#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 */
char *bits_of_double(double);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ print_bits_of_double(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  double d = 5432.0;
  char *bits = bits_of_double(d);
  printf("For d = %f, bits are\n", d);
  print_bits_of_double(bits);
  printf("\n");
  printf(
      "1 23456781234 5678123456781234567812345678123456781234567812345678\n");
  printf("1        2        3       4       5       6       7       8\n");
  free(bits);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xea9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <bits_of_double@plt>
mov    %rax,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe92(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <print_bits_of_double@plt>
lea    0xf10(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xe97(%rip),%xmm0
call   1060 <bits_of_double@plt>
mov    %rax,%rbx
lea    0xe90(%rip),%rdi
movsd  0xe80(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1080 <print_bits_of_double@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xe7e(%rip),%rdi
call   1050 <puts@plt>
lea    0xeb5(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"For d = %f, bits are\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [68 x i8] c"1 23456781234 5678123456781234567812345678123456781234567812345678\0A\00"
@.str.3 = [61 x i8] c"1 2 3 4 5 6 7 8\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i8*
store i32 0, i32* %1
store double 5.432000e+03, double* %2
%4 = load double, double* %2
%5 = call i8* @bits_of_double(double %4)
store i8* %5, i8** %3
%6 = load double, double* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %6)
%8 = load i8*, i8** %3
%9 = call i32 @print_bits_of_double(i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0))
%13 = load i8*, i8** %3
%14 = call i32 @free(i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"For d = %f, bits are\0A\00"
@str = [67 x i8] c"1 23456781234 5678123456781234567812345678123456781234567812345678\00"
@str.4 = [60 x i8] c"1 2 3 4 5 6 7 8\00"
define i32 @main() {
%1 = tail call i8* @bits_of_double(double 5.432000e+03)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 5.432000e+03)
%3 = tail call i32 @print_bits_of_double(i8* %1)
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.4, i64 0, i64 0))
%7 = tail call i32 @free(i8* %1)
ret i32 0
}