#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 */
typedef int /*<<< orphan*/ test_num;
struct sparse_array {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sparse_array_free(struct sparse_array *);
scalar_t__ sparse_array_get(struct sparse_array *, int const, size_t *);
struct sparse_array *sparse_array_init(int, int);
int /*<<< orphan*/ sparse_array_set(struct sparse_array *, int const,
                                    int const *, int);
int test_array_set_high_num() {
  const int test_num = 65555555;
  const int index = 48 - 1;
  int *returned = NULL;
  size_t siz = 0;
  struct sparse_array *arr = NULL;
  arr = sparse_array_init(sizeof(int), 140);
  if (!(arr)) {
    printf("%i: ", 139);
    return 0;
  };
  if (!(sparse_array_set(arr, index, &test_num, sizeof(test_num)))) {
    printf("%i: ", 141);
    return 0;
  };
  returned = (int *)sparse_array_get(arr, index, &siz);
  if (!(returned)) {
    printf("%i: ", 143);
    return 0;
  };
  if (!(*returned == test_num)) {
    printf("%i: ", 144);
    return 0;
  };
  if (!(siz == sizeof(int))) {
    printf("%i: ", 145);
    return 0;
  };
  if (!(sparse_array_free(arr))) {
    printf("%i: ", 147);
    return 0;
  };
  return 1;
}


x86 assembly (clang, -O0):
<test_array_set_high_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x3e84c63,-0x8(%rbp)
movl   $0x2f,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    $0x4,%edi
mov    $0x8c,%esi
call   1070 <sparse_array_init@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11b9 <test_array_set_high_num+0x69>
lea    0xe5d(%rip),%rdi
mov    $0x8b,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12bf <test_array_set_high_num+0x16f>
mov    -0x28(%rbp),%rdi
mov    $0x2f,%esi
lea    -0x8(%rbp),%rdx
mov    $0x4,%ecx
call   1030 <sparse_array_set@plt>
cmp    $0x0,%eax
jne    11f6 <test_array_set_high_num+0xa6>
lea    0xe20(%rip),%rdi
mov    $0x8d,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12bf <test_array_set_high_num+0x16f>
mov    -0x28(%rbp),%rdi
mov    $0x2f,%esi
lea    -0x20(%rbp),%rdx
call   1060 <sparse_array_get@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1234 <test_array_set_high_num+0xe4>
lea    0xde2(%rip),%rdi
mov    $0x8f,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12bf <test_array_set_high_num+0x16f>
mov    -0x18(%rbp),%rax
cmpl   $0x3e84c63,(%rax)
je     1261 <test_array_set_high_num+0x111>
lea    0xdb5(%rip),%rdi
mov    $0x90,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12bf <test_array_set_high_num+0x16f>
cmpq   $0x4,-0x20(%rbp)
je     1289 <test_array_set_high_num+0x139>
lea    0xd8d(%rip),%rdi
mov    $0x91,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12bf <test_array_set_high_num+0x16f>
mov    -0x28(%rbp),%rdi
call   1050 <sparse_array_free@plt>
cmp    $0x0,%eax
jne    12b8 <test_array_set_high_num+0x168>
lea    0xd5e(%rip),%rdi
mov    $0x93,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12bf <test_array_set_high_num+0x16f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_array_set_high_num>:
push   %rbx
sub    $0x10,%rsp
movl   $0x3e84c63,0x4(%rsp)
03
movq   $0x0,0x8(%rsp)
mov    $0x4,%edi
mov    $0x8c,%esi
call   1070 <sparse_array_init@plt>
test   %rax,%rax
je     11e0 <test_array_set_high_num+0x90>
mov    %rax,%rbx
lea    0x4(%rsp),%rdx
mov    %rax,%rdi
mov    $0x2f,%esi
mov    $0x4,%ecx
call   1030 <sparse_array_set@plt>
test   %eax,%eax
je     11ee <test_array_set_high_num+0x9e>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1060 <sparse_array_get@plt>
test   %rax,%rax
je     11fc <test_array_set_high_num+0xac>
cmpl   $0x3e84c63,(%rax)
jne    120a <test_array_set_high_num+0xba>
cmpq   $0x4,0x8(%rsp)
jne    1218 <test_array_set_high_num+0xc8>
mov    %rbx,%rdi
call   1050 <sparse_array_free@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
jne    122b <test_array_set_high_num+0xdb>
lea    0xe27(%rip),%rdi
mov    $0x93,%esi
jmp    1224 <test_array_set_high_num+0xd4>
lea    0xe19(%rip),%rdi
mov    $0x8b,%esi
jmp    1224 <test_array_set_high_num+0xd4>
lea    0xe0b(%rip),%rdi
mov    $0x8d,%esi
jmp    1224 <test_array_set_high_num+0xd4>
lea    0xdfd(%rip),%rdi
mov    $0x8f,%esi
jmp    1224 <test_array_set_high_num+0xd4>
lea    0xdef(%rip),%rdi
mov    $0x90,%esi
jmp    1224 <test_array_set_high_num+0xd4>
lea    0xde1(%rip),%rdi
mov    $0x91,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sparse_array = type { i32 }
@.str = [5 x i8] c"%i: \00"
define i32 @test_array_set_high_num() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i64
%6 = alloca %struct.sparse_array*
store i32 65555555, i32* %2
store i32 47, i32* %3
store i32* null, i32** %4
store i64 0, i64* %5
store %struct.sparse_array* null, %struct.sparse_array** %6
%7 = call %struct.sparse_array* @sparse_array_init(i32 4, i32 140)
store %struct.sparse_array* %7, %struct.sparse_array** %6
%8 = load %struct.sparse_array*, %struct.sparse_array** %6
%9 = icmp ne %struct.sparse_array* %8, null
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 139)
store i32 0, i32* %1
br label %44
12: ; preds = %0
%13 = load %struct.sparse_array*, %struct.sparse_array** %6
%14 = call i32 @sparse_array_set(%struct.sparse_array* %13, i32 47, i32* %2, i32 4)
%15 = icmp ne i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 141)
store i32 0, i32* %1
br label %44
18: ; preds = %12
%19 = load %struct.sparse_array*, %struct.sparse_array** %6
%20 = call i64 @sparse_array_get(%struct.sparse_array* %19, i32 47, i64* %5)
%21 = inttoptr i64 %20 to i32*
store i32* %21, i32** %4
%22 = load i32*, i32** %4
%23 = icmp ne i32* %22, null
br i1 %23, label %26, label %24
24: ; preds = %18
%25 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 143)
store i32 0, i32* %1
br label %44
26: ; preds = %18
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 65555555
br i1 %29, label %32, label %30
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 144)
store i32 0, i32* %1
br label %44
32: ; preds = %26
%33 = load i64, i64* %5
%34 = icmp eq i64 %33, 4
br i1 %34, label %37, label %35
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 145)
store i32 0, i32* %1
br label %44
37: ; preds = %32
%38 = load %struct.sparse_array*, %struct.sparse_array** %6
%39 = call i32 @sparse_array_free(%struct.sparse_array* %38)
%40 = icmp ne i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %37
%42 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 147)
store i32 0, i32* %1
br label %44
43: ; preds = %37
store i32 1, i32* %1
br label %44
44: ; preds = %43, %41, %35, %30, %24, %16, %10
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
%struct.sparse_array = type { i32 }
@.str = [5 x i8] c"%i: \00"
define i32 @test_array_set_high_num() {
%1 = alloca i32
%2 = alloca i64
%3 = bitcast i32* %1 to i8*
store i32 65555555, i32* %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = tail call %struct.sparse_array* @sparse_array_init(i32 4, i32 140)
%6 = icmp eq %struct.sparse_array* %5, null
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 139)
br label %35
9: ; preds = %0
%10 = call i32 @sparse_array_set(%struct.sparse_array* %5, i32 47, i32* %1, i32 4)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 141)
br label %35
14: ; preds = %9
%15 = call i64 @sparse_array_get(%struct.sparse_array* %5, i32 47, i64* %2)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 143)
br label %35
19: ; preds = %14
%20 = inttoptr i64 %15 to i32*
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 65555555
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 144)
br label %35
25: ; preds = %19
%26 = load i64, i64* %2
%27 = icmp eq i64 %26, 4
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 145)
br label %35
30: ; preds = %25
%31 = call i32 @sparse_array_free(%struct.sparse_array* %5)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 147)
br label %35
35: ; preds = %30, %33, %28, %23, %17, %12, %7
%36 = phi i32 [ 0, %33 ], [ 0, %28 ], [ 0, %23 ], [ 0, %17 ], [ 0, %12 ], [ 0, %7 ], [ 1, %30 ]
ret i32 %36
}