// File: /workspace/github_c_makefile_star2_O3/Ziddykins[P]Dawn/src/monsters.c
// Function: print_monster
void print_monster(char const *username, int global) { //username -> MAX_NICK_LENGTH
    char out[MAX_MESSAGE_BUFFER];
    int pindex = get_pindex(username);

    if (pindex == -1) return;

    if (global) {
        if (!dawn->global_monster.active) {
            sprintf(out, "PRIVMSG %s :There is no monster in the room currently\r\n", dawn->active_room);
        } else {
            snprintf(out, MAX_MESSAGE_BUFFER, "PRIVMSG %s :A %s is in the room: [Health: %d] [%d Str - %d Def - %d Int - %d MDef]\r\n",
                     dawn->active_room, dawn->global_monster.name, dawn->global_monster.hp,
                     dawn->global_monster.str, dawn->global_monster.def, dawn->global_monster.intel,
                     dawn->global_monster.mdef);
        }
    } else {
        if (!dawn->players[pindex].personal_monster.active) {
            sprintf(out, "PRIVMSG %s :%s, you are not fighting any monster currently\r\n", dawn->active_room, username);
        } else {
            sprintf(out, "PRIVMSG %s :%s, you are fighting a %s: [Health: %d][%dS - %dD - %dI - %dMD]\r\n",
                    dawn->active_room, username, dawn->players[pindex].personal_monster.name,
                    dawn->players[pindex].personal_monster.hp,
                    dawn->players[pindex].personal_monster.str,
                    dawn->players[pindex].personal_monster.def,
                    dawn->players[pindex].personal_monster.intel,
                    dawn->players[pindex].personal_monster.mdef);
        }
    }
    add_msg(out, strlen(out));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %esi, %ebp
movq %rdi, %rbx
callq 0xda6c
cmpl $-0x1, %eax
je 0xc706
leaq 0x15482(%rip), %rcx     # 0x21a80
movq (%rcx), %rdx
testl %ebp, %ebp
je 0xc661
cmpl $0x0, 0xf2e64(%rdx)
je 0xc6bf
leaq 0xf2e00(%rdx), %r8
leaq 0x100(%rdx), %rcx
movl 0xf2e4c(%rdx), %r10d
movl 0xf2e40(%rdx), %r9d
movl 0xf2e48(%rdx), %r11d
movl 0xf2e50(%rdx), %ebx
movl 0xf2e54(%rdx), %r14d
leaq 0xa55c(%rip), %rdx      # 0x16ba5
movq %rsp, %rdi
movl $0x190, %esi            # imm = 0x190
xorl %eax, %eax
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x2390
jmp 0xc6b9
cltq
imulq $0x26a8, %rax, %rcx     # imm = 0x26A8
leaq 0x100(%rdx), %rax
cmpl $0x0, 0x12d0(%rdx,%rcx)
je 0xc6d9
leaq (%rdx,%rcx), %r8
addq $0x126c, %r8            # imm = 0x126C
movl 0x4c(%r8), %r10d
movl 0x40(%r8), %r9d
movl 0x48(%r8), %r11d
movl 0x50(%r8), %r14d
movl 0x54(%r8), %r15d
leaq 0xa596(%rip), %rsi      # 0x16c37
movq %rsp, %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
pushq %r15
pushq %r14
pushq %r11
pushq %r10
callq 0x2050
addq $0x20, %rsp
jmp 0xc6f0
addq $0x100, %rdx            # imm = 0x100
leaq 0xa4a0(%rip), %rsi      # 0x16b6d
movq %rsp, %rdi
xorl %eax, %eax
callq 0x2050
jmp 0xc6f0
leaq 0xa51a(%rip), %rsi      # 0x16bfa
movq %rsp, %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2050
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xcefe
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
retq