LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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
movl $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 0x2280
movq (%r12), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x2070
movl %eax, 0x12766(%rip)     # 0x1f2c0
cmpl $-0x1, %eax
je 0xcbbb
leaq 0xa355(%rip), %rdi      # 0x16ebb
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2040
movl 0x12747(%rip), %edi     # 0x1f2c0
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
callq 0x2180
cmpl $-0x1, %eax
je 0xcbc0
leaq 0xa3b2(%rip), %rdi      # 0x16f48
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2040
movq 0x8(%rsp), %rdi
callq 0x22a0
movl (%rbx), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x2d98
callq 0x2d83
// File: /workspace/github_c_makefile_star2_O1/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 0x126c4(%rip), %rbx     # 0x1f2b8
testq %rbx, %rbx
setne %al
andb 0x126c4(%rip), %al      # 0x1f2c4
cmpb $0x1, %al
jne 0xcc2c
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xcc1d
movq 0x10(%rdi), %r14
callq 0x2240
movq %r14, %rdi
testq %r14, %r14
jne 0xcc0c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2240
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x12678(%rip), %r15     # 0x1f2b8
testq %r15, %r15
je 0xccbb
movq %rdi, %rbx
xorl %edi, %edi
callq 0x21b0
movq %rax, %r14
cmpq $0x0, (%r15)
je 0xcc7a
movl $0x1, %edi
movl $0x18, %esi
callq 0x2110
movq 0x8(%r15), %rcx
movq %rax, 0x10(%rcx)
testq %rax, %rax
je 0xccc1
movq %rax, 0x8(%r15)
jmp 0xcca8
movl $0x4, %edi
xorl %esi, %esi
movl $0x5, %edx
xorl %ecx, %ecx
callq 0xf5b7
movl $0x1, %edi
movl $0x18, %esi
callq 0x2110
movq %rax, 0x8(%r15)
movq %rax, (%r15)
testq %rax, %rax
je 0xccc6
movq 0x8(%r15), %rax
movq %r14, 0x8(%rax)
movq %rbx, (%rax)
addq %rbx, 0x10(%r15)
incq 0x18(%r15)
popq %rbx
popq %r14
popq %r15
retq
callq 0x2dc2
callq 0x2dd7
// File: /workspace/github_c_makefile_star2_O1/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 0x125d9(%rip), %rbx     # 0x1f2b0
testq %rbx, %rbx
je 0xcd16
testb $0x1, 0x125e5(%rip)     # 0x1f2c8
je 0xcd16
movq (%rbx), %r14
testq %r14, %r14
je 0xcd09
movq (%r14), %rdi
movq 0x10(%r14), %r15
callq 0x2240
movq %r14, %rdi
callq 0x2240
movq %r15, %r14
testq %r15, %r15
jne 0xcced
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2240
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
pushq %rax
movq 0x12585(%rip), %r15     # 0x1f2b0
testq %r15, %r15
je 0xcd60
movq %rsi, %rbx
movq %rdi, %r14
movq (%r15), %r12
movl $0x1, %edi
movl $0x18, %esi
callq 0x2110
testq %r12, %r12
je 0xcd6c
movq 0x8(%r15), %rcx
movq %rax, 0x10(%rcx)
testq %rax, %rax
je 0xcdbd
movq %rax, 0x8(%r15)
jmp 0xcd78
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, 0x8(%r15)
movq %rax, (%r15)
testq %rax, %rax
je 0xcdc2
leaq 0x1(%rbx), %rdi
callq 0x22b0
movq 0x8(%r15), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0xcdb8
movq %rax, %rdi
movq %r14, %rsi
callq 0x21c0
movq 0x8(%r15), %rax
movq %rbx, 0x8(%rax)
addq %rbx, 0x10(%r15)
incq 0x18(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xcdc7
callq 0x2e01
callq 0x2dec
callq 0x2e16
// File: /workspace/github_c_makefile_star2_O1/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 0x124d7(%rip), %r13     # 0x1f2b0
testq %r13, %r13
sete %al
movq 0x124d2(%rip), %r12     # 0x1f2b8
testq %r12, %r12
sete %cl
orb %al, %cl
je 0xcdff
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, (%r13)
je 0xcebd
cmpq $0x9, 0x18(%r12)
ja 0xcebd
movq 0x12493(%rip), %rax     # 0x1f2b0
testq %rax, %rax
je 0xce30
movq (%rax), %rax
testq %rax, %rax
je 0xce30
movq 0x8(%rax), %r14
jmp 0xce33
xorl %r14d, %r14d
movq 0x10(%r12), %rax
addq %r14, %rax
cmpq $0x1f3, %rax            # imm = 0x1F3
ja 0xcebd
cmpq $0x191, %r14            # imm = 0x191
jae 0xceaf
movq 0x1245d(%rip), %rbp     # 0x1f2b0
testq %rbp, %rbp
je 0xce8c
movq (%rbp), %rdi
testq %rdi, %rdi
je 0xce8c
movq (%rdi), %r15
movq 0x8(%rdi), %rax
subq %rax, 0x10(%rbp)
decq 0x18(%rbp)
movq 0x10(%rdi), %rbx
callq 0x2240
movq %rbx, (%rbp)
testq %rbx, %rbx
jne 0xce8f
movq $0x0, 0x8(%rbp)
jmp 0xce8f
xorl %r15d, %r15d
movq %r15, %rdi
movq %r14, %rsi
callq 0xcbca
movq %r15, %rdi
callq 0x2240
movq %r14, %rdi
callq 0xcc34
jmp 0xcdff
leaq 0xa37d(%rip), %rdi      # 0x17233
callq 0x2190
jmp 0xce4c
cmpq $0x9, 0x18(%r12)
ja 0xcef6
movq 0x10(%r12), %rax
movq 0x123df(%rip), %rcx     # 0x1f2b0
testq %rcx, %rcx
je 0xcee4
movq (%rcx), %rcx
testq %rcx, %rcx
je 0xcee4
movq 0x8(%rcx), %rcx
jmp 0xcee6
xorl %ecx, %ecx
addq %rax, %rcx
cmpq $0x1f4, %rcx            # imm = 0x1F4
jb 0xcdf0
leaq 0xa37b(%rip), %rdi      # 0x17278
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2330
// File: /workspace/github_c_makefile_star2_O1/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 0x12399(%rip), %r14     # 0x1f2b8
testq %r14, %r14
je 0xcf6d
cmpq $0x0, (%r14)
je 0xcf6d
xorl %edi, %edi
callq 0x21b0
movq %rax, %rbx
movq (%r14), %r15
testq %r15, %r15
sete %al
je 0xcf97
leaq -0x5(%rbx), %r12
cmpq 0x8(%r15), %r12
jl 0xcf79
movq %r15, %rdi
movq (%r15), %rax
subq %rax, 0x10(%r14)
decq 0x18(%r14)
movq 0x10(%r15), %r15
callq 0x2240
movq %r15, (%r14)
testq %r15, %r15
sete %al
jne 0xcf43
jmp 0xcf97
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
testb %al, %al
jne 0xcf97
movl 0x8(%r15), %edx
subl %ebx, %edx
addl $0x5, %edx
movl $0x4, %edi
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xf5b7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xcdc7
// File: /workspace/github_c_makefile_star2_O1/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 0x2220
testq %rax, %rax
je 0xcff3
movq 0x18(%rax), %rax
movq (%rax), %rax
testq %rax, %rax
je 0xcfff
movl (%rax), %edi
callq 0x20d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21c0
xorl %eax, %eax
jmp 0xd004
leaq 0xa270(%rip), %rdi      # 0x1726a
callq 0x2250
movl $0x1, %eax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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
cmpb $0x0, (%rdi)
je 0xd039
xorl %r14d, %r14d
movb (%rbx,%r14), %al
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0xd029
orb $0x20, %al
movb %al, (%rbx,%r14)
incq %r14
movq %rbx, %rdi
callq 0x20c0
cmpq %rax, %r14
jb 0xd017
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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
cmpb $0x0, (%rdi)
je 0xd068
xorl %r14d, %r14d
xorb $-0x42, (%rbx,%r14)
incq %r14
movq %rbx, %rdi
callq 0x20c0
cmpq %rax, %r14
jb 0xd053
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rdi, %rbx
xorl %r15d, %r15d
decq %r14
je 0xd09e
callq 0x2080
leal -0x80(%rax), %ecx
movb %cl, (%rbx,%r15)
cmpb $-0x80, %al
jne 0xd086
incq %r15
cmpq %r14, %r15
jne 0xd086
movb $0x0, (%rbx,%r15)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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
movl $0x10, %esi
movq %r15, %rdi
callq 0x2350
movq %rax, %r12
movl $0x40, %esi
movq %rbx, %rdi
callq 0x2350
leaq (%r12,%rax), %r13
addq $0x2, %r13
movq %r13, %rdi
callq 0x22b0
testq %rax, %rax
je 0xd182
movq %rax, %r12
leaq 0xa1df(%rip), %rdx      # 0x172dc
movq %rax, %rdi
movq %r13, %rsi
movq %rbx, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x2390
callq 0x2210
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 0x22f0
leaq 0xa195(%rip), %rdi      # 0x172e2
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq %rbx, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x2040
movq %r12, %rdi
callq 0x2240
movq %rbp, %rdi
callq 0x2420
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2e2b
// File: /workspace/github_c_makefile_star2_O1/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:
testq %rdi, %rdi
je 0xd1b7
xorl %ecx, %ecx
movb (%rdi,%rcx), %al
testb %al, %al
je 0xd1ae
movq %rsi, %rdx
addq %rcx, %rdx
je 0xd1ae
cmpb (%rdx), %al
jne 0xd1ae
incq %rcx
cmpl $0x20, %ecx
jne 0xd18e
movl $0x20, %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
sete %al
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/parse.c
// Function: matches_regex
int matches_regex (char *buf, const char *regular_expression) {
    pcre *regex_compiled;
    pcre_extra *pcre_optimized;
    int pcre_return;
    int pcre_error_offset;
    int substring_vec[30];
    const char *p_sub_str_match_str;
    const char *pcre_error;

    regex_compiled = pcre_compile(regular_expression, PCRE_MULTILINE,
                                  &pcre_error, &pcre_error_offset, NULL);

    if (regex_compiled == NULL) {
        fprintf(stderr, ERR "parse/matches_regex: Could not compile regular expression: %s (%s)\n",
                regular_expression, pcre_error);
        exit(1);
    }

    pcre_optimized = pcre_study(regex_compiled, 0, &pcre_error);

    if (pcre_error != NULL) {
        fprintf(stderr, ERR "parse/matches_regex: Could not optimize regular expression: %s (%s)\n", regular_expression, pcre_error);
        exit(1);
    }

    pcre_return = pcre_exec(regex_compiled, pcre_optimized, buf,
                            (int)strlen(buf), 0, PCRE_NOTEOL, substring_vec, 30);
    pcre_free(regex_compiled);
    pcre_free(pcre_optimized);

    if (pcre_return > 0) {
        int j;
        for (j=0; j<pcre_return; j++) {
            pcre_get_substring(buf, substring_vec, pcre_return, j, &(p_sub_str_match_str));
            strcpy(regex_group[j], p_sub_str_match_str);
            pcre_free_substring(p_sub_str_match_str);
        }
        //We've found a match
        return 1;
    } else {
        //We've not found a match
        return 0;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rsp), %rdx
leaq 0x1c(%rsp), %rcx
movq %rsi, %rdi
movl $0x2, %esi
xorl %r8d, %r8d
callq 0x23c0
testq %rax, %rax
je 0xd2cd
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x8(%rsp), %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x23e0
movq (%r13), %rsi
testq %rsi, %rsi
jne 0xd2da
movq %rax, %r12
movq %rbx, %rdi
callq 0x20c0
leaq 0x20(%rsp), %r10
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %r13
movq %rbx, %rdx
movl %eax, %ecx
xorl %r8d, %r8d
movl $0x100, %r9d            # imm = 0x100
pushq $0x1e
pushq %r10
callq 0x2300
addq $0x10, %rsp
movl %eax, %r15d
movq 0x11d7a(%rip), %rbx     # 0x1efd0
movq %r14, %rdi
callq *(%rbx)
movq %r12, %rdi
callq *(%rbx)
testl %r15d, %r15d
jle 0xd2b9
movl %r15d, %r14d
leaq 0x13071(%rip), %r15     # 0x202e0
xorl %r12d, %r12d
leaq 0x10(%rsp), %rbp
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
movl %r14d, %edx
movl %r12d, %ecx
movq %rbp, %r8
callq 0x2130
movq 0x10(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x21a0
incq %r12
addq $0x190, %r15            # imm = 0x190
cmpq %r12, %r14
jne 0xd277
movl $0x1, %ebp
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x2e67
movq %r15, %rdi
callq 0x2e40
// File: /workspace/github_c_makefile_star2_O1/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 0xa0d2(%rip), %rsi      # 0x173d0
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xcd1c
leaq 0xa0b5(%rip), %rsi      # 0x173da
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 0xcd1c
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
leaq 0x1448b(%rip), %rax     # 0x21a80
movq (%rax), %rax
movslq %esi, %rcx
imulq $0x26a8, %rcx, %rcx     # imm = 0x26A8
cmpl $0x0, 0x12ec(%rax,%rcx)
je 0xd691
movq %rdi, %rbx
movaps 0xa036(%rip), %xmm0     # 0x17650
movq %rsp, %r14
movaps %xmm0, 0x10(%r14)
movaps 0xa017(%rip), %xmm0     # 0x17640
movaps %xmm0, (%r14)
leaq 0x9ee8(%rip), %rdi      # 0x1751c
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2040
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22d0
testl %eax, %eax
je 0xd696
leaq 0x10(%rsp), %r14
xorl %ecx, %ecx
leaq 0x9ebc(%rip), %r15      # 0x1751c
testb $0x1, %cl
jne 0xd691
movl %ecx, %r12d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2040
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22d0
movb $0x1, %cl
testl %eax, %eax
jne 0xd660
xorl %ebp, %ebp
testb $0x1, %r12b
je 0xd696
movl $0x1, %ebp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x141d4(%rip), %rax     # 0x21a80
movq (%rax), %r15
movslq 0x148(%r15), %r12
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %r12, %r12
jle 0xd8f0
movq %rdi, %r14
addq $0x1a0, %r15            # imm = 0x1A0
xorl %r13d, %r13d
movq %r15, %rdi
movq %r14, %rsi
callq 0x2200
testl %eax, %eax
je 0xd8ed
incq %r13
addq $0x26a8, %r15           # imm = 0x26A8
cmpq %r13, %r12
jne 0xd8cd
jmp 0xd8f0
movl %r13d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %rdi
callq 0xd89c
leaq 0x1416d(%rip), %rcx     # 0x21a80
movq (%rcx), %rcx
cltq
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
leaq (%rcx,%rax), %r15
addq $0x133c, %r15           # imm = 0x133C
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22d0
testl %eax, %eax
je 0xd94f
incq %r14
addq $0x50, %r15
cmpq $0x40, %r14
jne 0xd92d
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x13e2d(%rip), %r14     # 0x21a80
cmpq $0x0, (%r14)
je 0xdcb5
leaq 0x9ae9(%rip), %rdi      # 0x17749
leaq 0x7a2b(%rip), %rsi      # 0x15692
callq 0x2230
testq %rax, %rax
je 0xdcbd
movq %rax, %rbx
movq (%r14), %rdi
movl $0xf2eb8, %esi          # imm = 0xF2EB8
movl $0x1, %edx
movq %rax, %rcx
callq 0x2480
testq %rax, %rax
je 0xdcd0
movq %rax, %r14
movq %rbx, %rdi
callq 0x21f0
imulq $0xf2eb8, %r14, %rsi    # imm = 0xF2EB8
leaq 0x9b3c(%rip), %rdi      # 0x177e3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2040
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x9a91(%rip), %rdi      # 0x17755
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2190
callq 0x2e91
// File: /workspace/github_c_makefile_star2_O1/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 0x9a6c(%rip), %rdi      # 0x17749
leaq 0x73bb(%rip), %rsi      # 0x1509f
callq 0x2230
testq %rax, %rax
je 0xdd2e
movq %rax, %rbx
leaq 0x13d88(%rip), %rax     # 0x21a80
movq (%rax), %rdi
movl $0xf2eb8, %esi          # imm = 0xF2EB8
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2320
testq %rax, %rax
je 0xdd35
movq %rbx, %rdi
callq 0x21f0
leaq 0x9b66(%rip), %rdi      # 0x17887
movl $0xf2eb8, %esi          # imm = 0xF2EB8
xorl %eax, %eax
popq %rbx
jmp 0x2040
callq 0x2ebb
popq %rbx
retq
callq 0x2ea6
// File: /workspace/github_c_makefile_star2_O1/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 0x13d3e(%rip), %rax     # 0x21a80
movq (%rax), %rbx
callq 0xd89c
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
movl $0x64, %eax
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_O1/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 0xd89c
movl %eax, %ebp
movq %rbx, %rdi
callq 0xdd3a
leaq 0x1396b(%rip), %r14     # 0x21a80
movq (%r14), %rcx
movslq %ebp, %rdx
imulq $0x26a8, %rdx, %r15     # imm = 0x26A8
cmpq %rax, 0x27f8(%rcx,%r15)
jae 0xe13a
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)
addl $0x19, 0x2670(%rcx,%r15)
addl $0x19, 0x2674(%rcx,%r15)
addl $0x14, 0x2698(%rcx,%r15)
movslq 0x2670(%rax), %rcx
movq %rcx, 0x2650(%rax)
movl 0x2674(%rax), %ecx
movl %ecx, 0x2680(%rax)
movq %rbx, %rdi
callq 0xed68
movq (%r14), %rax
movq 0x27f8(%rax,%r15), %r14
movq %rbx, %rdi
callq 0xdd3a
cmpq %rax, %r14
jbe 0xe1c3
movq %rbx, %rdi
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe0ef
jae 0xe12c
leaq 0xc0(%rbx), %rdx
leaq 0x978e(%rip), %rsi      # 0x17965
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 0xcd1c
jmp 0xe12c
// File: /workspace/github_c_makefile_star2_O1/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 0xd89c
leaq 0x13857(%rip), %rcx     # 0x21a80
movq (%rcx), %r12
leaq 0x1a0(%r12), %rbx
cltq
imulq $0x26a8, %rax, %r13     # imm = 0x26A8
movl 0x2838(%r12,%r13), %r15d
leaq 0x97b8(%rip), %rsi      # 0x17a04
movq %r14, %rdi
callq 0x22d0
testl %eax, %eax
setne %al
movl %r15d, 0xc(%rsp)
subl %ebp, %r15d
setl %cl
orb %al, %cl
je 0xe2f4
movq %rbx, 0x10(%rsp)
cmpl %ebp, 0xc(%rsp)
setl %bl
leaq 0x978e(%rip), %rsi      # 0x17a0d
movq %r14, %rdi
callq 0x22d0
testl %eax, %eax
setne %al
orb %bl, %al
je 0xe2fe
cmpl %ebp, 0xc(%rsp)
setl %bl
leaq 0x976a(%rip), %rsi      # 0x17a08
movq %r14, %rdi
callq 0x22d0
testl %eax, %eax
setne %al
orb %bl, %al
je 0xe30d
cmpl %ebp, 0xc(%rsp)
setl %bl
leaq 0x974f(%rip), %rsi      # 0x17a0c
movq %r14, %rdi
callq 0x22d0
testl %eax, %eax
setne %al
orb %bl, %al
je 0xe31c
movq 0x18(%rsp), %rcx
leaq 0xc0(%rcx), %rdx
leaq 0x9730(%rip), %rsi      # 0x17a11
leaq 0x20(%rsp), %rdi
movl 0xc(%rsp), %r8d
xorl %eax, %eax
callq 0x2050
jmp 0xe35e
addl %ebp, 0x2684(%rbx,%r13)
jmp 0xe329
movq 0x10(%rsp), %rax
addl %ebp, 0x268c(%rax,%r13)
jmp 0xe329
movq 0x10(%rsp), %rax
addl %ebp, 0x2688(%rax,%r13)
jmp 0xe329
movq 0x10(%rsp), %rax
addl %ebp, 0x2690(%rax,%r13)
leaq (%r12,%r13), %rax
addq $0x2838, %rax           # imm = 0x2838
subl %ebp, (%rax)
movq 0x18(%rsp), %rcx
leaq 0xc0(%rcx), %rdx
movl %r15d, (%rsp)
leaq 0x9756(%rip), %rsi      # 0x17aa2
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 0xcd1c
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xd89c
leaq 0x136df(%rip), %rcx     # 0x21a80
movq (%rcx), %rcx
cltq
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
cmpl $0x7, 0x278c(%rcx,%rax)
leaq 0x9782(%rip), %rsi      # 0x17b3e
jne 0xe422
cmpl $0x4, 0x2790(%rcx,%rax)
jne 0xe422
leaq (%rcx,%rax), %rdx
addq $0x1a0, %rdx            # imm = 0x1A0
cmpl $0x0, 0x2660(%rdx)
je 0xe3e5
leaq 0x9738(%rip), %rsi      # 0x17b1b
jmp 0xe422
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 0x96d0(%rip), %rsi      # 0x17af2
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 0xcd1c
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x96ea(%rip), %rsi      # 0x17b7b
callq 0x2200
testl %eax, %eax
je 0xe4dd
leaq 0x96df(%rip), %rsi      # 0x17b80
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0xe4e4
leaq 0x96d0(%rip), %rsi      # 0x17b84
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0xe4eb
leaq 0x96c3(%rip), %rsi      # 0x17b8a
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
sete %al
shll $0x2, %eax
jmp 0xe4f0
movl $0x1, %eax
jmp 0xe4f0
movl $0x2, %eax
jmp 0xe4f0
movl $0x3, %eax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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 0x12e80(%rip), %rax     # 0x21a80
movl $0x100, %esi            # imm = 0x100
addq (%rax), %rsi
callq 0x21c0
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
movl $0x1, %ecx
callq 0xaf9c
addq $0x900, %rsp            # imm = 0x900
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/spells.c
// Function: cast_rain
void cast_rain(const char *username) {
    int pindex = get_pindex(username);
    char out[MAX_MESSAGE_BUFFER];

    if (!dawn->players[pindex].spellbook.rain.learned) {
        snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :%s, you do not know this spell\r\n",
                 dawn->active_room, username);
        add_msg(out, strlen(out));
        return;
    }

    int rain_cost = 1 + dawn->players[pindex].spellbook.rain.level * 6;
    int rain_amount = 1 + rand() % (dawn->players[pindex].spellbook.rain.level * 6);

    if (dawn->players[pindex].mana >= rain_cost) {
        dawn->players[pindex].mana -= rain_cost;

        for (int i = 0; i < dawn->player_count; i++) {
            dawn->players[i].fullness += rain_amount;
            if (dawn->players[i].fullness >= 100) dawn->players[i].fullness = 100;
        }

        snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :%s has conjured up a storm. Rain pours down "
                "upon the town, allowing the crops to flourish! Everyone's fullness +%d!\r\n",
                 dawn->active_room, username, rain_amount);
    } else {
        snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :%s, you do not have enough mana to cast this spell\r\n",
                 dawn->active_room, username);
    }
    add_msg(out, strlen(out));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
