#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 MUX2way(int, int, int);
int MUX8way(int, int, int, int, int, int, int, int, int);
int get_bit(int, int);
int MUX16way(int A, int B, int C, int D, int E, int F, int G, int H, int L,
             int M, int N, int O, int P, int Q, int R, int S, int select) {
  int output, final_select;
  int Atemp, Btemp;
  Atemp = MUX8way(A, B, C, D, E, F, G, H, select);
  Btemp = MUX8way(L, M, N, O, P, Q, R, S, select);
  final_select = get_bit(select, 3);
  output = MUX2way(Atemp, Btemp, final_select);
  return output;
}


x86 assembly (clang, -O0):
<MUX16way>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x60(%rbp),%eax
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    0x10(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x60(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <MUX8way@plt>
mov    %eax,-0x24(%rbp)
mov    0x20(%rbp),%edi
mov    0x28(%rbp),%esi
mov    0x30(%rbp),%edx
mov    0x38(%rbp),%ecx
mov    0x40(%rbp),%r8d
mov    0x48(%rbp),%r9d
mov    0x50(%rbp),%r11d
mov    0x58(%rbp),%r10d
mov    0x60(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <MUX8way@plt>
mov    %eax,-0x28(%rbp)
mov    0x60(%rbp),%edi
mov    $0x3,%esi
call   1050 <get_bit@plt>
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1030 <MUX2way@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MUX16way>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x70(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x78(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x80(%rsp),%r15d
mov    0x88(%rsp),%r12d
mov    0x90(%rsp),%r13d
mov    0x98(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0xa0(%rsp),%eax
mov    %rax,0x20(%rsp)
mov    0xa8(%rsp),%eax
mov    %rax,0x18(%rsp)
mov    0x60(%rsp),%eax
mov    0x68(%rsp),%ebp
mov    0xb0(%rsp),%ebx
sub    $0x8,%rsp
push   %rbx
push   %rbp
push   %rax
call   1040 <MUX8way@plt>
add    $0x20,%rsp
mov    %eax,%r14d
sub    $0x8,%rsp
mov    0x1c(%rsp),%edi
mov    0x18(%rsp),%esi
mov    %r15d,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    0x14(%rsp),%r9d
push   %rbx
push   0x28(%rsp)
push   0x38(%rsp)
call   1040 <MUX8way@plt>
add    $0x20,%rsp
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x3,%esi
call   1050 <get_bit@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <MUX2way@plt>

LLVM IR (-O0):
define i32 @MUX16way(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16) {
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
store i32 %0, i32* %18
store i32 %1, i32* %19
store i32 %2, i32* %20
store i32 %3, i32* %21
store i32 %4, i32* %22
store i32 %5, i32* %23
store i32 %6, i32* %24
store i32 %7, i32* %25
store i32 %8, i32* %26
store i32 %9, i32* %27
store i32 %10, i32* %28
store i32 %11, i32* %29
store i32 %12, i32* %30
store i32 %13, i32* %31
store i32 %14, i32* %32
store i32 %15, i32* %33
store i32 %16, i32* %34
%39 = load i32, i32* %18
%40 = load i32, i32* %19
%41 = load i32, i32* %20
%42 = load i32, i32* %21
%43 = load i32, i32* %22
%44 = load i32, i32* %23
%45 = load i32, i32* %24
%46 = load i32, i32* %25
%47 = load i32, i32* %34
%48 = call i32 @MUX8way(i32 %39, i32 %40, i32 %41, i32 %42, i32 %43, i32 %44, i32 %45, i32 %46, i32 %47)
store i32 %48, i32* %37
%49 = load i32, i32* %26
%50 = load i32, i32* %27
%51 = load i32, i32* %28
%52 = load i32, i32* %29
%53 = load i32, i32* %30
%54 = load i32, i32* %31
%55 = load i32, i32* %32
%56 = load i32, i32* %33
%57 = load i32, i32* %34
%58 = call i32 @MUX8way(i32 %49, i32 %50, i32 %51, i32 %52, i32 %53, i32 %54, i32 %55, i32 %56, i32 %57)
store i32 %58, i32* %38
%59 = load i32, i32* %34
%60 = call i32 @get_bit(i32 %59, i32 3)
store i32 %60, i32* %36
%61 = load i32, i32* %37
%62 = load i32, i32* %38
%63 = load i32, i32* %36
%64 = call i32 @MUX2way(i32 %61, i32 %62, i32 %63)
store i32 %64, i32* %35
%65 = load i32, i32* %35
ret i32 %65
}

LLVM IR (-O2):
define i32 @MUX16way(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16) {
%18 = tail call i32 @MUX8way(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %16)
%19 = tail call i32 @MUX8way(i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16)
%20 = tail call i32 @get_bit(i32 %16, i32 3)
%21 = tail call i32 @MUX2way(i32 %18, i32 %19, i32 %20)
ret i32 %21
}