// File: /workspace/github_cpp_makefile_star2_O3/tap3edit[P]tap3xml/NrtInfo.cpp
// Function: NrtInfo::buffin(Buffin*)
void NrtInfo::buffin(Buffin *bfin)
{
    string str;
    int pos, bfin_pos, i;

    _bfin=bfin;
    bfin_pos=_bfin->get_pos();
    _bfin->set_pos(0);
    _bfin->read(_bfin->get_end() > 500 ? 500 : _bfin->get_end());

    str=bcd2hexa(_bfin->get_buf());


    /* 1. Find out which kind of file it is */

    pair<string, string> types[] =
    {
        pair<string,string>("",        "ERR"),    /* Not recognized file */
        pair<string,string>("61",      "NRT"),    /* Nrt file */
    };

    for(i=0;i<2;i++)
    {
        if (str.substr(0,types[i].first.size())==types[i].first)
        {
            _type=types[i].second;
        }
    }


    /* 2. Find its version */

    pair<string, int *> version[] =
    {
        pair<string,int *>("5f2901",  &_version),
        pair<string,int *>("5f2501",  &_release)
    };

    for(i=0;i<2;i++)
    {
        if ((pos=str.find(version[i].first)) != (int)string::npos)
        {
            *(version[i].second)=atoi(bcd2dec(hexa2bcd(str.substr(pos+version[i].first.size(),2))).c_str());
        }
        else
        {
            *(version[i].second)=-1;
        }
    }

    if (_version<0 || _release<0)
        _type="ERR";


    _bfin->set_pos(bfin_pos);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %r14
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rsi, (%rdi)
movq %rsi, %rdi
callq 0xdcb0
movq %rax, %r15
movq (%r14), %rdi
leaq 0x100(%rsp), %rsi
movq $0x0, (%rsi)
callq 0xdcb8
movq (%r14), %rbx
movq %rbx, %rdi
callq 0xddf0
movl $0x1f4, %esi            # imm = 0x1F4
cmpq $0x1f4, %rax            # imm = 0x1F4
jg 0x7366
movq (%r14), %rdi
callq 0xddf0
movq %rax, %rsi
movq %rbx, %rdi
callq 0xddf8
movq (%r14), %rsi
leaq 0x30(%rsp), %rdi
callq 0xdf7c
leaq 0x100(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xc7e6
leaq 0x10(%rsp), %rdi
leaq 0x100(%rsp), %rbx
movq %rbx, %rsi
callq 0x43a0
movq (%rbx), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x73c2
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x42e0
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x73dd
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42e0
leaq 0xf62c(%rip), %rsi      # 0x16a10
leaq 0xdd90(%rip), %rdx      # 0x1517b
leaq 0x100(%rsp), %rbx
movq %rbx, %rdi
callq 0x7b46
movq %r15, 0x98(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0xde7b(%rip), %rsi      # 0x1528d
leaq 0xde77(%rip), %rdx      # 0x15290
callq 0x7bc4
movq %r14, (%rsp)
leaq 0x10(%r14), %rax
movq %rax, 0x8(%rsp)
movb $0x1, %r15b
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %r12
movq 0x8(%rbx), %rcx
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x4300
movq 0x38(%rsp), %rdx
cmpq 0x8(%rbx), %rdx
jne 0x7471
movq 0x30(%rsp), %r13
testq %rdx, %rdx
je 0x747a
movq (%rbx), %rsi
movq %r13, %rdi
callq 0x42f0
testl %eax, %eax
sete %bpl
jmp 0x747d
movq 0x30(%rsp), %r13
xorl %ebp, %ebp
jmp 0x747d
movb $0x1, %bpl
leaq 0x40(%rsp), %rax
cmpq %rax, %r13
je 0x7497
movq 0x40(%rsp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x42e0
testb %bpl, %bpl
je 0x74ad
addq $0x20, %rbx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x4180
leaq 0x140(%rsp), %rbx
testb $0x1, %r15b
movl $0x0, %r15d
jne 0x7438
leaq 0x30(%rsp), %rbx
leaq 0x40(%rsp), %rax
movq %rax, (%rbx)
leaq 0xddbb(%rip), %rsi      # 0x15294
leaq 0xddba(%rip), %rdx      # 0x1529a
movq %rbx, %rdi
callq 0x6c96
movq (%rsp), %r15
leaq 0x8(%r15), %rax
leaq 0x58(%rsp), %rdi
movq %rax, 0x90(%rsp)
movq %rax, -0x8(%rdi)
leaq 0x68(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xdd8a(%rip), %rsi      # 0x1529b
leaq 0xdd89(%rip), %rdx      # 0x152a1
callq 0x6c96
leaq 0xc(%r15), %rax
movq %rax, 0x88(%rsp)
movq %rax, 0x78(%rsp)
movb $0x1, %r13b
leaq 0x10(%rsp), %r12
leaq 0xa0(%rsp), %r15
leaq 0xc0(%rsp), %rbp
movq (%rbx), %rsi
movq 0x8(%rbx), %rcx
movq %r12, %rdi
xorl %edx, %edx
callq 0x4580
cmpl $-0x1, %eax
jne 0x756b
movq 0x20(%rbx), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x762e
movslq %eax, %rdx
addq 0x8(%rbx), %rdx
movl $0x2, %ecx
movq %r15, %rdi
movq %r12, %rsi
callq 0x4300
movq %rbp, %rdi
movq %r15, %rsi
callq 0xc8ef
movq %rbp, %rsi
movq %r15, %rbp
leaq 0xe0(%rsp), %rdi
movq %rsi, %r12
callq 0xc51c
movq 0xe0(%rsp), %r15
movq %r15, %rdi
callq 0x44d0
movq 0x20(%rbx), %rcx
movl %eax, (%rcx)
leaq 0xf0(%rsp), %rax
cmpq %rax, %r15
je 0x75d9
movq 0xf0(%rsp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x42e0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x75fe
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
movq %rbp, %r15
je 0x7626
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x42e0
movq %r12, %rbp
leaq 0x10(%rsp), %r12
leaq 0x58(%rsp), %rbx
testb $0x1, %r13b
movl $0x0, %r13d
jne 0x7546
movq 0x90(%rsp), %rax
cmpl $0x0, (%rax)
movq (%rsp), %rbx
js 0x7661
movq 0x88(%rsp), %rax
cmpl $0x0, (%rax)
jns 0x767e
movq 0x18(%rbx), %rdx
leaq 0xdb0f(%rip), %rcx      # 0x1517b
movl $0x3, %r8d
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x44c0
movq (%rbx), %rdi
movslq 0x98(%rsp), %rax
leaq 0xe0(%rsp), %rsi
movq %rax, (%rsi)
callq 0xdcb8
movq $-0x50, %rbx
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0x76b4
movq (%r14), %rsi
incq %rsi
callq 0x42e0
addq $-0x28, %r14
addq $0x28, %rbx
jne 0x76a0
movq $-0x80, %rbx
leaq 0x170(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0x76e1
movq (%r14), %rsi
incq %rsi
callq 0x42e0
movq -0x30(%r14), %rdi
leaq -0x20(%r14), %rax
cmpq %rdi, %rax
je 0x76f9
movq (%rax), %rsi
incq %rsi
callq 0x42e0
addq $-0x40, %r14
addq $0x40, %rbx
jne 0x76cd
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x771f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42e0
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x77b1
jmp 0x77b1
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x7830
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42e0
jmp 0x7830
jmp 0x782d
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x7c42
jmp 0x7850
jmp 0x77a4
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7850
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42e0
jmp 0x7850
jmp 0x77a4
jmp 0x77a4
movq %rax, %rbx
jmp 0x7850
movq %rax, %rbx
jmp 0x77de
movq %rax, %rbx
jmp 0x7803
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x77de
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x42e0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x7803
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x42e0
xorl %r15d, %r15d
movq 0x58(%rsp,%r15), %rdi
leaq (%r14,%r15), %rax
cmpq %rdi, %rax
je 0x781f
movq (%rax), %rsi
incq %rsi
callq 0x42e0
addq $-0x28, %r15
cmpq $-0x50, %r15
jne 0x7806
jmp 0x7830
jmp 0x782d
movq %rax, %rbx
movl $0x40, %r14d
leaq (%rsp,%r14), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x7c42
addq $-0x40, %r14
cmpq $-0x40, %r14
jne 0x7836
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x786c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42e0
movq %rbx, %rdi
callq 0x4590