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

/* Variables and functions */
int linear_searchi(int *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printvinl(int *, int);
int main() {
  int x[] = {-42, 3, 7, 9, 11};
  {
    int pos = linear_searchi(x, (sizeof(x) / sizeof(x[0])), 11);
    if (pos >= 0)
      printf("Found "
             "11"
             " at %d in array ",
             pos);
    else
      printf("Couldn't found "
             "11"
             " in array ");
    printvinl(x, (sizeof(x) / sizeof(x[0])));
  };
  {
    int pos = linear_searchi(x, (sizeof(x) / sizeof(x[0])), -42);
    if (pos >= 0)
      printf("Found "
             "-42"
             " at %d in array ",
             pos);
    else
      printf("Couldn't found "
             "-42"
             " in array ");
    printvinl(x, (sizeof(x) / sizeof(x[0])));
  };
  {
    int pos = linear_searchi(x, (sizeof(x) / sizeof(x[0])), 3);
    if (pos >= 0)
      printf("Found "
             "3"
             " at %d in array ",
             pos);
    else
      printf("Couldn't found "
             "3"
             " in array ");
    printvinl(x, (sizeof(x) / sizeof(x[0])));
  };
  {
    int pos = linear_searchi(x, (sizeof(x) / sizeof(x[0])), 100);
    if (pos >= 0)
      printf("Found "
             "100"
             " at %d in array ",
             pos);
    else
      printf("Couldn't found "
             "100"
             " in array ");
    printvinl(x, (sizeof(x) / sizeof(x[0])));
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
mov    $0xb,%edx
call   1040 <linear_searchi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     1194 <main+0x64>
mov    -0x24(%rbp),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a2 <main+0x72>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <printvinl@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
mov    $0xffffffd6,%edx
call   1040 <linear_searchi@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     11e6 <main+0xb6>
mov    -0x28(%rbp),%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f4 <main+0xc4>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <printvinl@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <linear_searchi@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jl     1238 <main+0x108>
mov    -0x2c(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1246 <main+0x116>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <printvinl@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
mov    $0x64,%edx
call   1040 <linear_searchi@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jl     128a <main+0x15a>
mov    -0x30(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1298 <main+0x168>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <printvinl@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xed5(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
mov    $0xb,%edx
call   1040 <linear_searchi@plt>
test   %eax,%eax
js     1172 <main+0x42>
lea    0xead(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x50>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <printvinl@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0xffffffd6,%edx
call   1040 <linear_searchi@plt>
test   %eax,%eax
js     11b8 <main+0x88>
lea    0xe9c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11c6 <main+0x96>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <printvinl@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <linear_searchi@plt>
test   %eax,%eax
js     11fe <main+0xce>
lea    0xe8d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    120c <main+0xdc>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <printvinl@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x64,%edx
call   1040 <linear_searchi@plt>
test   %eax,%eax
js     1244 <main+0x114>
lea    0xe7a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1252 <main+0x122>
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdi
mov    $0x5,%esi
call   1050 <printvinl@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.x = [5 x i32] [i32 -42, i32 3, i32 7, i32 9, i32 11]
@.str = [25 x i8] c"Found 11 at %d in array \00"
@.str.1 = [28 x i8] c"Couldn't found 11 in array \00"
@.str.2 = [26 x i8] c"Found -42 at %d in array \00"
@.str.3 = [29 x i8] c"Couldn't found -42 in array \00"
@.str.4 = [24 x i8] c"Found 3 at %d in array \00"
@.str.5 = [27 x i8] c"Couldn't found 3 in array \00"
@.str.6 = [26 x i8] c"Found 100 at %d in array \00"
@.str.7 = [29 x i8] c"Couldn't found 100 in array \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [5 x i32]* %2 to i8*
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%9 = call i32 @linear_searchi(i32* %8, i32 5, i32 11)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%19 = call i32 @printvinl(i32* %18, i32 5)
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%21 = call i32 @linear_searchi(i32* %20, i32 5, i32 -42)
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = icmp sge i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %17
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %25)
br label %29
27: ; preds = %17
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%31 = call i32 @printvinl(i32* %30, i32 5)
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%33 = call i32 @linear_searchi(i32* %32, i32 5, i32 3)
store i32 %33, i32* %5
%34 = load i32, i32* %5
%35 = icmp sge i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %29
%37 = load i32, i32* %5
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %37)
br label %41
39: ; preds = %29
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%43 = call i32 @printvinl(i32* %42, i32 5)
%44 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%45 = call i32 @linear_searchi(i32* %44, i32 5, i32 100)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = icmp sge i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %41
%49 = load i32, i32* %6
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %49)
br label %53
51: ; preds = %41
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
br label %53
53: ; preds = %51, %48
%54 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%55 = call i32 @printvinl(i32* %54, i32 5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [5 x i32] [i32 -42, i32 3, i32 7, i32 9, i32 11]
@.str = [25 x i8] c"Found 11 at %d in array \00"
@.str.1 = [28 x i8] c"Couldn't found 11 in array \00"
@.str.2 = [26 x i8] c"Found -42 at %d in array \00"
@.str.3 = [29 x i8] c"Couldn't found -42 in array \00"
@.str.4 = [24 x i8] c"Found 3 at %d in array \00"
@.str.5 = [27 x i8] c"Couldn't found 3 in array \00"
@.str.6 = [26 x i8] c"Found 100 at %d in array \00"
@.str.7 = [29 x i8] c"Couldn't found 100 in array \00"
define i32 @main() {
%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 @linear_searchi(i32* %3, i32 5, i32 11)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = call i32 @printvinl(i32* %3, i32 5)
%12 = call i32 @linear_searchi(i32* %3, i32 5, i32 -42)
%13 = icmp sgt i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %18
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
%19 = call i32 @printvinl(i32* %3, i32 5)
%20 = call i32 @linear_searchi(i32* %3, i32 5, i32 3)
%21 = icmp sgt i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %20)
br label %26
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = call i32 @printvinl(i32* %3, i32 5)
%28 = call i32 @linear_searchi(i32* %3, i32 5, i32 100)
%29 = icmp sgt i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %28)
br label %34
32: ; preds = %26
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
%35 = call i32 @printvinl(i32* %3, i32 5)
ret i32 0
}