#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 *, long);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int a, i;
  scanf("%d", &a);
  long int arr[a], c = 0;
  for (i = 0; i < a; i++) {
    scanf("%ld", &arr[i]);
    c = c + arr[i];
  }
  printf("%ld\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c2 <main+0xa2>
mov    -0x30(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rdx
add    (%rcx,%rdx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1177 <main+0x57>
mov    -0x28(%rbp),%rsi
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xecb(%rip),%rdi
xor    %r14d,%r14d
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    1192 <main+0x72>
lea    0xe98(%rip),%r15
xor    %ebx,%ebx
xor    %r14d,%r14d
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    0x0(%r13),%r14
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0x8,%r13
cmp    %rax,%rbx
jl     1170 <main+0x50>
lea    0xe6e(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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