#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*/ exit(int);
double expo(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int /*<<< orphan*/ stderr;
main() {
  double x, y;
  printf("Introduzca un numero en punto flotante\n");
  if (scanf("%lf", &x) != 1) {
    fprintf(stderr, "No se ha leido correctamente el numero\n");
    exit(-1);
  }
  y = expo(x);
  if (y == -1) {
    fprintf(stderr, "Se ha producido overflow o underflow\n");
    exit(-1);
  }
  printf("10^%.6g = %.15g\n", x, y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     119e <main+0x4e>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
movsd  -0x8(%rbp),%xmm0
call   1060 <expo@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe46(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11e9 <main+0x99>
jp     11e9 <main+0x99>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xe88(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
lea    0xe94(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    11b2 <main+0x52>
movsd  (%rsp),%xmm0
call   1070 <expo@plt>
ucomisd 0xe6d(%rip),%xmm0
jne    1197 <main+0x37>
jnp    11c4 <main+0x64>
movapd %xmm0,%xmm1
movsd  (%rsp),%xmm0
lea    0xeb3(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
lea    0xe4a(%rip),%rsi
jmp    11d4 <main+0x74>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Introduzca un numero en punto flotante\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@stderr = global i32 0
@.str.2 = [40 x i8] c"No se ha leido correctamente el numero\0A\00"
@.str.3 = [38 x i8] c"Se ha producido overflow o underflow\0A\00"
@.str.4 = [17 x i8] c"10^%.6g = %.15g\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @exit(i32 -1)
unreachable
10: ; preds = %0
%11 = load double, double* %1
%12 = call double @expo(double %11)
store double %12, double* %2
%13 = load double, double* %2
%14 = fcmp oeq double %13, -1.000000e+00
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %10
%20 = load double, double* %1
%21 = load double, double* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %20, double %21)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@stderr = global i32 0
@.str.2 = [40 x i8] c"No se ha leido correctamente el numero\0A\00"
@.str.3 = [38 x i8] c"Se ha producido overflow o underflow\0A\00"
@.str.4 = [17 x i8] c"10^%.6g = %.15g\0A\00"
@str = [39 x i8] c"Introduzca un numero en punto flotante\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @exit(i32 -1)
unreachable
10: ; preds = %0
%11 = load double, double* %1
%12 = call double @expo(double %11)
%13 = fcmp oeq double %12, -1.000000e+00
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %10
%19 = load double, double* %1
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %19, double %12)
ret i32 0
}