#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long long findKthFibonacci(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, long long);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, long long *);
int main(void) {
  FILE *fin, *fout;
  int i, j;
  long long int n;
  fin = fopen("kfib.in", "r");
  fout = fopen("kfib.out", "w");
  fscanf(fin, "%lld", &n);
  long long int fn = findKthFibonacci(2707124);
  fprintf(fout, "%lld", fn);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe9d(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8d(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <fscanf@plt>
mov    $0x294eb4,%edi
call   1060 <findKthFibonacci@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe67(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb0(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xea4(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
lea    0xe99(%rip),%r15
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <fscanf@plt>
mov    $0x294eb4,%edi
call   1060 <findKthFibonacci@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"kfib.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"kfib.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [5 x i8] c"%lld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %1
%8 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %2
%9 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %9, i32** %3
%10 = load i32*, i32** %2
%11 = call i32 @fscanf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64* %6)
%12 = call i64 @findKthFibonacci(i32 2707124)
store i64 %12, i64* %7
%13 = load i32*, i32** %3
%14 = load i64, i64* %7
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"kfib.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"kfib.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [5 x i8] c"%lld\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64* %1)
%6 = call i64 @findKthFibonacci(i32 2707124)
%7 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %6)
ret i32 0
}