LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/map.c
// Function: check_special_location
void check_special_location (struct Bot *b, int pindex) {
    char out[MAX_MESSAGE_BUFFER];
    int cur_x = b->players[pindex].current_map.x;
    int cur_y = b->players[pindex].current_map.y;

    for (int i=0; i<MAX_BUILDINGS; i++) {
        int bld_startx = b->players[pindex].current_map.buildings[i].x;
        int bld_endx   = b->players[pindex].current_map.buildings[i].height + bld_startx;
        int bld_starty = b->players[pindex].current_map.buildings[i].y;
	    int bld_endy   = b->players[pindex].current_map.buildings[i].width + bld_starty;
	    char found_building[64] = {0};

        strncpy(found_building, "lot of empty space", 64);


	    if (cur_x == 0 && cur_y == 0) {
            continue;
        }

    	if (cur_x >= bld_startx && cur_x <= bld_endx) {
    	    if (cur_y >= bld_starty && cur_y <= bld_endy) {
		        strncpy(found_building, b->players[pindex].current_map.buildings[i].name, 62);
            }
	    }

        sprintf(out, "PRIVMSG %s :%s stands in front of the %s\r\n",
            b->active_room,
            b->players[pindex].username,
            found_building
        );
        add_msg(out, strlen(out));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movslq %esi, %rax
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
leaq (%rdi,%rax), %rcx
addq $0x1a0, %rcx            # imm = 0x1A0
movq %rcx, (%rsp)
leaq 0x133c(%rdi,%rax), %r15
movl 0x1448(%r15), %r12d
movl 0x144c(%r15), %ebp
movl %r12d, %eax
orl %ebp, %eax
sete %r14b
addq $0x100, %rdi            # imm = 0x100
movq %rdi, 0x8(%rsp)
pushq $0x40
popq %rbx
leaq 0x50(%rsp), %r13
subq $0x1, %rbx
jb 0xa504
movl 0x40(%r15), %edx
movl 0x44(%r15), %eax
movl 0x4c(%r15), %esi
movl 0x48(%r15), %ecx
movups 0xaf53(%rip), %xmm0     # 0x153c8
movaps %xmm0, 0x40(%rsp)
movups 0xaf37(%rip), %xmm0     # 0x153b8
movaps %xmm0, 0x30(%rsp)
movups 0xaf1b(%rip), %xmm0     # 0x153a8
movaps %xmm0, 0x20(%rsp)
movups 0xaeff(%rip), %xmm0     # 0x15398
movaps %xmm0, 0x10(%rsp)
testb %r14b, %r14b
jne 0xa4fb
cmpl %edx, %r12d
jl 0xa4c9
addl %edx, %esi
cmpl %esi, %r12d
jg 0xa4c9
cmpl %eax, %ebp
jl 0xa4c9
addl %eax, %ecx
cmpl %ecx, %ebp
jg 0xa4c9
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
pushq $0x3e
popq %rdx
callq 0x20e0
movq %r13, %rdi
leaq 0xaafe(%rip), %rsi      # 0x14fd1
movq 0x8(%rsp), %rdx
movq (%rsp), %rcx
leaq 0x10(%rsp), %r8
xorl %eax, %eax
callq 0x2050
movq %r13, %rdi
callq 0x20c0
movq %r13, %rdi
movq %rax, %rsi
callq 0xbd04
addq $0x50, %r15
jmp 0xa454
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/map.c
// Function: q_append
static inline void q_append(struct Location *q, size_t start, size_t *end, size_t len, struct Location elem) {
    q[*end].x = elem.x;
    q[*end].y = elem.y;
    (*end) = ((*end)+1)%len;
    assert(*end != start);
}

// Assembly:
movq %rdx, %r9
movq (%rdx), %rax
movq %r8, (%rdi,%rax,8)
incq %rax
xorl %edx, %edx
divq %rcx
movq %rdx, (%r9)
cmpq %rsi, %rdx
je 0xa531
retq
pushq %rax
leaq 0xabd8(%rip), %rdi      # 0x15111
leaq 0xa11f(%rip), %rsi      # 0x1465f
leaq 0xabd8(%rip), %rcx      # 0x1511f
movl $0x107, %edx            # imm = 0x107
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/map.c
// Function: queue_overlap
static inline int queue_overlap(struct Location *q, size_t start, size_t end, size_t len, int x, int y) {
    for(size_t i = start; i != end; i = (i+1)%len) {
        if(q[i].x == x && q[i].y == y) {
            return 1;
        }
    }
    return 0;
}

// Assembly:
movq %rdx, %r10
movq %rsi, %rax
cmpq %r10, %rax
je 0xa576
cmpl %r8d, (%rdi,%rax,8)
jne 0xa569
cmpl %r9d, 0x4(%rdi,%rax,8)
je 0xa576
incq %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rax
jmp 0xa557
xorl %ecx, %ecx
cmpq %r10, %rax
setne %cl
movl %ecx, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/market.c
// Function: fluctuate_market
void fluctuate_market() {
    char out[MAX_MESSAGE_BUFFER];
    memcpy(dawn->market.prevprice, dawn->market.materials, sizeof(dawn->market.materials));
    dawn->market.materials[WOOD] = rrange(100, 500);
    dawn->market.materials[LEATHER] = rrange(250, 800);
    dawn->market.materials[ORE] = rrange(400, 1200);
    dawn->market.materials[STONE] = rrange(500, 1400);
    dawn->market.materials[BRONZE] = rrange(700, 2000);
    dawn->market.materials[MAIL] = rrange(1000, 3000);
    dawn->market.materials[STEEL] = rrange(4000, 12000);
    dawn->market.materials[DIAMOND] = rrange(25000, 100000);
    sprintf(out, "PRIVMSG %s :Market prices have been updated\r\n", dawn->active_room);
    add_msg(out, strlen(out));
}

// Assembly:
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
leaq 0x154ed(%rip), %rbx     # 0x1fa80
movq (%rbx), %rax
movupd 0xf2e78(%rax), %xmm0
movups 0xf2e88(%rax), %xmm1
movups %xmm1, 0xf2ea8(%rax)
movupd %xmm0, 0xf2e98(%rax)
callq 0xed2c
mulsd 0xae3f(%rip), %xmm0     # 0x15400
addsd 0xae3f(%rip), %xmm0     # 0x15408
cvttsd2si %xmm0, %eax
movq (%rbx), %rcx
movl %eax, 0xf2e78(%rcx)
callq 0xed2c
mulsd 0xae2d(%rip), %xmm0     # 0x15410
addsd 0xae2d(%rip), %xmm0     # 0x15418
cvttsd2si %xmm0, %eax
movq (%rbx), %rcx
movl %eax, 0xf2e7c(%rcx)
callq 0xed2c
mulsd 0xae1b(%rip), %xmm0     # 0x15420
addsd 0xadf3(%rip), %xmm0     # 0x15400
cvttsd2si %xmm0, %eax
movq (%rbx), %rcx
movl %eax, 0xf2e80(%rcx)
callq 0xed2c
mulsd 0xae01(%rip), %xmm0     # 0x15428
addsd 0xae01(%rip), %xmm0     # 0x15430
cvttsd2si %xmm0, %eax
movq (%rbx), %rcx
movl %eax, 0xf2e84(%rcx)
callq 0xed2c
mulsd 0xadef(%rip), %xmm0     # 0x15438
addsd 0xadef(%rip), %xmm0     # 0x15440
cvttsd2si %xmm0, %eax
movq (%rbx), %rcx
movl %eax, 0xf2e88(%rcx)
callq 0xed2c
mulsd 0xaddd(%rip), %xmm0     # 0x15448
addsd 0xaddd(%rip), %xmm0     # 0x15450
cvttsd2si %xmm0, %eax
movq (%rbx), %rcx
movl %eax, 0xf2e8c(%rcx)
callq 0xed2c
mulsd 0xadcb(%rip), %xmm0     # 0x15458
addsd 0xadcb(%rip), %xmm0     # 0x15460
cvttsd2si %xmm0, %eax
movq (%rbx), %rcx
movl %eax, 0xf2e90(%rcx)
callq 0xed2c
mulsd 0xadb9(%rip), %xmm0     # 0x15468
addsd 0xadb9(%rip), %xmm0     # 0x15470
cvttsd2si %xmm0, %eax
movq (%rbx), %rdx
movl %eax, 0xf2e94(%rdx)
addq $0x100, %rdx            # imm = 0x100
leaq 0xada6(%rip), %rsi      # 0x15478
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xbd04
addq $0x190, %rsp            # imm = 0x190
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/market.c
// Function: print_market
void print_market() {
    char out[MAX_MESSAGE_BUFFER];
    sprintf(out, "PRIVMSG %s :", dawn->active_room);
    for (int i=0; i<MAX_MATERIAL_TYPE; i++) {
        char *temp;
        size_t len = strlen(out);
        CALLEXIT(!(temp = malloc(MAX_MESSAGE_BUFFER-len)))
        int difference = dawn->market.materials[i] - dawn->market.prevprice[i];
        snprintf(temp, MAX_MESSAGE_BUFFER-len, "[%s: %d (%s%+d" IRC_NORMAL ")] ",
                 material_to_str(i),
                 dawn->market.materials[i],
                 ((difference >= 0) ? IRC_GREEN : IRC_RED),
                 difference);
        strncat(out, temp, MAX_MESSAGE_BUFFER-len);
        free(temp);
    }
    strncat(out, "\r\n", 3);
    add_msg(out, strlen(out));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
leaq 0x1536d(%rip), %rax     # 0x1fa80
movl $0x100, %edx            # imm = 0x100
addq (%rax), %rdx
leaq 0x71b4(%rip), %rsi      # 0x118d6
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0xafd0(%rip), %rbp      # 0x15708
leaq 0xadb4(%rip), %r14      # 0x154f3
xorl %r13d, %r13d
cmpq $0x20, %r13
je 0xa7d8
movq %rbx, %rdi
callq 0x20c0
movl $0x190, %r15d           # imm = 0x190
subq %rax, %r15
movq %r15, %rdi
callq 0x22c0
testq %rax, %rax
je 0xa816
movq %rax, %r12
leaq 0x15308(%rip), %rax     # 0x1fa80
movq (%rax), %rcx
movl 0xf2e78(%rcx,%r13), %r8d
movl %r8d, %eax
subl 0xf2e98(%rcx,%r13), %eax
leaq 0x8a40(%rip), %r9       # 0x131d5
jns 0xa79e
leaq 0x6592(%rip), %r9       # 0x10d30
movslq (%r13,%rbp), %rcx
addq %rbp, %rcx
movl %eax, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x23a0
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x2120
movq %r12, %rdi
callq 0x2250
addq $0x4, %r13
jmp 0xa742
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x20c0
movw $0xa0d, 0x10(%rsp,%rax) # imm = 0xA0D
movb $0x0, 0x12(%rsp,%rax)
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xbd04
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xac89(%rip), %rdi      # 0x154a6
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/market.c
// Function: print_materials
void print_materials(struct Message *m) {
    int pindex = get_pindex(m->sender_nick);
    char out[MAX_MESSAGE_BUFFER];
    sprintf(out, "PRIVMSG %s :%s, [Materials: - Wood: %ld - Leather %ld - Ore: %ld - Stone: %ld - "
               " Bronze: %ld - Mail: %ld - Steel: %ld - Diamond: %ld]\r\n",
            m->receiver, m->sender_nick, dawn->players[pindex].materials[WOOD],
            dawn->players[pindex].materials[LEATHER], dawn->players[pindex].materials[ORE],
            dawn->players[pindex].materials[STONE], dawn->players[pindex].materials[BRONZE],
            dawn->players[pindex].materials[MAIL], dawn->players[pindex].materials[STEEL],
            dawn->players[pindex].materials[DIAMOND]);
    add_msg(out, strlen(out));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, %rbx
callq 0xc860
leaq 0xc0(%rbx), %rdx
leaq 0x14fcf(%rip), %rcx     # 0x1fa80
movq (%rcx), %rcx
cltq
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
movq 0x2798(%rcx,%rax), %r8
movq 0x27a0(%rcx,%rax), %r9
movups 0x27a8(%rcx,%rax), %xmm0
movups 0x27b8(%rcx,%rax), %xmm1
movups 0x27c8(%rcx,%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0xab55(%rip), %rsi      # 0x1564f
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2050
movq %r14, %rdi
callq 0x20c0
movq %r14, %rdi
movq %rax, %rsi
callq 0xbd04
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/namegen.c
// Function: init_name_gen
NameGen init_name_gen(unsigned int markov_tier) {
    if(markov_tier == 0)
        return 0;
    struct namegen * ng;
    CALLEXIT(!(ng = malloc(sizeof *ng)))
    ng->markov_tier = markov_tier;
    ng->success = 0;
    CALLEXIT(!(ng->tiers = malloc(markov_tier * sizeof *ng->tiers)))
    for(size_t i = 0; i < markov_tier; i++) {
        ng->tiers[i] = init_analyzer(i+1);
    }
    return ng;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %edi, %edi
je 0xb53f
movl %edi, %ebp
pushq $0x10
popq %rdi
callq 0x22c0
testq %rax, %rax
je 0xb54d
movq %rax, %rbx
movl %ebp, 0x8(%rax)
andl $0x0, 0xc(%rax)
movl %ebp, %r12d
leaq (,%r12,8), %rdi
callq 0x22c0
movq %rax, (%rbx)
testq %rax, %rax
je 0xb556
movq %rax, %r14
negq %r12
pushq $0x1
popq %r15
leaq (%r12,%r15), %rax
cmpq $0x1, %rax
je 0xb541
movq %r15, %rdi
callq 0x259c
movq %rax, -0x8(%r14,%r15,8)
incq %r15
jmp 0xb523
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa774(%rip), %rdi      # 0x15cc8
jmp 0xb55d
leaq 0xa7ab(%rip), %rdi      # 0x15d08
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/namegen.c
// Function: free_name_gen
void free_name_gen(NameGen ng) {
    if(!ng)
        return;
    struct namegen * cng = ng;
    for(size_t i = 0; i < cng->markov_tier; i++) {
        free_analyzer(cng->tiers[i]);
    }
    free(cng->tiers);
    free(cng);
}

// Assembly:
testq %rdi, %rdi
je 0xb5a6
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movl 0x8(%rbx), %eax
movq (%rbx), %rdi
cmpq %rax, %r14
jae 0xb592
movq (%rdi,%r14,8), %rdi
callq 0x25db
incq %r14
jmp 0xb579
callq 0x2250
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2250
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/namegen.c
// Function: add_file
void add_file(NameGen ng, char const * fn) {
    if(!ng || !fn || strlen(fn) == 0)
        return;
    struct namegen * cng = ng;
    for(size_t i = 0; i < cng->markov_tier; i++) {
        if(!analyze(cng->tiers[i], fn)) {
            cng->success = 0;
            return;
        }
    }
    cng->success = 1;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0xb5fc
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
cmpb $0x0, (%rsi)
je 0xb5f2
movq %rdi, %rbx
xorl %r15d, %r15d
pushq $0x1
popq %rbp
movl 0x8(%rbx), %eax
cmpq %rax, %r15
jae 0xb5ef
movq (%rbx), %rax
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
callq 0x262c
incq %r15
testl %eax, %eax
jne 0xb5cf
xorl %ebp, %ebp
movl %ebp, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/namegen.c
// Function: is_producible
int is_producible(NameGen ng, char src, size_t max_tier) {
    if(!ng || src == '\0')
        return 0;
    int valid = 0;
    struct namegen * cng = ng;
    for(size_t i = 0; i < max_tier && i < cng->markov_tier; i++) {
        if(has_rule_for(cng->tiers[i], src)) {
            valid = 1;
            break;
        }
    }
    return valid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testb %sil, %sil
sete %cl
xorl %r14d, %r14d
orb %al, %cl
jne 0xba01
movq %rdx, %rbx
movq %rdi, %r15
xorl %r14d, %r14d
movsbl %sil, %ebp
pushq $0x1
popq %r12
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0xba01
movl 0x8(%r15), %eax
cmpq %rax, %r13
jae 0xba01
movq (%r15), %rax
movq (%rax,%r13,8), %rdi
movl %ebp, %esi
callq 0x2ac3
incq %r13
testl %eax, %eax
je 0xb9db
movl %r12d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: init_msg_list
MsgList init_msg_list() {
    if(msgQ_singleton)
        return 0;
    struct msg_list * new_list;
    CALLEXIT(!(new_list = calloc(1, sizeof *new_list)))
    msgQ_singleton++;
    return new_list;
}

// Assembly:
pushq %rax
cmpb $0x0, 0x11891(%rip)     # 0x1d2c8
je 0xba3d
xorl %eax, %eax
jmp 0xba54
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0x2110
testq %rax, %rax
je 0xba56
movb $0x1, 0x11874(%rip)     # 0x1d2c8
popq %rcx
retq
leaq 0xa6a0(%rip), %rdi      # 0x160fd
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: init_msg_hist_list
MsgHistoryList init_msg_hist_list() {
    if(msgHQ_singleton)
        return 0;
    struct msg_hist_list * new_list;
    CALLEXIT(!(new_list = calloc(1, sizeof *new_list)))
    msgHQ_singleton++;
    return new_list;
}

// Assembly:
pushq %rax
cmpb $0x0, 0x11852(%rip)     # 0x1d2c4
je 0xba78
xorl %eax, %eax
jmp 0xba8f
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0x2110
testq %rax, %rax
je 0xba91
movb $0x1, 0x11835(%rip)     # 0x1d2c4
popq %rcx
retq
leaq 0xa54c(%rip), %rdi      # 0x15fe4
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: init_connect_server
int init_connect_server (const char *ip_addr, const char *port) {
    errno = 0;
    struct addrinfo destination, *res;
    memset(&destination, 0, sizeof destination);
    destination.ai_family = AF_INET;
    destination.ai_socktype = SOCK_STREAM;
    getaddrinfo(ip_addr, port, &destination, &res);
    CALLEXIT((con_socket = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1)
    printf(INFO "Trying to connect to %s:%s\n", ip_addr, port);
    CALLEXIT(connect(con_socket, res->ai_addr, res->ai_addrlen) == -1)
    printf(INFO "Connected to %s:%s\n", ip_addr, port);
    freeaddrinfo(res);
    return errno;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %r15
callq 0x2030
movq %rax, %rbx
andl $0x0, (%rax)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x4(%rdx)
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x2290
movq (%r12), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x2070
movl %eax, 0x117b3(%rip)     # 0x1d2c0
cmpl $-0x1, %eax
je 0xbb6e
leaq 0xa3cc(%rip), %rdi      # 0x15ee5
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2040
movl 0x11794(%rip), %edi     # 0x1d2c0
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
callq 0x2180
cmpl $-0x1, %eax
je 0xbb77
leaq 0xa429(%rip), %rdi      # 0x15f72
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2040
movq 0x8(%rsp), %rdi
callq 0x22b0
movl (%rbx), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xa2fb(%rip), %rdi      # 0x15e70
jmp 0xbb7e
leaq 0xa396(%rip), %rdi      # 0x15f14
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: free_msg_hist_list
void free_msg_hist_list() {
    if(!msgHQ_singleton || !mhlist)
        return;
    struct msg_hist_list * cmhlist = mhlist;
    struct msg_hist_node * tmp = cmhlist->head;
    while(tmp) {
        struct msg_hist_node * next = tmp->next;
        free(tmp);
        tmp = next;
    }
    free(cmhlist);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x116ef(%rip), %rbx     # 0x1d2b8
testq %rbx, %rbx
setne %al
andb 0x116ef(%rip), %al      # 0x1d2c4
cmpb $0x1, %al
jne 0xbbef
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xbbf7
movq 0x10(%rdi), %r14
callq 0x2250
movq %r14, %rdi
jmp 0xbbdc
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2250
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: add_hist_msg
void add_hist_msg(size_t len) {
    if(mhlist == 0)
        return;
    struct msg_hist_list * cmhlist = mhlist;

    time_t cur_time = time(0);
    if(cmhlist->head == 0) {
        add_event(MSGSEND, 0, SENDQ_INTERVAL, NORMAL); //should be unique, though there should also never be multiple MSGSEND events in the queue
        CALLEXIT(!(cmhlist->head = cmhlist->tail = calloc(1, sizeof *cmhlist->head)))
    } else {
        CALLEXIT(!(cmhlist->tail->next = calloc(1, sizeof *cmhlist->tail)))
        cmhlist->tail = cmhlist->tail->next;
    }
    cmhlist->tail->date = cur_time;
    cmhlist->tail->len = len;

    cmhlist->byte_size += len;
    cmhlist->msgs++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x116a6(%rip), %r15     # 0x1d2b8
testq %r15, %r15
je 0xbc93
movq %rdi, %rbx
xorl %edi, %edi
callq 0x21b0
movq %rax, %r14
cmpq $0x0, (%r15)
je 0xbc48
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x2110
movq 0x8(%r15), %rcx
movq %rax, 0x10(%rcx)
testq %rax, %rax
je 0xbc99
movq %rax, 0x8(%r15)
jmp 0xbc6e
pushq $0x4
popq %rdi
pushq $0x5
popq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
callq 0xe5c7
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x2110
movq %rax, 0x8(%r15)
movq %rax, (%r15)
testq %rax, %rax
je 0xbca2
movq %r14, 0x8(%rax)
movq %rbx, (%rax)
movq %rbx, %xmm0
movdqu 0x10(%r15), %xmm1
shufpd $0x2, 0xa1d7(%rip), %xmm0 # xmm0 = xmm0[0],mem[1]
paddq %xmm1, %xmm0
movdqu %xmm0, 0x10(%r15)
popq %rbx
popq %r14
popq %r15
retq
leaq 0xa3fd(%rip), %rdi      # 0x1609d
jmp 0xbca9
leaq 0xa38a(%rip), %rdi      # 0x16033
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: free_msg_list
void free_msg_list() {
    if(!mlist || !msgQ_singleton)
        return;
    struct msg_list * cmlist = mlist;
    struct msg_node * tmp = cmlist->head;
    while(tmp) {
        struct msg_node * next = tmp->next;
        free(tmp->msg);
        free(tmp);
        tmp = next;
    }
    free(cmlist);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x115ee(%rip), %rbx     # 0x1d2b0
testq %rbx, %rbx
je 0xbcf1
testb $0x1, 0x115fa(%rip)     # 0x1d2c8
je 0xbcf1
movq (%rbx), %r14
testq %r14, %r14
je 0xbcf7
movq (%r14), %rdi
movq 0x10(%r14), %r15
callq 0x2250
movq %r14, %rdi
callq 0x2250
movq %r15, %r14
jmp 0xbcd3
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2250
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: add_msg
void add_msg(char * msg, size_t len) {
    if(mlist == 0)
        return;
    struct msg_list * cmlist = mlist;

    if(cmlist->head == 0) {
        CALLEXIT(!(cmlist->head = cmlist->tail = calloc(1, sizeof *cmlist->head)))
    } else {
        CALLEXIT(!(cmlist->tail->next = calloc(1, sizeof *cmlist->tail)))
        cmlist->tail = cmlist->tail->next;
    }
    CALLEXIT(!(cmlist->tail->msg = malloc(len+1)))
    strcpy(cmlist->tail->msg, msg);
    cmlist->tail->len = len;
    cmlist->byte_size += len;
    cmlist->msgs++;
    process_messages();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x1159c(%rip), %r12     # 0x1d2b0
testq %r12, %r12
je 0xbd4b
movq %rsi, %rbx
movq %rdi, %r14
movq (%r12), %r13
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x2110
movq %rax, %r15
testq %r13, %r13
je 0xbd55
movq 0x8(%r12), %rax
movq %r15, 0x10(%rax)
testq %r15, %r15
je 0xbdba
movq %r15, 0x8(%r12)
jmp 0xbd63
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r15, 0x8(%r12)
movq %r15, (%r12)
testq %r15, %r15
je 0xbdc3
leaq 0x1(%rbx), %rdi
callq 0x22c0
movq %rax, (%r15)
testq %rax, %rax
je 0xbdb1
movq %rax, %rdi
movq %r14, %rsi
callq 0x21c0
movq %rbx, 0x8(%r15)
movq %rbx, %xmm0
movdqu 0x10(%r12), %xmm1
shufpd $0x2, 0xa0c8(%rip), %xmm0 # xmm0 = xmm0[0],mem[1]
paddq %xmm1, %xmm0
movdqu %xmm0, 0x10(%r12)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xbdd7
leaq 0xa45a(%rip), %rdi      # 0x16212
jmp 0xbdca
leaq 0xa3f3(%rip), %rdi      # 0x161b4
jmp 0xbdca
leaq 0xa383(%rip), %rdi      # 0x1614d
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: process_messages
void process_messages() {
    if(mlist == 0 || mhlist == 0)
        return;
    struct msg_list * csrc = mlist;
    struct msg_hist_list * cdest = mhlist;

    size_t len;
    while(csrc->head != 0 && cdest->msgs < MAX_MSGS_IN_INTERVAL && cdest->byte_size + (len = peek_msg_size()) < MAX_SENDQ_SIZE) {
        if(len > MAX_MESSAGE_BUFFER) {
            PRINTERR("Message too long")
        }
        char * msg = retr_msg();
        send_socket(msg, len);
        free(msg);
        add_hist_msg(len);
        //printf("MQueue: %zu of %d (PUSH)\n", cdest->byte_size, MAX_SENDQ_SIZE);

    }
    if(cdest->msgs >= MAX_MSGS_IN_INTERVAL || cdest->byte_size + peek_msg_size() >= MAX_SENDQ_SIZE) {
        printf(INFO "Send queue full\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x114c7(%rip), %r13     # 0x1d2b0
testq %r13, %r13
sete %al
movq 0x114c2(%rip), %r12     # 0x1d2b8
testq %r12, %r12
sete %cl
orb %al, %cl
je 0xbe0f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, (%r13)
movq 0x18(%r12), %rax
je 0xbeb8
cmpq $0x9, %rax
ja 0xbed7
movq 0x10(%r12), %r15
callq 0xbf77
addq %rax, %r15
cmpq $0x1f3, %r15            # imm = 0x1F3
ja 0xbebe
movq %rax, %r14
cmpq $0x191, %rax            # imm = 0x191
jae 0xbeaa
movq 0x1145f(%rip), %rbp     # 0x1d2b0
testq %rbp, %rbp
je 0xbe87
movq (%rbp), %rdi
testq %rdi, %rdi
je 0xbe87
movq (%rdi), %r15
movq 0x8(%rdi), %rax
subq %rax, 0x10(%rbp)
decq 0x18(%rbp)
movq 0x10(%rdi), %rbx
callq 0x2250
movq %rbx, (%rbp)
testq %rbx, %rbx
jne 0xbe8a
andq $0x0, 0x8(%rbp)
jmp 0xbe8a
xorl %r15d, %r15d
movq %r15, %rdi
movq %r14, %rsi
callq 0xbb90
movq %r15, %rdi
callq 0x2250
movq %r14, %rdi
callq 0xbc06
jmp 0xbe0f
leaq 0xa3ac(%rip), %rdi      # 0x1625d
callq 0x2190
jmp 0xbe4a
cmpq $0x9, %rax
ja 0xbed7
movq 0x10(%r12), %rbx
callq 0xbf77
addq %rbx, %rax
cmpq $0x1f4, %rax            # imm = 0x1F4
jb 0xbe00
leaq 0xa3c4(%rip), %rdi      # 0x162a2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2340
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: pop_hist_msg
void pop_hist_msg() {
    if(mhlist == 0)
        return;
    struct msg_hist_list * cmhlist = mhlist;
    if(cmhlist->head == 0)
        return;
    time_t cur_time = time(0);
    while(cmhlist->head != 0 && cur_time - SENDQ_INTERVAL >= cmhlist->head->date) {
        cmhlist->byte_size -= cmhlist->head->len;
        //printf("MQueue: %zu of %d (POP)\n", cmhlist->byte_size, MAX_SENDQ_SIZE);
        cmhlist->msgs--;
        struct msg_hist_node * new_head = cmhlist->head->next;
        free(cmhlist->head);
        cmhlist->head = new_head;
    }
    if(cmhlist->head != 0) {
        add_event(MSGSEND, 1, (unsigned int)(SENDQ_INTERVAL - (cur_time - cmhlist->head->date)), NORMAL);
    }
    process_messages();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x113b8(%rip), %r14     # 0x1d2b8
testq %r14, %r14
je 0xbf49
cmpq $0x0, (%r14)
je 0xbf49
xorl %edi, %edi
callq 0x21b0
movq %rax, %rbx
movq (%r14), %rdi
movq %rax, %r15
addq $-0x5, %r15
testq %rdi, %rdi
je 0xbf67
movq 0x8(%rdi), %rdx
cmpq %rdx, %r15
jl 0xbf55
movq (%rdi), %rax
subq %rax, 0x10(%r14)
decq 0x18(%r14)
movq 0x10(%rdi), %r12
callq 0x2250
movq %r12, (%r14)
movq %r12, %rdi
jmp 0xbf1f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
subl %ebx, %edx
addl $0x5, %edx
pushq $0x4
popq %rdi
pushq $0x1
popq %rsi
xorl %ecx, %ecx
callq 0xe5c7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xbdd7
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/network.c
// Function: hostname_to_ip
int hostname_to_ip(char *hostname , char *ip) {
    struct hostent *he;
    struct in_addr **addr_list;
    int i;
         
    if ((he = gethostbyname(hostname)) == NULL) {
        herror("gethostbyname");
        return 1;
    }
 
    addr_list = (struct in_addr **) he->h_addr_list;
     
    for(i=0; addr_list[i] != NULL; i++) {
        strcpy(ip , inet_ntoa(*addr_list[i]));
        return 0;
    }

    return 1;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
callq 0x2230
testq %rax, %rax
je 0xbfc3
movq 0x18(%rax), %rax
movq (%rax), %rax
testq %rax, %rax
je 0xbfcf
movl (%rax), %edi
callq 0x20d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21c0
xorl %eax, %eax
jmp 0xbfd2
leaq 0xa2ca(%rip), %rdi      # 0x16294
callq 0x2260
pushq $0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/parse.c
// Function: to_lower
char *to_lower (char *str) {
    for (size_t i=0; i<strlen(str); i++) {
        if (str[i] >= 'A' && str[i] <= 'Z') {
            str[i] += 32;
        }
    }
    return str;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x20c0
cmpq %rax, %r14
jae 0xc002
movb (%rbx,%r14), %al
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0xbffd
orb $0x20, %al
movb %al, (%rbx,%r14)
incq %r14
jmp 0xbfde
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/parse.c
// Function: xor_flip
char *xor_flip (char * password) { //password -> 64
    unsigned int key = 0xDEADBEBE;
    for (size_t i=0; i<strlen(password); i++)
        password[i] ^= key;
    return password;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x20c0
cmpq %rax, %r14
jae 0xc02e
xorb $-0x42, (%rbx,%r14)
incq %r14
jmp 0xc017
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/parse.c
// Function: gen_salt
void gen_salt(char * salt, size_t len) {
    size_t pos;
    for(pos = 0; pos < len-1; pos++) {
        do {
            salt[pos] = (char)(rand() % 256 - 128); //char -> (-128...127); mod 2^x does not skew random distribution
        } while(salt[pos] != 0);
    }
    salt[pos] = '\0';
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
decq %rbx
xorl %r15d, %r15d
cmpq %rbx, %r15
je 0xc064
callq 0x2080
leal -0x80(%rax), %ecx
movb %cl, (%r14,%r15)
cmpb $-0x80, %al
jne 0xc04f
incq %r15
jmp 0xc04a
movb $0x0, (%r14,%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/parse.c
// Function: hash_pwd
void hash_pwd(unsigned char * digest, char const * salt, char const * password) {
    size_t concatlen = strnlen(salt, 16) + strnlen(password, 64) + 2;
    char *concat;
    unsigned int outLen;

    CALLEXIT(!(concat = malloc(concatlen)))
    snprintf(concat, concatlen, "!%s%s", password, salt);

    EVP_MD_CTX *ctx;
    ctx = EVP_MD_CTX_new();

    EVP_DigestInit(ctx, EVP_sha256());
    EVP_DigestUpdate(ctx, concat, concatlen);
    EVP_DigestFinal(ctx, digest, &outLen);

    printf("concat %s - concatlen: %zu - salt: %s - pass: %s - digest: %s\n", concat, concatlen, salt, password, digest);

	free(concat);
    EVP_MD_CTX_free(ctx);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
pushq $0x10
popq %rsi
movq %r15, %rdi
callq 0x2360
movq %rax, %r12
pushq $0x40
popq %rsi
movq %rbx, %rdi
callq 0x2360
leaq (%r12,%rax), %r13
addq $0x2, %r13
movq %r13, %rdi
callq 0x22c0
testq %rax, %rax
je 0xc144
movq %rax, %r12
leaq 0xa247(%rip), %rdx      # 0x16306
movq %rax, %rdi
movq %r13, %rsi
movq %rbx, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x23a0
callq 0x2220
movq %rax, %rbp
callq 0x2400
movq %rbp, %rdi
movq %rax, %rsi
callq 0x2460
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2470
leaq 0x4(%rsp), %rdx
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2300
leaq 0xa1fd(%rip), %rdi      # 0x1630c
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq %rbx, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x2040
movq %r12, %rdi
callq 0x2250
movq %rbp, %rdi
callq 0x2420
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa17a(%rip), %rdi      # 0x162c5
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/parse.c
// Function: hash_cmp
int hash_cmp(unsigned char const * s1, unsigned char const * s2) {
    int i;
    for(i = 0; i < SHA256_DIGEST_LENGTH && s1 && *s1 && s2 && *s2 && *s1 == *s2; i++) {
        s1++;
        s2++;
    }
    return i == SHA256_DIGEST_LENGTH;
}

// Assembly:
xorl %ecx, %ecx
cmpl $0x1f, %ecx
ja 0xc17e
movq %rdi, %rax
addq %rcx, %rax
je 0xc17e
movb (%rax), %al
testb %al, %al
je 0xc17e
movq %rsi, %rdx
addq %rcx, %rdx
je 0xc17e
cmpb (%rdx), %al
jne 0xc17e
incq %rcx
jmp 0xc15a
xorl %eax, %eax
cmpl $0x20, %ecx
sete %al
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/parse.c
// Function: handle_login
void handle_login (char *nick, char *pass __attribute__((unused)), char *real, char *ident) {
    char out[MAX_MESSAGE_BUFFER];
    sprintf(out, "NICK %s\r\n", nick);
    add_msg(out, strlen(out));
    sprintf(out, "USER %s * * :%s\r\n", ident, real);
    add_msg(out, strlen(out));
    //printf(INFO "Using password '%s'\n", pass); //TODO:quieting down warnings for now but this will be nickserv
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rdx
leaq 0xa104(%rip), %rsi      # 0x163fa
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xbd04
leaq 0xa0e7(%rip), %rsi      # 0x16404
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xbd04
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/parse.c
// Function: command_allowed
int command_allowed(char *command, int pindex) { //command -> 16
    if (dawn->players[pindex].travel_timer.active) {
        char disallowed[2][16] = {"melee", "gmelee"}; //remember to change array limits
        for (int i=0; i<2; i++) {
            printf("recv '%s' iter '%s'\n", command, disallowed[i]);
            if (strcmp(command, disallowed[i]) == 0) return 0;
        }
    }
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
leaq 0x13494(%rip), %rax     # 0x1fa80
movq (%rax), %rax
movslq %esi, %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
pushq $0x1
popq %rbx
cmpl $0x0, 0x12ec(%rax,%rcx)
je 0xc65b
movq %rdi, %r14
movaps 0xa070(%rip), %xmm0     # 0x16680
movaps %xmm0, 0x10(%rsp)
movaps 0xa054(%rip), %xmm0     # 0x16670
movaps %xmm0, (%rsp)
leaq 0x9f1f(%rip), %r15      # 0x16546
xorl %ecx, %ecx
leaq 0x10(%rcx), %r13
cmpq $0x30, %r13
je 0xc65b
leaq (%rsp,%rcx), %r12
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2040
movq %r14, %rdi
movq %r12, %rsi
callq 0x22e0
movq %r13, %rcx
testl %eax, %eax
jne 0xc629
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: get_pindex
int get_pindex(char const *username) { //username -> MAX_NICK_LENGTH
    for (int i = 0; i < dawn->player_count; i++) {
        if (strcasecmp(dawn->players[i].username, username) == 0)
            return i;
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x1320e(%rip), %rax     # 0x1fa80
movq (%rax), %r14
movslq 0x148(%r14), %r15
addq $0x1a0, %r14            # imm = 0x1A0
xorl %r12d, %r12d
pushq $-0x1
popq %rbp
cmpq %r15, %r12
jge 0xc8ac
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2210
testl %eax, %eax
je 0xc8a9
incq %r12
addq $0x26a8, %r14           # imm = 0x26A8
jmp 0xc889
movl %r12d, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: get_bindex
int get_bindex (struct Bot *b, char const * username, char const * location) { //username -> MAX_NICK_LENGTH, location -> 64
    int pindex = get_pindex(username);
    for (int i=0; i<MAX_BUILDINGS; i++) {
        if (strcmp(location, dawn->players[pindex].current_map.buildings[i].name) == 0) {
            return i;
        }
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %rdi
callq 0xc860
leaq 0x131b0(%rip), %rcx     # 0x1fa80
movq (%rcx), %rcx
cltq
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
leaq (%rcx,%rax), %r14
addq $0x133c, %r14           # imm = 0x133C
xorl %r15d, %r15d
pushq $-0x1
popq %rbp
cmpq $0x40, %r15
je 0xc90e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22e0
testl %eax, %eax
je 0xc90b
incq %r15
addq $0x50, %r14
jmp 0xc8ed
movl %r15d, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: save_players
void save_players(void) {
    if (dawn == 0)
        return;
    FILE *file = fopen("players.bin", "wb");
    if(!file) {
        PRINTWARN("Could not save players")
        return;
    }
    size_t len;
    CALLEXIT(!(len = fwrite(dawn, sizeof *dawn, 1, file)))
    fclose(file);
    printf(INFO "Saved players (%zu bytes)\n", len * (sizeof *dawn));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x12e6f(%rip), %r14     # 0x1fa80
cmpq $0x0, (%r14)
je 0xcc71
leaq 0x9b5b(%rip), %rdi      # 0x16779
leaq 0x7a65(%rip), %rsi      # 0x1468a
callq 0x2240
testq %rax, %rax
je 0xcc79
movq %rax, %rbx
movq (%r14), %rdi
pushq $0x1
popq %rdx
movl $0xf2eb8, %esi          # imm = 0xF2EB8
movq %rax, %rcx
callq 0x2480
testq %rax, %rax
je 0xcc8c
movq %rax, %r14
movq %rbx, %rdi
callq 0x21f0
imulq $0xf2eb8, %r14, %rsi    # imm = 0xF2EB8
leaq 0x9bb0(%rip), %rdi      # 0x16813
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2040
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x9b05(%rip), %rdi      # 0x16785
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2190
leaq 0x9b2e(%rip), %rdi      # 0x167c1
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: load_players
void load_players(void) {
    FILE *file = fopen("players.bin", "rb");

    if (!file) {
        fprintf(stderr, WARN "Could not load players\n");
        return;
    }

    CALLEXIT(!(fread(dawn, sizeof *dawn, 1, file)))
    fclose(file);
    printf(INFO "Players loaded (%zu bytes)\n", sizeof *dawn);
}

// Assembly:
pushq %rbx
leaq 0x9ad1(%rip), %rdi      # 0x16779
leaq 0x73e8(%rip), %rsi      # 0x14097
callq 0x2240
testq %rax, %rax
je 0xccf7
movq %rax, %rbx
leaq 0x12dbd(%rip), %rax     # 0x1fa80
movq (%rax), %rdi
pushq $0x1
popq %rdx
movl $0xf2eb8, %esi          # imm = 0xF2EB8
movq %rbx, %rcx
callq 0x2330
testq %rax, %rax
je 0xcd14
movq %rbx, %rdi
callq 0x21f0
leaq 0x9bcd(%rip), %rdi      # 0x168b7
movl $0xf2eb8, %esi          # imm = 0xF2EB8
xorl %eax, %eax
popq %rbx
jmp 0x2040
movq 0x102da(%rip), %rax     # 0x1cfd8
movq (%rax), %rcx
leaq 0x9b39(%rip), %rdi      # 0x16841
pushq $0x2a
popq %rsi
pushq $0x1
popq %rdx
popq %rbx
jmp 0x2480
leaq 0x9b51(%rip), %rdi      # 0x1686c
callq 0x2190
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: get_nextlvl_exp
unsigned long long get_nextlvl_exp(char const *username) { //username -> MAX_NICK_LENGTH
    unsigned long long curr_level = (unsigned long long) dawn->players[get_pindex(username)].level;
    if (curr_level > 10) {
        return (500ULL * curr_level * curr_level * curr_level - 500ULL * curr_level);
    } else {
        return (100ULL * curr_level *curr_level * curr_level - 100ULL * curr_level);
    }
}

// Assembly:
pushq %rbx
leaq 0x12d50(%rip), %rax     # 0x1fa80
movq (%rax), %rbx
callq 0xc860
cltq
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
movslq 0x2808(%rbx,%rax), %rcx
movq %rcx, %rdx
imulq %rcx, %rdx
cmpq $0xb, %rcx
movl $0x1f4, %esi            # imm = 0x1F4
pushq $0x64
popq %rax
cmovaeq %rsi, %rax
imulq %rdx, %rax
leaq -0x1f4(%rax), %rdx
addq $-0x64, %rax
cmpq $0xb, %rcx
cmovaeq %rdx, %rax
imulq %rcx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: check_levelup
void check_levelup(struct Message *message) {
    int i = get_pindex(message->sender_nick);
    char out[MAX_MESSAGE_BUFFER];
    unsigned long long next_level_exp = get_nextlvl_exp(message->sender_nick);
    unsigned long long curr_level_exp = dawn->players[i].experience;
    int curr_level = dawn->players[i].level;

    if (curr_level_exp >= next_level_exp) {
        dawn->players[i].level++;
        dawn->players[i].max_health += 25;
        dawn->players[i].max_mana += 25;
        dawn->players[i].attr_pts += 20;
        dawn->players[i].health = dawn->players[i].max_health;
        dawn->players[i].mana = dawn->players[i].max_mana;
        check_learn_spells(message->sender_nick);

        if (dawn->players[i].experience > get_nextlvl_exp(message->sender_nick)) {
            check_levelup(message);
            return;
        }

        if (dawn->players[i].experience < get_nextlvl_exp(message->sender_nick)) {
            sprintf(out, "PRIVMSG %s :%s has achieved level %d. 20 attribute points ready for assignment, HP and MP"
                    " increased +25! Increase your attributes using the ;assign command!\r\n",
                    message->receiver, message->sender_nick, curr_level + 1);
            add_msg(out, strlen(out));
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
callq 0xc860
movl %eax, %ebp
movq %rbx, %rdi
callq 0xcd28
leaq 0x12943(%rip), %r14     # 0x1fa80
movq (%r14), %rcx
movslq %ebp, %rdx
imulq $0x26a8, %rdx, %r15     # imm = 0x26A8
cmpq %rax, 0x27f8(%rcx,%r15)
jae 0xd162
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq (%rcx,%r15), %rax
addq $0x1a0, %rax            # imm = 0x1A0
addq $0x1a0, %rcx            # imm = 0x1A0
movl 0x2668(%rax), %ebp
incl %ebp
movl %ebp, 0x2668(%rax)
movslq 0x2670(%rcx,%r15), %rdx
addq $0x19, %rdx
movl %edx, 0x2670(%rcx,%r15)
movl 0x2674(%rcx,%r15), %esi
addl $0x19, %esi
movl %esi, 0x2674(%rcx,%r15)
addl $0x14, 0x2698(%rcx,%r15)
movq %rdx, 0x2650(%rax)
movl %esi, 0x2680(%rax)
movq %rbx, %rdi
callq 0xdd6c
movq (%r14), %rax
movq 0x27f8(%rax,%r15), %r14
movq %rbx, %rdi
callq 0xcd28
cmpq %rax, %r14
jbe 0xd1f3
movq %rbx, %rdi
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xd117
jae 0xd154
leaq 0xc0(%rbx), %rdx
leaq 0x978e(%rip), %rsi      # 0x16995
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2050
movq %r14, %rdi
callq 0x20c0
movq %r14, %rdi
movq %rax, %rsi
callq 0xbd04
jmp 0xd154
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: assign_attr_points
void assign_attr_points(struct Message *message, char *which, int amount) {
    int pindex = get_pindex(message->sender_nick);
    int attr_pts = dawn->players[pindex].attr_pts;
    char out[MAX_MESSAGE_BUFFER];

    if (strcmp(which, "str") == 0 && attr_pts >= amount) {
        dawn->players[pindex].strength += amount;
    } else if (strcmp(which, "def") == 0 && attr_pts >= amount) {
        dawn->players[pindex].defense += amount;
    } else if (strcmp(which, "int") == 0 && attr_pts >= amount) {
        dawn->players[pindex].intelligence += amount;
    } else if (strcmp(which, "mdef") == 0 && attr_pts >= amount) {
        dawn->players[pindex].m_def += amount;
    } else {
        sprintf(out, "PRIVMSG %s :%s, you have chosen an invalid attribute to increase or do not have the amount "
                "of attribute points required: (%d points available)\r\n", message->receiver, message->sender_nick, attr_pts);
        add_msg(out, strlen(out));
        return;
    }
    dawn->players[pindex].attr_pts -= amount;
    sprintf(out, "PRIVMSG %s :%s has increased %s by %d, you have %d attribute points available\r\n", message->receiver,
            message->sender_nick, which, amount, attr_pts - amount);
    add_msg(out, strlen(out));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, 0x18(%rsp)
callq 0xc860
leaq 0x12827(%rip), %rcx     # 0x1fa80
movq (%rcx), %r12
leaq 0x1a0(%r12), %rbx
cltq
imulq $0x26a8, %rax, %r13     # imm = 0x26A8
movl 0x2838(%r12,%r13), %r15d
leaq 0x97b8(%rip), %rsi      # 0x16a34
movq %r14, %rdi
callq 0x22e0
testl %eax, %eax
setne %al
movl %r15d, 0xc(%rsp)
subl %ebp, %r15d
setl %cl
orb %al, %cl
je 0xd324
movq %rbx, 0x10(%rsp)
cmpl %ebp, 0xc(%rsp)
setl %bl
leaq 0x978e(%rip), %rsi      # 0x16a3d
movq %r14, %rdi
callq 0x22e0
testl %eax, %eax
setne %al
orb %bl, %al
je 0xd32e
cmpl %ebp, 0xc(%rsp)
setl %bl
leaq 0x976a(%rip), %rsi      # 0x16a38
movq %r14, %rdi
callq 0x22e0
testl %eax, %eax
setne %al
orb %bl, %al
je 0xd33d
cmpl %ebp, 0xc(%rsp)
setl %bl
leaq 0x974f(%rip), %rsi      # 0x16a3c
movq %r14, %rdi
callq 0x22e0
testl %eax, %eax
setne %al
orb %bl, %al
je 0xd34c
movq 0x18(%rsp), %rcx
leaq 0xc0(%rcx), %rdx
leaq 0x9730(%rip), %rsi      # 0x16a41
leaq 0x20(%rsp), %rdi
movl 0xc(%rsp), %r8d
xorl %eax, %eax
callq 0x2050
jmp 0xd38f
addl %ebp, 0x2684(%rbx,%r13)
jmp 0xd359
movq 0x10(%rsp), %rax
addl %ebp, 0x268c(%rax,%r13)
jmp 0xd359
movq 0x10(%rsp), %rax
addl %ebp, 0x2688(%rax,%r13)
jmp 0xd359
movq 0x10(%rsp), %rax
addl %ebp, 0x2690(%rax,%r13)
leaq (%r12,%r13), %rax
addq $0x2838, %rax           # imm = 0x2838
movl %r15d, (%rax)
movq 0x18(%rsp), %rcx
leaq 0xc0(%rcx), %rdx
movl %r15d, (%rsp)
leaq 0x9755(%rip), %rsi      # 0x16ad2
leaq 0x20(%rsp), %rdi
movq %r14, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0x2050
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xbd04
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: revive
void revive(struct Message *message) {
    char out[MAX_MESSAGE_BUFFER];
    int pindex = get_pindex(message->sender_nick);
    int cur_x = dawn->players[pindex].pos_x;
    int cur_y = dawn->players[pindex].pos_y;

    if (cur_x == 7 && cur_y == 4) {
        if (!dawn->players[pindex].alive) {
            dawn->players[pindex].health = dawn->players[pindex].max_health;
            dawn->players[pindex].mana = dawn->players[pindex].max_mana;
            dawn->players[pindex].alive = 1;
            dawn->players[pindex].fullness = 100;
            sprintf(out, "PRIVMSG %s :%s, you have been revived!\r\n", message->receiver, message->sender_nick);
        } else {
            sprintf(out, "PRIVMSG %s :%s, you are not dead\r\n", message->receiver, message->sender_nick);
        }
    } else {
        sprintf(out, "PRIVMSG %s :%s, you must be at a shrine to revive!\r\n", message->receiver, message->sender_nick);
    }
    add_msg(out, strlen(out));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
callq 0xc860
leaq 0x126ae(%rip), %rcx     # 0x1fa80
movq (%rcx), %rcx
cltq
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
cmpl $0x7, 0x278c(%rcx,%rax)
leaq 0x9781(%rip), %rsi      # 0x16b6e
jne 0xd453
cmpl $0x4, 0x2790(%rcx,%rax)
jne 0xd453
leaq (%rcx,%rax), %rdx
addq $0x1a0, %rdx            # imm = 0x1A0
cmpl $0x0, 0x2660(%rdx)
je 0xd416
leaq 0x9737(%rip), %rsi      # 0x16b4b
jmp 0xd453
addq $0x1a0, %rcx            # imm = 0x1A0
movslq 0x2670(%rdx), %rsi
movq %rsi, 0x2650(%rdx)
movl 0x2674(%rdx), %esi
movl %esi, 0x2680(%rdx)
movl $0x1, 0x2660(%rcx,%rax)
movw $0x64, 0x26a2(%rcx,%rax)
leaq 0x96cf(%rip), %rsi      # 0x16b22
leaq 0xc0(%rbx), %rdx
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2050
movq %r14, %rdi
callq 0x20c0
movq %r14, %rdi
movq %rax, %rsi
callq 0xbd04
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/player.c
// Function: str_to_auth_level
enum auth_level str_to_auth_level(char * al) {
    if(strcasecmp(al, "USER") == 0) {
        return AL_USER;
    } else if(strcasecmp(al, "REG") == 0) {
        return AL_REG;
    } else if(strcasecmp(al, "ADMIN") == 0) {
        return AL_ADMIN;
    } else if(strcasecmp(al, "ROOT") == 0) {
        return AL_ROOT;
    }
    return AL_NOAUTH;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x96e9(%rip), %rsi      # 0x16bab
callq 0x2210
testl %eax, %eax
je 0xd50e
leaq 0x96de(%rip), %rsi      # 0x16bb0
movq %rbx, %rdi
callq 0x2210
testl %eax, %eax
je 0xd512
leaq 0x96cf(%rip), %rsi      # 0x16bb4
movq %rbx, %rdi
callq 0x2210
testl %eax, %eax
je 0xd516
leaq 0x96c2(%rip), %rsi      # 0x16bba
movq %rbx, %rdi
callq 0x2210
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
sete %al
shll $0x2, %eax
jmp 0xd519
pushq $0x1
jmp 0xd518
pushq $0x2
jmp 0xd518
pushq $0x3
popq %rax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/spells.c
// Function: cast_teleport
void cast_teleport(const char *username, int x, int y) {
    struct Message temp;
    strcpy(temp.sender_nick, username);
    strcpy(temp.receiver, dawn->active_room);
    move_player(&temp, x, y, 1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x900, %rsp            # imm = 0x900
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %rsi
movq %rsp, %r14
movq %r14, %rdi
callq 0x21c0
leaq 0xc0(%rsp), %rdi
leaq 0x11e71(%rip), %rax     # 0x1fa80
movl $0x100, %esi            # imm = 0x100
addq (%rax), %rsi
callq 0x21c0
pushq $0x1
popq %rcx
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xa058
addq $0x900, %rsp            # imm = 0x900
popq %rbx
popq %r14
popq %rbp
retq