#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*/ fib(int);
int /*<<< orphan*/ printf(char *, int, ...);
main() {
  int i;
  double d;
  printf("sizeof(double) = %d\n", sizeof(double));
  for (i = 0; i < 22; ++i) {
    d = (double)i;
    printf("%2d ~ %08x%08x\n", i, ((unsigned *)&d)[0], ((unsigned *)&d)[1]);
  }
  fib(10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x16,-0x8(%rbp)
jge    1182 <main+0x62>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x29>
mov    $0xa,%edi
call   1040 <fib@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xede(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
pxor   %xmm0,%xmm0
lea    0xedc(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movq   %xmm0,(%rsp)
movq   %xmm0,%rdx
mov    %rdx,%rcx
shr    $0x20,%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xe86(%rip),%xmm0
add    $0x1,%ebp
cmp    $0x16,%ebp
jne    1150 <main+0x30>
mov    $0xa,%edi
call   1040 <fib@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"sizeof(double) = %d\0A\00"
@.str.1 = [16 x i8] c"%2d ~ %08x%08x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 8)
store i32 0, i32* %2
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 22
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
store double %10, double* %3
%11 = load i32, i32* %2
%12 = bitcast double* %3 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = bitcast double* %3 to i32*
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %14, i32 %17)
br label %19
19: ; preds = %8
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %5
22: ; preds = %5
%23 = call i32 @fib(i32 10)
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [21 x i8] c"sizeof(double) = %d\0A\00"
@.str.1 = [16 x i8] c"%2d ~ %08x%08x\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 8)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %10, %2 ]
%4 = sitofp i32 %3 to double
%5 = bitcast double %4 to i64
%6 = trunc i64 %5 to i32
%7 = lshr i64 %5, 32
%8 = trunc i64 %7 to i32
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %6, i32 %8)
%10 = add nuw nsw i32 %3, 1
%11 = icmp eq i32 %10, 22
br i1 %11, label %12, label %2
12: ; preds = %2
%13 = tail call i32 @fib(i32 10)
ret i32 0
}