#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 pm(int M, int N, float *A) {
  int i, j;
  for (i = 0; i < M; ++i) {
    printf("%d ", i + 1);
    for (j = 0; j < N; ++j) {
      printf("%2.4f, ", A[i * N + j]);
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<pm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ae <pm+0x9e>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1192 <pm+0x82>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe87(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1150 <pm+0x40>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <pm+0x19>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,0xc(%rsp)
test   %edi,%edi
jle    11bf <pm+0x9f>
mov    %rdx,%rbx
movslq 0xc(%rsp),%r13
mov    %edi,%eax
mov    %rax,0x10(%rsp)
mov    %r13d,%r15d
shl    $0x2,%r13
lea    0xead(%rip),%rbp
xor    %r12d,%r12d
jmp    1174 <pm+0x54>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    %r13,%rbx
cmp    0x10(%rsp),%r12
je     11bf <pm+0x9f>
add    $0x1,%r12
lea    0xe81(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1160 <pm+0x40>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  (%rbx,%r14,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    11a0 <pm+0x80>
jmp    1160 <pm+0x40>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [8 x i8] c"%2.4f, \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @pm(i32 %0, i32 %1, float* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store float* %2, float** %6
store i32 0, i32* %7
br label %9
9: ; preds = %38, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %41
13: ; preds = %9
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
store i32 0, i32* %8
br label %17
17: ; preds = %33, %13
%18 = load i32, i32* %8
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %36
21: ; preds = %17
%22 = load float*, float** %6
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %8
%27 = add nsw i32 %25, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %22, i64 %28
%30 = load float, float* %29
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %31)
br label %33
33: ; preds = %21
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %17
36: ; preds = %17
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %9
41: ; preds = %9
%42 = 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 = [4 x i8] c"%d \00"
@.str.1 = [8 x i8] c"%2.4f, \00"
define void @pm(i32 %0, i32 %1, float* nocapture %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %29
5: ; preds = %3
%6 = icmp sgt i32 %1, 0
%7 = sext i32 %1 to i64
%8 = zext i32 %0 to i64
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %5, %26
%11 = phi i64 [ 0, %5 ], [ %12, %26 ]
%12 = add nuw nsw i64 %11, 1
%13 = trunc i64 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
br i1 %6, label %15, label %26
15: ; preds = %10
%16 = mul nsw i64 %11, %7
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %24, %17 ]
%19 = add nsw i64 %18, %16
%20 = getelementptr inbounds float, float* %2, i64 %19
%21 = load float, float* %20
%22 = fpext float %21 to double
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %22)
%24 = add nuw nsw i64 %18, 1
%25 = icmp eq i64 %24, %9
br i1 %25, label %26, label %17
26: ; preds = %17, %10
%27 = tail call i32 @putchar(i32 10)
%28 = icmp eq i64 %12, %8
br i1 %28, label %29, label %10
29: ; preds = %26, %3
%30 = tail call i32 @putchar(i32 10)
ret void
}