#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ free_matrix3(double ***);
double ***new_matrix3(int, int, int);
int sscanf(char *, char *, ...);
int /*<<< orphan*/ stderr;
char *sword(char *, char *, int);
double ***load_matrix3(char *fin, int *n, int *m, int *p) {
  FILE *f = fopen(fin, "r");
  if (f == NULL) {
    fprintf(stderr, "Invalid filename: %s\n", fin);
    return NULL;
  }
  char sbuf0[128], *s = sbuf0;
  if (fgets(s, 128, f) == NULL || sscanf(s, "%d %d %d", n, m, p) < 3) {
    fprintf(stderr, "Corrupt matrix header in file %s\n", fin);
    fclose(f);
    return NULL;
  }
  double ***X = new_matrix3(*n, *m, *p);
  const int CHARS_PER_FLOAT = 20;
  char sbuf[CHARS_PER_FLOAT * (*p)];
  int i, j, k;
  for (i = 0; i < *n; i++) {
    for (j = 0; j < *m; j++) {
      s = sbuf;
      if (fgets(s, 10000, f) == NULL)
        break;
      for (k = 0; k < *p; k++) {
        if (sscanf(s, "%lf", &X[i][j][k]) < 1)
          break;
        s = sword(s, " \t", 1);
      }
      if (k < *p)
        break;
    }
    if (j < *m)
      break;
  }
  if (i < *n) {
    fprintf(stderr, "Corrupt matrix file '%s' at line %d\n", fin,
            i * (*m) + j + 2);
    fclose(f);
    free_matrix3(X);
    return NULL;
  }
  fclose(f);
  return X;
}


