#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*/ getch();
double ldexp(double, int);
double log(double);
double log10(double);
int /*<<< orphan*/ printf(char *, double, ...);
main() {
  double value, value1, value2;
  double x = 2, x1 = 8.6872, x2 = 100.00;
  int exponent = 3;
  value = ldexp(x, exponent);
  value1 = log(x1);
  value2 = log10(x2);
  printf("The ldexp value is:%lf\n", value);
  printf("The natural log of %lf is %lf\n", x1, value1);
  printf("The common log of %lf is %lf\n", x2, value2);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x3,-0x34(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x34(%rbp),%edi
call   1030 <ldexp@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1070 <log10@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe56(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xe56(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe5d(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xec7(%rip),%xmm0
mov    $0x3,%edi
call   1030 <ldexp@plt>
lea    0xed6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
movsd  0xea8(%rip),%xmm0
movsd  0xea8(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
movsd  0xe9a(%rip),%xmm0
movsd  0xe7a(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"The ldexp value is:%lf\0A\00"
@.str.1 = [31 x i8] c"The natural log of %lf is %lf\0A\00"
@.str.2 = [30 x i8] c"The common log of %lf is %lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double 2.000000e+00, double* %4
store double 8.687200e+00, double* %5
store double 1.000000e+02, double* %6
store i32 3, i32* %7
%8 = load double, double* %4
%9 = load i32, i32* %7
%10 = call double @ldexp(double %8, i32 %9)
store double %10, double* %1
%11 = load double, double* %5
%12 = call double @log(double %11)
store double %12, double* %2
%13 = load double, double* %6
%14 = call double @log10(double %13)
store double %14, double* %3
%15 = load double, double* %1
%16 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %15)
%17 = load double, double* %5
%18 = load double, double* %2
%19 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %17, double %18)
%20 = load double, double* %6
%21 = load double, double* %3
%22 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %20, double %21)
%23 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"The ldexp value is:%lf\0A\00"
@.str.1 = [31 x i8] c"The natural log of %lf is %lf\0A\00"
@.str.2 = [30 x i8] c"The common log of %lf is %lf\0A\00"
define i32 @main() {
%1 = tail call double @ldexp(double 2.000000e+00, i32 3)
%2 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %1)
%3 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double 8.687200e+00, double 0x40014B785E44089E)
%4 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double 1.000000e+02, double 2.000000e+00)
%5 = tail call i32 (...) @getch()
ret i32 0
}