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


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)
mov    $0x5,%edi
call   1030 <Rand@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1157 <Choose+0x47>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ac <Choose+0x9c>
cmpl   $0x1,-0x1c(%rbp)
jne    1170 <Choose+0x60>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ac <Choose+0x9c>
cmpl   $0x2,-0x1c(%rbp)
jne    1189 <Choose+0x79>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ac <Choose+0x9c>
cmpl   $0x3,-0x1c(%rbp)
jne    11a2 <Choose+0x92>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ac <Choose+0x9c>
movss  -0x18(%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  %xmm4,0x4(%rsp)
movss  %xmm3,0x10(%rsp)
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0x14(%rsp)
mov    $0x5,%edi
call   1030 <Rand@plt>
cmp    $0x3,%eax
ja     1164 <Choose+0x54>
mov    %eax,%eax
lea    0xeb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
movss  0x14(%rsp),%xmm0
jmp    *%rax
movss  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret
movss  0x4(%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) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca i32
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
%13 = call i32 @Rand(i32 5)
store i32 %13, i32* %12
%14 = load i32, i32* %12
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %5
%17 = load float, float* %7
store float %17, float* %6
br label %35
18: ; preds = %5
%19 = load i32, i32* %12
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load float, float* %8
store float %22, float* %6
br label %35
23: ; preds = %18
%24 = load i32, i32* %12
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load float, float* %9
store float %27, float* %6
br label %35
28: ; preds = %23
%29 = load i32, i32* %12
%30 = icmp eq i32 %29, 3
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = load float, float* %10
store float %32, float* %6
br label %35
33: ; preds = %28
%34 = load float, float* %11
store float %34, float* %6
br label %35
35: ; preds = %33, %31, %26, %21, %16
%36 = load float, float* %6
ret float %36
}

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