// File: /workspace/github_c_makefile_star2_O2/ajpaulson[P]srogue11/state.c
// Function: rs_write_object
int rs_write_object(FILE *savef, struct object *o)
{
    rs_write_int(savef, RSID_OBJECT);
    rs_write_coord(savef, o->o_pos);
    rs_write(savef, o->o_damage, sizeof(o->o_damage));
    rs_write(savef, o->o_hurldmg, sizeof(o->o_hurldmg));

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

    rs_write_int(savef, o->o_type);
    rs_write_int(savef, o->o_count);
    rs_write_int(savef, o->o_which);
    rs_write_int(savef, o->o_hplus);
    rs_write_int(savef, o->o_dplus);
    rs_write_int(savef, o->o_ac);
    rs_write_int(savef, o->o_flags);
    rs_write_int(savef, o->o_group);
    rs_write_int(savef, o->o_weight);
    rs_write_int(savef, o->o_vol);

    rs_write_char(savef, o->o_launch);

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0xabcd0003, %esi       # imm = 0xABCD0003
callq 0x14801
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x15389
leaq 0x8(%r14), %rsi
pushq $0x8
popq %rbp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x14776
leaq 0x10(%r14), %rsi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x14776
movl 0x20(%r14), %ebp
cmpl $0x21, %ebp
je 0x16196
cmpl $0x29, %ebp
je 0x16203
cmpl $0x2c, %ebp
je 0x161cc
cmpl $0x2f, %ebp
je 0x160aa
cmpl $0x3a, %ebp
je 0x16120
cmpl $0x3d, %ebp
je 0x1615b
cmpl $0x3f, %ebp
je 0x160e5
cmpl $0x5d, %ebp
jne 0x162b3
movq 0x18(%r14), %rdi
leaq 0x15d46(%rip), %rax     # 0x2bdc0
movq 0x40(%rax), %rsi
callq 0x6240
testl %eax, %eax
je 0x1621f
leaq 0xae88(%rip), %rdi      # 0x20f1a
leaq 0xac68(%rip), %rsi      # 0x20d01
leaq 0xaeae(%rip), %rcx      # 0x20f4e
movl $0x532, %edx            # imm = 0x532
callq 0x61e0
movq 0x18(%r14), %rdi
leaq 0x15d0b(%rip), %rax     # 0x2bdc0
movq 0x60(%rax), %rsi
callq 0x6240
testl %eax, %eax
je 0x1621f
leaq 0xafb3(%rip), %rdi      # 0x21080
leaq 0xac2d(%rip), %rsi      # 0x20d01
leaq 0xae73(%rip), %rcx      # 0x20f4e
movl $0x53e, %edx            # imm = 0x53E
callq 0x61e0
movq 0x18(%r14), %rdi
leaq 0x15cd0(%rip), %rax     # 0x2bdc0
movq 0x10(%rax), %rsi
callq 0x6240
testl %eax, %eax
je 0x1621f
leaq 0xaf43(%rip), %rdi      # 0x2104b
leaq 0xabf2(%rip), %rsi      # 0x20d01
leaq 0xae38(%rip), %rcx      # 0x20f4e
movl $0x53c, %edx            # imm = 0x53C
callq 0x61e0
movq 0x18(%r14), %rdi
leaq 0x15c95(%rip), %rax     # 0x2bdc0
movq 0x20(%rax), %rsi
callq 0x6240
testl %eax, %eax
je 0x1621f
leaq 0xae38(%rip), %rdi      # 0x20f7b
leaq 0xabb7(%rip), %rsi      # 0x20d01
leaq 0xadfd(%rip), %rcx      # 0x20f4e
movl $0x534, %edx            # imm = 0x534
callq 0x61e0
movq 0x18(%r14), %rdi
leaq 0x15c5a(%rip), %rax     # 0x2bdc0
movq 0x50(%rax), %rsi
callq 0x6240
testl %eax, %eax
je 0x1621f
leaq 0xae30(%rip), %rdi      # 0x20fae
leaq 0xab7c(%rip), %rsi      # 0x20d01
leaq 0xadc2(%rip), %rcx      # 0x20f4e
movl $0x536, %edx            # imm = 0x536
callq 0x61e0
movq 0x18(%r14), %rdi
leaq 0x15c1f(%rip), %rax     # 0x2bdc0
movq (%rax), %rsi
callq 0x6240
testl %eax, %eax
je 0x1621f
leaq 0xae62(%rip), %rdi      # 0x21016
leaq 0xab46(%rip), %rsi      # 0x20d01
leaq 0xad8c(%rip), %rcx      # 0x20f4e
movl $0x53a, %edx            # imm = 0x53A
callq 0x61e0
movq 0x18(%r14), %rdi
leaq 0x15be9(%rip), %rax     # 0x2bdc0
movq 0x70(%rax), %rsi
callq 0x6240
testl %eax, %eax
je 0x1621f
leaq 0xaec9(%rip), %rdi      # 0x210b4
leaq 0xab0f(%rip), %rsi      # 0x20d01
leaq 0xad55(%rip), %rcx      # 0x20f4e
movl $0x540, %edx            # imm = 0x540
callq 0x61e0
movq 0x18(%r14), %rdi
leaq 0x15bb2(%rip), %rax     # 0x2bdc0
movq 0x30(%rax), %rsi
callq 0x6240
testl %eax, %eax
jne 0x162d2
movq %rbx, %rdi
movl %ebp, %esi
callq 0x14801
movl 0x24(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movl 0x28(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movl 0x2c(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movl 0x30(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movl 0x34(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movl 0x38(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movl 0x3c(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movl 0x40(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movl 0x44(%r14), %esi
movq %rbx, %rdi
callq 0x14801
movsbl 0x48(%r14), %esi
movq %rbx, %rdi
callq 0x147bd
xorl %eax, %eax
cmpl $0x0, 0x1d1c9(%rip)     # 0x33474
sete %al
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xae2f(%rip), %rdi      # 0x210e9
leaq 0xaa40(%rip), %rsi      # 0x20d01
leaq 0xac86(%rip), %rcx      # 0x20f4e
movl $0x542, %edx            # imm = 0x542
callq 0x61e0
leaq 0xad08(%rip), %rdi      # 0x20fe1
leaq 0xaa21(%rip), %rsi      # 0x20d01
leaq 0xac67(%rip), %rcx      # 0x20f4e
movl $0x538, %edx            # imm = 0x538
callq 0x61e0