#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_bavail;
  scalar_t__ f_bsize;
};

/* Variables and functions */
int /*<<< orphan*/ readable_fs(double, char *);
int /*<<< orphan*/ statvfs(char *, struct statvfs *);
char *disk_left(char *output, char *path) {
  struct statvfs buf;
  if (!statvfs(path, &buf)) {
    unsigned long long free;
    free = (long long)buf.f_bsize * (long long)buf.f_bavail;
    readable_fs((double)free, output);
  }
  return output;
}


x86 assembly (clang, -O0):
<disk_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <statvfs@plt>
cmp    $0x0,%eax
jne    1186 <disk_left+0x66>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x28(%rbp)
movaps 0xea3(%rip),%xmm1
movq   -0x28(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xea2(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rdi
call   1030 <readable_fs@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disk_left>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
mov    %rsp,%rsi
mov    %rax,%rdi
call   1040 <statvfs@plt>
test   %eax,%eax
jne    116d <disk_left+0x4d>
mov    (%rsp),%rax
imul   0x8(%rsp),%rax
movq   %rax,%xmm1
punpckldq 0xeaf(%rip),%xmm1
subpd  0xeb7(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mov    %rbx,%rdi
call   1030 <readable_fs@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.statvfs = type { i64, i64 }
define i8* @disk_left(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.statvfs
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @statvfs(i8* %7, %struct.statvfs* %5)
%9 = icmp ne i32 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %2
%11 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %5, i32 0, i32 1
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %5, i32 0, i32 0
%14 = load i64, i64* %13
%15 = mul nsw i64 %12, %14
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = uitofp i64 %16 to double
%18 = load i8*, i8** %3
%19 = call i32 @readable_fs(double %17, i8* %18)
br label %20
20: ; preds = %10, %2
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
%struct.statvfs = type { i64, i64 }
define i8* @disk_left(i8* returned %0, i8* nocapture %1) {
%3 = alloca %struct.statvfs
%4 = bitcast %struct.statvfs* %3 to i8*
%5 = call i32 @statvfs(i8* %1, %struct.statvfs* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 1
%9 = load i64, i64* %8
%10 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 0
%11 = load i64, i64* %10
%12 = mul nsw i64 %11, %9
%13 = uitofp i64 %12 to double
%14 = tail call i32 @readable_fs(double %13, i8* %0)
br label %15
15: ; preds = %7, %2
ret i8* %0
}