#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*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
int main() {
  int i, j, m, n;
  float a[100][100], b[100][100];
  FILE *input, *output;
  if ((input = fopen("mat1.txt", "r")) == NULL) {
    printf("The file `mat1.txt` can not be opened!\n");
    exit(1);
  }
  if (!feof(input))
    fscanf(input, "%d %d", &m, &n);
  if ((m > 100) || (n > 100)) {
    printf("Very large matrix!");
    return (-1);
  }
  for (i = 0; i < m && !feof(input); i++)
    for (j = 0; j < n && !feof(input); j++)
      fscanf(input, "%f", &a[i][j]);
  fclose(input);
  if (i != m || j != n) {
    printf("Not enough data in the file!");
    return (-1);
  }
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      b[j][i] = a[i][j];
  if ((output = fopen("mat2.txt", "w")) == NULL) {
    printf("The file `mat2.txt` can not be opened!\n");
    exit(1);
  }
  fprintf(output, "%d %d\n", n, m);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      fprintf(output, "%7.2f\n", b[i][j]);
  fclose(output);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x138c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
lea    0xe79(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x138a8(%rbp)
cmp    $0x0,%rax
jne    11bc <main+0x4c>
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x138a8(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
jne    11ee <main+0x7e>
mov    -0x138a8(%rbp),%rdi
lea    0xe54(%rip),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
mov    $0x0,%al
call   1050 <fscanf@plt>
cmpl   $0x64,-0x10(%rbp)
jg     1202 <main+0x92>
cmpl   $0x64,-0x14(%rbp)
jle    121a <main+0xaa>
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14a3 <main+0x333>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x138b1(%rbp)
jge    124f <main+0xdf>
mov    -0x138a8(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x138b1(%rbp)
mov    -0x138b1(%rbp),%al
test   $0x1,%al
jne    1262 <main+0xf2>
jmp    1300 <main+0x190>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x138b2(%rbp)
jge    1297 <main+0x127>
mov    -0x138a8(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x138b2(%rbp)
mov    -0x138b2(%rbp),%al
test   $0x1,%al
jne    12aa <main+0x13a>
jmp    12ed <main+0x17d>
mov    -0x138a8(%rbp),%rdi
movslq -0x8(%rbp),%rax
lea    -0x9c60(%rbp),%rdx
imul   $0x190,%rax,%rax
add    %rax,%rdx
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xd74(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1269 <main+0xf9>
jmp    12f2 <main+0x182>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1221 <main+0xb1>
mov    -0x138a8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1324 <main+0x1b4>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     133c <main+0x1cc>
lea    0xd24(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14a3 <main+0x333>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    13bf <main+0x24f>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13ac <main+0x23c>
movslq -0x8(%rbp),%rcx
lea    -0x9c60(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0xc(%rbp),%rcx
lea    -0x138a0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1356 <main+0x1e6>
jmp    13b1 <main+0x241>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1343 <main+0x1d3>
lea    0xca6(%rip),%rdi
lea    0xca8(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x138b0(%rbp)
cmp    $0x0,%rax
jne    13f9 <main+0x289>
lea    0xc8d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x138b0(%rbp),%rdi
cvtsi2ssl -0x14(%rbp),%xmm0
mov    -0x10(%rbp),%edx
lea    0xc90(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1490 <main+0x320>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    147d <main+0x30d>
mov    -0x138b0(%rbp),%rdi
movslq -0x8(%rbp),%rcx
lea    -0x138a0(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xc3e(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1430 <main+0x2c0>
jmp    1482 <main+0x312>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    141d <main+0x2ad>
mov    -0x138b0(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x138c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x13898,%rsp
lea    0xe68(%rip),%rdi
lea    0xe6a(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     14ab <main+0x32b>
mov    %rax,%r15
mov    %rax,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     13a6 <main+0x226>
xor    %r13d,%r13d
mov    %r15,%rdi
call   1040 <fclose@plt>
cmp    0xc(%rsp),%r13d
jne    12df <main+0x15f>
cmp    0x8(%rsp),%r12d
jne    12df <main+0x15f>
test   %r13d,%r13d
jle    12eb <main+0x16b>
mov    %r13d,%r9d
mov    %r12d,%ecx
lea    -0x1(%rcx),%r8
mov    %ecx,%esi
and    $0x3,%esi
and    $0xfffffffc,%ecx
lea    0x1c(%rsp),%rdi
lea    0x9c50(%rsp),%r11
lea    0x10(%rsp),%r10
xor    %eax,%eax
jmp    123f <main+0xbf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rax
add    $0x190,%rdi
add    $0x4,%r11
add    $0x190,%r10
cmp    %r9,%rax
je     12eb <main+0x16b>
test   %r12d,%r12d
jle    1220 <main+0xa0>
cmp    $0x3,%r8
jae    1250 <main+0xd0>
xor    %ebp,%ebp
jmp    12a3 <main+0x123>
xchg   %ax,%ax
mov    %r11,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movss  -0xc(%rdi,%rbp,4),%xmm0
movss  %xmm0,(%rbx)
movss  -0x8(%rdi,%rbp,4),%xmm0
movss  %xmm0,0x190(%rbx)
movss  -0x4(%rdi,%rbp,4),%xmm0
movss  %xmm0,0x320(%rbx)
movss  (%rdi,%rbp,4),%xmm0
movss  %xmm0,0x4b0(%rbx)
add    $0x4,%rbp
add    $0x640,%rbx
cmp    %rbp,%rcx
jne    1260 <main+0xe0>
test   %rsi,%rsi
je     1220 <main+0xa0>
imul   $0x190,%rbp,%rbx
add    %r11,%rbx
lea    (%r10,%rbp,4),%rbp
xor    %edx,%edx
nopl   0x0(%rax)
movss  0x0(%rbp,%rdx,4),%xmm0
movss  %xmm0,(%rbx)
add    $0x1,%rdx
add    $0x190,%rbx
cmp    %rdx,%rsi
jne    12c0 <main+0x140>
jmp    1220 <main+0xa0>
lea    0xd41(%rip),%rdi
jmp    148f <main+0x30f>
lea    0xd52(%rip),%rdi
lea    0xd54(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     14b4 <main+0x334>
mov    %rax,%r12
xorps  %xmm0,%xmm0
cvtsi2ssl 0x8(%rsp),%xmm0
mov    0xc(%rsp),%edx
lea    0xd31(%rip),%rsi
mov    %rax,%rdi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
jle    1397 <main+0x217>
lea    0x9c50(%rsp),%rbp
mov    0xc(%rsp),%eax
xor    %r15d,%r15d
lea    0xd10(%rip),%r14
jmp    1363 <main+0x1e3>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
movslq %ecx,%rdx
add    $0x190,%rbp
cmp    %rdx,%r15
jge    1397 <main+0x217>
test   %eax,%eax
jle    1350 <main+0x1d0>
xor    %ebx,%ebx
nopl   0x0(%rax)
movss  0x0(%rbp,%rbx,4),%xmm0
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1370 <main+0x1f0>
mov    0x8(%rsp),%ecx
jmp    1350 <main+0x1d0>
mov    %r12,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    1499 <main+0x319>
lea    0xc5e(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x64,%eax
jg     1488 <main+0x308>
cmpl   $0x64,0x8(%rsp)
jg     1488 <main+0x308>
xor    %r13d,%r13d
test   %eax,%eax
jle    11c3 <main+0x43>
mov    %r15,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    11c3 <main+0x43>
lea    0x10(%rsp),%rbp
lea    0xc24(%rip),%r14
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpl   $0x0,0x8(%rsp)
mov    $0x0,%r12d
jle    145e <main+0x2de>
mov    %rbp,%rbx
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    145e <main+0x2de>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
add    $0x1,%r12
movslq 0x8(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%r12
jl     1430 <main+0x2b0>
add    $0x1,%r13
movslq 0xc(%rsp),%rax
cmp    %rax,%r13
jge    11c3 <main+0x43>
mov    %r15,%rdi
call   1080 <feof@plt>
add    $0x190,%rbp
test   %eax,%eax
je     1410 <main+0x290>
jmp    11c3 <main+0x43>
lea    0xb82(%rip),%rdi
call   1050 <printf@plt>
mov    $0xffffffff,%eax
add    $0x13898,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbd2(%rip),%rdi
jmp    14bb <main+0x33b>
lea    0xba2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"mat1.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [40 x i8] c"The file `mat1.txt` can not be opened!\0A\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [19 x i8] c"Very large matrix!\00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [29 x i8] c"Not enough data in the file!\00"
@.str.7 = [9 x i8] c"mat2.txt\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [40 x i8] c"The file `mat2.txt` can not be opened!\0A\00"
@.str.10 = [7 x i8] c"%d %d\0A\00"
@.str.11 = [7 x i8] c"%7.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100 x [100 x float]]
%7 = alloca [100 x [100 x float]]
%8 = alloca i32*
%9 = alloca i32*
store i32 0, i32* %1
%10 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 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** %8
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %0
%16 = load i32*, i32** %8
%17 = call i32 @feof(i32* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %15
%20 = load i32*, i32** %8
%21 = call i32 (i32*, i8*, ...) @fscanf(i32* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
br label %22
22: ; preds = %19, %15
%23 = load i32, i32* %4
%24 = icmp sgt i32 %23, 100
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %5
%27 = icmp sgt i32 %26, 100
br i1 %27, label %28, label %30
28: ; preds = %25, %22
%29 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %154
30: ; preds = %25
store i32 0, i32* %2
br label %31
31: ; preds = %67, %30
%32 = load i32, i32* %2
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = load i32*, i32** %8
%37 = call i32 @feof(i32* %36)
%38 = icmp ne i32 %37, 0
%39 = xor i1 %38, true
br label %40
40: ; preds = %35, %31
%41 = phi i1 [ false, %31 ], [ %39, %35 ]
br i1 %41, label %42, label %70
42: ; preds = %40
store i32 0, i32* %3
br label %43
43: ; preds = %63, %42
%44 = load i32, i32* %3
%45 = load i32, i32* %5
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %52
47: ; preds = %43
%48 = load i32*, i32** %8
%49 = call i32 @feof(i32* %48)
%50 = icmp ne i32 %49, 0
%51 = xor i1 %50, true
br label %52
52: ; preds = %47, %43
%53 = phi i1 [ false, %43 ], [ %51, %47 ]
br i1 %53, label %54, label %66
54: ; preds = %52
%55 = load i32*, i32** %8
%56 = load i32, i32* %2
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %6, i64 0, i64 %57
%59 = load i32, i32* %3
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [100 x float], [100 x float]* %58, i64 0, i64 %60
%62 = call i32 (i32*, i8*, ...) @fscanf(i32* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %61)
br label %63
63: ; preds = %54
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 1
store i32 %65, i32* %3
br label %43
66: ; preds = %52
br label %67
67: ; preds = %66
%68 = load i32, i32* %2
%69 = add nsw i32 %68, 1
store i32 %69, i32* %2
br label %31
70: ; preds = %40
%71 = load i32*, i32** %8
%72 = call i32 @fclose(i32* %71)
%73 = load i32, i32* %2
%74 = load i32, i32* %4
%75 = icmp ne i32 %73, %74
br i1 %75, label %80, label %76
76: ; preds = %70
%77 = load i32, i32* %3
%78 = load i32, i32* %5
%79 = icmp ne i32 %77, %78
br i1 %79, label %80, label %82
80: ; preds = %76, %70
%81 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %1
br label %154
82: ; preds = %76
store i32 0, i32* %2
br label %83
83: ; preds = %110, %82
%84 = load i32, i32* %2
%85 = load i32, i32* %4
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %113
87: ; preds = %83
store i32 0, i32* %3
br label %88
88: ; preds = %106, %87
%89 = load i32, i32* %3
%90 = load i32, i32* %5
%91 = icmp slt i32 %89, %90
br i1 %91, label %92, label %109
92: ; preds = %88
%93 = load i32, i32* %2
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %6, i64 0, i64 %94
%96 = load i32, i32* %3
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [100 x float], [100 x float]* %95, i64 0, i64 %97
%99 = load float, float* %98
%100 = load i32, i32* %3
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %7, i64 0, i64 %101
%103 = load i32, i32* %2
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [100 x float], [100 x float]* %102, i64 0, i64 %104
store float %99, float* %105
br label %106
106: ; preds = %92
%107 = load i32, i32* %3
%108 = add nsw i32 %107, 1
store i32 %108, i32* %3
br label %88
109: ; preds = %88
br label %110
110: ; preds = %109
%111 = load i32, i32* %2
%112 = add nsw i32 %111, 1
store i32 %112, i32* %2
br label %83
113: ; preds = %83
%114 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %114, i32** %9
%115 = icmp eq i32* %114, null
br i1 %115, label %116, label %119
116: ; preds = %113
%117 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%118 = call i32 @exit(i32 1)
unreachable
119: ; preds = %113
%120 = load i32*, i32** %9
%121 = load i32, i32* %5
%122 = sitofp i32 %121 to float
%123 = load i32, i32* %4
%124 = call i32 (i32*, i8*, float, ...) @fprintf(i32* %120, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), float %122, i32 %123)
store i32 0, i32* %2
br label %125
125: ; preds = %148, %119
%126 = load i32, i32* %2
%127 = load i32, i32* %5
%128 = icmp slt i32 %126, %127
br i1 %128, label %129, label %151
129: ; preds = %125
store i32 0, i32* %3
br label %130
130: ; preds = %144, %129
%131 = load i32, i32* %3
%132 = load i32, i32* %4
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %147
134: ; preds = %130
%135 = load i32*, i32** %9
%136 = load i32, i32* %2
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %7, i64 0, i64 %137
%139 = load i32, i32* %3
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds [100 x float], [100 x float]* %138, i64 0, i64 %140
%142 = load float, float* %141
%143 = call i32 (i32*, i8*, float, ...) @fprintf(i32* %135, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), float %142)
br label %144
144: ; preds = %134
%145 = load i32, i32* %3
%146 = add nsw i32 %145, 1
store i32 %146, i32* %3
br label %130
147: ; preds = %130
br label %148
148: ; preds = %147
%149 = load i32, i32* %2
%150 = add nsw i32 %149, 1
store i32 %150, i32* %2
br label %125
151: ; preds = %125
%152 = load i32*, i32** %9
%153 = call i32 @fclose(i32* %152)
store i32 0, i32* %1
br label %154
154: ; preds = %151, %80, %28
%155 = load i32, i32* %1
ret i32 %155
}

LLVM IR (-O2):
@.str = [9 x i8] c"mat1.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [19 x i8] c"Very large matrix!\00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [29 x i8] c"Not enough data in the file!\00"
@.str.7 = [9 x i8] c"mat2.txt\00"
@.str.8 = [2 x i8] c"w\00"
@.str.10 = [7 x i8] c"%d %d\0A\00"
@.str.11 = [7 x i8] c"%7.2f\0A\00"
@str = [39 x i8] c"The file `mat2.txt` can not be opened!\00"
@str.12 = [39 x i8] c"The file `mat1.txt` can not be opened!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x [100 x float]]
%4 = alloca [100 x [100 x float]]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast [100 x [100 x float]]* %3 to i8*
%8 = bitcast [100 x [100 x float]]* %4 to i8*
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 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 %11, label %14
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = tail call i32 @feof(i32* %9)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %60
17: ; preds = %14
%18 = call i32 (i32*, i8*, ...) @fscanf(i32* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 100
%22 = icmp sgt i32 %19, 100
%23 = select i1 %22, i1 true, i1 %21
br i1 %23, label %29, label %24
24: ; preds = %17
%25 = icmp sgt i32 %19, 0
br i1 %25, label %26, label %60
26: ; preds = %24
%27 = call i32 @feof(i32* %9)
%28 = icmp eq i32 %27, 0
br i1 %28, label %34, label %60
29: ; preds = %17
%30 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %159
31: ; preds = %52
%32 = call i32 @feof(i32* %9)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %58
34: ; preds = %26, %31
%35 = phi i64 [ %54, %31 ], [ 0, %26 ]
%36 = load i32, i32* %2
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %52
38: ; preds = %34, %42
%39 = phi i64 [ %45, %42 ], [ 0, %34 ]
%40 = call i32 @feof(i32* %9)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %49
42: ; preds = %38
%43 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %3, i64 0, i64 %35, i64 %39
%44 = call i32 (i32*, i8*, ...) @fscanf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %43)
%45 = add nuw nsw i64 %39, 1
%46 = load i32, i32* %2
%47 = sext i32 %46 to i64
%48 = icmp slt i64 %45, %47
br i1 %48, label %38, label %49
49: ; preds = %38, %42
%50 = phi i64 [ %45, %42 ], [ %39, %38 ]
%51 = trunc i64 %50 to i32
br label %52
52: ; preds = %49, %34
%53 = phi i32 [ 0, %34 ], [ %51, %49 ]
%54 = add nuw nsw i64 %35, 1
%55 = load i32, i32* %1
%56 = sext i32 %55 to i64
%57 = icmp slt i64 %54, %56
br i1 %57, label %31, label %58
58: ; preds = %52, %31
%59 = trunc i64 %54 to i32
br label %60
60: ; preds = %26, %58, %14, %24
%61 = phi i32 [ undef, %24 ], [ undef, %14 ], [ undef, %26 ], [ %53, %58 ]
%62 = phi i32 [ 0, %24 ], [ 0, %14 ], [ 0, %26 ], [ %59, %58 ]
%63 = call i32 @fclose(i32* %9)
%64 = load i32, i32* %1
%65 = icmp eq i32 %62, %64
%66 = load i32, i32* %2
%67 = icmp eq i32 %61, %66
%68 = select i1 %65, i1 %67, i1 false
br i1 %68, label %69, label %80
69: ; preds = %60
%70 = icmp sgt i32 %62, 0
br i1 %70, label %71, label %120
71: ; preds = %69
%72 = icmp sgt i32 %61, 0
%73 = zext i32 %62 to i64
%74 = zext i32 %61 to i64
%75 = add nsw i64 %74, -1
%76 = and i64 %74, 3
%77 = icmp ult i64 %75, 3
%78 = and i64 %74, 4294967292
%79 = icmp eq i64 %76, 0
br label %82
80: ; preds = %60
%81 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
br label %159
82: ; preds = %71, %117
%83 = phi i64 [ 0, %71 ], [ %118, %117 ]
br i1 %72, label %84, label %117
84: ; preds = %82
br i1 %77, label %106, label %85
85: ; preds = %84, %85
%86 = phi i64 [ %103, %85 ], [ 0, %84 ]
%87 = phi i64 [ %104, %85 ], [ 0, %84 ]
%88 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %3, i64 0, i64 %83, i64 %86
%89 = load float, float* %88
%90 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %4, i64 0, i64 %86, i64 %83
store float %89, float* %90
%91 = or i64 %86, 1
%92 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %3, i64 0, i64 %83, i64 %91
%93 = load float, float* %92
%94 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %4, i64 0, i64 %91, i64 %83
store float %93, float* %94
%95 = or i64 %86, 2
%96 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %3, i64 0, i64 %83, i64 %95
%97 = load float, float* %96
%98 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %4, i64 0, i64 %95, i64 %83
store float %97, float* %98
%99 = or i64 %86, 3
%100 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %3, i64 0, i64 %83, i64 %99
%101 = load float, float* %100
%102 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %4, i64 0, i64 %99, i64 %83
store float %101, float* %102
%103 = add nuw nsw i64 %86, 4
%104 = add i64 %87, 4
%105 = icmp eq i64 %104, %78
br i1 %105, label %106, label %85
106: ; preds = %85, %84
%107 = phi i64 [ 0, %84 ], [ %103, %85 ]
br i1 %79, label %117, label %108
108: ; preds = %106, %108
%109 = phi i64 [ %114, %108 ], [ %107, %106 ]
%110 = phi i64 [ %115, %108 ], [ 0, %106 ]
%111 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %3, i64 0, i64 %83, i64 %109
%112 = load float, float* %111
%113 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %4, i64 0, i64 %109, i64 %83
store float %112, float* %113
%114 = add nuw nsw i64 %109, 1
%115 = add i64 %110, 1
%116 = icmp eq i64 %115, %76
br i1 %116, label %117, label %108
117: ; preds = %106, %108, %82
%118 = add nuw nsw i64 %83, 1
%119 = icmp eq i64 %118, %73
br i1 %119, label %120, label %82
120: ; preds = %117, %69
%121 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%122 = icmp eq i32* %121, null
br i1 %122, label %123, label %126
123: ; preds = %120
%124 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%125 = call i32 @exit(i32 1)
unreachable
126: ; preds = %120
%127 = load i32, i32* %2
%128 = sitofp i32 %127 to float
%129 = load i32, i32* %1
%130 = call i32 (i32*, i8*, float, ...) @fprintf(i32* %121, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), float %128, i32 %129)
%131 = load i32, i32* %2
%132 = icmp sgt i32 %131, 0
br i1 %132, label %133, label %157
133: ; preds = %126
%134 = load i32, i32* %1
br label %135
135: ; preds = %133, %151
%136 = phi i32 [ %131, %133 ], [ %152, %151 ]
%137 = phi i32 [ %134, %133 ], [ %153, %151 ]
%138 = phi i64 [ 0, %133 ], [ %154, %151 ]
%139 = icmp sgt i32 %137, 0
br i1 %139, label %140, label %151
140: ; preds = %135, %140
%141 = phi i64 [ %145, %140 ], [ 0, %135 ]
%142 = getelementptr inbounds [100 x [100 x float]], [100 x [100 x float]]* %4, i64 0, i64 %138, i64 %141
%143 = load float, float* %142
%144 = call i32 (i32*, i8*, float, ...) @fprintf(i32* %121, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), float %143)
%145 = add nuw nsw i64 %141, 1
%146 = load i32, i32* %1
%147 = sext i32 %146 to i64
%148 = icmp slt i64 %145, %147
br i1 %148, label %140, label %149
149: ; preds = %140
%150 = load i32, i32* %2
br label %151
151: ; preds = %149, %135
%152 = phi i32 [ %150, %149 ], [ %136, %135 ]
%153 = phi i32 [ %146, %149 ], [ %137, %135 ]
%154 = add nuw nsw i64 %138, 1
%155 = sext i32 %152 to i64
%156 = icmp slt i64 %154, %155
br i1 %156, label %135, label %157
157: ; preds = %151, %126
%158 = call i32 @fclose(i32* %121)
br label %159
159: ; preds = %157, %80, %29
%160 = phi i32 [ -1, %29 ], [ -1, %80 ], [ 0, %157 ]
ret i32 %160
}