#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ imprimir();
scalar_t__ opterr;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ remover();
int main(int argc, char *argv[]) {
  FILE *dados = NULL;
  char tem;
  int opt, f = 0, c = 0;
  opterr = 0;
  while ((opt = getopt(argc, argv, "fc")) != EOF)
    switch (opt) {
    case 'f':
      f = 1;
      break;
    case 'c':
      c = 1;
      break;
    case '?':
    default:
      printf("Type\n\t$man %s\nor\n\t$%s -h\nfor help.\n\n", argv[0], argv[0]);
      return EXIT_FAILURE;
    }
  dados = fopen("errors.err", "r");
  if (dados != NULL) {
    if (c) {
      imprimir();
      if (f)
        remover();
    } else {
      if (fscanf(dados, "%c", &tem) == EOF) {
        printf("Sem conteudo\n");
        remover();
      } else
        printf("Com conteudo\n");
      if (f)
        remover();
    }
    fclose(dados);
  } else
    printf("Arquivo nao encontrado\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    0x2e2d(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe48(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x20(%rbp)
mov    0x2e21(%rip),%rcx
cmp    (%rcx),%eax
je     1254 <main+0xe4>
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x3f,%eax
je     121d <main+0xad>
jmp    11e3 <main+0x73>
mov    -0x2c(%rbp),%eax
sub    $0x63,%eax
je     1211 <main+0xa1>
jmp    11f4 <main+0x84>
mov    -0x2c(%rbp),%eax
sub    $0x66,%eax
jne    1222 <main+0xb2>
jmp    1205 <main+0x95>
movl   $0x1,-0x24(%rbp)
jmp    124f <main+0xdf>
movl   $0x1,-0x28(%rbp)
jmp    124f <main+0xdf>
jmp    1222 <main+0xb2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1326 <main+0x1b6>
jmp    11aa <main+0x3a>
lea    0xdcd(%rip),%rdi
lea    0xdcf(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     130c <main+0x19c>
cmpl   $0x0,-0x28(%rbp)
je     129d <main+0x12d>
mov    $0x0,%al
call   1070 <imprimir@plt>
cmpl   $0x0,-0x24(%rbp)
je     1298 <main+0x128>
mov    $0x0,%al
call   1040 <remover@plt>
jmp    12fe <main+0x18e>
mov    -0x18(%rbp),%rdi
lea    0xd8b(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1060 <fscanf@plt>
mov    0x2d30(%rip),%rcx
cmp    (%rcx),%eax
jne    12da <main+0x16a>
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <remover@plt>
jmp    12e8 <main+0x178>
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x24(%rbp)
je     12f9 <main+0x189>
mov    $0x0,%al
call   1040 <remover@plt>
jmp    12fe <main+0x18e>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    131a <main+0x1aa>
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2ca7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%ebp
mov    0x2e39(%rip),%rax
movq   $0x0,(%rax)
lea    0xe5b(%rip),%rdx
call   10a0 <getopt@plt>
mov    0x2e37(%rip),%r15
cmp    (%r15),%eax
jne    11d9 <main+0x59>
lea    0xe6b(%rip),%rdi
lea    0xe6d(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1280 <main+0x100>
mov    %rax,%rbp
xor    %ebx,%ebx
jmp    124e <main+0xce>
xor    %r13d,%r13d
lea    0xe1d(%rip),%r14
xor    %ecx,%ecx
jmp    1204 <main+0x84>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   10a0 <getopt@plt>
mov    %ebx,%ecx
cmp    (%r15),%eax
je     1221 <main+0xa1>
mov    $0x1,%ebx
cmp    $0x66,%eax
je     11f0 <main+0x70>
cmp    $0x63,%eax
jne    12c5 <main+0x145>
mov    $0x1,%r13d
mov    %ecx,%ebx
jmp    11f0 <main+0x70>
lea    0xe00(%rip),%rdi
lea    0xe02(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1280 <main+0x100>
mov    %rax,%rbp
test   %r13d,%r13d
je     124e <main+0xce>
xor    %eax,%eax
call   1080 <imprimir@plt>
test   %ebx,%ebx
jne    129e <main+0x11e>
jmp    12a5 <main+0x125>
lea    0xdde(%rip),%rsi
lea    0x7(%rsp),%rdx
mov    %rbp,%rdi
call   1070 <fscanf@plt>
cmp    (%r15),%eax
jne    128e <main+0x10e>
lea    0xdec(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <remover@plt>
test   %ebx,%ebx
jne    129e <main+0x11e>
jmp    12a5 <main+0x125>
lea    0xdaf(%rip),%rdi
call   1030 <puts@plt>
jmp    12ad <main+0x12d>
lea    0xdb8(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
je     12a5 <main+0x125>
xor    %eax,%eax
call   1050 <remover@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    0x2d14(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r12),%rdx
lea    0xd33(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2cf7(%rip),%rax
jmp    12b4 <main+0x134>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [3 x i8] c"fc\00"
@EOF = global i32 0
@.str.1 = [37 x i8] c"Type\0A\09$man %s\0Aor\0A\09$%s -h\0Afor help.\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [11 x i8] c"errors.err\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [14 x i8] c"Sem conteudo\0A\00"
@.str.6 = [14 x i8] c"Com conteudo\0A\00"
@.str.7 = [24 x i8] c"Arquivo nao encontrado\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32 0, i32* %9
store i32 0, i32* %10
store i64 0, i64* @opterr
br label %11
11: ; preds = %31, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %14, i32* %8
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %32
17: ; preds = %11
%18 = load i32, i32* %8
switch i32 %18, label %22 [
i32 102, label %19
i32 99, label %20
i32 63, label %21
]
19: ; preds = %17
store i32 1, i32* %9
br label %31
20: ; preds = %17
store i32 1, i32* %10
br label %31
21: ; preds = %17
br label %22
22: ; preds = %17, %21
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %25, i8* %28)
%30 = load i32, i32* @EXIT_FAILURE
store i32 %30, i32* %3
br label %69
31: ; preds = %20, %19
br label %11
32: ; preds = %11
%33 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %33, i32** %6
%34 = load i32*, i32** %6
%35 = icmp ne i32* %34, null
br i1 %35, label %36, label %65
36: ; preds = %32
%37 = load i32, i32* %10
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %36
%40 = call i32 (...) @imprimir()
%41 = load i32, i32* %9
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 (...) @remover()
br label %45
45: ; preds = %43, %39
br label %62
46: ; preds = %36
%47 = load i32*, i32** %6
%48 = call i32 @fscanf(i32* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%49 = load i32, i32* @EOF
%50 = icmp eq i32 %48, %49
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%53 = call i32 (...) @remover()
br label %56
54: ; preds = %46
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %56
56: ; preds = %54, %51
%57 = load i32, i32* %9
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 (...) @remover()
br label %61
61: ; preds = %59, %56
br label %62
62: ; preds = %61, %45
%63 = load i32*, i32** %6
%64 = call i32 @fclose(i32* %63)
br label %67
65: ; preds = %32
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %67
67: ; preds = %65, %62
%68 = load i32, i32* @EXIT_SUCCESS
store i32 %68, i32* %3
br label %69
69: ; preds = %67, %22
%70 = load i32, i32* %3
ret i32 %70
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [3 x i8] c"fc\00"
@EOF = global i32 0
@.str.1 = [37 x i8] c"Type\0A\09$man %s\0Aor\0A\09$%s -h\0Afor help.\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [11 x i8] c"errors.err\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%c\00"
@EXIT_SUCCESS = global i32 0
@str = [23 x i8] c"Arquivo nao encontrado\00"
@str.8 = [13 x i8] c"Com conteudo\00"
@str.9 = [13 x i8] c"Sem conteudo\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8
store i64 0, i64* @opterr
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %24, label %7
7: ; preds = %2, %15
%8 = phi i32 [ %18, %15 ], [ %4, %2 ]
%9 = phi i32 [ %17, %15 ], [ 0, %2 ]
%10 = phi i32 [ %16, %15 ], [ 0, %2 ]
switch i32 %8, label %12 [
i32 102, label %15
i32 99, label %11
]
11: ; preds = %7
br label %15
12: ; preds = %7
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %13)
br label %54
15: ; preds = %7, %11
%16 = phi i32 [ %10, %11 ], [ 1, %7 ]
%17 = phi i32 [ 1, %11 ], [ %9, %7 ]
%18 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %7
21: ; preds = %15
%22 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %52, label %27
24: ; preds = %2
%25 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i32* %25, null
br i1 %26, label %52, label %34
27: ; preds = %21
%28 = icmp eq i32 %17, 0
br i1 %28, label %34, label %29
29: ; preds = %27
%30 = tail call i32 (...) @imprimir()
%31 = icmp eq i32 %16, 0
br i1 %31, label %49, label %32
32: ; preds = %29
%33 = tail call i32 (...) @remover()
br label %49
34: ; preds = %24, %27
%35 = phi i32 [ %16, %27 ], [ 0, %24 ]
%36 = phi i32* [ %22, %27 ], [ %25, %24 ]
%37 = call i32 @fscanf(i32* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%38 = load i32, i32* @EOF
%39 = icmp eq i32 %37, %38
br i1 %39, label %40, label %43
40: ; preds = %34
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.9, i64 0, i64 0))
%42 = call i32 (...) @remover()
br label %45
43: ; preds = %34
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
%46 = icmp eq i32 %35, 0
br i1 %46, label %49, label %47
47: ; preds = %45
%48 = call i32 (...) @remover()
br label %49
49: ; preds = %45, %47, %29, %32
%50 = phi i32* [ %36, %45 ], [ %36, %47 ], [ %22, %29 ], [ %22, %32 ]
%51 = call i32 @fclose(i32* %50)
br label %54
52: ; preds = %24, %21
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %54
54: ; preds = %49, %52, %12
%55 = phi i32* [ @EXIT_FAILURE, %12 ], [ @EXIT_SUCCESS, %52 ], [ @EXIT_SUCCESS, %49 ]
%56 = load i32, i32* %55
ret i32 %56
}