PopPepComponentGetWork

CHAR __fastcall PopPepComponentGetWork(INT64 a1, INT64 a2, INT64 a3){
  unsigned int v3; 
  INT64 v5; 
  volatile INT32 *v8; 
  int v9; 
  unsigned int v10; 
  __int64 v11; 
  unsigned int *v12; 
  unsigned int v13; 
  __int64 v14; 
  char started; 
  unsigned int ReadyActivityType; 
  volatile INT32 *v17; 
  unsigned int v18; 
  INT64 v19; 
  unsigned int v20; 
  unsigned int v21; 
  unsigned int *v22; 
  v3 = 0;
  v5 = a2;
  if( !a3 )
    return v3;
  v8 = (volatile INT32 *)(a1 + 120);
  v9 = *(_DWORD *)(a1 + 120);
  if( v9 )
  {
    ReadyActivityType = PopPepGetReadyActivityType(a1 + 72, 0i64, 0i64);
    if( ReadyActivityType != 6 )
      goto LABEL_12;
  }
  if( v5 )
  {
    v17 = (volatile INT32 *)(v5 + 104);
    if( *(_DWORD *)(v5 + 104) > v3 )
    {
      v18 = PopPepGetReadyActivityType(v5 + 56, 1ui64, 3i64);
      started = PopPepStartActivity(a1, v19, v19 + 56, v18, v17, a3);
      goto LABEL_10;
    }
  }
  if( *(_BYTE *)(a1 + 125) == 1 )
  {
    v10 = *(_DWORD *)(a1 + 180);
    v11 = v3;
    if( v10 )
    {
      v12 = (unsigned int *)(a1 + 288);
      while( *v12 <= v3 )
      {
        v11 = (unsigned int)(v11 + 1);
        v12 += 50;
        if( (unsigned int)v11 >= v10 )
          goto LABEL_16;
      }
      v13 = PopPepGetReadyActivityType(a1 + 200 * v11 + 240, 1ui64, 3i64);
      started = PopPepStartActivity(a1, v14 + 184, v14 + 240, v13, (volatile INT32 *)(v14 + 288), a3);
      goto LABEL_10;
    }
  }
LABEL_16:
  if( !v9 )
    return v3;
  v20 = *(_DWORD *)(a1 + 180);
  v21 = v3;
  if( !v20 )
  {
LABEL_21:
    ReadyActivityType = PopPepGetReadyActivityType(a1 + 72, 4ui64, 5i64);
LABEL_12:
    started = PopPepStartActivity(a1, 0i64, a1 + 72, ReadyActivityType, v8, a3);
LABEL_10:
    LOBYTE(v3) = started;
    return v3;
  }
  v22 = (unsigned int *)(a1 + 288);
  while( *v22 <= v3 )
  {
    ++v21;
    v22 += 50;
    if( v21 >= v20 )
      goto LABEL_21;
  }
  return v3;
}

Referenced by:

PopPepProcessEvent