#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*/ nums;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int searchInsert(int *, int, int);
void searchInsertMain(void) {
  int nums[] = {1, 3, 5, 6};
  int numsSize = sizeof(nums) / sizeof(nums[0]);
  printf("%d\n", searchInsert(nums, numsSize, 4));
  printf("%d\n", searchInsert(nums, numsSize, 5));
  printf("%d\n", searchInsert(nums, numsSize, 2));
  printf("%d\n", searchInsert(nums, numsSize, 7));
  printf("%d\n", searchInsert(nums, numsSize, 0));
}


x86 assembly (clang, -O0):
<searchInsertMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x4,%edx
call   1040 <searchInsert@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x5,%edx
call   1040 <searchInsert@plt>
mov    %eax,%esi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x2,%edx
call   1040 <searchInsert@plt>
mov    %eax,%esi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x7,%edx
call   1040 <searchInsert@plt>
mov    %eax,%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
xor    %edx,%edx
call   1040 <searchInsert@plt>
mov    %eax,%esi
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchInsertMain>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <searchInsert@plt>
lea    0xec2(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x5,%edx
call   1040 <searchInsert@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1040 <searchInsert@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x7,%edx
call   1040 <searchInsert@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %edx,%edx
call   1040 <searchInsert@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.searchInsertMain.nums = [4 x i32] [i32 1, i32 3, i32 5, i32 6]
@.str = [4 x i8] c"%d\0A\00"
define void @searchInsertMain() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = bitcast [4 x i32]* %1 to i8*
store i32 4, i32* %2
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @searchInsert(i32* %4, i32 %5, i32 4)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%9 = load i32, i32* %2
%10 = call i32 @searchInsert(i32* %8, i32 %9, i32 5)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%13 = load i32, i32* %2
%14 = call i32 @searchInsert(i32* %12, i32 %13, i32 2)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%17 = load i32, i32* %2
%18 = call i32 @searchInsert(i32* %16, i32 %17, i32 7)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%21 = load i32, i32* %2
%22 = call i32 @searchInsert(i32* %20, i32 %21, i32 0)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
ret void
}

LLVM IR (-O2):
@__const.searchInsertMain.nums = [4 x i32] [i32 1, i32 3, i32 5, i32 6]
@.str = [4 x i8] c"%d\0A\00"
define void @searchInsertMain() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @searchInsert(i32* %3, i32 4, i32 4)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @searchInsert(i32* %3, i32 4, i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @searchInsert(i32* %3, i32 4, i32 2)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @searchInsert(i32* %3, i32 4, i32 7)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @searchInsert(i32* %3, i32 4, i32 0)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret void
}