// File: /workspace/github_cpp_makefile_star2_O2/tap3edit[P]tap3xml/Asn.cpp
// Function: Asn::decode()
void Asn::decode()
{

    /* 1. Decode Specification */

    _decode_spec();


    /* 2. Prepare Tree to decode */

    if (!_tree)
    {
        cerr << "treenode structure was not set with tree() method";
        err_trace(__FILE__, __LINE__);
    }

    if (!_spec_rootnode.size())
    {
        cerr << "Error. The root node should be specified with the method \"specroot\"";
        err_trace(__FILE__, __LINE__);
    }

    _tree->pc=1;
    _tree->children=NULL;
    _tree->tagname=_spec_rootnode;
    _tree->indef = false;
    _tree->size_d = _bfin->get_end();


    /* 3. Read initial tag if needed */

    _bfin->set_pos(0);

    if ( _spec_tree[_spec_rootnode]->tagid )
    {
        /* The rootnode could have its own tag but not necessarily (like in case of CHOICE)  */
        /* In case it has, we read it here, because in _decode() we assume that the rootnode */
        /* is already decoded. E.g. "DataInterChange" has no own tag, but "Nrtrde" has.      */

        /* 3.1 Eat up the first tag */

        treenode *child=new treenode();

        _asnitem->tree(child);
        _asnitem->decode();

        if (_spec_tree[_spec_rootnode]->tagid == child->tag_d)
        {

            /* 3.1.1. Tag matches */

            _tree->tag_d = child->tag_d;
            _tree->size_d = child->size_d;
            _tree->indef = child->indef;
        }
        else
        {
            /* 3.1.2. Tag does not match */

            delete child; 
            child = NULL;

            cerr << "Error: File does not match the specifications";
            cerr << " tag: " << child->tag_d << " pos: " << _bfin->get_pos() << endl;
            err_trace(__FILE__, __LINE__);
        }

        delete child; 
        child = NULL;

    }

    /* 4. Decode file */

    _decode(_spec_tree[_spec_rootnode], _tree, _tree->size_d, _tree->indef);

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
callq 0xc188
cmpq $0x0, 0x18(%rbx)
jne 0xc456
movq 0xdbdb(%rip), %rdi      # 0x19ff0
leaq 0x67c0(%rip), %rsi      # 0x12bdc
callq 0x4290
leaq 0x678d(%rip), %rsi      # 0x12bb5
leaq 0x8(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x5caa
leaq 0x4(%rsp), %rsi
movl $0xd2, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0xb17a
leaq 0x8(%rsp), %rdi
callq 0x4150
cmpq $0x0, 0x48(%rbx)
jne 0xc4a5
movq 0xdb8c(%rip), %rdi      # 0x19ff0
leaq 0x67a3(%rip), %rsi      # 0x12c0e
callq 0x4290
leaq 0x673e(%rip), %rsi      # 0x12bb5
leaq 0x8(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x5caa
leaq 0x4(%rsp), %rsi
movl $0xd8, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0xb17a
leaq 0x8(%rsp), %rdi
callq 0x4150
leaq 0x40(%rbx), %r14
movq 0x18(%rbx), %rax
orw $0x4, 0x20(%rax)
movq 0x18(%rbx), %rdi
andq $0x0, 0x50(%rdi)
movq %r14, %rsi
callq 0x4180
movq 0x18(%rbx), %rax
andw $0xfeff, 0x20(%rax)     # imm = 0xFEFF
movq (%rbx), %rdi
callq 0xbcd8
movq 0x18(%rbx), %rcx
movq %rax, 0x30(%rcx)
movq (%rbx), %rdi
leaq 0x8(%rsp), %rsi
andq $0x0, (%rsi)
callq 0xbc00
leaq 0x60(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x8bf6
movq (%rax), %rax
cmpl $0x0, 0x40(%rax)
je 0xc638
pushq $0x58
popq %rdi
callq 0x42b0
movq %rax, %r12
movq %rax, %rdi
callq 0x5d54
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
movq %r12, %rsi
callq *0x8(%rax)
movq 0x10(%rbx), %rdi
callq 0xfad2
movq %r15, %rdi
movq %r14, %rsi
callq 0x8bf6
movq (%rax), %rax
movl 0x40(%rax), %eax
cmpl 0x24(%r12), %eax
jne 0xc581
movq 0x18(%rbx), %rcx
movl %eax, 0x24(%rcx)
movq 0x30(%r12), %rax
movq %rax, 0x30(%rcx)
movzwl 0x20(%r12), %eax
andl $0x100, %eax            # imm = 0x100
movl $0xfffffeff, %edx       # imm = 0xFFFFFEFF
andl 0x20(%rcx), %edx
orl %eax, %edx
movw %dx, 0x20(%rcx)
movq %r12, %rdi
callq 0x4150
jmp 0xc62d
movq %r12, %rdi
callq 0x4150
pushq $0x58
popq %rsi
movq %r12, %rdi
callq 0x42c0
movq 0xda55(%rip), %r12      # 0x19ff0
leaq 0x66b0(%rip), %rsi      # 0x12c52
movq %r12, %rdi
callq 0x4290
leaq 0x66cf(%rip), %rsi      # 0x12c80
movq %r12, %rdi
callq 0x4290
movl 0x24, %esi
movq %rax, %rdi
callq 0x4540
leaq 0x672e(%rip), %rsi      # 0x12cfd
movq %rax, %rdi
callq 0x4290
movq %rax, %r12
movq (%rbx), %rdi
callq 0xbbf8
movq %r12, %rdi
movq %rax, %rsi
callq 0x4280
movq %rax, %rdi
callq 0x4160
leaq 0x65b9(%rip), %rsi      # 0x12bb5
leaq 0x8(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x5caa
leaq 0x4(%rsp), %rsi
movl $0x105, (%rsi)          # imm = 0x105
leaq 0x8(%rsp), %rdi
callq 0xb17a
leaq 0x8(%rsp), %rdi
callq 0x4150
xorl %r12d, %r12d
pushq $0x58
popq %rsi
movq %r12, %rdi
callq 0x42c0
movq %r15, %rdi
movq %r14, %rsi
callq 0x8bf6
movq (%rax), %rsi
movq 0x18(%rbx), %rdx
movq 0x30(%rdx), %rcx
movzbl 0x21(%rdx), %r8d
andl $0x1, %r8d
movq %rbx, %rdi
callq 0xc69e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xc671
jmp 0xc682
jmp 0xc671
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4150
jmp 0xc695
jmp 0xc682
movq %rax, %rbx
jmp 0xc695
movq %rax, %rbx
pushq $0x58
popq %rsi
movq %r12, %rdi
callq 0x42c0
movq %rbx, %rdi
callq 0x4560
nop