writefifo_(id, irtn, string, len) char *string;
long int len, *irtn, *id;
{
  *irtn = write(*id, string, len);
  if (*irtn < 0)
    perror("writefifo");
  *irtn = write(*id, "\n", 1);
  if (*irtn < 0)
    perror("writefifo");
}


x86 assembly (clang, -O0):
<writefifo_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1030 <write@plt>
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jge    1174 <writefifo_+0x54>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <perror@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe88(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jge    11b4 <writefifo_+0x94>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <perror@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writefifo_>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1030 <write@plt>
cltq
mov    %rax,(%r14)
test   %eax,%eax
jns    1151 <writefifo_+0x31>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <perror@plt>
mov    (%rbx),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
cltq
mov    %rax,(%r14)
test   %eax,%eax
jns    117e <writefifo_+0x5e>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <perror@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"writefifo\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @writefifo_(i64* %0, i64* %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i8*
%9 = alloca i64
store i64* %0, i64** %6
store i64* %1, i64** %7
store i8* %2, i8** %8
store i64 %3, i64* %9
%10 = load i64*, i64** %6
%11 = load i64, i64* %10
%12 = load i8*, i8** %8
%13 = load i64, i64* %9
%14 = call i32 (i64, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i64, i8*, i64, ...)*)(i64 %11, i8* %12, i64 %13)
%15 = sext i32 %14 to i64
%16 = load i64*, i64** %7
store i64 %15, i64* %16
%17 = load i64*, i64** %7
%18 = load i64, i64* %17
%19 = icmp slt i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %4
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %4
%23 = load i64*, i64** %6
%24 = load i64, i64* %23
%25 = call i32 (i64, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i64, i8*, i32, ...)*)(i64 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%26 = sext i32 %25 to i64
%27 = load i64*, i64** %7
store i64 %26, i64* %27
%28 = load i64*, i64** %7
%29 = load i64, i64* %28
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %22
%32 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %31, %22
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
@.str = [10 x i8] c"writefifo\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @writefifo_(i64* nocapture %0, i64* nocapture writeonly %1, i8* %2, i64 %3) {
%5 = load i64, i64* %0
%6 = tail call i32 (i64, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i64, i8*, i64, ...)*)(i64 %5, i8* %2, i64 %3)
%7 = sext i32 %6 to i64
store i64 %7, i64* %1
%8 = icmp slt i32 %6, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %4
%12 = load i64, i64* %0
%13 = tail call i32 (i64, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i64, i8*, i32, ...)*)(i64 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%14 = sext i32 %13 to i64
store i64 %14, i64* %1
%15 = icmp slt i32 %13, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %11
ret i32 undef
}