#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *, char *, char *, char *,
                  char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char fileName[20] = "p504pe5.dat";
  char objName[13], objAddress[6], objCity[11], objState[5], objAddressB[11],
      objAddressC[6];
  FILE *wrkFile;
  wrkFile = fopen(fileName, "r");
  if (wrkFile == NULL) {
    printf("\nFailed to open the p504pe5.dat file!\n");
    exit(1);
  }
  while (fscanf(wrkFile, "%s %s %s %s %s %s", objName, objAddress, objAddressB,
                objAddressC, objCity, objState) != EOF)
    printf("\n%s\n%s %s %s\n%s, %s\n", objName, objAddress, objAddressB,
           objAddressC, objCity, objState);
  fclose(wrkFile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe95(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    11b5 <main+0x65>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    11ba <main+0x6a>
mov    -0x60(%rbp),%rdi
lea    -0x2d(%rbp),%rdx
lea    -0x33(%rbp),%rcx
lea    -0x4e(%rbp),%r8
lea    -0x54(%rbp),%r9
lea    -0x3e(%rbp),%r10
lea    -0x43(%rbp),%rax
lea    0xe60(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <fscanf@plt>
mov    0x2df6(%rip),%rcx
cmp    (%rcx),%rax
je     122a <main+0xda>
lea    -0x2d(%rbp),%rsi
lea    -0x33(%rbp),%rdx
lea    -0x4e(%rbp),%rcx
lea    -0x54(%rbp),%r8
lea    -0x3e(%rbp),%r9
lea    -0x43(%rbp),%rax
lea    0xe35(%rip),%rdi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ba <main+0x6a>
mov    -0x60(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movl   $0x0,0x50(%rsp)
lea    0xe8b(%rip),%rsi
lea    0x40(%rsp),%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     1273 <main+0x113>
lea    0xb(%rsp),%rbp
lea    0x5d(%rsp),%r12
lea    0xe69(%rip),%rsi
lea    0x28(%rsp),%rdx
lea    0x22(%rsp),%rcx
lea    0x35(%rsp),%r8
lea    0x1c(%rsp),%r9
mov    %rax,%rdi
mov    %rax,0x10(%rsp)
push   %rbp
push   %r12
call   1060 <fscanf@plt>
add    $0x10,%rsp
mov    0x2e0c(%rip),%r13
cmp    0x0(%r13),%rax
je     1258 <main+0xf8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
sub    $0x8,%rsp
lea    0xe2d(%rip),%rdi
lea    0x30(%rsp),%rsi
lea    0x2a(%rsp),%rbp
mov    %rbp,%rdx
lea    0x3d(%rsp),%r15
mov    %r15,%rcx
lea    0x24(%rsp),%r14
mov    %r14,%r8
mov    %r12,%r9
xor    %eax,%eax
lea    0x13(%rsp),%rbx
push   %rbx
call   1050 <printf@plt>
add    $0x10,%rsp
mov    0x10(%rsp),%rdi
lea    0xdde(%rip),%rsi
lea    0x28(%rsp),%rdx
mov    %rbp,%rcx
mov    %r15,%r8
mov    %r14,%r9
push   %rbx
push   %r12
call   1060 <fscanf@plt>
add    $0x10,%rsp
cmp    0x0(%r13),%rax
jne    11f0 <main+0x90>
mov    0x10(%rsp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdc3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@__const.main.fileName = [20 x i8] c"p504pe5.dat\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"r\00"
@.str.1 = [39 x i8] c"\0AFailed to open the p504pe5.dat file!\0A\00"
@.str.2 = [18 x i8] c"%s %s %s %s %s %s\00"
@EOF = global i64 0
@.str.3 = [21 x i8] c"\0A%s\0A%s %s %s\0A%s, %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [13 x i8]
%4 = alloca [6 x i8]
%5 = alloca [11 x i8]
%6 = alloca [5 x i8]
%7 = alloca [11 x i8]
%8 = alloca [6 x i8]
%9 = alloca i32*
store i32 0, i32* %1
%10 = bitcast [20 x i8]* %2 to i8*
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %9
%13 = load i32*, i32** %9
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %0
br label %19
19: ; preds = %30, %18
%20 = load i32*, i32** %9
%21 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%22 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%23 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%25 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%26 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%27 = call i64 @fscanf(i32* %20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* %22, i8* %23, i8* %24, i8* %25, i8* %26)
%28 = load i64, i64* @EOF
%29 = icmp ne i64 %27, %28
br i1 %29, label %30, label %38
30: ; preds = %19
%31 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%33 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%34 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%35 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%36 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %31, i8* %32, i8* %33, i8* %34, i8* %35, i8* %36)
br label %19
38: ; preds = %19
%39 = load i32*, i32** %9
%40 = call i32 @fclose(i32* %39)
ret i32 0
}

LLVM IR (-O2):
@__const.main.fileName = [20 x i8] c"p504pe5.dat\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"%s %s %s %s %s %s\00"
@EOF = global i64 0
@.str.3 = [21 x i8] c"\0A%s\0A%s %s %s\0A%s, %s\0A\00"
@str = [38 x i8] c"\0AFailed to open the p504pe5.dat file!\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [13 x i8]
%3 = alloca [6 x i8]
%4 = alloca [11 x i8]
%5 = alloca [5 x i8]
%6 = alloca [11 x i8]
%7 = alloca [6 x i8]
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%15 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %21, label %17
17: ; preds = %0
%18 = call i64 @fscanf(i32* %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %10, i8* %13, i8* %14, i8* %11, i8* %12)
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %29, label %24
21: ; preds = %0
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %17, %24
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %9, i8* %10, i8* %13, i8* %14, i8* %11, i8* %12)
%26 = call i64 @fscanf(i32* %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %10, i8* %13, i8* %14, i8* %11, i8* %12)
%27 = load i64, i64* @EOF
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %24
29: ; preds = %24, %17
%30 = call i32 @fclose(i32* %15)
ret i32 0
}