#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void readFile(FILE *file) {
  int account;
  char user[30];
  char password[30];
  printf("Unreadable File Data:\n");
  if ((file = fopen("users.dat", "r")) == NULL) {
    printf("File could not be opened\n");
  } else {
    fscanf(file, "%d%s%s", &account, user, password);
    while (!feof(file)) {
      printf("%d%s%s", account, user, password);
      fscanf(file, "%d%s%s", &account, user, password);
    }
    printf("\n");
    fclose(file);
  }
  printf("Readable File Data:\n");
  if ((file = fopen("usersr.txt", "r")) == NULL) {
    printf("File could not be opened\n");
  } else {
    printf("%-10s%-13s%s\n", "Account", "user", "password");
    fscanf(file, "%d%s%s", &account, user, password);
    while (!feof(file)) {
      printf("%-10d%-13s%s\n", account, user, password);
      fscanf(file, "%d%s%s", &account, user, password);
    }
    fclose(file);
  }
}


x86 assembly (clang, -O0):
<readFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
lea    0xf03(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    119e <readFile+0x4e>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1229 <readFile+0xd9>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rcx
lea    -0x50(%rbp),%r8
lea    0xe8a(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11d8 <readFile+0x88>
jmp    1212 <readFile+0xc2>
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rcx
lea    -0x50(%rbp),%r8
lea    0xe37(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <fscanf@plt>
jmp    11ba <readFile+0x6a>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe19(%rip),%rdi
lea    0xe36(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    126b <readFile+0x11b>
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    130b <readFile+0x1bb>
lea    0xdf0(%rip),%rdi
lea    0xdf7(%rip),%rsi
lea    0xdf8(%rip),%rdx
lea    0xdf6(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rcx
lea    -0x50(%rbp),%r8
lea    0xd9a(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12c8 <readFile+0x178>
jmp    1302 <readFile+0x1b2>
mov    -0xc(%rbp),%esi
lea    -0x30(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rcx
lea    -0x50(%rbp),%r8
lea    0xd47(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <fscanf@plt>
jmp    12aa <readFile+0x15a>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6f(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1238 <readFile+0xc8>
mov    %rax,%rbx
lea    0xe5a(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    %rax,%rdi
call   1070 <fscanf@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    1224 <readFile+0xb4>
lea    0xe30(%rip),%r14
lea    0x30(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
nopl   0x0(%rax)
mov    0xc(%rsp),%esi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1070 <fscanf@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     11f0 <readFile+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    1244 <readFile+0xd4>
lea    0xe39(%rip),%rdi
call   1040 <puts@plt>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
lea    0xdba(%rip),%rdi
lea    0xdd7(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     131e <readFile+0x1ae>
mov    %rax,%rbx
lea    0xda6(%rip),%rdi
lea    0xdad(%rip),%rsi
lea    0xdae(%rip),%rdx
lea    0xdac(%rip),%rcx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd71(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    %rbx,%rdi
call   1070 <fscanf@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    1314 <readFile+0x1a4>
lea    0xd7d(%rip),%r14
lea    0x30(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xd36(%rip),%r13
lea    0xc(%rsp),%rbp
nopl   0x0(%rax)
mov    0xc(%rsp),%esi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1070 <fscanf@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     12e0 <readFile+0x170>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    132a <readFile+0x1ba>
lea    0xd53(%rip),%rdi
call   1040 <puts@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Unreadable File Data:\0A\00"
@.str.1 = [10 x i8] c"users.dat\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [26 x i8] c"File could not be opened\0A\00"
@.str.4 = [7 x i8] c"%d%s%s\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [21 x i8] c"Readable File Data:\0A\00"
@.str.7 = [11 x i8] c"usersr.txt\00"
@.str.8 = [14 x i8] c"%-10s%-13s%s\0A\00"
@.str.9 = [8 x i8] c"Account\00"
@.str.10 = [5 x i8] c"user\00"
@.str.11 = [9 x i8] c"password\00"
@.str.12 = [14 x i8] c"%-10d%-13s%s\0A\00"
define void @readFile(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
store i32* %0, i32** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %7, i32** %2
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %34
11: ; preds = %1
%12 = load i32*, i32** %2
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%15 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %3, i8* %13, i8* %14)
br label %16
16: ; preds = %21, %11
%17 = load i32*, i32** %2
%18 = call i32 @feof(i32* %17)
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
br i1 %20, label %21, label %30
21: ; preds = %16
%22 = load i32, i32* %3
%23 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %22, i8* %23, i8* %24)
%26 = load i32*, i32** %2
%27 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%28 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%29 = call i32 @fscanf(i32* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %3, i8* %27, i8* %28)
br label %16
30: ; preds = %16
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%32 = load i32*, i32** %2
%33 = call i32 @fclose(i32* %32)
br label %34
34: ; preds = %30, %9
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%36 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %36, i32** %2
%37 = icmp eq i32* %36, null
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %63
40: ; preds = %34
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%42 = load i32*, i32** %2
%43 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%44 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%45 = call i32 @fscanf(i32* %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %3, i8* %43, i8* %44)
br label %46
46: ; preds = %51, %40
%47 = load i32*, i32** %2
%48 = call i32 @feof(i32* %47)
%49 = icmp ne i32 %48, 0
%50 = xor i1 %49, true
br i1 %50, label %51, label %60
51: ; preds = %46
%52 = load i32, i32* %3
%53 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%54 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 %52, i8* %53, i8* %54)
%56 = load i32*, i32** %2
%57 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%58 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%59 = call i32 @fscanf(i32* %56, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %3, i8* %57, i8* %58)
br label %46
60: ; preds = %46
%61 = load i32*, i32** %2
%62 = call i32 @fclose(i32* %61)
br label %63
63: ; preds = %60, %38
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"users.dat\00"
@.str.2 = [2 x i8] c"r\00"
@.str.4 = [7 x i8] c"%d%s%s\00"
@.str.7 = [11 x i8] c"usersr.txt\00"
@.str.8 = [14 x i8] c"%-10s%-13s%s\0A\00"
@.str.9 = [8 x i8] c"Account\00"
@.str.10 = [5 x i8] c"user\00"
@.str.11 = [9 x i8] c"password\00"
@.str.12 = [14 x i8] c"%-10d%-13s%s\0A\00"
@str = [22 x i8] c"Unreadable File Data:\00"
@str.13 = [20 x i8] c"Readable File Data:\00"
@str.15 = [25 x i8] c"File could not be opened\00"
define void @readFile(i32* nocapture readnone %0) {
%2 = alloca i32
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = bitcast i32* %2 to i8*
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.15, i64 0, i64 0))
br label %26
13: ; preds = %1
%14 = call i32 @fscanf(i32* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %2, i8* %6, i8* %7)
%15 = call i32 @feof(i32* %9)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %13, %17
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %18, i8* %6, i8* %7)
%20 = call i32 @fscanf(i32* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %2, i8* %6, i8* %7)
%21 = call i32 @feof(i32* %9)
%22 = icmp eq i32 %21, 0
br i1 %22, label %17, label %23
23: ; preds = %17, %13
%24 = call i32 @putchar(i32 10)
%25 = call i32 @fclose(i32* %9)
br label %26
26: ; preds = %23, %11
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.13, i64 0, i64 0))
%28 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.15, i64 0, i64 0))
br label %45
32: ; preds = %26
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%34 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %2, i8* %6, i8* %7)
%35 = call i32 @feof(i32* %28)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %32, %37
%38 = load i32, i32* %2
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 %38, i8* %6, i8* %7)
%40 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %2, i8* %6, i8* %7)
%41 = call i32 @feof(i32* %28)
%42 = icmp eq i32 %41, 0
br i1 %42, label %37, label %43
43: ; preds = %37, %32
%44 = call i32 @fclose(i32* %28)
br label %45
45: ; preds = %43, %30
ret void
}