#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 /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ mkfifo(char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  int fd1, fd2;
  mkfifo("in1", 0644);
  mkfifo("in2", 0644);
  fd1 = open("in1", O_WRONLY);
  fd2 = open("in2", O_WRONLY);
  getchar();
  write(fd1, "10", 2);
  write(fd2, "20", 2);
  getchar();
  write(fd2, "4", 1);
  write(fd1, "1", 1);
  close(fd1);
  close(fd2);
  unlink("in1");
  unlink("in2");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x1a4,%esi
call   1070 <mkfifo@plt>
lea    0xe7d(%rip),%rdi
mov    $0x1a4,%esi
call   1070 <mkfifo@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%esi
lea    0xe5f(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e28(%rip),%rax
mov    (%rax),%esi
lea    0xe4b(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0x8(%rbp),%edi
lea    0xe36(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0xc(%rbp),%edi
lea    0xe25(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0xc(%rbp),%edi
lea    0xe0d(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    -0x8(%rbp),%edi
lea    0xded(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
mov    -0xc(%rbp),%edi
call   1050 <close@plt>
lea    0xdca(%rip),%rdi
call   1030 <unlink@plt>
lea    0xdc2(%rip),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe92(%rip),%r14
mov    %r14,%rdi
mov    $0x1a4,%esi
call   1070 <mkfifo@plt>
lea    0xe82(%rip),%r15
mov    %r15,%rdi
mov    $0x1a4,%esi
call   1070 <mkfifo@plt>
mov    0x2e42(%rip),%rbx
mov    (%rbx),%esi
mov    %r14,%rdi
call   1080 <open@plt>
mov    %eax,%ebp
mov    (%rbx),%esi
mov    %r15,%rdi
call   1080 <open@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe4c(%rip),%rsi
mov    %ebp,%edi
mov    $0x2,%edx
call   1040 <write@plt>
lea    0xe3c(%rip),%rsi
mov    %ebx,%edi
mov    $0x2,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xe25(%rip),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
call   1040 <write@plt>
lea    0xe06(%rip),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %ebp,%edi
call   1050 <close@plt>
mov    %ebx,%edi
call   1050 <close@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
mov    %r15,%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"in1\00"
@.str.1 = [4 x i8] c"in2\00"
@O_WRONLY = global i32 0
@.str.2 = [3 x i8] c"10\00"
@.str.3 = [3 x i8] c"20\00"
@.str.4 = [2 x i8] c"4\00"
@.str.5 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @mkfifo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 420)
%5 = call i32 @mkfifo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 420)
%6 = load i32, i32* @O_WRONLY
%7 = call i32 @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 %7, i32* %2
%8 = load i32, i32* @O_WRONLY
%9 = call i32 @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
store i32 %9, i32* %3
%10 = call i32 (...) @getchar()
%11 = load i32, i32* %2
%12 = call i32 @write(i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%13 = load i32, i32* %3
%14 = call i32 @write(i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%15 = call i32 (...) @getchar()
%16 = load i32, i32* %3
%17 = call i32 @write(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%18 = load i32, i32* %2
%19 = call i32 @write(i32 %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%20 = load i32, i32* %2
%21 = call i32 @close(i32 %20)
%22 = load i32, i32* %3
%23 = call i32 @close(i32 %22)
%24 = call i32 @unlink(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @unlink(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"in1\00"
@.str.1 = [4 x i8] c"in2\00"
@O_WRONLY = global i32 0
@.str.2 = [3 x i8] c"10\00"
@.str.3 = [3 x i8] c"20\00"
@.str.4 = [2 x i8] c"4\00"
@.str.5 = [2 x i8] c"1\00"
define i32 @main() {
%1 = tail call i32 @mkfifo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 420)
%2 = tail call i32 @mkfifo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 420)
%3 = load i32, i32* @O_WRONLY
%4 = tail call i32 @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @O_WRONLY
%6 = tail call i32 @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @getchar()
%8 = tail call i32 @write(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%9 = tail call i32 @write(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%10 = tail call i32 (...) @getchar()
%11 = tail call i32 @write(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%12 = tail call i32 @write(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%13 = tail call i32 @close(i32 %4)
%14 = tail call i32 @close(i32 %6)
%15 = tail call i32 @unlink(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 @unlink(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}