FopReadCmapTable

INT64 __fastcall FopReadCmapTable(INT64 a1, UINT64 a2, UINT64 **a3){
  int v4; 
  int BytesAtOffset; 
  unsigned __int16 v6; 
  UINT64 v7; 
  unsigned int v8; 
  _DWORD *v9; 
  UINT64 *v10; 
  unsigned int v11; 
  unsigned int v12; 
  unsigned int v13; 
  unsigned int *v14; 
  __int64 v17; 
  int v18; 
  v17 = 0i64;
  v18 = 0;
  v4 = a2;
  BytesAtOffset = FioFwReadBytesAtOffset(a1, a2, 4ui64, &v17);
  if( BytesAtOffset >= 0 )
  {
    v6 = __ROR2__(WORD1(v17), 8);
    LOWORD(v17) = __ROR2__(v17, 8);
    WORD1(v17) = v6;
    if( (_WORD)v17 )
    {
      return(unsigned int)-1073741701;
    }
    else
    {
      v7 = 12i64;
      if( v6 )
      {
        v8 = 8 * v6 + 4;
        if( v8 < 0xC )
          return(unsigned int)-1073741675;
        v7 = v8;
        BytesAtOffset = 0;
      }
      LODWORD(v9) = BgpFwAllocateMemory(v7);
      v10 = (UINT64 *)v9;
      if( v9 )
      {
        v11 = v4 + 4;
        v12 = v6;
        v13 = 0;
        *v9 = v17;
        if( v6 )
        {
          v14 = v9 + 2;
          while( 1 )
          {
            BytesAtOffset = FioFwReadBytesAtOffset(a1, v11, 8ui64, v14 - 1);
            if( BytesAtOffset >= 0 )
            {
              *((_WORD *)v14 - 2) = __ROR2__(*((_WORD *)v14 - 2), 8);
              *((_WORD *)v14 - 1) = __ROR2__(*((_WORD *)v14 - 1), 8);
              BytesAtOffset = 0;
              *v14 = _byteswap_ulong(*v14);
            }
            if( BytesAtOffset < 0 )
              break;
            ++v13;
            v14 += 2;
            v11 += 8;
            if( v13 >= v12 )
              goto LABEL_13;
          }
          BgpFwFreeMemory(v10);
        }
        else
        {
LABEL_13:
          *a3 = v10;
        }
      }
      else
      {
        return(unsigned int)-1073741801;
      }
    }
  }
  return(unsigned int)BytesAtOffset;
}

Referenced by:

FopReadMappingTable