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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ strcasecmp(char *, char *);
char *strtok(char *, char *);
int /*<<< orphan*/ username(char *);
void pass_1_file(char *name) {
  char buf[5555], *status;
  FILE *fpin = fopen(name, "r");
  while ((status = fgets(buf, sizeof(buf), fpin)) != NULL) {
    char *s = buf;
    while ((s = strtok(s, " \t")) != NULL) {
      if (strcasecmp(s, "CALL") == 0) {
        if ((s = strtok(NULL, ": \t")) == NULL)
          break;
        username(s);
      }
      s = 0;
    }
  }
  fclose(fpin);
}


x86 assembly (clang, -O0):
<pass_1_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x15e0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x15d0(%rbp)
lea    -0x15c0(%rbp),%rdi
mov    -0x15d0(%rbp),%rdx
mov    $0x15b3,%esi
call   1060 <fgets@plt>
mov    %rax,-0x15c8(%rbp)
cmp    $0x0,%rax
je     1245 <pass_1_file+0xe5>
lea    -0x15c0(%rbp),%rax
mov    %rax,-0x15d8(%rbp)
mov    -0x15d8(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x15d8(%rbp)
cmp    $0x0,%rax
je     1240 <pass_1_file+0xe0>
mov    -0x15d8(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1230 <pass_1_file+0xd0>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdfe(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x15d8(%rbp)
cmp    $0x0,%rax
jne    1224 <pass_1_file+0xc4>
jmp    1240 <pass_1_file+0xe0>
mov    -0x15d8(%rbp),%rdi
call   1050 <username@plt>
movq   $0x0,-0x15d8(%rbp)
jmp    11bd <pass_1_file+0x5d>
jmp    1186 <pass_1_file+0x26>
mov    -0x15d0(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x15e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pass_1_file>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x15c0,%rsp
lea    0xe89(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x15b3,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1208 <pass_1_file+0xa8>
lea    0xe6d(%rip),%rbx
mov    %rsp,%r15
lea    0xe5d(%rip),%r12
lea    0xe5b(%rip),%r13
jmp    11c5 <pass_1_file+0x65>
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x15b3,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1208 <pass_1_file+0xa8>
mov    %r15,%rdi
jmp    11da <pass_1_file+0x7a>
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1050 <username@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <strtok@plt>
test   %rax,%rax
je     11b0 <pass_1_file+0x50>
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    11d8 <pass_1_file+0x78>
xor    %edi,%edi
mov    %r13,%rsi
call   1080 <strtok@plt>
test   %rax,%rax
jne    11d0 <pass_1_file+0x70>
jmp    11b0 <pass_1_file+0x50>
mov    %r14,%rdi
call   1040 <fclose@plt>
add    $0x15c0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c" \09\00"
@.str.2 = [5 x i8] c"CALL\00"
@.str.3 = [4 x i8] c": \09\00"
define void @pass_1_file(i8* %0) {
%2 = alloca i8*
%3 = alloca [5555 x i8]
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %5
br label %9
9: ; preds = %32, %1
%10 = getelementptr inbounds [5555 x i8], [5555 x i8]* %3, i64 0, i64 0
%11 = load i32*, i32** %5
%12 = call i8* @fgets(i8* %10, i32 5555, i32* %11)
store i8* %12, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %33
14: ; preds = %9
%15 = getelementptr inbounds [5555 x i8], [5555 x i8]* %3, i64 0, i64 0
store i8* %15, i8** %6
br label %16
16: ; preds = %31, %14
%17 = load i8*, i8** %6
%18 = call i8* @strtok(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %18, i8** %6
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %32
20: ; preds = %16
%21 = load i8*, i8** %6
%22 = call i64 @strcasecmp(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i8* %25, i8** %6
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %28
27: ; preds = %24
br label %32
28: ; preds = %24
%29 = load i8*, i8** %6
%30 = call i32 @username(i8* %29)
br label %31
31: ; preds = %28, %20
store i8* null, i8** %6
br label %16
32: ; preds = %27, %16
br label %9
33: ; preds = %9
%34 = load i32*, i32** %5
%35 = call i32 @fclose(i32* %34)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c" \09\00"
@.str.2 = [5 x i8] c"CALL\00"
@.str.3 = [4 x i8] c": \09\00"
define void @pass_1_file(i8* nocapture %0) {
%2 = alloca [5555 x i8]
%3 = getelementptr inbounds [5555 x i8], [5555 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i8* @fgets(i8* %3, i32 5555, i32* %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %25, label %7
7: ; preds = %1, %22
%8 = call i8* @strtok(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %22, label %10
10: ; preds = %7, %19
%11 = phi i8* [ %20, %19 ], [ %8, %7 ]
%12 = call i64 @strcasecmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i8* %15, null
br i1 %16, label %22, label %17
17: ; preds = %14
%18 = call i32 @username(i8* %15)
br label %19
19: ; preds = %17, %10
%20 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %10
22: ; preds = %19, %14, %7
%23 = call i8* @fgets(i8* %3, i32 5555, i32* %4)
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %7
25: ; preds = %22, %1
%26 = call i32 @fclose(i32* %4)
ret void
}