#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 arr[] = {23, 43, 2, 67, 90, 2, 6, 19};
  int pos;
  pos = search(arr, 8, 6);
  if (pos != -1)
    printf("Number found at %d\n", pos);
  else
    printf("Number not found\n");
  pos = search(arr, 8, 4);
  if (pos != -1)
    printf("Number found at %d\n", pos);
  else
    printf("Number not found\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
mov    $0x6,%edx
call   1040 <search@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
je     1191 <main+0x71>
mov    -0x34(%rbp),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119f <main+0x7f>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
mov    $0x4,%edx
call   1040 <search@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
je     11d5 <main+0xb5>
mov    -0x34(%rbp),%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
mov    $0x6,%edx
call   1050 <search@plt>
cmp    $0xffffffff,%eax
je     1174 <main+0x44>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <main+0x50>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0x8,%esi
mov    $0x4,%edx
call   1050 <search@plt>
cmp    $0xffffffff,%eax
je     11a9 <main+0x79>
lea    0xe82(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b5 <main+0x85>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [8 x i32] [i32 23, i32 43, i32 2, i32 67, i32 90, i32 2, i32 6, i32 19]
@.str = [20 x i8] c"Number found at %d\0A\00"
@.str.1 = [18 x i8] c"Number not found\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i32]* %2 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%6 = call i32 @search(i32* %5, i32 8, i32 6)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%16 = call i32 @search(i32* %15, i32 8, i32 4)
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %24
22: ; preds = %14
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@__const.main.arr = [8 x i32] [i32 23, i32 43, i32 2, i32 67, i32 90, i32 2, i32 6, i32 19]
@.str = [20 x i8] c"Number found at %d\0A\00"
@str.2 = [17 x i8] c"Number not found\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @search(i32* %3, i32 8, i32 6)
%5 = icmp eq i32 %4, -1
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = call i32 @search(i32* %3, i32 8, i32 4)
%12 = icmp eq i32 %11, -1
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %17
15: ; preds = %10
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
ret i32 0
}