#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 */
scalar_t__ FLT_EPSILON;
float FLT_MAX;
int /*<<< orphan*/ assert(int);
scalar_t__ fabsf(float);
float TustinSToZ(float s, float dt) {
  float sT = s * dt;
  if (fabsf(sT - 2.0f) > FLT_EPSILON) {
    return (sT > -FLT_MAX) ? (2.0f + sT) / (2.0f - sT) : -1.0f;
  } else {
    assert(false);
    return FLT_MAX;
  }
}


x86 assembly (clang, -O0):
<TustinSToZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xeb2(%rip),%xmm1
subss  %xmm1,%xmm0
call   1030 <fabsf@plt>
mov    0x2e7a(%rip),%rcx
cmp    (%rcx),%rax
jle    11d6 <TustinSToZ+0xb6>
movss  -0x10(%rbp),%xmm0
mov    0x2e75(%rip),%rax
movss  (%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
ucomiss %xmm1,%xmm0
jbe    11b5 <TustinSToZ+0x95>
movss  0xe6b(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  0xe5e(%rip),%xmm1
subss  -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    11c7 <TustinSToZ+0xa7>
movss  0xe47(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    11c7 <TustinSToZ+0xa7>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ed <TustinSToZ+0xcd>
xor    %edi,%edi
call   1040 <assert@plt>
mov    0x2e04(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TustinSToZ>:
push   %rax
movaps %xmm0,%xmm2
mulss  %xmm1,%xmm2
movss  0xed0(%rip),%xmm0
movss  %xmm2,0x4(%rsp)
addss  %xmm2,%xmm0
call   1030 <fabsf@plt>
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%rax
jle    1181 <TustinSToZ+0x61>
mov    0x2e96(%rip),%rax
movss  (%rax),%xmm0
xorps  0xeb3(%rip),%xmm0
movss  0x4(%rsp),%xmm2
ucomiss %xmm0,%xmm2
jbe    1195 <TustinSToZ+0x75>
movss  0xe98(%rip),%xmm1
movaps %xmm2,%xmm0
addss  %xmm1,%xmm0
subss  %xmm2,%xmm1
divss  %xmm1,%xmm0
pop    %rax
ret
xor    %edi,%edi
call   1040 <assert@plt>
mov    0x2e59(%rip),%rax
movss  (%rax),%xmm0
pop    %rax
ret
movss  0xe67(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@FLT_EPSILON = global i64 0
@FLT_MAX = global float 0.000000e+00
define float @TustinSToZ(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fmul float %7, %8
store float %9, float* %6
%10 = load float, float* %6
%11 = fsub float %10, 2.000000e+00
%12 = call i64 @fabsf(float %11)
%13 = load i64, i64* @FLT_EPSILON
%14 = icmp sgt i64 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %2
%16 = load float, float* %6
%17 = load float, float* @FLT_MAX
%18 = fneg float %17
%19 = fcmp ogt float %16, %18
br i1 %19, label %20, label %26
20: ; preds = %15
%21 = load float, float* %6
%22 = fadd float 2.000000e+00, %21
%23 = load float, float* %6
%24 = fsub float 2.000000e+00, %23
%25 = fdiv float %22, %24
br label %27
26: ; preds = %15
br label %27
27: ; preds = %26, %20
%28 = phi float [ %25, %20 ], [ -1.000000e+00, %26 ]
store float %28, float* %3
br label %32
29: ; preds = %2
%30 = call i32 @assert(i32 0)
%31 = load float, float* @FLT_MAX
store float %31, float* %3
br label %32
32: ; preds = %29, %27
%33 = load float, float* %3
ret float %33
}

LLVM IR (-O2):
@FLT_EPSILON = global i64 0
@FLT_MAX = global float 0.000000e+00
define float @TustinSToZ(float %0, float %1) {
%3 = fmul float %0, %1
%4 = fadd float %3, -2.000000e+00
%5 = tail call i64 @fabsf(float %4)
%6 = load i64, i64* @FLT_EPSILON
%7 = icmp sgt i64 %5, %6
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load float, float* @FLT_MAX
%10 = fneg float %9
%11 = fcmp ogt float %3, %10
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = fadd float %3, 2.000000e+00
%14 = fsub float 2.000000e+00, %3
%15 = fdiv float %13, %14
br label %19
16: ; preds = %2
%17 = tail call i32 @assert(i32 0)
%18 = load float, float* @FLT_MAX
br label %19
19: ; preds = %12, %8, %16
%20 = phi float [ %18, %16 ], [ %15, %12 ], [ -1.000000e+00, %8 ]
ret float %20
}