#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t multiplex_4(uint32_t in0, uint32_t in1, uint32_t in2, uint32_t in3,
                     int selec) {
  if (selec == 0)
    return in0;
  if (selec == 1)
    return in1;
  if (selec == 2)
    return in2;
  if (selec == 3)
    return in3;
  if (selec > 3)
    return 0;
}


x86 assembly (clang, -O0):
<multiplex_4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1129 <multiplex_4+0x29>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1179 <multiplex_4+0x79>
cmpl   $0x1,-0x18(%rbp)
jne    113e <multiplex_4+0x3e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1179 <multiplex_4+0x79>
cmpl   $0x2,-0x18(%rbp)
jne    1153 <multiplex_4+0x53>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1179 <multiplex_4+0x79>
cmpl   $0x3,-0x18(%rbp)
jne    1168 <multiplex_4+0x68>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1179 <multiplex_4+0x79>
cmpl   $0x3,-0x18(%rbp)
jle    1179 <multiplex_4+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiplex_4>:
cmp    $0x3,%r8d
ja     111e <multiplex_4+0x1e>
mov    %edi,%eax
mov    %r8d,%edi
lea    0xeee(%rip),%r8
movslq (%r8,%rdi,4),%rdi
add    %r8,%rdi
jmp    *%rdi
mov    %esi,%eax
ret
xor    %eax,%eax
ret
mov    %edx,%eax
ret
mov    %ecx,%eax
ret

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

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