#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 */
int /*<<< orphan*/ power(long long **, long long);
long long int fibo(long long int n) {
  long long int arr[2][2];
  long long int temp[2][2] = {{0}};
  arr[0][0] = arr[0][1] = arr[1][0] = 1;
  arr[1][1] = 0;
  power(arr, n);
  return arr[1][0] % 1000000007;
}


x86 assembly (clang, -O0):
<fibo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
movq   $0x1,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
movq   $0x1,-0x30(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <power@plt>
mov    -0x20(%rbp),%rax
mov    $0x3b9aca07,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibo>:
sub    $0x28,%rsp
mov    %rdi,%rsi
movaps 0xee2(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rsp,%rdi
call   1030 <power@plt>
mov    0x10(%rsp),%rcx
movabs $0x89705f3112a28fe5,%rdx
5f 70 89
mov    %rcx,%rax
imul   %rdx
add    %rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x1d,%rdx
add    %rax,%rdx
imul   $0x3b9aca07,%rdx,%rax
sub    %rax,%rcx
mov    %rcx,%rax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i64 @fibo(i64 %0) {
%2 = alloca i64
%3 = alloca [2 x [2 x i64]]
%4 = alloca [2 x [2 x i64]]
store i64 %0, i64* %2
%5 = bitcast [2 x [2 x i64]]* %4 to i8*
%6 = getelementptr inbounds [2 x [2 x i64]], [2 x [2 x i64]]* %3, i64 0, i64 1
%7 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 0
store i64 1, i64* %7
%8 = getelementptr inbounds [2 x [2 x i64]], [2 x [2 x i64]]* %3, i64 0, i64 0
%9 = getelementptr inbounds [2 x i64], [2 x i64]* %8, i64 0, i64 1
store i64 1, i64* %9
%10 = getelementptr inbounds [2 x [2 x i64]], [2 x [2 x i64]]* %3, i64 0, i64 0
%11 = getelementptr inbounds [2 x i64], [2 x i64]* %10, i64 0, i64 0
store i64 1, i64* %11
%12 = getelementptr inbounds [2 x [2 x i64]], [2 x [2 x i64]]* %3, i64 0, i64 1
%13 = getelementptr inbounds [2 x i64], [2 x i64]* %12, i64 0, i64 1
store i64 0, i64* %13
%14 = getelementptr inbounds [2 x [2 x i64]], [2 x [2 x i64]]* %3, i64 0, i64 0
%15 = bitcast [2 x i64]* %14 to i64**
%16 = load i64, i64* %2
%17 = call i32 @power(i64** %15, i64 %16)
%18 = getelementptr inbounds [2 x [2 x i64]], [2 x [2 x i64]]* %3, i64 0, i64 1
%19 = getelementptr inbounds [2 x i64], [2 x i64]* %18, i64 0, i64 0
%20 = load i64, i64* %19
%21 = srem i64 %20, 1000000007
ret i64 %21
}

LLVM IR (-O2):
define i64 @fibo(i64 %0) {
%2 = alloca [2 x [2 x i64]]
%3 = bitcast [2 x [2 x i64]]* %2 to i8*
%4 = getelementptr inbounds [2 x [2 x i64]], [2 x [2 x i64]]* %2, i64 0, i64 1, i64 0
%5 = bitcast [2 x [2 x i64]]* %2 to <2 x i64>*
store <2 x i64> <i64 1, i64 1>, <2 x i64>* %5
%6 = bitcast i64* %4 to <2 x i64>*
store <2 x i64> <i64 1, i64 0>, <2 x i64>* %6
%7 = bitcast [2 x [2 x i64]]* %2 to i64**
%8 = call i32 @power(i64** %7, i64 %0)
%9 = load i64, i64* %4
%10 = srem i64 %9, 1000000007
ret i64 %10
}