#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 {
  int f_bsize;
  int f_blocks;
  int f_bavail;
};

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ statvfs(char const *, struct statvfs *);
void print_statvfs(const char *path) {
  struct statvfs buf;
  if (statvfs(path, &buf) == 0) {
    printf("%lu %lu\n", (buf.f_bsize) * buf.f_blocks,
           buf.f_bsize * buf.f_bavail);
  } else {
    exit(errno);
  }
}


x86 assembly (clang, -O0):
<print_statvfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <statvfs@plt>
cmp    $0x0,%rax
jne    1172 <print_statvfs+0x42>
mov    -0x18(%rbp),%esi
imul   -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
imul   -0x10(%rbp),%edx
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    1180 <print_statvfs+0x50>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_statvfs>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rsi
call   1040 <statvfs@plt>
test   %rax,%rax
jne    1164 <print_statvfs+0x34>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%esi
imul   %edx,%esi
imul   0x10(%rsp),%edx
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
add    $0x18,%rsp
ret
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.statvfs = type { i32, i32, i32 }
@.str = [9 x i8] c"%lu %lu\0A\00"
@errno = global i32 0
define void @print_statvfs(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.statvfs
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @statvfs(i8* %4, %struct.statvfs* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %1
%8 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i32 0, i32 1
%11 = load i32, i32* %10
%12 = mul nsw i32 %9, %11
%13 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i32 0, i32 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i32 0, i32 2
%16 = load i32, i32* %15
%17 = mul nsw i32 %14, %16
%18 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %17)
br label %22
19: ; preds = %1
%20 = load i32, i32* @errno
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %7
ret void
}

LLVM IR (-O2):
%struct.statvfs = type { i32, i32, i32 }
@.str = [9 x i8] c"%lu %lu\0A\00"
@errno = global i32 0
define void @print_statvfs(i8* %0) {
%2 = alloca %struct.statvfs
%3 = bitcast %struct.statvfs* %2 to i8*
%4 = call i64 @statvfs(i8* %0, %struct.statvfs* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %2, i64 0, i32 1
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, %8
%12 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %2, i64 0, i32 2
%13 = load i32, i32* %12
%14 = mul nsw i32 %13, %8
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14)
ret void
16: ; preds = %1
%17 = load i32, i32* @errno
%18 = call i32 @exit(i32 %17)
unreachable
}