#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 */
struct NumArray {
  int dummy;
};

/* Variables and functions */
struct NumArray *NumArrayCreate(int *, int);
int /*<<< orphan*/ NumArrayFree(struct NumArray *);
int /*<<< orphan*/ sumRange(struct NumArray *, int, int);
int main(int argc, char *argv[]) {
  int nums[] = {-2, 0, 3, -5, 2, -1};
  struct NumArray *numArray = NumArrayCreate(nums, 6);
  sumRange(numArray, 0, 2);
  sumRange(numArray, 2, 5);
  sumRange(numArray, 0, 5);
  NumArrayFree(numArray);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x6,%esi
call   1040 <NumArrayCreate@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <sumRange@plt>
mov    -0x38(%rbp),%rdi
mov    $0x2,%esi
mov    $0x5,%edx
call   1030 <sumRange@plt>
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1030 <sumRange@plt>
mov    -0x38(%rbp),%rdi
call   1050 <NumArrayFree@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
call   1040 <NumArrayCreate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <sumRange@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x5,%edx
call   1030 <sumRange@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1030 <sumRange@plt>
mov    %rbx,%rdi
call   1050 <NumArrayFree@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.NumArray = type { i32 }
@__const.main.nums = [6 x i32] [i32 -2, i32 0, i32 3, i32 -5, i32 2, i32 -1]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [6 x i32]
%6 = alloca %struct.NumArray*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = bitcast [6 x i32]* %5 to i8*
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%9 = call %struct.NumArray* @NumArrayCreate(i32* %8, i32 6)
store %struct.NumArray* %9, %struct.NumArray** %6
%10 = load %struct.NumArray*, %struct.NumArray** %6
%11 = call i32 @sumRange(%struct.NumArray* %10, i32 0, i32 2)
%12 = load %struct.NumArray*, %struct.NumArray** %6
%13 = call i32 @sumRange(%struct.NumArray* %12, i32 2, i32 5)
%14 = load %struct.NumArray*, %struct.NumArray** %6
%15 = call i32 @sumRange(%struct.NumArray* %14, i32 0, i32 5)
%16 = load %struct.NumArray*, %struct.NumArray** %6
%17 = call i32 @NumArrayFree(%struct.NumArray* %16)
ret i32 0
}

LLVM IR (-O2):
%struct.NumArray = type { i32 }
@__const.main.nums = [6 x i32] [i32 -2, i32 0, i32 3, i32 -5, i32 2, i32 -1]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %3 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%6 = call %struct.NumArray* @NumArrayCreate(i32* %5, i32 6)
%7 = call i32 @sumRange(%struct.NumArray* %6, i32 0, i32 2)
%8 = call i32 @sumRange(%struct.NumArray* %6, i32 2, i32 5)
%9 = call i32 @sumRange(%struct.NumArray* %6, i32 0, i32 5)
%10 = call i32 @NumArrayFree(%struct.NumArray* %6)
ret i32 0
}