#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 */
scalar_t__ EOF;
int /*<<< orphan*/ print(int *, int);
int /*<<< orphan*/ printf(char *, int);
int rob(int *, int);
scalar_t__ scanf(char *, int *);
int main(int argc, char **argv) {
  int a[20], n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; ++i)
      scanf("%d", &a[i]);
    print(a, n);
    printf("result = %d\n", rob(a, n));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x64(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%rax
je     11dd <main+0x9d>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    11b2 <main+0x72>
movslq -0x68(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe61(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    117d <main+0x3d>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1040 <print@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1060 <rob@plt>
mov    %eax,%esi
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%rax
jne    117c <main+0x3c>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%r14
lea    0xe78(%rip),%r13
lea    0xe74(%rip),%r15
lea    0xc(%rsp),%r12
jmp    11d5 <main+0x95>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <print@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
call   1060 <rob@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x2e18(%rip),%rcx
cmp    (%rcx),%rax
je     116b <main+0x2b>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11a0 <main+0x60>
mov    %r14,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rsi
add    $0x4,%rbx
cmp    %rsi,%rbp
jl     11f0 <main+0xb0>
jmp    11a0 <main+0x60>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [13 x i8] c"result = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %9
9: ; preds = %26, %2
%10 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %34
13: ; preds = %9
store i32 0, i32* %8
br label %14
14: ; preds = %23, %13
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 %20
%22 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
br label %23
23: ; preds = %18
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %14
26: ; preds = %14
%27 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%28 = load i32, i32* %7
%29 = call i32 @print(i32* %27, i32 %28)
%30 = getelementptr inbounds [20 x i32], [20 x i32]* %6, i64 0, i64 0
%31 = load i32, i32* %7
%32 = call i32 @rob(i32* %30, i32 %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %9
34: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [13 x i8] c"result = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i32]
%4 = alloca i32
%5 = bitcast [20 x i32]* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %32, label %10
10: ; preds = %2
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
br label %12
12: ; preds = %10, %15
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %24, %12
%16 = phi i32 [ %13, %12 ], [ %29, %24 ]
%17 = call i32 @print(i32* %11, i32 %16)
%18 = load i32, i32* %4
%19 = call i32 @rob(i32* %11, i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%22 = load i64, i64* @EOF
%23 = icmp eq i64 %21, %22
br i1 %23, label %32, label %12
24: ; preds = %12, %24
%25 = phi i64 [ %28, %24 ], [ 0, %12 ]
%26 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %25
%27 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %26)
%28 = add nuw nsw i64 %25, 1
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %24, label %15
32: ; preds = %15, %2
ret i32 0
}