#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 *);
char *gettext(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
double Frexp(double x, double frac) {
  int e;
  printf(gettext("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    0xea7(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
lea    -0x14(%rbp),%rdi
call   1050 <frexp@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x14(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 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 i8* @gettext(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%9 = load double, double* %3
%10 = call double @frexp(double %9, i32* %5)
store double %10, double* %4
%11 = load double, double* %3
%12 = load double, double* %4
%13 = load i32, i32* %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %11, double %12, i32 %13)
%15 = load double, double* %4
ret double %15
}

LLVM IR (-O2):
@.str = [17 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 i8* @gettext(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%9 = load double, double* %3
%10 = call double @frexp(double %9, i32* %4)
%11 = load double, double* %3
%12 = load i32, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %11, double %10, i32 %12)
ret double %10
}