#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(double *p, int c, int r) {
  int i, j;
  for (i = 0; i < c; i++) {
    for (j = 0; j < r; j++, p++)
      printf("%4.2f ", *p);
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<pm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1194 <pm+0x84>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1178 <pm+0x68>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    113c <pm+0x2c>
lea    0xe88(%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    0xe6c(%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
push   %rax
test   %esi,%esi
jle    118a <pm+0x6a>
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbp
xor    %r12d,%r12d
lea    0xebe(%rip),%r13
jmp    1163 <pm+0x43>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    %r14d,%r12d
je     118a <pm+0x6a>
test   %r15d,%r15d
jle    1150 <pm+0x30>
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x8,%rbp
add    $0xffffffff,%ebx
jne    1170 <pm+0x50>
jmp    1150 <pm+0x30>
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"%4.2f \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @pm(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %29, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %32
13: ; preds = %9
store i32 0, i32* %8
br label %14
14: ; preds = %22, %13
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load double*, double** %4
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %20)
br label %22
22: ; preds = %18
%23 = load i32, i32* %8
%24 = add nsw i32 %23, 1
store i32 %24, i32* %8
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i32 1
store double* %26, double** %4
br label %14
27: ; preds = %14
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %9
32: ; preds = %9
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

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