RaspTestIntersection

VOID __stdcall RaspTestIntersection(_GLYPH_SEGMENT *Segment, INT64 YValue, INT64 *XIntersection, INT64 *XIntersection2){
  _DWORD *v4; 
  _DWORD *v6; 
  _DWORD *v7; 
  __int64 v8; 
  __int64 v9; 
  __int64 v10; 
  __int64 v11; 
  __int64 v12; 
  __int64 v13; 
  __int64 v14; 
  __int64 v15; 
  __int64 v16; 
  __int64 v17; 
  char v18; 
  bool v19; 
  INT64 *v20; 
  UINT64 v21; 
  __int64 v22; 
  __int64 v23; 
  __int64 v24; 
  INT64 v25; 
  __int64 v26; 
  __int64 v27; 
  __int64 v28; 
  __int64 v29; 
  __int128 v30; 
  __int64 v31; 
  __int64 v32; 
  bool v33; 
  __int128 v34; 
  __int128 v35; 
  __int64 v36; 

  v4 = *(_DWORD **)Segment;
  v6 = (_DWORD *)*((_QWORD *)Segment + 1);
  v7 = (_DWORD *)*((_QWORD *)Segment + 2);
  v8 = (int)YValue;
  v9 = *v4 + v4[2];
  v10 = v4[1] + v4[3];
  v11 = v6[1] + v6[3];
  v36 = *v7 + v7[2];
  v12 = v9 << 16;
  v13 = (__int64)(v7[1] + v7[3]) << 16;
  v14 = v10 << 16;
  v15 = v11 << 16;
  v16 = v36 << 16;
  v17 = (__int64)(int)YValue << 16;
  if( v10 << 16 == v13 )
  {
    if( v14 == v17 )
      goto LABEL_9;
  }
  else if( v14 == v17 )
  {
LABEL_39:
    v18 = *((_BYTE *)Segment + 24);
    ++v17;
    goto LABEL_5;
  }
  if( v13 == v17 )
    goto LABEL_39;
  v18 = *((_BYTE *)Segment + 24);
  if( v15 == v17 && *((_BYTE *)Segment + 24) != 1 )
    ++v17;
LABEL_5:
  if( v18 == 1 )
  {
    *(_DWORD *)XIntersection2 = 0x7FFFFFFF;
    v33 = v14 < v17;
    if( v14 > v17 )
    {
      if( v13 > v17 )
        goto LABEL_27;
      v33 = v14 < v17;
    }
    if( !v33 || v13 >= v17 )
    {
      v34 = v12 + (v16 - v12) * (v17 - v14) / (v13 - v14);
      *(_DWORD *)XIntersection = (__int64)(WORD4(v34) + (_QWORD)v34) >> 16;
      return;
    }
LABEL_27:
    *(_DWORD *)XIntersection = 0x7FFFFFFF;
    return;
  }
  v19 = v14 < v17;
  if( v14 > v17 )
  {
    if( v13 > v17 && v15 > v17 )
      goto LABEL_9;
    v19 = v14 < v17;
  }
  if( v19 && v15 < v17 && v13 < v17 )
    goto LABEL_9;
  v21 = v14 + v13 - ((__int64)(v6[1] + v6[3]) << 17);
  if( !v21 )
  {
    v20 = XIntersection2;
    v35 = v12 + (v16 - v12) * (v17 - v14) / (v13 - v14);
    *(_DWORD *)XIntersection = (__int64)(WORD4(v35) + (_QWORD)v35) >> 16;
    goto LABEL_10;
  }
  v22 = *v6 + v6[2];
  v23 = v10 + v7[1] + v7[3] - 2 * v11;
  v24 = 2 * (v11 - v10);
  v25 = v24 * v24 - 4 * v23 * (v10 - v8);
  if( v25 < 0 )
  {
LABEL_9:
    v20 = XIntersection2;
    *(_DWORD *)XIntersection = 0x7FFFFFFF;
LABEL_10:
    *(_DWORD *)v20 = 0x7FFFFFFF;
    return;
  }
  LODWORD(v26) = BgpFmSqrt(v25, v21);
  v27 = -65536 * v24;
  v28 = (v27 + v26) / (2 * v23);
  v29 = (v27 - v26) / (2 * v23);
  v30 = v36 * v28 * v28 + (0x10000 - v28) * (v9 * (0x10000 - v28) + 2 * v22 * v28);
  *(_QWORD *)&v30 = DWORD2(v30) + (_QWORD)v30;
  v31 = (__int64)v30 >> 32;
  *(_DWORD *)XIntersection = DWORD1(v30);
  v20 = XIntersection2;
  v32 = (v36 * v29 * v29 + (0x10000 - v29) * (v9 * (0x10000 - v29) + 2 * v22 * v29)) / 0x100000000i64;
  *(_DWORD *)XIntersection2 = v32;
  if( v28 < 0 || v28 > 0x10000 )
  {
    *(_DWORD *)XIntersection = 0x7FFFFFFF;
    LODWORD(v31) = 0x7FFFFFFF;
  }
  if( v29 < 0 || v29 > 0x10000 )
  {
    *(_DWORD *)XIntersection2 = 0x7FFFFFFF;
    LODWORD(v32) = 0x7FFFFFFF;
  }
  if( (int)v31 > (int)v32 )
  {
    *(_DWORD *)XIntersection = v32;
    *(_DWORD *)XIntersection2 = v31;
    return;
  }
  if( (_DWORD)v31 == (_DWORD)v32 )
    goto LABEL_10;
}

Referenced by:

RaspScanConvert