#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct statvfs {
  unsigned long f_fsid;
  int /*<<< orphan*/ f_flag;
  int /*<<< orphan*/ f_ffree;
  int /*<<< orphan*/ f_favail;
  int /*<<< orphan*/ __f_spare;
  int /*<<< orphan*/ f_namemax;
  int /*<<< orphan*/ f_files;
  int /*<<< orphan*/ f_bavail;
  int /*<<< orphan*/ f_bfree;
  int /*<<< orphan*/ f_blocks;
  int /*<<< orphan*/ f_frsize;
  int /*<<< orphan*/ f_bsize;
};
struct TYPE_2__ {
  unsigned long *__val;
};
struct statfs {
  int /*<<< orphan*/ f_type;
  int /*<<< orphan*/ f_namelen;
  TYPE_1__ f_fsid;
  int /*<<< orphan*/ f_ffree;
  int /*<<< orphan*/ f_files;
  int /*<<< orphan*/ f_bavail;
  int /*<<< orphan*/ f_bfree;
  int /*<<< orphan*/ f_blocks;
  int /*<<< orphan*/ f_bsize;
  scalar_t__ f_frsize;
};
struct stat64 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __statvfs_getflags(char const *, int /*<<< orphan*/,
                                      struct stat64 *);
int /*<<< orphan*/ memset(int /*<<< orphan*/, char, int);
void __internal_statvfs(const char *name, struct statvfs *buf,
                        struct statfs *fsbuf, struct stat64 *st) {
  buf->f_bsize = fsbuf->f_bsize;
  buf->f_frsize = fsbuf->f_frsize ?: fsbuf->f_bsize;
  buf->f_blocks = fsbuf->f_blocks;
  buf->f_bfree = fsbuf->f_bfree;
  buf->f_bavail = fsbuf->f_bavail;
  buf->f_files = fsbuf->f_files;
  buf->f_ffree = fsbuf->f_ffree;
  if (sizeof(buf->f_fsid) == sizeof(fsbuf->f_fsid))
    buf->f_fsid =
        (fsbuf->f_fsid.__val[0] |
         ((unsigned long int)fsbuf->f_fsid.__val[1]
          << (8 * (sizeof(buf->f_fsid) - sizeof(fsbuf->f_fsid.__val[0])))));
  else
    buf->f_fsid = fsbuf->f_fsid.__val[0];
  buf->f_namemax = fsbuf->f_namelen;
  memset(buf->__f_spare, '\0', sizeof(buf->__f_spare));
  buf->f_favail = buf->f_ffree;
  buf->f_flag = __statvfs_getflags(name, fsbuf->f_type, st);
}


