#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);
long sum(int *, int);
int main(int argc, char const *argv[]) {
  int marbles[10] = {20, 10, 5, 39, 4, 16, 19, 26, 31, 20};
  long answer;
  answer = sum(marbles, 10);
  printf("The total number of marbles is %ld.", answer);
  printf("The size of marbles is %zd bytes.\n", sizeof marbles);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1050 <sum@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %eax,%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x28,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <sum@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x28,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.marbles = [10 x i32] [i32 20, i32 10, i32 5, i32 39, i32 4, i32 16, i32 19, i32 26, i32 31, i32 20]
@.str = [36 x i8] c"The total number of marbles is %ld.\00"
@.str.1 = [35 x i8] c"The size of marbles is %zd bytes.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [10 x i32]* %6 to i8*
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%10 = call i64 @sum(i32* %9, i32 10)
store i64 %10, i64* %7
%11 = load i64, i64* %7
%12 = trunc i64 %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 40)
ret i32 0
}

LLVM IR (-O2):
@__const.main.marbles = [10 x i32] [i32 20, i32 10, i32 5, i32 39, i32 4, i32 16, i32 19, i32 26, i32 31, i32 20]
@.str = [36 x i8] c"The total number of marbles is %ld.\00"
@.str.1 = [35 x i8] c"The size of marbles is %zd bytes.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i64 @sum(i32* %5, i32 10)
%7 = trunc i64 %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 40)
ret i32 0
}