#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*/ value;
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ escape_from_scary_killers();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int write(int, int *, int);
ssize_t Pipe_childWrite(int pipeSF[2], int value) {
  ssize_t size;
  assert(pipeSF != NULL);
  size = write(pipeSF[1], &value, sizeof(value));
  if (size < 1) {
    escape_from_scary_killers();
    perror("Child: Error when writing in pipeSF[1]");
    exit(EXIT_FAILURE);
  }
  return size;
}


x86 assembly (clang, -O0):
<Pipe_childWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jge    11b4 <Pipe_childWrite+0x64>
mov    $0x0,%al
call   1070 <escape_from_scary_killers@plt>
lea    0xe5f(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pipe_childWrite>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,0xc(%rsp)
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    0x4(%rbx),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
test   %eax,%eax
jle    1186 <Pipe_childWrite+0x36>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1070 <escape_from_scary_killers@plt>
lea    0xe6c(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"Child: Error when writing in pipeSF[1]\00"
@EXIT_FAILURE = global i32 0
define i32 @Pipe_childWrite(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = call i32 @write(i32 %12, i32* %4, i32 4)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = call i32 (...) @escape_from_scary_killers()
%18 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
@.str = [39 x i8] c"Child: Error when writing in pipeSF[1]\00"
@EXIT_FAILURE = global i32 0
define i32 @Pipe_childWrite(i32* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = icmp ne i32* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = load i32, i32* %7
%9 = call i32 @write(i32 %8, i32* %3, i32 4)
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = tail call i32 (...) @escape_from_scary_killers()
%13 = tail call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
ret i32 %9
}