#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*/ fastMatPow(int **, long long, int, int **);
int computeNumCallFibo(long long int n, int mod) {
  if (n < 2)
    return 1;
  int matFibo[3][3] = {{1, 1, 1}, {1, 0, 0}, {0, 0, 1}}, powMat[3][3];
  fastMatPow(matFibo, n - 1, mod, powMat);
  return (powMat[0][0] + powMat[0][1] + powMat[0][2]) % mod;
}


x86 assembly (clang, -O0):
<computeNumCallFibo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x2,-0x10(%rbp)
jge    1146 <computeNumCallFibo+0x26>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <computeNumCallFibo+0x81>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
movl   $0x1,-0x40(%rbp)
movl   $0x1,-0x3c(%rbp)
movl   $0x1,-0x38(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x1,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
sub    $0x1,%rsi
mov    -0x14(%rbp),%edx
lea    -0x70(%rbp),%rcx
call   1030 <fastMatPow@plt>
mov    -0x70(%rbp),%eax
add    -0x6c(%rbp),%eax
add    -0x68(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeNumCallFibo>:
mov    $0x1,%eax
cmp    $0x2,%rdi
jl     1169 <computeNumCallFibo+0x59>
push   %rbx
sub    $0x60,%rsp
mov    %esi,%ebx
mov    %rdi,%rsi
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movl   $0x1,0x50(%rsp)
add    $0xffffffffffffffff,%rsi
lea    0x30(%rsp),%rdi
mov    %rsp,%rcx
mov    %ebx,%edx
call   1030 <fastMatPow@plt>
mov    0x4(%rsp),%eax
add    (%rsp),%eax
add    0x8(%rsp),%eax
cltd
idiv   %ebx
mov    %edx,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @computeNumCallFibo(i64 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca [3 x [3 x i32]]
%7 = alloca [3 x [3 x i32]]
store i64 %0, i64* %4
store i32 %1, i32* %5
%8 = load i64, i64* %4
%9 = icmp slt i64 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %43
11: ; preds = %2
%12 = bitcast [3 x [3 x i32]]* %6 to i8*
%13 = bitcast i8* %12 to [3 x [3 x i32]]*
%14 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %13, i32 0, i32 0
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %14, i32 0, i32 0
store i32 1, i32* %15
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %14, i32 0, i32 1
store i32 1, i32* %16
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %14, i32 0, i32 2
store i32 1, i32* %17
%18 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %13, i32 0, i32 1
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %18, i32 0, i32 0
store i32 1, i32* %19
%20 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %13, i32 0, i32 2
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %20, i32 0, i32 2
store i32 1, i32* %21
%22 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 0
%23 = bitcast [3 x i32]* %22 to i32**
%24 = load i64, i64* %4
%25 = sub nsw i64 %24, 1
%26 = load i32, i32* %5
%27 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %7, i64 0, i64 0
%28 = bitcast [3 x i32]* %27 to i32**
%29 = call i32 @fastMatPow(i32** %23, i64 %25, i32 %26, i32** %28)
%30 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %7, i64 0, i64 0
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %30, i64 0, i64 0
%32 = load i32, i32* %31
%33 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %7, i64 0, i64 0
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %33, i64 0, i64 1
%35 = load i32, i32* %34
%36 = add nsw i32 %32, %35
%37 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %7, i64 0, i64 0
%38 = getelementptr inbounds [3 x i32], [3 x i32]* %37, i64 0, i64 2
%39 = load i32, i32* %38
%40 = add nsw i32 %36, %39
%41 = load i32, i32* %5
%42 = srem i32 %40, %41
store i32 %42, i32* %3
br label %43
43: ; preds = %11, %10
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
define i32 @computeNumCallFibo(i64 %0, i32 %1) {
%3 = alloca [3 x [3 x i32]]
%4 = alloca [3 x [3 x i32]]
%5 = icmp slt i64 %0, 2
br i1 %5, label %26, label %6
6: ; preds = %2
%7 = bitcast [3 x [3 x i32]]* %3 to i8*
%8 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 1, i64 1
%9 = bitcast i32* %8 to i8*
%10 = bitcast [3 x [3 x i32]]* %3 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %10
%11 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 2, i64 2
store i32 1, i32* %11
%12 = bitcast [3 x [3 x i32]]* %4 to i8*
%13 = bitcast [3 x [3 x i32]]* %3 to i32**
%14 = add nsw i64 %0, -1
%15 = bitcast [3 x [3 x i32]]* %4 to i32**
%16 = call i32 @fastMatPow(i32** %13, i64 %14, i32 %1, i32** %15)
%17 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %4, i64 0, i64 0, i64 0
%18 = load i32, i32* %17
%19 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %4, i64 0, i64 0, i64 1
%20 = load i32, i32* %19
%21 = add nsw i32 %20, %18
%22 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %4, i64 0, i64 0, i64 2
%23 = load i32, i32* %22
%24 = add nsw i32 %21, %23
%25 = srem i32 %24, %1
br label %26
26: ; preds = %2, %6
%27 = phi i32 [ %25, %6 ], [ 1, %2 ]
ret i32 %27
}