#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(int);
float Choose(float a, float b, float c, float d, float e, float f) {
  int r = Rand(6);
  if (r == 0)
    return a;
  else if (r == 1)
    return b;
  else if (r == 2)
    return c;
  else if (r == 3)
    return d;
  else if (r == 4)
    return e;
  else
    return f;
}


x86 assembly (clang, -O0):
<Choose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  %xmm4,-0x18(%rbp)
movss  %xmm5,-0x1c(%rbp)
mov    $0x6,%edi
call   1030 <Rand@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    115c <Choose+0x4c>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ca <Choose+0xba>
cmpl   $0x1,-0x20(%rbp)
jne    1175 <Choose+0x65>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ca <Choose+0xba>
cmpl   $0x2,-0x20(%rbp)
jne    118e <Choose+0x7e>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ca <Choose+0xba>
cmpl   $0x3,-0x20(%rbp)
jne    11a7 <Choose+0x97>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ca <Choose+0xba>
cmpl   $0x4,-0x20(%rbp)
jne    11c0 <Choose+0xb0>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ca <Choose+0xba>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Choose>:
sub    $0x18,%rsp
movss  %xmm5,(%rsp)
movss  %xmm4,0x10(%rsp)
movss  %xmm3,0xc(%rsp)
movss  %xmm2,0x8(%rsp)
movss  %xmm1,0x4(%rsp)
movss  %xmm0,0x14(%rsp)
mov    $0x6,%edi
call   1030 <Rand@plt>
cmp    $0x4,%eax
ja     1169 <Choose+0x59>
mov    %eax,%eax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
movss  0x14(%rsp),%xmm0
jmp    *%rax
movss  0x4(%rsp),%xmm0
add    $0x18,%rsp
ret
movss  (%rsp),%xmm0
add    $0x18,%rsp
ret
movss  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret
movss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret
movss  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @Choose(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i32
store float %0, float* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store float %4, float* %12
store float %5, float* %13
%15 = call i32 @Rand(i32 6)
store i32 %15, i32* %14
%16 = load i32, i32* %14
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %6
%19 = load float, float* %8
store float %19, float* %7
br label %42
20: ; preds = %6
%21 = load i32, i32* %14
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load float, float* %9
store float %24, float* %7
br label %42
25: ; preds = %20
%26 = load i32, i32* %14
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = load float, float* %10
store float %29, float* %7
br label %42
30: ; preds = %25
%31 = load i32, i32* %14
%32 = icmp eq i32 %31, 3
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = load float, float* %11
store float %34, float* %7
br label %42
35: ; preds = %30
%36 = load i32, i32* %14
%37 = icmp eq i32 %36, 4
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = load float, float* %12
store float %39, float* %7
br label %42
40: ; preds = %35
%41 = load float, float* %13
store float %41, float* %7
br label %42
42: ; preds = %40, %38, %33, %28, %23, %18
%43 = load float, float* %7
ret float %43
}

LLVM IR (-O2):
define float @Choose(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = tail call i32 @Rand(i32 6)
switch i32 %7, label %12 [
i32 0, label %13
i32 1, label %8
i32 2, label %9
i32 3, label %10
i32 4, label %11
]
8: ; preds = %6
br label %13
9: ; preds = %6
br label %13
10: ; preds = %6
br label %13
11: ; preds = %6
br label %13
12: ; preds = %6
br label %13
13: ; preds = %6, %12, %11, %10, %9, %8
%14 = phi float [ %1, %8 ], [ %2, %9 ], [ %3, %10 ], [ %4, %11 ], [ %5, %12 ], [ %0, %6 ]
ret float %14
}