#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int numOfLines = 15;
  int n;
  int arr[15];
  int i;
  for (i = 0; i < numOfLines; i++) {
    scanf("%d ", &n);
    arr[i] = n;
  }
  numOfLines--;
  while (numOfLines > 0) {
    for (i = 0; i < numOfLines; i++) {
      scanf("%d ", &n);
      arr[i] = n + (arr[i] > arr[i + 1] ? arr[i] : arr[i + 1]);
    }
    numOfLines--;
  }
  printf("sum: %d\n", arr[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1172 <main+0x52>
lea    0xeb0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    113d <main+0x1d>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1214 <main+0xf4>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1206 <main+0xe6>
lea    0xe61(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x58(%rbp)
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
jle    11d9 <main+0xb9>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    %eax,-0x5c(%rbp)
jmp    11e8 <main+0xc8>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%ecx
mov    -0x5c(%rbp),%eax
add    %eax,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    118c <main+0x6c>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    117b <main+0x5b>
mov    -0x50(%rbp),%esi
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xece(%rip),%r14
lea    0xc(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x1c(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x20(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x24(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x28(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x2c(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x30(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x34(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x38(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x3c(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x40(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x44(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x48(%rsp)
mov    $0xe,%r12d
nopw   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x10(%rsp,%rbx,4),%eax
mov    0x14(%rsp,%rbx,4),%ecx
cmp    %ecx,%eax
cmovg  %eax,%ecx
add    0xc(%rsp),%ecx
mov    %ecx,0x10(%rsp,%rbx,4)
lea    0x1(%rbx),%rax
mov    %rax,%rbx
cmp    %rax,%r12
jne    1270 <main+0x150>
lea    -0x1(%r12),%rax
cmp    $0x1,%r12
mov    %rax,%r12
ja     1260 <main+0x140>
mov    0x10(%rsp),%esi
lea    0xd4f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [9 x i8] c"sum: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [15 x i32]
%5 = alloca i32
store i32 0, i32* %1
store i32 15, i32* %2
store i32 0, i32* %5
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %5
%8 = load i32, i32* %2
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %10
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %6
19: ; preds = %6
%20 = load i32, i32* %2
%21 = add nsw i32 %20, -1
store i32 %21, i32* %2
br label %22
22: ; preds = %63, %19
%23 = load i32, i32* %2
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %66
25: ; preds = %22
store i32 0, i32* %5
br label %26
26: ; preds = %60, %25
%27 = load i32, i32* %5
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %63
30: ; preds = %26
%31 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%32 = load i32, i32* %3
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = icmp sgt i32 %36, %41
br i1 %42, label %43, label %48
43: ; preds = %30
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %45
%47 = load i32, i32* %46
br label %54
48: ; preds = %30
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %51
%53 = load i32, i32* %52
br label %54
54: ; preds = %48, %43
%55 = phi i32 [ %47, %43 ], [ %53, %48 ]
%56 = add nsw i32 %32, %55
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %58
store i32 %56, i32* %59
br label %60
60: ; preds = %54
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %26
63: ; preds = %26
%64 = load i32, i32* %2
%65 = add nsw i32 %64, -1
store i32 %65, i32* %2
br label %22
66: ; preds = %22
%67 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 0
%68 = load i32, i32* %67
%69 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %68)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [9 x i8] c"sum: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [15 x i32]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 0
store i32 %6, i32* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 1
store i32 %9, i32* %10
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 2
store i32 %12, i32* %13
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 3
store i32 %15, i32* %16
%17 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 4
store i32 %18, i32* %19
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 5
store i32 %21, i32* %22
%23 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%24 = load i32, i32* %1
%25 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 6
store i32 %24, i32* %25
%26 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%27 = load i32, i32* %1
%28 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 7
store i32 %27, i32* %28
%29 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%30 = load i32, i32* %1
%31 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 8
store i32 %30, i32* %31
%32 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%33 = load i32, i32* %1
%34 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 9
store i32 %33, i32* %34
%35 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%36 = load i32, i32* %1
%37 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 10
store i32 %36, i32* %37
%38 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%39 = load i32, i32* %1
%40 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 11
store i32 %39, i32* %40
%41 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%42 = load i32, i32* %1
%43 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 12
store i32 %42, i32* %43
%44 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%45 = load i32, i32* %1
%46 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 13
store i32 %45, i32* %46
%47 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%48 = load i32, i32* %1
%49 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 14
store i32 %48, i32* %49
br label %50
50: ; preds = %65, %0
%51 = phi i64 [ 14, %0 ], [ %66, %65 ]
br label %52
52: ; preds = %50, %52
%53 = phi i64 [ 0, %50 ], [ %58, %52 ]
%54 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%55 = load i32, i32* %1
%56 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 %53
%57 = load i32, i32* %56
%58 = add nuw nsw i64 %53, 1
%59 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = icmp sgt i32 %57, %60
%62 = select i1 %61, i32 %57, i32 %60
%63 = add nsw i32 %62, %55
store i32 %63, i32* %56
%64 = icmp eq i64 %58, %51
br i1 %64, label %65, label %52
65: ; preds = %52
%66 = add nsw i64 %51, -1
%67 = icmp ugt i64 %51, 1
br i1 %67, label %50, label %68
68: ; preds = %65
%69 = load i32, i32* %7
%70 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %69)
ret i32 0
}