x86 assembly (clang, -O0):
<load_matrix3>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11e2 <load_matrix3+0x62>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    14ca <load_matrix3+0x34a>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x80,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1239 <load_matrix3+0xb9>
mov    -0xb8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    0xdef(%rip),%rsi
mov    $0x0,%al
call   1080 <sscanf@plt>
cmp    $0x3,%eax
jge    126a <load_matrix3+0xea>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
movq   $0x0,-0x8(%rbp)
jmp    14ca <load_matrix3+0x34a>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
call   1050 <new_matrix3@plt>
mov    %rax,-0xc0(%rbp)
movl   $0x14,-0xc4(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
shl    $0x2,%ecx
mov    %ecx,%eax
lea    (%rax,%rax,4),%eax
mov    %rsp,%rcx
mov    %rcx,-0xd0(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xd8(%rbp)
movl   $0x0,-0xdc(%rbp)
mov    -0xdc(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1433 <load_matrix3+0x2b3>
movl   $0x0,-0xe0(%rbp)
mov    -0xe0(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    1403 <load_matrix3+0x283>
mov    -0xf0(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x2710,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    1336 <load_matrix3+0x1b6>
jmp    1403 <load_matrix3+0x283>
movl   $0x0,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    13d3 <load_matrix3+0x253>
mov    -0xb8(%rbp),%rdi
mov    -0xc0(%rbp),%rax
movslq -0xdc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xe0(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0xe4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xcb8(%rip),%rsi
mov    $0x0,%al
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jge    13a0 <load_matrix3+0x220>
jmp    13d3 <load_matrix3+0x253>
mov    -0xb8(%rbp),%rdi
lea    0xc99(%rip),%rsi
mov    $0x1,%edx
call   1090 <sword@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1340 <load_matrix3+0x1c0>
mov    -0xe4(%rbp),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    13ea <load_matrix3+0x26a>
jmp    1403 <load_matrix3+0x283>
jmp    13ef <load_matrix3+0x26f>
mov    -0xe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe0(%rbp)
jmp    12f2 <load_matrix3+0x172>
mov    -0xe0(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    141a <load_matrix3+0x29a>
jmp    1433 <load_matrix3+0x2b3>
jmp    141f <load_matrix3+0x29f>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    12d6 <load_matrix3+0x156>
mov    -0xdc(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    14a2 <load_matrix3+0x322>
mov    0x2b94(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0xdc(%rbp),%ecx
mov    -0x20(%rbp),%rax
imul   (%rax),%ecx
add    -0xe0(%rbp),%ecx
add    $0x2,%ecx
lea    0xbdb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xc0(%rbp),%rdi
call   1030 <free_matrix3@plt>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0xe8(%rbp)
jmp    14c0 <load_matrix3+0x340>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xc0(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0xe8(%rbp)
mov    -0xd0(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_matrix3>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rcx,-0x38(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdi,%rbx
lea    0xe56(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1223 <load_matrix3+0xa3>
mov    %rax,%r14
lea    -0xf0(%rbp),%rdi
mov    $0x80,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11f9 <load_matrix3+0x79>
lea    0xe41(%rip),%rsi
xor    %r12d,%r12d
lea    -0xf0(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
xor    %eax,%eax
call   1080 <sscanf@plt>
cmp    $0x2,%eax
jg     1245 <load_matrix3+0xc5>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
lea    0xe18(%rip),%rsi
xor    %r15d,%r15d
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
jmp    1410 <load_matrix3+0x290>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
lea    0xdcf(%rip),%rsi
xor    %r15d,%r15d
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1410 <load_matrix3+0x290>
mov    -0x40(%rbp),%r13
mov    0x0(%r13),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%r15
mov    (%r15),%edx
call   1050 <new_matrix3@plt>
mov    %rsp,%rdx
mov    (%r15),%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x50(%rbp)
mov    %rsi,%rsp
mov    0x0(%r13),%ecx
test   %ecx,%ecx
mov    %rbx,-0x58(%rbp)
mov    %rax,-0x48(%rbp)
mov    %rdx,-0x60(%rbp)
jle    13b0 <load_matrix3+0x230>
mov    -0x30(%rbp),%rbx
mov    (%rbx),%eax
xor    %r12d,%r12d
mov    %r14,-0x68(%rbp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x0,%r15d
test   %eax,%eax
jle    1395 <load_matrix3+0x215>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    -0x50(%rbp),%rdi
mov    $0x2710,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1393 <load_matrix3+0x213>
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
test   %eax,%eax
jle    1360 <load_matrix3+0x1e0>
xor    %ebx,%ebx
xor    %r13d,%r13d
mov    -0x50(%rbp),%r14
nopl   (%rax)
mov    -0x48(%rbp),%rax
mov    (%rax,%r12,8),%rax
mov    (%rax,%r15,8),%rdx
add    %rbx,%rdx
mov    %r14,%rdi
lea    0xd2a(%rip),%rsi
xor    %eax,%eax
call   1080 <sscanf@plt>
test   %eax,%eax
jle    1370 <load_matrix3+0x1f0>
mov    %r14,%rdi
lea    0xd19(%rip),%rsi
mov    $0x1,%edx
call   1090 <sword@plt>
mov    %rax,%r14
add    $0x1,%r13
mov    -0x38(%rbp),%rax
movslq (%rax),%rax
add    $0x8,%rbx
cmp    %rax,%r13
jl     1300 <load_matrix3+0x180>
jmp    1376 <load_matrix3+0x1f6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %r13d,%r13d
cmp    %eax,%r13d
jge    1383 <load_matrix3+0x203>
jmp    1393 <load_matrix3+0x213>
nopw   0x0(%rax,%rax,1)
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
mov    -0x68(%rbp),%r14
mov    -0x30(%rbp),%rbx
cmp    %eax,%r13d
jl     1393 <load_matrix3+0x213>
add    $0x1,%r15
movslq (%rbx),%rax
cmp    %rax,%r15
jl     12d0 <load_matrix3+0x150>
mov    (%rbx),%eax
cmp    %eax,%r15d
jl     13f5 <load_matrix3+0x275>
add    $0x1,%r12
mov    -0x40(%rbp),%rcx
movslq (%rcx),%rcx
cmp    %rcx,%r12
jl     12b0 <load_matrix3+0x130>
jmp    13b4 <load_matrix3+0x234>
mov    -0x30(%rbp),%rbx
cmp    %ecx,%r12d
jge    1400 <load_matrix3+0x280>
mov    0x2c20(%rip),%rax
mov    (%rax),%edi
imul   (%rbx),%r12d
lea    (%r15,%r12,1),%ecx
add    $0x2,%ecx
lea    0xc76(%rip),%rsi
mov    -0x58(%rbp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free_matrix3@plt>
xor    %r15d,%r15d
jmp    140c <load_matrix3+0x28c>
mov    -0x40(%rbp),%rax
mov    (%rax),%ecx
cmp    %ecx,%r12d
jl     13b9 <load_matrix3+0x239>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    -0x48(%rbp),%r15
mov    -0x60(%rbp),%rsp
mov    %r15,%rax
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"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Invalid filename: %s\0A\00"
@.str.2 = [9 x i8] c"%d %d %d\00"
@.str.3 = [34 x i8] c"Corrupt matrix header in file %s\0A\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [3 x i8] c" \09\00"
@.str.6 = [37 x i8] c"Corrupt matrix file '%s' at line %d\0A\00"
define double*** @load_matrix3(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca double***
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [128 x i8]
%12 = alloca i8*
%13 = alloca double***
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i8* %0, i8** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%21 = load i8*, i8** %6
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %22, i32** %10
%23 = load i32*, i32** %10
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %29
25: ; preds = %4
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %6
%28 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %27)
store double*** null, double**** %5
br label %154
29: ; preds = %4
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
store i8* %30, i8** %12
%31 = load i8*, i8** %12
%32 = load i32*, i32** %10
%33 = call i32* @fgets(i8* %31, i32 128, i32* %32)
%34 = icmp eq i32* %33, null
br i1 %34, label %42, label %35
35: ; preds = %29
%36 = load i8*, i8** %12
%37 = load i32*, i32** %7
%38 = load i32*, i32** %8
%39 = load i32*, i32** %9
%40 = call i32 (i8*, i8*, ...) @sscanf(i8* %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %37, i32* %38, i32* %39)
%41 = icmp slt i32 %40, 3
br i1 %41, label %42, label %48
42: ; preds = %35, %29
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %6
%45 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = load i32*, i32** %10
%47 = call i32 @fclose(i32* %46)
store double*** null, double**** %5
br label %154
48: ; preds = %35
%49 = load i32*, i32** %7
%50 = load i32, i32* %49
%51 = load i32*, i32** %8
%52 = load i32, i32* %51
%53 = load i32*, i32** %9
%54 = load i32, i32* %53
%55 = call double*** @new_matrix3(i32 %50, i32 %52, i32 %54)
store double*** %55, double**** %13
store i32 20, i32* %14
%56 = load i32*, i32** %9
%57 = load i32, i32* %56
%58 = mul nsw i32 20, %57
%59 = zext i32 %58 to i64
%60 = call i8* @llvm.stacksave()
store i8* %60, i8** %15
%61 = alloca i8, i64 %59
store i64 %59, i64* %16
store i32 0, i32* %17
br label %62
62: ; preds = %125, %48
%63 = load i32, i32* %17
%64 = load i32*, i32** %7
%65 = load i32, i32* %64
%66 = icmp slt i32 %63, %65
br i1 %66, label %67, label %128
67: ; preds = %62
store i32 0, i32* %18
br label %68
68: ; preds = %115, %67
%69 = load i32, i32* %18
%70 = load i32*, i32** %8
%71 = load i32, i32* %70
%72 = icmp slt i32 %69, %71
br i1 %72, label %73, label %118
73: ; preds = %68
store i8* %61, i8** %12
%74 = load i8*, i8** %12
%75 = load i32*, i32** %10
%76 = call i32* @fgets(i8* %74, i32 10000, i32* %75)
%77 = icmp eq i32* %76, null
br i1 %77, label %78, label %79
78: ; preds = %73
br label %118
79: ; preds = %73
store i32 0, i32* %19
br label %80
80: ; preds = %105, %79
%81 = load i32, i32* %19
%82 = load i32*, i32** %9
%83 = load i32, i32* %82
%84 = icmp slt i32 %81, %83
br i1 %84, label %85, label %108
85: ; preds = %80
%86 = load i8*, i8** %12
%87 = load double***, double**** %13
%88 = load i32, i32* %17
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double**, double*** %87, i64 %89
%91 = load double**, double*** %90
%92 = load i32, i32* %18
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double*, double** %91, i64 %93
%95 = load double*, double** %94
%96 = load i32, i32* %19
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %95, i64 %97
%99 = call i32 (i8*, i8*, ...) @sscanf(i8* %86, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %98)
%100 = icmp slt i32 %99, 1
br i1 %100, label %101, label %102
101: ; preds = %85
br label %108
102: ; preds = %85
%103 = load i8*, i8** %12
%104 = call i8* @sword(i8* %103, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 1)
store i8* %104, i8** %12
br label %105
105: ; preds = %102
%106 = load i32, i32* %19
%107 = add nsw i32 %106, 1
store i32 %107, i32* %19
br label %80
108: ; preds = %101, %80
%109 = load i32, i32* %19
%110 = load i32*, i32** %9
%111 = load i32, i32* %110
%112 = icmp slt i32 %109, %111
br i1 %112, label %113, label %114
113: ; preds = %108
br label %118
114: ; preds = %108
br label %115
115: ; preds = %114
%116 = load i32, i32* %18
%117 = add nsw i32 %116, 1
store i32 %117, i32* %18
br label %68
118: ; preds = %113, %78, %68
%119 = load i32, i32* %18
%120 = load i32*, i32** %8
%121 = load i32, i32* %120
%122 = icmp slt i32 %119, %121
br i1 %122, label %123, label %124
123: ; preds = %118
br label %128
124: ; preds = %118
br label %125
125: ; preds = %124
%126 = load i32, i32* %17
%127 = add nsw i32 %126, 1
store i32 %127, i32* %17
br label %62
128: ; preds = %123, %62
%129 = load i32, i32* %17
%130 = load i32*, i32** %7
%131 = load i32, i32* %130
%132 = icmp slt i32 %129, %131
br i1 %132, label %133, label %148
133: ; preds = %128
%134 = load i32, i32* @stderr
%135 = load i8*, i8** %6
%136 = load i32, i32* %17
%137 = load i32*, i32** %8
%138 = load i32, i32* %137
%139 = mul nsw i32 %136, %138
%140 = load i32, i32* %18
%141 = add nsw i32 %139, %140
%142 = add nsw i32 %141, 2
%143 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i8* %135, i32 %142)
%144 = load i32*, i32** %10
%145 = call i32 @fclose(i32* %144)
%146 = load double***, double**** %13
%147 = call i32 @free_matrix3(double*** %146)
store double*** null, double**** %5
store i32 1, i32* %20
br label %152
148: ; preds = %128
%149 = load i32*, i32** %10
%150 = call i32 @fclose(i32* %149)
%151 = load double***, double**** %13
store double*** %151, double**** %5
store i32 1, i32* %20
br label %152
152: ; preds = %148, %133
%153 = load i8*, i8** %15
br label %154
154: ; preds = %152, %42, %25
%155 = load double***, double**** %5
ret double*** %155
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Invalid filename: %s\0A\00"
@.str.2 = [9 x i8] c"%d %d %d\00"
@.str.3 = [34 x i8] c"Corrupt matrix header in file %s\0A\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [3 x i8] c" \09\00"
@.str.6 = [37 x i8] c"Corrupt matrix file '%s' at line %d\0A\00"
define double*** @load_matrix3(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca [128 x i8]
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %118
11: ; preds = %4
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%13 = call i32* @fgets(i8* %12, i32 128, i32* %6)
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %22
18: ; preds = %15, %11
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%21 = call i32 @fclose(i32* %6)
br label %116
22: ; preds = %15
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = call double*** @new_matrix3(i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %3
%28 = mul nsw i32 %27, 20
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
%31 = alloca i8, i64 %29
%32 = load i32, i32* %1
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %98
34: ; preds = %22
%35 = load i32, i32* %2
br label %36
36: ; preds = %34, %89
%37 = phi i32 [ %35, %34 ], [ %84, %89 ]
%38 = phi i64 [ 0, %34 ], [ %90, %89 ]
%39 = icmp sgt i32 %37, 0
br i1 %39, label %40, label %83
40: ; preds = %36
%41 = getelementptr inbounds double**, double*** %26, i64 %38
br label %42
42: ; preds = %40, %74
%43 = phi i64 [ 0, %40 ], [ %75, %74 ]
%44 = call i32* @fgets(i8* %31, i32 10000, i32* %6)
%45 = icmp eq i32* %44, null
br i1 %45, label %79, label %46
46: ; preds = %42
%47 = load i32, i32* %3
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %70
49: ; preds = %46, %60
%50 = phi i64 [ %62, %60 ], [ 0, %46 ]
%51 = phi i8* [ %61, %60 ], [ %31, %46 ]
%52 = load double**, double*** %41
%53 = getelementptr inbounds double*, double** %52, i64 %43
%54 = load double*, double** %53
%55 = getelementptr inbounds double, double* %54, i64 %50
%56 = call i32 (i8*, i8*, ...) @sscanf(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %55)
%57 = icmp slt i32 %56, 1
br i1 %57, label %58, label %60
58: ; preds = %49
%59 = load i32, i32* %3
br label %66
60: ; preds = %49
%61 = call i8* @sword(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 1)
%62 = add nuw nsw i64 %50, 1
%63 = load i32, i32* %3
%64 = sext i32 %63 to i64
%65 = icmp slt i64 %62, %64
br i1 %65, label %49, label %66
66: ; preds = %60, %58
%67 = phi i32 [ %59, %58 ], [ %63, %60 ]
%68 = phi i64 [ %50, %58 ], [ %62, %60 ]
%69 = trunc i64 %68 to i32
br label %70
70: ; preds = %66, %46
%71 = phi i32 [ %47, %46 ], [ %67, %66 ]
%72 = phi i32 [ 0, %46 ], [ %69, %66 ]
%73 = icmp slt i32 %72, %71
br i1 %73, label %79, label %74
74: ; preds = %70
%75 = add nuw nsw i64 %43, 1
%76 = load i32, i32* %2
%77 = sext i32 %76 to i64
%78 = icmp slt i64 %75, %77
br i1 %78, label %42, label %79
79: ; preds = %70, %42, %74
%80 = phi i64 [ %75, %74 ], [ %43, %42 ], [ %43, %70 ]
%81 = trunc i64 %80 to i32
%82 = load i32, i32* %2
br label %83
83: ; preds = %79, %36
%84 = phi i32 [ %37, %36 ], [ %82, %79 ]
%85 = phi i32 [ 0, %36 ], [ %81, %79 ]
%86 = icmp slt i32 %85, %84
br i1 %86, label %87, label %89
87: ; preds = %83
%88 = load i32, i32* %1
br label %94
89: ; preds = %83
%90 = add nuw nsw i64 %38, 1
%91 = load i32, i32* %1
%92 = sext i32 %91 to i64
%93 = icmp slt i64 %90, %92
br i1 %93, label %36, label %94
94: ; preds = %89, %87
%95 = phi i32 [ %88, %87 ], [ %91, %89 ]
%96 = phi i64 [ %38, %87 ], [ %90, %89 ]
%97 = trunc i64 %96 to i32
br label %98
98: ; preds = %94, %22
%99 = phi i32 [ %32, %22 ], [ %95, %94 ]
%100 = phi i32 [ 0, %22 ], [ %97, %94 ]
%101 = phi i32 [ undef, %22 ], [ %85, %94 ]
%102 = icmp slt i32 %100, %99
br i1 %102, label %103, label %112
103: ; preds = %98
%104 = load i32, i32* @stderr
%105 = load i32, i32* %2
%106 = mul nsw i32 %105, %100
%107 = add i32 %101, 2
%108 = add i32 %107, %106
%109 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i8* %0, i32 %108)
%110 = call i32 @fclose(i32* %6)
%111 = call i32 @free_matrix3(double*** %26)
br label %114
112: ; preds = %98
%113 = call i32 @fclose(i32* %6)
br label %114
114: ; preds = %112, %103
%115 = phi double*** [ null, %103 ], [ %26, %112 ]
br label %116
116: ; preds = %114, %18
%117 = phi double*** [ null, %18 ], [ %115, %114 ]
br label %118
118: ; preds = %116, %8
%119 = phi double*** [ null, %8 ], [ %117, %116 ]
ret double*** %119
}