// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x1020304, -0xc(%rbp)  # imm = 0x1020304
movsbl -0xc(%rbp), %eax
cmpl $0x1, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x1c278(%rip)     # 0x3c900
movq -0x8(%rbp), %rdi
leaq 0x163dd(%rip), %rsi     # 0x36a70
movl $0x14, %edx
callq 0x1d690
movq -0x8(%rbp), %rdi
leaq 0x165a8(%rip), %rax     # 0x36c50
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16666(%rip), %rsi     # 0x36d20
movl $0x9, %edx
callq 0x1ded0
movq -0x8(%rbp), %rdi
leaq 0x169f9(%rip), %rax     # 0x370c8
movq (%rax), %rsi
callq 0x1de00
movq -0x8(%rbp), %rdi
leaq 0x165ce(%rip), %rax     # 0x36cb0
movq (%rax), %rsi
callq 0x1fd20
movq -0x8(%rbp), %rdi
leaq 0x169db(%rip), %rsi     # 0x370d0
callq 0x1f7c0
movq -0x8(%rbp), %rdi
leaq 0x16a63(%rip), %rsi     # 0x37168
callq 0x1e650
movq -0x8(%rbp), %rdi
leaq 0x165a3(%rip), %rax     # 0x36cb8
movq (%rax), %rsi
callq 0x1f170
movq -0x8(%rbp), %rdi
leaq 0x169a8(%rip), %rax     # 0x370d0
movq 0x68(%rax), %rsi
leaq 0x1658d(%rip), %rax     # 0x36cc0
movq (%rax), %rdx
callq 0x1ff10
movq -0x8(%rbp), %rdi
leaq 0x1698a(%rip), %rax     # 0x370d0
movq 0x68(%rax), %rsi
leaq 0x16577(%rip), %rax     # 0x36cc8
movq (%rax), %rdx
callq 0x1ff10
movq -0x8(%rbp), %rdi
leaq 0x1696c(%rip), %rax     # 0x370d0
movq 0x68(%rax), %rsi
leaq 0x16a51(%rip), %rax     # 0x371c0
movq (%rax), %rdx
callq 0x1ff10
movq -0x8(%rbp), %rdi
leaq 0x1694e(%rip), %rax     # 0x370d0
movq 0x68(%rax), %rsi
leaq 0x16a33(%rip), %rax     # 0x371c0
movq 0x8(%rax), %rdx
callq 0x1ff10
leaq 0x16933(%rip), %rcx     # 0x370d0
leaq 0x16a2c(%rip), %rax     # 0x371d0
cmpq %rcx, (%rax)
jne 0x207ab
jmp 0x207ca
leaq 0xd115(%rip), %rdi      # 0x2d8c7
leaq 0xcb58(%rip), %rsi      # 0x2d311
movl $0x806, %edx            # imm = 0x806
leaq 0xd119(%rip), %rcx      # 0x2d8de
callq 0x61d0
movq -0x8(%rbp), %rdi
leaq 0x16a0b(%rip), %rsi     # 0x371e0
movl $0xa, %edx
callq 0x1f1f0
movq -0x8(%rbp), %rdi
leaq 0x12b06(%rip), %rax     # 0x332f0
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x164d4(%rip), %rax     # 0x36cd0
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x164c6(%rip), %rax     # 0x36cd4
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x164b8(%rip), %rax     # 0x36cd8
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x12ac2(%rip), %rax     # 0x332f4
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16498(%rip), %rax     # 0x36cdc
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16a82(%rip), %rax     # 0x372d8
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x1647c(%rip), %rax     # 0x36ce4
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16472(%rip), %rax     # 0x36cec
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x12a6c(%rip), %rax     # 0x332f8
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16452(%rip), %rax     # 0x36cf0
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16a2c(%rip), %rax     # 0x372dc
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16a1e(%rip), %rax     # 0x372e0
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16420(%rip), %rax     # 0x36cf4
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16412(%rip), %rax     # 0x36cf8
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x16404(%rip), %rax     # 0x36cfc
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x129f2(%rip), %rax     # 0x332fc
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x129e4(%rip), %rax     # 0x33300
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x129d6(%rip), %rax     # 0x33304
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x163c0(%rip), %rax     # 0x36d00
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x129b6(%rip), %rax     # 0x33308
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x163a0(%rip), %rax     # 0x36d04
movl (%rax), %esi
callq 0x1bf60
movq -0x8(%rbp), %rdi
leaq 0x1696e(%rip), %rax     # 0x372e4
movsbl (%rax), %esi
callq 0x1bec0
movq -0x8(%rbp), %rdi
leaq 0x1695c(%rip), %rax     # 0x372e5
movsbl (%rax), %esi
callq 0x1bec0
movq -0x8(%rbp), %rdi
leaq 0x1694a(%rip), %rsi     # 0x372e6
movl $0xf, %edx
callq 0x1be50
movq -0x8(%rbp), %rdi
leaq 0x1694f(%rip), %rsi     # 0x37300
movl $0x50, %edx
callq 0x1be50
movq -0x8(%rbp), %rdi
leaq 0x1698a(%rip), %rsi     # 0x37350
movl $0x50, %edx
callq 0x1be50
movq -0x8(%rbp), %rdi
leaq 0x169c5(%rip), %rsi     # 0x373a0
movl $0x50, %edx
callq 0x1be50
movq -0x8(%rbp), %rdi
leaq 0x16318(%rip), %rax     # 0x36d08
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x16302(%rip), %rax     # 0x36d09
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x162ec(%rip), %rax     # 0x36d0a
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x162d6(%rip), %rax     # 0x36d0b
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x162c0(%rip), %rax     # 0x36d0c
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x128a9(%rip), %rax     # 0x3330c
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x12888(%rip), %rax     # 0x3330d
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x16272(%rip), %rax     # 0x36d0e
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x1625c(%rip), %rax     # 0x36d0f
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x16246(%rip), %rax     # 0x36d10
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x16230(%rip), %rax     # 0x36d11
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x1621a(%rip), %rax     # 0x36d12
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x16204(%rip), %rax     # 0x36d13
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x1bf00
movq -0x8(%rbp), %rdi
leaq 0x18da6(%rip), %rax     # 0x398cc
movq (%rax), %rsi
callq 0x1d360
movq -0x8(%rbp), %rdi
leaq 0x18d9b(%rip), %rax     # 0x398d4
movq (%rax), %rsi
callq 0x1d360
movq -0x8(%rbp), %rdi
leaq 0x18d90(%rip), %rax     # 0x398dc
movq (%rax), %rsi
callq 0x1d360
movq -0x8(%rbp), %rdi
leaq 0x12851(%rip), %rax     # 0x333b0
movq (%rax), %rsi
callq 0x1d360
movq -0x8(%rbp), %rdi
leaq 0x1284e(%rip), %rsi     # 0x333c0
movl $0x35, %edx
callq 0x1f450
movq -0x8(%rbp), %rdi
leaq 0x18d69(%rip), %rsi     # 0x398f0
movl $0x14, %edx
callq 0x1e910
movq -0x8(%rbp), %rdi
callq 0x20060
movq -0x8(%rbp), %rdi
callq 0x201b0
movq -0x8(%rbp), %rdi
callq 0x20300
movq -0x8(%rbp), %rdi
callq 0x203a0
movq -0x8(%rbp), %rdi
leaq 0x14210(%rip), %rsi     # 0x34dd0
movl $0x9, %edx
callq 0x1e3e0
movq -0x8(%rbp), %rdi
leaq 0x1428b(%rip), %rsi     # 0x34e60
movl $0xb, %edx
callq 0x1e3e0
movq -0x8(%rbp), %rdi
leaq 0x143a6(%rip), %rsi     # 0x34f90
movl $0x13, %edx
callq 0x1e3e0
movq -0x8(%rbp), %rdi
leaq 0x14701(%rip), %rsi     # 0x35300
movl $0x1b, %edx
callq 0x1e3e0
movq -0x8(%rbp), %rdi
leaq 0x1489c(%rip), %rsi     # 0x354b0
movl $0x16, %edx
callq 0x1e3e0
movq -0x8(%rbp), %rdi
leaq 0x149e7(%rip), %rsi     # 0x35610
movl $0x1b, %edx
callq 0x1e3e0
movq -0x8(%rbp), %rdi
leaq 0x14b82(%rip), %rsi     # 0x357c0
movl $0x1b, %edx
callq 0x1e3e0
movq -0x8(%rbp), %rdi
leaq 0x191fd(%rip), %rax     # 0x39e50
movq (%rax), %rsi
callq 0x1d400
movq -0x8(%rbp), %rdi
leaq 0x191fa(%rip), %rax     # 0x39e60
movq (%rax), %rsi
callq 0x1d400
movq -0x8(%rbp), %rdi
movq 0x12347(%rip), %rax     # 0x32fc0
movq (%rax), %rsi
callq 0x1d400
movq -0x8(%rbp), %rdi
callq 0x6360
cmpl $0x0, 0x1bc63(%rip)     # 0x3c8f4
sete %al
andb $0x1, %al
movzbl %al, %eax
addq $0x10, %rsp
popq %rbp
retq
nop