// File: /workspace/github_cpp_makefile_star2_O1/lotuskip[P]yuxtapa/server/actives.cpp
// Function: do_placement()
void do_placement()
{
	short tmp;
	// empty previous stuff
	for(tmp = 0; tmp < MAX_NOE; ++tmp)
		noccents[tmp].clear();
	traps.clear();
	boulders.clear();
	PCs.clear();
	MMs.clear();
	arrows.clear();
	zaps.clear();
	team_flags[T_GREEN].clear();
	team_flags[T_PURPLE].clear();

	// we'll be using the nearby search in placement; see spiral.h
	short msize = Game::curmap->get_size();
	nearby_set_dim(msize);

	vector<Coords> used_coords;
	Coords c, d;
	// First place blocks (occent) and traps (noccent) in a single loop:
	// anywhere on a floor/ground/road tile
	for(c.y = 0; c.y < msize; c.y++)
	{
		for(c.x = 0; c.x < msize; c.x++)
		{
			// traps & blocks go only at open spaces:
			if(Game::curmap->get_tile(c).symbol == '.')
			{
				if(!(random()%TRAP_ONE_IN))
				{
					// random trap type:
					traps.push_back(Trap(c, random()%MAX_TRAP_TYPE, cur_players.end()));
					Game::curmap->mod_tile(c)->flags |= TF_TRAP;
					used_coords.push_back(c);
				}
				if(!(random()%BLOCK_ONE_IN))
				{
					add_block(c);
					// we might end up adding the same coords twice, but that
					// doesn't matter:
					used_coords.push_back(c);
				}
			}
		}
	}
	// Torches in a grid, but not if uninhabited
	if(Game::curmap->is_inhabited())
	{
		for(c.y = TORCH_GRID/2; c.y < msize; c.y += TORCH_GRID)
		{
			for(c.x = TORCH_GRID/2; c.x < msize; c.x += TORCH_GRID)
			{
				if(random()%100 >= CHANCE_NO_TORCH)
				{
					d = c;
					next_unused_tile(d, used_coords);
					add_noccent(d, NOE_TORCH);
				}
			}
		}
	}
	// Flags.
	// One green flag in a random corner:
	e_Dir green_corner = e_Dir(1 + 2*(random()%3));
	d = Game::curmap->get_center_of_sector(green_corner);
	next_unused_tile(d, used_coords, true);
	add_noccent(d, NOE_FLAG, T_GREEN);
	// A purple flag at the opposite side of the map:
	e_Dir purple_corner = !green_corner;
	// possibly rotate so that this flag won't be in a corner:
	switch(random()%3)
	{
	case 0: ++purple_corner; break;
	case 1: --purple_corner; break;
	// case 2: nothing
	}
	d = Game::curmap->get_center_of_sector(purple_corner);
	next_unused_tile(d, used_coords, true);
	add_noccent(d, NOE_FLAG, T_PURPLE);
	/* The result so far is either
	 * G..      G..
	 * ...   or ...   (or some rotated or mirrored version of these)
	 * ..P      .P.
	 */
	// Some more flags depending on mapsize & game mode:
	e_Dir tmpd;
	switch(gamemode)
	{
	case GM_DESTR:
	case GM_DOM:
		// Two neutral flags more always:
		tmpd = green_corner;
		++tmpd;
		if(random()%2) ++tmpd;
		d = Game::curmap->get_center_of_sector(tmpd);
		next_unused_tile(d, used_coords, true);
		add_noccent(d, NOE_FLAG, T_NO_TEAM);
		/* This makes it either
		 * GN.       G.N
		 * ..p   or  ..p   (or some rotation/mirroring of these,
		 * .pp       .pp    + the purple flag in one of the p:s)
		 */
		tmpd = green_corner;
		--tmpd;
		if(random()%2) --tmpd;
		d = Game::curmap->get_center_of_sector(tmpd);
		next_unused_tile(d, used_coords, true);
		add_noccent(d, NOE_FLAG, T_NO_TEAM);
		/* And that added another 'N' on the other side of 'G' */
		// On large maps, one more in central area:
		if(msize >= BIG_MAP_LIM)
		{
			d.y = d.x = msize/2;
			next_unused_tile(d, used_coords, true);
			add_noccent(d, NOE_FLAG, T_NO_TEAM);
		}
		break;
	case GM_CONQ:
		// add one purple-own 3rd flag in central area:
		d.y = d.x = msize/2;
		next_unused_tile(d, used_coords, true);
		add_noccent(d, NOE_FLAG, T_PURPLE);
		break;
	case GM_STEAL:
		/* Give the purples another flag, and also position the item here.
		 * It's going to be:
		 * GN.       G..
		 * .Pi   or  N.P    (where 'i' is the item)
		 * ..P       .Pi
		 */
		if(!(int(purple_corner)%2)) // existing P is not in the corner
		{
			// item:
			tmpd = !green_corner;
			d = Game::curmap->get_center_of_sector(tmpd);
			next_unused_tile(d, used_coords);
			the_item.setpos(d);
			obj_sector = tmpd;
			// flag:
			if(++tmpd == purple_corner)
				--(--tmpd);
			d = Game::curmap->get_center_of_sector(tmpd);
			next_unused_tile(d, used_coords, true);
			add_noccent(d, NOE_FLAG, T_PURPLE);
		}
		else // purple flag is in the corner
		{
			// flag:
			d.y = d.x = msize/2;
			next_unused_tile(d, used_coords, true);
			add_noccent(d, NOE_FLAG, T_PURPLE);
			// item:
			tmpd = !green_corner;
			if(random()%2) ++tmpd;
			else --tmpd;
			d = Game::curmap->get_center_of_sector(tmpd);
			next_unused_tile(d, used_coords);
			the_item.setpos(d);
			obj_sector = tmpd;
		}
		the_item.set_col(C_LIGHT_TRAP);
		// Give the greens a neutral vantage-point (always):
		tmpd = green_corner;
		if(random()%2) ++tmpd;
		else --tmpd;
		d = Game::curmap->get_center_of_sector(tmpd);
		next_unused_tile(d, used_coords, true);
		add_noccent(d, NOE_FLAG, T_NO_TEAM);
		break;
	case GM_TDM: break; // no additional flags
	} // switch game-mode (for flag positioning)
	//
	// Portals:
	// The possibilities are:
	// 2 portals:
	//      * 2 two-ways
	//      * 1 entry, 1 exit
	// 3 portals:
	//      * 3 two-ways
	//      * 2 entries, 1 exit
	//      * 1 entry, 2 exits
	// 	4 portals:
	//      * 4 two-ways
	//      * 2 two-ways, 1 entry, 1 exit
	//      * 1+n entries, 3-n exits (n=0..2)
	// 1. Determine the number of portals to place, if any.
	if(random()%100 < CHANCE_PORTALS)
	{
		vector<Coords> portals(2+random()%3);
		// 2. Collect the coordinates for the portals.
		// First one is just a random point:
		portals[0].x = random()%msize;
		portals[0].y = random()%msize;
		// Second one in the corner furthest away from the first:
		if(portals[0].x < msize/2)
			portals[1].x = msize - 2 - random()%PORTALS_FROM_EDGE;
		else
			portals[1].x = 2 + random()%PORTALS_FROM_EDGE;
		if(portals[0].y < msize/2)
			portals[1].y = msize - 2 - random()%PORTALS_FROM_EDGE;
		else
			portals[1].y = 2 + random()%PORTALS_FROM_EDGE;
		// Third one, if needed:
		if(portals.size() > 2)
		{
			portals[2].x = (portals[0].x + portals[1].x)/2;
			portals[2].y = (portals[0].y + portals[1].y)%msize;
			// Fourth one, if needed:
			if(portals.size() > 3)
			{
				portals[3].x = (portals[0].x + portals[1].x)%msize;
				portals[3].y = (portals[0].y + portals[1].y)/2;
			}
		}
		// 3. Determine what kind of portals to place in these coordinates (above)
		bool twoways = random()%2;
		// place at "the last and second to last coordinates" (either
		// 2 two-ways or 1 entry and 1 exit
		d = portals[portals.size()-1];
		next_unused_tile(d, used_coords);
		if(twoways)
			add_noccent(d, NOE_PORTAL_2WAY);
		else
			add_noccent(d, NOE_PORTAL_ENTRY);
		d = portals[portals.size()-2];
		next_unused_tile(d, used_coords);
		if(twoways)
			add_noccent(d, NOE_PORTAL_2WAY);
		else
			add_noccent(d, NOE_PORTAL_EXIT);
		// If there are 3 portals, add a third two-way, an entry, or an exit:
		if(portals.size()==3)
		{
			d = portals[0];
			next_unused_tile(d, used_coords);
			if(twoways)
				add_noccent(d, NOE_PORTAL_2WAY);
			else if(random()%2)
				add_noccent(d, NOE_PORTAL_ENTRY);
			else
				add_noccent(d, NOE_PORTAL_EXIT);
		}
		else if(portals.size()==4)
		{
			// We have so far either (A) 2 two-ways or (B) 1 one-way entry and 1 exit.
			// In case (A), may add 2 more two-ways or 1 entry & 1 exit.
			// In case (B) may add 2 more two-ways or 2 elements from {entry, exit}.
			// Hence, check if we want more 2-ways:
			if(random()%2) // yes!
			{
				for(char ch = 0; ch < 2; ++ch)
				{
					d = portals[ch];
					next_unused_tile(d, used_coords);
					add_noccent(d, NOE_PORTAL_2WAY);
				}
			}
			else if(twoways) // need 1 entry and 1 exit
			{
				d = portals[0];
				next_unused_tile(d, used_coords);
				add_noccent(d, NOE_PORTAL_ENTRY);
				d = portals[1];
				next_unused_tile(d, used_coords);
				add_noccent(d, NOE_PORTAL_EXIT);
			}
			else // may add freely entries/exits
			{
				for(char ch = 0; ch < 2; ++ch)
				{
					d = portals[ch];
					next_unused_tile(d, used_coords);
					if(random()%2)
						add_noccent(d, NOE_PORTAL_ENTRY);
					else
						add_noccent(d, NOE_PORTAL_EXIT);
				}
			}
		} // four portals
	}
	// Blocks for block destroying objective:
	if(gamemode == GM_DESTR)
	{
		// put blocks in a sector not too close to the green flag
		do
			obj_sector = e_Dir(random()%(MAX_D+1));
		while(obj_sector == green_corner || obj_sector == purple_corner);
		c = Game::curmap->get_center_of_sector(obj_sector);
		for(char j = 0; j < NUM_DESTROY_BLOCKS; ++j)
		{
			d = c;
			// These blocks can go anywhere where other entities can:
			next_unused_tile(d, used_coords);
			add_block(d);
		}
	}
	// Block sources (0-2 at random locations)
	for(tmp = random()%3; tmp > 0; --tmp)
	{
		c.x = 5 + random()%(Game::curmap->get_size()-10);
		c.y = 5 + random()%(Game::curmap->get_size()-10);
		next_unused_tile(c, used_coords);
		add_noccent(c, NOE_BLOCK_SOURCE);
	}	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
xorl %r14d, %r14d
leaq 0x265bd(%rip), %r15     # 0x45dc0
leaq (%r15,%r14), %rbx
movq %rbx, %rdi
callq 0x218a6
movq %rbx, 0x8(%r14,%r15)
movq %rbx, (%r14,%r15)
movq $0x0, 0x10(%r14,%r15)
addq $0x18, %r14
cmpq $0xa8, %r14
jne 0x1f803
leaq 0x26633(%rip), %rbx     # 0x45e68
movq %rbx, %rdi
callq 0x218e8
movq %rbx, 0x2662c(%rip)     # 0x45e70
movq %rbx, 0x2661d(%rip)     # 0x45e68
xorl %r14d, %r14d
movq %r14, 0x26623(%rip)     # 0x45e78
leaq 0x26624(%rip), %rbx     # 0x45e80
movq %rbx, %rdi
callq 0x2192a
movq %rbx, 0x2661d(%rip)     # 0x45e88
movq %rbx, 0x2660e(%rip)     # 0x45e80
movq %r14, 0x26617(%rip)     # 0x45e90
leaq 0x26660(%rip), %rbx     # 0x45ee0
movq %rbx, %rdi
callq 0x21a32
movq %rbx, 0x26659(%rip)     # 0x45ee8
movq %rbx, 0x2664a(%rip)     # 0x45ee0
movq %r14, 0x26653(%rip)     # 0x45ef0
leaq 0x2660c(%rip), %rbx     # 0x45eb0
movq %rbx, %rdi
callq 0x219ae
movq %rbx, 0x26605(%rip)     # 0x45eb8
movq %rbx, 0x265f6(%rip)     # 0x45eb0
movq %r14, 0x265ff(%rip)     # 0x45ec0
leaq 0x265d0(%rip), %rbx     # 0x45e98
movq %rbx, %rdi
callq 0x2196c
movq %rbx, 0x265c9(%rip)     # 0x45ea0
movq %rbx, 0x265ba(%rip)     # 0x45e98
movq %r14, 0x265c3(%rip)     # 0x45ea8
leaq 0x265dc(%rip), %rbx     # 0x45ec8
movq %rbx, %rdi
callq 0x219f0
movq %rbx, 0x265d5(%rip)     # 0x45ed0
movq %rbx, 0x265c6(%rip)     # 0x45ec8
movq %r14, 0x265cf(%rip)     # 0x45ed8
leaq 0x265f0(%rip), %rdi     # 0x45f00
callq 0x1d8ba
leaq 0x265fc(%rip), %rdi     # 0x45f18
callq 0x1d8ba
leaq 0x25340(%rip), %rax     # 0x44c68
movq (%rax), %rax
movswl (%rax), %ebx
movl %ebx, %edi
callq 0x22bbc
movq %r14, -0x40(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2bbe8
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2bbe8
movq %rbx, -0x58(%rbp)
movslq %ebx, %rax
movw $0x0, -0x2e(%rbp)
movq %rax, -0x88(%rbp)
testw %ax, %ax
jle 0x1fb04
movabsq $0x303030303030302, %r13 # imm = 0x303030303030302
leaq -0x78(%rbp), %r15
leaq -0x30(%rbp), %r12
movabsq $0x4e25b9efd4e25b9f, %r14 # imm = 0x4E25B9EFD4E25B9F
movabsq $0x158ed2308158ed2, %rbx # imm = 0x158ED2308158ED2
movw $0x0, -0x30(%rbp)
xorl %eax, %eax
leaq 0x252bc(%rip), %rcx     # 0x44c68
movq (%rcx), %rcx
movswq -0x2e(%rbp), %rdx
movq 0x8(%rcx), %rcx
leaq (%rdx,%rdx,2), %rdx
movswq %ax, %rax
movq (%rcx,%rdx,8), %rcx
movzbl 0x2(%rcx,%rax,4), %eax
shll $0x10, %eax
cmpl $0x2e0000, %eax         # imm = 0x2E0000
jne 0x1fada
callq 0x41d0
movabsq $-0x303030303030303, %rcx # imm = 0xFCFCFCFCFCFCFCFD
imulq %rcx, %rax
movabsq $0x181818181818181, %rcx # imm = 0x181818181818181
addq %rcx, %rax
cmpq %r13, %rax
ja 0x1fa9c
callq 0x41d0
movq %rax, %rcx
movabsq $0x2aaaaaaaaaaaaaab, %rdx # imm = 0x2AAAAAAAAAAAAAAB
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
addl %edx, %eax
addl %eax, %eax
leal (%rax,%rax,2), %eax
subl %eax, %ecx
movzbl %cl, %edx
movq %r15, %rdi
movq %r12, %rsi
leaq 0x2368b(%rip), %rcx     # 0x430c0
callq 0x22004
leaq 0x26427(%rip), %rdi     # 0x45e68
movq %rdi, %rsi
movq %r15, %rdx
callq 0x21afc
movq %r15, %rdi
callq 0x21f6c
leaq 0x2520d(%rip), %rax     # 0x44c68
movq (%rax), %rax
movswq -0x2e(%rbp), %rcx
movq 0x8(%rax), %rax
leaq (%rcx,%rcx,2), %rcx
movswq -0x30(%rbp), %rdx
movq (%rax,%rcx,8), %rax
orw $0x800, (%rax,%rdx,4)   # imm = 0x800
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1fa90
movl -0x30(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, -0x48(%rbp)
jmp 0x1fa9c
leaq -0x50(%rbp), %rdi
movq %r12, %rdx
callq 0x18c8e
callq 0x41d0
imulq %r14, %rax
addq %rbx, %rax
rorq %rax
cmpq %rbx, %rax
ja 0x1fada
movq %r12, %rdi
callq 0x20502
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1face
movl -0x30(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, -0x48(%rbp)
jmp 0x1fada
leaq -0x50(%rbp), %rdi
movq %r12, %rdx
callq 0x18c8e
movl -0x30(%rbp), %eax
incl %eax
movw %ax, -0x30(%rbp)
cmpw -0x58(%rbp), %ax
jl 0x1f9a5
movzwl -0x2e(%rbp), %eax
incl %eax
movw %ax, -0x2e(%rbp)
cmpw -0x88(%rbp), %ax
jl 0x1f99d
leaq 0x2515d(%rip), %rax     # 0x44c68
movq (%rax), %rax
cmpb $0x1, 0x2(%rax)
movabsq $-0x5c28f5c28f5c28f5, %r13 # imm = 0xA3D70A3D70A3D70B
movq -0x58(%rbp), %rbx
movq -0x88(%rbp), %r12
jne 0x1fbb2
movw $0x8, -0x2e(%rbp)
cmpw $0x9, %bx
jl 0x1fbb2
leaq -0x2c(%rbp), %r14
leaq -0x50(%rbp), %r15
movw $0x8, -0x30(%rbp)
callq 0x41d0
movq %rax, %rcx
imulq %r13
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x6, %rdx
addq %rax, %rdx
imulq $0x64, %rdx, %rax
subq %rax, %rcx
cmpq $0x1e, %rcx
jl 0x1fb92
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x205bb
movq %r14, %rdi
movl $0x6, %esi
xorl %edx, %edx
callq 0x20718
movl -0x30(%rbp), %eax
addl $0x11, %eax
movw %ax, -0x30(%rbp)
cmpw %r12w, %ax
jl 0x1fb47
movzwl -0x2e(%rbp), %eax
addl $0x11, %eax
movw %ax, -0x2e(%rbp)
cmpw %bx, %ax
jl 0x1fb41
callq 0x41d0
movq %rax, %rcx
movabsq $0x5555555555555556, %r12 # imm = 0x5555555555555556
imulq %r12
movq %rdx, %rax
shrq $0x3f, %rax
addl %edx, %eax
leal (%rax,%rax,2), %eax
subl %eax, %ecx
leal 0x1(,%rcx,2), %r14d
leaq 0x25084(%rip), %rax     # 0x44c68
movq (%rax), %rsi
leaq -0x78(%rbp), %rdi
movl %r14d, %edx
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
leaq -0x2c(%rbp), %r15
movl %eax, (%r15)
callq 0x2bbf6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x205bb
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
xorl %edx, %edx
callq 0x20718
movl %r14d, %edi
callq 0x2bbcc
movl %eax, -0x38(%rbp)
callq 0x41d0
movq %rax, %rcx
imulq %r12
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
subq %rax, %rcx
je 0x1fc60
cmpq $0x1, %rcx
jne 0x1fc69
leaq -0x38(%rbp), %rdi
callq 0x2bbb4
jmp 0x1fc69
leaq -0x38(%rbp), %rdi
callq 0x2bb9c
leaq 0x24ff8(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x38(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2bbf6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x205bb
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0x20718
leaq 0x2456c(%rip), %rax     # 0x44224
movl (%rax), %eax
cmpq $0x3, %rax
ja 0x1ffd2
leaq 0x11485(%rip), %rcx     # 0x31150
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x34(%rbp), %rdi
movl %r14d, (%rdi)
callq 0x2bb9c
callq 0x41d0
testb $0x1, %al
je 0x1fcf2
leaq -0x34(%rbp), %rdi
callq 0x2bb9c
leaq 0x24f6f(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2bbf6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x205bb
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x3, %edx
callq 0x20718
leaq -0x34(%rbp), %rdi
movl %r14d, (%rdi)
callq 0x2bbb4
callq 0x41d0
testb $0x1, %al
je 0x1fd58
leaq -0x34(%rbp), %rdi
callq 0x2bbb4
leaq 0x24f09(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2bbf6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x205bb
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x3, %edx
callq 0x20718
cmpl $0x96, -0x58(%rbp)
jl 0x1ffd2
movzwl -0x58(%rbp), %eax
shrl %eax
movw %ax, -0x2c(%rbp)
movw %ax, -0x2a(%rbp)
jmp 0x1ffab
movq -0x58(%rbp), %rcx
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
shrl %eax
leaq -0x2c(%rbp), %rdi
movw %ax, (%rdi)
movw %ax, 0x2(%rdi)
movw $0x1, %bx
leaq -0x50(%rbp), %rsi
movl $0x1, %edx
callq 0x205bb
jmp 0x1ffc1
testb $0x1, -0x38(%rbp)
jne 0x1feb7
movl %r14d, %edi
callq 0x2bbcc
movl %eax, -0x34(%rbp)
leaq 0x24e5d(%rip), %rcx     # 0x44c68
movq (%rcx), %rsi
leaq -0x78(%rbp), %rdi
movl %eax, %edx
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2bbf6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x205bb
movl -0x2c(%rbp), %eax
movl %eax, 0x261e2(%rip)     # 0x46020
leaq -0x34(%rbp), %rdi
movl (%rdi), %eax
leaq 0x205d9(%rip), %rcx     # 0x40424
movl %eax, (%rcx)
callq 0x2bb9c
movl (%rax), %eax
cmpl -0x38(%rbp), %eax
jne 0x1fe6a
leaq -0x34(%rbp), %rdi
callq 0x2bbb4
movq %rax, %rdi
callq 0x2bbb4
leaq 0x24df7(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2bbf6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x205bb
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0x20718
jmp 0x1ff5f
movq -0x58(%rbp), %rcx
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
shrl %eax
leaq -0x2c(%rbp), %rdi
movw %ax, (%rdi)
movw %ax, 0x2(%rdi)
leaq -0x50(%rbp), %rsi
movl $0x1, %edx
callq 0x205bb
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0x20718
movl %r14d, %edi
callq 0x2bbcc
movl %eax, -0x34(%rbp)
callq 0x41d0
testb $0x1, %al
jne 0x1ff0f
leaq -0x34(%rbp), %rdi
callq 0x2bbb4
jmp 0x1ff18
leaq -0x34(%rbp), %rdi
callq 0x2bb9c
leaq 0x24d49(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2bbf6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x205bb
movl -0x2c(%rbp), %eax
movl %eax, 0x260cd(%rip)     # 0x46020
movl -0x34(%rbp), %eax
leaq 0x204c7(%rip), %rcx     # 0x40424
movl %eax, (%rcx)
movb $0x22, 0x260bf(%rip)    # 0x46025
movl %r14d, -0x34(%rbp)
callq 0x41d0
testb $0x1, %al
jne 0x1ff7e
leaq -0x34(%rbp), %rdi
callq 0x2bbb4
jmp 0x1ff87
leaq -0x34(%rbp), %rdi
callq 0x2bb9c
leaq 0x24cda(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, -0x2c(%rbp)
callq 0x2bbf6
movw $0x3, %bx
leaq -0x2c(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl $0x1, %edx
callq 0x205bb
movzwl %bx, %edx
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
callq 0x20718
callq 0x41d0
movq %rax, %rcx
imulq %r13
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x6, %rdx
addq %rax, %rdx
imulq $0x64, %rdx, %rax
subq %rax, %rcx
cmpq $0x2c, %rcx
jg 0x20341
callq 0x41d0
movq %rax, %rcx
imulq %r12
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
negq %rax
leaq (%rcx,%rax), %rsi
addq $0x2, %rsi
leaq -0x78(%rbp), %rdi
leaq -0x79(%rbp), %rdx
callq 0x188ec
callq 0x41d0
cqto
movq -0x88(%rbp), %rbx
idivq %rbx
movq -0x78(%rbp), %rax
movw %dx, (%rax)
callq 0x41d0
cqto
idivq %rbx
movq -0x78(%rbp), %rax
movw %dx, 0x2(%rax)
movswl (%rax), %eax
movq -0x58(%rbp), %r13
movl %r13d, %r15d
shrl $0x1f, %r15d
addl %r13d, %r15d
sarl %r15d
movabsq $-0x7777777777777777, %rbx # imm = 0x8888888888888889
cmpl %eax, %r15d
jle 0x200a9
callq 0x41d0
movq %rax, %rcx
imulq %rbx
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x3, %rdx
addl %eax, %edx
leal (%rdx,%rdx,4), %eax
leal (%rax,%rax,2), %eax
subl %ecx, %eax
leal (%rax,%r13), %ecx
addl $-0x2, %ecx
jmp 0x200cf
callq 0x41d0
movq %rax, %rcx
imulq %rbx
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x3, %rdx
addl %eax, %edx
leal (%rdx,%rdx,4), %eax
leal (%rax,%rax,2), %eax
subl %eax, %ecx
addl $0x2, %ecx
movq -0x78(%rbp), %rax
movw %cx, 0x4(%rax)
movswl 0x2(%rax), %eax
cmpl %eax, %r15d
jle 0x20110
callq 0x41d0
movq %rax, %rcx
imulq %rbx
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x3, %rdx
addl %eax, %edx
leal (%rdx,%rdx,4), %eax
leal (%rax,%rax,2), %eax
subl %ecx, %eax
movq -0x58(%rbp), %r9
leal (%r9,%rax), %ecx
addl $-0x2, %ecx
jmp 0x2013a
callq 0x41d0
movq %rax, %rcx
imulq %rbx
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x3, %rdx
addl %eax, %edx
leal (%rdx,%rdx,4), %eax
leal (%rax,%rax,2), %eax
subl %eax, %ecx
addl $0x2, %ecx
movq -0x58(%rbp), %r9
movq -0x78(%rbp), %rdi
movw %cx, 0x6(%rdi)
movq -0x70(%rbp), %r8
subq %rdi, %r8
cmpq $0x9, %r8
jb 0x20196
movswl (%rdi), %eax
movswl 0x4(%rdi), %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
shrl %eax
movw %ax, 0x8(%rdi)
movswl 0x2(%rdi), %eax
movswl 0x6(%rdi), %esi
addl %eax, %esi
movl %esi, %eax
cltd
idivl %r9d
movw %dx, 0xa(%rdi)
cmpq $0xc, %r8
je 0x20196
movl %ecx, %eax
cltd
idivl %r9d
movw %dx, 0xc(%rdi)
movl %esi, %eax
shrl $0x1f, %eax
addl %esi, %eax
shrl %eax
movw %ax, 0xe(%rdi)
callq 0x41d0
movq %rax, %rbx
movq -0x70(%rbp), %rax
movl -0x4(%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x205bb
movl %ebx, %eax
andl $0x1, %eax
leal 0x2(,%rax,2), %esi
leaq -0x2c(%rbp), %rdi
xorl %edx, %edx
callq 0x20718
movq -0x70(%rbp), %rax
movl -0x8(%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x205bb
movl %ebx, %esi
andl $0x1, %esi
addl $0x3, %esi
leaq -0x2c(%rbp), %rdi
xorl %edx, %edx
callq 0x20718
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq $0x4, %rcx
je 0x2024e
cmpq $0x3, %rcx
jne 0x20338
movl (%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x205bb
movl $0x4, %r15d
testb $0x1, %bl
jne 0x2032a
callq 0x41d0
movq %rax, %r15
andl $0x1, %r15d
xorl $0x3, %r15d
jmp 0x2032a
callq 0x41d0
testb $0x1, %al
jne 0x202a8
testb $0x1, %bl
jne 0x202e5
xorl %r13d, %r13d
leaq -0x2c(%rbp), %rbx
leaq -0x50(%rbp), %r15
movq -0x78(%rbp), %rax
movl (%rax,%r13,4), %eax
movl %eax, -0x2c(%rbp)
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x205bb
callq 0x41d0
andl $0x1, %eax
xorl $0x3, %eax
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x20718
incq %r13
cmpq $0x2, %r13
jne 0x2026b
jmp 0x20338
xorl %r13d, %r13d
leaq -0x2c(%rbp), %rbx
leaq -0x50(%rbp), %r15
movq -0x78(%rbp), %rax
movl (%rax,%r13,4), %eax
movl %eax, -0x2c(%rbp)
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x205bb
movq %rbx, %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x20718
incq %r13
cmpq $0x2, %r13
jne 0x202b3
jmp 0x20338
movq -0x78(%rbp), %rax
movl (%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x205bb
leaq -0x2c(%rbp), %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x20718
movq -0x78(%rbp), %rax
movl 0x4(%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
movl $0x3, %r15d
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x205bb
leaq -0x2c(%rbp), %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x20718
leaq -0x78(%rbp), %rdi
callq 0x1889c
leaq 0x23edc(%rip), %rax     # 0x44224
cmpl $0x3, (%rax)
jne 0x203d6
movabsq $0x1c71c71c71c71c72, %rbx # imm = 0x1C71C71C71C71C72
leaq 0x200c2(%rip), %r15     # 0x40424
callq 0x41d0
movq %rax, %rcx
imulq %rbx
movq %rdx, %rax
shrq $0x3f, %rax
addl %edx, %eax
leal (%rax,%rax,8), %eax
subl %eax, %ecx
movl %ecx, (%r15)
cmpl %ecx, %r14d
je 0x20362
cmpl %ecx, -0x38(%rbp)
je 0x20362
leaq 0x248d9(%rip), %rax     # 0x44c68
movq (%rax), %rsi
leaq -0x78(%rbp), %rdi
movl %ecx, %edx
callq 0x17076
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, -0x30(%rbp)
callq 0x2bbf6
movb $0xa, %r15b
leaq -0x2c(%rbp), %rbx
leaq -0x50(%rbp), %r14
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x205bb
movq %rbx, %rdi
callq 0x20502
decb %r15b
jne 0x203b6
callq 0x41d0
movq %rax, %rbx
imulq %r12
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
subq %rax, %rbx
testq %rbx, %rbx
jle 0x20466
incl %ebx
leaq -0x30(%rbp), %r14
leaq -0x50(%rbp), %r15
callq 0x41d0
leaq 0x2485b(%rip), %r12     # 0x44c68
movq (%r12), %rcx
movswq (%rcx), %rcx
addq $-0xa, %rcx
cqto
idivq %rcx
addl $0x5, %edx
movw %dx, -0x30(%rbp)
callq 0x41d0
movq (%r12), %rcx
movswq (%rcx), %rcx
addq $-0xa, %rcx
cqto
idivq %rcx
addl $0x5, %edx
movw %dx, -0x2e(%rbp)
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x205bb
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x20718
decl %ebx
cmpw $0x1, %bx
jg 0x20401
leaq -0x2c(%rbp), %rdi
callq 0x2bbf6
leaq -0x30(%rbp), %rdi
callq 0x2bbf6
leaq -0x50(%rbp), %rdi
callq 0x1889c
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x204dc
jmp 0x204dc
jmp 0x204dc
jmp 0x204dc
jmp 0x204dc
jmp 0x204dc
jmp 0x204dc
jmp 0x204dc
jmp 0x204dc
jmp 0x204dc
movq %rax, %rbx
jmp 0x204e8
movq %rax, %rbx
jmp 0x204f1
jmp 0x204dc
jmp 0x204b8
jmp 0x204b8
jmp 0x204dc
jmp 0x204dc
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x1889c
jmp 0x204df
jmp 0x204dc
jmp 0x204dc
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x21f6c
jmp 0x204df
jmp 0x204dc
jmp 0x204dc
movq %rax, %rbx
leaq -0x2c(%rbp), %rdi
callq 0x2bbf6
leaq -0x30(%rbp), %rdi
callq 0x2bbf6
leaq -0x50(%rbp), %rdi
callq 0x1889c
movq %rbx, %rdi
callq 0x4750