#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 longestIncreasingPath(int **, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char const *argv[]) {
  int **matrix = (int **)malloc(sizeof(int *) * 3);
  matrix[0] = (int *)malloc(sizeof(int) * 3);
  matrix[0][0] = 7;
  matrix[0][1] = 8;
  matrix[0][2] = 9;
  matrix[1] = (int *)malloc(sizeof(int) * 3);
  matrix[1][0] = 9;
  matrix[1][1] = 7;
  matrix[1][2] = 6;
  matrix[2] = (int *)malloc(sizeof(int) * 3);
  matrix[2][0] = 7;
  matrix[2][1] = 2;
  matrix[2][2] = 3;
  printf("%d\n", longestIncreasingPath(matrix, 3, 3));
  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    $0x18,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0x7,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0x8,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0x9,0x8(%rax)
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x9,(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x7,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x6,0x8(%rax)
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x7,(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x2,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x3,0x8(%rax)
mov    -0x18(%rbp),%rdi
mov    $0x3,%edx
mov    %edx,%esi
call   1050 <longestIncreasingPath@plt>
mov    %eax,%esi
lea    0xdd4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x18,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,(%rbx)
movabs $0x800000007,%rcx
mov    %rcx,(%rax)
movl   $0x9,0x8(%rax)
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,0x8(%rbx)
movabs $0x700000009,%rcx
mov    %rcx,(%rax)
movl   $0x6,0x8(%rax)
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,0x10(%rbx)
movabs $0x200000007,%rcx
mov    %rcx,(%rax)
movl   $0x3,0x8(%rax)
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1050 <longestIncreasingPath@plt>
lea    0xe44(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @malloc(i32 24)
%8 = inttoptr i64 %7 to i32**
store i32** %8, i32*** %6
%9 = call i64 @malloc(i32 12)
%10 = inttoptr i64 %9 to i32*
%11 = load i32**, i32*** %6
%12 = getelementptr inbounds i32*, i32** %11, i64 0
store i32* %10, i32** %12
%13 = load i32**, i32*** %6
%14 = getelementptr inbounds i32*, i32** %13, i64 0
%15 = load i32*, i32** %14
%16 = getelementptr inbounds i32, i32* %15, i64 0
store i32 7, i32* %16
%17 = load i32**, i32*** %6
%18 = getelementptr inbounds i32*, i32** %17, i64 0
%19 = load i32*, i32** %18
%20 = getelementptr inbounds i32, i32* %19, i64 1
store i32 8, i32* %20
%21 = load i32**, i32*** %6
%22 = getelementptr inbounds i32*, i32** %21, i64 0
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i64 2
store i32 9, i32* %24
%25 = call i64 @malloc(i32 12)
%26 = inttoptr i64 %25 to i32*
%27 = load i32**, i32*** %6
%28 = getelementptr inbounds i32*, i32** %27, i64 1
store i32* %26, i32** %28
%29 = load i32**, i32*** %6
%30 = getelementptr inbounds i32*, i32** %29, i64 1
%31 = load i32*, i32** %30
%32 = getelementptr inbounds i32, i32* %31, i64 0
store i32 9, i32* %32
%33 = load i32**, i32*** %6
%34 = getelementptr inbounds i32*, i32** %33, i64 1
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 1
store i32 7, i32* %36
%37 = load i32**, i32*** %6
%38 = getelementptr inbounds i32*, i32** %37, i64 1
%39 = load i32*, i32** %38
%40 = getelementptr inbounds i32, i32* %39, i64 2
store i32 6, i32* %40
%41 = call i64 @malloc(i32 12)
%42 = inttoptr i64 %41 to i32*
%43 = load i32**, i32*** %6
%44 = getelementptr inbounds i32*, i32** %43, i64 2
store i32* %42, i32** %44
%45 = load i32**, i32*** %6
%46 = getelementptr inbounds i32*, i32** %45, i64 2
%47 = load i32*, i32** %46
%48 = getelementptr inbounds i32, i32* %47, i64 0
store i32 7, i32* %48
%49 = load i32**, i32*** %6
%50 = getelementptr inbounds i32*, i32** %49, i64 2
%51 = load i32*, i32** %50
%52 = getelementptr inbounds i32, i32* %51, i64 1
store i32 2, i32* %52
%53 = load i32**, i32*** %6
%54 = getelementptr inbounds i32*, i32** %53, i64 2
%55 = load i32*, i32** %54
%56 = getelementptr inbounds i32, i32* %55, i64 2
store i32 3, i32* %56
%57 = load i32**, i32*** %6
%58 = call i32 @longestIncreasingPath(i32** %57, i32 3, i32 3)
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %58)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 24)
%4 = inttoptr i64 %3 to i32**
%5 = tail call i64 @malloc(i32 12)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %4
store i32 7, i32* %6
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 8, i32* %7
%8 = getelementptr inbounds i32, i32* %6, i64 2
store i32 9, i32* %8
%9 = tail call i64 @malloc(i32 12)
%10 = inttoptr i64 %9 to i32*
%11 = getelementptr inbounds i32*, i32** %4, i64 1
store i32* %10, i32** %11
store i32 9, i32* %10
%12 = getelementptr inbounds i32, i32* %10, i64 1
store i32 7, i32* %12
%13 = getelementptr inbounds i32, i32* %10, i64 2
store i32 6, i32* %13
%14 = tail call i64 @malloc(i32 12)
%15 = inttoptr i64 %14 to i32*
%16 = getelementptr inbounds i32*, i32** %4, i64 2
store i32* %15, i32** %16
store i32 7, i32* %15
%17 = getelementptr inbounds i32, i32* %15, i64 1
store i32 2, i32* %17
%18 = getelementptr inbounds i32, i32* %15, i64 2
store i32 3, i32* %18
%19 = tail call i32 @longestIncreasingPath(i32** %4, i32 3, i32 3)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
ret i32 0
}