LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 0x14cb7
testl %eax, %eax
je 0x16529
leaq 0x4(%rsp), %rsi
movl %ebp, %edi
callq 0x14cb7
testl %eax, %eax
je 0x16529
movq %rbx, 0x8(%rsp)
movl 0x4(%rsp), %r12d
xorl %r13d, %r13d
testl %r12d, %r12d
cmovlel %r13d, %r12d
xorl %r14d, %r14d
subl $0x1, %r12d
jb 0x16537
pushq $0x50
popq %rdi
callq 0xb877
movq %rax, %r15
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 %r13, 0x8(%r15)
movq %r15, %rbx
testq %r13, %r13
je 0x16516
movq %r15, (%r13)
movq %r14, %rbx
movq 0x10(%r15), %rsi
movl %ebp, %edi
callq 0x162f1
movq %r15, %r13
movq %rbx, %r14
jmp 0x164d8
movl $0x1, 0x1cf45(%rip)     # 0x33478
xorl %eax, %eax
jmp 0x16553
testq %r13, %r13
je 0x16541
andq $0x0, (%r13)
movq 0x8(%rsp), %rax
movq %r14, (%rax)
cmpl $0x0, 0x1cf28(%rip)     # 0x33478
sete %al
cmpl $0x0, 0x1cf16(%rip)     # 0x33470
sete %cl
andb %al, %cl
movzbl %cl, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x14801
movq %rbx, %rdi
callq 0x14760
movq %r14, %rdi
movl %eax, %esi
callq 0x14801
testq %rbx, %rbx
je 0x165ad
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x15fed
movq (%rbx), %rbx
jmp 0x16597
xorl %eax, %eax
cmpl $0x0, 0x1cebe(%rip)     # 0x33474
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movl $0xabcd000c, %esi       # imm = 0xABCD000C
callq 0x14801
movq %r14, %rdi
movl %r15d, %esi
callq 0x14801
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
imulq $0x18, %r15, %r15
cmpq %r12, %r15
je 0x16634
movq (%rbx,%r12), %rsi
movq %r14, %rdi
callq 0x15389
movq 0x8(%rbx,%r12), %rsi
movq %r14, %rdi
callq 0x15389
movl 0x10(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x14801
movsbl 0x14(%rbx,%r12), %esi
movq %r14, %rdi
callq 0x147bd
addq $0x18, %r12
jmp 0x165f5
xorl %eax, %eax
cmpl $0x0, 0x1ce37(%rip)     # 0x33474
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %r14d
movq %rsi, %rbx
leaq 0xc(%rsp), %rsi
andl $0x0, (%rsi)
movl %edi, %ebp
andl $0x0, 0x8(%rsp)
callq 0x14cb7
testl %eax, %eax
je 0x166e1
movl 0xc(%rsp), %esi
cmpl $0xabcd000c, %esi       # imm = 0xABCD000C
jne 0x166b6
leaq 0x8(%rsp), %rsi
movl %ebp, %edi
callq 0x14cb7
testl %eax, %eax
je 0x166d7
movl 0x8(%rsp), %esi
cmpl %r14d, %esi
jle 0x166fb
leaq 0xaabf(%rip), %rdi      # 0x2115d
movl %r14d, %edx
xorl %eax, %eax
callq 0x61c0
leaq 0xabf4(%rip), %rdi      # 0x212a3
callq 0x60f0
jmp 0x166d7
leaq 0xaa7f(%rip), %rdi      # 0x2113c
movl $0xabcd000c, %edx       # imm = 0xABCD000C
xorl %eax, %eax
callq 0x61c0
leaq 0xabd3(%rip), %rdi      # 0x212a3
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1cd97(%rip)     # 0x33478
movl 0x1cd89(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1cd89(%rip), %ecx     # 0x33478
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
xorl %r14d, %r14d
testl %esi, %esi
cmovgl %esi, %r14d
subq $0x1, %r14
jb 0x166e1
movl %ebp, %edi
movq %rbx, %rsi
callq 0x153bb
leaq 0x8(%rbx), %rsi
movl %ebp, %edi
callq 0x153bb
leaq 0x10(%rbx), %rsi
movl %ebp, %edi
callq 0x14cb7
leaq 0x14(%rbx), %rsi
movl %ebp, %edi
callq 0x14c64
addq $0x18, %rbx
jmp 0x16704
// File: /workspace/github_c_makefile_star2_O2/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 0x14801
movq %r14, %rdi
movl %ebp, %esi
callq 0x14801
xorl %r15d, %r15d
testl %ebp, %ebp
cmovgl %ebp, %r15d
addq $0x20, %rbx
subq $0x1, %r15
jb 0x16791
movq -0x14(%rbx), %rsi
movl -0xc(%rbx), %edx
movq %r14, %rdi
callq 0x15b6d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x15da5
addq $0x70, %rbx
jmp 0x1676b
xorl %eax, %eax
cmpl $0x0, 0x1ccda(%rip)     # 0x33474
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
leaq 0xc(%rsp), %rsi
andl $0x0, (%rsi)
movl %edi, %ebp
andl $0x0, 0x8(%rsp)
callq 0x14cb7
testl %eax, %eax
je 0x16844
movl 0xc(%rsp), %esi
cmpl $0xabcd000b, %esi       # imm = 0xABCD000B
jne 0x16819
leaq 0x8(%rsp), %rsi
movl %ebp, %edi
callq 0x14cb7
testl %eax, %eax
je 0x1683a
movl 0x8(%rsp), %eax
xorl %r14d, %r14d
testl %eax, %eax
cmovgl %eax, %r14d
addq $0x20, %rbx
subq $0x1, %r14
jb 0x16844
leaq -0x14(%rbx), %rsi
movl %ebp, %edi
callq 0x15bad
movl %ebp, %edi
movq %rbx, %rsi
callq 0x15e4c
addq $0x70, %rbx
jmp 0x167f8
leaq 0xa96a(%rip), %rdi      # 0x2118a
movl $0xabcd000b, %edx       # imm = 0xABCD000B
xorl %eax, %eax
callq 0x61c0
leaq 0xaa70(%rip), %rdi      # 0x212a3
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1cc34(%rip)     # 0x33478
movl 0x1cc26(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1cc26(%rip), %ecx     # 0x33478
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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), %esi
testl %esi, %esi
js 0x168c9
pushq %rbx
movq %rdi, %rbx
leaq 0x16f81(%rip), %rax     # 0x2d830
movq (%rax), %rdi
callq 0x14730
testq %rax, %rax
je 0x168c8
movq 0x10(%rax), %rax
addq $0x50, %rax
movq %rax, 0x60(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/ajpaulson[P]srogue11/state.c
// Function: find_room_coord
int find_room_coord(struct room *rmlist, struct coord *c, int n)
{
    int i = 0;
    
    for(i=0; i < n; i++)
        if(&rmlist[i].r_gold == c)
            return(i);
    
    return(-1);
}

// Assembly:
xorl %ecx, %ecx
testl %edx, %edx
cmovlel %ecx, %edx
addq $0x10, %rdi
pushq $-0x1
popq %rax
cmpq %rcx, %rdx
je 0x168ed
cmpq %rsi, %rdi
je 0x168eb
incq %rcx
addq $0x68, %rdi
jmp 0x168d8
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x14801
movq %rbx, %rdi
callq 0x14760
movl %eax, %ebp
movq %r14, %rdi
movl %eax, %esi
callq 0x14801
testl %ebp, %ebp
jle 0x16cae
testq %rbx, %rbx
je 0x16cae
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x168ee
movq (%rbx), %rbx
jmp 0x16c98
xorl %eax, %eax
cmpl $0x0, 0x1c7bd(%rip)     # 0x33474
sete %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x14cb7
testl %eax, %eax
je 0x16d74
movl 0xc(%rsp), %esi
cmpl $0xabcd0009, %esi       # imm = 0xABCD0009
jne 0x16d53
leaq 0x8(%rsp), %rsi
movl %ebp, %edi
callq 0x14cb7
testl %eax, %eax
je 0x16d92
movq %rbx, 0x10(%rsp)
movl 0x8(%rsp), %r15d
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
xorl %ebx, %ebx
subl $0x1, %r15d
jb 0x16d80
movl $0x98, %edi
callq 0xb877
movq %rax, %r14
movq %r12, 0x8(%rax)
movq %rax, %r13
testq %r12, %r12
je 0x16d40
movq %r14, (%r12)
movq %rbx, %r13
movq 0x10(%r14), %rsi
movl %ebp, %edi
callq 0x16a84
movq %r14, %r12
movq %r13, %rbx
jmp 0x16d1a
leaq 0xa477(%rip), %rdi      # 0x211d1
movl $0xabcd0009, %edx       # imm = 0xABCD0009
xorl %eax, %eax
callq 0x61c0
leaq 0xa536(%rip), %rdi      # 0x212a3
xorl %eax, %eax
callq 0x61c0
movl $0x1, 0x1c6fa(%rip)     # 0x33478
jmp 0x16d92
testq %r12, %r12
je 0x16d8a
andq $0x0, (%r12)
movq 0x10(%rsp), %rax
movq %rbx, (%rax)
movl 0x1c6d8(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1c6d8(%rip), %ecx     # 0x33478
sete %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edi, %ebx
leaq 0x195a0(%rip), %r14     # 0x303d0
xorl %r15d, %r15d
leaq 0x196d6(%rip), %r12     # 0x30510
leaq 0x1926f(%rip), %r13     # 0x300b0
cmpq $0xd0, %r15
je 0x16e73
leaq (%r15,%r12), %rsi
movl %ebx, %edi
callq 0x15158
movl %ebx, %edi
movq %r14, %rsi
callq 0x14c80
leaq (%r15,%r13), %rsi
movl %ebx, %edi
callq 0x15158
addq $0x8, %r15
incq %r14
jmp 0x16e41
movl 0x1c5f7(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1c5f7(%rip), %ecx     # 0x33478
sete %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
leaq 0x1966c(%rip), %r15     # 0x30510
leaq 0x19525(%rip), %r12     # 0x303d0
leaq 0x191fe(%rip), %r13     # 0x300b0
cmpq $0x1a, %r14
je 0x16ee3
movq (%r15,%r14,8), %rsi
movq %rbx, %rdi
callq 0x14aed
movzbl (%r12,%r14), %esi
movq %rbx, %rdi
callq 0x147df
movq (%r13,%r14,8), %rsi
movq %rbx, %rdi
callq 0x14aed
incq %r14
jmp 0x16eb2
movl 0x1c587(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1c587(%rip), %ecx     # 0x33478
sete %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x194de(%rip), %r14     # 0x303f0
xorl %r12d, %r12d
leaq 0x15bf4(%rip), %r15     # 0x2cb10
pushq $0x20
popq %rbp
leaq 0x1925a(%rip), %r13     # 0x30180
cmpq $0xa8, %r12
je 0x16f64
leaq 0x196aa(%rip), %rax     # 0x305e0
leaq (%r12,%rax), %rcx
movl %ebx, %edi
movq %r15, %rsi
movl %ebp, %edx
callq 0x151cd
movl %ebx, %edi
movq %r14, %rsi
callq 0x14c80
leaq (%r12,%r13), %rsi
movl %ebx, %edi
callq 0x15158
addq $0x8, %r12
incq %r14
jmp 0x16f26
movl 0x1c506(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1c506(%rip), %ecx     # 0x33478
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15d, %r15d
leaq 0x15b74(%rip), %r14     # 0x2cb10
pushq $0x20
popq %rbp
leaq 0x1944a(%rip), %r13     # 0x303f0
leaq 0x191d3(%rip), %r12     # 0x30180
cmpq $0x15, %r15
je 0x16fea
leaq 0x19626(%rip), %rax     # 0x305e0
movq (%rax,%r15,8), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x14b3b
movzbl (%r13,%r15), %esi
movq %rbx, %rdi
callq 0x147df
movq (%r12,%r15,8), %rsi
movq %rbx, %rdi
callq 0x14aed
incq %r15
jmp 0x16fad
xorl %eax, %eax
cmpl $0x0, 0x1c481(%rip)     # 0x33474
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x193f7(%rip), %r14     # 0x30410
xorl %r12d, %r12d
leaq 0x160ed(%rip), %r15     # 0x2d110
pushq $0x23
popq %rbp
leaq 0x19203(%rip), %r13     # 0x30230
cmpq $0xd0, %r12
je 0x1706b
leaq 0x19653(%rip), %rax     # 0x30690
leaq (%r12,%rax), %rcx
movl %ebx, %edi
movq %r15, %rsi
movl %ebp, %edx
callq 0x151cd
movl %ebx, %edi
movq %r14, %rsi
callq 0x14c80
leaq (%r12,%r13), %rsi
movl %ebx, %edi
callq 0x15158
addq $0x8, %r12
incq %r14
jmp 0x1702d
movl 0x1c3ff(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1c3ff(%rip), %ecx     # 0x33478
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15d, %r15d
leaq 0x1606d(%rip), %r14     # 0x2d110
pushq $0x23
popq %rbp
leaq 0x19363(%rip), %r13     # 0x30410
leaq 0x1917c(%rip), %r12     # 0x30230
cmpq $0x1a, %r15
je 0x170f1
leaq 0x195cf(%rip), %rax     # 0x30690
movq (%rax,%r15,8), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x14b3b
movzbl (%r13,%r15), %esi
movq %rbx, %rdi
callq 0x147df
movq (%r12,%r15,8), %rsi
movq %rbx, %rdi
callq 0x14aed
incq %r15
jmp 0x170b4
xorl %eax, %eax
cmpl $0x0, 0x1c37a(%rip)     # 0x33474
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1963f(%rip), %rbp     # 0x30760
addq $0x14, %rbp
xorl %r12d, %r12d
leaq 0x6d10(%rip), %r14      # 0x1de3f
leaq 0x192fa(%rip), %r13     # 0x30430
leaq 0x191c3(%rip), %r15     # 0x30300
cmpq $0x1a, %r12
je 0x171cd
movq -0x14(%rbp), %rdi
movq %r14, %rsi
callq 0x6240
movq %rbx, %rdi
testl %eax, %eax
je 0x17174
pushq $0x1
popq %rsi
callq 0x14801
movq -0xc(%rbp), %rcx
movq %rbx, %rdi
leaq 0x16180(%rip), %rsi     # 0x2d2f0
pushq $0xf
jmp 0x1718b
xorl %esi, %esi
callq 0x14801
movq -0xc(%rbp), %rcx
movq %rbx, %rdi
leaq 0x160a7(%rip), %rsi     # 0x2d230
pushq $0x18
popq %rdx
callq 0x14b3b
movl -0x4(%rbp), %esi
movq %rbx, %rdi
callq 0x14801
movl (%rbp), %esi
movq %rbx, %rdi
callq 0x14801
movzbl (%r13,%r12), %esi
movq %rbx, %rdi
callq 0x147df
movq (%r15,%r12,8), %rsi
movq %rbx, %rdi
callq 0x14aed
incq %r12
addq $0x18, %rbp
jmp 0x1713d
xorl %eax, %eax
cmpl $0x0, 0x1c29e(%rip)     # 0x33474
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
leaq 0x4(%rsp), %rbx
andl $0x0, (%rbx)
movl %edi, %ebp
leaq 0x190fc(%rip), %r14     # 0x30300
leaq 0x19225(%rip), %r15     # 0x30430
xorl %r12d, %r12d
leaq 0x1954b(%rip), %r13     # 0x30760
cmpq $0x270, %r12            # imm = 0x270
je 0x172ae
movl %ebp, %edi
movq %rbx, %rsi
callq 0x14cb7
cmpl $0x0, 0x4(%rsp)
leaq 0x8(%r13,%r12), %rcx
movl %ebp, %edi
je 0x17252
leaq 0x160af(%rip), %rsi     # 0x2d2f0
pushq $0xf
popq %rdx
callq 0x151cd
leaq 0x6fed(%rip), %rax      # 0x1e23d
jmp 0x17268
leaq 0x15fd7(%rip), %rsi     # 0x2d230
pushq $0x18
popq %rdx
callq 0x151cd
leaq 0x6bd7(%rip), %rax      # 0x1de3f
leaq (%r12,%r13), %rsi
addq $0x10, %rsi
movq %rax, -0x10(%rsi)
movl %ebp, %edi
callq 0x14cb7
leaq (%r12,%r13), %rsi
addq $0x14, %rsi
movl %ebp, %edi
callq 0x14cb7
movl %ebp, %edi
movq %r15, %rsi
callq 0x14c80
movl %ebp, %edi
movq %r14, %rsi
callq 0x15158
addq $0x18, %r12
addq $0x8, %r14
incq %r15
jmp 0x17215
movl 0x1c1bc(%rip), %ecx     # 0x33470
xorl %eax, %eax
orl 0x1c1bc(%rip), %ecx     # 0x33478
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2f, 0x20(%rdi)
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0xc004
addl $0x4, %eax
movl %eax, 0x34(%rbx)
movl $0x316431, 0x10(%rbx)   # imm = 0x316431
movslq 0x28(%rbx), %r14
imulq $0x18, %r14, %rax
leaq 0x18a70(%rip), %rcx     # 0x30760
movq 0x10(%rcx,%rax), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x40(%rbx)
movq (%rcx,%rax), %rdi
leaq 0x6134(%rip), %rsi      # 0x1de3f
callq 0x6240
testl %eax, %eax
je 0x17d1d
movl $0x316431, 0x8(%rbx)    # imm = 0x316431
jmp 0x17d3d
movl $0x336432, 0x8(%rbx)    # imm = 0x336432
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0xc004
movl 0x28(%rbx), %r14d
movl 0x34(%rbx), %ecx
addl %ecx, %eax
addl $0x3, %eax
movl %eax, 0x34(%rbx)
testl %r14d, %r14d
je 0x17d6e
cmpl $0x1, %r14d
jne 0x17d9a
pushq $0x64
popq %rdi
xorl %eax, %eax
callq 0xc004
cmpl $0xe, %eax
jg 0x17d85
movabsq $0x900000009, %rax      # imm = 0x900000009
movq %rax, 0x2c(%rbx)
movl $0x386433, 0x8(%rbx)    # imm = 0x386433
jmp 0x17d9a
pushq $0x9
popq %rdi
xorl %eax, %eax
callq 0xc004
movl 0x34(%rbx), %ecx
addl %ecx, %eax
addl $0x7, %eax
movl %eax, 0x34(%rbx)
jmp 0x17d9a
movabsq $0x300000003, %rax      # imm = 0x300000003
movq %rax, 0x2c(%rbx)
movl $0x386431, 0x8(%rbx)    # imm = 0x386431
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 $0x18, %rsp
movl %ecx, %ebx
movl %edx, 0x8(%rsp)
movl %esi, 0xc(%rsp)
movl %edi, %r12d
xorl %ebp, %ebp
leaq 0x17ae2(%rip), %r14     # 0x309e0
movl %edi, 0x10(%rsp)
cmpl 0xc(%rsp), %r12d
jg 0x18f52
movl 0x8(%rsp), %r13d
cmpl %ebx, %r13d
jg 0x18f4d
callq 0x6590
movq (%rax), %r15
movq (%r14), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x6470
pushq $-0x1
popq %rcx
cmpl $-0x1, %eax
je 0x18f3c
movq (%r14), %rdi
callq 0x6320
movslq %eax, %rcx
movzwl (%r15,%rcx,2), %eax
btl $0xa, %eax
adcl $0x0, %ebp
incl %r13d
jmp 0x18f0e
incl %r12d
jmp 0x18f02
testl %ebp, %ebp
je 0x19023
leaq 0x14def(%rip), %rax     # 0x2dd50
movq (%rax), %rsi
movl 0x30(%rsi), %ecx
movl %ecx, %eax
cltd
idivl %ebp
movl %eax, 0x14(%rsp)
pushq $0x2
popq %rdi
movl %ecx, %eax
cltd
idivl %edi
movl %eax, 0x30(%rsi)
movl 0x10(%rsp), %ebp
cmpl 0xc(%rsp), %ebp
jg 0x19031
movl 0x8(%rsp), %r13d
cmpl %ebx, %r13d
jg 0x1901c
callq 0x6590
movq (%rax), %r15
movq (%r14), %rdi
movl %ebp, %r12d
movl %ebp, %esi
movl %r13d, %edx
callq 0x6470
pushq $-0x1
popq %rcx
cmpl $-0x1, %eax
je 0x18fc2
movq (%r14), %rdi
callq 0x6320
movslq %eax, %rcx
testb $0x4, 0x1(%r15,%rcx,2)
je 0x19011
movl %r12d, %edi
movl %r13d, %esi
callq 0x745e
testq %rax, %rax
je 0x19011
movq %rax, %rbp
movq 0x10(%rax), %r15
movl 0x14(%rsp), %eax
subl %eax, 0x30(%r15)
jg 0x19011
movl %r12d, %edi
movl %r13d, %esi
callq 0x6ec2
testb %al, %al
je 0x19004
testb $0x10, 0x78(%r15)
sete %al
jmp 0x19006
xorl %eax, %eax
movzbl %al, %esi
movq %rbp, %rdi
callq 0x9d41
incl %r13d
movl %r12d, %ebp
jmp 0x18f8e
incl %ebp
jmp 0x18f7f
leaq 0x843c(%rip), %rdi      # 0x21466
xorl %eax, %eax
callq 0xb178
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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, 0x1a443(%rip)     # 0x33490
pushq $0x2
popq %rsi
callq 0x934a
testb %al, %al
jne 0x19068
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x934a
testb %al, %al
je 0x19080
movl 0x34(%rbx), %edx
leaq 0x1a41e(%rip), %rdi     # 0x33490
leaq 0x840a(%rip), %rsi      # 0x21483
xorl %eax, %eax
callq 0x64d0
leaq 0x1a409(%rip), %rax     # 0x33490
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x143b9(%rip), %rbx     # 0x2dc50
movq 0x70(%rbx), %r12
testq %r12, %r12
je 0x19973
movl 0x50(%rbx), %eax
cmpl 0x10(%r12), %eax
jne 0x19973
movl 0x54(%rbx), %eax
cmpl 0x14(%r12), %eax
jne 0x19973
movl 0x58(%r12), %esi
leaq 0x7cd1(%rip), %rdi      # 0x2159d
xorl %eax, %eax
callq 0xb178
movl 0x58(%r12), %eax
leaq 0x13f7d(%rip), %rcx     # 0x2d85c
addl %eax, (%rcx)
andl $0x0, 0x58(%r12)
movq 0x1064a(%rip), %r14     # 0x29f38
movq (%r14), %rdi
movl 0x10(%r12), %edx
movl 0x14(%r12), %esi
callq 0x6470
movq (%r14), %rdi
pushq $0x2e
popq %rsi
callq 0x64a0
leaq 0x13f1e(%rip), %r13     # 0x2d830
pushq $0x64
popq %rbp
pushq $0xc
popq %r14
addq $0x50, %rbx
movq (%r13), %r13
testq %r13, %r13
je 0x1998f
movq 0x10(%r13), %r15
movl %ebp, %edi
xorl %eax, %eax
callq 0xc004
cmpl $0x45, %eax
jg 0x1991d
cmpq %r12, 0x70(%r15)
jne 0x1991d
movl %r14d, %edi
callq 0x11fa5
testb %al, %al
jne 0x1991d
testb $0x60, 0x78(%r15)
jne 0x19962
movl $0x3e8, %edi            # imm = 0x3E8
xorl %eax, %eax
callq 0xc004
cmpl $0x13, %eax
jg 0x1991d
addq $0x50, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7427
jmp 0x1991d
leaq 0x7c33(%rip), %rdi      # 0x215ad
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb178
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x19c46
movq %rdi, %r14
leaq 0x13c8e(%rip), %rax     # 0x2d854
cmpl $0x1, (%rax)
jne 0x19bf2
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x19c3e
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x19c3e
leaq 0x7a61(%rip), %rdi      # 0x21651
jmp 0x19c33
leaq 0x13c4f(%rip), %r15     # 0x2d848
leaq 0x13c40(%rip), %r12     # 0x2d840
cmpq %r14, (%r15)
je 0x19c1d
cmpq %r14, (%r12)
je 0x19c1d
leaq 0x1412e(%rip), %rax     # 0x2dd40
cmpq %r14, (%rax)
je 0x19c1d
cmpq %r14, 0x8(%rax)
jne 0x19c46
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x19c54
leaq 0x7a4d(%rip), %rdi      # 0x21680
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xb178
jmp 0x19c46
movq %r14, %rdi
callq 0x100da
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpq %r14, (%r12)
je 0x19c7b
cmpq %r14, (%r15)
je 0x19c82
leaq 0x140da(%rip), %rax     # 0x2dd40
cmpq %r14, (%rax)
je 0x19c71
cmpq %r14, 0x8(%rax)
jne 0x19c46
movq %r14, %rdi
callq 0x11ae1
jmp 0x19c46
andq $0x0, (%r12)
jmp 0x19c46
xorl %eax, %eax
callq 0xc284
andq $0x0, (%r15)
jmp 0x19c46
// File: /workspace/github_c_makefile_star2_O2/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)
andq $0x0, 0x18(%rdi)
leaq 0x103f5(%rip), %rax     # 0x2a2f4
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movl %ecx, 0x3c(%rdi)
andq $0x0, 0x40(%rdi)
andl $0x0, 0x30(%rdi)
movl $0x306430, %eax         # imm = 0x306430
movl %eax, 0x8(%rdi)
movl %eax, 0x10(%rdi)
andq $0x0, 0x28(%rdi)
andl $0x0, 0x20(%rdi)
andl $0x0, 0x38(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
movl $0x3e8, %edi            # imm = 0x3E8
xorl %eax, %eax
callq 0xc004
cmpq $0x0, (%rbx)
je 0x19f51
cmpl 0x8(%rbx), %eax
jl 0x19f51
addq $0x10, %rbx
incl %ebp
jmp 0x19f3e
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
callq 0x1a57e
testb %al, %al
je 0x1a1a7
leaq 0x13b40(%rip), %rax     # 0x2dc50
movl 0x50(%rax), %esi
movl 0x54(%rax), %edi
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xc996
testq %rax, %rax
je 0x1a1a9
leaq 0x101b5(%rip), %r14     # 0x2a2e4
cmpl $-0x1, (%r14)
jne 0x1a171
movq 0x10(%rax), %rbx
movq %rbx, %rdi
callq 0x1a1b0
movl %eax, %ebp
pushq $0x64
popq %rdi
xorl %eax, %eax
callq 0xc004
subl %eax, %ebp
addl $0x32, %ebp
cmpl $0x1a, %ebp
pushq $0x19
popq %rax
cmovgel %ebp, %eax
leal (%rax,%rax,2), %eax
movl %eax, (%r14)
movq 0x18(%rbx), %rsi
leaq 0x13cfa(%rip), %rdi     # 0x2de66
callq 0x60e0
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0xc004
cltq
leaq 0x7758(%rip), %rcx      # 0x218dc
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
movl (%r14), %ecx
leaq 0x761a(%rip), %rdi      # 0x217af
leaq 0x13cca(%rip), %rsi     # 0x2de66
xorl %eax, %eax
callq 0xb178
movb $0x1, %bl
jmp 0x1a1a9
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x12f28(%rip), %rax     # 0x2dc50
movq 0x50(%rax), %r15
movq %r15, (%rdi)
movq %r15, %r12
shrq $0x20, %r12
leaq 0x15c93(%rip), %rbx     # 0x309d0
leaq 0x12f0c(%rip), %rax     # 0x2dc50
cmpl 0x50(%rax), %r15d
jne 0x1ad57
leaq 0x12eff(%rip), %rax     # 0x2dc50
cmpl 0x54(%rax), %r12d
je 0x1adb2
movl %r12d, %edi
movl %r15d, %esi
callq 0x6ec2
testb %al, %al
je 0x1adb2
movq (%rbx), %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x6470
cmpl $-0x1, %eax
je 0x1ad86
movq (%rbx), %rdi
callq 0x6320
cmpl $0x20, %eax
je 0x1adb2
movq (%rbx), %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x6470
cmpl $-0x1, %eax
je 0x1adb2
movq (%rbx), %r13
movl %r12d, %edi
movl %r15d, %esi
callq 0xdabc
movsbl %al, %esi
movq %r13, %rdi
callq 0x64a0
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 0x92ab
movl %eax, %r13d
movsbq %al, %rdi
callq 0xb3d0
testb %al, %al
je 0x1ae4c
cmpb $0x2b, %r13b
je 0x1ae4c
movl (%r14), %esi
movl 0x4(%r14), %edi
callq 0x6ec2
testb %al, %al
je 0x1ae40
movq (%rbx), %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x6470
cmpl $-0x1, %eax
je 0x1ae19
movq (%rbx), %rdi
callq 0x6320
cmpl $0x20, %eax
je 0x1ae40
movq (%rbx), %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x6470
cmpl $-0x1, %eax
je 0x1ae38
movq (%rbx), %rdi
movl 0x20(%r14), %esi
callq 0x64a0
movq (%rbx), %rdi
callq 0x6200
movl (%r14), %r15d
movl 0x4(%r14), %r12d
jmp 0x1ad3d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x18656(%rip), %rsi     # 0x334d0
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x1af79
testb %al, %al
je 0x1af20
movq 0xf0a4(%rip), %r15      # 0x29f38
movq (%r15), %rdi
movl 0x18637(%rip), %esi     # 0x334d4
movl 0x1862d(%rip), %edx     # 0x334d0
callq 0x6470
cmpl $-0x1, %eax
je 0x1aeb9
movq (%r15), %rdi
movl 0x20(%r14), %esi
callq 0x64a0
movq 0x18610(%rip), %rax     # 0x334d0
movq %rax, (%r14)
leaq 0x12d86(%rip), %r14     # 0x2dc50
movq 0x70(%r14), %rdi
testq %rdi, %rdi
je 0x1af0f
pushq $0x1
popq %rsi
callq 0x12f50
testl %eax, %eax
jne 0x1af0f
leaq 0x50(%r14), %rdi
callq 0xe29f
leaq 0x15ae1(%rip), %r15     # 0x309d0
movq (%r15), %rdi
movl 0x50(%r14), %edx
movl 0x54(%r14), %esi
callq 0x6470
cmpl $-0x1, %eax
je 0x1af0f
movq (%r15), %rdi
pushq $0x40
popq %rsi
callq 0x64a0
leaq 0x12922(%rip), %rdi     # 0x2d838
movq %rbx, %rsi
callq 0xb81b
jmp 0x1af6c
testb %bpl, %bpl
je 0x1af64
cmpl $0x29, 0x20(%r14)
jne 0x1af48
movslq 0x28(%r14), %rax
shlq $0x4, %rax
leaq 0x11045(%rip), %rcx     # 0x2bf80
movq (%rcx,%rax), %rsi
leaq 0x69df(%rip), %rdi      # 0x21925
jmp 0x1af5d
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x1908c
leaq 0x69d0(%rip), %rdi      # 0x2192a
movq %rax, %rsi
xorl %eax, %eax
callq 0xb178
movq %rbx, %rdi
callq 0xb857
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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, %r15
movl 0x4(%rdi), %r13d
leal -0x1(%r13), %r14d
leaq 0x12cb4(%rip), %rbx     # 0x2dc50
incl %r13d
cmpl %r13d, %r14d
jg 0x1aff4
movl (%r15), %eax
leal -0x1(%rax), %r12d
leal 0x1(%rax), %ecx
cmpl %ecx, %r12d
jg 0x1afe0
cmpl 0x54(%rbx), %r14d
jne 0x1afbf
cmpl 0x50(%rbx), %r12d
je 0x1afdb
movl %r14d, %edi
movl %r12d, %esi
callq 0x92ab
cmpb $0x23, %al
sete %cl
cmpb $0x2e, %al
je 0x1afe9
andb %bpl, %cl
jne 0x1afe9
movl (%r15), %eax
incl %r12d
jmp 0x1afab
incl %r14d
movl 0x4(%r15), %r13d
jmp 0x1af9c
movq (%rsp), %rax
movl %r14d, 0x4(%rax)
movl %r12d, (%rax)
cmpl %r13d, %r14d
setle %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x11087(%rip), %r15     # 0x2c0b0
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 0x10d5d(%rip), %rax     # 0x2bdc0
movq 0x30(%rax), %rax
movq %rax, 0x18(%rbx)
movl $0x4000, %esi           # imm = 0x4000
movq %rbx, %rdi
callq 0x934a
testb %al, %al
je 0x1b08b
pushq $0x8
popq %rdi
xorl %eax, %eax
callq 0xc004
addl $0x8, %eax
jmp 0x1b08e
pushq $0x1
popq %rax
movl %eax, 0x24(%rbx)
leaq 0xf25c(%rip), %rax      # 0x2a2f4
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movl %ecx, 0x3c(%rbx)
movq %rbx, %rdi
callq 0x953d
movl %eax, 0x44(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1b0f7
movl %esi, %r9d
movl %edi, %ecx
testl %edi, %edi
leaq 0x68c2(%rip), %rax      # 0x21989
leaq 0x6882(%rip), %r8       # 0x21950
movq %r8, %rdx
cmovsq %rax, %rdx
testl %esi, %esi
je 0x1b100
cmovsq %rax, %r8
leaq 0x183fc(%rip), %rbx     # 0x334e0
leaq 0x6867(%rip), %rsi      # 0x21952
movq %rbx, %rdi
xorl %eax, %eax
callq 0x64d0
jmp 0x1b118
leaq 0x684f(%rip), %rbx      # 0x2194d
jmp 0x1b118
leaq 0x183d9(%rip), %rbx     # 0x334e0
leaq 0x6849(%rip), %rsi      # 0x21957
movq %rbx, %rdi
xorl %eax, %eax
callq 0x64d0
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x12718(%rip), %r14     # 0x2d840
movq (%r14), %rbx
movq %rbx, %rdi
callq 0x19ba9
movq %rbx, (%r14)
testb %al, %al
je 0x1b189
leaq 0x681b(%rip), %rdi      # 0x2195c
pushq $0x29
popq %rsi
callq 0xfd08
testq %rax, %rax
je 0x1b189
movq 0x10(%rax), %rbx
movq %rbx, %rdi
callq 0xcb75
testb %al, %al
je 0x1b16a
leaq 0xf198(%rip), %rax      # 0x2a2fd
movb $0x0, (%rax)
jmp 0x1b189
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1908c
leaq 0x67e6(%rip), %rdi      # 0x21962
movq %rax, %rsi
xorl %eax, %eax
callq 0xb178
movq %rbx, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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 0x1b1bb
leaq 0x2f9c(%rip), %rdi      # 0x1e147
xorl %esi, %esi
callq 0xfd08
testq %rax, %rax
je 0x1b263
movq 0x10(%rax), %r14
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x936c
movslq 0x28(%r14), %rax
movl 0x20(%r14), %ecx
cmpl $0x21, %ecx
je 0x1b222
cmpl $0x2f, %ecx
je 0x1b1fa
cmpl $0x3d, %ecx
je 0x1b20e
cmpl $0x3f, %ecx
jne 0x1b24a
leaq 0x151e3(%rip), %rcx     # 0x303d0
movb $0x1, (%rcx,%rax)
leaq 0x14eb8(%rip), %rcx     # 0x300b0
jmp 0x1b234
leaq 0x1522f(%rip), %rcx     # 0x30430
movb $0x1, (%rcx,%rax)
leaq 0x150f4(%rip), %rcx     # 0x30300
jmp 0x1b234
leaq 0x151fb(%rip), %rcx     # 0x30410
movb $0x1, (%rcx,%rax)
leaq 0x15010(%rip), %rcx     # 0x30230
jmp 0x1b234
leaq 0x151c7(%rip), %rcx     # 0x303f0
movb $0x1, (%rcx,%rax)
leaq 0x14f4c(%rip), %rcx     # 0x30180
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x1b24a
leaq (%rcx,%rax,8), %r15
callq 0x6050
andq $0x0, (%r15)
testq %rbx, %rbx
jne 0x1b263
movq %r14, %rdi
xorl %esi, %esi
callq 0x1908c
movq %rax, %rdi
xorl %eax, %eax
callq 0xb178
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq