#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 *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
double Frexp(double x, double frac) {
  int e;
  printf("Enter a number:");
  scanf("%lf", &x);
  frac = frexp(x, &e);
  printf("x = %.2lf = %.2lf * 2^%d\n", x, frac, e);
  return (frac);
}


x86 assembly (clang, -O0):
<Frexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
lea    -0x14(%rbp),%rdi
call   1040 <frexp@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x14(%rbp),%esi
lea    0xe8d(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Frexp>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
lea    0xc(%rsp),%rdi
call   1040 <frexp@plt>
movaps %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
mov    0xc(%rsp),%esi
lea    0xe96(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter a number:\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [26 x i8] c"x = %.2lf = %.2lf * 2^%d\0A\00"
define double @Frexp(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %3
store double %1, double* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%8 = load double, double* %3
%9 = call double @frexp(double %8, i32* %5)
store double %9, double* %4
%10 = load double, double* %3
%11 = load double, double* %4
%12 = load i32, i32* %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %10, double %11, i32 %12)
%14 = load double, double* %4
ret double %14
}

LLVM IR (-O2):
@.str = [16 x i8] c"Enter a number:\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [26 x i8] c"x = %.2lf = %.2lf * 2^%d\0A\00"
define double @Frexp(double %0, double %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%8 = load double, double* %3
%9 = call double @frexp(double %8, i32* %4)
%10 = load double, double* %3
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %10, double %9, i32 %11)
ret double %9
}