#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 getopt(int, char **, char *);
char *optarg;
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 size = 10, bound = 5;
  char *OUTPATH = "data_input";
  int b_print = 0;
  int option;
  int temp, i, j;
  FILE *op;
  while ((option = getopt(argc, argv, "s:b:po:")) != -1)
    switch (option) {
    case 's':
      size = strtol(optarg, NULL, 10);
      break;
    case 'b':
      bound = strtol(optarg, NULL, 10);
      ;
      break;
    case 'p':
      b_print = 1;
      break;
    case 'o':
      OUTPATH = optarg;
      break;
    case '?':
      printf("Unexpected Options. \n");
      return -1;
    }
  if ((op = fopen(OUTPATH, "w")) == NULL) {
    printf("Cant open a file!/n");
    return -2;
  }
  srand(time(NULL));
  fprintf(op, "%d\n\n", size);
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      temp = rand() % (2 * bound) - bound + 1;
      fprintf(op, "%d\t", temp);
    }
    fprintf(op, "\n");
  }
  fprintf(op, "\n");
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      temp = rand() % (2 * bound) - bound + 1;
      fprintf(op, "%d\t", temp);
    }
    fprintf(op, "\n");
  }
  fclose(op);
  if (b_print) {
    if ((op = fopen(OUTPATH, "r")) == NULL) {
      printf("Cant open a file!\n");
      return -2;
    }
    fscanf(op, "%d\n", &size);
    printf("The matrix size is %d\n", size);
    printf("=====================================\n");
    printf("Matrix A is \n");
    for (i = 0; i < size; i++) {
      for (j = 0; j < size; j++) {
        fscanf(op, "%d\t", &temp);
        printf("%d\t", temp);
      }
      printf("\n");
    }
    printf("=====================================\n");
    printf("Matrix B is \n");
    for (i = 0; i < size; i++) {
      for (j = 0; j < size; 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    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
lea    0xe35(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe27(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
je     12cb <main+0x12b>
mov    -0x28(%rbp),%eax
mov    %eax,-0x44(%rbp)
sub    $0x3f,%eax
je     12ac <main+0x10c>
jmp    1209 <main+0x69>
mov    -0x44(%rbp),%eax
sub    $0x62,%eax
je     126d <main+0xcd>
jmp    121a <main+0x7a>
mov    -0x44(%rbp),%eax
sub    $0x6f,%eax
je     1299 <main+0xf9>
jmp    122b <main+0x8b>
mov    -0x44(%rbp),%eax
sub    $0x70,%eax
je     128d <main+0xed>
jmp    123c <main+0x9c>
mov    -0x44(%rbp),%eax
sub    $0x73,%eax
jne    12c6 <main+0x126>
jmp    124d <main+0xad>
mov    0x2da4(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x14(%rbp)
jmp    12c6 <main+0x126>
mov    0x2d84(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x18(%rbp)
jmp    12c6 <main+0x126>
movl   $0x1,-0x24(%rbp)
jmp    12c6 <main+0x126>
mov    0x2d58(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    12c6 <main+0x126>
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15e4 <main+0x444>
jmp    11d6 <main+0x36>
mov    -0x20(%rbp),%rdi
lea    0xd53(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1303 <main+0x163>
lea    0xd3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    15e4 <main+0x444>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd1e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13ac <main+0x20c>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    138c <main+0x1ec>
mov    $0x0,%al
call   10c0 <rand@plt>
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
sub    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x2c(%rbp),%edx
lea    0xccd(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1342 <main+0x1a2>
mov    -0x40(%rbp),%rdi
lea    0xcab(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    132f <main+0x18f>
mov    -0x40(%rbp),%rdi
lea    0xc8b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1442 <main+0x2a2>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1422 <main+0x282>
mov    $0x0,%al
call   10c0 <rand@plt>
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
sub    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x2c(%rbp),%edx
lea    0xc37(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13d8 <main+0x238>
mov    -0x40(%rbp),%rdi
lea    0xc15(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    13c5 <main+0x225>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0x0,-0x24(%rbp)
je     15dd <main+0x43d>
mov    -0x20(%rbp),%rdi
lea    0xbe8(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    148d <main+0x2ed>
lea    0xbd0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    15e4 <main+0x444>
mov    -0x40(%rbp),%rdi
lea    0xbd8(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x14(%rbp),%esi
lea    0xbb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbbb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1543 <main+0x3a3>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1527 <main+0x387>
mov    -0x40(%rbp),%rdi
lea    0xb45(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x2c(%rbp),%esi
lea    0xb32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14e8 <main+0x348>
lea    0xb14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    14d5 <main+0x335>
lea    0xb2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    15d4 <main+0x434>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    15b8 <main+0x418>
mov    -0x40(%rbp),%rdi
lea    0xab4(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x2c(%rbp),%esi
lea    0xaa1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1579 <main+0x3d9>
lea    0xa83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1566 <main+0x3c6>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r12
mov    %edi,%ebp
xor    %eax,%eax
mov    %rax,0x18(%rsp)
lea    0xe57(%rip),%r15
mov    $0x5,%r14d
movl   $0xa,0xc(%rsp)
lea    0xe4d(%rip),%r13
lea    0xdf3(%rip),%rbx
nopl   (%rax)
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r13,%rdx
call   10e0 <getopt@plt>
lea    -0x62(%rax),%ecx
cmp    $0x11,%ecx
ja     1250 <main+0x80>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    0x2dc3(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10b0 <strtol@plt>
mov    %eax,%r14d
jmp    1210 <main+0x40>
nopl   0x0(%rax)
cmp    $0xffffffff,%eax
je     1296 <main+0xc6>
cmp    $0x3f,%eax
jne    1210 <main+0x40>
jmp    13d7 <main+0x207>
mov    0x2d92(%rip),%rax
mov    (%rax),%r15
jmp    1210 <main+0x40>
mov    $0x1,%eax
mov    %rax,0x18(%rsp)
jmp    1210 <main+0x40>
mov    0x2d7a(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10b0 <strtol@plt>
mov    %eax,0xc(%rsp)
jmp    1210 <main+0x40>
mov    0xc(%rsp),%ebx
mov    %ebx,0x8(%rsp)
lea    0xdb6(%rip),%rsi
mov    %r15,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     13ed <main+0x21d>
mov    %rax,%r13
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
lea    0xda3(%rip),%rsi
mov    %r13,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
test   %ebx,%ebx
mov    %r15,0x20(%rsp)
jle    1400 <main+0x230>
lea    (%r14,%r14,1),%ebp
lea    0xd84(%rip),%r12
xor    %eax,%eax
mov    0xc(%rsp),%r15d
nopl   0x0(%rax)
mov    %eax,0x14(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   10f0 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%ebx
sub    %r14d,%ebx
add    $0x1,%ebx
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0xffffffff,%r15d
jne    1310 <main+0x140>
mov    $0xa,%edi
mov    %r13,%rsi
call   1080 <fputc@plt>
mov    0x14(%rsp),%eax
add    $0x1,%eax
mov    0xc(%rsp),%r15d
cmp    %r15d,%eax
jne    1300 <main+0x130>
mov    $0xa,%edi
mov    %r13,%rsi
call   1080 <fputc@plt>
test   %r15d,%r15d
jle    140d <main+0x23d>
lea    0xd04(%rip),%r12
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,0x14(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   10f0 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%ebx
sub    %r14d,%ebx
add    $0x1,%ebx
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0xffffffff,%r15d
jne    1390 <main+0x1c0>
mov    $0xa,%edi
mov    %r13,%rsi
call   1080 <fputc@plt>
mov    0x14(%rsp),%eax
add    $0x1,%eax
mov    0xc(%rsp),%r15d
cmp    %r15d,%eax
jne    1380 <main+0x1b0>
jmp    140d <main+0x23d>
lea    0xd07(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
jmp    1584 <main+0x3b4>
lea    0xc69(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    157f <main+0x3af>
mov    $0xa,%edi
mov    %r13,%rsi
call   1080 <fputc@plt>
mov    %ebx,0x10(%rsp)
mov    %r13,%rdi
call   1050 <fclose@plt>
cmpl   $0x0,0x18(%rsp)
je     156f <main+0x39f>
lea    0xc4f(%rip),%rsi
mov    0x20(%rsp),%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1573 <main+0x3a3>
mov    %rax,%r12
lea    0xc47(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
call   1070 <fscanf@plt>
mov    0x8(%rsp),%esi
lea    0xc1c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc32(%rip),%rdi
call   1040 <puts@plt>
lea    0xc19(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    14e7 <main+0x317>
lea    0xbe8(%rip),%rbp
lea    0x10(%rsp),%r14
xor    %r15d,%r15d
jmp    14b7 <main+0x2e7>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
mov    0x8(%rsp),%eax
cmp    %eax,%r15d
jge    14e7 <main+0x317>
test   %eax,%eax
jle    14a0 <main+0x2d0>
xor    %ebx,%ebx
nopl   (%rax)
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1070 <fscanf@plt>
mov    0x10(%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     14c0 <main+0x2f0>
jmp    14a0 <main+0x2d0>
lea    0xbb2(%rip),%rdi
call   1040 <puts@plt>
lea    0xbcc(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1567 <main+0x397>
lea    0xb68(%rip),%rbp
lea    0x10(%rsp),%r14
xor    %r15d,%r15d
jmp    1537 <main+0x367>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
mov    0x8(%rsp),%eax
cmp    %eax,%r15d
jge    1567 <main+0x397>
test   %eax,%eax
jle    1520 <main+0x350>
xor    %ebx,%ebx
nopl   (%rax)
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1070 <fscanf@plt>
mov    0x10(%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     1540 <main+0x370>
jmp    1520 <main+0x350>
mov    %r12,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    1584 <main+0x3b4>
lea    0xb59(%rip),%rdi
call   1040 <puts@plt>
mov    $0xfffffffe,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"data_input\00"
@.str.1 = [8 x i8] c"s:b:po:\00"
@optarg = global i8* null
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [20 x i8] c"Cant open a file!/n\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.10 = [4 x i8] c"%d\0A\00"
@.str.11 = [23 x i8] c"The matrix size is %d\0A\00"
@str.15 = [13 x i8] c"Matrix A is \00"
@str.16 = [38 x i8] c"=====================================\00"
@str.17 = [13 x i8] c"Matrix B is \00"
@str.18 = [18 x i8] c"Cant open a file!\00"
@str.19 = [21 x i8] c"Unexpected Options. \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
br label %7
7: ; preds = %23, %2
%8 = phi i32 [ %25, %23 ], [ 10, %2 ]
%9 = phi i32 [ %13, %23 ], [ 5, %2 ]
%10 = phi i8* [ %17, %23 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %2 ]
%11 = phi i32 [ %20, %23 ], [ 0, %2 ]
br label %12
12: ; preds = %7, %26
%13 = phi i32 [ %9, %7 ], [ %28, %26 ]
%14 = phi i8* [ %10, %7 ], [ %17, %26 ]
%15 = phi i32 [ %11, %7 ], [ %20, %26 ]
br label %16
16: ; preds = %12, %29
%17 = phi i8* [ %14, %12 ], [ %30, %29 ]
%18 = phi i32 [ %15, %12 ], [ %20, %29 ]
br label %19
19: ; preds = %21, %16
%20 = phi i32 [ %18, %16 ], [ 1, %21 ]
br label %21
21: ; preds = %19, %21
%22 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
switch i32 %22, label %21 [
i32 -1, label %33
i32 115, label %23
i32 98, label %26
i32 112, label %19
i32 111, label %29
i32 63, label %31
]
23: ; preds = %21
%24 = load i8*, i8** @optarg
%25 = tail call i32 @strtol(i8* nocapture %24, i32* null, i32 10)
br label %7
26: ; preds = %21
%27 = load i8*, i8** @optarg
%28 = tail call i32 @strtol(i8* nocapture %27, i32* null, i32 10)
br label %12
29: ; preds = %21
%30 = load i8*, i8** @optarg
br label %16
31: ; preds = %21
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.19, i64 0, i64 0))
br label %139
33: ; preds = %21
store i32 %8, i32* %3
%34 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %139
38: ; preds = %33
%39 = tail call i32 @time(i32* null)
%40 = tail call i32 @srand(i32 %39)
%41 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %8)
%42 = icmp sgt i32 %8, 0
br i1 %42, label %45, label %43
43: ; preds = %38
%44 = tail call i32 @fputc(i32 10, i32* %34)
br label %81
45: ; preds = %38
%46 = shl nsw i32 %13, 1
br label %47
47: ; preds = %58, %45
%48 = phi i32 [ 0, %45 ], [ %60, %58 ]
br label %49
49: ; preds = %47, %49
%50 = phi i32 [ %56, %49 ], [ 0, %47 ]
%51 = tail call i32 (...) @rand()
%52 = srem i32 %51, %46
%53 = sub nsw i32 %52, %13
%54 = add nsw i32 %53, 1
%55 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %54)
%56 = add nuw nsw i32 %50, 1
%57 = icmp eq i32 %56, %8
br i1 %57, label %58, label %49
58: ; preds = %49
%59 = tail call i32 @fputc(i32 10, i32* %34)
%60 = add nuw nsw i32 %48, 1
%61 = icmp eq i32 %60, %8
br i1 %61, label %62, label %47
62: ; preds = %58
%63 = tail call i32 @fputc(i32 10, i32* %34)
br i1 %42, label %64, label %81
64: ; preds = %62
%65 = shl nsw i32 %13, 1
br label %66
66: ; preds = %77, %64
%67 = phi i32 [ 0, %64 ], [ %79, %77 ]
br label %68
68: ; preds = %66, %68
%69 = phi i32 [ %75, %68 ], [ 0, %66 ]
%70 = tail call i32 (...) @rand()
%71 = srem i32 %70, %65
%72 = sub nsw i32 %71, %13
%73 = add nsw i32 %72, 1
%74 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %73)
%75 = add nuw nsw i32 %69, 1
%76 = icmp eq i32 %75, %8
br i1 %76, label %77, label %68
77: ; preds = %68
%78 = tail call i32 @fputc(i32 10, i32* %34)
%79 = add nuw nsw i32 %67, 1
%80 = icmp eq i32 %79, %8
br i1 %80, label %81, label %66
81: ; preds = %77, %43, %62
%82 = phi i32 [ %54, %62 ], [ undef, %43 ], [ %73, %77 ]
store i32 %82, i32* %4
%83 = tail call i32 @fclose(i32* %34)
%84 = icmp eq i32 %20, 0
br i1 %84, label %139, label %85
85: ; preds = %81
%86 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%87 = icmp eq i32* %86, null
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.18, i64 0, i64 0))
br label %139
90: ; preds = %85
%91 = call i32 @fscanf(i32* %86, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32* %3)
%92 = load i32, i32* %3
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 %92)
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.16, i64 0, i64 0))
%95 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.15, i64 0, i64 0))
%96 = load i32, i32* %3
%97 = icmp sgt i32 %96, 0
br i1 %97, label %98, label %115
98: ; preds = %90, %110
%99 = phi i32 [ %113, %110 ], [ %96, %90 ]
%100 = phi i32 [ %112, %110 ], [ 0, %90 ]
%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* %86, 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, %90
%116 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.16, i64 0, i64 0))
%117 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.17, i64 0, i64 0))
%118 = load i32, i32* %3
%119 = icmp sgt i32 %118, 0
br i1 %119, label %120, label %137
120: ; preds = %115, %132
%121 = phi i32 [ %135, %132 ], [ %118, %115 ]
%122 = phi i32 [ %134, %132 ], [ 0, %115 ]
%123 = icmp sgt i32 %121, 0
br i1 %123, label %124, label %132
124: ; preds = %120, %124
%125 = phi i32 [ %129, %124 ], [ 0, %120 ]
%126 = call i32 @fscanf(i32* %86, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%127 = load i32, i32* %4
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %127)
%129 = add nuw nsw i32 %125, 1
%130 = load i32, i32* %3
%131 = icmp slt i32 %129, %130
br i1 %131, label %124, label %132
132: ; preds = %124, %120
%133 = call i32 @putchar(i32 10)
%134 = add nuw nsw i32 %122, 1
%135 = load i32, i32* %3
%136 = icmp slt i32 %134, %135
br i1 %136, label %120, label %137
137: ; preds = %132, %115
%138 = call i32 @fclose(i32* %86)
br label %139
139: ; preds = %81, %137, %88, %36, %31
%140 = phi i32 [ -1, %31 ], [ -2, %36 ], [ -2, %88 ], [ 0, %137 ], [ 0, %81 ]
ret i32 %140
}