#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 GetTCelsiusFromTKelvin(double);
double GetTFahrenheitFromTRankine(double);
scalar_t__ isIP();
double GetTDryBulbFromMoistAirVolumeAndHumRatio(double MoistAirVolume,
                                                double HumRatio,
                                                double Pressure) {
  double BoundedHumRatio;
  if (!(HumRatio >= 0.)) {
    Assert("Humidity ratio is negative",
           "/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",
           901);
  }
  BoundedHumRatio = (((HumRatio) > (1e-7)) ? (HumRatio) : (1e-7));
  if (isIP())
    return GetTFahrenheitFromTRankine(
        MoistAirVolume * (144 * Pressure) /
        (53.350 * (1 + 1.607858 * BoundedHumRatio)));
  else
    return GetTCelsiusFromTKelvin(MoistAirVolume * Pressure /
                                  (287.042 * (1 + 1.607858 * BoundedHumRatio)));
}


x86 assembly (clang, -O0):
<GetTDryBulbFromMoistAirVolumeAndHumRatio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    1181 <GetTDryBulbFromMoistAirVolumeAndHumRatio+0x41>
lea    0xec0(%rip),%rdi
lea    0xed4(%rip),%rsi
mov    $0x385,%edx
call   1030 <Assert@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe72(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a7 <GetTDryBulbFromMoistAirVolumeAndHumRatio+0x67>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11b9 <GetTDryBulbFromMoistAirVolumeAndHumRatio+0x79>
movsd  0xe51(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11b9 <GetTDryBulbFromMoistAirVolumeAndHumRatio+0x79>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1060 <isIP@plt>
cmp    $0x0,%rax
je     1226 <GetTDryBulbFromMoistAirVolumeAndHumRatio+0xe6>
movsd  -0x10(%rbp),%xmm0
movsd  0xe47(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0xe19(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xe15(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  0xe11(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1040 <GetTFahrenheitFromTRankine@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1267 <GetTDryBulbFromMoistAirVolumeAndHumRatio+0x127>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0xdd3(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xdcf(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  0xdb3(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1050 <GetTCelsiusFromTKelvin@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetTDryBulbFromMoistAirVolumeAndHumRatio>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jae    117c <GetTDryBulbFromMoistAirVolumeAndHumRatio+0x3c>
lea    0xecf(%rip),%rdi
lea    0xee3(%rip),%rsi
mov    $0x385,%edx
movsd  %xmm1,(%rsp)
call   1030 <Assert@plt>
movsd  (%rsp),%xmm1
maxsd  0xe7c(%rip),%xmm1
movsd  %xmm1,(%rsp)
xor    %eax,%eax
call   1060 <isIP@plt>
test   %rax,%rax
je     11d3 <GetTDryBulbFromMoistAirVolumeAndHumRatio+0x93>
movsd  0x10(%rsp),%xmm0
mulsd  0xe65(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  0xe60(%rip),%xmm1
addsd  0xe60(%rip),%xmm1
mulsd  0x8(%rsp),%xmm0
mulsd  0xe5a(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x18,%rsp
jmp    1040 <GetTFahrenheitFromTRankine@plt>
movsd  (%rsp),%xmm1
mulsd  0xe30(%rip),%xmm1
addsd  0xe30(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  0xe2c(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x18,%rsp
jmp    1050 <GetTCelsiusFromTKelvin@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Humidity ratio is negative\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 @GetTDryBulbFromMoistAirVolumeAndHumRatio(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* %5
store double %1, double* %6
store double %2, double* %7
%9 = load double, double* %6
%10 = fcmp oge double %9, 0.000000e+00
br i1 %10, label %13, label %11
11: ; preds = %3
%12 = call i32 @Assert(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.1, i64 0, i64 0), i32 901)
br label %13
13: ; preds = %11, %3
%14 = load double, double* %6
%15 = fcmp ogt double %14, 0x3E7AD7F29ABCAF48
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load double, double* %6
br label %19
18: ; preds = %13
br label %19
19: ; preds = %18, %16
%20 = phi double [ %17, %16 ], [ 0x3E7AD7F29ABCAF48, %18 ]
store double %20, double* %8
%21 = call i64 (...) @isIP()
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %33
23: ; preds = %19
%24 = load double, double* %5
%25 = load double, double* %7
%26 = fmul double 1.440000e+02, %25
%27 = fmul double %24, %26
%28 = load double, double* %8
%29 = call double @llvm.fmuladd.f64(double 0x3FF9B9C94F69CA9F, double %28, double 1.000000e+00)
%30 = fmul double 5.335000e+01, %29
%31 = fdiv double %27, %30
%32 = call double @GetTFahrenheitFromTRankine(double %31)
store double %32, double* %4
br label %42
33: ; preds = %19
%34 = load double, double* %5
%35 = load double, double* %7
%36 = fmul double %34, %35
%37 = load double, double* %8
%38 = call double @llvm.fmuladd.f64(double 0x3FF9B9C94F69CA9F, double %37, double 1.000000e+00)
%39 = fmul double 2.870420e+02, %38
%40 = fdiv double %36, %39
%41 = call double @GetTCelsiusFromTKelvin(double %40)
store double %41, double* %4
br label %42
42: ; preds = %33, %23
%43 = load double, double* %4
ret double %43
}

LLVM IR (-O2):
@.str = [27 x i8] c"Humidity ratio is negative\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 @GetTDryBulbFromMoistAirVolumeAndHumRatio(double %0, double %1, double %2) {
%4 = fcmp ult double %1, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @Assert(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.1, i64 0, i64 0), i32 901)
br label %7
7: ; preds = %5, %3
%8 = fcmp ogt double %1, 0x3E7AD7F29ABCAF48
%9 = select i1 %8, double %1, double 0x3E7AD7F29ABCAF48
%10 = tail call i64 (...) @isIP()
%11 = icmp eq i64 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %7
%13 = fmul double %2, 1.440000e+02
%14 = fmul double %13, %0
%15 = tail call double @llvm.fmuladd.f64(double %9, double 0x3FF9B9C94F69CA9F, double 1.000000e+00)
%16 = fmul double %15, 5.335000e+01
%17 = fdiv double %14, %16
%18 = tail call double @GetTFahrenheitFromTRankine(double %17)
br label %25
19: ; preds = %7
%20 = fmul double %0, %2
%21 = tail call double @llvm.fmuladd.f64(double %9, double 0x3FF9B9C94F69CA9F, double 1.000000e+00)
%22 = fmul double %21, 2.870420e+02
%23 = fdiv double %20, %22
%24 = tail call double @GetTCelsiusFromTKelvin(double %23)
br label %25
25: ; preds = %19, %12
%26 = phi double [ %18, %12 ], [ %24, %19 ]
ret double %26
}