#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 sscanf(char const *, char *, double *, double *, double *);
int iupStrToHSI(const char *str, double *h, double *s, double *i) {
  double fh, fs, fi;
  if (!str)
    return 0;
  if (sscanf(str, "%lf %lf %lf", &fh, &fs, &fi) != 3)
    return 0;
  if (fh > 359.0 || fs > 1.0 || fi > 1.0)
    return 0;
  if (fh < 0.0 || fs < 0.0 || fi < 0.0)
    return 0;
  *h = fh;
  *s = fs;
  *i = fi;
  return 1;
}


x86 assembly (clang, -O0):
<iupStrToHSI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113f <iupStrToHSI+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1225 <iupStrToHSI+0x115>
mov    -0x10(%rbp),%rdi
lea    0xec6(%rip),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
lea    -0x40(%rbp),%r8
call   1030 <sscanf@plt>
cmp    $0x3,%eax
je     1170 <iupStrToHSI+0x60>
movl   $0x0,-0x4(%rbp)
jmp    1225 <iupStrToHSI+0x115>
movsd  -0x30(%rbp),%xmm0
movsd  0xe83(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     11b5 <iupStrToHSI+0xa5>
movsd  -0x38(%rbp),%xmm0
movsd  0xe74(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     11b5 <iupStrToHSI+0xa5>
movsd  -0x40(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c1 <iupStrToHSI+0xb1>
movl   $0x0,-0x4(%rbp)
jmp    1225 <iupStrToHSI+0x115>
xorps  %xmm0,%xmm0
ucomisd -0x30(%rbp),%xmm0
ja     11eb <iupStrToHSI+0xdb>
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
ja     11eb <iupStrToHSI+0xdb>
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    11f7 <iupStrToHSI+0xe7>
movl   $0x0,-0x4(%rbp)
jmp    1225 <iupStrToHSI+0x115>
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupStrToHSI>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %ebx,%ebx
test   %rdi,%rdi
je     11ab <iupStrToHSI+0x9b>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
lea    0xeda(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
call   1030 <sscanf@plt>
cmp    $0x3,%eax
jne    11ab <iupStrToHSI+0x9b>
movsd  0x10(%rsp),%xmm0
ucomisd 0xea5(%rip),%xmm0
ja     11ab <iupStrToHSI+0x9b>
movsd  0x8(%rsp),%xmm1
ucomisd 0xe9d(%rip),%xmm1
ja     11ab <iupStrToHSI+0x9b>
movsd  (%rsp),%xmm2
ucomisd 0xe8e(%rip),%xmm2
ja     11ab <iupStrToHSI+0x9b>
xorpd  %xmm3,%xmm3
ucomisd %xmm0,%xmm3
ja     11ab <iupStrToHSI+0x9b>
ucomisd %xmm1,%xmm3
ja     11ab <iupStrToHSI+0x9b>
xorpd  %xmm3,%xmm3
ucomisd %xmm2,%xmm3
ja     11ab <iupStrToHSI+0x9b>
movsd  %xmm0,(%r12)
movsd  %xmm1,(%r15)
movsd  %xmm2,(%r14)
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%lf %lf %lf\00"
define i32 @iupStrToHSI(i8* %0, double* %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i8* %0, i8** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
%13 = load i8*, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %4
store i32 0, i32* %5
br label %48
16: ; preds = %4
%17 = load i8*, i8** %6
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double* %10, double* %11, double* %12)
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 0, i32* %5
br label %48
21: ; preds = %16
%22 = load double, double* %10
%23 = fcmp ogt double %22, 3.590000e+02
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = load double, double* %11
%26 = fcmp ogt double %25, 1.000000e+00
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load double, double* %12
%29 = fcmp ogt double %28, 1.000000e+00
br i1 %29, label %30, label %31
30: ; preds = %27, %24, %21
store i32 0, i32* %5
br label %48
31: ; preds = %27
%32 = load double, double* %10
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %40, label %34
34: ; preds = %31
%35 = load double, double* %11
%36 = fcmp olt double %35, 0.000000e+00
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = load double, double* %12
%39 = fcmp olt double %38, 0.000000e+00
br i1 %39, label %40, label %41
40: ; preds = %37, %34, %31
store i32 0, i32* %5
br label %48
41: ; preds = %37
%42 = load double, double* %10
%43 = load double*, double** %7
store double %42, double* %43
%44 = load double, double* %11
%45 = load double*, double** %8
store double %44, double* %45
%46 = load double, double* %12
%47 = load double*, double** %9
store double %46, double* %47
store i32 1, i32* %5
br label %48
48: ; preds = %41, %40, %30, %20, %15
%49 = load i32, i32* %5
ret i32 %49
}

LLVM IR (-O2):
@.str = [12 x i8] c"%lf %lf %lf\00"
define i32 @iupStrToHSI(i8* %0, double* nocapture writeonly %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = bitcast double* %5 to i8*
%9 = bitcast double* %6 to i8*
%10 = bitcast double* %7 to i8*
%11 = icmp eq i8* %0, null
br i1 %11, label %31, label %12
12: ; preds = %4
%13 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double* %5, double* %6, double* %7)
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = load double, double* %5
%17 = fcmp ogt double %16, 3.590000e+02
%18 = load double, double* %6
%19 = fcmp ogt double %18, 1.000000e+00
%20 = select i1 %17, i1 true, i1 %19
%21 = load double, double* %7
%22 = fcmp ogt double %21, 1.000000e+00
%23 = select i1 %20, i1 true, i1 %22
br i1 %23, label %31, label %24
24: ; preds = %15
%25 = fcmp olt double %16, 0.000000e+00
%26 = fcmp olt double %18, 0.000000e+00
%27 = select i1 %25, i1 true, i1 %26
%28 = fcmp olt double %21, 0.000000e+00
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %31, label %30
30: ; preds = %24
store double %16, double* %1
store double %18, double* %2
store double %21, double* %3
br label %31
31: ; preds = %24, %15, %12, %4, %30
%32 = phi i32 [ 1, %30 ], [ 0, %4 ], [ 0, %12 ], [ 0, %15 ], [ 0, %24 ]
ret i32 %32
}