// File: dnegovan[P]Intruder-On-Donnar-V/dansLibrary.cpp
// Function: getMoneyWithinRange(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, double)
double getMoneyWithinRange(std::string prompt, double min, double max)
{
    bool isMoney = true;

    std::cout << prompt << " Choose an amount from $" << makeTwoDecimals(min)
              << " to $" << makeTwoDecimals(max) << std::endl;
    double input = getDouble();

    //check that they only entered 2 numbers after decimal
    double check1 = input * 100;
    int check2 = check1;
    if (check1 != check2)
    {
        isMoney = false;
        std::cout << "Please enter a valid monetary value in USD."
                  << std::endl;
    }

    //validate range
    while(input < min || input > max || !isMoney)
    {
        std::cout << "Choose an amount from $" << makeTwoDecimals(min)
                  << " to $" << makeTwoDecimals(max) << std::endl;

        input = getDouble();

        //check that they only entered 2 numbers after decimal
        double check1 = input * 100;
        int check2 = check1;
        if (check1 != check2)
        {
            isMoney = false;
            std::cout << "Please enter a valid monetary value in USD."
                      << std::endl;
        }
        else
        {
            isMoney = true;
        }
    }

    return input;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, %rsi
movq %rsi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movb $0x1, -0x19(%rbp)
movq 0x112b1(%rip), %rdi     # 0x28fc8
callq 0x31e0
movq %rax, %rdi
leaq 0x7824(%rip), %rsi      # 0x1f54a
callq 0x3210
movq %rax, -0xf0(%rbp)
movsd -0x10(%rbp), %xmm0
leaq -0x40(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x18040
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rsi
callq 0x31e0
movq %rax, -0xe0(%rbp)
jmp 0x17d63
movq -0xe0(%rbp), %rdi
leaq 0x77f2(%rip), %rsi      # 0x1f563
callq 0x3210
movq %rax, -0xf8(%rbp)
jmp 0x17d7f
movsd -0x18(%rbp), %xmm0
leaq -0x70(%rbp), %rdi
callq 0x18040
jmp 0x17d8f
movq -0xf8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x31e0
movq %rax, -0x100(%rbp)
jmp 0x17da8
movq -0x100(%rbp), %rdi
movq 0x111fa(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x17dbd
leaq -0x70(%rbp), %rdi
callq 0x3448
leaq -0x40(%rbp), %rdi
callq 0x3448
callq 0x17a60
movsd %xmm0, -0x78(%rbp)
movsd 0x76a7(%rip), %xmm0     # 0x1f488
mulsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
cvttsd2si -0x80(%rbp), %eax
movl %eax, -0x84(%rbp)
movsd -0x80(%rbp), %xmm0
cvtsi2sdl -0x84(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jne 0x17e0d
jp 0x17e0d
jmp 0x17e66
movb $0x0, -0x19(%rbp)
movq 0x111b0(%rip), %rdi     # 0x28fc8
leaq 0x774a(%rip), %rsi      # 0x1f569
callq 0x3210
movq %rax, %rdi
movq 0x11182(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x17e66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x17e58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3448
leaq -0x40(%rbp), %rdi
callq 0x3448
jmp 0x1802e
jmp 0x17e68
movsd -0x78(%rbp), %xmm1
movsd -0x10(%rbp), %xmm0
movb $0x1, %al
ucomisd %xmm1, %xmm0
movb %al, -0x101(%rbp)
ja 0x17e9f
movsd -0x78(%rbp), %xmm0
movb $0x1, %al
ucomisd -0x18(%rbp), %xmm0
movb %al, -0x101(%rbp)
ja 0x17e9f
movb -0x19(%rbp), %al
xorb $-0x1, %al
movb %al, -0x101(%rbp)
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x17eae
jmp 0x18020
movq 0x11113(%rip), %rdi     # 0x28fc8
leaq 0x768f(%rip), %rsi      # 0x1f54b
callq 0x3210
movq %rax, -0x120(%rbp)
movsd -0x10(%rbp), %xmm0
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x18040
movq -0x120(%rbp), %rdi
movq -0x118(%rbp), %rsi
callq 0x31e0
movq %rax, -0x110(%rbp)
jmp 0x17efc
movq -0x110(%rbp), %rdi
leaq 0x7659(%rip), %rsi      # 0x1f563
callq 0x3210
movq %rax, -0x128(%rbp)
jmp 0x17f18
movsd -0x18(%rbp), %xmm0
leaq -0xc8(%rbp), %rdi
callq 0x18040
jmp 0x17f2b
movq -0x128(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x31e0
movq %rax, -0x130(%rbp)
jmp 0x17f47
movq -0x130(%rbp), %rdi
movq 0x1105b(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x17f5c
leaq -0xc8(%rbp), %rdi
callq 0x3448
leaq -0xa8(%rbp), %rdi
callq 0x3448
callq 0x17a60
movsd %xmm0, -0x78(%rbp)
movsd 0x7502(%rip), %xmm0     # 0x1f488
mulsd -0x78(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
cvttsd2si -0xd0(%rbp), %eax
movl %eax, -0xd4(%rbp)
movsd -0xd0(%rbp), %xmm0
cvtsi2sdl -0xd4(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jne 0x17fbb
jp 0x17fbb
jmp 0x18017
movb $0x0, -0x19(%rbp)
movq 0x11002(%rip), %rdi     # 0x28fc8
leaq 0x759c(%rip), %rsi      # 0x1f569
callq 0x3210
movq %rax, %rdi
movq 0x10fd4(%rip), %rsi     # 0x28fb0
callq 0x3240
jmp 0x1801b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x18009
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3448
leaq -0xa8(%rbp), %rdi
callq 0x3448
jmp 0x1802e
movb $0x1, -0x19(%rbp)
jmp 0x17e68
movsd -0x78(%rbp), %xmm0
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x33c0
nopw (%rax,%rax)