#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*/ MatrixM(int *, int *);
int powe(int *x, int n) {
  int y[] = {1, 0, 0, 1};
  int i;
  while (n > 0) {
    if (n % 2 != 0) {
      MatrixM(y, x);
    }
    MatrixM(x, x);
    n = n / 2;
  }
  return y[2];
}


x86 assembly (clang, -O0):
<powe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1180 <powe+0x70>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1160 <powe+0x50>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <MatrixM@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <MatrixM@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1135 <powe+0x25>
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<powe>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movaps 0xee1(%rip),%xmm0
movaps %xmm0,(%rsp)
test   %esi,%esi
jle    116f <powe+0x5f>
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%r14
jmp    1156 <powe+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1030 <MatrixM@plt>
mov    %ebp,%eax
shr    %eax
cmp    $0x1,%ebp
mov    %eax,%ebp
jbe    1169 <powe+0x59>
test   $0x1,%bpl
je     1140 <powe+0x30>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <MatrixM@plt>
jmp    1140 <powe+0x30>
mov    0x8(%rsp),%eax
jmp    1171 <powe+0x61>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.powe.y = [4 x i32] [i32 1, i32 0, i32 0, i32 1]
define i32 @powe(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [4 x i32]
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = bitcast [4 x i32]* %5 to i8*
br label %8
8: ; preds = %19, %2
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32, i32* %4
%13 = srem i32 %12, 2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%17 = load i32*, i32** %3
%18 = call i32 @MatrixM(i32* %16, i32* %17)
br label %19
19: ; preds = %15, %11
%20 = load i32*, i32** %3
%21 = load i32*, i32** %3
%22 = call i32 @MatrixM(i32* %20, i32* %21)
%23 = load i32, i32* %4
%24 = sdiv i32 %23, 2
store i32 %24, i32* %4
br label %8
25: ; preds = %8
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 2
%27 = load i32, i32* %26
ret i32 %27
}

LLVM IR (-O2):
@__const.powe.y = [4 x i32] [i32 1, i32 0, i32 0, i32 1]
define i32 @powe(i32* %0, i32 %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %21
6: ; preds = %2
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
br label %8
8: ; preds = %6, %14
%9 = phi i32 [ %1, %6 ], [ %16, %14 ]
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @MatrixM(i32* %7, i32* %0)
br label %14
14: ; preds = %12, %8
%15 = call i32 @MatrixM(i32* %0, i32* %0)
%16 = lshr i32 %9, 1
%17 = icmp ult i32 %9, 2
br i1 %17, label %18, label %8
18: ; preds = %14
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
%20 = load i32, i32* %19
br label %21
21: ; preds = %18, %2
%22 = phi i32 [ %20, %18 ], [ 0, %2 ]
ret i32 %22
}