#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*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int a, b, sum, n, i;
  while (scanf("%d", &n) != EOF) {
    sum = 0;
    for (i = 1; i <= n; i++) {
      scanf("%d", &a);
      sum = sum + a;
    }
    printf("%d\n", sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%rax
je     11a4 <main+0x84>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1190 <main+0x70>
lea    0xe90(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115d <main+0x3d>
mov    -0x10(%rbp),%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    0x2ea7(%rip),%r13
cmp    0x0(%r13),%rax
jne    1158 <main+0x38>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea1(%rip),%rbx
mov    %rsp,%r15
lea    0x4(%rsp),%r12
jmp    1191 <main+0x71>
nopl   0x0(%rax)
xor    %ebp,%ebp
lea    0xe8a(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
cmp    0x0(%r13),%rax
je     1147 <main+0x27>
cmpl   $0x0,(%rsp)
jle    1170 <main+0x50>
xor    %r14d,%r14d
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
add    0x4(%rsp),%ebp
add    $0x1,%r14d
cmp    (%rsp),%r14d
jl     11a0 <main+0x80>
jmp    1172 <main+0x52>

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

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