// File: /workspace/github_cpp_makefile_star2_O3/tap3edit[P]tap3xml/AsnItem.cpp
// Function: AsnItem::decode()
void AsnItem::decode()
{
    int i;
    string buffin;

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

    if (!_bfin)
    {
        cerr << "buffin was not set with buffin() method";
        err_trace(__FILE__, __LINE__);
    }

    _tree->tag_d=0;
    _tree->tag_l=0;
    memset(_tree->tag_x,  '\0', 4);

    _tree->size_d=0;
    _tree->size_l=0;
    _tree->indef=0;
    memset(_tree->size_x, '\0', 5);


    /* 1. Decode Tag */

    {

        /* 1.1. Read first byte of tag */

        _bfin->read(1);
        buffin=_bfin->get_buf();


        /* 1.2. Store class, primitive/constructed info and hexa tag */

        _tree->cl=buffin[0]>>6;
        _tree->pc=(buffin[0]>>5)&0x1;
        _tree->tag_x[0]=(uchar)buffin[0];
        _tree->tag_l=1;


        /* 1.3. Work according to number of tag octets */

        if ( ( buffin[0]&0x1F ) == 0x1F )
        {
            /* 1.3.1 Tag has more than one octet */


            for(i=1;i<=4;i++)
            {
                _bfin->read(1);
                buffin=_bfin->get_buf();

                _tree->tag_d<<=7;
                _tree->tag_d+=(int)(((uchar)buffin[0])&0x7F);
                _tree->tag_x[i]=(uchar)buffin[0];
                _tree->tag_l+=1;

                if ( ! (buffin[0]>>7) )
                    break;

            }

            if ( i>3 )
            {
                cerr << "Found tag bigger than 4 bytes at file position: " << _bfin->get_pos();
                err_trace(__FILE__, __LINE__);
            }

        } 
        else
        {
            /* 1.3.2 Tag has just one octet */

            _tree->tag_d=(int)buffin[0]&0x1F;
        }

    }


    /* 2. Decode Size */

    {

        /* 2.1. Read first byte of tag */

        _bfin->read(1);
        buffin=_bfin->get_buf();


        /* 2.2. Storing size_x */

        _tree->size_x[0]=buffin[0];
        _tree->size_l=1;


        /* 2.3. Work according the number of octets */

        if (buffin[0]>>7)
        {
            /* 2.3.1. Size with more than one octet */

            for(i=1;(i<=(int)(_tree->size_x[0]&0x7F)) && (i<=4);i++)
            {
                _bfin->read(1);
                buffin=_bfin->get_buf();

                _tree->size_d<<=8;
                _tree->size_d+=(int)((uchar)buffin[0]);
                _tree->size_x[i]=buffin[0];
                _tree->size_l+=1;
            }

            if ( i>7 )
            {
                cerr << "Found size bigger than 8 bytes at file position: " << _bfin->get_pos();
                err_trace(__FILE__, __LINE__);
            }

            /* 2.3.2. If the size is still 0, then it's a tag with indefinite length */
             
            if (_tree->size_d == 0)
            {
                _tree->indef = 1;
            }

        }
        else
        {
            /* 2.3.3. Size with just one octet */

            _tree->size_d=(int)(buffin[0]);

        }

    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
cmpq $0x0, 0x40(%rdi)
jne 0x12e94
movq 0xa1b5(%rip), %rdi      # 0x1cff0
leaq 0x3d9a(%rip), %rsi      # 0x16bdc
movl $0x31, %edx
callq 0x4340
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4232(%rip), %rsi      # 0x1708e
leaq 0x4236(%rip), %rdx      # 0x17099
movq %rsp, %rdi
callq 0x6c96
leaq 0x24(%rsp), %rsi
movl $0x3b, (%rsi)
movq %rsp, %rdi
callq 0xcde4
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x12e94
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
cmpq $0x0, 0x30(%rbx)
jne 0x12efb
movq 0xa14e(%rip), %rdi      # 0x1cff0
leaq 0x41f1(%rip), %rsi      # 0x1709a
movl $0x27, %edx
callq 0x4340
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x41cb(%rip), %rsi      # 0x1708e
leaq 0x41cf(%rip), %rdx      # 0x17099
movq %rsp, %rdi
callq 0x6c96
leaq 0x24(%rsp), %rsi
movl $0x41, (%rsi)
movq %rsp, %rdi
callq 0xcde4
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x12efb
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x40(%rbx), %rax
xorl %ecx, %ecx
movq %rcx, 0x24(%rax)
movl %ecx, 0x2c(%rax)
movq 0x40(%rbx), %rax
movq %rcx, 0x30(%rax)
movl %ecx, 0x40(%rax)
andb $-0x2, 0x21(%rax)
movq 0x40(%rbx), %rax
movl %ecx, 0x38(%rax)
movb $0x0, 0x3c(%rax)
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0xddf8
movq 0x30(%rbx), %rsi
movq %rsp, %rdi
callq 0xdf7c
leaq 0x28(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x43a0
movq (%r14), %rdi
leaq 0x10(%rsp), %r13
cmpq %r13, %rdi
je 0x12f66
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x28(%rsp), %rcx
movzbl (%rcx), %eax
shrl $0x6, %eax
movq 0x40(%rbx), %rdx
movl 0x20(%rdx), %esi
andl $-0x4, %esi
orl %eax, %esi
movw %si, 0x20(%rdx)
movzbl (%rcx), %eax
movq 0x40(%rbx), %rdx
movl 0x20(%rdx), %esi
shrl $0x3, %eax
andl $0x4, %eax
andl $-0x5, %esi
orl %eax, %esi
movw %si, 0x20(%rdx)
movb (%rcx), %al
movq 0x40(%rbx), %rdx
movb %al, 0x28(%rdx)
movq 0x40(%rbx), %rax
movl $0x1, 0x2c(%rax)
movzbl (%rcx), %ecx
andl $0x1f, %ecx
cmpl $0x1f, %ecx
jne 0x13041
xorl %ebp, %ebp
movq %rsp, %r14
leaq 0x28(%rsp), %r15
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0xddf8
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0xdf7c
movq %r15, %rdi
movq %r14, %rsi
callq 0x43a0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x13002
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x40(%rbx), %rax
movl 0x24(%rax), %ecx
shll $0x7, %ecx
movl %ecx, 0x24(%rax)
movq 0x28(%rsp), %rdx
movzbl (%rdx), %esi
andl $0x7f, %esi
orl %ecx, %esi
movl %esi, 0x24(%rax)
movb (%rdx), %cl
movb %cl, 0x29(%rax,%rbp)
movq 0x40(%rbx), %rax
incl 0x2c(%rax)
movq 0x28(%rsp), %rax
cmpb $0x0, (%rax)
jns 0x13046
incq %rbp
cmpq $0x4, %rbp
jne 0x12fc7
jmp 0x1304c
movl %ecx, 0x24(%rax)
jmp 0x130be
cmpq $0x3, %rbp
jne 0x130be
movq 0x9f9d(%rip), %rdi      # 0x1cff0
leaq 0x4068(%rip), %rsi      # 0x170c2
movl $0x30, %edx
callq 0x4340
movq 0x30(%rbx), %rdi
callq 0xdcb0
movq 0x9f7c(%rip), %rdi      # 0x1cff0
movq %rax, %rsi
callq 0x4290
movq %rsp, %rdi
movq %r13, (%rdi)
leaq 0x4005(%rip), %rsi      # 0x1708e
leaq 0x4009(%rip), %rdx      # 0x17099
callq 0x6c96
leaq 0x24(%rsp), %rsi
movl $0x79, (%rsi)
movq %rsp, %rdi
callq 0xcde4
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x130be
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0xddf8
movq 0x30(%rbx), %rsi
movq %rsp, %rdi
callq 0xdf7c
leaq 0x28(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x43a0
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x130fd
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x28(%rsp), %rcx
movb (%rcx), %al
movq 0x40(%rbx), %rdx
movb %al, 0x38(%rdx)
movq 0x40(%rbx), %rax
movl $0x1, 0x40(%rax)
movsbq (%rcx), %rcx
testq %rcx, %rcx
js 0x13128
movq %rcx, 0x30(%rax)
jmp 0x131c9
testb $0x7f, 0x38(%rax)
je 0x131be
movl $0x39, %ebp
movq %rsp, %r14
leaq 0x28(%rsp), %r15
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0xddf8
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0xdf7c
movq %r15, %rdi
movq %r14, %rsi
callq 0x43a0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x1317a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
leaq -0x38(%rbp), %rcx
movq 0x40(%rbx), %rax
movq 0x30(%rax), %rdx
shlq $0x8, %rdx
movq %rdx, 0x30(%rax)
movq 0x28(%rsp), %rsi
movzbl (%rsi), %edi
orq %rdx, %rdi
movq %rdi, 0x30(%rax)
movb (%rsi), %dl
movb %dl, (%rax,%rbp)
movq 0x40(%rbx), %rax
incl 0x40(%rax)
cmpq $0x3, %rcx
ja 0x131be
movzbl 0x38(%rax), %edx
andl $0x7f, %edx
incq %rbp
cmpq %rdx, %rcx
jb 0x1313f
cmpq $0x0, 0x30(%rax)
jne 0x131c9
orb $0x1, 0x21(%rax)
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x131e0
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42e0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
jne 0x1320f
jmp 0x1322f
jmp 0x1322c
jmp 0x13203
jmp 0x1322c
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x1322f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
jmp 0x1322f
jmp 0x1322c
jmp 0x1322c
jmp 0x1322c
jmp 0x1322c
jmp 0x1322c
jmp 0x1322c
jmp 0x1322c
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x13246
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42e0
movq %rbx, %rdi
callq 0x4590