#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 */
scalar_t__ EINTR;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ errno;
int /*<<< orphan*/ escape_from_scary_killers();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int write(int, int *, int);
ssize_t Pipe_fatherWrite(int pipeFS[2], int value) {
  ssize_t size = 0;
  assert(pipeFS != NULL);
  while (size == 0) {
    size = write(pipeFS[1], &value, sizeof(value));
    if (size < 1) {
      if (errno == EINTR) {
        size = 0;
      } else {
        escape_from_scary_killers();
        perror("Father: Error when writing in pipeFS[1]");
        exit(EXIT_FAILURE);
      }
    }
  }
  return size;
}


x86 assembly (clang, -O0):
<Pipe_fatherWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x10(%rbp)
jne    11f5 <Pipe_fatherWrite+0xa5>
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    11f0 <Pipe_fatherWrite+0xa0>
mov    0x2e35(%rip),%rax
mov    (%rax),%rax
mov    0x2e1b(%rip),%rcx
cmp    (%rcx),%rax
jne    11ca <Pipe_fatherWrite+0x7a>
movl   $0x0,-0x10(%rbp)
jmp    11eb <Pipe_fatherWrite+0x9b>
mov    $0x0,%al
call   1070 <escape_from_scary_killers@plt>
lea    0xe28(%rip),%rdi
call   1050 <perror@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    11f0 <Pipe_fatherWrite+0xa0>
jmp    1178 <Pipe_fatherWrite+0x28>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pipe_fatherWrite>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %esi,0x4(%rsp)
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
lea    0x4(%rsp),%r14
mov    0x2e67(%rip),%r15
mov    0x2e50(%rip),%r12
mov    0x4(%rbx),%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <write@plt>
test   %eax,%eax
jg     11be <Pipe_fatherWrite+0x6e>
mov    (%r15),%rax
cmp    (%r12),%rax
je     1180 <Pipe_fatherWrite+0x30>
xor    %eax,%eax
call   1070 <escape_from_scary_killers@plt>
lea    0xe55(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
@.str = [40 x i8] c"Father: Error when writing in pipeFS[1]\00"
@EXIT_FAILURE = global i32 0
define i32 @Pipe_fatherWrite(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
br label %10
10: ; preds = %31, %2
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %10
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = call i32 @write(i32 %16, i32* %4, i32 4)
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = icmp slt i32 %18, 1
br i1 %19, label %20, label %31
20: ; preds = %13
%21 = load i64, i64* @errno
%22 = load i64, i64* @EINTR
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 0, i32* %5
br label %30
25: ; preds = %20
%26 = call i32 (...) @escape_from_scary_killers()
%27 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %24
br label %31
31: ; preds = %30, %13
br label %10
32: ; preds = %10
%33 = load i32, i32* %5
ret i32 %33
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
@.str = [40 x i8] c"Father: Error when writing in pipeFS[1]\00"
@EXIT_FAILURE = global i32 0
define i32 @Pipe_fatherWrite(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
br label %8
8: ; preds = %12, %2
%9 = load i32, i32* %7
%10 = call i32 @write(i32 %9, i32* %3, i32 4)
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i64, i64* @errno
%14 = load i64, i64* @EINTR
%15 = icmp eq i64 %13, %14
br i1 %15, label %8, label %16
16: ; preds = %12
%17 = tail call i32 (...) @escape_from_scary_killers()
%18 = tail call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %8
ret i32 %10
}