// File: rurban[P]dgnlib/dgnwrite.cpp
// Function: DGNCreateTextElem
DGNElemCore *
DGNCreateTextElem( DGNHandle hDGN, const char *pszText, 
                   int nFontId, int nJustification, 
                   double dfLengthMult, double dfHeightMult, 
                   double dfRotation, int *panQuaternion,
                   double dfOriginX, double dfOriginY, double dfOriginZ )

{
    DGNElemText *psText;
    DGNElemCore *psCore;
    DGNInfo *psDGN = (DGNInfo *) hDGN;
    DGNPoint sMin, sMax, sLowLeft, sLowRight, sUpLeft, sUpRight;
    GInt32 nIntValue, nBase;
    double length, height, diagonal;

    DGNLoadTCB( hDGN );

/* -------------------------------------------------------------------- */
/*      Allocate element.                                               */
/* -------------------------------------------------------------------- */
    psText = (DGNElemText *) 
        CPLCalloc( sizeof(DGNElemText)+strlen(pszText), 1 );
    psCore = &(psText->core);

    DGNInitializeElemCore( hDGN, psCore );
    psCore->stype = DGNST_TEXT;
    psCore->type = DGNT_TEXT;

/* -------------------------------------------------------------------- */
/*      Set arc specific information in the structure.                  */
/* -------------------------------------------------------------------- */
    psText->font_id = nFontId;
    psText->justification = nJustification;
    psText->length_mult = dfLengthMult;
    psText->height_mult = dfHeightMult;
    psText->rotation = dfRotation;
    psText->origin.x = dfOriginX;
    psText->origin.y = dfOriginY;
    psText->origin.z = dfOriginZ;
    strcpy( psText->string, pszText );

/* -------------------------------------------------------------------- */
/*      Setup Raw data for the text specific portion.                   */
/* -------------------------------------------------------------------- */
    if( psDGN->dimension == 2 )
        psCore->raw_bytes = 60 + strlen(pszText);
    else
        psCore->raw_bytes = 76 + strlen(pszText);

    psCore->raw_bytes += (psCore->raw_bytes % 2);
    psCore->raw_data = (unsigned char*) CPLCalloc(psCore->raw_bytes,1);

    psCore->raw_data[36] = (unsigned char) nFontId;
    psCore->raw_data[37] = (unsigned char) nJustification;

    nIntValue = (int) (dfLengthMult * 1000.0 / (psDGN->scale * 6.0) + 0.5);
    DGN_WRITE_INT32( nIntValue, psCore->raw_data + 38 );
    
    nIntValue = (int) (dfHeightMult * 1000.0 / (psDGN->scale * 6.0) + 0.5);
    DGN_WRITE_INT32( nIntValue, psCore->raw_data + 42 );

    if( psDGN->dimension == 2 )
    {
        nIntValue = (int) (dfRotation * 360000.0);
        DGN_WRITE_INT32( nIntValue, psCore->raw_data + 46 );

        DGNInverseTransformPointToInt( psDGN, &(psText->origin), 
                                       psCore->raw_data + 50 );

        nBase = 58;
    }
    else
    {
        int anQuaternion[4];

        if( panQuaternion == NULL )
            DGNRotationToQuaternion( dfRotation, anQuaternion );
        else
            memcpy( anQuaternion, panQuaternion, sizeof(int) * 4 );

        DGN_WRITE_INT32( anQuaternion[0], psCore->raw_data + 46 );
        DGN_WRITE_INT32( anQuaternion[1], psCore->raw_data + 50 );
        DGN_WRITE_INT32( anQuaternion[2], psCore->raw_data + 54 );
        DGN_WRITE_INT32( anQuaternion[3], psCore->raw_data + 58 );

        DGNInverseTransformPointToInt( psDGN, &(psText->origin), 
                                       psCore->raw_data + 62 );
        nBase = 74;
    }

    psCore->raw_data[nBase] = (unsigned char) strlen(pszText);
    psCore->raw_data[nBase+1] = 0; /* edflds? */
    memcpy( psCore->raw_data + nBase+2, pszText, strlen(pszText) );
    
/* -------------------------------------------------------------------- */
/*      Set the core raw data, including the bounds.                    */
/*                                                                      */
/*      Code contributed by Mart Kelder.                                */
/* -------------------------------------------------------------------- */
    DGNUpdateElemCoreExtended( hDGN, psCore );

    //calculate bounds if rotation is 0
    sMin.x = dfOriginX;
    sMin.y = dfOriginY;
    sMin.z = 0.0;
    sMax.x = dfOriginX + dfLengthMult * strlen(pszText);
    sMax.y = dfOriginY + dfHeightMult;
    sMax.z = 0.0;

    //calculate rotated bounding box coordinates
    length = sMax.x-sMin.x;
    height = sMax.y-sMin.y;
    diagonal=sqrt(length*length+height*height);
    sLowLeft.x=sMin.x;
    sLowLeft.y=sMin.y;
    sLowRight.x=sMin.x+cos(psText->rotation*PI/180.0)*length;
    sLowRight.y=sMin.y+sin(psText->rotation*PI/180.0)*length;
    sUpRight.x=sMin.x+cos((psText->rotation*PI/180.0)+atan(height/length))*diagonal;
    sUpRight.y=sMin.y+sin((psText->rotation*PI/180.0)+atan(height/length))*diagonal;
    sUpLeft.x=sMin.x+cos((psText->rotation+90.0)*PI/180.0)*height;
    sUpLeft.y=sMin.y+sin((psText->rotation+90.0)*PI/180.0)*height;

    //calculate new values for bounding box
    sMin.x=MIN(sLowLeft.x,MIN(sLowRight.x,MIN(sUpLeft.x,sUpRight.x)));
    sMin.y=MIN(sLowLeft.y,MIN(sLowRight.y,MIN(sUpLeft.y,sUpRight.y)));
    sMax.x=MAX(sLowLeft.x,MAX(sLowRight.x,MAX(sUpLeft.x,sUpRight.x)));
    sMax.y=MAX(sLowLeft.y,MAX(sLowRight.y,MAX(sUpLeft.y,sUpRight.y)));
    sMin.x = dfOriginX - dfLengthMult * strlen(pszText);
    sMin.y = dfOriginY - dfHeightMult;
    sMin.z = 0.0;
    sMax.x = dfOriginX + dfLengthMult * strlen(pszText);
    sMax.y = dfOriginY + dfHeightMult;
    sMax.z = 0.0;

    DGNWriteBounds( psDGN, psCore, &sMin, &sMax );
    
    return psCore;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movsd %xmm1, -0x28(%rbp)
movsd %xmm2, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movsd %xmm3, -0x40(%rbp)
movsd %xmm4, -0x48(%rbp)
movsd %xmm5, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
callq 0x11190
movq -0x10(%rbp), %rdi
callq 0x2120
movq %rax, %rdi
addq $0x90, %rdi
movl $0x1, %esi
callq 0x2fc0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x135f0
movq -0x60(%rbp), %rax
movl $0x6, 0xc(%rax)
movq -0x60(%rbp), %rax
movl $0x11, 0x14(%rax)
movl -0x14(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x50(%rax)
movl -0x18(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x54(%rax)
movsd -0x20(%rbp), %xmm0
movq -0x58(%rbp), %rax
movsd %xmm0, 0x58(%rax)
movsd -0x28(%rbp), %xmm0
movq -0x58(%rbp), %rax
movsd %xmm0, 0x60(%rax)
movsd -0x30(%rbp), %xmm0
movq -0x58(%rbp), %rax
movsd %xmm0, 0x68(%rax)
movsd -0x40(%rbp), %xmm0
movq -0x58(%rbp), %rax
movsd %xmm0, 0x70(%rax)
movsd -0x48(%rbp), %xmm0
movq -0x58(%rbp), %rax
movsd %xmm0, 0x78(%rax)
movsd -0x50(%rbp), %xmm0
movq -0x58(%rbp), %rax
movsd %xmm0, 0x80(%rax)
movq -0x58(%rbp), %rdi
addq $0x88, %rdi
movq -0x10(%rbp), %rsi
callq 0x22c0
movq -0x68(%rbp), %rax
cmpl $0x2, 0x20018(%rax)
jne 0x14c1c
movq -0x10(%rbp), %rdi
callq 0x2120
addq $0x3c, %rax
movl %eax, %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x40(%rax)
jmp 0x14c32
movq -0x10(%rbp), %rdi
callq 0x2120
addq $0x4c, %rax
movl %eax, %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x60(%rbp), %rax
movl 0x40(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movq -0x60(%rbp), %rax
addl 0x40(%rax), %edx
movl %edx, 0x40(%rax)
movq -0x60(%rbp), %rax
movslq 0x40(%rax), %rdi
movl $0x1, %esi
callq 0x2fc0
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0x14(%rbp), %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x24(%rax)
movl -0x18(%rbp), %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x25(%rax)
movsd 0x4590(%rip), %xmm0     # 0x19220
mulsd -0x20(%rbp), %xmm0
movq -0x68(%rbp), %rax
movsd 0x569f(%rip), %xmm1     # 0x1a340
mulsd 0x20020(%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x499b(%rip), %xmm1     # 0x19650
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
movl %eax, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
sarl $0x10, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x26(%rax)
movl -0x11c(%rbp), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
shrl $0x18, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x27(%rax)
movl -0x11c(%rbp), %eax
andl $0xff, %eax
sarl $0x0, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x28(%rax)
movl -0x11c(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x29(%rax)
movsd 0x44dd(%rip), %xmm0     # 0x19220
mulsd -0x28(%rbp), %xmm0
movq -0x68(%rbp), %rax
movsd 0x55ec(%rip), %xmm1     # 0x1a340
mulsd 0x20020(%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x48e8(%rip), %xmm1     # 0x19650
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
movl %eax, -0x120(%rbp)
movl -0x120(%rbp), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
sarl $0x10, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x2a(%rax)
movl -0x120(%rbp), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
shrl $0x18, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x2b(%rax)
movl -0x120(%rbp), %eax
andl $0xff, %eax
sarl $0x0, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x2c(%rax)
movl -0x120(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x2d(%rax)
movq -0x68(%rbp), %rax
cmpl $0x2, 0x20018(%rax)
jne 0x14eba
movsd 0x5541(%rip), %xmm0     # 0x1a348
mulsd -0x30(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
movl %eax, -0x124(%rbp)
movl -0x124(%rbp), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
sarl $0x10, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x2e(%rax)
movl -0x124(%rbp), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
shrl $0x18, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x2f(%rax)
movl -0x124(%rbp), %eax
andl $0xff, %eax
sarl $0x0, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x30(%rax)
movl -0x124(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x31(%rax)
movq -0x68(%rbp), %rdi
movq -0x58(%rbp), %rsi
addq $0x70, %rsi
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rdx
addq $0x32, %rdx
callq 0x10fd0
movl $0x3a, -0x100(%rbp)
jmp 0x150f4
cmpq $0x0, -0x38(%rbp)
jne 0x14ed4
movsd -0x30(%rbp), %xmm0
leaq -0x140(%rbp), %rdi
callq 0xc5f0
jmp 0x14eed
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x140(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x138(%rbp)
movl -0x140(%rbp), %eax
movl %eax, -0x144(%rbp)
movl -0x144(%rbp), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
sarl $0x10, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x2e(%rax)
movl -0x144(%rbp), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
shrl $0x18, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x2f(%rax)
movl -0x144(%rbp), %eax
andl $0xff, %eax
sarl $0x0, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x30(%rax)
movl -0x144(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x31(%rax)
movl -0x13c(%rbp), %eax
movl %eax, -0x148(%rbp)
movl -0x148(%rbp), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
sarl $0x10, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x32(%rax)
movl -0x148(%rbp), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
shrl $0x18, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x33(%rax)
movl -0x148(%rbp), %eax
andl $0xff, %eax
sarl $0x0, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x34(%rax)
movl -0x148(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x35(%rax)
movl -0x138(%rbp), %eax
movl %eax, -0x14c(%rbp)
movl -0x14c(%rbp), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
sarl $0x10, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x36(%rax)
movl -0x14c(%rbp), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
shrl $0x18, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x37(%rax)
movl -0x14c(%rbp), %eax
andl $0xff, %eax
sarl $0x0, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x38(%rax)
movl -0x14c(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x39(%rax)
movl -0x134(%rbp), %eax
movl %eax, -0x150(%rbp)
movl -0x150(%rbp), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
sarl $0x10, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x3a(%rax)
movl -0x150(%rbp), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
shrl $0x18, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x3b(%rax)
movl -0x150(%rbp), %eax
andl $0xff, %eax
sarl $0x0, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x3c(%rax)
movl -0x150(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movb %al, %cl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movb %cl, 0x3d(%rax)
movq -0x68(%rbp), %rdi
movq -0x58(%rbp), %rsi
addq $0x70, %rsi
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rdx
addq $0x3e, %rdx
callq 0x10fd0
movl $0x4a, -0x100(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2120
movb %al, %dl
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x100(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rcx
movslq -0x100(%rbp), %rax
movb $0x0, 0x1(%rax,%rcx)
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x100(%rbp), %rcx
leaq 0x2(%rax,%rcx), %rax
movq %rax, -0x1c0(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x2120
movq -0x1c0(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
movq %rax, %rdx
callq 0x2240
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x12f50
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x1a8(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x1b0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2120
movsd -0x1b0(%rbp), %xmm0
movsd -0x1a8(%rbp), %xmm1
movq %rax, %xmm2
movaps 0x5402(%rip), %xmm3     # 0x1a5d0
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movapd 0x5406(%rip), %xmm3     # 0x1a5e0
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x48(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x98(%rbp), %xmm0
subsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
movsd -0x90(%rbp), %xmm0
subsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x110(%rbp)
movsd -0x108(%rbp), %xmm0
movsd -0x108(%rbp), %xmm2
movsd -0x110(%rbp), %xmm1
mulsd -0x110(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x2220
movsd %xmm0, -0x118(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movq -0x58(%rbp), %rax
movsd 0x4620(%rip), %xmm0     # 0x198c8
mulsd 0x68(%rax), %xmm0
movsd 0x461b(%rip), %xmm1     # 0x198d0
divsd %xmm1, %xmm0
callq 0x2540
movsd -0x1a0(%rbp), %xmm1
movsd -0x108(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x198(%rbp)
movq -0x58(%rbp), %rax
movsd 0x45d1(%rip), %xmm0     # 0x198c8
mulsd 0x68(%rax), %xmm0
movsd 0x45cc(%rip), %xmm1     # 0x198d0
divsd %xmm1, %xmm0
callq 0x20b0
movsd -0x198(%rbp), %xmm1
movsd -0x108(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x188(%rbp)
movq -0x58(%rbp), %rax
movsd 0x4582(%rip), %xmm0     # 0x198c8
mulsd 0x68(%rax), %xmm0
movsd 0x457d(%rip), %xmm1     # 0x198d0
divsd %xmm1, %xmm0
movsd %xmm0, -0x190(%rbp)
movsd -0x110(%rbp), %xmm0
divsd -0x108(%rbp), %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x190(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x2540
movsd -0x188(%rbp), %xmm1
movsd -0x118(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x178(%rbp)
movq -0x58(%rbp), %rax
movsd 0x4507(%rip), %xmm0     # 0x198c8
mulsd 0x68(%rax), %xmm0
movsd 0x4502(%rip), %xmm1     # 0x198d0
divsd %xmm1, %xmm0
movsd %xmm0, -0x180(%rbp)
movsd -0x110(%rbp), %xmm0
divsd -0x108(%rbp), %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x180(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x20b0
movsd -0x178(%rbp), %xmm1
movsd -0x118(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x170(%rbp)
movq -0x58(%rbp), %rax
movsd 0x5184(%rip), %xmm0     # 0x1a5c0
addsd 0x68(%rax), %xmm0
movsd 0x447f(%rip), %xmm1     # 0x198c8
mulsd %xmm1, %xmm0
movsd 0x447b(%rip), %xmm1     # 0x198d0
divsd %xmm1, %xmm0
callq 0x2540
movsd -0x170(%rbp), %xmm1
movsd -0x110(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
movq -0x58(%rbp), %rax
movsd 0x5129(%rip), %xmm0     # 0x1a5c0
addsd 0x68(%rax), %xmm0
movsd 0x4424(%rip), %xmm1     # 0x198c8
mulsd %xmm1, %xmm0
movsd 0x4420(%rip), %xmm1     # 0x198d0
divsd %xmm1, %xmm0
callq 0x20b0
movsd -0x168(%rbp), %xmm1
movsd -0x110(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x160(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
movsd -0xe0(%rbp), %xmm1
movsd -0xf8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15521
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x1c8(%rbp)
jmp 0x15531
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x1c8(%rbp)
movsd -0x158(%rbp), %xmm1
movsd -0x1c8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15559
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x1d0(%rbp)
jmp 0x155a1
movsd -0xe0(%rbp), %xmm1
movsd -0xf8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15581
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x1d8(%rbp)
jmp 0x15591
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x1d8(%rbp)
movsd -0x1d8(%rbp), %xmm0
movsd %xmm0, -0x1d0(%rbp)
movsd -0x160(%rbp), %xmm1
movsd -0x1d0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x155cc
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x1e0(%rbp)
jmp 0x15694
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x1e8(%rbp)
movsd -0xe0(%rbp), %xmm1
movsd -0xf8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15604
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x1f0(%rbp)
jmp 0x15614
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x1f0(%rbp)
movsd -0x1e8(%rbp), %xmm1
movsd -0x1f0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1563c
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x1f8(%rbp)
jmp 0x15684
movsd -0xe0(%rbp), %xmm1
movsd -0xf8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15664
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x200(%rbp)
jmp 0x15674
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x200(%rbp)
movsd -0x200(%rbp), %xmm0
movsd %xmm0, -0x1f8(%rbp)
movsd -0x1f8(%rbp), %xmm0
movsd %xmm0, -0x1e0(%rbp)
movsd -0x1e0(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x210(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x208(%rbp)
movsd -0xd8(%rbp), %xmm1
movsd -0xf0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x156e9
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x218(%rbp)
jmp 0x156f9
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x218(%rbp)
movsd -0x208(%rbp), %xmm1
movsd -0x218(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15721
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x220(%rbp)
jmp 0x15769
movsd -0xd8(%rbp), %xmm1
movsd -0xf0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15749
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x228(%rbp)
jmp 0x15759
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x228(%rbp)
movsd -0x228(%rbp), %xmm0
movsd %xmm0, -0x220(%rbp)
movsd -0x210(%rbp), %xmm1
movsd -0x220(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15794
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x230(%rbp)
jmp 0x1585c
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x238(%rbp)
movsd -0xd8(%rbp), %xmm1
movsd -0xf0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x157cc
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x240(%rbp)
jmp 0x157dc
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x240(%rbp)
movsd -0x238(%rbp), %xmm1
movsd -0x240(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x15804
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x248(%rbp)
jmp 0x1584c
movsd -0xd8(%rbp), %xmm1
movsd -0xf0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1582c
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x250(%rbp)
jmp 0x1583c
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x250(%rbp)
movsd -0x250(%rbp), %xmm0
movsd %xmm0, -0x248(%rbp)
movsd -0x248(%rbp), %xmm0
movsd %xmm0, -0x230(%rbp)
movsd -0x230(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x260(%rbp)
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x258(%rbp)
movsd -0xe0(%rbp), %xmm0
ucomisd -0xf8(%rbp), %xmm0
jbe 0x158ad
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x268(%rbp)
jmp 0x158bd
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x268(%rbp)
movsd -0x258(%rbp), %xmm0
movsd -0x268(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x158e5
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x270(%rbp)
jmp 0x15929
movsd -0xe0(%rbp), %xmm0
ucomisd -0xf8(%rbp), %xmm0
jbe 0x15909
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x278(%rbp)
jmp 0x15919
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x278(%rbp)
movsd -0x278(%rbp), %xmm0
movsd %xmm0, -0x270(%rbp)
movsd -0x260(%rbp), %xmm0
movsd -0x270(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x15954
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x280(%rbp)
jmp 0x15a14
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x288(%rbp)
movsd -0xe0(%rbp), %xmm0
ucomisd -0xf8(%rbp), %xmm0
jbe 0x15988
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x290(%rbp)
jmp 0x15998
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x290(%rbp)
movsd -0x288(%rbp), %xmm0
movsd -0x290(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x159c0
movsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0x298(%rbp)
jmp 0x15a04
movsd -0xe0(%rbp), %xmm0
ucomisd -0xf8(%rbp), %xmm0
jbe 0x159e4
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x2a0(%rbp)
jmp 0x159f4
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x2a0(%rbp)
movsd -0x2a0(%rbp), %xmm0
movsd %xmm0, -0x298(%rbp)
movsd -0x298(%rbp), %xmm0
movsd %xmm0, -0x280(%rbp)
movsd -0x280(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x2b0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x2a8(%rbp)
movsd -0xd8(%rbp), %xmm0
ucomisd -0xf0(%rbp), %xmm0
jbe 0x15a68
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x2b8(%rbp)
jmp 0x15a78
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x2b8(%rbp)
movsd -0x2a8(%rbp), %xmm0
movsd -0x2b8(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x15aa0
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x2c0(%rbp)
jmp 0x15ae4
movsd -0xd8(%rbp), %xmm0
ucomisd -0xf0(%rbp), %xmm0
jbe 0x15ac4
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x2c8(%rbp)
jmp 0x15ad4
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x2c8(%rbp)
movsd -0x2c8(%rbp), %xmm0
movsd %xmm0, -0x2c0(%rbp)
movsd -0x2b0(%rbp), %xmm0
movsd -0x2c0(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x15b0f
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x2d0(%rbp)
jmp 0x15bcf
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x2d8(%rbp)
movsd -0xd8(%rbp), %xmm0
ucomisd -0xf0(%rbp), %xmm0
jbe 0x15b43
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x2e0(%rbp)
jmp 0x15b53
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x2e0(%rbp)
movsd -0x2d8(%rbp), %xmm0
movsd -0x2e0(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x15b7b
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x2e8(%rbp)
jmp 0x15bbf
movsd -0xd8(%rbp), %xmm0
ucomisd -0xf0(%rbp), %xmm0
jbe 0x15b9f
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
jmp 0x15baf
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
movsd -0x2f0(%rbp), %xmm0
movsd %xmm0, -0x2e8(%rbp)
movsd -0x2e8(%rbp), %xmm0
movsd %xmm0, -0x2d0(%rbp)
movsd -0x2d0(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x328(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x330(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2120
movsd -0x330(%rbp), %xmm1
movsd -0x328(%rbp), %xmm0
movq %rax, %xmm2
movaps 0x49b2(%rip), %xmm3     # 0x1a5d0
movaps %xmm3, -0x320(%rbp)
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movapd 0x49af(%rip), %xmm3     # 0x1a5e0
movaps %xmm3, -0x310(%rbp)
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x48(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x2f8(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x300(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2120
movaps -0x320(%rbp), %xmm4
movaps -0x310(%rbp), %xmm3
movsd -0x300(%rbp), %xmm0
movsd -0x2f8(%rbp), %xmm1
movq %rax, %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x48(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
leaq -0x80(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x13630
movq -0x60(%rbp), %rax
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
nopw (%rax,%rax)