#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 */
char *gettext(char *);
double ldexp(double, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
double Idexp(double x, double ret) {
  int n;
  printf(gettext("Enter a number: "));
  scanf("%lf", &x);
  printf(gettext("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    0xea7(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe94(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <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    0xe5b(%rip),%rdi
mov    $0x2,%al
call   1050 <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    0xeaf(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe9b(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <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    0xe5e(%rip),%rdi
mov    $0x2,%al
call   1050 <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 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 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%9 = call i8* @gettext(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* %9)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%12 = load double, double* %3
%13 = load i32, i32* %5
%14 = call double @ldexp(double %12, i32 %13)
store double %14, double* %4
%15 = load double, double* %3
%16 = load i32, i32* %5
%17 = load double, double* %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %15, i32 %16, double %17)
%19 = load double, double* %4
ret double %19
}

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 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 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%9 = call i8* @gettext(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%12 = load double, double* %3
%13 = load i32, i32* %4
%14 = call double @ldexp(double %12, i32 %13)
%15 = load double, double* %3
%16 = load i32, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %15, i32 %16, double %14)
ret double %14
}