#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*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char *C[10], *nome;
  unsigned int achei = 0;
  int i;
  for (i = 0; i < 10; ++i) {
    printf("Digite um nome: ");
    C[i] = (char *)malloc(100 * sizeof(char));
    scanf(" %100[^\n]s", C[i]);
  }
  nome = (char *)malloc(100 * sizeof(char));
  printf("Digite um nome para pesquisa: ");
  scanf(" %100[^\n]s", nome);
  for (i = 0; i < 10; ++i)
    if (strcmp(nome, C[i]) == 0) {
      achei = 1;
      break;
    }
  if (achei == 1)
    printf("ACHEI\n");
  else
    printf("NÃO ACHEI\n");
  for (i = 0; i < 10; ++i) {
    free(C[i]);
    C[i] = NULL;
  }
  free(nome);
  nome = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
cmpl   $0xa,-0x70(%rbp)
jge    11bc <main+0x6c>
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
movslq -0x70(%rbp),%rax
mov    %rcx,-0x60(%rbp,%rax,8)
movslq -0x70(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
lea    0xe68(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    116d <main+0x1d>
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,-0x68(%rbp)
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x68(%rbp),%rsi
lea    0xe30(%rip),%rdi
call   1070 <scanf@plt>
movl   $0x0,-0x70(%rbp)
cmpl   $0xa,-0x70(%rbp)
jge    1232 <main+0xe2>
mov    -0x68(%rbp),%rdi
movslq -0x70(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    121f <main+0xcf>
movl   $0x1,-0x6c(%rbp)
jmp    1232 <main+0xe2>
jmp    1224 <main+0xd4>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    11ed <main+0x9d>
cmpl   $0x1,-0x6c(%rbp)
jne    124d <main+0xfd>
lea    0xdfd(%rip),%rdi
call   1040 <printf@plt>
jmp    1259 <main+0x109>
lea    0xde7(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x70(%rbp)
cmpl   $0xa,-0x70(%rbp)
jge    1293 <main+0x143>
movslq -0x70(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdi
call   1030 <free@plt>
movslq -0x70(%rbp),%rax
movq   $0x0,-0x60(%rbp,%rax,8)
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    1260 <main+0x110>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x68(%rbp)
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe8b(%rip),%rbp
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
lea    0xe80(%rip),%r12
mov    %r12,%rdi
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %r12,%rdi
mov    %rax,0x30(%rsp)
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %r12,%rdi
mov    %rax,0x28(%rsp)
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %r12,%rdi
mov    %rax,0x20(%rsp)
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %r12,%rdi
mov    %rax,0x18(%rsp)
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %r12,%rdi
mov    %rax,0x10(%rsp)
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %r12,%rdi
mov    %rax,0x8(%rsp)
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    %r12,%rdi
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %r12,%rdi
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    $0x64,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
lea    0xd40(%rip),%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    0x30(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    0x28(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    0x20(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    0x10(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    0x8(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ad <main+0x24d>
lea    0xc90(%rip),%rdi
jmp    13b4 <main+0x254>
lea    0xc8c(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Digite um nome: \00"
@.str.1 = [11 x i8] c" %100[^\0A]s\00"
@.str.2 = [31 x i8] c"Digite um nome para pesquisa: \00"
@.str.3 = [7 x i8] c"ACHEI\0A\00"
@.str.4 = [12 x i8] c"N\C3\83O ACHEI\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8*]
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %21, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%11 = call i64 @malloc(i32 100)
%12 = inttoptr i64 %11 to i8*
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %14
store i8* %12, i8** %15
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %9
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %6
%25 = call i64 @malloc(i32 100)
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %3
%27 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%28 = load i8*, i8** %3
%29 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %28)
store i32 0, i32* %5
br label %30
30: ; preds = %43, %24
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 10
br i1 %32, label %33, label %46
33: ; preds = %30
%34 = load i8*, i8** %3
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %36
%38 = load i8*, i8** %37
%39 = call i64 @strcmp(i8* %34, i8* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %33
store i32 1, i32* %4
br label %46
42: ; preds = %33
br label %43
43: ; preds = %42
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %30
46: ; preds = %41, %30
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 1
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %53
51: ; preds = %46
%52 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
store i32 0, i32* %5
br label %54
54: ; preds = %66, %53
%55 = load i32, i32* %5
%56 = icmp slt i32 %55, 10
br i1 %56, label %57, label %69
57: ; preds = %54
%58 = load i32, i32* %5
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 @free(i8* %61)
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %64
store i8* null, i8** %65
br label %66
66: ; preds = %57
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
store i32 %68, i32* %5
br label %54
69: ; preds = %54
%70 = load i8*, i8** %3
%71 = call i32 @free(i8* %70)
store i8* null, i8** %3
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Digite um nome: \00"
@.str.1 = [11 x i8] c" %100[^\0A]s\00"
@.str.2 = [31 x i8] c"Digite um nome para pesquisa: \00"
@str = [11 x i8] c"N\C3\83O ACHEI\00"
@str.5 = [6 x i8] c"ACHEI\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @malloc(i32 100)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = tail call i64 @malloc(i32 100)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = tail call i64 @malloc(i32 100)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%14 = tail call i64 @malloc(i32 100)
%15 = inttoptr i64 %14 to i8*
%16 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%18 = tail call i64 @malloc(i32 100)
%19 = inttoptr i64 %18 to i8*
%20 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%22 = tail call i64 @malloc(i32 100)
%23 = inttoptr i64 %22 to i8*
%24 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%26 = tail call i64 @malloc(i32 100)
%27 = inttoptr i64 %26 to i8*
%28 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%30 = tail call i64 @malloc(i32 100)
%31 = inttoptr i64 %30 to i8*
%32 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%34 = tail call i64 @malloc(i32 100)
%35 = inttoptr i64 %34 to i8*
%36 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%38 = tail call i64 @malloc(i32 100)
%39 = inttoptr i64 %38 to i8*
%40 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = tail call i64 @malloc(i32 100)
%42 = inttoptr i64 %41 to i8*
%43 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%44 = tail call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %42)
%45 = tail call i64 @strcmp(i8* %42, i8* %3)
%46 = icmp eq i64 %45, 0
br i1 %46, label %74, label %47
47: ; preds = %0
%48 = tail call i64 @strcmp(i8* %42, i8* %7)
%49 = icmp eq i64 %48, 0
br i1 %49, label %74, label %50
50: ; preds = %47
%51 = tail call i64 @strcmp(i8* %42, i8* %11)
%52 = icmp eq i64 %51, 0
br i1 %52, label %74, label %53
53: ; preds = %50
%54 = tail call i64 @strcmp(i8* %42, i8* %15)
%55 = icmp eq i64 %54, 0
br i1 %55, label %74, label %56
56: ; preds = %53
%57 = tail call i64 @strcmp(i8* %42, i8* %19)
%58 = icmp eq i64 %57, 0
br i1 %58, label %74, label %59
59: ; preds = %56
%60 = tail call i64 @strcmp(i8* %42, i8* %23)
%61 = icmp eq i64 %60, 0
br i1 %61, label %74, label %62
62: ; preds = %59
%63 = tail call i64 @strcmp(i8* %42, i8* %27)
%64 = icmp eq i64 %63, 0
br i1 %64, label %74, label %65
65: ; preds = %62
%66 = tail call i64 @strcmp(i8* %42, i8* %31)
%67 = icmp eq i64 %66, 0
br i1 %67, label %74, label %68
68: ; preds = %65
%69 = tail call i64 @strcmp(i8* %42, i8* %35)
%70 = icmp eq i64 %69, 0
br i1 %70, label %74, label %71
71: ; preds = %68
%72 = tail call i64 @strcmp(i8* %42, i8* %39)
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %71, %68, %65, %62, %59, %56, %53, %50, %47, %0
br label %75
75: ; preds = %71, %74
%76 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0), %74 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0), %71 ]
%77 = tail call i32 @puts(i8* dereferenceable(1) %76)
%78 = tail call i32 @free(i8* %3)
%79 = tail call i32 @free(i8* %7)
%80 = tail call i32 @free(i8* %11)
%81 = tail call i32 @free(i8* %15)
%82 = tail call i32 @free(i8* %19)
%83 = tail call i32 @free(i8* %23)
%84 = tail call i32 @free(i8* %27)
%85 = tail call i32 @free(i8* %31)
%86 = tail call i32 @free(i8* %35)
%87 = tail call i32 @free(i8* %39)
%88 = tail call i32 @free(i8* %42)
ret i32 0
}