#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*/ printf(char *, char *);
int /*<<< orphan*/ textcolor(int);
void waveprint(char *in, double wavelength) {
  if (wavelength < 400.0) {
    textcolor(35);
  } else if (wavelength < 500.0) {
    textcolor(34);
  } else if (wavelength < 575.0) {
    textcolor(32);
  } else if (wavelength < 600.0) {
    textcolor(33);
  } else {
    textcolor(31);
  }
  printf("%s", in);
  textcolor(0);
}


x86 assembly (clang, -O0):
<waveprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  0xec7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1153 <waveprint+0x33>
mov    $0x23,%edi
call   1040 <textcolor@plt>
jmp    11d2 <waveprint+0xb2>
movsd  0xead(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1175 <waveprint+0x55>
mov    $0x22,%edi
call   1040 <textcolor@plt>
jmp    11cd <waveprint+0xad>
movsd  0xe93(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1197 <waveprint+0x77>
mov    $0x20,%edi
call   1040 <textcolor@plt>
jmp    11c8 <waveprint+0xa8>
movsd  0xe79(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11b9 <waveprint+0x99>
mov    $0x21,%edi
call   1040 <textcolor@plt>
jmp    11c3 <waveprint+0xa3>
mov    $0x1f,%edi
call   1040 <textcolor@plt>
jmp    11c8 <waveprint+0xa8>
jmp    11cd <waveprint+0xad>
jmp    11d2 <waveprint+0xb2>
mov    -0x8(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <textcolor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waveprint>:
push   %rbx
mov    %rdi,%rbx
mov    $0x23,%edi
movsd  0xecf(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1174 <waveprint+0x54>
mov    $0x22,%edi
movsd  0xec4(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1174 <waveprint+0x54>
mov    $0x20,%edi
movsd  0xeb9(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1174 <waveprint+0x54>
movsd  0xeb3(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
lea    (%rax,%rax,1),%edi
add    $0x1f,%edi
call   1040 <textcolor@plt>
lea    0xea0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rbx
jmp    1040 <textcolor@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @waveprint(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp olt double %5, 4.000000e+02
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @textcolor(i32 35)
br label %29
9: ; preds = %2
%10 = load double, double* %4
%11 = fcmp olt double %10, 5.000000e+02
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @textcolor(i32 34)
br label %28
14: ; preds = %9
%15 = load double, double* %4
%16 = fcmp olt double %15, 5.750000e+02
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @textcolor(i32 32)
br label %27
19: ; preds = %14
%20 = load double, double* %4
%21 = fcmp olt double %20, 6.000000e+02
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @textcolor(i32 33)
br label %26
24: ; preds = %19
%25 = call i32 @textcolor(i32 31)
br label %26
26: ; preds = %24, %22
br label %27
27: ; preds = %26, %17
br label %28
28: ; preds = %27, %12
br label %29
29: ; preds = %28, %7
%30 = load i8*, i8** %3
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = call i32 @textcolor(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @waveprint(i8* %0, double %1) {
%3 = fcmp olt double %1, 4.000000e+02
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = fcmp olt double %1, 5.000000e+02
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = fcmp olt double %1, 5.750000e+02
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = fcmp olt double %1, 6.000000e+02
%10 = select i1 %9, i32 33, i32 31
br label %11
11: ; preds = %8, %6, %4, %2
%12 = phi i32 [ 35, %2 ], [ 34, %4 ], [ 32, %6 ], [ %10, %8 ]
%13 = tail call i32 @textcolor(i32 %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%15 = tail call i32 @textcolor(i32 0)
ret void
}