#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*/ assert(int);
int sumRange(struct NumArray *, int /*<<< orphan*/, int);
int /*<<< orphan*/ update(struct NumArray *, int, int);
int main(int argc, char **argv) {
  int data0[] = {1, 3, 5};
  struct NumArray *case0 = NumArrayCreate(data0, 3);
  assert(sumRange(case0, 0, 2) == 9);
  update(case0, 1, 2);
  assert(sumRange(case0, 0, 2) == 8);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xea1(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x1c(%rbp),%rdi
mov    $0x3,%esi
call   1050 <NumArrayCreate@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <sumRange@plt>
cmp    $0x9,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <update@plt>
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <sumRange@plt>
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0xebd(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xeaa(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1050 <NumArrayCreate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <sumRange@plt>
xor    %edi,%edi
cmp    $0x9,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <update@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <sumRange@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
call   1060 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.NumArray = type { i32 }
@__const.main.data0 = [3 x i32] [i32 1, i32 3, i32 5]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i32]
%4 = bitcast [3 x i32]* %3 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%6 = call %struct.NumArray* @NumArrayCreate(i32* %5, i32 3)
%7 = call i32 @sumRange(%struct.NumArray* %6, i32 0, i32 2)
%8 = icmp eq i32 %7, 9
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @update(%struct.NumArray* %6, i32 1, i32 2)
%12 = call i32 @sumRange(%struct.NumArray* %6, i32 0, i32 2)
%13 = icmp eq i32 %12, 8
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
ret i32 0
}