#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 */
double cov_rand(int, int);
double cov_rand_sp(int itv) {
  switch (itv) {
  case 0:
    return -1.0 * cov_rand(64, 127);
  case 1:
    return -1.0 * cov_rand(0, 64);
  case 2:
    return -1.0 * cov_rand(-63, 0);
  case 3:
    return -1.0 * cov_rand(-126, -63);
  case 4:
    return 1.0 * 0.0;
  case 5:
    return -1.0 * 0.0;
  case 6:
    return cov_rand(-126, -63);
  case 7:
    return cov_rand(-63, 0);
  case 8:
    return cov_rand(0, 64);
  case 9:
    return cov_rand(64, 127);
  default:
    return cov_rand_sp(itv % 10);
  }
}


x86 assembly (clang, -O0):
<cov_rand_sp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x9,%rax
ja     1267 <cov_rand_sp+0x147>
mov    -0x18(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x40,%edi
mov    $0x7f,%esi
call   1040 <cov_rand@plt>
movaps %xmm0,%xmm1
movsd  0xe9e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
xor    %edi,%edi
mov    $0x40,%esi
call   1040 <cov_rand@plt>
movaps %xmm0,%xmm1
movsd  0xe79(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
mov    $0xffffffc1,%edi
xor    %esi,%esi
call   1040 <cov_rand@plt>
movaps %xmm0,%xmm1
movsd  0xe54(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
mov    $0xffffff82,%edi
mov    $0xffffffc1,%esi
call   1040 <cov_rand@plt>
movaps %xmm0,%xmm1
movsd  0xe2c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
movsd  0xe01(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
mov    $0xffffff82,%edi
mov    $0xffffffc1,%esi
call   1040 <cov_rand@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
mov    $0xffffffc1,%edi
xor    %esi,%esi
call   1040 <cov_rand@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
xor    %edi,%edi
mov    $0x40,%esi
call   1040 <cov_rand@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
mov    $0x40,%edi
mov    $0x7f,%esi
call   1040 <cov_rand@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    127e <cov_rand_sp+0x15e>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <cov_rand_sp@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cov_rand_sp>:
push   %rax
cmp    $0x9,%edi
jbe    1139 <cov_rand_sp+0x29>
movslq %edi,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
cmp    $0x9,%edi
ja     1116 <cov_rand_sp+0x6>
mov    %edi,%eax
lea    0xede(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x40,%edi
mov    $0x7f,%esi
jmp    1173 <cov_rand_sp+0x63>
xor    %edi,%edi
mov    $0x40,%esi
jmp    1173 <cov_rand_sp+0x63>
mov    $0xffffffc1,%edi
xor    %esi,%esi
jmp    1173 <cov_rand_sp+0x63>
mov    $0xffffff82,%edi
mov    $0xffffffc1,%esi
call   1030 <cov_rand@plt>
xorps  0xe91(%rip),%xmm0
pop    %rax
ret
xorps  %xmm0,%xmm0
pop    %rax
ret
movsd  0xe72(%rip),%xmm0
pop    %rax
ret
mov    $0xffffff82,%edi
mov    $0xffffffc1,%esi
pop    %rax
jmp    1030 <cov_rand@plt>
mov    $0xffffffc1,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <cov_rand@plt>
xor    %edi,%edi
mov    $0x40,%esi
pop    %rax
jmp    1030 <cov_rand@plt>
mov    $0x40,%edi
mov    $0x7f,%esi
pop    %rax
jmp    1030 <cov_rand@plt>

LLVM IR (-O0):
define double @cov_rand_sp(i32 %0) {
%2 = alloca double
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %27 [
i32 0, label %5
i32 1, label %8
i32 2, label %11
i32 3, label %14
i32 4, label %17
i32 5, label %18
i32 6, label %19
i32 7, label %21
i32 8, label %23
i32 9, label %25
]
5: ; preds = %1
%6 = call double @cov_rand(i32 64, i32 127)
%7 = fmul double -1.000000e+00, %6
store double %7, double* %2
br label %31
8: ; preds = %1
%9 = call double @cov_rand(i32 0, i32 64)
%10 = fmul double -1.000000e+00, %9
store double %10, double* %2
br label %31
11: ; preds = %1
%12 = call double @cov_rand(i32 -63, i32 0)
%13 = fmul double -1.000000e+00, %12
store double %13, double* %2
br label %31
14: ; preds = %1
%15 = call double @cov_rand(i32 -126, i32 -63)
%16 = fmul double -1.000000e+00, %15
store double %16, double* %2
br label %31
17: ; preds = %1
store double 0.000000e+00, double* %2
br label %31
18: ; preds = %1
store double -0.000000e+00, double* %2
br label %31
19: ; preds = %1
%20 = call double @cov_rand(i32 -126, i32 -63)
store double %20, double* %2
br label %31
21: ; preds = %1
%22 = call double @cov_rand(i32 -63, i32 0)
store double %22, double* %2
br label %31
23: ; preds = %1
%24 = call double @cov_rand(i32 0, i32 64)
store double %24, double* %2
br label %31
25: ; preds = %1
%26 = call double @cov_rand(i32 64, i32 127)
store double %26, double* %2
br label %31
27: ; preds = %1
%28 = load i32, i32* %3
%29 = srem i32 %28, 10
%30 = call double @cov_rand_sp(i32 %29)
store double %30, double* %2
br label %31
31: ; preds = %27, %25, %23, %21, %19, %18, %17, %14, %11, %8, %5
%32 = load double, double* %2
ret double %32
}

LLVM IR (-O2):
define double @cov_rand_sp(i32 %0) {
br label %2
2: ; preds = %24, %1
%3 = phi i32 [ %0, %1 ], [ %25, %24 ]
switch i32 %3, label %24 [
i32 0, label %4
i32 1, label %7
i32 2, label %10
i32 3, label %13
i32 4, label %26
i32 5, label %27
i32 6, label %16
i32 7, label %18
i32 8, label %20
i32 9, label %22
]
4: ; preds = %2
%5 = tail call double @cov_rand(i32 64, i32 127)
%6 = fneg double %5
br label %27
7: ; preds = %2
%8 = tail call double @cov_rand(i32 0, i32 64)
%9 = fneg double %8
br label %27
10: ; preds = %2
%11 = tail call double @cov_rand(i32 -63, i32 0)
%12 = fneg double %11
br label %27
13: ; preds = %2
%14 = tail call double @cov_rand(i32 -126, i32 -63)
%15 = fneg double %14
br label %27
16: ; preds = %2
%17 = tail call double @cov_rand(i32 -126, i32 -63)
br label %27
18: ; preds = %2
%19 = tail call double @cov_rand(i32 -63, i32 0)
br label %27
20: ; preds = %2
%21 = tail call double @cov_rand(i32 0, i32 64)
br label %27
22: ; preds = %2
%23 = tail call double @cov_rand(i32 64, i32 127)
br label %27
24: ; preds = %2
%25 = srem i32 %3, 10
br label %2
26: ; preds = %2
br label %27
27: ; preds = %2, %26, %22, %20, %18, %16, %13, %10, %7, %4
%28 = phi double [ %23, %22 ], [ %21, %20 ], [ %19, %18 ], [ %17, %16 ], [ %15, %13 ], [ %12, %10 ], [ %9, %7 ], [ %6, %4 ], [ 0.000000e+00, %26 ], [ -0.000000e+00, %2 ]
ret double %28
}