callq 0xd89c
leaq 0x12e3a(%rip), %r15     # 0x21a80
movq (%r15), %rcx
cltq
imulq $0x26a8, %rax, %r14     # imm = 0x26A8
cmpl $0x0, 0x1304(%rcx,%r14)
je 0xed14
leaq (%rcx,%r14), %rax
addq $0x12fc, %rax           # imm = 0x12FC
movl (%rax), %eax
addl %eax, %eax
leal (%rax,%rax,2), %ebp
callq 0x2080
movq (%r15), %rcx
movl 0x12fc(%rcx,%r14), %edx
addl %edx, %edx
leal (%rdx,%rdx,2), %esi
cltd
idivl %esi
movl 0x2820(%rcx,%r14), %eax
cmpl %ebp, %eax
jle 0xed24
movl %edx, %r9d
leaq (%rcx,%r14), %rdx
addq $0x1a0, %rdx            # imm = 0x1A0
incl %r9d
notl %ebp
addl %ebp, %eax
movl %eax, 0x2680(%rdx)
cmpl $0x0, 0x148(%rcx)
jle 0xecf2
leaq 0x2842(%rcx), %rax
xorl %edx, %edx
movzwl (%rax), %esi
addw %r9w, %si
cmpw $0x64, %si
movl $0x64, %edi
cmovll %esi, %edi
movw %di, (%rax)
incq %rdx
movslq 0x148(%rcx), %rsi
addq $0x26a8, %rax           # imm = 0x26A8
cmpq %rsi, %rdx
jl 0xecc7
addq $0x100, %rcx            # imm = 0x100
leaq 0x93ed(%rip), %rdx      # 0x180ed
movq %rsp, %rdi
movl $0x190, %esi            # imm = 0x190
movq %rbx, %r8
xorl %eax, %eax
callq 0x2390
jmp 0xed44
addq $0x100, %rcx            # imm = 0x100
leaq 0x9061(%rip), %rdx      # 0x17d83
jmp 0xed32
addq $0x100, %rcx            # imm = 0x100
leaq 0x943d(%rip), %rdx      # 0x1816f
movq %rsp, %rdi
movl $0x190, %esi            # imm = 0x190
movq %rbx, %r8
xorl %eax, %eax
callq 0x2390
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xcd1c
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/stats.c
// Function: get_stat
void get_stat(struct Message *m, int stats[7]) {
    int i = get_pindex(m->sender_nick);
    if (i == -1) {
        return;
    }
    for (int j = 0; j < (MAX_INVENTORY_SLOTS - dawn->players[i].available_slots); j++) {
        if (is_equipped(i, j)) {
            stats[0] += dawn->players[i].inventory[j].attr_health;
            stats[1] += dawn->players[i].inventory[j].attr_mana;
            stats[2] += dawn->players[i].inventory[j].attr_strength;
            stats[3] += dawn->players[i].inventory[j].attr_intelligence;
            stats[4] += dawn->players[i].inventory[j].attr_mdef;
            stats[5] += dawn->players[i].inventory[j].attr_defense;
        }
    }
    stats[6] = dawn->players[i].alignment;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
callq 0xd89c
cmpl $-0x1, %eax
je 0xefa2
movl %eax, %ebp
movslq %eax, %rcx
leaq 0x12b6c(%rip), %r12     # 0x21a80
movq (%r12), %rax
imulq $0x26a8, %rcx, %r15     # imm = 0x26A8
cmpl $0x18, 0x2818(%rax,%r15)
jg 0xef97
leaq 0x394(%r15), %r13
xorl %r14d, %r14d
movl %ebp, %edi
movl %r14d, %esi
callq 0x7a38
testl %eax, %eax
je 0xef74
movq (%r12), %rax
movl (%rax,%r13), %ecx
addl %ecx, (%rbx)
movl 0x2c(%rax,%r13), %ecx
addl %ecx, 0x4(%rbx)
movl 0xc(%rax,%r13), %ecx
addl %ecx, 0x8(%rbx)
movl 0x8(%rax,%r13), %ecx
addl %ecx, 0xc(%rbx)
movl 0x10(%rax,%r13), %ecx
addl %ecx, 0x10(%rbx)
movl 0x4(%rax,%r13), %eax
addl %eax, 0x14(%rbx)
incq %r14
movq (%r12), %rax
movslq 0x2818(%rax,%r15), %rcx
movl $0x19, %edx
subq %rcx, %rdx
addq $0x9c, %r13
cmpq %rdx, %r14
jl 0xef34
movl 0x2834(%rax,%r15), %eax
movl %eax, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/status.c
// Function: init_timers
void init_timers (struct Bot *b, char const * fn) {
    //Times are defined in limits.h and are in seconds
    struct sigaction act;
    memset(&act, '\0', sizeof act);

    act.sa_handler = event_handler; //use simple signal handler
    act.sa_flags = SA_RESTART; //use SA_SIGINFO for more advanced handler

    CALLEXIT(sigaction(SIGALRM, &act, NULL) < 0) //hook SIGALRM to call our message_handler function

    load_events(fn);
    dawn = b;
    add_event(HEALING,         0, HEALING_INTERVAL,         UNIQUE | KEEP);
    add_event(SAVING,          0, SAVING_INTERVAL,          UNIQUE | KEEP);
    add_event(HOURLY,          0, 3600,                     UNIQUE | KEEP);
    add_event(LOTTERY_COLLECT, 0, LOTTERY_COLLECT_INTERVAL, UNIQUE | KEEP);
    add_event(LOTTERY_REWARD,  0, LOTTERY_REWARD_INTERVAL,  UNIQUE | KEEP);
    add_event(BOUNTY_RESET,    0, BOUNTY_RESET_INTERVAL,    UNIQUE | KEEP);
    add_event(BOUNTY_INIT,     0, 15,                       UNIQUE | KEEP);
    printf(INFO "Timers started\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movl $0x98, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x20f0
leaq 0xe9(%rip), %rax        # 0xf0ca
movq %rax, (%r15)
movl $0x10000000, 0x88(%r15) # imm = 0x10000000
movl $0xe, %edi
movq %r15, %rsi
xorl %edx, %edx
callq 0x2270
testl %eax, %eax
js 0xf0c5
movq %r14, %rdi
callq 0xf301
movq %rbx, 0x12a6b(%rip)     # 0x21a80
xorl %edi, %edi
xorl %esi, %esi
movl $0x708, %edx            # imm = 0x708
movl $0x3, %ecx
callq 0xf5b7
movl $0x1, %edi
xorl %esi, %esi
movl $0x384, %edx            # imm = 0x384
movl $0x3, %ecx
callq 0xf5b7
movl $0x2, %edi
xorl %esi, %esi
movl $0xe10, %edx            # imm = 0xE10
movl $0x3, %ecx
callq 0xf5b7
movl $0x5, %edi
xorl %esi, %esi
movl $0x708, %edx            # imm = 0x708
movl $0x3, %ecx
callq 0xf5b7
movl $0x6, %edi
xorl %esi, %esi
movl $0xa8c0, %edx           # imm = 0xA8C0
movl $0x3, %ecx
callq 0xf5b7
movl $0x7, %edi
xorl %esi, %esi
movl $0x15180, %edx          # imm = 0x15180
movl $0x3, %ecx
callq 0xf5b7
movl $0x8, %edi
xorl %esi, %esi
movl $0xf, %edx
movl $0x3, %ecx
callq 0xf5b7
leaq 0x97fc(%rip), %rdi      # 0x188af
callq 0x2330
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0x2ed7
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/status.c
// Function: init_event_list
EventList init_event_list() {
    if(eventQ_singleton) //if an instance already exists do not create a new one
        return 0;
    eventQ_singleton++;
    struct event_list * newlist;
    CALLEXIT(!(newlist = calloc(1, sizeof *newlist)))
    return newlist;
}

// Assembly:
pushq %rax
cmpl $0x0, 0x1230c(%rip)     # 0x21a88
je 0xf782
xorl %eax, %eax
jmp 0xf7a0
movl $0x1, 0x122fc(%rip)     # 0x21a88
movl $0x1, %edi
movl $0x10, %esi
callq 0x2110
testq %rax, %rax
je 0xf7a2
popq %rcx
retq
callq 0x2fd3
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/status.c
// Function: free_event_list
void free_event_list() {
    if(elist == 0)
        return;
    struct event_list * celist = (struct event_list *)elist;

    struct event_node * tmp = celist->head;
    while(tmp != 0) {
        struct event_node * next = tmp->next;
        free(tmp->elem);
        free(tmp);
        tmp = next;
    }
    free(elist);
    eventQ_singleton--;
    elist = 0;
}

// Assembly:
movq 0x122e2(%rip), %rax     # 0x21a90
testq %rax, %rax
je 0xf7ff
pushq %r14
pushq %rbx
pushq %rax
movq (%rax), %rbx
testq %rbx, %rbx
je 0xf7db
movq (%rbx), %r14
movq 0x8(%rbx), %rdi
callq 0x2240
movq %rbx, %rdi
callq 0x2240
movq %r14, %rbx
testq %r14, %r14
jne 0xf7bf
movq 0x122ae(%rip), %rdi     # 0x21a90
callq 0x2240
decl 0x1229b(%rip)           # 0x21a88
movq $0x0, 0x12298(%rip) # 0x21a90
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/status.c
// Function: update_alarm
void update_alarm() {
    if(elist == 0)
        return;
    struct event_list* celist = (struct event_list *)elist;
    if(celist->head == 0)
        return;

    time_t curtime = time(0);
    time_t event = celist->head->event_time;
    if(event < curtime)
        event_handler(SIGALRM);
    else
        alarm((unsigned int)(event - curtime));
}

// Assembly:
pushq %rbx
movq 0x12288(%rip), %rbx     # 0x21a90
testq %rbx, %rbx
je 0xf831
cmpq $0x0, (%rbx)
je 0xf831
xorl %edi, %edi
callq 0x21b0
movq (%rbx), %rcx
movq 0x10(%rcx), %rdi
cmpq %rax, %rdi
jge 0xf833
movl $0xe, %edi
popq %rbx
jmp 0xf0ca
popq %rbx
retq
subl %eax, %edi
popq %rbx
jmp 0x2440
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/status.c
// Function: remove_event
void remove_event(struct event_node * prev) { //requires the /PREVIOUS/ node or 0 for head
    struct event_list * celist = (struct event_list *)elist;
    if(elist == 0)
        return;
    if(prev == 0) {
        struct event_node * next = celist->head->next;
        free(celist->head->elem);
        free(celist->head);
        celist->head = next;
    } else {
        struct event_node * to_free = prev->next;
        prev->next = prev->next->next;
        free(to_free->elem);
        free(to_free);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x12242(%rip), %rbx     # 0x21a90
testq %rbx, %rbx
je 0xf893
testq %rdi, %rdi
je 0xf879
movq (%rdi), %rbx
movq (%rbx), %rax
movq %rax, (%rdi)
movq 0x8(%rbx), %rdi
callq 0x2240
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2240
movq (%rbx), %rax
movq (%rax), %r14
movq 0x8(%rax), %rdi
callq 0x2240
movq (%rbx), %rdi
callq 0x2240
movq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Ziddykins[P]Dawn/src/status.c
// Function: retr_event
struct event * retr_event() { //callee must free the data himself
    if(elist == 0)
        return 0;
    struct event_list * celist = (struct event_list *)elist;
    if(celist->head == 0)
        return 0;

    struct event * ret = celist->head->elem;
    struct event_node * to_free = celist->head;
    celist->head = celist->head->next;
    free(to_free);
    celist->len--;
    update_alarm();
    return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x121ea(%rip), %r14     # 0x21a90
testq %r14, %r14
je 0xf8cd
movq (%r14), %rdi
testq %rdi, %rdi
je 0xf8cd
movq (%rdi), %rax
movq 0x8(%rdi), %rbx
movq %rax, (%r14)
callq 0x2240
decq 0x8(%r14)
callq 0xf800
jmp 0xf8cf
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq