// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
andl $0x0, 0x1c1a1(%rip)     # 0x33480
leaq 0x1630a(%rip), %rsi     # 0x2d5f0
pushq $0x14
popq %rdx
callq 0x155e9
leaq 0x164db(%rip), %rax     # 0x2d7d0
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x1659a(%rip), %rsi     # 0x2d8a0
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x15911
leaq 0x16930(%rip), %rax     # 0x2dc48
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x1589b
leaq 0x16506(%rip), %rax     # 0x2d830
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x16c6c
leaq 0x16914(%rip), %r14     # 0x2dc50
movq %rbx, %rdi
movq %r14, %rsi
callq 0x168ee
leaq 0x1699a(%rip), %rsi     # 0x2dce8
movq %rbx, %rdi
callq 0x15da5
leaq 0x164db(%rip), %rax     # 0x2d838
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x16571
movq 0x68(%r14), %rsi
leaq 0x164cd(%rip), %rax     # 0x2d840
movq (%rax), %rdx
movq %rbx, %rdi
callq 0x16db2
movq 0x68(%r14), %rsi
leaq 0x164bf(%rip), %rax     # 0x2d848
movq (%rax), %rdx
movq %rbx, %rdi
callq 0x16db2
movq 0x68(%r14), %rsi
leaq 0x169a1(%rip), %r15     # 0x2dd40
movq (%r15), %rdx
movq %rbx, %rdi
callq 0x16db2
movq 0x68(%r14), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x16db2
leaq 0x1698f(%rip), %rax     # 0x2dd50
cmpq %r14, (%rax)
jne 0x17811
leaq 0x1698f(%rip), %rsi     # 0x2dd60
pushq $0xa
popq %rdx
movq %rbx, %rdi
callq 0x165c1
leaq 0x12efd(%rip), %rax     # 0x2a2e0
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x1645c(%rip), %rax     # 0x2d850
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x1644f(%rip), %rax     # 0x2d854
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x16442(%rip), %rax     # 0x2d858
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x12ebd(%rip), %rax     # 0x2a2e4
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x16424(%rip), %rax     # 0x2d85c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x16a0f(%rip), %rax     # 0x2de58
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x1640a(%rip), %rax     # 0x2d864
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x16401(%rip), %rax     # 0x2d86c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x12e6c(%rip), %rax     # 0x2a2e8
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x163e3(%rip), %rax     # 0x2d870
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x169be(%rip), %rax     # 0x2de5c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x169b1(%rip), %rax     # 0x2de60
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x163b4(%rip), %rax     # 0x2d874
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x163a7(%rip), %rax     # 0x2d878
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x1639a(%rip), %rax     # 0x2d87c
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x12df9(%rip), %rax     # 0x2a2ec
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x12dec(%rip), %rax     # 0x2a2f0
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x12ddf(%rip), %rax     # 0x2a2f4
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x1635a(%rip), %rax     # 0x2d880
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x12dc1(%rip), %rax     # 0x2a2f8
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x1633c(%rip), %rax     # 0x2d884
movl (%rax), %esi
movq %rbx, %rdi
callq 0x14801
leaq 0x1690b(%rip), %rax     # 0x2de64
movsbl (%rax), %esi
movq %rbx, %rdi
callq 0x147bd
leaq 0x168fa(%rip), %rax     # 0x2de65
movsbl (%rax), %esi
movq %rbx, %rdi
callq 0x147bd
leaq 0x168e9(%rip), %rsi     # 0x2de66
pushq $0xf
popq %rdx
movq %rbx, %rdi
callq 0x14776
leaq 0x168f1(%rip), %rsi     # 0x2de80
pushq $0x50
popq %rbp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x14776
leaq 0x1692d(%rip), %rsi     # 0x2ded0
movq %rbx, %rdi
movl %ebp, %edx
callq 0x14776
leaq 0x1696c(%rip), %rsi     # 0x2df20
movq %rbx, %rdi
movl %ebp, %edx
callq 0x14776
leaq 0x162c3(%rip), %rax     # 0x2d888
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x162b2(%rip), %rax     # 0x2d889
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x162a1(%rip), %rax     # 0x2d88a
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x16290(%rip), %rax     # 0x2d88b
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x1627f(%rip), %rax     # 0x2d88c
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x12cdd(%rip), %rax     # 0x2a2fc
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
movq %rbx, %rdi
xorl %esi, %esi
callq 0x147df
leaq 0x12cc2(%rip), %rax     # 0x2a2fd
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x16241(%rip), %rax     # 0x2d88e
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x16230(%rip), %rax     # 0x2d88f
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x1621f(%rip), %rax     # 0x2d890
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x1620e(%rip), %rax     # 0x2d891
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x161fd(%rip), %rax     # 0x2d892
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x161ec(%rip), %rax     # 0x2d893
movzbl (%rax), %esi
movq %rbx, %rdi
callq 0x147df
leaq 0x18d93(%rip), %rax     # 0x3044c
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x15389
leaq 0x18d89(%rip), %rax     # 0x30454
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x15389
leaq 0x18d7f(%rip), %rax     # 0x3045c
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x15389
leaq 0x12cb1(%rip), %rax     # 0x2a3a0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x15389
leaq 0x12caf(%rip), %rsi     # 0x2a3b0
pushq $0x35
popq %rdx
movq %rbx, %rdi
callq 0x1673b
leaq 0x18d5d(%rip), %rsi     # 0x30470
pushq $0x14
popq %rdx
movq %rbx, %rdi
callq 0x15f68
movq %rbx, %rdi
callq 0x16e8e
movq %rbx, %rdi
callq 0x16f84
movq %rbx, %rdi
callq 0x1708b
movq %rbx, %rdi
callq 0x1710c
leaq 0x1467b(%rip), %rsi     # 0x2bdc0
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x15beb
leaq 0x146f9(%rip), %rsi     # 0x2be50
pushq $0xb
popq %rdx
movq %rbx, %rdi
callq 0x15beb
leaq 0x14817(%rip), %rsi     # 0x2bf80
pushq $0x13
popq %rdx
movq %rbx, %rdi
callq 0x15beb
leaq 0x14b75(%rip), %rsi     # 0x2c2f0
pushq $0x1b
popq %rbp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x15beb
leaq 0x14d11(%rip), %rsi     # 0x2c4a0
pushq $0x16
popq %rdx
movq %rbx, %rdi
callq 0x15beb
leaq 0x14e5f(%rip), %rsi     # 0x2c600
movq %rbx, %rdi
movl %ebp, %edx
callq 0x15beb
leaq 0x14ffe(%rip), %rsi     # 0x2c7b0
movq %rbx, %rdi
movl %ebp, %edx
callq 0x15beb
leaq 0x1920d(%rip), %rax     # 0x309d0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x153ee
leaq 0x1920b(%rip), %rax     # 0x309e0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x153ee
movq 0x12751(%rip), %rax     # 0x29f38
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x153ee
movq %rbx, %rdi
callq 0x6340
xorl %eax, %eax
cmpl $0x0, 0x1bc71(%rip)     # 0x33474
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x99e1(%rip), %rdi      # 0x211f9
leaq 0x94e2(%rip), %rsi      # 0x20d01
leaq 0x99ea(%rip), %rcx      # 0x21210
movl $0x806, %edx            # imm = 0x806
callq 0x61e0