#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 rand();
float change_speed() {
  switch (rand() % 7) {
  case 0:
    return 0.6f;
  case 1:
    return 0.7f;
  case 2:
    return 0.9f;
  case 3:
    return 1.4f;
  case 4:
    return 1.6f;
  case 5:
    return 1.8f;
  default:
    break;
  }
  return 1.0f;
}


x86 assembly (clang, -O0):
<change_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rcx
imul   $0xffffffff92492493,%rcx,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x3,%edx
sub    %edx,%ecx
add    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5,%eax
ja     11d1 <change_speed+0xc1>
mov    -0x10(%rbp),%rax
lea    0xec0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xea7(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e3 <change_speed+0xd3>
movss  0xe91(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e3 <change_speed+0xd3>
movss  0xe7b(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e3 <change_speed+0xd3>
movss  0xe65(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e3 <change_speed+0xd3>
movss  0xe4f(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e3 <change_speed+0xd3>
movss  0xe39(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e3 <change_speed+0xd3>
jmp    11d6 <change_speed+0xc6>
movss  0xe3a(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_speed>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rcx
imul   $0xffffffff92492493,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x2,%eax
add    %edx,%eax
lea    0x0(,%rax,8),%edx
sub    %edx,%eax
add    %ecx,%eax
cmp    $0x5,%eax
ja     1152 <change_speed+0x42>
cltq
lea    0xeb9(%rip),%rcx
movss  (%rcx,%rax,4),%xmm0
pop    %rax
ret
movss  0xea6(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @change_speed() {
%1 = alloca float
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 7
switch i32 %3, label %10 [
i32 0, label %4
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 5, label %9
]
4: ; preds = %0
store float 0x3FE3333340000000, float* %1
br label %12
5: ; preds = %0
store float 0x3FE6666660000000, float* %1
br label %12
6: ; preds = %0
store float 0x3FECCCCCC0000000, float* %1
br label %12
7: ; preds = %0
store float 0x3FF6666660000000, float* %1
br label %12
8: ; preds = %0
store float 0x3FF99999A0000000, float* %1
br label %12
9: ; preds = %0
store float 0x3FFCCCCCC0000000, float* %1
br label %12
10: ; preds = %0
br label %11
11: ; preds = %10
store float 1.000000e+00, float* %1
br label %12
12: ; preds = %11, %9, %8, %7, %6, %5, %4
%13 = load float, float* %1
ret float %13
}

LLVM IR (-O2):
@switch.table.change_speed = [6 x float] [float 0x3FE3333340000000, float 0x3FE6666660000000, float 0x3FECCCCCC0000000, float 0x3FF6666660000000, float 0x3FF99999A0000000, float 0x3FFCCCCCC0000000]
define float @change_speed() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 7
%3 = icmp ult i32 %2, 6
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [6 x float], [6 x float]* @switch.table.change_speed, i64 0, i64 %5
%7 = load float, float* %6
br label %8
8: ; preds = %0, %4
%9 = phi float [ %7, %4 ], [ 1.000000e+00, %0 ]
ret float %9
}