#ifdef MEDIA042_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void F0399_MENUS_AddChampionSymbol(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0768_i_SymbolIndex)
#endif
int16_t P0768_i_SymbolIndex FINAL_SEPARATOR
{
        REGISTER CHAMPION* L1225_ps_Champion;
        REGISTER unsigned int16_t L1222_ui_SymbolStep;
        REGISTER unsigned int16_t L1223_ui_ManaCost;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER unsigned int16_t L1224_ui_SymbolIndex; /* BUG0_00 Useless code */
#endif


        L1225_ps_Champion = &M516_CHAMPIONS[G0514_i_MagicCasterChampionIndex];
        L1222_ui_SymbolStep = L1225_ps_Champion->SymbolStep;
        L1223_ui_ManaCost = G0485_aauc_Graphic560_SymbolBaseManaCost[L1222_ui_SymbolStep][P0768_i_SymbolIndex];
        if (L1222_ui_SymbolStep)
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                L1223_ui_ManaCost = (L1223_ui_ManaCost * G0486_auc_Graphic560_SymbolManaCostMultiplier[L1224_ui_SymbolIndex = L1225_ps_Champion->Symbols[0] - 96]) >> 3;
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                L1223_ui_ManaCost = (L1223_ui_ManaCost * G0486_auc_Graphic560_SymbolManaCostMultiplier[L1225_ps_Champion->Symbols[0] - 96]) >> 3;
#endif
        if (L1223_ui_ManaCost <= L1225_ps_Champion->CurrentMana) {
                L1225_ps_Champion->CurrentMana -= L1223_ui_ManaCost;
                M008_SET(L1225_ps_Champion->Attributes, MASK0x0100_STATISTICS);
                L1225_ps_Champion->Symbols[L1222_ui_SymbolStep] = 96 + (L1222_ui_SymbolStep * 6) + P0768_i_SymbolIndex;
                L1225_ps_Champion->Symbols[L1222_ui_SymbolStep + 1] = '\0';
#ifdef MEDIA014_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J
                L1225_ps_Champion->SymbolStep = L1222_ui_SymbolStep = (L1222_ui_SymbolStep + 1) & 3;
#endif
#ifdef MEDIA670_F31E_F31J
                /* Local var initialization might be used (tested but no visible effect) */
                /* 'if' condition might be inverted and use 'return' (tested but no effect) */
                /* nearly there, si instead of esi
                L1222_ui_SymbolStep++;
                L1222_ui_SymbolStep %= 4;
                L1225_ps_Champion->SymbolStep = L1222_ui_SymbolStep;
                */
                /* OK if L1222_ui_SymbolStep is of type int    but breaks elsewhere. actual type IS unsigned short
                L1222_ui_SymbolStep++;
                L1225_ps_Champion->SymbolStep = L1222_ui_SymbolStep %= 4;
                */
                /*L1225_ps_Champion->SymbolStep = L1222_ui_SymbolStep = (L1222_ui_SymbolStep + 1) % 4;*/
                /* OK but one too many instruction
                L1225_ps_Champion->SymbolStep = L1222_ui_SymbolStep = (L1225_ps_Champion->SymbolStep + 1) % 4;
                BUT, this very same line produces wrong machine code if all other code is removed (except first 2 or 3 local variable initializations)
                */

                /* Good code */
                _inline(0x46, 0x8B, 0xC6, 0x81, 0xE6, 0x03, 0x00, 0x00, 0x00, 0x23, 0xC0, 0x7D, 0x07, 0x23, 0xF6, 0x74, 0x03, 0x83, 0xEE, 0x04);
                L1225_ps_Champion->SymbolStep = L1222_ui_SymbolStep;

                /*L1225_ps_Champion->SymbolStep = L1222_ui_SymbolStep = (L1222_ui_SymbolStep + 1) % 4;*/ /* ANOMALY_FMT with modulo. si register used instead of esi, machine code 4 bytes too large */
#endif
#ifdef MEDIA595_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
                L1225_ps_Champion->SymbolStep = L1222_ui_SymbolStep = (L1222_ui_SymbolStep + 1) % 4; /* Also works for _A20ED_A20E_A20F_A20G_A21E_A22E_A22G, maybe also others ? */
#endif
                F0077_MOUSE_EnableScreenUpdate_CPSE();
                F0397_MENUS_DrawAvailableSymbols(L1222_ui_SymbolStep);
                F0398_MENUS_DrawChampionSymbols(L1225_ps_Champion);
                F0292_CHAMPION_DrawState(G0514_i_MagicCasterChampionIndex);
                F0078_MOUSE_DisableScreenUpdate();
        }
}

void F0400_MENUS_DeleteChampionSymbol(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER CHAMPION* L1228_ps_Champion;
#endif
        REGISTER unsigned int16_t L1226_ui_SymbolStep;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        register int16_t L1227_i_Unreferenced; /* BUG0_00 Useless code */
        REGISTER CHAMPION* L1228_ps_Champion;
#endif


        L1228_ps_Champion = &M516_CHAMPIONS[G0514_i_MagicCasterChampionIndex];
#ifdef MEDIA141_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        if (!M544_STRLEN(M772_CAST_PC(L1228_ps_Champion->Symbols))) { /* ANOMALY_ST_COMPARISON_WITH_ZERO */
#endif
#ifdef MEDIA351_G14ED_G20E_G21E /* OK for PC too */
        if (M544_STRLEN(L1228_ps_Champion->Symbols) == 0) {
#endif
                return;
        }
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
        L1228_ps_Champion->SymbolStep = L1226_ui_SymbolStep = M019_PREVIOUS(L1228_ps_Champion->SymbolStep);
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        L1228_ps_Champion->SymbolStep = L1226_ui_SymbolStep = M108_PREVIOUS(L1228_ps_Champion->SymbolStep);
#endif
        L1228_ps_Champion->Symbols[L1226_ui_SymbolStep] = '\0';
        F0077_MOUSE_EnableScreenUpdate_CPSE();
        F0397_MENUS_DrawAvailableSymbols(L1226_ui_SymbolStep);
        F0398_MENUS_DrawChampionSymbols(L1228_ps_Champion);
        F0078_MOUSE_DisableScreenUpdate();
}
#endif