x86 assembly (clang, -O0):
<__internal_statvfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x24(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x30(%rax)
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1169 <__internal_statvfs+0x49>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    1175 <__internal_statvfs+0x55>
mov    -0x18(%rbp),%rax
movslq 0x24(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x2c(%rax)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x28(%rax)
mov    -0x18(%rbp),%rax
mov    0x1c(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x24(%rax)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x20(%rax)
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x8(%rax),%rax
shl    $0x0,%rax
or     %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
call   1030 <__statvfs_getflags@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__internal_statvfs>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r15
mov    0x24(%rdx),%eax
mov    %eax,0x30(%rsi)
mov    0x28(%rdx),%rcx
test   %rcx,%rcx
cmove  %eax,%ecx
mov    %ecx,0x2c(%rsi)
movups 0x14(%rdx),%xmm0
movups %xmm0,0x1c(%rsi)
mov    0x10(%rdx),%eax
mov    %eax,0xc(%rsi)
mov    0x8(%rdx),%rax
mov    0x8(%rax),%rcx
or     (%rax),%rcx
mov    %rcx,(%rsi)
mov    0x4(%rdx),%eax
mov    %eax,0x18(%rsi)
mov    0x14(%rsi),%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    0xc(%rbx),%eax
mov    %eax,0x10(%rbx)
mov    (%r12),%esi
mov    %r15,%rdi
mov    %r14,%rdx
call   1030 <__statvfs_getflags@plt>
mov    %eax,0x8(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.statvfs = type { i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.statfs = type { i32, i32, %struct.TYPE_2__, i32, i32, i32, i32, i32, i32, i64 }
%struct.TYPE_2__ = type { i64* }
%struct.stat64 = type { i32 }
define void @__internal_statvfs(i8* %0, %struct.statvfs* %1, %struct.statfs* %2, %struct.stat64* %3) {
%5 = alloca i8*
%6 = alloca %struct.statvfs*
%7 = alloca %struct.statfs*
%8 = alloca %struct.stat64*
store i8* %0, i8** %5
store %struct.statvfs* %1, %struct.statvfs** %6
store %struct.statfs* %2, %struct.statfs** %7
store %struct.stat64* %3, %struct.stat64** %8
%9 = load %struct.statfs*, %struct.statfs** %7
%10 = getelementptr inbounds %struct.statfs, %struct.statfs* %9, i32 0, i32 8
%11 = load i32, i32* %10
%12 = load %struct.statvfs*, %struct.statvfs** %6
%13 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %12, i32 0, i32 11
store i32 %11, i32* %13
%14 = load %struct.statfs*, %struct.statfs** %7
%15 = getelementptr inbounds %struct.statfs, %struct.statfs* %14, i32 0, i32 9
%16 = load i64, i64* %15
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %4
br label %24
19: ; preds = %4
%20 = load %struct.statfs*, %struct.statfs** %7
%21 = getelementptr inbounds %struct.statfs, %struct.statfs* %20, i32 0, i32 8
%22 = load i32, i32* %21
%23 = sext i32 %22 to i64
br label %24
24: ; preds = %19, %18
%25 = phi i64 [ %16, %18 ], [ %23, %19 ]
%26 = trunc i64 %25 to i32
%27 = load %struct.statvfs*, %struct.statvfs** %6
%28 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %27, i32 0, i32 10
store i32 %26, i32* %28
%29 = load %struct.statfs*, %struct.statfs** %7
%30 = getelementptr inbounds %struct.statfs, %struct.statfs* %29, i32 0, i32 7
%31 = load i32, i32* %30
%32 = load %struct.statvfs*, %struct.statvfs** %6
%33 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %32, i32 0, i32 9
store i32 %31, i32* %33
%34 = load %struct.statfs*, %struct.statfs** %7
%35 = getelementptr inbounds %struct.statfs, %struct.statfs* %34, i32 0, i32 6
%36 = load i32, i32* %35
%37 = load %struct.statvfs*, %struct.statvfs** %6
%38 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %37, i32 0, i32 8
store i32 %36, i32* %38
%39 = load %struct.statfs*, %struct.statfs** %7
%40 = getelementptr inbounds %struct.statfs, %struct.statfs* %39, i32 0, i32 5
%41 = load i32, i32* %40
%42 = load %struct.statvfs*, %struct.statvfs** %6
%43 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %42, i32 0, i32 7
store i32 %41, i32* %43
%44 = load %struct.statfs*, %struct.statfs** %7
%45 = getelementptr inbounds %struct.statfs, %struct.statfs* %44, i32 0, i32 4
%46 = load i32, i32* %45
%47 = load %struct.statvfs*, %struct.statvfs** %6
%48 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %47, i32 0, i32 6
store i32 %46, i32* %48
%49 = load %struct.statfs*, %struct.statfs** %7
%50 = getelementptr inbounds %struct.statfs, %struct.statfs* %49, i32 0, i32 3
%51 = load i32, i32* %50
%52 = load %struct.statvfs*, %struct.statvfs** %6
%53 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %52, i32 0, i32 2
store i32 %51, i32* %53
%54 = load %struct.statfs*, %struct.statfs** %7
%55 = getelementptr inbounds %struct.statfs, %struct.statfs* %54, i32 0, i32 2
%56 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %55, i32 0, i32 0
%57 = load i64*, i64** %56
%58 = getelementptr inbounds i64, i64* %57, i64 0
%59 = load i64, i64* %58
%60 = load %struct.statfs*, %struct.statfs** %7
%61 = getelementptr inbounds %struct.statfs, %struct.statfs* %60, i32 0, i32 2
%62 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %61, i32 0, i32 0
%63 = load i64*, i64** %62
%64 = getelementptr inbounds i64, i64* %63, i64 1
%65 = load i64, i64* %64
%66 = shl i64 %65, 0
%67 = or i64 %59, %66
%68 = load %struct.statvfs*, %struct.statvfs** %6
%69 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %68, i32 0, i32 0
store i64 %67, i64* %69
%70 = load %struct.statfs*, %struct.statfs** %7
%71 = getelementptr inbounds %struct.statfs, %struct.statfs* %70, i32 0, i32 1
%72 = load i32, i32* %71
%73 = load %struct.statvfs*, %struct.statvfs** %6
%74 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %73, i32 0, i32 5
store i32 %72, i32* %74
%75 = load %struct.statvfs*, %struct.statvfs** %6
%76 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %75, i32 0, i32 4
%77 = load i32, i32* %76
%78 = call i32 @memset(i32 %77, i8 signext 0, i32 4)
%79 = load %struct.statvfs*, %struct.statvfs** %6
%80 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %79, i32 0, i32 2
%81 = load i32, i32* %80
%82 = load %struct.statvfs*, %struct.statvfs** %6
%83 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %82, i32 0, i32 3
store i32 %81, i32* %83
%84 = load i8*, i8** %5
%85 = load %struct.statfs*, %struct.statfs** %7
%86 = getelementptr inbounds %struct.statfs, %struct.statfs* %85, i32 0, i32 0
%87 = load i32, i32* %86
%88 = load %struct.stat64*, %struct.stat64** %8
%89 = call i32 @__statvfs_getflags(i8* %84, i32 %87, %struct.stat64* %88)
%90 = load %struct.statvfs*, %struct.statvfs** %6
%91 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %90, i32 0, i32 1
store i32 %89, i32* %91
ret void
}

LLVM IR (-O2):
%struct.statvfs = type { i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.statfs = type { i32, i32, %struct.TYPE_2__, i32, i32, i32, i32, i32, i32, i64 }
%struct.TYPE_2__ = type { i64* }
%struct.stat64 = type { i32 }
define void @__internal_statvfs(i8* %0, %struct.statvfs* nocapture %1, %struct.statfs* nocapture %2, %struct.stat64* %3) {
%5 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 8
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 11
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 9
%9 = load i64, i64* %8
%10 = icmp eq i64 %9, 0
%11 = zext i32 %6 to i64
%12 = select i1 %10, i64 %11, i64 %9
%13 = trunc i64 %12 to i32
%14 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 10
store i32 %13, i32* %14
%15 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 4
%16 = bitcast i32* %15 to <4 x i32>*
%17 = load <4 x i32>, <4 x i32>* %16
%18 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 6
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %19
%20 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 3
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 2
store i32 %21, i32* %22
%23 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 2, i32 0
%24 = load i64*, i64** %23
%25 = load i64, i64* %24
%26 = getelementptr inbounds i64, i64* %24, i64 1
%27 = load i64, i64* %26
%28 = or i64 %27, %25
%29 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 0
store i64 %28, i64* %29
%30 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 1
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 5
store i32 %31, i32* %32
%33 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 4
%34 = load i32, i32* %33
%35 = tail call i32 @memset(i32 %34, i8 signext 0, i32 4)
%36 = load i32, i32* %22
%37 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 3
store i32 %36, i32* %37
%38 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 0
%39 = load i32, i32* %38
%40 = tail call i32 @__statvfs_getflags(i8* %0, i32 %39, %struct.stat64* %3)
%41 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 1
store i32 %40, i32* %41
ret void
}