#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*/ *fopen(char *, char *);
scalar_t__ get_double(int, int *, double *);
int /*<<< orphan*/ m_clear(int);
int m_create(int, int);
int /*<<< orphan*/ m_free(int);
char m_fscan2(int, char, int /*<<< orphan*/ *);
int /*<<< orphan*/ m_put(int, ...);
scalar_t__ mls(int, int);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ puts(char *);
int load(char *name, int col) {
  int i, m;
  int table = m_create(col, sizeof(int));
  for (i = 0; i < col; i++) {
    m = m_create(10, sizeof(double));
    m_put(table, &m);
  }
  FILE *fp = fopen(name, "r");
  if (!fp)
    return table;
  m = m_create(10, 1);
  double d[col];
  int p;
  while (m_fscan2(m, '\n', fp) == '\n') {
    p = 0;
    for (i = 0; i < col; i++) {
      if (get_double(m, &p, d + i))
        goto skip_line;
      printf(" %f", d[i]);
    }
    for (i = 0; i < col; i++) {
      m_put((*(int *)mls((table), (i))), d + i);
    }
  skip_line:
    puts("");
    m_clear(m);
  }
  fclose(fp);
  m_free(m);
  return table;
}


x86 assembly (clang, -O0):
<load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   10b0 <m_create@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1210 <load+0x60>
mov    $0xa,%edi
mov    $0x8,%esi
call   10b0 <m_create@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1030 <m_put@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d6 <load+0x26>
mov    -0x10(%rbp),%rdi
lea    0xde5(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    123a <load+0x8a>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    137b <load+0x1cb>
mov    $0xa,%edi
mov    $0x1,%esi
call   10b0 <m_create@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rdx
mov    $0xa,%esi
call   1050 <m_fscan2@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    135d <load+0x1ad>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12fb <load+0x14b>
mov    -0x48(%rbp),%rdx
mov    -0x1c(%rbp),%edi
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    -0x3c(%rbp),%rsi
call   1080 <get_double@plt>
cmp    $0x0,%rax
je     12d4 <load+0x124>
jmp    1344 <load+0x194>
mov    -0x48(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xd1a(%rip),%rdi
call   1070 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    129e <load+0xee>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    133f <load+0x18f>
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%esi
call   10d0 <mls@plt>
mov    -0x48(%rbp),%rsi
mov    (%rax),%edi
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    $0x0,%al
call   1030 <m_put@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1302 <load+0x152>
jmp    1344 <load+0x194>
lea    0xcba(%rip),%rdi
call   1040 <puts@plt>
mov    -0x1c(%rbp),%edi
call   10c0 <m_clear@plt>
jmp    1273 <load+0xc3>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x1c(%rbp),%edi
call   1090 <m_free@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
mov    $0x4,%esi
call   10b0 <m_create@plt>
mov    %eax,%r12d
mov    %ebx,-0x30(%rbp)
test   %ebx,%ebx
jle    1214 <load+0x64>
lea    -0x2c(%rbp),%r15
mov    -0x30(%rbp),%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
mov    $0x8,%esi
call   10b0 <m_create@plt>
mov    %eax,-0x2c(%rbp)
mov    %r12d,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <m_put@plt>
add    $0xffffffff,%ebx
jne    11f0 <load+0x40>
lea    0xde5(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1350 <load+0x1a0>
mov    %rax,%rbx
mov    %r12d,-0x34(%rbp)
mov    $0xa,%edi
mov    $0x1,%esi
call   10b0 <m_create@plt>
mov    %rsp,-0x48(%rbp)
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%r12d
mov    %rsp,%rcx
lea    0xf(,%r12,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    -0x2c(%rbp),%edi
mov    $0xa,%esi
mov    %rbx,%rdx
call   1050 <m_fscan2@plt>
cmp    $0xa,%al
jne    1338 <load+0x188>
lea    -0x38(%rbp),%r14
lea    0xd79(%rip),%r13
mov    %rbx,-0x50(%rbp)
jmp    12ba <load+0x10a>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%edi
call   10c0 <m_clear@plt>
mov    -0x2c(%rbp),%edi
mov    $0xa,%esi
mov    -0x50(%rbp),%rbx
mov    %rbx,%rdx
call   1050 <m_fscan2@plt>
cmp    $0xa,%al
jne    1338 <load+0x188>
movl   $0x0,-0x38(%rbp)
mov    %r12,%rbx
mov    -0x40(%rbp),%r15
cmpl   $0x0,-0x30(%rbp)
jle    1290 <load+0xe0>
xchg   %ax,%ax
mov    -0x2c(%rbp),%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1080 <get_double@plt>
test   %rax,%rax
jne    1290 <load+0xe0>
movsd  (%r15),%xmm0
mov    %r13,%rdi
call   1070 <printf@plt>
add    $0x8,%r15
add    $0xffffffffffffffff,%rbx
jne    12d0 <load+0x120>
cmpl   $0x0,-0x30(%rbp)
jle    1290 <load+0xe0>
mov    -0x40(%rbp),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    -0x34(%rbp),%edi
mov    %ebx,%esi
call   10d0 <mls@plt>
mov    (%rax),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <m_put@plt>
add    $0x1,%rbx
add    $0x8,%r15
cmp    %rbx,%r12
jne    1310 <load+0x160>
jmp    1290 <load+0xe0>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    -0x2c(%rbp),%edi
call   1090 <m_free@plt>
mov    -0x48(%rbp),%rsp
mov    -0x34(%rbp),%r12d
mov    %r12d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c" %f\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @load(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @m_create(i32 %13, i32 4)
store i32 %14, i32* %8
store i32 0, i32* %6
br label %15
15: ; preds = %23, %2
%16 = load i32, i32* %6
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = call i32 @m_create(i32 10, i32 8)
store i32 %20, i32* %7
%21 = load i32, i32* %8
%22 = call i32 (i32, ...) @m_put(i32 %21, i32* %7)
br label %23
23: ; preds = %19
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %15
26: ; preds = %15
%27 = load i8*, i8** %4
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %28, i32** %9
%29 = load i32*, i32** %9
%30 = icmp ne i32* %29, null
br i1 %30, label %33, label %31
31: ; preds = %26
%32 = load i32, i32* %8
store i32 %32, i32* %3
br label %97
33: ; preds = %26
%34 = call i32 @m_create(i32 10, i32 1)
store i32 %34, i32* %7
%35 = load i32, i32* %5
%36 = zext i32 %35 to i64
%37 = call i8* @llvm.stacksave()
store i8* %37, i8** %10
%38 = alloca double, i64 %36
store i64 %36, i64* %11
br label %39
39: ; preds = %86, %33
%40 = load i32, i32* %7
%41 = load i32*, i32** %9
%42 = call signext i8 @m_fscan2(i32 %40, i8 signext 10, i32* %41)
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 10
br i1 %44, label %45, label %90
45: ; preds = %39
store i32 0, i32* %12
store i32 0, i32* %6
br label %46
46: ; preds = %64, %45
%47 = load i32, i32* %6
%48 = load i32, i32* %5
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %67
50: ; preds = %46
%51 = load i32, i32* %7
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %38, i64 %53
%55 = call i64 @get_double(i32 %51, i32* %12, double* %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %50
br label %86
58: ; preds = %50
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %38, i64 %60
%62 = load double, double* %61
%63 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %62)
br label %64
64: ; preds = %58
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %46
67: ; preds = %46
store i32 0, i32* %6
br label %68
68: ; preds = %82, %67
%69 = load i32, i32* %6
%70 = load i32, i32* %5
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %85
72: ; preds = %68
%73 = load i32, i32* %8
%74 = load i32, i32* %6
%75 = call i64 @mls(i32 %73, i32 %74)
%76 = inttoptr i64 %75 to i32*
%77 = load i32, i32* %76
%78 = load i32, i32* %6
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %38, i64 %79
%81 = call i32 (i32, ...) @m_put(i32 %77, double* %80)
br label %82
82: ; preds = %72
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 1
store i32 %84, i32* %6
br label %68
85: ; preds = %68
br label %86
86: ; preds = %85, %57
%87 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%88 = load i32, i32* %7
%89 = call i32 @m_clear(i32 %88)
br label %39
90: ; preds = %39
%91 = load i32*, i32** %9
%92 = call i32 @fclose(i32* %91)
%93 = load i32, i32* %7
%94 = call i32 @m_free(i32 %93)
%95 = load i32, i32* %8
store i32 %95, i32* %3
%96 = load i8*, i8** %10
br label %97
97: ; preds = %90, %31
%98 = load i32, i32* %3
ret i32 %98
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c" %f\00"
define i32 @load(i8* nocapture %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 @m_create(i32 %1, i32 4)
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %14
8: ; preds = %2, %8
%9 = phi i32 [ %12, %8 ], [ 0, %2 ]
%10 = call i32 @m_create(i32 10, i32 8)
store i32 %10, i32* %3
%11 = call i32 (i32, ...) @m_put(i32 %6, i32* %3)
%12 = add nuw nsw i32 %9, 1
%13 = icmp eq i32 %12, %1
br i1 %13, label %14, label %8
14: ; preds = %8, %2
%15 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %60, label %17
17: ; preds = %14
%18 = call i32 @m_create(i32 10, i32 1)
store i32 %18, i32* %3
%19 = zext i32 %1 to i64
%20 = call i8* @llvm.stacksave()
%21 = alloca double, i64 %19
%22 = bitcast i32* %4 to i8*
%23 = load i32, i32* %3
%24 = call signext i8 @m_fscan2(i32 %23, i8 signext 10, i32* %15)
%25 = icmp eq i8 %24, 10
br i1 %25, label %26, label %56
26: ; preds = %17, %49
store i32 0, i32* %4
br i1 %7, label %28, label %49
27: ; preds = %34
br i1 %7, label %39, label %49
28: ; preds = %26, %34
%29 = phi i64 [ %37, %34 ], [ 0, %26 ]
%30 = load i32, i32* %3
%31 = getelementptr inbounds double, double* %21, i64 %29
%32 = call i64 @get_double(i32 %30, i32* %4, double* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %49
34: ; preds = %28
%35 = load double, double* %31
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %35)
%37 = add nuw nsw i64 %29, 1
%38 = icmp eq i64 %37, %19
br i1 %38, label %27, label %28
39: ; preds = %27, %39
%40 = phi i64 [ %47, %39 ], [ 0, %27 ]
%41 = trunc i64 %40 to i32
%42 = call i64 @mls(i32 %6, i32 %41)
%43 = inttoptr i64 %42 to i32*
%44 = load i32, i32* %43
%45 = getelementptr inbounds double, double* %21, i64 %40
%46 = call i32 (i32, ...) @m_put(i32 %44, double* %45)
%47 = add nuw nsw i64 %40, 1
%48 = icmp eq i64 %47, %19
br i1 %48, label %49, label %39
49: ; preds = %28, %39, %26, %27
%50 = call i32 @putchar(i32 10)
%51 = load i32, i32* %3
%52 = call i32 @m_clear(i32 %51)
%53 = load i32, i32* %3
%54 = call signext i8 @m_fscan2(i32 %53, i8 signext 10, i32* %15)
%55 = icmp eq i8 %54, 10
br i1 %55, label %26, label %56
56: ; preds = %49, %17
%57 = call i32 @fclose(i32* %15)
%58 = load i32, i32* %3
%59 = call i32 @m_free(i32 %58)
br label %60
60: ; preds = %14, %56
ret i32 %6
}