#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_path_matrix(char **mat, int size, char *text) {
  int i, j;
  printf("Matrix %s\n", text);
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      if (mat[i * size + j]) {
        printf("%8s", mat[i * size + j]);
      } else {
        printf("%8s", "");
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_path_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e3 <print_path_matrix+0xd3>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c7 <print_path_matrix+0xb7>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     119f <print_path_matrix+0x8f>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <print_path_matrix+0xa4>
lea    0xe65(%rip),%rdi
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b9 <print_path_matrix+0xa9>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114f <print_path_matrix+0x3f>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <print_path_matrix+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_path_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xec9(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    11b1 <print_path_matrix+0x91>
mov    %ebp,%ebp
lea    0x0(,%rbp,8),%rax
mov    %rax,(%rsp)
lea    0xeb1(%rip),%r14
lea    0xea9(%rip),%r15
xor    %r13d,%r13d
jmp    1187 <print_path_matrix+0x67>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    (%rsp),%rbx
cmp    %rbp,%r13
je     11b1 <print_path_matrix+0x91>
xor    %r12d,%r12d
jmp    11a0 <print_path_matrix+0x80>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
je     1170 <print_path_matrix+0x50>
mov    (%rbx,%r12,8),%rsi
mov    %r14,%rdi
test   %rsi,%rsi
jne    1190 <print_path_matrix+0x70>
mov    %r15,%rsi
jmp    1190 <print_path_matrix+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Matrix %s\0A\00"
@.str.1 = [4 x i8] c"%8s\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"\0A\00"
define void @print_path_matrix(i8** %0, i32 %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %9)
store i32 0, i32* %7
br label %11
11: ; preds = %50, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %53
15: ; preds = %11
store i32 0, i32* %8
br label %16
16: ; preds = %45, %15
%17 = load i32, i32* %8
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %48
20: ; preds = %16
%21 = load i8**, i8*** %4
%22 = load i32, i32* %7
%23 = load i32, i32* %5
%24 = mul nsw i32 %22, %23
%25 = load i32, i32* %8
%26 = add nsw i32 %24, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %21, i64 %27
%29 = load i8*, i8** %28
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %42
31: ; preds = %20
%32 = load i8**, i8*** %4
%33 = load i32, i32* %7
%34 = load i32, i32* %5
%35 = mul nsw i32 %33, %34
%36 = load i32, i32* %8
%37 = add nsw i32 %35, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %32, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %40)
br label %44
42: ; preds = %20
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42, %31
br label %45
45: ; preds = %44
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %16
48: ; preds = %16
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %11
53: ; preds = %11
ret void
}

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