// File: rurban[P]dgnlib/dgnread.cpp
// Function: DGNGetRawExtents(DGNInfo*, int, unsigned char*, unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*)
static int 
DGNGetRawExtents( DGNInfo *psDGN, int nType, unsigned char *pabyRawData,
                  GUInt32 *pnXMin, GUInt32 *pnYMin, GUInt32 *pnZMin, 
                  GUInt32 *pnXMax, GUInt32 *pnYMax, GUInt32 *pnZMax )

{
    if( pabyRawData == NULL )
        pabyRawData = psDGN->abyElem + 0;

    switch( nType )
    {
      case DGNT_LINE:
      case DGNT_LINE_STRING:
      case DGNT_SHAPE:
      case DGNT_CURVE:
      case DGNT_BSPLINE_POLE:
      case DGNT_BSPLINE_SURFACE_HEADER:
      case DGNT_BSPLINE_CURVE_HEADER:
      case DGNT_ELLIPSE:
      case DGNT_ARC:
      case DGNT_TEXT:
      case DGNT_TEXT_NODE:
      case DGNT_COMPLEX_CHAIN_HEADER:
      case DGNT_COMPLEX_SHAPE_HEADER:
      case DGNT_CONE:
      case DGNT_3DSURFACE_HEADER:
      case DGNT_3DSOLID_HEADER:
        *pnXMin = DGN_INT32( pabyRawData + 4 );
        *pnYMin = DGN_INT32( pabyRawData + 8 );
        if( pnZMin != NULL )
            *pnZMin = DGN_INT32( pabyRawData + 12 );

        *pnXMax = DGN_INT32( pabyRawData + 16 );
        *pnYMax = DGN_INT32( pabyRawData + 20 );
        if( pnZMax != NULL )
            *pnZMax = DGN_INT32( pabyRawData + 24 );
        return TRUE;

      default:
        return FALSE;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xd31a
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
addl $-0x3, %eax
subl $0x2, %eax
jb 0xd376
jmp 0xd32a
movl -0x3c(%rbp), %eax
addl $-0x6, %eax
subl $0x2, %eax
jb 0xd376
jmp 0xd337
movl -0x3c(%rbp), %eax
addl $-0xb, %eax
subl $0x2, %eax
jb 0xd376
jmp 0xd344
movl -0x3c(%rbp), %eax
addl $-0xe, %eax
subl $0x6, %eax
jb 0xd376
jmp 0xd351
movl -0x3c(%rbp), %eax
subl $0x15, %eax
je 0xd376
jmp 0xd35b
movl -0x3c(%rbp), %eax
addl $-0x17, %eax
subl $0x2, %eax
jb 0xd376
jmp 0xd368
movl -0x3c(%rbp), %eax
subl $0x1b, %eax
jne 0xd4dd
jmp 0xd376
movq -0x20(%rbp), %rax
movzbl 0x6(%rax), %ecx
movq -0x20(%rbp), %rax
movzbl 0x7(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x5(%rax), %eax
shll $0x10, %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x4(%rax), %eax
shll $0x10, %eax
addl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movzbl 0xa(%rax), %ecx
movq -0x20(%rbp), %rax
movzbl 0xb(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x9(%rax), %eax
shll $0x10, %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x8(%rax), %eax
shll $0x10, %eax
addl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x38(%rbp)
je 0xd425
movq -0x20(%rbp), %rax
movzbl 0xe(%rax), %ecx
movq -0x20(%rbp), %rax
movzbl 0xf(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0xd(%rax), %eax
shll $0x10, %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0xc(%rax), %eax
shll $0x10, %eax
addl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movzbl 0x12(%rax), %ecx
movq -0x20(%rbp), %rax
movzbl 0x13(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x11(%rax), %eax
shll $0x10, %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
shll $0x10, %eax
addl %eax, %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movzbl 0x16(%rax), %ecx
movq -0x20(%rbp), %rax
movzbl 0x17(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x15(%rax), %eax
shll $0x10, %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x14(%rax), %eax
shll $0x10, %eax
addl %eax, %ecx
movq 0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, 0x20(%rbp)
je 0xd4d4
movq -0x20(%rbp), %rax
movzbl 0x1a(%rax), %ecx
movq -0x20(%rbp), %rax
movzbl 0x1b(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x19(%rax), %eax
shll $0x10, %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movzbl 0x18(%rax), %eax
shll $0x10, %eax
addl %eax, %ecx
movq 0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xd4e4
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)