#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 */
struct Lista {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ adicionaItem(struct Lista *, char *);
int buscaPalavra(struct Lista *, char *);
struct Lista *criaLista();
int errno;
scalar_t__ executa(char *, char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  FILE *f;
  char palavra[16];
  int i;
  struct Lista *lista;
  lista = criaLista();
  if (argc < 2) {
    printf("Uso: %s arquivo_de_palavras\n", argv[0]);
    return 0;
  }
  if ((f = fopen(argv[1], "r")) == NULL) {
    perror("Ao abrir o arquivo");
    return errno;
  }
  while (!feof(f)) {
    if (fscanf(f, "%16[a-zA-ZãÃáÁçéÉóÓúâÂíÍêÊõÕàÀ-]", palavra) > 0) {
      if (buscaPalavra(lista, palavra) == 1) {
        printf("Falha!Item existente!\n");
      } else {
        if (executa(palavra, "arquivo.gpg", "pronto.pdf")) {
          printf("A chave é:%s\n", palavra);
          fclose(f);
        } else {
          adicionaItem(lista, palavra);
          printf("Falhou! Item adicionado: %s\n", palavra);
        }
      }
    } else {
      fscanf(f, "%*[^a-zA-ZãÃáÁçéÉóÓúâÂíÍêÊõÕàÀ-]");
    }
  }
  fclose(f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10c0 <criaLista@plt>
mov    %rax,-0x40(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11ec <main+0x4c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1321 <main+0x181>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe22(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    122b <main+0x8b>
lea    0xe0a(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1321 <main+0x181>
jmp    1230 <main+0x90>
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    124e <main+0xae>
jmp    1318 <main+0x178>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xdd5(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
cmp    $0x0,%rax
jle    1301 <main+0x161>
mov    -0x40(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <buscaPalavra@plt>
cmp    $0x1,%eax
jne    1297 <main+0xf7>
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12fc <main+0x15c>
lea    -0x30(%rbp),%rdi
lea    0xddc(%rip),%rsi
lea    0xde1(%rip),%rdx
call   1080 <executa@plt>
cmp    $0x0,%rax
je     12d8 <main+0x138>
lea    -0x30(%rbp),%rsi
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
jmp    12f7 <main+0x157>
mov    -0x40(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1090 <adicionaItem@plt>
lea    -0x30(%rbp),%rsi
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12fc <main+0x15c>
jmp    1313 <main+0x173>
mov    -0x18(%rbp),%rdi
lea    0xdb5(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
jmp    1230 <main+0x90>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
xor    %r15d,%r15d
xor    %eax,%eax
call   10d0 <criaLista@plt>
cmp    $0x1,%ebx
jg     11e6 <main+0x36>
mov    0x0(%rbp),%rsi
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    121c <main+0x6c>
mov    %rax,%r14
mov    0x8(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     12f3 <main+0x143>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     122e <main+0x7e>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdfd(%rip),%r15
mov    %rsp,%r12
lea    0xe34(%rip),%r13
lea    0xe64(%rip),%rbp
jmp    1269 <main+0xb9>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    1211 <main+0x61>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
test   %rax,%rax
jle    1250 <main+0xa0>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <buscaPalavra@plt>
cmp    $0x1,%eax
jne    12a0 <main+0xf0>
lea    0xe4a(%rip),%rdi
call   1030 <puts@plt>
jmp    125d <main+0xad>
nopl   0x0(%rax)
mov    %r12,%rdi
lea    0xdbd(%rip),%rsi
mov    %r13,%rdx
call   1090 <executa@plt>
test   %rax,%rax
je     12d2 <main+0x122>
lea    0xdc0(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    125d <main+0xad>
mov    %r14,%rdi
mov    %r12,%rsi
call   10a0 <adicionaItem@plt>
lea    0xda9(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    125d <main+0xad>
lea    0xd25(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2cda(%rip),%rax
mov    (%rax),%r15d
jmp    121c <main+0x6c>

LLVM IR (-O0):
%struct.Lista = type { i32 }
@.str = [29 x i8] c"Uso: %s arquivo_de_palavras\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"Ao abrir o arquivo\00"
@errno = global i32 0
@.str.3 = [53 x i8] c"%16[a-zA-Z\C3\A3\C3\83\C3\A1\C3\81\C3\A7\C3\A9\C3\89\C3\B3\C3\93\C3\BA\C3\A2\C3\82\C3\AD\C3\8D\C3\AA\C3\8A\C3\B5\C3\95\C3\A0\C3\80-]\00"
@.str.4 = [23 x i8] c"Falha!Item existente!\0A\00"
@.str.5 = [12 x i8] c"arquivo.gpg\00"
@.str.6 = [11 x i8] c"pronto.pdf\00"
@.str.7 = [15 x i8] c"A chave \C3\A9:%s\0A\00"
@.str.8 = [29 x i8] c"Falhou! Item adicionado: %s\0A\00"
@.str.9 = [53 x i8] c"%*[^a-zA-Z\C3\A3\C3\83\C3\A1\C3\81\C3\A7\C3\A9\C3\89\C3\B3\C3\93\C3\BA\C3\A2\C3\82\C3\AD\C3\8D\C3\AA\C3\8A\C3\B5\C3\95\C3\A0\C3\80-]\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [16 x i8]
%8 = alloca i32
%9 = alloca %struct.Lista*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call %struct.Lista* (...) @criaLista()
store %struct.Lista* %10, %struct.Lista** %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 0, i32* %3
br label %69
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %6
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %27
24: ; preds = %18
%25 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* @errno
store i32 %26, i32* %3
br label %69
27: ; preds = %18
br label %28
28: ; preds = %65, %27
%29 = load i32*, i32** %6
%30 = call i32 @feof(i32* %29)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
br i1 %32, label %33, label %66
33: ; preds = %28
%34 = load i32*, i32** %6
%35 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%36 = call i64 (i32*, i8*, ...) @fscanf(i32* %34, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i8* %35)
%37 = icmp sgt i64 %36, 0
br i1 %37, label %38, label %62
38: ; preds = %33
%39 = load %struct.Lista*, %struct.Lista** %9
%40 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%41 = call i32 @buscaPalavra(%struct.Lista* %39, i8* %40)
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %45
43: ; preds = %38
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %61
45: ; preds = %38
%46 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%47 = call i64 @executa(i8* %46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %45
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %50)
%52 = load i32*, i32** %6
%53 = call i32 @fclose(i32* %52)
br label %60
54: ; preds = %45
%55 = load %struct.Lista*, %struct.Lista** %9
%56 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%57 = call i32 @adicionaItem(%struct.Lista* %55, i8* %56)
%58 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %54, %49
br label %61
61: ; preds = %60, %43
br label %65
62: ; preds = %33
%63 = load i32*, i32** %6
%64 = call i64 (i32*, i8*, ...) @fscanf(i32* %63, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0))
br label %65
65: ; preds = %62, %61
br label %28
66: ; preds = %28
%67 = load i32*, i32** %6
%68 = call i32 @fclose(i32* %67)
br label %69
69: ; preds = %66, %24, %13
%70 = load i32, i32* %3
ret i32 %70
}

LLVM IR (-O2):
%struct.Lista = type { i32 }
@.str = [29 x i8] c"Uso: %s arquivo_de_palavras\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"Ao abrir o arquivo\00"
@errno = global i32 0
@.str.3 = [53 x i8] c"%16[a-zA-Z\C3\A3\C3\83\C3\A1\C3\81\C3\A7\C3\A9\C3\89\C3\B3\C3\93\C3\BA\C3\A2\C3\82\C3\AD\C3\8D\C3\AA\C3\8A\C3\B5\C3\95\C3\A0\C3\80-]\00"
@.str.5 = [12 x i8] c"arquivo.gpg\00"
@.str.6 = [11 x i8] c"pronto.pdf\00"
@.str.7 = [15 x i8] c"A chave \C3\A9:%s\0A\00"
@.str.8 = [29 x i8] c"Falhou! Item adicionado: %s\0A\00"
@.str.9 = [53 x i8] c"%*[^a-zA-Z\C3\A3\C3\83\C3\A1\C3\81\C3\A7\C3\A9\C3\89\C3\B3\C3\93\C3\BA\C3\A2\C3\82\C3\AD\C3\8D\C3\AA\C3\8A\C3\B5\C3\95\C3\A0\C3\80-]\00"
@str = [22 x i8] c"Falha!Item existente!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = tail call %struct.Lista* (...) @criaLista()
%6 = icmp slt i32 %0, 2
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %45
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = call i32 @feof(i32* %13)
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %43
18: ; preds = %10
%19 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @errno
br label %45
21: ; preds = %15, %40
%22 = call i64 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%23 = icmp sgt i64 %22, 0
br i1 %23, label %24, label %38
24: ; preds = %21
%25 = call i32 @buscaPalavra(%struct.Lista* %5, i8* %4)
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %40
29: ; preds = %24
%30 = call i64 @executa(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %4)
%34 = call i32 @fclose(i32* %13)
br label %40
35: ; preds = %29
%36 = call i32 @adicionaItem(%struct.Lista* %5, i8* %4)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i8* %4)
br label %40
38: ; preds = %21
%39 = call i64 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0))
br label %40
40: ; preds = %27, %35, %32, %38
%41 = call i32 @feof(i32* %13)
%42 = icmp eq i32 %41, 0
br i1 %42, label %21, label %43
43: ; preds = %40, %15
%44 = call i32 @fclose(i32* %13)
br label %45
45: ; preds = %43, %18, %7
%46 = phi i32 [ 0, %7 ], [ %20, %18 ], [ 0, %43 ]
ret i32 %46
}