#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*/ SIGPIPE;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ SIG_IGN;
int S_IREAD;
int S_IWRITE;
int mkfifo(char *, int);
scalar_t__ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ umask(int /*<<< orphan*/);
int /*<<< orphan*/ unlink(char *);
int akwbs_request_io_create_queue(void) {
  if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
    return -1;
  umask(0);
  unlink("/tmp/akwbs_mt");
  if (mkfifo("/tmp/akwbs_mt", S_IWRITE | S_IREAD) == -1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<akwbs_request_io_create_queue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%rax
jne    117b <akwbs_request_io_create_queue+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c8 <akwbs_request_io_create_queue+0x88>
xor    %edi,%edi
call   1060 <umask@plt>
lea    0xe77(%rip),%rdi
call   1030 <unlink@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%esi
mov    0x2e22(%rip),%rax
or     (%rax),%esi
lea    0xe59(%rip),%rdi
call   1050 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    11c1 <akwbs_request_io_create_queue+0x81>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c8 <akwbs_request_io_create_queue+0x88>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<akwbs_request_io_create_queue>:
push   %rbx
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    %rax,%rcx
mov    0x2e6e(%rip),%rdx
mov    $0xffffffff,%eax
cmp    (%rdx),%rcx
je     11a8 <akwbs_request_io_create_queue+0x68>
xor    %edi,%edi
call   1060 <umask@plt>
lea    0xe86(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    0x2e5f(%rip),%rax
mov    0x2e30(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %rbx,%rdi
call   1050 <mkfifo@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
sete   %al
neg    %eax
pop    %rbx
ret

LLVM IR (-O0):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str = [14 x i8] c"/tmp/akwbs_mt\00"
@S_IWRITE = global i32 0
@S_IREAD = global i32 0
define i32 @akwbs_request_io_create_queue() {
%1 = alloca i32
%2 = load i32, i32* @SIGPIPE
%3 = load i32, i32* @SIG_IGN
%4 = call i64 @signal(i32 %2, i32 %3)
%5 = load i64, i64* @SIG_ERR
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 -1, i32* %1
br label %18
8: ; preds = %0
%9 = call i32 @umask(i32 0)
%10 = call i32 @unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @S_IWRITE
%12 = load i32, i32* @S_IREAD
%13 = or i32 %11, %12
%14 = call i32 @mkfifo(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %8
store i32 -1, i32* %1
br label %18
17: ; preds = %8
store i32 0, i32* %1
br label %18
18: ; preds = %17, %16, %7
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str = [14 x i8] c"/tmp/akwbs_mt\00"
@S_IWRITE = global i32 0
@S_IREAD = global i32 0
define i32 @akwbs_request_io_create_queue() {
%1 = load i32, i32* @SIGPIPE
%2 = load i32, i32* @SIG_IGN
%3 = tail call i64 @signal(i32 %1, i32 %2)
%4 = load i64, i64* @SIG_ERR
%5 = icmp eq i64 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %0
%7 = tail call i32 @umask(i32 0)
%8 = tail call i32 @unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @S_IWRITE
%10 = load i32, i32* @S_IREAD
%11 = or i32 %10, %9
%12 = tail call i32 @mkfifo(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = icmp eq i32 %12, -1
%14 = sext i1 %13 to i32
br label %15
15: ; preds = %6, %0
%16 = phi i32 [ -1, %0 ], [ %14, %6 ]
ret i32 %16
}