#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 **create_matrix(int, int, int);
int /*<<< orphan*/ destroy_matrix(int **);
int /*<<< orphan*/ printf(char *);
int main(int argv, char **argc) {
  int **m;
  int rows, cols, init;
  ;
  ;
  if (argv == 4) {
    rows = atoi(argc[1]);
    cols = atoi(argc[2]);
    init = atoi(argc[3]);
    ;
    ;
    ;
    ;
  } else if (argv == 1) {

    ;
    rows = 3;
    cols = 3;
    init = 3;
  } else {
    ;
    printf("wrong syntax\n");
    printf("exiting...\n");
    return -1;
  }
  m = create_matrix(rows, cols, init);
  destroy_matrix(m);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    1195 <main+0x55>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x24(%rbp)
jmp    11e2 <main+0xa2>
cmpl   $0x1,-0x8(%rbp)
jne    11b9 <main+0x79>
movl   $0x3,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
movl   $0x3,-0x24(%rbp)
jmp    11dd <main+0x9d>
lea    0xe40(%rip),%rdi
call   1050 <printf@plt>
lea    0xe42(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1204 <main+0xc4>
jmp    11e2 <main+0xa2>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1030 <create_matrix@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <destroy_matrix@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
je     1175 <main+0x35>
cmp    $0x4,%edi
jne    119b <main+0x5b>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    0x18(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edx
jmp    1185 <main+0x45>
mov    $0x3,%r14d
mov    $0x3,%ebp
mov    $0x3,%edx
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <create_matrix@plt>
mov    %rax,%rdi
call   1050 <destroy_matrix@plt>
xor    %eax,%eax
jmp    11b8 <main+0x78>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5f(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"wrong syntax\0A\00"
@.str.1 = [12 x i8] c"exiting...\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 4
br i1 %11, label %12, label %25
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %7
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %8
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 3
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %9
br label %33
25: ; preds = %2
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 3, i32* %7
store i32 3, i32* %8
store i32 3, i32* %9
br label %32
29: ; preds = %25
%30 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %40
32: ; preds = %28
br label %33
33: ; preds = %32, %12
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = call i32** @create_matrix(i32 %34, i32 %35, i32 %36)
store i32** %37, i32*** %6
%38 = load i32**, i32*** %6
%39 = call i32 @destroy_matrix(i32** %38)
store i32 0, i32* %3
br label %40
40: ; preds = %33, %29
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@str = [13 x i8] c"wrong syntax\00"
@str.2 = [11 x i8] c"exiting...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %13 [
i32 4, label %3
i32 1, label %16
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 3
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
br label %16
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.2, i64 0, i64 0))
br label %22
16: ; preds = %2, %3
%17 = phi i32 [ %6, %3 ], [ 3, %2 ]
%18 = phi i32 [ %9, %3 ], [ 3, %2 ]
%19 = phi i32 [ %12, %3 ], [ 3, %2 ]
%20 = tail call i32** @create_matrix(i32 %17, i32 %18, i32 %19)
%21 = tail call i32 @destroy_matrix(i32** %20)
br label %22
22: ; preds = %16, %13
%23 = phi i32 [ 0, %16 ], [ -1, %13 ]
ret i32 %23
}