#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 */
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *, char *, int *);
scalar_t__ strcmp(char *, char *);
int verifier(char login[100], char password[100]) {
  FILE *h;
  char tmp[100];
  char tmp1[100];
  int test, tmp2;
  tmp2 = 0;
  test = 0;
  h = fopen("users.txt", "r");
  if (h != NULL) {
    while (fscanf(h, "%s %s %d \n", tmp, tmp1, &tmp2) != EOF) {
      if ((strcmp(login, tmp) == 0) && (strcmp(password, tmp1) == 0)) {
        test = 1;
        return tmp2;
      }
    }
  }
  fclose(h);
  if (test == 0)
    return -1;
}


x86 assembly (clang, -O0):
<verifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x108(%rbp)
movl   $0x0,-0x104(%rbp)
lea    0xe92(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1219 <verifier+0xd9>
jmp    118e <verifier+0x4e>
mov    -0x20(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    -0x100(%rbp),%rcx
lea    0xe65(%rip),%rsi
lea    -0x108(%rbp),%r8
call   1040 <fscanf@plt>
mov    0x2e2e(%rip),%rcx
cmp    (%rcx),%rax
je     1214 <verifier+0xd4>
mov    -0x10(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    120f <verifier+0xcf>
mov    -0x18(%rbp),%rdi
lea    -0x100(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    120f <verifier+0xcf>
movl   $0x1,-0x104(%rbp)
mov    -0x108(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1236 <verifier+0xf6>
jmp    118e <verifier+0x4e>
jmp    1219 <verifier+0xd9>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0x0,-0x104(%rbp)
jne    1236 <verifier+0xf6>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifier>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,%r15
movl   $0x0,0x4(%rsp)
lea    0xe98(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11a9 <verifier+0x69>
lea    0xe89(%rip),%rsi
lea    0x80(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rbx,%rdi
call   1040 <fscanf@plt>
mov    0x2e44(%rip),%rcx
cmp    (%rcx),%rax
jne    11c8 <verifier+0x88>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    $0xffffffff,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x80(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xe30(%rip),%rbp
lea    0x4(%rsp),%r14
jmp    1210 <verifier+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
call   1040 <fscanf@plt>
mov    0x2ddd(%rip),%rcx
cmp    (%rcx),%rax
je     11a9 <verifier+0x69>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11f0 <verifier+0xb0>
mov    0x8(%rsp),%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11f0 <verifier+0xb0>
mov    0x4(%rsp),%eax
jmp    11b6 <verifier+0x76>

LLVM IR (-O0):
@.str = [10 x i8] c"users.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"%s %s %d \0A\00"
@EOF = global i64 0
define i32 @verifier(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %10
store i32 0, i32* %9
%11 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %6
%12 = load i32*, i32** %6
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %36
14: ; preds = %2
br label %15
15: ; preds = %34, %14
%16 = load i32*, i32** %6
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%19 = call i64 @fscanf(i32* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %18, i32* %10)
%20 = load i64, i64* @EOF
%21 = icmp ne i64 %19, %20
br i1 %21, label %22, label %35
22: ; preds = %15
%23 = load i8*, i8** %4
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%25 = call i64 @strcmp(i8* %23, i8* %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %22
%28 = load i8*, i8** %5
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%30 = call i64 @strcmp(i8* %28, i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %27
store i32 1, i32* %9
%33 = load i32, i32* %10
store i32 %33, i32* %3
br label %42
34: ; preds = %27, %22
br label %15
35: ; preds = %15
br label %36
36: ; preds = %35, %2
%37 = load i32*, i32** %6
%38 = call i32 @fclose(i32* %37)
%39 = load i32, i32* %9
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %36
store i32 -1, i32* %3
br label %42
42: ; preds = %32, %41, %36
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@.str = [10 x i8] c"users.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"%s %s %d \0A\00"
@EOF = global i64 0
define i32 @verifier(i8* %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca i32
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %27, label %11
11: ; preds = %2
%12 = call i64 @fscanf(i32* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %7, i32* %5)
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %27, label %15
15: ; preds = %11, %23
%16 = call i64 @strcmp(i8* %0, i8* %6)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = call i64 @strcmp(i8* %1, i8* %7)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32, i32* %5
br label %29
23: ; preds = %18, %15
%24 = call i64 @fscanf(i32* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %7, i32* %5)
%25 = load i64, i64* @EOF
%26 = icmp eq i64 %24, %25
br i1 %26, label %27, label %15
27: ; preds = %23, %11, %2
%28 = call i32 @fclose(i32* %9)
br label %29
29: ; preds = %27, %21
%30 = phi i32 [ %22, %21 ], [ -1, %27 ]
ret i32 %30
}