#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 getfitsfloatcenter();
double tli2p(double di, double tlmin, double binsiz, int type) {
  double dval = getfitsfloatcenter();
  if ((binsiz == 1.0) || (binsiz <= 0.0)) {
    switch (type) {
    case 'B':
    case 'I':
    case 'U':
    case 'J':
    case 'K':
    case 'V':
    default:
      return ((di - 1.0) + tlmin);
    case 'E':
    case 'D':
      return ((di - dval) + tlmin);
    }
  } else {
    switch (type) {
    case 'B':
    case 'I':
    case 'U':
    case 'J':
    case 'K':
    case 'V':
    default:
      return ((di - 1.0) * binsiz + tlmin);
    case 'E':
    case 'D':
      return ((di - dval) * binsiz + tlmin);
    }
  }
}


x86 assembly (clang, -O0):
<tli2p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
mov    $0x0,%al
call   1030 <getfitsfloatcenter@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xebd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1158 <tli2p+0x48>
jp     1158 <tli2p+0x48>
jmp    1166 <tli2p+0x56>
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     11f4 <tli2p+0xe4>
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x42,%eax
je     11b6 <tli2p+0xa6>
jmp    117a <tli2p+0x6a>
mov    -0x34(%rbp),%eax
add    $0xffffffbc,%eax
sub    $0x2,%eax
jb     11db <tli2p+0xcb>
jmp    118e <tli2p+0x7e>
mov    -0x34(%rbp),%eax
add    $0xffffffb7,%eax
sub    $0x3,%eax
jb     11b6 <tli2p+0xa6>
jmp    11a2 <tli2p+0x92>
mov    -0x34(%rbp),%eax
add    $0xffffffab,%eax
sub    $0x1,%eax
ja     11bb <tli2p+0xab>
jmp    11b6 <tli2p+0xa6>
jmp    11bb <tli2p+0xab>
movsd  -0x10(%rbp),%xmm0
movsd  0xe38(%rip),%xmm1
subsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1297 <tli2p+0x187>
movsd  -0x10(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1297 <tli2p+0x187>
mov    -0x24(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0x42,%eax
je     1244 <tli2p+0x134>
jmp    1208 <tli2p+0xf8>
mov    -0x38(%rbp),%eax
add    $0xffffffbc,%eax
sub    $0x2,%eax
jb     1276 <tli2p+0x166>
jmp    121c <tli2p+0x10c>
mov    -0x38(%rbp),%eax
add    $0xffffffb7,%eax
sub    $0x3,%eax
jb     1244 <tli2p+0x134>
jmp    1230 <tli2p+0x120>
mov    -0x38(%rbp),%eax
add    $0xffffffab,%eax
sub    $0x1,%eax
ja     1249 <tli2p+0x139>
jmp    1244 <tli2p+0x134>
jmp    1249 <tli2p+0x139>
movsd  -0x10(%rbp),%xmm0
movsd  0xdaa(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1297 <tli2p+0x187>
movsd  -0x10(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tli2p>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <getfitsfloatcenter@plt>
movsd  0x18(%rsp),%xmm2
and    $0xfffffffe,%ebx
ucomisd 0xebf(%rip),%xmm2
jne    1145 <tli2p+0x35>
jnp    116e <tli2p+0x5e>
xorpd  %xmm1,%xmm1
ucomisd %xmm2,%xmm1
jae    116e <tli2p+0x5e>
cmp    $0x44,%ebx
jne    1183 <tli2p+0x73>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
jmp    11ab <tli2p+0x9b>
cmp    $0x44,%ebx
jne    1197 <tli2p+0x87>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    11a5 <tli2p+0x95>
movsd  0x10(%rsp),%xmm0
addsd  0xe77(%rip),%xmm0
mulsd  %xmm2,%xmm0
jmp    11a5 <tli2p+0x95>
movsd  0x10(%rsp),%xmm0
addsd  0xe63(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @tli2p(double %0, double %1, double %2, i32 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store i32 %3, i32* %9
%11 = call double (...) @getfitsfloatcenter()
store double %11, double* %10
%12 = load double, double* %8
%13 = fcmp oeq double %12, 1.000000e+00
br i1 %13, label %17, label %14
14: ; preds = %4
%15 = load double, double* %8
%16 = fcmp ole double %15, 0.000000e+00
br i1 %16, label %17, label %31
17: ; preds = %14, %4
%18 = load i32, i32* %9
switch i32 %18, label %20 [
i32 66, label %19
i32 73, label %19
i32 85, label %19
i32 74, label %19
i32 75, label %19
i32 86, label %19
i32 69, label %25
i32 68, label %25
]
19: ; preds = %17, %17, %17, %17, %17, %17
br label %20
20: ; preds = %17, %19
%21 = load double, double* %6
%22 = fsub double %21, 1.000000e+00
%23 = load double, double* %7
%24 = fadd double %22, %23
store double %24, double* %5
br label %47
25: ; preds = %17, %17
%26 = load double, double* %6
%27 = load double, double* %10
%28 = fsub double %26, %27
%29 = load double, double* %7
%30 = fadd double %28, %29
store double %30, double* %5
br label %47
31: ; preds = %14
%32 = load i32, i32* %9
switch i32 %32, label %34 [
i32 66, label %33
i32 73, label %33
i32 85, label %33
i32 74, label %33
i32 75, label %33
i32 86, label %33
i32 69, label %40
i32 68, label %40
]
33: ; preds = %31, %31, %31, %31, %31, %31
br label %34
34: ; preds = %31, %33
%35 = load double, double* %6
%36 = fsub double %35, 1.000000e+00
%37 = load double, double* %8
%38 = load double, double* %7
%39 = call double @llvm.fmuladd.f64(double %36, double %37, double %38)
store double %39, double* %5
br label %47
40: ; preds = %31, %31
%41 = load double, double* %6
%42 = load double, double* %10
%43 = fsub double %41, %42
%44 = load double, double* %8
%45 = load double, double* %7
%46 = call double @llvm.fmuladd.f64(double %43, double %44, double %45)
store double %46, double* %5
br label %47
47: ; preds = %40, %34, %25, %20
%48 = load double, double* %5
ret double %48
}

LLVM IR (-O2):
define double @tli2p(double %0, double %1, double %2, i32 %3) {
%5 = tail call double (...) @getfitsfloatcenter()
%6 = fcmp oeq double %2, 1.000000e+00
%7 = fcmp ole double %2, 0.000000e+00
%8 = or i1 %6, %7
%9 = and i32 %3, -2
%10 = icmp eq i32 %9, 68
br i1 %8, label %11, label %18
11: ; preds = %4
br i1 %10, label %15, label %12
12: ; preds = %11
%13 = fadd double %0, -1.000000e+00
%14 = fadd double %13, %1
br label %25
15: ; preds = %11
%16 = fsub double %0, %5
%17 = fadd double %16, %1
br label %25
18: ; preds = %4
br i1 %10, label %22, label %19
19: ; preds = %18
%20 = fadd double %0, -1.000000e+00
%21 = tail call double @llvm.fmuladd.f64(double %20, double %2, double %1)
br label %25
22: ; preds = %18
%23 = fsub double %0, %5
%24 = tail call double @llvm.fmuladd.f64(double %23, double %2, double %1)
br label %25
25: ; preds = %22, %19, %15, %12
%26 = phi double [ %14, %12 ], [ %17, %15 ], [ %21, %19 ], [ %24, %22 ]
ret double %26
}