Skip to content

Instantly share code, notes, and snippets.

@bobpoekert
Created August 31, 2013 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobpoekert/6401102 to your computer and use it in GitHub Desktop.
Save bobpoekert/6401102 to your computer and use it in GitHub Desktop.
static PyObject *__pyx_pf_4test_fib(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n) {
PyObject *__pyx_v_SZ = NULL;
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_a = NULL;
PyObject *__pyx_v_b = NULL;
PyObject *__pyx_v_t = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fib", 0);
/* "test.pyx":2
* def fib(n):
* SZ = 2**64 # <<<<<<<<<<<<<<
* i = 0
* a, b = 1, 0
*/
__Pyx_INCREF(__pyx_int_18446744073709551616);
__pyx_v_SZ = __pyx_int_18446744073709551616;
/* "test.pyx":3
* def fib(n):
* SZ = 2**64
* i = 0 # <<<<<<<<<<<<<<
* a, b = 1, 0
* while i < n:
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_v_i = __pyx_int_0;
/* "test.pyx":4
* SZ = 2**64
* i = 0
* a, b = 1, 0 # <<<<<<<<<<<<<<
* while i < n:
* t = b
*/
__pyx_t_1 = __pyx_int_1;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __pyx_int_0;
__Pyx_INCREF(__pyx_t_2);
__pyx_v_a = __pyx_t_1;
__pyx_t_1 = 0;
__pyx_v_b = __pyx_t_2;
__pyx_t_2 = 0;
/* "test.pyx":5
* i = 0
* a, b = 1, 0
* while i < n: # <<<<<<<<<<<<<<
* t = b
* b = (b+a) % SZ
*/
while (1) {
__pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_n, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (!__pyx_t_3) break;
/* "test.pyx":6
* a, b = 1, 0
* while i < n:
* t = b # <<<<<<<<<<<<<<
* b = (b+a) % SZ
* a = t
*/
__Pyx_INCREF(__pyx_v_b);
__Pyx_XDECREF(__pyx_v_t);
__pyx_v_t = __pyx_v_b;
/* "test.pyx":7
* while i < n:
* t = b
* b = (b+a) % SZ # <<<<<<<<<<<<<<
* a = t
* i = i + 1
*/
__pyx_t_2 = PyNumber_Add(__pyx_v_b, __pyx_v_a); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyNumber_Remainder(__pyx_t_2, __pyx_v_SZ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_t_1;
__pyx_t_1 = 0;
/* "test.pyx":8
* t = b
* b = (b+a) % SZ
* a = t # <<<<<<<<<<<<<<
* i = i + 1
* return b
*/
__Pyx_INCREF(__pyx_v_t);
__Pyx_DECREF(__pyx_v_a);
__pyx_v_a = __pyx_v_t;
/* "test.pyx":9
* b = (b+a) % SZ
* a = t
* i = i + 1 # <<<<<<<<<<<<<<
* return b
*/
__pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_1;
__pyx_t_1 = 0;
}
/* "test.pyx":10
* a = t
* i = i + 1
* return b # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_b);
__pyx_r = __pyx_v_b;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("test.fib", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_SZ);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_a);
__Pyx_XDECREF(__pyx_v_b);
__Pyx_XDECREF(__pyx_v_t);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment