#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 linear_search(int *, int, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int array[100], i;
  for (i = 1; i <= 100; i++)
    array[i - 1] = i;
  int search[5] = {12, 55, 34, 102, 78};
  for (i = 0; i < 5; i++) {
    int index = linear_search(array, 100, search[i]);
    if (index >= 0)
      printf("%d found at index %d\n", search[i], index);
    else
      printf("%d not found in the list\n", search[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jg     1175 <main+0x55>
mov    -0x1a4(%rbp),%ecx
mov    -0x1a4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    113c <main+0x1c>
mov    0xe84(%rip),%rax
mov    %rax,-0x1c0(%rbp)
mov    0xe7e(%rip),%rax
mov    %rax,-0x1b8(%rbp)
mov    0xe79(%rip),%eax
mov    %eax,-0x1b0(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x5,-0x1a4(%rbp)
jge    1242 <main+0x122>
lea    -0x1a0(%rbp),%rdi
movslq -0x1a4(%rbp),%rax
mov    -0x1c0(%rbp,%rax,4),%edx
mov    $0x64,%esi
call   1030 <linear_search@plt>
mov    %eax,-0x1c4(%rbp)
cmpl   $0x0,-0x1c4(%rbp)
jl     120d <main+0xed>
movslq -0x1a4(%rbp),%rax
mov    -0x1c0(%rbp,%rax,4),%esi
mov    -0x1c4(%rbp),%edx
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1229 <main+0x109>
movslq -0x1a4(%rbp),%rax
mov    -0x1c0(%rbp,%rax,4),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122e <main+0x10e>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11a7 <main+0x87>
xor    %eax,%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x198,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xed7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee3(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeef(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xef4(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xef6(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xef7(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xefa(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xefc(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movaps 0xefd(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movaps 0xefe(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0xeff(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movaps 0xf00(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0xf03(%rip),%xmm0
movaps %xmm0,0x180(%rsp)
mov    %rsp,%rdi
mov    $0x64,%esi
mov    $0xc,%edx
call   1030 <linear_search@plt>
test   %eax,%eax
js     12b2 <main+0x192>
lea    0xeee(%rip),%rdi
mov    $0xc,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12c5 <main+0x1a5>
lea    0xeed(%rip),%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
mov    $0x64,%esi
mov    $0x37,%edx
call   1030 <linear_search@plt>
test   %eax,%eax
js     12f2 <main+0x1d2>
lea    0xeae(%rip),%rdi
mov    $0x37,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1305 <main+0x1e5>
lea    0xead(%rip),%rdi
mov    $0x37,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
mov    $0x64,%esi
mov    $0x22,%edx
call   1030 <linear_search@plt>
test   %eax,%eax
js     1332 <main+0x212>
lea    0xe6e(%rip),%rdi
mov    $0x22,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1345 <main+0x225>
lea    0xe6d(%rip),%rdi
mov    $0x22,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
mov    $0x64,%esi
mov    $0x66,%edx
call   1030 <linear_search@plt>
test   %eax,%eax
js     1372 <main+0x252>
lea    0xe2e(%rip),%rdi
mov    $0x66,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1385 <main+0x265>
lea    0xe2d(%rip),%rdi
mov    $0x66,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
mov    $0x64,%esi
mov    $0x4e,%edx
call   1030 <linear_search@plt>
test   %eax,%eax
js     13b2 <main+0x292>
lea    0xdee(%rip),%rdi
mov    $0x4e,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13c5 <main+0x2a5>
lea    0xded(%rip),%rdi
mov    $0x4e,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x198,%rsp
ret

LLVM IR (-O0):
@__const.main.search = [5 x i32] [i32 12, i32 55, i32 34, i32 102, i32 78]
@.str = [22 x i8] c"%d found at index %d\0A\00"
@.str.1 = [26 x i8] c"%d not found in the list\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca [5 x i32]
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 100
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %13
store i32 %10, i32* %14
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = bitcast [5 x i32]* %4 to i8*
store i32 0, i32* %3
br label %20
20: ; preds = %46, %18
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %49
23: ; preds = %20
%24 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 @linear_search(i32* %24, i32 100, i32 %28)
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = icmp sge i32 %30, 0
br i1 %31, label %32, label %39
32: ; preds = %23
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %5
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %37)
br label %45
39: ; preds = %23
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %39, %32
br label %46
46: ; preds = %45
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %20
49: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"%d found at index %d\0A\00"
@.str.1 = [26 x i8] c"%d not found in the list\0A\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = bitcast [100 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %3
%4 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 4
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %5
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 8
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, <4 x i32>* %7
%8 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 12
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 13, i32 14, i32 15, i32 16>, <4 x i32>* %9
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 16
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 17, i32 18, i32 19, i32 20>, <4 x i32>* %11
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 20
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 21, i32 22, i32 23, i32 24>, <4 x i32>* %13
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 24
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 25, i32 26, i32 27, i32 28>, <4 x i32>* %15
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 28
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 29, i32 30, i32 31, i32 32>, <4 x i32>* %17
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 32
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> <i32 33, i32 34, i32 35, i32 36>, <4 x i32>* %19
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 36
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 37, i32 38, i32 39, i32 40>, <4 x i32>* %21
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 40
%23 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> <i32 41, i32 42, i32 43, i32 44>, <4 x i32>* %23
%24 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 44
%25 = bitcast i32* %24 to <4 x i32>*
store <4 x i32> <i32 45, i32 46, i32 47, i32 48>, <4 x i32>* %25
%26 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 48
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> <i32 49, i32 50, i32 51, i32 52>, <4 x i32>* %27
%28 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 52
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> <i32 53, i32 54, i32 55, i32 56>, <4 x i32>* %29
%30 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 56
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> <i32 57, i32 58, i32 59, i32 60>, <4 x i32>* %31
%32 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 60
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> <i32 61, i32 62, i32 63, i32 64>, <4 x i32>* %33
%34 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 64
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> <i32 65, i32 66, i32 67, i32 68>, <4 x i32>* %35
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 68
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> <i32 69, i32 70, i32 71, i32 72>, <4 x i32>* %37
%38 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 72
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> <i32 73, i32 74, i32 75, i32 76>, <4 x i32>* %39
%40 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 76
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> <i32 77, i32 78, i32 79, i32 80>, <4 x i32>* %41
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 80
%43 = bitcast i32* %42 to <4 x i32>*
store <4 x i32> <i32 81, i32 82, i32 83, i32 84>, <4 x i32>* %43
%44 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 84
%45 = bitcast i32* %44 to <4 x i32>*
store <4 x i32> <i32 85, i32 86, i32 87, i32 88>, <4 x i32>* %45
%46 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 88
%47 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> <i32 89, i32 90, i32 91, i32 92>, <4 x i32>* %47
%48 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 92
%49 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> <i32 93, i32 94, i32 95, i32 96>, <4 x i32>* %49
%50 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 96
%51 = bitcast i32* %50 to <4 x i32>*
store <4 x i32> <i32 97, i32 98, i32 99, i32 100>, <4 x i32>* %51
%52 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%53 = call i32 @linear_search(i32* %52, i32 100, i32 12)
%54 = icmp sgt i32 %53, -1
br i1 %54, label %55, label %57
55: ; preds = %0
%56 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 12, i32 %53)
br label %59
57: ; preds = %0
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 12)
br label %59
59: ; preds = %57, %55
%60 = call i32 @linear_search(i32* %52, i32 100, i32 55)
%61 = icmp sgt i32 %60, -1
br i1 %61, label %64, label %62
62: ; preds = %59
%63 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 55)
br label %66
64: ; preds = %59
%65 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 55, i32 %60)
br label %66
66: ; preds = %64, %62
%67 = call i32 @linear_search(i32* %52, i32 100, i32 34)
%68 = icmp sgt i32 %67, -1
br i1 %68, label %71, label %69
69: ; preds = %66
%70 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 34)
br label %73
71: ; preds = %66
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 34, i32 %67)
br label %73
73: ; preds = %71, %69
%74 = call i32 @linear_search(i32* %52, i32 100, i32 102)
%75 = icmp sgt i32 %74, -1
br i1 %75, label %78, label %76
76: ; preds = %73
%77 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 102)
br label %80
78: ; preds = %73
%79 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 102, i32 %74)
br label %80
80: ; preds = %78, %76
%81 = call i32 @linear_search(i32* %52, i32 100, i32 78)
%82 = icmp sgt i32 %81, -1
br i1 %82, label %85, label %83
83: ; preds = %80
%84 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 78)
br label %87
85: ; preds = %80
%86 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 78, i32 %81)
br label %87
87: ; preds = %85, %83
ret i32 0
}