#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 *, char *, int);
scalar_t__ strcmp(char *, char *);
void sequential_search() {
  typedef struct {
    char name[20];
    int age;
  } girl;
  girl a[] = {{"Ann", 18},    {"Rolla", 19},    {"Nancy", 16}, {"Eluza", 17},
              {"Juliet", 18}, {"Machilda", 20}, {"Emy", 15},   {"Candy", 16},
              {"Ema", 17},    {"Mari", 18}};
  char *key;
  int i;
  i = 0;
  key = "Ema";
  while (i < 20 && strcmp(key, a[i].name) != 0) {
    i++;
  }
  printf("%s %d\n", a[i].name, a[i].age);
}


x86 assembly (clang, -O0):
<sequential_search>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0xf0(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0xf0,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0xfc(%rbp)
lea    0xf8c(%rip),%rax
mov    %rax,-0xf8(%rbp)
xor    %eax,%eax
cmpl   $0x14,-0xfc(%rbp)
mov    %al,-0xfd(%rbp)
jge    11ae <sequential_search+0x7e>
mov    -0xf8(%rbp),%rdi
movslq -0xfc(%rbp),%rax
lea    -0xf0(%rbp),%rsi
imul   $0x18,%rax,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xfd(%rbp)
mov    -0xfd(%rbp),%al
test   $0x1,%al
jne    11c1 <sequential_search+0x91>
jmp    11d5 <sequential_search+0xa5>
mov    -0xfc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc(%rbp)
jmp    116b <sequential_search+0x3b>
movslq -0xfc(%rbp),%rax
lea    -0xf0(%rbp),%rsi
imul   $0x18,%rax,%rax
add    %rax,%rsi
movslq -0xfc(%rbp),%rcx
lea    -0xf0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x14(%rax),%edx
lea    0xeeb(%rip),%rdi
call   1030 <printf@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sequential_search>:
push   %rbx
sub    $0xf0,%rsp
lea    0xec1(%rip),%rsi
mov    %rsp,%rbx
mov    $0xf0,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
lea    0xf9a(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1388 <sequential_search+0x258>
lea    0x18(%rsp),%rsi
lea    0xf7d(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     138c <sequential_search+0x25c>
lea    0x30(%rsp),%rsi
lea    0xf63(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1393 <sequential_search+0x263>
lea    0x48(%rsp),%rsi
lea    0xf49(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     139a <sequential_search+0x26a>
lea    0x60(%rsp),%rsi
lea    0xf2f(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13a1 <sequential_search+0x271>
lea    0x78(%rsp),%rsi
lea    0xf15(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13a8 <sequential_search+0x278>
lea    0x90(%rsp),%rsi
lea    0xef8(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13af <sequential_search+0x27f>
lea    0xa8(%rsp),%rsi
lea    0xedb(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13b6 <sequential_search+0x286>
lea    0xc0(%rsp),%rsi
lea    0xebe(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13bd <sequential_search+0x28d>
lea    0xd8(%rsp),%rsi
lea    0xea1(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13c4 <sequential_search+0x294>
lea    0xf0(%rsp),%rsi
lea    0xe84(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13cb <sequential_search+0x29b>
lea    0x108(%rsp),%rsi
lea    0xe67(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13d2 <sequential_search+0x2a2>
lea    0x120(%rsp),%rsi
lea    0xe4a(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13d9 <sequential_search+0x2a9>
lea    0x138(%rsp),%rsi
lea    0xe2d(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13e0 <sequential_search+0x2b0>
lea    0x150(%rsp),%rsi
lea    0xe10(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13e7 <sequential_search+0x2b7>
lea    0x168(%rsp),%rsi
lea    0xdf3(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13ee <sequential_search+0x2be>
lea    0x180(%rsp),%rsi
lea    0xdd6(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13f5 <sequential_search+0x2c5>
lea    0x198(%rsp),%rsi
lea    0xdb9(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     13fc <sequential_search+0x2cc>
lea    0x1b0(%rsp),%rsi
lea    0xd9c(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1403 <sequential_search+0x2d3>
lea    0x1c8(%rsp),%rsi
lea    0xd7f(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x1,%rax
mov    $0x14,%eax
sbb    $0x0,%rax
jmp    1408 <sequential_search+0x2d8>
xor    %eax,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x1,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x2,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x3,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x4,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x5,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x6,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x7,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x8,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x9,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0xa,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0xb,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0xc,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0xd,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0xe,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0xf,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x10,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x11,%eax
jmp    1408 <sequential_search+0x2d8>
mov    $0x12,%eax
lea    (%rax,%rax,2),%rax
lea    (%rsp,%rax,8),%rsi
mov    0x14(%rsp,%rax,8),%edx
lea    0xcd9(%rip),%rdi
call   1030 <printf@plt>
add    $0xf0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.girl = type { [20 x i8], i32 }
@__const.sequential_search.a = [10 x %struct.girl] [%struct.girl { [20 x i8] c"Ann\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 18 }, %struct.girl { [20 x i8] c"Rolla\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 19 }, %struct.girl { [20 x i8] c"Nancy\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 16 }, %struct.girl { [20 x i8] c"Eluza\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 17 }, %struct.girl { [20 x i8] c"Juliet\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 18 }, %struct.girl { [20 x i8] c"Machilda\00\00\00\00\00\00\00\00\00\00\00\00", i32 20 }, %struct.girl { [20 x i8] c"Emy\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 15 }, %struct.girl { [20 x i8] c"Candy\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 16 }, %struct.girl { [20 x i8] c"Ema\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 17 }, %struct.girl { [20 x i8] c"Mari\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 18 }]
@.str = [4 x i8] c"Ema\00"
@.str.1 = [7 x i8] c"%s %d\0A\00"
define void @sequential_search() {
%1 = alloca [10 x %struct.girl]
%2 = alloca i8*
%3 = alloca i32
%4 = bitcast [10 x %struct.girl]* %1 to i8*
store i32 0, i32* %3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 20
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 %11
%13 = getelementptr inbounds %struct.girl, %struct.girl* %12, i32 0, i32 0
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 0, i64 0
%15 = call i64 @strcmp(i8* %9, i8* %14)
%16 = icmp ne i64 %15, 0
br label %17
17: ; preds = %8, %5
%18 = phi i1 [ false, %5 ], [ %16, %8 ]
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %5
22: ; preds = %17
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 %24
%26 = getelementptr inbounds %struct.girl, %struct.girl* %25, i32 0, i32 0
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %26, i64 0, i64 0
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 %29
%31 = getelementptr inbounds %struct.girl, %struct.girl* %30, i32 0, i32 1
%32 = load i32, i32* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %27, i32 %32)
ret void
}

LLVM IR (-O2):
%struct.girl = type { [20 x i8], i32 }
@__const.sequential_search.a = [10 x %struct.girl] [%struct.girl { [20 x i8] c"Ann\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 18 }, %struct.girl { [20 x i8] c"Rolla\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 19 }, %struct.girl { [20 x i8] c"Nancy\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 16 }, %struct.girl { [20 x i8] c"Eluza\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 17 }, %struct.girl { [20 x i8] c"Juliet\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 18 }, %struct.girl { [20 x i8] c"Machilda\00\00\00\00\00\00\00\00\00\00\00\00", i32 20 }, %struct.girl { [20 x i8] c"Emy\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 15 }, %struct.girl { [20 x i8] c"Candy\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 16 }, %struct.girl { [20 x i8] c"Ema\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 17 }, %struct.girl { [20 x i8] c"Mari\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 18 }]
@.str = [4 x i8] c"Ema\00"
@.str.1 = [7 x i8] c"%s %d\0A\00"
define void @sequential_search() {
%1 = alloca [10 x %struct.girl]
%2 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 0, i32 0, i64 0
%3 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %82, label %5
5: ; preds = %0
%6 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 1, i32 0, i64 0
%7 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %82, label %9
9: ; preds = %5
%10 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 2, i32 0, i64 0
%11 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %82, label %13
13: ; preds = %9
%14 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 3, i32 0, i64 0
%15 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %82, label %17
17: ; preds = %13
%18 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 4, i32 0, i64 0
%19 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %82, label %21
21: ; preds = %17
%22 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 5, i32 0, i64 0
%23 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %82, label %25
25: ; preds = %21
%26 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 6, i32 0, i64 0
%27 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %82, label %29
29: ; preds = %25
%30 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 7, i32 0, i64 0
%31 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %82, label %33
33: ; preds = %29
%34 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 8, i32 0, i64 0
%35 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %82, label %37
37: ; preds = %33
%38 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 9, i32 0, i64 0
%39 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %82, label %41
41: ; preds = %37
%42 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 10, i32 0, i64 0
%43 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %42)
%44 = icmp eq i64 %43, 0
br i1 %44, label %82, label %45
45: ; preds = %41
%46 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 11, i32 0, i64 0
%47 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %46)
%48 = icmp eq i64 %47, 0
br i1 %48, label %82, label %49
49: ; preds = %45
%50 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 12, i32 0, i64 0
%51 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %82, label %53
53: ; preds = %49
%54 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 13, i32 0, i64 0
%55 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %54)
%56 = icmp eq i64 %55, 0
br i1 %56, label %82, label %57
57: ; preds = %53
%58 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 14, i32 0, i64 0
%59 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %58)
%60 = icmp eq i64 %59, 0
br i1 %60, label %82, label %61
61: ; preds = %57
%62 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 15, i32 0, i64 0
%63 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %62)
%64 = icmp eq i64 %63, 0
br i1 %64, label %82, label %65
65: ; preds = %61
%66 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 16, i32 0, i64 0
%67 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %66)
%68 = icmp eq i64 %67, 0
br i1 %68, label %82, label %69
69: ; preds = %65
%70 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 17, i32 0, i64 0
%71 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %70)
%72 = icmp eq i64 %71, 0
br i1 %72, label %82, label %73
73: ; preds = %69
%74 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 18, i32 0, i64 0
%75 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %74)
%76 = icmp eq i64 %75, 0
br i1 %76, label %82, label %77
77: ; preds = %73
%78 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 19, i32 0, i64 0
%79 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %78)
%80 = icmp eq i64 %79, 0
%81 = select i1 %80, i64 19, i64 20
br label %82
82: ; preds = %77, %73, %69, %65, %61, %57, %53, %49, %45, %41, %37, %33, %29, %25, %21, %17, %13, %9, %5, %0
%83 = phi i64 [ 0, %0 ], [ 1, %5 ], [ 2, %9 ], [ 3, %13 ], [ 4, %17 ], [ 5, %21 ], [ 6, %25 ], [ 7, %29 ], [ 8, %33 ], [ 9, %37 ], [ 10, %41 ], [ 11, %45 ], [ 12, %49 ], [ 13, %53 ], [ 14, %57 ], [ 15, %61 ], [ 16, %65 ], [ 17, %69 ], [ 18, %73 ], [ %81, %77 ]
%84 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 %83, i32 0, i64 0
%85 = getelementptr inbounds [10 x %struct.girl], [10 x %struct.girl]* %1, i64 0, i64 %83, i32 1
%86 = load i32, i32* %85
%87 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %84, i32 %86)
ret void
}