#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 /*<<< orphan*/ printf(char *, ...);
void print_char_matrix(int c_size, int r_size, char matrix[255][255]) {
  int i, j;
  printf("\nArrows Matrix\n");
  printf("1 Up, 2 Diagonal, 4 Left\n");
  printf("3 Up-Diagonal, 5 Up-Left, 6 Diagonal-Left\n");
  printf("7 All directions\n");
  for (i = 0; i < r_size; i++) {
    for (j = 0; j < c_size; j++) {
      printf("%d ", matrix[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_char_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d2 <print_char_matrix+0xc2>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b6 <print_char_matrix+0xa6>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0xff,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1174 <print_char_matrix+0x64>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <print_char_matrix+0x51>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_char_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,0x4(%rsp)
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
lea    0xee7(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    11da <print_char_matrix+0xaa>
mov    %ebp,%r15d
mov    0x4(%rsp),%ebp
lea    0xe7a(%rip),%r12
xor    %r13d,%r13d
jmp    11aa <print_char_matrix+0x7a>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    $0xff,%rbx
cmp    %r15,%r13
je     11da <print_char_matrix+0xaa>
cmpl   $0x0,0x4(%rsp)
jle    1190 <print_char_matrix+0x60>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx,%r14,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    11c0 <print_char_matrix+0x90>
jmp    1190 <print_char_matrix+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0AArrows Matrix\0A\00"
@.str.1 = [26 x i8] c"1 Up, 2 Diagonal, 4 Left\0A\00"
@.str.2 = [43 x i8] c"3 Up-Diagonal, 5 Up-Left, 6 Diagonal-Left\0A\00"
@.str.3 = [18 x i8] c"7 All directions\0A\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @print_char_matrix(i32 %0, i32 %1, [255 x i8]* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca [255 x i8]*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store [255 x i8]* %2, [255 x i8]** %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %7
br label %13
13: ; preds = %38, %3
%14 = load i32, i32* %7
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %41
17: ; preds = %13
store i32 0, i32* %8
br label %18
18: ; preds = %33, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %36
22: ; preds = %18
%23 = load [255 x i8]*, [255 x i8]** %6
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [255 x i8], [255 x i8]* %23, i64 %25
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [255 x i8], [255 x i8]* %26, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %22
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %18
36: ; preds = %18
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %13
41: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str.4 = [4 x i8] c"%d \00"
@str = [15 x i8] c"\0AArrows Matrix\00"
@str.6 = [25 x i8] c"1 Up, 2 Diagonal, 4 Left\00"
@str.7 = [42 x i8] c"3 Up-Diagonal, 5 Up-Left, 6 Diagonal-Left\00"
@str.8 = [17 x i8] c"7 All directions\00"
define void @print_char_matrix(i32 %0, i32 %1, [255 x i8]* nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.7, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %27
9: ; preds = %3
%10 = icmp sgt i32 %0, 0
%11 = zext i32 %1 to i64
%12 = zext i32 %0 to i64
br label %13
13: ; preds = %9, %23
%14 = phi i64 [ 0, %9 ], [ %25, %23 ]
br i1 %10, label %15, label %23
15: ; preds = %13, %15
%16 = phi i64 [ %21, %15 ], [ 0, %13 ]
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %12
br i1 %22, label %23, label %15
23: ; preds = %15, %13
%24 = tail call i32 @putchar(i32 10)
%25 = add nuw nsw i64 %14, 1
%26 = icmp eq i64 %25, %11
br i1 %26, label %27, label %13
27: ; preds = %23, %3
ret void
}