#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 double_exponent(double);
int double_mantissa(double);
int double_sign(double);
int /*<<< orphan*/ printf(char *, int);
int main() {
  double f = -332.00231;
  printf("Double value: %f\n", f);
  printf("Sign: %d\n", double_sign(f));
  printf("Exponent: %d\n", double_exponent(f));
  printf("Mantissa: %d\n", double_mantissa(f));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xea9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%esi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
call   1050 <double_sign@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
call   1030 <double_exponent@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
call   1060 <double_mantissa@plt>
mov    %eax,%esi
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec0(%rip),%rdi
mov    $0xfffffeb4,%esi
call   1040 <printf@plt>
movsd  0xea6(%rip),%xmm0
call   1050 <double_sign@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
movsd  0xe8b(%rip),%xmm0
call   1030 <double_exponent@plt>
lea    0xea3(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
movsd  0xe70(%rip),%xmm0
call   1060 <double_mantissa@plt>
lea    0xe96(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Double value: %f\0A\00"
@.str.1 = [10 x i8] c"Sign: %d\0A\00"
@.str.2 = [14 x i8] c"Exponent: %d\0A\00"
@.str.3 = [14 x i8] c"Mantissa: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 0xC074C0097635E743, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load double, double* %2
%7 = call i32 @double_sign(double %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load double, double* %2
%10 = call i32 @double_exponent(double %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = load double, double* %2
%13 = call i32 @double_mantissa(double %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Double value: %f\0A\00"
@.str.1 = [10 x i8] c"Sign: %d\0A\00"
@.str.2 = [14 x i8] c"Exponent: %d\0A\00"
@.str.3 = [14 x i8] c"Mantissa: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 -332)
%2 = tail call i32 @double_sign(double 0xC074C0097635E743)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = tail call i32 @double_exponent(double 0xC074C0097635E743)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = tail call i32 @double_mantissa(double 0xC074C0097635E743)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %6)
ret i32 0
}