LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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, 0x1dc43(%rip)     # 0x33490
je 0x1586e
movzwl (%rsp), %eax
movzwl 0x2(%rsp), %ecx
rolw $0x8, %ax
leaq 0x4(%rsp), %rsi
movw %ax, 0x2(%rsi)
rolw $0x8, %cx
movw %cx, (%rsi)
jmp 0x15871
movq %rsp, %rsi
movl $0x4, %edx
callq 0x157b1
xorl %eax, %eax
cmpl $0x0, 0x1dc00(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15842
testl %ebp, %ebp
jle 0x158d2
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 0x157b1
incq %r13
cmpq %r13, %r12
jne 0x158b2
xorl %eax, %eax
cmpl $0x0, 0x1dba9(%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_O1/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, 0x1db72(%rip)     # 0x33490
je 0x15933
movzwl 0x4(%rsp), %eax
rolw $0x8, %ax
leaq 0x6(%rsp), %rsi
movw %ax, (%rsi)
jmp 0x15938
leaq 0x4(%rsp), %rsi
movl $0x2, %edx
callq 0x157b1
xorl %eax, %eax
cmpl $0x0, 0x1db39(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15842
testl %ebp, %ebp
jle 0x15986
movl %ebp, %r15d
xorl %r12d, %r12d
movswl (%rbx,%r12,2), %esi
movq %r14, %rdi
callq 0x15911
incq %r12
cmpq %r12, %r15
jne 0x15971
xorl %eax, %eax
cmpl $0x0, 0x1daf5(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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, 0x1dae8(%rip)     # 0x33490
je 0x159bd
movzwl 0x4(%rsp), %eax
rolw $0x8, %ax
leaq 0x6(%rsp), %rsi
movw %ax, (%rsi)
jmp 0x159c2
leaq 0x4(%rsp), %rsi
movl $0x2, %edx
callq 0x157b1
xorl %eax, %eax
cmpl $0x0, 0x1daaf(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15842
testl %ebp, %ebp
jle 0x15a0f
movl %ebp, %r15d
xorl %r12d, %r12d
movl (%rbx,%r12,4), %esi
movq %r14, %rdi
callq 0x15842
incq %r12
cmpq %r12, %r15
jne 0x159fb
xorl %eax, %eax
cmpl $0x0, 0x1da6c(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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, 0x1da61(%rip)     # 0x33490
je 0x15a50
movzwl (%rsp), %eax
movzwl 0x2(%rsp), %ecx
rolw $0x8, %ax
leaq 0x4(%rsp), %rsi
movw %ax, 0x2(%rsi)
rolw $0x8, %cx
movw %cx, (%rsi)
jmp 0x15a53
movq %rsp, %rsi
movl $0x4, %edx
callq 0x157b1
xorl %eax, %eax
cmpl $0x0, 0x1da1e(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15842
testl %ebp, %ebp
jle 0x15ae7
movl %ebp, %r15d
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
movq %r14, %rdi
callq 0x15a6b
incq %r12
cmpq %r12, %r15
jne 0x15ad3
xorl %eax, %eax
cmpl $0x0, 0x1d994(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15842
testl %ebp, %ebp
jle 0x15b78
movl %ebp, %r15d
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
movq %r14, %rdi
callq 0x15afc
incq %r12
cmpq %r12, %r15
jne 0x15b64
xorl %eax, %eax
cmpl $0x0, 0x1d903(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x15bad
movq %rbx, %rdi
callq 0x6170
movq %rax, %r15
incl %r15d
jmp 0x15bb0
xorl %r15d, %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x15842
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x157b1
xorl %eax, %eax
cmpl $0x0, 0x1d8b2(%rip)     # 0x33484
sete %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15842
testl %ebp, %ebp
jle 0x15c72
movl %ebp, %r12d
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rdi
movl $0x0, %r15d
testq %rdi, %rdi
je 0x15c50
callq 0x6170
movq %rax, %r15
incl %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x15842
movq (%rbx,%r13,8), %rsi
movq %r14, %rdi
movl %r15d, %edx
callq 0x157b1
incq %r13
cmpq %r13, %r12
jne 0x15c36
xorl %eax, %eax
cmpl $0x0, 0x1d809(%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_O1/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, 0x1d7f4(%rip)     # 0x3348c
movl 0x1d7ea(%rip), %eax     # 0x33488
orl 0x1d7dc(%rip), %eax     # 0x33480
jne 0x15cc6
movl %edx, %ebx
movl %edi, %edx
movq %rsi, %rdi
movl %ebx, %esi
callq 0x15700
testl %ebx, %ebx
je 0x15cc6
testl %eax, %eax
jne 0x15cc6
movl $0x1, 0x1d7c6(%rip)     # 0x3348c
cmpl $0x0, 0x1d7b3(%rip)     # 0x33480
jne 0x15cdf
cmpl $0x0, 0x1d7b2(%rip)     # 0x33488
jne 0x15ce8
movl $0x1, %eax
popq %rbx
retq
leaq 0xd4f9(%rip), %rdi      # 0x231df
jmp 0x15d04
movq 0x177e1(%rip), %rsi     # 0x2d4d0
leaq 0xcfbd(%rip), %rdi      # 0x22cb3
xorl %eax, %eax
callq 0x61c0
leaq 0xd4ad(%rip), %rdi      # 0x231b1
callq 0x60f0
callq 0x6090
// File: /workspace/github_c_makefile_star2_O1/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
movq %rsp, %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x15c8d
cmpl $0x0, 0x1d70d(%rip)     # 0x33490
je 0x15da4
movzwl (%rsp), %eax
movzwl 0x2(%rsp), %ecx
rolw $0x8, %ax
leaq 0x4(%rsp), %r14
movw %ax, 0x2(%r14)
rolw $0x8, %cx
movw %cx, (%r14)
movl (%r14), %eax
movl %eax, (%rbx)
movl 0x1d6d1(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d6d1(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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, %r15d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15d65
testl %eax, %eax
je 0x15e42
movl 0xc(%rsp), %r14d
cmpl %r15d, %r14d
jne 0x15e24
testl %r14d, %r14d
jle 0x15e42
xorl %r12d, %r12d
leaq 0xb(%rsp), %r15
movl %ebp, %edi
movq %r15, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, 0xb(%rsp)
setne (%rbx,%r12)
incq %r12
cmpq %r12, %r14
jne 0x15e01
jmp 0x15e42
leaq 0xce9b(%rip), %rdi      # 0x22cc6
movl %r14d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1d646(%rip)     # 0x33488
movl 0x1d638(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d638(%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_O1/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 0x15c8d
cmpl $0x0, 0x1d5d9(%rip)     # 0x33490
je 0x15ecb
movzwl 0x4(%rsp), %eax
rolw $0x8, %ax
leaq 0x6(%rsp), %r14
movw %ax, (%r14)
movzwl (%r14), %eax
movw %ax, (%rbx)
movl 0x1d5a8(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d5a8(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15d65
testl %eax, %eax
je 0x15f3c
movl 0x4(%rsp), %r15d
cmpl %r14d, %r15d
jne 0x15f32
testl %r15d, %r15d
jle 0x15f3c
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15e97
addq $0x2, %rbx
decq %r15
jne 0x15f1d
jmp 0x15f3c
movl $0x1, 0x1d54c(%rip)     # 0x33488
movl 0x1d53e(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d53e(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15c8d
cmpl $0x0, 0x1d518(%rip)     # 0x33490
je 0x15f8c
movzwl 0x4(%rsp), %eax
rolw $0x8, %ax
leaq 0x6(%rsp), %r14
movw %ax, (%r14)
movzwl (%r14), %eax
movw %ax, (%rbx)
movl 0x1d4e7(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d4e7(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15d65
testl %eax, %eax
je 0x15ffd
movl 0x4(%rsp), %r15d
cmpl %r14d, %r15d
jne 0x15ff3
testl %r15d, %r15d
jle 0x15ffd
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15d65
addq $0x4, %rbx
decq %r15
jne 0x15fde
jmp 0x15ffd
movl $0x1, 0x1d48b(%rip)     # 0x33488
movl 0x1d47d(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d47d(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movq %rsp, %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x15c8d
cmpl $0x0, 0x1d459(%rip)     # 0x33490
je 0x16058
movzwl (%rsp), %eax
movzwl 0x2(%rsp), %ecx
rolw $0x8, %ax
leaq 0x4(%rsp), %r14
movw %ax, 0x2(%r14)
rolw $0x8, %cx
movw %cx, (%r14)
movl (%r14), %eax
movl %eax, (%rbx)
movl 0x1d41d(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d41d(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x8(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x15c8d
cmpl $0x0, 0x1d3f7(%rip)     # 0x33490
je 0x160bb
movzwl 0x8(%rsp), %eax
movzwl 0xa(%rsp), %ecx
rolw $0x8, %ax
leaq 0x14(%rsp), %r14
movw %ax, 0x2(%r14)
rolw $0x8, %cx
movw %cx, (%r14)
movq (%r14), %rax
movq %rax, (%rbx)
movl 0x1d3b9(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d3b9(%rip), %ecx     # 0x33488
sete %al
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15d65
testl %eax, %eax
je 0x1612b
movl 0x4(%rsp), %r15d
cmpl %r14d, %r15d
jne 0x16121
testl %r15d, %r15d
jle 0x1612b
movl %ebp, %edi
movq %rbx, %rsi
callq 0x16076
addq $0x8, %rbx
decq %r15
jne 0x1610c
jmp 0x1612b
movl $0x1, 0x1d35d(%rip)     # 0x33488
movl 0x1d34f(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d34f(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x8(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x15c8d
cmpl $0x0, 0x1d326(%rip)     # 0x33490
je 0x1618c
movzwl 0x8(%rsp), %eax
movzwl 0xa(%rsp), %ecx
rolw $0x8, %ax
leaq 0x14(%rsp), %r14
movw %ax, 0x2(%r14)
rolw $0x8, %cx
movw %cx, (%r14)
movq (%r14), %rax
movq %rax, (%rbx)
movl 0x1d2e8(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d2e8(%rip), %ecx     # 0x33488
sete %al
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15d65
testl %eax, %eax
je 0x161fc
movl 0x4(%rsp), %r15d
cmpl %r14d, %r15d
jne 0x161f2
testl %r15d, %r15d
jle 0x161fc
movl %ebp, %edi
movq %rbx, %rsi
callq 0x16147
addq $0x8, %rbx
decq %r15
jne 0x161dd
jmp 0x161fc
movl $0x1, 0x1d28c(%rip)     # 0x33488
movl 0x1d27e(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d27e(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15d65
testl %eax, %eax
je 0x1627c
movl 0x4(%rsp), %r15d
cmpl %r14d, %r15d
jle 0x1626f
leaq 0xcaa6(%rip), %rdi      # 0x22cf2
movl %r15d, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x61c0
leaq 0xcfcb(%rip), %rdi      # 0x2322b
callq 0x60f0
movl $0x1, 0x1d219(%rip)     # 0x33488
movl %ebp, %edi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x15c8d
movl 0x1d1fe(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d1fe(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15d65
testl %eax, %eax
je 0x162f7
movslq 0x4(%rsp), %r14
testq %r14, %r14
je 0x162e4
movq %r14, %rdi
callq 0x6340
testq %rax, %rax
je 0x162ed
movq %rax, %r15
movl %ebp, %edi
movq %rax, %rsi
movl %r14d, %edx
callq 0x15c8d
movq %r15, (%rbx)
jmp 0x162f7
movq $0x0, (%rbx)
jmp 0x162f7
movl $0x1, 0x1d189(%rip)     # 0x33480
movl 0x1d183(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d183(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15d65
testl %eax, %eax
je 0x16375
movl 0xc(%rsp), %esi
cmpl %ebp, %esi
jle 0x16361
leaq 0xc9d7(%rip), %rdi      # 0x22d17
movl %ebp, %edx
xorl %eax, %eax
callq 0x61c0
leaq 0xcedb(%rip), %rdi      # 0x2322b
callq 0x60f0
movl $0x1, 0x1d129(%rip)     # 0x33488
jmp 0x16375
testl %esi, %esi
js 0x1636e
movq (%r14,%rsi,8), %rax
movq %rax, (%rbx)
jmp 0x16375
movq $0x0, (%rbx)
movl 0x1d105(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d105(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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, %r12d
movq %rsi, %r14
movl %edi, %ebp
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
callq 0x15d65
testl %eax, %eax
je 0x1640e
movl 0xc(%rsp), %r15d
cmpl %r12d, %r15d
jne 0x163e2
testl %r15d, %r15d
jle 0x1640e
xorl %r12d, %r12d
movq (%r14,%r12,8), %rsi
movl %ebp, %edi
movl %ebx, %edx
callq 0x16218
incq %r12
cmpq %r12, %r15
jne 0x163cb
jmp 0x1640e
leaq 0xc955(%rip), %rdi      # 0x22d3e
movl %r15d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x61c0
leaq 0xce2e(%rip), %rdi      # 0x2322b
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1d07a(%rip)     # 0x33488
movl 0x1d06c(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1d06c(%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_O1/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, %r15d
movq %rsi, %rbx
movl %edi, %ebp
xorl %eax, %eax
movl %eax, (%rsp)
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
callq 0x15d65
testl %eax, %eax
je 0x164a7
movl 0x4(%rsp), %r14d
cmpl %r15d, %r14d
jne 0x164c7
testl %r14d, %r14d
jle 0x164a7
xorl %r13d, %r13d
movq %rsp, %r15
movl %ebp, %edi
movq %r15, %rsi
callq 0x15d65
movslq (%rsp), %r12
testq %r12, %r12
je 0x16497
movq %r12, %rdi
callq 0x6340
movq %rax, (%rbx,%r13,8)
movl %ebp, %edi
movq %rax, %rsi
movl %r12d, %edx
callq 0x15c8d
jmp 0x1649f
movq $0x0, (%rbx,%r13,8)
incq %r13
cmpq %r13, %r14
jne 0x16469
movl 0x1cfd3(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1cfd3(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc89f(%rip), %rdi      # 0x22d6d
movl %r14d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x61c0
callq 0x6090
// File: /workspace/github_c_makefile_star2_O1/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
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x1656e
movswl 0x6(%rbx), %r15d
incl %r15d
testq %rbx, %rbx
je 0x16579
movswl 0x4(%rbx), %ebp
incl %ebp
movq %r14, %rdi
movl $0xabcd000d, %esi       # imm = 0xABCD000D
callq 0x15842
movq %r14, %rdi
movl %ebp, %esi
callq 0x15842
movq %r14, %rdi
movl %r15d, %esi
callq 0x15842
testl %ebp, %ebp
jle 0x165e6
xorl %r12d, %r12d
testl %r15d, %r15d
jle 0x165de
xorl %r13d, %r13d
movq %rbx, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x165c9
movq %rbx, %rdi
callq 0x6330
movl %eax, %esi
jmp 0x165ce
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x15842
incl %r13d
cmpl %r13d, %r15d
jne 0x165aa
incl %r12d
cmpl %ebp, %r12d
jne 0x165a2
xorl %eax, %eax
cmpl $0x0, 0x1ce95(%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_O1/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
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x1662d
movswl 0x6(%rbx), %r15d
incl %r15d
testq %rbx, %rbx
je 0x1663a
movswl 0x4(%rbx), %r12d
incl %r12d
leaq 0x10(%rsp), %rsi
movl %ebp, %edi
callq 0x15d65
testl %eax, %eax
je 0x16716
movl 0x10(%rsp), %esi
cmpl $0xabcd000d, %esi       # imm = 0xABCD000D
jne 0x166eb
leaq 0x14(%rsp), %r14
movl %ebp, %edi
movq %r14, %rsi
callq 0x15d65
leaq 0xc(%rsp), %rsi
movl %ebp, %edi
callq 0x15d65
movl (%r14), %eax
movl %eax, 0x4(%rsp)
cmpl %r12d, %eax
jg 0x16736
movl 0xc(%rsp), %r13d
cmpl %r15d, %r13d
jg 0x16736
cmpl $0x0, 0x4(%rsp)
jle 0x16716
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
testl %r13d, %r13d
jle 0x166df
xorl %r12d, %r12d
movl %ebp, %edi
movq %r15, %rsi
callq 0x15d65
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x166d7
movl 0x8(%rsp), %esi
movq %rbx, %rdi
callq 0x64c0
incl %r12d
cmpl %r12d, %r13d
jne 0x166ae
incl %r14d
cmpl 0x4(%rsp), %r14d
jne 0x166a6
jmp 0x16716
leaq 0xc6ae(%rip), %rdi      # 0x22da0
movl $0xabcd000d, %edx       # imm = 0xABCD000D
xorl %eax, %eax
callq 0x61c0
leaq 0xcb26(%rip), %rdi      # 0x2322b
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1cd72(%rip)     # 0x33488
movl 0x1cd64(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1cd64(%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_O1/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 0x16e3d(%rip), %rcx     # 0x2d8b0
xorl %edx, %edx
cmpq %rax, %rcx
cmovel %edx, %esi
incq %rdx
addq $0x68, %rcx
cmpq $0x9, %rdx
jne 0x16a75
pushq %rax
callq 0x15842
xorl %eax, %eax
cmpl $0x0, 0x1c9ed(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15842
movq %r14, %rdi
movl %r15d, %esi
callq 0x15842
andb $0x1, %bl
leaq 0xf(%rsp), %rsi
movb %bl, (%rsi)
movq %r14, %rdi
movl $0x1, %edx
callq 0x157b1
xorl %eax, %eax
cmpl $0x0, 0x1c542(%rip)     # 0x33484
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15d65
leaq 0x4(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0xf(%rsp), %r14
movl %ebp, %edi
movq %r14, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, (%r14)
setne 0x8(%rbx)
movl 0x1c4f2(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1c4f2(%rip), %ecx     # 0x33488
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15842
movq %r14, %rdi
movl %ebp, %esi
callq 0x15842
testl %ebp, %ebp
jle 0x16fea
movl %ebp, %r15d
shlq $0x4, %r15
xorl %r12d, %r12d
movl 0x8(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x15842
addq $0x10, %r12
cmpq %r12, %r15
jne 0x16fd4
xorl %eax, %eax
cmpl $0x0, 0x1c491(%rip)     # 0x33484
sete %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_read_magic_items
int rs_read_magic_items(int inf, struct magic_item *mi, int count)
{
    int id;
    int n;
    int value;

    if (rs_read_int(inf, &id) != 0)
    {
        if (id != RSID_MAGICITEMS)
        {
            printf("Invalid id. %x != %x(RSID_MAGICITEMS)\n",
                id, RSID_MAGICITEMS);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }   
        else if (rs_read_int(inf, &value) != 0)
        {
            if (value > count)
            {
                printf("Incorrect number of magic items in block. %d > %d.",
                    value, count);
                printf("Sorry, invalid save game format");
                format_error = TRUE;
            }
            else
            {
                for(n = 0; n < value; n++)
                {
                    rs_read_int(inf,&mi[n].mi_prob);
                }
            }
        }
    }
    
    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
callq 0x15d65
testl %eax, %eax
je 0x17079
movl 0x4(%rsp), %esi
cmpl $0xabcd0004, %esi       # imm = 0xABCD0004
jne 0x1704e
movq %rsp, %rsi
movl %ebp, %edi
callq 0x15d65
testl %eax, %eax
je 0x17079
movl (%rsp), %r15d
cmpl %r14d, %r15d
jle 0x17095
leaq 0xbe29(%rip), %rdi      # 0x22e6f
movl %r15d, %esi
movl %r14d, %edx
jmp 0x1705a
leaq 0xbdf3(%rip), %rdi      # 0x22e48
movl $0xabcd0004, %edx       # imm = 0xABCD0004
xorl %eax, %eax
callq 0x61c0
leaq 0xc1c3(%rip), %rdi      # 0x2322b
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1c40f(%rip)     # 0x33488
movl 0x1c401(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1c401(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testl %r15d, %r15d
jle 0x17079
addq $0x8, %rbx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15d65
addq $0x10, %rbx
decq %r15
jne 0x1709e
jmp 0x17079
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_write_real
int rs_write_real(FILE *savef, struct real r)
{
    rs_write_int(savef, r.a_str);
    rs_write_int(savef, r.a_dex);
    rs_write_int(savef, r.a_wis);
    rs_write_int(savef, r.a_con);

    return(WRITESTAT);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq %rsi, %r15
shrq $0x20, %r15
movq %rdx, %r12
shrq $0x20, %r12
callq 0x15842
movq %r14, %rdi
movl %r15d, %esi
callq 0x15842
movq %r14, %rdi
movl %ebx, %esi
callq 0x15842
movq %r14, %rdi
movl %r12d, %esi
callq 0x15842
xorl %eax, %eax
cmpl $0x0, 0x1c387(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_read_real
int rs_read_real(int inf, struct real *r)
{
    rs_read_int(inf,&r->a_str);
    rs_read_int(inf,&r->a_dex);
    rs_read_int(inf,&r->a_wis);
    rs_read_int(inf,&r->a_con);

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
callq 0x15d65
leaq 0x4(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x8(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
addq $0xc, %rbx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15d65
movl 0x1c33d(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1c33d(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_write_stats
int rs_write_stats(FILE *savef, struct stats *s)
{
    rs_write_int(savef, RSID_STATS);
    rs_write_real(savef, s->s_re);
    rs_write_real(savef, s->s_ef);
    rs_write_long(savef, s->s_exp);
    rs_write_int(savef, s->s_lvl);
    rs_write_int(savef, s->s_arm);
    rs_write_int(savef, s->s_hpt);
    rs_write_int(savef, s->s_maxhp);
    rs_write_int(savef, s->s_pack);
    rs_write_int(savef, s->s_carry);
    rs_write(savef, s->s_dmg, sizeof(s->s_dmg));

    return(WRITESTAT);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0xabcd0001, %esi       # imm = 0xABCD0001
callq 0x15842
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x170b3
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
movq %r14, %rdi
callq 0x170b3
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x15a6b
movl 0x28(%rbx), %esi
movq %r14, %rdi
callq 0x15842
movl 0x2c(%rbx), %esi
movq %r14, %rdi
callq 0x15842
movl 0x30(%rbx), %esi
movq %r14, %rdi
callq 0x15842
movl 0x34(%rbx), %esi
movq %r14, %rdi
callq 0x15842
movl 0x38(%rbx), %esi
movq %r14, %rdi
callq 0x15842
movl 0x3c(%rbx), %esi
movq %r14, %rdi
callq 0x15842
addq $0x40, %rbx
movq %r14, %rdi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x157b1
xorl %eax, %eax
cmpl $0x0, 0x1c291(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_read_stats
int rs_read_stats(int inf, struct stats *s)
{
    int id;

    rs_read_int(inf, &id);
    rs_read_real(inf, &s->s_re);
    rs_read_real(inf, &s->s_ef);

    rs_read_long(inf,&s->s_exp);
    rs_read_int(inf,&s->s_lvl);
    rs_read_int(inf,&s->s_arm);
    rs_read_int(inf,&s->s_hpt);
    rs_read_int(inf,&s->s_maxhp);
    rs_read_int(inf,&s->s_pack);
    rs_read_int(inf,&s->s_carry);

    rs_read(inf,s->s_dmg,sizeof(s->s_dmg));
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4(%rsp), %rsi
callq 0x15d65
movl %ebp, %edi
movq %rbx, %rsi
callq 0x1710c
leaq 0x10(%rbx), %rsi
movl %ebp, %edi
callq 0x1710c
leaq 0x20(%rbx), %rsi
movl %ebp, %edi
callq 0x16076
leaq 0x28(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x2c(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x30(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x34(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x38(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x3c(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
addq $0x40, %rbx
movl %ebp, %edi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x15c8d
movl 0x1c1f5(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1c1f5(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_write_monster_reference
int rs_write_monster_reference(FILE *savef, struct monster *m)
{
    int i, mon = -1;
    
    for (i = 0; i < (MAXMONS+1); i++)
        if (&monsters[i] == m)
            mon = i;

    rs_write_int(savef, mon);

    return(WRITESTAT);
}

// Assembly:
movq %rsi, %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x13114(%rip), %rcx     # 0x2a3c0
xorl %edx, %edx
cmpq %rax, %rcx
cmovel %edx, %esi
incq %rdx
addq $0x70, %rcx
cmpq $0x35, %rdx
jne 0x172ae
pushq %rax
callq 0x15842
xorl %eax, %eax
cmpl $0x0, 0x1c1b4(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_write_monster_references
int rs_write_monster_references(FILE *savef, struct monster *marray[], int count)
{
    int i;

    for(i = 0; i < count; i++)
        rs_write_monster_reference(savef, marray[i]);
    return(WRITESTAT);
}

// Assembly:
testl %edx, %edx
jle 0x17376
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %r15d
xorl %r12d, %r12d
leaq 0x13084(%rip), %r13     # 0x2a3c0
movq (%rbx,%r12,8), %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r13, %rcx
xorl %edx, %edx
cmpq %rax, %rcx
cmovel %edx, %esi
incq %rdx
addq $0x70, %rcx
cmpq $0x35, %rdx
jne 0x1734a
movq %r14, %rdi
callq 0x15842
incq %r12
cmpq %r15, %r12
jne 0x1733c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
xorl %eax, %eax
cmpl $0x0, 0x1c105(%rip)     # 0x33484
sete %al
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_read_monster_references
int rs_read_monster_references(int inf, struct monster *marray[], int count)
{
    int i;

    for(i = 0; i < count; i++)
        rs_read_monster_reference(inf, &marray[i]);
    return(READSTAT);
}

// Assembly:
testl %edx, %edx
jle 0x173e5
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
movl %edx, %r15d
xorl %r12d, %r12d
leaq 0x4(%rsp), %r14
leaq 0x13017(%rip), %r13     # 0x2a3c0
movl %ebp, %edi
movq %r14, %rsi
callq 0x15d65
movslq 0x4(%rsp), %rax
imulq $0x70, %rax, %rcx
addq %r13, %rcx
testq %rax, %rax
movl $0x0, %eax
cmovnsq %rcx, %rax
movq %rax, (%rbx,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x173a9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl 0x1c095(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1c095(%rip), %ecx     # 0x33488
sete %al
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_read_object_list
int rs_read_object_list(int inf, struct linked_list **list)
{
    int id;
    int i, cnt;
    struct linked_list *l = NULL, *previous = NULL, *head = NULL;

    if (rs_read_int(inf,&id) != 0)
    {
        if (rs_read_int(inf,&cnt) != 0)
        {
            for (i = 0; i < cnt; i++) 
            {
                l = new_item(sizeof(struct object));
                memset(l->l_data,0,sizeof(struct object));
                l->l_prev = previous;
                if (previous != NULL)
                    previous->l_next = l;
                rs_read_object(inf,(struct object *) l->l_data);
                if (previous == NULL)
                    head = l;
                previous = l;
            }
            
            if (l != NULL)
                l->l_next = NULL;
    
            *list = head;
        }
        else
            format_error = TRUE;
    }
    else
        format_error = TRUE;


    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x14(%rsp), %rsi
callq 0x15d65
testl %eax, %eax
je 0x179a4
leaq 0x4(%rsp), %rsi
movl %ebp, %edi
callq 0x15d65
testl %eax, %eax
je 0x179a4
movq %rbx, 0x8(%rsp)
movl 0x4(%rsp), %r15d
testl %r15d, %r15d
jle 0x179b0
xorl %r12d, %r12d
xorl %r14d, %r14d
movl $0x50, %edi
callq 0xbeb3
movq %rax, %r13
movq 0x10(%rax), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movq %r14, 0x8(%r13)
movq %r13, %rbx
testq %r14, %r14
je 0x1798c
movq %r13, (%r14)
movq %r12, %rbx
movq 0x10(%r13), %rsi
movl %ebp, %edi
callq 0x17743
movq %rbx, %r12
movq %r13, %r14
decl %r15d
jne 0x17953
jmp 0x179b5
movl $0x1, 0x1bada(%rip)     # 0x33488
jmp 0x179ca
xorl %r13d, %r13d
xorl %ebx, %ebx
testq %r13, %r13
je 0x179c2
movq $0x0, (%r13)
movq 0x8(%rsp), %rax
movq %rbx, (%rax)
movl 0x1bab0(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1bab0(%rip), %ecx     # 0x33488
sete %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_write_object_list
int rs_write_object_list(FILE *savef, struct linked_list *l)
{
    rs_write_int(savef, RSID_OBJECTLIST);
    rs_write_int(savef, list_size(l));

    while (l != NULL) 
    {
        rs_write_object(savef, (struct object *) l->l_data);
        l = l->l_next;
    }
    
    return(WRITESTAT);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0xabcd0007, %esi       # imm = 0xABCD0007
callq 0x15842
xorl %esi, %esi
testq %rbx, %rbx
je 0x17a19
movq %rbx, %rax
cmpq $0x0, 0x10(%rax)
je 0x17a19
incl %esi
movq (%rax), %rax
testq %rax, %rax
jne 0x17a08
movq %r14, %rdi
callq 0x15842
testq %rbx, %rbx
je 0x17a37
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x173f7
movq (%rbx), %rbx
jmp 0x17a21
xorl %eax, %eax
cmpl $0x0, 0x1ba44(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_write_traps
int rs_write_traps(FILE *savef, struct trap *trap,int count)
{
    int n;

    rs_write_int(savef, RSID_TRAP);
    rs_write_int(savef, count);
    
    for(n=0; n<count; n++)
    {
        rs_write_coord(savef, trap[n].tr_pos);
        rs_write_coord(savef, trap[n].tr_goto);
        rs_write_int(savef, trap[n].tr_flags);
        rs_write_char(savef, trap[n].tr_type);
    }
    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 $0xabcd000c, %esi       # imm = 0xABCD000C
callq 0x15842
movq %r14, %rdi
movl %ebp, %esi
callq 0x15842
testl %ebp, %ebp
jle 0x17af1
movl %ebp, %eax
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
xorl %ebp, %ebp
leaq 0x7(%rsp), %r15
movq (%rbx,%rbp), %rsi
movq %rsi, %r12
shrq $0x20, %r12
movq %r14, %rdi
callq 0x15842
movq %r14, %rdi
movl %r12d, %esi
callq 0x15842
movq 0x8(%rbx,%rbp), %rsi
movq %rsi, %r12
shrq $0x20, %r12
movq %r14, %rdi
callq 0x15842
movq %r14, %rdi
movl %r12d, %esi
callq 0x15842
movl 0x10(%rbx,%rbp), %esi
movq %r14, %rdi
callq 0x15842
movb 0x14(%rbx,%rbp), %al
movb %al, 0x7(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x157b1
addq $0x18, %rbp
cmpq %rbp, %r13
jne 0x17a87
xorl %eax, %eax
cmpl $0x0, 0x1b98a(%rip)     # 0x33484
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq