#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 *, double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
void e(void) {
  FILE *filePtr;
  int accountNum;
  double dollarAmount;
  if ((filePtr = fopen("trans.dat", "r")) == NULL) {
    puts("File trans.dat non trovato");
  } else {
    printf("%-14s%-8s\n", "Numero Account", "Bilancio");
    fscanf(filePtr, "%d %lf", &accountNum, &dollarAmount);
    while (!feof(filePtr)) {
      printf("%-14d%-8.2lf\n", accountNum, dollarAmount);
      fscanf(filePtr, "%d%lf", &accountNum, &dollarAmount);
    }
  }
  fclose(filePtr);
  return;
}


x86 assembly (clang, -O0):
<e>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    119a <e+0x3a>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <e+0xc4>
lea    0xe86(%rip),%rdi
lea    0xe8a(%rip),%rsi
lea    0xe92(%rip),%rdx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1060 <fscanf@plt>
mov    -0x8(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ec <e+0x8c>
jmp    121f <e+0xbf>
mov    -0xc(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xe56(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe52(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1060 <fscanf@plt>
jmp    11ce <e+0x6e>
jmp    1224 <e+0xc4>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<e>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe8c(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1223 <e+0xc3>
lea    0xe94(%rip),%rdi
lea    0xe98(%rip),%rsi
lea    0xea0(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9b(%rip),%rsi
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
call   1060 <fscanf@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    122f <e+0xcf>
lea    0xe7d(%rip),%r14
lea    0xe84(%rip),%r15
lea    0x4(%rsp),%r12
lea    0x8(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x4(%rsp),%esi
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1060 <fscanf@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     11f0 <e+0x90>
jmp    122f <e+0xcf>
lea    0xde2(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"trans.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [27 x i8] c"File trans.dat non trovato\00"
@.str.3 = [11 x i8] c"%-14s%-8s\0A\00"
@.str.4 = [15 x i8] c"Numero Account\00"
@.str.5 = [9 x i8] c"Bilancio\00"
@.str.6 = [7 x i8] c"%d %lf\00"
@.str.7 = [14 x i8] c"%-14d%-8.2lf\0A\00"
@.str.8 = [6 x i8] c"%d%lf\00"
define void @e() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca double
%4 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %24
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%10 = load i32*, i32** %1
%11 = call i32 @fscanf(i32* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32* %2, double* %3)
br label %12
12: ; preds = %17, %8
%13 = load i32*, i32** %1
%14 = call i32 @feof(i32* %13)
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i32, i32* %2
%19 = load double, double* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %18, double %19)
%21 = load i32*, i32** %1
%22 = call i32 @fscanf(i32* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %2, double* %3)
br label %12
23: ; preds = %12
br label %24
24: ; preds = %23, %6
%25 = load i32*, i32** %1
%26 = call i32 @fclose(i32* %25)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"trans.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [27 x i8] c"File trans.dat non trovato\00"
@.str.3 = [11 x i8] c"%-14s%-8s\0A\00"
@.str.4 = [15 x i8] c"Numero Account\00"
@.str.5 = [9 x i8] c"Bilancio\00"
@.str.6 = [7 x i8] c"%d %lf\00"
@.str.7 = [14 x i8] c"%-14d%-8.2lf\0A\00"
@.str.8 = [6 x i8] c"%d%lf\00"
define void @e() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 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 %9
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %21
9: ; preds = %0
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32* %1, double* %2)
%12 = call i32 @feof(i32* %5)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %9, %14
%15 = load i32, i32* %1
%16 = load double, double* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %15, double %16)
%18 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %1, double* %2)
%19 = call i32 @feof(i32* %5)
%20 = icmp eq i32 %19, 0
br i1 %20, label %14, label %21
21: ; preds = %14, %9, %7
%22 = call i32 @fclose(i32* %5)
ret void
}