LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/rip.c
// Function: showpack
void showpack(bool winner,char *howso)
{
	char *iname;
	int cnt, worth, ch;
	struct linked_list *item;
	struct object *obj;

	idenpack();
	cnt = 1;
	clear();
	if (winner)
		mvaddstr(0, 0, "   Worth  Item");
	else
		mvprintw(0, 0, "Contents of your pack %s:\n",howso);
	ch = 'a';
	for (item = pack; item != NULL; item = next(item)) {
		obj = OBJPTR(item);
		iname = inv_name(obj, FALSE);
		if (winner) {
			worth = get_worth(obj);
			worth *= obj->o_count;
			mvprintw(cnt, 0, "  %6d  %s",worth,iname);
			purse += worth;
		}
		else {
			mvprintw(cnt, 0, "%c) %s\n",ch,iname);
			ch = npch(ch);
		}
		if (++cnt >= LINES - 2 && next(item) != NULL) {
			cnt = 1;
			mvaddstr(LINES - 1, 0, morestr);
			refresh();
			wait_for(stdscr, ' ');
			clear();
		}
	}
	mvprintw(cnt + 1,0,"--- %d  Gold Pieces ---",oldpurse);
	refresh();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
xorl %eax, %eax
callq 0x10b43
movq 0x16b60(%rip), %r12     # 0x29f30
movq (%r12), %rdi
callq 0x6120
testl %ebp, %ebp
je 0x13406
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x1341b
movq (%r12), %rdi
leaq 0xee0d(%rip), %rsi      # 0x22207
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
jmp 0x1341b
leaq 0xee09(%rip), %rdx      # 0x22216
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x62c0
leaq 0x1a83e(%rip), %rax     # 0x2dc60
movq 0x68(%rax), %rbx
testq %rbx, %rbx
je 0x1353e
movl $0x61, (%rsp)
movl $0x1, %r13d
movl %ebp, 0x4(%rsp)
movq 0x10(%rbx), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x1aa04
movq %rax, %r15
testb %bpl, %bpl
je 0x13495
movq %r14, %rdi
callq 0x1bc95
movq %r12, %rbp
movl %eax, %r12d
imull 0x24(%r14), %r12d
movl %r13d, %edi
xorl %esi, %esi
leaq 0xedbc(%rip), %rdx      # 0x22231
movl %r12d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x62c0
leaq 0x1a3e3(%rip), %rax     # 0x2d86c
addl %r12d, (%rax)
movq %rbp, %r12
movl 0x4(%rsp), %ebp
jmp 0x134c1
movl %r13d, %edi
xorl %esi, %esi
leaq 0xed9a(%rip), %rdx      # 0x2223b
movl (%rsp), %r14d
movl %r14d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x62c0
movsbl %r14b, %edi
callq 0xbd39
movsbl %al, %eax
movl %eax, (%rsp)
incl %r13d
movq 0x16ae5(%rip), %rax     # 0x29fb0
movl (%rax), %esi
leal -0x2(%rsi), %ecx
movq (%rbx), %rax
cmpl %ecx, %r13d
jl 0x1352d
testq %rax, %rax
je 0x13539
movq (%r12), %rdi
decl %esi
xorl %edx, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x13504
movq (%r12), %rdi
leaq 0x16e34(%rip), %rsi     # 0x2a32e
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%r12), %rdi
callq 0x6200
movq (%r12), %rdi
movl $0x20, %esi
callq 0xb89e
movq (%r12), %rdi
callq 0x6120
movq (%rbx), %rax
movl $0x1, %r13d
movq %rax, %rbx
testq %rax, %rax
jne 0x13440
incl %r13d
jmp 0x13544
movl $0x2, %r13d
movl 0x1f976(%rip), %ecx     # 0x32ec0
leaq 0xecf2(%rip), %rdx      # 0x22243
movl %r13d, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x62c0
movq (%r12), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6200
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/rooms.c
// Function: rnd_pos
struct coord *rnd_pos(struct room *rp)
{
	int y, x, i;
	static struct coord spot;

