#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 nsl_fit_map_bound(double const, int, int);
double nsl_fit_map_unbound(double const, int, int);
int /*<<< orphan*/ printf(char *, double const, double);
int /*<<< orphan*/ puts(char *);
int main() {
  const double data[] = {-1000, -100, -10, -1, -.1, 0, .1, 1, 10, 100, 1000};
  const int n = 11;
  int i;
  for (i = 0; i < n; i++) {
    double x = nsl_fit_map_bound(data[i], -1, 2);
    printf("%g -> %g\n", data[i], x);
  }
  puts("");
  const double data2[] = {-1, -.99, -.5, 0, .49, .5, .51, 1, 1.5, 1.99, 2};
  for (i = 0; i < n; i++) {
    double xb = nsl_fit_map_unbound(data2[i], -1, 2);
    printf("%g -> %g\n", data2[i], xb);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x58,%edx
call   1060 <memcpy@plt>
movl   $0xb,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
cmpl   $0xb,-0x68(%rbp)
jge    11d6 <main+0x86>
movslq -0x68(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1070 <nsl_fit_map_bound@plt>
movsd  %xmm0,-0x70(%rbp)
movslq -0x68(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
movsd  -0x70(%rbp),%xmm1
lea    0xef5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1185 <main+0x35>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    -0xd0(%rbp),%rdi
lea    0xe70(%rip),%rsi
mov    $0x58,%edx
call   1060 <memcpy@plt>
movl   $0x0,-0x68(%rbp)
cmpl   $0xb,-0x68(%rbp)
jge    125e <main+0x10e>
movslq -0x68(%rbp),%rax
movsd  -0xd0(%rbp,%rax,8),%xmm0
ff ff
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
movslq -0x68(%rbp),%rax
movsd  -0xd0(%rbp,%rax,8),%xmm0
ff ff
movsd  -0xd8(%rbp),%xmm1
ff
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1201 <main+0xb1>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xeb7(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
lea    0xf2e(%rip),%rbx
mov    %rbx,%rdi
movsd  0xe93(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xe8e(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xe71(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xe6c(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xe4f(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xe4a(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xe2d(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xe28(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xe0b(%rip),%xmm0
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0xde6(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xdc9(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xdc4(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xda7(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xda2(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xd85(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xd80(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xd63(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xd5e(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <nsl_fit_map_bound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xd41(%rip),%xmm0
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0xcfa(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xcdd(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xd08(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xceb(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xce6(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xcc9(%rip),%xmm0
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0xca4(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xc87(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xc82(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xc65(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xc60(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xc43(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xbf6(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xbd9(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xc14(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xbf7(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xbf2(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xbd5(%rip),%xmm0
call   1040 <printf@plt>
movsd  0xbd0(%rip),%xmm0
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1050 <nsl_fit_map_unbound@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0xbb3(%rip),%xmm0
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.data = [11 x double] [double -1.000000e+03, double -1.000000e+02, double -1.000000e+01, double -1.000000e+00, double -1.000000e-01, double 0.000000e+00, double 1.000000e-01, double 1.000000e+00, double 1.000000e+01, double 1.000000e+02, double 1.000000e+03]
@.str = [10 x i8] c"%g -> %g\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@__const.main.data2 = [11 x double] [double -1.000000e+00, double 0xBFEFAE147AE147AE, double -5.000000e-01, double 0.000000e+00, double 4.900000e-01, double 5.000000e-01, double 5.100000e-01, double 1.000000e+00, double 1.500000e+00, double 1.990000e+00, double 2.000000e+00]
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x double]
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca [11 x double]
%7 = alloca double
store i32 0, i32* %1
%8 = bitcast [11 x double]* %2 to i8*
store i32 11, i32* %3
store i32 0, i32* %4
br label %9
9: ; preds = %24, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 11
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [11 x double], [11 x double]* %2, i64 0, i64 %14
%16 = load double, double* %15
%17 = call double @nsl_fit_map_bound(double %16, i32 -1, i32 2)
store double %17, double* %5
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [11 x double], [11 x double]* %2, i64 0, i64 %19
%21 = load double, double* %20
%22 = load double, double* %5
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %21, double %22)
br label %24
24: ; preds = %12
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %9
27: ; preds = %9
%28 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%29 = bitcast [11 x double]* %6 to i8*
store i32 0, i32* %4
br label %30
30: ; preds = %45, %27
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 11
br i1 %32, label %33, label %48
33: ; preds = %30
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [11 x double], [11 x double]* %6, i64 0, i64 %35
%37 = load double, double* %36
%38 = call double @nsl_fit_map_unbound(double %37, i32 -1, i32 2)
store double %38, double* %7
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [11 x double], [11 x double]* %6, i64 0, i64 %40
%42 = load double, double* %41
%43 = load double, double* %7
%44 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %42, double %43)
br label %45
45: ; preds = %33
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
store i32 %47, i32* %4
br label %30
48: ; preds = %30
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@.str = [10 x i8] c"%g -> %g\0A\00"
define i32 @main() {
%1 = tail call double @nsl_fit_map_bound(double -1.000000e+03, i32 -1, i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double -1.000000e+03, double %1)
%3 = tail call double @nsl_fit_map_bound(double -1.000000e+02, i32 -1, i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double -1.000000e+02, double %3)
%5 = tail call double @nsl_fit_map_bound(double -1.000000e+01, i32 -1, i32 2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double -1.000000e+01, double %5)
%7 = tail call double @nsl_fit_map_bound(double -1.000000e+00, i32 -1, i32 2)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double -1.000000e+00, double %7)
%9 = tail call double @nsl_fit_map_bound(double -1.000000e-01, i32 -1, i32 2)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double -1.000000e-01, double %9)
%11 = tail call double @nsl_fit_map_bound(double 0.000000e+00, i32 -1, i32 2)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 0.000000e+00, double %11)
%13 = tail call double @nsl_fit_map_bound(double 1.000000e-01, i32 -1, i32 2)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.000000e-01, double %13)
%15 = tail call double @nsl_fit_map_bound(double 1.000000e+00, i32 -1, i32 2)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.000000e+00, double %15)
%17 = tail call double @nsl_fit_map_bound(double 1.000000e+01, i32 -1, i32 2)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.000000e+01, double %17)
%19 = tail call double @nsl_fit_map_bound(double 1.000000e+02, i32 -1, i32 2)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.000000e+02, double %19)
%21 = tail call double @nsl_fit_map_bound(double 1.000000e+03, i32 -1, i32 2)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.000000e+03, double %21)
%23 = tail call i32 @putchar(i32 10)
%24 = tail call double @nsl_fit_map_unbound(double -1.000000e+00, i32 -1, i32 2)
%25 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double -1.000000e+00, double %24)
%26 = tail call double @nsl_fit_map_unbound(double 0xBFEFAE147AE147AE, i32 -1, i32 2)
%27 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 0xBFEFAE147AE147AE, double %26)
%28 = tail call double @nsl_fit_map_unbound(double -5.000000e-01, i32 -1, i32 2)
%29 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double -5.000000e-01, double %28)
%30 = tail call double @nsl_fit_map_unbound(double 0.000000e+00, i32 -1, i32 2)
%31 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 0.000000e+00, double %30)
%32 = tail call double @nsl_fit_map_unbound(double 4.900000e-01, i32 -1, i32 2)
%33 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 4.900000e-01, double %32)
%34 = tail call double @nsl_fit_map_unbound(double 5.000000e-01, i32 -1, i32 2)
%35 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 5.000000e-01, double %34)
%36 = tail call double @nsl_fit_map_unbound(double 5.100000e-01, i32 -1, i32 2)
%37 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 5.100000e-01, double %36)
%38 = tail call double @nsl_fit_map_unbound(double 1.000000e+00, i32 -1, i32 2)
%39 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.000000e+00, double %38)
%40 = tail call double @nsl_fit_map_unbound(double 1.500000e+00, i32 -1, i32 2)
%41 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.500000e+00, double %40)
%42 = tail call double @nsl_fit_map_unbound(double 1.990000e+00, i32 -1, i32 2)
%43 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 1.990000e+00, double %42)
%44 = tail call double @nsl_fit_map_unbound(double 2.000000e+00, i32 -1, i32 2)
%45 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double 2.000000e+00, double %44)
ret i32 0
}