// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movsd %xmm1, -0x30(%rbp)
movsd %xmm0, -0x38(%rbp)
movq %rdi, %rsi
movq 0xac33(%rip), %rdi      # 0x15fc8
callq 0x31b0
leaq 0x5189(%rip), %rsi      # 0x1052a
movq %rax, %rdi
callq 0x31d0
movq %rax, %rbx
leaq -0x80(%rbp), %r14
movq %r14, %rdi
movsd -0x38(%rbp), %xmm0
callq 0xb585
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31b0
leaq 0x5174(%rip), %rsi      # 0x10543
movq %rax, %rdi
callq 0x31d0
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
movsd -0x30(%rbp), %xmm0
callq 0xb585
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x31b0
movq %rax, %rdi
callq 0x30f0
leaq -0x60(%rbp), %rdi
callq 0x3368
leaq -0x80(%rbp), %rdi
callq 0x3368
callq 0xb191
movapd %xmm0, %xmm3
mulsd 0x5049(%rip), %xmm0     # 0x10468
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
movapd %xmm0, %xmm2
cmpeqsd %xmm1, %xmm2
movq %xmm2, %rbx
andl $0x1, %ebx
ucomisd %xmm1, %xmm0
jne 0xb451
jnp 0xb476
jmp 0xb451
jmp 0xb571
jmp 0xb563
jmp 0xb571
movsd %xmm3, -0x40(%rbp)
movq 0xab6b(%rip), %rdi      # 0x15fc8
leaq 0x50e5(%rip), %rsi      # 0x10549
callq 0x31d0
movq %rax, %rdi
callq 0x30f0
movsd -0x40(%rbp), %xmm3
leaq 0x50ae(%rip), %r14      # 0x1052b
leaq -0x80(%rbp), %r15
leaq 0x50bb(%rip), %r12      # 0x10543
leaq -0x60(%rbp), %r13
movsd -0x38(%rbp), %xmm0
ucomisd %xmm3, %xmm0
ja 0xb4a7
ucomisd -0x30(%rbp), %xmm3
ja 0xb4a7
testb $0x1, %bl
jne 0xb54e
movq 0xab1a(%rip), %rdi      # 0x15fc8
movq %r14, %rsi
callq 0x31d0
movq %rax, %rbx
movq %r15, %rdi
movsd -0x38(%rbp), %xmm0
callq 0xb585
movq %rbx, %rdi
movq %r15, %rsi
callq 0x31b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x31d0
movq %rax, %rbx
movq %r13, %rdi
movsd -0x30(%rbp), %xmm0
callq 0xb585
movq %rbx, %rdi
movq %r13, %rsi
callq 0x31b0
movq %rax, %rdi
callq 0x30f0
movq %r13, %rdi
callq 0x3368
movq %r15, %rdi
callq 0x3368
callq 0xb191
movapd %xmm0, %xmm3
mulsd 0x4f48(%rip), %xmm0     # 0x10468
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
movapd %xmm0, %xmm2
cmpeqsd %xmm1, %xmm2
movq %xmm2, %rbx
andl $0x1, %ebx
ucomisd %xmm1, %xmm0
jne 0xb451
jnp 0xb48c
jmp 0xb451
movapd %xmm3, %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb571
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x3368
jmp 0xb574
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x3368
movq %rbx, %rdi
callq 0x3300