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

/* Variables and functions */
int _get_position(int *, int);
int /*<<< orphan*/ _print_array(int *, int);
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int arr[] = {3, 5, 7, 9, 10, 90, 100, 130, 140, 160, 170};
  int val = 0;
  _print_array(arr, sizeof(arr) / sizeof(arr[0]));
  val = _get_position(arr, 10);
  if (val == -1) {
    printf("\nElement does not exists\n");
    return;
  } else {
    printf("\nElement found at position:=%d\n", val);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x2c,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xb,%esi
call   1040 <_print_array@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1060 <_get_position@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    11a0 <main+0x60>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <main+0x71>
mov    -0x34(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xed0(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xb,%esi
call   1050 <_print_array@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <_get_position@plt>
cmp    $0xffffffff,%eax
je     119c <main+0x5c>
lea    0xe9b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a8 <main+0x68>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [11 x i32] [i32 3, i32 5, i32 7, i32 9, i32 10, i32 90, i32 100, i32 130, i32 140, i32 160, i32 170]
@.str = [26 x i8] c"\0AElement does not exists\0A\00"
@.str.1 = [32 x i8] c"\0AElement found at position:=%d\0A\00"
define void @main() {
%1 = alloca [11 x i32]
%2 = alloca i32
%3 = bitcast [11 x i32]* %1 to i8*
store i32 0, i32* %2
%4 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%5 = call i32 @_print_array(i32* %4, i32 11)
%6 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%7 = call i32 @_get_position(i32* %6, i32 10)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %15
12: ; preds = %0
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %10, %12
ret void
}

LLVM IR (-O2):
@__const.main.arr = [11 x i32] [i32 3, i32 5, i32 7, i32 9, i32 10, i32 90, i32 100, i32 130, i32 140, i32 160, i32 170]
@.str.1 = [32 x i8] c"\0AElement found at position:=%d\0A\00"
@str = [25 x i8] c"\0AElement does not exists\00"
define void @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = call i32 @_print_array(i32* %3, i32 11)
%5 = call i32 @_get_position(i32* %3, i32 10)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br label %11
11: ; preds = %9, %7
ret void
}