#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*/ csum(long *, long *, int);
int /*<<< orphan*/ fill(long *, int);
long *malloc(int);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ random_fill(long *, int);
int main(void) {
  long *arr = malloc(sizeof(*arr) * 100000);
  long *out = malloc(sizeof(*out) * 100000);
  long *other = malloc(sizeof(*other) * 1000);
  fill(arr, 100000);
  random_fill(other, 1000);
  csum(arr, out, 100000);
  printf("%ld\n", out[45]);
  printf("%d\n", other[576]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc3500,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0xc3500,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1f40,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x186a0,%esi
call   1050 <fill@plt>
mov    -0x20(%rbp),%rdi
mov    $0x3e8,%esi
call   1070 <random_fill@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x186a0,%edx
call   1030 <csum@plt>
mov    -0x18(%rbp),%rax
mov    0x168(%rax),%rsi
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
mov    0x1200(%rax),%rsi
lea    0xe25(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0xc3500,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0xc3500,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x1f40,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x186a0,%esi
call   1050 <fill@plt>
mov    %r15,%rdi
mov    $0x3e8,%esi
call   1070 <random_fill@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x186a0,%edx
call   1030 <csum@plt>
mov    0x168(%r14),%rsi
lea    0xe4c(%rip),%rdi
call   1040 <printf@plt>
mov    0x1200(%r15),%rsi
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64*
%3 = alloca i64*
%4 = alloca i64*
store i32 0, i32* %1
%5 = call i64* @malloc(i32 800000)
store i64* %5, i64** %2
%6 = call i64* @malloc(i32 800000)
store i64* %6, i64** %3
%7 = call i64* @malloc(i32 8000)
store i64* %7, i64** %4
%8 = load i64*, i64** %2
%9 = call i32 @fill(i64* %8, i32 100000)
%10 = load i64*, i64** %4
%11 = call i32 @random_fill(i64* %10, i32 1000)
%12 = load i64*, i64** %2
%13 = load i64*, i64** %3
%14 = call i32 @csum(i64* %12, i64* %13, i32 100000)
%15 = load i64*, i64** %3
%16 = getelementptr inbounds i64, i64* %15, i64 45
%17 = load i64, i64* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %17)
%19 = load i64*, i64** %4
%20 = getelementptr inbounds i64, i64* %19, i64 576
%21 = load i64, i64* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i64* @malloc(i32 800000)
%2 = tail call i64* @malloc(i32 800000)
%3 = tail call i64* @malloc(i32 8000)
%4 = tail call i32 @fill(i64* %1, i32 100000)
%5 = tail call i32 @random_fill(i64* %3, i32 1000)
%6 = tail call i32 @csum(i64* %1, i64* %2, i32 100000)
%7 = getelementptr inbounds i64, i64* %2, i64 45
%8 = load i64, i64* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %8)
%10 = getelementptr inbounds i64, i64* %3, i64 576
%11 = load i64, i64* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %11)
ret i32 0
}