int FromLT(int rsize, double *ltm, double *ltv, int *bin, int *corner) {
  extern int status;
  double dbinx, dbiny, dxcorner, dycorner;
  dbinx = (double)rsize / ltm[0];
  dbiny = (double)rsize / ltm[1];
  dxcorner = (dbinx - rsize) - dbinx * ltv[0];
  dycorner = (dbiny - rsize) - dbiny * ltv[1];
  corner[0] =
      ((dxcorner >= 0.) ? (int)(dxcorner + 0.5) : (int)(dxcorner - 0.5));
  corner[1] =
      ((dycorner >= 0.) ? (int)(dycorner + 0.5) : (int)(dycorner - 0.5));
  bin[0] = ((dbinx >= 0.) ? (int)(dbinx + 0.5) : (int)(dbinx - 0.5));
  bin[1] = ((dbiny >= 0.) ? (int)(dbiny + 0.5) : (int)(dbiny - 0.5));
  return (status);
}


x86 assembly (clang, -O0):
<FromLT>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11e6 <FromLT+0xe6>
movsd  0xe2b(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4c(%rbp)
jmp    11fe <FromLT+0xfe>
movsd  -0x40(%rbp),%xmm0
movsd  0xe0d(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1232 <FromLT+0x132>
movsd  0xddf(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x50(%rbp)
jmp    124a <FromLT+0x14a>
movsd  -0x48(%rbp),%xmm0
movsd  0xdc1(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x4(%rax)
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     127f <FromLT+0x17f>
movsd  0xd92(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
jmp    1297 <FromLT+0x197>
movsd  -0x30(%rbp),%xmm0
movsd  0xd74(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12cb <FromLT+0x1cb>
movsd  0xd46(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x58(%rbp)
jmp    12e3 <FromLT+0x1e3>
movsd  -0x38(%rbp),%xmm0
movsd  0xd28(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    0x2cf4(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FromLT>:
cvtsi2sd %edi,%xmm1
movupd (%rsi),%xmm2
unpcklpd %xmm1,%xmm1
movapd %xmm1,%xmm0
divpd  %xmm2,%xmm0
movapd %xmm0,%xmm3
subpd  %xmm1,%xmm3
movupd (%rdx),%xmm1
mulpd  %xmm0,%xmm1
subpd  %xmm1,%xmm3
xorpd  %xmm4,%xmm4
xorpd  %xmm1,%xmm1
cmpnlepd %xmm3,%xmm1
movmskpd %xmm1,%eax
movsd  0xebf(%rip),%xmm1
movsd  0xebf(%rip),%xmm2
movapd %xmm1,%xmm5
test   $0x1,%al
jne    1155 <FromLT+0x55>
movapd %xmm2,%xmm5
addsd  %xmm3,%xmm5
cvttsd2si %xmm5,%edx
mov    %edx,(%r8)
movapd %xmm1,%xmm5
test   $0x2,%al
jne    116c <FromLT+0x6c>
movapd %xmm2,%xmm5
unpckhpd %xmm3,%xmm3
addsd  %xmm5,%xmm3
cvttsd2si %xmm3,%eax
mov    %eax,0x4(%r8)
cmpnlepd %xmm0,%xmm4
movmskpd %xmm4,%eax
movapd %xmm1,%xmm3
test   $0x1,%al
jne    1191 <FromLT+0x91>
movapd %xmm2,%xmm3
addsd  %xmm0,%xmm3
cvttsd2si %xmm3,%edx
mov    %edx,(%rcx)
test   $0x2,%al
jne    11a3 <FromLT+0xa3>
movapd %xmm2,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,0x4(%rcx)
mov    0x2e2f(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@status = external global i32
define i32 @FromLT(i32 %0, double* %1, double* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store i32 %0, i32* %6
store double* %1, double** %7
store double* %2, double** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%15 = load i32, i32* %6
%16 = sitofp i32 %15 to double
%17 = load double*, double** %7
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
%20 = fdiv double %16, %19
store double %20, double* %11
%21 = load i32, i32* %6
%22 = sitofp i32 %21 to double
%23 = load double*, double** %7
%24 = getelementptr inbounds double, double* %23, i64 1
%25 = load double, double* %24
%26 = fdiv double %22, %25
store double %26, double* %12
%27 = load double, double* %11
%28 = load i32, i32* %6
%29 = sitofp i32 %28 to double
%30 = fsub double %27, %29
%31 = load double, double* %11
%32 = load double*, double** %8
%33 = getelementptr inbounds double, double* %32, i64 0
%34 = load double, double* %33
%35 = fneg double %31
%36 = call double @llvm.fmuladd.f64(double %35, double %34, double %30)
store double %36, double* %13
%37 = load double, double* %12
%38 = load i32, i32* %6
%39 = sitofp i32 %38 to double
%40 = fsub double %37, %39
%41 = load double, double* %12
%42 = load double*, double** %8
%43 = getelementptr inbounds double, double* %42, i64 1
%44 = load double, double* %43
%45 = fneg double %41
%46 = call double @llvm.fmuladd.f64(double %45, double %44, double %40)
store double %46, double* %14
%47 = load double, double* %13
%48 = fcmp oge double %47, 0.000000e+00
br i1 %48, label %49, label %53
49: ; preds = %5
%50 = load double, double* %13
%51 = fadd double %50, 5.000000e-01
%52 = fptosi double %51 to i32
br label %57
53: ; preds = %5
%54 = load double, double* %13
%55 = fsub double %54, 5.000000e-01
%56 = fptosi double %55 to i32
br label %57
57: ; preds = %53, %49
%58 = phi i32 [ %52, %49 ], [ %56, %53 ]
%59 = load i32*, i32** %10
%60 = getelementptr inbounds i32, i32* %59, i64 0
store i32 %58, i32* %60
%61 = load double, double* %14
%62 = fcmp oge double %61, 0.000000e+00
br i1 %62, label %63, label %67
63: ; preds = %57
%64 = load double, double* %14
%65 = fadd double %64, 5.000000e-01
%66 = fptosi double %65 to i32
br label %71
67: ; preds = %57
%68 = load double, double* %14
%69 = fsub double %68, 5.000000e-01
%70 = fptosi double %69 to i32
br label %71
71: ; preds = %67, %63
%72 = phi i32 [ %66, %63 ], [ %70, %67 ]
%73 = load i32*, i32** %10
%74 = getelementptr inbounds i32, i32* %73, i64 1
store i32 %72, i32* %74
%75 = load double, double* %11
%76 = fcmp oge double %75, 0.000000e+00
br i1 %76, label %77, label %81
77: ; preds = %71
%78 = load double, double* %11
%79 = fadd double %78, 5.000000e-01
%80 = fptosi double %79 to i32
br label %85
81: ; preds = %71
%82 = load double, double* %11
%83 = fsub double %82, 5.000000e-01
%84 = fptosi double %83 to i32
br label %85
85: ; preds = %81, %77
%86 = phi i32 [ %80, %77 ], [ %84, %81 ]
%87 = load i32*, i32** %9
%88 = getelementptr inbounds i32, i32* %87, i64 0
store i32 %86, i32* %88
%89 = load double, double* %12
%90 = fcmp oge double %89, 0.000000e+00
br i1 %90, label %91, label %95
91: ; preds = %85
%92 = load double, double* %12
%93 = fadd double %92, 5.000000e-01
%94 = fptosi double %93 to i32
br label %99
95: ; preds = %85
%96 = load double, double* %12
%97 = fsub double %96, 5.000000e-01
%98 = fptosi double %97 to i32
br label %99
99: ; preds = %95, %91
%100 = phi i32 [ %94, %91 ], [ %98, %95 ]
%101 = load i32*, i32** %9
%102 = getelementptr inbounds i32, i32* %101, i64 1
store i32 %100, i32* %102
%103 = load i32, i32* @status
ret i32 %103
}

LLVM IR (-O2):
@status = external global i32
define i32 @FromLT(i32 %0, double* nocapture %1, double* nocapture %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = sitofp i32 %0 to double
%7 = bitcast double* %1 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
%9 = insertelement <2 x double> poison, double %6, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fdiv <2 x double> %10, %8
%12 = fsub <2 x double> %11, %10
%13 = bitcast double* %2 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = fneg <2 x double> %11
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %14, <2 x double> %12)
%17 = fcmp ult <2 x double> %16, zeroinitializer
%18 = extractelement <2 x i1> %17, i64 0
%19 = select i1 %18, double -5.000000e-01, double 5.000000e-01
%20 = extractelement <2 x double> %16, i64 0
%21 = fadd double %20, %19
%22 = fptosi double %21 to i32
store i32 %22, i32* %4
%23 = extractelement <2 x i1> %17, i64 1
%24 = select i1 %23, double -5.000000e-01, double 5.000000e-01
%25 = extractelement <2 x double> %16, i64 1
%26 = fadd double %25, %24
%27 = fptosi double %26 to i32
%28 = getelementptr inbounds i32, i32* %4, i64 1
store i32 %27, i32* %28
%29 = fcmp ult <2 x double> %11, zeroinitializer
%30 = extractelement <2 x i1> %29, i64 0
%31 = select i1 %30, double -5.000000e-01, double 5.000000e-01
%32 = extractelement <2 x double> %11, i64 0
%33 = fadd double %32, %31
%34 = fptosi double %33 to i32
store i32 %34, i32* %3
%35 = extractelement <2 x i1> %29, i64 1
%36 = select i1 %35, double -5.000000e-01, double 5.000000e-01
%37 = extractelement <2 x double> %11, i64 1
%38 = fadd double %37, %36
%39 = fptosi double %38 to i32
%40 = getelementptr inbounds i32, i32* %3, i64 1
store i32 %39, i32* %40
%41 = load i32, i32* @status
ret i32 %41
}