#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                           long, float);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, int *, long *,
                          float *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  char buffer[128];
  FILE *ptabla = NULL;
  long entl = 0, total_entl = 0;
  float real = 0.0F, total_real = 0.0F;
  int i = 0, c = 'A';
  if ((ptabla = fopen("tabla.d", "r")) != NULL) {
    printf("RESULTADOS:\n\n");
    for (i = 0, total_entl = 0, total_real = 0.0F; i < 10; i++) {
      fscanf(ptabla, "%s %c: %ld %f", buffer, &c, &entl, &real);
      total_entl += entl;
      total_real += real;
      printf("\t%s %c: %7ld %9.2f\n", buffer, c, entl, real);
    }
    printf("\n\tTotal:   %7ld %9.2f\n", total_entl, total_real);
  } else {
    if ((ptabla = fopen("tabla.d", "w")) == NULL)
      exit(1);
    for (i = 0, entl = 99999, real = 3.14F; i < 10; i++)
      fprintf(ptabla, "\tLínea %c: %7ld %9.2f\n", c++, entl /= 2, real *= 2);
    printf("El fichero no existía y lo hemos creado.\n");
    printf("\nEjecute de nuevo el programa.\n");
  }
  fclose(ptabla);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x98(%rbp)
movq   $0x0,-0xa0(%rbp)
movq   $0x0,-0xa8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xac(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0xb0(%rbp)
ff
movl   $0x0,-0xb4(%rbp)
movl   $0x41,-0xb8(%rbp)
lea    0xe44(%rip),%rdi
lea    0xe45(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmp    $0x0,%rax
je     12e0 <main+0x180>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xb4(%rbp)
movq   $0x0,-0xa8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xb0(%rbp)
ff
cmpl   $0xa,-0xb4(%rbp)
jge    12ba <main+0x15a>
mov    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xdef(%rip),%rsi
lea    -0xb8(%rbp),%rcx
lea    -0xa0(%rbp),%r8
lea    -0xac(%rbp),%r9
call   1050 <fscanf@plt>
mov    -0xa0(%rbp),%rax
add    -0xa8(%rbp),%rax
mov    %rax,-0xa8(%rbp)
movss  -0xac(%rbp),%xmm0
ff
addss  -0xb0(%rbp),%xmm0
ff
movss  %xmm0,-0xb0(%rbp)
ff
lea    -0x90(%rbp),%rsi
mov    -0xb8(%rbp),%edx
mov    -0xa0(%rbp),%rcx
movss  -0xac(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd8f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    120f <main+0xaf>
mov    -0xa8(%rbp),%rsi
movss  -0xb0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd6e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    13d1 <main+0x271>
lea    0xd21(%rip),%rdi
lea    0xd6b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmp    $0x0,%rax
jne    130e <main+0x1ae>
mov    $0x1,%edi
call   1080 <exit@plt>
movl   $0x0,-0xb4(%rbp)
movq   $0x1869f,-0xa0(%rbp)
movss  0xcd5(%rip),%xmm0
movss  %xmm0,-0xac(%rbp)
ff
cmpl   $0xa,-0xb4(%rbp)
jge    13b5 <main+0x255>
mov    -0x98(%rbp),%rdi
mov    -0xb8(%rbp),%eax
mov    %eax,-0xbc(%rbp)
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
mov    -0xa0(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    -0xbc(%rbp),%edx
mov    %rax,%rcx
mov    %rcx,-0xa0(%rbp)
movss  0xc7f(%rip),%xmm0
mulss  -0xac(%rbp),%xmm0
ff
movss  %xmm0,-0xac(%rbp)
ff
lea    0xcbf(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1333 <main+0x1d3>
lea    0xcb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x98(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
movq   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x41,0x10(%rsp)
lea    0xe87(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1268 <main+0xf8>
mov    %rax,%rbp
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0xa,%r13d
xor    %ebx,%ebx
lea    0x20(%rsp),%r12
lea    0x14(%rsp),%r15
lea    0xe59(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
lea    0xe38(%rip),%rsi
mov    %r12,%rdx
lea    0x10(%rsp),%rcx
lea    0x18(%rsp),%r8
mov    %r15,%r9
call   1060 <fscanf@plt>
mov    0x18(%rsp),%rcx
add    %rcx,%rbx
movss  0x14(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
mov    0x10(%rsp),%edx
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0xffffffff,%r13d
jne    11f0 <main+0x80>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfb(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    13e1 <main+0x271>
lea    0xdb9(%rip),%rdi
lea    0xdf5(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13fd <main+0x28d>
mov    %rax,%rbp
lea    0xddf(%rip),%r14
movss  0xd6a(%rip),%xmm0
mov    $0xc34f,%ecx
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0x41,%edx
call   1070 <fprintf@plt>
movss  0xd51(%rip),%xmm0
mov    $0x61a7,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x42,%edx
call   1070 <fprintf@plt>
movss  0xd38(%rip),%xmm0
mov    $0x30d3,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x43,%edx
call   1070 <fprintf@plt>
movss  0xd1f(%rip),%xmm0
mov    $0x1869,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x44,%edx
call   1070 <fprintf@plt>
movss  0xd06(%rip),%xmm0
mov    $0xc34,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x45,%edx
call   1070 <fprintf@plt>
movss  0xced(%rip),%xmm0
mov    $0x61a,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x46,%edx
call   1070 <fprintf@plt>
movss  0xcd4(%rip),%xmm0
mov    $0x30d,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x47,%edx
call   1070 <fprintf@plt>
movss  0xcbb(%rip),%xmm0
mov    $0x186,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x48,%edx
call   1070 <fprintf@plt>
movss  0xca2(%rip),%xmm0
mov    $0xc3,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x49,%edx
call   1070 <fprintf@plt>
movss  0xc89(%rip),%xmm0
mov    $0x61,%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x4a,%edx
call   1070 <fprintf@plt>
movl   $0x4b,0x10(%rsp)
movq   $0x61,0x18(%rsp)
movl   $0x4548f5c3,0x14(%rsp)
45
lea    0xcb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xcd3(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"tabla.d\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"RESULTADOS:\0A\0A\00"
@.str.3 = [14 x i8] c"%s %c: %ld %f\00"
@.str.4 = [20 x i8] c"\09%s %c: %7ld %9.2f\0A\00"
@.str.5 = [23 x i8] c"\0A\09Total: %7ld %9.2f\0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [24 x i8] c"\09L\C3\ADnea %c: %7ld %9.2f\0A\00"
@.str.8 = [43 x i8] c"El fichero no exist\C3\ADa y lo hemos creado.\0A\00"
@.str.9 = [32 x i8] c"\0AEjecute de nuevo el programa.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca float
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %3
store i64 0, i64* %4
store i64 0, i64* %5
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
store i32 0, i32* %8
store i32 65, i32* %9
%10 = 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* %10, i32** %3
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %41
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
store i64 0, i64* %5
store float 0.000000e+00, float* %7
br label %14
14: ; preds = %33, %12
%15 = load i32, i32* %8
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %36
17: ; preds = %14
%18 = load i32*, i32** %3
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%20 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %19, i32* %9, i64* %4, float* %6)
%21 = load i64, i64* %4
%22 = load i64, i64* %5
%23 = add nsw i64 %22, %21
store i64 %23, i64* %5
%24 = load float, float* %6
%25 = load float, float* %7
%26 = fadd float %25, %24
store float %26, float* %7
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%28 = load i32, i32* %9
%29 = load i64, i64* %4
%30 = load float, float* %6
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %27, i32 %28, i64 %29, double %31)
br label %33
33: ; preds = %17
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %14
36: ; preds = %14
%37 = load i64, i64* %5
%38 = load float, float* %7
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 %37, double %39)
br label %65
41: ; preds = %0
%42 = 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.6, i64 0, i64 0))
store i32* %42, i32** %3
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %41
store i32 0, i32* %8
store i64 99999, i64* %4
store float 0x40091EB860000000, float* %6
br label %47
47: ; preds = %59, %46
%48 = load i32, i32* %8
%49 = icmp slt i32 %48, 10
br i1 %49, label %50, label %62
50: ; preds = %47
%51 = load i32*, i32** %3
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
store i32 %53, i32* %9
%54 = load i64, i64* %4
%55 = sdiv i64 %54, 2
store i64 %55, i64* %4
%56 = load float, float* %6
%57 = fmul float %56, 2.000000e+00
store float %57, float* %6
%58 = call i32 @fprintf(i32* %51, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 %52, i64 %55, float %57)
br label %59
59: ; preds = %50
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %47
62: ; preds = %47
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
br label %65
65: ; preds = %62, %36
%66 = load i32*, i32** %3
%67 = call i32 @fclose(i32* %66)
%68 = load i32, i32* %1
ret i32 %68
}

LLVM IR (-O2):
@.str = [8 x i8] c"tabla.d\00"
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [14 x i8] c"%s %c: %ld %f\00"
@.str.4 = [20 x i8] c"\09%s %c: %7ld %9.2f\0A\00"
@.str.5 = [23 x i8] c"\0A\09Total: %7ld %9.2f\0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [24 x i8] c"\09L\C3\ADnea %c: %7ld %9.2f\0A\00"
@str = [42 x i8] c"El fichero no exist\C3\ADa y lo hemos creado.\00"
@str.10 = [31 x i8] c"\0AEjecute de nuevo el programa.\00"
@str.11 = [13 x i8] c"RESULTADOS:\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = alloca i64
%3 = alloca float
%4 = alloca i32
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%6 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%7 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%8 = bitcast i32* %4 to i8*
store i32 65, i32* %4
%9 = 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))
%10 = icmp eq i32* %9, null
br i1 %10, label %30, label %11
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.11, i64 0, i64 0))
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ 0, %11 ], [ %25, %13 ]
%15 = phi float [ 0.000000e+00, %11 ], [ %21, %13 ]
%16 = phi i64 [ 0, %11 ], [ %19, %13 ]
%17 = call i32 @fscanf(i32* %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %5, i32* %4, i64* %2, float* %3)
%18 = load i64, i64* %2
%19 = add nsw i64 %18, %16
%20 = load float, float* %3
%21 = fadd float %15, %20
%22 = load i32, i32* %4
%23 = fpext float %20 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %5, i32 %22, i64 %18, double %23)
%25 = add nuw nsw i32 %14, 1
%26 = icmp eq i32 %25, 10
br i1 %26, label %27, label %13
27: ; preds = %13
%28 = fpext float %21 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 %19, double %28)
br label %48
30: ; preds = %0
%31 = 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.6, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %30
%36 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 65, i64 49999, float 0x40191EB860000000)
%37 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 66, i64 24999, float 0x40291EB860000000)
%38 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 67, i64 12499, float 0x40391EB860000000)
%39 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 68, i64 6249, float 0x40491EB860000000)
%40 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 69, i64 3124, float 0x40591EB860000000)
%41 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 70, i64 1562, float 0x40691EB860000000)
%42 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 71, i64 781, float 0x40791EB860000000)
%43 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 72, i64 390, float 0x40891EB860000000)
%44 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 73, i64 195, float 0x40991EB860000000)
%45 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 74, i64 97, float 0x40A91EB860000000)
store i32 75, i32* %4
store i64 97, i64* %2
store float 0x40A91EB860000000, float* %3
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
br label %48
48: ; preds = %35, %27
%49 = phi i32* [ %9, %27 ], [ %31, %35 ]
%50 = call i32 @fclose(i32* %49)
ret i32 0
}