#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 /*<<< orphan*/ _err_msg(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ pass_close(int /*<<< orphan*/ *);
int pass_init(char *, int /*<<< orphan*/ **);
int pass_read(char *, char *, int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char *);
int is_auth_ok(char *file, char *u, char *p) {
  int auth_ok;
  char user[4096], pwd[4096];
  FILE *fp;
  auth_ok = 0;
  if (-1 == pass_init(file, &fp)) {
    _err_msg(0,
             "["
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/zh1149277309/fms/refs/heads/master/"
             "server/auth.c"
             ",%d] "
             "pass_init",
             123);
    return 0;
  }
  while (pass_read(user, pwd, fp) != -1) {
    if (strcmp(user, u) == 0 && strcmp(pwd, p) == 0) {
      auth_ok = 1;
      break;
    }
  }
  pass_close(fp);
  return auth_ok;
}


x86 assembly (clang, -O0):
<is_auth_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2040,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x2038(%rbp),%rsi
call   1050 <pass_init@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    11ac <is_auth_ok+0x5c>
xor    %edi,%edi
lea    0xe6a(%rip),%rsi
mov    $0x7b,%edx
call   1060 <_err_msg@plt>
movl   $0x0,-0x4(%rbp)
jmp    122b <is_auth_ok+0xdb>
jmp    11b1 <is_auth_ok+0x61>
lea    -0x1030(%rbp),%rdi
lea    -0x2030(%rbp),%rsi
mov    -0x2038(%rbp),%rdx
call   1030 <pass_read@plt>
cmp    $0xffffffff,%eax
je     1219 <is_auth_ok+0xc9>
lea    -0x1030(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1214 <is_auth_ok+0xc4>
lea    -0x2030(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1214 <is_auth_ok+0xc4>
movl   $0x1,-0x24(%rbp)
jmp    1219 <is_auth_ok+0xc9>
jmp    11b1 <is_auth_ok+0x61>
mov    -0x2038(%rbp),%rdi
call   1070 <pass_close@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_auth_ok>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x2010,%rsp
mov    %rdx,%r15
mov    %rsi,%rbp
lea    0x8(%rsp),%rsi
call   1050 <pass_init@plt>
cmp    $0xffffffff,%eax
je     11f7 <is_auth_ok+0xa7>
mov    0x8(%rsp),%rdx
lea    0x1010(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <pass_read@plt>
xor    %r14d,%r14d
cmp    $0xffffffff,%eax
je     11eb <is_auth_ok+0x9b>
lea    0x1010(%rsp),%rbx
lea    0x10(%rsp),%r12
jmp    11c5 <is_auth_ok+0x75>
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <pass_read@plt>
cmp    $0xffffffff,%eax
je     11eb <is_auth_ok+0x9b>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11b0 <is_auth_ok+0x60>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11b0 <is_auth_ok+0x60>
mov    $0x1,%r14d
mov    0x8(%rsp),%rdi
call   1070 <pass_close@plt>
jmp    120d <is_auth_ok+0xbd>
lea    0xe02(%rip),%rsi
xor    %r14d,%r14d
xor    %edi,%edi
mov    $0x7b,%edx
call   1060 <_err_msg@plt>
mov    %r14d,%eax
add    $0x2010,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [154 x i8] c"[/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zh1149277309/fms/refs/heads/master/server/auth.c,%d] pass_init\00"
define i32 @is_auth_ok(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [4096 x i8]
%10 = alloca [4096 x i8]
%11 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %8
%12 = load i8*, i8** %5
%13 = call i32 @pass_init(i8* %12, i32** %11)
%14 = icmp eq i32 -1, %13
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = call i32 @_err_msg(i32 0, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 123)
store i32 0, i32* %4
br label %40
17: ; preds = %3
br label %18
18: ; preds = %35, %17
%19 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%20 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%21 = load i32*, i32** %11
%22 = call i32 @pass_read(i8* %19, i8* %20, i32* %21)
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %36
24: ; preds = %18
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%26 = load i8*, i8** %6
%27 = call i64 @strcmp(i8* %25, i8* %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %24
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%31 = load i8*, i8** %7
%32 = call i64 @strcmp(i8* %30, i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %29
store i32 1, i32* %8
br label %36
35: ; preds = %29, %24
br label %18
36: ; preds = %34, %18
%37 = load i32*, i32** %11
%38 = call i32 @pass_close(i32* %37)
%39 = load i32, i32* %8
store i32 %39, i32* %4
br label %40
40: ; preds = %36, %15
%41 = load i32, i32* %4
ret i32 %41
}

LLVM IR (-O2):
@.str = [154 x i8] c"[/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zh1149277309/fms/refs/heads/master/server/auth.c,%d] pass_init\00"
define i32 @is_auth_ok(i8* %0, i8* %1, i8* %2) {
%4 = alloca [4096 x i8]
%5 = alloca [4096 x i8]
%6 = alloca i32*
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%9 = bitcast i32** %6 to i8*
%10 = call i32 @pass_init(i8* %0, i32** %6)
%11 = icmp eq i32 %10, -1
br i1 %11, label %16, label %12
12: ; preds = %3
%13 = load i32*, i32** %6
%14 = call i32 @pass_read(i8* %7, i8* %8, i32* %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %28, label %18
16: ; preds = %3
%17 = call i32 @_err_msg(i32 0, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 123)
br label %32
18: ; preds = %12, %24
%19 = call i64 @strcmp(i8* %7, i8* %1)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i64 @strcmp(i8* %8, i8* %2)
%23 = icmp eq i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %21, %18
%25 = load i32*, i32** %6
%26 = call i32 @pass_read(i8* %7, i8* %8, i32* %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %18
28: ; preds = %24, %21, %12
%29 = phi i32 [ 0, %12 ], [ 1, %21 ], [ 0, %24 ]
%30 = load i32*, i32** %6
%31 = call i32 @pass_close(i32* %30)
br label %32
32: ; preds = %28, %16
%33 = phi i32 [ 0, %16 ], [ %29, %28 ]
ret i32 %33
}