#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 */
struct statfs {
  int /*<<< orphan*/ f_ffree;
  int /*<<< orphan*/ f_files;
  int /*<<< orphan*/ f_bavail;
  int /*<<< orphan*/ f_bfree;
  int /*<<< orphan*/ f_blocks;
  int /*<<< orphan*/ f_bsize;
  int /*<<< orphan*/ f_type;
};

/* Variables and functions */
scalar_t__ fstatfs(int /*<<< orphan*/, struct statfs *);
int /*<<< orphan*/ prnum(int /*<<< orphan*/);
int /*<<< orphan*/ wrmagic();
int df(void) {
  struct statfs sfsbuf;
  if (fstatfs(0, &sfsbuf))
    return 1;
  wrmagic();
  prnum(sfsbuf.f_type);
  prnum(sfsbuf.f_bsize);
  prnum(sfsbuf.f_blocks);
  prnum(sfsbuf.f_bfree);
  prnum(sfsbuf.f_bavail);
  prnum(sfsbuf.f_files);
  prnum(sfsbuf.f_ffree);
  wrmagic();
  return 0;
}


x86 assembly (clang, -O0):
<df>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
lea    -0x20(%rbp),%rsi
call   1050 <fstatfs@plt>
cmp    $0x0,%rax
je     1159 <df+0x29>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <df+0x76>
mov    $0x0,%al
call   1030 <wrmagic@plt>
mov    -0x8(%rbp),%edi
call   1040 <prnum@plt>
mov    -0xc(%rbp),%edi
call   1040 <prnum@plt>
mov    -0x10(%rbp),%edi
call   1040 <prnum@plt>
mov    -0x14(%rbp),%edi
call   1040 <prnum@plt>
mov    -0x18(%rbp),%edi
call   1040 <prnum@plt>
mov    -0x1c(%rbp),%edi
call   1040 <prnum@plt>
mov    -0x20(%rbp),%edi
call   1040 <prnum@plt>
mov    $0x0,%al
call   1030 <wrmagic@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<df>:
sub    $0x28,%rsp
lea    0x8(%rsp),%rsi
xor    %edi,%edi
call   1050 <fstatfs@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1152 <df+0x22>
add    $0x28,%rsp
ret
xor    %eax,%eax
call   1030 <wrmagic@plt>
mov    0x20(%rsp),%edi
call   1040 <prnum@plt>
mov    0x1c(%rsp),%edi
call   1040 <prnum@plt>
mov    0x18(%rsp),%edi
call   1040 <prnum@plt>
mov    0x14(%rsp),%edi
call   1040 <prnum@plt>
mov    0x10(%rsp),%edi
call   1040 <prnum@plt>
mov    0xc(%rsp),%edi
call   1040 <prnum@plt>
mov    0x8(%rsp),%edi
call   1040 <prnum@plt>
xor    %eax,%eax
call   1030 <wrmagic@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.statfs = type { i32, i32, i32, i32, i32, i32, i32 }
define i32 @df() {
%1 = alloca i32
%2 = alloca %struct.statfs
%3 = call i64 @fstatfs(i32 0, %struct.statfs* %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %30
6: ; preds = %0
%7 = call i32 (...) @wrmagic()
%8 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i32 0, i32 6
%9 = load i32, i32* %8
%10 = call i32 @prnum(i32 %9)
%11 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i32 0, i32 5
%12 = load i32, i32* %11
%13 = call i32 @prnum(i32 %12)
%14 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i32 0, i32 4
%15 = load i32, i32* %14
%16 = call i32 @prnum(i32 %15)
%17 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i32 0, i32 3
%18 = load i32, i32* %17
%19 = call i32 @prnum(i32 %18)
%20 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i32 0, i32 2
%21 = load i32, i32* %20
%22 = call i32 @prnum(i32 %21)
%23 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i32 0, i32 1
%24 = load i32, i32* %23
%25 = call i32 @prnum(i32 %24)
%26 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i32 0, i32 0
%27 = load i32, i32* %26
%28 = call i32 @prnum(i32 %27)
%29 = call i32 (...) @wrmagic()
store i32 0, i32* %1
br label %30
30: ; preds = %6, %5
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
%struct.statfs = type { i32, i32, i32, i32, i32, i32, i32 }
define i32 @df() {
%1 = alloca %struct.statfs
%2 = bitcast %struct.statfs* %1 to i8*
%3 = call i64 @fstatfs(i32 0, %struct.statfs* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %29
5: ; preds = %0
%6 = call i32 (...) @wrmagic()
%7 = getelementptr inbounds %struct.statfs, %struct.statfs* %1, i64 0, i32 6
%8 = load i32, i32* %7
%9 = call i32 @prnum(i32 %8)
%10 = getelementptr inbounds %struct.statfs, %struct.statfs* %1, i64 0, i32 5
%11 = load i32, i32* %10
%12 = call i32 @prnum(i32 %11)
%13 = getelementptr inbounds %struct.statfs, %struct.statfs* %1, i64 0, i32 4
%14 = load i32, i32* %13
%15 = call i32 @prnum(i32 %14)
%16 = getelementptr inbounds %struct.statfs, %struct.statfs* %1, i64 0, i32 3
%17 = load i32, i32* %16
%18 = call i32 @prnum(i32 %17)
%19 = getelementptr inbounds %struct.statfs, %struct.statfs* %1, i64 0, i32 2
%20 = load i32, i32* %19
%21 = call i32 @prnum(i32 %20)
%22 = getelementptr inbounds %struct.statfs, %struct.statfs* %1, i64 0, i32 1
%23 = load i32, i32* %22
%24 = call i32 @prnum(i32 %23)
%25 = getelementptr inbounds %struct.statfs, %struct.statfs* %1, i64 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @prnum(i32 %26)
%28 = call i32 (...) @wrmagic()
br label %29
29: ; preds = %0, %5
%30 = phi i32 [ 0, %5 ], [ 1, %0 ]
ret i32 %30
}