#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 double_is_within(double, float, float);
bool cm_hsi_is_valid(double h, double s, double i) {
  bool isValid = true;
  if ((double_is_within(h, (0.0f), (360.0f)) == false) ||
      (double_is_within(s, (0.0f), (1.0f)) == false) ||
      (double_is_within(i, (0.0f), (1.0f)) == false)) {
    isValid = false;
  }
  return isValid;
}


x86 assembly (clang, -O0):
<cm_hsi_is_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
movss  0xec2(%rip),%xmm2
call   1030 <double_is_within@plt>
cmp    $0x0,%eax
je     1188 <cm_hsi_is_valid+0x78>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
movss  0xea8(%rip),%xmm2
call   1030 <double_is_within@plt>
cmp    $0x0,%eax
je     1188 <cm_hsi_is_valid+0x78>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
movss  0xe8a(%rip),%xmm2
call   1030 <double_is_within@plt>
cmp    $0x0,%eax
jne    118f <cm_hsi_is_valid+0x7f>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cm_hsi_is_valid>:
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movss  0xed8(%rip),%xmm2
xorps  %xmm1,%xmm1
call   1030 <double_is_within@plt>
test   %eax,%eax
je     1174 <cm_hsi_is_valid+0x64>
movss  0xec8(%rip),%xmm2
xorps  %xmm1,%xmm1
movsd  0x10(%rsp),%xmm0
call   1030 <double_is_within@plt>
test   %eax,%eax
je     1174 <cm_hsi_is_valid+0x64>
movss  0xeae(%rip),%xmm2
xorps  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
call   1030 <double_is_within@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     1174 <cm_hsi_is_valid+0x64>
add    $0x18,%rsp
ret
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @cm_hsi_is_valid(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
store i32 1, i32* %7
%8 = load double, double* %4
%9 = call i32 @double_is_within(double %8, float 0.000000e+00, float 3.600000e+02)
%10 = icmp eq i32 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %3
%12 = load double, double* %5
%13 = call i32 @double_is_within(double %12, float 0.000000e+00, float 1.000000e+00)
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load double, double* %6
%17 = call i32 @double_is_within(double %16, float 0.000000e+00, float 1.000000e+00)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15, %11, %3
store i32 0, i32* %7
br label %20
20: ; preds = %19, %15
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @cm_hsi_is_valid(double %0, double %1, double %2) {
%4 = tail call i32 @double_is_within(double %0, float 0.000000e+00, float 3.600000e+02)
%5 = icmp eq i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = tail call i32 @double_is_within(double %1, float 0.000000e+00, float 1.000000e+00)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i32 @double_is_within(double %2, float 0.000000e+00, float 1.000000e+00)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9, %6, %3
br label %13
13: ; preds = %12, %9
%14 = phi i32 [ 0, %12 ], [ 1, %9 ]
ret i32 %14
}