#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 *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int i, j;
  int n;
  int temp;
  FILE *op;
  if (argc == 1) {
    printf("Please assign the matrix size!\n");
    return 1;
  }
  n = strtol(argv[1], NULL, 10);
  if (n > 100000) {
    printf("Exceed the maximum size\n");
    return 1;
  }
  op = fopen("data_input", "w");
  if (op == NULL) {
    printf("Cant open a file!");
    return 1;
  }
  srand(time(NULL));
  fprintf(op, "%d\n\n", n);
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      temp = rand() % (2 * 10) - 10 + 1;
      fprintf(op, "%d\t", temp);
    }
    fprintf(op, "\n");
  }
  fprintf(op, "\n");
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      temp = rand() % (2 * 10) - 10 + 1;
      fprintf(op, "%d\t", temp);
    }
    fprintf(op, "\n");
  }
  fclose(op);
  if (argc > 2) {
    op = fopen("data_input", "r");
    if (op == NULL) {
      printf("Cant open a file!");
      return 1;
    }
    fscanf(op, "%d\n", &n);
    printf("the matrix size is %d\n", n);
    printf("=====================================\n");
    printf("Matrix A is \n");
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        fscanf(op, "%d\t", &temp);
        printf("%d\t", temp);
      }
      printf("\n");
    }
    printf("=====================================\n");
    printf("Matrix B is \n");
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        fscanf(op, "%d\t", &temp);
        printf("%d\t", temp);
      }
      printf("\n");
    }
    fclose(op);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11ca <main+0x3a>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1529 <main+0x399>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x186a0,-0x1c(%rbp)
