#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 atoi(int /*<<< orphan*/);
int /*<<< orphan*/ captura(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int verifica_login(int agencia, int cc, int senha) {
  int correta = 0, bloqueada = 0, encontrou = 0;
  FILE *arq_usuarios;
  char buffer[200];
  arq_usuarios = fopen("usuarios.txt", "r");
  if (arq_usuarios != NULL) {
    while ((!feof(arq_usuarios)) && (encontrou == 0)) {
      fgets(buffer, 200, arq_usuarios);
      if ((atoi(captura(buffer, 1)) == agencia) &&
          (atoi(captura(buffer, 2)) == cc) && (atoi(captura(buffer, 4)) != 2)) {
        encontrou = 1;
        if (atoi(captura(buffer, 3)) == senha)
          correta = 1;
        if (atoi(captura(buffer, 4)) == 1)
          bloqueada = 1;
      }
    }
    fclose(arq_usuarios);
    if (encontrou == 0)
      return 0;
    else if (bloqueada == 1)
      return 3;
    else if (correta == 0)
      return 2;
    else
      return 1;
  } else
    return 4;
}


x86 assembly (clang, -O0):
<verifica_login>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe70(%rip),%rdi
lea    0xe76(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     131c <verifica_login+0x1bc>
jmp    11b0 <verifica_login+0x50>
mov    -0x28(%rbp),%rdi
call   1050 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xf1(%rbp)
jne    11d9 <verifica_login+0x79>
cmpl   $0x0,-0x1c(%rbp)
sete   %al
mov    %al,-0xf1(%rbp)
mov    -0xf1(%rbp),%al
test   $0x1,%al
jne    11ec <verifica_login+0x8c>
jmp    12c5 <verifica_login+0x165>
lea    -0xf0(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0xc8,%esi
call   1040 <fgets@plt>
lea    -0xf0(%rbp),%rdi
mov    $0x1,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    -0x8(%rbp),%eax
jne    12c0 <verifica_login+0x160>
lea    -0xf0(%rbp),%rdi
mov    $0x2,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    -0xc(%rbp),%eax
jne    12c0 <verifica_login+0x160>
lea    -0xf0(%rbp),%rdi
mov    $0x4,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    $0x2,%eax
je     12c0 <verifica_login+0x160>
movl   $0x1,-0x1c(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x3,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    -0x10(%rbp),%eax
jne    1293 <verifica_login+0x133>
movl   $0x1,-0x14(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x4,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    $0x1,%eax
jne    12bb <verifica_login+0x15b>
movl   $0x1,-0x18(%rbp)
jmp    12c0 <verifica_login+0x160>
jmp    11b0 <verifica_login+0x50>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    12e4 <verifica_login+0x184>
movl   $0x0,-0x4(%rbp)
jmp    1323 <verifica_login+0x1c3>
cmpl   $0x1,-0x18(%rbp)
jne    12fa <verifica_login+0x19a>
movl   $0x3,-0x4(%rbp)
jmp    1323 <verifica_login+0x1c3>
cmpl   $0x0,-0x14(%rbp)
jne    1310 <verifica_login+0x1b0>
movl   $0x2,-0x4(%rbp)
jmp    1323 <verifica_login+0x1c3>
movl   $0x1,-0x4(%rbp)
jmp    1323 <verifica_login+0x1c3>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifica_login>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,%r15d
mov    %edi,%r12d
lea    0xe7e(%rip),%rdi
lea    0xe84(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11b1 <verifica_login+0x51>
mov    %rax,%rbp
mov    %rax,%rdi
call   1050 <feof@plt>
test   %eax,%eax
je     11bb <verifica_login+0x5b>
mov    %rbp,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    12ce <verifica_login+0x16e>
mov    $0x4,%eax
jmp    12ce <verifica_login+0x16e>
movl   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rbx
movl   $0x0,0x4(%rsp)
jmp    11f4 <verifica_login+0x94>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %r13d,%r13d
mov    %rbp,%rdi
call   1050 <feof@plt>
or     %r13d,%eax
jne    12a6 <verifica_login+0x146>
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    %rbp,%rdx
call   1040 <fgets@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
mov    $0x1,%r14b
cmp    %r12d,%eax
jne    11e0 <verifica_login+0x80>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    %r15d,%eax
jne    11e0 <verifica_login+0x80>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    $0x2,%eax
je     11e0 <verifica_login+0x80>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    0xc(%rsp),%eax
mov    $0x1,%r13d
mov    0x4(%rsp),%eax
cmove  %r13d,%eax
mov    %eax,0x4(%rsp)
mov    %rbx,%rdi
mov    $0x4,%esi
call   1080 <captura@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
cmp    $0x1,%eax
mov    0x8(%rsp),%ecx
cmove  %eax,%ecx
mov    %ecx,0x8(%rsp)
xor    %r14d,%r14d
jmp    11e3 <verifica_login+0x83>
mov    %rbp,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
test   %r14b,%r14b
jne    12ce <verifica_login+0x16e>
mov    $0x3,%eax
cmpl   $0x1,0x8(%rsp)
je     12ce <verifica_login+0x16e>
cmpl   $0x1,0x4(%rsp)
mov    $0x1,%eax
adc    $0x0,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"usuarios.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @verifica_login(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca [200 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%13 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %11
%14 = load i32*, i32** %11
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %76
16: ; preds = %3
br label %17
17: ; preds = %60, %16
%18 = load i32*, i32** %11
%19 = call i32 @feof(i32* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = load i32, i32* %10
%23 = icmp eq i32 %22, 0
br label %24
24: ; preds = %21, %17
%25 = phi i1 [ false, %17 ], [ %23, %21 ]
br i1 %25, label %26, label %61
26: ; preds = %24
%27 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%28 = load i32*, i32** %11
%29 = call i32 @fgets(i8* %27, i32 200, i32* %28)
%30 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%31 = call i32 @captura(i8* %30, i32 1)
%32 = call i32 @atoi(i32 %31)
%33 = load i32, i32* %5
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %60
35: ; preds = %26
%36 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%37 = call i32 @captura(i8* %36, i32 2)
%38 = call i32 @atoi(i32 %37)
%39 = load i32, i32* %6
%40 = icmp eq i32 %38, %39
br i1 %40, label %41, label %60
41: ; preds = %35
%42 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%43 = call i32 @captura(i8* %42, i32 4)
%44 = call i32 @atoi(i32 %43)
%45 = icmp ne i32 %44, 2
br i1 %45, label %46, label %60
46: ; preds = %41
store i32 1, i32* %10
%47 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%48 = call i32 @captura(i8* %47, i32 3)
%49 = call i32 @atoi(i32 %48)
%50 = load i32, i32* %7
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %53
52: ; preds = %46
store i32 1, i32* %8
br label %53
53: ; preds = %52, %46
%54 = getelementptr inbounds [200 x i8], [200 x i8]* %12, i64 0, i64 0
%55 = call i32 @captura(i8* %54, i32 4)
%56 = call i32 @atoi(i32 %55)
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %59
58: ; preds = %53
store i32 1, i32* %9
br label %59
59: ; preds = %58, %53
br label %60
60: ; preds = %59, %41, %35, %26
br label %17
61: ; preds = %24
%62 = load i32*, i32** %11
%63 = call i32 @fclose(i32* %62)
%64 = load i32, i32* %10
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %61
store i32 0, i32* %4
br label %77
67: ; preds = %61
%68 = load i32, i32* %9
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %71
70: ; preds = %67
store i32 3, i32* %4
br label %77
71: ; preds = %67
%72 = load i32, i32* %8
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %71
store i32 2, i32* %4
br label %77
75: ; preds = %71
store i32 1, i32* %4
br label %77
76: ; preds = %3
store i32 4, i32* %4
br label %77
77: ; preds = %76, %75, %74, %70, %66
%78 = load i32, i32* %4
ret i32 %78
}

LLVM IR (-O2):
@.str = [13 x i8] c"usuarios.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @verifica_login(i32 %0, i32 %1, i32 %2) {
%4 = alloca [200 x i8]
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %52, label %8
8: ; preds = %3
%9 = call i32 @feof(i32* %6)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = call i32 @fclose(i32* %6)
br label %52
13: ; preds = %8, %37
%14 = phi i32 [ %39, %37 ], [ 0, %8 ]
%15 = phi i32 [ %38, %37 ], [ 0, %8 ]
%16 = call i32 @fgets(i8* %5, i32 200, i32* %6)
%17 = call i32 @captura(i8* %5, i32 1)
%18 = call i32 @atoi(i32 %17)
%19 = icmp eq i32 %18, %0
br i1 %19, label %20, label %37
20: ; preds = %13
%21 = call i32 @captura(i8* %5, i32 2)
%22 = call i32 @atoi(i32 %21)
%23 = icmp eq i32 %22, %1
br i1 %23, label %24, label %37
24: ; preds = %20
%25 = call i32 @captura(i8* %5, i32 4)
%26 = call i32 @atoi(i32 %25)
%27 = icmp eq i32 %26, 2
br i1 %27, label %37, label %28
28: ; preds = %24
%29 = call i32 @captura(i8* %5, i32 3)
%30 = call i32 @atoi(i32 %29)
%31 = icmp eq i32 %30, %2
%32 = select i1 %31, i32 1, i32 %15
%33 = call i32 @captura(i8* %5, i32 4)
%34 = call i32 @atoi(i32 %33)
%35 = icmp eq i32 %34, 1
%36 = select i1 %35, i32 1, i32 %14
br label %37
37: ; preds = %28, %24, %20, %13
%38 = phi i32 [ %15, %24 ], [ %15, %20 ], [ %15, %13 ], [ %32, %28 ]
%39 = phi i32 [ %14, %24 ], [ %14, %20 ], [ %14, %13 ], [ %36, %28 ]
%40 = phi i1 [ true, %24 ], [ true, %20 ], [ true, %13 ], [ false, %28 ]
%41 = phi i32 [ 0, %24 ], [ 0, %20 ], [ 0, %13 ], [ 1, %28 ]
%42 = call i32 @feof(i32* %6)
%43 = or i32 %42, %41
%44 = icmp eq i32 %43, 0
br i1 %44, label %13, label %45
45: ; preds = %37
%46 = call i32 @fclose(i32* %6)
br i1 %40, label %52, label %47
47: ; preds = %45
%48 = icmp eq i32 %39, 1
br i1 %48, label %52, label %49
49: ; preds = %47
%50 = icmp eq i32 %38, 0
%51 = select i1 %50, i32 2, i32 1
br label %52
52: ; preds = %11, %3, %49, %47, %45
%53 = phi i32 [ 0, %45 ], [ 3, %47 ], [ %51, %49 ], [ 4, %3 ], [ 0, %11 ]
ret i32 %53
}