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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int search(int *, int, int);
int main(int argc, char *argv[]) {
  int nums[] = {4, 5, 4, 4, 4};
  for (int i = 0; i < 5; ++i) {
    if (!(search(nums, 5, nums[i]) == 1)) {
      printf("assert fail: %s\n", "search");
      return -1;
    };
  }
  printf("everything is fine!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    11b9 <main+0x99>
lea    -0x30(%rbp),%rdi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
mov    $0x5,%esi
call   1040 <search@plt>
cmp    $0x1,%eax
je     11a6 <main+0x86>
lea    0xe88(%rip),%rdi
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ce <main+0xae>
jmp    11ab <main+0x8b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    115c <main+0x3c>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xed6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xebb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
mov    $0x4,%edx
call   1050 <search@plt>
cmp    $0x1,%eax
jne    11cb <main+0x9b>
mov    0x4(%rsp),%edx
mov    %rsp,%rdi
mov    $0x5,%esi
call   1050 <search@plt>
cmp    $0x1,%eax
jne    11cb <main+0x9b>
mov    0x8(%rsp),%edx
mov    %rsp,%rdi
mov    $0x5,%esi
call   1050 <search@plt>
cmp    $0x1,%eax
jne    11cb <main+0x9b>
mov    0xc(%rsp),%edx
mov    %rsp,%rdi
mov    $0x5,%esi
call   1050 <search@plt>
cmp    $0x1,%eax
jne    11cb <main+0x9b>
mov    0x10(%rsp),%edx
mov    %rsp,%rdi
mov    $0x5,%esi
call   1050 <search@plt>
cmp    $0x1,%eax
jne    11cb <main+0x9b>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe42(%rip),%rdi
lea    0xe4c(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.nums = [5 x i32] [i32 4, i32 5, i32 4, i32 4, i32 4]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [7 x i8] c"search\00"
@.str.2 = [21 x i8] c"everything is fine!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [5 x i32]* %6 to i8*
store i32 0, i32* %7
br label %9
9: ; preds = %23, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %26
12: ; preds = %9
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = call i32 @search(i32* %13, i32 5, i32 %17)
%19 = icmp eq i32 %18, 1
br i1 %19, label %22, label %20
20: ; preds = %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %28
22: ; preds = %12
br label %23
23: ; preds = %22
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %9
26: ; preds = %9
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %28
28: ; preds = %26, %20
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@__const.main.nums = [5 x i32] [i32 4, i32 5, i32 4, i32 4, i32 4]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [7 x i8] c"search\00"
@str = [20 x i8] c"everything is fine!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%6 = call i32 @search(i32* %5, i32 5, i32 4)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %30
8: ; preds = %2
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%10 = load i32, i32* %9
%11 = call i32 @search(i32* %5, i32 5, i32 %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %30
13: ; preds = %8
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
%15 = load i32, i32* %14
%16 = call i32 @search(i32* %5, i32 5, i32 %15)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %30
18: ; preds = %13
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
%20 = load i32, i32* %19
%21 = call i32 @search(i32* %5, i32 5, i32 %20)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %30
23: ; preds = %18
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
%25 = load i32, i32* %24
%26 = call i32 @search(i32* %5, i32 5, i32 %25)
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %32
30: ; preds = %23, %18, %13, %8, %2
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
%33 = phi i32 [ 0, %28 ], [ -1, %30 ]
ret i32 %33
}