#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 */
typedef int int64_t;

/* Variables and functions */
int *malloc(int);
int /*<<< orphan*/ printf(char *, long long);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  int arr_i;
  int64_t sum = 0;
  int64_t *arr;
  int64_t *p;
  scanf("%d", &n);
  arr = malloc(n * sizeof(int64_t));
  p = arr;
  for (arr_i = 0; arr_i < n; arr_i++) {
    scanf("%lld", p);
    sum += *p;
    p++;
  }
  printf("%lld\n", (long long)sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ba <main+0x8a>
mov    -0x20(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <main+0x48>
movslq -0x10(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
xor    %r12d,%r12d
test   %ebx,%ebx
jle    1195 <main+0x65>
mov    %rax,%r14
lea    0xe99(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
movslq (%r14),%rax
movslq %ebx,%rbx
add    %rax,%rbx
add    $0x4,%r14
add    $0x1,%r12d
cmp    0x4(%rsp),%r12d
jl     1170 <main+0x40>
jmp    1197 <main+0x67>
xor    %ebx,%ebx
lea    0xe6a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [6 x i8] c"%lld\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
store i32 0, i32* %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 4
%11 = trunc i64 %10 to i32
%12 = call i32* @malloc(i32 %11)
store i32* %12, i32** %5
%13 = load i32*, i32** %5
store i32* %13, i32** %6
store i32 0, i32* %3
br label %14
14: ; preds = %27, %0
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %30
18: ; preds = %14
%19 = load i32*, i32** %6
%20 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = load i32, i32* %4
%24 = add nsw i32 %23, %22
store i32 %24, i32* %4
%25 = load i32*, i32** %6
%26 = getelementptr inbounds i32, i32* %25, i32 1
store i32* %26, i32** %6
br label %27
27: ; preds = %18
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %14
30: ; preds = %14
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %32)
ret i32 0
}

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