#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 gAnd4Way(int const, int const, int const, int const);
int gNot(int const);
int gOr8Way(int, int, int, int, int, int, int, int);
void mux8Way16(const int s2, const int s1, const int s0, const int *a,
               const int *b, const int *c, const int *d, const int *e,
               const int *f, const int *g, const int *h, int *out) {
  int notS0 = gNot(s0);
  int notS1 = gNot(s1);
  int notS2 = gNot(s2);
  int i = 0;
  for (i = 0; i < 16; i++) {
    int bitA = gAnd4Way(notS2, notS1, notS0, a[i]);
    int bitB = gAnd4Way(notS2, notS1, s0, b[i]);
    int bitC = gAnd4Way(notS2, s1, notS0, c[i]);
    int bitD = gAnd4Way(notS2, s1, s0, d[i]);
    int bitE = gAnd4Way(s2, notS1, notS0, e[i]);
    int bitF = gAnd4Way(s2, notS1, s0, f[i]);
    int bitG = gAnd4Way(s2, s1, notS0, g[i]);
    int bitH = gAnd4Way(s2, s1, s0, h[i]);
    out[i] = gOr8Way(bitA, bitB, bitC, bitD, bitE, bitF, bitG, bitH);
  }
}


x86 assembly (clang, -O0):
<mux8Way16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <gNot@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <gNot@plt>
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <gNot@plt>
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x10,-0x38(%rbp)
jge    12c1 <mux8Way16+0x191>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1050 <gAnd4Way@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1050 <gAnd4Way@plt>
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1050 <gAnd4Way@plt>
mov    %eax,-0x44(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1050 <gAnd4Way@plt>
mov    %eax,-0x48(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1050 <gAnd4Way@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1050 <gAnd4Way@plt>
mov    %eax,-0x50(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1050 <gAnd4Way@plt>
mov    %eax,-0x54(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1050 <gAnd4Way@plt>
mov    %eax,-0x58(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
mov    -0x44(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
mov    -0x50(%rbp),%r9d
mov    -0x54(%rbp),%r10d
mov    -0x58(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <gOr8Way@plt>
mov    %eax,%edx
mov    0x38(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1194 <mux8Way16+0x64>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mux8Way16>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x40(%rsp)
mov    %r8,0x38(%rsp)
mov    %rcx,0x30(%rsp)
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edx,0x14(%rsp)
mov    %edx,%edi
call   1040 <gNot@plt>
mov    %eax,(%rsp)
mov    %ebx,0x10(%rsp)
mov    %ebx,%edi
call   1040 <gNot@plt>
mov    %eax,0x8(%rsp)
mov    %ebp,0xc(%rsp)
mov    %ebp,%edi
call   1040 <gNot@plt>
mov    %eax,0x4(%rsp)
xor    %ebx,%ebx
mov    0x14(%rsp),%r15d
mov    0x10(%rsp),%r12d
nopl   0x0(%rax)
mov    0x30(%rsp),%rax
mov    (%rax,%rbx,1),%ecx
mov    0x4(%rsp),%ebp
mov    %ebp,%edi
mov    0x8(%rsp),%r14d
mov    %r14d,%esi
mov    (%rsp),%r13d
mov    %r13d,%edx
call   1050 <gAnd4Way@plt>
mov    %eax,0x2c(%rsp)
mov    0x38(%rsp),%rax
mov    (%rax,%rbx,1),%ecx
mov    %ebp,%edi
mov    %r14d,%esi
mov    %r15d,%edx
call   1050 <gAnd4Way@plt>
mov    %eax,0x28(%rsp)
mov    0x40(%rsp),%rax
mov    (%rax,%rbx,1),%ecx
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r13d,%edx
call   1050 <gAnd4Way@plt>
mov    %eax,0x24(%rsp)
mov    0x80(%rsp),%rax
mov    (%rax,%rbx,1),%ecx
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r15d,%edx
call   1050 <gAnd4Way@plt>
mov    %eax,0x20(%rsp)
mov    0x88(%rsp),%rax
mov    (%rax,%rbx,1),%ecx
mov    0xc(%rsp),%r13d
mov    %r13d,%edi
mov    %r14d,%esi
mov    (%rsp),%ebp
mov    %ebp,%edx
call   1050 <gAnd4Way@plt>
mov    %eax,0x1c(%rsp)
mov    0x90(%rsp),%rax
mov    (%rax,%rbx,1),%ecx
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r15d,%edx
call   1050 <gAnd4Way@plt>
mov    %eax,0x18(%rsp)
mov    0x98(%rsp),%rax
mov    (%rax,%rbx,1),%ecx
mov    %r13d,%edi
mov    %r12d,%esi
mov    %ebp,%edx
call   1050 <gAnd4Way@plt>
mov    %eax,%r14d
mov    0xa0(%rsp),%rax
mov    (%rax,%rbx,1),%ecx
mov    %r13d,%edi
mov    %r12d,%esi
mov    %r15d,%edx
call   1050 <gAnd4Way@plt>
mov    0x2c(%rsp),%edi
mov    0x28(%rsp),%esi
mov    0x24(%rsp),%edx
mov    0x20(%rsp),%ecx
mov    0x1c(%rsp),%r8d
mov    0x18(%rsp),%r9d
push   %rax
push   %r14
call   1030 <gOr8Way@plt>
add    $0x10,%rsp
mov    0xa8(%rsp),%rcx
mov    %eax,(%rcx,%rbx,1)
add    $0x4,%rbx
cmp    $0x40,%rbx
jne    1190 <mux8Way16+0x60>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @mux8Way16(i32 %0, i32 %1, i32 %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11) {
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32*
%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
store i32 %0, i32* %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store i32* %3, i32** %16
store i32* %4, i32** %17
store i32* %5, i32** %18
store i32* %6, i32** %19
store i32* %7, i32** %20
store i32* %8, i32** %21
store i32* %9, i32** %22
store i32* %10, i32** %23
store i32* %11, i32** %24
%37 = load i32, i32* %15
%38 = call i32 @gNot(i32 %37)
store i32 %38, i32* %25
%39 = load i32, i32* %14
%40 = call i32 @gNot(i32 %39)
store i32 %40, i32* %26
%41 = load i32, i32* %13
%42 = call i32 @gNot(i32 %41)
store i32 %42, i32* %27
store i32 0, i32* %28
store i32 0, i32* %28
br label %43
43: ; preds = %132, %12
%44 = load i32, i32* %28
%45 = icmp slt i32 %44, 16
br i1 %45, label %46, label %135
46: ; preds = %43
%47 = load i32, i32* %27
%48 = load i32, i32* %26
%49 = load i32, i32* %25
%50 = load i32*, i32** %16
%51 = load i32, i32* %28
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
%54 = load i32, i32* %53
%55 = call i32 @gAnd4Way(i32 %47, i32 %48, i32 %49, i32 %54)
store i32 %55, i32* %29
%56 = load i32, i32* %27
%57 = load i32, i32* %26
%58 = load i32, i32* %15
%59 = load i32*, i32** %17
%60 = load i32, i32* %28
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
%63 = load i32, i32* %62
%64 = call i32 @gAnd4Way(i32 %56, i32 %57, i32 %58, i32 %63)
store i32 %64, i32* %30
%65 = load i32, i32* %27
%66 = load i32, i32* %14
%67 = load i32, i32* %25
%68 = load i32*, i32** %18
%69 = load i32, i32* %28
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i32, i32* %68, i64 %70
%72 = load i32, i32* %71
%73 = call i32 @gAnd4Way(i32 %65, i32 %66, i32 %67, i32 %72)
store i32 %73, i32* %31
%74 = load i32, i32* %27
%75 = load i32, i32* %14
%76 = load i32, i32* %15
%77 = load i32*, i32** %19
%78 = load i32, i32* %28
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %77, i64 %79
%81 = load i32, i32* %80
%82 = call i32 @gAnd4Way(i32 %74, i32 %75, i32 %76, i32 %81)
store i32 %82, i32* %32
%83 = load i32, i32* %13
%84 = load i32, i32* %26
%85 = load i32, i32* %25
%86 = load i32*, i32** %20
%87 = load i32, i32* %28
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i32, i32* %86, i64 %88
%90 = load i32, i32* %89
%91 = call i32 @gAnd4Way(i32 %83, i32 %84, i32 %85, i32 %90)
store i32 %91, i32* %33
%92 = load i32, i32* %13
%93 = load i32, i32* %26
%94 = load i32, i32* %15
%95 = load i32*, i32** %21
%96 = load i32, i32* %28
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i32, i32* %95, i64 %97
%99 = load i32, i32* %98
%100 = call i32 @gAnd4Way(i32 %92, i32 %93, i32 %94, i32 %99)
store i32 %100, i32* %34
%101 = load i32, i32* %13
%102 = load i32, i32* %14
%103 = load i32, i32* %25
%104 = load i32*, i32** %22
%105 = load i32, i32* %28
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i32, i32* %104, i64 %106
%108 = load i32, i32* %107
%109 = call i32 @gAnd4Way(i32 %101, i32 %102, i32 %103, i32 %108)
store i32 %109, i32* %35
%110 = load i32, i32* %13
%111 = load i32, i32* %14
%112 = load i32, i32* %15
%113 = load i32*, i32** %23
%114 = load i32, i32* %28
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i32, i32* %113, i64 %115
%117 = load i32, i32* %116
%118 = call i32 @gAnd4Way(i32 %110, i32 %111, i32 %112, i32 %117)
store i32 %118, i32* %36
%119 = load i32, i32* %29
%120 = load i32, i32* %30
%121 = load i32, i32* %31
%122 = load i32, i32* %32
%123 = load i32, i32* %33
%124 = load i32, i32* %34
%125 = load i32, i32* %35
%126 = load i32, i32* %36
%127 = call i32 @gOr8Way(i32 %119, i32 %120, i32 %121, i32 %122, i32 %123, i32 %124, i32 %125, i32 %126)
%128 = load i32*, i32** %24
%129 = load i32, i32* %28
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %128, i64 %130
store i32 %127, i32* %131
br label %132
132: ; preds = %46
%133 = load i32, i32* %28
%134 = add nsw i32 %133, 1
store i32 %134, i32* %28
br label %43
135: ; preds = %43
ret void
}

LLVM IR (-O2):
define void @mux8Way16(i32 %0, i32 %1, i32 %2, i32* nocapture %3, i32* nocapture %4, i32* nocapture %5, i32* nocapture %6, i32* nocapture %7, i32* nocapture %8, i32* nocapture %9, i32* nocapture %10, i32* nocapture writeonly %11) {
%13 = tail call i32 @gNot(i32 %2)
%14 = tail call i32 @gNot(i32 %1)
%15 = tail call i32 @gNot(i32 %0)
br label %16
16: ; preds = %12, %16
%17 = phi i64 [ 0, %12 ], [ %44, %16 ]
%18 = getelementptr inbounds i32, i32* %3, i64 %17
%19 = load i32, i32* %18
%20 = tail call i32 @gAnd4Way(i32 %15, i32 %14, i32 %13, i32 %19)
%21 = getelementptr inbounds i32, i32* %4, i64 %17
%22 = load i32, i32* %21
%23 = tail call i32 @gAnd4Way(i32 %15, i32 %14, i32 %2, i32 %22)
%24 = getelementptr inbounds i32, i32* %5, i64 %17
%25 = load i32, i32* %24
%26 = tail call i32 @gAnd4Way(i32 %15, i32 %1, i32 %13, i32 %25)
%27 = getelementptr inbounds i32, i32* %6, i64 %17
%28 = load i32, i32* %27
%29 = tail call i32 @gAnd4Way(i32 %15, i32 %1, i32 %2, i32 %28)
%30 = getelementptr inbounds i32, i32* %7, i64 %17
%31 = load i32, i32* %30
%32 = tail call i32 @gAnd4Way(i32 %0, i32 %14, i32 %13, i32 %31)
%33 = getelementptr inbounds i32, i32* %8, i64 %17
%34 = load i32, i32* %33
%35 = tail call i32 @gAnd4Way(i32 %0, i32 %14, i32 %2, i32 %34)
%36 = getelementptr inbounds i32, i32* %9, i64 %17
%37 = load i32, i32* %36
%38 = tail call i32 @gAnd4Way(i32 %0, i32 %1, i32 %13, i32 %37)
%39 = getelementptr inbounds i32, i32* %10, i64 %17
%40 = load i32, i32* %39
%41 = tail call i32 @gAnd4Way(i32 %0, i32 %1, i32 %2, i32 %40)
%42 = tail call i32 @gOr8Way(i32 %20, i32 %23, i32 %26, i32 %29, i32 %32, i32 %35, i32 %38, i32 %41)
%43 = getelementptr inbounds i32, i32* %11, i64 %17
store i32 %42, i32* %43
%44 = add nuw nsw i64 %17, 1
%45 = icmp eq i64 %44, 16
br i1 %45, label %46, label %16
46: ; preds = %16
ret void
}