// File: rurban[P]dgnlib/dgnwrite.cpp
// Function: DGNPointToInt(DGNInfo*, DGNPoint*, unsigned char*)
static void DGNPointToInt( DGNInfo *psDGN, DGNPoint *psPoint, 
                           unsigned char *pabyTarget )

{
    double     adfCT[4];
    int        i;

    adfCT[0] = psPoint->x;
    adfCT[1] = psPoint->y;
    adfCT[2] = psPoint->z;
    adfCT[3] = 0;
    assert(psDGN->dimension < 3);

    for( i = 0; i < psDGN->dimension; i++ )
    {
        GInt32 nCTI;
        unsigned char *pabyCTI = (unsigned char *) &nCTI;

        nCTI = (GInt32) MAX(-2147483647,MIN(2147483647,adfCT[i]));
        
#ifdef WORDS_BIGENDIAN 
        pabyTarget[i*4+0] = pabyCTI[1];
        pabyTarget[i*4+1] = pabyCTI[0];
        pabyTarget[i*4+2] = pabyCTI[3];
        pabyTarget[i*4+3] = pabyCTI[2];
#else
        pabyTarget[i*4+3] = pabyCTI[1];
        pabyTarget[i*4+2] = pabyCTI[0];
        pabyTarget[i*4+1] = pabyCTI[3];
        pabyTarget[i*4+0] = pabyCTI[2];
#endif        
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x3, 0x20018(%rax)
jge 0x16fd4
jmp 0x16ff3
leaq 0x3907(%rip), %rdi      # 0x1a8e2
leaq 0x3915(%rip), %rsi      # 0x1a8f7
movl $0x8a7, %edx            # imm = 0x8A7
leaq 0x3916(%rip), %rcx      # 0x1a904
callq 0x21c0
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x20018(%rcx), %eax
jge 0x1712e
leaq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movslq -0x44(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movsd 0x2891(%rip), %xmm1     # 0x198b8
ucomisd %xmm1, %xmm0
jbe 0x1703c
movsd 0x2883(%rip), %xmm0     # 0x198b8
movsd %xmm0, -0x58(%rbp)
jmp 0x1704b
movslq -0x44(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm1
movsd 0x3308(%rip), %xmm0     # 0x1a360
ucomisd %xmm1, %xmm0
jbe 0x1706d
movsd 0x32fa(%rip), %xmm0     # 0x1a360
movsd %xmm0, -0x60(%rbp)
jmp 0x170ad
movslq -0x44(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movsd 0x2839(%rip), %xmm1     # 0x198b8
ucomisd %xmm1, %xmm0
jbe 0x17094
movsd 0x282b(%rip), %xmm0     # 0x198b8
movsd %xmm0, -0x68(%rbp)
jmp 0x170a3
movslq -0x44(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x48(%rbp)
movq -0x50(%rbp), %rax
movb 0x1(%rax), %dl
movq -0x18(%rbp), %rax
movl -0x44(%rbp), %ecx
shll $0x2, %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x50(%rbp), %rax
movb (%rax), %dl
movq -0x18(%rbp), %rax
movl -0x44(%rbp), %ecx
shll $0x2, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x50(%rbp), %rax
movb 0x3(%rax), %dl
movq -0x18(%rbp), %rax
movl -0x44(%rbp), %ecx
shll $0x2, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x50(%rbp), %rax
movb 0x2(%rax), %dl
movq -0x18(%rbp), %rax
movl -0x44(%rbp), %ecx
shll $0x2, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x16ffa
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)