// File: danishansari[P]NumberToText/test/testConvertor.cpp
// Function: main
int main(int argc, char*argv[])
{
    if (argc < 2)
    {
        cout << "usage: " << endl;
        cout << argv[0] << "-l <language(def=english)>\t e.g. " << argv[0] << " -l english 123" << endl;
        cout << argv[0] << "-r <range(any number)>    \t e.g  " << argv[0] << " -r 99" << endl;
        cout << argv[0] << "1 2 3 4 ...               \t e.g. " << argv[0] << " 1 99 156"<< endl;

        return -1;
    }

    vector<string> numbersVec;

    string lang = "english";

    int range = 0;
    
    for (int i = 1; i < argc; i++)
    {
        if (strcmp(argv[i], "-l") == 0)
            lang = argv[++i];
        if (strcmp(argv[i], "-r") == 0)
            range = atoi(argv[++i]);
        else
            numbersVec.push_back(string(argv[i]));
    }

    if (range)
    {
        numbersVec.clear();

        for (int i = 0; i < range; i++)
        {
            stringstream ss;
            ss << i;

            numbersVec.push_back(ss.str());
        }
    }

    NumToText* convertor = NumToText::getConvertor(lang);

    if (convertor)
    {
        for (int i = 0; i < numbersVec.size(); i++)
            cout << numbersVec[i] << ": " << convertor->convert(numbersVec[i]) << endl;
    }
    else
        cout << "could not convert!!" << endl;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x485e
movq 0x7886(%rip), %rdi      # 0xbfd0
leaq 0x38b3(%rip), %rsi      # 0x8004
callq 0x21f0
movq %rax, %rdi
movq 0x7860(%rip), %rsi      # 0xbfc0
callq 0x2220
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq 0x785d(%rip), %rdi      # 0xbfd0
callq 0x21f0
movq %rax, %rdi
leaq 0x388a(%rip), %rsi      # 0x800c
callq 0x21f0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x21f0
movq %rax, %rdi
leaq 0x388e(%rip), %rsi      # 0x802e
callq 0x21f0
movq %rax, %rdi
movq 0x7811(%rip), %rsi      # 0xbfc0
callq 0x2220
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq 0x780e(%rip), %rdi      # 0xbfd0
callq 0x21f0
movq %rax, %rdi
leaq 0x386d(%rip), %rsi      # 0x803e
callq 0x21f0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x21f0
movq %rax, %rdi
leaq 0x3871(%rip), %rsi      # 0x8060
callq 0x21f0
movq %rax, %rdi
movq 0x77c2(%rip), %rsi      # 0xbfc0
callq 0x2220
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq 0x77bf(%rip), %rdi      # 0xbfd0
callq 0x21f0
movq %rax, %rdi
leaq 0x3847(%rip), %rsi      # 0x8067
callq 0x21f0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x21f0
movq %rax, %rdi
leaq 0x384b(%rip), %rsi      # 0x8089
callq 0x21f0
movq %rax, %rdi
movq 0x7773(%rip), %rsi      # 0xbfc0
callq 0x2220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4d10
leaq -0x28(%rbp), %rdi
callq 0x4d30
leaq -0x49(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
callq 0x2360
movq -0x2b0(%rbp), %rdx
leaq 0x380e(%rip), %rsi      # 0x8093
leaq -0x48(%rbp), %rdi
callq 0x4d50
jmp 0x4890
leaq -0x49(%rbp), %rdi
callq 0x2240
movl $0x0, -0x60(%rbp)
movl $0x1, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4a0f
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x37d5(%rip), %rsi      # 0x809b
callq 0x22a0
cmpl $0x0, %eax
jne 0x491c
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl %ecx, %edx
incl %edx
movl %edx, -0x64(%rbp)
movq 0x8(%rax,%rcx,8), %rsi
leaq -0x48(%rbp), %rdi
callq 0x2290
jmp 0x48ef
jmp 0x491c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x2240
jmp 0x4d05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4cfc
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x376f(%rip), %rsi      # 0x809e
callq 0x22a0
cmpl $0x0, %eax
jne 0x495a
movq -0x10(%rbp), %rax
movl -0x64(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x64(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x22e0
movl %eax, -0x60(%rbp)
jmp 0x49ff
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x2c0(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x2360
movq -0x2c0(%rbp), %rsi
movq -0x2b8(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0x4d50
jmp 0x499c
leaq -0x28(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4e00
jmp 0x49ae
leaq -0x88(%rbp), %rdi
callq 0x2110
leaq -0x89(%rbp), %rdi
callq 0x2240
jmp 0x49ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x49ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x2110
leaq -0x89(%rbp), %rdi
callq 0x2240
jmp 0x4cfc
jmp 0x4a01
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x48a7
cmpl $0x0, -0x60(%rbp)
je 0x4ae9
leaq -0x28(%rbp), %rdi
callq 0x4e30
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x60(%rbp), %eax
jge 0x4ae7
leaq -0x218(%rbp), %rdi
callq 0x2140
jmp 0x4a49
leaq -0x208(%rbp), %rdi
movl -0x90(%rbp), %esi
callq 0x2340
jmp 0x4a5d
leaq -0x238(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x21e0
jmp 0x4a72
leaq -0x28(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x4e00
jmp 0x4a84
leaq -0x238(%rbp), %rdi
callq 0x2110
leaq -0x218(%rbp), %rdi
callq 0x2160
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x4a2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4ad6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x2110
leaq -0x218(%rbp), %rdi
callq 0x2160
jmp 0x4cfc
jmp 0x4ae9
leaq -0x260(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x20a0
jmp 0x4afb
leaq -0x260(%rbp), %rdi
callq 0x7920
movq %rax, -0x2c8(%rbp)
jmp 0x4b10
leaq -0x260(%rbp), %rdi
callq 0x2110
movq -0x2c8(%rbp), %rax
movq %rax, -0x240(%rbp)
cmpq $0x0, -0x240(%rbp)
je 0x4cae
movl $0x0, -0x264(%rbp)
movslq -0x264(%rbp), %rax
movq %rax, -0x2d0(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x4e50
movq %rax, %rcx
movq -0x2d0(%rbp), %rax
cmpq %rcx, %rax
jae 0x4cac
movslq -0x264(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x4e70
movq %rax, %rsi
movq 0x744a(%rip), %rdi      # 0xbfd0
callq 0x21c0
movq %rax, -0x2d8(%rbp)
jmp 0x4b94
movq -0x2d8(%rbp), %rdi
leaq 0x3467(%rip), %rsi      # 0x8009
callq 0x21f0
movq %rax, -0x2e0(%rbp)
jmp 0x4bb0
movq -0x240(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movslq -0x264(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x4e70
movq %rax, %rsi
leaq -0x2a8(%rbp), %rdi
callq 0x20a0
jmp 0x4bdf
movq -0x2e8(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x288(%rbp), %rdi
leaq -0x2a8(%rbp), %rdx
callq *%rax
jmp 0x4bfe
movq -0x2e0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x21c0
movq %rax, -0x2f0(%rbp)
jmp 0x4c1a
movq -0x2f0(%rbp), %rdi
movq 0x7398(%rip), %rsi      # 0xbfc0
callq 0x2220
jmp 0x4c2f
leaq -0x288(%rbp), %rdi
callq 0x2110
leaq -0x2a8(%rbp), %rdi
callq 0x2110
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
jmp 0x4b42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x2110
jmp 0x4cfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4c9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x2110
leaq -0x2a8(%rbp), %rdi
callq 0x2110
jmp 0x4cfc
jmp 0x4ce1
movq 0x731b(%rip), %rdi      # 0xbfd0
leaq 0x33e5(%rip), %rsi      # 0x80a1
callq 0x21f0
movq %rax, -0x2f8(%rbp)
jmp 0x4cca
movq -0x2f8(%rbp), %rdi
movq 0x72e8(%rip), %rsi      # 0xbfc0
callq 0x2220
jmp 0x4cdf
jmp 0x4ce1
movl $0x0, -0x4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x2110
leaq -0x28(%rbp), %rdi
callq 0x4e90
jmp 0x4d10
leaq -0x48(%rbp), %rdi
callq 0x2110
leaq -0x28(%rbp), %rdi
callq 0x4e90
jmp 0x4d1c
movl -0x4(%rbp), %eax
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x2350
nopw %cs:(%rax,%rax)
nop