#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 statvfs {
  scalar_t__ f_namemax;
  scalar_t__ f_flag;
  scalar_t__ f_fsid;
  scalar_t__ f_favail;
  scalar_t__ f_ffree;
  scalar_t__ f_files;
  scalar_t__ f_bavail;
  scalar_t__ f_bfree;
  scalar_t__ f_blocks;
  scalar_t__ f_frsize;
  scalar_t__ f_bsize;
};

/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ printf(char *, char *, ...);
int statvfs(char *, struct statvfs *);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("Usage: %s directory\n", argv[0]);
    _exit(-1);
  }
  struct statvfs stv;
  int ret = statvfs(argv[1], &stv);
  printf("             Path:%s\n"
         " statvfs returned:%d\n\n"
         "          f_bsize=%12llu /* file system block size */\n"
         "         f_frsize=%12llu /* fragment size */\n"
         "         f_blocks=%12llu /* size of fs in f_frsize units */\n"
         "          f_bfree=%12llu /* # free blocks */\n"
         "         f_bavail=%12llu /* # free blocks for non-root */\n"
         "          f_files=%12llu /* # inodes */\n"
         "          f_ffree=%12llu /* # free inodes */\n"
         "         f_favail=%12llu /* # free inodes for non-root */\n"
         "           f_fsid=%12llu /* file system ID */\n"
         "           f_flag=%12llu /* mount flags */\n"
         "        f_namemax=%12llu /* maximum filename length */\n",
         argv[1], ret, (unsigned long long)stv.f_bsize,
         (unsigned long long)stv.f_frsize, (unsigned long long)stv.f_blocks,
         (unsigned long long)stv.f_bfree, (unsigned long long)stv.f_bavail,
         (unsigned long long)stv.f_files, (unsigned long long)stv.f_ffree,
         (unsigned long long)stv.f_favail, (unsigned long long)stv.f_fsid,
         (unsigned long long)stv.f_flag, (unsigned long long)stv.f_namemax);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
cmpl   $0x2,-0x30(%rbp)
jge    117b <main+0x4b>
mov    -0x38(%rbp),%rax
mov    (%rax),%rsi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x90(%rbp),%rsi
call   1050 <statvfs@plt>
mov    %eax,-0x94(%rbp)
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x94(%rbp),%edx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x50(%rbp),%r9
mov    -0x58(%rbp),%r13
mov    -0x60(%rbp),%r12
mov    -0x68(%rbp),%r15
mov    -0x70(%rbp),%r14
mov    -0x78(%rbp),%rbx
mov    -0x80(%rbp),%r11
mov    -0x88(%rbp),%r10
mov    -0x90(%rbp),%rax
lea    0xe39(%rip),%rdi
mov    %r13,(%rsp)
mov    %r12,0x8(%rsp)
mov    %r15,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10,0x30(%rsp)
mov    %rax,0x38(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jle    119a <main+0x6a>
mov    0x8(%rbx),%rdi
lea    0x8(%rsp),%rsi
call   1050 <statvfs@plt>
mov    0x8(%rbx),%rsi
mov    0x58(%rsp),%rcx
mov    0x50(%rsp),%r8
mov    0x48(%rsp),%r9
lea    0xeb0(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
push   0x8(%rsp)
push   0x18(%rsp)
push   0x28(%rsp)
push   0x38(%rsp)
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
call   1040 <printf@plt>
add    $0x40,%rsp
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret
mov    (%rbx),%rsi
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
%struct.statvfs = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
@.str = [21 x i8] c"Usage: %s directory\0A\00"
@.str.1 = [593 x i8] c" Path:%s\0A statvfs returned:%d\0A\0A f_bsize=%12llu /* file system block size */\0A f_frsize=%12llu /* fragment size */\0A f_blocks=%12llu /* size of fs in f_frsize units */\0A f_bfree=%12llu /* # free blocks */\0A f_bavail=%12llu /* # free blocks for non-root */\0A f_files=%12llu /* # inodes */\0A f_ffree=%12llu /* # free inodes */\0A f_favail=%12llu /* # free inodes for non-root */\0A f_fsid=%12llu /* file system ID */\0A f_flag=%12llu /* mount flags */\0A f_namemax=%12llu /* maximum filename length */\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.statvfs
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @_exit(i32 -1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @statvfs(i8* %19, %struct.statvfs* %6)
store i32 %20, i32* %7
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i32, i32* %7
%25 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 10
%26 = load i64, i64* %25
%27 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 9
%28 = load i64, i64* %27
%29 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 8
%30 = load i64, i64* %29
%31 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 7
%32 = load i64, i64* %31
%33 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 6
%34 = load i64, i64* %33
%35 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 5
%36 = load i64, i64* %35
%37 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 4
%38 = load i64, i64* %37
%39 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 3
%40 = load i64, i64* %39
%41 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 2
%42 = load i64, i64* %41
%43 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 1
%44 = load i64, i64* %43
%45 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 0
%46 = load i64, i64* %45
%47 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([593 x i8], [593 x i8]* @.str.1, i64 0, i64 0), i8* %23, i32 %24, i64 %26, i64 %28, i64 %30, i64 %32, i64 %34, i64 %36, i64 %38, i64 %40, i64 %42, i64 %44, i64 %46)
ret i32 0
}

LLVM IR (-O2):
%struct.statvfs = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
@.str = [21 x i8] c"Usage: %s directory\0A\00"
@.str.1 = [593 x i8] c" Path:%s\0A statvfs returned:%d\0A\0A f_bsize=%12llu /* file system block size */\0A f_frsize=%12llu /* fragment size */\0A f_blocks=%12llu /* size of fs in f_frsize units */\0A f_bfree=%12llu /* # free blocks */\0A f_bavail=%12llu /* # free blocks for non-root */\0A f_files=%12llu /* # inodes */\0A f_ffree=%12llu /* # free inodes */\0A f_favail=%12llu /* # free inodes for non-root */\0A f_fsid=%12llu /* file system ID */\0A f_flag=%12llu /* mount flags */\0A f_namemax=%12llu /* maximum filename length */\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.statvfs
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @_exit(i32 -1)
unreachable
9: ; preds = %2
%10 = bitcast %struct.statvfs* %3 to i8*
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @statvfs(i8* %12, %struct.statvfs* %3)
%14 = load i8*, i8** %11
%15 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 10
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 9
%18 = load i64, i64* %17
%19 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 8
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 7
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 6
%24 = load i64, i64* %23
%25 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 5
%26 = load i64, i64* %25
%27 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 4
%28 = load i64, i64* %27
%29 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 3
%30 = load i64, i64* %29
%31 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 2
%32 = load i64, i64* %31
%33 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 1
%34 = load i64, i64* %33
%35 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 0
%36 = load i64, i64* %35
%37 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([593 x i8], [593 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 %13, i64 %16, i64 %18, i64 %20, i64 %22, i64 %24, i64 %26, i64 %28, i64 %30, i64 %32, i64 %34, i64 %36)
ret i32 0
}