#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 **createMatrix(int, int);
int /*<<< orphan*/ drawAbsoluteDirections(int **, int, int);
int getNeighboorsMatrix(int **, int, int);
int /*<<< orphan*/ printMatrix(int **, int, int);
void drawArrows(int(**matrix), int row, int col) {
  int r = row - 2;
  int c = col - 2;
  int i, j;
  int **mat = createMatrix(r, c);
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      mat[i][j] = getNeighboorsMatrix(matrix, i, j);
    }
  }
  printMatrix(mat, r, c);
  drawAbsoluteDirections(mat, r, c);
}


x86 assembly (clang, -O0):
<drawArrows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <createMatrix@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11de <drawArrows+0x9e>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11cb <drawArrows+0x8b>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <getNeighboorsMatrix@plt>
mov    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    118d <drawArrows+0x4d>
jmp    11d0 <drawArrows+0x90>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117a <drawArrows+0x3a>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <printMatrix@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1060 <drawAbsoluteDirections@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawArrows>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,%r13
lea    -0x2(%rbp),%edi
mov    %rdx,0x10(%rsp)
lea    -0x2(%rdx),%esi
mov    %edi,0xc(%rsp)
mov    %esi,0x8(%rsp)
call   1050 <createMatrix@plt>
mov    %rax,%rbx
cmp    $0x3,%ebp
jl     11d0 <drawArrows+0x90>
mov    0xc(%rsp),%r15d
mov    0x8(%rsp),%r12d
xor    %ebp,%ebp
jmp    1199 <drawArrows+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %r15,%rbp
je     11d0 <drawArrows+0x90>
cmpl   $0x3,0x10(%rsp)
jl     1190 <drawArrows+0x50>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <getNeighboorsMatrix@plt>
mov    (%rbx,%rbp,8),%rcx
mov    %eax,(%rcx,%r14,4)
add    $0x1,%r14
cmp    %r14,%r12
jne    11b0 <drawArrows+0x70>
jmp    1190 <drawArrows+0x50>
mov    %rbx,%rdi
mov    0xc(%rsp),%ebp
mov    %ebp,%esi
mov    0x8(%rsp),%r14d
mov    %r14d,%edx
call   1030 <printMatrix@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <drawAbsoluteDirections@plt>

LLVM IR (-O0):
define void @drawArrows(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32**
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 2
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 2
store i32 %15, i32* %8
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = call i32** @createMatrix(i32 %16, i32 %17)
store i32** %18, i32*** %11
store i32 0, i32* %9
br label %19
19: ; preds = %45, %3
%20 = load i32, i32* %9
%21 = load i32, i32* %7
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %48
23: ; preds = %19
store i32 0, i32* %10
br label %24
24: ; preds = %41, %23
%25 = load i32, i32* %10
%26 = load i32, i32* %8
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %44
28: ; preds = %24
%29 = load i32**, i32*** %4
%30 = load i32, i32* %9
%31 = load i32, i32* %10
%32 = call i32 @getNeighboorsMatrix(i32** %29, i32 %30, i32 %31)
%33 = load i32**, i32*** %11
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32*, i32** %33, i64 %35
%37 = load i32*, i32** %36
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
store i32 %32, i32* %40
br label %41
41: ; preds = %28
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %24
44: ; preds = %24
br label %45
45: ; preds = %44
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
store i32 %47, i32* %9
br label %19
48: ; preds = %19
%49 = load i32**, i32*** %11
%50 = load i32, i32* %7
%51 = load i32, i32* %8
%52 = call i32 @printMatrix(i32** %49, i32 %50, i32 %51)
%53 = load i32**, i32*** %11
%54 = load i32, i32* %7
%55 = load i32, i32* %8
%56 = call i32 @drawAbsoluteDirections(i32** %53, i32 %54, i32 %55)
ret void
}

LLVM IR (-O2):
define void @drawArrows(i32** %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -2
%5 = add nsw i32 %2, -2
%6 = tail call i32** @createMatrix(i32 %4, i32 %5)
%7 = icmp sgt i32 %1, 2
br i1 %7, label %8, label %28
8: ; preds = %3
%9 = icmp sgt i32 %2, 2
%10 = zext i32 %4 to i64
%11 = zext i32 %5 to i64
br label %12
12: ; preds = %8, %25
%13 = phi i64 [ 0, %8 ], [ %26, %25 ]
br i1 %9, label %14, label %25
14: ; preds = %12
%15 = getelementptr inbounds i32*, i32** %6, i64 %13
%16 = trunc i64 %13 to i32
br label %17
17: ; preds = %14, %17
%18 = phi i64 [ 0, %14 ], [ %23, %17 ]
%19 = trunc i64 %18 to i32
%20 = tail call i32 @getNeighboorsMatrix(i32** %0, i32 %16, i32 %19)
%21 = load i32*, i32** %15
%22 = getelementptr inbounds i32, i32* %21, i64 %18
store i32 %20, i32* %22
%23 = add nuw nsw i64 %18, 1
%24 = icmp eq i64 %23, %11
br i1 %24, label %25, label %17
25: ; preds = %17, %12
%26 = add nuw nsw i64 %13, 1
%27 = icmp eq i64 %26, %10
br i1 %27, label %28, label %12
28: ; preds = %25, %3
%29 = tail call i32 @printMatrix(i32** %6, i32 %4, i32 %5)
%30 = tail call i32 @drawAbsoluteDirections(i32** %6, i32 %4, i32 %5)
ret void
}