#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);
void demux8Way(const int s2, const int s1, const int s0, const int in,
               int *out1, int *out2, int *out3, int *out4, int *out5, int *out6,
               int *out7, int *out8) {
  int notS0 = gNot(s0);
  int notS1 = gNot(s1);
  int notS2 = gNot(s2);
  *out1 = gAnd4Way(notS2, notS1, notS0, in);
  *out2 = gAnd4Way(notS2, notS1, s0, in);
  *out3 = gAnd4Way(notS2, s1, notS0, in);
  *out4 = gAnd4Way(notS2, s1, s0, in);
  *out5 = gAnd4Way(s2, notS1, notS0, in);
  *out6 = gAnd4Way(s2, notS1, s0, in);
  *out7 = gAnd4Way(s2, s1, notS0, in);
  *out8 = gAnd4Way(s2, s1, s0, in);
}


x86 assembly (clang, -O0):
<demux8Way>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <gNot@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <gNot@plt>
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <gNot@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <gAnd4Way@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <gAnd4Way@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <gAnd4Way@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <gAnd4Way@plt>
mov    %eax,%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <gAnd4Way@plt>
mov    %eax,%ecx
mov    0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <gAnd4Way@plt>
mov    %eax,%ecx
mov    0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <gAnd4Way@plt>
mov    %eax,%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <gAnd4Way@plt>
mov    %eax,%ecx
mov    0x38(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<demux8Way>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,0x18(%rsp)
mov    %ecx,%ebx
mov    %edx,0xc(%rsp)
mov    %esi,%ebp
mov    %esi,0x10(%rsp)
mov    %edi,%r14d
mov    %edi,0x14(%rsp)
mov    %edx,%edi
call   1030 <gNot@plt>
mov    %eax,%r13d
mov    %ebp,%edi
call   1030 <gNot@plt>
mov    %eax,%r15d
mov    %r14d,%edi
call   1030 <gNot@plt>
mov    %eax,%r14d
mov    %eax,%edi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r13d,0x8(%rsp)
mov    %ebx,%ecx
call   1040 <gAnd4Way@plt>
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r14d,%edi
mov    %r15d,%esi
mov    0xc(%rsp),%ebp
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <gAnd4Way@plt>
mov    0x20(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r14d,%edi
mov    0x10(%rsp),%r12d
mov    %r12d,%esi
mov    %r13d,%edx
mov    %ebx,%ecx
call   1040 <gAnd4Way@plt>
mov    0x60(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r14d,%edi
mov    %r12d,%r14d
mov    %r12d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <gAnd4Way@plt>
mov    0x68(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x14(%rsp),%r13d
mov    %r13d,%edi
mov    %r15d,%esi
mov    0x8(%rsp),%r12d
mov    %r12d,%edx
mov    %ebx,%ecx
call   1040 <gAnd4Way@plt>
mov    0x70(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r13d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <gAnd4Way@plt>
mov    0x78(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1040 <gAnd4Way@plt>
mov    0x80(%rsp),%rcx
mov    %eax,(%rcx)
mov    %r13d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <gAnd4Way@plt>
mov    0x88(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @demux8Way(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
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
%28 = load i32, i32* %15
%29 = call i32 @gNot(i32 %28)
store i32 %29, i32* %25
%30 = load i32, i32* %14
%31 = call i32 @gNot(i32 %30)
store i32 %31, i32* %26
%32 = load i32, i32* %13
%33 = call i32 @gNot(i32 %32)
store i32 %33, i32* %27
%34 = load i32, i32* %27
%35 = load i32, i32* %26
%36 = load i32, i32* %25
%37 = load i32, i32* %16
%38 = call i32 @gAnd4Way(i32 %34, i32 %35, i32 %36, i32 %37)
%39 = load i32*, i32** %17
store i32 %38, i32* %39
%40 = load i32, i32* %27
%41 = load i32, i32* %26
%42 = load i32, i32* %15
%43 = load i32, i32* %16
%44 = call i32 @gAnd4Way(i32 %40, i32 %41, i32 %42, i32 %43)
%45 = load i32*, i32** %18
store i32 %44, i32* %45
%46 = load i32, i32* %27
%47 = load i32, i32* %14
%48 = load i32, i32* %25
%49 = load i32, i32* %16
%50 = call i32 @gAnd4Way(i32 %46, i32 %47, i32 %48, i32 %49)
%51 = load i32*, i32** %19
store i32 %50, i32* %51
%52 = load i32, i32* %27
%53 = load i32, i32* %14
%54 = load i32, i32* %15
%55 = load i32, i32* %16
%56 = call i32 @gAnd4Way(i32 %52, i32 %53, i32 %54, i32 %55)
%57 = load i32*, i32** %20
store i32 %56, i32* %57
%58 = load i32, i32* %13
%59 = load i32, i32* %26
%60 = load i32, i32* %25
%61 = load i32, i32* %16
%62 = call i32 @gAnd4Way(i32 %58, i32 %59, i32 %60, i32 %61)
%63 = load i32*, i32** %21
store i32 %62, i32* %63
%64 = load i32, i32* %13
%65 = load i32, i32* %26
%66 = load i32, i32* %15
%67 = load i32, i32* %16
%68 = call i32 @gAnd4Way(i32 %64, i32 %65, i32 %66, i32 %67)
%69 = load i32*, i32** %22
store i32 %68, i32* %69
%70 = load i32, i32* %13
%71 = load i32, i32* %14
%72 = load i32, i32* %25
%73 = load i32, i32* %16
%74 = call i32 @gAnd4Way(i32 %70, i32 %71, i32 %72, i32 %73)
%75 = load i32*, i32** %23
store i32 %74, i32* %75
%76 = load i32, i32* %13
%77 = load i32, i32* %14
%78 = load i32, i32* %15
%79 = load i32, i32* %16
%80 = call i32 @gAnd4Way(i32 %76, i32 %77, i32 %78, i32 %79)
%81 = load i32*, i32** %24
store i32 %80, i32* %81
ret void
}

LLVM IR (-O2):
define void @demux8Way(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7, i32* nocapture writeonly %8, i32* nocapture writeonly %9, i32* nocapture writeonly %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)
%16 = tail call i32 @gAnd4Way(i32 %15, i32 %14, i32 %13, i32 %3)
store i32 %16, i32* %4
%17 = tail call i32 @gAnd4Way(i32 %15, i32 %14, i32 %2, i32 %3)
store i32 %17, i32* %5
%18 = tail call i32 @gAnd4Way(i32 %15, i32 %1, i32 %13, i32 %3)
store i32 %18, i32* %6
%19 = tail call i32 @gAnd4Way(i32 %15, i32 %1, i32 %2, i32 %3)
store i32 %19, i32* %7
%20 = tail call i32 @gAnd4Way(i32 %0, i32 %14, i32 %13, i32 %3)
store i32 %20, i32* %8
%21 = tail call i32 @gAnd4Way(i32 %0, i32 %14, i32 %2, i32 %3)
store i32 %21, i32* %9
%22 = tail call i32 @gAnd4Way(i32 %0, i32 %1, i32 %13, i32 %3)
store i32 %22, i32* %10
%23 = tail call i32 @gAnd4Way(i32 %0, i32 %1, i32 %2, i32 %3)
store i32 %23, i32* %11
ret void
}