// File: /workspace/github_c_makefile_star2_O1/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 0xd89c
movl %eax, %ebp
addq $0xc0, %rbx
leaq 0xad53(%rip), %rsi      # 0x128d6
leaq 0x80(%rsp), %rdi
movq %rbx, 0x8(%rsp)
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
movslq %ebp, %rax
leaq 0x19edc(%rip), %rcx     # 0x21a80
movq (%rcx), %rcx
imulq $0x26a8, %rax, %r14     # imm = 0x26A8
movl 0x2818(%rcx,%r14), %edx
cmpl $0x18, %edx
jg 0x7ce9
leaq 0x330(%r14), %r13
xorl %r15d, %r15d
movl %r15d, %eax
imulq $0x38e38e39, %rax, %rax # imm = 0x38E38E39
shrq $0x21, %rax
leal (%rax,%rax,8), %eax
cmpl %eax, %r15d
jne 0x7c2a
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x20c0
movw $0xa0d, 0x80(%rsp,%rax) # imm = 0xA0D
movb $0x0, 0x82(%rsp,%rax)
movq %rbx, %rdi
callq 0x20c0
movq %rbx, %rdi
movq %rax, %rsi
callq 0xcd1c
movq %rbx, %rdi
leaq 0xacb8(%rip), %rsi      # 0x128d6
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x2050
movb $0x0, 0x10(%rsp)
leaq 0x19e4a(%rip), %rbp     # 0x21a80
movq (%rbp), %r10
movb 0x98(%r10,%r13), %al
addq %r13, %r10
testb $0x4, %al
leaq 0xc587(%rip), %rdx      # 0x141d5
leaq 0xa0db(%rip), %rcx      # 0x11d30
cmoveq %rcx, %rdx
testb $0x2, %al
leaq 0xc577(%rip), %r9       # 0x141d9
leaq 0xd137(%rip), %rcx      # 0x14da0
cmoveq %rcx, %r9
testb $0x1, %al
leaq 0xc569(%rip), %r11      # 0x141df
cmoveq %rcx, %r11
leaq 0xc564(%rip), %rbx      # 0x141e5
cmoveq %rcx, %rbx
subq $0x8, %rsp
leaq 0x18(%rsp), %r12
movq %r12, %rdi
leaq 0xc528(%rip), %rsi      # 0x141c0
movl %r15d, %ecx
leaq 0xc53b(%rip), %r8       # 0x141dd
xorl %eax, %eax
pushq %rbx
pushq %r10
pushq %r11
callq 0x2050
addq $0x20, %rsp
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x2410
incq %r15
movq (%rbp), %rax
movslq 0x2818(%rax,%r14), %rdx
movl $0x19, %eax
subq %rdx, %rax
addq $0x9c, %r13
cmpq %rax, %r15
jl 0x7bc9
leaq 0xc4fb(%rip), %rsi      # 0x141eb
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 0xcd1c
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq