#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 */
scalar_t__ strcmp(char *, char *);
int find_the_name(char list[4999][33], int n, char *name) {
  int i;
  for (i = 0; i < n; i++) {
    if (strcmp(list[i], name) == 0)
      return (i);
  }
  return (-1);
}


x86 assembly (clang, -O0):
<find_the_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1176 <find_the_name+0x66>
mov    -0x10(%rbp),%rdi
movslq -0x24(%rbp),%rax
imul   $0x21,%rax,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1163 <find_the_name+0x53>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <find_the_name+0x6d>
jmp    1168 <find_the_name+0x58>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112a <find_the_name+0x1a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_the_name>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
test   %esi,%esi
jle    1152 <find_the_name+0x42>
mov    %rdx,%r15
mov    %rdi,%rbp
mov    %esi,%r12d
xor    %ebx,%ebx
nopl   (%rax)
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114f <find_the_name+0x3f>
add    $0x1,%rbx
add    $0x21,%rbp
cmp    %rbx,%r12
jne    1130 <find_the_name+0x20>
jmp    1152 <find_the_name+0x42>
mov    %ebx,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_the_name([33 x i8]* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca [33 x i8]*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store [33 x i8]* %0, [33 x i8]** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 0, i32* %8
br label %9
9: ; preds = %25, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = load [33 x i8]*, [33 x i8]** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [33 x i8], [33 x i8]* %14, i64 %16
%18 = getelementptr inbounds [33 x i8], [33 x i8]* %17, i64 0, i64 0
%19 = load i8*, i8** %7
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = load i32, i32* %8
store i32 %23, i32* %4
br label %29
24: ; preds = %13
br label %25
25: ; preds = %24
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %9
28: ; preds = %9
store i32 -1, i32* %4
br label %29
29: ; preds = %28, %22
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @find_the_name([33 x i8]* %0, i32 %1, i8* %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds [33 x i8], [33 x i8]* %0, i64 %8, i64 0
%10 = tail call i64 @strcmp(i8* %9, i8* %2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}