#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 abs(int);
double rate_interval_h(int i) {
  int o = 0;
  i = abs(i);
  while (i > 11) {
    o++;
    i = abs(i - 12);
  }
  double v = 0;
  switch (i) {
  case 0:
    v = 0.5;
  case 1:
    v = 0.002;
  case 2:
    v = 0.06;
  case 3:
    v = 0.82;
  case 4:
    v = 0.75;
  case 5:
    v = 0.8;
  case 6:
    v = 0.03;
  case 7:
    v = 1.0;
  case 8:
    v = 0.85;
  case 9:
    v = 0.9;
  case 10:
    v = 0.62;
  case 11:
    v = 0.04;
  }
  if (o)
    return ((v + (o * 0.15)) / (1.0 + (o * 0.15)));
  return (v);
}


x86 assembly (clang, -O0):
<rate_interval_h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xb,-0xc(%rbp)
jle    1153 <rate_interval_h+0x43>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
sub    $0xc,%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
jmp    112d <rate_interval_h+0x1d>
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0xb,%rax
ja     121c <rate_interval_h+0x10c>
mov    -0x20(%rbp),%rax
lea    0xef1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xe78(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe73(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe6e(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe69(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe64(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe55(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe50(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe4b(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe46(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe41(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     126b <rate_interval_h+0x15b>
movsd  -0x18(%rbp),%xmm1
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xe28(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe13(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xddf(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1275 <rate_interval_h+0x165>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rate_interval_h>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cmp    $0xc,%eax
jb     1146 <rate_interval_h+0x46>
cmp    $0x17,%eax
mov    $0x17,%ecx
cmovl  %eax,%ecx
neg    %ecx
add    %eax,%ecx
add    $0xb,%ecx
mov    $0xaaaaaaab,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
lea    0x1(%rdx),%ecx
shl    $0x2,%edx
lea    (%rdx,%rdx,2),%edx
neg    %edx
add    %edx,%eax
add    $0xfffffff4,%eax
cmp    $0xc,%eax
jb     114f <rate_interval_h+0x4f>
xorpd  %xmm1,%xmm1
jmp    1157 <rate_interval_h+0x57>
movsd  0xeb2(%rip),%xmm0
ret
movsd  0xea9(%rip),%xmm1
cvtsi2sd %ecx,%xmm0
shufpd $0x2,0xeac(%rip),%xmm1
mulsd  0xe9c(%rip),%xmm0
unpcklpd %xmm0,%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @rate_interval_h(i32 %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %3
store i32 0, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @abs(i32 %6)
store i32 %7, i32* %3
br label %8
8: ; preds = %11, %1
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 11
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 12
%16 = call i32 @abs(i32 %15)
store i32 %16, i32* %3
br label %8
17: ; preds = %8
store double 0.000000e+00, double* %5
%18 = load i32, i32* %3
switch i32 %18, label %31 [
i32 0, label %19
i32 1, label %20
i32 2, label %21
i32 3, label %22
i32 4, label %23
i32 5, label %24
i32 6, label %25
i32 7, label %26
i32 8, label %27
i32 9, label %28
i32 10, label %29
i32 11, label %30
]
19: ; preds = %17
store double 5.000000e-01, double* %5
br label %20
20: ; preds = %17, %19
store double 2.000000e-03, double* %5
br label %21
21: ; preds = %17, %20
store double 6.000000e-02, double* %5
br label %22
22: ; preds = %17, %21
store double 8.200000e-01, double* %5
br label %23
23: ; preds = %17, %22
store double 7.500000e-01, double* %5
br label %24
24: ; preds = %17, %23
store double 8.000000e-01, double* %5
br label %25
25: ; preds = %17, %24
store double 3.000000e-02, double* %5
br label %26
26: ; preds = %17, %25
store double 1.000000e+00, double* %5
br label %27
27: ; preds = %17, %26
store double 8.500000e-01, double* %5
br label %28
28: ; preds = %17, %27
store double 9.000000e-01, double* %5
br label %29
29: ; preds = %17, %28
store double 6.200000e-01, double* %5
br label %30
30: ; preds = %17, %29
store double 4.000000e-02, double* %5
br label %31
31: ; preds = %30, %17
%32 = load i32, i32* %4
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %43
34: ; preds = %31
%35 = load double, double* %5
%36 = load i32, i32* %4
%37 = sitofp i32 %36 to double
%38 = call double @llvm.fmuladd.f64(double %37, double 1.500000e-01, double %35)
%39 = load i32, i32* %4
%40 = sitofp i32 %39 to double
%41 = call double @llvm.fmuladd.f64(double %40, double 1.500000e-01, double 1.000000e+00)
%42 = fdiv double %38, %41
store double %42, double* %2
br label %45
43: ; preds = %31
%44 = load double, double* %5
store double %44, double* %2
br label %45
45: ; preds = %43, %34
%46 = load double, double* %2
ret double %46
}

LLVM IR (-O2):
define double @rate_interval_h(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = icmp ugt i32 %2, 11
br i1 %3, label %4, label %23
4: ; preds = %1
%5 = add nuw i32 %2, 11
%6 = call i32 @llvm.smin.i32(i32 %2, i32 23)
%7 = sub nuw i32 %5, %6
%8 = udiv i32 %7, 12
%9 = add nuw nsw i32 %8, 1
%10 = mul nsw i32 %8, -12
%11 = add nsw i32 %2, -12
%12 = add nsw i32 %10, %11
%13 = icmp ult i32 %12, 12
%14 = select i1 %13, double 4.000000e-02, double 0.000000e+00
%15 = sitofp i32 %9 to double
%16 = insertelement <2 x double> poison, double %15, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %14, i64 0
%19 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %17, <2 x double> <double 1.500000e-01, double 1.500000e-01>, <2 x double> %18)
%20 = extractelement <2 x double> %19, i64 0
%21 = extractelement <2 x double> %19, i64 1
%22 = fdiv double %20, %21
br label %23
23: ; preds = %1, %4
%24 = phi double [ %22, %4 ], [ 4.000000e-02, %1 ]
ret double %24
}