// File: /workspace/github_c_makefile_star2_O1/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 0xd89c
cmpl $-0x1, %eax
je 0xd407
movl %eax, %ebp
leaq 0x100(%r14), %rbx
leaq 0xa08e(%rip), %rsi      # 0x17415
movq %rbx, %rdi
callq 0xd1ba
movslq %ebp, %r12
testl %eax, %eax
je 0xd422
leaq 0x80(%r14), %rdi
leaq 0x146d8(%rip), %rax     # 0x21a80
movq (%rax), %r15
imulq $0x26a8, %r12, %r13     # imm = 0x26A8
leaq (%r15,%r13), %rsi
addq $0x1e0, %rsi            # imm = 0x1E0
callq 0x22d0
testl %eax, %eax
jne 0xd534
leaq (%r15,%r13), %rsi
addq $0x1a0, %rsi            # imm = 0x1A0
leaq 0x8f(%rsi), %rdi
addq $0x7f, %rsi
leaq 0x13089(%rip), %rdx     # 0x20470
callq 0xd0a9
leaq 0xa036(%rip), %rsi      # 0x17429
leaq 0x20(%rsp), %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xd534
leaq 0x9fde(%rip), %rsi      # 0x173ec
leaq 0x20(%rsp), %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
jmp 0xd5b8
leaq 0xa029(%rip), %rsi      # 0x17452
movq %rbx, %rdi
callq 0xd1ba
testl %eax, %eax
je 0xd54c
leaq 0x14640(%rip), %r13     # 0x21a80
movq (%r13), %rax
imulq $0x26a8, %r12, %rbp     # imm = 0x26A8
cmpb $0x0, 0x2840(%rax,%rbp)
je 0xd461
leaq 0xa06e(%rip), %rdx      # 0x174ca
jmp 0xd520
addq $0x1a0, %rax            # imm = 0x1A0
leaq (%rax,%rbp), %rsi
addq $0x7f, %rsi
leaq 0x12ffa(%rip), %rdx     # 0x20470
movq %rsp, %rdi
callq 0xd0a9
movq (%r13), %rax
leaq (%rax,%rbp), %rdx
addq $0x22f, %rdx            # imm = 0x22F
addq $0x1a0, %rax            # imm = 0x1A0
xorl %ecx, %ecx
movb (%rsp,%rcx), %sil
testb %sil, %sil
je 0xd4b1
cmpb (%rdx,%rcx), %sil
jne 0xd4b1
incq %rcx
cmpl $0x20, %ecx
jne 0xd495
movl $0x20, %ecx
cmpl $0x20, %ecx
jne 0xd519
leaq (%rax,%rbp), %rdi
addq $0x40, %rdi
leaq 0x80(%r14), %rsi
callq 0x21c0
movl $0x100, %ecx            # imm = 0x100
addq (%r13), %rcx
leaq 0x9f85(%rip), %rdx      # 0x1745f
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 0xcd1c
movq (%r13), %rax
movb $0x1, 0x2840(%rax,%rbp)
leaq 0x9f73(%rip), %rdx      # 0x1748a
jmp 0xd520
leaq 0x9f89(%rip), %rdx      # 0x174a9
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 0xcd1c
leaq 0x1452d(%rip), %r14     # 0x21a80
movq (%r14), %rax
imulq $0x26a8, %r12, %rcx     # imm = 0x26A8
cmpb $0x3, 0x2840(%rax,%rcx)
jb 0xd5d0
leaq 0x9f95(%rip), %rsi      # 0x17503
movq %rbx, %rdi
callq 0xd1ba
testl %eax, %eax
je 0xd5d0
movl $0x100, %ecx            # imm = 0x100
addq (%r14), %rcx
leaq 0x9f84(%rip), %rdx      # 0x1750d
leaq 0x12ee0(%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 0xcd1c
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq