#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double floor(int);
double log(double);
double sqrt(double);
double nonfibonacci(int n) {
  double sqrt5;
  double lphi;
  double phi;
  double dn;
  double a;
  double b;
  phi = 1.618033988749895;
  lphi = log(phi);
  sqrt5 = sqrt(5.0);
  dn = (double)n + 1;
  a = log(dn * sqrt5) / lphi;
  b = (sqrt5 * (dn + a)) - 5.0 + (3.0 / dn);
  return floor(n + (log(b) / lphi) - 2.0);
}


x86 assembly (clang, -O0):
<nonfibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movsd  0xee5(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xec1(%rip),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe49(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe06(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <floor@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonfibonacci>:
sub    $0x18,%rsp
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xeca(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  0xebc(%rip),%xmm0
call   1030 <log@plt>
divsd  0xeb7(%rip),%xmm0
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm0
mulsd  0xe9d(%rip),%xmm0
addsd  0xea5(%rip),%xmm0
movsd  0xea5(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1030 <log@plt>
divsd  0xe80(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0xe8a(%rip),%xmm0
cvttsd2si %xmm0,%edi
add    $0x18,%rsp
jmp    1040 <floor@plt>

LLVM IR (-O0):
define double @nonfibonacci(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %2
store double 0x3FF9E3779B97F4A8, double* %5
%9 = load double, double* %5
%10 = call double @log(double %9)
store double %10, double* %4
%11 = call double @sqrt(double 5.000000e+00)
store double %11, double* %3
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = fadd double %13, 1.000000e+00
store double %14, double* %6
%15 = load double, double* %6
%16 = load double, double* %3
%17 = fmul double %15, %16
%18 = call double @log(double %17)
%19 = load double, double* %4
%20 = fdiv double %18, %19
store double %20, double* %7
%21 = load double, double* %3
%22 = load double, double* %6
%23 = load double, double* %7
%24 = fadd double %22, %23
%25 = call double @llvm.fmuladd.f64(double %21, double %24, double -5.000000e+00)
%26 = load double, double* %6
%27 = fdiv double 3.000000e+00, %26
%28 = fadd double %25, %27
store double %28, double* %8
%29 = load i32, i32* %2
%30 = sitofp i32 %29 to double
%31 = load double, double* %8
%32 = call double @log(double %31)
%33 = load double, double* %4
%34 = fdiv double %32, %33
%35 = fadd double %30, %34
%36 = fsub double %35, 2.000000e+00
%37 = fptosi double %36 to i32
%38 = call double @floor(i32 %37)
ret double %38
}

LLVM IR (-O2):
define double @nonfibonacci(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fadd double %2, 1.000000e+00
%4 = fmul double %3, 0x4001E3779B97F4A8
%5 = tail call double @log(double %4)
%6 = fdiv double %5, 0x3FDECC2CAEC5160A
%7 = fadd double %3, %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x4001E3779B97F4A8, double -5.000000e+00)
%9 = fdiv double 3.000000e+00, %3
%10 = fadd double %9, %8
%11 = tail call double @log(double %10)
%12 = fdiv double %11, 0x3FDECC2CAEC5160A
%13 = fadd double %12, %2
%14 = fadd double %13, -2.000000e+00
%15 = fptosi double %14 to i32
%16 = tail call double @floor(i32 %15)
ret double %16
}