// File: /workspace/github_c_makefile_star2_O2/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 0xc860
cmpl $-0x1, %eax
je 0xb4ce
leaq 0x146ba(%rip), %rcx     # 0x1fa80
movq (%rcx), %rdx
testl %ebp, %ebp
je 0xb429
cmpl $0x0, 0xf2e64(%rdx)
je 0xb487
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 0xa744(%rip), %rdx      # 0x15b55
movq %rsp, %rdi
movl $0x190, %esi            # imm = 0x190
xorl %eax, %eax
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0x23a0
jmp 0xb481
cltq
imulq $0x26a8, %rax, %rcx     # imm = 0x26A8
leaq 0x100(%rdx), %rax
cmpl $0x0, 0x12d0(%rdx,%rcx)
je 0xb4a1
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 0xa77e(%rip), %rsi      # 0x15be7
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 0xb4b8
addq $0x100, %rdx            # imm = 0x100
leaq 0xa688(%rip), %rsi      # 0x15b1d
movq %rsp, %rdi
xorl %eax, %eax
callq 0x2050
jmp 0xb4b8
leaq 0xa702(%rip), %rsi      # 0x15baa
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 0xbd04
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
retq