LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/eric-lo[P]3150/4-ProcessKernel/time_example.c
// Function: main
int main(int argc, char **argv) {
	int i, is_printf;
	double x = 0;

	if(argc != 2) {
		print_usage(argv[0]);
		exit(1);
	}

	is_printf = atoi(argv[1]);
	if(is_printf != 0 && is_printf != 1) {
		print_usage(argv[0]);
		exit(1);
	}

	for(i = 1; i <= 1000000; i++) {
		x += i;
		if(is_printf == 1)
			printf("x = %.0f\n", x);
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
cmpl $0x2, %edi
jne 0x120f
movq 0x8(%r14), %rdi
callq 0x1050
cmpl $0x1, %eax
ja 0x120f
movl %eax, %ebx
xorpd %xmm0, %xmm0
movsd 0xe55(%rip), %xmm1      # 0x2008
movl $0xf4240, %ebp          # imm = 0xF4240
leaq 0xe94(%rip), %r14       # 0x2053
movapd %xmm1, %xmm2
subl $0x1, %ebp
jb 0x1204
addsd %xmm2, %xmm0
cmpl $0x1, %ebx
jne 0x11fe
movq %r14, %rdi
movsd %xmm0, (%rsp)
movsd (%rsp), %xmm0
movb $0x1, %al
movsd %xmm2, 0x8(%rsp)
callq 0x1030
movsd 0x8(%rsp), %xmm2
movsd 0xe0f(%rip), %xmm1      # 0x2008
movsd (%rsp), %xmm0
addsd %xmm1, %xmm2
jmp 0x11c3
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq (%r14), %rdi
callq 0x116c
pushq $0x1
popq %rdi
callq 0x1060
// File: /workspace/github_c_makefile_star2_O2/agl[P]obstcp/curve25519/donna/smult.c
// Function: fsum
static void
fsum(felem *output, const felem *in) {
  output[0] = output[0] + in[0];
  output[1] = output[1] + in[1];
  output[2] = output[2] + in[2];
  output[3] = output[3] + in[3];
  output[4] = output[4] + in[4];
}

// Assembly:
movq (%rsi), %rax
addq %rax, (%rdi)
movq 0x8(%rsi), %rax
addq %rax, 0x8(%rdi)
movq 0x10(%rsi), %rax
addq %rax, 0x10(%rdi)
movq 0x18(%rsi), %rax
addq %rax, 0x18(%rdi)
movq 0x20(%rsi), %rax
addq %rax, 0x20(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/wtakuo[P]SVM/test2.c
// Function: vmtest
void vmtest (int n, vm_mode_t trace) {
    int codelen = sizeof(code)/sizeof(Bcode);
    Function f = new_function(1, 0, code + 10, codelen - 10);
    gv[0] = (Value)n;
    gv[1] = (Value)f;

    vm(code, codelen, vs_base, VS_SIZE, gv, GV_SIZE, trace);

    delete_function(f);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movl %edi, %ebp
leaq 0x286f(%rip), %rdx      # 0x407a
pushq $0x1
popq %rdi
pushq $0x15
popq %rcx
xorl %esi, %esi
callq 0x1578
movq %rax, %r14
leaq 0x284e(%rip), %rdi      # 0x4070
movslq %ebp, %rax
movq %rax, 0x2874(%rip)      # 0x40a0
leaq 0x286d(%rip), %r8       # 0x40a0
movq %r14, 0x286e(%rip)      # 0x40a8
movl %ebx, (%rsp)
leaq 0x309c(%rip), %rdx      # 0x48e0
pushq $0x1f
popq %rsi
pushq $0x8
popq %r9
movl $0x100, %ecx            # imm = 0x100
callq 0x11bc
movq %r14, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x15c8
// File: /workspace/github_c_makefile_star2_O2/ramirezsebas[P]TP-LISTINGS/./src/capitulo_3/3.4/fork-exec.c
// Function: spawn(char*, char**)
int spawn (char* program, char** arg_list)
	{
	pid_t child_pid;
	/* Duplicate this process. */
	child_pid = fork ();
	if (child_pid != 0)
	/* This is the parent process. */
	return child_pid;
	else {
		/* Now execute PROGRAM, searching for it in the path. */
		execvp (program, arg_list);
		/* The execvp function returns only if an error occurs. */
		fprintf (stderr, "an error occurred in execvp\n");
		abort ();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1030
testl %eax, %eax
je 0x1197
popq %rbx
popq %r14
popq %rbp
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1050
movq 0x2e37(%rip), %rax      # 0x3fe0
movq (%rax), %rcx
leaq 0xe51(%rip), %rdi       # 0x2004
pushq $0x1c
popq %rsi
pushq $0x1
popq %rdx
callq 0x1070
callq 0x1040
// File: /workspace/github_c_makefile_star2_O2/ramirezsebas[P]TP-LISTINGS/./src/capitulo_3/3.4/fork-exec.c
// Function: main
int main ()
{
	/* The argument list to pass to the "ls" command. */
	char* arg_list[] = {
		"ls", /* argv[0], the name of the program. */
		"-l",
		"/",
		NULL  /* The argument list must end with a NULL. */
	};
	/* Spawn a child process running the "ls" command. Ignore the returned child process ID. */
	spawn ("ls", arg_list);
	printf ("done with main program\n");
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movaps 0x2bde(%rip), %xmm0     # 0x3db0
leaq -0x20(%rbp), %rsi
movaps %xmm0, 0x10(%rsi)
movaps 0x2bbf(%rip), %xmm0     # 0x3da0
movaps %xmm0, (%rsi)
leaq 0xe36(%rip), %rdi       # 0x2021
callq 0x117c
leaq 0xe32(%rip), %rdi       # 0x2029
callq 0x1060
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: changeState(Thread*, char, bool)
void changeState(struct Thread* t, char statebit, bool op){
    char truebit = statebit;

    if(op){ // add a state
        if(t->state & truebit){} // already has the state
        else
            t->state += truebit;
    }else{
        if(t->state & truebit)
            t->state -= truebit;
        else{} // already lose the state
    }
}

// Assembly:
movb (%rdi), %al
testl %edx, %edx
je 0xd2e8
testb %sil, %al
je 0xd2f2
retq
testb %sil, %al
je 0xd2e7
subb %sil, %al
jmp 0xd2f5
addb %sil, %al
movb %al, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_resolve_state[abi:cxx11](char)
string unq_resolve_state(char state){
    string ret = "";
    
    ret += state & NORMAL_DISPLAY ? "Normal," : "Deleted,";
    ret += state & MAIN_THREAD ? "Thread," : "";
    ret += state & THREAD_REPLY ? "Reply," : "";
    ret += state & SAGE_THREAD ? "Sage," : "";
    ret += state & LOCKED_THREAD ? "Locked," : "";

    return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x5a346(%rip), %r14     # 0x67652
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0xcb10
testb $0x1, %bpl
leaq 0x53ce8(%rip), %rax     # 0x6100c
leaq 0x53cd9(%rip), %rsi     # 0x61004
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0xc7d0
testb $0x4, %bpl
leaq 0x53cd3(%rip), %rsi     # 0x61015
cmoveq %r14, %rsi
movq %rbx, %rdi
callq 0xc7d0
testb $0x2, %bpl
leaq 0x53cc4(%rip), %rsi     # 0x6101d
cmoveq %r14, %rsi
movq %rbx, %rdi
callq 0xc7d0
testb $0x10, %bpl
leaq 0x53cb4(%rip), %rsi     # 0x61024
cmoveq %r14, %rsi
movq %rbx, %rdi
callq 0xc7d0
testb %bpl, %bpl
leaq 0x53ca4(%rip), %rsi     # 0x6102a
cmovnsq %r14, %rsi
movq %rbx, %rdi
callq 0xc7d0
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0xcd88
movq %r14, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_reset(unqlite*)
int unq_reset(unqlite *pDb){
    int rc = unq_write_int(pDb, "global_counter", 0, true);
    if (!rc) return 0;

    //construct the root thread
    cclong *key = new cclong(0);
    struct Thread *t = new Thread();
    t->threadID = 0;
    //t->state = 'r';
    t->nextThread = 0;
    t->childCount = 0;

    strcpy(t->content, "slogan");

    rc = unqlite_kv_store(pDb, key, 4, t, sizeof(struct Thread));
    if (rc != UNQLITE_OK)
        return 0;
    else{
        unqlite_commit(pDb);
        return 1;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x53c6f(%rip), %rsi     # 0x61032
xorl %r14d, %r14d
pushq $0x1
popq %rbp
xorl %edx, %edx
movl %ebp, %ecx
callq 0xd447
testl %eax, %eax
je 0xd43b
pushq $0x4
popq %rdi
callq 0xc1f0
movq %rax, %r15
andl $0x0, (%rax)
movl $0xd0, %edi
callq 0xc1f0
movq %rax, %r12
xorl %r14d, %r14d
movl $0xd0, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0xc370
movl $0x676f6c73, 0x1(%r12)  # imm = 0x676F6C73
movl $0x6e6167, 0x4(%r12)    # imm = 0x6E6167
pushq $0x4
popq %rdx
movl $0xd0, %r8d
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x2a435
testl %eax, %eax
jne 0xd43b
movq %rbx, %rdi
callq 0x2b666
movl %ebp, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_write_int(unqlite*, char const*, int, bool)
int unq_write_int(unqlite *pDb, const char* key, int value, bool autoCommit){
    int* zzz = new cclong(value);
    int rc;
    rc = unqlite_kv_store(pDb, key, -1, zzz, 4);
    delete zzz;

    if (rc != UNQLITE_OK)
        return 0;
    else{
        if(autoCommit) unqlite_commit(pDb);
        return 1;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x4
popq %r12
movq %r12, %rdi
callq 0xc1f0
movq %rax, %r13
movl %r14d, (%rax)
pushq $-0x1
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rcx
movq %r12, %r8
callq 0x2a435
movl %eax, %r14d
movq %r13, %rdi
callq 0xc660
xorl %eax, %eax
testl %r14d, %r14d
sete %cl
andb %cl, %bpl
cmpb $0x1, %bpl
jne 0xd4ac
movq %rbx, %rdi
callq 0x2b666
pushq $0x1
popq %rax
jmp 0xd4ae
movb %cl, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_thread_parent(unqlite*, Thread*)
int unq_thread_parent(unqlite *pDb, struct Thread* b){
    // struct Thread* b = unq_read_thread(pDb, startID);
    int startID = b->threadID;
    if (!(b->state & NORMAL_DISPLAY)) return -1;
    if (b->state & MAIN_THREAD) return 0;
    if (b->parentThread) return b->parentThread;

    while (b->nextThread != startID){
        b = unq_read_thread(pDb, b->nextThread);
        if (b->parentThread) return b->parentThread;
    }

    return 0;
}

// Assembly:
movzbl (%rsi), %ecx
testb $0x1, %cl
jne 0xd4ca
pushq $-0x1
popq %rcx
jmp 0xd512
testb $0x4, %cl
jne 0xd506
movq %rsi, %rax
movl 0xc8(%rsi), %ecx
testl %ecx, %ecx
jne 0xd512
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xb8(%rax), %ebp
movl 0xbc(%rax), %esi
cmpl %ebp, %esi
je 0xd50a
movq %rbx, %rdi
callq 0xd515
movl 0xc8(%rax), %ecx
testl %ecx, %ecx
je 0xd4e8
jmp 0xd50c
xorl %ecx, %ecx
jmp 0xd512
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %rbp
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_read_thread(unqlite*, int)
struct Thread* unq_read_thread(unqlite *pDb, int key){
    unqlite_int64 nBytes = sizeof(struct Thread);
    // cclong *k = new cclong(key);
    int k = key;

    int rc;
    struct Thread* zBuf = new Thread();

    rc = unqlite_kv_fetch(pDb, &k, 4, zBuf, &nBytes);
    
    // delete k;
    //even the fetch function failed, we return an empty structure

    return zBuf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
movq $0xd0, (%r14)
leaq 0xc(%rsp), %r15
movl %esi, (%r15)
movl $0xd0, %edi
callq 0xc1f0
movq %rax, %r12
movl $0xd0, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0xc370
pushq $0x4
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rcx
movq %r14, %r8
callq 0x2aa1d
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_delete_thread(unqlite*, int)
int unq_delete_thread(unqlite *pDb, int tid){
    // cchan will never truely delete a thread, it just hides it
    struct Thread* t = unq_read_thread(pDb, tid);
    struct Thread* tp = unq_read_thread(pDb, t->prevThread);
    struct Thread* tn = unq_read_thread(pDb, t->nextThread);

    if (!(t->state & NORMAL_DISPLAY)) return 0;

    if (t->parentThread == 0 && t->state & MAIN_THREAD){
        tn->prevThread = t->prevThread;
        tp->nextThread = t->nextThread;

        if (t->prevThread == t->nextThread){
            //this happens only if the thread has one child reply
            tn->nextThread = tn->threadID;
            unq_write_thread(pDb, tn->threadID, tn, false);
        }
        else{
            unq_write_thread(pDb, tn->threadID, tn, false);
            unq_write_thread(pDb, tp->threadID, tp, false);
        }

        //t->state = 'd';
        //t->state -= NORMAL_DISPLAY;
        changeState(t, NORMAL_DISPLAY, false);
        unq_write_thread(pDb, t->threadID, t, false);
    }

    if (!(t->state & MAIN_THREAD)){
        changeState(t, NORMAL_DISPLAY, false);
        unq_write_thread(pDb, t->threadID, t, false);
    }

    unqlite_commit(pDb);

    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0xd515
movq %rax, %r14
movl 0xc0(%rax), %esi
movq %rbx, %rdi
callq 0xd515
movq %rax, %r15
movl 0xbc(%r14), %esi
movq %rbx, %rdi
callq 0xd515
movb (%r14), %dl
xorl %ecx, %ecx
testb $0x1, %dl
je 0xd66c
testb $0x4, %dl
je 0xd63e
cmpl $0x0, 0xc8(%r14)
jne 0xd63e
movl 0xc0(%r14), %ecx
movl %ecx, 0xc0(%rax)
movl 0xbc(%r14), %edx
movl %edx, 0xbc(%r15)
movl 0xb8(%rax), %esi
cmpl %edx, %ecx
jne 0xd5fa
movl %esi, 0xbc(%rax)
movq %rbx, %rdi
movq %rax, %rdx
jmp 0xd614
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0xd674
movl 0xb8(%r15), %esi
movq %rbx, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0xd674
movb (%r14), %al
testb $0x1, %al
je 0xd627
decb %al
movb %al, (%r14)
movl 0xb8(%r14), %esi
movq %rbx, %rdi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xd674
movb (%r14), %dl
testb $0x4, %dl
jne 0xd661
testb $0x1, %dl
je 0xd64d
decb %dl
movb %dl, (%r14)
movl 0xb8(%r14), %esi
movq %rbx, %rdi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xd674
movq %rbx, %rdi
callq 0x2b666
pushq $0x1
popq %rcx
movl %ecx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_write_thread(unqlite*, int, Thread*, bool)
int unq_write_thread(unqlite *pDb, cclong key, struct Thread* t, bool autoCommit){
    
    int k = key;
    int rc;
    rc = unqlite_kv_store(pDb, &k, 4, t, sizeof(struct Thread));

    if (rc != UNQLITE_OK)
        return 0;
    else{
        if (autoCommit) unqlite_commit(pDb);
        return 1;
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rcx
movq %rdi, %rbx
leaq 0x4(%rsp), %rax
movl %esi, (%rax)
pushq $0x4
popq %rdx
movl $0xd0, %r8d
movq %rax, %rsi
callq 0x2a435
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
sete %cl
andb %cl, %bpl
cmpb $0x1, %bpl
jne 0xd6b6
movq %rbx, %rdi
callq 0x2b666
pushq $0x1
popq %rax
jmp 0xd6b8
movb %cl, %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_write_string(unqlite*, char const*, char const*, bool)
int unq_write_string(unqlite *pDb, const char* key, const char* value, bool autoCommit){
    int rc;
    rc = unqlite_kv_store_fmt(pDb, key, -1, value); //simple
    if (rc != UNQLITE_OK)
        return 0;
    else{
        if (autoCommit) unqlite_commit(pDb);
        return 1;
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rcx
movq %rdi, %rbx
pushq $-0x1
popq %rdx
xorl %eax, %eax
callq 0x2a581
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
sete %cl
andb %cl, %bpl
cmpb $0x1, %bpl
jne 0xd8a0
movq %rbx, %rdi
callq 0x2b666
pushq $0x1
popq %rax
jmp 0xd8a2
movb %cl, %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: displayReply(unqlite*, Thread*)
int displayReply(unqlite *pDb, struct Thread *t){
    cclong ct = t->childThread;
    struct Thread *r = unq_read_thread(pDb, ct); // beginning of the circle
    cclong rid = r->threadID; //the ID

    struct tm * timeinfo;
    timeinfo = localtime(&(r->date));
    fprintf(stdout, "  %d Reply(s)\n", r->childCount);
    fprintf(stdout, "  Reply-ID: %d, Author: %s, Date: %s  %s\n", rid, r->author, asctime(timeinfo), unq_read_string(pDb, r->content));

    while (r->prevThread != rid){
        r = unq_read_thread(pDb, r->prevThread);
        timeinfo = localtime(&(r->date));
        fprintf(stdout, "  Reply-ID: %d, Author: %s, Date: %s  %s\n", r->threadID, r->author, asctime(timeinfo), unq_read_string(pDb, r->content));
    }

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0xc4(%rsi), %esi
callq 0xd515
movq %rax, %r14
movl 0xb8(%rax), %ebp
leaq 0xa0(%rax), %rdi
callq 0xc7a0
movq %rax, %r15
movq 0x79335(%rip), %r12     # 0x86fa8
movq (%r12), %rdi
movl 0xcc(%r14), %edx
leaq 0x533bc(%rip), %rsi     # 0x61041
xorl %eax, %eax
callq 0xc260
movq (%r12), %r12
leaq 0x11(%r14), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
callq 0xc520
movq %rax, %r13
movq %r14, %rsi
incq %rsi
movq %rbx, %rdi
callq 0xdd4d
leaq 0x53397(%rip), %rsi     # 0x61050
movq %r12, %rdi
movl %ebp, 0xc(%rsp)
movl %ebp, %edx
movq 0x10(%rsp), %rcx
movq %r13, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0xc260
movl 0xc0(%r14), %esi
cmpl 0xc(%rsp), %esi
je 0xdd3b
movq %rbx, %rdi
callq 0xd515
movq %rax, %r14
leaq 0xa0(%rax), %rdi
callq 0xc7a0
movq 0x792a9(%rip), %rcx     # 0x86fa8
movq (%rcx), %r12
movl 0xb8(%r14), %r13d
leaq 0x11(%r14), %r15
movq %rax, %rdi
callq 0xc520
movq %rax, %rbp
movq %r14, %rsi
incq %rsi
movq %rbx, %rdi
callq 0xdd4d
movq %r12, %rdi
leaq 0x53320(%rip), %rsi     # 0x61050
movl %r13d, %edx
movq %r15, %rcx
movq %rbp, %r8
jmp 0xdcca
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_read_string(unqlite*, char const*)
const char* unq_read_string(unqlite *pDb, const char* key){
    unqlite_int64 nBytes;
    int rc;
    rc = unqlite_kv_fetch(pDb, key, -1, NULL, &nBytes);
    if (rc != UNQLITE_OK)
        return 0;

    char *zBuf = new char[++nBytes];
    if (zBuf == NULL) 
        return 0;

    rc = unqlite_kv_fetch(pDb, key, -1, zBuf, &nBytes);
    if (rc != UNQLITE_OK)
        return 0;

    zBuf[nBytes] = 0;

    return zBuf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
xorl %ebx, %ebx
pushq $-0x1
popq %rdx
movq %rsp, %r8
xorl %ecx, %ecx
callq 0x2aa1d
testl %eax, %eax
jne 0xddb4
movq %rsp, %r12
movq (%r12), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%r12)
cmpq $-0x1, %rax
pushq $-0x1
popq %rdi
cmovgeq %rcx, %rdi
callq 0xc560
movq %rax, %rbx
pushq $-0x1
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rcx
movq %r12, %r8
callq 0x2aa1d
testl %eax, %eax
je 0xddac
xorl %ebx, %ebx
jmp 0xddb4
movq (%rsp), %rax
movb $0x0, (%rbx,%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: listThread(unqlite*)
int listThread(unqlite *pDb){
    struct Thread *r = unq_read_thread(pDb, 0); // get the root thread
    //iterThread(pDb, r);

    while (r->nextThread){
        r = unq_read_thread(pDb, r->nextThread);

        struct tm * timeinfo;
        timeinfo = localtime(&(r->date));
        fprintf(stdout, "ID: %d, Author: %s, Date: %s%s\n", r->threadID, r->author, asctime(timeinfo), unq_read_string(pDb, r->content));

        if (r->childThread) displayReply(pDb, r);
    }

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0xd515
movq %rax, %r15
movl 0xbc(%r15), %esi
testl %esi, %esi
je 0xde5f
movq %rbx, %rdi
callq 0xd515
movq %rax, %r15
leaq 0xa0(%rax), %rdi
callq 0xc7a0
movq 0x791a4(%rip), %rcx     # 0x86fa8
movq (%rcx), %r12
movl 0xb8(%r15), %ebp
leaq 0x11(%r15), %r13
movq %rax, %rdi
callq 0xc520
movq %rax, %r14
leaq 0x1(%r15), %rsi
movq %rbx, %rdi
callq 0xdd4d
movq %r12, %rdi
leaq 0x53247(%rip), %rsi     # 0x6107a
movl %ebp, %edx
movq %r13, %rcx
movq %r14, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0xc260
cmpl $0x0, 0xc4(%r15)
je 0xdddb
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdc38
jmp 0xdddb
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_read_int(unqlite*, int)
int unq_read_int(unqlite *pDb, int key){
    unqlite_int64 nBytes = 4;
    int *k = new int(key);
    int rc;
    int* zBuf = new int(0);

    rc = unqlite_kv_fetch(pDb, k, 4, zBuf, &nBytes);
    delete k;

    // if (rc != UNQLITE_OK)
    //  return 0;

    return *zBuf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movq %rdi, %r14
leaq 0x8(%rsp), %r15
movq $0x4, (%r15)
pushq $0x4
popq %r12
movq %r12, %rdi
callq 0xc1f0
movq %rax, %r13
movl %ebx, (%rax)
movq %r12, %rdi
callq 0xc1f0
movq %rax, %rbx
andl $0x0, (%rax)
pushq $0x4
popq %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rcx
movq %r15, %r8
callq 0x2aa1d
movq %r13, %rdi
callq 0xc660
movl (%rbx), %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/general.cpp
// Function: unq_read_thread_sp(unqlite*, int)
std::shared_ptr<struct Thread> unq_read_thread_sp(unqlite * pDb, int key)
{
    unqlite_int64 nBytes = sizeof(struct Thread);
    std::shared_ptr<struct Thread> ret = std::shared_ptr<struct Thread>(new Thread());

    unqlite_kv_fetch(pDb, &key, 4, ret.get(), &nBytes);

    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4(%rsp), %r15
movl %edx, (%r15)
leaq 0x8(%rsp), %r12
movq $0xd0, (%r12)
movl $0xd0, %edi
callq 0xc1f0
movq %rax, %r13
movl $0xd0, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0xc370
movq %rbx, %rdi
movq %r13, %rsi
callq 0xdfec
movq (%rbx), %rcx
pushq $0x4
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %r8
callq 0x2aa1d
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
addq $0x8, %rbx
movq %rbx, %rdi
callq 0xdf66
movq %r14, %rdi
callq 0xc790
nop
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: is_assist[abi:cxx11](mg_connection*)
string is_assist(mg_connection* conn){
    string ssid = cck_extract_ssid(conn);
    for(auto x = assist_cookie.begin(); x != assist_cookie.end(); ++x){
        // cout << x->first << "," << x->second << "," << ssid << endl;
        if(x->second == ssid) return x->first;
    }

    return string("");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xe0b8
leaq 0x79b35(%rip), %r12     # 0x87c68
movq 0x18(%r12), %r15
addq $0x8, %r12
cmpq %r12, %r15
je 0xe15e
leaq 0x40(%r15), %rdi
movq %r14, %rsi
callq 0x1000c
testb %al, %al
jne 0xe174
movq %r15, %rdi
callq 0xcae0
movq %rax, %r15
jmp 0xe13c
leaq 0x594ed(%rip), %rsi     # 0x67652
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0xcb10
jmp 0xe183
addq $0x20, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc640
leaq 0x8(%rsp), %rdi
callq 0xcd88
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xe19e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xcd88
movq %rbx, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cck_send_ssid(mg_connection*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void cck_send_ssid(mg_connection *conn, const std::string c){
    char expire[100];
    time_t t = time(NULL) + 60 * 60 * 24 * 30;
    strftime(expire, sizeof(expire), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&t));

    mg_printf(conn,
        "HTTP/1.1 200 OK\r\n"
        "Set-Cookie: ssid=%s; expires=%s; max-age=%d; path=/; http-only; HttpOnly;\r\n"
        "Content-type: text/html\r\n"
        "X-UA-Compatible: IE=edge\r\n"
        "Content-Length: 0\r\n",
        c.c_str(), expire, 60 * 60 * 24 * 30);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorl %edi, %edi
callq 0xc850
addq $0x278d00, %rax         # imm = 0x278D00
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
callq 0xc2f0
leaq 0x52f5e(%rip), %rdx     # 0x61144
leaq 0x10(%rsp), %r15
pushq $0x64
popq %rsi
movq %r15, %rdi
movq %rax, %rcx
callq 0xca00
movq (%r14), %rdx
leaq 0x52f5b(%rip), %rsi     # 0x6115e
movq %rbx, %rdi
movq %r15, %rcx
movl $0x278d00, %r8d         # imm = 0x278D00
xorl %eax, %eax
callq 0x58c06
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cck_send_admin_ssid(mg_connection*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char const*)
void cck_send_admin_ssid(mg_connection *conn, const string ssid, const char* type){
    ConfigManager c;
    char expire[100];
    time_t t = time(NULL) + 60 * c.global().get<int>("security::" + string(type) + "::expire_time");
    strftime(expire, sizeof(expire), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&t));

    mg_printf(conn,
        "HTTP/1.1 200 OK\r\n"
        "Set-Cookie: ssid=%s; expires=%s; path=/; http-only; HttpOnly;\r\n"
        "Content-type: text/html\r\n"
        "X-UA-Compatible: IE=edge\r\n"
        "Content-Length: 0\r\n",
        ssid.c_str(), expire);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xa8(%rsp), %rax
movq %rax, -0x30(%rax)
pushq $0x1
popq %rcx
movq %rcx, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0xe0(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x118(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
xorl %edi, %edi
callq 0xc850
movq %rax, %r15
leaq 0x78(%rsp), %rdi
callq 0x1008c
movq %rax, %r12
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r13, %rsi
callq 0xcb10
leaq 0x52f39(%rip), %rsi     # 0x61201
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x10111
leaq 0x52f2e(%rip), %rdx     # 0x6120c
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x100f2
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
callq 0x100e4
imull $0x3c, %eax, %eax
cltq
addq %rax, %r15
leaq 0x50(%rsp), %rdi
callq 0xcd88
leaq 0x30(%rsp), %rdi
callq 0xcd88
leaq 0x10(%rsp), %rdi
callq 0xcd88
leaq 0x70(%rsp), %rdi
movq %r15, (%rdi)
callq 0xc2f0
leaq 0x52e10(%rip), %rdx     # 0x61144
leaq 0x120(%rsp), %r15
pushq $0x64
popq %rsi
movq %r15, %rdi
movq %rax, %rcx
callq 0xca00
movq (%r14), %rdx
leaq 0x52ec6(%rip), %rsi     # 0x6121a
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x58c06
leaq 0x78(%rsp), %rdi
callq 0x10136
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0xe3ab
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xcd88
jmp 0xe390
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xcd88
jmp 0xe39f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xcd88
jmp 0xe3ae
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x10136
movq %rbx, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: _generate_appender[abi:cxx11](char const*)
string __generate_appender(const char *username) {
    char *hash = new char[33];
    ConfigManager c;
    mg_md5(hash, username, ":", c.global().get("security::salt").c_str(), NULL);
    // mg_md5(hash, username, ":", md5Salt, NULL);

    string ret(hash);
    delete [] hash;

    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x21
popq %rdi
callq 0xc560
movq %rax, %r14
leaq 0x60(%rsp), %rax
movq %rax, -0x30(%rax)
pushq $0x1
popq %rcx
movq %rcx, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x98(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0xd0(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x30(%rsp), %rdi
callq 0x1008c
movq %rax, %r12
leaq 0x52e65(%rip), %rsi     # 0x612b1
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xcb10
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x104e4
movq (%rax), %rcx
leaq 0x537fa(%rip), %rdx     # 0x61c6c
movq %r14, %rdi
movq %r15, %rsi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x59db6
leaq 0x10(%rsp), %rdi
callq 0xcd88
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xcb10
movq %r14, %rdi
callq 0xc400
leaq 0x30(%rsp), %rdi
callq 0x10136
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xe4c2
movq %rax, %rbx
jmp 0xe4d4
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xcd88
leaq 0x30(%rsp), %rdi
callq 0x10136
movq %rbx, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cck_create_ssid[abi:cxx11](char const*)
string cck_create_ssid(const char* username){
    // char newssid[33];
    // strcpy(newssid, to_ssid(username));

    string appender = __generate_appender(username);

    char finalssid[64];// = new char[64];

    int len = sprintf(finalssid, "%s|%s", username, appender.c_str());
    finalssid[len] = 0;

    std::string ret(finalssid);

    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0xe3c0
movq (%r15), %rcx
leaq 0x52db4(%rip), %rsi     # 0x612c0
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xcb90
cltq
movb $0x0, 0x30(%rsp,%rax)
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xcb10
leaq 0x10(%rsp), %rdi
callq 0xcd88
movq %rbx, %rax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xcd88
movq %rbx, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cck_verify_ssid(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string cck_verify_ssid(string ssid){
    string username;
    vector<string> zztmp = cc_split(ssid, string("|"));
    if (zztmp.size() != 2) return username;

    username = zztmp[0];
    string _ssid = cck_create_ssid(username);

    return (_ssid == ssid) ? username : "";
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
andq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0x57095(%rip), %rsi     # 0x656b4
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xcb10
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %r14, %rsi
callq 0xe782
leaq 0x28(%rsp), %rdi
callq 0xcd88
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rax
subq %rsi, %rax
cmpq $0x40, %rax
jne 0xe6af
leaq 0x8(%rsp), %rdi
callq 0xcc70
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xc640
movq 0x60(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0xe4e6
leaq 0x60(%rsp), %rdi
callq 0xcd88
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x1000c
testb %al, %al
je 0xe6ce
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0xc640
jmp 0xe6e2
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq 0x8(%rsp), %rcx
cmpq %r15, %rcx
je 0xe6ee
movq %rcx, (%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0xe6f5
leaq 0x58f7d(%rip), %rsi     # 0x67652
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0xcb10
leaq 0x28(%rsp), %rdi
callq 0xcd88
jmp 0xe70e
movups (%r15), %xmm0
movups %xmm0, (%rax)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %r15, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x10156
leaq 0x8(%rsp), %rdi
callq 0xcd88
movq %rbx, %rax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0xe734
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0xe746
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xcd88
jmp 0xe752
jmp 0xe74f
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x10156
jmp 0xe770
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xcd88
jmp 0xe770
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xcd88
movq %rbx, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
vector<string> cc_split(const string &s, const string &seperator){
    vector<string> result;
    typedef string::size_type string_size;
    string_size i = 0;

    while (i != s.size()){
        int flag = 0;
        while (i != s.size() && flag == 0){
            flag = 1;
            for (string_size x = 0; x < seperator.size(); ++x)
                if (s[i] == seperator[x]){
                    ++i;
                    flag = 0;
                    break;
                }
        }

        flag = 0;
        string_size j = i;
        while (j != s.size() && flag == 0){
            for (string_size x = 0; x < seperator.size(); ++x)
                if (s[j] == seperator[x]){
                    flag = 1;
                    break;
                }
            if (flag == 0)
                ++j;
        }
        if (i != j){
            result.push_back(s.substr(i, j - i));
            i = j;
        }
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x10(%rdi)
movups %xmm0, (%rdi)
xorl %edx, %edx
pushq $0x1
popq %rbp
leaq 0x8(%rsp), %r12
movq 0x8(%r15), %rax
cmpq %rax, %rdx
je 0xe864
movq (%r14), %rcx
movq 0x8(%r14), %rsi
movq (%r15), %rdi
movb $0x1, %r8b
cmpq %rax, %rdx
je 0xe7f8
testb $0x1, %r8b
je 0xe7f8
xorl %r8d, %r8d
cmpq %r8, %rsi
je 0xe7ee
movb (%rdi,%rdx), %r9b
leaq 0x1(%r8), %r10
cmpb (%rcx,%r8), %r9b
movq %r10, %r8
jne 0xe7d6
jmp 0xe7f3
xorl %r8d, %r8d
jmp 0xe7c8
incq %rdx
jmp 0xe7c5
xorl %r8d, %r8d
movq %rdx, %r13
testl %r8d, %r8d
jne 0xe832
cmpq %rax, %r13
je 0xe832
xorl %r8d, %r8d
movq %r8, %r9
cmpq %r8, %rsi
je 0xe826
movb (%rdi,%r13), %r10b
leaq 0x1(%r9), %r8
cmpb (%rcx,%r9), %r10b
jne 0xe80b
movl %ebp, %r8d
jmp 0xe829
xorl %r8d, %r8d
cmpq %rsi, %r9
sbbq $-0x1, %r13
jmp 0xe7fe
movq %r13, %rcx
subq %rdx, %rcx
je 0xe7ae
movq %r12, %rdi
movq %r15, %rsi
callq 0xcb30
movq %rbx, %rdi
movq %r12, %rsi
callq 0x10e0e
movq %r12, %rdi
callq 0xcd88
movq %r13, %rdx
jmp 0xe7ae
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0xe888
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xcd88
movq %rbx, %rdi
callq 0x10156
movq %r14, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_valid_image_ext(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string cc_valid_image_ext(string name){
    string ext = "";
    if (cc_ends_with(name, ".jpg"))
        ext = ".jpg";
    else if (cc_ends_with(name, ".gif"))
        ext = ".gif";
    else if (cc_ends_with(name, ".png"))
        ext = ".png";

    return ext;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x58d50(%rip), %rsi     # 0x67652
leaq 0x8(%rsp), %rdx
callq 0xcb10
leaq 0x52a66(%rip), %r14     # 0x61379
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %r14, %rsi
callq 0xcb10
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xe9f6
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0xcd88
testb %bpl, %bpl
jne 0xe9b1
leaq 0x52a34(%rip), %r14     # 0x6137e
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %r14, %rsi
callq 0xcb10
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xe9f6
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0xcd88
testb %bpl, %bpl
jne 0xe9b1
leaq 0x52a02(%rip), %r14     # 0x61383
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %r14, %rsi
callq 0xcb10
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xe9f6
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0xcd88
testb %bpl, %bpl
je 0xe9bc
movq %rbx, %rdi
movq %r14, %rsi
callq 0xcd10
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe9d4
jmp 0xe9e3
jmp 0xe9d4
jmp 0xe9e3
jmp 0xe9e3
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xcd88
jmp 0xe9e6
movq %rax, %r14
movq %rbx, %rdi
callq 0xcd88
movq %r14, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_ends_with(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool cc_ends_with(std::string const &fullString, std::string const &ending) {
    if (fullString.length() >= ending.length()) {
        return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending));
    }
    else {
        return false;
    }
}

// Assembly:
movq %rsi, %rcx
movq 0x8(%rdi), %rsi
movq 0x8(%rcx), %rdx
subq %rdx, %rsi
jae 0xea09
xorl %eax, %eax
retq
pushq %rax
callq 0xcc10
testl %eax, %eax
sete %al
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_random_chars[abi:cxx11](int)
string cc_random_chars(int len){
    char *username = new char[len + 1];
    unqlite_util_random_string(pDb, username, len);
    username[len] = 0;

    string ret(username);

    delete [] username;

    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movq %rdi, %rbx
leal 0x1(%r14), %eax
cmpl $-0x1, %esi
pushq $-0x1
popq %rcx
cmovgel %eax, %ecx
movslq %ecx, %rdi
callq 0xc560
movq %rax, %r15
leaq 0x791d1(%rip), %rax     # 0x87c18
movq (%rax), %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x2bc94
movslq %r14d, %rax
movb $0x0, (%r15,%rax)
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xcb10
movq %r15, %rdi
callq 0xc400
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_timestamp_to_time[abi:cxx11](long)
string cc_timestamp_to_time(time_t ts){
    struct tm tm_date;

    localtime_r(&(ts), &tm_date);

    char std_time[64];
    strftime(std_time, 64, "%X", &tm_date);

    string ret(std_time);
    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %rdi
movq %rsi, (%rdi)
leaq 0x18(%rsp), %r14
movq %r14, %rsi
callq 0xc200
leaq 0x528d3(%rip), %rdx     # 0x61391
leaq 0x50(%rsp), %r15
pushq $0x40
popq %rsi
movq %r15, %rdi
movq %r14, %rcx
callq 0xca00
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xcb10
movq %rbx, %rax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_timestamp_diff_day(long, long)
int cc_timestamp_diff_day(time_t t1, time_t t2){
    struct tm tm_t1, tm_t2;
    localtime_r(&t1, &tm_t1);
    localtime_r(&t2, &tm_t2);

    time_t diff = t1 - (tm_t1.tm_sec + tm_t1.tm_min * 60 + tm_t1.tm_hour * 3600) -
                  (t2 - (tm_t2.tm_sec + tm_t2.tm_min * 60 + tm_t2.tm_hour * 3600));
    
    return (int)(diff / 3600 / 24);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x88, %rsp
leaq 0x10(%rsp), %r14
movq %rdi, (%r14)
leaq 0x8(%rsp), %rbx
movq %rsi, (%rbx)
leaq 0x50(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xc200
leaq 0x18(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc200
movq (%r14), %rax
movslq (%r15), %rcx
movslq 0x4(%r15), %rdx
imulq $0x3c, %rdx, %rdx
addq %rcx, %rdx
movslq 0x8(%r15), %rcx
imulq $0xe10, %rcx, %rcx      # imm = 0xE10
addq %rdx, %rcx
movslq (%r12), %rdx
movslq 0x4(%r12), %rsi
imulq $0x3c, %rsi, %rsi
addq %rdx, %rsi
movslq 0x8(%r12), %rdx
imulq $0xe10, %rdx, %rdx      # imm = 0xE10
addq %rsi, %rdx
addq (%rbx), %rcx
subq %rcx, %rax
addq %rdx, %rax
movl $0x15180, %ecx          # imm = 0x15180
cqto
idivq %rcx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: logLog(char const*, ...)
void logLog(const char* msg, ...){
    time_t rawtime;
    time(&rawtime);

    char timetmp[64];
    struct tm * timeinfo;
    timeinfo = localtime(&(rawtime));

    strftime(timetmp, 64, "%Y/%m/%d %X", timeinfo);

    fprintf(log_file, "[%s]\t", timetmp);

    va_list argptr;
    va_start(argptr, msg);
    vfprintf(log_file, msg, argptr);
    va_end(argptr);

    fprintf(log_file, "\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
leaq 0x70(%rsp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0xebfd
movaps %xmm0, 0xa0(%rsp)
movaps %xmm1, 0xb0(%rsp)
movaps %xmm2, 0xc0(%rsp)
movaps %xmm3, 0xd0(%rsp)
movaps %xmm4, 0xe0(%rsp)
movaps %xmm5, 0xf0(%rsp)
movaps %xmm6, 0x100(%rsp)
movaps %xmm7, 0x110(%rsp)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xc850
movq %r14, %rdi
callq 0xc7a0
leaq 0x5276f(%rip), %rdx     # 0x61388
leaq 0x30(%rsp), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
movq %rax, %rcx
callq 0xca00
leaq 0x79065(%rip), %r12     # 0x87c98
movq (%r12), %rdi
leaq 0x52756(%rip), %rsi     # 0x61394
movq %r14, %rdx
xorl %eax, %eax
callq 0xc260
leaq 0x10(%rsp), %rdx
movq %r15, 0x10(%rdx)
leaq 0x150(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq (%r12), %rdi
movq %rbx, %rsi
callq 0xcbc0
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0xc990
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: database_fatal(char const*)
void database_fatal(const char *zMsg){
    if (pDb){
        const char *zErr;
        int iLen = 0; /* Stupid cc warning */

        /* Extract the database error log */
        unqlite_config(pDb, UNQLITE_CONFIG_ERR_LOG, &zErr, &iLen);
        if (iLen > 0){
            /* Output the DB error log */
            puts(zErr); /* Always null termniated */
        }
    }
    else{
        if (zMsg){
            puts(zMsg);
        }
    }
    /* Manually shutdown the library */
    unqlite_lib_shutdown();
    /* Exit immediately */
    exit(0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rax
leaq 0x78f78(%rip), %rcx     # 0x87c18
movq (%rcx), %rdi
testq %rdi, %rdi
jne 0xecb2
testq %rax, %rax
je 0xecd8
movq %rax, %rdi
jmp 0xecd3
leaq 0xc(%rsp), %rbx
andl $0x0, (%rbx)
pushq $0x3
popq %rsi
movq %rsp, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x27c79
cmpl $0x0, (%rbx)
jle 0xecd8
movq (%rsp), %rdi
callq 0xcb70
callq 0x27133
xorl %edi, %edi
callq 0xc7e0
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_smart_shorten(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int)
string cc_smart_shorten(string& s, int limiter){
    //s = s.substr(0, limiter * 2);
    int nl_pos = s.find_first_of("<");
    s = s.substr(0, nl_pos);
    if(s.size() <= limiter) return s;

    string ret = s.substr(0, limiter);
    if(nl_pos <= limiter) return ret;

    for(int i = limiter; i < s.size(); ++i){
        if(i < s.size() - 3){
            if(s[i] == -17 && s[i+1] == -68 && s[i+2] == -116) break;
            if(s[i] == -29 && s[i+1] == -128 && s[i+2] == -126) break;
            if(s[i] == ',' || s[i] == '.') break;
        }
        ret += s[i];
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x5699c(%rip), %rsi     # 0x6569b
movq %r14, %rdi
xorl %edx, %edx
callq 0xc760
movq %rax, %r12
movslq %r12d, %rcx
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xcb30
movq %r14, %rdi
movq %r15, %rsi
callq 0xc5f0
movq %r15, %rdi
callq 0xcd88
movslq %ebp, %r15
cmpq %r15, 0x8(%r14)
jbe 0xedc3
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0xcb30
cmpl %r15d, %r12d
jle 0xedce
xorl %ebp, %ebp
movq 0x8(%r14), %rdx
cmpq %r15, %rdx
jbe 0xedce
addq $-0x3, %rdx
movq (%r14), %rcx
movb (%rcx,%r15), %al
cmpq %r15, %rdx
jbe 0xedb3
movzbl %al, %edx
cmpl $0xe3, %edx
je 0xed8e
cmpl $0xef, %edx
je 0xeda1
cmpl $0x2c, %edx
je 0xedce
cmpl $0x2e, %edx
jne 0xedb3
jmp 0xedce
movb $-0x1d, %al
cmpb 0x1(%rcx,%r15), %bpl
jno 0xedb3
cmpb $-0x7e, 0x2(%rcx,%r15)
jne 0xedb3
jmp 0xedce
movb $-0x11, %al
cmpb $-0x44, 0x1(%rcx,%r15)
jne 0xedb3
cmpb $-0x74, 0x2(%rcx,%r15)
je 0xedce
movsbl %al, %esi
movq %rbx, %rdi
callq 0xccf0
incq %r15
jmp 0xed56
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc640
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0xcd88
movq %r14, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_replace(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
string cc_replace(std::string str, const std::string& from, const std::string& to) {
    size_t start_pos = 0;
    while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
        str.replace(start_pos, from.length(), to);
        start_pos += to.length(); // Handles case where 'to' is a substring of 'from'
    }
    return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
xorl %r13d, %r13d
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xc780
cmpq $-0x1, %rax
je 0xf7d0
movq %rax, %r13
movq 0x8(%r12), %rdx
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rcx
callq 0xcac0
addq 0x8(%r15), %r13
jmp 0xf7a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc950
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_extract_uri_num(mg_connection*)
int cc_extract_uri_num(mg_connection* conn){
    string url(conn->uri);
    vector<string> tmp = cc_split(url, "/");
    string num = tmp[tmp.size() - 1];

    return atol(num.c_str());
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq 0x8(%rdi), %rsi
leaq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xcb10
leaq 0x59d61(%rip), %rsi     # 0x6958c
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xcb10
leaq 0x30(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0xe782
leaq 0x10(%rsp), %rdi
callq 0xcd88
movq 0x38(%rsp), %rsi
addq $-0x20, %rsi
leaq 0x10(%rsp), %rdi
callq 0xc640
leaq 0x10(%rsp), %rbx
movq (%rbx), %rdi
callq 0xc730
movq %rax, %r14
movq %rbx, %rdi
callq 0xcd88
leaq 0x30(%rsp), %rdi
callq 0x10156
leaq 0x48(%rsp), %rdi
callq 0xcd88
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x10156
jmp 0xf8c3
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xcd88
jmp 0xf8c3
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xcd88
movq %rbx, %rdi
callq 0xc790
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./src/helper.cpp
// Function: cc_load_file_to_set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void cc_load_file_to_set(const string& p, unordered_set<string>& s){
    ifstream f(p);
    string line;
    while (f >> line) if(line != "") s.insert(line);
    f.close();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x20(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0xcbe0
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rsp, %r15
leaq 0x5773c(%rip), %r12     # 0x67652
movq %r14, %rdi
movq %r15, %rsi
callq 0xc4e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xff4b
movq %r15, %rdi
movq %r12, %rsi
callq 0x102cc
testb %al, %al
je 0xff16
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10fca
jmp 0xff16
leaq 0x20(%rsp), %rdi
callq 0xc750
movq %rsp, %rdi
callq 0xcd88
leaq 0x20(%rsp), %rdi
callq 0xc070
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xff78
movq %rax, %rbx
movq %rsp, %rdi
callq 0xcd88
leaq 0x20(%rsp), %rdi
callq 0xc070
movq %rbx, %rdi
callq 0xc790