// File: /workspace/github_c_makefile_star2_O1/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 0x15d65
testl %eax, %eax
je 0x178d6
movl 0x4(%rsp), %esi
cmpl $0xabcd0003, %esi       # imm = 0xABCD0003
jne 0x177d8
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15d65
leaq 0x4(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x8(%rbx), %rsi
movl %ebp, %edi
movl $0x8, %edx
callq 0x15c8d
leaq 0x10(%rbx), %rsi
movl %ebp, %edi
movl $0x8, %edx
callq 0x15c8d
leaq 0x20(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x14620(%rip), %rax     # 0x2bdd0
movl 0x20(%rbx), %ecx
cmpl $0x39, %ecx
jg 0x17808
cmpl $0x2b, %ecx
jg 0x17821
cmpl $0x21, %ecx
je 0x17859
cmpl $0x29, %ecx
jne 0x178ee
addq $0x30, %rax
jmp 0x17859
leaq 0xb899(%rip), %rdi      # 0x23078
movl $0xabcd0003, %edx       # imm = 0xABCD0003
xorl %eax, %eax
callq 0x61c0
leaq 0xba39(%rip), %rdi      # 0x2322b
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1bc85(%rip)     # 0x33488
jmp 0x178d6
cmpl $0x3e, %ecx
jg 0x17835
cmpl $0x3a, %ecx
je 0x17849
cmpl $0x3d, %ecx
jne 0x178ee
addq $0x50, %rax
jmp 0x17859
cmpl $0x2c, %ecx
je 0x1784f
cmpl $0x2f, %ecx
jne 0x178ee
addq $0x60, %rax
jmp 0x17859
cmpl $0x3f, %ecx
je 0x17855
cmpl $0x5d, %ecx
jne 0x178ee
addq $0x40, %rax
jmp 0x17859
addq $0x20, %rax
jmp 0x17859
addq $0x70, %rax
jmp 0x17859
addq $0x10, %rax
movq (%rax), %rax
movq %rax, 0x18(%rbx)
leaq 0x24(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x28(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x2c(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x30(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x34(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x38(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x3c(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x40(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x44(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
addq $0x48, %rbx
movl %ebp, %edi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x15c8d
movl 0x1bba4(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1bba4(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xb77c(%rip), %rdi      # 0x23071
leaq 0xb38d(%rip), %rsi      # 0x22c89
leaq 0xb798(%rip), %rcx      # 0x2309b
movl $0x579, %edx            # imm = 0x579
callq 0x61e0