#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 sum(int *, int *);
int main(void) {
  int marbles[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  int answer = 0;
  answer = sum(marbles, marbles + 10);
  printf("answer=%lu \n", answer);
  printf("marbles+SIZES=%lu \n", marbles + 10);
  printf("marbles+SIZES=%lu \n", marbles + 10 + 1);
  printf("the size of marbles is %zd \n", sizeof marbles);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x30(%rbp),%rsi
add    $0x28,%rsi
call   1050 <sum@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
add    $0x28,%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
add    $0x28,%rsi
add    $0x4,%rsi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
mov    $0x28,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0xef2(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x28(%rsp),%r14
mov    %rsp,%rdi
mov    %r14,%rsi
call   1040 <sum@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec4(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x28,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.marbles = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.str = [13 x i8] c"answer=%lu \0A\00"
@.str.1 = [20 x i8] c"marbles+SIZES=%lu \0A\00"
@.str.2 = [29 x i8] c"the size of marbles is %zd \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
store i32 0, i32* %3
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = getelementptr inbounds i32, i32* %6, i64 10
%8 = call i32 @sum(i32* %5, i32* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%12 = getelementptr inbounds i32, i32* %11, i64 10
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%15 = getelementptr inbounds i32, i32* %14, i64 10
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i64 40)
ret i32 0
}

LLVM IR (-O2):
@__const.main.marbles = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.str = [13 x i8] c"answer=%lu \0A\00"
@.str.1 = [20 x i8] c"marbles+SIZES=%lu \0A\00"
@.str.2 = [29 x i8] c"the size of marbles is %zd \0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 10
%5 = call i32 @sum(i32* %3, i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 11
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i64 40)
ret i32 0
}