// File: /workspace/github_cpp_makefile_star2_O1/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 0x1357c
movq 0x9acd(%rip), %rdi      # 0x1cff0
leaq 0x36b2(%rip), %rsi      # 0x16bdc
movl $0x31, %edx
callq 0x4340
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x3b4a(%rip), %rsi      # 0x1708e
leaq 0x3b4e(%rip), %rdx      # 0x17099
movq %rsp, %rdi
callq 0x6e3c
leaq 0x24(%rsp), %rsi
movl $0x3b, (%rsi)
movq %rsp, %rdi
callq 0xd138
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x1357c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
cmpq $0x0, 0x30(%rbx)
jne 0x135e3
movq 0x9a66(%rip), %rdi      # 0x1cff0
leaq 0x3b09(%rip), %rsi      # 0x1709a
movl $0x27, %edx
callq 0x4340
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x3ae3(%rip), %rsi      # 0x1708e
leaq 0x3ae7(%rip), %rdx      # 0x17099
movq %rsp, %rdi
callq 0x6e3c
leaq 0x24(%rsp), %rsi
movl $0x41, (%rsi)
movq %rsp, %rdi
callq 0xd138
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x135e3
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 0xe492
movq 0x30(%rbx), %rsi
movq %rsp, %rdi
callq 0xe616
leaq 0x28(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x43a0
movq (%r14), %rdi
leaq 0x10(%rsp), %r13
cmpq %r13, %rdi
je 0x1364e
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 0x1372e
xorl %ebp, %ebp
movq %rsp, %r14
leaq 0x28(%rsp), %r15
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0xe492
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0xe616
movq %r15, %rdi
movq %r14, %rsi
callq 0x43a0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x136ea
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 0x13733
incq %rbp
cmpq $0x4, %rbp
jne 0x136af
movl $0x5, %ebp
jmp 0x13735
movl %ecx, 0x24(%rax)
jmp 0x137ac
incl %ebp
cmpl $0x4, %ebp
jb 0x137ac
movq 0x98af(%rip), %rdi      # 0x1cff0
leaq 0x397a(%rip), %rsi      # 0x170c2
movl $0x30, %edx
callq 0x4340
movq 0x30(%rbx), %rdi
callq 0xe34a
movq 0x988e(%rip), %rdi      # 0x1cff0
movq %rax, %rsi
callq 0x4290
movq %rsp, %rdi
movq %r13, (%rdi)
leaq 0x3917(%rip), %rsi      # 0x1708e
leaq 0x391b(%rip), %rdx      # 0x17099
callq 0x6e3c
leaq 0x24(%rsp), %rsi
movl $0x79, (%rsi)
movq %rsp, %rdi
callq 0xd138
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x137ac
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0xe492
movq 0x30(%rbx), %rsi
movq %rsp, %rdi
callq 0xe616
leaq 0x28(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x43a0
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x137eb
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 0x13816
movq %rcx, 0x30(%rax)
jmp 0x13931
movq 0x40(%rbx), %rax
testb $0x7f, 0x38(%rax)
je 0x13922
xorl %ebp, %ebp
movq %rsp, %r14
leaq 0x28(%rsp), %r15
movq 0x30(%rbx), %rdi
movl $0x1, %esi
callq 0xe492
movq 0x30(%rbx), %rsi
movq %r14, %rdi
callq 0xe616
movq %r15, %rdi
movq %r14, %rsi
callq 0x43a0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x13869
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x40(%rbx), %rax
movq 0x30(%rax), %rcx
shlq $0x8, %rcx
movq %rcx, 0x30(%rax)
movq 0x28(%rsp), %rdx
movzbl (%rdx), %esi
orq %rcx, %rsi
movq %rsi, 0x30(%rax)
movb (%rdx), %cl
movb %cl, 0x39(%rax,%rbp)
incq %rbp
movq 0x40(%rbx), %rax
incl 0x40(%rax)
cmpq $0x3, %rbp
ja 0x138aa
movzbl 0x38(%rax), %eax
andl $0x7f, %eax
cmpq %rax, %rbp
jb 0x1382e
cmpq $0x7, %rbp
jb 0x13922
movq 0x9739(%rip), %rdi      # 0x1cff0
leaq 0x3835(%rip), %rsi      # 0x170f3
movl $0x31, %edx
callq 0x4340
movq 0x30(%rbx), %rdi
callq 0xe34a
movq 0x9718(%rip), %rdi      # 0x1cff0
movq %rax, %rsi
callq 0x4290
movq %rsp, %rdi
movq %r13, (%rdi)
leaq 0x37a1(%rip), %rsi      # 0x1708e
leaq 0x37a5(%rip), %rdx      # 0x17099
callq 0x6e3c
leaq 0x24(%rsp), %rsi
movl $0xab, (%rsi)
movq %rsp, %rdi
callq 0xd138
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x13922
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0x40(%rbx), %rax
cmpq $0x0, 0x30(%rax)
jne 0x13931
orb $0x1, 0x21(%rax)
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x13948
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42e0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1395b
jmp 0x13998
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
jne 0x1397b
jmp 0x1399b
jmp 0x13998
jmp 0x1396f
jmp 0x13998
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x1399b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42e0
jmp 0x1399b
jmp 0x13998
jmp 0x13998
jmp 0x13998
jmp 0x13998
jmp 0x13998
jmp 0x13998
jmp 0x13998
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x139b2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42e0
movq %rbx, %rdi
callq 0x4590