// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/parse.c
// Function: parse_private_message
void parse_private_message(struct Message *message) {
    char out[MAX_MESSAGE_BUFFER];
    int pindex = get_pindex(message->sender_nick);

    if (pindex == -1) {
        sprintf(out, "PRIVMSG %s :You do not have an account\r\n", message->sender_nick);
        add_msg(out, strlen(out));
        return;
    }
/*    if (dawn->players[pindex].max_auth >= AL_REG) {
        sprintf(out, "PRIVMSG %s :Please use ;auth\r\n", message->sender_nick);
        add_msg(out, strlen(out));
        return;
    }
Explain yourself*/

    if (matches_regex(message->message, ";set password (\\w+)")) {
        if (strcmp(message->sender_hostmask, dawn->players[pindex].hostmask) == 0) {
            hash_pwd(dawn->players[pindex].pwd, dawn->players[pindex].salt, regex_group[1]);
            sprintf(out, "PRIVMSG %s :Your password has been set\r\n", message->sender_nick);
        }
        add_msg(out, strlen(out));
    } else if (matches_regex(message->message, ";login (\\w+)")) {
        if (dawn->players[pindex].auth_level < AL_USER) {
            unsigned char hash[SHA256_DIGEST_LENGTH];
            hash_pwd(hash, dawn->players[pindex].salt, regex_group[1]);
            if (hash_cmp(hash, dawn->players[pindex].pwd)) {
                strcpy(dawn->players[pindex].hostmask, message->sender_hostmask);
                snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :%s has been verified. (USER)\r\n", dawn->active_room,
                         message->sender_nick);
                add_msg(out, strlen(out));
                dawn->players[pindex].auth_level = AL_USER;
                snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :Password correct\r\n", message->sender_nick);
            } else {
                snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :Incorrect password\r\n", message->sender_nick);
            }
        } else {
            snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :I already recognize you, no need to log in\r\n", message->sender_nick);
        }
        add_msg(out, strlen(out));
    }

    if (dawn->players[pindex].auth_level >= AL_ADMIN) {
        if (matches_regex(message->message, ";say (.*)")) {
            snprintf(out, MAX_MESSAGE_BUFFER-2, "PRIVMSG %s :%s", dawn->active_room, regex_group[1]);
            strcat(out, "\r\n");
            add_msg(out, strlen(out));
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, %r14
callq 0xc860
cmpl $-0x1, %eax
je 0xc3ff
movl %eax, %ebp
leaq 0x100(%r14), %rbx
leaq 0xa0c0(%rip), %rsi      # 0x1643f
movq %rbx, %rdi
callq 0xc187
testl %eax, %eax
je 0xc41a
leaq 0x80(%r14), %rdi
leaq 0x136e3(%rip), %rax     # 0x1fa80
movq (%rax), %r15
movslq %ebp, %r12
imulq $0x26a8, %r12, %r13     # imm = 0x26A8
leaq (%r15,%r13), %rsi
addq $0x1e0, %rsi            # imm = 0x1E0
callq 0x22e0
testl %eax, %eax
jne 0xc52a
leaq (%r15,%r13), %rsi
addq $0x1a0, %rsi            # imm = 0x1A0
leaq 0x8f(%rsi), %rdi
addq $0x7f, %rsi
leaq 0x12091(%rip), %rdx     # 0x1e470
callq 0xc06f
leaq 0xa068(%rip), %rsi      # 0x16453
leaq 0x20(%rsp), %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xc52a
leaq 0xa010(%rip), %rsi      # 0x16416
leaq 0x20(%rsp), %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xc5ae
leaq 0xa05b(%rip), %rsi      # 0x1647c
movq %rbx, %rdi
callq 0xc187
testl %eax, %eax
je 0xc458
leaq 0x1364c(%rip), %r13     # 0x1fa80
movq (%r13), %rax
movslq %ebp, %r12
imulq $0x26a8, %r12, %rbp     # imm = 0x26A8
cmpb $0x0, 0x2840(%rax,%rbp)
je 0xc460
leaq 0xa0a1(%rip), %rdx      # 0x164f4
jmp 0xc516
movslq %ebp, %r12
jmp 0xc542
addq $0x1a0, %rax            # imm = 0x1A0
leaq (%rax,%rbp), %rsi
addq $0x7f, %rsi
leaq 0x11ffb(%rip), %rdx     # 0x1e470
movq %rsp, %r15
movq %r15, %rdi
callq 0xc06f
movq (%r13), %r13
leaq 0x22f(,%rbp), %rsi
addq %r13, %rsi
movq %r15, %rdi
callq 0xc158
testl %eax, %eax
je 0xc50f
addq $0x1a0, %r13            # imm = 0x1A0
leaq 0x40(,%rbp), %rdi
addq %r13, %rdi
leaq 0x80(%r14), %rsi
callq 0x21c0
movl $0x100, %ecx            # imm = 0x100
leaq 0x135bb(%rip), %r13     # 0x1fa80
addq (%r13), %rcx
leaq 0x9fb9(%rip), %rdx      # 0x16489
leaq 0x20(%rsp), %r15
movl $0x190, %esi            # imm = 0x190
movq %r15, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x23a0
movq %r15, %rdi
callq 0x20c0
movq %r15, %rdi
movq %rax, %rsi
callq 0xbd04
movq (%r13), %rax
movb $0x1, 0x2840(%rax,%rbp)
leaq 0x9fa7(%rip), %rdx      # 0x164b4
jmp 0xc516
leaq 0x9fbd(%rip), %rdx      # 0x164d3
leaq 0x20(%rsp), %rdi
movl $0x190, %esi            # imm = 0x190
movq %r14, %rcx
xorl %eax, %eax
callq 0x23a0
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x20c0
movq %r14, %rdi
movq %rax, %rsi
callq 0xbd04
leaq 0x13537(%rip), %r14     # 0x1fa80
movq (%r14), %rax
imulq $0x26a8, %r12, %rcx     # imm = 0x26A8
cmpb $0x3, 0x2840(%rax,%rcx)
jb 0xc5c6
leaq 0x9fc9(%rip), %rsi      # 0x1652d
movq %rbx, %rdi
callq 0xc187
testl %eax, %eax
je 0xc5c6
movl $0x100, %ecx            # imm = 0x100
addq (%r14), %rcx
leaq 0x9fb8(%rip), %rdx      # 0x16537
leaq 0x11eea(%rip), %r8      # 0x1e470
leaq 0x20(%rsp), %rbx
movl $0x18e, %esi            # imm = 0x18E
movq %rbx, %rdi
xorl %eax, %eax
callq 0x23a0
movq %rbx, %rdi
callq 0x20c0
movw $0xa0d, 0x20(%rsp,%rax) # imm = 0xA0D
movb $0x0, 0x22(%rsp,%rax)
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