#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*/ time_t;
struct chirp_client {
  int dummy;
};
typedef scalar_t__ int64_t;

/* Variables and functions */
scalar_t__ chirp_client_pwrite_begin(struct chirp_client *, scalar_t__,
                                     void const *, scalar_t__, scalar_t__,
                                     int /*<<< orphan*/);
scalar_t__ chirp_client_pwrite_finish(struct chirp_client *, scalar_t__,
                                      void const *, scalar_t__, scalar_t__,
                                      int /*<<< orphan*/);
int64_t chirp_client_pwrite(struct chirp_client *c, int64_t fd,
                            const void *buffer, int64_t length, int64_t offset,
                            time_t stoptime) {
  int64_t result =
      chirp_client_pwrite_begin(c, fd, buffer, length, offset, stoptime);
  if (result < 0)
    return result;
  return chirp_client_pwrite_finish(c, fd, buffer, length, offset, stoptime);
}


x86 assembly (clang, -O0):
<chirp_client_pwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x34(%rbp),%r9d
call   1040 <chirp_client_pwrite_begin@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jge    1179 <chirp_client_pwrite+0x59>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    119a <chirp_client_pwrite+0x7a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x34(%rbp),%r9d
call   1030 <chirp_client_pwrite_finish@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_pwrite>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1040 <chirp_client_pwrite_begin@plt>
test   %rax,%rax
js     116c <chirp_client_pwrite+0x4c>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <chirp_client_pwrite_finish@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.chirp_client = type { i32 }
define i64 @chirp_client_pwrite(%struct.chirp_client* %0, i64 %1, i8* %2, i64 %3, i64 %4, i32 %5) {
%7 = alloca i64
%8 = alloca %struct.chirp_client*
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i64
store %struct.chirp_client* %0, %struct.chirp_client** %8
store i64 %1, i64* %9
store i8* %2, i8** %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i32 %5, i32* %13
%15 = load %struct.chirp_client*, %struct.chirp_client** %8
%16 = load i64, i64* %9
%17 = load i8*, i8** %10
%18 = load i64, i64* %11
%19 = load i64, i64* %12
%20 = load i32, i32* %13
%21 = call i64 @chirp_client_pwrite_begin(%struct.chirp_client* %15, i64 %16, i8* %17, i64 %18, i64 %19, i32 %20)
store i64 %21, i64* %14
%22 = load i64, i64* %14
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %6
%25 = load i64, i64* %14
store i64 %25, i64* %7
br label %34
26: ; preds = %6
%27 = load %struct.chirp_client*, %struct.chirp_client** %8
%28 = load i64, i64* %9
%29 = load i8*, i8** %10
%30 = load i64, i64* %11
%31 = load i64, i64* %12
%32 = load i32, i32* %13
%33 = call i64 @chirp_client_pwrite_finish(%struct.chirp_client* %27, i64 %28, i8* %29, i64 %30, i64 %31, i32 %32)
store i64 %33, i64* %7
br label %34
34: ; preds = %26, %24
%35 = load i64, i64* %7
ret i64 %35
}

LLVM IR (-O2):
%struct.chirp_client = type { i32 }
define i64 @chirp_client_pwrite(%struct.chirp_client* %0, i64 %1, i8* %2, i64 %3, i64 %4, i32 %5) {
%7 = tail call i64 @chirp_client_pwrite_begin(%struct.chirp_client* %0, i64 %1, i8* %2, i64 %3, i64 %4, i32 %5)
%8 = icmp slt i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i64 @chirp_client_pwrite_finish(%struct.chirp_client* %0, i64 %1, i8* %2, i64 %3, i64 %4, i32 %5)
br label %11
11: ; preds = %6, %9
%12 = phi i64 [ %10, %9 ], [ %7, %6 ]
ret i64 %12
}