#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_matrix(double matrix[20][20], unsigned int lines,
                  unsigned int columns) {
  printf("\nMatrix\n=====================\n\n");
  unsigned int i, j;
  for (i = 0; i < lines; i++) {
    for (j = 0; j < columns; j++) {
      printf("#matrix[%d][%d]: %2.2f ", i, j, matrix[i][j]);
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11ad <print_matrix+0x9d>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1191 <print_matrix+0x81>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   $0xa0,%rcx,%rcx
add    %rcx,%rax
mov    -0x18(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
lea    0xea4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <print_matrix+0x3a>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <print_matrix+0x27>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,0x4(%rsp)
mov    %esi,%ebx
mov    %rdi,%r12
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
je     11bf <print_matrix+0x8f>
mov    %ebx,%r13d
mov    0x4(%rsp),%r14d
xor    %ebp,%ebp
lea    0xe9b(%rip),%r15
jmp    118a <print_matrix+0x5a>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    $0xa0,%r12
cmp    %r13,%rbp
je     11bf <print_matrix+0x8f>
cmpl   $0x0,0x4(%rsp)
je     1170 <print_matrix+0x40>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%r12,%rbx,8),%xmm0
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    11a0 <print_matrix+0x70>
jmp    1170 <print_matrix+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"\0AMatrix\0A=====================\0A\0A\00"
@.str.1 = [24 x i8] c"#matrix[%d][%d]: %2.2f \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_matrix([20 x double]* %0, i32 %1, i32 %2) {
%4 = alloca [20 x double]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store [20 x double]* %0, [20 x double]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %10
10: ; preds = %36, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %39
14: ; preds = %10
store i32 0, i32* %8
br label %15
15: ; preds = %31, %14
%16 = load i32, i32* %8
%17 = load i32, i32* %6
%18 = icmp ult i32 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = load [20 x double]*, [20 x double]** %4
%23 = load i32, i32* %7
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds [20 x double], [20 x double]* %22, i64 %24
%26 = load i32, i32* %8
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds [20 x double], [20 x double]* %25, i64 0, i64 %27
%29 = load double, double* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %21, double %29)
br label %31
31: ; preds = %19
%32 = load i32, i32* %8
%33 = add i32 %32, 1
store i32 %33, i32* %8
br label %15
34: ; preds = %15
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34
%37 = load i32, i32* %7
%38 = add i32 %37, 1
store i32 %38, i32* %7
br label %10
39: ; preds = %10
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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