#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*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
int write(int, double *, int);
void writePipe(int *pDescr, double seq, double time) {
  errno = 0;
  close(pDescr[0]);
  if (write(pDescr[1], &seq, sizeof(double)) == -1)
    fprintf(stderr, "Error writing to pipe: %s\n", strerror(errno));
  if (write(pDescr[1], &time, sizeof(double)) == -1)
    fprintf(stderr, "Error writing to pipe: %s\n", strerror(errno));
  close(pDescr[1]);
}


x86 assembly (clang, -O0):
<writePipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    0x2e7b(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <close@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    11ba <writePipe+0x7a>
mov    0x2e4c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e38(%rip),%rax
mov    (%rax),%rdi
call   1060 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe4b(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    1205 <writePipe+0xc5>
mov    0x2e01(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2ded(%rip),%rax
mov    (%rax),%rdi
call   1060 <strerror@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%rdx
lea    0xe00(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writePipe>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,(%rsp)
mov    0x2e7b(%rip),%r14
movq   $0x0,(%r14)
mov    (%rdi),%edi
call   1040 <close@plt>
mov    0x4(%rbx),%edi
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    11a4 <writePipe+0x64>
mov    0x2e57(%rip),%rax
mov    (%rax),%ebp
mov    (%r14),%rdi
call   1060 <strerror@plt>
lea    0xe66(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    0x4(%rbx),%edi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    11db <writePipe+0x9b>
mov    0x2e20(%rip),%rax
mov    (%rax),%ebp
mov    (%r14),%rdi
call   1060 <strerror@plt>
lea    0xe2f(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    0x4(%rbx),%edi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <close@plt>

LLVM IR (-O0):
@errno = global i64 0
@stderr = global i32 0
@.str = [27 x i8] c"Error writing to pipe: %s\0A\00"
define void @writePipe(i32* %0, double %1, double %2) {
%4 = alloca i32*
%5 = alloca double
%6 = alloca double
store i32* %0, i32** %4
store double %1, double* %5
store double %2, double* %6
store i64 0, i64* @errno
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = call i32 @close(i32 %9)
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = load i32, i32* %12
%14 = call i32 @write(i32 %13, double* %5, i32 8)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %21
16: ; preds = %3
%17 = load i32, i32* @stderr
%18 = load i64, i64* @errno
%19 = call i8* @strerror(i64 %18)
%20 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %16, %3
%22 = load i32*, i32** %4
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
%25 = call i32 @write(i32 %24, double* %6, i32 8)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %32
27: ; preds = %21
%28 = load i32, i32* @stderr
%29 = load i64, i64* @errno
%30 = call i8* @strerror(i64 %29)
%31 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %27, %21
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 1
%35 = load i32, i32* %34
%36 = call i32 @close(i32 %35)
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@stderr = global i32 0
@.str = [27 x i8] c"Error writing to pipe: %s\0A\00"
define void @writePipe(i32* nocapture %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
store double %1, double* %4
store double %2, double* %5
store i64 0, i64* @errno
%6 = load i32, i32* %0
%7 = tail call i32 @close(i32 %6)
%8 = getelementptr inbounds i32, i32* %0, i64 1
%9 = load i32, i32* %8
%10 = call i32 @write(i32 %9, double* %4, i32 8)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = load i64, i64* @errno
%15 = tail call i8* @strerror(i64 %14)
%16 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %12, %3
%18 = load i32, i32* %8
%19 = call i32 @write(i32 %18, double* %5, i32 8)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = load i64, i64* @errno
%24 = tail call i8* @strerror(i64 %23)
%25 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %21, %17
%27 = load i32, i32* %8
%28 = tail call i32 @close(i32 %27)
ret void
}