decompiled_code:
__int64 __fastcall MMA_GetBuyPrice(_DWORD *a1, unsigned __int64 a2)
{
__int64 result; // rax
unsigned int v3; // edx
float v4[7]; // [rsp+Ch] [rbp-1Ch] BYREF

GetTotalRise(1LL, a1, 4LL, v4);
result = 0xFFFFFFFFLL;
if ( v4[0] <= 0.098999999 )
{
v3 = a1[9];
if ( a1[6] != v3 || a1[7] != a1[8] )
{
result = v3;
if ( v3 < a2 )
result = 0xFFFFFFFFLL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(_DWORD *a1, unsigned __int64 a2)
{
__int64 result; // rax
unsigned int v3; // edx
float v4[7]; // [rsp+Ch] [rbp-1Ch] BYREF

GetTotalRise(1LL, a1, 4LL, v4);
result = 0xFFFFFFFFLL;
if ( v4[0] <= 0.098999999 )
{
v3 = a1[9];
if ( a1[6] != v3 || a1[7] != a1[8] )
{
result = v3;
if ( v3 < a2 )
result = 0xFFFFFFFFLL;
}
}
return result;
}

original_code:
ULONG MMA_GetBuyPrice( FILE_WHOLE_DATA_S *pstCurrData, ULONG ulWishPrice)
{
    FLOAT fRise;
    (VOID)GetTotalRise(1,pstCurrData,(0x04UL),&fRise);
    if (fRise > (0.099F)) return (0xFFFFFFFF);
    if ((pstCurrData->stDailyPrice.ulBegin == pstCurrData->stDailyPrice.ulEnd) &&
        (pstCurrData->stDailyPrice.ulHigh == pstCurrData->stDailyPrice.ulLow)) return (0xFFFFFFFF);
    if (pstCurrData->stDailyPrice.ulEnd < ulWishPrice) return (0xFFFFFFFF);
    return pstCurrData->stDailyPrice.ulEnd;
}

canonical_original_code:
unsigned long MMA_GetBuyPrice(struct tagWholeData *pstCurrData, unsigned long ulWishPrice)
{
    float fRise;
    (void)GetTotalRise(1,pstCurrData,(0x04UL),&fRise);
    if (fRise > (0.099F)) return (0xFFFFFFFF);
    if ((pstCurrData->stDailyPrice.ulBegin == pstCurrData->stDailyPrice.ulEnd) &&
        (pstCurrData->stDailyPrice.ulHigh == pstCurrData->stDailyPrice.ulLow)) return (0xFFFFFFFF);
    if (pstCurrData->stDailyPrice.ulEnd < ulWishPrice) return (0xFFFFFFFF);
    return pstCurrData->stDailyPrice.ulEnd;
}

variable_types:
ulWishPrice
unsigned long

variable_types: fRise float


repo: gitslime/StockAnalyser

decompiled_code:
// attributes: thunk
__int64 MMA_GetSellPrice()
{
return MMA_GetGainPrice();
}

canonical_decompiled_code:
__int64 func7()
{
return func4();
}

original_code:
ULONG MMA_GetSellPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    return (0xFFFFFFFF);
}

canonical_original_code:
unsigned long MMA_GetSellPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    return (0xFFFFFFFF);
}

variable_types: struct tagWholeData { char szComment[16]; unsigned int ulDate; unsigned int ulRsv; struct tagPrice { unsigned int ulBegin; unsigned int ulHigh; unsigned int ulLow; unsigned int ulEnd; unsigned int ulVol; unsigned int ulFlag; } stDailyPrice; struct tagPrice astMin30Price[8]; struct tagFactor { unsigned int ulFlag; float fMulti; float fAdder; } stFactor; unsigned int ulPad; } *

variable_types: struct tagStockCtrl { unsigned int ulGainPrice; unsigned int ulLossPrice; unsigned int ulBuyDate; unsigned int ulBuyPrice; unsigned int ulSellDate; unsigned int ulSellPrice; float fContext; } *

return_type: unsigned long

user_defined_types: struct tagWholeData { char szComment[16]; unsigned int ulDate; unsigned int ulRsv; struct tagPrice stDailyPrice; struct tagPrice astMin30Price[8]; struct tagFactor stFactor; unsigned int ulPad; }


decompiled_code:
unsigned __int64 __fastcall OMA_SetParam(__int64 a1, float *a2)
{
float v2; // xmm0_4
int v3; // eax
float v4; // xmm1_4
unsigned int v5; // edx
float v6; // xmm0_4
float v7; // xmm2_4
unsigned __int64 result; // rax

if ( a1 )
{
if ( a1 != 4 )
_assert_fail("ulCnt == sizeof(OMA_PARAM_S)/sizeof(UINT32)", "method/oma.c", 0x24u, "OMA_SetParam");
v2 = *a2;
if ( *a2 >= 9.223372e18 )
v3 = (int)(float)(v2 - 9.223372e18);
else
v3 = (int)v2;
v4 = a2[3];
v5 = v3;
LODWORD(g_stOmaParam) = v3;
v6 = a2[1];
v7 = a2[2];
*((float *)&g_stOmaParam + 1) = v6;
*(float *)&qword_5D8 = v7;
if ( v4 >= 9.223372e18 )
result = (unsigned int)(int)(float)(v4 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v4;
HIDWORD(qword_5D8) = result;
if ( v5 <= 1 )
_assert_fail("OMA_PARAM_MA > 1", "method/oma.c", 0x2Bu, "OMA_SetParam");
if ( v6 > 0.0 )
_assert_fail("OMA_PARAM_NO <= 0", "method/oma.c", 0x2Cu, "OMA_SetParam");
if ( v7 <= v6 )
_assert_fail("OMA_PARAM_PO > OMA_PARAM_NO", "method/oma.c", 0x2Du, "OMA_SetParam");
if ( !(_DWORD)result )
_assert_fail("OMA_PARAM_CD > 0", "method/oma.c", 0x2Eu, "OMA_SetParam");
}
else
{
g_stOmaParam = 0xBE3851EC00000018LL;
result = 0x2BCA3D70ALL;
qword_5D8 = 0x2BCA3D70ALL;
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func0(__int64 a1, float *a2)
{
float v2; // xmm0_4
int v3; // eax
float v4; // xmm1_4
unsigned int v5; // edx
float v6; // xmm0_4
float v7; // xmm2_4
unsigned __int64 result; // rax

if ( a1 )
{
if ( a1 != 4 )
_assert_fail("ulCnt == sizeof(OMA_PARAM_S)/sizeof(UINT32)", "method/oma.c", 0x24u, "OMA_SetParam");
v2 = *a2;
if ( *a2 >= 9.223372e18 )
v3 = (int)(float)(v2 - 9.223372e18);
else
v3 = (int)v2;
v4 = a2[3];
v5 = v3;
LODWORD(g_stOmaParam) = v3;
v6 = a2[1];
v7 = a2[2];
*((float *)&g_stOmaParam + 1) = v6;
*(float *)&qword_5D8 = v7;
if ( v4 >= 9.223372e18 )
result = (unsigned int)(int)(float)(v4 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v4;
HIDWORD(qword_5D8) = result;
if ( v5 <= 1 )
_assert_fail("OMA_PARAM_MA > 1", "method/oma.c", 0x2Bu, "OMA_SetParam");
if ( v6 > 0.0 )
_assert_fail("OMA_PARAM_NO <= 0", "method/oma.c", 0x2Cu, "OMA_SetParam");
if ( v7 <= v6 )
_assert_fail("OMA_PARAM_PO > OMA_PARAM_NO", "method/oma.c", 0x2Du, "OMA_SetParam");
if ( !(_DWORD)result )
_assert_fail("OMA_PARAM_CD > 0", "method/oma.c", 0x2Eu, "OMA_SetParam");
}
else
{
g_stOmaParam = 0xBE3851EC00000018LL;
result = 0x2BCA3D70ALL;
qword_5D8 = 0x2BCA3D70ALL;
}
return result;
}

original_code:
VOID OMA_SetParam( ULONG ulCnt, FLOAT *afParam)
{
    if (0==ulCnt) {
        g_stOmaParam.ulMaDays = (24);
        g_stOmaParam.fNoThreshold = (-0.18F);
        g_stOmaParam.fPoThreshold = (-0.02F);
        g_stOmaParam.ulChkSellDays = (2);
        return;
    }
    ((void) sizeof ((ulCnt == sizeof(OMA_PARAM_S)/sizeof(UINT32)) ? 1 : 0), __extension__ ({ if (ulCnt == sizeof(OMA_PARAM_S)/sizeof(UINT32)) ; else __assert_fail ("ulCnt == sizeof(OMA_PARAM_S)/sizeof(UINT32)", "method/oma.c", 36, __extension__ __PRETTY_FUNCTION__); }));
    g_stOmaParam.ulMaDays = (ULONG)afParam[0];
    g_stOmaParam.fNoThreshold = afParam[1];
    g_stOmaParam.fPoThreshold = afParam[2];
    g_stOmaParam.ulChkSellDays = (ULONG)afParam[3];
    ((void) sizeof (((g_stOmaParam.ulMaDays) > 1) ? 1 : 0), __extension__ ({ if ((g_stOmaParam.ulMaDays) > 1) ; else __assert_fail ("OMA_PARAM_MA > 1", "method/oma.c", 43, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof (((g_stOmaParam.fNoThreshold) <= 0) ? 1 : 0), __extension__ ({ if ((g_stOmaParam.fNoThreshold) <= 0) ; else __assert_fail ("OMA_PARAM_NO <= 0", "method/oma.c", 44, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof (((g_stOmaParam.fPoThreshold) > (g_stOmaParam.fNoThreshold)) ? 1 : 0), __extension__ ({ if ((g_stOmaParam.fPoThreshold) > (g_stOmaParam.fNoThreshold)) ; else __assert_fail ("OMA_PARAM_PO > OMA_PARAM_NO", "method/oma.c", 45, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof (((g_stOmaParam.ulChkSellDays) > 0) ? 1 : 0), __extension__ ({ if ((g_stOmaParam.ulChkSellDays) > 0) ; else __assert_fail ("OMA_PARAM_CD > 0", "method/oma.c", 46, __extension__ __PRETTY_FUNCTION__); }));
    return;
}

canonical_original_code:
void OMA_SetParam(unsigned long ulCnt, float *afParam)
{
    if (0==ulCnt) {
        g_stOmaParam.ulMaDays = (24);
        g_stOmaParam.fNoThreshold = (-0.18F);
        g_stOmaParam.fPoThreshold = (-0.02F);
        g_stOmaParam.ulChkSellDays = (2);
        return;
    }
    ((void) sizeof ((ulCnt == sizeof(OMA_PARAM_S)/sizeof(UINT32)) ? 1 : 0), __extension__ ({ if (ulCnt == sizeof(OMA_PARAM_S)/sizeof(UINT32)) ; else __assert_fail ("ulCnt == sizeof(OMA_PARAM_S)/sizeof(UINT32)", "method/oma.c", 36, __extension__ __PRETTY_FUNCTION__); }));
    g_stOmaParam.ulMaDays = (unsigned long)afParam[0];
    g_stOmaParam.fNoThreshold = afParam[1];
    g_stOmaParam.fPoThreshold = afParam[2];
    g_stOmaParam.ulChkSellDays = (unsigned long)afParam[3];
    ((void) sizeof (((g_stOmaParam.ulMaDays) > 1) ? 1 : 0), __extension__ ({ if ((g_stOmaParam.ulMaDays) > 1) ; else __assert_fail ("OMA_PARAM_MA > 1", "method/oma.c", 43, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof (((g_stOmaParam.fNoThreshold) <= 0) ? 1 : 0), __extension__ ({ if ((g_stOmaParam.fNoThreshold) <= 0) ; else __assert_fail ("OMA_PARAM_NO <= 0", "method/oma.c", 44, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof (((g_stOmaParam.fPoThreshold) > (g_stOmaParam.fNoThreshold)) ? 1 : 0), __extension__ ({ if ((g_stOmaParam.fPoThreshold) > (g_stOmaParam.fNoThreshold)) ; else __assert_fail ("OMA_PARAM_PO > OMA_PARAM_NO", "method/oma.c", 45, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof (((g_stOmaParam.ulChkSellDays) > 0) ? 1 : 0), __extension__ ({ if ((g_stOmaParam.ulChkSellDays) > 0) ; else __assert_fail ("OMA_PARAM_CD > 0", "method/oma.c", 46, __extension__ __PRETTY_FUNCTION__); }));
    return;
}

variable_types:
ulCnt
unsigned long

variable_types:
afParam
float *

return_type: void


decompiled_code:
void __fastcall OMA_Statistics(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rax
float v3; // xmm1_4

if ( a1 > 0x17 )
{
v2 = GetMean(24LL, a2, 0xFFFFFFFFLL);
if ( v2 < 0 )
v3 = (float)(v2 & 1 | (unsigned int)((unsigned __int64)v2 >> 1))
+ (float)(v2 & 1 | (unsigned int)((unsigned __int64)v2 >> 1));
else
v3 = (float)(int)v2;
printf(
"%lu,%lu,%f\n",
*(unsigned int *)(a2 + 16),
*(unsigned int *)(a2 + 36),
(float)((float)((float)*(int *)(a2 + 36) / v3) - 1.0));
}
}

canonical_decompiled_code:
void __fastcall func1(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rax
float v3; // xmm1_4

if ( a1 > 0x17 )
{
v2 = GetMean(24LL, a2, 0xFFFFFFFFLL);
if ( v2 < 0 )
v3 = (float)(v2 & 1 | (unsigned int)((unsigned __int64)v2 >> 1))
+ (float)(v2 & 1 | (unsigned int)((unsigned __int64)v2 >> 1));
else
v3 = (float)(int)v2;
printf(
"%lu,%lu,%f\n",
*(unsigned int *)(a2 + 16),
*(unsigned int *)(a2 + 36),
(float)((float)((float)*(int *)(a2 + 36) / v3) - 1.0));
}
}

original_code:
VOID OMA_Statistics( ULONG ulIndex, FILE_WHOLE_DATA_S *pstCurrData)
{
    ULONG ulMa;
    if (ulIndex < (24)) return;
    ulMa=GetMean((24),pstCurrData,(0xFFFFFFFF));
    printf("%lu,%lu,%f\n",pstCurrData->ulDate, pstCurrData->stDailyPrice.ulEnd,
                        pstCurrData->stDailyPrice.ulEnd/(FLOAT)ulMa-1);
    return;
}

canonical_original_code:
void OMA_Statistics(unsigned long ulIndex, struct tagWholeData *pstCurrData)
{
    unsigned long ulMa;
    if (ulIndex < (24)) return;
    ulMa=GetMean((24),pstCurrData,(0xFFFFFFFF));
    printf("%lu,%lu,%f\n",pstCurrData->ulDate, pstCurrData->stDailyPrice.ulEnd,
                        pstCurrData->stDailyPrice.ulEnd/(float)ulMa-1);
    return;
}

variable_types:
ulIndex
unsigned long

variable_types:
ulMa
unsigned long

user_defined_types: struct tagPrice { unsigned int ulBegin; unsigned int ulHigh; unsigned int ulLow; unsigned int ulEnd; unsigned int ulVol; unsigned int ulFlag; }

user_defined_types: struct tagFactor { unsigned int ulFlag; float fMulti; float fAdder; }


decompiled_code:
__int64 __fastcall OMA_Choose(unsigned __int64 a1, __int64 a2, __int64 a3)
{
float v4; // xmm1_4
__int64 v5; // rax
__int64 v6; // rdx
__int64 result; // rax
__int64 v8; // rax
float v9; // xmm2_4
__int64 v10; // r12
__int64 v11; // rax
float v12; // xmm3_4
float v13; // xmm0_4
float v14; // xmm2_4
float v15; // xmm0_4
__int64 v16; // rax
float v17; // xmm0_4
float v18; // xmm1_4

if ( (unsigned int)g_stOmaParam > a1 )
return 0LL;
v4 = *(float *)&LC8;
if ( (_DWORD)g_stOmaParam )
{
v4 = *(float *)&LC8;
v5 = a2;
v6 = 0LL;
while ( *(_DWORD *)(v5 + 240) != -2004318072 || *(float *)(v5 + 244) <= 1.0 )
{
++v6;
v5 -= 256LL;
if ( (unsigned int)g_stOmaParam == v6 )
goto LABEL_8;
}
return 0LL;
}
LABEL_8:
v8 = GetMean((unsigned int)g_stOmaParam, a2, 0xFFFFFFFFLL);
if ( v8 < 0 )
v9 = (float)(v8 & 1 | (unsigned int)((unsigned __int64)v8 >> 1))
+ (float)(v8 & 1 | (unsigned int)((unsigned __int64)v8 >> 1));
else
v9 = (float)(int)v8;
if ( (float)((float)((float)*(int *)(a2 + 36) / v9) - v4) >= *((float *)&g_stOmaParam + 1) )
return 0LL;
v10 = GetMean((unsigned int)(g_stOmaParam - 1), a2 - 256, 0xFFFFFFFFLL);
v11 = GetMean((unsigned int)(g_stOmaParam - 1), a2, v10);
v12 = (float)*(int *)(a2 + 36);
if ( v11 < 0 )
{
v13 = (float)(v11 & 1 | (unsigned int)((unsigned __int64)v11 >> 1))
+ (float)(v11 & 1 | (unsigned int)((unsigned __int64)v11 >> 1));
if ( v10 >= 0 )
goto LABEL_13;
}
else
{
v13 = (float)(int)v11;
if ( v10 >= 0 )
{
LABEL_13:
v14 = (float)(int)v10;
goto LABEL_14;
}
}
v14 = (float)(v10 & 1 | (unsigned int)((unsigned __int64)v10 >> 1))
+ (float)(v10 & 1 | (unsigned int)((unsigned __int64)v10 >> 1));
LABEL_14:
v15 = (float)(v13 / v14) * v12;
if ( (float)((float)(v15 / v12) - v4) > 0.098999999 )
return 0LL;
*(_DWORD *)a3 = 917504;
*(_WORD *)(a3 + 4) = RandomUlong(50LL, 60LL);
*(_WORD *)(a3 + 6) = 1;
v16 = RandomUlong(0LL, 100LL);
v17 = fmaxf(v12, v15);
if ( v16 < 0 )
v18 = (float)(v16 & 1 | (unsigned int)((unsigned __int64)v16 >> 1))
+ (float)(v16 & 1 | (unsigned int)((unsigned __int64)v16 >> 1));
else
v18 = (float)(int)v16;
*(float *)(a3 + 12) = v18;
result = 1LL;
*(float *)(a3 + 8) = v17 / 1000.0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int64 a1, __int64 a2, __int64 a3)
{
float v4; // xmm1_4
__int64 v5; // rax
__int64 v6; // rdx
__int64 result; // rax
__int64 v8; // rax
float v9; // xmm2_4
__int64 v10; // r12
__int64 v11; // rax
float v12; // xmm3_4
float v13; // xmm0_4
float v14; // xmm2_4
float v15; // xmm0_4
__int64 v16; // rax
float v17; // xmm0_4
float v18; // xmm1_4

if ( (unsigned int)g_stOmaParam > a1 )
return 0LL;
v4 = *(float *)&LC8;
if ( (_DWORD)g_stOmaParam )
{
v4 = *(float *)&LC8;
v5 = a2;
v6 = 0LL;
while ( *(_DWORD *)(v5 + 240) != -2004318072 || *(float *)(v5 + 244) <= 1.0 )
{
++v6;
v5 -= 256LL;
if ( (unsigned int)g_stOmaParam == v6 )
goto LABEL_8;
}
return 0LL;
}
LABEL_8:
v8 = GetMean((unsigned int)g_stOmaParam, a2, 0xFFFFFFFFLL);
if ( v8 < 0 )
v9 = (float)(v8 & 1 | (unsigned int)((unsigned __int64)v8 >> 1))
+ (float)(v8 & 1 | (unsigned int)((unsigned __int64)v8 >> 1));
else
v9 = (float)(int)v8;
if ( (float)((float)((float)*(int *)(a2 + 36) / v9) - v4) >= *((float *)&g_stOmaParam + 1) )
return 0LL;
v10 = GetMean((unsigned int)(g_stOmaParam - 1), a2 - 256, 0xFFFFFFFFLL);
v11 = GetMean((unsigned int)(g_stOmaParam - 1), a2, v10);
v12 = (float)*(int *)(a2 + 36);
if ( v11 < 0 )
{
v13 = (float)(v11 & 1 | (unsigned int)((unsigned __int64)v11 >> 1))
+ (float)(v11 & 1 | (unsigned int)((unsigned __int64)v11 >> 1));
if ( v10 >= 0 )
goto LABEL_13;
}
else
{
v13 = (float)(int)v11;
if ( v10 >= 0 )
{
LABEL_13:
v14 = (float)(int)v10;
goto LABEL_14;
}
}
v14 = (float)(v10 & 1 | (unsigned int)((unsigned __int64)v10 >> 1))
+ (float)(v10 & 1 | (unsigned int)((unsigned __int64)v10 >> 1));
LABEL_14:
v15 = (float)(v13 / v14) * v12;
if ( (float)((float)(v15 / v12) - v4) > 0.098999999 )
return 0LL;
*(_DWORD *)a3 = 917504;
*(_WORD *)(a3 + 4) = RandomUlong(50LL, 60LL);
*(_WORD *)(a3 + 6) = 1;
v16 = RandomUlong(0LL, 100LL);
v17 = fmaxf(v12, v15);
if ( v16 < 0 )
v18 = (float)(v16 & 1 | (unsigned int)((unsigned __int64)v16 >> 1))
+ (float)(v16 & 1 | (unsigned int)((unsigned __int64)v16 >> 1));
else
v18 = (float)(int)v16;
*(float *)(a3 + 12) = v18;
result = 1LL;
*(float *)(a3 + 8) = v17 / 1000.0;
return result;
}

original_code:
BOOL_T OMA_Choose( ULONG ulIndex, FILE_WHOLE_DATA_S *pstCurrData, CHOOSE_PRE_DEAL_S *pstDealInfo)
{
    ULONG ulMa;
    ULONG ulPrevShorterMa, ulCurrShorterMa;
    FLOAT fCurrOffset;
    FLOAT fThresholdPrice;
    FLOAT fCurrRise, fExpectRise;
    ULONG i;
    ULONG ulStartPrice;
    FILE_WHOLE_DATA_S *pstMeanData;
    if (ulIndex < (g_stOmaParam.ulMaDays)) return (0);
    for (i=0,pstMeanData=pstCurrData;i<(g_stOmaParam.ulMaDays);i++,pstMeanData--) {
        if ((pstMeanData->stFactor.ulFlag == 0x88888888) &&
            (pstMeanData->stFactor.fMulti > 1))
           return (0);
    }
    pstMeanData=pstCurrData-(g_stOmaParam.ulMaDays)+1;
    ulStartPrice = pstMeanData->stDailyPrice.ulEnd;
    ulMa = GetMean((g_stOmaParam.ulMaDays), pstCurrData, (0xFFFFFFFF));
    fCurrOffset = ((FLOAT)pstCurrData->stDailyPrice.ulEnd/ulMa) - 1;
    if (fCurrOffset >= (g_stOmaParam.fNoThreshold)) return (0);
    ulPrevShorterMa = GetMean((g_stOmaParam.ulMaDays)-1,pstCurrData-1,(0xFFFFFFFF));
    ulCurrShorterMa = GetMean((g_stOmaParam.ulMaDays)-1,pstCurrData,ulPrevShorterMa);
    fThresholdPrice = (FLOAT)ulCurrShorterMa/ulPrevShorterMa*pstCurrData->stDailyPrice.ulEnd;
    fExpectRise = fThresholdPrice/pstCurrData->stDailyPrice.ulEnd-1;
    if (fExpectRise > (0.099F)) return (0);
    fThresholdPrice = (((pstCurrData->stDailyPrice.ulEnd) > (fThresholdPrice)) ? (pstCurrData->stDailyPrice.ulEnd) : (fThresholdPrice));
    pstDealInfo->bIsSell = (0);
    pstDealInfo->usDealHour = 14;
    pstDealInfo->usDealMin = (USHORT)RandomUlong(50,60);
    pstDealInfo->bIsHigher = (1);
    pstDealInfo->fWeight = (FLOAT)RandomUlong(0,100);
    pstDealInfo->fThresholdPrice = (((FLOAT)(fThresholdPrice))/(1000));
    return (1);
}

canonical_original_code:
unsigned short OMA_Choose(unsigned long ulIndex, struct tagWholeData *pstCurrData, struct tagPreDealInfo *pstDealInfo)
{
    unsigned long ulMa;
    unsigned long ulPrevShorterMa; unsigned long ulCurrShorterMa;
    float fCurrOffset;
    float fThresholdPrice;
    float fCurrRise; float fExpectRise;
    unsigned long i;
    unsigned long ulStartPrice;
    struct tagWholeData *pstMeanData;
    if (ulIndex < (g_stOmaParam.ulMaDays)) return (0);
    for (i=0,pstMeanData=pstCurrData;i<(g_stOmaParam.ulMaDays);i++,pstMeanData--) {
        if ((pstMeanData->stFactor.ulFlag == 0x88888888) &&
            (pstMeanData->stFactor.fMulti > 1))
           return (0);
    }
    pstMeanData=pstCurrData-(g_stOmaParam.ulMaDays)+1;
    ulStartPrice = pstMeanData->stDailyPrice.ulEnd;
    ulMa = GetMean((g_stOmaParam.ulMaDays), pstCurrData, (0xFFFFFFFF));
    fCurrOffset = ((float)pstCurrData->stDailyPrice.ulEnd/ulMa) - 1;
    if (fCurrOffset >= (g_stOmaParam.fNoThreshold)) return (0);
    ulPrevShorterMa = GetMean((g_stOmaParam.ulMaDays)-1,pstCurrData-1,(0xFFFFFFFF));
    ulCurrShorterMa = GetMean((g_stOmaParam.ulMaDays)-1,pstCurrData,ulPrevShorterMa);
    fThresholdPrice = (float)ulCurrShorterMa/ulPrevShorterMa*pstCurrData->stDailyPrice.ulEnd;
    fExpectRise = fThresholdPrice/pstCurrData->stDailyPrice.ulEnd-1;
    if (fExpectRise > (0.099F)) return (0);
    fThresholdPrice = (((pstCurrData->stDailyPrice.ulEnd) > (fThresholdPrice)) ? (pstCurrData->stDailyPrice.ulEnd) : (fThresholdPrice));
    pstDealInfo->bIsSell = (0);
    pstDealInfo->usDealHour = 14;
    pstDealInfo->usDealMin = (unsigned short)RandomUlong(50,60);
    pstDealInfo->bIsHigher = (1);
    pstDealInfo->fWeight = (float)RandomUlong(0,100);
    pstDealInfo->fThresholdPrice = (((FLOAT)(fThresholdPrice))/(1000));
    return (1);
}

variable_types: struct tagPreDealInfo { unsigned short bIsSell; unsigned short usDealHour; unsigned short usDealMin; unsigned short bIsHigher; float fThresholdPrice; float fWeight; } *

variable_types:
ulPrevShorterMa
unsigned long

variable_types:
ulCurrShorterMa
unsigned long

variable_types: fCurrOffset float

variable_types: fThresholdPrice float

variable_types: fCurrRise float

variable_types: fExpectRise float

variable_types:
i
unsigned long

variable_types:
ulStartPrice
unsigned long

return_type: unsigned short


decompiled_code:
__int64 __fastcall OMA_SortWishList(__int64 a1)
{
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
return a1;
}

original_code:
ULONG OMA_SortWishList( ULONG ulWishCnt, SIM_STOCK_DATA_S *pstAllData, SIM_WISH_LIST_S *astWishList)
{
    return ulWishCnt;
}

canonical_original_code:
unsigned long OMA_SortWishList(unsigned long ulWishCnt, struct tagStockData *pstAllData, struct tagWishList *astWishList)
{
    return ulWishCnt;
}

variable_types:
ulWishCnt
unsigned long

variable_types: struct tagStockData { unsigned int ulStockCode; unsigned int ulEntryCnt; unsigned short bIsHold; struct tagWholeData { char szComment[16]; unsigned int ulDate; unsigned int ulRsv; struct tagPrice { unsigned int ulBegin; unsigned int ulHigh; unsigned int ulLow; unsigned int ulEnd; unsigned int ulVol; unsigned int ulFlag; } stDailyPrice; struct tagPrice astMin30Price[8]; struct tagFactor { unsigned int ulFlag; float fMulti; float fAdder; } stFactor; unsigned int ulPad; } *pstCurrData; struct tagWholeData *astWholeData; } *

variable_types: struct tagWishList { unsigned int ulCode; unsigned int ulIndex; unsigned int ulWishPrice; float fWeight; } *

user_defined_types: struct tagStockData { unsigned int ulStockCode; unsigned int ulEntryCnt; unsigned short bIsHold; struct tagWholeData *pstCurrData; struct tagWholeData *astWholeData; }


decompiled_code:
__int64 OMA_GetGainPrice()
{
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func4()
{
return 0xFFFFFFFFLL;
}

original_code:
ULONG OMA_GetGainPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    return (0xFFFFFFFF);
}

canonical_original_code:
unsigned long OMA_GetGainPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    return (0xFFFFFFFF);
}

variable_types: struct tagWholeData { char szComment[16]; unsigned int ulDate; unsigned int ulRsv; struct tagPrice { unsigned int ulBegin; unsigned int ulHigh; unsigned int ulLow; unsigned int ulEnd; unsigned int ulVol; unsigned int ulFlag; } stDailyPrice; struct tagPrice astMin30Price[8]; struct tagFactor { unsigned int ulFlag; float fMulti; float fAdder; } stFactor; unsigned int ulPad; } *

variable_types: struct tagStockCtrl { unsigned int ulGainPrice; unsigned int ulLossPrice; unsigned int ulBuyDate; unsigned int ulBuyPrice; unsigned int ulSellDate; unsigned int ulSellPrice; float fContext; } *


original_code:
ULONG OMA_GetLossPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    ULONG ulHoldDays=0;
    FILE_WHOLE_DATA_S *pstBuyData = pstCurrData;
    ((void) sizeof ((pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ? 1 : 0), __extension__ ({ if (pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ; else __assert_fail ("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/oma.c", 217, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstBuyData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstBuyData--;
    }
    if (ulHoldDays > 30) return (ULONG)((1+(ulHoldDays*0.003F))*pstBuyData->stDailyPrice.ulEnd);
    return (ULONG)(0.8F * pstBuyData->stDailyPrice.ulEnd);
}

canonical_original_code:
unsigned long OMA_GetLossPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    unsigned long ulHoldDays = 0;
    struct tagWholeData *pstBuyData = pstCurrData;
    ((void) sizeof ((pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ? 1 : 0), __extension__ ({ if (pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ; else __assert_fail ("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/oma.c", 217, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstBuyData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstBuyData--;
    }
    if (ulHoldDays > 30) return (ULONG)((1+(ulHoldDays*0.003F))*pstBuyData->stDailyPrice.ulEnd);
    return (ULONG)(0.8F * pstBuyData->stDailyPrice.ulEnd);
}

variable_types:
ulHoldDays
unsigned long

user_defined_types: struct tagStockCtrl { unsigned int ulGainPrice; unsigned int ulLossPrice; unsigned int ulBuyDate; unsigned int ulBuyPrice; unsigned int ulSellDate; unsigned int ulSellPrice; float fContext; }


decompiled_code:
__int64 __fastcall OMA_GetBuyPrice(_DWORD *a1, unsigned __int64 a2)
{
__int64 result; // rax
unsigned int v3; // edx
float v4[7]; // [rsp+Ch] [rbp-1Ch] BYREF

GetTotalRise(1LL, a1, 4LL, v4);
result = 0xFFFFFFFFLL;
if ( v4[0] <= 0.098999999 )
{
v3 = a1[9];
if ( a1[6] != v3 || a1[7] != a1[8] )
{
result = v3;
if ( v3 < a2 )
result = 0xFFFFFFFFLL;
}
}
return result;
}

original_code:
ULONG OMA_GetBuyPrice( FILE_WHOLE_DATA_S *pstCurrData, ULONG ulWishPrice)
{
    FLOAT fRise;
    (VOID)GetTotalRise(1,pstCurrData,(0x04UL),&fRise);
    if (fRise > (0.099F)) return (0xFFFFFFFF);
    if ((pstCurrData->stDailyPrice.ulBegin == pstCurrData->stDailyPrice.ulEnd) &&
        (pstCurrData->stDailyPrice.ulHigh == pstCurrData->stDailyPrice.ulLow)) return (0xFFFFFFFF);
    if (pstCurrData->stDailyPrice.ulEnd < ulWishPrice) return (0xFFFFFFFF);
    return pstCurrData->stDailyPrice.ulEnd;
}

canonical_original_code:
unsigned long OMA_GetBuyPrice(struct tagWholeData *pstCurrData, unsigned long ulWishPrice)
{
    float fRise;
    (void)GetTotalRise(1,pstCurrData,(0x04UL),&fRise);
    if (fRise > (0.099F)) return (0xFFFFFFFF);
    if ((pstCurrData->stDailyPrice.ulBegin == pstCurrData->stDailyPrice.ulEnd) &&
        (pstCurrData->stDailyPrice.ulHigh == pstCurrData->stDailyPrice.ulLow)) return (0xFFFFFFFF);
    if (pstCurrData->stDailyPrice.ulEnd < ulWishPrice) return (0xFFFFFFFF);
    return pstCurrData->stDailyPrice.ulEnd;
}

variable_types:
ulWishPrice
unsigned long

variable_types: fRise float


decompiled_code:
// attributes: thunk
__int64 OMA_GetSellPrice()
{
return OMA_GetGainPrice();
}

original_code:
ULONG OMA_GetSellPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    return (0xFFFFFFFF);
}

canonical_original_code:
unsigned long OMA_GetSellPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    return (0xFFFFFFFF);
}


GetFileType

decompiled_code:
__int64 __fastcall GetFileType(char *s1)
{
if ( !strcasecmp(s1, "ths_day") )
return 268435492LL;
if ( !strcasecmp(s1, "ths_min5") )
return 268435461LL;
if ( !strcasecmp(s1, "custom") )
return 4026531840LL;
if ( strcasecmp(s1, "weight") )
{
puts("invaild file type");
exit(2);
}
return 536903680LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s1)
{
if ( !strcasecmp(s1, "ths_day") )
return 268435492LL;
if ( !strcasecmp(s1, "ths_min5") )
return 268435461LL;
if ( !strcasecmp(s1, "custom") )
return 4026531840LL;
if ( strcasecmp(s1, "weight") )
{
puts("invaild file type");
exit(2);
}
return 536903680LL;
}

original_code:
ULONG GetFileType( CHAR* szType)
{
    ULONG ulFileType;
    if (0 == strcasecmp(szType, "ths_day")) {
        ulFileType = 0x10000024;
    }
    else if (0 == strcasecmp(szType, "ths_min5")) {
        ulFileType = 0x10000005;
    }
    else if (0 == strcasecmp(szType, "custom")) {
        ulFileType = 0xF0000000;
    }
    else if (0 == strcasecmp(szType, "weight")) {
        ulFileType = 0x20008000;
    }
    else {
        printf("invaild file type\n");
        ulFileType = (0xFFFFFFFF);
        exit(2);
    }
    return ulFileType;
}

canonical_original_code:
unsigned long GetFileType(char *szType)
{
    unsigned long ulFileType;
    if (0 == strcasecmp(szType, "ths_day")) {
        ulFileType = 0x10000024;
    }
    else if (0 == strcasecmp(szType, "ths_min5")) {
        ulFileType = 0x10000005;
    }
    else if (0 == strcasecmp(szType, "custom")) {
        ulFileType = 0xF0000000;
    }
    else if (0 == strcasecmp(szType, "weight")) {
        ulFileType = 0x20008000;
    }
    else {
        printf("invaild file type\n");
        ulFileType = (0xFFFFFFFF);
        exit(2);
    }
    return ulFileType;
}

variable_types:
szType
char *

variable_types:
ulFileType
unsigned long


PrintSingleDay

original_code:
VOID PrintSingleDay( FILE_WHOLE_DATA_S *pstEntry)
{
    ULONG i, ulMin30Cnt;
    ULONG aulMin[8] = {1000,1030,1100,1130,1330,1400,1430,1500};
    for (ulMin30Cnt=0;ulMin30Cnt<8;ulMin30Cnt++) {
        if (0xCCCCCCCC != pstEntry->astMin30Price[ulMin30Cnt].ulFlag) break;
    }
    printf("\n=============================================================================");
    printf("\nDATE: %lu", pstEntry->ulDate);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", aulMin[i]);
    }
    printf("\n=============================================================================");
    printf("\nBEGIN:\t%lu", pstEntry->stDailyPrice.ulBegin);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulBegin);
    }
    printf("\nHIGH:\t%lu", pstEntry->stDailyPrice.ulHigh);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulHigh);
    }
    printf("\nLOW:\t%lu", pstEntry->stDailyPrice.ulLow);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulLow);
    }
    printf("\nEND:\t%lu", pstEntry->stDailyPrice.ulEnd);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulEnd);
    }
    printf("\nVOL:\t%lu", pstEntry->stDailyPrice.ulVol);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulVol);
    }
    printf("\n");
    if (0x88888888 == pstEntry->stFactor.ulFlag) {
        printf("Multi=%f, Adder=%f\n", pstEntry->stFactor.fMulti, pstEntry->stFactor.fAdder);
    }
    return;
}

canonical_original_code:
void PrintSingleDay(struct tagWholeData *pstEntry)
{
    unsigned long i; unsigned long ulMin30Cnt;
    unsigned long aulMin[8] = {1000,1030,1100,1130,1330,1400,1430,1500};
    for (ulMin30Cnt=0;ulMin30Cnt<8;ulMin30Cnt++) {
        if (0xCCCCCCCC != pstEntry->astMin30Price[ulMin30Cnt].ulFlag) break;
    }
    printf("\n=============================================================================");
    printf("\nDATE: %lu", pstEntry->ulDate);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", aulMin[i]);
    }
    printf("\n=============================================================================");
    printf("\nBEGIN:\t%lu", pstEntry->stDailyPrice.ulBegin);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulBegin);
    }
    printf("\nHIGH:\t%lu", pstEntry->stDailyPrice.ulHigh);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulHigh);
    }
    printf("\nLOW:\t%lu", pstEntry->stDailyPrice.ulLow);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulLow);
    }
    printf("\nEND:\t%lu", pstEntry->stDailyPrice.ulEnd);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulEnd);
    }
    printf("\nVOL:\t%lu", pstEntry->stDailyPrice.ulVol);
    for (i=0;i<ulMin30Cnt;i++) {
        printf("\t%lu", pstEntry->astMin30Price[i].ulVol);
    }
    printf("\n");
    if (0x88888888 == pstEntry->stFactor.ulFlag) {
        printf("Multi=%f, Adder=%f\n", pstEntry->stFactor.fMulti, pstEntry->stFactor.fAdder);
    }
    return;
}

variable_types:
aulMin
unsigned long [8]


ShowThsDaily

decompiled_code:
int __fastcall ShowThsDaily(__int64 a1, __int64 a2, _DWORD *a3)
{
__int64 v4; // rax
_BYTE v6[264]; // [rsp-108h] [rbp-108h] BYREF

if ( !a2 )
return printf("date %ld not found\n", a1);
v4 = 0LL;
while ( *a3 != a1 )
{
++v4;
a3 += 42;
if ( a2 == v4 )
return printf("date %ld not found\n", a1);
}
memset(v6, 0, 0x100uLL);
FILE_ThsDayToCustom(a3, v6);
return PrintSingleDay((__int64)v6);
}

canonical_decompiled_code:
int __fastcall func2(__int64 a1, __int64 a2, _DWORD *a3)
{
__int64 v4; // rax
_BYTE v6[264]; // [rsp-108h] [rbp-108h] BYREF

if ( !a2 )
return printf("date %ld not found\n", a1);
v4 = 0LL;
while ( *a3 != a1 )
{
++v4;
a3 += 42;
if ( a2 == v4 )
return printf("date %ld not found\n", a1);
}
memset(v6, 0, 0x100uLL);
FILE_ThsDayToCustom(a3, v6);
return func1((__int64)v6);
}

original_code:
VOID ShowThsDaily( ULONG ulDate, ULONG ulEntryCnt, FILE_THS_DAILY_ENTRY_S *pstEntry)
{
    ULONG i;
    FILE_WHOLE_DATA_S stWholeData;
    for (i=0;i<ulEntryCnt;i++) {
        if (ulDate == pstEntry->ulDate) break;
        pstEntry++;
    }
    if (i==ulEntryCnt) {
        printf("date %ld not found\n", ulDate);
        return;
    }
    memset(&stWholeData, 0 ,sizeof(stWholeData));
    FILE_ThsDayToCustom(pstEntry, &stWholeData);
    PrintSingleDay(&stWholeData);
    return;
}

canonical_original_code:
void ShowThsDaily(unsigned long ulDate, unsigned long ulEntryCnt, struct tagFileDailyData *pstEntry)
{
    unsigned long i;
    struct tagWholeData stWholeData;
    for (i=0;i<ulEntryCnt;i++) {
        if (ulDate == pstEntry->ulDate) break;
        pstEntry++;
    }
    if (i==ulEntryCnt) {
        printf("date %ld not found\n", ulDate);
        return;
    }
    memset(&stWholeData, 0 ,sizeof(stWholeData));
    FILE_ThsDayToCustom(pstEntry, &stWholeData);
    PrintSingleDay(&stWholeData);
    return;
}

variable_types:
ulDate
unsigned long

variable_types:
ulEntryCnt
unsigned long

variable_types: struct tagFileDailyData { unsigned int ulDate; unsigned int ulBeginWithCheck; unsigned int ulHighWithCheck; unsigned int ulLowWithCheck; unsigned int ulEndWithCheck; unsigned int ulRsv; unsigned int ulVolWithCheck; unsigned char aucRsv[-1]; } *

variable_types: struct tagWholeData { char szComment[16]; unsigned int ulDate; unsigned int ulRsv; struct tagPrice { unsigned int ulBegin; unsigned int ulHigh; unsigned int ulLow; unsigned int ulEnd; unsigned int ulVol; unsigned int ulFlag; } stDailyPrice; struct tagPrice astMin30Price[8]; struct tagFactor { unsigned int ulFlag; float fMulti; float fAdder; } stFactor; unsigned int ulPad; }


decompiled_code:
int __fastcall ShowThsMin30(unsigned __int64 a1, __int64 a2, unsigned int *a3)
{
unsigned int *v4; // rbp
const char *v6; // rdi
unsigned __int64 v7; // rsi
unsigned __int64 v8; // rcx
__int64 v9; // rax
int v11[74]; // [rsp+0h] [rbp-128h] BYREF

v4 = a3;
v6 = "Entry starts at %ld.\n";
v7 = FILE_ThsMin2Date(*a3);
if ( v7 > a1 )
return printf(v6, v7);
v8 = FILE_Date2ThsMin(a1, v7);
if ( !a2 )
{
LABEL_7:
v7 = a1;
v6 = "date %ld not found\n";
return printf(v6, v7);
}
v9 = 0LL;
while ( *v4 <= v8 )
{
++v9;
v4 += 34;
if ( a2 == v9 )
goto LABEL_7;
}
memset(v11, 0, 0x100uLL);
v11[4] = a1;
FILE_ThsMin5ToMin30(v4, v11);
return PrintSingleDay((__int64)v11);
}

canonical_decompiled_code:
int __fastcall func3(unsigned __int64 a1, __int64 a2, unsigned int *a3)
{
unsigned int *v4; // rbp
const char *v6; // rdi
unsigned __int64 v7; // rsi
unsigned __int64 v8; // rcx
__int64 v9; // rax
int v11[74]; // [rsp+0h] [rbp-128h] BYREF

v4 = a3;
v6 = "Entry starts at %ld.\n";
v7 = FILE_ThsMin2Date(*a3);
if ( v7 > a1 )
return printf(v6, v7);
v8 = FILE_Date2ThsMin(a1, v7);
if ( !a2 )
{
LABEL_7:
v7 = a1;
v6 = "date %ld not found\n";
return printf(v6, v7);
}
v9 = 0LL;
while ( *v4 <= v8 )
{
++v9;
v4 += 34;
if ( a2 == v9 )
goto LABEL_7;
}
memset(v11, 0, 0x100uLL);
v11[4] = a1;
FILE_ThsMin5ToMin30(v4, v11);
return func1((__int64)v11);
}

original_code:
VOID ShowThsMin30( ULONG ulDate, ULONG ulEntryCnt, FILE_THS_MIN5_ENTRY_S *pstEntry)
{
    ULONG i;
    FILE_WHOLE_DATA_S stWholeData;
    ULONG ulShowMin;
    ULONG ulStartDate = FILE_ThsMin2Date(pstEntry->ulMin);
    if (ulStartDate > ulDate) {
        printf("Entry starts at %ld.\n", ulStartDate);
        return;
    }
    ulShowMin = FILE_Date2ThsMin(ulDate);
    for (i=0;i<ulEntryCnt;i++,pstEntry++) {
        if (pstEntry->ulMin > ulShowMin) break;
    }
    if (i==ulEntryCnt) {
        printf("date %ld not found\n", ulDate);
        return;
    }
    memset(&stWholeData, 0 ,sizeof(stWholeData));
    stWholeData.ulDate = ulDate;
    FILE_ThsMin5ToMin30(pstEntry, &stWholeData);
    PrintSingleDay(&stWholeData);
    return;
}

canonical_original_code:
void ShowThsMin30(unsigned long ulDate, unsigned long ulEntryCnt, struct tagFile5MinuteData *pstEntry)
{
    unsigned long i;
    struct tagWholeData stWholeData;
    unsigned long ulShowMin;
    unsigned long ulStartDate = FILE_ThsMin2Date(pstEntry->ulMin);
    if (ulStartDate > ulDate) {
        printf("Entry starts at %ld.\n", ulStartDate);
        return;
    }
    ulShowMin = FILE_Date2ThsMin(ulDate);
    for (i=0;i<ulEntryCnt;i++,pstEntry++) {
        if (pstEntry->ulMin > ulShowMin) break;
    }
    if (i==ulEntryCnt) {
        printf("date %ld not found\n", ulDate);
        return;
    }
    memset(&stWholeData, 0 ,sizeof(stWholeData));
    stWholeData.ulDate = ulDate;
    FILE_ThsMin5ToMin30(pstEntry, &stWholeData);
    PrintSingleDay(&stWholeData);
    return;
}

variable_types: struct tagFile5MinuteData { unsigned int ulMin; unsigned int ulBeginWithCheck; unsigned int ulHighWithCheck; unsigned int ulLowWithCheck; unsigned int ulEndWithCheck; unsigned int ulRsv; unsigned int ulVolWithCheck; unsigned char aucRsv[-1]; } *

variable_types:
i
unsigned long

variable_types:
ulShowMin
unsigned long

variable_types:
ulStartDate
unsigned long


ShowQlWeight

decompiled_code:
void ShowQlWeight()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code:
VOID ShowQlWeight( ULONG ulDate, ULONG ulEntryCnt, FILE_QL_WEIGHT_ENTRY_S *pstEntry)
{
    return;
}

canonical_original_code:
void ShowQlWeight(unsigned long ulDate, unsigned long ulEntryCnt, struct tagFileWeight *pstEntry)
{
    return;
}

variable_types: struct tagFileWeight { unsigned int ulQlDate; unsigned int ulGift; unsigned int ulOffer; unsigned int ulOfferPrice; unsigned int ulProfit; unsigned int ulAdd; unsigned int ulTotalStock; unsigned int ulCirStock; unsigned int ulRsv; } *


ShowCustom

decompiled_code:
int __fastcall ShowCustom(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v5; // rdi
int result; // eax

v5 = GetIndexByDate(a1, 0LL, a2, a3);
if ( v5 == 0xFFFFFFFFLL )
result = printf("date %ld not found\n", a1);
else
result = PrintSingleDay(a3 + (v5 << 8));
return result;
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v5; // rdi
int result; // eax

v5 = GetIndexByDate(a1, 0LL, a2, a3);
if ( v5 == 0xFFFFFFFFLL )
result = printf("date %ld not found\n", a1);
else
result = func1(a3 + (v5 << 8));
return result;
}

original_code:
VOID ShowCustom( ULONG ulDate, ULONG ulEntryCnt, FILE_WHOLE_DATA_S *pstEntry)
{
    ULONG ulIndex;
    FILE_WHOLE_DATA_S *pstCurrent;
    ulIndex = GetIndexByDate(ulDate, (0x00), ulEntryCnt, pstEntry);
    if ((0xFFFFFFFF) == ulIndex) {
        printf("date %ld not found\n", ulDate);
        return;
    }
    pstCurrent = pstEntry+ulIndex;
    PrintSingleDay(pstCurrent);
    return;
}

canonical_original_code:
void ShowCustom(unsigned long ulDate, unsigned long ulEntryCnt, struct tagWholeData *pstEntry)
{
    unsigned long ulIndex;
    struct tagWholeData *pstCurrent;
    ulIndex = GetIndexByDate(ulDate, (0x00), ulEntryCnt, pstEntry);
    if ((0xFFFFFFFF) == ulIndex) {
        printf("date %ld not found\n", ulDate);
        return;
    }
    pstCurrent = pstEntry+ulIndex;
    PrintSingleDay(pstCurrent);
    return;
}

variable_types: struct tagWholeData { char szComment[16]; unsigned int ulDate; unsigned int ulRsv; struct tagPrice { unsigned int ulBegin; unsigned int ulHigh; unsigned int ulLow; unsigned int ulEnd; unsigned int ulVol; unsigned int ulFlag; } stDailyPrice; struct tagPrice astMin30Price[8]; struct tagFactor { unsigned int ulFlag; float fMulti; float fAdder; } stFactor; unsigned int ulPad; } *

variable_types:
ulIndex
unsigned long


ShowFileContent

decompiled_code:
void __fastcall ShowFileContent(__int64 a1, unsigned __int64 a2, __int64 a3, unsigned __int64 a4)
{
__int64 v5; // rax
void *ptr; // [rsp+8h] [rbp-20h] BYREF

ptr = 0LL;
v5 = FILE_GetFileData(a1, a3, a4, &ptr);
if ( v5 )
{
if ( a4 != 536903680 )
{
if ( a4 > 0x20008000 )
{
if ( a4 == 4026531840 )
{
ShowCustom(a2, v5, (__int64)ptr);
goto LABEL_7;
}
}
else
{
if ( a4 == 268435461 )
{
ShowThsMin30(a2, v5, (unsigned int *)ptr);
goto LABEL_7;
}
if ( a4 == 268435492 )
{
ShowThsDaily(a2, v5, ptr);
goto LABEL_7;
}
}
_assert_fail("0", "ShowData.c", 0xADu, "ShowFileContent");
}
LABEL_7:
free(ptr);
return;
}
puts("can't get data");
}

canonical_decompiled_code:
void __fastcall func6(__int64 a1, unsigned __int64 a2, __int64 a3, unsigned __int64 a4)
{
__int64 v5; // rax
void *ptr; // [rsp+8h] [rbp-20h] BYREF

ptr = 0LL;
v5 = FILE_GetFileData(a1, a3, a4, &ptr);
if ( v5 )
{
if ( a4 != 536903680 )
{
if ( a4 > 0x20008000 )
{
if ( a4 == 4026531840 )
{
func5(a2, v5, (__int64)ptr);
goto LABEL_7;
}
}
else
{
if ( a4 == 268435461 )
{
func3(a2, v5, (unsigned int *)ptr);
goto LABEL_7;
}
if ( a4 == 268435492 )
{
func2(a2, v5, ptr);
goto LABEL_7;
}
}
_assert_fail("0", "ShowData.c", 0xADu, "ShowFileContent");
}
LABEL_7:
free(ptr);
return;
}
puts("can't get data");
}

original_code:
VOID ShowFileContent( ULONG ulStockCode, ULONG ulDate, CHAR *szDir, ULONG ulFileType)
{
    ULONG ulEntryCnt;
    VOID *pData = ((void *)0);
    ulEntryCnt = FILE_GetFileData(ulStockCode, szDir, ulFileType, &pData);
    if (0 == ulEntryCnt) {
        printf("can't get data\n");
        return;
    }
    switch(ulFileType) {
        case 0x10000024:
            ShowThsDaily(ulDate, ulEntryCnt, pData);
            break;
        case 0x10000005:
            ShowThsMin30(ulDate, ulEntryCnt, pData);
            break;
        case 0x20008000:
            ShowQlWeight(ulDate, ulEntryCnt, pData);
            break;
        case 0xF0000000:
            ShowCustom(ulDate, ulEntryCnt, pData);
            break;
        default:
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "ShowData.c", 173, __extension__ __PRETTY_FUNCTION__); }));
    }
    free(pData);
    return;
}

canonical_original_code:
void ShowFileContent(unsigned long ulStockCode, unsigned long ulDate, char *szDir, unsigned long ulFileType)
{
    unsigned long ulEntryCnt;
    void *pData = ((void *)0);
    ulEntryCnt = FILE_GetFileData(ulStockCode, szDir, ulFileType, &pData);
    if (0 == ulEntryCnt) {
        printf("can't get data\n");
        return;
    }
    switch(ulFileType) {
        case 0x10000024:
            ShowThsDaily(ulDate, ulEntryCnt, pData);
            break;
        case 0x10000005:
            ShowThsMin30(ulDate, ulEntryCnt, pData);
            break;
        case 0x20008000:
            ShowQlWeight(ulDate, ulEntryCnt, pData);
            break;
        case 0xF0000000:
            ShowCustom(ulDate, ulEntryCnt, pData);
            break;
        default:
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "ShowData.c", 173, __extension__ __PRETTY_FUNCTION__); }));
    }
    free(pData);
    return;
}

