#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 */
unsigned long atol(char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ memcmp(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
char *strpbrk(char *, char *);
void authentication(FILE *acl, char *user, unsigned long pass_buscado) {
  char user1[50];
  char *pass_file;
  unsigned long pass1 = 0;
  strcpy(user1, "");
  fscanf(acl, "%s", user1);
  pass_file = (strpbrk(user1, ":") + 2);
  pass1 = atol(pass_file);
  while (memcmp(user1, user, strlen(user)) != 0 && pass1 != pass_buscado &&
         !feof(acl)) {
    fscanf(acl, "%s", user1);
    pass_file = (strpbrk(user1, ":") + 2);
    pass1 = atol(pass_file);
  }
  if (pass_buscado == pass1 && memcmp(user1, user, strlen(user)) == 0) {
    printf("Usuario # %s # Valido\n", user);
  } else {
    printf(" #######ERROR########\n ==Usuario %s INVALIDO==\n", user);
  }
}


x86 assembly (clang, -O0):
<authentication>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x60(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0xe42(%rip),%rsi
call   1060 <fscanf@plt>
lea    -0x50(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1090 <strpbrk@plt>
add    $0x2,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
call   10a0 <atol@plt>
mov    %rax,-0x60(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    %eax,%edx
call   1070 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x61(%rbp)
je     1249 <authentication+0xc9>
mov    -0x60(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x61(%rbp)
je     1249 <authentication+0xc9>
mov    -0x8(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    1259 <authentication+0xd9>
jmp    1297 <authentication+0x117>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0xd98(%rip),%rsi
call   1060 <fscanf@plt>
lea    -0x50(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   1090 <strpbrk@plt>
add    $0x2,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
call   10a0 <atol@plt>
mov    %rax,-0x60(%rbp)
jmp    11e8 <authentication+0x68>
mov    -0x18(%rbp),%rax
cmp    -0x60(%rbp),%rax
jne    12f2 <authentication+0x172>
lea    -0x50(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x88(%rbp),%rdi
mov    -0x80(%rbp),%rsi
mov    %eax,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
jne    12f2 <authentication+0x172>
mov    -0x10(%rbp),%rsi
lea    0xd1d(%rip),%rdi
call   1050 <printf@plt>
jmp    1302 <authentication+0x182>
mov    -0x10(%rbp),%rsi
lea    0xd1f(%rip),%rdi
call   1050 <printf@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<authentication>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xeab(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdi
call   1030 <strcpy@plt>
lea    0xe50(%rip),%rsi
mov    %r15,%rdi
mov    %r12,%rdx
call   1070 <fscanf@plt>
mov    %r12,%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
lea    0x2(%rax),%rdi
call   10a0 <atol@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1080 <memcmp@plt>
cmp    %r13,%rbx
sete   %cl
test   %rax,%rax
je     1268 <authentication+0xe8>
cmp    %r13,%rbx
je     1268 <authentication+0xe8>
lea    0xe00(%rip),%r12
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    1286 <authentication+0x106>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1070 <fscanf@plt>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
lea    0x2(%rax),%rdi
call   10a0 <atol@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1080 <memcmp@plt>
cmp    %r13,%rbp
sete   %cl
test   %rax,%rax
je     1268 <authentication+0xe8>
cmp    %r13,%rbp
jne    1210 <authentication+0x90>
test   %cl,%cl
je     1286 <authentication+0x106>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1080 <memcmp@plt>
test   %rax,%rax
je     12a4 <authentication+0x124>
lea    0xd8d(%rip),%rdi
mov    %r14,%rsi
call   1060 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd58(%rip),%rdi
jmp    128d <authentication+0x10d>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c":\00"
@.str.3 = [23 x i8] c"Usuario # %s # Valido\0A\00"
@.str.4 = [48 x i8] c" #######ERROR########\0A ==Usuario %s INVALIDO==\0A\00"
define void @authentication(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca [50 x i8]
%8 = alloca i8*
%9 = alloca i64
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
store i64 0, i64* %9
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%12 = load i32*, i32** %4
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%14 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%16 = call i8* @strpbrk(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = getelementptr inbounds i8, i8* %16, i64 2
store i8* %17, i8** %8
%18 = load i8*, i8** %8
%19 = call i64 @atol(i8* %18)
store i64 %19, i64* %9
br label %20
20: ; preds = %38, %3
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%22 = load i8*, i8** %5
%23 = load i8*, i8** %5
%24 = call i32 @strlen(i8* %23)
%25 = call i64 @memcmp(i8* %21, i8* %22, i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %20
%28 = load i64, i64* %9
%29 = load i64, i64* %6
%30 = icmp ne i64 %28, %29
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = load i32*, i32** %4
%33 = call i32 @feof(i32* %32)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br label %36
36: ; preds = %31, %27, %20
%37 = phi i1 [ false, %27 ], [ false, %20 ], [ %35, %31 ]
br i1 %37, label %38, label %47
38: ; preds = %36
%39 = load i32*, i32** %4
%40 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%41 = call i32 @fscanf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%43 = call i8* @strpbrk(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%44 = getelementptr inbounds i8, i8* %43, i64 2
store i8* %44, i8** %8
%45 = load i8*, i8** %8
%46 = call i64 @atol(i8* %45)
store i64 %46, i64* %9
br label %20
47: ; preds = %36
%48 = load i64, i64* %6
%49 = load i64, i64* %9
%50 = icmp eq i64 %48, %49
br i1 %50, label %51, label %61
51: ; preds = %47
%52 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%53 = load i8*, i8** %5
%54 = load i8*, i8** %5
%55 = call i32 @strlen(i8* %54)
%56 = call i64 @memcmp(i8* %52, i8* %53, i32 %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %51
%59 = load i8*, i8** %5
%60 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %59)
br label %64
61: ; preds = %51, %47
%62 = load i8*, i8** %5
%63 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* %62)
br label %64
64: ; preds = %61, %58
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [23 x i8] c"Usuario # %s # Valido\0A\00"
@.str.4 = [48 x i8] c" #######ERROR########\0A ==Usuario %s INVALIDO==\0A\00"
define void @authentication(i32* nocapture %0, i8* %1, i64 %2) {
%4 = alloca [50 x i8]
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%8 = call i8* @strchr(i8* %5, i32 58)
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = call i64 @atol(i8* %9)
%11 = call i32 @strlen(i8* %1)
%12 = call i64 @memcmp(i8* %5, i8* %1, i32 %11)
%13 = icmp eq i64 %12, 0
%14 = icmp eq i64 %10, %2
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %29, label %16
16: ; preds = %3, %19
%17 = call i32 @feof(i32* %0)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %35
19: ; preds = %16
%20 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%21 = call i8* @strchr(i8* %5, i32 58)
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = call i64 @atol(i8* %22)
%24 = call i32 @strlen(i8* %1)
%25 = call i64 @memcmp(i8* %5, i8* %1, i32 %24)
%26 = icmp eq i64 %25, 0
%27 = icmp eq i64 %23, %2
%28 = select i1 %26, i1 true, i1 %27
br i1 %28, label %29, label %16
29: ; preds = %19, %3
%30 = phi i1 [ %14, %3 ], [ %27, %19 ]
br i1 %30, label %31, label %35
31: ; preds = %29
%32 = call i32 @strlen(i8* %1)
%33 = call i64 @memcmp(i8* %5, i8* %1, i32 %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %16, %31, %29
br label %36
36: ; preds = %31, %35
%37 = phi i8* [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), %35 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %31 ]
%38 = call i32 @printf(i8* %37, i8* %1)
ret void
}