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


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

x86 assembly (clang, -O2):
<Idexp>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
mov    0x4(%rsp),%edi
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    0x4(%rsp),%esi
lea    0xe7e(%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 = [11 x i8] c"Enter pow:\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [16 x i8] c"%f * 2^%d = %f\0A\00"
define double @Idexp(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 ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%10 = load double, double* %3
%11 = load i32, i32* %5
%12 = call double @ldexp(double %10, i32 %11)
store double %12, double* %4
%13 = load double, double* %3
%14 = load i32, i32* %5
%15 = load double, double* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %13, i32 %14, double %15)
%17 = load double, double* %4
ret double %17
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [11 x i8] c"Enter pow:\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [16 x i8] c"%f * 2^%d = %f\0A\00"
define double @Idexp(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 ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%10 = load double, double* %3
%11 = load i32, i32* %4
%12 = call double @ldexp(double %10, i32 %11)
%13 = load double, double* %3
%14 = load i32, i32* %4
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %13, i32 %14, double %12)
ret double %12
}