#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 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 f_flags;
  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 __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;
  if ((fsbuf->f_flags & 0x0020) == 0)
    buf->f_flag = __statvfs_getflags(name, fsbuf->f_type, st);
  else
    buf->f_flag = fsbuf->f_flags ^ 0x0020;
}


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    0x2c(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x30(%rax)
mov    -0x18(%rbp),%rax
mov    0x30(%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 0x2c(%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    0x28(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x28(%rax)
mov    -0x18(%rbp),%rax
mov    0x24(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x24(%rax)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x20(%rax)
mov    -0x18(%rbp),%rax
mov    0x1c(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x8(%rax),%rax
shl    $0x0,%rax
or     %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%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    -0x18(%rbp),%rax
mov    (%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
jne    1250 <__internal_statvfs+0x130>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x20(%rbp),%rdx
call   1030 <__statvfs_getflags@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
jmp    1260 <__internal_statvfs+0x140>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
xor    $0x20,%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    0x2c(%rdx),%eax
mov    %eax,0x30(%rsi)
mov    0x30(%rdx),%rcx
test   %rcx,%rcx
cmove  %eax,%ecx
mov    %ecx,0x2c(%rsi)
movups 0x1c(%rdx),%xmm0
movups %xmm0,0x1c(%rsi)
mov    0x18(%rdx),%eax
mov    %eax,0xc(%rsi)
mov    0x10(%rdx),%rax
mov    0x8(%rax),%rcx
or     (%rax),%rcx
mov    %rcx,(%rsi)
mov    0x8(%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),%eax
test   $0x20,%al
jne    1198 <__internal_statvfs+0x78>
mov    0x4(%r12),%esi
mov    %r15,%rdi
mov    %r14,%rdx
call   1030 <__statvfs_getflags@plt>
jmp    119b <__internal_statvfs+0x7b>
xor    $0x20,%eax
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, 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 9
%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 10
%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 9
%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 8
%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 7
%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 6
%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 5
%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 4
%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 3
%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 3
%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 2
%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 %struct.statfs*, %struct.statfs** %7
%85 = getelementptr inbounds %struct.statfs, %struct.statfs* %84, i32 0, i32 0
%86 = load i32, i32* %85
%87 = and i32 %86, 32
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %98
89: ; preds = %24
%90 = load i8*, i8** %5
%91 = load %struct.statfs*, %struct.statfs** %7
%92 = getelementptr inbounds %struct.statfs, %struct.statfs* %91, i32 0, i32 1
%93 = load i32, i32* %92
%94 = load %struct.stat64*, %struct.stat64** %8
%95 = call i32 @__statvfs_getflags(i8* %90, i32 %93, %struct.stat64* %94)
%96 = load %struct.statvfs*, %struct.statvfs** %6
%97 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %96, i32 0, i32 1
store i32 %95, i32* %97
br label %105
98: ; preds = %24
%99 = load %struct.statfs*, %struct.statfs** %7
%100 = getelementptr inbounds %struct.statfs, %struct.statfs* %99, i32 0, i32 0
%101 = load i32, i32* %100
%102 = xor i32 %101, 32
%103 = load %struct.statvfs*, %struct.statvfs** %6
%104 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %103, i32 0, i32 1
store i32 %102, i32* %104
br label %105
105: ; preds = %98, %89
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, 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 9
%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 10
%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 5
%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 4
%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 3, 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 2
%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 = and i32 %39, 32
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %4
%43 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 1
%44 = load i32, i32* %43
%45 = tail call i32 @__statvfs_getflags(i8* %0, i32 %44, %struct.stat64* %3)
br label %48
46: ; preds = %4
%47 = xor i32 %39, 32
br label %48
48: ; preds = %46, %42
%49 = phi i32 [ %45, %42 ], [ %47, %46 ]
%50 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %1, i64 0, i32 1
store i32 %49, i32* %50
ret void
}