#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 */
double frexp(double, int *);
double ldexp(double, int);
double modf(double, double *);
int /*<<< orphan*/ print_f(double);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  double i, j;
  int p;
  printf("\nmodf :");
  j = modf(100.123, &i);
  print_f(i);
  print_f(j);
  j = modf(100.00, &i);
  print_f(i);
  print_f(j);
  j = modf(0.123, &i);
  print_f(i);
  print_f(j);
  printf("\nfrexp :");
  j = frexp(100.123, &p);
  printf("%d  ", p);
  print_f(j);
  print_f(ldexp(j, p));
  j = frexp(100.00, &p);
  printf("%d  ", p);
  print_f(j);
  print_f(ldexp(j, p));
  j = frexp(0.123, &p);
  printf("%d  ", p);
  print_f(j);
  print_f(ldexp(j, p));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  0xe9b(%rip),%xmm0
lea    -0x10(%rbp),%rdi
call   1050 <modf@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1070 <print_f@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <print_f@plt>
movsd  0xe69(%rip),%xmm0
lea    -0x10(%rbp),%rdi
call   1050 <modf@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1070 <print_f@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <print_f@plt>
movsd  0xe37(%rip),%xmm0
lea    -0x10(%rbp),%rdi
call   1050 <modf@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1070 <print_f@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <print_f@plt>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  0xe0f(%rip),%xmm0
lea    -0x1c(%rbp),%rdi
call   1060 <frexp@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <print_f@plt>
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1030 <ldexp@plt>
call   1070 <print_f@plt>
movsd  0xdc4(%rip),%xmm0
lea    -0x1c(%rbp),%rdi
call   1060 <frexp@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <print_f@plt>
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1030 <ldexp@plt>
call   1070 <print_f@plt>
movsd  0xd79(%rip),%xmm0
lea    -0x1c(%rbp),%rdi
call   1060 <frexp@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <print_f@plt>
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1030 <ldexp@plt>
call   1070 <print_f@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0xe92(%rip),%xmm0
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <modf@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1070 <print_f@plt>
movsd  0x8(%rsp),%xmm0
call   1070 <print_f@plt>
movsd  0xe69(%rip),%xmm0
mov    %rbx,%rdi
call   1050 <modf@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1070 <print_f@plt>
movsd  0x8(%rsp),%xmm0
call   1070 <print_f@plt>
movsd  0xe45(%rip),%xmm0
mov    %rbx,%rdi
call   1050 <modf@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1070 <print_f@plt>
movsd  0x8(%rsp),%xmm0
call   1070 <print_f@plt>
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%r14
movsd  0xdf6(%rip),%xmm0
mov    %r14,%rdi
call   1060 <frexp@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x14(%rsp),%ebp
lea    0xe06(%rip),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1070 <print_f@plt>
movsd  0x8(%rsp),%xmm0
mov    %ebp,%edi
call   1030 <ldexp@plt>
call   1070 <print_f@plt>
movsd  0xdb4(%rip),%xmm0
mov    %r14,%rdi
call   1060 <frexp@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x14(%rsp),%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1070 <print_f@plt>
movsd  0x8(%rsp),%xmm0
mov    %ebp,%edi
call   1030 <ldexp@plt>
call   1070 <print_f@plt>
movsd  0xd79(%rip),%xmm0
mov    %r14,%rdi
call   1060 <frexp@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x14(%rsp),%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1070 <print_f@plt>
movsd  0x8(%rsp),%xmm0
mov    %ebp,%edi
call   1030 <ldexp@plt>
call   1070 <print_f@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\0Amodf :\00"
@.str.1 = [9 x i8] c"\0Afrexp :\00"
@.str.2 = [5 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = call double @modf(double 1.001230e+02, double* %2)
store double %6, double* %3
%7 = load double, double* %2
%8 = call i32 @print_f(double %7)
%9 = load double, double* %3
%10 = call i32 @print_f(double %9)
%11 = call double @modf(double 1.000000e+02, double* %2)
store double %11, double* %3
%12 = load double, double* %2
%13 = call i32 @print_f(double %12)
%14 = load double, double* %3
%15 = call i32 @print_f(double %14)
%16 = call double @modf(double 1.230000e-01, double* %2)
store double %16, double* %3
%17 = load double, double* %2
%18 = call i32 @print_f(double %17)
%19 = load double, double* %3
%20 = call i32 @print_f(double %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%22 = call double @frexp(double 1.001230e+02, i32* %4)
store double %22, double* %3
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load double, double* %3
%26 = call i32 @print_f(double %25)
%27 = load double, double* %3
%28 = load i32, i32* %4
%29 = call double @ldexp(double %27, i32 %28)
%30 = call i32 @print_f(double %29)
%31 = call double @frexp(double 1.000000e+02, i32* %4)
store double %31, double* %3
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = load double, double* %3
%35 = call i32 @print_f(double %34)
%36 = load double, double* %3
%37 = load i32, i32* %4
%38 = call double @ldexp(double %36, i32 %37)
%39 = call i32 @print_f(double %38)
%40 = call double @frexp(double 1.230000e-01, i32* %4)
store double %40, double* %3
%41 = load i32, i32* %4
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %41)
%43 = load double, double* %3
%44 = call i32 @print_f(double %43)
%45 = load double, double* %3
%46 = load i32, i32* %4
%47 = call double @ldexp(double %45, i32 %46)
%48 = call i32 @print_f(double %47)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"\0Amodf :\00"
@.str.1 = [9 x i8] c"\0Afrexp :\00"
@.str.2 = [5 x i8] c"%d \00"
define i32 @main() {
%1 = alloca double
%2 = alloca i32
%3 = bitcast double* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = call double @modf(double 1.001230e+02, double* %1)
%7 = load double, double* %1
%8 = tail call i32 @print_f(double %7)
%9 = tail call i32 @print_f(double %6)
%10 = call double @modf(double 1.000000e+02, double* %1)
%11 = load double, double* %1
%12 = tail call i32 @print_f(double %11)
%13 = tail call i32 @print_f(double %10)
%14 = call double @modf(double 1.230000e-01, double* %1)
%15 = load double, double* %1
%16 = tail call i32 @print_f(double %15)
%17 = tail call i32 @print_f(double %14)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%19 = call double @frexp(double 1.001230e+02, i32* %2)
%20 = load i32, i32* %2
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = tail call i32 @print_f(double %19)
%23 = tail call double @ldexp(double %19, i32 %20)
%24 = tail call i32 @print_f(double %23)
%25 = call double @frexp(double 1.000000e+02, i32* %2)
%26 = load i32, i32* %2
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = tail call i32 @print_f(double %25)
%29 = tail call double @ldexp(double %25, i32 %26)
%30 = tail call i32 @print_f(double %29)
%31 = call double @frexp(double 1.230000e-01, i32* %2)
%32 = load i32, i32* %2
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = tail call i32 @print_f(double %31)
%35 = tail call double @ldexp(double %31, i32 %32)
%36 = tail call i32 @print_f(double %35)
ret i32 0
}