#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*/ dd_to_string(double const *, char *, int, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/, int,
                                char, int *);
int /*<<< orphan*/ printf(char *, char *);
void dd_write(const double *a, int precision) {
  char s[precision + 10];
  int s_end;
  dd_to_string(a, s, precision, 0, 0, 0, 1, ' ', &s_end);
  printf("%s", s);
}


x86 assembly (clang, -O0):
<dd_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x30(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %r9d,%r9d
lea    -0x24(%rbp),%rax
sub    $0x20,%rsp
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
movl   $0x20,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <dd_to_string@plt>
mov    -0x30(%rbp),%rsi
add    $0x20,%rsp
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_write>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %esi,%edx
lea    0xa(%rdx),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
sub    $0x8,%rsp
lea    -0xc(%rbp),%rax
mov    %rbx,%rsi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   %rax
push   $0x20
push   $0x1
call   1040 <dd_to_string@plt>
add    $0x20,%rsp
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @dd_write(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 10
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca i8, i64 %10
store i64 %10, i64* %6
%13 = load double*, double** %3
%14 = load i32, i32* %4
%15 = call i32 @dd_to_string(double* %13, i8* %12, i32 %14, i32 0, i32 0, i32 0, i32 1, i8 signext 32, i32* %7)
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%17 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @dd_write(double* %0, i32 %1) {
%3 = alloca i32
%4 = add nsw i32 %1, 10
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = bitcast i32* %3 to i8*
%8 = call i32 @dd_to_string(double* %0, i8* %6, i32 %1, i32 0, i32 0, i32 0, i32 1, i8 signext 32, i32* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}