#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 */
struct MatrixNode {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ read(int /*<<< orphan*/ *, struct MatrixNode **,
                        struct MatrixNode **, int *, int *);
int main(int argc, char *argv[]) {
  FILE *fin = fopen("matrix1.txt", "r");
  FILE *fout = fopen("result1.txt", "w");
  struct MatrixNode **a_colHeader, **a_rowHeader;
  int a_col, a_row;
  struct MatrixNode **b_colHeader, **b_rowHeader;
  int b_col, b_row;
  read(fin, a_colHeader, a_rowHeader, &a_col, &a_row);
  read(fin, b_colHeader, b_rowHeader, &b_col, &b_row);
  fclose(fin);
  fclose(fout);
  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)
lea    0xeb3(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rcx
lea    -0x38(%rbp),%r8
call   1040 <read@plt>
mov    -0x18(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
lea    -0x4c(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1040 <read@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xeba(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    %rbx,%rdi
call   1040 <read@plt>
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rbx,%rdi
call   1040 <read@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.MatrixNode = type { i32 }
@.str = [12 x i8] c"matrix1.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [12 x i8] c"result1.txt\00"
@.str.3 = [2 x i8] c"w\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 %struct.MatrixNode**
%9 = alloca %struct.MatrixNode**
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.MatrixNode**
%13 = alloca %struct.MatrixNode**
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %6
%17 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 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* %17, i32** %7
%18 = load i32*, i32** %6
%19 = load %struct.MatrixNode**, %struct.MatrixNode*** %8
%20 = load %struct.MatrixNode**, %struct.MatrixNode*** %9
%21 = call i32 @read(i32* %18, %struct.MatrixNode** %19, %struct.MatrixNode** %20, i32* %10, i32* %11)
%22 = load i32*, i32** %6
%23 = load %struct.MatrixNode**, %struct.MatrixNode*** %12
%24 = load %struct.MatrixNode**, %struct.MatrixNode*** %13
%25 = call i32 @read(i32* %22, %struct.MatrixNode** %23, %struct.MatrixNode** %24, i32* %14, i32* %15)
%26 = load i32*, i32** %6
%27 = call i32 @fclose(i32* %26)
%28 = load i32*, i32** %7
%29 = call i32 @fclose(i32* %28)
ret i32 0
}

LLVM IR (-O2):
%struct.MatrixNode = type { i32 }
@.str = [12 x i8] c"matrix1.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [12 x i8] c"result1.txt\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = call i32 @read(i32* %7, %struct.MatrixNode** undef, %struct.MatrixNode** undef, i32* %3, i32* %4)
%14 = call i32 @read(i32* %7, %struct.MatrixNode** undef, %struct.MatrixNode** undef, i32* %5, i32* %6)
%15 = call i32 @fclose(i32* %7)
%16 = call i32 @fclose(i32* %8)
ret i32 0
}