#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 write_unblocked(double *v, int max_dim, int nrhs, int n) {
  int i, j, jj;
  for (i = 0; i < n; i++) {
    for (j = 0, jj = 0; j < nrhs; j++, jj += max_dim) {
      printf("%le ", v[jj + i]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<write_unblocked>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a5 <write_unblocked+0x95>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1189 <write_unblocked+0x79>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe95(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1146 <write_unblocked+0x36>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112c <write_unblocked+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_unblocked>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
test   %ecx,%ecx
jle    11aa <write_unblocked+0x8a>
mov    %rdi,%r12
movslq %esi,%rbx
mov    %ecx,%eax
mov    %rax,0x10(%rsp)
shl    $0x3,%rbx
xor    %r13d,%r13d
lea    0xeaf(%rip),%rbp
jmp    1179 <write_unblocked+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    $0x8,%r12
cmp    0x10(%rsp),%r13
je     11aa <write_unblocked+0x8a>
cmpl   $0x0,0xc(%rsp)
jle    1160 <write_unblocked+0x40>
mov    0xc(%rsp),%r14d
mov    %r12,%r15
nopl   0x0(%rax,%rax,1)
movsd  (%r15),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    %rbx,%r15
add    $0xffffffff,%r14d
jne    1190 <write_unblocked+0x70>
jmp    1160 <write_unblocked+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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