#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 const gAnd(int const, int const);
int gNot(int const);
void demux4Way(const int s1, const int s0, const int in, int *out1, int *out2,
               int *out3, int *out4) {
  int notS0 = gNot(s0);
  int notS1 = gNot(s1);
  *out1 = gAnd(gAnd(notS1, notS0), in);
  *out2 = gAnd(gAnd(notS1, s0), in);
  *out3 = gAnd(gAnd(s1, notS0), in);
  *out4 = gAnd(gAnd(s1, s0), in);
}


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

x86 assembly (clang, -O2):
<demux4Way>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %rcx,%r14
mov    %edx,%ebx
mov    %esi,%r15d
mov    %edi,%ebp
mov    %esi,%edi
call   1030 <gNot@plt>
mov    %eax,%r13d
mov    %ebp,%edi
call   1030 <gNot@plt>
mov    %eax,%r12d
mov    %eax,%edi
mov    %r13d,%esi
call   1040 <gAnd@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <gAnd@plt>
mov    %eax,(%r14)
mov    %r12d,%edi
mov    %r15d,%esi
call   1040 <gAnd@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <gAnd@plt>
mov    0x8(%rsp),%rcx
mov    %eax,(%rcx)
mov    %ebp,%edi
mov    %r13d,%esi
call   1040 <gAnd@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <gAnd@plt>
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
mov    %ebp,%edi
mov    %r15d,%esi
call   1040 <gAnd@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <gAnd@plt>
mov    0x50(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @demux4Way(i32 %0, i32 %1, i32 %2, i32* %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32* %3, i32** %11
store i32* %4, i32** %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%17 = load i32, i32* %9
%18 = call i32 @gNot(i32 %17)
store i32 %18, i32* %15
%19 = load i32, i32* %8
%20 = call i32 @gNot(i32 %19)
store i32 %20, i32* %16
%21 = load i32, i32* %16
%22 = load i32, i32* %15
%23 = call i32 @gAnd(i32 %21, i32 %22)
%24 = load i32, i32* %10
%25 = call i32 @gAnd(i32 %23, i32 %24)
%26 = load i32*, i32** %11
store i32 %25, i32* %26
%27 = load i32, i32* %16
%28 = load i32, i32* %9
%29 = call i32 @gAnd(i32 %27, i32 %28)
%30 = load i32, i32* %10
%31 = call i32 @gAnd(i32 %29, i32 %30)
%32 = load i32*, i32** %12
store i32 %31, i32* %32
%33 = load i32, i32* %8
%34 = load i32, i32* %15
%35 = call i32 @gAnd(i32 %33, i32 %34)
%36 = load i32, i32* %10
%37 = call i32 @gAnd(i32 %35, i32 %36)
%38 = load i32*, i32** %13
store i32 %37, i32* %38
%39 = load i32, i32* %8
%40 = load i32, i32* %9
%41 = call i32 @gAnd(i32 %39, i32 %40)
%42 = load i32, i32* %10
%43 = call i32 @gAnd(i32 %41, i32 %42)
%44 = load i32*, i32** %14
store i32 %43, i32* %44
ret void
}

LLVM IR (-O2):
define void @demux4Way(i32 %0, i32 %1, i32 %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6) {
%8 = tail call i32 @gNot(i32 %1)
%9 = tail call i32 @gNot(i32 %0)
%10 = tail call i32 @gAnd(i32 %9, i32 %8)
%11 = tail call i32 @gAnd(i32 %10, i32 %2)
store i32 %11, i32* %3
%12 = tail call i32 @gAnd(i32 %9, i32 %1)
%13 = tail call i32 @gAnd(i32 %12, i32 %2)
store i32 %13, i32* %4
%14 = tail call i32 @gAnd(i32 %0, i32 %8)
%15 = tail call i32 @gAnd(i32 %14, i32 %2)
store i32 %15, i32* %5
%16 = tail call i32 @gAnd(i32 %0, i32 %1)
%17 = tail call i32 @gAnd(i32 %16, i32 %2)
store i32 %17, i32* %6
ret void
}