#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*/ abort_safe_block();
int /*<<< orphan*/ errno;
int pipe(int *);
int /*<<< orphan*/ tap_error_errno_at(char *, int /*<<< orphan*/, char *, int);
int safe_pipe(int pipefd[2]) {
  int res = pipe(pipefd);
  if (res < 0) {
    tap_error_errno_at(
        ("pipe()"), (errno),
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/picotm/picotm/refs/heads/master/tests/"
        "libsafeblk/safe_unistd.c",
        78);
    abort_safe_block();
  }
  return res;
}


x86 assembly (clang, -O0):
<safe_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <pipe@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    117a <safe_pipe+0x4a>
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
lea    0xe9e(%rip),%rdi
lea    0xe9e(%rip),%rdx
mov    $0x4e,%ecx
call   1040 <tap_error_errno_at@plt>
mov    $0x0,%al
call   1030 <abort_safe_block@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_pipe>:
push   %rbx
call   1050 <pipe@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1164 <safe_pipe+0x34>
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
lea    0xeb4(%rip),%rdi
lea    0xeb4(%rip),%rdx
mov    $0x4e,%ecx
call   1040 <tap_error_errno_at@plt>
xor    %eax,%eax
call   1030 <abort_safe_block@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"pipe()\00"
@errno = global i32 0
@.str.1 = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/picotm/picotm/refs/heads/master/tests/libsafeblk/safe_unistd.c\00"
define i32 @safe_pipe(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @pipe(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @errno
%10 = call i32 @tap_error_errno_at(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %9, i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.1, i64 0, i64 0), i32 78)
%11 = call i32 (...) @abort_safe_block()
br label %12
12: ; preds = %8, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [7 x i8] c"pipe()\00"
@errno = global i32 0
@.str.1 = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/picotm/picotm/refs/heads/master/tests/libsafeblk/safe_unistd.c\00"
define i32 @safe_pipe(i32* %0) {
%2 = tail call i32 @pipe(i32* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i32 @tap_error_errno_at(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5, i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.1, i64 0, i64 0), i32 78)
%7 = tail call i32 (...) @abort_safe_block()
br label %8
8: ; preds = %4, %1
ret i32 %2
}