#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 {
  unsigned long long f_blocks;
  unsigned long long f_bfree;
  scalar_t__ f_bsize;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int statvfs(char *, struct statvfs *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int get_disk_space(char *dev_path, unsigned long long *ptr_nbytes, char *mode) {
  int status = 0;
  struct statvfs sfs;
  *ptr_nbytes = 0;
  if (dev_path == NULL) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 499,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  if (mode == NULL) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 500,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  status = statvfs(dev_path, &sfs);
  {
    if ((status) < 0) {
      {
        {
          fprintf(stderr, "Line %3d of File %s \n", 503,
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/"
                  "heads/master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
        };
        status = (status);
        goto BYE;
      }
    }
  };
  if (strcmp(mode, "capacity") == 0) {
    *ptr_nbytes = (unsigned long long)sfs.f_bsize * sfs.f_blocks;
  } else if (strcmp(mode, "free_space") == 0) {
    *ptr_nbytes = (unsigned long long)sfs.f_bsize * sfs.f_bfree;
  } else {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 510,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
BYE:
  return status;
}


x86 assembly (clang, -O0):
<get_disk_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
cmpq   $0x0,-0x8(%rbp)
jne    118e <get_disk_space+0x5e>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
mov    $0x1f3,%edx
lea    0xe99(%rip),%rcx
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x1c(%rbp)
jmp    12a1 <get_disk_space+0x171>
cmpq   $0x0,-0x18(%rbp)
jne    11c6 <get_disk_space+0x96>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xe57(%rip),%rsi
mov    $0x1f4,%edx
lea    0xe61(%rip),%rcx
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x1c(%rbp)
jmp    12a1 <get_disk_space+0x171>
mov    -0x8(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <statvfs@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    120c <get_disk_space+0xdc>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
mov    $0x1f7,%edx
lea    0xe1a(%rip),%rcx
call   1040 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    12a1 <get_disk_space+0x171>
mov    -0x18(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    123b <get_disk_space+0x10b>
mov    -0x28(%rbp),%rcx
imul   -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    129c <get_disk_space+0x16c>
mov    -0x18(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    126a <get_disk_space+0x13a>
mov    -0x28(%rbp),%rcx
imul   -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    1297 <get_disk_space+0x167>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
lea    0xd86(%rip),%rsi
mov    $0x1fe,%edx
lea    0xd90(%rip),%rcx
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x1c(%rbp)
jmp    12a1 <get_disk_space+0x171>
jmp    129c <get_disk_space+0x16c>
jmp    12a1 <get_disk_space+0x171>
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_disk_space>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
movq   $0x0,(%rsi)
test   %rdi,%rdi
je     11b6 <get_disk_space+0x86>
mov    %rdx,%rbp
test   %rdx,%rdx
je     11d4 <get_disk_space+0xa4>
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1050 <statvfs@plt>
mov    %eax,%r14d
test   %eax,%eax
js     1207 <get_disk_space+0xd7>
lea    0xf4e(%rip),%rsi
mov    %rbp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     122a <get_disk_space+0xfa>
lea    0xf3f(%rip),%rsi
mov    %rbp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1231 <get_disk_space+0x101>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xe58(%rip),%rsi
lea    0xe67(%rip),%rcx
mov    $0x1fe,%edx
jmp    11f0 <get_disk_space+0xc0>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe3a(%rip),%rsi
lea    0xe49(%rip),%rcx
mov    $0x1f3,%edx
jmp    11f0 <get_disk_space+0xc0>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
lea    0xe1c(%rip),%rsi
lea    0xe2b(%rip),%rcx
mov    $0x1f4,%edx
call   1040 <fprintf@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
lea    0xde9(%rip),%rsi
lea    0xdf8(%rip),%rcx
mov    $0x1f7,%edx
call   1040 <fprintf@plt>
jmp    11fb <get_disk_space+0xcb>
mov    0x8(%rsp),%rax
jmp    1236 <get_disk_space+0x106>
mov    0x10(%rsp),%rax
imul   0x18(%rsp),%rax
mov    %rax,(%rbx)
jmp    11fb <get_disk_space+0xcb>

LLVM IR (-O0):
%struct.statvfs = type { i64, i64, i64 }
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [167 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/BAK.4.23.2015.PARSER/auxil.c\00"
@.str.2 = [9 x i8] c"capacity\00"
@.str.3 = [11 x i8] c"free_space\00"
define i32 @get_disk_space(i8* %0, i64* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.statvfs
store i8* %0, i8** %4
store i64* %1, i64** %5
store i8* %2, i8** %6
store i32 0, i32* %7
%9 = load i64*, i64** %5
store i64 0, i64* %9
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 499, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %7
br label %57
15: ; preds = %3
%16 = load i8*, i8** %6
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %7
br label %57
21: ; preds = %15
%22 = load i8*, i8** %4
%23 = call i32 @statvfs(i8* %22, %struct.statvfs* %8)
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 503, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32, i32* %7
store i32 %29, i32* %7
br label %57
30: ; preds = %21
%31 = load i8*, i8** %6
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %30
%35 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %8, i32 0, i32 2
%36 = load i64, i64* %35
%37 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %8, i32 0, i32 0
%38 = load i64, i64* %37
%39 = mul i64 %36, %38
%40 = load i64*, i64** %5
store i64 %39, i64* %40
br label %56
41: ; preds = %30
%42 = load i8*, i8** %6
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %52
45: ; preds = %41
%46 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %8, i32 0, i32 2
%47 = load i64, i64* %46
%48 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %8, i32 0, i32 1
%49 = load i64, i64* %48
%50 = mul i64 %47, %49
%51 = load i64*, i64** %5
store i64 %50, i64* %51
br label %55
52: ; preds = %41
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 510, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %7
br label %57
55: ; preds = %45
br label %56
56: ; preds = %55, %34
br label %57
57: ; preds = %56, %52, %26, %18, %12
%58 = load i32, i32* %7
ret i32 %58
}

LLVM IR (-O2):
%struct.statvfs = type { i64, i64, i64 }
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [167 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/BAK.4.23.2015.PARSER/auxil.c\00"
@.str.2 = [9 x i8] c"capacity\00"
@.str.3 = [11 x i8] c"free_space\00"
define i32 @get_disk_space(i8* %0, i64* nocapture writeonly %1, i8* %2) {
%4 = alloca %struct.statvfs
%5 = bitcast %struct.statvfs* %4 to i8*
store i64 0, i64* %1
%6 = icmp eq i8* %0, null
br i1 %6, label %7, label %10
7: ; preds = %3
%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 499, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %42
10: ; preds = %3
%11 = icmp eq i8* %2, null
br i1 %11, label %12, label %15
12: ; preds = %10
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %42
15: ; preds = %10
%16 = call i32 @statvfs(i8* %0, %struct.statvfs* %4)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 503, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %42
21: ; preds = %15
%22 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %4, i64 0, i32 2
%26 = load i64, i64* %25
%27 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %4, i64 0, i32 0
%28 = load i64, i64* %27
%29 = mul i64 %28, %26
store i64 %29, i64* %1
br label %42
30: ; preds = %21
%31 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %4, i64 0, i32 2
%35 = load i64, i64* %34
%36 = getelementptr inbounds %struct.statvfs, %struct.statvfs* %4, i64 0, i32 1
%37 = load i64, i64* %36
%38 = mul i64 %37, %35
store i64 %38, i64* %1
br label %42
39: ; preds = %30
%40 = load i32, i32* @stderr
%41 = tail call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 510, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %42
42: ; preds = %24, %33, %39, %18, %12, %7
%43 = phi i32 [ -1, %7 ], [ -1, %12 ], [ %16, %18 ], [ %16, %24 ], [ %16, %33 ], [ -1, %39 ]
ret i32 %43
}