// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_save_file
int rs_save_file(FILE *savef)
{
    int endian = 0x01020304;
    big_endian = ( *((char *)&endian) == 0x01 );

    rs_write_daemons(savef, d_list, MAXDAEMONS);
    rs_write_int(savef, between);
    rs_write_rooms(savef, rooms, MAXROOMS);
    rs_write_room_reference(savef, oldrp);
    rs_write_monster_list(savef, mlist);
    rs_write_thing(savef, &player);
    rs_write_stats(savef,&max_stats);                   
    rs_write_object_list(savef, lvl_obj);
    rs_write_object_reference(savef, player.t_pack, cur_weapon); 
    rs_write_object_reference(savef, player.t_pack, cur_armor);
    rs_write_object_reference(savef, player.t_pack, cur_ring[0]);
    rs_write_object_reference(savef, player.t_pack, cur_ring[1]);
    assert(him == &player.t_stats);
    rs_write_traps(savef, traps, MAXTRAPS);             
    rs_write_int(savef, level);
    rs_write_int(savef, levcount);
    rs_write_int(savef, levtype);
    rs_write_int(savef, trader);
    rs_write_int(savef, curprice);
    rs_write_int(savef, purse);
    rs_write_int(savef, ntraps);
    rs_write_int(savef, packvol);
    rs_write_int(savef, demoncnt);
    rs_write_int(savef, lastscore);
    rs_write_int(savef, no_food);
    rs_write_int(savef, seed);
    rs_write_int(savef, dnum);
    rs_write_int(savef, count);
    rs_write_int(savef, fung_hit);
    rs_write_int(savef, quiet);
    rs_write_int(savef, max_level);
    rs_write_int(savef, food_left);
    rs_write_int(savef, group);
    rs_write_int(savef, hungry_state);
    rs_write_int(savef, foodlev);
    rs_write_int(savef, ringfood);
    rs_write_char(savef, take);
    rs_write_char(savef, runch);
    rs_write(savef, curpurch, 15);

    rs_write(savef, prbuf, LINLEN);
    rs_write(savef, whoami, LINLEN);
    rs_write(savef, fruit, LINLEN);
    
    rs_write_boolean(savef, isfight); 
    rs_write_boolean(savef, nlmove);
    rs_write_boolean(savef, inpool);
    rs_write_boolean(savef, inwhgt);
    rs_write_boolean(savef, running);
    rs_write_boolean(savef, playing);
#ifdef WIZARD
    rs_write_boolean(savef, wizard);
#else 
    rs_write_boolean(savef, 0);
#endif
    rs_write_boolean(savef, after);
    rs_write_boolean(savef, door_stop);
    rs_write_boolean(savef, firstmove);
    rs_write_boolean(savef, waswizard);
    rs_write_boolean(savef, amulet);
    rs_write_boolean(savef, in_shell);
    rs_write_boolean(savef, nochange);
    
    rs_write_coord(savef, oldpos);
    rs_write_coord(savef, delta);
    rs_write_coord(savef, stairs);
    rs_write_coord(savef, rndspot);

    rs_write_monsters(savef, monsters, MAXMONS+1);
    rs_write_monster_references(savef, mtlev, MONRANGE);

    rs_write_scrolls(savef);
    rs_write_potions(savef);
    rs_write_rings(savef);
    rs_write_sticks(savef);

    rs_write_magic_items(savef, things, NUMTHINGS+1);
    rs_write_magic_items(savef, a_magic, MAXARMORS+1);
    rs_write_magic_items(savef, w_magic, MAXWEAPONS+1);
    rs_write_magic_items(savef, s_magic, MAXSCROLLS+1);
    rs_write_magic_items(savef, p_magic, MAXPOTIONS+1);
    rs_write_magic_items(savef, r_magic, MAXRINGS+1);
    rs_write_magic_items(savef, ws_magic, MAXSTICKS+1);

    rs_write_window(savef, cw);
    rs_write_window(savef, mw);
    rs_write_window(savef, stdscr);

    fflush(savef);

    return(WRITESTAT);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x0, 0x1ac2f(%rip)     # 0x33490
leaq 0x14d98(%rip), %rsi     # 0x2d600
movl $0x14, %edx
callq 0x16574
leaq 0x14f67(%rip), %rax     # 0x2d7e0
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x15026(%rip), %r14     # 0x2d8b0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x9, %edx
callq 0x1690c
leaq 0x153b7(%rip), %rax     # 0x2dc58
movq (%rax), %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpq %rax, %r14
cmovel %ecx, %esi
incq %rcx
addq $0x68, %r14
cmpq $0x9, %rcx
jne 0x188ab
movq %rbx, %rdi
callq 0x156d6
leaq 0x14f73(%rip), %rax     # 0x2d840
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x180e0
leaq 0x15381(%rip), %r14     # 0x2dc60
movq %rbx, %rdi
movq %r14, %rsi
callq 0x17c38
leaq 0x15407(%rip), %rsi     # 0x2dcf8
movq %rbx, %rdi
callq 0x16f87
leaq 0x14f48(%rip), %rax     # 0x2d848
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x17840
movq 0x68(%r14), %rsi
leaq 0x14f3a(%rip), %rax     # 0x2d850
movq (%rax), %rdx
movq %rbx, %rdi
callq 0x1824f
movq 0x68(%r14), %rsi
leaq 0x14f2c(%rip), %rax     # 0x2d858
movq (%rax), %rdx
movq %rbx, %rdi
callq 0x1824f
movq 0x68(%r14), %rsi
leaq 0x1540e(%rip), %r15     # 0x2dd50
movq (%r15), %rdx
movq %rbx, %rdi
callq 0x1824f
movq 0x68(%r14), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x1824f
leaq 0x153fc(%rip), %rax     # 0x2dd60
cmpq %r14, (%rax)
jne 0x18f04
leaq 0x153fc(%rip), %rsi     # 0x2dd70
movq %rbx, %rdi
movl $0xa, %edx
callq 0x178ab
leaq 0x11968(%rip), %rax     # 0x2a2f0
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14ec7(%rip), %rax     # 0x2d860
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14eba(%rip), %rax     # 0x2d864
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14ead(%rip), %rax     # 0x2d868
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x11928(%rip), %rax     # 0x2a2f4
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14e8f(%rip), %rax     # 0x2d86c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x1547a(%rip), %rax     # 0x2de68
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14e75(%rip), %rax     # 0x2d874
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14e6c(%rip), %rax     # 0x2d87c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x118d7(%rip), %rax     # 0x2a2f8
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14e4e(%rip), %rax     # 0x2d880
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x15429(%rip), %rax     # 0x2de6c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x1541c(%rip), %rax     # 0x2de70
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14e1f(%rip), %rax     # 0x2d884
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14e12(%rip), %rax     # 0x2d888
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14e05(%rip), %rax     # 0x2d88c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x11864(%rip), %rax     # 0x2a2fc
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x11857(%rip), %rax     # 0x2a300
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x1184a(%rip), %rax     # 0x2a304
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14dc5(%rip), %rax     # 0x2d890
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x1182c(%rip), %rax     # 0x2a308
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x14da7(%rip), %rax     # 0x2d894
movl (%rax), %esi
movq %rbx, %rdi
callq 0x156d6
leaq 0x15376(%rip), %rax     # 0x2de74
movb (%rax), %al
leaq 0xf(%rsp), %r14
movb %al, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x15356(%rip), %rax     # 0x2de75
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x15336(%rip), %rsi     # 0x2de76
movq %rbx, %rdi
movl $0xf, %edx
callq 0x15645
leaq 0x1533c(%rip), %rsi     # 0x2de90
movq %rbx, %rdi
movl $0x50, %edx
callq 0x15645
leaq 0x15378(%rip), %rsi     # 0x2dee0
movq %rbx, %rdi
movl $0x50, %edx
callq 0x15645
leaq 0x153b4(%rip), %rsi     # 0x2df30
movq %rbx, %rdi
movl $0x50, %edx
callq 0x15645
leaq 0x14d08(%rip), %rax     # 0x2d898
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14ce8(%rip), %rax     # 0x2d899
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14cc8(%rip), %rax     # 0x2d89a
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14ca8(%rip), %rax     # 0x2d89b
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14c88(%rip), %rax     # 0x2d89c
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x116d7(%rip), %rax     # 0x2a30c
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
movb $0x0, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x1169e(%rip), %rax     # 0x2a30d
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14c0e(%rip), %rax     # 0x2d89e
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14bee(%rip), %rax     # 0x2d89f
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14bce(%rip), %rax     # 0x2d8a0
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14bae(%rip), %rax     # 0x2d8a1
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14b8e(%rip), %rax     # 0x2d8a2
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15645
leaq 0x14b6e(%rip), %rax     # 0x2d8a3
movb (%rax), %al
movb %al, (%r14)
leaq 0xf(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x15645
leaq 0x17709(%rip), %rax     # 0x3045c
movq (%rax), %rsi
movq %rsi, %r14
shrq $0x20, %r14
movq %rbx, %rdi
callq 0x156d6
movq %rbx, %rdi
movl %r14d, %esi
callq 0x156d6
leaq 0x176ed(%rip), %rax     # 0x30464
movq (%rax), %rsi
movq %rsi, %r14
shrq $0x20, %r14
movq %rbx, %rdi
callq 0x156d6
movq %rbx, %rdi
movl %r14d, %esi
callq 0x156d6
leaq 0x176d1(%rip), %rax     # 0x3046c
movq (%rax), %rsi
movq %rsi, %r14
shrq $0x20, %r14
movq %rbx, %rdi
callq 0x156d6
movq %rbx, %rdi
movl %r14d, %esi
callq 0x156d6
leaq 0x115f1(%rip), %rax     # 0x2a3b0
movq (%rax), %rsi
movq %rsi, %r14
shrq $0x20, %r14
movq %rbx, %rdi
callq 0x156d6
movq %rbx, %rdi
movl %r14d, %esi
callq 0x156d6
leaq 0x115dd(%rip), %rsi     # 0x2a3c0
movq %rbx, %rdi
movl $0x35, %edx
callq 0x17a72
leaq 0x17689(%rip), %rsi     # 0x30480
movq %rbx, %rdi
movl $0x14, %edx
callq 0x1716d
movq %rbx, %rdi
callq 0x18362
movq %rbx, %rdi
callq 0x1847b
movq %rbx, %rdi
callq 0x185ac
movq %rbx, %rdi
callq 0x1864a
leaq 0x12fa5(%rip), %rsi     # 0x2bdd0
movq %rbx, %rdi
movl $0x9, %edx
callq 0x16dd4
leaq 0x13021(%rip), %rsi     # 0x2be60
movq %rbx, %rdi
movl $0xb, %edx
callq 0x16dd4
leaq 0x1313d(%rip), %rsi     # 0x2bf90
movq %rbx, %rdi
movl $0x13, %edx
callq 0x16dd4
leaq 0x13499(%rip), %rsi     # 0x2c300
movq %rbx, %rdi
movl $0x1b, %edx
callq 0x16dd4
leaq 0x13635(%rip), %rsi     # 0x2c4b0
movq %rbx, %rdi
movl $0x16, %edx
callq 0x16dd4
leaq 0x13781(%rip), %rsi     # 0x2c610
movq %rbx, %rdi
movl $0x1b, %edx
callq 0x16dd4
leaq 0x1391d(%rip), %rsi     # 0x2c7c0
movq %rbx, %rdi
movl $0x1b, %edx
callq 0x16dd4
leaq 0x17b29(%rip), %rax     # 0x309e0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x16384
leaq 0x17b27(%rip), %rax     # 0x309f0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x16384
movq 0x11055(%rip), %rax     # 0x29f30
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x16384
movq %rbx, %rdi
callq 0x6350
xorl %eax, %eax
cmpl $0x0, 0x1a58d(%rip)     # 0x33484
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0xa2ee(%rip), %rdi      # 0x231f9
leaq 0x9def(%rip), %rsi      # 0x22d01
leaq 0xa2f7(%rip), %rcx      # 0x23210
movl $0x806, %edx            # imm = 0x806
callq 0x61e0