#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 */

/* Variables and functions */
int /*<<< orphan*/ mat_add(int **, int, int, int **, int, int);
int /*<<< orphan*/ mat_read(int **, int, int);
int /*<<< orphan*/ mat_write(int **, int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int /*<<< orphan*/ sp_add(int **, int **);
int /*<<< orphan*/ sparsify(int **, int **, int, int);
int main() {
  int r1, c1, r2, c2, ch;
  int m1[80][80], m2[80][80], sp1[80][80], sp2[80][80];
  puts("Enter row and column numbers of matrices 1 and 2:");
  scanf(" %u %u %u %u%*c", &r1, &c1, &r2, &c2);
  putchar('\n');
  printf("Enter value of Matrix 1 (%ux%u):\n", r1, c1);
  mat_read(m1, r1, c1);
  putchar('\n');
  printf("Enter value of Matrix 2 (%ux%u):\n", r2, c2);
  mat_read(m2, r2, c2);
  putchar('\n');
  sparsify(sp1, m1, r1, c1);
  sparsify(sp2, m2, r2, c2);
  do {
    puts("What would you like to do?");
    puts(" ( 0) Exit");
    puts(" ( 1) Display");
    puts(" ( 2) Sum");
    puts(" ( 3) Sparse Display");
    puts(" ( 4) Sparse Sum");
    scanf(" %u%*c", &ch);
    switch (ch) {
    case 0:
      puts("Bye!");
      break;
    case 1:
      puts("Matrix 1:");
      mat_write(m1, r1, c1);
      putchar('\n');
      puts("Matrix 2:");
      mat_write(m2, r2, c2);
      break;
    case 2:
      mat_add(m1, r1, c1, m2, r2, c2);
      break;
    case 3:
      puts("Sparse Matrix 1:");
      mat_write(sp1, sp1[0][2] + 1, 3);
      putchar('\n');
      puts("Sparse Matrix 2:");
      mat_write(sp2, sp2[0][2] + 1, 3);
      break;
    case 4:
      sp_add(sp1, sp2);
      break;
    default:
      puts("Incorrect Choice!");
      break;
    }
    putchar('\n');
  } while (ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x19030,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe91(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1080 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe73(%rip),%rdi
call   1060 <printf@plt>
lea    -0x6420(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1070 <mat_read@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe67(%rip),%rdi
call   1060 <printf@plt>
lea    -0xc820(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1070 <mat_read@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x12c20(%rbp),%rdi
lea    -0x6420(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1090 <sparsify@plt>
lea    -0x19020(%rbp),%rdi
lea    -0xc820(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1090 <sparsify@plt>
lea    0xe2f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe46(%rip),%rdi
call   1040 <puts@plt>
lea    0xd9c(%rip),%rdi
xor    %eax,%eax
lea    -0x18(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %rax,-0x19028(%rbp)
sub    $0x4,%rax
ja     13de <main+0x24e>
mov    -0x19028(%rbp),%rax
lea    0xd20(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe0e(%rip),%rdi
call   1040 <puts@plt>
jmp    13ea <main+0x25a>
lea    0xe09(%rip),%rdi
call   1040 <puts@plt>
lea    -0x6420(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <mat_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdf2(%rip),%rdi
call   1040 <puts@plt>
lea    -0xc820(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <mat_write@plt>
jmp    13ea <main+0x25a>
lea    -0x6420(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0xc820(%rbp),%rcx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
call   10b0 <mat_add@plt>
jmp    13ea <main+0x25a>
lea    0xd91(%rip),%rdi
call   1040 <puts@plt>
lea    -0x12c20(%rbp),%rdi
mov    -0x12c18(%rbp),%esi
add    $0x1,%esi
mov    $0x3,%edx
call   1050 <mat_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd72(%rip),%rdi
call   1040 <puts@plt>
lea    -0x19020(%rbp),%rdi
mov    -0x19018(%rbp),%esi
add    $0x1,%esi
mov    $0x3,%edx
call   1050 <mat_write@plt>
jmp    13ea <main+0x25a>
lea    -0x12c20(%rbp),%rdi
lea    -0x19020(%rbp),%rsi
call   10a0 <sp_add@plt>
jmp    13ea <main+0x25a>
lea    0xd40(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1264 <main+0xd4>
xor    %eax,%eax
add    $0x19030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x19028,%rsp
lea    0xe6c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe92(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
xor    %eax,%eax
call   1080 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x18(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0xe6e(%rip),%rdi
call   1060 <printf@plt>
mov    0x18(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0x12c20(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <mat_read@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xe5a(%rip),%rdi
call   1060 <printf@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xc820(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <mat_read@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x18(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0x6420(%rsp),%rdi
mov    %rbx,%rsi
call   1090 <sparsify@plt>
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0x20(%rsp),%rdi
mov    %rbp,%rsi
call   1090 <sparsify@plt>
lea    0xe55(%rip),%r15
lea    0xe58(%rip),%r12
lea    0xe66(%rip),%r13
lea    0xdc1(%rip),%rbx
lea    0x1c(%rsp),%rbp
lea    0xd66(%rip),%r14
jmp    12bd <main+0x12d>
lea    0xe82(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x1c(%rsp)
je     140f <main+0x27f>
lea    0xdd6(%rip),%rdi
call   1040 <puts@plt>
lea    0xde5(%rip),%rdi
call   1040 <puts@plt>
lea    0xde4(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0x1c(%rsp),%eax
cmp    $0x4,%rax
ja     129c <main+0x10c>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
lea    0xdde(%rip),%rdi
jmp    12a3 <main+0x113>
lea    0xde1(%rip),%rdi
call   1040 <puts@plt>
mov    0x18(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0x12c20(%rsp),%rdi
call   1050 <mat_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc7(%rip),%rdi
call   1040 <puts@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xc820(%rsp),%rdi
call   1050 <mat_write@plt>
jmp    12a8 <main+0x118>
mov    0x18(%rsp),%esi
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%r8d
mov    0xc(%rsp),%r9d
lea    0x12c20(%rsp),%rdi
lea    0xc820(%rsp),%rcx
call   10b0 <mat_add@plt>
jmp    12a8 <main+0x118>
lea    0xd5d(%rip),%rdi
call   1040 <puts@plt>
mov    0x6428(%rsp),%esi
add    $0x1,%esi
lea    0x6420(%rsp),%rdi
mov    $0x3,%edx
call   1050 <mat_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd3c(%rip),%rdi
call   1040 <puts@plt>
mov    0x28(%rsp),%esi
add    $0x1,%esi
lea    0x20(%rsp),%rdi
mov    $0x3,%edx
call   1050 <mat_write@plt>
jmp    12a8 <main+0x118>
lea    0x6420(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   10a0 <sp_add@plt>
jmp    12a8 <main+0x118>
xor    %eax,%eax
add    $0x19028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Enter row and column numbers of matrices 1 and 2:\00"
@.str.1 = [16 x i8] c" %u %u %u %u%*c\00"
@.str.2 = [34 x i8] c"Enter value of Matrix 1 (%ux%u):\0A\00"
@.str.3 = [34 x i8] c"Enter value of Matrix 2 (%ux%u):\0A\00"
@.str.4 = [27 x i8] c"What would you like to do?\00"
@.str.5 = [11 x i8] c" ( 0) Exit\00"
@.str.6 = [14 x i8] c" ( 1) Display\00"
@.str.7 = [10 x i8] c" ( 2) Sum\00"
@.str.8 = [21 x i8] c" ( 3) Sparse Display\00"
@.str.9 = [17 x i8] c" ( 4) Sparse Sum\00"
@.str.10 = [7 x i8] c" %u%*c\00"
@.str.11 = [5 x i8] c"Bye!\00"
@.str.12 = [10 x i8] c"Matrix 1:\00"
@.str.13 = [10 x i8] c"Matrix 2:\00"
@.str.14 = [17 x i8] c"Sparse Matrix 1:\00"
@.str.15 = [17 x i8] c"Sparse Matrix 2:\00"
@.str.16 = [18 x i8] c"Incorrect Choice!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [80 x [80 x i32]]
%8 = alloca [80 x [80 x i32]]
%9 = alloca [80 x [80 x i32]]
%10 = alloca [80 x [80 x i32]]
store i32 0, i32* %1
%11 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%13 = call i32 @putchar(i8 signext 10)
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15)
%17 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %7, i64 0, i64 0
%18 = bitcast [80 x i32]* %17 to i32**
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @mat_read(i32** %18, i32 %19, i32 %20)
%22 = call i32 @putchar(i8 signext 10)
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %24)
%26 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %8, i64 0, i64 0
%27 = bitcast [80 x i32]* %26 to i32**
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = call i32 @mat_read(i32** %27, i32 %28, i32 %29)
%31 = call i32 @putchar(i8 signext 10)
%32 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %9, i64 0, i64 0
%33 = bitcast [80 x i32]* %32 to i32**
%34 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %7, i64 0, i64 0
%35 = bitcast [80 x i32]* %34 to i32**
%36 = load i32, i32* %2
%37 = load i32, i32* %3
%38 = call i32 @sparsify(i32** %33, i32** %35, i32 %36, i32 %37)
%39 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %10, i64 0, i64 0
%40 = bitcast [80 x i32]* %39 to i32**
%41 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %8, i64 0, i64 0
%42 = bitcast [80 x i32]* %41 to i32**
%43 = load i32, i32* %4
%44 = load i32, i32* %5
%45 = call i32 @sparsify(i32** %40, i32** %42, i32 %43, i32 %44)
br label %46
46: ; preds = %109, %0
%47 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%48 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%49 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%50 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%51 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%52 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%53 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i32* %6)
%54 = load i32, i32* %6
switch i32 %54, label %105 [
i32 0, label %55
i32 1, label %57
i32 2, label %71
i32 3, label %81
i32 4, label %99
]
55: ; preds = %46
%56 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
br label %107
57: ; preds = %46
%58 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%59 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %7, i64 0, i64 0
%60 = bitcast [80 x i32]* %59 to i32**
%61 = load i32, i32* %2
%62 = load i32, i32* %3
%63 = call i32 @mat_write(i32** %60, i32 %61, i32 %62)
%64 = call i32 @putchar(i8 signext 10)
%65 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%66 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %8, i64 0, i64 0
%67 = bitcast [80 x i32]* %66 to i32**
%68 = load i32, i32* %4
%69 = load i32, i32* %5
%70 = call i32 @mat_write(i32** %67, i32 %68, i32 %69)
br label %107
71: ; preds = %46
%72 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %7, i64 0, i64 0
%73 = bitcast [80 x i32]* %72 to i32**
%74 = load i32, i32* %2
%75 = load i32, i32* %3
%76 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %8, i64 0, i64 0
%77 = bitcast [80 x i32]* %76 to i32**
%78 = load i32, i32* %4
%79 = load i32, i32* %5
%80 = call i32 @mat_add(i32** %73, i32 %74, i32 %75, i32** %77, i32 %78, i32 %79)
br label %107
81: ; preds = %46
%82 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0))
%83 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %9, i64 0, i64 0
%84 = bitcast [80 x i32]* %83 to i32**
%85 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %9, i64 0, i64 0
%86 = getelementptr inbounds [80 x i32], [80 x i32]* %85, i64 0, i64 2
%87 = load i32, i32* %86
%88 = add nsw i32 %87, 1
%89 = call i32 @mat_write(i32** %84, i32 %88, i32 3)
%90 = call i32 @putchar(i8 signext 10)
%91 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
%92 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %10, i64 0, i64 0
%93 = bitcast [80 x i32]* %92 to i32**
%94 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %10, i64 0, i64 0
%95 = getelementptr inbounds [80 x i32], [80 x i32]* %94, i64 0, i64 2
%96 = load i32, i32* %95
%97 = add nsw i32 %96, 1
%98 = call i32 @mat_write(i32** %93, i32 %97, i32 3)
br label %107
99: ; preds = %46
%100 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %9, i64 0, i64 0
%101 = bitcast [80 x i32]* %100 to i32**
%102 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %10, i64 0, i64 0
%103 = bitcast [80 x i32]* %102 to i32**
%104 = call i32 @sp_add(i32** %101, i32** %103)
br label %107
105: ; preds = %46
%106 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0))
br label %107
107: ; preds = %105, %99, %81, %71, %57, %55
%108 = call i32 @putchar(i8 signext 10)
br label %109
109: ; preds = %107
%110 = load i32, i32* %6
%111 = icmp ne i32 %110, 0
br i1 %111, label %46, label %112
112: ; preds = %109
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"Enter row and column numbers of matrices 1 and 2:\00"
@.str.1 = [16 x i8] c" %u %u %u %u%*c\00"
@.str.2 = [34 x i8] c"Enter value of Matrix 1 (%ux%u):\0A\00"
@.str.3 = [34 x i8] c"Enter value of Matrix 2 (%ux%u):\0A\00"
@.str.4 = [27 x i8] c"What would you like to do?\00"
@.str.5 = [11 x i8] c" ( 0) Exit\00"
@.str.6 = [14 x i8] c" ( 1) Display\00"
@.str.7 = [10 x i8] c" ( 2) Sum\00"
@.str.8 = [21 x i8] c" ( 3) Sparse Display\00"
@.str.9 = [17 x i8] c" ( 4) Sparse Sum\00"
@.str.10 = [7 x i8] c" %u%*c\00"
@.str.11 = [5 x i8] c"Bye!\00"
@.str.12 = [10 x i8] c"Matrix 1:\00"
@.str.13 = [10 x i8] c"Matrix 2:\00"
@.str.14 = [17 x i8] c"Sparse Matrix 1:\00"
@.str.15 = [17 x i8] c"Sparse Matrix 2:\00"
@.str.16 = [18 x i8] c"Incorrect Choice!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [80 x [80 x i32]]
%7 = alloca [80 x [80 x i32]]
%8 = alloca [80 x [80 x i32]]
%9 = alloca [80 x [80 x i32]]
%10 = bitcast i32* %1 to i8*
%11 = bitcast i32* %2 to i8*
%12 = bitcast i32* %3 to i8*
%13 = bitcast i32* %4 to i8*
%14 = bitcast i32* %5 to i8*
%15 = bitcast [80 x [80 x i32]]* %6 to i8*
%16 = bitcast [80 x [80 x i32]]* %7 to i8*
%17 = bitcast [80 x [80 x i32]]* %8 to i8*
%18 = bitcast [80 x [80 x i32]]* %9 to i8*
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%21 = call i32 @putchar(i8 signext 10)
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23)
%25 = bitcast [80 x [80 x i32]]* %6 to i32**
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = call i32 @mat_read(i32** %25, i32 %26, i32 %27)
%29 = call i32 @putchar(i8 signext 10)
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %30, i32 %31)
%33 = bitcast [80 x [80 x i32]]* %7 to i32**
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = call i32 @mat_read(i32** %33, i32 %34, i32 %35)
%37 = call i32 @putchar(i8 signext 10)
%38 = bitcast [80 x [80 x i32]]* %8 to i32**
%39 = load i32, i32* %1
%40 = load i32, i32* %2
%41 = call i32 @sparsify(i32** %38, i32** %25, i32 %39, i32 %40)
%42 = bitcast [80 x [80 x i32]]* %9 to i32**
%43 = load i32, i32* %3
%44 = load i32, i32* %4
%45 = call i32 @sparsify(i32** %42, i32** %33, i32 %43, i32 %44)
%46 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %8, i64 0, i64 0, i64 2
%47 = getelementptr inbounds [80 x [80 x i32]], [80 x [80 x i32]]* %9, i64 0, i64 0, i64 2
br label %48
48: ; preds = %89, %0
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%55 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i32* %5)
%56 = load i32, i32* %5
switch i32 %56, label %87 [
i32 0, label %57
i32 1, label %59
i32 2, label %69
i32 3, label %75
i32 4, label %85
]
57: ; preds = %48
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
br label %89
59: ; preds = %48
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%61 = load i32, i32* %1
%62 = load i32, i32* %2
%63 = call i32 @mat_write(i32** %25, i32 %61, i32 %62)
%64 = call i32 @putchar(i8 signext 10)
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%66 = load i32, i32* %3
%67 = load i32, i32* %4
%68 = call i32 @mat_write(i32** %33, i32 %66, i32 %67)
br label %89
69: ; preds = %48
%70 = load i32, i32* %1
%71 = load i32, i32* %2
%72 = load i32, i32* %3
%73 = load i32, i32* %4
%74 = call i32 @mat_add(i32** %25, i32 %70, i32 %71, i32** %33, i32 %72, i32 %73)
br label %89
75: ; preds = %48
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0))
%77 = load i32, i32* %46
%78 = add nsw i32 %77, 1
%79 = call i32 @mat_write(i32** %38, i32 %78, i32 3)
%80 = call i32 @putchar(i8 signext 10)
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
%82 = load i32, i32* %47
%83 = add nsw i32 %82, 1
%84 = call i32 @mat_write(i32** %42, i32 %83, i32 3)
br label %89
85: ; preds = %48
%86 = call i32 @sp_add(i32** %38, i32** %42)
br label %89
87: ; preds = %48
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0))
br label %89
89: ; preds = %87, %85, %75, %69, %59, %57
%90 = call i32 @putchar(i8 signext 10)
%91 = load i32, i32* %5
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %48
93: ; preds = %89
ret i32 0
}