#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__ abs(int);
double _p3dHuangYagerThresholding_Ux(int g, int u0, int u1, int t) {
  double ux, x;
  if (g <= t) {
    x = 1.0 + ((double)abs(g - u0)) / 255.0;
    ux = 1.0 / x;
  } else {
    x = 1.0 + ((double)abs(g - u1)) / 255.0;
    ux = 1.0 / x;
  }
  return ux;
}


x86 assembly (clang, -O0):
<_p3dHuangYagerThresholding_Ux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1174 <_p3dHuangYagerThresholding_Ux+0x64>
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <abs@plt>
cvtsi2sd %rax,%xmm1
movsd  0xec0(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xeac(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe9b(%rip),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11b3 <_p3dHuangYagerThresholding_Ux+0xa3>
mov    -0x4(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1030 <abs@plt>
cvtsi2sd %rax,%xmm1
movsd  0xe7c(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe68(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe57(%rip),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_p3dHuangYagerThresholding_Ux>:
push   %rax
cmp    %ecx,%edi
cmovg  %edx,%esi
sub    %esi,%edi
call   1030 <abs@plt>
cvtsi2sd %rax,%xmm1
divsd  0xed6(%rip),%xmm1
movsd  0xed6(%rip),%xmm0
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @_p3dHuangYagerThresholding_Ux(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %8
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = sub nsw i32 %15, %16
%18 = call i64 @abs(i32 %17)
%19 = sitofp i64 %18 to double
%20 = fdiv double %19, 2.550000e+02
%21 = fadd double 1.000000e+00, %20
store double %21, double* %10
%22 = load double, double* %10
%23 = fdiv double 1.000000e+00, %22
store double %23, double* %9
br label %34
24: ; preds = %4
%25 = load i32, i32* %5
%26 = load i32, i32* %7
%27 = sub nsw i32 %25, %26
%28 = call i64 @abs(i32 %27)
%29 = sitofp i64 %28 to double
%30 = fdiv double %29, 2.550000e+02
%31 = fadd double 1.000000e+00, %30
store double %31, double* %10
%32 = load double, double* %10
%33 = fdiv double 1.000000e+00, %32
store double %33, double* %9
br label %34
34: ; preds = %24, %14
%35 = load double, double* %9
ret double %35
}

LLVM IR (-O2):
define double @_p3dHuangYagerThresholding_Ux(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %0, %3
%6 = select i1 %5, i32 %2, i32 %1
%7 = sub nsw i32 %0, %6
%8 = tail call i64 @abs(i32 %7)
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 2.550000e+02
%11 = fadd double %10, 1.000000e+00
%12 = fdiv double 1.000000e+00, %11
ret double %12
}