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

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

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

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

variable_types:
ulMaDrift
unsigned long


repo: gitslime/StockAnalyser

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

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; }

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 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);
}

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


DebugOutString

decompiled_code:
int DebugOutString(char *format, ...)
{
int result; // eax
char v2[1032]; // [rsp+0h] [rbp-4D8h] BYREF
gcc_va_list arg; // [rsp+408h] [rbp-D0h] BYREF

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

canonical_decompiled_code:
int func0(char *format, ...)
{
int result; // eax
char v2[1032]; // [rsp+0h] [rbp-4D8h] BYREF
gcc_va_list arg; // [rsp+408h] [rbp-D0h] BYREF

if ( g_bIsDebugMode )
{
va_start(arg, format);
vsprintf(v2, format, arg);
result = printf("%s", v2);
}
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]

return_type: void


GetIndexByDate

decompiled_code:
__int64 __fastcall GetIndexByDate(unsigned __int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4)
{
int v7; // esi
int v8; // ecx
__int64 result; // rax
unsigned __int64 v10; // rdx

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

canonical_decompiled_code:
__int64 __fastcall func1(unsigned __int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4)
{
int v7; // esi
int v8; // ecx
__int64 result; // rax
unsigned __int64 v10; // rdx

v7 = a3 - 1;
v8 = 0;
while ( 1 )
{
LODWORD(result) = (v8 + v7) >> 1;
v10 = *(unsigned int *)(a4 + ((__int64)(int)result << 8) + 16);
if ( v10 == a1 )
break;
if ( v10 <= a1 )
v8 = result + 1;
else
v7 = result - 1;
if ( v8 > v7 )
{
if ( a2 == 16 )
{
LODWORD(result) = v7;
}
else
{
if ( a2 != 17 )
{
if ( a2 )
_assert_fail("0", "common/util.c", 0x3Cu, "GetIndexByDate");
func0("%d not in the list\n", a1);
return 0xFFFFFFFFLL;
}
LODWORD(result) = v8;
}
break;
}
}
result = (int)result;
if ( (int)result >= a3 )
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]

return_type: unsigned short


RandomUlong

decompiled_code:
unsigned __int64 __fastcall RandomUlong(unsigned __int64 a1, unsigned __int64 a2)
{
if ( a1 == a2 )
return a2;
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 a2;
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; // xmm0_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; // xmm0_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

return_type: int


decompiled_code:
__int64 __fastcall FILE_GetFileName(unsigned __int64 a1, const char *a2, unsigned __int64 a3, _BYTE *a4)
{
const char *v4; // r8
__int64 result; // rax

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 )
return LIB_Sprintf(a4, 256LL, "%s/%s/weight/%06lu.wgt", a2, v4, a1);
if ( a3 > 0x20008000 )
{
if ( a3 != 4026531840 )
goto LABEL_16;
result = LIB_Sprintf(a4, 256LL, "%s/%06lu.all", a2, a1);
}
else
{
if ( a3 != 268435461 )
{
if ( a3 == 268435492 )
return LIB_Sprintf(a4, 256LL, "%s/%s/%s/%06lu.%s", a2, v4, "day", a1, "day");
LABEL_16:
_assert_fail("0", "common/file.c", 0x1Fu, "FILE_GetFileName");
}
result = LIB_Sprintf(a4, 256LL, "%s/%s/%s/%06lu.%s", a2, v4, "min5", a1, "mn5");
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int64 a1, const char *a2, unsigned __int64 a3, _BYTE *a4)
{
const char *v4; // r8
__int64 result; // rax

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 )
return LIB_Sprintf(a4, 256LL, "%s/%s/weight/%06lu.wgt", a2, v4, a1);
if ( a3 > 0x20008000 )
{
if ( a3 != 4026531840 )
goto LABEL_16;
result = LIB_Sprintf(a4, 256LL, "%s/%06lu.all", a2, a1);
}
else
{
if ( a3 != 268435461 )
{
if ( a3 == 268435492 )
return LIB_Sprintf(a4, 256LL, "%s/%s/%s/%06lu.%s", a2, v4, "day", a1, "day");
LABEL_16:
_assert_fail("0", "common/file.c", 0x1Fu, "FILE_GetFileName");
}
result = LIB_Sprintf(a4, 256LL, "%s/%s/%s/%06lu.%s", a2, v4, "min5", a1, "mn5");
}
return result;
}

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_8;
result = 256LL;
}
else
{
if ( a1 != 268435461 )
{
if ( a1 == 268435492 )
return 168LL;
LABEL_8:
_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_8;
result = 256LL;
}
else
{
if ( a1 != 268435461 )
{
if ( a1 == 268435492 )
return 168LL;
LABEL_8:
_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)
{
__int64 result; // rax

if ( a1 == 268435492 )
return 184LL;
if ( a1 <= 0x10000024 )
{
if ( a1 != 268435461 )
goto LABEL_8;
result = 152LL;
}
else
{
if ( a1 != 536903680 )
{
if ( a1 == 4026531840 )
return 0LL;
LABEL_8:
_assert_fail("0", "common/file.c", 0x61u, "FILE_GetFileHead");
}
result = 0LL;
}
return result;
}

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

if ( a1 == 268435492 )
return 184LL;
if ( a1 <= 0x10000024 )
{
if ( a1 != 268435461 )
goto LABEL_8;
result = 152LL;
}
else
{
if ( a1 != 536903680 )
{
if ( a1 == 4026531840 )
return 0LL;
LABEL_8:
_assert_fail("0", "common/file.c", 0x61u, "FILE_GetFileHead");
}
result = 0LL;
}
return result;
}

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


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


original_code:
ULONG FILE_ThsMin5ToMin30( FILE_THS_MIN5_ENTRY_S *pstMin5, FILE_WHOLE_DATA_S *pstWhole)
{
    ULONG i,k;
    ULONG ulMaxPrice, ulMinPrice, ulMin30Vol;
    ULONG ulPrevMin;
    ULONG ulMin5Date;
    PRICE_S *pstMin30Price;
    ((void) sizeof ((((void *)0) != pstMin5) ? 1 : 0), __extension__ ({ if (((void *)0) != pstMin5) ; else __assert_fail ("NULL != pstMin5", "common/file.c", 237, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((((void *)0) != pstWhole) ? 1 : 0), __extension__ ({ if (((void *)0) != pstWhole) ; else __assert_fail ("NULL != pstWhole", "common/file.c", 238, __extension__ __PRETTY_FUNCTION__); }));
    ulMin5Date = FILE_ThsMin2Date(pstMin5->ulMin);
    ((void) sizeof ((ulMin5Date == pstWhole->ulDate) ? 1 : 0), __extension__ ({ if (ulMin5Date == pstWhole->ulDate) ; else __assert_fail ("ulMin5Date == pstWhole->ulDate", "common/file.c", 241, __extension__ __PRETTY_FUNCTION__); }));
    pstMin30Price=pstWhole->astMin30Price;
    ulPrevMin = pstMin5->ulMin;
    ulMaxPrice = 0;
    ulMinPrice = 0xFFFFFFFF;
    ulMin30Vol = 0;
    for (i=0,k=0;i<48;i++,pstMin5++) {
        if ((pstMin5->ulMin-ulPrevMin) > 720)
            break;
        k++;
        if (ulMaxPrice < pstMin5->ulHighWithCheck) {
            ulMaxPrice = pstMin5->ulHighWithCheck;
        }
        if (ulMinPrice > pstMin5->ulLowWithCheck) {
            ulMinPrice = pstMin5->ulLowWithCheck;
        }
        ulMin30Vol += FILE_GetVol(pstMin5->ulVolWithCheck);
        if (1 == k) {
            pstMin30Price->ulBegin = pstMin5->ulBeginWithCheck - (0xB0000000);
        }
        if (6 == k) {
            pstMin30Price->ulHigh = ulMaxPrice - (0xB0000000);
            pstMin30Price->ulLow = ulMinPrice - (0xB0000000);
            pstMin30Price->ulEnd = pstMin5->ulEndWithCheck - (0xB0000000);
            pstMin30Price->ulVol = ulMin30Vol+3;
            pstMin30Price->ulFlag = 0xCCCCCCCC;
            pstMin30Price++;
            ulMin30Vol = 0;
            k = 0;
            ulMaxPrice = 0;
            ulMinPrice = 0xFFFFFFFF;
        }
        ulPrevMin = pstMin5->ulMin;
    }
    return i;
}

canonical_original_code:
unsigned long FILE_ThsMin5ToMin30(struct tagFile5MinuteData *pstMin5, struct tagWholeData *pstWhole)
{
    unsigned long i; unsigned long k;
    unsigned long ulMaxPrice; unsigned long ulMinPrice; unsigned long ulMin30Vol;
    unsigned long ulPrevMin;
    unsigned long ulMin5Date;
    struct tagPrice *pstMin30Price;
    ((void) sizeof ((((void *)0) != pstMin5) ? 1 : 0), __extension__ ({ if (((void *)0) != pstMin5) ; else __assert_fail ("NULL != pstMin5", "common/file.c", 237, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((((void *)0) != pstWhole) ? 1 : 0), __extension__ ({ if (((void *)0) != pstWhole) ; else __assert_fail ("NULL != pstWhole", "common/file.c", 238, __extension__ __PRETTY_FUNCTION__); }));
    ulMin5Date = FILE_ThsMin2Date(pstMin5->ulMin);
    ((void) sizeof ((ulMin5Date == pstWhole->ulDate) ? 1 : 0), __extension__ ({ if (ulMin5Date == pstWhole->ulDate) ; else __assert_fail ("ulMin5Date == pstWhole->ulDate", "common/file.c", 241, __extension__ __PRETTY_FUNCTION__); }));
    pstMin30Price=pstWhole->astMin30Price;
    ulPrevMin = pstMin5->ulMin;
    ulMaxPrice = 0;
    ulMinPrice = 0xFFFFFFFF;
    ulMin30Vol = 0;
    for (i=0,k=0;i<48;i++,pstMin5++) {
        if ((pstMin5->ulMin-ulPrevMin) > 720)
            break;
        k++;
        if (ulMaxPrice < pstMin5->ulHighWithCheck) {
            ulMaxPrice = pstMin5->ulHighWithCheck;
        }
        if (ulMinPrice > pstMin5->ulLowWithCheck) {
            ulMinPrice = pstMin5->ulLowWithCheck;
        }
        ulMin30Vol += FILE_GetVol(pstMin5->ulVolWithCheck);
        if (1 == k) {
            pstMin30Price->ulBegin = pstMin5->ulBeginWithCheck - (0xB0000000);
        }
        if (6 == k) {
            pstMin30Price->ulHigh = ulMaxPrice - (0xB0000000);
            pstMin30Price->ulLow = ulMinPrice - (0xB0000000);
            pstMin30Price->ulEnd = pstMin5->ulEndWithCheck - (0xB0000000);
            pstMin30Price->ulVol = ulMin30Vol+3;
            pstMin30Price->ulFlag = 0xCCCCCCCC;
            pstMin30Price++;
            ulMin30Vol = 0;
            k = 0;
            ulMaxPrice = 0;
            ulMinPrice = 0xFFFFFFFF;
        }
        ulPrevMin = pstMin5->ulMin;
    }
    return i;
}

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: 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:
i
unsigned long

variable_types:
k
unsigned long

variable_types:
ulMaxPrice
unsigned long

variable_types:
ulMinPrice
unsigned long

variable_types:
ulPrevMin
unsigned long

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


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

v2 = a1[4];
v3 = 0.0;
if ( v2 )
{
v3 = (float)(v2 / 0xA);
v4 = 1;
}
else
{
v4 = 0;
}
v5 = a1[5];
if ( v5 || a1[1] || a1[2] )
{
v6 = a1[2];
v7 = (float)(v6 + a1[1] + v5 + 100000) / 100000.0;
v3 = v3 - (float)(a1[3] * v6 / 0x186A0u);
}
else
{
if ( !v4 )
return 0LL;
v7 = *(float *)&LC31;
}
if ( *(_DWORD *)(a2 + 240) == -2004318072 )
{
if ( v7 != *(float *)(a2 + 244) )
_assert_fail("pstFactor->fMulti == fMultiTemp", "common/file.c", 0x14Bu, "FILE_QlWeightToCustom");
if ( v3 != *(float *)(a2 + 248) )
_assert_fail("pstFactor->fAdder == fAdderTemp", "common/file.c", 0x14Cu, "FILE_QlWeightToCustom");
result = 0LL;
}
else
{
*(float *)(a2 + 244) = v7;
*(float *)(a2 + 248) = v3;
*(_DWORD *)(a2 + 240) = -2004318072;
result = 1LL;
}
return result;
}

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

v2 = a1[4];
v3 = 0.0;
if ( v2 )
{
v3 = (float)(v2 / 0xA);
v4 = 1;
}
else
{
v4 = 0;
}
v5 = a1[5];
if ( v5 || a1[1] || a1[2] )
{
v6 = a1[2];
v7 = (float)(v6 + a1[1] + v5 + 100000) / 100000.0;
v3 = v3 - (float)(a1[3] * v6 / 0x186A0u);
}
else
{
if ( !v4 )
return 0LL;
v7 = *(float *)&LC31;
}
if ( *(_DWORD *)(a2 + 240) == -2004318072 )
{
if ( v7 != *(float *)(a2 + 244) )
_assert_fail("pstFactor->fMulti == fMultiTemp", "common/file.c", 0x14Bu, "FILE_QlWeightToCustom");
if ( v3 != *(float *)(a2 + 248) )
_assert_fail("pstFactor->fAdder == fAdderTemp", "common/file.c", 0x14Cu, "FILE_QlWeightToCustom");
result = 0LL;
}
else
{
*(float *)(a2 + 244) = v7;
*(float *)(a2 + 248) = v3;
*(_DWORD *)(a2 + 240) = -2004318072;
result = 1LL;
}
return result;
}

original_code:
ULONG FILE_QlWeightToCustom( FILE_QL_WEIGHT_ENTRY_S *pstWeight, FILE_WHOLE_DATA_S *pstWhole)
{
    BOOL_T bVaild;
    FLOAT fMultiTemp, fAdderTemp;
    FACTOR_S *pstFactor = &(pstWhole->stFactor);
    bVaild = (0);
    fMultiTemp = 1;
    fAdderTemp = 0;
    if (0 != pstWeight->ulProfit) {
        fAdderTemp = (FLOAT)(pstWeight->ulProfit / 10);
        bVaild = (1);
    }
    if ((0 != pstWeight->ulAdd) || (0 != pstWeight->ulGift) || (0 != pstWeight->ulOffer)) {
        fMultiTemp = ((FLOAT)(pstWeight->ulAdd + pstWeight->ulGift + pstWeight->ulOffer + 100000) / 100000);
        fAdderTemp -= (FLOAT)(pstWeight->ulOffer * pstWeight->ulOfferPrice / 100000);
        bVaild = (1);
    }
    if ((0) == bVaild) {
        return 0;
    }
    if (0x88888888 == pstFactor->ulFlag) {
        ((void) sizeof ((pstFactor->fMulti == fMultiTemp) ? 1 : 0), __extension__ ({ if (pstFactor->fMulti == fMultiTemp) ; else __assert_fail ("pstFactor->fMulti == fMultiTemp", "common/file.c", 331, __extension__ __PRETTY_FUNCTION__); }));
        ((void) sizeof ((pstFactor->fAdder == fAdderTemp) ? 1 : 0), __extension__ ({ if (pstFactor->fAdder == fAdderTemp) ; else __assert_fail ("pstFactor->fAdder == fAdderTemp", "common/file.c", 332, __extension__ __PRETTY_FUNCTION__); }));
        return 0;
    }
    pstFactor->fMulti = fMultiTemp;
    pstFactor->fAdder = fAdderTemp;
    pstFactor->ulFlag = 0x88888888;
    return 1;
}

canonical_original_code:
unsigned long FILE_QlWeightToCustom(struct tagFileWeight *pstWeight, struct tagWholeData *pstWhole)
{
    unsigned short bVaild;
    float fMultiTemp; float fAdderTemp;
    struct tagFactor *pstFactor = &(pstWhole->stFactor);
    bVaild = (0);
    fMultiTemp = 1;
    fAdderTemp = 0;
    if (0 != pstWeight->ulProfit) {
        fAdderTemp = (FLOAT)(pstWeight->ulProfit / 10);
        bVaild = (1);
    }
    if ((0 != pstWeight->ulAdd) || (0 != pstWeight->ulGift) || (0 != pstWeight->ulOffer)) {
        fMultiTemp = ((FLOAT)(pstWeight->ulAdd + pstWeight->ulGift + pstWeight->ulOffer + 100000) / 100000);
        fAdderTemp -= (FLOAT)(pstWeight->ulOffer * pstWeight->ulOfferPrice / 100000);
        bVaild = (1);
    }
    if ((0) == bVaild) {
        return 0;
    }
    if (0x88888888 == pstFactor->ulFlag) {
        ((void) sizeof ((pstFactor->fMulti == fMultiTemp) ? 1 : 0), __extension__ ({ if (pstFactor->fMulti == fMultiTemp) ; else __assert_fail ("pstFactor->fMulti == fMultiTemp", "common/file.c", 331, __extension__ __PRETTY_FUNCTION__); }));
        ((void) sizeof ((pstFactor->fAdder == fAdderTemp) ? 1 : 0), __extension__ ({ if (pstFactor->fAdder == fAdderTemp) ; else __assert_fail ("pstFactor->fAdder == fAdderTemp", "common/file.c", 332, __extension__ __PRETTY_FUNCTION__); }));
        return 0;
    }
    pstFactor->fMulti = fMultiTemp;
    pstFactor->fAdder = fAdderTemp;
    pstFactor->ulFlag = 0x88888888;
    return 1;
}

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; } *

variable_types:
bVaild
unsigned short

variable_types: fMultiTemp float

variable_types: fAdderTemp float

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


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

original_code:
ULONG FILE_QlDate2Custom( ULONG ulWeightDate)
{
    ULONG ulYear = (((ulWeightDate) & 0xFFF00000) >> 20);
    ULONG ulMonth = (((ulWeightDate) & 0x000F0000) >> 16);
    ULONG ulDay = (((ulWeightDate) & 0x0000F800) >> 11);
    return ((ulYear * 10000) + (ulMonth * 100) + ulDay);
}

canonical_original_code:
unsigned long FILE_QlDate2Custom(unsigned long ulWeightDate)
{
    unsigned long ulYear = (((ulWeightDate) & 0xFFF00000) >> 20);
    unsigned long ulMonth = (((ulWeightDate) & 0x000F0000) >> 16);
    unsigned long ulDay = (((ulWeightDate) & 0x0000F800) >> 11);
    return ((ulYear * 10000) + (ulMonth * 100) + ulDay);
}

variable_types:
ulWeightDate
unsigned long

variable_types:
ulYear
unsigned long

variable_types:
ulMonth
unsigned long


decompiled_code:
int __fastcall CHOOSE_Track(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v5; // rax
__int64 v6; // rbx
char *v7; // r15
unsigned int v8; // er14
unsigned __int64 v9; // r8
unsigned __int64 v10; // rbx
void *ptr; // [rsp+8h] [rbp-A0h] BYREF
__int64 v13; // [rsp+10h] [rbp-98h] BYREF
__int64 v14; // [rsp+18h] [rbp-90h]
__int64 v15; // [rsp+20h] [rbp-88h]
int v16; // [rsp+28h] [rbp-80h]
__int64 v17[15]; // [rsp+30h] [rbp-78h] BYREF

ptr = 0LL;
v5 = FILE_GetFileData(a1, a3, 4026531840LL, &ptr);
if ( v5 )
{
v6 = v5;
if ( GetIndexByDate(a2, 0LL, v5, ptr) == 0xFFFFFFFFLL )
{
free(ptr);
LODWORD(v5) = DebugOutString("invalid date=%lu, code=%06lu\n", a2, a1);
}
else
{
v7 = (char *)ptr + 256 * v6 - 256;
v8 = *((_DWORD *)v7 + 9);
METHOD_GetFuncSet(a4, v17);
((void (__fastcall *)(_QWORD, _QWORD))v17[6])(0LL, 0LL);
v13 = 0LL;
v15 = 0LL;
v16 = 0;
v14 = (unsigned int)a2;
v13 = ((unsigned int (__fastcall *)(char *, __int64 *))v17[0])(v7, &v13);
HIDWORD(v13) = ((__int64 (__fastcall *)(char *, __int64 *))v17[1])(v7, &v13);
free(ptr);
v9 = (unsigned int)v13 - (unsigned __int64)v8;
if ( (unsigned int)v13 <= (unsigned __int64)v8 + 10 )
v9 = 10LL;
v10 = v8 - (unsigned __int64)HIDWORD(v13);
if ( v8 <= HIDWORD(v13) + 10 )
v10 = 10LL;
LODWORD(v5) = printf(
"%06lu,%lu,%.2f,%.2f,%lu,%.2f,%lu\n",
a1,
(unsigned int)v14,
(float)((float)(int)v8 / 1000.0),
(float)((float)SHIDWORD(v13) / 1000.0),
v10 / 0xA,
(float)((float)(int)v13 / 1000.0),
v9 / 0xA);
}
}
return v5;
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v5; // rax
__int64 v6; // rbx
char *v7; // r15
unsigned int v8; // er14
unsigned __int64 v9; // r8
unsigned __int64 v10; // rbx
void *ptr; // [rsp+8h] [rbp-A0h] BYREF
__int64 v13; // [rsp+10h] [rbp-98h] BYREF
__int64 v14; // [rsp+18h] [rbp-90h]
__int64 v15; // [rsp+20h] [rbp-88h]
int v16; // [rsp+28h] [rbp-80h]
__int64 v17[15]; // [rsp+30h] [rbp-78h] BYREF

ptr = 0LL;
v5 = FILE_GetFileData(a1, a3, 4026531840LL, &ptr);
if ( v5 )
{
v6 = v5;
if ( GetIndexByDate(a2, 0LL, v5, ptr) == 0xFFFFFFFFLL )
{
free(ptr);
LODWORD(v5) = DebugOutString("invalid date=%lu, code=%06lu\n", a2, a1);
}
else
{
v7 = (char *)ptr + 256 * v6 - 256;
v8 = *((_DWORD *)v7 + 9);
METHOD_GetFuncSet(a4, v17);
((void (__fastcall *)(_QWORD, _QWORD))v17[6])(0LL, 0LL);
v13 = 0LL;
v15 = 0LL;
v16 = 0;
v14 = (unsigned int)a2;
v13 = ((unsigned int (__fastcall *)(char *, __int64 *))v17[0])(v7, &v13);
HIDWORD(v13) = ((__int64 (__fastcall *)(char *, __int64 *))v17[1])(v7, &v13);
free(ptr);
v9 = (unsigned int)v13 - (unsigned __int64)v8;
if ( (unsigned int)v13 <= (unsigned __int64)v8 + 10 )
v9 = 10LL;
v10 = v8 - (unsigned __int64)HIDWORD(v13);
if ( v8 <= HIDWORD(v13) + 10 )
v10 = 10LL;
LODWORD(v5) = printf(
"%06lu,%lu,%.2f,%.2f,%lu,%.2f,%lu\n",
a1,
(unsigned int)v14,
(float)((float)(int)v8 / 1000.0),
(float)((float)SHIDWORD(v13) / 1000.0),
v10 / 0xA,
(float)((float)(int)v13 / 1000.0),
v9 / 0xA);
}
}
return v5;
}

original_code:
VOID CHOOSE_Track( ULONG ulCode, ULONG ulDate, CHAR * szDir, ULONG ulMethod)
{
    ULONG ulEntryCnt;
    ULONG ulIndex;
    ULONG ulLatestEndPrice;
    ULONG ulGainPriceDiff, ulLossPriceDiff;
    METHOD_FUNC_SET_S stMethodFunc;
    STOCK_CTRL_S stStockCtrl;
    FILE_WHOLE_DATA_S *astWholeData = ((void *)0);
    FILE_WHOLE_DATA_S *pstLatestData = ((void *)0);
    ulEntryCnt = FILE_GetFileData(ulCode, szDir, 0xF0000000, (VOID**)&astWholeData);
    if (0 == ulEntryCnt) return;
    ulIndex = GetIndexByDate(ulDate, (0x00), ulEntryCnt, astWholeData);
    if ((0xFFFFFFFF) == ulIndex) {
        free(astWholeData);
        DebugOutString("invalid date=%lu, code=%06lu\n", ulDate, ulCode);
        return;
    }
    pstLatestData=&astWholeData[ulEntryCnt-1];
    ulLatestEndPrice = pstLatestData->stDailyPrice.ulEnd;
    METHOD_GetFuncSet(ulMethod, &stMethodFunc);
    stMethodFunc.pfSetParam(0, ((void *)0));
    memset(&stStockCtrl, 0, sizeof(stStockCtrl));
    stStockCtrl.ulBuyDate = ulDate;
    stStockCtrl.ulGainPrice = stMethodFunc.pfGetGainPrice(pstLatestData, &stStockCtrl);
    stStockCtrl.ulLossPrice = stMethodFunc.pfGetLossPrice(pstLatestData, &stStockCtrl);
    free(astWholeData);
    ulGainPriceDiff=(stStockCtrl.ulGainPrice > (ulLatestEndPrice+10)) ?
                    (stStockCtrl.ulGainPrice-ulLatestEndPrice) : 10;
    ulLossPriceDiff=(ulLatestEndPrice>(stStockCtrl.ulLossPrice+10)) ?
                    (ulLatestEndPrice-stStockCtrl.ulLossPrice) : 10;
    printf("%06lu,%lu,%.2f,%.2f,%lu,%.2f,%lu\n",
           ulCode, stStockCtrl.ulBuyDate, (((FLOAT)(ulLatestEndPrice))/(1000)),
           (((FLOAT)(stStockCtrl.ulLossPrice))/(1000)), ulLossPriceDiff/10,
           (((FLOAT)(stStockCtrl.ulGainPrice))/(1000)), ulGainPriceDiff/10);
    return;
}

canonical_original_code:
void CHOOSE_Track(unsigned long ulCode, unsigned long ulDate, char *szDir, unsigned long ulMethod)
{
    unsigned long ulEntryCnt;
    unsigned long ulIndex;
    unsigned long ulLatestEndPrice;
    unsigned long ulGainPriceDiff; unsigned long ulLossPriceDiff;
    struct tagMethodFuncSet stMethodFunc;
    struct tagStockCtrl stStockCtrl;
    struct tagWholeData *astWholeData = ((void *)0);
    struct tagWholeData *pstLatestData = ((void *)0);
    ulEntryCnt = FILE_GetFileData(ulCode, szDir, 0xF0000000, (void **)&astWholeData);
    if (0 == ulEntryCnt) return;
    ulIndex = GetIndexByDate(ulDate, (0x00), ulEntryCnt, astWholeData);
    if ((0xFFFFFFFF) == ulIndex) {
        free(astWholeData);
        DebugOutString("invalid date=%lu, code=%06lu\n", ulDate, ulCode);
        return;
    }
    pstLatestData=&astWholeData[ulEntryCnt-1];
    ulLatestEndPrice = pstLatestData->stDailyPrice.ulEnd;
    METHOD_GetFuncSet(ulMethod, &stMethodFunc);
    stMethodFunc.pfSetParam(0, ((void *)0));
    memset(&stStockCtrl, 0, sizeof(stStockCtrl));
    stStockCtrl.ulBuyDate = ulDate;
    stStockCtrl.ulGainPrice = stMethodFunc.pfGetGainPrice(pstLatestData, &stStockCtrl);
    stStockCtrl.ulLossPrice = stMethodFunc.pfGetLossPrice(pstLatestData, &stStockCtrl);
    free(astWholeData);
    ulGainPriceDiff=(stStockCtrl.ulGainPrice > (ulLatestEndPrice+10)) ?
                    (stStockCtrl.ulGainPrice-ulLatestEndPrice) : 10;
    ulLossPriceDiff=(ulLatestEndPrice>(stStockCtrl.ulLossPrice+10)) ?
                    (ulLatestEndPrice-stStockCtrl.ulLossPrice) : 10;
    printf("%06lu,%lu,%.2f,%.2f,%lu,%.2f,%lu\n",
           ulCode, stStockCtrl.ulBuyDate, (((FLOAT)(ulLatestEndPrice))/(1000)),
           (((FLOAT)(stStockCtrl.ulLossPrice))/(1000)), ulLossPriceDiff/10,
           (((FLOAT)(stStockCtrl.ulGainPrice))/(1000)), ulGainPriceDiff/10);
    return;
}

variable_types:
ulCode
unsigned long

variable_types:
ulDate
unsigned long

variable_types:
szDir
char *

variable_types:
ulMethod
unsigned long

variable_types:
ulEntryCnt
unsigned long

variable_types:
ulIndex
unsigned long

variable_types:
ulLatestEndPrice
unsigned long

variable_types:
ulGainPriceDiff
unsigned long

variable_types:
ulLossPriceDiff
unsigned long

variable_types: struct tagMethodFuncSet { unsigned long (*pfGetGainPrice)(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; } *, struct tagStockCtrl { unsigned int ulGainPrice; unsigned int ulLossPrice; unsigned int ulBuyDate; unsigned int ulBuyPrice; unsigned int ulSellDate; unsigned int ulSellPrice; float fContext; } *); unsigned long (*pfGetLossPrice)(struct tagWholeData *, struct tagStockCtrl *); unsigned long (*pfGetBuyPrice)(struct tagWholeData *, unsigned long); unsigned long (*pfGetSellPrice)(struct tagWholeData *, struct tagStockCtrl *); unsigned short (*pfDailyChoose)(unsigned long, struct tagWholeData *, struct tagPreDealInfo { unsigned short bIsSell; unsigned short usDealHour; unsigned short usDealMin; unsigned short bIsHigher; float fThresholdPrice; float fWeight; } *); void (*pfStatistics)(unsigned long, struct tagWholeData *); void (*pfSetParam)(unsigned long, float *); }

user_defined_types: struct tagMethodFuncSet { unsigned long (*pfGetGainPrice)(struct tagWholeData *, struct tagStockCtrl *); unsigned long (*pfGetLossPrice)(struct tagWholeData *, struct tagStockCtrl *); unsigned long (*pfGetBuyPrice)(struct tagWholeData *, unsigned long); unsigned long (*pfGetSellPrice)(struct tagWholeData *, struct tagStockCtrl *); unsigned short (*pfDailyChoose)(unsigned long, struct tagWholeData *, struct tagPreDealInfo *); void (*pfStatistics)(unsigned long, struct tagWholeData *); void (*pfSetParam)(unsigned long, float *); }


decompiled_code:
int __fastcall CHOOSE_Distribute(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v5; // rax
__int64 v6; // r13
__int64 (__fastcall *v7)(__int64, char *, __int16 *); // rbp
void *ptr; // [rsp+8h] [rbp-80h] BYREF
char v10[32]; // [rsp+10h] [rbp-78h] BYREF
__int64 (__fastcall *v11)(__int64, char *, __int16 *); // [rsp+30h] [rbp-58h]
void (__fastcall *v12)(_QWORD, _QWORD); // [rsp+40h] [rbp-48h]
__int16 v13[4]; // [rsp+50h] [rbp-38h] BYREF
float v14; // [rsp+58h] [rbp-30h]

ptr = 0LL;
v5 = FILE_GetFileData(a1, a3, 4026531840LL, &ptr);
if ( v5 )
{
v6 = GetIndexByDate(a2, 16LL, v5, ptr);
if ( v6 == 0xFFFFFFFFLL )
{
free(ptr);
LODWORD(v5) = DebugOutString("invalid date=%lu, code=%06lu\n", a2, a1);
}
else
{
METHOD_GetFuncSet(a4, v10);
v7 = v11;
v12(0LL, 0LL);
LOWORD(v7) = v7(v6, (char *)ptr + 256 * v6, v13);
free(ptr);
if ( (_WORD)v7 == 1 )
LODWORD(v5) = printf(
"%06lu,%u,%u,%u,%u,%.2f\n",
a1,
(unsigned __int16)v13[0],
(unsigned __int16)v13[1],
(unsigned __int16)v13[2],
(unsigned __int16)v13[3],
v14);
else
LODWORD(v5) = DebugOutString("%06lu not in deal\n", a1);
}
}
return v5;
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v5; // rax
__int64 v6; // r13
__int64 (__fastcall *v7)(__int64, char *, __int16 *); // rbp
void *ptr; // [rsp+8h] [rbp-80h] BYREF
char v10[32]; // [rsp+10h] [rbp-78h] BYREF
__int64 (__fastcall *v11)(__int64, char *, __int16 *); // [rsp+30h] [rbp-58h]
void (__fastcall *v12)(_QWORD, _QWORD); // [rsp+40h] [rbp-48h]
__int16 v13[4]; // [rsp+50h] [rbp-38h] BYREF
float v14; // [rsp+58h] [rbp-30h]

ptr = 0LL;
v5 = FILE_GetFileData(a1, a3, 4026531840LL, &ptr);
if ( v5 )
{
v6 = GetIndexByDate(a2, 16LL, v5, ptr);
if ( v6 == 0xFFFFFFFFLL )
{
free(ptr);
LODWORD(v5) = DebugOutString("invalid date=%lu, code=%06lu\n", a2, a1);
}
else
{
METHOD_GetFuncSet(a4, v10);
v7 = v11;
v12(0LL, 0LL);
LOWORD(v7) = v7(v6, (char *)ptr + 256 * v6, v13);
free(ptr);
if ( (_WORD)v7 == 1 )
LODWORD(v5) = printf(
"%06lu,%u,%u,%u,%u,%.2f\n",
a1,
(unsigned __int16)v13[0],
(unsigned __int16)v13[1],
(unsigned __int16)v13[2],
(unsigned __int16)v13[3],
v14);
else
LODWORD(v5) = DebugOutString("%06lu not in deal\n", a1);
}
}
return v5;
}

original_code:
VOID CHOOSE_Distribute( ULONG ulCode, ULONG ulDate, CHAR * szDir, ULONG ulMethod)
{
    BOOL_T bIsDeal;
    CHOOSE_PRE_DEAL_S stDealInfo;
    ULONG ulEntryCnt;
    ULONG ulIndex;
    METHOD_FUNC_SET_S stMethodFunc;
    Choose_PF pfChoose = ((void *)0);
    FILE_WHOLE_DATA_S *astWholeData = ((void *)0);
    ulEntryCnt = FILE_GetFileData(ulCode, szDir, 0xF0000000, (VOID**)&astWholeData);
    if (0 == ulEntryCnt) return;
    ulIndex = GetIndexByDate(ulDate, (0x10), ulEntryCnt, astWholeData);
    if ((0xFFFFFFFF) == ulIndex) {
        free(astWholeData);
        DebugOutString("invalid date=%lu, code=%06lu\n", ulDate, ulCode);
        return;
    }
    METHOD_GetFuncSet(ulMethod, &stMethodFunc);
    pfChoose = stMethodFunc.pfDailyChoose;
    stMethodFunc.pfSetParam(0, ((void *)0));
    bIsDeal = pfChoose(ulIndex, &astWholeData[ulIndex], &stDealInfo);
    free(astWholeData);
    if ((1) == bIsDeal) {
        printf("%06lu,%u,%u,%u,%u,%.2f\n",
               ulCode, stDealInfo.bIsSell, stDealInfo.usDealHour, stDealInfo.usDealMin,
               stDealInfo.bIsHigher, stDealInfo.fThresholdPrice);
    }
    else {
        DebugOutString("%06lu not in deal\n",ulCode);
    }
    return;
}

canonical_original_code:
void CHOOSE_Distribute(unsigned long ulCode, unsigned long ulDate, char *szDir, unsigned long ulMethod)
{
    unsigned short bIsDeal;
    struct tagPreDealInfo stDealInfo;
    unsigned long ulEntryCnt;
    unsigned long ulIndex;
    struct tagMethodFuncSet stMethodFunc;
    unsigned short (*pfChoose)(unsigned long, struct tagWholeData *, struct tagPreDealInfo *) = ((void *)0);
    struct tagWholeData *astWholeData = ((void *)0);
    ulEntryCnt = FILE_GetFileData(ulCode, szDir, 0xF0000000, (void **)&astWholeData);
    if (0 == ulEntryCnt) return;
    ulIndex = GetIndexByDate(ulDate, (0x10), ulEntryCnt, astWholeData);
    if ((0xFFFFFFFF) == ulIndex) {
        free(astWholeData);
        DebugOutString("invalid date=%lu, code=%06lu\n", ulDate, ulCode);
        return;
    }
    METHOD_GetFuncSet(ulMethod, &stMethodFunc);
    pfChoose = stMethodFunc.pfDailyChoose;
    stMethodFunc.pfSetParam(0, ((void *)0));
    bIsDeal = pfChoose(ulIndex, &astWholeData[ulIndex], &stDealInfo);
    free(astWholeData);
    if ((1) == bIsDeal) {
        printf("%06lu,%u,%u,%u,%u,%.2f\n",
               ulCode, stDealInfo.bIsSell, stDealInfo.usDealHour, stDealInfo.usDealMin,
               stDealInfo.bIsHigher, stDealInfo.fThresholdPrice);
    }
    else {
        DebugOutString("%06lu not in deal\n",ulCode);
    }
    return;
}

variable_types:
bIsDeal
unsigned short

variable_types: unsigned short (*)(unsigned long, 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; } *, struct tagPreDealInfo { unsigned short bIsSell; unsigned short usDealHour; unsigned short usDealMin; unsigned short bIsHigher; float fThresholdPrice; float fWeight; } *)

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; }


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r14
__int64 v4; // r13
__int64 v5; // rax
__int64 v6; // r12
__int64 v7; // rbx
__int64 *v9; // [rsp+8h] [rbp-30h] BYREF

v9 = 0LL;
if ( (unsigned int)(argc - 5) > 1 )
{
printf("USAGE: %s method path date { code | all } [debug]", *argv);
exit(1);
}
RandomInit(argc, argv, envp);
if ( !strcasecmp(argv[argc - 1], "debug") )
g_bIsDebugMode = 1;
v3 = GetMethod(argv[1]);
v4 = atol(argv[3]);
v5 = GetCodeList(argv[4], &v9);
v6 = v5;
if ( v5 == 1 )
{
CHOOSE_Track(*v9, v4, (__int64)argv[2], v3);
}
else
{
v7 = 0LL;
if ( v5 )
{
do
CHOOSE_Distribute(v9[v7++], v4, (__int64)argv[2], v3);
while ( v6 != v7 );
}
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r14
__int64 v4; // r13
__int64 v5; // rax
__int64 v6; // r12
__int64 v7; // rbx
__int64 *v9; // [rsp+8h] [rbp-30h] BYREF

v9 = 0LL;
if ( (unsigned int)(argc - 5) > 1 )
{
printf("USAGE: %s method path date { code | all } [debug]", *argv);
exit(1);
}
RandomInit(argc, argv, envp);
if ( !strcasecmp(argv[argc - 1], "debug") )
g_bIsDebugMode = 1;
v3 = GetMethod(argv[1]);
v4 = atol(argv[3]);
v5 = GetCodeList(argv[4], &v9);
v6 = v5;
if ( v5 == 1 )
{
func0(*v9, v4, (__int64)argv[2], v3);
}
else
{
v7 = 0LL;
if ( v5 )
{
do
func1(v9[v7++], v4, (__int64)argv[2], v3);
while ( v6 != v7 );
}
}
return 0;
}

original_code:
int main(int argc,char *argv[])
{
    ULONG i, ulCodeCnt;
    ULONG ulDate;
    ULONG ulMethod;
    ULONG *pulCodeList = ((void *)0);
    if ((argc < 5) || (argc > 6)) {
        printf("USAGE: %s method path date { code | all } [debug]", argv[0]);
        exit(1);
    }
    RandomInit();
    if (0 == strcasecmp(argv[argc-1], "debug"))
        g_bIsDebugMode = (1);
    ulMethod = GetMethod(argv[1]);
    ulDate = (ULONG)atol(argv[3]);
    ulCodeCnt = GetCodeList(argv[4], &pulCodeList);
    if (1 == ulCodeCnt) {
        CHOOSE_Track(pulCodeList[0], ulDate, argv[2], ulMethod);
    }
    else {
        for (i=0;i<ulCodeCnt;i++) {
            CHOOSE_Distribute(pulCodeList[i], ulDate, argv[2], ulMethod);
        }
    }
    return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
    unsigned long i; unsigned long ulCodeCnt;
    unsigned long ulDate;
    unsigned long ulMethod;
    unsigned long *pulCodeList = ((void *)0);
    if ((argc < 5) || (argc > 6)) {
        printf("USAGE: %s method path date { code | all } [debug]", argv[0]);
        exit(1);
    }
    RandomInit();
    if (0 == strcasecmp(argv[argc-1], "debug"))
        g_bIsDebugMode = (1);
    ulMethod = GetMethod(argv[1]);
    ulDate = (unsigned long)atol(argv[3]);
    ulCodeCnt = GetCodeList(argv[4], &pulCodeList);
    if (1 == ulCodeCnt) {
        CHOOSE_Track(pulCodeList[0], ulDate, argv[2], ulMethod);
    }
    else {
        for (i=0;i<ulCodeCnt;i++) {
            CHOOSE_Distribute(pulCodeList[i], ulDate, argv[2], ulMethod);
        }
    }
    return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types:
i
unsigned long

variable_types:
ulCodeCnt
unsigned long

variable_types:
pulCodeList
unsigned long *


decompiled_code:
void RISE_SetParam()
{
;
}

canonical_decompiled_code:
void func1()
{
;
}

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

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

variable_types:
ulCnt
unsigned long

variable_types:
afParam
float *


decompiled_code:
void RISE_SortWishList()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

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

canonical_original_code:
void RISE_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; } *

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


decompiled_code:
void __fastcall RISE_Statistics(unsigned __int64 a1, __int64 a2)
{
float v2; // xmm0_4
float v3; // [rsp+0h] [rbp-20h] BYREF
float v4[7]; // [rsp+4h] [rbp-1Ch] BYREF

if ( a1 > 3 )
{
GetTotalRise(1LL, a2, 4LL, &v3);
if ( v3 >= -0.11 && v3 <= 0.11 )
{
GetTotalRise(3LL, a2 - 256, 4LL, v4);
v2 = GetVolRatio(a2 - 256);
if ( v2 > 5.0 && v4[0] > 0.1 )
printf("%lu,%.5f,%.5f\n", *(unsigned int *)(a2 + 16), v2, v3);
}
}
}

canonical_decompiled_code:
void __fastcall func3(unsigned __int64 a1, __int64 a2)
{
float v2; // xmm0_4
float v3; // [rsp+0h] [rbp-20h] BYREF
float v4[7]; // [rsp+4h] [rbp-1Ch] BYREF

if ( a1 > 3 )
{
GetTotalRise(1LL, a2, 4LL, &v3);
if ( v3 >= -0.11 && v3 <= 0.11 )
{
GetTotalRise(3LL, a2 - 256, 4LL, v4);
v2 = GetVolRatio(a2 - 256);
if ( v2 > 5.0 && v4[0] > 0.1 )
printf("%lu,%.5f,%.5f\n", *(unsigned int *)(a2 + 16), v2, v3);
}
}
}

original_code:
VOID RISE_Statistics( ULONG ulIndex, FILE_WHOLE_DATA_S *pstSettleData)
{
    FLOAT fWatchRise;
    FLOAT fPrevVolRate;
    FLOAT fCurrRise;
    if (ulIndex <= (3)) return;
    (VOID)GetTotalRise(1, pstSettleData, (0x04UL), &fCurrRise);
    if ((fCurrRise < -0.11) || (fCurrRise > 0.11)) return;
    (VOID)GetTotalRise((3), pstSettleData-1, (0x04UL), &fWatchRise);
    fPrevVolRate=GetVolRatio(pstSettleData-1);
    if ((fPrevVolRate>5) && (fWatchRise>0.1))
    printf("%lu,%.5f,%.5f\n", pstSettleData->ulDate, fPrevVolRate, fCurrRise);
    return;
}

canonical_original_code:
void RISE_Statistics(unsigned long ulIndex, struct tagWholeData *pstSettleData)
{
    float fWatchRise;
    float fPrevVolRate;
    float fCurrRise;
    if (ulIndex <= (3)) return;
    (void)GetTotalRise(1, pstSettleData, (0x04UL), &fCurrRise);
    if ((fCurrRise < -0.11) || (fCurrRise > 0.11)) return;
    (void)GetTotalRise((3), pstSettleData-1, (0x04UL), &fWatchRise);
    fPrevVolRate=GetVolRatio(pstSettleData-1);
    if ((fPrevVolRate>5) && (fWatchRise>0.1))
    printf("%lu,%.5f,%.5f\n", pstSettleData->ulDate, fPrevVolRate, fCurrRise);
    return;
}

variable_types:
ulIndex
unsigned long

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: fWatchRise float

variable_types: fPrevVolRate float

variable_types: fCurrRise float


decompiled_code:
__int64 __fastcall RISE_Choose(unsigned __int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
char v5[28]; // [rsp+0h] [rbp-1Ch] BYREF

result = 0LL;
if ( a1 > 2 )
{
result = GetTotalRise(2LL, a2, 4LL, v5);
if ( (_WORD)result )
{
*(_WORD *)a3 = 0;
*(_WORD *)(a3 + 2) = 14;
*(_WORD *)(a3 + 4) = RandomUlong(50LL, 60LL);
*(_WORD *)(a3 + 6) = 1;
*(float *)(a3 + 8) = fmaxf((float)*(int *)(a2 - 476) * 1.1, (float)*(int *)(a2 + 36) * 1.02) / 1000.0;
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned __int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
char v5[28]; // [rsp+0h] [rbp-1Ch] BYREF

result = 0LL;
if ( a1 > 2 )
{
result = GetTotalRise(2LL, a2, 4LL, v5);
if ( (_WORD)result )
{
*(_WORD *)a3 = 0;
*(_WORD *)(a3 + 2) = 14;
*(_WORD *)(a3 + 4) = RandomUlong(50LL, 60LL);
*(_WORD *)(a3 + 6) = 1;
*(float *)(a3 + 8) = fmaxf((float)*(int *)(a2 - 476) * 1.1, (float)*(int *)(a2 + 36) * 1.02) / 1000.0;
result = 1LL;
}
}
return result;
}

original_code:
BOOL_T RISE_Choose( ULONG ulIndex, FILE_WHOLE_DATA_S *pstCurrData, CHOOSE_PRE_DEAL_S *pstDealInfo)
{
    FLOAT fPrevRise;
    FLOAT fThreshPrice;
    ULONG ulMeanPrice=(0xFFFFFFFF);
    FILE_WHOLE_DATA_S *pstBase = pstCurrData - (2);
    FILE_WHOLE_DATA_S *pstTemp = pstBase-1;
    if (ulIndex <= ((2))) return (0);
    {
        BOOL_T bIsContinuous;
        bIsContinuous = GetTotalRise((2), pstCurrData, (0x04UL), &fPrevRise);
        if ((0) == bIsContinuous) return (0);
    }
    pstDealInfo->bIsSell = (0);
    pstDealInfo->usDealHour = (14);
    pstDealInfo->usDealMin = (USHORT)RandomUlong(50,60);
    pstDealInfo->bIsHigher = (1);
    fThreshPrice = (((((1.10F) * pstBase->stDailyPrice.ulEnd)) > (((1.02F) * pstCurrData->stDailyPrice.ulEnd))) ? (((1.10F) * pstBase->stDailyPrice.ulEnd)) : (((1.02F) * pstCurrData->stDailyPrice.ulEnd)));
    pstDealInfo->fThresholdPrice = (((FLOAT)(fThreshPrice))/(1000));
    return (1);
}

canonical_original_code:
unsigned short RISE_Choose(unsigned long ulIndex, struct tagWholeData *pstCurrData, struct tagPreDealInfo *pstDealInfo)
{
    float fPrevRise;
    float fThreshPrice;
    unsigned long ulMeanPrice = (0xFFFFFFFF);
    struct tagWholeData *pstBase = pstCurrData - (2);
    struct tagWholeData *pstTemp = pstBase-1;
    if (ulIndex <= ((2))) return (0);
    {
        unsigned short bIsContinuous;
        bIsContinuous = GetTotalRise((2), pstCurrData, (0x04UL), &fPrevRise);
        if ((0) == bIsContinuous) return (0);
    }
    pstDealInfo->bIsSell = (0);
    pstDealInfo->usDealHour = (14);
    pstDealInfo->usDealMin = (unsigned short)RandomUlong(50,60);
    pstDealInfo->bIsHigher = (1);
    fThreshPrice = (((((1.10F) * pstBase->stDailyPrice.ulEnd)) > (((1.02F) * pstCurrData->stDailyPrice.ulEnd))) ? (((1.10F) * pstBase->stDailyPrice.ulEnd)) : (((1.02F) * pstCurrData->stDailyPrice.ulEnd)));
    pstDealInfo->fThresholdPrice = (((FLOAT)(fThreshPrice))/(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: fPrevRise float

variable_types: fThreshPrice float

variable_types:
ulMeanPrice
unsigned long

variable_types:
bIsContinuous
unsigned short


decompiled_code:
unsigned __int64 __fastcall RISE_GetGainPrice(__int64 a1, __int64 a2)
{
unsigned int v2; // edx
unsigned int v3; // eax
float v4; // xmm0_4
unsigned __int64 result; // rax

v2 = *(_DWORD *)(a1 + 16);
v3 = *(_DWORD *)(a2 + 8);
if ( v2 < v3 )
_assert_fail("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/rise.c", 0x74u, "RISE_GetGainPrice");
if ( v2 != v3 )
{
do
a1 -= 256LL;
while ( v3 != *(_DWORD *)(a1 + 16) );
}
v4 = (float)*(int *)(a1 + 36) * 1.033;
if ( v4 >= 9.223372e18 )
result = (unsigned int)(int)(float)(v4 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v4;
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func5(__int64 a1, __int64 a2)
{
unsigned int v2; // edx
unsigned int v3; // eax
float v4; // xmm0_4
unsigned __int64 result; // rax

v2 = *(_DWORD *)(a1 + 16);
v3 = *(_DWORD *)(a2 + 8);
if ( v2 < v3 )
_assert_fail("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/rise.c", 0x74u, "RISE_GetGainPrice");
if ( v2 != v3 )
{
do
a1 -= 256LL;
while ( v3 != *(_DWORD *)(a1 + 16) );
}
v4 = (float)*(int *)(a1 + 36) * 1.033;
if ( v4 >= 9.223372e18 )
result = (unsigned int)(int)(float)(v4 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v4;
return result;
}

original_code:
ULONG RISE_GetGainPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    ULONG ulHoldDays=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/rise.c", 116, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstData--;
    }
    return (ULONG)(pstData->stDailyPrice.ulEnd * (1.033F));
}

canonical_original_code:
unsigned long RISE_GetGainPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    unsigned long ulHoldDays = 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/rise.c", 116, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstData--;
    }
    return (ULONG)(pstData->stDailyPrice.ulEnd * (1.033F));
}

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


decompiled_code:
unsigned __int64 __fastcall RISE_GetLossPrice(__int64 a1, __int64 a2)
{
unsigned int v2; // edx
unsigned int v3; // eax
float v4; // xmm0_4
unsigned __int64 result; // rax

v2 = *(_DWORD *)(a1 + 16);
v3 = *(_DWORD *)(a2 + 8);
if ( v2 < v3 )
_assert_fail("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/rise.c", 0x85u, "RISE_GetLossPrice");
if ( v2 != v3 )
{
do
a1 -= 256LL;
while ( v3 != *(_DWORD *)(a1 + 16) );
}
v4 = (float)*(int *)(a1 + 36) * 0.92299998;
if ( v4 >= 9.223372e18 )
result = (unsigned int)(int)(float)(v4 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v4;
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func6(__int64 a1, __int64 a2)
{
unsigned int v2; // edx
unsigned int v3; // eax
float v4; // xmm0_4
unsigned __int64 result; // rax

v2 = *(_DWORD *)(a1 + 16);
v3 = *(_DWORD *)(a2 + 8);
if ( v2 < v3 )
_assert_fail("pstCurrData->ulDate>=pstStockCtrl->ulBuyDate", "method/rise.c", 0x85u, "RISE_GetLossPrice");
if ( v2 != v3 )
{
do
a1 -= 256LL;
while ( v3 != *(_DWORD *)(a1 + 16) );
}
v4 = (float)*(int *)(a1 + 36) * 0.92299998;
if ( v4 >= 9.223372e18 )
result = (unsigned int)(int)(float)(v4 - 9.223372e18) ^ 0x8000000000000000LL;
else
result = (unsigned int)(int)v4;
return result;
}

original_code:
ULONG RISE_GetLossPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    ULONG ulHoldDays=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/rise.c", 133, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstData--;
    }
    return (ULONG)(pstData->stDailyPrice.ulEnd * (0.923F));
}

canonical_original_code:
unsigned long RISE_GetLossPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    unsigned long ulHoldDays = 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/rise.c", 133, __extension__ __PRETTY_FUNCTION__); }));
    while (1) {
        ulHoldDays++;
        if (pstData->ulDate==pstStockCtrl->ulBuyDate) break;
        pstData--;
    }
    return (ULONG)(pstData->stDailyPrice.ulEnd * (0.923F));
}


decompiled_code:
__int64 __fastcall RISE_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 RISE_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 RISE_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 __fastcall RISE_GetSellPrice(unsigned int *a1, __int64 a2)
{
unsigned int *v2; // rbx
__int64 v3; // rdx
unsigned __int64 v4; // rax
__int64 result; // rax
float v6; // xmm0_4
int v7; // eax

v2 = a1 + 12;
v3 = GetDateInterval(*(unsigned int *)(a2 + 8), a1[4]);
v4 = 0LL;
if ( v3 )
{
while ( v2[5] == -858993460 )
{
++v4;
v2 += 6;
if ( v4 == 8 )
return a1[6 * v4 + 3];
}
if ( v4 > 1 )
return a1[6 * v4 + 3];
result = RandomUlong(a1[8], a1[7]);
}
else
{
v6 = (float)*(int *)(a2 + 4) * 1.01;
if ( v6 >= 9.223372e18 )
v7 = (int)(float)(v6 - 9.223372e18);
else
v7 = (int)v6;
*(_DWORD *)(a2 + 4) = v7;
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(unsigned int *a1, __int64 a2)
{
unsigned int *v2; // rbx
__int64 v3; // rdx
unsigned __int64 v4; // rax
__int64 result; // rax
float v6; // xmm0_4
int v7; // eax

v2 = a1 + 12;
v3 = GetDateInterval(*(unsigned int *)(a2 + 8), a1[4]);
v4 = 0LL;
if ( v3 )
{
while ( v2[5] == -858993460 )
{
++v4;
v2 += 6;
if ( v4 == 8 )
return a1[6 * v4 + 3];
}
if ( v4 > 1 )
return a1[6 * v4 + 3];
result = RandomUlong(a1[8], a1[7]);
}
else
{
v6 = (float)*(int *)(a2 + 4) * 1.01;
if ( v6 >= 9.223372e18 )
v7 = (int)(float)(v6 - 9.223372e18);
else
v7 = (int)v6;
*(_DWORD *)(a2 + 4) = v7;
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
ULONG RISE_GetSellPrice( FILE_WHOLE_DATA_S *pstCurrData, STOCK_CTRL_S *pstStockCtrl)
{
    ULONG i;
    ULONG ulSellPrice;
    PRICE_S *pstMin30Price = pstCurrData->astMin30Price;
    if ((1) > GetDateInterval(pstStockCtrl->ulBuyDate, pstCurrData->ulDate)) {
        pstStockCtrl->ulLossPrice=(ULONG)(pstStockCtrl->ulLossPrice*1.01F);
        return (0xFFFFFFFF);
    }
    for (i=0;i<8;i++, pstMin30Price++) {
        if (0xCCCCCCCC != pstMin30Price->ulFlag) break;
    }
    if (i>1) {
        ulSellPrice = pstCurrData->astMin30Price[i-2].ulEnd;
    }
    else {
        ulSellPrice = RandomUlong(pstCurrData->stDailyPrice.ulLow, pstCurrData->stDailyPrice.ulHigh);
    }
    return ulSellPrice;
}

canonical_original_code:
unsigned long RISE_GetSellPrice(struct tagWholeData *pstCurrData, struct tagStockCtrl *pstStockCtrl)
{
    unsigned long i;
    unsigned long ulSellPrice;
    struct tagPrice *pstMin30Price = pstCurrData->astMin30Price;
    if ((1) > GetDateInterval(pstStockCtrl->ulBuyDate, pstCurrData->ulDate)) {
        pstStockCtrl->ulLossPrice=(ULONG)(pstStockCtrl->ulLossPrice*1.01F);
        return (0xFFFFFFFF);
    }
    for (i=0;i<8;i++, pstMin30Price++) {
        if (0xCCCCCCCC != pstMin30Price->ulFlag) break;
    }
    if (i>1) {
        ulSellPrice = pstCurrData->astMin30Price[i-2].ulEnd;
    }
    else {
        ulSellPrice = RandomUlong(pstCurrData->stDailyPrice.ulLow, pstCurrData->stDailyPrice.ulHigh);
    }
    return ulSellPrice;
}

variable_types:
i
unsigned long

variable_types:
ulSellPrice
unsigned long

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


GetMethod

decompiled_code:
__int64 __fastcall GetMethod(char *s1)
{
if ( !strcasecmp(s1, "rise") )
return 1LL;
if ( !strcasecmp(s1, "sma") )
return 2LL;
if ( !strcasecmp(s1, "mma") )
return 3LL;
if ( strcasecmp(s1, "oma") )
{
puts("invaild method type");
exit(2);
}
return 4LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s1)
{
if ( !strcasecmp(s1, "rise") )
return 1LL;
if ( !strcasecmp(s1, "sma") )
return 2LL;
if ( !strcasecmp(s1, "mma") )
return 3LL;
if ( strcasecmp(s1, "oma") )
{
puts("invaild method type");
exit(2);
}
return 4LL;
}

original_code:
ULONG GetMethod( CHAR* szMethod)
{
    ULONG ulMethod;
    if (0 == strcasecmp(szMethod, "rise")) {
        ulMethod = (0x0001);
    }
    else if (0 == strcasecmp(szMethod, "sma")) {
        ulMethod = (0x0002);
    }
    else if (0 == strcasecmp(szMethod, "mma")) {
        ulMethod = (0x0003);
    }
    else if (0 == strcasecmp(szMethod, "oma")) {
        ulMethod = (0x0004);
    }
    else {
        printf("invaild method type\n");
        ulMethod = (0xFFFFFFFF);
        exit(2);
    }
    return ulMethod;
}

canonical_original_code:
unsigned long GetMethod(char *szMethod)
{
    unsigned long ulMethod;
    if (0 == strcasecmp(szMethod, "rise")) {
        ulMethod = (0x0001);
    }
    else if (0 == strcasecmp(szMethod, "sma")) {
        ulMethod = (0x0002);
    }
    else if (0 == strcasecmp(szMethod, "mma")) {
        ulMethod = (0x0003);
    }
    else if (0 == strcasecmp(szMethod, "oma")) {
        ulMethod = (0x0004);
    }
    else {
        printf("invaild method type\n");
        ulMethod = (0xFFFFFFFF);
        exit(2);
    }
    return ulMethod;
}

variable_types:
szMethod
char *

variable_types:
ulMethod
unsigned long


original_code:
VOID FILE_UpdateDailyPrice( ULONG ulCode, const CHAR *szSrcDir, const CHAR *szTrgDir)
{
    ULONG i,j;
    ULONG ulSrcEntryCnt, ulOgEntryCnt, ulTrgEntryCnt;
    ULONG ulRemainingCnt;
    FILE_THS_DAILY_ENTRY_S *astDailyData = ((void *)0);
    FILE_THS_DAILY_ENTRY_S *pstDailyData = ((void *)0);
    FILE_WHOLE_DATA_S *astOgData = ((void *)0);
    FILE_WHOLE_DATA_S *pstOgData = ((void *)0);
    FILE_WHOLE_DATA_S *astWholeData = ((void *)0);
    FILE_WHOLE_DATA_S *pstWholeData = ((void *)0);
    ((void) sizeof ((((void *)0) != szSrcDir) ? 1 : 0), __extension__ ({ if (((void *)0) != szSrcDir) ; else __assert_fail ("NULL != szSrcDir", "OrgData.c", 19, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((((void *)0) != szTrgDir) ? 1 : 0), __extension__ ({ if (((void *)0) != szTrgDir) ; else __assert_fail ("NULL != szTrgDir", "OrgData.c", 20, __extension__ __PRETTY_FUNCTION__); }));
    ulSrcEntryCnt = FILE_GetFileData(ulCode, szSrcDir, 0x10000024, (VOID**)&astDailyData);
    if (0==ulSrcEntryCnt) return;
    ulOgEntryCnt = FILE_GetFileData(ulCode, szTrgDir, 0xF0000000, (VOID**)&astOgData);
    astWholeData = malloc(sizeof(FILE_WHOLE_DATA_S) * (ulSrcEntryCnt+ulOgEntryCnt));
    ((void) sizeof ((((void *)0) != astWholeData) ? 1 : 0), __extension__ ({ if (((void *)0) != astWholeData) ; else __assert_fail ("NULL != astWholeData", "OrgData.c", 30, __extension__ __PRETTY_FUNCTION__); }));
    memset(astWholeData, 0xFF, sizeof(FILE_WHOLE_DATA_S) * (ulSrcEntryCnt+ulOgEntryCnt));
    if (0 == ulOgEntryCnt) {
        astOgData = malloc(sizeof(FILE_WHOLE_DATA_S));
        ((void) sizeof ((((void *)0) != astOgData) ? 1 : 0), __extension__ ({ if (((void *)0) != astOgData) ; else __assert_fail ("NULL != astOgData", "OrgData.c", 35, __extension__ __PRETTY_FUNCTION__); }));
        memset(astOgData, 0xFF, sizeof(FILE_WHOLE_DATA_S));
    }
    pstDailyData = astDailyData;
    pstOgData = astOgData;
    pstWholeData = astWholeData;
    for (i=0,j=0;i<ulSrcEntryCnt;i++,pstDailyData++) {
        if ((0 == pstDailyData->ulDate) || ((0) == ((((pstDailyData->ulBeginWithCheck) & 0xF0000000) == (0xB0000000)) ? (1) : (0))) ||
            (0x80000000 == pstDailyData->ulVolWithCheck)) continue;
        for (;j<ulOgEntryCnt;j++) {
            if (pstDailyData->ulDate > pstOgData->ulDate) {
                memcpy(pstWholeData, pstOgData, sizeof(FILE_WHOLE_DATA_S));
                pstWholeData++;
                pstOgData++;
            }
            else {
                break;
            }
        }
        if (pstDailyData->ulDate == pstOgData->ulDate) {
            memcpy(pstWholeData, pstOgData, sizeof(FILE_WHOLE_DATA_S));
            pstOgData++;
            j++;
        }
        FILE_ThsDayToCustom(pstDailyData, pstWholeData);
        pstWholeData++;
    }
    ulRemainingCnt = ulOgEntryCnt-(pstOgData-astOgData);
    if (0 != ulRemainingCnt) {
        memcpy(pstWholeData, pstOgData, ulRemainingCnt*sizeof(FILE_WHOLE_DATA_S));
        pstWholeData += ulRemainingCnt;
    }
    ulTrgEntryCnt = pstWholeData - astWholeData;
    FILE_SetFileData(ulCode, szTrgDir, 0xF0000000, sizeof(FILE_WHOLE_DATA_S)*ulTrgEntryCnt,astWholeData);
    free(astDailyData);
    free(astOgData);
    free(astWholeData);
    return;
}

canonical_original_code:
void FILE_UpdateDailyPrice(unsigned long ulCode, char *szSrcDir, char *szTrgDir)
{
    unsigned long i; unsigned long j;
    unsigned long ulSrcEntryCnt; unsigned long ulOgEntryCnt; unsigned long ulTrgEntryCnt;
    unsigned long ulRemainingCnt;
    struct tagFileDailyData *astDailyData = ((void *)0);
    struct tagFileDailyData *pstDailyData = ((void *)0);
    struct tagWholeData *astOgData = ((void *)0);
    struct tagWholeData *pstOgData = ((void *)0);
    struct tagWholeData *astWholeData = ((void *)0);
    struct tagWholeData *pstWholeData = ((void *)0);
    ((void) sizeof ((((void *)0) != szSrcDir) ? 1 : 0), __extension__ ({ if (((void *)0) != szSrcDir) ; else __assert_fail ("NULL != szSrcDir", "OrgData.c", 19, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((((void *)0) != szTrgDir) ? 1 : 0), __extension__ ({ if (((void *)0) != szTrgDir) ; else __assert_fail ("NULL != szTrgDir", "OrgData.c", 20, __extension__ __PRETTY_FUNCTION__); }));
    ulSrcEntryCnt = FILE_GetFileData(ulCode, szSrcDir, 0x10000024, (void **)&astDailyData);
    if (0==ulSrcEntryCnt) return;
    ulOgEntryCnt = FILE_GetFileData(ulCode, szTrgDir, 0xF0000000, (void **)&astOgData);
    astWholeData = malloc(sizeof(FILE_WHOLE_DATA_S) * (ulSrcEntryCnt+ulOgEntryCnt));
    ((void) sizeof ((((void *)0) != astWholeData) ? 1 : 0), __extension__ ({ if (((void *)0) != astWholeData) ; else __assert_fail ("NULL != astWholeData", "OrgData.c", 30, __extension__ __PRETTY_FUNCTION__); }));
    memset(astWholeData, 0xFF, sizeof(FILE_WHOLE_DATA_S) * (ulSrcEntryCnt+ulOgEntryCnt));
    if (0 == ulOgEntryCnt) {
        astOgData = malloc(sizeof(FILE_WHOLE_DATA_S));
        ((void) sizeof ((((void *)0) != astOgData) ? 1 : 0), __extension__ ({ if (((void *)0) != astOgData) ; else __assert_fail ("NULL != astOgData", "OrgData.c", 35, __extension__ __PRETTY_FUNCTION__); }));
        memset(astOgData, 0xFF, sizeof(FILE_WHOLE_DATA_S));
    }
    pstDailyData = astDailyData;
    pstOgData = astOgData;
    pstWholeData = astWholeData;
    for (i=0,j=0;i<ulSrcEntryCnt;i++,pstDailyData++) {
        if ((0 == pstDailyData->ulDate) || ((0) == ((((pstDailyData->ulBeginWithCheck) & 0xF0000000) == (0xB0000000)) ? (1) : (0))) ||
            (0x80000000 == pstDailyData->ulVolWithCheck)) continue;
        for (;j<ulOgEntryCnt;j++) {
            if (pstDailyData->ulDate > pstOgData->ulDate) {
                memcpy(pstWholeData, pstOgData, sizeof(FILE_WHOLE_DATA_S));
                pstWholeData++;
                pstOgData++;
            }
            else {
                break;
            }
        }
        if (pstDailyData->ulDate == pstOgData->ulDate) {
            memcpy(pstWholeData, pstOgData, sizeof(FILE_WHOLE_DATA_S));
            pstOgData++;
            j++;
        }
        FILE_ThsDayToCustom(pstDailyData, pstWholeData);
        pstWholeData++;
    }
    ulRemainingCnt = ulOgEntryCnt-(pstOgData-astOgData);
    if (0 != ulRemainingCnt) {
        memcpy(pstWholeData, pstOgData, ulRemainingCnt*sizeof(FILE_WHOLE_DATA_S));
        pstWholeData += ulRemainingCnt;
    }
    ulTrgEntryCnt = pstWholeData - astWholeData;
    FILE_SetFileData(ulCode, szTrgDir, 0xF0000000, sizeof(FILE_WHOLE_DATA_S)*ulTrgEntryCnt,astWholeData);
    free(astDailyData);
    free(astOgData);
    free(astWholeData);
    return;
}

variable_types:
ulCode
unsigned long

variable_types:
szSrcDir
char *

variable_types:
szTrgDir
char *

variable_types:
j
unsigned long

variable_types:
ulSrcEntryCnt
unsigned long

variable_types:
ulOgEntryCnt
unsigned long

variable_types:
ulTrgEntryCnt
unsigned long

variable_types:
ulRemainingCnt
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; } *