#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 nn_debug(const char *label, float *m, int rows, int cols) {
  int i;
  printf("   %s:\n", label);
  for (i = 0; i < rows * cols; i++)
    printf("%10.5f%c", m[i], (cols > 1 && i % cols == cols - 1) ? '\n' : ' ');
  if (cols == 1)
    printf("\n");
}


x86 assembly (clang, -O0):
<nn_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x18(%rbp),%ecx
cmp    %ecx,%eax
jge    11bf <nn_debug+0xaf>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x18(%rbp)
mov    %al,-0x1d(%rbp)
jle    118b <nn_debug+0x7b>
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
cmp    %eax,%edx
sete   %al
mov    %al,-0x1d(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x1d(%rbp),%cl
mov    $0x20,%esi
mov    $0xa,%eax
test   $0x1,%cl
cmovne %eax,%esi
lea    0xe5e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <nn_debug+0x2f>
cmpl   $0x1,-0x18(%rbp)
jne    11d7 <nn_debug+0xc7>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nn_debug>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
imul   %r15d,%ebx
test   %ebx,%ebx
jle    119f <nn_debug+0x7f>
lea    -0x1(%r15),%r13d
mov    %ebx,%ebp
xor    %ebx,%ebx
lea    0xead(%rip),%r12
jmp    1177 <nn_debug+0x57>
nopl   (%rax)
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     119f <nn_debug+0x7f>
movss  (%r14,%rbx,4),%xmm0
mov    $0x20,%esi
cmp    $0x2,%r15d
jl     1160 <nn_debug+0x40>
mov    %ebx,%eax
cltd
idiv   %r15d
mov    $0xa,%esi
cmp    %r13d,%edx
je     1160 <nn_debug+0x40>
mov    $0x20,%esi
jmp    1160 <nn_debug+0x40>
cmp    $0x1,%r15d
jne    11bd <nn_debug+0x9d>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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