#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_float_matrix(float *matrix, int n_lines, int n_columns,
                        bool show_index) {
  int n = 0, line_c = 0;
  while (n < n_lines * n_columns) {
    if ((n % n_columns == 0) && show_index) {
      printf("%05.d: ", line_c);
    }
    printf("%05.4f\t\t", matrix[n]);
    n += 1;
    if ((n % n_columns == 0) && (n > 0)) {
      line_c += 1;
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<print_float_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    11ce <print_float_matrix+0xbe>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1170 <print_float_matrix+0x60>
cmpl   $0x0,-0x14(%rbp)
je     1170 <print_float_matrix+0x60>
mov    -0x1c(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe80(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11c9 <print_float_matrix+0xb9>
cmpl   $0x0,-0x18(%rbp)
jle    11c9 <print_float_matrix+0xb9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1133 <print_float_matrix+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_float_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
imul   %edx,%esi
test   %esi,%esi
jle    11aa <print_float_matrix+0x8a>
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rdi,%r13
mov    %esi,%r12d
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    1155 <print_float_matrix+0x35>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %rbx,%r12
je     11aa <print_float_matrix+0x8a>
mov    %ebx,%eax
cltd
idiv   %ebp
test   %r14d,%r14d
je     1174 <print_float_matrix+0x54>
test   %edx,%edx
jne    1174 <print_float_matrix+0x54>
lea    0xe96(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x0(%r13,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe82(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
mov    %ebx,%eax
cltd
idiv   %ebp
test   %edx,%edx
jne    1150 <print_float_matrix+0x30>
add    $0x1,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <print_float_matrix+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%05.d: \00"
@.str.1 = [9 x i8] c"%05.4f\09\09\00"
define void @print_float_matrix(float* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = mul i32 %2, %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %34
7: ; preds = %4
%8 = icmp ne i32 %3, 0
%9 = zext i32 %5 to i64
br label %10
10: ; preds = %7, %31
%11 = phi i64 [ 0, %7 ], [ %24, %31 ]
%12 = phi i32 [ 0, %7 ], [ %32, %31 ]
%13 = trunc i64 %11 to i32
%14 = srem i32 %13, %2
%15 = icmp eq i32 %14, 0
%16 = and i1 %8, %15
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %19
19: ; preds = %17, %10
%20 = getelementptr inbounds float, float* %0, i64 %11
%21 = load float, float* %20
%22 = fpext float %21 to double
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %22)
%24 = add nuw nsw i64 %11, 1
%25 = trunc i64 %24 to i32
%26 = srem i32 %25, %2
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %19
%29 = add nsw i32 %12, 1
%30 = tail call i32 @putchar(i32 10)
br label %31
31: ; preds = %28, %19
%32 = phi i32 [ %29, %28 ], [ %12, %19 ]
%33 = icmp eq i64 %24, %9
br i1 %33, label %34, label %10
34: ; preds = %31, %4
ret void
}