#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 */
int /*<<< orphan*/ Assert(char *, char *, int);
double GetSatHumRatio(double, double);
scalar_t__ isIP();
double GetHumRatioFromTWetBulb(double TDryBulb, double TWetBulb,
                               double Pressure) {
  double Wsstar;
  double HumRatio = -99999;
  if (!(TWetBulb <= TDryBulb)) {
    Assert("Wet bulb temperature is above dry bulb temperature",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/psychrometrics/psychrolib/refs/heads/"
           "master/src/c/psychrolib.c",
           488);
  }
  Wsstar = GetSatHumRatio(TWetBulb, Pressure);
  if (isIP()) {
    if (TWetBulb >= 32.0)
      HumRatio = ((1093. - 0.556 * TWetBulb) * Wsstar -
                  0.240 * (TDryBulb - TWetBulb)) /
                 (1093. + 0.444 * TDryBulb - TWetBulb);
    else
      HumRatio =
          ((1220. - 0.04 * TWetBulb) * Wsstar - 0.240 * (TDryBulb - TWetBulb)) /
          (1220. + 0.444 * TDryBulb - 0.48 * TWetBulb);
  } else {
    if (TWetBulb >= 0.0)
      HumRatio = ((2501. - 2.326 * TWetBulb) * Wsstar -
                  1.006 * (TDryBulb - TWetBulb)) /
                 (2501. + 1.86 * TDryBulb - 4.186 * TWetBulb);
    else
      HumRatio =
          ((2830. - 0.24 * TWetBulb) * Wsstar - 1.006 * (TDryBulb - TWetBulb)) /
          (2830. + 1.86 * TDryBulb - 2.1 * TWetBulb);
  }
  return (((HumRatio) > (1e-7)) ? (HumRatio) : (1e-7));
}


