// File: rurban[P]dgnlib/dgnread.cpp
// Function: DGNParseCore(DGNInfo*, DGNElemCore*)
int DGNParseCore( DGNInfo *psDGN, DGNElemCore *psElement )

{
    GByte       *psData = psDGN->abyElem+0;

    psElement->level = psData[0] & 0x3f;
    psElement->complex = psData[0] & 0x80;
    psElement->deleted = psData[1] & 0x80;
    psElement->type = psData[1] & 0x7f;

    if( psDGN->nElemBytes >= 36 && DGNElemTypeHasDispHdr( psElement->type ) )
    {
        psElement->graphic_group = psData[28] + psData[29] * 256;
        psElement->properties = psData[32] + psData[33] * 256;
        psElement->style = psData[34] & 0x7;
        psElement->weight = (psData[34] & 0xf8) >> 3;
        psElement->color = psData[35];
    }
    else
    {
        psElement->graphic_group = 0;
        psElement->properties = 0;
        psElement->style = 0;
        psElement->weight = 0;
        psElement->color = 0;
    }

    if( psElement->properties & DGNPF_ATTRIBUTES )
    {
        int   nAttIndex;
        
        nAttIndex = psData[30] + psData[31] * 256;

        psElement->attr_bytes = psDGN->nElemBytes - nAttIndex*2 - 32;
        if( psElement->attr_bytes > 0 )
        {
            psElement->attr_data = (unsigned char *) 
                CPLMalloc(psElement->attr_bytes);
            memcpy( psElement->attr_data, psData + nAttIndex * 2 + 32,
                    psElement->attr_bytes );
        }
        else
        {
            CPLError(
                CE_Warning, CPLE_AppDefined, 
                "Computed %d bytes for attribute info on element,\n"
                "perhaps this element type doesn't really have a disphdr?",
                psElement->attr_bytes );
            psElement->attr_bytes = 0;
        }
    }
    
    return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
andl $0x3f, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
andl $0x80, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %ecx
andl $0x80, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x18(%rbp), %rax
movzbl 0x1(%rax), %ecx
andl $0x7f, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rax
cmpl $0x24, 0xc(%rax)
jl 0x10ada
movq -0x10(%rbp), %rax
movl 0x14(%rax), %edi
callq 0x10970
cmpl $0x0, %eax
je 0x10ada
movq -0x18(%rbp), %rax
movzbl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
movzbl 0x1d(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rax
movzbl 0x20(%rax), %ecx
movq -0x18(%rbp), %rax
movzbl 0x21(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x18(%rbp), %rax
movzbl 0x22(%rax), %ecx
andl $0x7, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rax
movzbl 0x22(%rax), %ecx
andl $0xf8, %ecx
sarl $0x3, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x18(%rbp), %rax
movzbl 0x23(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x10b11
movq -0x10(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x30(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2c(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
movl 0x24(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x10bcd
movq -0x18(%rbp), %rax
movzbl 0x1e(%rax), %eax
movq -0x18(%rbp), %rcx
movzbl 0x1f(%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
movl -0x1c(%rbp), %eax
shll %eax
subl %eax, %ecx
subl $0x20, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jle 0x10ba1
movq -0x10(%rbp), %rax
movslq 0x34(%rax), %rdi
callq 0x3040
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %eax
shll %eax
cltq
addq %rax, %rsi
addq $0x20, %rsi
movq -0x10(%rbp), %rax
movslq 0x34(%rax), %rdx
callq 0x2240
jmp 0x10bcb
movq -0x10(%rbp), %rax
movl 0x34(%rax), %ecx
movl $0x2, %edi
movl $0x1, %esi
leaq 0x991d(%rip), %rdx      # 0x1a4d6
movb $0x0, %al
callq 0x5740
movq -0x10(%rbp), %rax
movl $0x0, 0x34(%rax)
jmp 0x10bcd
movl $0x1, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)