#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 atoi(char *);
int /*<<< orphan*/ free2D(double **, int, int);
int /*<<< orphan*/ init2D(double **, int, int);
double **malloc2D(int, int);
int /*<<< orphan*/ print2DFile(double **, int, int, char *);
int main(int argc, char **argv) {
  int x = atoi(argv[1]);
  int y = x;
  double **A = malloc2D(x, y);
  init2D(A, x, y);
  print2DFile(A, x, y, argv[2]);
  free2D(A, x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <malloc2D@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <init2D@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
call   1040 <print2DFile@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1060 <free2D@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %eax,%esi
call   1070 <malloc2D@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
call   1030 <init2D@plt>
mov    0x10(%r14),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
call   1040 <print2DFile@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
call   1060 <free2D@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = call double** @malloc2D(i32 %14, i32 %15)
store double** %16, double*** %8
%17 = load double**, double*** %8
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @init2D(double** %17, i32 %18, i32 %19)
%21 = load double**, double*** %8
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @print2DFile(double** %21, i32 %22, i32 %23, i8* %26)
%28 = load double**, double*** %8
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = call i32 @free2D(double** %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call double** @malloc2D(i32 %5, i32 %5)
%7 = tail call i32 @init2D(double** %6, i32 %5, i32 %5)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @print2DFile(double** %6, i32 %5, i32 %5, i8* %9)
%11 = tail call i32 @free2D(double** %6, i32 %5, i32 %5)
ret i32 0
}