// File: /workspace/github_c_makefile_star2_O3/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 0xda6c
cmpl $-0x1, %eax
je 0xd5f7
movl %eax, %ebp
leaq 0x100(%r14), %rbx
leaq 0x9efe(%rip), %rsi      # 0x17475
movq %rbx, %rdi
callq 0xd3aa
testl %eax, %eax
je 0xd612
leaq 0x80(%r14), %rdi
leaq 0x144eb(%rip), %rax     # 0x21a80
movq (%rax), %r15
movslq %ebp, %r12
imulq $0x26a8, %r12, %r13     # imm = 0x26A8
leaq (%r15,%r13), %rsi
addq $0x1e0, %rsi            # imm = 0x1E0
callq 0x22d0
testl %eax, %eax
jne 0xd728
leaq (%r15,%r13), %rsi
addq $0x1a0, %rsi            # imm = 0x1A0
leaq 0x8f(%rsi), %rdi
addq $0x7f, %rsi
leaq 0x12e99(%rip), %rdx     # 0x20470
callq 0xd299
leaq 0x9ea6(%rip), %rsi      # 0x17489
leaq 0x20(%rsp), %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xd728
leaq 0x9e4e(%rip), %rsi      # 0x1744c
leaq 0x20(%rsp), %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xd7ac
leaq 0x9e99(%rip), %rsi      # 0x174b2
movq %rbx, %rdi
callq 0xd3aa
testl %eax, %eax
je 0xd650
leaq 0x14454(%rip), %r13     # 0x21a80
movq (%r13), %rax
movslq %ebp, %r12
imulq $0x26a8, %r12, %rbp     # imm = 0x26A8
cmpb $0x0, 0x2840(%rax,%rbp)
je 0xd658
leaq 0x9edf(%rip), %rdx      # 0x1752a
jmp 0xd714
movslq %ebp, %r12
jmp 0xd740
addq $0x1a0, %rax            # imm = 0x1A0
leaq (%rax,%rbp), %rsi
addq $0x7f, %rsi
leaq 0x12e03(%rip), %rdx     # 0x20470
movq %rsp, %rdi
callq 0xd299
movq (%r13), %rax
leaq (%rax,%rbp), %rcx
addq $0x22f, %rcx            # imm = 0x22F
addq $0x1a0, %rax            # imm = 0x1A0
xorl %edx, %edx
movb (%rsp,%rdx), %sil
testb %sil, %sil
je 0xd6a5
cmpb (%rcx,%rdx), %sil
jne 0xd6a5
incq %rdx
cmpl $0x20, %edx
jne 0xd68c
jmp 0xd6aa
cmpl $0x20, %edx
jne 0xd70d
leaq (%rax,%rbp), %rdi
addq $0x40, %rdi
leaq 0x80(%r14), %rsi
callq 0x21c0
movl $0x100, %ecx            # imm = 0x100
addq (%r13), %rcx
leaq 0x9df1(%rip), %rdx      # 0x174bf
leaq 0x20(%rsp), %r15
movl $0x190, %esi            # imm = 0x190
movq %r15, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x2390
movq %r15, %rdi
callq 0x20c0
movq %r15, %rdi
movq %rax, %rsi
callq 0xcefe
movq (%r13), %rax
movb $0x1, 0x2840(%rax,%rbp)
leaq 0x9ddf(%rip), %rdx      # 0x174ea
jmp 0xd714
leaq 0x9df5(%rip), %rdx      # 0x17509
leaq 0x20(%rsp), %rdi
movl $0x190, %esi            # imm = 0x190
movq %r14, %rcx
xorl %eax, %eax
callq 0x2390
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x20c0
movq %r14, %rdi
movq %rax, %rsi
callq 0xcefe
leaq 0x14339(%rip), %r14     # 0x21a80
movq (%r14), %rax
imulq $0x26a8, %r12, %rcx     # imm = 0x26A8
cmpb $0x3, 0x2840(%rax,%rcx)
jb 0xd7c4
leaq 0x9e01(%rip), %rsi      # 0x17563
movq %rbx, %rdi
callq 0xd3aa
testl %eax, %eax
je 0xd7c4
movl $0x100, %ecx            # imm = 0x100
addq (%r14), %rcx
leaq 0x9df0(%rip), %rdx      # 0x1756d
leaq 0x12cec(%rip), %r8      # 0x20470
leaq 0x20(%rsp), %rbx
movl $0x18e, %esi            # imm = 0x18E
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2390
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 0xcefe
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq