#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 *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ mul(int **, int **, int **, unsigned int, unsigned int,
                       unsigned int);
int /*<<< orphan*/ *stderr;
int main(int argc, char **argv) {
  FILE *fp;
  unsigned int m, n;
  unsigned int p;
  int A[10][10];
  int B[10][10];
  int C[10][10];
  int i, j, k;
  if (argc < 3) {
    fprintf(stderr, "Parameters error!\nUsage: "
                    "./matmul <inp_file> <out_file>\n");
    return -1;
  }
  if ((fp = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "Can't open file %s\n", argv[1]);
    return -2;
  }
  fscanf(fp, "%d %d", &m, &n);
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      fscanf(fp, "%d", &A[i][j]);
    }
  }
  fscanf(fp, "%*d %d", &p);
  for (i = 0; i < n; i++) {
    for (j = 0; j < p; j++) {
      fscanf(fp, "%d", &B[i][j]);
    }
  }
  fclose(fp);
  mul(A, B, C, m, p, n);
  if ((fp = fopen(argv[2], "w")) == NULL) {
    fprintf(stderr, "Can't create output file %s\n", argv[2]);
    return -4;
  }
  for (i = 0; i < m; i++) {
    for (j = 0; j < p; j++) {
      fprintf(fp, "%d ", C[i][j]);
    }
    fprintf(fp, "\n");
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1197 <main+0x47>
mov    0x2e66(%rip),%rax
mov    (%rax),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1466 <main+0x316>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe93(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11e5 <main+0x95>
mov    0x2e20(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1466 <main+0x316>
mov    -0x18(%rbp),%rdi
lea    0xe5f(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1040 <fscanf@plt>
movl   $0x0,-0x4e4(%rbp)
mov    -0x4e4(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    1293 <main+0x143>
movl   $0x0,-0x4e8(%rbp)
mov    -0x4e8(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    127a <main+0x12a>
mov    -0x18(%rbp),%rdi
movslq -0x4e4(%rbp),%rax
lea    -0x1c0(%rbp),%rdx
imul   $0x28,%rax,%rax
add    %rax,%rdx
movslq -0x4e8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xdf3(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x4e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e8(%rbp)
jmp    1222 <main+0xd2>
jmp    127f <main+0x12f>
mov    -0x4e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e4(%rbp)
jmp    1209 <main+0xb9>
mov    -0x18(%rbp),%rdi
lea    0xdb7(%rip),%rsi
lea    -0x24(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
movl   $0x0,-0x4e4(%rbp)
mov    -0x4e4(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    133d <main+0x1ed>
movl   $0x0,-0x4e8(%rbp)
mov    -0x4e8(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    1324 <main+0x1d4>
mov    -0x18(%rbp),%rdi
movslq -0x4e4(%rbp),%rax
lea    -0x350(%rbp),%rdx
imul   $0x28,%rax,%rax
add    %rax,%rdx
movslq -0x4e8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xd49(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    -0x4e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e8(%rbp)
jmp    12cc <main+0x17c>
jmp    1329 <main+0x1d9>
mov    -0x4e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e4(%rbp)
jmp    12b3 <main+0x163>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x1c0(%rbp),%rdi
lea    -0x350(%rbp),%rsi
lea    -0x4e0(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x20(%rbp),%r9d
call   1060 <mul@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xce2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    13b9 <main+0x269>
mov    0x2c4c(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xcb8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    1466 <main+0x316>
movl   $0x0,-0x4e4(%rbp)
mov    -0x4e4(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    1456 <main+0x306>
movl   $0x0,-0x4e8(%rbp)
mov    -0x4e8(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    1430 <main+0x2e0>
mov    -0x18(%rbp),%rdi
movslq -0x4e4(%rbp),%rcx
lea    -0x4e0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x4e8(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xc66(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x4e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e8(%rbp)
jmp    13dc <main+0x28c>
mov    -0x18(%rbp),%rdi
lea    0xbfc(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x4e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e4(%rbp)
jmp    13c3 <main+0x273>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4d8,%rsp
cmp    $0x2,%edi
jg     11b0 <main+0x40>
mov    0x2e53(%rip),%rax
mov    (%rax),%rcx
lea    0xe69(%rip),%rdi
mov    $0x38,%esi
mov    $0x1,%edx
call   1090 <fwrite@plt>
mov    $0xffffffff,%eax
jmp    13df <main+0x26f>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe7b(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     139b <main+0x22b>
mov    %rax,%r12
mov    %rbx,0x18(%rsp)
lea    0xe74(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %rax,%rdi
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0x14(%rsp),%ecx
test   %ecx,%ecx
je     1257 <main+0xe7>
lea    0x1b0(%rsp),%r13
mov    0x10(%rsp),%eax
lea    0xe48(%rip),%r15
xor    %ebp,%ebp
jmp    121f <main+0xaf>
xchg   %ax,%ax
add    $0x1,%rbp
mov    %ecx,%edx
add    $0x28,%r13
cmp    %rdx,%rbp
jae    1257 <main+0xe7>
test   %eax,%eax
mov    $0x0,%eax
je     1210 <main+0xa0>
mov    %r13,%rbx
xor    %r14d,%r14d
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
add    $0x1,%r14
mov    0x10(%rsp),%eax
add    $0x4,%rbx
cmp    %rax,%r14
jb     1230 <main+0xc0>
mov    0x14(%rsp),%ecx
jmp    1210 <main+0xa0>
lea    0xdf7(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0x10(%rsp),%ecx
test   %ecx,%ecx
je     12d7 <main+0x167>
lea    0x20(%rsp),%r13
mov    0xc(%rsp),%eax
lea    0xdcd(%rip),%r15
xor    %r14d,%r14d
jmp    129f <main+0x12f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
mov    %ecx,%edx
add    $0x28,%r13
cmp    %rdx,%r14
jae    12d7 <main+0x167>
test   %eax,%eax
mov    $0x0,%eax
je     1290 <main+0x120>
mov    %r13,%rbx
xor    %ebp,%ebp
nopl   (%rax)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
add    $0x1,%rbp
mov    0xc(%rsp),%eax
add    $0x4,%rbx
cmp    %rax,%rbp
jb     12b0 <main+0x140>
mov    0x10(%rsp),%ecx
jmp    1290 <main+0x120>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    0x14(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    0x10(%rsp),%r9d
lea    0x1b0(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x340(%rsp),%rbx
mov    %rbx,%rdx
call   1070 <mul@plt>
mov    0x18(%rsp),%rbp
mov    0x10(%rbp),%rdi
lea    0xd42(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13be <main+0x24e>
mov    %rax,%r15
cmpl   $0x0,0x14(%rsp)
je     138f <main+0x21f>
lea    0xd42(%rip),%r14
xor    %r12d,%r12d
jmp    135e <main+0x1ee>
xchg   %ax,%ax
mov    $0xa,%edi
mov    %r15,%rsi
call   1050 <fputc@plt>
add    $0x1,%r12
mov    0x14(%rsp),%eax
add    $0x28,%rbx
cmp    %rax,%r12
jae    138f <main+0x21f>
cmpl   $0x0,0xc(%rsp)
je     1340 <main+0x1d0>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%edx
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x1,%rbp
mov    0xc(%rsp),%eax
cmp    %rax,%rbp
jb     1370 <main+0x200>
jmp    1340 <main+0x1d0>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    13df <main+0x26f>
mov    0x2c3e(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%rbx),%rdx
lea    0xc8b(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xfffffffe,%eax
jmp    13df <main+0x26f>
mov    0x2c1b(%rip),%rax
mov    (%rax),%rdi
mov    0x10(%rbp),%rdx
lea    0xc8b(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xfffffffc,%eax
add    $0x4d8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32* null
@.str = [57 x i8] c"Parameters error!\0AUsage: ./matmul <inp_file> <out_file>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [20 x i8] c"Can't open file %s\0A\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [7 x i8] c"%*d %d\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [29 x i8] c"Can't create output file %s\0A\00"
@.str.8 = [4 x i8] c"%d \00"
@.str.9 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [10 x [10 x i32]]
%11 = alloca [10 x [10 x i32]]
%12 = alloca [10 x [10 x i32]]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load i32*, i32** @stderr
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %145
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %6
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %33
27: ; preds = %21
%28 = load i32*, i32** @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %31)
store i32 -2, i32* %3
br label %145
33: ; preds = %21
%34 = load i32*, i32** %6
%35 = call i32 (i32*, i8*, ...) @fscanf(i32* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %7, i32* %8)
store i32 0, i32* %13
br label %36
36: ; preds = %58, %33
%37 = load i32, i32* %13
%38 = load i32, i32* %7
%39 = icmp ult i32 %37, %38
br i1 %39, label %40, label %61
40: ; preds = %36
store i32 0, i32* %14
br label %41
41: ; preds = %54, %40
%42 = load i32, i32* %14
%43 = load i32, i32* %8
%44 = icmp ult i32 %42, %43
br i1 %44, label %45, label %57
45: ; preds = %41
%46 = load i32*, i32** %6
%47 = load i32, i32* %13
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %10, i64 0, i64 %48
%50 = load i32, i32* %14
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %49, i64 0, i64 %51
%53 = call i32 (i32*, i8*, ...) @fscanf(i32* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %52)
br label %54
54: ; preds = %45
%55 = load i32, i32* %14
%56 = add nsw i32 %55, 1
store i32 %56, i32* %14
br label %41
57: ; preds = %41
br label %58
58: ; preds = %57
%59 = load i32, i32* %13
%60 = add nsw i32 %59, 1
store i32 %60, i32* %13
br label %36
61: ; preds = %36
%62 = load i32*, i32** %6
%63 = call i32 (i32*, i8*, ...) @fscanf(i32* %62, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %9)
store i32 0, i32* %13
br label %64
64: ; preds = %86, %61
%65 = load i32, i32* %13
%66 = load i32, i32* %8
%67 = icmp ult i32 %65, %66
br i1 %67, label %68, label %89
68: ; preds = %64
store i32 0, i32* %14
br label %69
69: ; preds = %82, %68
%70 = load i32, i32* %14
%71 = load i32, i32* %9
%72 = icmp ult i32 %70, %71
br i1 %72, label %73, label %85
73: ; preds = %69
%74 = load i32*, i32** %6
%75 = load i32, i32* %13
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %11, i64 0, i64 %76
%78 = load i32, i32* %14
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [10 x i32], [10 x i32]* %77, i64 0, i64 %79
%81 = call i32 (i32*, i8*, ...) @fscanf(i32* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %80)
br label %82
82: ; preds = %73
%83 = load i32, i32* %14
%84 = add nsw i32 %83, 1
store i32 %84, i32* %14
br label %69
85: ; preds = %69
br label %86
86: ; preds = %85
%87 = load i32, i32* %13
%88 = add nsw i32 %87, 1
store i32 %88, i32* %13
br label %64
89: ; preds = %64
%90 = load i32*, i32** %6
%91 = call i32 @fclose(i32* %90)
%92 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %10, i64 0, i64 0
%93 = bitcast [10 x i32]* %92 to i32**
%94 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %11, i64 0, i64 0
%95 = bitcast [10 x i32]* %94 to i32**
%96 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %12, i64 0, i64 0
%97 = bitcast [10 x i32]* %96 to i32**
%98 = load i32, i32* %7
%99 = load i32, i32* %9
%100 = load i32, i32* %8
%101 = call i32 @mul(i32** %93, i32** %95, i32** %97, i32 %98, i32 %99, i32 %100)
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 2
%104 = load i8*, i8** %103
%105 = call i32* @fopen(i8* %104, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %105, i32** %6
%106 = icmp eq i32* %105, null
br i1 %106, label %107, label %113
107: ; preds = %89
%108 = load i32*, i32** @stderr
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 2
%111 = load i8*, i8** %110
%112 = call i32 (i32*, i8*, ...) @fprintf(i32* %108, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* %111)
store i32 -4, i32* %3
br label %145
113: ; preds = %89
store i32 0, i32* %13
br label %114
114: ; preds = %139, %113
%115 = load i32, i32* %13
%116 = load i32, i32* %7
%117 = icmp ult i32 %115, %116
br i1 %117, label %118, label %142
118: ; preds = %114
store i32 0, i32* %14
br label %119
119: ; preds = %133, %118
%120 = load i32, i32* %14
%121 = load i32, i32* %9
%122 = icmp ult i32 %120, %121
br i1 %122, label %123, label %136
123: ; preds = %119
%124 = load i32*, i32** %6
%125 = load i32, i32* %13
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %12, i64 0, i64 %126
%128 = load i32, i32* %14
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [10 x i32], [10 x i32]* %127, i64 0, i64 %129
%131 = load i32, i32* %130
%132 = call i32 (i32*, i8*, ...) @fprintf(i32* %124, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %131)
br label %133
133: ; preds = %123
%134 = load i32, i32* %14
%135 = add nsw i32 %134, 1
store i32 %135, i32* %14
br label %119
136: ; preds = %119
%137 = load i32*, i32** %6
%138 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %139
139: ; preds = %136
%140 = load i32, i32* %13
%141 = add nsw i32 %140, 1
store i32 %141, i32* %13
br label %114
142: ; preds = %114
%143 = load i32*, i32** %6
%144 = call i32 @fclose(i32* %143)
store i32 0, i32* %3
br label %145
145: ; preds = %142, %107, %27, %18
%146 = load i32, i32* %3
ret i32 %146
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [57 x i8] c"Parameters error!\0AUsage: ./matmul <inp_file> <out_file>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [20 x i8] c"Can't open file %s\0A\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [7 x i8] c"%*d %d\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [29 x i8] c"Can't create output file %s\0A\00"
@.str.8 = [4 x i8] c"%d \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [10 x [10 x i32]]
%7 = alloca [10 x [10 x i32]]
%8 = alloca [10 x [10 x i32]]
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast [10 x [10 x i32]]* %6 to i8*
%13 = bitcast [10 x [10 x i32]]* %7 to i8*
%14 = bitcast [10 x [10 x i32]]* %8 to i8*
%15 = icmp slt i32 %0, 3
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32*, i32** @stderr
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i64 56, i64 1, i32* %17)
br label %123
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i32*, i32** @stderr
%26 = load i8*, i8** %20
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %26)
br label %123
28: ; preds = %19
%29 = call i32 (i32*, i8*, ...) @fscanf(i32* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 0
br i1 %31, label %55, label %32
32: ; preds = %28
%33 = load i32, i32* %4
br label %34
34: ; preds = %32, %49
%35 = phi i32 [ %30, %32 ], [ %50, %49 ]
%36 = phi i32 [ %33, %32 ], [ %51, %49 ]
%37 = phi i64 [ 0, %32 ], [ %52, %49 ]
%38 = icmp eq i32 %36, 0
br i1 %38, label %49, label %39
39: ; preds = %34, %39
%40 = phi i64 [ %43, %39 ], [ 0, %34 ]
%41 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %6, i64 0, i64 %37, i64 %40
%42 = call i32 (i32*, i8*, ...) @fscanf(i32* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %41)
%43 = add nuw nsw i64 %40, 1
%44 = load i32, i32* %4
%45 = zext i32 %44 to i64
%46 = icmp ult i64 %43, %45
br i1 %46, label %39, label %47
47: ; preds = %39
%48 = load i32, i32* %3
br label %49
49: ; preds = %47, %34
%50 = phi i32 [ %48, %47 ], [ %35, %34 ]
%51 = phi i32 [ %44, %47 ], [ 0, %34 ]
%52 = add nuw nsw i64 %37, 1
%53 = zext i32 %50 to i64
%54 = icmp ult i64 %52, %53
br i1 %54, label %34, label %55
55: ; preds = %49, %28
%56 = call i32 (i32*, i8*, ...) @fscanf(i32* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %5)
%57 = load i32, i32* %4
%58 = icmp eq i32 %57, 0
br i1 %58, label %82, label %59
59: ; preds = %55
%60 = load i32, i32* %5
br label %61
61: ; preds = %59, %76
%62 = phi i32 [ %57, %59 ], [ %77, %76 ]
%63 = phi i32 [ %60, %59 ], [ %78, %76 ]
%64 = phi i64 [ 0, %59 ], [ %79, %76 ]
%65 = icmp eq i32 %63, 0
br i1 %65, label %76, label %66
66: ; preds = %61, %66
%67 = phi i64 [ %70, %66 ], [ 0, %61 ]
%68 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %7, i64 0, i64 %64, i64 %67
%69 = call i32 (i32*, i8*, ...) @fscanf(i32* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %68)
%70 = add nuw nsw i64 %67, 1
%71 = load i32, i32* %5
%72 = zext i32 %71 to i64
%73 = icmp ult i64 %70, %72
br i1 %73, label %66, label %74
74: ; preds = %66
%75 = load i32, i32* %4
br label %76
76: ; preds = %74, %61
%77 = phi i32 [ %75, %74 ], [ %62, %61 ]
%78 = phi i32 [ %71, %74 ], [ 0, %61 ]
%79 = add nuw nsw i64 %64, 1
%80 = zext i32 %77 to i64
%81 = icmp ult i64 %79, %80
br i1 %81, label %61, label %82
82: ; preds = %76, %55
%83 = call i32 @fclose(i32* %22)
%84 = bitcast [10 x [10 x i32]]* %6 to i32**
%85 = bitcast [10 x [10 x i32]]* %7 to i32**
%86 = bitcast [10 x [10 x i32]]* %8 to i32**
%87 = load i32, i32* %3
%88 = load i32, i32* %5
%89 = load i32, i32* %4
%90 = call i32 @mul(i32** %84, i32** %85, i32** %86, i32 %87, i32 %88, i32 %89)
%91 = getelementptr inbounds i8*, i8** %1, i64 2
%92 = load i8*, i8** %91
%93 = call i32* @fopen(i8* %92, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%94 = icmp eq i32* %93, null
br i1 %94, label %98, label %95
95: ; preds = %82
%96 = load i32, i32* %3
%97 = icmp eq i32 %96, 0
br i1 %97, label %121, label %102
98: ; preds = %82
%99 = load i32*, i32** @stderr
%100 = load i8*, i8** %91
%101 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* %100)
br label %123
102: ; preds = %95, %115
%103 = phi i64 [ %117, %115 ], [ 0, %95 ]
%104 = load i32, i32* %5
%105 = icmp eq i32 %104, 0
br i1 %105, label %115, label %106
106: ; preds = %102, %106
%107 = phi i64 [ %111, %106 ], [ 0, %102 ]
%108 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %8, i64 0, i64 %103, i64 %107
%109 = load i32, i32* %108
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %109)
%111 = add nuw nsw i64 %107, 1
%112 = load i32, i32* %5
%113 = zext i32 %112 to i64
%114 = icmp ult i64 %111, %113
br i1 %114, label %106, label %115
115: ; preds = %106, %102
%116 = call i32 @fputc(i32 10, i32* %93)
%117 = add nuw nsw i64 %103, 1
%118 = load i32, i32* %3
%119 = zext i32 %118 to i64
%120 = icmp ult i64 %117, %119
br i1 %120, label %102, label %121
121: ; preds = %115, %95
%122 = call i32 @fclose(i32* %93)
br label %123
123: ; preds = %121, %98, %24, %16
%124 = phi i32 [ -1, %16 ], [ -2, %24 ], [ -4, %98 ], [ 0, %121 ]
ret i32 %124
}