// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/trader.c
// Function: do_post
void do_post()
{
	struct coord tp;
	int i;
	struct room *rp;
	struct object *op;
	struct linked_list *ll;

	free_list(lvl_obj);		/* throw old items away */

	for (rp = rooms; rp < &rooms[MAXROOMS]; rp++) {
		rp->r_goldval = 0;			/* no gold */
		rp->r_nexits = 0;			/* no exits */
		rp->r_flags = ISGONE;		/* kill all rooms */
	}
	rp = &rooms[0];					/* point to only room */
	rp->r_flags = 0;				/* this room NOT gone */
	rp->r_max.x = 40;
	rp->r_max.y = 10;				/* 10 * 40 room */
	rp->r_pos.x = (COLS - rp->r_max.x) / 2;	/* center horizontal */
	rp->r_pos.y = 1;				/* 2nd line */
	draw_room(rp);					/* draw the only room */
	i = roll(4,10);					/* 10 to 40 items */
	for (; i > 0 ; i--) {			/* place all the items */
		ll = new_thing(FALSE, ANYTHING);		/* get something */
		attach(lvl_obj, ll);
		op = OBJPTR(ll);
		setoflg(op, ISPOST);		/* object in trading post */
		tp = *rnd_pos(rp);
		op->o_pos = tp;
		mvaddch(tp.y,tp.x,op->o_type);
	}
	trader = 0;
	wmove(cw,12,0);
	waddstr(cw,"Welcome to Friendly Fiend's Flea Market\n\r");
	waddstr(cw,"=======================================\n\r");
	waddstr(cw,"$: Prices object that you stand upon.\n\r");
	waddstr(cw,"#: Buys the object that you stand upon.\n\r");
	waddstr(cw,"%: Trades in something in your pack for gold.\n\r");
	trans_line();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x11d54(%rip), %rdi     # 0x2d848
callq 0xbe53
movq $-0x68, %rax
leaq 0x11da9(%rip), %rdi     # 0x2d8b0
movabsq $0x200000000, %rcx      # imm = 0x200000000
movq %rcx, 0xc0(%rdi,%rax)
movl $0x0, 0xc8(%rdi,%rax)
addq $0x68, %rax
cmpq $0x340, %rax            # imm = 0x340
jb 0x1bb11
movl $0x0, 0x5c(%rdi)
movl $0xa, 0xc(%rdi)
movq 0xe453(%rip), %rax      # 0x29f98
movl (%rax), %eax
movl %eax, %ecx
addl $-0x28, %ecx
shrl $0x1f, %ecx
addl %ecx, %eax
addl $-0x28, %eax
sarl %eax
movl %eax, (%rdi)
movabsq $0x2800000001, %rax     # imm = 0x2800000001
movq %rax, 0x4(%rdi)
callq 0x13e7b
movl $0x4, %edi
movl $0xa, %esi
callq 0xc74e
testl %eax, %eax
jle 0x1bc05
movl %eax, %ebx
incl %ebx
leaq 0x11cbb(%rip), %r14     # 0x2d848
leaq 0x11d1c(%rip), %r15     # 0x2d8b0
movq 0xe395(%rip), %r13      # 0x29f30
xorl %edi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1b715
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
callq 0xbe2d
movq 0x10(%r12), %r12
movl $0x4, %esi
movq %r12, %rdi
callq 0x95d5
movq %r15, %rdi
callq 0x14063
movl (%rax), %edx
movl 0x4(%rax), %esi
movl %edx, (%r12)
movl %esi, 0x4(%r12)
movq (%r13), %rdi
callq 0x6490
cmpl $-0x1, %eax
je 0x1bbfe
movq (%r13), %rdi
movl 0x20(%r12), %esi
callq 0x64c0
decl %ebx
cmpl $0x1, %ebx
jg 0x1bb9b
leaq 0x11c5c(%rip), %rax     # 0x2d868
movl $0x0, (%rax)
leaq 0x14dc7(%rip), %rbx     # 0x309e0
movq (%rbx), %rdi
movl $0xc, %esi
xorl %edx, %edx
callq 0x6490
movq (%rbx), %rdi
leaq 0x7a00(%rip), %rsi      # 0x23632
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%rbx), %rdi
leaq 0x7a16(%rip), %rsi      # 0x2365c
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%rbx), %rdi
leaq 0x7a2c(%rip), %rsi      # 0x23686
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%rbx), %rdi
leaq 0x7a40(%rip), %rsi      # 0x236ae
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%rbx), %rdi
leaq 0x7a56(%rip), %rsi      # 0x236d8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1c19d