// File: Saevon[P]node-diskfree/./test/test.cpp
// Function: main
int main(void) {
    uint64_t free, available, total;
    uint64_t err;

    err = GetDiskSpace(VALID_PATH, &available, &total, &free);

    assertEqual(err, 0, "error reading 'c:'");
    assertTrue(total > 0, "total disk space is wrong");
    assertTrue(total >= free, "total disk space less than free space??");
    assertTrue(total >= available, "total disk space less than available space??");
    assertTrue(free >= available, "free disk space is less than available space??");


    err = GetDiskSpace("c", &available, &total, &free);

    assertTrue(isErrBadPath(err), "no error reading invalid path");

    printf("avail: %" PRIu64 "\n", available);
    printf("free : %" PRIu64 "\n", free);
    printf("total: %" PRIu64 "\n", total);

    printf("Test Complete\n");

    //uint64_t val = DBL_MAX;
    //uint64_t val = //0xFFFFFFFFFFFFF800;
    uint64_t val = 0xFFFFFFFFFFFFF802;
    double val2 = (double) val;
    printf("%" PRIu64 "\n", val);
    printf("%f\n", val2);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
leaq 0xd1e(%rip), %rdi       # 0x2044
leaq -0x18(%rbp), %rsi
movq %rsi, -0x58(%rbp)
leaq -0x20(%rbp), %rdx
movq %rdx, -0x50(%rbp)
leaq -0x10(%rbp), %rcx
movq %rcx, -0x48(%rbp)
callq 0x1160
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0xcf4(%rip), %rdx       # 0x2046
xorl %eax, %eax
movl %eax, -0x40(%rbp)
movl %eax, %esi
callq 0x1290
movq -0x20(%rbp), %rax
testq %rax, %rax
setne %al
movzbl %al, %edi
leaq 0xce7(%rip), %rsi       # 0x2059
callq 0x12d0
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
setae %al
movzbl %al, %edi
leaq 0xce4(%rip), %rsi       # 0x2073
callq 0x12d0
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
setae %al
movzbl %al, %edi
leaq 0xcef(%rip), %rsi       # 0x209b
callq 0x12d0
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
setae %al
movzbl %al, %edi
leaq 0xcff(%rip), %rsi       # 0x20c8
callq 0x12d0
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
leaq 0xd16(%rip), %rdi       # 0x20f7
callq 0x1160
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1210
movzbl %al, %edi
leaq 0xcfc(%rip), %rsi       # 0x20f9
callq 0x12d0
movl -0x40(%rbp), %eax
movq -0x18(%rbp), %rsi
leaq 0xd07(%rip), %rdi       # 0x2117
movb %al, -0x39(%rbp)
callq 0x1040
movb -0x39(%rbp), %al
movq -0x10(%rbp), %rsi
leaq 0xcfd(%rip), %rdi       # 0x2123
callq 0x1040
movb -0x39(%rbp), %al
movq -0x20(%rbp), %rsi
leaq 0xcf6(%rip), %rdi       # 0x212f
callq 0x1040
movb -0x39(%rbp), %al
leaq 0xcf3(%rip), %rdi       # 0x213b
callq 0x1040
movq $-0x7fe, -0x30(%rbp)    # imm = 0xF802
movaps 0xbb4(%rip), %xmm1      # 0x2010
movq -0x30(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xbb3(%rip), %xmm1      # 0x2020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x30(%rbp), %rsi
leaq 0xc9e(%rip), %rdi       # 0x212a
movb $0x0, %al
callq 0x1040
movsd -0x38(%rbp), %xmm0
leaq 0xcab(%rip), %rdi       # 0x214a
movb $0x1, %al
callq 0x1040
xorl %eax, %eax
addq $0x60, %rsp
popq %rbp
retq