#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 PrintMatrix(int **matr, int size, char str[]) {
  printf("\n");
  for (int i = 0; i < 3 * size + 1; i++) {
    printf("*");
  }
  printf("%s", str);
  for (int i = 0; i < 3 * size; i++) {
    printf("*");
  }
  printf("\n");
  for (int i = 0; i <= size; i++) {
    for (int j = 0; j <= size; j++) {
      printf("%5d ", matr[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<PrintMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
imul   $0x3,-0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1166 <PrintMatrix+0x56>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1138 <PrintMatrix+0x28>
mov    -0x18(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
imul   $0x3,-0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    11aa <PrintMatrix+0x9a>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117f <PrintMatrix+0x6f>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1229 <PrintMatrix+0x119>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     120d <PrintMatrix+0xfd>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d2 <PrintMatrix+0xc2>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bf <PrintMatrix+0xaf>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %esi,%r12d
mov    %rdi,%r14
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r12d,%r12d
js     1206 <PrintMatrix+0xe6>
lea    (%r12,%r12,2),%ebx
xor    %ebp,%ebp
test   %ebx,%ebx
cmovg  %ebx,%ebp
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1160 <PrintMatrix+0x40>
lea    0xe8a(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12d,%r12d
jle    119f <PrintMatrix+0x7f>
cmp    $0x2,%ebx
mov    $0x1,%ebp
cmovge %ebx,%ebp
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <PrintMatrix+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r12d,%r12d
js     11fd <PrintMatrix+0xdd>
add    $0x1,%r12d
lea    0xe4a(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rax
mov    (%rax,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11d0 <PrintMatrix+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r12,%rbx
jne    11c0 <PrintMatrix+0xa0>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdf3(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [5 x i8] c"%5d \00"
define void @PrintMatrix(i32** nocapture %0, i32 %1, i8* %2) {
%4 = tail call i32 @putchar(i32 10)
%5 = mul i32 %1, 3
%6 = icmp slt i32 %1, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%9 = tail call i32 @putchar(i32 10)
br label %35
10: ; preds = %3
%11 = call i32 @llvm.smax.i32(i32 %5, i32 0)
br label %17
12: ; preds = %17
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%14 = icmp sgt i32 %1, 0
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %27
17: ; preds = %10, %17
%18 = phi i32 [ %20, %17 ], [ 0, %10 ]
%19 = tail call i32 @putchar(i32 42)
%20 = add nuw i32 %18, 1
%21 = icmp eq i32 %18, %11
br i1 %21, label %12, label %17
22: ; preds = %27, %12
%23 = tail call i32 @putchar(i32 10)
br i1 %6, label %35, label %24
24: ; preds = %22
%25 = add nuw i32 %1, 1
%26 = zext i32 %25 to i64
br label %32
27: ; preds = %15, %27
%28 = phi i32 [ %30, %27 ], [ 0, %15 ]
%29 = tail call i32 @putchar(i32 42)
%30 = add nuw nsw i32 %28, 1
%31 = icmp eq i32 %30, %16
br i1 %31, label %22, label %27
32: ; preds = %36, %24
%33 = phi i64 [ 0, %24 ], [ %38, %36 ]
%34 = getelementptr inbounds i32*, i32** %0, i64 %33
br label %40
35: ; preds = %36, %7, %22
ret void
36: ; preds = %40
%37 = tail call i32 @putchar(i32 10)
%38 = add nuw nsw i64 %33, 1
%39 = icmp eq i64 %38, %26
br i1 %39, label %35, label %32
40: ; preds = %32, %40
%41 = phi i64 [ 0, %32 ], [ %46, %40 ]
%42 = load i32*, i32** %34
%43 = getelementptr inbounds i32, i32* %42, i64 %41
%44 = load i32, i32* %43
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %44)
%46 = add nuw nsw i64 %41, 1
%47 = icmp eq i64 %46, %26
br i1 %47, label %36, label %40
}