#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 **CreateMat(int);
int /*<<< orphan*/ DestroyMat(int **, int);
int /*<<< orphan*/ PrintMat(int **, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
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, rate = 5;
  char *OUTPATH = "data_input";
  int b_print = 0;
  int option;
  int temp, i, j;
  int **A;
  FILE *op;
  while ((option = getopt(argc, argv, "s:b:r:po:")) != -1)
    switch (option) {
    case 's':
      size = strtol(optarg, NULL, 10);
      break;
    case 'b':
      bound = strtol(optarg, NULL, 10);
      break;
    case 'r':
      rate = strtol(optarg, NULL, 10);
    case 'p':
      b_print = 1;
      break;
    case 'o':
      OUTPATH = optarg;
      break;
    case '?':
      printf("Unexpected Options. \n");
      return -1;
    }
  A = CreateMat(size);
  srand(time(NULL));
  for (i = 0; i < size; ++i) {
    for (j = i; j < size; ++j) {
      if (rand() % 100 <= rate)
        A[i][j] = 10 * bound;
      else
        A[i][j] = rand() % bound + 1;
      A[j][i] = A[i][j];
    }
  }
  for (i = 0; i < size; ++i) {
    A[i][i] = 0;
  }
  if ((op = fopen(OUTPATH, "w")) == NULL) {
    printf("Cant open a file!/n");
    return -2;
  }
  fprintf(op, "%d\n\n", size);
  for (i = 0; i < size; ++i) {
    for (j = 0; j < size; ++j) {
      fprintf(op, "%d\t", A[i][j]);
    }
    fprintf(op, "\n");
  }
  fclose(op);
  if (b_print) {
    printf("The matrix size is %d\n", size);
    printf("=====================================\n");
    printf("Matrix A is \n");
    PrintMat(A, size);
  }
  DestroyMat(A, size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
movl   $0x5,-0x1c(%rbp)
lea    0xee2(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xed4(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x30(%rbp)
cmp    $0xffffffff,%eax
je     12de <main+0x11e>
mov    -0x30(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x34,%eax
ja     12d9 <main+0x119>
mov    -0x58(%rbp),%rax
lea    0xdc4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2dac(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x14(%rbp)
jmp    12d9 <main+0x119>
mov    0x2d8c(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x18(%rbp)
jmp    12d9 <main+0x119>
mov    0x2d6c(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    12d9 <main+0x119>
mov    0x2d45(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    12d9 <main+0x119>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1518 <main+0x358>
jmp    11fd <main+0x3d>
mov    -0x14(%rbp),%edi
call   10d0 <CreateMat@plt>
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13bb <main+0x1fb>
mov    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13a8 <main+0x1e8>
mov    $0x0,%al
call   10e0 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    -0x1c(%rbp),%edx
jg     1353 <main+0x193>
imul   $0xa,-0x18(%rbp),%edx
mov    -0x48(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1374 <main+0x1b4>
mov    $0x0,%al
call   10e0 <rand@plt>
cltd
idivl  -0x18(%rbp)
add    $0x1,%edx
mov    -0x48(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x48(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x38(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1313 <main+0x153>
jmp    13ad <main+0x1ed>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1301 <main+0x141>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13f3 <main+0x233>
mov    -0x48(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x38(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    13c2 <main+0x202>
mov    -0x28(%rbp),%rdi
lea    0xd01(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    142b <main+0x26b>
lea    0xce9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1518 <main+0x358>
mov    -0x50(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xcdc(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14b9 <main+0x2f9>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1499 <main+0x2d9>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    145a <main+0x29a>
mov    -0x50(%rbp),%rdi
lea    0xc74(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1447 <main+0x287>
mov    -0x50(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0x0,-0x2c(%rbp)
je     1505 <main+0x345>
mov    -0x14(%rbp),%esi
lea    0xc48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10a0 <PrintMat@plt>
mov    -0x48(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <DestroyMat@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%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,%r13
mov    %edi,%ebx
mov    $0xa,%r12d
mov    $0x5,%r14d
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xec7(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xec6(%rip),%rbp
lea    0xde0(%rip),%r15
mov    $0x5,%eax
mov    %rax,0x18(%rsp)
jmp    1239 <main+0x59>
nopl   0x0(%rax)
cmp    $0xffffffff,%eax
je     12e1 <main+0x101>
mov    %ebx,%edi
mov    %r13,%rsi
mov    %rbp,%rdx
call   10e0 <getopt@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x34,%ecx
ja     1230 <main+0x50>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    0x2d9a(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x20(%rsp)
jmp    1239 <main+0x59>
mov    0x2d89(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10a0 <strtol@plt>
mov    %eax,%r14d
mov    $0x1,%eax
mov    %rax,0x10(%rsp)
jmp    1239 <main+0x59>
mov    0x2d64(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10a0 <strtol@plt>
mov    %eax,%r12d
jmp    1239 <main+0x59>
nopl   0x0(%rax,%rax,1)
mov    0x2d41(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10a0 <strtol@plt>
jmp    1225 <main+0x45>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    14f9 <main+0x319>
mov    %r12d,%edi
call   10f0 <CreateMat@plt>
mov    %rax,%r15
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    %r12d,%r13d
test   %r12d,%r12d
mov    %r12d,0xc(%rsp)
jle    1405 <main+0x225>
mov    0x18(%rsp),%rax
add    %eax,%eax
lea    (%rax,%rax,4),%ebp
xor    %r12d,%r12d
jmp    1329 <main+0x149>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    %r13,%r12
je     1382 <main+0x1a2>
mov    %r12,%rbx
jmp    1348 <main+0x168>
xchg   %ax,%ax
mov    (%r15,%r12,8),%rax
mov    %edx,(%rax,%rbx,4)
mov    (%r15,%rbx,8),%rax
mov    %edx,(%rax,%r12,4)
add    $0x1,%rbx
cmp    %rbx,%r13
je     1320 <main+0x140>
xor    %eax,%eax
call   1100 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %ebp,%edx
cmp    %r14d,%eax
jle    1330 <main+0x150>
xor    %eax,%eax
call   1100 <rand@plt>
cltd
idivl  0x18(%rsp)
add    $0x1,%edx
jmp    1330 <main+0x150>
cmpl   $0x0,0xc(%rsp)
jle    1405 <main+0x225>
lea    -0x1(%r13),%rcx
mov    %r13d,%eax
and    $0x3,%eax
cmp    $0x3,%rcx
jae    139d <main+0x1bd>
xor    %ecx,%ecx
jmp    13eb <main+0x20b>
mov    %r13d,%edx
and    $0xfffffffc,%edx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rcx,8),%rsi
movl   $0x0,(%rsi,%rcx,4)
mov    0x8(%r15,%rcx,8),%rsi
movl   $0x0,0x4(%rsi,%rcx,4)
mov    0x10(%r15,%rcx,8),%rsi
movl   $0x0,0x8(%rsi,%rcx,4)
mov    0x18(%r15,%rcx,8),%rsi
movl   $0x0,0xc(%rsi,%rcx,4)
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    13b0 <main+0x1d0>
test   %rax,%rax
je     1405 <main+0x225>
mov    (%r15,%rcx,8),%rdx
movl   $0x0,(%rdx,%rcx,4)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rax
jne    13f0 <main+0x210>
lea    0xcdd(%rip),%rsi
mov    0x20(%rsp),%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     14e6 <main+0x306>
mov    %rax,%r12
lea    0xcd6(%rip),%rsi
mov    %rax,%rdi
mov    0xc(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
test   %ebx,%ebx
jle    1493 <main+0x2b3>
lea    0xcc0(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rax
mov    (%rax,%rbp,4),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1460 <main+0x280>
mov    $0xa,%edi
mov    %r12,%rsi
call   1070 <fputc@plt>
add    $0x1,%rbx
cmp    %r13,%rbx
jne    1450 <main+0x270>
mov    %r12,%rdi
call   1040 <fclose@plt>
cmpl   $0x0,0x10(%rsp)
mov    0xc(%rsp),%ebx
je     14d8 <main+0x2f8>
lea    0xc5b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc62(%rip),%rdi
call   1030 <puts@plt>
lea    0xc7c(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   10c0 <PrintMat@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1060 <DestroyMat@plt>
xor    %eax,%eax
jmp    14f9 <main+0x319>
lea    0xbfe(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@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 = [10 x i8] c"s:b:r: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 = [23 x i8] c"The matrix size is %d\0A\00"
@.str.9 = [39 x i8] c"=====================================\0A\00"
@.str.10 = [14 x i8] c"Matrix A 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 i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32**
%16 = 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 i32 5, i32* %8
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %9
store i32 0, i32* %10
br label %17
17: ; preds = %38, %2
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = call i32 @getopt(i32 %18, i8** %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 %20, i32* %11
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %39
22: ; preds = %17
%23 = load i32, i32* %11
switch i32 %23, label %38 [
i32 115, label %24
i32 98, label %27
i32 114, label %30
i32 112, label %33
i32 111, label %34
i32 63, label %36
]
24: ; preds = %22
%25 = load i8*, i8** @optarg
%26 = call i32 @strtol(i8* %25, i32* null, i32 10)
store i32 %26, i32* %6
br label %38
27: ; preds = %22
%28 = load i8*, i8** @optarg
%29 = call i32 @strtol(i8* %28, i32* null, i32 10)
store i32 %29, i32* %7
br label %38
30: ; preds = %22
%31 = load i8*, i8** @optarg
%32 = call i32 @strtol(i8* %31, i32* null, i32 10)
store i32 %32, i32* %8
br label %33
33: ; preds = %22, %30
store i32 1, i32* %10
br label %38
34: ; preds = %22
%35 = load i8*, i8** @optarg
store i8* %35, i8** %9
br label %38
36: ; preds = %22
%37 = 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 %182
38: ; preds = %22, %34, %33, %27, %24
br label %17
39: ; preds = %17
%40 = load i32, i32* %6
%41 = call i32** @CreateMat(i32 %40)
store i32** %41, i32*** %15
%42 = call i32 @time(i32* null)
%43 = call i32 @srand(i32 %42)
store i32 0, i32* %13
br label %44
44: ; preds = %105, %39
%45 = load i32, i32* %13
%46 = load i32, i32* %6
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %108
48: ; preds = %44
%49 = load i32, i32* %13
store i32 %49, i32* %14
br label %50
50: ; preds = %101, %48
%51 = load i32, i32* %14
%52 = load i32, i32* %6
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %104
54: ; preds = %50
%55 = call i32 (...) @rand()
%56 = srem i32 %55, 100
%57 = load i32, i32* %8
%58 = icmp sle i32 %56, %57
br i1 %58, label %59, label %70
59: ; preds = %54
%60 = load i32, i32* %7
%61 = mul nsw i32 10, %60
%62 = load i32**, i32*** %15
%63 = load i32, i32* %13
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32*, i32** %62, i64 %64
%66 = load i32*, i32** %65
%67 = load i32, i32* %14
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i32, i32* %66, i64 %68
store i32 %61, i32* %69
br label %83
70: ; preds = %54
%71 = call i32 (...) @rand()
%72 = load i32, i32* %7
%73 = srem i32 %71, %72
%74 = add nsw i32 %73, 1
%75 = load i32**, i32*** %15
%76 = load i32, i32* %13
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32*, i32** %75, i64 %77
%79 = load i32*, i32** %78
%80 = load i32, i32* %14
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %79, i64 %81
store i32 %74, i32* %82
br label %83
83: ; preds = %70, %59
%84 = load i32**, i32*** %15
%85 = load i32, i32* %13
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32*, i32** %84, i64 %86
%88 = load i32*, i32** %87
%89 = load i32, i32* %14
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %88, i64 %90
%92 = load i32, i32* %91
%93 = load i32**, i32*** %15
%94 = load i32, i32* %14
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32*, i32** %93, i64 %95
%97 = load i32*, i32** %96
%98 = load i32, i32* %13
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i32, i32* %97, i64 %99
store i32 %92, i32* %100
br label %101
101: ; preds = %83
%102 = load i32, i32* %14
%103 = add nsw i32 %102, 1
store i32 %103, i32* %14
br label %50
104: ; preds = %50
br label %105
105: ; preds = %104
%106 = load i32, i32* %13
%107 = add nsw i32 %106, 1
store i32 %107, i32* %13
br label %44
108: ; preds = %44
store i32 0, i32* %13
br label %109
109: ; preds = %122, %108
%110 = load i32, i32* %13
%111 = load i32, i32* %6
%112 = icmp slt i32 %110, %111
br i1 %112, label %113, label %125
113: ; preds = %109
%114 = load i32**, i32*** %15
%115 = load i32, i32* %13
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i32*, i32** %114, i64 %116
%118 = load i32*, i32** %117
%119 = load i32, i32* %13
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i32, i32* %118, i64 %120
store i32 0, i32* %121
br label %122
122: ; preds = %113
%123 = load i32, i32* %13
%124 = add nsw i32 %123, 1
store i32 %124, i32* %13
br label %109
125: ; preds = %109
%126 = load i8*, i8** %9
%127 = call i32* @fopen(i8* %126, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %127, i32** %16
%128 = icmp eq i32* %127, null
br i1 %128, label %129, label %131
129: ; preds = %125
%130 = 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 %182
131: ; preds = %125
%132 = load i32*, i32** %16
%133 = load i32, i32* %6
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %132, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %133)
store i32 0, i32* %13
br label %135
135: ; preds = %162, %131
%136 = load i32, i32* %13
%137 = load i32, i32* %6
%138 = icmp slt i32 %136, %137
br i1 %138, label %139, label %165
139: ; preds = %135
store i32 0, i32* %14
br label %140
140: ; preds = %156, %139
%141 = load i32, i32* %14
%142 = load i32, i32* %6
%143 = icmp slt i32 %141, %142
br i1 %143, label %144, label %159
144: ; preds = %140
%145 = load i32*, i32** %16
%146 = load i32**, i32*** %15
%147 = load i32, i32* %13
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds i32*, i32** %146, i64 %148
%150 = load i32*, i32** %149
%151 = load i32, i32* %14
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i32, i32* %150, i64 %152
%154 = load i32, i32* %153
%155 = call i32 (i32*, i8*, ...) @fprintf(i32* %145, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %154)
br label %156
156: ; preds = %144
%157 = load i32, i32* %14
%158 = add nsw i32 %157, 1
store i32 %158, i32* %14
br label %140
159: ; preds = %140
%160 = load i32*, i32** %16
%161 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %162
162: ; preds = %159
%163 = load i32, i32* %13
%164 = add nsw i32 %163, 1
store i32 %164, i32* %13
br label %135
165: ; preds = %135
%166 = load i32*, i32** %16
%167 = call i32 @fclose(i32* %166)
%168 = load i32, i32* %10
%169 = icmp ne i32 %168, 0
br i1 %169, label %170, label %178
170: ; preds = %165
%171 = load i32, i32* %6
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %171)
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%175 = load i32**, i32*** %15
%176 = load i32, i32* %6
%177 = call i32 @PrintMat(i32** %175, i32 %176)
br label %178
178: ; preds = %170, %165
%179 = load i32**, i32*** %15
%180 = load i32, i32* %6
%181 = call i32 @DestroyMat(i32** %179, i32 %180)
store i32 0, i32* %3
br label %182
182: ; preds = %178, %129, %36
%183 = load i32, i32* %3
ret i32 %183
}

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