#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void printM(float *aa, int m, int n) {
  int i = 0;
  int j = 0;
  for (i = 0; i < m; ++i) {
    for (j = 0; j < n; ++j) {
      fprintf(stderr, "%lf,", aa[i * n + j]);
    }
    fprintf(stderr, "\n");
  }
}


x86 assembly (clang, -O0):
<printM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ba <printM+0xaa>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1195 <printM+0x85>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe80(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <printM+0x3a>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <printM+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printM>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0x4(%rsp)
test   %esi,%esi
jle    11b2 <printM+0xa2>
mov    %rdi,%rbx
movslq 0x4(%rsp),%rax
mov    %esi,%ecx
mov    %rcx,0x8(%rsp)
mov    %eax,%r15d
shl    $0x2,%rax
mov    %rax,0x10(%rsp)
mov    0x2e94(%rip),%r14
lea    0xead(%rip),%rbp
xor    %r13d,%r13d
jmp    1181 <printM+0x71>
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edi
lea    0xe9b(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%r13
add    0x10(%rsp),%rbx
cmp    0x8(%rsp),%r13
je     11b2 <printM+0xa2>
cmpl   $0x0,0x4(%rsp)
jle    1160 <printM+0x50>
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edi
movss  (%rbx,%r12,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
add    $0x1,%r12
cmp    %r12,%r15
jne    1190 <printM+0x80>
jmp    1160 <printM+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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