#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 */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int _mv_error(char const *, int);
scalar_t__ mkfifo(char const *, int /*<<< orphan*/);
scalar_t__ unlink(char const *);
int _mv_single_fifo(char const *src, char const *dst, mode_t mode) {
  if (mkfifo(dst, mode) != 0)
    return _mv_error(dst, 1);
  if (unlink(src) != 0)
    _mv_error(src, 0);
  return 0;
}


x86 assembly (clang, -O0):
<_mv_single_fifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <mkfifo@plt>
cmp    $0x0,%rax
je     116f <_mv_single_fifo+0x3f>
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1050 <_mv_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1194 <_mv_single_fifo+0x64>
mov    -0x10(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
je     118d <_mv_single_fifo+0x5d>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1050 <_mv_error@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mv_single_fifo>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %edx,%esi
call   1040 <mkfifo@plt>
test   %rax,%rax
je     115d <_mv_single_fifo+0x2d>
mov    %rbx,%rdi
mov    $0x1,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <_mv_error@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
test   %rax,%rax
je     1174 <_mv_single_fifo+0x44>
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <_mv_error@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @_mv_single_fifo(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %6
%9 = load i32, i32* %7
%10 = call i64 @mkfifo(i8* %8, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i8*, i8** %6
%14 = call i32 @_mv_error(i8* %13, i32 1)
store i32 %14, i32* %4
br label %23
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = call i64 @unlink(i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8*, i8** %5
%21 = call i32 @_mv_error(i8* %20, i32 0)
br label %22
22: ; preds = %19, %15
store i32 0, i32* %4
br label %23
23: ; preds = %22, %12
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
define i32 @_mv_single_fifo(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @mkfifo(i8* %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @_mv_error(i8* %1, i32 1)
br label %13
8: ; preds = %3
%9 = tail call i64 @unlink(i8* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @_mv_error(i8* %0, i32 0)
br label %13
13: ; preds = %8, %11, %6
%14 = phi i32 [ %7, %6 ], [ 0, %11 ], [ 0, %8 ]
ret i32 %14
}