#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 *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *, double *);
void estload(int *matrix, int Nx, int Ny) {
  FILE *file = fopen("Maps/estaciones.dat", "r");
  int x = 0, y = 0;
  double t = 0;
  for (; fscanf(file, "%d\t%d\t%f", &x, &y, &t) && !feof(file);)
    matrix[y * Nx + x] = 1;
  fclose(file);
}


x86 assembly (clang, -O0):
<estload>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xea7(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe8c(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1040 <fscanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     11c1 <estload+0x81>
mov    -0x18(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    11d1 <estload+0x91>
jmp    11ee <estload+0xae>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    117f <estload+0x3f>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<estload>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xea6(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe8d(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    %rax,%rdi
call   1040 <fscanf@plt>
test   %rax,%rax
je     1202 <estload+0xc2>
movslq %ebp,%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x10(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
jne    1202 <estload+0xc2>
movslq 0x8(%rsp),%rax
imul   %r15,%rax
movslq 0xc(%rsp),%rcx
add    %rax,%rcx
movl   $0x1,(%r14,%rcx,4)
mov    %rbx,%rdi
lea    0xe27(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
call   1040 <fscanf@plt>
test   %rax,%rax
jne    11c0 <estload+0x80>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Maps/estaciones.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%d\09%d\09%f\00"
define void @estload(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %7
store i32 0, i32* %8
store i32 0, i32* %9
store double 0.000000e+00, double* %10
br label %12
12: ; preds = %23, %3
%13 = load i32*, i32** %7
%14 = call i64 @fscanf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %8, i32* %9, double* %10)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i32*, i32** %7
%18 = call i32 @feof(i32* %17)
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
br label %21
21: ; preds = %16, %12
%22 = phi i1 [ false, %12 ], [ %20, %16 ]
br i1 %22, label %23, label %32
23: ; preds = %21
%24 = load i32*, i32** %4
%25 = load i32, i32* %9
%26 = load i32, i32* %5
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %8
%29 = add nsw i32 %27, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %24, i64 %30
store i32 1, i32* %31
br label %12
32: ; preds = %21
%33 = load i32*, i32** %7
%34 = call i32 @fclose(i32* %33)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Maps/estaciones.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%d\09%d\09%f\00"
define void @estload(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = bitcast double* %6 to i8*
store double 0.000000e+00, double* %6
%11 = call i64 @fscanf(i32* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %4, i32* %5, double* %6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %3, %16
%14 = call i32 @feof(i32* %7)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i32, i32* %5
%18 = mul nsw i32 %17, %1
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %0, i64 %21
store i32 1, i32* %22
%23 = call i64 @fscanf(i32* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %4, i32* %5, double* %6)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %13
25: ; preds = %13, %16, %3
%26 = call i32 @fclose(i32* %7)
ret void
}