// File: /workspace/github_c_makefile_star2_O2/Ziddykins[P]Dawn/src/inventory.c
// Function: print_inventory
void print_inventory(struct Message *message) {
    int i = get_pindex(message->sender_nick);
    int j;
    char out[MAX_MESSAGE_BUFFER];
    char temp[100];

    sprintf(out, "PRIVMSG %s :", message->receiver);

    for (j = 0; j < (MAX_INVENTORY_SLOTS - dawn->players[i].available_slots); j++) {
        if (j % 9 == 0) {
            strcat(out, "\r\n");
            add_msg(out, strlen(out));
            sprintf(out, "PRIVMSG %s :", message->receiver);
        }
        temp[0] = '\0';

        sprintf(temp, "[%s%d%s%s] - %s%s%s ", 
                is_equipped(i, j) ? IRC_GREEN : IRC_RED,
                j,
                IRC_NORMAL,
                is_favorite(i, j) ? IRC_PURPLE"*"IRC_NORMAL : "",
                is_new(i, j) ? IRC_RED"["IRC_NORMAL : "",
                dawn->players[i].inventory[j].name,
                is_new(i, j) ? IRC_RED"]"IRC_NORMAL : "");
        strcat(out, temp);
    }
    sprintf(temp, " - Available slots: %d", dawn->players[i].available_slots);
    strcat(out, temp);
    strcat(out, "\r\n");
    add_msg(out, strlen(out));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
callq 0xc860
movl %eax, %ebp
addq $0xc0, %rbx
leaq 0xab7b(%rip), %rsi      # 0x118d6
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %rbx, (%rsp)
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
movslq %ebp, %rax
imulq $0x26a8, %rax, %rcx     # imm = 0x26A8
movq %rcx, 0x8(%rsp)
leaq 0x330(%rcx), %r12
leaq 0xd00f(%rip), %r13      # 0x13da0
leaq 0x10(%rsp), %rbp
xorl %r14d, %r14d
movl %r14d, %eax
xorl %edx, %edx
pushq $0x9
popq %rcx
divl %ecx
leaq 0x18cd6(%rip), %rcx     # 0x1fa80
movq (%rcx), %r10
movq 0x8(%rsp), %rcx
movslq 0x2818(%r10,%rcx), %rdx
pushq $0x19
popq %rcx
subq %rdx, %rcx
cmpq %rcx, %r14
jge 0x6ea8
imull $-0x9, %eax, %eax
addl %r14d, %eax
jne 0x6e1d
movq %r15, %rdi
callq 0x20c0
movw $0xa0d, 0x80(%rsp,%rax) # imm = 0xA0D
movb $0x0, 0x82(%rsp,%rax)
movq %r15, %rdi
callq 0x20c0
movq %r15, %rdi
movq %rax, %rsi
callq 0xbd04
movq %r15, %rdi
leaq 0xaace(%rip), %rsi      # 0x118d6
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x18c66(%rip), %rax     # 0x1fa80
movq (%rax), %r10
movb $0x0, 0x10(%rsp)
movb 0x98(%r10,%r12), %al
addq %r12, %r10
testb $0x4, %al
leaq 0xc39f(%rip), %rdx      # 0x131d5
leaq 0x9ef3(%rip), %rcx      # 0x10d30
cmoveq %rcx, %rdx
testb $0x2, %al
leaq 0xc38f(%rip), %r9       # 0x131d9
cmoveq %r13, %r9
testb $0x1, %al
leaq 0xc388(%rip), %r11      # 0x131df
cmoveq %r13, %r11
leaq 0xc383(%rip), %rbx      # 0x131e5
cmoveq %r13, %rbx
subq $0x8, %rsp
movq %rbp, %rdi
leaq 0xc34c(%rip), %rsi      # 0x131c0
movl %r14d, %ecx
leaq 0xc35f(%rip), %r8       # 0x131dd
xorl %eax, %eax
pushq %rbx
pushq %r10
pushq %r11
callq 0x2050
addq $0x20, %rsp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2410
incq %r14
addq $0x9c, %r12
jmp 0x6d99
leaq 0xc33c(%rip), %rsi      # 0x131eb
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2410
movq %r14, %rdi
callq 0x20c0
movw $0xa0d, 0x80(%rsp,%rax) # imm = 0xA0D
movb $0x0, 0x82(%rsp,%rax)
movq %r14, %rdi
callq 0x20c0
movq %r14, %rdi
movq %rax, %rsi
callq 0xbd04
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq