#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*/ printf(char *, int);
int rob(int *, int);
int main(void) {
  int arr1[] = {1, 3, 2, 4, 5, 8, 7};
  int arr2[] = {1, 1, 1};
  int arr3[] = {0};
  printf("%d\n", rob(arr1, 7));
  printf("%d\n", rob(arr2, 3));
  printf("%d\n", rob(arr3, 1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x2c(%rbp)
mov    0xeaa(%rip),%eax
mov    %eax,-0x24(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1050 <rob@plt>
mov    %eax,%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
lea    -0x2c(%rbp),%rdi
mov    $0x3,%esi
call   1050 <rob@plt>
mov    %eax,%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x1,%esi
call   1050 <rob@plt>
mov    %eax,%esi
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movups 0xee0(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xee1(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xece(%rip),%rax
mov    %rax,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x7,%esi
call   1040 <rob@plt>
lea    0xeb7(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
call   1040 <rob@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
call   1040 <rob@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr1 = [7 x i32] [i32 1, i32 3, i32 2, i32 4, i32 5, i32 8, i32 7]
@__const.main.arr2 = [3 x i32] [i32 1, i32 1, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca [3 x i32]
%4 = alloca [1 x i32]
store i32 0, i32* %1
%5 = bitcast [7 x i32]* %2 to i8*
%6 = bitcast [3 x i32]* %3 to i8*
%7 = bitcast [1 x i32]* %4 to i8*
%8 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%9 = call i32 @rob(i32* %8, i32 7)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%12 = call i32 @rob(i32* %11, i32 3)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [1 x i32], [1 x i32]* %4, i64 0, i64 0
%15 = call i32 @rob(i32* %14, i32 1)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr1 = [7 x i32] [i32 1, i32 3, i32 2, i32 4, i32 5, i32 8, i32 7]
@__const.main.arr2 = [3 x i32] [i32 1, i32 1, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = alloca [3 x i32]
%3 = alloca [1 x i32]
%4 = bitcast [7 x i32]* %1 to i8*
%5 = bitcast [3 x i32]* %2 to i8*
%6 = bitcast [1 x i32]* %3 to i8*
%7 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
store i32 0, i32* %7
%8 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%9 = call i32 @rob(i32* %8, i32 7)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%12 = call i32 @rob(i32* %11, i32 3)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @rob(i32* %7, i32 1)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}