FopReadMappingTable

__int64 __fastcall FopReadMappingTable(__int64 a1, UINT64 a2, __int64 *a3){
  int v3; 
  int v5; 
  UINT64 *v6; 
  int BytesAtOffset; 
  _DWORD *v8; 
  unsigned int v9; 
  int v10; 
  int v11; 
  unsigned __int16 v12; 
  unsigned __int16 v13; 
  __int64 v14; 
  __int64 v15; 
  int v16; 
  unsigned int v17; 
  _WORD *v18; 
  _WORD *v19; 
  unsigned int v20; 
  _WORD *v21; 
  __int64 v22; 
  int v23; 
  __int64 v25; 
  int v26; 
  __int16 v27; 
  UINT64 *v29; 
  v29 = 0i64;
  v3 = a2;
  v25 = 0i64;
  v26 = 0;
  v27 = 0;
  v5 = FopReadCmapTable(a1, a2, &v29);
  v6 = v29;
  BytesAtOffset = v5;
  if( v5 >= 0 )
  {
    v8 = (_DWORD *)v29 + 1;
    v9 = 0;
    if( !*((_WORD *)v29 + 1) )
      goto LABEL_24;
    while( *v8 != 65539 )
    {
      ++v9;
      v8 += 2;
      if( v9 >= *((unsigned __int16 *)v29 + 1) )
        goto LABEL_24;
    }
    v10 = v8[1];
    if( !v10 )
    {
LABEL_24:
      BytesAtOffset = -1073741275;
      goto LABEL_20;
    }
    v11 = v10 + v3;
    BytesAtOffset = FioFwReadBytesAtOffset(a1, (unsigned int)(v10 + v3), 0xEui64, &v25);
    if( BytesAtOffset < 0 )
    {
      v13 = HIWORD(v25);
      v12 = WORD1(v25);
    }
    else
    {
      if( __ROR2__(v25, 8) != 4 )
      {
        BytesAtOffset = -1073741701;
        goto LABEL_20;
      }
      v12 = __ROR2__(WORD1(v25), 8);
      v13 = __ROR2__(HIWORD(v25), 8);
      BytesAtOffset = 0;
    }
    if( BytesAtOffset >= 0 )
    {
      LODWORD(v14) = BgpFwAllocateMemory(0x38ui64);
      v15 = v14;
      if( v14 )
      {
        *(_OWORD *)v14 = 0i64;
        *(_OWORD *)(v14 + 16) = 0i64;
        *(_OWORD *)(v14 + 32) = 0i64;
        *(_QWORD *)(v14 + 48) = 0i64;
        v16 = v13 >> 1;
        v17 = v12 - 14;
        *(_DWORD *)v15 = v16;
        LODWORD(v18) = BgpFwAllocateMemory(v17);
        v19 = v18;
        if( v18 )
        {
          v20 = v17 >> 1;
          *(_QWORD *)(v15 + 8) = v18;
          BytesAtOffset = FioFwReadBytesAtOffset(a1, (unsigned int)(v11 + 14), 2 * v20, v18);
          if( BytesAtOffset >= 0 )
          {
            if( v20 )
            {
              v21 = v19;
              v22 = v20;
              do
              {
                *v21 = __ROR2__(*v21, 8);
                ++v21;
                --v22;
              }
              while( v22 );
            }
            BytesAtOffset = 0;
          }
          if( BytesAtOffset >= 0 )
          {
            v23 = 2 * *(_DWORD *)v15;
            *(_QWORD *)(v15 + 24) = v19;
            *(_QWORD *)(v15 + 16) = (char *)v19 + (unsigned int)(v23 + 2);
            *(_QWORD *)(v15 + 32) = (char *)v19 + (unsigned int)(2 * v23 + 2);
            *(_QWORD *)(v15 + 40) = (char *)v19 + (unsigned int)(v23 + 2 * (v23 + 1));
            *(_QWORD *)(v15 + 48) = (char *)v19 + (unsigned int)(4 * v23 + 2);
            *a3 = v15;
            v15 = 0i64;
            BytesAtOffset = 0;
          }
        }
        else
        {
          BytesAtOffset = -1073741801;
        }
        if( v15 )
          FopFreeMappingTable(v15);
      }
      else
      {
        BytesAtOffset = -1073741801;
      }
    }
  }
LABEL_20:
  if( v6 )
    BgpFwFreeMemory(v6);
  return(unsigned int)BytesAtOffset;
}

Referenced by:

FopInitializeFonts