#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 errno;
int pipe(int *);
int rd_fd_set_nonblocking(int);
__attribute__((unused)) int rd_pipe_nonblocking(int *fds) {
  if (pipe(fds) == -1 || rd_fd_set_nonblocking(fds[0]) == -1 ||
      rd_fd_set_nonblocking(fds[1]))
    return errno;
  return 0;
}


x86 assembly (clang, -O0):
<rd_pipe_nonblocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <pipe@plt>
cmp    $0xffffffff,%eax
je     1167 <rd_pipe_nonblocking+0x47>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <rd_fd_set_nonblocking@plt>
cmp    $0xffffffff,%eax
je     1167 <rd_pipe_nonblocking+0x47>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <rd_fd_set_nonblocking@plt>
cmp    $0x0,%eax
je     1178 <rd_pipe_nonblocking+0x58>
mov    0x2e72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <rd_pipe_nonblocking+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rd_pipe_nonblocking>:
push   %rbx
mov    %rdi,%rbx
call   1040 <pipe@plt>
cmp    $0xffffffff,%eax
je     1146 <rd_pipe_nonblocking+0x26>
mov    (%rbx),%edi
call   1030 <rd_fd_set_nonblocking@plt>
cmp    $0xffffffff,%eax
je     1146 <rd_pipe_nonblocking+0x26>
mov    0x4(%rbx),%edi
call   1030 <rd_fd_set_nonblocking@plt>
test   %eax,%eax
je     1151 <rd_pipe_nonblocking+0x31>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @rd_pipe_nonblocking(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i32 @pipe(i32* %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %19, label %7
7: ; preds = %1
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = call i32 @rd_fd_set_nonblocking(i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %19, label %13
13: ; preds = %7
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = call i32 @rd_fd_set_nonblocking(i32 %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %13, %7, %1
%20 = load i32, i32* @errno
store i32 %20, i32* %2
br label %22
21: ; preds = %13
store i32 0, i32* %2
br label %22
22: ; preds = %21, %19
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @rd_pipe_nonblocking(i32* %0) {
%2 = tail call i32 @pipe(i32* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = load i32, i32* %0
%6 = tail call i32 @rd_fd_set_nonblocking(i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = load i32, i32* %9
%11 = tail call i32 @rd_fd_set_nonblocking(i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %8, %4, %1
%14 = load i32, i32* @errno
br label %15
15: ; preds = %8, %13
%16 = phi i32 [ %14, %13 ], [ 0, %8 ]
ret i32 %16
}