// File: /workspace/github_c_makefile_star2_O3/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 0x11e28(%rip), %rdi     # 0x2d848
callq 0xbd9a
movq $-0x68, %rax
leaq 0x11e7d(%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 0x1ba3d
movl $0x0, 0x5c(%rdi)
movl $0xa, 0xc(%rdi)
movq 0xe527(%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 0x13d1f
movl $0x4, %edi
movl $0xa, %esi
callq 0xc695
testl %eax, %eax
jle 0x1bb31
movl %eax, %ebx
incl %ebx
leaq 0x11d8f(%rip), %r14     # 0x2d848
leaq 0x11df0(%rip), %r15     # 0x2d8b0
movq 0xe469(%rip), %r13      # 0x29f30
xorl %edi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1b640
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
callq 0xbd73
movq 0x10(%r12), %r12
movl $0x4, %esi
movq %r12, %rdi
callq 0x9553
movq %r15, %rdi
callq 0x13f09
movl (%rax), %edx
movl 0x4(%rax), %esi
movl %edx, (%r12)
movl %esi, 0x4(%r12)
movq (%r13), %rdi
callq 0x6490
cmpl $-0x1, %eax
je 0x1bb2a
movq (%r13), %rdi
movl 0x20(%r12), %esi
callq 0x64c0
decl %ebx
cmpl $0x1, %ebx
jg 0x1bac7
leaq 0x11d30(%rip), %rax     # 0x2d868
movl $0x0, (%rax)
leaq 0x14e9b(%rip), %rbx     # 0x309e0
movq (%rbx), %rdi
movl $0xc, %esi
xorl %edx, %edx
callq 0x6490
movq (%rbx), %rdi
leaq 0x7b4c(%rip), %rsi      # 0x236aa
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%rbx), %rdi
leaq 0x7b62(%rip), %rsi      # 0x236d4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%rbx), %rdi
leaq 0x7b78(%rip), %rsi      # 0x236fe
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%rbx), %rdi
leaq 0x7b8c(%rip), %rsi      # 0x23726
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
movq (%rbx), %rdi
leaq 0x7ba2(%rip), %rsi      # 0x23750
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6550
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1c0c4