#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 *, long, double, unsigned long);
int double_test(long n, double d1, double d2, double d3, double d4) {
  unsigned long ul;
  ul = *((unsigned long *)(&d1));
  printf("%ld: %16.16e %lX\n", n, d1, ul);
  ul = *((unsigned long *)(&d2));
  printf("%ld: %16.16e %lX\n", n, d2, ul);
  ul = *((unsigned long *)(&d3));
  printf("%ld: %16.16e %lX\n", n, d3, ul);
  ul = *((unsigned long *)(&d4));
  printf("%ld: %16.16e %lX\n", n, d4, ul);
  return -1;
}


x86 assembly (clang, -O0):
<double_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rsi
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rdx
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
mov    -0x30(%rbp),%rdx
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rsi
movsd  -0x20(%rbp),%xmm0
mov    -0x30(%rbp),%rdx
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
mov    -0x30(%rbp),%rdx
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_test>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
mov    %rdi,%rbx
movq   %xmm0,%rdx
lea    0xec9(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movq   (%rsp),%xmm0
movq   %xmm0,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movq   0x8(%rsp),%xmm0
movq   %xmm0,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movq   0x10(%rsp),%xmm0
movq   %xmm0,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"%ld: %16.16e %lX\0A\00"
define i32 @double_test(i64 %0, double %1, double %2, double %3, double %4) {
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i64
store i64 %0, i64* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%12 = bitcast double* %7 to i64*
%13 = load i64, i64* %12
store i64 %13, i64* %11
%14 = load i64, i64* %6
%15 = load double, double* %7
%16 = load i64, i64* %11
%17 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %14, double %15, i64 %16)
%18 = bitcast double* %8 to i64*
%19 = load i64, i64* %18
store i64 %19, i64* %11
%20 = load i64, i64* %6
%21 = load double, double* %8
%22 = load i64, i64* %11
%23 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %20, double %21, i64 %22)
%24 = bitcast double* %9 to i64*
%25 = load i64, i64* %24
store i64 %25, i64* %11
%26 = load i64, i64* %6
%27 = load double, double* %9
%28 = load i64, i64* %11
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %26, double %27, i64 %28)
%30 = bitcast double* %10 to i64*
%31 = load i64, i64* %30
store i64 %31, i64* %11
%32 = load i64, i64* %6
%33 = load double, double* %10
%34 = load i64, i64* %11
%35 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %32, double %33, i64 %34)
ret i32 -1
}

LLVM IR (-O2):
@.str = [18 x i8] c"%ld: %16.16e %lX\0A\00"
define i32 @double_test(i64 %0, double %1, double %2, double %3, double %4) {
%6 = bitcast double %1 to i64
%7 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %0, double %1, i64 %6)
%8 = bitcast double %2 to i64
%9 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %0, double %2, i64 %8)
%10 = bitcast double %3 to i64
%11 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %0, double %3, i64 %10)
%12 = bitcast double %4 to i64
%13 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %0, double %4, i64 %12)
ret i32 -1
}