variable_types:
ulStockCode
unsigned long

variable_types:
szDir
char *

variable_types:
pData
void *


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbp
__int64 v4; // r12
unsigned __int64 v5; // r13

if ( (unsigned int)(argc - 5) > 1 )
{
printf("USAGE: %s path type code date [debug]", *argv);
exit(1);
}
if ( !strcasecmp(argv[argc - 1], "debug") )
g_bIsDebugMode = 1;
v3 = atol(argv[3]);
v4 = atol(argv[4]);
v5 = GetFileType((char *)argv[2]);
DebugOutString("code=%06lu, date=%lu, type=0x%08lx\n", v3, v4, v5);
ShowFileContent(v3, v4, (__int64)argv[1], v5);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbp
__int64 v4; // r12
unsigned __int64 v5; // r13

if ( (unsigned int)(argc - 5) > 1 )
{
printf("USAGE: %s path type code date [debug]", *argv);
exit(1);
}
if ( !strcasecmp(argv[argc - 1], "debug") )
g_bIsDebugMode = 1;
v3 = atol(argv[3]);
v4 = atol(argv[4]);
v5 = func0((char *)argv[2]);
DebugOutString("code=%06lu, date=%lu, type=0x%08lx\n", v3, v4, v5);
func6(v3, v4, (__int64)argv[1], v5);
return 0;
}

