#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;
};
typedef int /*<<< orphan*/ nums;

/* Variables and functions */
struct NumArray *NumArrayCreate(int *, int);
int /*<<< orphan*/ NumArrayFree(struct NumArray *);
int /*<<< orphan*/ printf(char *, int);
int sumRange(struct NumArray *, int, int);
int /*<<< orphan*/ update(struct NumArray *, int, int);
int main() {
  int nums[] = {9, -8};
  int numsSize = sizeof(nums) / sizeof(*nums);
  struct NumArray *numArray = NumArrayCreate(nums, numsSize);
  update(numArray, 0, 3);
  printf("sumRange(numArray, 1, 1)"
         " %d\n",
         sumRange(numArray, 1, 1));
  ;
  return 0;
  printf("sumRange(numArray, 0, 1)"
         " %d\n",
         sumRange(numArray, 0, 1));
  ;
  update(numArray, 1, -3);
  printf("sumRange(numArray, 0, 1)"
         " %d\n",
         sumRange(numArray, 0, 1));
  ;
  NumArrayFree(numArray);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1060 <NumArrayCreate@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <update@plt>
mov    -0x18(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <sumRange@plt>
mov    %eax,%esi
lea    0xe6e(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0xfffffff800000009,%rax
ff ff ff
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
call   1060 <NumArrayCreate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <update@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <sumRange@plt>
lea    0xe72(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.NumArray = type { i32 }
@__const.main.nums = [2 x i32] [i32 9, i32 -8]
@.str = [29 x i8] c"sumRange(numArray, 1, 1) %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca i32
%4 = alloca %struct.NumArray*
store i32 0, i32* %1
%5 = bitcast [2 x i32]* %2 to i8*
store i32 2, i32* %3
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call %struct.NumArray* @NumArrayCreate(i32* %6, i32 %7)
store %struct.NumArray* %8, %struct.NumArray** %4
%9 = load %struct.NumArray*, %struct.NumArray** %4
%10 = call i32 @update(%struct.NumArray* %9, i32 0, i32 3)
%11 = load %struct.NumArray*, %struct.NumArray** %4
%12 = call i32 @sumRange(%struct.NumArray* %11, i32 1, i32 1)
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
%struct.NumArray = type { i32 }
@.str = [29 x i8] c"sumRange(numArray, 1, 1) %d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 -34359738359, i64* %1
%3 = bitcast i64* %1 to i32*
%4 = call %struct.NumArray* @NumArrayCreate(i32* %3, i32 2)
%5 = call i32 @update(%struct.NumArray* %4, i32 0, i32 3)
%6 = call i32 @sumRange(%struct.NumArray* %4, i32 1, i32 1)
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}