// File: /workspace/github_c_makefile_star2_O3/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 %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
callq 0x15bb9
testl %eax, %eax
je 0x17727
movl 0x4(%rsp), %esi
cmpl $0xabcd0003, %esi       # imm = 0xABCD0003
jne 0x17629
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15bb9
leaq 0x4(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x8(%rbx), %rsi
movl %ebp, %edi
movl $0x8, %edx
callq 0x15ade
leaq 0x10(%rbx), %rsi
movl %ebp, %edi
movl $0x8, %edx
callq 0x15ade
leaq 0x20(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x147cf(%rip), %rax     # 0x2bdd0
movl 0x20(%rbx), %ecx
cmpl $0x39, %ecx
jg 0x17659
cmpl $0x2b, %ecx
jg 0x17672
cmpl $0x21, %ecx
je 0x176aa
cmpl $0x29, %ecx
jne 0x1773f
addq $0x30, %rax
jmp 0x176aa
leaq 0xbac0(%rip), %rdi      # 0x230f0
movl $0xabcd0003, %edx       # imm = 0xABCD0003
xorl %eax, %eax
callq 0x61c0
leaq 0xbc60(%rip), %rdi      # 0x232a3
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1be34(%rip)     # 0x33488
jmp 0x17727
cmpl $0x3e, %ecx
jg 0x17686
cmpl $0x3a, %ecx
je 0x1769a
cmpl $0x3d, %ecx
jne 0x1773f
addq $0x50, %rax
jmp 0x176aa
cmpl $0x2c, %ecx
je 0x176a0
cmpl $0x2f, %ecx
jne 0x1773f
addq $0x60, %rax
jmp 0x176aa
cmpl $0x3f, %ecx
je 0x176a6
cmpl $0x5d, %ecx
jne 0x1773f
addq $0x40, %rax
jmp 0x176aa
addq $0x20, %rax
jmp 0x176aa
addq $0x70, %rax
jmp 0x176aa
addq $0x10, %rax
movq (%rax), %rax
movq %rax, 0x18(%rbx)
leaq 0x24(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x28(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x2c(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x30(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x34(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x38(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x3c(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x40(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0x44(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
addq $0x48, %rbx
movl %ebp, %edi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x15ade
movl 0x1bd53(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1bd53(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xb9a3(%rip), %rdi      # 0x230e9
leaq 0xb5b4(%rip), %rsi      # 0x22d01
leaq 0xb9bf(%rip), %rcx      # 0x23113
movl $0x579, %edx            # imm = 0x579
callq 0x61e0