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

/* Variables and functions */
scalar_t__ get_statfs_result(struct chirp_client *, struct chirp_statfs *,
                             int /*<<< orphan*/);
scalar_t__ simple_command(struct chirp_client *, int /*<<< orphan*/, char *,
                          scalar_t__);
int64_t chirp_client_fstatfs(struct chirp_client *c, int64_t fd,
                             struct chirp_statfs *info, time_t stoptime) {
  int64_t result = simple_command(c, stoptime, "fstatfs %lld\n", fd);
  if (result >= 0)
    result = get_statfs_result(c, info, stoptime);
  return result;
}


x86 assembly (clang, -O0):
<chirp_client_fstatfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rcx
lea    0xeb7(%rip),%rdx
call   1030 <simple_command@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jl     1171 <chirp_client_fstatfs+0x51>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <get_statfs_result@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_fstatfs>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%rcx
mov    %rdi,%rbx
lea    0xeca(%rip),%rdx
mov    %ebp,%esi
call   1030 <simple_command@plt>
test   %rax,%rax
js     1153 <chirp_client_fstatfs+0x33>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <get_statfs_result@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.chirp_client = type { i32 }
%struct.chirp_statfs = type { i32 }
@.str = [14 x i8] c"fstatfs %lld\0A\00"
define i64 @chirp_client_fstatfs(%struct.chirp_client* %0, i64 %1, %struct.chirp_statfs* %2, i32 %3) {
%5 = alloca %struct.chirp_client*
%6 = alloca i64
%7 = alloca %struct.chirp_statfs*
%8 = alloca i32
%9 = alloca i64
store %struct.chirp_client* %0, %struct.chirp_client** %5
store i64 %1, i64* %6
store %struct.chirp_statfs* %2, %struct.chirp_statfs** %7
store i32 %3, i32* %8
%10 = load %struct.chirp_client*, %struct.chirp_client** %5
%11 = load i32, i32* %8
%12 = load i64, i64* %6
%13 = call i64 @simple_command(%struct.chirp_client* %10, i32 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %12)
store i64 %13, i64* %9
%14 = load i64, i64* %9
%15 = icmp sge i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %4
%17 = load %struct.chirp_client*, %struct.chirp_client** %5
%18 = load %struct.chirp_statfs*, %struct.chirp_statfs** %7
%19 = load i32, i32* %8
%20 = call i64 @get_statfs_result(%struct.chirp_client* %17, %struct.chirp_statfs* %18, i32 %19)
store i64 %20, i64* %9
br label %21
21: ; preds = %16, %4
%22 = load i64, i64* %9
ret i64 %22
}

LLVM IR (-O2):
%struct.chirp_client = type { i32 }
%struct.chirp_statfs = type { i32 }
@.str = [14 x i8] c"fstatfs %lld\0A\00"
define i64 @chirp_client_fstatfs(%struct.chirp_client* %0, i64 %1, %struct.chirp_statfs* %2, i32 %3) {
%5 = tail call i64 @simple_command(%struct.chirp_client* %0, i32 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %1)
%6 = icmp sgt i64 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i64 @get_statfs_result(%struct.chirp_client* %0, %struct.chirp_statfs* %2, i32 %3)
br label %9
9: ; preds = %7, %4
%10 = phi i64 [ %8, %7 ], [ %5, %4 ]
ret i64 %10
}