#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 aprintf(char *str, int n, long double a[n]) {
  printf("%s\n", str);
  int i;
  for (i = 0; i < n; i += 4) {
    printf("\t%10.15Lg", a[i]);
    if (i + 1 < n)
      printf("\t%10.15Lg", a[i + 1]);
    if (i + 2 < n)
      printf("\t%10.15Lg", a[i + 2]);
    if (i + 3 < n)
      printf("\t%10.15Lg", a[i + 3]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<aprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121c <aprintf+0x10c>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jge    119c <aprintf+0x8c>
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rax
shl    $0x4,%rax
fldt   0x10(%rax,%rcx,1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
cmp    -0xc(%rbp),%eax
jge    11ce <aprintf+0xbe>
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rax
shl    $0x4,%rax
fldt   0x20(%rax,%rcx,1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x3,%eax
cmp    -0xc(%rbp),%eax
jge    1200 <aprintf+0xf0>
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rax
shl    $0x4,%rax
fldt   0x30(%rax,%rcx,1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe0b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <aprintf+0x2c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aprintf>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %esi,%r14d
call   1040 <puts@plt>
test   %r14d,%r14d
jle    11e2 <aprintf+0xb2>
mov    %r14d,%r12d
add    $0x30,%rbx
mov    $0x1,%ebp
lea    0xe9d(%rip),%r15
jmp    118a <aprintf+0x5a>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x40,%rbx
add    $0x4,%rbp
lea    -0x1(%rbp),%eax
cmp    %r14d,%eax
jge    11e2 <aprintf+0xb2>
fldt   -0x30(%rbx)
fstpt  (%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r12,%rbp
jge    11af <aprintf+0x7f>
fldt   -0x20(%rbx)
fstpt  (%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1(%rbp),%rax
cmp    %r12,%rax
jge    11c8 <aprintf+0x98>
fldt   -0x10(%rbx)
fstpt  (%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x2(%rbp),%rax
cmp    %r12,%rax
jge    1170 <aprintf+0x40>
fldt   (%rbx)
fstpt  (%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1170 <aprintf+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [10 x i8] c"\09%10.15Lg\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @aprintf(i8* %0, i32 %1, x86_fp80* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca x86_fp80*
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store x86_fp80* %2, x86_fp80** %6
%8 = load i32, i32* %5
%9 = zext i32 %8 to i64
%10 = load i8*, i8** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32 0, i32* %7
br label %12
12: ; preds = %63, %3
%13 = load i32, i32* %7
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %66
16: ; preds = %12
%17 = load x86_fp80*, x86_fp80** %6
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds x86_fp80, x86_fp80* %17, i64 %19
%21 = load x86_fp80, x86_fp80* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %21)
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %5
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %35
27: ; preds = %16
%28 = load x86_fp80*, x86_fp80** %6
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds x86_fp80, x86_fp80* %28, i64 %31
%33 = load x86_fp80, x86_fp80* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %33)
br label %35
35: ; preds = %27, %16
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 2
%38 = load i32, i32* %5
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %48
40: ; preds = %35
%41 = load x86_fp80*, x86_fp80** %6
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds x86_fp80, x86_fp80* %41, i64 %44
%46 = load x86_fp80, x86_fp80* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %46)
br label %48
48: ; preds = %40, %35
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 3
%51 = load i32, i32* %5
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %61
53: ; preds = %48
%54 = load x86_fp80*, x86_fp80** %6
%55 = load i32, i32* %7
%56 = add nsw i32 %55, 3
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds x86_fp80, x86_fp80* %54, i64 %57
%59 = load x86_fp80, x86_fp80* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %59)
br label %61
61: ; preds = %53, %48
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %63
63: ; preds = %61
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 4
store i32 %65, i32* %7
br label %12
66: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"\09%10.15Lg\00"
define void @aprintf(i8* nocapture %0, i32 %1, x86_fp80* nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) %0)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %38
6: ; preds = %3
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %33
%9 = phi i64 [ 0, %6 ], [ %35, %33 ]
%10 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %9
%11 = load x86_fp80, x86_fp80* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %11)
%13 = or i64 %9, 1
%14 = icmp slt i64 %13, %7
br i1 %14, label %15, label %19
15: ; preds = %8
%16 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %13
%17 = load x86_fp80, x86_fp80* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %17)
br label %19
19: ; preds = %15, %8
%20 = or i64 %9, 2
%21 = icmp slt i64 %20, %7
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %20
%24 = load x86_fp80, x86_fp80* %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %24)
br label %26
26: ; preds = %22, %19
%27 = or i64 %9, 3
%28 = icmp slt i64 %27, %7
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %27
%31 = load x86_fp80, x86_fp80* %30
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %31)
br label %33
33: ; preds = %29, %26
%34 = tail call i32 @putchar(i32 10)
%35 = add nuw i64 %9, 4
%36 = trunc i64 %35 to i32
%37 = icmp slt i32 %36, %1
br i1 %37, label %8, label %38
38: ; preds = %33, %3
ret void
}