#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*/ print_arr(int *, int);
int /*<<< orphan*/ printf(char *, int);
int search_arr(int *, int, int);
int main(void) {
  int myArray[10] = {12, 23, 56, 35, 18, 65, 12, 87, 73, 9};
  int result, number;
  print_arr(myArray, 10);
  number = 65;
  result = search_arr(myArray, 10, number);
  if (result == -1)
    printf("%d was not found.\n", number);
  else
    printf("Found %d\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <print_arr@plt>
movl   $0x41,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%edx
mov    $0xa,%esi
call   1060 <search_arr@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    11ab <main+0x6b>
mov    -0x38(%rbp),%esi
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
jmp    11ba <main+0x7a>
mov    -0x34(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xee4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <print_arr@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x41,%edx
call   1050 <search_arr@plt>
cmp    $0xffffffff,%eax
je     118a <main+0x5a>
lea    0xeb5(%rip),%rdi
mov    %eax,%esi
jmp    1196 <main+0x66>
lea    0xe97(%rip),%rdi
mov    $0x41,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.myArray = [10 x i32] [i32 12, i32 23, i32 56, i32 35, i32 18, i32 65, i32 12, i32 87, i32 73, i32 9]
@.str = [19 x i8] c"%d was not found.\0A\00"
@.str.1 = [10 x i8] c"Found %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @print_arr(i32* %6, i32 10)
store i32 65, i32* %4
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %4
%10 = call i32 @search_arr(i32* %8, i32 10, i32 %9)
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %19
16: ; preds = %0
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %13
ret i32 0
}

LLVM IR (-O2):
@__const.main.myArray = [10 x i32] [i32 12, i32 23, i32 56, i32 35, i32 18, i32 65, i32 12, i32 87, i32 73, i32 9]
@.str = [19 x i8] c"%d was not found.\0A\00"
@.str.1 = [10 x i8] c"Found %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @print_arr(i32* %3, i32 10)
%5 = call i32 @search_arr(i32* %3, i32 10, i32 65)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 65)
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br label %11
11: ; preds = %9, %7
ret i32 0
}