// File: /workspace/github_c_makefile_star2_O2/ajpaulson[P]srogue11/state.c
// Function: rs_read_object
int rs_read_object(int inf, struct object *o)
{
    int id;

    if (rs_read_int(inf, &id) != 0)
    {
        if (id != RSID_OBJECT)
        {
            printf("Invalid id. %x != %x(RSID_OBJECT)\n",
                id,RSID_OBJECT);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }
        else
        {
            rs_read_coord(inf, &o->o_pos);
            rs_read(inf, &o->o_damage, sizeof(o->o_damage));
            rs_read(inf, &o->o_hurldmg, sizeof(o->o_hurldmg));
            rs_read_int(inf, &o->o_type);

            if (o->o_type == ARMOR)
                o->o_typname = things[TYP_ARMOR].mi_name;
            else if (o->o_type == FOOD)
                o->o_typname = things[TYP_FOOD].mi_name;
            else if (o->o_type == RING)
                o->o_typname = things[TYP_RING].mi_name;
            else if (o->o_type == WEAPON)
                o->o_typname = things[TYP_WEAPON].mi_name;
            else if (o->o_type == POTION)
                o->o_typname = things[TYP_POTION].mi_name;
            else if (o->o_type == SCROLL)
                o->o_typname = things[TYP_SCROLL].mi_name;
            else if (o->o_type == STICK)
                o->o_typname = things[TYP_STICK].mi_name;
            else if (o->o_type == AMULET)
                o->o_typname = things[TYP_AMULET].mi_name;
            else
                assert(0 == 1);

            rs_read_int(inf, &o->o_count);
            rs_read_int(inf, &o->o_which);
            rs_read_int(inf, &o->o_hplus);
            rs_read_int(inf, &o->o_dplus);
            rs_read_int(inf, &o->o_ac);
            rs_read_int(inf, &o->o_flags);
            rs_read_int(inf, &o->o_group);
            rs_read_int(inf, &o->o_weight);
            rs_read_int(inf, &o->o_vol);
            rs_read_char(inf, &o->o_launch);
        }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xc(%rsp), %rsi
callq 0x14cb7
testl %eax, %eax
je 0x16457
movl 0xc(%rsp), %esi
cmpl $0xabcd0003, %esi       # imm = 0xABCD0003
jne 0x1638d
movl %ebp, %edi
movq %rbx, %rsi
callq 0x153bb
leaq 0x8(%rbx), %rsi
pushq $0x8
popq %r14
movl %ebp, %edi
movl %r14d, %edx
callq 0x14be5
leaq 0x10(%rbx), %rsi
movl %ebp, %edi
movl %r14d, %edx
callq 0x14be5
leaq 0x20(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x15a68(%rip), %rax     # 0x2bdc0
movl 0x20(%rbx), %ecx
cmpl $0x21, %ecx
je 0x163df
cmpl $0x29, %ecx
je 0x163db
cmpl $0x2c, %ecx
je 0x163d5
cmpl $0x2f, %ecx
je 0x163bd
cmpl $0x5d, %ecx
je 0x163c9
cmpl $0x3d, %ecx
je 0x163cf
cmpl $0x3f, %ecx
je 0x163c3
cmpl $0x3a, %ecx
jne 0x16471
addq $0x20, %rax
jmp 0x163df
leaq 0xad5c(%rip), %rdi      # 0x210f0
movl $0xabcd0003, %edx       # imm = 0xABCD0003
xorl %eax, %eax
callq 0x61c0
leaq 0xaefc(%rip), %rdi      # 0x212a3
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1d0c0(%rip)     # 0x33478
jmp 0x16457
addq $0x60, %rax
jmp 0x163df
addq $0x10, %rax
jmp 0x163df
addq $0x40, %rax
jmp 0x163df
addq $0x50, %rax
jmp 0x163df
addq $0x70, %rax
jmp 0x163df
addq $0x30, %rax
movq (%rax), %rax
movq %rax, 0x18(%rbx)
leaq 0x24(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x28(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x2c(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x30(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x34(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x38(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x3c(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x40(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x44(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
addq $0x48, %rbx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x14c64
movl 0x1d013(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1d013(%rip), %ecx     # 0x33478
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xac71(%rip), %rdi      # 0x210e9
leaq 0xa882(%rip), %rsi      # 0x20d01
leaq 0xac8d(%rip), %rcx      # 0x21113
movl $0x579, %edx            # imm = 0x579
callq 0x61e0