#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 search(int *, int, int);
void searchMain(void) {
  int nums[] = {1, 3, 1, 1, 1};
  int numsSize = sizeof(nums) / sizeof(nums[0]);
  printf("%d\n", search(nums, numsSize, 0));
  printf("%d\n", search(nums, numsSize, 1));
  printf("%d\n", search(nums, numsSize, 2));
  printf("%d\n", search(nums, numsSize, 3));
  printf("%d\n", search(nums, numsSize, 4));
  printf("%d\n", search(nums, numsSize, 5));
  printf("%d\n", search(nums, numsSize, 6));
  printf("%d\n", search(nums, numsSize, 7));
}


x86 assembly (clang, -O0):
<searchMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x5,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
xor    %edx,%edx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x1,%edx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x2,%edx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x3,%edx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x4,%edx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x5,%edx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x6,%edx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xdf5(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x7,%edx
call   1040 <search@plt>
mov    %eax,%esi
lea    0xdd6(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchMain>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0xee3(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x5,%esi
xor    %edx,%edx
call   1040 <search@plt>
lea    0xebf(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1040 <search@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
call   1040 <search@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <search@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x4,%edx
call   1040 <search@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x5,%edx
call   1040 <search@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x6,%edx
call   1040 <search@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x7,%edx
call   1040 <search@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.searchMain.nums = [5 x i32] [i32 1, i32 3, i32 1, i32 1, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define void @searchMain() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = bitcast [5 x i32]* %1 to i8*
store i32 5, i32* %2
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @search(i32* %4, i32 %5, i32 0)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%9 = load i32, i32* %2
%10 = call i32 @search(i32* %8, i32 %9, i32 1)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%13 = load i32, i32* %2
%14 = call i32 @search(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 [5 x i32], [5 x i32]* %1, i64 0, i64 0
%17 = load i32, i32* %2
%18 = call i32 @search(i32* %16, i32 %17, i32 3)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%21 = load i32, i32* %2
%22 = call i32 @search(i32* %20, i32 %21, i32 4)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%25 = load i32, i32* %2
%26 = call i32 @search(i32* %24, i32 %25, i32 5)
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%29 = load i32, i32* %2
%30 = call i32 @search(i32* %28, i32 %29, i32 6)
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%33 = load i32, i32* %2
%34 = call i32 @search(i32* %32, i32 %33, i32 7)
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
ret void
}

LLVM IR (-O2):
@__const.searchMain.nums = [5 x i32] [i32 1, i32 3, i32 1, i32 1, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define void @searchMain() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @search(i32* %3, i32 5, i32 0)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @search(i32* %3, i32 5, i32 1)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @search(i32* %3, i32 5, 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 @search(i32* %3, i32 5, i32 3)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @search(i32* %3, i32 5, i32 4)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @search(i32* %3, i32 5, i32 5)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @search(i32* %3, i32 5, i32 6)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @search(i32* %3, i32 5, i32 7)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
ret void
}