#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*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fread(struct emp **, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  struct emp {
    char name[64];
    long int telephone;
    int hoursWorked;
    float hourlyWage;
  };
  struct emp employees[10];
  FILE *emp_f;
  if ((emp_f = fopen("EMP.bin", "r")) == NULL) {
    printf("Unable to open employee file!\n");
    exit(1);
  }
  if (fread(&employees, sizeof(struct emp), 10, emp_f) == 0) {
    printf("Unable to read from employee file!\n");
    exit(1);
  }
  for (int i = 0; i < 10; i++) {
    printf("Employee #%d:\n", i + 1);
    printf("Name: %s\n", employees[i].name);
    printf("Telephone number: %ld\n", employees[i].telephone);
    printf("Hours Worked: %d\n", employees[i].hoursWorked);
    printf("Hourly Wage: %.2f\n", employees[i].hourlyWage);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x338(%rbp)
cmp    $0x0,%rax
jne    1195 <main+0x55>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    -0x330(%rbp),%rdi
mov    -0x338(%rbp),%rcx
mov    $0x50,%esi
mov    $0xa,%edx
call   1030 <fread@plt>
cmp    $0x0,%rax
jne    11d4 <main+0x94>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movl   $0x0,-0x33c(%rbp)
cmpl   $0xa,-0x33c(%rbp)
jge    12c0 <main+0x180>
mov    -0x33c(%rbp),%esi
add    $0x1,%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x33c(%rbp),%rax
lea    -0x330(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x33c(%rbp),%rcx
lea    -0x330(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    0x40(%rax),%rsi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x33c(%rbp),%rcx
lea    -0x330(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    0x48(%rax),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x33c(%rbp),%rcx
lea    -0x330(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movss  0x4c(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x33c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x33c(%rbp)
jmp    11de <main+0x9e>
mov    -0x4(%rbp),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x328,%rsp
lea    0xe88(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1254 <main+0xf4>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    $0xa,%edx
mov    %rax,%rcx
call   1050 <fread@plt>
test   %rax,%rax
je     125d <main+0xfd>
mov    $0xfffffffffffffff6,%r14
lea    0xe5d(%rip),%r15
lea    0xe60(%rip),%r12
lea    0xe70(%rip),%r13
lea    0xe7b(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xb(%r14),%esi
lea    0xe1f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x40(%rbx),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x48(%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movss  0x4c(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x50,%rbx
inc    %r14
jne    11e0 <main+0x80>
xor    %eax,%eax
add    $0x328,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe27(%rip),%rdi
jmp    1264 <main+0x104>
lea    0xdfb(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.emp = type { [64 x i8], i64, i32, float }
%struct.emp.0 = type opaque
@.str = [8 x i8] c"EMP.bin\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [31 x i8] c"Unable to open employee file!\0A\00"
@.str.3 = [36 x i8] c"Unable to read from employee file!\0A\00"
@.str.4 = [15 x i8] c"Employee #%d:\0A\00"
@.str.5 = [10 x i8] c"Name: %s\0A\00"
@.str.6 = [23 x i8] c"Telephone number: %ld\0A\00"
@.str.7 = [18 x i8] c"Hours Worked: %d\0A\00"
@.str.8 = [19 x i8] c"Hourly Wage: %.2f\0A\00"
@.str.9 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x %struct.emp]
%7 = alloca i32*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %7
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = bitcast [10 x %struct.emp]* %6 to %struct.emp.0**
%16 = load i32*, i32** %7
%17 = call i64 @fread(%struct.emp.0** %15, i32 80, i32 10, i32* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %14
store i32 0, i32* %8
br label %23
23: ; preds = %56, %22
%24 = load i32, i32* %8
%25 = icmp slt i32 %24, 10
br i1 %25, label %26, label %59
26: ; preds = %23
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %6, i64 0, i64 %31
%33 = getelementptr inbounds %struct.emp, %struct.emp* %32, i32 0, i32 0
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %33, i64 0, i64 0
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %6, i64 0, i64 %37
%39 = getelementptr inbounds %struct.emp, %struct.emp* %38, i32 0, i32 1
%40 = load i64, i64* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i64 %40)
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %6, i64 0, i64 %43
%45 = getelementptr inbounds %struct.emp, %struct.emp* %44, i32 0, i32 2
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %6, i64 0, i64 %49
%51 = getelementptr inbounds %struct.emp, %struct.emp* %50, i32 0, i32 3
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %56
56: ; preds = %26
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %23
59: ; preds = %23
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
%struct.emp = type { [64 x i8], i64, i32, float }
%struct.emp.0 = type opaque
@.str = [8 x i8] c"EMP.bin\00"
@.str.1 = [2 x i8] c"r\00"
@.str.4 = [15 x i8] c"Employee #%d:\0A\00"
@.str.5 = [10 x i8] c"Name: %s\0A\00"
@.str.6 = [23 x i8] c"Telephone number: %ld\0A\00"
@.str.7 = [18 x i8] c"Hours Worked: %d\0A\00"
@.str.8 = [19 x i8] c"Hourly Wage: %.2f\0A\00"
@str = [35 x i8] c"Unable to read from employee file!\00"
@str.10 = [30 x i8] c"Unable to open employee file!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x %struct.emp]
%4 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %3, i64 0, i64 0, i32 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.10, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = bitcast [10 x %struct.emp]* %3 to %struct.emp.0**
%12 = call i64 @fread(%struct.emp.0** %11, i32 80, i32 10, i32* %5)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %18
ret i32 0
18: ; preds = %10, %18
%19 = phi i64 [ %20, %18 ], [ 0, %10 ]
%20 = add nuw nsw i64 %19, 1
%21 = trunc i64 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %3, i64 0, i64 %19, i32 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %3, i64 0, i64 %19, i32 1
%26 = load i64, i64* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i64 %26)
%28 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %3, i64 0, i64 %19, i32 2
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [10 x %struct.emp], [10 x %struct.emp]* %3, i64 0, i64 %19, i32 3
%32 = load float, float* %31
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %33)
%35 = call i32 @putchar(i32 10)
%36 = icmp eq i64 %20, 10
br i1 %36, label %17, label %18
}