#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_RDONLY;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ mkfifo(char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ read(int, int *, int);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ write(int, int *, int);
int main() {
  int a2b, b2a, n;
  mkfifo("./a2b", 0600);
  mkfifo("./b2a", 0600);
  n = 5;
  a2b = open("./a2b", O_WRONLY);
  b2a = open("./b2a", O_RDONLY);
  write(a2b, &n, sizeof(int));
  read(b2a, &n, sizeof(int));
  printf("%d\n", n);
  close(a2b);
  close(b2a);
  unlink("./a2b");
  unlink("./b2a");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
mov    $0x180,%esi
call   1080 <mkfifo@plt>
lea    0xe6f(%rip),%rdi
mov    $0x180,%esi
call   1080 <mkfifo@plt>
movl   $0x5,-0x10(%rbp)
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
lea    0xe48(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
lea    0xe36(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0xc(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1070 <read@plt>
mov    -0x10(%rbp),%esi
lea    0xe08(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
mov    -0xc(%rbp),%edi
call   1060 <close@plt>
lea    0xde0(%rip),%rdi
call   1030 <unlink@plt>
lea    0xdda(%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   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe7d(%rip),%r14
mov    %r14,%rdi
mov    $0x180,%esi
call   1080 <mkfifo@plt>
lea    0xe6f(%rip),%r15
mov    %r15,%rdi
mov    $0x180,%esi
call   1080 <mkfifo@plt>
movl   $0x5,0xc(%rsp)
mov    0x2e1d(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1090 <open@plt>
mov    %eax,%ebp
mov    0x2e22(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1090 <open@plt>
mov    %eax,%ebx
lea    0xc(%rsp),%r12
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0x4,%edx
call   1070 <read@plt>
mov    0xc(%rsp),%esi
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
mov    %ebp,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   1060 <close@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
mov    %r15,%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"./a2b\00"
@.str.1 = [6 x i8] c"./b2a\00"
@O_WRONLY = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @mkfifo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 384)
%4 = tail call i32 @mkfifo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 384)
store i32 5, i32* %1
%5 = load i32, i32* @O_WRONLY
%6 = tail call i32 @open(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @O_RDONLY
%8 = tail call i32 @open(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @write(i32 %6, i32* %1, i32 4)
%10 = call i32 @read(i32 %8, i32* %1, i32 4)
%11 = load i32, i32* %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = tail call i32 @close(i32 %6)
%14 = tail call i32 @close(i32 %8)
%15 = tail call i32 @unlink(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 @unlink(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}