// File: /workspace/github_cpp_makefile_star2_O3/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 0x26759(%rip), %r15     # 0x45dc0
leaq (%r15,%r14), %rbx
movq %rbx, %rdi
callq 0x216bc
movq %rbx, 0x8(%r14,%r15)
movq %rbx, (%r14,%r15)
movq $0x0, 0x10(%r14,%r15)
addq $0x18, %r14
cmpq $0xa8, %r14
jne 0x1f667
leaq 0x267cf(%rip), %rbx     # 0x45e68
movq %rbx, %rdi
callq 0x216fe
movq %rbx, 0x267c8(%rip)     # 0x45e70
movq %rbx, 0x267b9(%rip)     # 0x45e68
xorl %r14d, %r14d
movq %r14, 0x267bf(%rip)     # 0x45e78
leaq 0x267c0(%rip), %rbx     # 0x45e80
movq %rbx, %rdi
callq 0x21740
movq %rbx, 0x267b9(%rip)     # 0x45e88
movq %rbx, 0x267aa(%rip)     # 0x45e80
movq %r14, 0x267b3(%rip)     # 0x45e90
leaq 0x267fc(%rip), %rbx     # 0x45ee0
movq %rbx, %rdi
callq 0x21848
movq %rbx, 0x267f5(%rip)     # 0x45ee8
movq %rbx, 0x267e6(%rip)     # 0x45ee0
movq %r14, 0x267ef(%rip)     # 0x45ef0
leaq 0x267a8(%rip), %rbx     # 0x45eb0
movq %rbx, %rdi
callq 0x217c4
movq %rbx, 0x267a1(%rip)     # 0x45eb8
movq %rbx, 0x26792(%rip)     # 0x45eb0
movq %r14, 0x2679b(%rip)     # 0x45ec0
leaq 0x2676c(%rip), %rbx     # 0x45e98
movq %rbx, %rdi
callq 0x21782
movq %rbx, 0x26765(%rip)     # 0x45ea0
movq %rbx, 0x26756(%rip)     # 0x45e98
movq %r14, 0x2675f(%rip)     # 0x45ea8
leaq 0x26778(%rip), %rbx     # 0x45ec8
movq %rbx, %rdi
callq 0x21806
movq %rbx, 0x26771(%rip)     # 0x45ed0
movq %rbx, 0x26762(%rip)     # 0x45ec8
movq %r14, 0x2676b(%rip)     # 0x45ed8
leaq 0x2678c(%rip), %rdi     # 0x45f00
callq 0x1d79a
leaq 0x26798(%rip), %rdi     # 0x45f18
callq 0x1d79a
leaq 0x254dc(%rip), %rax     # 0x44c68
movq (%rax), %rax
movswl (%rax), %ebx
movl %ebx, %edi
callq 0x22918
movq %r14, -0x40(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2b798
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2b798
movq %rbx, -0x58(%rbp)
movslq %ebx, %rax
movw $0x0, -0x2e(%rbp)
movq %rax, -0x88(%rbp)
testw %ax, %ax
jle 0x1f99f
leaq -0x70(%rbp), %r14
movabsq $0x303030303030302, %r15 # imm = 0x303030303030302
leaq -0x30(%rbp), %r12
movabsq $0x4e25b9efd4e25b9f, %r13 # imm = 0x4E25B9EFD4E25B9F
movabsq $0x158ed2308158ed2, %rbx # imm = 0x158ED2308158ED2
movw $0x0, -0x30(%rbp)
xorl %eax, %eax
leaq 0x25458(%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 0x1f975
callq 0x41d0
movabsq $-0x303030303030303, %rcx # imm = 0xFCFCFCFCFCFCFCFD
imulq %rcx, %rax
movabsq $0x181818181818181, %rcx # imm = 0x181818181818181
addq %rcx, %rax
cmpq %r15, %rax
ja 0x1f937
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
leaq -0x78(%rbp), %rdi
movq %r12, %rsi
leaq 0x23826(%rip), %rcx     # 0x430c0
callq 0x21d94
movl $0x30, %edi
callq 0x43e0
movl (%r14), %ecx
movl 0x3(%r14), %edx
movl %edx, 0x1b(%rax)
movl %ecx, 0x18(%rax)
movb -0x69(%rbp), %cl
movb %cl, 0x1f(%rax)
leaq 0x2028d(%rip), %rcx     # 0x3fb50
movq %rcx, 0x10(%rax)
movups 0x8(%r14), %xmm0
movups %xmm0, 0x20(%rax)
movq %rax, %rdi
leaq 0x2658e(%rip), %rsi     # 0x45e68
callq 0x4060
incq 0x26592(%rip)           # 0x45e78
leaq -0x78(%rbp), %rdi
callq 0x21cfc
leaq 0x25372(%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 0x1f92b
movl -0x30(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, -0x48(%rbp)
jmp 0x1f937
leaq -0x50(%rbp), %rdi
movq %r12, %rdx
callq 0x18b6a
callq 0x41d0
imulq %r13, %rax
addq %rbx, %rax
rorq %rax
cmpq %rbx, %rax
ja 0x1f975
movq %r12, %rdi
callq 0x203ae
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1f969
movl -0x30(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, -0x48(%rbp)
jmp 0x1f975
leaq -0x50(%rbp), %rdi
movq %r12, %rdx
callq 0x18b6a
movl -0x30(%rbp), %eax
incl %eax
movw %ax, -0x30(%rbp)
cmpw -0x58(%rbp), %ax
jl 0x1f809
movzwl -0x2e(%rbp), %eax
incl %eax
movw %ax, -0x2e(%rbp)
cmpw -0x88(%rbp), %ax
jl 0x1f801
leaq 0x252c2(%rip), %rax     # 0x44c68
movq (%rax), %rax
cmpb $0x1, 0x2(%rax)
movabsq $-0x5c28f5c28f5c28f5, %r13 # imm = 0xA3D70A3D70A3D70B
movq -0x58(%rbp), %rbx
movq -0x88(%rbp), %r12
jne 0x1fa4d
movw $0x8, -0x2e(%rbp)
cmpw $0x9, %bx
jl 0x1fa4d
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 0x1fa2d
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x20458
movq %r14, %rdi
movl $0x6, %esi
xorl %edx, %edx
callq 0x205b5
movl -0x30(%rbp), %eax
addl $0x11, %eax
movw %ax, -0x30(%rbp)
cmpw %r12w, %ax
jl 0x1f9e2
movzwl -0x2e(%rbp), %eax
addl $0x11, %eax
movw %ax, -0x2e(%rbp)
cmpw %bx, %ax
jl 0x1f9dc
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 0x251e9(%rip), %rax     # 0x44c68
movq (%rax), %rsi
leaq -0x78(%rbp), %rdi
movl %r14d, %edx
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
leaq -0x2c(%rbp), %r15
movl %eax, (%r15)
callq 0x2b7a6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x20458
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
xorl %edx, %edx
callq 0x205b5
movl %r14d, %edi
callq 0x2b77c
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 0x1fafb
cmpq $0x1, %rcx
jne 0x1fb04
leaq -0x38(%rbp), %rdi
callq 0x2b764
jmp 0x1fb04
leaq -0x38(%rbp), %rdi
callq 0x2b74c
leaq 0x2515d(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x38(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2b7a6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x20458
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0x205b5
leaq 0x246d1(%rip), %rax     # 0x44224
movl (%rax), %eax
cmpq $0x3, %rax
ja 0x1fe6d
leaq 0x115da(%rip), %rcx     # 0x31140
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x34(%rbp), %rdi
movl %r14d, (%rdi)
callq 0x2b74c
callq 0x41d0
testb $0x1, %al
je 0x1fb8d
leaq -0x34(%rbp), %rdi
callq 0x2b74c
leaq 0x250d4(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2b7a6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x20458
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x3, %edx
callq 0x205b5
leaq -0x34(%rbp), %rdi
movl %r14d, (%rdi)
callq 0x2b764
callq 0x41d0
testb $0x1, %al
je 0x1fbf3
leaq -0x34(%rbp), %rdi
callq 0x2b764
leaq 0x2506e(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2b7a6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x20458
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x3, %edx
callq 0x205b5
cmpl $0x96, -0x58(%rbp)
jl 0x1fe6d
movzwl -0x58(%rbp), %eax
shrl %eax
movw %ax, -0x2c(%rbp)
movw %ax, -0x2a(%rbp)
jmp 0x1fe46
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 0x20458
jmp 0x1fe5c
testb $0x1, -0x38(%rbp)
jne 0x1fd52
movl %r14d, %edi
callq 0x2b77c
movl %eax, -0x34(%rbp)
leaq 0x24fc2(%rip), %rcx     # 0x44c68
movq (%rcx), %rsi
leaq -0x78(%rbp), %rdi
movl %eax, %edx
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2b7a6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x20458
movl -0x2c(%rbp), %eax
movl %eax, 0x26347(%rip)     # 0x46020
leaq -0x34(%rbp), %rdi
movl (%rdi), %eax
leaq 0x20736(%rip), %rcx     # 0x4041c
movl %eax, (%rcx)
callq 0x2b74c
movl (%rax), %eax
cmpl -0x38(%rbp), %eax
jne 0x1fd05
leaq -0x34(%rbp), %rdi
callq 0x2b764
movq %rax, %rdi
callq 0x2b764
leaq 0x24f5c(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2b7a6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
callq 0x20458
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0x205b5
jmp 0x1fdfa
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 0x20458
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
callq 0x205b5
movl %r14d, %edi
callq 0x2b77c
movl %eax, -0x34(%rbp)
callq 0x41d0
testb $0x1, %al
jne 0x1fdaa
leaq -0x34(%rbp), %rdi
callq 0x2b764
jmp 0x1fdb3
leaq -0x34(%rbp), %rdi
callq 0x2b74c
leaq 0x24eae(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, (%r15)
callq 0x2b7a6
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x20458
movl -0x2c(%rbp), %eax
movl %eax, 0x26232(%rip)     # 0x46020
movl -0x34(%rbp), %eax
leaq 0x20624(%rip), %rcx     # 0x4041c
movl %eax, (%rcx)
movb $0x22, 0x26224(%rip)    # 0x46025
movl %r14d, -0x34(%rbp)
callq 0x41d0
testb $0x1, %al
jne 0x1fe19
leaq -0x34(%rbp), %rdi
callq 0x2b764
jmp 0x1fe22
leaq -0x34(%rbp), %rdi
callq 0x2b74c
leaq 0x24e3f(%rip), %rax     # 0x44c68
movq (%rax), %rsi
movl -0x34(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, -0x2c(%rbp)
callq 0x2b7a6
movw $0x3, %bx
leaq -0x2c(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl $0x1, %edx
callq 0x20458
movzwl %bx, %edx
leaq -0x2c(%rbp), %rdi
movl $0x5, %esi
callq 0x205b5
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 0x201ed
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 0x187b2
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 0x1ff44
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 0x1ff6a
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 0x1ffab
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 0x1ffd5
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 0x20030
movswl (%rdi), %eax
movswl 0x4(%rdi), %esi
addl %eax, %esi
movl %esi, %eax
shrl $0x1f, %eax
addl %esi, %eax
shrl %eax
movw %ax, 0x8(%rdi)
movswl 0x2(%rdi), %eax
movswl %cx, %ecx
addl %eax, %ecx
movl %ecx, %eax
cltd
idivl %r9d
movw %dx, 0xa(%rdi)
cmpq $0xc, %r8
je 0x20030
movl %esi, %eax
cltd
idivl %r9d
movw %dx, 0xc(%rdi)
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %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 0x20458
movl %ebx, %eax
andl $0x1, %eax
leal 0x2(,%rax,2), %esi
leaq -0x2c(%rbp), %rdi
xorl %edx, %edx
callq 0x205b5
movq -0x70(%rbp), %rax
movl -0x8(%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x20458
movl %ebx, %esi
andl $0x1, %esi
addl $0x3, %esi
leaq -0x2c(%rbp), %rdi
xorl %edx, %edx
callq 0x205b5
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq $0x4, %rcx
je 0x200e8
cmpq $0x3, %rcx
jne 0x201e4
movl (%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x20458
movl $0x4, %r15d
testb $0x1, %bl
jne 0x201d6
callq 0x41d0
movq %rax, %r15
andl $0x1, %r15d
xorl $0x3, %r15d
jmp 0x201d6
callq 0x41d0
testb $0x1, %al
jne 0x2014b
testb $0x1, %bl
jne 0x20191
movb $0x1, %r13b
xorl %eax, %eax
leaq -0x2c(%rbp), %rbx
leaq -0x50(%rbp), %r15
movq -0x78(%rbp), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, -0x2c(%rbp)
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x20458
callq 0x41d0
andl $0x1, %eax
xorl $0x3, %eax
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x205b5
movl $0x1, %eax
testb $0x1, %r13b
movl $0x0, %r13d
jne 0x20107
jmp 0x201e4
movb $0x1, %r13b
xorl %eax, %eax
leaq -0x2c(%rbp), %rbx
leaq -0x50(%rbp), %r15
movq -0x78(%rbp), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, -0x2c(%rbp)
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x20458
movq %rbx, %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x205b5
movl $0x1, %eax
testb $0x1, %r13b
movl $0x0, %r13d
jne 0x20158
jmp 0x201e4
movq -0x78(%rbp), %rax
movl (%rax), %eax
leaq -0x2c(%rbp), %rdi
movl %eax, (%rdi)
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x20458
leaq -0x2c(%rbp), %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x205b5
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 0x20458
leaq -0x2c(%rbp), %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x205b5
leaq -0x78(%rbp), %rdi
callq 0x1875c
leaq 0x24030(%rip), %rax     # 0x44224
cmpl $0x3, (%rax)
jne 0x20282
movabsq $0x1c71c71c71c71c72, %rbx # imm = 0x1C71C71C71C71C72
leaq 0x2020e(%rip), %r15     # 0x4041c
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 0x2020e
cmpl %ecx, -0x38(%rbp)
je 0x2020e
leaq 0x24a2d(%rip), %rax     # 0x44c68
movq (%rax), %rsi
leaq -0x78(%rbp), %rdi
movl %ecx, %edx
callq 0x16f4e
leaq -0x78(%rbp), %rdi
movl (%rdi), %eax
movl %eax, -0x30(%rbp)
callq 0x2b7a6
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 0x20458
movq %rbx, %rdi
callq 0x203ae
decb %r15b
jne 0x20262
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 0x20312
incl %ebx
leaq -0x30(%rbp), %r14
leaq -0x50(%rbp), %r15
callq 0x41d0
leaq 0x249af(%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 0x20458
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x205b5
decl %ebx
cmpw $0x1, %bx
jg 0x202ad
leaq -0x2c(%rbp), %rdi
callq 0x2b7a6
leaq -0x30(%rbp), %rdi
callq 0x2b7a6
leaq -0x50(%rbp), %rdi
callq 0x1875c
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x20388
jmp 0x20388
jmp 0x20388
jmp 0x20388
jmp 0x20388
jmp 0x20388
jmp 0x20388
jmp 0x20388
jmp 0x20388
jmp 0x20388
movq %rax, %rbx
jmp 0x20394
movq %rax, %rbx
jmp 0x2039d
jmp 0x20388
jmp 0x20364
jmp 0x20364
jmp 0x20388
jmp 0x20388
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x1875c
jmp 0x2038b
jmp 0x20388
jmp 0x20388
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x21cfc
jmp 0x2038b
jmp 0x20388
jmp 0x20388
movq %rax, %rbx
leaq -0x2c(%rbp), %rdi
callq 0x2b7a6
leaq -0x30(%rbp), %rdi
callq 0x2b7a6
leaq -0x50(%rbp), %rdi
callq 0x1875c
movq %rbx, %rdi
callq 0x4740