// File: /workspace/github_cpp_makefile_star2_O1/thuydx55[P]C-Number-to-Word/NumberRepresentation/Number.cpp
// Function: Number::getTextRepresentation[abi:cxx11](LanguageType)
string Number::getTextRepresentation(LanguageType type) {
    vector<string> words;
    Language* lang = Language::getLanguage(type);

    string tempNumStr = string(mNumStr);
    bool isNegative = false;

    if (tempNumStr[0] == '-') {
        isNegative = true;
        tempNumStr.erase(0,1);
    }

    while(tempNumStr.size() % 3)
        tempNumStr = '0' + tempNumStr;

    stack<string> bigGroups = divideStringToBigGroup(tempNumStr);
    while(!bigGroups.empty()) {
        string bigGroup = bigGroups.top();
        bigGroups.pop();

        // cout << bigGroup << endl;

        stack<string> groups = divideStringToSmallGroup(bigGroup);

        while(!groups.empty()) {
            string subNumber = groups.top();
            groups.pop();

            // cout << subNumber << endl;

            if (subNumber[0] == '0' && subNumber[1] == '0' && subNumber[2] == '0')
                continue;

            if (subNumber[0] > '0') {
                words.push_back(getElement(lang->getOnes(), subNumber[0]));
                words.push_back(lang->getHundred());
            }

            if ((subNumber[0] > '0' || words.size()) && (subNumber[1] > '0' || subNumber[2] > '0'))
                words.push_back(lang->getConnectiveHundredsAndNext());

            if (subNumber[1] == '0' || subNumber[1] > '1') {
                if (subNumber[1] > '1')
                    words.push_back(getElement(lang->getTens(), subNumber[1]));
                if (subNumber[2] > '0') {
                    if (subNumber[1] == '0' && words.size() > 0)
                        words.push_back(lang->getConnectiveTensAndOnes());
                    words.push_back(getElement(lang->getOnes(), subNumber[2]));
                }
            }
            else {
                words.push_back(getElement(lang->getTeens(), subNumber[2]));
            }
            const vector<string> powers = lang->getPowers();
            words.push_back(powers[groups.size()]);
            for (short i = 0; i < bigGroups.size(); i++) {
                words.push_back(powers[powers.size()-1]);
            }
        }
    }
    if (words.size() && isNegative)
        words.insert(words.begin(), lang->getNegative());
    string result = "";
    for (short i = 0; i < words.size(); ++i)
    {
        if (words[i].length())
            result += words[i] + " ";
    }

    // Remove last space
    if (result.length())
        result = result.substr(0, result.size()-1);
    else
        result = lang->getOnes()[0];

    delete lang;

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rsi, %rbx
movq %rdi, %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movl %edx, %edi
callq 0x54a8
movq %rax, %r14
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x58(%rsp), %rdi
callq 0x3722
movq 0x58(%rsp), %rax
movb (%rax), %al
movb %al, 0xf(%rsp)
cmpb $0x2d, %al
jne 0x3967
leaq 0x58(%rsp), %rdi
movl $0x1, %edx
xorl %esi, %esi
callq 0x2040
movq %r15, 0x50(%rsp)
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
movq 0x60(%rsp), %rax
imulq %r12, %rax
movabsq $0x5555555555555556, %r13 # imm = 0x5555555555555556
cmpq %r13, %rax
jb 0x39e9
leaq 0x118(%rsp), %rbp
leaq 0x108(%rsp), %rbx
leaq 0x58(%rsp), %r15
movq %rbx, %rdi
movl $0x30, %esi
movq %r15, %rdx
callq 0x44a7
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2160
movq 0x108(%rsp), %rdi
cmpq %rbp, %rdi
je 0x39db
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x2130
movq 0x60(%rsp), %rax
imulq %r12, %rax
cmpq %r13, %rax
jae 0x39a3
leaq 0x108(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x4150
movq 0x138(%rsp), %rax
cmpq 0x118(%rsp), %rax
je 0x3e57
leaq 0x88(%rsp), %r15
leaq 0x20(%rsp), %rbp
leaq 0xe8(%rsp), %r13
leaq 0x10(%rsp), %r12
leaq 0x30(%rsp), %rbx
cmpq 0x140(%rsp), %rax
jne 0x3a4e
movq 0x150(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
leaq 0xf8(%rsp), %rcx
movq %rcx, 0xe8(%rsp)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x3722
leaq 0x108(%rsp), %rdi
callq 0x490c
leaq 0x98(%rsp), %rdi
movq %r13, %rdx
callq 0x4384
movq 0xc8(%rsp), %rax
cmpq 0xa8(%rsp), %rax
je 0x3e07
cmpq 0xd0(%rsp), %rax
jne 0x3ac2
movq 0xe0(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
movq %r15, 0x78(%rsp)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0x3722
leaq 0x98(%rsp), %rdi
callq 0x490c
movq 0x78(%rsp), %rcx
movb (%rcx), %al
cmpb $0x30, %al
jne 0x3b04
cmpb $0x30, 0x1(%rcx)
jne 0x3b04
cmpb $0x30, 0x2(%rcx)
je 0x3de4
cmpb $0x31, %al
jl 0x3b77
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq 0x78(%rsp), %rcx
movsbq (%rcx), %rcx
movq (%rax), %rax
shlq $0x5, %rcx
movq %rbp, 0x10(%rsp)
movq -0x600(%rax,%rcx), %rsi
movq -0x5f8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3722
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4998
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3b63
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2130
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4528
movq 0x78(%rsp), %rax
cmpb $0x30, (%rax)
jg 0x3b8d
movq 0x38(%rsp), %rcx
cmpq 0x30(%rsp), %rcx
je 0x3bad
cmpb $0x30, 0x1(%rax)
jg 0x3b99
cmpb $0x31, 0x2(%rax)
jl 0x3bad
movq (%r14), %rax
movq %r14, %rdi
callq *0x38(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4528
movq 0x78(%rsp), %rax
movb 0x1(%rax), %al
cmpb $0x30, %al
setne %cl
cmpb $0x32, %al
setl %dl
testb %dl, %cl
jne 0x3ca3
cmpb $0x32, %al
jl 0x3c27
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
movq 0x78(%rsp), %rcx
movsbq 0x1(%rcx), %rcx
movq (%rax), %rax
shlq $0x5, %rcx
movq %rbp, 0x10(%rsp)
movq -0x600(%rax,%rcx), %rsi
movq -0x5f8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3722
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4998
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3c27
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2130
movq 0x78(%rsp), %rax
cmpb $0x31, 0x2(%rax)
jl 0x3cff
cmpb $0x30, 0x1(%rax)
jne 0x3c5c
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x3c5c
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4528
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq 0x78(%rsp), %rcx
movsbq 0x2(%rcx), %rcx
movq (%rax), %rax
shlq $0x5, %rcx
movq %rbp, 0x10(%rsp)
movq -0x600(%rax,%rcx), %rsi
movq -0x5f8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3722
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4998
jmp 0x3ce8
movq (%r14), %rax
movq %r14, %rdi
callq *0x18(%rax)
movq 0x78(%rsp), %rcx
movsbq 0x2(%rcx), %rcx
movq (%rax), %rax
shlq $0x5, %rcx
movq %rbp, 0x10(%rsp)
movq -0x600(%rax,%rcx), %rsi
movq -0x5f8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3722
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4998
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3cff
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2130
movq (%r14), %rax
movq %r14, %rdi
callq *0x28(%rax)
movq %r12, %rdi
movq %rax, %rsi
callq 0x4566
movq 0xe0(%rsp), %rax
movq %rax, %rsi
subq 0xc0(%rsp), %rsi
shrq $0x3, %rsi
cmpq $0x1, %rax
adcq $-0x1, %rsi
movq 0xc8(%rsp), %rax
subq 0xd0(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xa8(%rsp), %rcx
addq %rax, %rcx
shlq $0x9, %rsi
addq 0x10(%rsp), %rsi
addq %rcx, %rsi
movq %rbx, %rdi
callq 0x4528
xorl %r13d, %r13d
movswq %r13w, %rax
movq 0x150(%rsp), %rcx
movq %rcx, %rdx
subq 0x130(%rsp), %rdx
shrq $0x3, %rdx
cmpq $0x1, %rcx
adcq $-0x1, %rdx
shlq $0x4, %rdx
movq 0x138(%rsp), %rcx
subq 0x140(%rsp), %rcx
movq 0x128(%rsp), %rsi
sarq $0x5, %rcx
subq 0x118(%rsp), %rsi
sarq $0x5, %rsi
addq %rcx, %rsi
addq %rdx, %rsi
cmpq %rax, %rsi
jbe 0x3ddc
movq 0x18(%rsp), %rsi
addq $-0x20, %rsi
movq %rbx, %rdi
callq 0x4528
incl %r13d
jmp 0x3d6c
movq %r12, %rdi
callq 0x45f0
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a8e
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x3a8e
leaq 0x98(%rsp), %rdi
callq 0x4724
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x3e39
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2130
movq 0x138(%rsp), %rax
cmpq 0x118(%rsp), %rax
leaq 0xe8(%rsp), %r13
jne 0x3a30
cmpb $0x2d, 0xf(%rsp)
jne 0x3e83
movq 0x30(%rsp), %rbx
cmpq %rbx, 0x38(%rsp)
je 0x3e83
movq (%r14), %rax
movq %r14, %rdi
callq *0x48(%rax)
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x464c
movq 0x50(%rsp), %rdi
leaq 0x10(%rdi), %r12
movq %r12, (%rdi)
leaq 0x2187(%rip), %rdx      # 0x601d
movq %rdx, %rsi
callq 0x37b2
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x3f56
movw $0x1, %bp
leaq 0xa8(%rsp), %r13
xorl %ecx, %ecx
leaq 0x98(%rsp), %rbx
leaq 0x213f(%rip), %r15      # 0x600a
shlq $0x5, %rcx
cmpq $0x0, 0x8(%rax,%rcx)
je 0x3f36
addq %rcx, %rax
movq %r13, 0x98(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3722
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2200
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x50(%rsp), %rdi
callq 0x2060
movq 0x98(%rsp), %rdi
cmpq %r13, %rdi
je 0x3f36
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2130
movswq %bp, %rcx
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x3ecb
movq 0x50(%rsp), %r15
movq 0x8(%r15), %rcx
testq %rcx, %rcx
je 0x3fae
decq %rcx
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x2140
leaq 0x98(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2160
movq (%rbx), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x3fc2
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x3fc2
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq (%rax), %rsi
movq %r15, %rdi
callq 0x20b0
testq %r14, %r14
je 0x3fd0
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
leaq 0x108(%rsp), %rdi
callq 0x4724
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x3ff9
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x30(%rsp), %rdi
callq 0x45f0
movq %r15, %rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x407c
jmp 0x4030
jmp 0x4030
jmp 0x406f
jmp 0x406f
jmp 0x407c
jmp 0x4026
movq %rax, %rbx
jmp 0x413e
jmp 0x4035
movq %rax, %rbx
jmp 0x4055
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r13, %rdi
je 0x4055
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2130
movq 0x50(%rsp), %rax
movq (%rax), %rdi
cmpq %r12, %rdi
je 0x4115
movq (%r12), %rsi
jmp 0x410d
movq %rax, %rbx
jmp 0x4115
movq %rax, %rbx
jmp 0x40f0
movq %rax, %rbx
jmp 0x4122
jmp 0x408e
jmp 0x408e
jmp 0x408e
jmp 0x40b7
jmp 0x40b7
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x40c9
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x40c9
jmp 0x40b7
jmp 0x40bc
jmp 0x40b7
movq %rax, %rbx
jmp 0x40e3
jmp 0x40b7
movq %rax, %rbx
jmp 0x40c9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x45f0
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x40e3
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x98(%rsp), %rdi
callq 0x4724
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x4115
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x108(%rsp), %rdi
callq 0x4724
leaq 0x68(%rsp), %rax
movq 0x58(%rsp), %rdi
cmpq %rax, %rdi
je 0x413e
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x30(%rsp), %rdi
callq 0x45f0
movq %rbx, %rdi
callq 0x21d0