#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 print(double *p, int m, int n) {
  for (int i = 0; i < (((n < 10) ? n : 10)); ++i) {
    for (int j = (((m < 10) ? m : 10)); j > 0; --j) {
      printf("%e ", *p);
      ++p;
    }
    p += m - (((m < 10) ? m : 10));
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    1144 <print+0x34>
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1151 <print+0x41>
mov    $0xa,%eax
mov    %eax,-0x20(%rbp)
jmp    1151 <print+0x41>
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    121f <print+0x10f>
cmpl   $0xa,-0xc(%rbp)
jge    1174 <print+0x64>
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1181 <print+0x71>
mov    $0xa,%eax
mov    %eax,-0x24(%rbp)
jmp    1181 <print+0x71>
mov    -0x24(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    11c1 <print+0xb1>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1187 <print+0x77>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11dc <print+0xcc>
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    11e9 <print+0xd9>
mov    $0xa,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e9 <print+0xd9>
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%eax
sub    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <print+0x19>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,(%rsp)
test   %edx,%edx
jle    11bf <print+0x9f>
mov    %rdi,%rbp
mov    %edx,%eax
cmp    $0xa,%edx
mov    $0xa,%r15d
cmovae %r15d,%eax
mov    %eax,0x4(%rsp)
mov    (%rsp),%eax
cmp    $0xa,%eax
cmovl  %eax,%r15d
sub    %r15d,%eax
movslq %eax,%r13
add    $0x1,%r15d
xor    %r14d,%r14d
lea    0xe96(%rip),%rbx
jmp    118a <print+0x6a>
nopl   0x0(%rax)
lea    0x0(%rbp,%r13,8),%rbp
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
je     11bf <print+0x9f>
mov    %r15d,%r12d
cmpl   $0x0,(%rsp)
jle    1170 <print+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x0(%rbp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x8,%rbp
add    $0xffffffff,%r12d
cmp    $0x1,%r12d
jg     11a0 <print+0x80>
jmp    1170 <print+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%e \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print(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 = %53, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32, i32* %6
br label %16
15: ; preds = %9
br label %16
16: ; preds = %15, %13
%17 = phi i32 [ %14, %13 ], [ 10, %15 ]
%18 = icmp slt i32 %10, %17
br i1 %18, label %19, label %56
19: ; preds = %16
%20 = load i32, i32* %5
%21 = icmp slt i32 %20, 10
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = load i32, i32* %5
br label %25
24: ; preds = %19
br label %25
25: ; preds = %24, %22
%26 = phi i32 [ %23, %22 ], [ 10, %24 ]
store i32 %26, i32* %8
br label %27
27: ; preds = %36, %25
%28 = load i32, i32* %8
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load double*, double** %4
%32 = load double, double* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %32)
%34 = load double*, double** %4
%35 = getelementptr inbounds double, double* %34, i32 1
store double* %35, double** %4
br label %36
36: ; preds = %30
%37 = load i32, i32* %8
%38 = add nsw i32 %37, -1
store i32 %38, i32* %8
br label %27
39: ; preds = %27
%40 = load i32, i32* %5
%41 = load i32, i32* %5
%42 = icmp slt i32 %41, 10
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = load i32, i32* %5
br label %46
45: ; preds = %39
br label %46
46: ; preds = %45, %43
%47 = phi i32 [ %44, %43 ], [ 10, %45 ]
%48 = sub nsw i32 %40, %47
%49 = load double*, double** %4
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds double, double* %49, i64 %50
store double* %51, double** %4
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %53
53: ; preds = %46
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %9
56: ; preds = %16
ret void
}

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