	i = 0;
	do {
		x = rp->r_pos.x + rnd(rp->r_max.x - 2) + 1;
		y = rp->r_pos.y + rnd(rp->r_max.y - 2) + 1;
		i += 1;
	} while(winat(y, x) != FLOOR && i < 1000);
	spot.x = x;
	spot.y = y;
	return &spot;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r15d, %r15d
movl (%rbx), %r14d
movl 0x8(%rbx), %edi
addl $-0x2, %edi
xorl %eax, %eax
callq 0xc674
leal (%r14,%rax), %ebp
incl %ebp
movl 0x4(%rbx), %r14d
movl 0xc(%rbx), %edi
addl $-0x2, %edi
xorl %eax, %eax
callq 0xc674
addl %eax, %r14d
incl %r14d
movl %r14d, %edi
movl %ebp, %esi
callq 0x9492
cmpb $0x2e, %al
je 0x13f61
leal 0x1(%r15), %eax
cmpl $0x3e7, %r15d           # imm = 0x3E7
movl %eax, %r15d
jb 0x13f16
movl %ebp, 0x1f481(%rip)     # 0x333e8
leaq 0x1f47a(%rip), %rax     # 0x333e8
movl %r14d, 0x1f477(%rip)    # 0x333ec
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/save.c
// Function: save_game
int save_game()
{
	FILE *savef;
	int c;
	char buf[LINLEN];

	mpos = 0;
	if (file_name[0] != '\0') {
		msg("Save file (%s)? ", file_name);
		do {
			c = wgetch(cw);
			if(c == ESCAPE) {
				msg("");
				return FALSE;
			}
		} while (c != 'n' && c != 'y');
		mpos = 0;
		if (c == 'y')
			goto gotfile;
	}
	msg("File name: ");
	mpos = 0;
	buf[0] = '\0';
	if (get_str(buf, cw) == QUIT) {
		msg("");
		return FALSE;
	}
	msg("");
	strcpy(file_name, buf);
gotfile:
	c = dosave();		/* try to save this game */
	if (c == FALSE)
		msg("Could not save game to file %s", file_name);
	return c;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
leaq 0x19831(%rip), %r14     # 0x2d870
movl $0x0, (%r14)
leaq 0x19f83(%rip), %rax     # 0x2dfd0
cmpb $0x0, (%rax)
je 0x140a6
leaq 0xe563(%rip), %rdi      # 0x225bc
leaq 0x19f70(%rip), %rsi     # 0x2dfd0
xorl %eax, %eax
callq 0xb620
leaq 0x1c972(%rip), %rbx     # 0x309e0
movq (%rbx), %rdi
callq 0x6110
cmpl $0x79, %eax
je 0x1409a
cmpl $0x6e, %eax
je 0x1409a
cmpl $0x1b, %eax
jne 0x1406e
leaq 0xf8fd(%rip), %rdi      # 0x23989
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xb620
jmp 0x1411b
movl $0x0, (%r14)
cmpl $0x79, %eax
je 0x140f6
leaq 0xe520(%rip), %rdi      # 0x225cd
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xb620
movl $0x0, (%r14)
movq %rsp, %rdi
movb $0x0, (%rdi)
leaq 0x1c916(%rip), %rax     # 0x309e0
movq (%rax), %rsi
callq 0xfd31
movl %eax, %ebp
leaq 0xf8ae(%rip), %rdi      # 0x23989
xorl %eax, %eax
callq 0xb620
cmpl $0x1, %ebp
je 0x1411b
leaq 0x19ee2(%rip), %rdi     # 0x2dfd0
movq %rsp, %rsi
callq 0x60e0
movl $0x1, %ebx
callq 0x141a9
testb %al, %al
jne 0x1411b
leaq 0xe4ce(%rip), %rdi      # 0x225d9
leaq 0x19ebe(%rip), %rsi     # 0x2dfd0
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xb620
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/save.c
// Function: game_err
void game_err(int a)
{
	int ok;

	ok = dosave();			/* try to save this game */
	clear();
	refresh();
	endwin();

	printf("\nInternal error !!!\n\nYour game was ");
	if (ok)
		printf("saved.");
	else
		printf("NOT saveable.");

	fflush(stdout);

#ifdef SIGIOT
	signal(SIGIOT, SIG_DFL);	/* allow core dump signal */
#endif

	abort();			/* cause core dump */
	byebye(3);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
callq 0x141a9
movl %eax, %ebx
movq 0x15de5(%rip), %r14     # 0x29f30
movq (%r14), %rdi
callq 0x6120
movq (%r14), %rdi
callq 0x6200
callq 0x6530
leaq 0xe491(%rip), %rdi      # 0x225f8
xorl %eax, %eax
callq 0x61c0
leaq 0xe4a7(%rip), %rax      # 0x2261c
leaq 0xe4a7(%rip), %rdi      # 0x22623
testb %bl, %bl
cmovneq %rax, %rdi
xorl %eax, %eax
callq 0x61c0
movq 0x15d70(%rip), %rax     # 0x29f00
movq (%rax), %rdi
callq 0x6350
movl $0x6, %edi
xorl %esi, %esi
callq 0x6280
callq 0x6090
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/save.c
// Function: dosave
bool dosave()
{
	FILE *savef;

	ignore();
	setuid(playuid);
	setgid(playgid);
	umask(022);

	if (file_name[0] != '\0') {
		if ((savef = fopen(file_name,"w")) != NULL)
		{
			save_file(savef);
			return TRUE;
		}
	}
	return FALSE;
}

// Assembly:
pushq %rbx
xorl %ebx, %ebx
movl $0x1, %esi
movl %ebx, %edi
callq 0x6280
incl %ebx
cmpl $0x41, %ebx
jne 0x141ac
leaq 0x19c9a(%rip), %rax     # 0x2de60
movl (%rax), %edi
callq 0x6520
leaq 0x19c90(%rip), %rax     # 0x2de64
movl (%rax), %edi
callq 0x6410
movl $0x12, %edi
callq 0x62a0
leaq 0x19de4(%rip), %rax     # 0x2dfd0
cmpb $0x0, (%rax)
je 0x14215
leaq 0x19dd8(%rip), %rdi     # 0x2dfd0
leaq 0xbe53(%rip), %rsi      # 0x20052
callq 0x6460
testq %rax, %rax
je 0x14215
movq %rax, %rdi
callq 0x14219
movb $0x1, %al
jmp 0x14217
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/save.c
// Function: save_file
void save_file(FILE *savef)
{
	int fnum;
	int slines = LINES;
	int scols = COLS;

#ifdef __DJGPP__                      /* st_ino w/ DJGPP under WinXP broken */
        _djstat_flags |= _STAT_INODE; /* so turn off computing it for now   */
#endif

	/*
	 * force allocation of the buffer now so that inodes, etc
	 * can be checked when restoring saved games.
	 */
	fnum = fileno(savef);
	fstat(fnum, &sbuf);
	write(fnum, "RDK", 4);
	lseek(fnum, 0L, 0);
	encwrite(version,strlen(version)+1,savef);
	encwrite(&sbuf.st_ino,sizeof(sbuf.st_ino),savef);
	encwrite(&sbuf.st_dev,sizeof(sbuf.st_dev),savef);
	encwrite(&sbuf.st_ctime,sizeof(sbuf.st_ctime),savef);
	encwrite(&sbuf.st_mtime,sizeof(sbuf.st_mtime),savef);
	encwrite(&slines,sizeof(slines),savef);
	encwrite(&scols,sizeof(scols),savef);
	msg("");
	rs_save_file(savef);
	close(fnum);
	signal(SIGINT, byebye);
	signal(SIGQUIT, byebye);
	wclear(cw);
	draw(cw);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x15d82(%rip), %rax     # 0x29fb0
movl (%rax), %eax
leaq 0x4(%rsp), %r15
movl %eax, (%r15)
movq 0x15d59(%rip), %rax     # 0x29f98
movl (%rax), %eax
movq %rsp, %r14
movl %eax, (%r14)
callq 0x62f0
movl %eax, %ebp
leaq 0x1f19b(%rip), %r12     # 0x333f0
movl %eax, %edi
movq %r12, %rsi
callq 0x6570
leaq 0xe3cb(%rip), %rsi      # 0x22631
movl $0x4, %edx
movl %ebp, %edi
callq 0x6100
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x61d0
leaq 0x1932c(%rip), %r13     # 0x2d5b0
movq %r13, %rdi
callq 0x6170
leal 0x1(%rax), %esi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x15534
leaq 0x1f157(%rip), %rdi     # 0x333f8
movl $0x8, %esi
movq %rbx, %rdx
callq 0x15534
movq %r12, %rdi
movl $0x8, %esi
movq %rbx, %rdx
callq 0x15534
leaq 0x1f193(%rip), %rdi     # 0x33458
movl $0x8, %esi
movq %rbx, %rdx
callq 0x15534
leaq 0x1f16f(%rip), %rdi     # 0x33448
movl $0x8, %esi
movq %rbx, %rdx
callq 0x15534
movq %r15, %rdi
movl $0x4, %esi
movq %rbx, %rdx
callq 0x15534
movq %r14, %rdi
movl $0x4, %esi
movq %rbx, %rdx
callq 0x15534
leaq 0xf67c(%rip), %rdi      # 0x23989
xorl %eax, %eax
callq 0xb620
movq %rbx, %rdi
callq 0x1884b
movl %ebp, %edi
callq 0x6230
leaq -0x7cce(%rip), %rbx     # 0xc65c
movl $0x2, %edi
movq %rbx, %rsi
callq 0x6280
movl $0x3, %edi
movq %rbx, %rsi
callq 0x6280
leaq 0x1c695(%rip), %rbx     # 0x309e0
movq (%rbx), %rdi
callq 0x6120
movq (%rbx), %rdi
callq 0x6200
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: encwrite
void encwrite(void *starta,unsigned int size,FILE *outf)
{
    char *ep;
    char *start = starta;

    ep = encstr;

    while (size--)
    {
        putc(*start++ ^ *ep++, outf);
        if (*ep == '\0')
            ep = encstr;
    }
}

// Assembly:
testl %esi, %esi
je 0x15593
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movl %esi, %r15d
leaq 0x17f8d(%rip), %r12     # 0x2d4e0
xorl %r13d, %r13d
movq %r12, %rbp
movb (%rbp), %al
xorb (%r14,%r13), %al
movsbl %al, %edi
movq %rbx, %rsi
callq 0x6260
cmpb $0x0, 0x1(%rbp)
movq %r12, %rax
je 0x1557a
incq %rbp
movq %rbp, %rax
incq %r13
movq %rax, %rbp
cmpl %r13d, %r15d
jne 0x15559
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: encread
int encread(void *starta,unsigned int size,int inf)
{
    char *ep;
    int read_size;
    char *start = starta;

    if ((read_size = read(inf, start, size)) == -1 || read_size == 0)
        return read_size;

    ep = encstr;

    while (size--)
    {
        *start++ ^= *ep++;
        if (*ep == '\0')
            ep = encstr;
    }
    return read_size;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %r14d
movl %edx, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x6240
leal 0x1(%rax), %ecx
cmpl $0x2, %ecx
setb %cl
testl %ebp, %ebp
sete %dl
orb %cl, %dl
jne 0x155ec
leaq 0x17f1a(%rip), %rcx     # 0x2d4e0
xorl %edx, %edx
movq %rcx, %rsi
movb (%rsi), %dil
xorb %dil, (%rbx,%rdx)
cmpb $0x0, 0x1(%rsi)
movq %rcx, %rdi
je 0x155e1
incq %rsi
movq %rsi, %rdi
incq %rdx
movq %rdi, %rsi
cmpl %edx, %r14d
jne 0x155cb
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write
int rs_write(FILE *savef, void *ptr, int size)
{
    if (!write_error)
        encwrite(ptr,size,savef);

    if (0)
        write_error = TRUE;
        
    assert(write_error == 0);

    return(WRITESTAT);
}

// Assembly:
pushq %rax
cmpl $0x0, 0x1de37(%rip)     # 0x33484
jne 0x1566f
movq %rdi, %rax
movq %rsi, %rdi
movl %edx, %esi
movq %rax, %rdx
callq 0x15534
cmpl $0x0, 0x1de1e(%rip)     # 0x33484
jne 0x1566f
movl $0x1, %eax
popq %rcx
retq
leaq 0xd67a(%rip), %rdi      # 0x22cf0
leaq 0xd684(%rip), %rsi      # 0x22d01
leaq 0xd685(%rip), %rcx      # 0x22d09
movl $0xb7, %edx
callq 0x61e0
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_int
int rs_write_int(FILE *savef, int c)
{
    unsigned char bytes[4];
    unsigned char *buf = (unsigned char *) &c;

    if (big_endian)
    {
        bytes[3] = buf[0];
        bytes[2] = buf[1];
        bytes[1] = buf[2];
        bytes[0] = buf[3];
        buf = bytes;
    }
    
    rs_write(savef, buf, 4);

    return(WRITESTAT);
}

// Assembly:
pushq %rax
movl %esi, (%rsp)
cmpl $0x0, 0x1ddaf(%rip)     # 0x33490
je 0x156f0
movl %esi, %eax
bswapl %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
jmp 0x156f3
movq %rsp, %rsi
movl $0x4, %edx
callq 0x15645
xorl %eax, %eax
cmpl $0x0, 0x1dd7e(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_booleans
int rs_write_booleans(FILE *savef, bool *c, int count)
{
    int n = 0;

    rs_write_int(savef,count);
    
    for(n = 0; n < count; n++)
        rs_write_boolean(savef,c[n]);

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x15754
movl %ebp, %r12d
xorl %r13d, %r13d
leaq 0x7(%rsp), %r15
movb (%rbx,%r13), %al
movb %al, 0x7(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x15645
incq %r13
cmpq %r13, %r12
jne 0x15734
xorl %eax, %eax
cmpl $0x0, 0x1dd27(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_short
int rs_write_short(FILE *savef, short c)
{
    unsigned char bytes[2];
    unsigned char *buf = (unsigned char *) &c;

    if (big_endian)
    {
        bytes[1] = buf[0];
        bytes[0] = buf[1];
        buf = bytes;
    }

    rs_write(savef, buf, 2);

    return(WRITESTAT);
}

// Assembly:
pushq %rax
movw %si, 0x4(%rsp)
cmpl $0x0, 0x1dcf0(%rip)     # 0x33490
je 0x157b0
rolw $0x8, %si
leaq 0x6(%rsp), %rax
movw %si, (%rax)
jmp 0x157b5
leaq 0x4(%rsp), %rax
movq %rax, %rsi
movl $0x2, %edx
callq 0x15645
xorl %eax, %eax
cmpl $0x0, 0x1dcb9(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_shorts
int rs_write_shorts(FILE *savef, short *c, int count)
{
    int n = 0;

    rs_write_int(savef,count);
    
    for(n = 0; n < count; n++)
        rs_write_short(savef,c[n]);

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x15806
movl %ebp, %r15d
xorl %r12d, %r12d
movswl (%rbx,%r12,2), %esi
movq %r14, %rdi
callq 0x15793
incq %r12
cmpq %r12, %r15
jne 0x157f1
xorl %eax, %eax
cmpl $0x0, 0x1dc75(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_ushort
int rs_write_ushort(FILE *savef, unsigned short c)
{
    unsigned char bytes[2];
    unsigned char *buf = (unsigned char *) &c;

    if (big_endian)
    {
        bytes[1] = buf[0];
        bytes[0] = buf[1];
        buf = bytes;
    }

    rs_write(savef, buf, 2);

    return(WRITESTAT);
}

// Assembly:
pushq %rax
movw %si, 0x4(%rsp)
cmpl $0x0, 0x1dc68(%rip)     # 0x33490
je 0x15838
rolw $0x8, %si
leaq 0x6(%rsp), %rax
movw %si, (%rax)
jmp 0x1583d
leaq 0x4(%rsp), %rax
movq %rax, %rsi
movl $0x2, %edx
callq 0x15645
xorl %eax, %eax
cmpl $0x0, 0x1dc31(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_ints
int rs_write_ints(FILE *savef, int *c, int count)
{
    int n = 0;

    rs_write_int(savef,count);
    
    for(n = 0; n < count; n++)
        rs_write_int(savef,c[n]);

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x1588d
movl %ebp, %r15d
xorl %r12d, %r12d
movl (%rbx,%r12,4), %esi
movq %r14, %rdi
callq 0x156d6
incq %r12
cmpq %r12, %r15
jne 0x15879
xorl %eax, %eax
cmpl $0x0, 0x1dbee(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_uint
int rs_write_uint(FILE *savef, unsigned int c)
{
    unsigned char bytes[4];
    unsigned char *buf = (unsigned char *) &c;

    if (big_endian)
    {
        bytes[3] = buf[0];
        bytes[2] = buf[1];
        bytes[1] = buf[2];
        bytes[0] = buf[3];
        buf = bytes;
    }
    
    rs_write(savef, buf, 4);

    return(WRITESTAT);
}

// Assembly:
pushq %rax
movl %esi, (%rsp)
cmpl $0x0, 0x1dbe3(%rip)     # 0x33490
je 0x158bc
movl %esi, %eax
bswapl %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
jmp 0x158bf
movq %rsp, %rsi
movl $0x4, %edx
callq 0x15645
xorl %eax, %eax
cmpl $0x0, 0x1dbb2(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_longs
int rs_write_longs(FILE *savef, long *c, int count)
{
    int n = 0;

    rs_write_int(savef,count);
    
    for(n = 0; n < count; n++)
        rs_write_long(savef,c[n]);

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x15942
movl %ebp, %r15d
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
movq %r14, %rdi
callq 0x158d7
incq %r12
cmpq %r12, %r15
jne 0x1592e
xorl %eax, %eax
cmpl $0x0, 0x1db39(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_ulongs
int rs_write_ulongs(FILE *savef, unsigned long *c, int count)
{
    int n = 0;

    rs_write_int(savef,count);
    
    for(n = 0; n < count; n++)
        rs_write_ulong(savef,c[n]);

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x159c2
movl %ebp, %r15d
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
movq %r14, %rdi
callq 0x15957
incq %r12
cmpq %r12, %r15
jne 0x159ae
xorl %eax, %eax
cmpl $0x0, 0x1dab9(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_string
int rs_write_string(FILE *savef, char *s)
{
    int len = 0;

    len = (s == NULL) ? 0 : strlen(s) + 1;

    rs_write_int(savef, len);
    rs_write(savef, s, len);
            
    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x15a05
movq %rsi, %r14
movq %rsi, %rdi
callq 0x6170
leal 0x1(%rax), %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x156d6
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
jmp 0x15a16
movq %rbx, %rdi
xorl %esi, %esi
callq 0x156d6
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x15645
xorl %eax, %eax
cmpl $0x0, 0x1da60(%rip)     # 0x33484
sete %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_strings
int rs_write_strings(FILE *savef, char *s[], int count)
{
    int len = 0;
    int n = 0;

    rs_write_int(savef,count);

    for(n = 0; n < count; n++)
    {
        len = (s[n] == NULL) ? 0L : strlen(s[n]) + 1;
        rs_write_int(savef, len);
        rs_write(savef, s[n], len);
    }
    
    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x15ac3
movl %ebp, %r12d
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rdi
movl $0x0, %r15d
testq %rdi, %rdi
je 0x15aa1
callq 0x6170
movq %rax, %r15
incl %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq (%rbx,%r13,8), %rsi
movq %r14, %rdi
movl %r15d, %edx
callq 0x15645
incq %r13
cmpq %r13, %r12
jne 0x15a87
xorl %eax, %eax
cmpl $0x0, 0x1d9b8(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read
int rs_read(int inf, void *ptr, int size)
{
    int actual;

    end_of_file = FALSE;

    if (!read_error && !format_error)
    {
        actual = encread(ptr, size, inf);

        if ((actual == 0) && (size != 0))
           end_of_file = TRUE;
    }
       
    if (read_error)
    {
        printf("read error has occurred. restore short-circuited.\n");
        abort();
    }

    if (format_error)
    {
        printf("format error: %s\r\n", fmterr);
        printf("game format invalid. restore short-circuited.\n");
        abort();
    }

    return(READSTAT);
}

// Assembly:
pushq %rbx
movl $0x0, 0x1d9a3(%rip)     # 0x3348c
movl 0x1d991(%rip), %eax     # 0x33480
movl 0x1d993(%rip), %ecx     # 0x33488
orl %eax, %ecx
jne 0x15b1f
movl %edx, %ebx
movl %edi, %edx
movq %rsi, %rdi
movl %ebx, %esi
callq 0x15594
testl %ebx, %ebx
je 0x15b19
testl %eax, %eax
jne 0x15b19
movl $0x1, 0x1d973(%rip)     # 0x3348c
movl 0x1d961(%rip), %eax     # 0x33480
testl %eax, %eax
jne 0x15b33
cmpl $0x0, 0x1d95e(%rip)     # 0x33488
jne 0x15b3c
movl $0x1, %eax
popq %rbx
retq
leaq 0xd71d(%rip), %rdi      # 0x23257
jmp 0x15b58
movq 0x1798d(%rip), %rsi     # 0x2d4d0
leaq 0xd1e1(%rip), %rdi      # 0x22d2b
xorl %eax, %eax
callq 0x61c0
leaq 0xd6d1(%rip), %rdi      # 0x23229
callq 0x60f0
callq 0x6090
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_int
int rs_read_int(int inf, int *i)
{
    unsigned char bytes[4];
    int  input;
    unsigned char *buf = (unsigned char *)&input;
    
    rs_read(inf, &input, 4);

    if (big_endian)
    {
        bytes[3] = buf[0];
        bytes[2] = buf[1];
        bytes[1] = buf[2];
        bytes[0] = buf[3];
        buf = bytes;
    }
    
    *i = *((int *) buf);

    return(READSTAT);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x4(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x15ade
cmpl $0x0, 0x1d8b7(%rip)     # 0x33490
movl (%r14), %eax
movl %eax, %ecx
bswapl %ecx
cmovel %eax, %ecx
movl %ecx, (%rbx)
movl 0x1d895(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d895(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_booleans
int rs_read_booleans(int inf, bool *i, int count)
{
    int n = 0, value = 0;
    
    if (rs_read_int(inf,&value) != 0)
    {
        if (value != count)
        {
            printf("Invalid booleans block. %d != requested %d\n",value,count); 
            format_error = TRUE;
        }
        else
        {
            for(n = 0; n < value; n++)
                rs_read_boolean(inf, &i[n]);
        }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x15c7d
movl 0xc(%rsp), %esi
cmpl %r14d, %esi
jne 0x15c62
testl %r14d, %r14d
jle 0x15c7d
movl %r14d, %r15d
xorl %r12d, %r12d
leaq 0xb(%rsp), %r14
movl %ebp, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15ade
cmpb $0x0, 0xb(%rsp)
setne (%rbx,%r12)
incq %r12
cmpq %r12, %r15
jne 0x15c3f
jmp 0x15c7d
leaq 0xd0d5(%rip), %rdi      # 0x22d3e
movl %r14d, %edx
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1d80b(%rip)     # 0x33488
movl 0x1d7fd(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d7fd(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_short
int rs_read_short(int inf, short *i)
{
    unsigned char bytes[2];
    short  input;
    unsigned char *buf = (unsigned char *)&input;
    
    rs_read(inf, &input, 2);

    if (big_endian)
    {
        bytes[1] = buf[0];
        bytes[0] = buf[1];
        buf = bytes;
    }
    
    *i = *((short *) buf);

    return(READSTAT);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x4(%rsp), %r14
movq %r14, %rsi
movl $0x2, %edx
callq 0x15ade
cmpl $0x0, 0x1d79e(%rip)     # 0x33490
je 0x15d06
movzwl 0x4(%rsp), %eax
rolw $0x8, %ax
leaq 0x6(%rsp), %r14
movw %ax, (%r14)
movzwl (%r14), %eax
movw %ax, (%rbx)
movl 0x1d76d(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d76d(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_shorts
int rs_read_shorts(int inf, short *i, int count)
{
    int n = 0, value = 0;

    if (rs_read_int(inf,&value) != 0)
    {
        if (value != count)
            format_error = TRUE;
        else
        {
            for(n = 0; n < value; n++)
                rs_read_short(inf, &i[n]);
        }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x15d78
cmpl %r14d, 0xc(%rsp)
jne 0x15d6e
testl %r14d, %r14d
jle 0x15d78
movl %r14d, %r14d
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15cd2
addq $0x2, %rbx
decq %r14
jne 0x15d59
jmp 0x15d78
movl $0x1, 0x1d710(%rip)     # 0x33488
movl 0x1d702(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d702(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_ushort
int rs_read_ushort(int inf, unsigned short *i)
{
    unsigned char bytes[2];
    unsigned short  input;
    unsigned char *buf = (unsigned char *)&input;
    
    rs_read(inf, &input, 2);

    if (big_endian)
    {
        bytes[1] = buf[0];
        bytes[0] = buf[1];
        buf = bytes;
    }
    
    *i = *((unsigned short *) buf);

    return(READSTAT);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x4(%rsp), %r14
movq %r14, %rsi
movl $0x2, %edx
callq 0x15ade
cmpl $0x0, 0x1d6de(%rip)     # 0x33490
je 0x15dc6
movzwl 0x4(%rsp), %eax
rolw $0x8, %ax
leaq 0x6(%rsp), %r14
movw %ax, (%r14)
movzwl (%r14), %eax
movw %ax, (%rbx)
movl 0x1d6ad(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d6ad(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_ints
int rs_read_ints(int inf, int *i, int count)
{
    int n = 0, value = 0;
    
    if (rs_read_int(inf,&value) != 0)
    {
        if (value != count)
            format_error = TRUE;
        else
        {
            for(n = 0; n < value; n++)
                rs_read_int(inf, &i[n]);
        }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x15e38
cmpl %r14d, 0xc(%rsp)
jne 0x15e2e
testl %r14d, %r14d
jle 0x15e38
movl %r14d, %r14d
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15bb9
addq $0x4, %rbx
decq %r14
jne 0x15e19
jmp 0x15e38
movl $0x1, 0x1d650(%rip)     # 0x33488
movl 0x1d642(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d642(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_uint
int rs_read_uint(int inf, unsigned int *i)
{
    unsigned char bytes[4];
    int  input;
    unsigned char *buf = (unsigned char *)&input;
    
    rs_read(inf, &input, 4);

    if (big_endian)
    {
        bytes[3] = buf[0];
        bytes[2] = buf[1];
        bytes[1] = buf[2];
        bytes[0] = buf[3];
        buf = bytes;
    }
    
    *i = *((unsigned int *) buf);

    return(READSTAT);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x4(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x15ade
cmpl $0x0, 0x1d61e(%rip)     # 0x33490
movl (%r14), %eax
movl %eax, %ecx
bswapl %ecx
cmovel %eax, %ecx
movl %ecx, (%rbx)
movl 0x1d5fc(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d5fc(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_long
int rs_read_long(int inf, long *i)
{
    unsigned char bytes[4];
    long input;
    unsigned char *buf = (unsigned char *) &input;
    
    rs_read(inf, &input, 4);

    if (big_endian)
    {
        bytes[3] = buf[0];
        bytes[2] = buf[1];
        bytes[1] = buf[2];
        bytes[0] = buf[3];
        buf = bytes;
    }
    
    *i = *((long *) buf);

    return(READSTAT);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x15ade
cmpl $0x0, 0x1d5d6(%rip)     # 0x33490
leaq 0xc(%rsp), %rax
cmoveq %r14, %rax
movq (%rax), %rax
movq %rax, (%rbx)
movl 0x1d5b1(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d5b1(%rip), %ecx     # 0x33488
sete %al
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_longs
int rs_read_longs(int inf, long *i, int count)
{
    int n = 0, value = 0;
    
    if (rs_read_int(inf,&value) != 0)
    {
        if (value != count)
            format_error = TRUE;
        else
        {
            for(n = 0; n < value; n++)
                rs_read_long(inf, &i[n]);
        }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x15f5a
cmpl %r14d, 0x4(%rsp)
jne 0x15f50
testl %r14d, %r14d
jle 0x15f5a
movl %r14d, %r15d
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movl %ebp, %edi
movq %r14, %rsi
movl $0x4, %edx
callq 0x15ade
cmpl $0x0, 0x1d559(%rip)     # 0x33490
jne 0x15f40
movq 0x8(%rsp), %rax
jmp 0x15f42
xorl %eax, %eax
movq %rax, (%rbx,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x15f21
jmp 0x15f5a
movl $0x1, 0x1d52e(%rip)     # 0x33488
movl 0x1d520(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d520(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_ulong
int rs_read_ulong(int inf, unsigned long *i)
{
    unsigned char bytes[4];
    unsigned long input;
    unsigned char *buf = (unsigned char *) &input;
    
    rs_read(inf, &input, 4);

    if (big_endian)
    {
        bytes[3] = buf[0];
        bytes[2] = buf[1];
        bytes[1] = buf[2];
        bytes[0] = buf[3];
        buf = bytes;
    }
    
    *i = *((unsigned long *) buf);

    return(READSTAT);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x15ade
cmpl $0x0, 0x1d4f5(%rip)     # 0x33490
leaq 0xc(%rsp), %rax
cmoveq %r14, %rax
movq (%rax), %rax
movq %rax, (%rbx)
movl 0x1d4d0(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d4d0(%rip), %ecx     # 0x33488
sete %al
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_ulongs
int rs_read_ulongs(int inf, unsigned long *i, int count)
{
    int n = 0, value = 0;
    
    if (rs_read_int(inf,&value) != 0)
    {
        if (value != count)
            format_error = TRUE;
        else
        {
            for(n = 0; n < value; n++)
                rs_read_ulong(inf, &i[n]);
        }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x1603b
cmpl %r14d, 0x4(%rsp)
jne 0x16031
testl %r14d, %r14d
jle 0x1603b
movl %r14d, %r15d
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movl %ebp, %edi
movq %r14, %rsi
movl $0x4, %edx
callq 0x15ade
cmpl $0x0, 0x1d478(%rip)     # 0x33490
jne 0x16021
movq 0x8(%rsp), %rax
jmp 0x16023
xorl %eax, %eax
movq %rax, (%rbx,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x16002
jmp 0x1603b
movl $0x1, 0x1d44d(%rip)     # 0x33488
movl 0x1d43f(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d43f(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_string
int rs_read_string(int inf, char *s, int max)
{
    int len = 0;

    if (rs_read_int(inf, &len) != FALSE)
    {
        if (len > max)
        {
            printf("String too long to restore. %d > %d\n",len,max);
            printf("Sorry, invalid save game format\n");
            format_error = TRUE;
        }
    
        rs_read(inf, s, len);
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x160bd
movl 0x4(%rsp), %r15d
cmpl %r14d, %r15d
jle 0x160b0
leaq 0xccdd(%rip), %rdi      # 0x22d6a
movl %r15d, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x61c0
leaq 0xd202(%rip), %rdi      # 0x232a3
callq 0x60f0
movl $0x1, 0x1d3d8(%rip)     # 0x33488
movl %ebp, %edi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x15ade
movl 0x1d3bd(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d3bd(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_new_string
int rs_read_new_string(int inf, char **s)
{
    int len=0;
    char *buf=0;

    if (rs_read_int(inf, &len) != 0)
    {
        if (len == 0)
            *s = NULL;
        else
        { 
            buf = malloc(len);

            if (buf == NULL)            
                read_error = TRUE;
            else
            {
                rs_read(inf, buf, len);
                *s = buf;
            }
        }
    }

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x16138
movslq 0x4(%rsp), %r14
testq %r14, %r14
je 0x16125
movq %r14, %rdi
callq 0x6340
testq %rax, %rax
je 0x1612e
movq %rax, %r15
movl %ebp, %edi
movq %rax, %rsi
movl %r14d, %edx
callq 0x15ade
movq %r15, (%rbx)
jmp 0x16138
movq $0x0, (%rbx)
jmp 0x16138
movl $0x1, 0x1d348(%rip)     # 0x33480
movl 0x1d342(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d342(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_string_index
int rs_read_string_index(int inf, char *master[], int maxindex, char **str)
{
    int i;

    if (rs_read_int(inf,&i) != 0)
    {
        if (i > maxindex)
        {
            printf("String index is out of range. %d > %d\n", i, maxindex);
            printf("Sorry, invalid save game format\n");
            format_error = TRUE;
        }
        else if (i >= 0)
            *str = master[i];
        else
            *str = NULL;
    }

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
leaq 0xc(%rsp), %rsi
callq 0x15bb9
testl %eax, %eax
je 0x161b6
movl 0xc(%rsp), %esi
cmpl %ebp, %esi
jle 0x161a2
leaq 0xcc0e(%rip), %rdi      # 0x22d8f
movl %ebp, %edx
xorl %eax, %eax
callq 0x61c0
leaq 0xd112(%rip), %rdi      # 0x232a3
callq 0x60f0
movl $0x1, 0x1d2e8(%rip)     # 0x33488
jmp 0x161b6
testl %esi, %esi
js 0x161af
movq (%r14,%rsi,8), %rax
movq %rax, (%rbx)
jmp 0x161b6
movq $0x0, (%rbx)
movl 0x1d2c4(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d2c4(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_strings
int rs_read_strings(int inf, char **s, int count, int max)
{
    int len   = 0;
    int n     = 0;
    int value = 0;
    
    if (rs_read_int(inf,&value) != 0)
    {
        if (value != count)
        {
            printf("Incorrect number of strings in block. %d > %d.", 
                value, count);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }
        else
        {
            for(n = 0; n < value; n++)
            {
                rs_read_string(inf, s[n], max);
            }
        }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %ebx
movl %edx, %r15d
movq %rsi, %r14
movl %edi, %ebp
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x1624e
movl 0xc(%rsp), %esi
cmpl %r15d, %esi
jne 0x16225
testl %r15d, %r15d
jle 0x1624e
movl %r15d, %r15d
xorl %r12d, %r12d
movq (%r14,%r12,8), %rsi
movl %ebp, %edi
movl %ebx, %edx
callq 0x16059
incq %r12
cmpq %r12, %r15
jne 0x1620e
jmp 0x1624e
leaq 0xcb8a(%rip), %rdi      # 0x22db6
movl %r15d, %edx
xorl %eax, %eax
callq 0x61c0
leaq 0xd066(%rip), %rdi      # 0x232a3
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1d23a(%rip)     # 0x33488
movl 0x1d22c(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d22c(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_new_strings
int rs_read_new_strings(int inf, char **s, int count)
{
    int len   = 0;
    int n     = 0;
    int value = 0;
    
    if (rs_read_int(inf,&value) != 0)
    {
        if (value != count)
        {
            printf("Incorrect number of new strings in block. %d > %d.",
                value,count);abort();
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }
        else
            for(n=0; n<value; n++)
            {
                rs_read_int(inf, &len);
            
                if (len == 0)
                    s[n]=0;
                else 
                {
                    s[n] = malloc(len);
                    rs_read(inf,s[n],len);
                }
            }
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
xorl %eax, %eax
movl %eax, (%rsp)
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
callq 0x15bb9
testl %eax, %eax
je 0x162e9
movl 0x4(%rsp), %esi
cmpl %r14d, %esi
jne 0x16309
testl %r14d, %r14d
jle 0x162e9
movl %r14d, %r12d
xorl %r13d, %r13d
movq %rsp, %r14
movl %ebp, %edi
movq %r14, %rsi
callq 0x15bb9
movslq (%rsp), %r15
testq %r15, %r15
je 0x162d9
movq %r15, %rdi
callq 0x6340
movq %rax, (%rbx,%r13,8)
movl %ebp, %edi
movq %rax, %rsi
movl %r15d, %edx
callq 0x15ade
jmp 0x162e1
movq $0x0, (%rbx,%r13,8)
incq %r13
cmpq %r13, %r12
jne 0x162ab
movl 0x1d191(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d191(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xcad5(%rip), %rdi      # 0x22de5
movl %r14d, %edx
xorl %eax, %eax
callq 0x61c0
callq 0x6090
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_window
int rs_write_window(FILE *savef, WINDOW *win)
{
    int row,col,height,width;
    width = getmaxx(win);
    height = getmaxy(win);

    rs_write_int(savef,RSID_WINDOW);
    rs_write_int(savef,height);
    rs_write_int(savef,width);
    
    for(row=0;row<height;row++)
        for(col=0;col<width;col++)
            rs_write_int(savef, mvwinch(win,row,col));
    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x163aa
movswl 0x6(%rbx), %ebp
incl %ebp
movswl 0x4(%rbx), %r15d
incl %r15d
jmp 0x163b5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %r14, %rdi
movl $0xabcd000d, %esi       # imm = 0xABCD000D
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
movq %r14, %rdi
movl %ebp, %esi
callq 0x156d6
testl %r15d, %r15d
jle 0x16422
xorl %r12d, %r12d
testl %ebp, %ebp
jle 0x1641a
xorl %r13d, %r13d
movq %rbx, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x16405
movq %rbx, %rdi
callq 0x6330
movl %eax, %esi
jmp 0x1640a
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x156d6
incl %r13d
cmpl %r13d, %ebp
jne 0x163e6
incl %r12d
cmpl %r15d, %r12d
jne 0x163df
xorl %eax, %eax
cmpl $0x0, 0x1d059(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_window
int rs_read_window(int inf, WINDOW *win)
{
    int id,row,col,maxlines,maxcols,value,width,height;
    
    width = getmaxx(win);
    height = getmaxy(win);

    if (rs_read_int(inf, &id) != 0)
    {
        if (id != RSID_WINDOW)
        {
            printf("Invalid head id. %x != %x(RSID_WINDOW)\n", id, RSID_WINDOW);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }   
        else
        {
            rs_read_int(inf,&maxlines);
            rs_read_int(inf,&maxcols);
            if (maxlines > height)
               abort();
            if (maxcols > width)
               abort();
               
            for(row=0;row<maxlines;row++)
                for(col=0;col<maxcols;col++)
                {
                    rs_read_int(inf, &value);
                    mvwaddch(win,row,col,value);
                }
        }
    }
        
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %ebp
testq %rsi, %rsi
je 0x16467
movswl 0x6(%rbx), %r15d
incl %r15d
movswl 0x4(%rbx), %r12d
incl %r12d
jmp 0x16473
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq 0x10(%rsp), %rsi
movl %ebp, %edi
callq 0x15bb9
testl %eax, %eax
je 0x1654f
movl 0x10(%rsp), %esi
cmpl $0xabcd000d, %esi       # imm = 0xABCD000D
jne 0x16524
leaq 0x14(%rsp), %r14
movl %ebp, %edi
movq %r14, %rsi
callq 0x15bb9
leaq 0xc(%rsp), %rsi
movl %ebp, %edi
callq 0x15bb9
movl (%r14), %eax
movl %eax, 0x4(%rsp)
cmpl %r12d, %eax
jg 0x1656f
movl 0xc(%rsp), %r13d
cmpl %r15d, %r13d
jg 0x1656f
cmpl $0x0, 0x4(%rsp)
jle 0x1654f
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
testl %r13d, %r13d
jle 0x16518
xorl %r12d, %r12d
movl %ebp, %edi
movq %r15, %rsi
callq 0x15bb9
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x16510
movl 0x8(%rsp), %esi
movq %rbx, %rdi
callq 0x64c0
incl %r12d
cmpl %r12d, %r13d
jne 0x164e7
incl %r14d
cmpl 0x4(%rsp), %r14d
jne 0x164df
jmp 0x1654f
leaq 0xc8ed(%rip), %rdi      # 0x22e18
movl $0xabcd000d, %edx       # imm = 0xABCD000D
xorl %eax, %eax
callq 0x61c0
leaq 0xcd65(%rip), %rdi      # 0x232a3
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1cf39(%rip)     # 0x33488
movl 0x1cf2b(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1cf2b(%rip), %ecx     # 0x33488
sete %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6090
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_room_reference
int rs_write_room_reference(FILE *savef, struct room *rp)
{
    int i, room = -1;
    
    for (i = 0; i < MAXROOMS; i++)
        if (&rooms[i] == rp)
            room = i;

    rs_write_int(savef, room);

    return(WRITESTAT);
}

// Assembly:
movq %rsi, %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x1700b(%rip), %rcx     # 0x2d8b0
xorl %edx, %edx
cmpq %rax, %rcx
cmovel %edx, %esi
incq %rdx
addq $0x68, %rcx
cmpq $0x9, %rdx
jne 0x168a7
pushq %rax
callq 0x156d6
xorl %eax, %eax
cmpl $0x0, 0x1cbbb(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_monlev
int rs_write_monlev(FILE *savef, struct monlev m)
{
    rs_write_int(savef, m.l_lev);
    rs_write_int(savef, m.h_lev);
    rs_write_boolean(savef, m.d_wand);

    return(WRITESTAT);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movq %rdi, %r14
movq %rsi, %r15
shrq $0x20, %r15
callq 0x156d6
movq %r14, %rdi
movl %r15d, %esi
callq 0x156d6
andb $0x1, %bl
leaq 0xf(%rsp), %rsi
movb %bl, (%rsi)
movq %r14, %rdi
movl $0x1, %edx
callq 0x15645
xorl %eax, %eax
cmpl $0x0, 0x1c710(%rip)     # 0x33484
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_read_monlev
int rs_read_monlev(int inf, struct monlev *m)
{
    rs_read_int(inf, &m->l_lev);
    rs_read_int(inf, &m->h_lev);
    rs_read_boolean(inf, &m->d_wand);

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movl %edi, %ebp
callq 0x15bb9
leaq 0x4(%rbx), %rsi
movl %ebp, %edi
callq 0x15bb9
leaq 0xf(%rsp), %r14
movl %ebp, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15ade
cmpb $0x0, (%r14)
setne 0x8(%rbx)
movl 0x1c6c0(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1c6c0(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ajpaulson[P]srogue11/state.c
// Function: rs_write_magic_items
int rs_write_magic_items(FILE *savef, struct magic_item *i, int count)
{
    int n;
    
    rs_write_int(savef, RSID_MAGICITEMS);
    rs_write_int(savef, count);

    for(n = 0; n < count; n++)
    {
        /* mi_name is constant, defined at compile time in all cases */
        rs_write_int(savef,i[n].mi_prob);
    }
    
    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl $0xabcd0004, %esi       # imm = 0xABCD0004
callq 0x156d6
movq %r14, %rdi
movl %ebp, %esi
callq 0x156d6
testl %ebp, %ebp
jle 0x16e1c
movl %ebp, %r15d
shlq $0x4, %r15
xorl %r12d, %r12d
movl 0x8(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x156d6
addq $0x10, %r12
cmpq %r12, %r15
jne 0x16e06
xorl %eax, %eax
cmpl $0x0, 0x1c65f(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq