#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 */
typedef int uint8_t;

/* Variables and functions */
uint8_t map_noise_to_terrain(double noise) {
  if (noise < .35) {
    return 4;
  }
  if (noise < .5) {
    return 3;
  }
  if (noise < .65) {
    return 4;
  }
  if (noise < .7) {
    return 5;
  }
  if (noise < .78f) {
    return 6;
  }
  return 7;
}


x86 assembly (clang, -O0):
<map_noise_to_terrain>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  0xeef(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1128 <map_noise_to_terrain+0x28>
movl   $0x4,-0x4(%rbp)
jmp    11ab <map_noise_to_terrain+0xab>
movsd  0xed8(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1147 <map_noise_to_terrain+0x47>
movl   $0x3,-0x4(%rbp)
jmp    11ab <map_noise_to_terrain+0xab>
movsd  0xec1(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1166 <map_noise_to_terrain+0x66>
movl   $0x4,-0x4(%rbp)
jmp    11ab <map_noise_to_terrain+0xab>
movsd  0xeaa(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1185 <map_noise_to_terrain+0x85>
movl   $0x5,-0x4(%rbp)
jmp    11ab <map_noise_to_terrain+0xab>
movsd  0xe93(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11a4 <map_noise_to_terrain+0xa4>
movl   $0x6,-0x4(%rbp)
jmp    11ab <map_noise_to_terrain+0xab>
movl   $0x7,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_noise_to_terrain>:
mov    $0x4,%eax
movsd  0xef3(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1160 <map_noise_to_terrain+0x60>
mov    $0x3,%eax
movsd  0xee8(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1160 <map_noise_to_terrain+0x60>
movsd  0xee2(%rip),%xmm1
ucomisd %xmm0,%xmm1
mov    $0x4,%eax
ja     1160 <map_noise_to_terrain+0x60>
mov    $0x5,%eax
movsd  0xed2(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1160 <map_noise_to_terrain+0x60>
movsd  0xecc(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
xor    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @map_noise_to_terrain(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 3.500000e-01
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 4, i32* %2
br label %24
7: ; preds = %1
%8 = load double, double* %3
%9 = fcmp olt double %8, 5.000000e-01
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 3, i32* %2
br label %24
11: ; preds = %7
%12 = load double, double* %3
%13 = fcmp olt double %12, 6.500000e-01
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 4, i32* %2
br label %24
15: ; preds = %11
%16 = load double, double* %3
%17 = fcmp olt double %16, 0x3FE6666666666666
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 5, i32* %2
br label %24
19: ; preds = %15
%20 = load double, double* %3
%21 = fcmp olt double %20, 0x3FE8F5C280000000
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 6, i32* %2
br label %24
23: ; preds = %19
store i32 7, i32* %2
br label %24
24: ; preds = %23, %22, %18, %14, %10, %6
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @map_noise_to_terrain(double %0) {
%2 = fcmp olt double %0, 3.500000e-01
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = fcmp olt double %0, 5.000000e-01
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = fcmp olt double %0, 6.500000e-01
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = fcmp olt double %0, 0x3FE6666666666666
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = fcmp olt double %0, 0x3FE8F5C280000000
%11 = select i1 %10, i32 6, i32 7
br label %12
12: ; preds = %9, %7, %5, %3, %1
%13 = phi i32 [ 4, %1 ], [ 3, %3 ], [ 4, %5 ], [ 5, %7 ], [ %11, %9 ]
ret i32 %13
}