x86 assembly (clang, -O0):
<GetHumRatioFromTWetBulb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xeb1(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    1180 <GetHumRatioFromTWetBulb+0x50>
lea    0xf21(%rip),%rdi
lea    0xf4d(%rip),%rsi
mov    $0x1e8,%edx
call   1030 <Assert@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <GetSatHumRatio@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1050 <isIP@plt>
cmp    $0x0,%rax
je     12da <GetHumRatioFromTWetBulb+0x1aa>
movsd  -0x10(%rbp),%xmm0
movsd  0xe96(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1243 <GetHumRatioFromTWetBulb+0x113>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
subsd  -0x10(%rbp),%xmm3
movsd  0xe78(%rip),%xmm1
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xe38(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe4c(%rip),%xmm2
addsd  %xmm2,%xmm1
subsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    12d5 <GetHumRatioFromTWetBulb+0x1a5>
movsd  -0x10(%rbp),%xmm0
movsd  0xe20(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe04(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
subsd  -0x10(%rbp),%xmm3
movsd  0xdf1(%rip),%xmm1
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xdb1(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xdad(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  -0x10(%rbp),%xmm1
movsd  0xd8c(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    141a <GetHumRatioFromTWetBulb+0x2ea>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1383 <GetHumRatioFromTWetBulb+0x253>
movsd  -0x10(%rbp),%xmm0
movsd  0xd47(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd33(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
subsd  -0x10(%rbp),%xmm3
movsd  0xd00(%rip),%xmm1
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xcc0(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xcdc(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  -0x10(%rbp),%xmm1
movsd  0xcc3(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1415 <GetHumRatioFromTWetBulb+0x2e5>
movsd  -0x10(%rbp),%xmm0
movsd  0xc98(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc7c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
subsd  -0x10(%rbp),%xmm3
movsd  0xc69(%rip),%xmm1
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xc29(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xc25(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  -0x10(%rbp),%xmm1
movsd  0xc04(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    141a <GetHumRatioFromTWetBulb+0x2ea>
movsd  -0x28(%rbp),%xmm0
movsd  0xc61(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1440 <GetHumRatioFromTWetBulb+0x310>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1452 <GetHumRatioFromTWetBulb+0x322>
movsd  0xc40(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1452 <GetHumRatioFromTWetBulb+0x322>
movsd  -0x30(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetHumRatioFromTWetBulb>:
sub    $0x18,%rsp
movaps %xmm2,%xmm3
movsd  %xmm0,0x8(%rsp)
ucomisd %xmm1,%xmm0
movsd  %xmm1,0x10(%rsp)
jae    1171 <GetHumRatioFromTWetBulb+0x41>
lea    0xf30(%rip),%rdi
lea    0xf5c(%rip),%rsi
mov    $0x1e8,%edx
movsd  %xmm3,(%rsp)
call   1030 <Assert@plt>
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
movaps %xmm3,%xmm1
call   1040 <GetSatHumRatio@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <isIP@plt>
test   %rax,%rax
je     11f2 <GetHumRatioFromTWetBulb+0xc2>
movsd  0x10(%rsp),%xmm3
ucomisd 0xe64(%rip),%xmm3
jae    125a <GetHumRatioFromTWetBulb+0x12a>
movsd  0xe7e(%rip),%xmm0
mulsd  %xmm3,%xmm0
movsd  0xe7a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm2
subsd  %xmm3,%xmm2
mulsd  0xe48(%rip),%xmm2
mulsd  (%rsp),%xmm0
addsd  %xmm2,%xmm0
mulsd  0xe3f(%rip),%xmm4
addsd  %xmm1,%xmm4
mulsd  0xe4b(%rip),%xmm3
jmp    12eb <GetHumRatioFromTWetBulb+0x1bb>
xorpd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm3
ucomisd %xmm0,%xmm3
movsd  0x8(%rsp),%xmm4
movsd  (%rsp),%xmm5
jae    12a7 <GetHumRatioFromTWetBulb+0x177>
movsd  0xdff(%rip),%xmm0
mulsd  %xmm3,%xmm0
movsd  0xe43(%rip),%xmm1
addsd  %xmm1,%xmm0
movapd %xmm4,%xmm2
subsd  %xmm3,%xmm2
mulsd  0xe17(%rip),%xmm2
mulsd  %xmm5,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xe0f(%rip),%xmm4
addsd  %xmm1,%xmm4
mulsd  0xe1b(%rip),%xmm3
jmp    12eb <GetHumRatioFromTWetBulb+0x1bb>
movsd  0xda6(%rip),%xmm0
mulsd  %xmm3,%xmm0
movsd  0xda2(%rip),%xmm1
movsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm2
subsd  %xmm3,%xmm2
mulsd  0xd94(%rip),%xmm2
addsd  %xmm1,%xmm0
mulsd  (%rsp),%xmm0
mulsd  0xd8b(%rip),%xmm4
addsd  %xmm2,%xmm0
addsd  %xmm1,%xmm4
subsd  %xmm3,%xmm4
divsd  %xmm4,%xmm0
jmp    12f3 <GetHumRatioFromTWetBulb+0x1c3>
movsd  0xd91(%rip),%xmm0
mulsd  %xmm3,%xmm0
movsd  0xd8d(%rip),%xmm1
addsd  %xmm1,%xmm0
movapd %xmm4,%xmm2
subsd  %xmm3,%xmm2
mulsd  0xd81(%rip),%xmm2
mulsd  %xmm5,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xd79(%rip),%xmm4
addsd  %xmm1,%xmm4
mulsd  0xd75(%rip),%xmm3
addsd  %xmm4,%xmm3
divsd  %xmm3,%xmm0
maxsd  0xd7d(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Wet bulb temperature is above dry bulb temperature\00"
@.str.1 = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/psychrometrics/psychrolib/refs/heads/master/src/c/psychrolib.c\00"
define double @GetHumRatioFromTWetBulb(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
store double -9.999900e+04, double* %8
%9 = load double, double* %5
%10 = load double, double* %4
%11 = fcmp ole double %9, %10
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = call i32 @Assert(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.1, i64 0, i64 0), i32 488)
br label %14
14: ; preds = %12, %3
%15 = load double, double* %5
%16 = load double, double* %6
%17 = call double @GetSatHumRatio(double %15, double %16)
store double %17, double* %7
%18 = call i64 (...) @isIP()
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %54
20: ; preds = %14
%21 = load double, double* %5
%22 = fcmp oge double %21, 3.200000e+01
br i1 %22, label %23, label %38
23: ; preds = %20
%24 = load double, double* %5
%25 = call double @llvm.fmuladd.f64(double -5.560000e-01, double %24, double 1.093000e+03)
%26 = load double, double* %7
%27 = load double, double* %4
%28 = load double, double* %5
%29 = fsub double %27, %28
%30 = fmul double 2.400000e-01, %29
%31 = fneg double %30
%32 = call double @llvm.fmuladd.f64(double %25, double %26, double %31)
%33 = load double, double* %4
%34 = call double @llvm.fmuladd.f64(double 4.440000e-01, double %33, double 1.093000e+03)
%35 = load double, double* %5
%36 = fsub double %34, %35
%37 = fdiv double %32, %36
store double %37, double* %8
br label %53
38: ; preds = %20
%39 = load double, double* %5
%40 = call double @llvm.fmuladd.f64(double -4.000000e-02, double %39, double 1.220000e+03)
%41 = load double, double* %7
%42 = load double, double* %4
%43 = load double, double* %5
%44 = fsub double %42, %43
%45 = fmul double 2.400000e-01, %44
%46 = fneg double %45
%47 = call double @llvm.fmuladd.f64(double %40, double %41, double %46)
%48 = load double, double* %4
%49 = call double @llvm.fmuladd.f64(double 4.440000e-01, double %48, double 1.220000e+03)
%50 = load double, double* %5
%51 = call double @llvm.fmuladd.f64(double -4.800000e-01, double %50, double %49)
%52 = fdiv double %47, %51
store double %52, double* %8
br label %53
53: ; preds = %38, %23
br label %88
54: ; preds = %14
%55 = load double, double* %5
%56 = fcmp oge double %55, 0.000000e+00
br i1 %56, label %57, label %72
57: ; preds = %54
%58 = load double, double* %5
%59 = call double @llvm.fmuladd.f64(double -2.326000e+00, double %58, double 2.501000e+03)
%60 = load double, double* %7
%61 = load double, double* %4
%62 = load double, double* %5
%63 = fsub double %61, %62
%64 = fmul double 1.006000e+00, %63
%65 = fneg double %64
%66 = call double @llvm.fmuladd.f64(double %59, double %60, double %65)
%67 = load double, double* %4
%68 = call double @llvm.fmuladd.f64(double 1.860000e+00, double %67, double 2.501000e+03)
%69 = load double, double* %5
%70 = call double @llvm.fmuladd.f64(double -4.186000e+00, double %69, double %68)
%71 = fdiv double %66, %70
store double %71, double* %8
br label %87
72: ; preds = %54
%73 = load double, double* %5
%74 = call double @llvm.fmuladd.f64(double -2.400000e-01, double %73, double 2.830000e+03)
%75 = load double, double* %7
%76 = load double, double* %4
%77 = load double, double* %5
%78 = fsub double %76, %77
%79 = fmul double 1.006000e+00, %78
%80 = fneg double %79
%81 = call double @llvm.fmuladd.f64(double %74, double %75, double %80)
%82 = load double, double* %4
%83 = call double @llvm.fmuladd.f64(double 1.860000e+00, double %82, double 2.830000e+03)
%84 = load double, double* %5
%85 = call double @llvm.fmuladd.f64(double -2.100000e+00, double %84, double %83)
%86 = fdiv double %81, %85
store double %86, double* %8
br label %87
87: ; preds = %72, %57
br label %88
88: ; preds = %87, %53
%89 = load double, double* %8
%90 = fcmp ogt double %89, 0x3E7AD7F29ABCAF48
br i1 %90, label %91, label %93
91: ; preds = %88
%92 = load double, double* %8
br label %94
93: ; preds = %88
br label %94
94: ; preds = %93, %91
%95 = phi double [ %92, %91 ], [ 0x3E7AD7F29ABCAF48, %93 ]
ret double %95
}

LLVM IR (-O2):
@.str = [51 x i8] c"Wet bulb temperature is above dry bulb temperature\00"
@.str.1 = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/psychrometrics/psychrolib/refs/heads/master/src/c/psychrolib.c\00"
define double @GetHumRatioFromTWetBulb(double %0, double %1, double %2) {
%4 = fcmp ugt double %1, %0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @Assert(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.1, i64 0, i64 0), i32 488)
br label %7
7: ; preds = %5, %3
%8 = tail call double @GetSatHumRatio(double %1, double %2)
%9 = tail call i64 (...) @isIP()
%10 = icmp eq i64 %9, 0
br i1 %10, label %29, label %11
11: ; preds = %7
%12 = fcmp ult double %1, 3.200000e+01
br i1 %12, label %21, label %13
13: ; preds = %11
%14 = tail call double @llvm.fmuladd.f64(double %1, double -5.560000e-01, double 1.093000e+03)
%15 = fsub double %0, %1
%16 = fmul double %15, -2.400000e-01
%17 = tail call double @llvm.fmuladd.f64(double %14, double %8, double %16)
%18 = tail call double @llvm.fmuladd.f64(double %0, double 4.440000e-01, double 1.093000e+03)
%19 = fsub double %18, %1
%20 = fdiv double %17, %19
br label %47
21: ; preds = %11
%22 = tail call double @llvm.fmuladd.f64(double %1, double -4.000000e-02, double 1.220000e+03)
%23 = fsub double %0, %1
%24 = fmul double %23, -2.400000e-01
%25 = tail call double @llvm.fmuladd.f64(double %22, double %8, double %24)
%26 = tail call double @llvm.fmuladd.f64(double %0, double 4.440000e-01, double 1.220000e+03)
%27 = tail call double @llvm.fmuladd.f64(double %1, double -4.800000e-01, double %26)
%28 = fdiv double %25, %27
br label %47
29: ; preds = %7
%30 = fcmp ult double %1, 0.000000e+00
br i1 %30, label %39, label %31
31: ; preds = %29
%32 = tail call double @llvm.fmuladd.f64(double %1, double -2.326000e+00, double 2.501000e+03)
%33 = fsub double %0, %1
%34 = fmul double %33, -1.006000e+00
%35 = tail call double @llvm.fmuladd.f64(double %32, double %8, double %34)
%36 = tail call double @llvm.fmuladd.f64(double %0, double 1.860000e+00, double 2.501000e+03)
%37 = tail call double @llvm.fmuladd.f64(double %1, double -4.186000e+00, double %36)
%38 = fdiv double %35, %37
br label %47
39: ; preds = %29
%40 = tail call double @llvm.fmuladd.f64(double %1, double -2.400000e-01, double 2.830000e+03)
%41 = fsub double %0, %1
%42 = fmul double %41, -1.006000e+00
%43 = tail call double @llvm.fmuladd.f64(double %40, double %8, double %42)
%44 = tail call double @llvm.fmuladd.f64(double %0, double 1.860000e+00, double 2.830000e+03)
%45 = tail call double @llvm.fmuladd.f64(double %1, double -2.100000e+00, double %44)
%46 = fdiv double %43, %45
br label %47
47: ; preds = %31, %39, %13, %21
%48 = phi double [ %20, %13 ], [ %28, %21 ], [ %38, %31 ], [ %46, %39 ]
%49 = fcmp ogt double %48, 0x3E7AD7F29ABCAF48
%50 = select i1 %49, double %48, double 0x3E7AD7F29ABCAF48
ret double %50
}