LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_read_traps
int rs_read_traps(int inf, struct trap *trap, int count)
{
    int id = 0, value = 0, n = 0;

    if (rs_read_int(inf,&id) != 0)
    {
        if (id != RSID_TRAP)
        {
            printf("Invalid id. %x != %x(RSID_TRAP)\n",
                id,RSID_TRAP);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }
        else if (rs_read_int(inf,&value) != 0)
        {
            if (value > count)
            {
                printf("Incorrect number of traps in block. %d > %d.",
                    value,count);
                printf("Sorry, invalid save game format\n");
                format_error = TRUE;
            }
            else
            {
                for(n=0;n<value;n++)
                {   
                    rs_read_coord(inf,&trap[n].tr_pos);
                    rs_read_coord(inf,&trap[n].tr_goto);
                    rs_read_int(inf,&trap[n].tr_flags);
                    rs_read_char(inf,&trap[n].tr_type);
                }
            }
        }
        else
            format_error = TRUE;
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movl %edi, %ebp
xorl %eax, %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movl %eax, (%rsp)
callq 0x15d65
testl %eax, %eax
je 0x17ba0
movl 0x4(%rsp), %esi
cmpl $0xabcd000c, %esi       # imm = 0xABCD000C
jne 0x17b75
movq %rsp, %rsi
movl %ebp, %edi
callq 0x15d65
testl %eax, %eax
je 0x17b96
movl (%rsp), %r14d
cmpl %r15d, %r14d
jle 0x17bbc
leaq 0xb58b(%rip), %rdi      # 0x230e5
movl %r14d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x61c0
leaq 0xb6bd(%rip), %rdi      # 0x2322b
callq 0x60f0
jmp 0x17b96
leaq 0xb548(%rip), %rdi      # 0x230c4
movl $0xabcd000c, %edx       # imm = 0xABCD000C
xorl %eax, %eax
callq 0x61c0
leaq 0xb69c(%rip), %rdi      # 0x2322b
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1b8e8(%rip)     # 0x33488
movl 0x1b8da(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1b8da(%rip), %ecx     # 0x33488
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testl %r14d, %r14d
jle 0x17ba0
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15d65
leaq 0x4(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x8(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0xc(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x10(%rbx), %rsi
movl %ebp, %edi
callq 0x15d65
leaq 0x14(%rbx), %rsi
movl %ebp, %edi
movl $0x1, %edx
callq 0x15c8d
addq $0x18, %rbx
decq %r14
jne 0x17bc1
jmp 0x17ba0
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_write_monsters
int rs_write_monsters(FILE * savef, struct monster * m, int count)
{
    int n;
    
    rs_write_int(savef, RSID_MONSTERS);
    rs_write_int(savef, count);

    for(n=0;n<count;n++)
    {
        rs_write_monlev(savef, m[n].m_lev);
        rs_write_stats(savef, &m[n].m_stats);
    }
    
    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl $0xabcd000b, %esi       # imm = 0xABCD000B
callq 0x15842
movq %r14, %rdi
movl %ebp, %esi
callq 0x15842
testl %ebp, %ebp
jle 0x17c63
movl %ebp, %r15d
addq $0x20, %rbx
movq -0x14(%rbx), %rsi
movl -0xc(%rbx), %edx
movq %r14, %rdi
callq 0x16efd
movq %r14, %rdi
movq %rbx, %rsi
callq 0x17155
addq $0x70, %rbx
decq %r15
jne 0x17c40
xorl %eax, %eax
cmpl $0x0, 0x1b818(%rip)     # 0x33484
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_monsters
int rs_read_monsters(int inf, struct monster *m, int count)
{
    int id = 0, value = 0, n = 0;
    
    if (rs_read_int(inf, &id) != 0)
    {
        if (id != RSID_MONSTERS)
        {
            printf("Invalid id. %x != %x(RSID_MONSTERS)\n",
                id,RSID_MONSTERS);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }
        else if (rs_read_int(inf, &value) != 0)
        {
            for(n=0;n<value;n++)
            {
                rs_read_monlev(inf, &m[n].m_lev);
                rs_read_stats(inf, &m[n].m_stats);
            }
        }
        else
            format_error = TRUE;
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movl %edi, %ebp
xorl %eax, %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
movl %eax, 0x8(%rsp)
callq 0x15d65
testl %eax, %eax
je 0x17d12
movl 0xc(%rsp), %esi
cmpl $0xabcd000b, %esi       # imm = 0xABCD000B
jne 0x17ce7
leaq 0x8(%rsp), %rsi
movl %ebp, %edi
callq 0x15d65
testl %eax, %eax
je 0x17d08
movslq 0x8(%rsp), %r14
testq %r14, %r14
jle 0x17d12
addq $0x20, %rbx
leaq -0x14(%rbx), %rsi
movl %ebp, %edi
callq 0x16f4f
movl %ebp, %edi
movq %rbx, %rsi
callq 0x171fe
addq $0x70, %rbx
decq %r14
jne 0x17cc7
jmp 0x17d12
leaq 0xb424(%rip), %rdi      # 0x23112
movl $0xabcd000b, %edx       # imm = 0xABCD000B
xorl %eax, %eax
callq 0x61c0
leaq 0xb52a(%rip), %rdi      # 0x2322b
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1b776(%rip)     # 0x33488
movl 0x1b768(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1b768(%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: find_thing_coord
int find_thing_coord(struct linked_list *monlist, struct coord *c)
{
    struct linked_list *mitem;
    struct thing *tp;
    int i = 0;

    for(mitem = monlist; mitem != NULL; mitem = mitem->l_next)
    {
        tp = THINGPTR(mitem);
        if (c == &tp->t_pos)
            return(i);
        i++;
    }

    return(-1);
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x17d4f
xorl %ecx, %ecx
movq 0x10(%rdi), %rdx
addq $0x50, %rdx
cmpq %rsi, %rdx
je 0x17d50
incl %ecx
movq (%rdi), %rdi
testq %rdi, %rdi
jne 0x17d38
retq
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_fix_thing
void rs_fix_thing(struct thing *t)
{
    struct linked_list *item;
    struct thing *tp;

    if (t->t_reserved < 0)
        return;

    item = get_list_item(mlist,t->t_reserved);

    if (item != NULL)
    {
        tp = THINGPTR(item);
        t->t_dest = &tp->t_pos;
    }
}

// Assembly:
movsbl 0x90(%rdi), %ecx
testl %ecx, %ecx
js 0x17db8
leaq 0x15abb(%rip), %rax     # 0x2d840
movq (%rax), %rdx
testq %rdx, %rdx
je 0x17d9f
incl %ecx
xorl %eax, %eax
decl %ecx
je 0x17da3
movq (%rdx), %rdx
testq %rdx, %rdx
jne 0x17d91
jmp 0x17da7
xorl %eax, %eax
jmp 0x17da7
movq 0x10(%rdx), %rax
testq %rax, %rax
je 0x17db8
movq 0x10(%rax), %rax
addq $0x50, %rax
movq %rax, 0x60(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_write_monster_list
int rs_write_monster_list(FILE *savef, struct linked_list *l)
{
    int cnt = 0;
    
    rs_write_int(savef, RSID_MONSTERLIST);

    cnt = list_size(l);

    rs_write_int(savef, cnt);

    if (cnt < 1)
        return(WRITESTAT);

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

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0xabcd0009, %esi       # imm = 0xABCD0009
callq 0x15842
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x182b5
movq %rbx, %rax
cmpq $0x0, 0x10(%rax)
je 0x182b5
incl %ebp
movq (%rax), %rax
testq %rax, %rax
jne 0x182a4
movq %r14, %rdi
movl %ebp, %esi
callq 0x15842
testl %ebp, %ebp
setle %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x182e2
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x17ddf
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x182ce
xorl %eax, %eax
cmpl $0x0, 0x1b199(%rip)     # 0x33484
sete %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_read_monster_list
int rs_read_monster_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 (id != RSID_MONSTERLIST)
        {
            printf("Invalid id. %x != %x(RSID_MONSTERLIST)\n",
                id,RSID_MONSTERLIST);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }
        else if (rs_read_int(inf,&cnt) != 0)
        {
            for (i = 0; i < cnt; i++) 
            {
                l = new_item(sizeof(struct thing));
                l->l_prev = previous;
                if (previous != NULL)
                    previous->l_next = l;
                rs_read_thing(inf,(struct thing *)l->l_data);
                if (previous == NULL)
                    head = l;
                previous = l;
            }
        

            if (l != NULL)
                l->l_next = NULL;

            *list = head;
        }
    }
    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 0xc(%rsp), %rsi
callq 0x15d65
testl %eax, %eax
je 0x183a6
movl 0xc(%rsp), %esi
cmpl $0xabcd0009, %esi       # imm = 0xABCD0009
jne 0x18385
leaq 0x8(%rsp), %rsi
movl %ebp, %edi
callq 0x15d65
testl %eax, %eax
je 0x183cc
movq %rbx, 0x10(%rsp)
movl 0x8(%rsp), %r15d
testl %r15d, %r15d
jle 0x183b2
xorl %r13d, %r13d
xorl %r14d, %r14d
movl $0x98, %edi
callq 0xbeb3
movq %rax, %r12
movq %r14, 0x8(%rax)
movq %rax, %rbx
testq %r14, %r14
je 0x1836c
movq %r12, (%r14)
movq %r13, %rbx
movq 0x10(%r12), %rsi
movl %ebp, %edi
callq 0x1802d
movq %rbx, %r13
movq %r12, %r14
decl %r15d
jne 0x1834d
jmp 0x183b7
leaq 0xadcd(%rip), %rdi      # 0x23159
movl $0xabcd0009, %edx       # imm = 0xABCD0009
xorl %eax, %eax
callq 0x61c0
leaq 0xae8c(%rip), %rdi      # 0x2322b
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1b0d8(%rip)     # 0x33488
jmp 0x183cc
xorl %r12d, %r12d
xorl %ebx, %ebx
testq %r12, %r12
je 0x183c4
movq $0x0, (%r12)
movq 0x10(%rsp), %rax
movq %rbx, (%rax)
movl 0x1b0ae(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1b0ae(%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_reference
int rs_write_object_reference(FILE *savef, struct linked_list *list, struct object *item)
{
    int i;
    
    i = find_list_ptr(list, item);
    rs_write_int(savef, i);

    return(WRITESTAT);
}

// Assembly:
pushq %rax
movq %rsi, %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x18410
xorl %ecx, %ecx
cmpq %rdx, 0x10(%rax)
je 0x1840e
movq (%rax), %rax
incl %ecx
testq %rax, %rax
jne 0x183fc
jmp 0x18410
movl %ecx, %esi
callq 0x15842
xorl %eax, %eax
cmpl $0x0, 0x1b066(%rip)     # 0x33484
sete %al
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/state.c
// Function: rs_read_object_reference
int rs_read_object_reference(int inf, struct linked_list *list, struct object **item)
{
    int i;
    
    rs_read_int(inf, &i);
    *item = get_list_item(list,i);
            
    return(READSTAT);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x4(%rsp), %rsi
callq 0x15d65
testq %r14, %r14
je 0x18452
movl 0x4(%rsp), %ecx
incl %ecx
xorl %eax, %eax
decl %ecx
je 0x18456
movq (%r14), %r14
testq %r14, %r14
jne 0x18444
jmp 0x1845a
xorl %eax, %eax
jmp 0x1845a
movq 0x10(%r14), %rax
movq %rax, (%rbx)
movl 0x1b01d(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1b01d(%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_scrolls
int rs_read_scrolls(int inf)
{
    int i;

    for(i = 0; i < MAXSCROLLS; i++)
    {
        rs_read_new_string(inf,&s_names[i]);
        rs_read_boolean(inf,&s_know[i]);
        rs_read_new_string(inf,&s_guess[i]);
    }

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x17c36(%rip), %r14     # 0x300c0
leaq 0x1808f(%rip), %r15     # 0x30520
xorl %r13d, %r13d
leaq 0x17f45(%rip), %rbp     # 0x303e0
leaq 0x7(%rsp), %r12
movl %ebx, %edi
movq %r15, %rsi
callq 0x16298
movl %ebx, %edi
movq %r12, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, 0x7(%rsp)
setne (%rbp,%r13)
movl %ebx, %edi
movq %r14, %rsi
callq 0x16298
incq %r13
addq $0x8, %r14
addq $0x8, %r15
cmpq $0x1a, %r13
jne 0x184a0
movl 0x1af9b(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1af9b(%rip), %ecx     # 0x33488
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_scrolls
int rs_write_scrolls(FILE *savef)
{
    int i;

    for(i = 0; i < MAXSCROLLS; i++)
    {
        rs_write_string(savef,s_names[i]);
        rs_write_boolean(savef,s_know[i]);
        rs_write_string(savef,s_guess[i]);
    }
    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r15d, %r15d
leaq 0x18009(%rip), %r12     # 0x30520
leaq 0x17ec2(%rip), %r13     # 0x303e0
leaq 0x7(%rsp), %r14
leaq 0x17b96(%rip), %rbp     # 0x300c0
movq (%r12,%r15,8), %rsi
movq %rbx, %rdi
callq 0x15b8d
movb (%r13,%r15), %al
movb %al, 0x7(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x157b1
movq (%rbp,%r15,8), %rsi
movq %rbx, %rdi
callq 0x15b8d
incq %r15
cmpq $0x1a, %r15
jne 0x1852a
movl 0x1af15(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1af15(%rip), %ecx     # 0x33488
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_potions
int rs_read_potions(int inf)
{
    int i;

    for(i = 0; i < MAXPOTIONS; i++)
    {
        rs_read_string_index(inf,rainbow,NCOLORS,&p_colors[i]);
        rs_read_boolean(inf,&p_know[i]);
        rs_read_new_string(inf,&p_guess[i]);
    }

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x17bf7(%rip), %r14     # 0x30190
leaq 0x18050(%rip), %r15     # 0x305f0
xorl %ebp, %ebp
leaq 0x17e57(%rip), %r12     # 0x30400
leaq 0x7(%rsp), %r13
movl %ebx, %edi
leaq 0x14569(%rip), %rsi     # 0x2cb20
movl $0x20, %edx
movq %r15, %rcx
callq 0x16313
movl %ebx, %edi
movq %r13, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, 0x7(%rsp)
setne (%r12,%rbp)
movl %ebx, %edi
movq %r14, %rsi
callq 0x16298
incq %rbp
addq $0x8, %r14
addq $0x8, %r15
cmpq $0x15, %rbp
jne 0x185ae
movl 0x1ae82(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1ae82(%rip), %ecx     # 0x33488
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_potions
int rs_write_potions(FILE *savef)
{
    int i;

    for(i = 0; i < MAXPOTIONS; i++)
    {
        rs_write_string_index(savef,rainbow,NCOLORS,p_colors[i]);
        rs_write_boolean(savef,p_know[i]);
        rs_write_string(savef,p_guess[i]);
    }

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r12d, %r12d
leaq 0x144f0(%rip), %r14     # 0x2cb20
leaq 0x17dc9(%rip), %rbp     # 0x30400
leaq 0x7(%rsp), %r15
leaq 0x17b4d(%rip), %r13     # 0x30190
leaq 0x17fa6(%rip), %rax     # 0x305f0
movq (%rax,%r12,8), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x20, %edx
callq 0x15bdb
movb (%rbp,%r12), %al
movb %al, 0x7(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x157b1
movq (%r13,%r12,8), %rsi
movq %rbx, %rdi
callq 0x15b8d
incq %r12
cmpq $0x15, %r12
jne 0x18643
xorl %eax, %eax
cmpl $0x0, 0x1adee(%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_rings
int rs_read_rings(int inf)
{
    int i;

    for(i = 0; i < MAXRINGS; i++)
    {
        rs_read_string_index(inf,stones,NSTONES,&r_stones[i]);
        rs_read_boolean(inf,&r_know[i]);
        rs_read_new_string(inf,&r_guess[i]);
    }

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x17b84(%rip), %r14     # 0x30240
leaq 0x17fdd(%rip), %r15     # 0x306a0
xorl %ebp, %ebp
leaq 0x17d54(%rip), %r12     # 0x30420
leaq 0x7(%rsp), %r13
movl %ebx, %edi
leaq 0x14a46(%rip), %rsi     # 0x2d120
movl $0x23, %edx
movq %r15, %rcx
callq 0x16313
movl %ebx, %edi
movq %r13, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, 0x7(%rsp)
setne (%r12,%rbp)
movl %ebx, %edi
movq %r14, %rsi
callq 0x16298
incq %rbp
addq $0x8, %r14
addq $0x8, %r15
cmpq $0x1a, %rbp
jne 0x186d1
movl 0x1ad5f(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1ad5f(%rip), %ecx     # 0x33488
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_rings
int rs_write_rings(FILE *savef)
{
    int i;

    for(i = 0; i < MAXRINGS; i++)
    {
        rs_write_string_index(savef,stones,NSTONES,r_stones[i]);
        rs_write_boolean(savef,r_know[i]);
        rs_write_string(savef,r_guess[i]);
    }

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r12d, %r12d
leaq 0x149cd(%rip), %r14     # 0x2d120
leaq 0x17cc6(%rip), %rbp     # 0x30420
leaq 0x7(%rsp), %r15
leaq 0x17ada(%rip), %r13     # 0x30240
leaq 0x17f33(%rip), %rax     # 0x306a0
movq (%rax,%r12,8), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x23, %edx
callq 0x15bdb
movb (%rbp,%r12), %al
movb %al, 0x7(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x157b1
movq (%r13,%r12,8), %rsi
movq %rbx, %rdi
callq 0x15b8d
incq %r12
cmpq $0x1a, %r12
jne 0x18766
xorl %eax, %eax
cmpl $0x0, 0x1accb(%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_sticks
int rs_write_sticks(FILE *savef)
{
    int i;

    for (i = 0; i < MAXSTICKS; i++)
    {
        if (strcmp(ws_stuff[i].ws_type,"staff") == 0)
        {
            rs_write_int(savef,0);
            rs_write_string_index(savef, wood, NWOOD, ws_stuff[i].ws_made);
        }
        else
        {
            rs_write_int(savef,1);
            rs_write_string_index(savef, metal, NMETAL, ws_stuff[i].ws_made);
        }
        rs_write_int(savef, ws_stuff[i].ws_vol);
        rs_write_int(savef, ws_stuff[i].ws_wght);
        rs_write_boolean(savef, ws_know[i]);
        rs_write_string(savef, ws_guess[i]);
    }

    return(WRITESTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x17f90(%rip), %rbp     # 0x30770
addq $0x14, %rbp
xorl %r15d, %r15d
leaq 0x17c52(%rip), %r13     # 0x30440
leaq 0x7(%rsp), %r12
leaq 0x17b16(%rip), %r14     # 0x30310
movq -0x14(%rbp), %rdi
leaq 0x763a(%rip), %rsi      # 0x1fe3f
callq 0x6250
movq %rbx, %rdi
testl %eax, %eax
je 0x18830
movl $0x1, %esi
callq 0x15842
movq -0xc(%rbp), %rcx
movq %rbx, %rdi
leaq 0x14ad7(%rip), %rsi     # 0x2d300
movl $0xf, %edx
jmp 0x1884a
xorl %esi, %esi
callq 0x15842
movq -0xc(%rbp), %rcx
movq %rbx, %rdi
leaq 0x149fb(%rip), %rsi     # 0x2d240
movl $0x18, %edx
callq 0x15bdb
movl -0x4(%rbp), %esi
movq %rbx, %rdi
callq 0x15842
movl (%rbp), %esi
movq %rbx, %rdi
callq 0x15842
movb (%r13,%r15), %al
movb %al, 0x7(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x157b1
movq (%r14,%r15,8), %rsi
movq %rbx, %rdi
callq 0x15b8d
incq %r15
addq $0x18, %rbp
cmpq $0x1a, %r15
jne 0x187fa
xorl %eax, %eax
cmpl $0x0, 0x1abe0(%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_sticks
int rs_read_sticks(int inf)
{
    int i = 0, list = 0;

    for(i = 0; i < MAXSTICKS; i++)
    {
        rs_read_int(inf,&list);
        if (list == 0)
        {
            rs_read_string_index(inf,wood,NWOOD,&ws_stuff[i].ws_made);
            ws_stuff[i].ws_type = "staff";
        }
        else
        {
            rs_read_string_index(inf,metal,NMETAL,&ws_stuff[i].ws_made);
            ws_stuff[i].ws_type = "wand";
        }
        rs_read_int(inf, &ws_stuff[i].ws_vol);
        rs_read_int(inf, &ws_stuff[i].ws_wght);

        rs_read_boolean(inf, &ws_know[i]);
        rs_read_new_string(inf, &ws_guess[i]);
    }

    return(READSTAT);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x4(%rsp), %rax
movl $0x0, (%rax)
leaq 0x17a3b(%rip), %r15     # 0x30310
leaq 0x17b64(%rip), %r12     # 0x30440
xorl %ebp, %ebp
leaq 0x17e8b(%rip), %r14     # 0x30770
leaq 0x3(%rsp), %r13
movl %ebx, %edi
leaq 0x4(%rsp), %rsi
callq 0x15d65
cmpl $0x0, 0x4(%rsp)
leaq 0x8(%r14,%rbp), %rcx
movl %ebx, %edi
je 0x1891e
leaq 0x149f5(%rip), %rsi     # 0x2d300
movl $0xf, %edx
callq 0x16313
leaq 0x7921(%rip), %rax      # 0x2023d
jmp 0x18936
leaq 0x1491b(%rip), %rsi     # 0x2d240
movl $0x18, %edx
callq 0x16313
leaq 0x7509(%rip), %rax      # 0x1fe3f
leaq (%r14,%rbp), %rsi
addq $0x10, %rsi
movq %rax, -0x10(%rsi)
movl %ebx, %edi
callq 0x15d65
leaq (%r14,%rbp), %rsi
addq $0x14, %rsi
movl %ebx, %edi
callq 0x15d65
movl %ebx, %edi
movq %r13, %rsi
movl $0x1, %edx
callq 0x15c8d
cmpb $0x0, 0x3(%rsp)
setne (%r12)
movl %ebx, %edi
movq %r15, %rsi
callq 0x16298
addq $0x18, %rbp
addq $0x8, %r15
incq %r12
cmpq $0x270, %rbp            # imm = 0x270
jne 0x188ea
movl 0x1aae7(%rip), %ecx     # 0x33480
xorl %eax, %eax
orl 0x1aae7(%rip), %ecx     # 0x33488
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/sticks.c
// Function: fix_stick
void fix_stick(struct object *cur)
{
	struct rod *rd;

	cur->o_type = STICK;
	cur->o_charges = 4 + rnd(5);
	strcpy(cur->o_hurldmg, "1d1");
	rd = &ws_stuff[cur->o_which];
	cur->o_weight = rd->ws_wght;
	cur->o_vol = rd->ws_vol;
	if (strcmp(rd->ws_type, "staff") == 0) {
		strcpy(cur->o_damage, "2d3");
		cur->o_charges += rnd(5) + 3;
	}
	else {
		strcpy(cur->o_damage, "1d1");
	}
	switch (cur->o_which) {
		case WS_HIT:
			if(rnd(100) < 15) {
				cur->o_hplus = 9;
				cur->o_dplus = 9;
				strcpy(cur->o_damage,"3d8");
			}
			else {
				cur->o_hplus = 3;
				cur->o_dplus = 3;
				strcpy(cur->o_damage,"1d8");
			}
		when WS_LIGHT:
			cur->o_charges += 7 + rnd(9);
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x2f, 0x20(%rdi)
movl $0x5, %edi
xorl %eax, %eax
callq 0xc72d
addl $0x4, %eax
movl %eax, 0x34(%rbx)
movl $0x316431, 0x10(%rbx)   # imm = 0x316431
movslq 0x28(%rbx), %rax
leaq (%rax,%rax,2), %rax
leaq 0x170a5(%rip), %rcx     # 0x30770
movl 0x14(%rcx,%rax,8), %edx
movl %edx, 0x40(%rbx)
movl 0x10(%rcx,%rax,8), %edx
movl %edx, 0x44(%rbx)
movq (%rcx,%rax,8), %rdi
leaq 0x675b(%rip), %rsi      # 0x1fe3f
callq 0x6250
testl %eax, %eax
je 0x196f6
movl $0x316431, 0x8(%rbx)    # imm = 0x316431
jmp 0x19714
movl $0x336432, 0x8(%rbx)    # imm = 0x336432
movl $0x5, %edi
xorl %eax, %eax
callq 0xc72d
movl 0x34(%rbx), %ecx
addl %ecx, %eax
addl $0x3, %eax
movl %eax, 0x34(%rbx)
movl 0x28(%rbx), %eax
testl %eax, %eax
je 0x19748
cmpl $0x1, %eax
jne 0x19776
movl $0x64, %edi
xorl %eax, %eax
callq 0xc72d
cmpl $0xe, %eax
jg 0x19761
movabsq $0x900000009, %rax      # imm = 0x900000009
movq %rax, 0x2c(%rbx)
movl $0x386433, 0x8(%rbx)    # imm = 0x386433
jmp 0x19776
movl $0x9, %edi
xorl %eax, %eax
callq 0xc72d
movl 0x34(%rbx), %ecx
addl %ecx, %eax
addl $0x7, %eax
movl %eax, 0x34(%rbx)
jmp 0x19776
movabsq $0x300000003, %rax      # imm = 0x300000003
movq %rax, 0x2c(%rbx)
movl $0x386431, 0x8(%rbx)    # imm = 0x386431
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/sticks.c
// Function: drain
int drain(int ymin,int  ymax,int xmin,int xmax)
{
	int i, j, cnt;
	struct thing *ick;
	struct linked_list *item;

	/*
	 * First count how many things we need to spread the hit points among
	 */
	cnt = 0;
	for (i = ymin; i <= ymax; i++)
		for (j = xmin; j <= xmax; j++)
			if (isalpha(mvwinch(mw, i, j)))
				cnt++;
	if (cnt == 0) {
		msg("You have a tingling feeling.");
		return 0;
	}
	cnt = him->s_hpt / cnt;
	him->s_hpt /= 2;
	/*
	 * Now zot all of the monsters
	 */
	for (i = ymin; i <= ymax; i++) {
		for (j = xmin; j <= xmax; j++) {
			if(isalpha(mvwinch(mw, i, j))) {
				item = find_mons(i, j);
				if (item == NULL)
					continue;
				ick = THINGPTR(item);
				if ((ick->t_stats.s_hpt -= cnt) < 1)
					killed(item,cansee(i,j) && !(ick->t_flags & ISINVIS));
			}
		}
	}
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, 0x18(%rsp)
movl %edx, %ebp
xorl %ebx, %ebx
movl %esi, 0x8(%rsp)
movq %rdi, (%rsp)
cmpl %esi, %edi
movl %edx, 0xc(%rsp)
jg 0x1a93b
movq 0x18(%rsp), %rax
incl %eax
movl %eax, 0x24(%rsp)
xorl %ebx, %ebx
leaq 0x1612f(%rip), %rcx     # 0x309f0
movq (%rsp), %r12
movq %r12, 0x10(%rsp)
cmpl 0x18(%rsp), %ebp
jg 0x1a924
movq %rcx, %r14
callq 0x65b0
movq %r14, %rcx
movq %rax, %r13
movq (%r13), %r15
movq (%rcx), %rdi
movq 0x10(%rsp), %rsi
movl %ebp, %edx
movq %rcx, %r12
callq 0x6490
cmpl $-0x1, %eax
je 0x1a906
movq (%r12), %rdi
callq 0x6330
cltq
jmp 0x1a90d
movq $-0x1, %rax
movzwl (%r15,%rax,2), %eax
btl $0xa, %eax
adcl $0x0, %ebx
incl %ebp
cmpl %ebp, 0x24(%rsp)
movq %r14, %rcx
jne 0x1a8de
movq 0x10(%rsp), %rdx
leal 0x1(%rdx), %eax
cmpl 0x8(%rsp), %edx
movq %rax, 0x10(%rsp)
movl 0xc(%rsp), %ebp
jne 0x1a8ca
testl %ebx, %ebx
je 0x1aa38
leaq 0x13416(%rip), %rax     # 0x2dd60
movq (%rax), %rsi
movl 0x30(%rsi), %ecx
movl %ecx, %eax
cltd
idivl %ebx
movl %eax, 0x10(%rsp)
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
movl %eax, 0x30(%rsi)
movq (%rsp), %rax
cmpl 0x8(%rsp), %eax
jg 0x1aa46
movq 0x18(%rsp), %rax
leal 0x1(%rax), %ebx
leaq 0x1606e(%rip), %r12     # 0x309f0
cmpl 0x18(%rsp), %ebp
jg 0x1aa1d
callq 0x65b0
movq %rax, %r13
movl 0xc(%rsp), %ebp
movq (%r13), %r14
movq (%r12), %rdi
movq (%rsp), %rsi
movl %ebp, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x1a9bd
movq (%r12), %rdi
callq 0x6330
cltq
jmp 0x1a9c4
movq $-0x1, %rax
testb $0x4, 0x1(%r14,%rax,2)
je 0x1aa13
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x75c5
testq %rax, %rax
je 0x1aa13
movq %rax, %r14
movq 0x10(%rax), %r15
movl 0x10(%rsp), %eax
subl %eax, 0x30(%r15)
jg 0x1aa13
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x6fcc
testb %al, %al
je 0x1aa06
testb $0x10, 0x78(%r15)
sete %al
jmp 0x1aa08
xorl %eax, %eax
movzbl %al, %esi
movq %r14, %rdi
callq 0xa109
incl %ebp
cmpl %ebp, %ebx
jne 0x1a998
movq (%rsp), %rcx
leal 0x1(%rcx), %eax
cmpl 0x8(%rsp), %ecx
movq %rax, (%rsp)
movl 0xc(%rsp), %ebp
jne 0x1a982
jmp 0x1aa46
leaq 0x89af(%rip), %rdi      # 0x233ee
xorl %eax, %eax
callq 0xb6e0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/sticks.c
// Function: charge_str
char *charge_str(struct object *obj)
{
	static char buf[20];

	buf[0] = '\0';
	if (o_on(obj,ISKNOW) || o_on(obj,ISPOST))
		sprintf(buf, " [%d]", obj->o_charges);
	return buf;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb $0x0, 0x18a3e(%rip)     # 0x334a0
movl $0x2, %esi
callq 0x95b3
testb %al, %al
jne 0x1aa81
movl $0x4, %esi
movq %rbx, %rdi
callq 0x95b3
testb %al, %al
je 0x1aa99
movl 0x34(%rbx), %edx
leaq 0x18a15(%rip), %rdi     # 0x334a0
leaq 0x8979(%rip), %rsi      # 0x2340b
xorl %eax, %eax
callq 0x64f0
leaq 0x18a00(%rip), %rax     # 0x334a0
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/things.c
// Function: money
void money()
{
	struct room *rp;
	struct linked_list *item;
	struct thing *tp;

	rp = player.t_room;
	if (rp != NULL && ce(hero, rp->r_gold)) {
		msg("%d gold pieces.", rp->r_goldval);
		purse += rp->r_goldval;
		rp->r_goldval = 0;
		cmov(rp->r_gold);
		addch(FLOOR);
		/*
		 * once gold is taken, all monsters will chase him
		 */
		for (item = mlist; item != NULL; item = next(item)) {
			tp = THINGPTR(item);
			if (rnd(100) < 70 && tp->t_room == rp && !iswearing(R_STEALTH)
			  && ((tp->t_flags & (ISMEAN | ISGREED)) || rnd(1000) < 20))
				runto(&tp->t_pos, &hero);
		}
	}
	else
		msg("That gold must have been counterfeit.");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x12952(%rip), %rbx     # 0x2dc60
movq 0x70(%rbx), %r15
testq %r15, %r15
je 0x1b3f9
movl 0x50(%rbx), %eax
cmpl 0x10(%r15), %eax
jne 0x1b3f9
movl 0x54(%rbx), %eax
cmpl 0x14(%r15), %eax
jne 0x1b3f9
movl 0x58(%r15), %esi
leaq 0x81e5(%rip), %rdi      # 0x23525
xorl %eax, %eax
callq 0xb6e0
movl 0x58(%r15), %eax
leaq 0x1251a(%rip), %rcx     # 0x2d86c
addl %eax, (%rcx)
movl $0x0, 0x58(%r15)
movq 0xebcd(%rip), %r14      # 0x29f30
movq (%r14), %rdi
movl 0x10(%r15), %edx
movl 0x14(%r15), %esi
callq 0x6490
movq (%r14), %rdi
movl $0x2e, %esi
callq 0x64c0
leaq 0x124b9(%rip), %rax     # 0x2d840
movq (%rax), %r12
testq %r12, %r12
je 0x1b3ed
addq $0x50, %rbx
movq 0x10(%r12), %r14
movl $0x64, %edi
xorl %eax, %eax
callq 0xc72d
cmpl $0x45, %eax
jg 0x1b3e4
cmpq %r15, 0x70(%r14)
jne 0x1b3e4
movl $0xc, %edi
callq 0x12d9c
testb %al, %al
jne 0x1b3e4
testb $0x60, 0x78(%r14)
jne 0x1b3d5
movl $0x3e8, %edi            # imm = 0x3E8
xorl %eax, %eax
callq 0xc72d
cmpl $0x13, %eax
jg 0x1b3e4
addq $0x50, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7571
movq (%r12), %r12
testq %r12, %r12
jne 0x1b393
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x8135(%rip), %rdi      # 0x23535
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xb6e0
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/things.c
// Function: dropcheck
bool dropcheck(struct object *op)
{
	if (op == NULL)
		return TRUE;
	if (levtype == POSTLEV) {
		if (o_on(op,ISCURSED) && o_on(op,ISKNOW)) {
			msg("The trader does not accept shoddy merchandise.");
			return FALSE;
		}
		else {
			cur_null(op);	/* update cur_weapon, etc */
			return TRUE;
		}
	}
	if (op != cur_armor && op != cur_weapon
	  && op != cur_ring[LEFT] && op != cur_ring[RIGHT])
		return TRUE;
	if (o_on(op,ISCURSED)) {
		msg("You can't.  It appears to be cursed.");
		return FALSE;
	}
	if (op == cur_weapon)
		cur_weapon = NULL;
	else if (op == cur_armor) {
		waste_time();
		cur_armor = NULL;
	}
	else if (op == cur_ring[LEFT] || op == cur_ring[RIGHT])
		toss_ring(op);
	return TRUE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movb $0x1, %bl
testq %rdi, %rdi
je 0x1b6c6
movq %rdi, %r14
leaq 0x12224(%rip), %rax     # 0x2d864
cmpl $0x1, (%rax)
jne 0x1b670
movl $0x1, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b6be
movl $0x2, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b6be
leaq 0x7f6b(%rip), %rdi      # 0x235d9
jmp 0x1b6b3
leaq 0x121e1(%rip), %r15     # 0x2d858
leaq 0x121d2(%rip), %r12     # 0x2d850
cmpq %r14, (%r15)
je 0x1b69b
cmpq %r14, (%r12)
je 0x1b69b
leaq 0x126c0(%rip), %rax     # 0x2dd50
cmpq %r14, (%rax)
je 0x1b69b
cmpq %r14, 0x8(%rax)
jne 0x1b6c6
movl $0x1, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b6d4
leaq 0x7f55(%rip), %rdi      # 0x23608
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xb6e0
jmp 0x1b6c6
movq %r14, %rdi
callq 0x10d55
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpq %r14, (%r12)
je 0x1b6fb
cmpq %r14, (%r15)
je 0x1b705
leaq 0x1266a(%rip), %rax     # 0x2dd50
cmpq %r14, (%rax)
je 0x1b6f1
cmpq %r14, 0x8(%rax)
jne 0x1b6c6
movq %r14, %rdi
callq 0x128bc
jmp 0x1b6c6
movq $0x0, (%r12)
jmp 0x1b6c6
xorl %eax, %eax
callq 0xca74
movq $0x0, (%r15)
jmp 0x1b6c6
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/things.c
// Function: basic_init
void basic_init(struct object *cur)
{
	cur->o_ac = 11;
	cur->o_count = 1;
	cur->o_launch = 0;
	cur->o_typname = NULL;
	cur->o_group = newgrp();
	cur->o_weight = cur->o_vol = 0;
	cur->o_hplus = cur->o_dplus = 0;
	strcpy(cur->o_damage,"0d0");
	strcpy(cur->o_hurldmg,"0d0");
	cur->o_flags = cur->o_type = cur->o_which = 0;
}

// Assembly:
movl $0xb, 0x34(%rdi)
movl $0x1, 0x24(%rdi)
movb $0x0, 0x48(%rdi)
xorl %eax, %eax
movq %rax, 0x18(%rdi)
leaq 0xe8a8(%rip), %rcx      # 0x2a304
movl (%rcx), %edx
incl %edx
movl %edx, (%rcx)
movl %edx, 0x3c(%rdi)
movq %rax, 0x40(%rdi)
movl %eax, 0x30(%rdi)
movl $0x306430, %ecx         # imm = 0x306430
movl %ecx, 0x8(%rdi)
movl %ecx, 0x10(%rdi)
movq %rax, 0x28(%rdi)
movl %eax, 0x20(%rdi)
movl %eax, 0x38(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/things.c
// Function: pick_one
int pick_one(struct magic_item *mag)
{
	struct magic_item *start;
	int i;

	start = mag;
	for (i = rnd(1000); mag->mi_name != NULL; mag++) {
		if (i < mag->mi_prob)
			break;
		if (mag->mi_name == NULL) {
			if (author() || wizard) {
				for (mag = start; mag->mi_name != NULL; mag++)
					msg("%s: %d%%", mag->mi_name, mag->mi_prob);
			}
			mag = start;
		}
	}
	return mag - start;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x3e8, %edi            # imm = 0x3E8
xorl %eax, %eax
callq 0xc72d
cmpq $0x0, (%rbx)
movq %rbx, %rcx
je 0x1bab6
movq %rbx, %rdx
cmpl 0x8(%rdx), %eax
jl 0x1bab3
leaq 0x10(%rdx), %rcx
cmpq $0x0, 0x10(%rdx)
movq %rcx, %rdx
jne 0x1ba9e
jmp 0x1bab6
movq %rdx, %rcx
subq %rbx, %rcx
shrq $0x4, %rcx
movl %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/trader.c
// Function: price_it
bool price_it()
{
	static char *bargain[] = {
		"great bargain",
		"quality product",
		"exceptional find",
	};
	struct linked_list *item;
	struct object *obj;
	int worth;

	if (!open_market())		/* after buying hours */
		return FALSE;
	if ((item = find_obj(hero.y,hero.x)) == NULL)
		return FALSE;
	obj = OBJPTR(item);
	if (curprice == NOTPRICED) {
		worth = get_worth(obj);
		worth += 50 - rnd(100);
		if (worth < 25)
			worth = 25;
		worth *= 3;							/* slightly expensive */
		curprice = worth;					/* save price */
		strcpy(curpurch, obj->o_typname);	/* save item */
	}
	msg("That %s is a %s for only %d pieces of gold", curpurch,
	  bargain[rnd(3)], curprice);
	return TRUE;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
leaq 0x11bc3(%rip), %rax     # 0x2d868
cmpl $0x4, (%rax)
jge 0x1bd52
leaq 0x11fab(%rip), %rax     # 0x2dc60
movl 0x50(%rax), %esi
movl 0x54(%rax), %edi
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xd15e
testq %rax, %rax
je 0x1bd62
leaq 0xe620(%rip), %r14      # 0x2a2f4
cmpl $-0x1, (%r14)
jne 0x1bd1a
movq 0x10(%rax), %rbx
movq %rbx, %rdi
callq 0x1bd69
movl %eax, %ebp
movl $0x64, %edi
xorl %eax, %eax
callq 0xc72d
subl %eax, %ebp
addl $0x32, %ebp
cmpl $0x1a, %ebp
movl $0x19, %eax
cmovgel %ebp, %eax
leal (%rax,%rax,2), %eax
movl %eax, (%r14)
movq 0x18(%rbx), %rsi
leaq 0x12161(%rip), %rdi     # 0x2de76
callq 0x60e0
movl $0x3, %edi
xorl %eax, %eax
callq 0xc72d
cltq
leaq 0x7b35(%rip), %rcx      # 0x23864
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
movl (%r14), %ecx
leaq 0x79f7(%rip), %rdi      # 0x23737
leaq 0x1212f(%rip), %rsi     # 0x2de76
xorl %eax, %eax
callq 0xb6e0
movb $0x1, %bl
jmp 0x1bd62
leaq 0x7ab4(%rip), %rdi      # 0x2380d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xb6e0
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/weapons.c
// Function: do_motion
void do_motion(struct object *obj,int ydelta,int xdelta)
{
	int ch, y, x;

	obj->o_pos = hero;
	while (1) {
		y = obj->o_pos.y;
		x = obj->o_pos.x;
		if (!ce(obj->o_pos, hero) && cansee(unc(obj->o_pos)) &&
		  mvwinch(cw, y, x) != ' ')
			mvwaddch(cw, y, x, show(y, x));
		/*
		 * Get the new position
		 */
		obj->o_pos.y += ydelta;
		obj->o_pos.x += xdelta;
		y = obj->o_pos.y;
		x = obj->o_pos.x;
		ch = winat(y, x);
		if (step_ok(ch) && ch != DOOR) {
			if (cansee(unc(obj->o_pos)) && mvwinch(cw, y, x) != ' ') {
				mvwaddch(cw, y, x, obj->o_type);
				draw(cw);
			}
			continue;
		}
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, 0x4(%rsp)
movl %esi, %ebp
movq %rdi, %r14
leaq 0x112d1(%rip), %rax     # 0x2dc60
movq 0x50(%rax), %rax
movq %rax, (%rdi)
leaq 0x14043(%rip), %rbx     # 0x309e0
movl (%r14), %r15d
movl 0x4(%r14), %r12d
leaq 0x112b5(%rip), %rax     # 0x2dc60
cmpl 0x50(%rax), %r15d
jne 0x1c9be
leaq 0x112a8(%rip), %rax     # 0x2dc60
cmpl 0x54(%rax), %r12d
je 0x1ca19
movl %r12d, %edi
movl %r15d, %esi
callq 0x6fcc
testb %al, %al
je 0x1ca19
movq (%rbx), %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x1c9ed
movq (%rbx), %rdi
callq 0x6330
cmpl $0x20, %eax
je 0x1ca19
movq (%rbx), %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x1ca19
movq (%rbx), %r13
movl %r12d, %edi
movl %r15d, %esi
callq 0xe3c4
movsbl %al, %esi
movq %r13, %rdi
callq 0x64c0
movl 0x4(%r14), %r15d
addl %ebp, %r15d
movl %r15d, 0x4(%r14)
movl (%r14), %r12d
addl 0x4(%rsp), %r12d
movl %r12d, (%r14)
movl %r15d, %edi
movl %r12d, %esi
callq 0x9514
movl %eax, %r13d
movsbq %al, %rdi
callq 0xb995
testb %al, %al
je 0x1cab4
cmpb $0x2b, %r13b
je 0x1cab4
movl (%r14), %esi
movl 0x4(%r14), %edi
callq 0x6fcc
testb %al, %al
je 0x1c99d
movq (%rbx), %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x1ca88
movq (%rbx), %rdi
callq 0x6330
cmpl $0x20, %eax
je 0x1c99d
movq (%rbx), %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x1caa7
movq (%rbx), %rdi
movl 0x20(%r14), %esi
callq 0x64c0
movq (%rbx), %rdi
callq 0x6200
jmp 0x1c99d
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/weapons.c
// Function: fall
int fall(struct linked_list *item,bool pr)
{
	struct object *obj;
	struct room *rp;
	static struct coord fpos;

	obj = OBJPTR(item);
	if (fallpos(&obj->o_pos, &fpos, TRUE)) {
		mvaddch(fpos.y, fpos.x, obj->o_type);
		obj->o_pos = fpos;
		rp = player.t_room;
		if (rp != NULL && !rf_on(rp,ISDARK)) {
			light(&hero);
			mvwaddch(cw, hero.y, hero.x, PLAYER);
		}
		attach(lvl_obj, item);
		return 0;
	}

	if (pr) {
        if (obj->o_type == WEAPON) { /* BUGFIX: Identification trick */
            msg("Your %s vanishes as it hits the ground.", w_magic[obj->o_which].mi_name);
        } else {
            msg("%s vanishes as it hits the ground.", inv_name(obj,TRUE));
        }
  }

	discard(item);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movq 0x10(%rdi), %r14
leaq 0x169fc(%rip), %rsi     # 0x334e0
movq %r14, %rdi
movl $0x1, %edx
callq 0x1cbeb
testb %al, %al
je 0x1cb90
movq 0xd430(%rip), %r15      # 0x29f30
movq (%r15), %rdi
movl 0x169db(%rip), %esi     # 0x334e4
movl 0x169d1(%rip), %edx     # 0x334e0
callq 0x6490
cmpl $-0x1, %eax
je 0x1cb25
movq (%r15), %rdi
movl 0x20(%r14), %esi
callq 0x64c0
movq 0x169b4(%rip), %rax     # 0x334e0
movq %rax, (%r14)
leaq 0x1112a(%rip), %r14     # 0x2dc60
movq 0x70(%r14), %rdi
testq %rdi, %rdi
je 0x1cb7f
movl $0x1, %esi
callq 0x13e74
testl %eax, %eax
jne 0x1cb7f
leaq 0x50(%r14), %rdi
callq 0xecbc
leaq 0x13e83(%rip), %r15     # 0x309e0
movq (%r15), %rdi
movl 0x50(%r14), %edx
movl 0x54(%r14), %esi
callq 0x6490
cmpl $-0x1, %eax
je 0x1cb7f
movq (%r15), %rdi
movl $0x40, %esi
callq 0x64c0
leaq 0x10cc2(%rip), %rdi     # 0x2d848
movq %rbx, %rsi
callq 0xbe2d
jmp 0x1cbde
testb %bpl, %bpl
je 0x1cbd6
cmpl $0x29, 0x20(%r14)
jne 0x1cbb8
movslq 0x28(%r14), %rax
shlq $0x4, %rax
leaq 0xf3e5(%rip), %rcx      # 0x2bf90
movq (%rcx,%rax), %rsi
leaq 0x6cf7(%rip), %rdi      # 0x238ad
jmp 0x1cbcf
movq %r14, %rdi
movl $0x1, %esi
callq 0x1aaa4
leaq 0x6ce6(%rip), %rdi      # 0x238b2
movq %rax, %rsi
xorl %eax, %eax
callq 0xb6e0
movq %rbx, %rdi
callq 0xbe93
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/weapons.c
// Function: fallpos
bool fallpos(struct coord *pos,struct coord *newpos,bool passages)
{
	int y, x, ch;

	for (y = pos->y - 1; y <= pos->y + 1; y++) {
		for (x = pos->x - 1; x <= pos->x + 1; x++) {
			/*
			 * check to make certain the spot is empty, if it is,
			 * put the object there, set it in the level list
			 * and re-draw the room if he can see it
			 */
			if (y == hero.y && x == hero.x)
				continue;
			ch = winat(y, x);
			if (ch == FLOOR || (passages && ch == PASSAGE)) {
				newpos->y = y;
				newpos->x = x;
				return TRUE;
			}
		}
	}
	return FALSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, (%rsp)
movq %rdi, %r14
movl 0x4(%rdi), %r12d
decl %r12d
movb $0x1, %r15b
leaq 0x11050(%rip), %rbx     # 0x2dc60
movl (%r14), %r13d
decl %r13d
cmpl 0x54(%rbx), %r12d
jne 0x1cc22
cmpl 0x50(%rbx), %r13d
je 0x1cc3b
movl %r12d, %edi
movl %r13d, %esi
callq 0x9514
cmpb $0x23, %al
sete %cl
cmpb $0x2e, %al
je 0x1cc5b
andb %bpl, %cl
jne 0x1cc5b
leal 0x1(%r13), %eax
cmpl (%r14), %r13d
movl %eax, %r13d
jle 0x1cc16
leal 0x1(%r12), %eax
cmpl 0x4(%r14), %r12d
setle %r15b
movl %eax, %r12d
jle 0x1cc10
jmp 0x1cc66
movq (%rsp), %rax
movl %r12d, 0x4(%rax)
movl %r13d, (%rax)
andb $0x1, %r15b
movl %r15d, %eax
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/weapons.c
// Function: init_weapon
void init_weapon(struct object *weap,int type)
{
	struct init_weps *iwp;

	weap->o_type = WEAPON;
	weap->o_which = type;
	iwp = &weaps[type];
	strcpy(weap->o_damage,iwp->w_dam);
	strcpy(weap->o_hurldmg,iwp->w_hrl);
	weap->o_launch = iwp->w_launch;
	weap->o_flags = iwp->w_flags;
	weap->o_weight = iwp->w_wght;
	weap->o_typname = things[TYP_WEAPON].mi_name;
	if (o_on(weap,ISMANY))
		weap->o_count = rnd(8) + 8;
	else
		weap->o_count = 1;
	weap->o_group = newgrp();
	weap->o_vol = itemvol(weap);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x29, 0x20(%rdi)
movl %esi, 0x28(%rdi)
movslq %esi, %r14
shlq $0x5, %r14
leaq 0xf424(%rip), %r15      # 0x2c0c0
addq $0x8, %rdi
movq (%r15,%r14), %rsi
callq 0x60e0
leaq 0x10(%rbx), %rdi
movq 0x8(%r15,%r14), %rsi
callq 0x60e0
movb 0x1c(%r15,%r14), %al
movb %al, 0x48(%rbx)
movl 0x10(%r15,%r14), %eax
movl %eax, 0x38(%rbx)
movl 0x14(%r15,%r14), %eax
movl %eax, 0x40(%rbx)
leaq 0xf0fa(%rip), %rax      # 0x2bdd0
movq 0x30(%rax), %rax
movq %rax, 0x18(%rbx)
movl $0x4000, %esi           # imm = 0x4000
movq %rbx, %rdi
callq 0x95b3
movl %eax, %ecx
movl $0x1, %eax
testb %cl, %cl
je 0x1cd05
movl $0x8, %edi
xorl %eax, %eax
callq 0xc72d
addl $0x8, %eax
movl %eax, 0x24(%rbx)
leaq 0xd5f5(%rip), %rax      # 0x2a304
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movl %ecx, 0x3c(%rbx)
movq %rbx, %rdi
callq 0x9804
movl %eax, 0x44(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/weapons.c
// Function: num
char *num(int n1,int n2)
{
	static char numbuf[LINLEN];

	if (n1 == 0 && n2 == 0)
		return "+0";
	if (n2 == 0)
		sprintf(numbuf, "%s%d", n1 < 0 ? "" : "+", n1);
	else
		sprintf(numbuf,"%s%d,%s%d",n1<0 ? "":"+",n1,n2<0 ? "":"+",n2);  
	return numbuf;
}

// Assembly:
pushq %rbx
movl %esi, %eax
orl %edi, %eax
je 0x1cd6e
movl %esi, %r9d
movl %edi, %ecx
testl %edi, %edi
leaq 0x6bd3(%rip), %rax      # 0x23911
leaq 0x6b93(%rip), %r8       # 0x238d8
movq %r8, %rdx
cmovsq %rax, %rdx
testl %esi, %esi
je 0x1cd77
cmovsq %rax, %r8
leaq 0x16795(%rip), %rbx     # 0x334f0
leaq 0x6b78(%rip), %rsi      # 0x238da
movq %rbx, %rdi
xorl %eax, %eax
callq 0x64f0
jmp 0x1cd8f
leaq 0x6b60(%rip), %rbx      # 0x238d5
jmp 0x1cd8f
leaq 0x16772(%rip), %rbx     # 0x334f0
leaq 0x6b5a(%rip), %rsi      # 0x238df
movq %rbx, %rdi
xorl %eax, %eax
callq 0x64f0
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/weapons.c
// Function: wield
int wield()
{
	struct linked_list *item;
	struct object *obj, *oweapon;

	oweapon = cur_weapon;
	if (!dropcheck(cur_weapon)) {
		cur_weapon = oweapon;
		return 0;
	}
	cur_weapon = oweapon;
	if ((item = get_item("wield", WEAPON)) == NULL)
		return 0;
	obj = OBJPTR(item);
	if (is_current(obj)) {
		after = FALSE;
		return 0;
	}
	msg("Wielding %s", inv_name(obj, TRUE));
	cur_weapon = obj;
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x10ab1(%rip), %r14     # 0x2d850
movq (%r14), %rbx
movq %rbx, %rdi
callq 0x1b623
movq %rbx, (%r14)
testb %al, %al
je 0x1ce04
leaq 0x6b2c(%rip), %rdi      # 0x238e4
movl $0x29, %esi
callq 0x10881
testq %rax, %rax
je 0x1ce04
movq 0x10(%rax), %rbx
movq %rbx, %rdi
callq 0xd358
testb %al, %al
je 0x1cde3
leaq 0xd52f(%rip), %rax      # 0x2a30d
movb $0x0, (%rax)
jmp 0x1ce04
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1aaa4
leaq 0x6af3(%rip), %rdi      # 0x238ea
movq %rax, %rsi
xorl %eax, %eax
callq 0xb6e0
movq %rbx, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/wizard.c
// Function: whatis
int whatis(struct linked_list *what)
{
	struct object *obj;
	struct linked_list *item;
	int wh;

	if (what == NULL) {				/* we need to ask */
		if ((item = get_item("identify", 0)) == NULL)
			return 0;
	}
	else							/* no need to ask */
		item = what;
	obj = OBJPTR(item);
	setoflg(obj, ISKNOW);
	wh = obj->o_which;
	switch (obj->o_type) {
		case SCROLL:
			s_know[wh] = TRUE;
			if (s_guess[wh]) {
				free(s_guess[wh]);
				s_guess[wh] = NULL;
			}
	    when POTION:
			p_know[wh] = TRUE;
			if (p_guess[wh]) {
				free(p_guess[wh]);
				p_guess[wh] = NULL;
			}
		when STICK:
			ws_know[wh] = TRUE;
			if (ws_guess[wh]) {
				free(ws_guess[wh]);
			ws_guess[wh] = NULL;
			}
	    when RING:
			r_know[wh] = TRUE;
			if (r_guess[wh]) {
				free(r_guess[wh]);
				r_guess[wh] = NULL;
			}
	}
	if (what == NULL)
		msg(inv_name(obj, FALSE));
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rdi, %rax
testq %rdi, %rdi
jne 0x1ce37
leaq 0x3320(%rip), %rdi      # 0x20147
xorl %esi, %esi
callq 0x10881
testq %rax, %rax
je 0x1cee9
movq 0x10(%rax), %r14
movl $0x2, %esi
movq %r14, %rdi
callq 0x95d5
movslq 0x28(%r14), %rax
movl 0x20(%r14), %ecx
cmpl $0x3c, %ecx
jg 0x1ce73
cmpl $0x21, %ecx
je 0x1ce91
cmpl $0x2f, %ecx
jne 0x1ced0
leaq 0x135da(%rip), %rcx     # 0x30440
movb $0x1, (%rcx,%rax)
leaq 0x1349f(%rip), %rcx     # 0x30310
jmp 0x1ceb7
cmpl $0x3d, %ecx
je 0x1cea5
cmpl $0x3f, %ecx
jne 0x1ced0
leaq 0x1355c(%rip), %rcx     # 0x303e0
movb $0x1, (%rcx,%rax)
leaq 0x13231(%rip), %rcx     # 0x300c0
jmp 0x1ceb7
leaq 0x13568(%rip), %rcx     # 0x30400
movb $0x1, (%rcx,%rax)
leaq 0x132ed(%rip), %rcx     # 0x30190
jmp 0x1ceb7
leaq 0x13574(%rip), %rcx     # 0x30420
movb $0x1, (%rcx,%rax)
leaq 0x13389(%rip), %rcx     # 0x30240
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x1ced0
leaq (%rcx,%rax,8), %r15
callq 0x6050
movq $0x0, (%r15)
testq %rbx, %rbx
jne 0x1cee9
movq %r14, %rdi
xorl %esi, %esi
callq 0x1aaa4
movq %rax, %rdi
xorl %eax, %eax
callq 0xb6e0
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq