Generated by Cython 0.19.1 on Mon Nov 3 12:27:16 2014

Raw output: nth_fib.c

 1: # Slow version:
 2: def nth_fib2(n):
/* "nth_fib.pyx":2
 * # Slow version:
 * def nth_fib2(n):             # <<<<<<<<<<<<<<
 *     a, b = 0, 1
 *     for i in range(n):
 */

static PyObject *__pyx_pf_7nth_fib_nth_fib2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_b = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nth_fib2", 0);

  /* "nth_fib.pyx":2
 * # Slow version:
 * def nth_fib2(n):             # <<<<<<<<<<<<<<
 *     a, b = 0, 1
 *     for i in range(n):
 */
  __pyx_k_tuple_1 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__n), ((PyObject *)__pyx_n_s__a), ((PyObject *)__pyx_n_s__b), ((PyObject *)__pyx_n_s__i)); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));

  /* "nth_fib.pyx":2
 * # Slow version:
 * def nth_fib2(n):             # <<<<<<<<<<<<<<
 *     a, b = 0, 1
 *     for i in range(n):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7nth_fib_1nth_fib2, NULL, __pyx_n_s__nth_fib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__nth_fib2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_codeobj_2 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_1, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_3, __pyx_n_s__nth_fib2, 2, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 3:     a, b = 0, 1
  /* "nth_fib.pyx":3
 * # Slow version:
 * def nth_fib2(n):
 *     a, b = 0, 1             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         b, a = a + b, b
 */
  __pyx_t_1 = __pyx_int_0;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_int_1;
  __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;
 4:     for i in range(n):
  /* "nth_fib.pyx":4
 * def nth_fib2(n):
 *     a, b = 0, 1
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         b, a = a + b, b
 *     return a
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_n);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n);
  __Pyx_GIVEREF(__pyx_v_n);
  __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_1;
    __pyx_t_1 = 0;
 5:         b, a = a + b, b
    /* "nth_fib.pyx":5
 *     a, b = 0, 1
 *     for i in range(n):
 *         b, a = a + b, b             # <<<<<<<<<<<<<<
 *     return a
 * 
 */
    __pyx_t_1 = PyNumber_Add(__pyx_v_a, __pyx_v_b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_b);
    __pyx_v_b = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_a);
    __pyx_v_a = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 6:     return a
  /* "nth_fib.pyx":6
 *     for i in range(n):
 *         b, a = a + b, b
 *     return a             # <<<<<<<<<<<<<<
 * 
 * # Fast Version:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_a);
  __pyx_r = __pyx_v_a;
  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_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("nth_fib.nth_fib2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7nth_fib_3nth_fib3(PyObject *__pyx_self, PyObject *__pyx_arg_n); /*proto*/
static PyMethodDef __pyx_mdef_7nth_fib_3nth_fib3 = {__Pyx_NAMESTR("nth_fib3"), (PyCFunction)__pyx_pw_7nth_fib_3nth_fib3, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7nth_fib_3nth_fib3(PyObject *__pyx_self, PyObject *__pyx_arg_n) {
  int __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nth_fib3 (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_AsInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("nth_fib.nth_fib3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nth_fib_2nth_fib3(__pyx_self, ((int)__pyx_v_n));
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 7: 
 8: # Fast Version:
 9: def nth_fib3(int n):
/* "nth_fib.pyx":9
 * 
 * # Fast Version:
 * def nth_fib3(int n):             # <<<<<<<<<<<<<<
 *     cdef int a = 0
 *     cdef int b = 1
 */

static PyObject *__pyx_pf_7nth_fib_2nth_fib3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n) {
  int __pyx_v_a;
  int __pyx_v_b;
  int __pyx_v_tmp;
  CYTHON_UNUSED int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nth_fib3", 0);

  /* "nth_fib.pyx":9
 * 
 * # Fast Version:
 * def nth_fib3(int n):             # <<<<<<<<<<<<<<
 *     cdef int a = 0
 *     cdef int b = 1
 */
  __pyx_k_tuple_4 = PyTuple_Pack(6, ((PyObject *)__pyx_n_s__n), ((PyObject *)__pyx_n_s__n), ((PyObject *)__pyx_n_s__a), ((PyObject *)__pyx_n_s__b), ((PyObject *)__pyx_n_s__tmp), ((PyObject *)__pyx_n_s__i)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_4);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));

  /* "nth_fib.pyx":9
 * 
 * # Fast Version:
 * def nth_fib3(int n):             # <<<<<<<<<<<<<<
 *     cdef int a = 0
 *     cdef int b = 1
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7nth_fib_3nth_fib3, NULL, __pyx_n_s__nth_fib); 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);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__nth_fib3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 10:     cdef int a = 0
  /* "nth_fib.pyx":10
 * # Fast Version:
 * def nth_fib3(int n):
 *     cdef int a = 0             # <<<<<<<<<<<<<<
 *     cdef int b = 1
 *     cdef int tmp
 */
  __pyx_v_a = 0;
 11:     cdef int b = 1
  /* "nth_fib.pyx":11
 * def nth_fib3(int n):
 *     cdef int a = 0
 *     cdef int b = 1             # <<<<<<<<<<<<<<
 *     cdef int tmp
 *     for i in range(n):
 */
  __pyx_v_b = 1;
 12:     cdef int tmp
 13:     for i in range(n):
  /* "nth_fib.pyx":13
 *     cdef int b = 1
 *     cdef int tmp
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         tmp = b
 *         b = a + b
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
 14:         tmp = b
    /* "nth_fib.pyx":14
 *     cdef int tmp
 *     for i in range(n):
 *         tmp = b             # <<<<<<<<<<<<<<
 *         b = a + b
 *         a = tmp
 */
    __pyx_v_tmp = __pyx_v_b;
 15:         b = a + b
    /* "nth_fib.pyx":15
 *     for i in range(n):
 *         tmp = b
 *         b = a + b             # <<<<<<<<<<<<<<
 *         a = tmp
 *     return a
 */
    __pyx_v_b = (__pyx_v_a + __pyx_v_b);
 16:         a = tmp
    /* "nth_fib.pyx":16
 *         tmp = b
 *         b = a + b
 *         a = tmp             # <<<<<<<<<<<<<<
 *     return a
 */
    __pyx_v_a = __pyx_v_tmp;
  }
 17:     return a
  /* "nth_fib.pyx":17
 *         b = a + b
 *         a = tmp
 *     return a             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_a); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nth_fib.nth_fib3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}