jle    120a <main+0x7a>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1529 <main+0x399>
lea    0xe28(%rip),%rdi
lea    0xe2c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1246 <main+0xb6>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1529 <main+0x399>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xdf4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12ee <main+0x15e>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12ce <main+0x13e>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
sub    $0xa,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xda4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1285 <main+0xf5>
mov    -0x28(%rbp),%rdi
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1272 <main+0xe2>
mov    -0x28(%rbp),%rdi
lea    0xd62(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1383 <main+0x1f3>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1363 <main+0x1d3>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
sub    $0xa,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xd0f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    131a <main+0x18a>
mov    -0x28(%rbp),%rdi
lea    0xced(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1307 <main+0x177>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0x2,-0x8(%rbp)
jle    1522 <main+0x392>
lea    0xc9c(%rip),%rdi
lea    0xcbd(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    13d2 <main+0x242>
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1529 <main+0x399>
mov    -0x28(%rbp),%rdi
lea    0xc99(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x1c(%rbp),%esi
lea    0xc73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1488 <main+0x2f8>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    146c <main+0x2dc>
mov    -0x28(%rbp),%rdi
lea    0xc19(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x20(%rbp),%esi
lea    0xc06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    142d <main+0x29d>
lea    0xbe8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    141a <main+0x28a>
lea    0xbeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1519 <main+0x389>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    14fd <main+0x36d>
mov    -0x28(%rbp),%rdi
lea    0xb88(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x20(%rbp),%esi
lea    0xb75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14be <main+0x32e>
lea    0xb57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    14ab <main+0x31b>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
jne    11dc <main+0x1c>
lea    0xebf(%rip),%rdi
jmp    1201 <main+0x41>
mov    %edi,%r15d
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10b0 <strtol@plt>
mov    %eax,0xc(%rsp)
cmp    $0x186a1,%eax
jl     121a <main+0x5a>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,0x10(%rsp)
lea    0xddb(%rip),%rdi
lea    0xddf(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1467 <main+0x2a7>
mov    %rax,%r14
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
lea    0xdcd(%rip),%rsi
mov    %r14,%rdi
mov    0x10(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
test   %ebx,%ebx
jle    137b <main+0x1bb>
mov    %ebx,%eax
mov    %r15d,%ebx
lea    0xdae(%rip),%r12
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    %eax,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   10e0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xfffffff7,%ebp
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0xffffffff,%r15d
jne    1290 <main+0xd0>
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
add    $0x1,%r13d
mov    0x10(%rsp),%eax
cmp    %eax,%r13d
jne    1280 <main+0xc0>
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
mov    0x10(%rsp),%eax
test   %eax,%eax
mov    %ebx,%r15d
jle    1388 <main+0x1c8>
lea    0xd17(%rip),%r12
xor    %r13d,%r13d
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   10e0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xfffffff7,%ebp
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0xffffffff,%ebx
jne    1320 <main+0x160>
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
add    $0x1,%r13d
mov    0x10(%rsp),%eax
cmp    %eax,%r13d
jne    1310 <main+0x150>
jmp    1388 <main+0x1c8>
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
mov    %ebp,0x14(%rsp)
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
cmp    $0x3,%r15d
jl     120b <main+0x4b>
lea    0xc59(%rip),%rdi
lea    0xc7a(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1467 <main+0x2a7>
mov    %rax,%r12
lea    0xc77(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1070 <fscanf@plt>
mov    0xc(%rsp),%esi
lea    0xc4c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc62(%rip),%rdi
call   1040 <puts@plt>
lea    0xc49(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    147a <main+0x2ba>
lea    0xc18(%rip),%rbp
lea    0x14(%rsp),%r14
xor    %r15d,%r15d
jmp    1437 <main+0x277>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
mov    0xc(%rsp),%eax
cmp    %eax,%r15d
jge    147a <main+0x2ba>
test   %eax,%eax
jle    1420 <main+0x260>
xor    %ebx,%ebx
nopl   (%rax)
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1070 <fscanf@plt>
mov    0x14(%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1440 <main+0x280>
jmp    1420 <main+0x260>
lea    0xb9f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1206 <main+0x46>
lea    0xbcd(%rip),%rdi
call   1040 <puts@plt>
lea    0xbe7(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    14f7 <main+0x337>
lea    0xb83(%rip),%rbp
lea    0x14(%rsp),%r14
xor    %r15d,%r15d
jmp    14c7 <main+0x307>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
mov    0xc(%rsp),%eax
cmp    %eax,%r15d
jge    14f7 <main+0x337>
test   %eax,%eax
jle    14b0 <main+0x2f0>
xor    %ebx,%ebx
nopl   (%rax)
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1070 <fscanf@plt>
mov    0x14(%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     14d0 <main+0x310>
jmp    14b0 <main+0x2f0>
mov    %r12,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    120b <main+0x4b>

LLVM IR (-O0):
@.str = [32 x i8] c"Please assign the matrix size!\0A\00"
@.str.1 = [25 x i8] c"Exceed the maximum size\0A\00"
@.str.2 = [11 x i8] c"data_input\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [18 x i8] c"Cant open a file!\00"
@.str.5 = [5 x i8] c"%d\0A\0A\00"
@.str.6 = [4 x i8] c"%d\09\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [2 x i8] c"r\00"
@.str.9 = [4 x i8] c"%d\0A\00"
@.str.10 = [23 x i8] c"the matrix size is %d\0A\00"
@.str.11 = [39 x i8] c"=====================================\0A\00"
@.str.12 = [14 x i8] c"Matrix A is \0A\00"
@.str.13 = [14 x i8] c"Matrix B is \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 i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %160
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strtol(i8* %18, i32* null, i32 10)
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = icmp sgt i32 %20, 100000
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %160
24: ; preds = %15
%25 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %25, i32** %10
%26 = load i32*, i32** %10
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %160
30: ; preds = %24
%31 = call i32 @time(i32* null)
%32 = call i32 @srand(i32 %31)
%33 = load i32*, i32** %10
%34 = load i32, i32* %8
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %34)
store i32 0, i32* %6
br label %36
36: ; preds = %59, %30
%37 = load i32, i32* %6
%38 = load i32, i32* %8
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %62
40: ; preds = %36
store i32 0, i32* %7
br label %41
41: ; preds = %53, %40
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %56
45: ; preds = %41
%46 = call i32 (...) @rand()
%47 = srem i32 %46, 20
%48 = sub nsw i32 %47, 10
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
%50 = load i32*, i32** %10
%51 = load i32, i32* %9
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %45
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %41
56: ; preds = %41
%57 = load i32*, i32** %10
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %59
59: ; preds = %56
%60 = load i32, i32* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
br label %36
62: ; preds = %36
%63 = load i32*, i32** %10
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %6
br label %65
65: ; preds = %88, %62
%66 = load i32, i32* %6
%67 = load i32, i32* %8
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %91
69: ; preds = %65
store i32 0, i32* %7
br label %70
70: ; preds = %82, %69
%71 = load i32, i32* %7
%72 = load i32, i32* %8
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %85
74: ; preds = %70
%75 = call i32 (...) @rand()
%76 = srem i32 %75, 20
%77 = sub nsw i32 %76, 10
%78 = add nsw i32 %77, 1
store i32 %78, i32* %9
%79 = load i32*, i32** %10
%80 = load i32, i32* %9
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %79, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %74
%83 = load i32, i32* %7
%84 = add nsw i32 %83, 1
store i32 %84, i32* %7
br label %70
85: ; preds = %70
%86 = load i32*, i32** %10
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %88
88: ; preds = %85
%89 = load i32, i32* %6
%90 = add nsw i32 %89, 1
store i32 %90, i32* %6
br label %65
91: ; preds = %65
%92 = load i32*, i32** %10
%93 = call i32 @fclose(i32* %92)
%94 = load i32, i32* %4
%95 = icmp sgt i32 %94, 2
br i1 %95, label %96, label %159
96: ; preds = %91
%97 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %97, i32** %10
%98 = load i32*, i32** %10
%99 = icmp eq i32* %98, null
br i1 %99, label %100, label %102
100: ; preds = %96
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %160
102: ; preds = %96
%103 = load i32*, i32** %10
%104 = call i32 @fscanf(i32* %103, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32* %8)
%105 = load i32, i32* %8
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %105)
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0))
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %6
br label %109
109: ; preds = %128, %102
%110 = load i32, i32* %6
%111 = load i32, i32* %8
%112 = icmp slt i32 %110, %111
br i1 %112, label %113, label %131
113: ; preds = %109
store i32 0, i32* %7
br label %114
114: ; preds = %123, %113
%115 = load i32, i32* %7
%116 = load i32, i32* %8
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %126
118: ; preds = %114
%119 = load i32*, i32** %10
%120 = call i32 @fscanf(i32* %119, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %9)
%121 = load i32, i32* %9
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %121)
br label %123
123: ; preds = %118
%124 = load i32, i32* %7
%125 = add nsw i32 %124, 1
store i32 %125, i32* %7
br label %114
126: ; preds = %114
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %128
128: ; preds = %126
%129 = load i32, i32* %6
%130 = add nsw i32 %129, 1
store i32 %130, i32* %6
br label %109
131: ; preds = %109
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0))
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %6
br label %134
134: ; preds = %153, %131
%135 = load i32, i32* %6
%136 = load i32, i32* %8
%137 = icmp slt i32 %135, %136
br i1 %137, label %138, label %156
138: ; preds = %134
store i32 0, i32* %7
br label %139
139: ; preds = %148, %138
%140 = load i32, i32* %7
%141 = load i32, i32* %8
%142 = icmp slt i32 %140, %141
br i1 %142, label %143, label %151
143: ; preds = %139
%144 = load i32*, i32** %10
%145 = call i32 @fscanf(i32* %144, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %9)
%146 = load i32, i32* %9
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %146)
br label %148
148: ; preds = %143
%149 = load i32, i32* %7
%150 = add nsw i32 %149, 1
store i32 %150, i32* %7
br label %139
151: ; preds = %139
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %153
153: ; preds = %151
%154 = load i32, i32* %6
%155 = add nsw i32 %154, 1
store i32 %155, i32* %6
br label %134
156: ; preds = %134
%157 = load i32*, i32** %10
%158 = call i32 @fclose(i32* %157)
br label %159
159: ; preds = %156, %91
store i32 0, i32* %3
br label %160
160: ; preds = %159, %100, %28, %22, %13
%161 = load i32, i32* %3
ret i32 %161
}

LLVM IR (-O2):
@.str.2 = [11 x i8] c"data_input\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [18 x i8] c"Cant open a file!\00"
@.str.5 = [5 x i8] c"%d\0A\0A\00"
@.str.6 = [4 x i8] c"%d\09\00"
@.str.8 = [2 x i8] c"r\00"
@.str.9 = [4 x i8] c"%d\0A\00"
@.str.10 = [23 x i8] c"the matrix size is %d\0A\00"
@str.14 = [13 x i8] c"Matrix A is \00"
@str.15 = [38 x i8] c"=====================================\00"
@str.16 = [13 x i8] c"Matrix B is \00"
@str.17 = [24 x i8] c"Exceed the maximum size\00"
@str.18 = [31 x i8] c"Please assign the matrix size!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.18, i64 0, i64 0))
br label %117
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strtol(i8* nocapture %12, i32* null, i32 10)
store i32 %13, i32* %3
%14 = icmp sgt i32 %13, 100000
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.17, i64 0, i64 0))
br label %117
17: ; preds = %10
%18 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %117
22: ; preds = %17
%23 = tail call i32 @time(i32* null)
%24 = tail call i32 @srand(i32 %23)
%25 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%26 = icmp sgt i32 %13, 0
br i1 %26, label %29, label %27
27: ; preds = %22
%28 = tail call i32 @fputc(i32 10, i32* %18)
br label %59
29: ; preds = %22, %39
%30 = phi i32 [ %41, %39 ], [ 0, %22 ]
br label %31
31: ; preds = %29, %31
%32 = phi i32 [ %37, %31 ], [ 0, %29 ]
%33 = tail call i32 (...) @rand()
%34 = srem i32 %33, 20
%35 = add nsw i32 %34, -9
%36 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %35)
%37 = add nuw nsw i32 %32, 1
%38 = icmp eq i32 %37, %13
br i1 %38, label %39, label %31
39: ; preds = %31
%40 = tail call i32 @fputc(i32 10, i32* %18)
%41 = add nuw nsw i32 %30, 1
%42 = icmp eq i32 %41, %13
br i1 %42, label %43, label %29
43: ; preds = %39
%44 = tail call i32 @fputc(i32 10, i32* %18)
br i1 %26, label %45, label %59
45: ; preds = %43, %55
%46 = phi i32 [ %57, %55 ], [ 0, %43 ]
br label %47
47: ; preds = %45, %47
%48 = phi i32 [ %53, %47 ], [ 0, %45 ]
%49 = tail call i32 (...) @rand()
%50 = srem i32 %49, 20
%51 = add nsw i32 %50, -9
%52 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %51)
%53 = add nuw nsw i32 %48, 1
%54 = icmp eq i32 %53, %13
br i1 %54, label %55, label %47
55: ; preds = %47
%56 = tail call i32 @fputc(i32 10, i32* %18)
%57 = add nuw nsw i32 %46, 1
%58 = icmp eq i32 %57, %13
br i1 %58, label %59, label %45
59: ; preds = %55, %27, %43
%60 = phi i32 [ %35, %43 ], [ undef, %27 ], [ %51, %55 ]
store i32 %60, i32* %4
%61 = tail call i32 @fclose(i32* %18)
%62 = icmp sgt i32 %0, 2
br i1 %62, label %63, label %117
63: ; preds = %59
%64 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%65 = icmp eq i32* %64, null
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %117
68: ; preds = %63
%69 = call i32 @fscanf(i32* %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32* %3)
%70 = load i32, i32* %3
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %70)
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.15, i64 0, i64 0))
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.14, i64 0, i64 0))
%74 = load i32, i32* %3
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %93
76: ; preds = %68, %88
%77 = phi i32 [ %91, %88 ], [ %74, %68 ]
%78 = phi i32 [ %90, %88 ], [ 0, %68 ]
%79 = icmp sgt i32 %77, 0
br i1 %79, label %80, label %88
80: ; preds = %76, %80
%81 = phi i32 [ %85, %80 ], [ 0, %76 ]
%82 = call i32 @fscanf(i32* %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%83 = load i32, i32* %4
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %83)
%85 = add nuw nsw i32 %81, 1
%86 = load i32, i32* %3
%87 = icmp slt i32 %85, %86
br i1 %87, label %80, label %88
88: ; preds = %80, %76
%89 = call i32 @putchar(i32 10)
%90 = add nuw nsw i32 %78, 1
%91 = load i32, i32* %3
%92 = icmp slt i32 %90, %91
br i1 %92, label %76, label %93
93: ; preds = %88, %68
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.15, i64 0, i64 0))
%95 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.16, i64 0, i64 0))
%96 = load i32, i32* %3
%97 = icmp sgt i32 %96, 0
br i1 %97, label %98, label %115
98: ; preds = %93, %110
%99 = phi i32 [ %113, %110 ], [ %96, %93 ]
%100 = phi i32 [ %112, %110 ], [ 0, %93 ]
%101 = icmp sgt i32 %99, 0
br i1 %101, label %102, label %110
102: ; preds = %98, %102
%103 = phi i32 [ %107, %102 ], [ 0, %98 ]
%104 = call i32 @fscanf(i32* %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%105 = load i32, i32* %4
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %105)
%107 = add nuw nsw i32 %103, 1
%108 = load i32, i32* %3
%109 = icmp slt i32 %107, %108
br i1 %109, label %102, label %110
110: ; preds = %102, %98
%111 = call i32 @putchar(i32 10)
%112 = add nuw nsw i32 %100, 1
%113 = load i32, i32* %3
%114 = icmp slt i32 %112, %113
br i1 %114, label %98, label %115
115: ; preds = %110, %93
%116 = call i32 @fclose(i32* %64)
br label %117
117: ; preds = %59, %115, %66, %20, %15, %8
%118 = phi i32 [ 1, %8 ], [ 1, %15 ], [ 1, %20 ], [ 1, %66 ], [ 0, %115 ], [ 0, %59 ]
ret i32 %118
}