original_code:
int main(int argc,char *argv[])
{
    ULONG ulStockCode;
    ULONG ulShowDate;
    ULONG ulFileType;
    if ((argc < 5) || (argc > 6)) {
        printf("USAGE: %s path type code date [debug]", argv[0]);
        exit(1);
    }
    if (0 == strcasecmp(argv[argc-1], "debug"))
        g_bIsDebugMode = (1);
    ulStockCode = (ULONG)atol(argv[3]);
    ulShowDate = (ULONG)atol(argv[4]);
    ulFileType = GetFileType(argv[2]);
    DebugOutString("code=%06lu, date=%lu, type=0x%08lx\n", ulStockCode, ulShowDate, ulFileType);
    ShowFileContent(ulStockCode, ulShowDate, argv[1], ulFileType);
    return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
    unsigned long ulStockCode;
    unsigned long ulShowDate;
    unsigned long ulFileType;
    if ((argc < 5) || (argc > 6)) {
        printf("USAGE: %s path type code date [debug]", argv[0]);
        exit(1);
    }
    if (0 == strcasecmp(argv[argc-1], "debug"))
        g_bIsDebugMode = (1);
    ulStockCode = (unsigned long)atol(argv[3]);
    ulShowDate = (unsigned long)atol(argv[4]);
    ulFileType = GetFileType(argv[2]);
    DebugOutString("code=%06lu, date=%lu, type=0x%08lx\n", ulStockCode, ulShowDate, ulFileType);
    ShowFileContent(ulStockCode, ulShowDate, argv[1], ulFileType);
    return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types:
ulShowDate
unsigned long

return_type: int


decompiled_code:
void SMA_SetParam()
{
;
}

canonical_decompiled_code:
void func1()
{
;
}

original_code:
VOID SMA_SetParam( ULONG ulCnt, FLOAT *afParam)
{
    return;
}

canonical_original_code:
void SMA_SetParam(unsigned long ulCnt, float *afParam)
{
    return;
}

variable_types:
ulCnt
unsigned long

variable_types:
afParam
float *


decompiled_code:
void __fastcall SMA_Statistics(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rax
float v3; // xmm1_4

if ( a1 > 0x1D )
{
v2 = GetMean(15LL, a2, 0xFFFFFFFFLL);
if ( v2 < 0 )
v3 = (float)(v2 & 1 | (unsigned int)((unsigned __int64)v2 >> 1))
+ (float)(v2 & 1 | (unsigned int)((unsigned __int64)v2 >> 1));
else
v3 = (float)(int)v2;
printf(
"%lu,%lu,%f\n",
*(unsigned int *)(a2 + 16),
*(unsigned int *)(a2 + 36),
(float)((float)((float)*(int *)(a2 + 36) / v3) - 1.0));
}
}

canonical_decompiled_code:
void __fastcall func2(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rax
float v3; // xmm1_4

if ( a1 > 0x1D )
{
v2 = GetMean(15LL, a2, 0xFFFFFFFFLL);
if ( v2 < 0 )
v3 = (float)(v2 & 1 | (unsigned int)((unsigned __int64)v2 >> 1))
+ (float)(v2 & 1 | (unsigned int)((unsigned __int64)v2 >> 1));
else
v3 = (float)(int)v2;
printf(
"%lu,%lu,%f\n",
*(unsigned int *)(a2 + 16),
*(unsigned int *)(a2 + 36),
(float)((float)((float)*(int *)(a2 + 36) / v3) - 1.0));
}
}

original_code:
VOID SMA_Statistics( ULONG ulIndex, FILE_WHOLE_DATA_S *pstBuyData)
{
    ULONG ulMa, ulWma;
    FLOAT fRate;
    if (ulIndex < (30)) return;
    ulMa=GetMean((15),pstBuyData,(0xFFFFFFFF));
        printf("%lu,%lu,%f\n",pstBuyData->ulDate, pstBuyData->stDailyPrice.ulEnd, pstBuyData->stDailyPrice.ulEnd/(FLOAT)ulMa-1);
    return;
}

canonical_original_code:
void SMA_Statistics(unsigned long ulIndex, struct tagWholeData *pstBuyData)
{
    unsigned long ulMa; unsigned long ulWma;
    float fRate;
    if (ulIndex < (30)) return;
    ulMa=GetMean((15),pstBuyData,(0xFFFFFFFF));
        printf("%lu,%lu,%f\n",pstBuyData->ulDate, pstBuyData->stDailyPrice.ulEnd, pstBuyData->stDailyPrice.ulEnd/(float)ulMa-1);
    return;
}

variable_types:
ulMa
unsigned long

variable_types:
ulWma
unsigned long

variable_types: fRate float


original_code:
BOOL_T SMA_Choose( ULONG ulIndex, FILE_WHOLE_DATA_S *pstCurrData, CHOOSE_PRE_DEAL_S *pstDealInfo)
{
    ULONG ulPrevMa,ulCurrMa;
    ULONG ulThreshPrice;
    ULONG i;
    FLOAT fPrevVolRatio, fChooseVolRatio;
    FILE_WHOLE_DATA_S *pstTemp=pstCurrData;
    FILE_WHOLE_DATA_S *pstChoose=pstCurrData;
    FILE_WHOLE_DATA_S *pstPrev=pstChoose-1;
    if (ulIndex <= SMA_GetMinIndex()) return (0);
    for (i=(15);i>0;i--,pstTemp--) {
        if (0x88888888==pstTemp->stFactor.ulFlag) return (0);
    }
    fPrevVolRatio=GetVolRatio(pstPrev);
    if ((fPrevVolRatio<1) || (fPrevVolRatio>2)) return (0);
    fChooseVolRatio=GetVolRatio(pstChoose);
    if (fChooseVolRatio>2) return (0);
    ulPrevMa=GetMean((15),pstPrev,(0xFFFFFFFF));
    ulCurrMa=GetMean((15),pstChoose,ulPrevMa);
    if (pstPrev->stDailyPrice.ulBegin > (ulPrevMa*0.99)) return (0);
    if (pstPrev->stDailyPrice.ulEnd < (ulPrevMa*1.01)) return (0);
    if (pstChoose->stDailyPrice.ulLow < ulCurrMa) return (0);
    if (ulCurrMa > (ULONG)(ulPrevMa*(1.000F))) return (0);
    {
        FLOAT fDrop;
        GetTotalRise((30),pstPrev,(0x04UL),&fDrop);
        if (fDrop>(-0.1800F)) return (0);
    }
    ulThreshPrice = (((ulCurrMa) < (ulPrevMa)) ? (ulCurrMa) : (ulPrevMa));
    pstDealInfo->bIsSell = (0);
    pstDealInfo->usDealHour = (14);
    pstDealInfo->usDealMin = (USHORT)RandomUlong(50,60);
    pstDealInfo->bIsHigher = (1);
    pstDealInfo->fThresholdPrice = (((FLOAT)(ulThreshPrice))/(1000));
    return (1);
}

canonical_original_code:
unsigned short SMA_Choose(unsigned long ulIndex, struct tagWholeData *pstCurrData, struct tagPreDealInfo *pstDealInfo)
{
    unsigned long ulPrevMa; unsigned long ulCurrMa;
    unsigned long ulThreshPrice;
    unsigned long i;
    float fPrevVolRatio; float fChooseVolRatio;
    struct tagWholeData *pstTemp = pstCurrData;
    struct tagWholeData *pstChoose = pstCurrData;
    struct tagWholeData *pstPrev = pstChoose-1;
    if (ulIndex <= SMA_GetMinIndex()) return (0);
    for (i=(15);i>0;i--,pstTemp--) {
        if (0x88888888==pstTemp->stFactor.ulFlag) return (0);
    }
    fPrevVolRatio=GetVolRatio(pstPrev);
    if ((fPrevVolRatio<1) || (fPrevVolRatio>2)) return (0);
    fChooseVolRatio=GetVolRatio(pstChoose);
    if (fChooseVolRatio>2) return (0);
    ulPrevMa=GetMean((15),pstPrev,(0xFFFFFFFF));
    ulCurrMa=GetMean((15),pstChoose,ulPrevMa);
    if (pstPrev->stDailyPrice.ulBegin > (ulPrevMa*0.99)) return (0);
    if (pstPrev->stDailyPrice.ulEnd < (ulPrevMa*1.01)) return (0);
    if (pstChoose->stDailyPrice.ulLow < ulCurrMa) return (0);
    if (ulCurrMa > (ULONG)(ulPrevMa*(1.000F))) return (0);
    {
        float fDrop;
        GetTotalRise((30),pstPrev,(0x04UL),&fDrop);
        if (fDrop>(-0.1800F)) return (0);
    }
    ulThreshPrice = (((ulCurrMa) < (ulPrevMa)) ? (ulCurrMa) : (ulPrevMa));
    pstDealInfo->bIsSell = (0);
    pstDealInfo->usDealHour = (14);
    pstDealInfo->usDealMin = (unsigned short)RandomUlong(50,60);
    pstDealInfo->bIsHigher = (1);
    pstDealInfo->fThresholdPrice = (((FLOAT)(ulThreshPrice))/(1000));
    return (1);
}

variable_types: struct tagPreDealInfo { unsigned short bIsSell; unsigned short usDealHour; unsigned short usDealMin; unsigned short bIsHigher; float fThresholdPrice; float fWeight; } *

variable_types:
ulPrevMa
unsigned long

variable_types:
ulCurrMa
unsigned long

variable_types:
ulThreshPrice
unsigned long

variable_types:
i
unsigned long

variable_types: fPrevVolRatio float

variable_types: fChooseVolRatio float

variable_types: fDrop float


decompiled_code:
void SMA_SortWishList()
{
;
}

original_code:
VOID SMA_SortWishList( ULONG ulWishCnt, SIM_STOCK_DATA_S *pstAllData, SIM_WISH_LIST_S *astWishList)
{
    return;
}

canonical_original_code:
void SMA_SortWishList(unsigned long ulWishCnt, struct tagStockData *pstAllData, struct tagWishList *astWishList)
{
    return;
}

variable_types:
ulWishCnt
unsigned long

variable_types: struct tagStockData { unsigned int ulStockCode; unsigned int ulEntryCnt; unsigned short bIsHold; struct tagWholeData { char szComment[16]; unsigned int ulDate; unsigned int ulRsv; struct tagPrice { unsigned int ulBegin; unsigned int ulHigh; unsigned int ulLow; unsigned int ulEnd; unsigned int ulVol; unsigned int ulFlag; } stDailyPrice; struct tagPrice astMin30Price[8]; struct tagFactor { unsigned int ulFlag; float fMulti; float fAdder; } stFactor; unsigned int ulPad; } *pstCurrData; struct tagWholeData *astWholeData; } *

variable_types: struct tagWishList { unsigned int ulCode; unsigned int ulIndex; unsigned int ulWishPrice; float fWeight; } *


decompiled_code:
unsigned __int64 __fastcall SMA_GetGainPrice(__int64 a1, __int64 a2, unsigned __int64 a3)
{
unsigned int v3; // eax
__int64 v4; // rbx
unsigned __int64 v5; // rbp
float v6; // xmm2_4
__int64 v7; // r13
unsigned __int64 i; // r12
float v9; // xmm1_4
float v10; // xmm0_4
float v11; // xmm0_4
unsigned __int64 result; // rax

v3 = *(_DWORD *)(a2 + 8);
if ( *(_DWORD *)(a1 + 16) < v3 )
_assert_fail("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/sma.c", 0x78u, "SMA_GetGainPrice");
v4 = a1;
v5 = 1LL;
if ( *(_DWORD *)(a1 + 16) == v3 )
goto LABEL_5;
do
{
v4 -= 256LL;
++v5;
}
while ( v3 != *(_DWORD *)(v4 + 16) );
v6 = *(float *)&LC8;
if ( v5 )
{
LABEL_5:
v7 = 0LL;
a3 = 0xFFFFFFFFLL;
for ( i = 0LL; i < v5; ++i )
{
a3 = GetMean(15LL, v4, a3);
v7 += *(unsigned int *)(v4 + 32) < a3;
v4 += 256LL;
}
if ( v7 < 0 )
v9 = (float)(v7 & 1 | (unsigned int)((unsigned __int64)v7 >> 1))
+ (float)(v7 & 1 | (unsigned int)((unsigned __int64)v7 >> 1));
else
v9 = (float)(int)v7;
v6 = 1.2029999 - (float)(v9 * 0.0099999998);
}
if ( (a3 & 0x8000000000000000LL) != 0LL )
v10 = (float)(int)(a3 & 1 | (a3 >> 1)) + (float)(int)(a3 & 1 | (a3 >> 1));
else
v10 = (float)(int)a3;
v11 = v10 * v6;
if ( v11 >= 9.223372e18 )
result = (unsigned int)(int)(float)(v11 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v11;
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func5(__int64 a1, __int64 a2, unsigned __int64 a3)
{
unsigned int v3; // eax
__int64 v4; // rbx
unsigned __int64 v5; // rbp
float v6; // xmm2_4
__int64 v7; // r13
unsigned __int64 i; // r12
float v9; // xmm1_4
float v10; // xmm0_4
float v11; // xmm0_4
unsigned __int64 result; // rax

v3 = *(_DWORD *)(a2 + 8);
if ( *(_DWORD *)(a1 + 16) < v3 )
_assert_fail("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/sma.c", 0x78u, "SMA_GetGainPrice");
v4 = a1;
v5 = 1LL;
if ( *(_DWORD *)(a1 + 16) == v3 )
goto LABEL_5;
do
{
v4 -= 256LL;
++v5;
}
while ( v3 != *(_DWORD *)(v4 + 16) );
v6 = *(float *)&LC8;
if ( v5 )
{
LABEL_5:
v7 = 0LL;
a3 = 0xFFFFFFFFLL;
for ( i = 0LL; i < v5; ++i )
{
a3 = GetMean(15LL, v4, a3);
v7 += *(unsigned int *)(v4 + 32) < a3;
v4 += 256LL;
}
if ( v7 < 0 )
v9 = (float)(v7 & 1 | (unsigned int)((unsigned __int64)v7 >> 1))
+ (float)(v7 & 1 | (unsigned int)((unsigned __int64)v7 >> 1));
else
v9 = (float)(int)v7;
v6 = 1.2029999 - (float)(v9 * 0.0099999998);
}
if ( (a3 & 0x8000000000000000LL) != 0LL )
v10 = (float)(int)(a3 & 1 | (a3 >> 1)) + (float)(int)(a3 & 1 | (a3 >> 1));
else
v10 = (float)(int)a3;
v11 = v10 * v6;
if ( v11 >= 9.223372e18 )
result = (unsigned int)(int)(float)(v11 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v11;
return result;
}

original_code:
ULONG SMA_GetGainPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    ULONG i, ulHoldDays=0;
    ULONG ulPrevMa, ulCurrMa;
    ULONG ulBelowCnt;
    BOOL_T bIsSame=(0);
    FILE_WHOLE_DATA_S *pstData=pstCurrData;
    ((void) sizeof ((pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ? 1 : 0), __extension__ ({ if (pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ; else __assert_fail ("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/sma.c", 120, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstData--;
    }
    for(i=0,ulPrevMa=(0xFFFFFFFF),ulBelowCnt=0;i<ulHoldDays;i++,pstData++) {
        ulCurrMa=GetMean((15),pstData,ulPrevMa);
        if (pstData->stDailyPrice.ulLow < ulCurrMa) {
            ulBelowCnt++;
        }
        ulPrevMa=ulCurrMa;
    }
    return (ULONG)(ulCurrMa * ((1.203F)-(ulBelowCnt*(0.010F))));
}

canonical_original_code:
unsigned long SMA_GetGainPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    unsigned long i; unsigned long ulHoldDays = 0;
    unsigned long ulPrevMa; unsigned long ulCurrMa;
    unsigned long ulBelowCnt;
    unsigned short bIsSame = (0);
    struct tagWholeData *pstData = pstCurrData;
    ((void) sizeof ((pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ? 1 : 0), __extension__ ({ if (pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ; else __assert_fail ("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/sma.c", 120, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstData--;
    }
    for(i=0,ulPrevMa=(0xFFFFFFFF),ulBelowCnt=0;i<ulHoldDays;i++,pstData++) {
        ulCurrMa=GetMean((15),pstData,ulPrevMa);
        if (pstData->stDailyPrice.ulLow < ulCurrMa) {
            ulBelowCnt++;
        }
        ulPrevMa=ulCurrMa;
    }
    return (ULONG)(ulCurrMa * ((1.203F)-(ulBelowCnt*(0.010F))));
}

variable_types: struct tagWholeData { char szComment[16]; unsigned int ulDate; unsigned int ulRsv; struct tagPrice { unsigned int ulBegin; unsigned int ulHigh; unsigned int ulLow; unsigned int ulEnd; unsigned int ulVol; unsigned int ulFlag; } stDailyPrice; struct tagPrice astMin30Price[8]; struct tagFactor { unsigned int ulFlag; float fMulti; float fAdder; } stFactor; unsigned int ulPad; } *

variable_types: struct tagStockCtrl { unsigned int ulGainPrice; unsigned int ulLossPrice; unsigned int ulBuyDate; unsigned int ulBuyPrice; unsigned int ulSellDate; unsigned int ulSellPrice; float fContext; } *

variable_types:
ulHoldDays
unsigned long

variable_types:
ulBelowCnt
unsigned long

variable_types:
bIsSame
unsigned short


decompiled_code:
unsigned __int64 __fastcall SMA_GetLossPrice(_DWORD *a1, __int64 a2, unsigned __int64 a3)
{
unsigned int v3; // eax
_DWORD *v4; // rbx
__int64 i; // r14
unsigned __int64 v6; // rcx
_DWORD *v7; // rax
unsigned __int64 v8; // r13
__int64 v9; // r12
__int64 j; // rbp
float v11; // xmm0_4
float v12; // xmm1_4
float v13; // xmm0_4
float v14; // xmm0_4
unsigned __int64 result; // rax

v3 = *(_DWORD *)(a2 + 8);
if ( a1[4] < v3 )
_assert_fail("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/sma.c", 0x99u, "SMA_GetLossPrice");
v4 = a1;
for ( i = 1LL; v3 != v4[4]; ++i )
v4 -= 64;
v6 = (unsigned int)v4[8];
v7 = v4;
v8 = v6;
while ( 1 )
{
if ( v8 > v6 )
v8 = v6;
v7 -= 64;
if ( v7 == v4 - 960 )
break;
v6 = (unsigned int)v7[8];
}
if ( i )
{
v9 = 0LL;
a3 = 0xFFFFFFFFLL;
for ( j = 0LL; j != i; ++j )
{
a3 = GetMean(15LL, v4, a3);
if ( (unsigned int)v4[6] < a3 )
v9 += (unsigned int)v4[9] < a3;
v4 += 64;
}
if ( v9 < 0 )
v11 = (float)(v9 & 1 | (unsigned int)((unsigned __int64)v9 >> 1))
+ (float)(v9 & 1 | (unsigned int)((unsigned __int64)v9 >> 1));
else
v11 = (float)(int)v9;
v12 = (float)(v11 * 0.02) + 0.88300002;
}
else
{
v12 = *(float *)&LC12;
}
if ( (a3 & 0x8000000000000000LL) != 0LL )
v13 = (float)(int)(a3 & 1 | (a3 >> 1)) + (float)(int)(a3 & 1 | (a3 >> 1));
else
v13 = (float)(int)a3;
v14 = v13 * v12;
if ( v14 >= 9.223372e18 )
{
result = (unsigned int)(int)(float)(v14 - 9.223372e18) ^ 0x8000000000000000LL;
if ( result < v8 )
result = v8;
}
else
{
result = (unsigned int)(int)v14;
if ( result < v8 )
result = v8;
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func6(_DWORD *a1, __int64 a2, unsigned __int64 a3)
{
unsigned int v3; // eax
_DWORD *v4; // rbx
__int64 i; // r14
unsigned __int64 v6; // rcx
_DWORD *v7; // rax
unsigned __int64 v8; // r13
__int64 v9; // r12
__int64 j; // rbp
float v11; // xmm0_4
float v12; // xmm1_4
float v13; // xmm0_4
float v14; // xmm0_4
unsigned __int64 result; // rax

v3 = *(_DWORD *)(a2 + 8);
if ( a1[4] < v3 )
_assert_fail("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/sma.c", 0x99u, "SMA_GetLossPrice");
v4 = a1;
for ( i = 1LL; v3 != v4[4]; ++i )
v4 -= 64;
v6 = (unsigned int)v4[8];
v7 = v4;
v8 = v6;
while ( 1 )
{
if ( v8 > v6 )
v8 = v6;
v7 -= 64;
if ( v7 == v4 - 960 )
break;
v6 = (unsigned int)v7[8];
}
if ( i )
{
v9 = 0LL;
a3 = 0xFFFFFFFFLL;
for ( j = 0LL; j != i; ++j )
{
a3 = GetMean(15LL, v4, a3);
if ( (unsigned int)v4[6] < a3 )
v9 += (unsigned int)v4[9] < a3;
v4 += 64;
}
if ( v9 < 0 )
v11 = (float)(v9 & 1 | (unsigned int)((unsigned __int64)v9 >> 1))
+ (float)(v9 & 1 | (unsigned int)((unsigned __int64)v9 >> 1));
else
v11 = (float)(int)v9;
v12 = (float)(v11 * 0.02) + 0.88300002;
}
else
{
v12 = *(float *)&LC12;
}
if ( (a3 & 0x8000000000000000LL) != 0LL )
v13 = (float)(int)(a3 & 1 | (a3 >> 1)) + (float)(int)(a3 & 1 | (a3 >> 1));
else
v13 = (float)(int)a3;
v14 = v13 * v12;
if ( v14 >= 9.223372e18 )
{
result = (unsigned int)(int)(float)(v14 - 9.223372e18) ^ 0x8000000000000000LL;
if ( result < v8 )
result = v8;
}
else
{
result = (unsigned int)(int)v14;
if ( result < v8 )
result = v8;
}
return result;
}

original_code:
ULONG SMA_GetLossPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    ULONG i, ulHoldDays=0;
    ULONG ulPrevMa, ulCurrMa;
    ULONG ulPrevLow, ulMaDrift;
    ULONG ulBelowCnt;
    BOOL_T bIsSame=(0);
    FILE_WHOLE_DATA_S *pstData=pstCurrData;
    ((void) sizeof ((pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ? 1 : 0), __extension__ ({ if (pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ; else __assert_fail ("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/sma.c", 153, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstData--;
    }
    for (i=(15),ulPrevLow=pstData->stDailyPrice.ulLow;i>0;i--,pstData--) {
        ulPrevLow=(((ulPrevLow) < (pstData->stDailyPrice.ulLow)) ? (ulPrevLow) : (pstData->stDailyPrice.ulLow));
    }
    pstData+=(15);
    for(i=0,ulPrevMa=(0xFFFFFFFF),ulBelowCnt=0;i<ulHoldDays;i++,pstData++) {
        ulCurrMa=GetMean((15),pstData,ulPrevMa);
        if ((pstData->stDailyPrice.ulBegin < ulCurrMa) && (pstData->stDailyPrice.ulEnd < ulCurrMa)) {
            ulBelowCnt++;
        }
        ulPrevMa=ulCurrMa;
    }
    ulMaDrift=(ULONG)(ulCurrMa * ((0.883F)+(ulBelowCnt*(0.020F))));
    return (((ulPrevLow) > (ulMaDrift)) ? (ulPrevLow) : (ulMaDrift));
}

canonical_original_code:
unsigned long SMA_GetLossPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    unsigned long i; unsigned long ulHoldDays = 0;
    unsigned long ulPrevMa; unsigned long ulCurrMa;
    unsigned long ulPrevLow; unsigned long ulMaDrift;
    unsigned long ulBelowCnt;
    unsigned short bIsSame = (0);
    struct tagWholeData *pstData = pstCurrData;
    ((void) sizeof ((pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ? 1 : 0), __extension__ ({ if (pstCurrData->ulDate>=pstStockCtrl->ulBuyDate) ; else __assert_fail ("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/sma.c", 153, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstData--;
    }
    for (i=(15),ulPrevLow=pstData->stDailyPrice.ulLow;i>0;i--,pstData--) {
        ulPrevLow=(((ulPrevLow) < (pstData->stDailyPrice.ulLow)) ? (ulPrevLow) : (pstData->stDailyPrice.ulLow));
    }
    pstData+=(15);
    for(i=0,ulPrevMa=(0xFFFFFFFF),ulBelowCnt=0;i<ulHoldDays;i++,pstData++) {
        ulCurrMa=GetMean((15),pstData,ulPrevMa);
        if ((pstData->stDailyPrice.ulBegin < ulCurrMa) && (pstData->stDailyPrice.ulEnd < ulCurrMa)) {
            ulBelowCnt++;
        }
        ulPrevMa=ulCurrMa;
    }
    ulMaDrift=(ULONG)(ulCurrMa * ((0.883F)+(ulBelowCnt*(0.020F))));
    return (((ulPrevLow) > (ulMaDrift)) ? (ulPrevLow) : (ulMaDrift));
}

variable_types:
ulPrevLow
unsigned long

variable_types:
ulMaDrift
unsigned long


decompiled_code:
__int64 __fastcall SMA_GetBuyPrice(_DWORD *a1, unsigned __int64 a2)
{
__int64 result; // rax
unsigned int v3; // edx
float v4[7]; // [rsp+Ch] [rbp-1Ch] BYREF

GetTotalRise(1LL, a1, 4LL, v4);
result = 0xFFFFFFFFLL;
if ( v4[0] <= 0.098999999 )
{
v3 = a1[9];
if ( a1[6] != v3 || a1[7] != a1[8] )
{
result = v3;
if ( v3 < a2 )
result = 0xFFFFFFFFLL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(_DWORD *a1, unsigned __int64 a2)
{
__int64 result; // rax
unsigned int v3; // edx
float v4[7]; // [rsp+Ch] [rbp-1Ch] BYREF

GetTotalRise(1LL, a1, 4LL, v4);
result = 0xFFFFFFFFLL;
if ( v4[0] <= 0.098999999 )
{
v3 = a1[9];
if ( a1[6] != v3 || a1[7] != a1[8] )
{
result = v3;
if ( v3 < a2 )
result = 0xFFFFFFFFLL;
}
}
return result;
}

original_code:
ULONG SMA_GetBuyPrice( FILE_WHOLE_DATA_S *pstCurrData, ULONG ulWishPrice)
{
    FLOAT fRise;
    (VOID)GetTotalRise(1,pstCurrData,(0x04UL),&fRise);
    if (fRise > (0.099F)) return (0xFFFFFFFF);
    if ((pstCurrData->stDailyPrice.ulBegin == pstCurrData->stDailyPrice.ulEnd) &&
        (pstCurrData->stDailyPrice.ulHigh == pstCurrData->stDailyPrice.ulLow)) return (0xFFFFFFFF);
    if (pstCurrData->stDailyPrice.ulEnd < ulWishPrice) return (0xFFFFFFFF);
    return pstCurrData->stDailyPrice.ulEnd;
}

canonical_original_code:
unsigned long SMA_GetBuyPrice(struct tagWholeData *pstCurrData, unsigned long ulWishPrice)
{
    float fRise;
    (void)GetTotalRise(1,pstCurrData,(0x04UL),&fRise);
    if (fRise > (0.099F)) return (0xFFFFFFFF);
    if ((pstCurrData->stDailyPrice.ulBegin == pstCurrData->stDailyPrice.ulEnd) &&
        (pstCurrData->stDailyPrice.ulHigh == pstCurrData->stDailyPrice.ulLow)) return (0xFFFFFFFF);
    if (pstCurrData->stDailyPrice.ulEnd < ulWishPrice) return (0xFFFFFFFF);
    return pstCurrData->stDailyPrice.ulEnd;
}

variable_types:
ulWishPrice
unsigned long

variable_types: fRise float


decompiled_code:
__int64 SMA_GetSellPrice()
{
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func8()
{
return 0xFFFFFFFFLL;
}

original_code:
ULONG SMA_GetSellPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    return (0xFFFFFFFF);
}

canonical_original_code:
unsigned long SMA_GetSellPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    return (0xFFFFFFFF);
}


DebugOutString

decompiled_code:
int DebugOutString(char *format, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-4D0h] BYREF
char s[1024]; // [rsp+20h] [rbp-4B8h] BYREF

if ( g_bIsDebugMode )
{
va_start(arg, format);
vsprintf(s, format, arg);
result = printf("%s", s);
}
return result;
}

canonical_decompiled_code:
int func0(char *format, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-4D0h] BYREF
char s[1024]; // [rsp+20h] [rbp-4B8h] BYREF

if ( g_bIsDebugMode )
{
va_start(arg, format);
vsprintf(s, format, arg);
result = printf("%s", s);
}
return result;
}

original_code:
VOID DebugOutString( const CHAR *szFmt, ...)
{
    va_list pArg;
    CHAR szBuf[(1024)];
    if ((0) == g_bIsDebugMode)
        return;
    __builtin_va_start(pArg,szFmt);
    vsprintf(szBuf,szFmt,pArg);
    __builtin_va_end(pArg);
    printf("%s", szBuf);
    return;
}

canonical_original_code:
void DebugOutString(char *szFmt, ...)
{
    __builtin_va_list pArg;
    char szBuf[-1];
    if ((0) == g_bIsDebugMode)
        return;
    __builtin_va_start(pArg,szFmt);
    vsprintf(szBuf,szFmt,pArg);
    __builtin_va_end(pArg);
    printf("%s", szBuf);
    return;
}

variable_types:
szFmt
char *

variable_types:
szBuf
char [-1]


GetIndexByDate

decompiled_code:
__int64 __fastcall GetIndexByDate(unsigned __int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4)
{
int v6; // ecx
int v8; // edx
int v9; // eax
unsigned __int64 v10; // r8
unsigned __int64 v11; // rsi
__int64 result; // rax
__int64 v13; // r8

v6 = a3 - 1;
v8 = 0;
do
{
while ( 1 )
{
v9 = (v8 + v6) >> 1;
v10 = v9;
v11 = *(unsigned int *)(a4 + ((__int64)v9 << 8) + 16);
if ( v11 == a1 )
goto LABEL_9;
if ( v11 <= a1 )
break;
v6 = v9 - 1;
if ( v8 > v9 - 1 )
goto LABEL_6;
}
v8 = v9 + 1;
}
while ( v9 + 1 <= v6 );
LABEL_6:
if ( a2 == 16 )
{
v13 = v6;
if ( a3 <= v6 )
v13 = 0xFFFFFFFFLL;
result = v13;
}
else
{
if ( a2 == 17 )
{
v10 = v8;
LABEL_9:
if ( a3 <= v10 )
v10 = 0xFFFFFFFFLL;
return v10;
}
if ( a2 )
_assert_fail("0", "common/util.c", 0x3Cu, "GetIndexByDate");
DebugOutString("%d not in the list\n", a1);
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned __int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4)
{
int v6; // ecx
int v8; // edx
int v9; // eax
unsigned __int64 v10; // r8
unsigned __int64 v11; // rsi
__int64 result; // rax
__int64 v13; // r8

v6 = a3 - 1;
v8 = 0;
do
{
while ( 1 )
{
v9 = (v8 + v6) >> 1;
v10 = v9;
v11 = *(unsigned int *)(a4 + ((__int64)v9 << 8) + 16);
if ( v11 == a1 )
goto LABEL_9;
if ( v11 <= a1 )
break;
v6 = v9 - 1;
if ( v8 > v9 - 1 )
goto LABEL_6;
}
v8 = v9 + 1;
}
while ( v9 + 1 <= v6 );
LABEL_6:
if ( a2 == 16 )
{
v13 = v6;
if ( a3 <= v6 )
v13 = 0xFFFFFFFFLL;
result = v13;
}
else
{
if ( a2 == 17 )
{
v10 = v8;
LABEL_9:
if ( a3 <= v10 )
v10 = 0xFFFFFFFFLL;
return v10;
}
if ( a2 )
_assert_fail("0", "common/util.c", 0x3Cu, "GetIndexByDate");
func0("%d not in the list\n", a1);
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
ULONG GetIndexByDate( ULONG ulDate, ULONG ulFlag, ULONG ulEntryCnt, FILE_WHOLE_DATA_S *pstWholeEntry)
{
    int iBegin, iEnd, iMid;
    FILE_WHOLE_DATA_S *pstMidEntry = pstWholeEntry;
    iBegin=0;
    iEnd=ulEntryCnt-1;
    while (1) {
        iMid=(iBegin+iEnd)>>1;
        pstMidEntry = pstWholeEntry + iMid;
        if (ulDate == pstMidEntry->ulDate) break;
        if (ulDate < pstMidEntry->ulDate) {
            iEnd = iMid-1;
        }
        else {
            iBegin = iMid+1;
        }
        if (iBegin>iEnd) {
            switch (ulFlag) {
                case (0x00):
                    DebugOutString("%d not in the list\n",ulDate);
                    iMid = (0xFFFFFFFF);
                    break;
                case (0x10):
                    iMid = iEnd;
                    break;
                case (0x11):
                    iMid = iBegin;
                    break;
                default:
                    ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/util.c", 60, __extension__ __PRETTY_FUNCTION__); }));
                    return (0xFFFFFFFF);
            }
            break;
        }
    }
    return ((ULONG)iMid >= ulEntryCnt) ? (0xFFFFFFFF) : (ULONG)iMid;
}

canonical_original_code:
unsigned long GetIndexByDate(unsigned long ulDate, unsigned long ulFlag, unsigned long ulEntryCnt, struct tagWholeData *pstWholeEntry)
{
    int iBegin; int iEnd; int iMid;
    struct tagWholeData *pstMidEntry = pstWholeEntry;
    iBegin=0;
    iEnd=ulEntryCnt-1;
    while (1) {
        iMid=(iBegin+iEnd)>>1;
        pstMidEntry = pstWholeEntry + iMid;
        if (ulDate == pstMidEntry->ulDate) break;
        if (ulDate < pstMidEntry->ulDate) {
            iEnd = iMid-1;
        }
        else {
            iBegin = iMid+1;
        }
        if (iBegin>iEnd) {
            switch (ulFlag) {
                case (0x00):
                    DebugOutString("%d not in the list\n",ulDate);
                    iMid = (0xFFFFFFFF);
                    break;
                case (0x10):
                    iMid = iEnd;
                    break;
                case (0x11):
                    iMid = iBegin;
                    break;
                default:
                    ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/util.c", 60, __extension__ __PRETTY_FUNCTION__); }));
                    return (0xFFFFFFFF);
            }
            break;
        }
    }
    return ((unsigned long)iMid >= ulEntryCnt) ? (0xFFFFFFFF) : (unsigned long)iMid;
}

variable_types:
ulDate
unsigned long

variable_types:
ulFlag
unsigned long

variable_types:
ulEntryCnt
unsigned long

variable_types: iBegin int

variable_types: iEnd int

variable_types: iMid int


original_code:
ULONG GetDayto1904( ULONG ulDate)
{
    ULONG ulYear, ulMon, ulDay;
    ULONG ulYearCnt, ulMonCnt, ulDayCnt, i;
    CHAR aucDaysofMon[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
                           31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
                           31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
                           31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    ((void) sizeof ((ulDate > 19040101) ? 1 : 0), __extension__ ({ if (ulDate > 19040101) ; else __assert_fail ("ulDate > 19040101", "common/util.c", 81, __extension__ __PRETTY_FUNCTION__); }));
    { (ulYear) = (ulDate) / 10000; (ulDate) -= (ulYear) * 10000; (ulMon) = (ulDate) / 100; (ulDate) -= (ulMon) * 100; (ulDay) = (ulDate); };
    ulDayCnt = 0;
    ulYearCnt = ulYear - 1904;
    ulDayCnt += (ulYearCnt/4)*(365*4+1);
    ulMonCnt = (ulYearCnt%4)*12 + ulMon - 1;
    ((void) sizeof ((ulMonCnt < 48) ? 1 : 0), __extension__ ({ if (ulMonCnt < 48) ; else __assert_fail ("ulMonCnt < 48", "common/util.c", 89, __extension__ __PRETTY_FUNCTION__); }));
    for(i=0; i < ulMonCnt; i++)
        ulDayCnt += aucDaysofMon[i];
    ulDayCnt += ulDay - 1;
    return ulDayCnt;
}

canonical_original_code:
unsigned long GetDayto1904(unsigned long ulDate)
{
    unsigned long ulYear; unsigned long ulMon; unsigned long ulDay;
    unsigned long ulYearCnt; unsigned long ulMonCnt; unsigned long ulDayCnt; unsigned long i;
    char aucDaysofMon[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
                           31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
                           31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
                           31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    ((void) sizeof ((ulDate > 19040101) ? 1 : 0), __extension__ ({ if (ulDate > 19040101) ; else __assert_fail ("ulDate > 19040101", "common/util.c", 81, __extension__ __PRETTY_FUNCTION__); }));
    { (ulYear) = (ulDate) / 10000; (ulDate) -= (ulYear) * 10000; (ulMon) = (ulDate) / 100; (ulDate) -= (ulMon) * 100; (ulDay) = (ulDate); };
    ulDayCnt = 0;
    ulYearCnt = ulYear - 1904;
    ulDayCnt += (ulYearCnt/4)*(365*4+1);
    ulMonCnt = (ulYearCnt%4)*12 + ulMon - 1;
    ((void) sizeof ((ulMonCnt < 48) ? 1 : 0), __extension__ ({ if (ulMonCnt < 48) ; else __assert_fail ("ulMonCnt < 48", "common/util.c", 89, __extension__ __PRETTY_FUNCTION__); }));
    for(i=0; i < ulMonCnt; i++)
        ulDayCnt += aucDaysofMon[i];
    ulDayCnt += ulDay - 1;
    return ulDayCnt;
}

variable_types:
ulYear
unsigned long

variable_types:
ulMon
unsigned long

variable_types:
ulDay
unsigned long

variable_types:
ulYearCnt
unsigned long

variable_types:
ulMonCnt
unsigned long

variable_types:
ulDayCnt
unsigned long

variable_types:
i
unsigned long

variable_types:
aucDaysofMon
char []


GetWeekDay

original_code:
ULONG GetWeekDay( ULONG ulDate)
{
    return ((GetDayto1904(ulDate)+4)%7)+1;
}

canonical_original_code:
unsigned long GetWeekDay(unsigned long ulDate)
{
    return ((GetDayto1904(ulDate)+4)%7)+1;
}


GetDateInterval

decompiled_code:
__int64 __fastcall GetDateInterval(unsigned __int64 a1, unsigned __int64 a2)
{
__int64 v2; // rbx

if ( a1 >= a2 )
_assert_fail("ulStartDate < ulEndDate", "common/util.c", 0x69u, "GetDateInterval");
v2 = GetDayto1904(a2);
return v2 - GetDayto1904(a1);
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned __int64 a1, unsigned __int64 a2)
{
__int64 v2; // rbx

if ( a1 >= a2 )
_assert_fail("ulStartDate < ulEndDate", "common/util.c", 0x69u, "GetDateInterval");
v2 = func2(a2);
return v2 - func2(a1);
}

original_code:
ULONG GetDateInterval( ULONG ulStartDate, ULONG ulEndDate)
{
    ((void) sizeof ((ulStartDate < ulEndDate) ? 1 : 0), __extension__ ({ if (ulStartDate < ulEndDate) ; else __assert_fail ("ulStartDate < ulEndDate", "common/util.c", 105, __extension__ __PRETTY_FUNCTION__); }));
    return GetDayto1904(ulEndDate) - GetDayto1904(ulStartDate);
}

canonical_original_code:
unsigned long GetDateInterval(unsigned long ulStartDate, unsigned long ulEndDate)
{
    ((void) sizeof ((ulStartDate < ulEndDate) ? 1 : 0), __extension__ ({ if (ulStartDate < ulEndDate) ; else __assert_fail ("ulStartDate < ulEndDate", "common/util.c", 105, __extension__ __PRETTY_FUNCTION__); }));
    return GetDayto1904(ulEndDate) - GetDayto1904(ulStartDate);
}

variable_types:
ulStartDate
unsigned long

variable_types:
ulEndDate
unsigned long


IsVaildDate

original_code:
BOOL_T IsVaildDate( ULONG ulDate)
{
    ULONG ulYear, ulMon, ulDay;
    ULONG ulCheckDate=ulDate;
    ULONG ulDateEachMon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    { (ulYear) = (ulCheckDate) / 10000; (ulCheckDate) -= (ulYear) * 10000; (ulMon) = (ulCheckDate) / 100; (ulCheckDate) -= (ulMon) * 100; (ulDay) = (ulCheckDate); };
    if ((ulYear < 1990) || (ulYear > 2050)) return (0);
    if ((ulMon < 1) || (ulMon > 12)) return (0);
    if ((2==ulMon) && (29==ulDay) && (0==(ulYear&0x03))) return (1);
    if ((ulDay < 1) || (ulDay > ulDateEachMon[ulMon])) return (0);
    return (1);
}

canonical_original_code:
unsigned short IsVaildDate(unsigned long ulDate)
{
    unsigned long ulYear; unsigned long ulMon; unsigned long ulDay;
    unsigned long ulCheckDate = ulDate;
    unsigned long ulDateEachMon[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
    { (ulYear) = (ulCheckDate) / 10000; (ulCheckDate) -= (ulYear) * 10000; (ulMon) = (ulCheckDate) / 100; (ulCheckDate) -= (ulMon) * 100; (ulDay) = (ulCheckDate); };
    if ((ulYear < 1990) || (ulYear > 2050)) return (0);
    if ((ulMon < 1) || (ulMon > 12)) return (0);
    if ((2==ulMon) && (29==ulDay) && (0==(ulYear&0x03))) return (1);
    if ((ulDay < 1) || (ulDay > ulDateEachMon[ulMon])) return (0);
    return (1);
}

variable_types:
ulCheckDate
unsigned long

variable_types:
ulDateEachMon
unsigned long [13]


RandomUlong

decompiled_code:
unsigned __int64 __fastcall RandomUlong(unsigned __int64 a1, unsigned __int64 a2)
{
if ( a1 == a2 )
return a1;
if ( a1 >= a2 )
_assert_fail("ulMax > ulMin", "common/util.c", 0x89u, "RandomUlong");
return rand() % (a2 - a1) + a1;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func7(unsigned __int64 a1, unsigned __int64 a2)
{
if ( a1 == a2 )
return a1;
if ( a1 >= a2 )
_assert_fail("ulMax > ulMin", "common/util.c", 0x89u, "RandomUlong");
return rand() % (a2 - a1) + a1;
}

original_code:
ULONG RandomUlong( ULONG ulMin, ULONG ulMax)
{
    if (ulMin == ulMax) return ulMin;
    ((void) sizeof ((ulMax > ulMin) ? 1 : 0), __extension__ ({ if (ulMax > ulMin) ; else __assert_fail ("ulMax > ulMin", "common/util.c", 137, __extension__ __PRETTY_FUNCTION__); }));
    return (rand() % (ulMax - ulMin)) + ulMin;
}

canonical_original_code:
unsigned long RandomUlong(unsigned long ulMin, unsigned long ulMax)
{
    if (ulMin == ulMax) return ulMin;
    ((void) sizeof ((ulMax > ulMin) ? 1 : 0), __extension__ ({ if (ulMax > ulMin) ; else __assert_fail ("ulMax > ulMin", "common/util.c", 137, __extension__ __PRETTY_FUNCTION__); }));
    return (rand() % (ulMax - ulMin)) + ulMin;
}

variable_types:
ulMin
unsigned long

variable_types:
ulMax
unsigned long


RandomFloat

decompiled_code:
float __fastcall RandomFloat(float a1, float a2)
{
float v2; // xmm2_4

if ( a2 < a1 )
_assert_fail("fMax >= fMin", "common/util.c", 0x90u, "RandomFloat");
v2 = (double)rand() / 2147483647.0;
return (float)(v2 * (float)(a2 - a1)) + a1;
}

canonical_decompiled_code:
float __fastcall func8(float a1, float a2)
{
float v2; // xmm2_4

if ( a2 < a1 )
_assert_fail("fMax >= fMin", "common/util.c", 0x90u, "RandomFloat");
v2 = (double)rand() / 2147483647.0;
return (float)(v2 * (float)(a2 - a1)) + a1;
}

original_code:
FLOAT RandomFloat( FLOAT fMin, FLOAT fMax)
{
    ((void) sizeof ((fMax >= fMin) ? 1 : 0), __extension__ ({ if (fMax >= fMin) ; else __assert_fail ("fMax >= fMin", "common/util.c", 144, __extension__ __PRETTY_FUNCTION__); }));
    return (FLOAT)(rand()/(double)(2147483647))*(fMax-fMin)+fMin;
}

canonical_original_code:
float RandomFloat(float fMin, float fMax)
{
    ((void) sizeof ((fMax >= fMin) ? 1 : 0), __extension__ ({ if (fMax >= fMin) ; else __assert_fail ("fMax >= fMin", "common/util.c", 144, __extension__ __PRETTY_FUNCTION__); }));
    return (FLOAT)(rand()/(double)(2147483647))*(fMax-fMin)+fMin;
}

variable_types: fMin float

variable_types: fMax float

return_type: float


decompiled_code:
int LIB_Sprintf(char *a1, __int64 a2, const char *a3, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a3);
return vsprintf(a1, a3, arg);
}

canonical_decompiled_code:
int func10(char *a1, __int64 a2, const char *a3, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a3);
return vsprintf(a1, a3, arg);
}

original_code:
int LIB_Sprintf( CHAR *szBuf, int sizeOfBuffer, const char *szFmt, ... )
{
    int StrSize;
    va_list pArg;
    __builtin_va_start(pArg,szFmt);
    StrSize = vsprintf(szBuf, szFmt, pArg);
    __builtin_va_end(pArg);
    return StrSize;
}

canonical_original_code:
int LIB_Sprintf(char *szBuf, int sizeOfBuffer, char *szFmt, ...)
{
    int StrSize;
    __builtin_va_list pArg;
    __builtin_va_start(pArg,szFmt);
    StrSize = vsprintf(szBuf, szFmt, pArg);
    __builtin_va_end(pArg);
    return StrSize;
}

variable_types:
szBuf
char *

variable_types: sizeOfBuffer int

variable_types:
szFmt
char *

variable_types: StrSize int


decompiled_code:
__int64 __fastcall FILE_GetFileName(unsigned __int64 a1, const char *a2, unsigned __int64 a3, _BYTE *a4)
{
const char *v4; // r8
__int64 v6; // [rsp-10h] [rbp-18h]

v4 = "sznse";
if ( a1 >= 0x927C0 )
v4 = "shase";
if ( !a2 )
_assert_fail("NULL != szFileDir", "common/file.c", 0xDu, "FILE_GetFileName");
if ( !a4 )
_assert_fail("NULL != szFileName", "common/file.c", 0xEu, "FILE_GetFileName");
*a4 = 0;
if ( a3 != 536903680 )
{
if ( a3 > 0x20008000 )
{
if ( a3 == 4026531840 )
return LIB_Sprintf(a4, 256LL, "%s/%06lu.all", a2, a1);
}
else
{
if ( a3 == 268435461 )
{
LIB_Sprintf(a4, 256LL, "%s/%s/%s/%06lu.%s", a2, v4, "min5", a1, "mn5");
return v6;
}
if ( a3 == 268435492 )
{
LIB_Sprintf(a4, 256LL, "%s/%s/%s/%06lu.%s", a2, v4, "day", a1, "day");
return v6;
}
}
_assert_fail("0", "common/file.c", 0x1Fu, "FILE_GetFileName");
}
return LIB_Sprintf(a4, 256LL, "%s/%s/weight/%06lu.wgt", a2, v4, a1);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int64 a1, const char *a2, unsigned __int64 a3, _BYTE *a4)
{
const char *v4; // r8
__int64 v6; // [rsp-10h] [rbp-18h]

v4 = "sznse";
if ( a1 >= 0x927C0 )
v4 = "shase";
if ( !a2 )
_assert_fail("NULL != szFileDir", "common/file.c", 0xDu, "FILE_GetFileName");
if ( !a4 )
_assert_fail("NULL != szFileName", "common/file.c", 0xEu, "FILE_GetFileName");
*a4 = 0;
if ( a3 != 536903680 )
{
if ( a3 > 0x20008000 )
{
if ( a3 == 4026531840 )
return LIB_Sprintf(a4, 256LL, "%s/%06lu.all", a2, a1);
}
else
{
if ( a3 == 268435461 )
{
LIB_Sprintf(a4, 256LL, "%s/%s/%s/%06lu.%s", a2, v4, "min5", a1, "mn5");
return v6;
}
if ( a3 == 268435492 )
{
LIB_Sprintf(a4, 256LL, "%s/%s/%s/%06lu.%s", a2, v4, "day", a1, "day");
return v6;
}
}
_assert_fail("0", "common/file.c", 0x1Fu, "FILE_GetFileName");
}
return LIB_Sprintf(a4, 256LL, "%s/%s/weight/%06lu.wgt", a2, v4, a1);
}

original_code:
VOID FILE_GetFileName( ULONG ulStockCode, const CHAR* szFileDir, ULONG ulFlag, CHAR* szFileName)
{
    CHAR *pcDir = ((ulStockCode) < 600000) ? "sznse" : "shase";
    ((void) sizeof ((((void *)0) != szFileDir) ? 1 : 0), __extension__ ({ if (((void *)0) != szFileDir) ; else __assert_fail ("NULL != szFileDir", "common/file.c", 13, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((((void *)0) != szFileName) ? 1 : 0), __extension__ ({ if (((void *)0) != szFileName) ; else __assert_fail ("NULL != szFileName", "common/file.c", 14, __extension__ __PRETTY_FUNCTION__); }));
    szFileName[0] = 0;
    switch (ulFlag) {
        case 0x10000005:
            LIB_Sprintf(szFileName, 256, "%s/%s/%s/%06lu.%s", szFileDir, pcDir, "min5", ulStockCode, "mn5");
            break;
        case 0x10000024:
            LIB_Sprintf(szFileName, 256, "%s/%s/%s/%06lu.%s", szFileDir, pcDir, "day", ulStockCode, "day");
            break;
        case 0x20008000:
            LIB_Sprintf(szFileName, 256, "%s/%s/weight/%06lu.wgt", szFileDir, pcDir, ulStockCode);
            break;
        case 0xF0000000:
            LIB_Sprintf(szFileName, 256, "%s/%06lu.all", szFileDir, ulStockCode);
            break;
        default:
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/file.c", 31, __extension__ __PRETTY_FUNCTION__); }));
            return;
    }
    return;
}

canonical_original_code:
void FILE_GetFileName(unsigned long ulStockCode, char *szFileDir, unsigned long ulFlag, char *szFileName)
{
    char *pcDir = ((ulStockCode) < 600000) ? "sznse" : "shase";
    ((void) sizeof ((((void *)0) != szFileDir) ? 1 : 0), __extension__ ({ if (((void *)0) != szFileDir) ; else __assert_fail ("NULL != szFileDir", "common/file.c", 13, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((((void *)0) != szFileName) ? 1 : 0), __extension__ ({ if (((void *)0) != szFileName) ; else __assert_fail ("NULL != szFileName", "common/file.c", 14, __extension__ __PRETTY_FUNCTION__); }));
    szFileName[0] = 0;
    switch (ulFlag) {
        case 0x10000005:
            LIB_Sprintf(szFileName, 256, "%s/%s/%s/%06lu.%s", szFileDir, pcDir, "min5", ulStockCode, "mn5");
            break;
        case 0x10000024:
            LIB_Sprintf(szFileName, 256, "%s/%s/%s/%06lu.%s", szFileDir, pcDir, "day", ulStockCode, "day");
            break;
        case 0x20008000:
            LIB_Sprintf(szFileName, 256, "%s/%s/weight/%06lu.wgt", szFileDir, pcDir, ulStockCode);
            break;
        case 0xF0000000:
            LIB_Sprintf(szFileName, 256, "%s/%06lu.all", szFileDir, ulStockCode);
            break;
        default:
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/file.c", 31, __extension__ __PRETTY_FUNCTION__); }));
            return;
    }
    return;
}

variable_types:
ulStockCode
unsigned long

variable_types:
szFileDir
char *

variable_types:
ulFlag
unsigned long

variable_types:
szFileName
char *

variable_types:
pcDir
char *


decompiled_code:
__int64 __fastcall FILE_GetEntrySize(unsigned __int64 a1)
{
__int64 result; // rax

if ( a1 == 536903680 )
return 36LL;
if ( a1 > 0x20008000 )
{
if ( a1 != 4026531840 )
goto LABEL_10;
result = 256LL;
}
else
{
if ( a1 != 268435461 )
{
if ( a1 == 268435492 )
return 168LL;
LABEL_10:
_assert_fail("0", "common/file.c", 0x4Au, "FILE_GetEntrySize");
}
result = 136LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int64 a1)
{
__int64 result; // rax

if ( a1 == 536903680 )
return 36LL;
if ( a1 > 0x20008000 )
{
if ( a1 != 4026531840 )
goto LABEL_10;
result = 256LL;
}
else
{
if ( a1 != 268435461 )
{
if ( a1 == 268435492 )
return 168LL;
LABEL_10:
_assert_fail("0", "common/file.c", 0x4Au, "FILE_GetEntrySize");
}
result = 136LL;
}
return result;
}

original_code:
ULONG FILE_GetEntrySize( ULONG ulFileType)
{
    ULONG ulEntrySize;
    switch (ulFileType) {
        case 0x10000005:
            ulEntrySize = sizeof(FILE_THS_MIN5_ENTRY_S);
            break;
        case 0x10000024:
            ulEntrySize = sizeof(FILE_THS_DAILY_ENTRY_S);
            break;
        case 0x20008000:
            ulEntrySize = sizeof(FILE_QL_WEIGHT_ENTRY_S);
            break;
        case 0xF0000000:
            ulEntrySize = sizeof(FILE_WHOLE_DATA_S);
            break;
        default:
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/file.c", 74, __extension__ __PRETTY_FUNCTION__); }));
            return 0;
    }
    return ulEntrySize;
}

canonical_original_code:
unsigned long FILE_GetEntrySize(unsigned long ulFileType)
{
    unsigned long ulEntrySize;
    switch (ulFileType) {
        case 0x10000005:
            ulEntrySize = sizeof(FILE_THS_MIN5_ENTRY_S);
            break;
        case 0x10000024:
            ulEntrySize = sizeof(FILE_THS_DAILY_ENTRY_S);
            break;
        case 0x20008000:
            ulEntrySize = sizeof(FILE_QL_WEIGHT_ENTRY_S);
            break;
        case 0xF0000000:
            ulEntrySize = sizeof(FILE_WHOLE_DATA_S);
            break;
        default:
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/file.c", 74, __extension__ __PRETTY_FUNCTION__); }));
            return 0;
    }
    return ulEntrySize;
}

variable_types:
ulFileType
unsigned long

variable_types:
ulEntrySize
unsigned long


decompiled_code:
__int64 __fastcall FILE_GetFileHead(unsigned __int64 a1)
{
if ( a1 == 268435492 )
return 184LL;
if ( a1 > 0x10000024 )
{
if ( a1 == 536903680 || a1 == 4026531840 )
return 0LL;
LABEL_9:
_assert_fail("0", "common/file.c", 0x61u, "FILE_GetFileHead");
}
if ( a1 != 268435461 )
goto LABEL_9;
return 152LL;
}

original_code:
ULONG FILE_GetFileHead( ULONG ulFlag)
{
    ULONG ulFileHead;
    switch (ulFlag) {
        case 0x10000005:
            ulFileHead = (0x98);
            break;
        case 0x10000024:
            ulFileHead = (0xB8);
            break;
        case 0x20008000:
        case 0xF0000000:
            ulFileHead = 0;
            break;
        default:
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/file.c", 97, __extension__ __PRETTY_FUNCTION__); }));
            return 0;
    }
    return ulFileHead;
}

canonical_original_code:
unsigned long FILE_GetFileHead(unsigned long ulFlag)
{
    unsigned long ulFileHead;
    switch (ulFlag) {
        case 0x10000005:
            ulFileHead = (0x98);
            break;
        case 0x10000024:
            ulFileHead = (0xB8);
            break;
        case 0x20008000:
        case 0xF0000000:
            ulFileHead = 0;
            break;
        default:
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/file.c", 97, __extension__ __PRETTY_FUNCTION__); }));
            return 0;
    }
    return ulFileHead;
}

variable_types:
ulFileHead
unsigned long


decompiled_code:
unsigned __int64 __fastcall FILE_GetVol(int a1)
{
unsigned __int64 v1; // rsi
unsigned __int64 result; // rax

v1 = a1 & 0xF0000000;
result = a1 & 0xFFFFFFF;
if ( v1 == 2415919104 )
{
result /= 0x3E8uLL;
}
else if ( v1 > 0x90000000 )
{
if ( v1 == 2684354560 )
{
result /= 0x2710uLL;
}
else
{
if ( v1 != 2952790016 )
goto LABEL_13;
result /= 0x186A0uLL;
}
}
else
{
if ( v1 != 0x10000000 )
{
if ( v1 == 0x20000000 )
return result;
if ( (a1 & 0xF0000000) == 0 )
{
result /= 0x64uLL;
return result;
}
LABEL_13:
printf("multi=0x%lx", v1);
_assert_fail("0", "common/file.c", 0xCAu, "FILE_GetVol");
}
result /= 0xAuLL;
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func6(int a1)
{
unsigned __int64 v1; // rsi
unsigned __int64 result; // rax

v1 = a1 & 0xF0000000;
result = a1 & 0xFFFFFFF;
if ( v1 == 2415919104 )
{
result /= 0x3E8uLL;
}
else if ( v1 > 0x90000000 )
{
if ( v1 == 2684354560 )
{
result /= 0x2710uLL;
}
else
{
if ( v1 != 2952790016 )
goto LABEL_13;
result /= 0x186A0uLL;
}
}
else
{
if ( v1 != 0x10000000 )
{
if ( v1 == 0x20000000 )
return result;
if ( (a1 & 0xF0000000) == 0 )
{
result /= 0x64uLL;
return result;
}
LABEL_13:
printf("multi=0x%lx", v1);
_assert_fail("0", "common/file.c", 0xCAu, "FILE_GetVol");
}
result /= 0xAuLL;
}
return result;
}

original_code:
ULONG FILE_GetVol( ULONG ulFileVol)
{
    ULONG ulMulti = ulFileVol & 0xF0000000;
    ULONG ulValue = ulFileVol & 0x0FFFFFFF;
    switch (ulMulti)
    {
        case 0x10000000:
            ulMulti = 10;
            break;
        case 0x00000000:
            ulMulti = 100;
            break;
        case 0x90000000:
            ulMulti = 1000;
            break;
        case 0xA0000000:
            ulMulti = 10000;
            break;
        case 0xB0000000:
            ulMulti = 100000;
            break;
        case 0x20000000:
            ulMulti = 1;
            break;
        default:
            printf("multi=0x%lx", ulMulti);
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/file.c", 202, __extension__ __PRETTY_FUNCTION__); }));
    }
    return (ulValue / ulMulti);
}

canonical_original_code:
unsigned long FILE_GetVol(unsigned long ulFileVol)
{
    unsigned long ulMulti = ulFileVol & 0xF0000000;
    unsigned long ulValue = ulFileVol & 0x0FFFFFFF;
    switch (ulMulti)
    {
        case 0x10000000:
            ulMulti = 10;
            break;
        case 0x00000000:
            ulMulti = 100;
            break;
        case 0x90000000:
            ulMulti = 1000;
            break;
        case 0xA0000000:
            ulMulti = 10000;
            break;
        case 0xB0000000:
            ulMulti = 100000;
            break;
        case 0x20000000:
            ulMulti = 1;
            break;
        default:
            printf("multi=0x%lx", ulMulti);
            ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("0", "common/file.c", 202, __extension__ __PRETTY_FUNCTION__); }));
    }
    return (ulValue / ulMulti);
}

variable_types:
ulFileVol
unsigned long

variable_types:
ulMulti
unsigned long

variable_types:
ulValue
unsigned long


decompiled_code:
__int64 __fastcall FILE_ThsMin2Date(unsigned __int64 a1)
{
return ((unsigned __int16)a1 >> 11) + 100 * ((a1 >> 16) & 0xF) + 10000 * (((unsigned int)a1 >> 20) + 1900LL);
}

original_code:
ULONG FILE_ThsMin2Date( ULONG ulMin)
{
    ULONG ulYear, ulMon, ulDate;
    ulYear = ((ulMin & 0xFFF00000) >> 20) + 1900;
    ulMon = (ulMin & 0x000F0000) >> 16;
    ulDate = (ulMin & 0x0000FF00) >> 11;
    return (ulYear * 10000 + ulMon * 100 + ulDate);
}

canonical_original_code:
unsigned long FILE_ThsMin2Date(unsigned long ulMin)
{
    unsigned long ulYear; unsigned long ulMon; unsigned long ulDate;
    ulYear = ((ulMin & 0xFFF00000) >> 20) + 1900;
    ulMon = (ulMin & 0x000F0000) >> 16;
    ulDate = (ulMin & 0x0000FF00) >> 11;
    return (ulYear * 10000 + ulMon * 100 + ulDate);
}

variable_types:
ulMin
unsigned long

variable_types:
ulYear
unsigned long

variable_types:
ulMon
unsigned long

variable_types:
ulDate
unsigned long


original_code:
ULONG FILE_Date2ThsMin( ULONG ulDate)
{
    ULONG ulYear, ulMon, ulDay;
    { (ulYear) = (ulDate) / 10000; (ulDate) -= (ulYear) * 10000; (ulMon) = (ulDate) / 100; (ulDate) -= (ulMon) * 100; (ulDay) = (ulDate); };
    ((void) sizeof ((ulYear>1900) ? 1 : 0), __extension__ ({ if (ulYear>1900) ; else __assert_fail ("ulYear>1900", "common/file.c", 223, __extension__ __PRETTY_FUNCTION__); }));
    return ((ulYear-1900)<<20) | (ulMon << 16) | (ulDay << 11);
}

canonical_original_code:
unsigned long FILE_Date2ThsMin(unsigned long ulDate)
{
    unsigned long ulYear; unsigned long ulMon; unsigned long ulDay;
    { (ulYear) = (ulDate) / 10000; (ulDate) -= (ulYear) * 10000; (ulMon) = (ulDate) / 100; (ulDate) -= (ulMon) * 100; (ulDay) = (ulDate); };
    ((void) sizeof ((ulYear>1900) ? 1 : 0), __extension__ ({ if (ulYear>1900) ; else __assert_fail ("ulYear>1900", "common/file.c", 223, __extension__ __PRETTY_FUNCTION__); }));
    return ((ulYear-1900)<<20) | (ulMon << 16) | (ulDay << 11);
}

variable_types:
ulDay
unsigned long