#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_sread_begin(struct chirp_client *, scalar_t__, void *,
                                    scalar_t__, scalar_t__, scalar_t__,
                                    scalar_t__, int /*<<< orphan*/);
scalar_t__ chirp_client_sread_finish(struct chirp_client *, scalar_t__, void *,
                                     scalar_t__, scalar_t__, scalar_t__,
                                     scalar_t__, int /*<<< orphan*/);
int64_t chirp_client_sread(struct chirp_client *c, int64_t fd, void *buffer,
                           int64_t length, int64_t stride_length,
                           int64_t stride_skip, int64_t offset,
                           time_t stoptime) {
  int64_t result = chirp_client_sread_begin(
      c, fd, buffer, length, stride_length, stride_skip, offset, stoptime);
  if (result < 0)
    return result;
  return chirp_client_sread_finish(c, fd, buffer, length, stride_length,
                                   stride_skip, offset, stoptime);
}


x86 assembly (clang, -O0):
<chirp_client_sread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <chirp_client_sread_begin@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jge    118f <chirp_client_sread+0x6f>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11bf <chirp_client_sread+0x9f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <chirp_client_sread_finish@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_sread>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x48(%rsp),%eax
push   %rax
push   0x48(%rsp)
call   1040 <chirp_client_sread_begin@plt>
add    $0x10,%rsp
test   %rax,%rax
js     1179 <chirp_client_sread+0x59>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <chirp_client_sread_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_sread(%struct.chirp_client* %0, i64 %1, i8* %2, i64 %3, i64 %4, i64 %5, i64 %6, i32 %7) {
%9 = alloca i64
%10 = alloca %struct.chirp_client*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i32
%18 = alloca i64
store %struct.chirp_client* %0, %struct.chirp_client** %10
store i64 %1, i64* %11
store i8* %2, i8** %12
store i64 %3, i64* %13
store i64 %4, i64* %14
store i64 %5, i64* %15
store i64 %6, i64* %16
store i32 %7, i32* %17
%19 = load %struct.chirp_client*, %struct.chirp_client** %10
%20 = load i64, i64* %11
%21 = load i8*, i8** %12
%22 = load i64, i64* %13
%23 = load i64, i64* %14
%24 = load i64, i64* %15
%25 = load i64, i64* %16
%26 = load i32, i32* %17
%27 = call i64 @chirp_client_sread_begin(%struct.chirp_client* %19, i64 %20, i8* %21, i64 %22, i64 %23, i64 %24, i64 %25, i32 %26)
store i64 %27, i64* %18
%28 = load i64, i64* %18
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %8
%31 = load i64, i64* %18
store i64 %31, i64* %9
br label %42
32: ; preds = %8
%33 = load %struct.chirp_client*, %struct.chirp_client** %10
%34 = load i64, i64* %11
%35 = load i8*, i8** %12
%36 = load i64, i64* %13
%37 = load i64, i64* %14
%38 = load i64, i64* %15
%39 = load i64, i64* %16
%40 = load i32, i32* %17
%41 = call i64 @chirp_client_sread_finish(%struct.chirp_client* %33, i64 %34, i8* %35, i64 %36, i64 %37, i64 %38, i64 %39, i32 %40)
store i64 %41, i64* %9
br label %42
42: ; preds = %32, %30
%43 = load i64, i64* %9
ret i64 %43
}

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