#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 *, float);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char const *);
void printmatrix(const char *name, float *a, size_t m, size_t n) {
  size_t i;
  size_t j;
  puts(name);
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++)
      printf("%12.4f", a[i * n + j]);
    putchar('\n');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<printmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <puts@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11cb <printmatrix+0x9b>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11b0 <printmatrix+0x80>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    116f <printmatrix+0x3f>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1159 <printmatrix+0x29>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printmatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rsi,%rbx
call   1040 <puts@plt>
mov    %rbp,(%rsp)
test   %rbp,%rbp
je     11a9 <printmatrix+0x79>
lea    0x0(,%r15,4),%r13
xor    %ebp,%ebp
lea    0xe9d(%rip),%r12
jmp    1187 <printmatrix+0x57>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    %r13,%rbx
cmp    (%rsp),%rbp
je     11a9 <printmatrix+0x79>
test   %r15,%r15
je     1170 <printmatrix+0x40>
xor    %r14d,%r14d
nop
movss  (%rbx,%r14,4),%xmm0
mov    %r12,%rdi
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    1190 <printmatrix+0x60>
jmp    1170 <printmatrix+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 = [7 x i8] c"%12.4f\00"
define void @printmatrix(i8* %0, float* %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca float*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i8* %0, i8** %5
store float* %1, float** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%11 = load i8*, i8** %5
%12 = call i32 @puts(i8* %11)
store i64 0, i64* %9
br label %13
13: ; preds = %37, %4
%14 = load i64, i64* %9
%15 = load i64, i64* %7
%16 = icmp ult i64 %14, %15
br i1 %16, label %17, label %40
17: ; preds = %13
store i64 0, i64* %10
br label %18
18: ; preds = %32, %17
%19 = load i64, i64* %10
%20 = load i64, i64* %8
%21 = icmp ult i64 %19, %20
br i1 %21, label %22, label %35
22: ; preds = %18
%23 = load float*, float** %6
%24 = load i64, i64* %9
%25 = load i64, i64* %8
%26 = mul i64 %24, %25
%27 = load i64, i64* %10
%28 = add i64 %26, %27
%29 = getelementptr inbounds float, float* %23, i64 %28
%30 = load float, float* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %30)
br label %32
32: ; preds = %22
%33 = load i64, i64* %10
%34 = add i64 %33, 1
store i64 %34, i64* %10
br label %18
35: ; preds = %18
%36 = call i32 @putchar(i8 signext 10)
br label %37
37: ; preds = %35
%38 = load i64, i64* %9
%39 = add i64 %38, 1
store i64 %39, i64* %9
br label %13
40: ; preds = %13
%41 = call i32 @putchar(i8 signext 10)
ret void
}

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