#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 EXIT_SUCCESS;
int /*<<< orphan*/ be_bc(int *, int *);
int /*<<< orphan*/ be_dc(int *, int *);
scalar_t__ fork();
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int main(void) {
  int todc[2], fromdc[2];
  pipe(todc);
  pipe(fromdc);
  if (fork() == 0) {
    be_dc(todc, fromdc);
  } else {
    be_bc(todc, fromdc);
    wait(NULL);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <pipe@plt>
lea    -0x14(%rbp),%rdi
call   1040 <pipe@plt>
mov    $0x0,%al
call   1070 <fork@plt>
cmp    $0x0,%rax
jne    1194 <main+0x44>
lea    -0xc(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <be_dc@plt>
jmp    11aa <main+0x5a>
lea    -0xc(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <be_bc@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <wait@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
call   1040 <pipe@plt>
lea    0x8(%rsp),%rdi
call   1040 <pipe@plt>
xor    %eax,%eax
call   1070 <fork@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
test   %rax,%rax
je     118c <main+0x3c>
call   1030 <be_bc@plt>
xor    %edi,%edi
call   1060 <wait@plt>
jmp    1191 <main+0x41>
call   1050 <be_dc@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
store i32 0, i32* %1
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%5 = call i32 @pipe(i32* %4)
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%7 = call i32 @pipe(i32* %6)
%8 = call i64 (...) @fork()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%13 = call i32 @be_dc(i32* %11, i32* %12)
br label %19
14: ; preds = %0
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%17 = call i32 @be_bc(i32* %15, i32* %16)
%18 = call i32 @wait(i32* null)
br label %19
19: ; preds = %14, %10
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca [2 x i32]
%3 = bitcast [2 x i32]* %1 to i8*
%4 = bitcast [2 x i32]* %2 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%6 = call i32 @pipe(i32* %5)
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%8 = call i32 @pipe(i32* %7)
%9 = call i64 (...) @fork()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @be_dc(i32* %5, i32* %7)
br label %16
13: ; preds = %0
%14 = call i32 @be_bc(i32* %5, i32* %7)
%15 = call i32 @wait(i32* null)
br label %16
16: ; preds = %13, %11
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}