#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*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int statvfs(char *, struct statvfs *);
int /*<<< orphan*/ stderr;
int avail_space(char *dir, unsigned long long *ptr_avail_space) {
  int status = 0;
  struct statvfs sbuf;
  status = statvfs(dir, &sbuf);
  {
    if ((status) < 0) {
      {
        {
          fprintf(stderr, "Line %3d of File %s \n", 701,
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/"
                  "heads/master/DEPRECATED_Q2/AUX/auxil.c");
        };
        status = (status);
        goto BYE;
      }
    }
  };
  *ptr_avail_space =
      (unsigned long long)sbuf.f_bsize * (unsigned long long)sbuf.f_bavail;
BYE:
  return status;
}


x86 assembly (clang, -O0):
<avail_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <statvfs@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    117d <avail_space+0x5d>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
mov    $0x2bd,%edx
lea    0xea9(%rip),%rcx
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    118d <avail_space+0x6d>
mov    -0x20(%rbp),%rcx
imul   -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<avail_space>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
lea    0x8(%rsp),%rsi
call   1040 <statvfs@plt>
mov    %eax,%ebx
test   %eax,%eax
js     114a <avail_space+0x2a>
mov    0x8(%rsp),%rax
imul   0x10(%rsp),%rax
mov    %rax,(%r14)
jmp    116b <avail_space+0x4b>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
lea    0xeb5(%rip),%rcx
mov    $0x2bd,%edx
call   1030 <fprintf@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.statvfs = type { i64, i64 }
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/DEPRECATED_Q2/AUX/auxil.c\00"
define i32 @avail_space(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
%5 = alloca i32
%6 = alloca %struct.statvfs
store i8* %0, i8** %3
store i64* %1, i64** %4
store i32 0, i32* %5
%7 = load i8*, i8** %3
%8 = call i32 @statvfs(i8* %7, %struct.statvfs* %6)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 701, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %5
store i32 %14, i32* %5
br label %22
15: ; preds = %2
%16 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 1
%17 = load i64, i64* %16
%18 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %6, i32 0, i32 0
%19 = load i64, i64* %18
%20 = mul i64 %17, %19
%21 = load i64*, i64** %4
store i64 %20, i64* %21
br label %22
22: ; preds = %15, %11
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
%struct.statvfs = type { i64, i64 }
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/DEPRECATED_Q2/AUX/auxil.c\00"
define i32 @avail_space(i8* nocapture %0, i64* nocapture writeonly %1) {
%3 = alloca %struct.statvfs
%4 = bitcast %struct.statvfs* %3 to i8*
%5 = call i32 @statvfs(i8* %0, %struct.statvfs* %3)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 701, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.1, i64 0, i64 0))
br label %16
10: ; preds = %2
%11 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 1
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %3, i64 0, i32 0
%14 = load i64, i64* %13
%15 = mul i64 %14, %12
store i64 %15, i64* %1
br label %16
16: ; preds = %10, %7
ret i32 %5
}