LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: dbGetStocksFromList
sds *dbGetStocksFromList(const char *listname, int *numstocks) {
    int rows = 0;
    sds *symbols = NULL;

    /* Get the ID of the specified list, if any. */
    int64_t listid = dbGetListID(listname,0);
    if (listid == 0) return NULL;

    /* Check if a list with such name already exists. */
    sqlRow row;
    sqlSelect(&row,"SELECT symbol FROM ListStock WHERE listid=?i",listid);
    while (sqlNextRow(&row)) {
        symbols = realloc(symbols,sizeof(sds)*(rows+1));
        sds sym = sdsnew(row.col[0].s);
        symbols[rows++] = sym;
    }
    *numstocks = rows;
    return symbols;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x7efd
testq %rax, %rax
je 0x82b5
leaq 0x4af9(%rip), %rsi      # 0xcd58
xorl %r13d, %r13d
movq %rsp, %r15
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x711d
pushq $0x8
popq %r12
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x6eb5
testl %eax, %eax
je 0x82b2
leaq 0x1(%r13), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0x2488
movq %rax, %r14
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x4ef7
movq %rax, (%r14,%r13,8)
addq $0x8, %r12
movq %rbp, %r13
jmp 0x8279
movl %r13d, (%rbx)
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: dbGetStockPack
int dbGetStockPack(stockpack *sp) {
    sqlRow row;
    sqlSelect(&row,
        "SELECT rowid,quantity,avgprice FROM StockPack WHERE liststockid=?i",
        sp->stockid);

    /* Check if a list with such name already exists. */
    if (sqlNextRow(&row)) {
        sp->rowid = row.col[0].i;
        sp->quantity = row.col[1].i;
        sp->avgprice = row.col[2].d;
        sqlEnd(&row);
        return C_OK;
    } else {
        return C_ERR;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rdx
leaq 0x4aa8(%rip), %rsi      # 0xcd85
xorl %ebp, %ebp
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x711d
movq %r14, %rdi
callq 0x6eb5
testl %eax, %eax
je 0x8324
leaq 0x8(%rsp), %rdi
movq 0x10(%rdi), %rax
movq 0x8(%rax), %rcx
movq %rcx, (%rbx)
movq 0x28(%rax), %rcx
movq %rcx, 0x10(%rbx)
movsd 0x58(%rax), %xmm0
movsd %xmm0, 0x18(%rbx)
callq 0x6e8f
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: dbUpdateStockPack
int dbUpdateStockPack(stockpack *sp) {
    if (sp->rowid == 0) {
        sp->rowid = sqlInsert(
            "INSERT INTO StockPack VALUES(?i,?i,?d)",
            sp->stockid, sp->quantity, sp->avgprice);
        return sp->rowid == 0 ? C_ERR : C_OK;
    } else if (sp->quantity > 0) {
        int done = sqlQuery("UPDATE StockPack SET quantity=?i,avgprice=?d "
                             "WHERE rowid=?i",
                             sp->quantity,sp->avgprice,sp->rowid);
        return done ? C_OK : C_ERR;
    } else {
        int done = sqlQuery("DELETE FROM StockPack WHERE rowid=?i",sp->rowid);
        return done ? C_OK : C_ERR;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdx
testq %rdx, %rdx
je 0x8358
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
jle 0x8382
movsd 0x18(%rbx), %xmm0
leaq 0x4a9f(%rip), %rdi      # 0xcdef
movb $0x1, %al
popq %rbx
jmp 0x7083
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movsd 0x18(%rbx), %xmm0
leaq 0x4a5c(%rip), %rdi      # 0xcdc8
movb $0x1, %al
callq 0x6fd7
movslq %eax, %rcx
movq %rcx, (%rbx)
xorl %eax, %eax
testl %ecx, %ecx
setne %al
popq %rbx
retq
leaq 0x4aa2(%rip), %rdi      # 0xce2b
movq %rdx, %rsi
xorl %eax, %eax
popq %rbx
jmp 0x7083
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: dbBuyStocks
int dbBuyStocks(const char *listname, const char *symbol, double price, int quantity, stockpack *spp) {
    /* Sanity check. */
    if (quantity <= 0) return C_ERR;

    /* Create the list and its stock. */
    int64_t listid = dbGetListID(listname,1);
    if (listid == 0) return C_ERR;
    int stockid = dbAddStockToList(listname,symbol);
    if (stockid == 0) return C_ERR;

    /* Check if a pack exists for this stock, in order to adjust
     * quantity and price. */
    stockpack sp;
    sp.rowid = 0;
    sp.stockid = stockid;
    if (dbGetStockPack(&sp)) {
        double totprice = (sp.avgprice * sp.quantity) + (price * quantity);
        sp.quantity += quantity;
        sp.avgprice = totprice / sp.quantity;
    } else {
        sp.quantity = quantity;
        sp.avgprice = price;
    }
    int retval = dbUpdateStockPack(&sp);
    if (spp && retval == C_OK) *spp = sp;
    return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
xorl %ebp, %ebp
testl %edx, %edx
jle 0x8474
movq %rcx, %rbx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
movsd %xmm0, 0x8(%rsp)
pushq $0x1
popq %rsi
callq 0x7efd
testq %rax, %rax
je 0x8474
movq %r12, %rdi
movq %r15, %rsi
callq 0x81ed
testl %eax, %eax
je 0x8474
leaq 0x10(%rsp), %rdi
andq $0x0, (%rdi)
cltq
movq %rax, 0x8(%rdi)
callq 0x82c7
testl %eax, %eax
je 0x8430
movq 0x20(%rsp), %rax
cvtsi2sd %rax, %xmm0
cvtsi2sd %r14d, %xmm1
mulsd 0x8(%rsp), %xmm1
mulsd 0x28(%rsp), %xmm0
addsd %xmm1, %xmm0
movl %r14d, %ecx
addq %rax, %rcx
movq %rcx, 0x20(%rsp)
cvtsi2sd %rcx, %xmm1
divsd %xmm1, %xmm0
jmp 0x843e
movl %r14d, %eax
movq %rax, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x832f
movl %eax, %ebp
testq %rbx, %rbx
setne %al
testl %ebp, %ebp
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8474
leaq 0x10(%rsp), %rsi
movl $0x90, %edx
movq %rbx, %rdi
callq 0x21e0
movl %ebp, %eax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: dbSellStocks
int dbSellStocks(const char *listname, const char *symbol, int quantity, double sellprice, const char *csym, stockpack *sp) {
    /* Sanity check. */
    if (quantity < 0) return C_ERR;

    sp->quantity = 0; /* Whatever happens, don't return a negative value
                         if not on purpose. */

    /* Lookup the stock ID in that list. */
    int64_t stockid = dbGetStockID(listname,symbol);
    if (stockid == 0) {
        sp->quantity = -quantity;
        return C_ERR;
    }

    /* Fetch the stock. */
    sp->stockid = stockid;
    if (dbGetStockPack(sp) == C_ERR) {
        sp->quantity = -quantity;
        return C_ERR;
    }
    if (quantity == 0) quantity = sp->quantity;

    /* Finally update. */
    sp->quantity -= quantity;
    if (sp->quantity < 0) return C_ERR; /* Not enough stocks. */

    /* Create a profit and loss entry with this selling. */
    int64_t listid = dbGetListID(listname,0);
    if (listid) {
        sqlInsert("INSERT INTO ProfitLoss VALUES(?s,?i,?i,?i,?d,?d,?s)",
            symbol, listid, (int64_t)time(NULL), quantity, sp->avgprice,
            sellprice, csym);
    }

    return dbUpdateStockPack(sp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
testl %edx, %edx
js 0x8543
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
andq $0x0, 0x10(%r8)
callq 0x7f3f
testq %rax, %rax
je 0x853a
movq %rax, 0x8(%rbx)
movq %rbx, %rdi
callq 0x82c7
testl %eax, %eax
je 0x853a
testl %ebp, %ebp
movq 0x10(%rbx), %rax
movl %eax, %r13d
cmovnel %ebp, %r13d
movslq %r13d, %rcx
subq %rcx, %rax
movq %rax, 0x10(%rbx)
js 0x8543
movq %r12, %rdi
xorl %esi, %esi
callq 0x7efd
testq %rax, %rax
je 0x8524
movq %rax, %r12
xorl %edi, %edi
callq 0x2210
movsd 0x18(%rbx), %xmm0
leaq 0x4947(%rip), %rdi      # 0xce50
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
movl %r13d, %r8d
movsd (%rsp), %xmm1
movq %r14, %r9
movb $0x2, %al
callq 0x6fd7
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x832f
negl %ebp
movslq %ebp, %rax
movq %rax, 0x10(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: dbDestroyList
void dbDestroyList(const char *listname) {
    int64_t listid = dbGetListID(listname,0);
    if (listid == 0) return;
    sqlQuery("DELETE FROM StockPack WHERE liststockid IN (SELECT rowid FROM ListStock WHERE listid=?i)",listid);
    sqlQuery("DELETE FROM ListStock WHERE listid=?i",listid);
    sqlQuery("DELETE FROM ProfitLoss WHERE listid=?i",listid);
    sqlQuery("DELETE FROM Lists WHERE rowid=?i",listid);
}

// Assembly:
pushq %rbx
xorl %esi, %esi
callq 0x7efd
testq %rax, %rax
je 0x85a9
movq %rax, %rbx
leaq 0x4919(%rip), %rdi      # 0xce84
movq %rax, %rsi
xorl %eax, %eax
callq 0x7083
leaq 0x4961(%rip), %rdi      # 0xcedd
movq %rbx, %rsi
xorl %eax, %eax
callq 0x7083
leaq 0x4976(%rip), %rdi      # 0xcf03
movq %rbx, %rsi
xorl %eax, %eax
callq 0x7083
leaq 0x498c(%rip), %rdi      # 0xcf2a
movq %rbx, %rsi
xorl %eax, %eax
popq %rbx
jmp 0x7083
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: checkYahooTimeSeriesValidity
int checkYahooTimeSeriesValidity(ydata *yd, int maxperc) {
    int nulls = 0;
    for (int j = 0; j < yd->ts_len; j++)
        nulls += yd->ts_data[j] == 0;
    return (nulls > yd->ts_len/maxperc) ? C_ERR : C_OK;
}

// Assembly:
movl 0x78(%rdi), %eax
xorl %ecx, %ecx
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
xorps %xmm0, %xmm0
xorl %r8d, %r8d
cmpq %rcx, %rdx
je 0x85e4
movq 0x80(%rdi), %r9
movss (%r9,%rcx,4), %xmm1
cmpeqss %xmm0, %xmm1
movd %xmm1, %r9d
subl %r9d, %r8d
incq %rcx
jmp 0x85c0
cltd
idivl %esi
xorl %ecx, %ecx
cmpl %eax, %r8d
setle %cl
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: botHandlePriceRequest
void botHandlePriceRequest(botRequest *br, sds symbol) {
    ydata *yd = getYahooData(YDATA_QUOTE,symbol,NULL,NULL,15);
    sds reply = sdsCatPriceRequest(sdsempty(),symbol,yd,0);
    freeYahooData(yd);
    botSendMessage(br->target,reply,0);
    sdsfree(reply);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0xf
popq %r8
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7676
movq %rax, %r15
callq 0x4ee9
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x88de
movq %rax, %rbx
movq %r15, %rdi
callq 0x75e4
movq 0x8(%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x7cae
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4f65
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: botHandleInfoRequest
void botHandleInfoRequest(botRequest *br, sds symbol) {
    ydata *yd = getYahooData(YDATA_INFO,symbol,NULL,NULL,3600);
    sds reply = NULL;
    if (yd == NULL) {
        reply = sdscatprintf(sdsempty(),
            "Stock symbol %s not found.", symbol);
    } else {
        unsigned int maxsum = 500;
        sds summary = yd->summary ? sdsdup(yd->summary) : sdsnew("No summary.");
        if (sdslen(summary) > maxsum) {
            sdsrange(summary,0,maxsum-1);
            sdscat(summary,"...");
        }
        char *exdivdate = yd->exdivdate;
        if (exdivdate == NULL || strlen(exdivdate) == 0)
            exdivdate = "No date for next dividend.";
        reply = sdscatprintf(sdsempty(),
            "*%s* (%s)\n\n"
            "_%s_\n\n"
            "last dividend %% of current price: %.2f%% / year\n"
            "next dividend ex-date: %s\n"
            ,yd->name,
            yd->industry ? yd->industry : "unknown industry",
            summary,
            yd->lastdiv/yd->reg*100*4,
            exdivdate);
        sdsfree(summary);
    }
    freeYahooData(yd);
    botSendMessage(br->target,reply,0);
    sdsfree(reply);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x2
popq %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xe10, %r8d            # imm = 0xE10
callq 0x7676
movq %rax, %r14
testq %rax, %rax
je 0x8b9b
movq 0xc8(%r14), %rdi
testq %rdi, %rdi
je 0x8bbc
callq 0x4f18
jmp 0x8bc8
callq 0x4ee9
leaq 0x450d(%rip), %rsi      # 0xd0b4
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5814
movq %rax, %r12
jmp 0x8c76
leaq 0x450c(%rip), %rdi      # 0xd0cf
callq 0x4ef7
movq %rax, %r15
movq %rax, %rdi
callq 0x8c9f
cmpq $0x1f5, %rax            # imm = 0x1F5
jb 0x8bf9
movl $0x1f3, %edx            # imm = 0x1F3
movq %r15, %rdi
xorl %esi, %esi
callq 0x5c53
leaq 0x4f83(%rip), %rsi      # 0xdb74
movq %r15, %rdi
callq 0x5593
movq 0xf0(%r14), %r12
testq %r12, %r12
je 0x8c0c
cmpb $0x0, (%r12)
jne 0x8c13
leaq 0x44c8(%rip), %r12      # 0xd0db
callq 0x4ee9
movq 0x10(%r14), %rdx
movq 0xd8(%r14), %rsi
testq %rsi, %rsi
leaq 0x4526(%rip), %rcx      # 0xd153
cmovneq %rsi, %rcx
movsd 0xe8(%r14), %xmm0
cvtss2sd 0x20(%r14), %xmm1
divsd %xmm1, %xmm0
mulsd 0x377c(%rip), %xmm0     # 0xc3c8
mulsd 0x3784(%rip), %xmm0     # 0xc3d8
leaq 0x449b(%rip), %rsi      # 0xd0f6
movq %rax, %rdi
movq %r15, %r8
movq %r12, %r9
movb $0x1, %al
callq 0x5814
movq %rax, %r12
movq %r15, %rdi
callq 0x4f65
movq %r14, %rdi
callq 0x75e4
movq 0x8(%rbx), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x7cae
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f65
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: botHandleTrendRequest
void botHandleTrendRequest(botRequest *br, sds symbol) {
    sds reply = NULL;
    ydata *yd = getYahooData(YDATA_TS,symbol,"5y","1d",3600);
    if (yd == NULL || yd->ts_len < 253) {
        reply = sdscatprintf(sdsempty(),
            "Can't fetch enough historical data for '%s'.",symbol);
        goto cleanup;
    }
    mcres mcvl, mclong, mcshort, mcvs;
    computeMontecarlo(yd,253*5,1000,5,&mcvl);
    computeMontecarlo(yd,253,1000,5,&mclong);
    computeMontecarlo(yd,60,1000,5,&mcshort);
    computeMontecarlo(yd,20,1000,5,&mcvs);

    reply = sdscatprintf(sdsempty(),
            "```\n"
            "%s Montecarlo analysis trend, 5 days buy/sell period.\n"
            "  5y: %-8.2f%% (+-%.2f%%)\n"
            "  1y: %-8.2f%% (+-%.2f%%)\n"
            "  3m: %-8.2f%% (+-%.2f%%)\n"
            "  1m: %-8.2f%% (+-%.2f%%)\n"
            "```"
            ,symbol,
            mcvl.gain, mcvl.absdiff,
            mclong.gain, mclong.absdiff,
            mcshort.gain, mcshort.absdiff,
            mcvs.gain, mcvs.absdiff);

cleanup:
    if (reply) botSendMessage(br->target,reply,0);
    freeYahooData(yd);
    sdsfree(reply);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x3ac5(%rip), %rdx      # 0xd1aa
leaq 0x2f0a(%rip), %rcx      # 0xc5f6
pushq $0x1
popq %rdi
movl $0xe10, %r8d            # imm = 0xE10
callq 0x7676
movq %rax, %r14
testq %rax, %rax
je 0x970c
cmpl $0xfc, 0x78(%r14)
jg 0x972a
callq 0x4ee9
leaq 0x3f21(%rip), %rsi      # 0xd639
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5814
jmp 0x97e4
pushq $0x5
popq %rbp
leaq 0x38(%rsp), %r8
movq %r14, %rdi
movl $0x4f1, %esi            # imm = 0x4F1
movl $0x3e8, %edx            # imm = 0x3E8
movl %ebp, %ecx
callq 0x85f2
leaq 0x8(%rsp), %r8
movq %r14, %rdi
movl $0xfd, %esi
movl $0x3e8, %edx            # imm = 0x3E8
movl %ebp, %ecx
callq 0x85f2
pushq $0x3c
popq %rsi
leaq 0x98(%rsp), %r12
movq %r14, %rdi
movl $0x3e8, %edx            # imm = 0x3E8
movl %ebp, %ecx
movq %r12, %r8
callq 0x85f2
pushq $0x14
popq %rsi
leaq 0x68(%rsp), %r13
movq %r14, %rdi
movl $0x3e8, %edx            # imm = 0x3E8
movl %ebp, %ecx
movq %r13, %r8
callq 0x85f2
callq 0x4ee9
leaq 0x38(%rsp), %rcx
movsd (%rcx), %xmm0
movsd 0x18(%rcx), %xmm1
leaq 0x8(%rsp), %rcx
movsd (%rcx), %xmm2
movsd 0x18(%rcx), %xmm3
movsd (%r12), %xmm4
movsd 0x18(%r12), %xmm5
movsd (%r13), %xmm6
movsd 0x18(%r13), %xmm7
leaq 0x3e8f(%rip), %rsi      # 0xd666
movq %rax, %rdi
movq %r15, %rdx
movb $0x8, %al
callq 0x5814
movq %rax, %r15
testq %rax, %rax
je 0x97fa
movq 0x8(%rbx), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x7cae
movq %r14, %rdi
callq 0x75e4
movq %r15, %rdi
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f65
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: parseQuantityAndPrice
void parseQuantityAndPrice(const char *str, int64_t *quantity, double *price, double curprice) {
    /* Parse the quantity@price argument if available. */
    sds copy = sdsnew(str);
    char *p = strchr(copy,'@');
    if (p) {
        *price = strtod(p+1,NULL);
        curprice = *price;
    } else {
        p = copy+sdslen(copy); /* Make p always point at char next of
                                  quantity, that is '@' or the null term
                                  if no price was specified. */
    }
    if (curprice && *(p-1)  == '$') {
        *(p-1) = 0;
        int64_t money = strtoll(copy,NULL,10);
        *quantity = money/curprice;
    } else {
        *quantity = strtoll(copy,NULL,10);
    }
    sdsfree(copy);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
movq %rdx, %r12
movq %rsi, %rbx
callq 0x4ef7
movq %rax, %r14
pushq $0x40
popq %rsi
movq %rax, %rdi
callq 0x20f0
testq %rax, %rax
je 0x985e
movq %rax, %r15
movq %rax, %rdi
incq %rdi
xorl %esi, %esi
callq 0x21c0
movsd %xmm0, (%r12)
jmp 0x9871
movq %r14, %rdi
callq 0x8c9f
movq %r14, %r15
addq %rax, %r15
movsd (%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x987d
jnp 0x98ac
cmpb $0x24, -0x1(%r15)
jne 0x98ac
movb $0x0, -0x1(%r15)
pushq $0xa
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
movsd %xmm0, (%rsp)
callq 0x2060
cvtsi2sd %rax, %xmm0
divsd (%rsp), %xmm0
cvttsd2si %xmm0, %rax
jmp 0x98b9
pushq $0xa
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2060
movq %rax, (%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f65
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: sdsTimeAgo
sds sdsTimeAgo(time_t attime) {
    double t = time(NULL) - attime;
    char *unit;
    int fraction = 0; /* Use fractional part. >= hours. */
    if (t >= 3600*24*365) {
        t /= 3600*24*365;
        unit = "year";
        fraction = 1;
    } else if (t >= 3600*24*30) {
        t /= 3600*24*30;
        unit = "month";
        fraction = 1;
    } else if (t >= 3600*24) {
        t /= 3600*24;
        unit = "day";
        fraction = 1;
    } else if (t >= 3600) {
        t /= 3600;
        unit = "hour";
        fraction = 1;
    } else if (t >= 60) {
        t /= 60;
        unit = "minute";
    } else {
        unit = "second";
    }

    sds s;
    if (fraction)
        s = sdscatprintf(sdsempty(),"%.1f %s", t, unit);
    else
        s = sdscatprintf(sdsempty(),"%ld %s", (long)t, unit);
    if (t > 1) s = sdscat(s,"s"); /* Pluralize if needed. */
    return s;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorl %edi, %edi
callq 0x2210
subq %rbx, %rax
cvtsi2sd %rax, %xmm1
cmpq $0x1e1337f, %rax        # imm = 0x1E1337F
jle 0xa2ee
leaq 0x372c(%rip), %rbx      # 0xda10
movsd 0x212c(%rip), %xmm0     # 0xc418
jmp 0xa337
cmpq $0x278cff, %rax         # imm = 0x278CFF
jle 0xa307
leaq 0x3718(%rip), %rbx      # 0xda15
movsd 0x211b(%rip), %xmm0     # 0xc420
jmp 0xa337
cmpq $0x1517f, %rax          # imm = 0x1517F
jle 0xa320
leaq 0x3705(%rip), %rbx      # 0xda1b
movsd 0x210a(%rip), %xmm0     # 0xc428
jmp 0xa337
cmpq $0xe0f, %rax            # imm = 0xE0F
jle 0xa38a
leaq 0x36f0(%rip), %rbx      # 0xda1f
movsd 0x20f9(%rip), %xmm0     # 0xc430
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
callq 0x4ee9
leaq 0x36e5(%rip), %rsi      # 0xda32
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdx
movb $0x1, %al
callq 0x5814
movsd 0x8(%rsp), %xmm0
ucomisd 0x20d2(%rip), %xmm0     # 0xc440
jbe 0xa384
leaq 0x36c8(%rip), %rsi      # 0xda3f
movq %rax, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0x5593
addq $0x10, %rsp
popq %rbx
retq
cmpq $0x3c, %rax
jl 0xa398
divsd 0x20a0(%rip), %xmm1     # 0xc438
movsd %xmm1, 0x8(%rsp)
leaq 0x367f(%rip), %rax      # 0xda24
leaq 0x367f(%rip), %rbx      # 0xda2b
cmovgeq %rax, %rbx
callq 0x4ee9
cvttsd2si 0x8(%rsp), %rdx
leaq 0x3677(%rip), %rsi      # 0xda3a
movq %rax, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x5814
jmp 0xa360
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: botHandleLsRequest
void botHandleLsRequest(botRequest *br) {
    sds listnames = sdsnew("Existing lists: ");
    sqlRow row;
    sqlSelect(&row,"SELECT name FROM Lists");
    int rows = 0;
    while(sqlNextRow(&row)) {
        listnames = sdscat(listnames,row.col[0].s);
        listnames = sdscat(listnames,", ");
        rows++;
    }
    if (rows) {
        sdsrange(listnames,0,-3);
        listnames = sdscat(listnames,".");
    }
    sqlEnd(&row);
    botSendMessage(br->target,listnames,0);
    sdsfree(listnames);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x340c(%rip), %rdi      # 0xdb26
callq 0x4ef7
movq %rax, %r14
leaq 0x340e(%rip), %rsi      # 0xdb37
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x711d
leaq 0x31f8(%rip), %r12      # 0xd939
movq %r15, %rdi
callq 0x6eb5
testl %eax, %eax
je 0xa770
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rsi
movq %r14, %rdi
callq 0x5593
movq %rax, %rdi
movq %r12, %rsi
callq 0x5593
movq %rax, %r14
decl %ebp
jmp 0xa741
testl %ebp, %ebp
je 0xa793
pushq $-0x3
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x5c53
leaq 0x2e6c(%rip), %rsi      # 0xd5f4
movq %r14, %rdi
callq 0x5593
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6e8f
movq 0x8(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x7cae
movq %r14, %rdi
callq 0x4f65
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: botUpdateActiveChannels
void botUpdateActiveChannels(int64_t id) {
    for (int i = 0; i < ActiveChannelsCount; i++) {
        if (ActiveChannels[i] == id) {
            /* Channel already in the list of active channels.
             * Update the last activity time. */
            ActiveChannelsLast[i] = time(NULL);
            return;
        }
    }
    /* Not found, add it. */
    ActiveChannels[ActiveChannelsCount] = id;
    ActiveChannelsLast[ActiveChannelsCount] = time(NULL);
    ActiveChannelsCount++;
}

// Assembly:
pushq %rbx
leaq 0x867e(%rip), %rax      # 0x13300
xorl %ebx, %ebx
movslq 0x864d(%rip), %rcx      # 0x132d8
cmpq %rcx, %rbx
jge 0xacb4
movq (%rax), %rcx
incq %rbx
addq $0x8, %rax
cmpq %rdi, %rcx
jne 0xac84
xorl %edi, %edi
callq 0x2210
leaq 0x8853(%rip), %rcx      # 0x13500
xchgq %rax, -0x8(%rcx,%rbx,8)
jmp 0xace1
leaq 0x8645(%rip), %rax      # 0x13300
xchgq %rdi, (%rax,%rcx,8)
xorl %edi, %edi
callq 0x2210
movslq 0x860b(%rip), %rcx      # 0x132d8
leaq 0x882c(%rip), %rdx      # 0x13500
xchgq %rax, (%rdx,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x85f7(%rip)      # 0x132d8
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: loadFile
sds *loadFile(char *filename, int *count, int shuffle) {
    FILE *fp = fopen(filename,"r");
    if (fp == NULL) return NULL;

    char buf[1024];
    sds *lines = NULL;
    int num = 0;
    while (fgets(buf,sizeof(buf),fp) != NULL) {
        buf[sizeof(buf)-1] = '\0';
        for (unsigned int i = 0; buf[i] && i < sizeof(buf); i++) {
            if (buf[i] == '\r' || buf[i] == '\n') {
                buf[i] = 0;
                break;
            }
        }
        lines = xrealloc(lines,sizeof(sds)*(num+1));
        lines[num++] = sdsnew(buf);
    }
    fclose(fp);

    /* Shuffle them: since we don't store the symbols in a database,
     * we want to start scanning them in different order at every
     * restart. */
    for (int j = 0; shuffle && j < num; j++) {
        int with = rand() % num;
        sds aux = lines[j];
        lines[j] = lines[with];
        lines[with] = aux;
    }

    if (VerboseMode) printf("%s loaded (%d lines)\n", filename, num);
    *count = num;
    return lines;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1412(%rip), %rsi      # 0xc3a4
callq 0x22e0
testq %rax, %rax
je 0xb07f
movq %rax, %r13
movl %ebp, 0x4(%rsp)
movq %rbx, 0x8(%rsp)
xorl %ebp, %ebp
leaq 0x10(%rsp), %rbx
xorl %r12d, %r12d
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r13, %rdx
callq 0x23f0
testq %rax, %rax
je 0xb024
movb $0x0, 0x40f(%rsp)
xorl %eax, %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xaffc
movb 0x10(%rsp,%rax), %cl
testb %cl, %cl
je 0xaffc
movzbl %cl, %ecx
cmpl $0xd, %ecx
je 0xaff7
cmpl $0xa, %ecx
je 0xaff7
incq %rax
jmp 0xafd5
movb $0x0, 0x10(%rsp,%rax)
leaq 0x1(%rbp), %r15
leaq 0x8(,%rbp,8), %rsi
movq %r12, %rdi
callq 0x6591
movq %rax, %r12
movq %rbx, %rdi
callq 0x4ef7
movq %rax, (%r12,%rbp,8)
movq %r15, %rbp
jmp 0xafb6
movq %r13, %rdi
callq 0x2280
cmpl $0x0, 0x4(%rsp)
je 0xb05a
xorl %ebx, %ebx
cmpq %rbx, %rbp
je 0xb05a
callq 0x20d0
cltd
idivl %ebp
movq (%r12,%rbx,8), %rax
movslq %edx, %rcx
movq (%r12,%rcx,8), %rdx
movq %rdx, (%r12,%rbx,8)
movq %rax, (%r12,%rcx,8)
incq %rbx
jmp 0xb035
cmpl $0x0, 0x8253(%rip)      # 0x132b4
je 0xb076
leaq 0x3421(%rip), %rdi      # 0xe48b
movq %r14, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2030
movq 0x8(%rsp), %rax
movl %ebp, (%rax)
jmp 0xb082
xorl %r12d, %r12d
movq %r12, %rax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: cvThread
void *cvThread(void *arg) {
    DbHandle = dbInit(0);
    UNUSED(arg);
    while(1) {
        ydata *yd = getYahooData(YDATA_QUOTE,"EURUSD=X",NULL,NULL,0);
        if (yd) EURUSD = yd->reg;
        freeYahooData(yd);
        sleep(10);
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
xorl %edi, %edi
callq 0x7e27
movq %rax, %fs:-0x8
leaq 0x3018(%rip), %rbx      # 0xe629
pushq $0xa
popq %rbp
xorl %edi, %edi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x7676
testq %rax, %rax
je 0xb63b
cvtss2sd 0x20(%rax), %xmm0
movq %xmm0, %rcx
xchgq %rcx, 0x7c8d(%rip)      # 0x132c8
movq %rax, %rdi
callq 0x75e4
movl %ebp, %edi
callq 0x21a0
jmp 0xb614
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: broadcastBigMovers
void broadcastBigMovers(void) {
    sds reply = genBigMoversMessage(20);
    for (int j = 0; j < ActiveChannelsCount; j++) {
        botSendMessage(ActiveChannels[j],reply,0);
    }
    sdsfree(reply);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
pushq $0x14
popq %rdi
callq 0x8d06
movq %rax, %rbx
leaq 0x7c7f(%rip), %r14      # 0x13300
xorl %r15d, %r15d
movslq 0x7c4d(%rip), %rax      # 0x132d8
cmpq %rax, %r15
jge 0xb6a6
movq (%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x7cae
incq %r15
addq $0x8, %r14
jmp 0xb684
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4f65
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: fortuneThread
void *fortuneThread(void *arg) {
    UNUSED(arg);
    time_t lastbcast = time(NULL);
    time_t mindelay = 3600; /* Min time between fortune broadcasting. */
    time_t minact = 60*5; /* Min time elapsed since last channel activity. */

    while(1) {
        sleep(1);
        if (time(NULL)-lastbcast < mindelay) continue;
        sds quote = Fortune[rand() % NumFortune];
        for (int j = 0; j < ActiveChannelsCount; j++) {
            /* Skip channels that are idle right now. This is useful both
             * to give a sense of liveness to the bot, that talks when
             * others are talking, than to avoid notifications at night
             * when other users are otherwise silent. */
            if (time(NULL)-ActiveChannelsLast[j] > minact) continue;
            botSendMessage(ActiveChannels[j],quote,0);
        }
        lastbcast = time(NULL);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $0x1
popq %rbx
leaq 0x7d29(%rip), %r15      # 0x13500
leaq 0x7b22(%rip), %r12      # 0x13300
xorl %edi, %edi
callq 0x2210
movq %rax, %r14
movl %ebx, %edi
callq 0x21a0
xorl %edi, %edi
callq 0x2210
subq %r14, %rax
cmpq $0xe10, %rax            # imm = 0xE10
jl 0xb7e8
movq 0x7f20(%rip), %r14      # 0x13728
callq 0x20d0
cltd
idivl 0x7f1c(%rip)            # 0x13730
movslq %edx, %rax
movq (%r14,%rax,8), %r14
xorl %r13d, %r13d
xorl %ebp, %ebp
movslq 0x7ab1(%rip), %rax      # 0x132d8
cmpq %rax, %rbp
jge 0xb7de
xorl %edi, %edi
callq 0x2210
movq (%r13,%r15), %rcx
subq %rcx, %rax
cmpq $0x12c, %rax            # imm = 0x12C
jg 0xb852
movq (%r13,%r12), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x7cae
incq %rbp
addq $0x8, %r13
jmp 0xb820
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: startBackgroundTasks
void startBackgroundTasks(void) {
    pthread_t tid;

    /* Autolists thread. */
    if (Symbols && AutoListsMode) {
        if (pthread_create(&tid,NULL,scanStocksThread,NULL) != 0) {
            printf("Can't create the thread to scan stocks "
                   "on the background\n");
            exit(1);
        }
    }

    /* Cached valuations thread. */
    if (pthread_create(&tid,NULL,cvThread,NULL) != 0) {
        printf("Can't the cached values thread\n");
        exit(1);
    }

#if 0
    /* Big movers periodic message. */
    if (pthread_create(&tid,NULL,bigMoversThread,NULL) != 0) {
        printf("Can't the big movers thread\n");
        exit(1);
    }
#endif

    /* Fortune thread. */
    if (pthread_create(&tid,NULL,fortuneThread,NULL) != 0) {
        printf("Can't the big movers thread\n");
        exit(1);
    }
}

// Assembly:
pushq %rax
cmpq $0x0, 0x7e9c(%rip)      # 0x13700
je 0xb886
cmpl $0x0, 0x79fb(%rip)      # 0x13268
je 0xb886
leaq -0x7df(%rip), %rdx      # 0xb097
movq %rsp, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x2450
testl %eax, %eax
jne 0xb8c8
leaq -0x296(%rip), %rdx      # 0xb5f7
movq %rsp, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x2450
testl %eax, %eax
jne 0xb8b6
leaq -0xe2(%rip), %rdx       # 0xb7c2
movq %rsp, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x2450
testl %eax, %eax
jne 0xb8bf
popq %rax
retq
leaq 0x2f5e(%rip), %rdi      # 0xe81b
jmp 0xb8cf
leaq 0x2f39(%rip), %rdi      # 0xe7ff
jmp 0xb8cf
leaq 0x2f6b(%rip), %rdi      # 0xe83a
callq 0x23d0
pushq $0x1
popq %rdi
callq 0x2300
// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: readApiKeyFromFile
void readApiKeyFromFile(void) {
    FILE *fp = fopen("apikey.txt","r");
    if (fp == NULL) return;
    char buf[1024];
    if (fgets(buf,sizeof(buf),fp) == NULL) {
        fclose(fp);
        return;
    }
    buf[sizeof(buf)-1] = '\0';
    fclose(fp);
    sdsfree(BotApiKey);
    BotApiKey = sdsnew(buf);
    BotApiKey = sdstrim(BotApiKey," \t\r\n");
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
leaq 0x2d7e(%rip), %rdi      # 0xe69b
leaq 0xa80(%rip), %rsi       # 0xc3a4
callq 0x22e0
testq %rax, %rax
je 0xb994
movq %rax, %rbx
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x23f0
testq %rax, %rax
je 0xb98c
movq %rsp, %r14
movb $0x0, 0x3ff(%r14)
movq %rbx, %rdi
callq 0x2280
movq 0x7960(%rip), %rdi      # 0x132c0
callq 0x4f65
movq %r14, %rdi
callq 0x4ef7
movq %rax, 0x794c(%rip)      # 0x132c0
leaq 0x2d2b(%rip), %rsi      # 0xe6a6
movq %rax, %rdi
callq 0x5bb1
movq %rax, 0x7936(%rip)      # 0x132c0
jmp 0xb994
movq %rbx, %rdi
callq 0x2280
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: set_dev_string_rw
int set_dev_string_rw(const char *pk, const char *dn, const char *value)
{
    int index;
    
    if (strlen(value) > 2048) {
        return LE_ERROR_PARAM_RANGE_OVERFLOW;
    }

    index = get_device_index(pk, dn);
    snprintf(g_devices[index].string_rw, sizeof(g_devices[index].string_rw), "%s", value);
    return LE_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdx, %rdi
callq 0x1130
movl $0x186a7, %r14d         # imm = 0x186A7
cmpq $0x800, %rax            # imm = 0x800
ja 0x16d1
movq %r15, %rsi
callq 0x137c
movq 0x3be9(%rip), %rcx      # 0x5290
cltq
imulq $0x10a8, %rax, %rax     # imm = 0x10A8
leaq (%rcx,%rax), %rdi
addq $0x62, %rdi
leaq 0x1981(%rip), %rdx      # 0x3040
xorl %r14d, %r14d
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: set_dev_date_rw
int set_dev_date_rw(const char *pk, const char *dn, const char *value)
{
    int index;
    
    if (strlen(value) > 32) {
        return LE_ERROR_PARAM_RANGE_OVERFLOW;
    }

    index = get_device_index(pk, dn);
    snprintf(g_devices[index].date_rw, sizeof(g_devices[index].date_rw), "%s", value);
    return LE_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdx, %rdi
callq 0x1130
movl $0x186a7, %r14d         # imm = 0x186A7
cmpq $0x20, %rax
ja 0x179f
movq %r15, %rsi
callq 0x137c
movq 0x3b1c(%rip), %rcx      # 0x5290
cltq
imulq $0x10a8, %rax, %rax     # imm = 0x10A8
leaq (%rcx,%rax), %rdi
addq $0x1062, %rdi           # imm = 0x1062
leaq 0x18b1(%rip), %rdx      # 0x3040
xorl %r14d, %r14d
pushq $0x20
popq %rsi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: get_property_enum
int get_property_enum(const char *name)
{
   int i = E_PROPERTY_INVALID, count;

   count = sizeof(g_property_string_enum_map) / sizeof(property_string_enum_map_t);

   for(i = 0; i < count; i++) {
       if (0 == strcmp(g_property_string_enum_map[i].property_string, name)) {
           break;
       }
   }
   return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
leaq 0x390c(%rip), %r15      # 0x5154
xorl %r12d, %r12d
pushq $0xf
popq %rbx
cmpq $0xf, %r12
je 0x186f
movq %r15, %rdi
movq %r14, %rsi
callq 0x11d0
testl %eax, %eax
je 0x186c
incq %r12
addq $0x14, %r15
jmp 0x184e
movl %r12d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: send_signal_property_changed
void send_signal_property_changed(const char *pk, const char *dn)
{
   int i;
   
   snprintf(g_property_changed_pk, sizeof(g_property_changed_pk), "%s", pk);
   snprintf(g_property_changed_dn, sizeof(g_property_changed_dn), "%s", dn);
   pthread_mutex_lock(&g_property_monitor_locker);
   pthread_cond_signal(&g_cond_property_changed);
   pthread_mutex_unlock(&g_property_monitor_locker);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %rcx
leaq 0x3ac2(%rip), %rdi      # 0x5350
leaq 0x17ab(%rip), %r14      # 0x3040
pushq $0x10
popq %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1050
leaq 0x3ab7(%rip), %rdi      # 0x5360
pushq $0x20
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x39e0(%rip), %rbx      # 0x52a0
movq %rbx, %rdi
callq 0x1260
leaq 0x3a21(%rip), %rdi      # 0x52f0
callq 0x10a0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1270
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: report_all_event
void report_all_event(const char *pk, const char *dn)
{
    leda_device_data_t event_output[1] = {0};

    snprintf(event_output[0].key, MAX_PARAM_NAME_LENGTH, PROPERTY_INT32_RW);
    event_output[0].type = LEDA_TYPE_INT;
    snprintf(event_output[0].value, MAX_PARAM_VALUE_LENGTH, "%d", get_dev_int32_rw(pk, dn));
    leda_report_event(pk, dn, EVENT_INT32, event_output, 1);
    
    snprintf(event_output[0].key, MAX_PARAM_NAME_LENGTH, PROPERTY_FLOAT_RW);
    event_output[0].type = LEDA_TYPE_FLOAT;
    snprintf(event_output[0].value, MAX_PARAM_VALUE_LENGTH, "%f", get_dev_float_rw(pk, dn));
    leda_report_event(pk, dn, EVENT_FLOAT, event_output, 1);
    
    snprintf(event_output[0].key, MAX_PARAM_NAME_LENGTH, PROPERTY_STRING_RW);
    event_output[0].type = LEDA_TYPE_TEXT;
    snprintf(event_output[0].value, MAX_PARAM_VALUE_LENGTH, "%s", get_dev_string_rw(pk, dn));
    leda_report_event(pk, dn, EVENT_STRING, event_output, 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x848, %rsp            # imm = 0x848
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x870(%rbp), %r14
xorl %r12d, %r12d
movl $0x844, %edx            # imm = 0x844
movq %r14, %rdi
xorl %esi, %esi
callq 0x1040
movabsq $0x77725f3233746e69, %rax # imm = 0x77725F3233746E69
movq %rax, 0x4(%r14)
movb %r12b, 0xc(%r14)
leaq -0x82c(%rbp), %r12
movq %rbx, %rsi
callq 0x13d2
leaq 0x1721(%rip), %rdx      # 0x305c
movl $0x800, %esi            # imm = 0x800
movq %r12, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x1050
leaq 0x170c(%rip), %rdx      # 0x305f
pushq $0x1
popq %r13
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
movl %r13d, %r8d
callq 0x1140
movabsq $0x77725f74616f6c66, %rax # imm = 0x77725F74616F6C66
movq %rax, -0x40(%r12)
xorl %eax, %eax
movb %al, -0x38(%r12)
movl $0x2, -0x44(%r12)
movq %rbx, %rsi
callq 0x144d
cvtss2sd %xmm0, %xmm0
leaq 0x16da(%rip), %rdx      # 0x3074
movl $0x800, %esi            # imm = 0x800
movq %r12, %rdi
movb $0x1, %al
callq 0x1050
leaq 0x16c7(%rip), %rdx      # 0x3077
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
movl %r13d, %r8d
callq 0x1140
movabsq $0x725f676e69727473, %rax # imm = 0x725F676E69727473
movq %rax, -0x40(%r12)
movw $0x77, -0x38(%r12)
movl $0x3, -0x44(%r12)
movq %rbx, %rsi
callq 0x1650
leaq 0x1650(%rip), %rdx      # 0x3040
movl $0x800, %esi            # imm = 0x800
movq %r12, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x1684(%rip), %rdx      # 0x308d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
movl %r13d, %r8d
callq 0x1140
addq $0x848, %rsp            # imm = 0x848
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: property_monitor
void *property_monitor(void *arg)
{
    leda_device_data_t property[1] = {0};

    pthread_detach(pthread_self());
    
    while (g_running) {
        pthread_mutex_lock(&g_property_monitor_locker);
        pthread_cond_wait(&g_cond_property_changed, &g_property_monitor_locker);
        report_all_property(g_property_changed_pk, g_property_changed_dn);
        memset(g_property_changed_pk, 0, sizeof(g_property_changed_pk));
        memset(g_property_changed_dn, 0, sizeof(g_property_changed_dn));
        pthread_mutex_unlock(&g_property_monitor_locker);
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
callq 0x1170
movq %rax, %rdi
callq 0x11c0
leaq 0x3443(%rip), %rbx      # 0x52a0
leaq 0x348c(%rip), %r14      # 0x52f0
leaq 0x34e5(%rip), %r15      # 0x5350
leaq 0x34ee(%rip), %r12      # 0x5360
cmpl $0x0, 0x3403(%rip)      # 0x527c
je 0x1ebb
movq %rbx, %rdi
callq 0x1260
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1210
movq %r15, %rdi
movq %r12, %rsi
callq 0x1a2c
xorps %xmm0, %xmm0
movaps %xmm0, 0x34ad(%rip)     # 0x5350
movaps %xmm0, 0x34b6(%rip)     # 0x5360
movaps %xmm0, 0x34bf(%rip)     # 0x5370
movq %rbx, %rdi
callq 0x1270
jmp 0x1e72
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: thread_online
void* thread_online(void *arg)
{
    int count, i, ret;
    char *pk, *dn;
    
    pthread_detach(pthread_self());
    prctl(PR_SET_NAME, "online", NULL, NULL, NULL);

    count = g_devices_count;
    
    while (g_running) {
        pthread_mutex_lock(&g_mtx_online);
        pthread_cond_wait(&g_cond_conn_state_changed, &g_mtx_online);
        for (i = 0; i < count; i++) {
            if (g_is_connected) {
                ret = leda_online(g_devices[i].pk, g_devices[i].dn);
                if (LE_SUCCESS == ret) {
                    g_devices[i].online = 1;
                }
            } else {
                g_devices[i].online = 0; 
            }
        }
        pthread_mutex_unlock(&g_mtx_online);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x1170
movq %rax, %rdi
callq 0x11c0
leaq 0x1200(%rip), %rsi      # 0x3127
xorl %ebx, %ebx
pushq $0xf
popq %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x10c0
movl 0x3358(%rip), %eax      # 0x5298
testl %eax, %eax
cmovlel %ebx, %eax
imulq $0x10a8, %rax, %r15     # imm = 0x10A8
leaq 0x3375(%rip), %rbx      # 0x52c8
leaq 0x33c6(%rip), %r14      # 0x5320
pushq $0x1
popq %r12
cmpl $0x0, 0x3317(%rip)      # 0x527c
je 0x1fcc
movq %rbx, %rdi
callq 0x1260
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1210
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x1fc2
cmpl $0x0, 0x33f7(%rip)      # 0x5380
movq 0x3300(%rip), %rdi      # 0x5290
je 0x1fb2
leaq (%rdi,%r13), %rsi
addq $0x10, %rsi
addq %r13, %rdi
callq 0x11b0
testl %eax, %eax
jne 0x1fb9
movq 0x32e3(%rip), %rdi      # 0x5290
movl %r12d, %eax
jmp 0x1fb4
xorl %eax, %eax
movl %eax, 0x30(%rdi,%r13)
addq $0x10a8, %r13           # imm = 0x10A8
jmp 0x1f7d
movq %rbx, %rdi
callq 0x1270
jmp 0x1f5e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: thread_report
void *thread_report(void *arg) {
    int count, i;
    char *pk, *dn;

    pthread_detach(pthread_self());
    prctl(PR_SET_NAME, "report", NULL, NULL, NULL);
    
    count = g_devices_count;
    
    while (g_running) {
        for (i = 0; i < count; i++) {
            pk = g_devices[i].pk;
            dn = g_devices[i].dn;
            if (g_devices[i].online == 1) {
                report_all_event(pk, dn);
                report_all_property(pk, dn);
            }
            usleep(5*1000000/count);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x1170
movq %rax, %rdi
callq 0x11c0
leaq 0x1131(%rip), %rsi      # 0x312e
xorl %ebx, %ebx
pushq $0xf
popq %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x10c0
movl 0x3281(%rip), %r15d     # 0x5298
testl %r15d, %r15d
cmovgl %r15d, %ebx
imulq $0x10a8, %rbx, %r12     # imm = 0x10A8
cmpl $0x0, 0x3250(%rip)      # 0x527c
je 0x2080
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x2025
movq 0x3253(%rip), %rbx      # 0x5290
cmpl $0x1, 0x30(%rbx,%r13)
jne 0x2066
leaq (%rbx,%r13), %r14
addq $0x10, %r14
addq %r13, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a2c
movl $0x4c4b40, %eax         # imm = 0x4C4B40
xorl %edx, %edx
idivl %r15d
movl %eax, %edi
callq 0x1180
addq $0x10a8, %r13           # imm = 0x10A8
jmp 0x2031
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/test/linux/simulated_device.c
// Function: cb_call_service
static int cb_call_service(const char *pk, const char *dn, const char *method_name, const leda_device_data_t *input, int count, 
                            leda_device_data_t *output, void *usr)
{
    int i, ret = LE_ERROR_UNKNOWN;
    
    if (!method_name || !output) {
        return LE_ERROR_INVAILD_PARAM;
    }
    if (0 == strcmp(SERVICE_WRITE, method_name)) {
        ret = cb_set_property(pk, dn, input, count, NULL);
    } else {
        ret = LEDA_ERROR_SERVICE_NOT_EXIST;
    }

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rsi, %r15
testq %rdx, %rdx
sete %cl
testq %r9, %r9
sete %sil
movl $0x186a1, %eax          # imm = 0x186A1
orb %cl, %sil
jne 0x29be
movl %r8d, %ebx
leaq 0x820(%rip), %rdi       # 0x31cb
movq %rdx, %rsi
callq 0x11d0
movl %eax, %ecx
movl $0x1a9cd, %eax          # imm = 0x1A9CD
testl %ecx, %ecx
je 0x29c9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rsi
movq %r14, %rdx
movl %ebx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x27ea
// File: /workspace/github_c_makefile_star2_O2/MartinNovotny25[P]VUT-FIT-IFJ2020/tokenList.c
// Function: TDLLPrintAllTokens
void TDLLPrintAllTokens(TDLList *L) {
    printf("tokenList: Printing all tokens from DL list...\n\n");
    TDLLFirst(L);
    
    while (L->Act != NULL) {                          //while prechadza listom
        printf("typ   %d\n", L->Act->tdata.type);
        if (L->Act->tdata.type == t_EOF) {
            printf("lexem EOF\n\n");
        } else {
            if (L->Act->tdata.type == t_EOL) {
                printf("lexem EOL\n\n");
            } else {
                printf("lexem %s\n\n", L->Act->tdata.lex);
            }
        }
        
        TDLLSucc(L);                                //presun aktivity na nasledujuci token
    }
    printf("tokenList: Printing Ended Succesfully...\n");
    TDLLFirst(L);                                      //aktivita sa vrati na zaciatok
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x6dfa(%rip), %rdi      # 0x8019
callq 0x1050
leaq 0x6dd9(%rip), %r14      # 0x8004
leaq 0x6e40(%rip), %r15      # 0x8072
leaq 0x6e44(%rip), %r12      # 0x807d
leaq 0x6dce(%rip), %r13      # 0x800e
movq %rbx, %rax
movq (%rax), %rcx
movq %rcx, 0x8(%rbx)
testq %rcx, %rcx
je 0x129d
movl 0x8(%rcx), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl $0x2f, %ecx
je 0x1272
cmpl $0x1d, %ecx
jne 0x127c
movq %r12, %rdi
jmp 0x1275
movq %r15, %rdi
callq 0x1050
jmp 0x1289
movq (%rax), %rsi
movq %r13, %rdi
xorl %eax, %eax
callq 0x1070
movq 0x8(%rbx), %rax
movl $0x0, %ecx
testq %rax, %rax
je 0x124a
addq $0x18, %rax
jmp 0x1243
leaq 0x6da5(%rip), %rdi      # 0x8049
callq 0x1050
movq (%rbx), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/MartinNovotny25[P]VUT-FIT-IFJ2020/tokenList.c
// Function: TDLLDisposeList
void TDLLDisposeList (TDLList *L) {

    TDLLElemPtr tmp = L->First;             //tmp ukazuje na prvy prvok
    while (L->First != NULL) {              //zoznam nie je prazdny
        L->First = L->First->rptr;          //cyklus posuva ukazatel First do prava a uvolnuje pamat prvku pred nim
        free(tmp);
        tmp = L->First;
    }
    L->First = NULL;                        //ukazatele zoznamu nastavi na NULL
    L->Last = NULL;
    L->Act = NULL;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x12fa
movq 0x18(%rdi), %rax
movq %rax, (%rbx)
callq 0x1030
jmp 0x12e4
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
popq %rbx
retq