// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/generate.cpp
// Function: (anonymous namespace)::loc_generator::generate_one(unsigned long)
void generate_one(uint64_t seed)
{
	rand.seed(seed);
	
	map.width = par.width;
	map.height = par.height;
	map.numislands = 0;
	
	for (int y=0;y<map.height;y++)
	for (int x=0;x<map.width;x++)
	{
		gamemap::island& here = map.map[y][x];
		
		here.population = -1;
		here.totbridges = 0;
		here.rootnode = y*100+x;
		
		here.bridgelen[0] = -1;
		here.bridgelen[1] = -1;
		here.bridgelen[2] = -1;
		here.bridgelen[3] = -1;
		
		here.bridges[0] = 0;
		here.bridges[1] = 0;
		here.bridges[2] = 0;
		here.bridges[3] = 0;
		
		map.towalk[y*100+x] = 0;
	}
	
	map.an_island[1] = -1;
	map.an_island[2] = -1;
	map.an_island[3] = -1;
	map.an_island[4] = -1;
	
	if (!par.use_castle)
	{
		int startx = rand(par.width);
		int starty = rand(par.height);
		map.an_island[0] = starty*100 + startx;
		add_island_sub(startx, starty, starty*100+startx, false, 3);
		
		map.has_castles = false;
	}
	int ncastle = 0;
	int ncastleeach = 1;
	if (par.use_castle)
	{
		ncastle = rand(3) + 2;
		uint8_t colors[4] = {80,81,82,83};
		for (int i=4;i>0;i--)
		{
			int a = i-1;
			int b = rand(i);
			
			uint8_t tmp = colors[a];
			colors[a] = colors[b];
			colors[b] = tmp;
		}
		
		map.has_castles = true;
		
		//minimum sizes with 2 castles, such that there's always a place to put the last castle,
		// no matter where the first ones ended up, even with dense false:
		//2x? - 2x7
		//3x? - 3x7
		//4x? - 4x7
		//5x? - 5x5
		//6x? - 6x5
		//
		//minimum sizes with 3 castles:
		//2x? - 2x12
		//3x? - 3x12
		//4x? - 4x12
		//5x? - 5x9
		//6x? - 6x8
		//7x? - 7x7
		//
		//minimum sizes with 4 castles:
		//2x? - 2x17
		//3x? - 3x17
		//4x? - 4x17
		//5x? - 5x13
		//6x? - 6x11
		//7x? - 7x7
		
		//-> allow 3 or 4 castles on 7x7 maps, but anything smaller gets 2
		if (par.width < 7 || par.height < 7) ncastle = 2;
		if (par.width < 3 || par.height < 3) ncastle = 1; // tiny maps get only one castle
		if (par.width < 5 && par.height < 5) ncastle = 1;
		
		
		for (int i=0;i<ncastle;i++)
		{
			while (true)
			{
				int x = rand(par.width-1);
				int y = rand(par.height-1);
				
				if (map.towalk[y*100+x    ] <= 1 &&
				    map.towalk[y*100+x+  1] <= 1 &&
				    map.towalk[y*100+x+100] <= 1 &&
				    map.towalk[y*100+x+101] <= 1)
				{
					add_island_sub(x,   y,   y*100+x, false, colors[i]);
					add_island_sub(x+1, y,   y*100+x, false, colors[i]);
					add_island_sub(x,   y+1, y*100+x, false, colors[i]);
					add_island_sub(x+1, y+1, y*100+x, false, colors[i]);
					
					map.map[y][x].population = colors[i];
					map.towalk[y*100+x] = colors[i];
					
					map.an_island[0] = y*100 + x;
					map.an_island[colors[i]-80+1] = y*100 + x;
					
					break;
				}
			}
		}
	}
	
	if (par.use_reef)
	{
		for (int y=0;y<map.height;y++)
		for (int x=0;x<map.width;x++)
		{
			if (rand(100) > 3) continue;
			if (map.towalk[y*100+x] >= 3) continue;
			
			map.towalk[y*100+x] = 3;
			map.map[y][x].population = -2;
		}
	}
	
	int totislands = par.width*par.height*par.density;
	totislands = totislands * (rand(100)+50) / 100; // multiply by 50%..150%
	//make sure it doesn't loop forever saying "here's a map with density 0" "don't give me maps with only one island!"
	if (totislands < 4) totislands = 4;
	while (map.numislands < totislands)
	{
		//packed index - equal to y*width+x, as opposed to normal index (y*100+x)
		int pidx_start = rand(par.width*par.height);
		int pidx_skip = rand_coprime(par.width*par.height);
		
		int pidx = pidx_start;
		
		while (true)
		{
			uint16_t y = pidx / par.width;
			uint16_t x = pidx % par.width;
			
			if (try_add_island(x, y)) break;
			else if (map.towalk[y*100+x] == 1) map.towalk[y*100+x] = 0;
			
			pidx = (pidx+pidx_skip) % (par.width*par.height);
			if (pidx == pidx_start) goto done; // all possibilities taken already?
		}
		
		//try to create more castles
		if (par.use_castle && ncastle*ncastleeach <= 4)
		{
//puts(".");
			uint16_t numoptions[4] = { 0,0,0,0 };
			uint16_t newcastle[4];
			uint16_t newroot[4];
			
			for (int y=0;y<par.height-1;y++)
			for (int x=0;x<par.width-1;x++)
			{
				//if
				//- at least one tile is island
				//- all four tiles are available (towalk < 3, or rootnode same)
				//   (towalk=2 is always true somewhere unless the island initially was a 2x2,
				//     which is a pointless restriction, so it must be allowed)
				//- none of the eight surrounding tiles has the same root node
				//- allow_ambiguous is true, or this one is not beside a castle of the same color
				//then a castle can be placed here
				
				uint16_t index = y*100+x;
				
				//- at least one tile is island
				uint16_t root = -1;
				if (map.get(index    ).population >= 0) root = index    ;
				if (map.get(index+  1).population >= 0) root = index+  1;
				if (map.get(index+100).population >= 0) root = index+100;
				if (map.get(index+101).population >= 0) root = index+101;
				
				if (root == (uint16_t)-1) continue;
				root = map.get(root).rootnode;
				if (map.get(root).population >= 80) continue;
				
				//- all four tiles are available (towalk < 3)
				if (map.towalk[index    ] >= 3 && map.get(index    ).rootnode != root) continue;
				if (map.towalk[index+  1] >= 3 && map.get(index+  1).rootnode != root) continue;
				if (map.towalk[index+100] >= 3 && map.get(index+100).rootnode != root) continue;
				if (map.towalk[index+101] >= 3 && map.get(index+101).rootnode != root) continue;
				
				//- all four tiles are available (rootnode same)
				if (map.get(index    ).population >= 0 && map.get(index    ).rootnode != root) continue;
				if (map.get(index+  1).population >= 0 && map.get(index+  1).rootnode != root) continue;
				if (map.get(index+100).population >= 0 && map.get(index+100).rootnode != root) continue;
				if (map.get(index+101).population >= 0 && map.get(index+101).rootnode != root) continue;
				
				//- none of the eight surrounding tiles has the same root node
				if (x > 0 && map.get(index    -1).population >= 0 && map.get(index    -1).rootnode == root) continue;
				if (x > 0 && map.get(index+100-1).population >= 0 && map.get(index+100-1).rootnode == root) continue;
				if (y > 0 && map.get(index-100  ).population >= 0 && map.get(index-100  ).rootnode == root) continue;
				if (y > 0 && map.get(index-100+1).population >= 0 && map.get(index-100+1).rootnode == root) continue;
				
				//- none of the eight surrounding tiles has the same root node
				if (x < map.width-1  && map.get(index+  2).population >= 0 && map.get(index+  2).rootnode == root) continue;
				if (x < map.width-1  && map.get(index+102).population >= 0 && map.get(index+102).rootnode == root) continue;
				if (y < map.height-1 && map.get(index+200).population >= 0 && map.get(index+200).rootnode == root) continue;
				if (y < map.height-1 && map.get(index+201).population >= 0 && map.get(index+201).rootnode == root) continue;
				
				//- allow_ambiguous is true, or this one is not beside a castle of the same color
				//(TODO: allow, but force zero bridges that way)
				if (!par.allow_ambiguous)
				{
					for (int tile=0;tile<4;tile++)
					{
						static const int8_t tilepos[] = { 0, 1, 100, 101 };
						uint16_t lindex = index + tilepos[tile];
						
						static const int8_t diroff[] = { 1, -100, -1, 100 };
						for (int dir=0;dir<4;dir++)
						{
							int8_t bridgelen = map.get(lindex).bridgelen[dir];
							if (bridgelen == -1) continue;
							
							uint16_t newindex = lindex + bridgelen*diroff[dir];
							//printf("%.4X\n",newindex);
							if (map.get(newindex).population == map.towalk[root]) goto has_castle_link;
						}
					}
				}
				if (false) { has_castle_link: continue; }
				
				uint16_t color = map.towalk[root];
//printf("CASTLEVALID[%i]:%.3i,%.3i\n",color,root,index);
				if (rand(++numoptions[color-80]) != 0) continue;
				
				newcastle[color-80] = index;
				newroot[color-80] = root;
			}
			
			if (!!numoptions[0] + !!numoptions[1] + !!numoptions[2] + !!numoptions[3] == ncastle)
			{
				//make sure the new islands don't overlap
				for (int i=0;i<4;i++)
				{
					for (int j=0;j<4;j++)
					{
						if (numoptions[i] == 0) continue;
						if (numoptions[j] == 0) continue;
						
						uint16_t pos1 = newcastle[i];
						uint16_t pos2 = newcastle[j];
						
						if (pos1 == pos2 + 001) goto skip_new_castles;
						if (pos1 == pos2 + 101) goto skip_new_castles;
						if (pos1 == pos2 + 100) goto skip_new_castles;
						if (pos1 == pos2 +  99) goto skip_new_castles;
						//these four checks are enough; if they overlap in other directions, it'll be one of those for the other one
						//equal position is impossible, it'd cause unauthorized overlaps
					}
				}
				
				ncastleeach++;
				for (int i=0;i<4;i++)
				{
					uint16_t pos = newcastle[i];
//printf("CASTLE[%i]=%.3i\n",i,pos);
					if (numoptions[i] == 0) continue;
					
					map.towalk[pos    ] = 80+i; // preallocate these so it won't try to build bridges across them
					map.towalk[pos+  1] = 80+i;
					map.towalk[pos+100] = 80+i;
					map.towalk[pos+101] = 80+i;
				}
				for (int i=0;i<4;i++)
				{
					uint16_t pos = newcastle[i];
					if (numoptions[i] == 0) continue;
					
					if (map.get(pos    ).population < 0) add_island_sub(pos%100  , pos/100  , newroot[i], false, 80+i);
					if (map.get(pos+  1).population < 0) add_island_sub(pos%100+1, pos/100  , newroot[i], false, 80+i);
					if (map.get(pos+100).population < 0) add_island_sub(pos%100  , pos/100+1, newroot[i], false, 80+i);
					if (map.get(pos+101).population < 0) add_island_sub(pos%100+1, pos/100+1, newroot[i], false, 80+i);
					
					map.get(newroot[i]).population = 80+i;
				}
			skip_new_castles: ;
			}
//puts(".");
		}
//for (int y=0;y<map.height;y++)
//for (int x=0;x<map.width;x++)
//{
//if(y&&!x)puts("");
//printf("%i",map.towalk[y*100+x]%(80-6));
//}
//puts("\n");
//for (int y=0;y<map.height;y++)
//for (int x=0;x<map.width;x++)
//{
//if(y&&!x)puts("");
//char ch=map.map[y][x].population;
//if(0);
//else if(ch<0)ch='?';
//else if(ch<10)ch='0'+ch;
//else if(ch<20)ch='A'+ch-10;
//else ch="rbyg"[ch-80];
//printf("%c",ch);
//}
//puts("\n\n");
	}
done: ;
	
	//to ensure large islands' roots are not at bottom right, and its location is not a clue:
	//- set towalk on each island to point to itself
	//- for every tile, swap towalk with its root; this creates linked lists
	//- for each large island, pick a random valid root, then use it
	for (int y=0;y<map.height;y++)
	for (int x=0;x<map.width;x++)
	{
		map.towalk[y*100+x] = y*100+x;
	}
	
	for (int y=0;y<map.height;y++)
	for (int x=0;x<map.width;x++)
	{
		gamemap::island& here = map.map[y][x];
		if (here.population < 0) continue;
		
		uint16_t swap = map.towalk[y*100+x];
		map.towalk[y*100+x] = map.towalk[here.rootnode];
		map.towalk[here.rootnode] = swap;
		
		//also repair bridgelen, bridges==3, non-root population, and bridge counts for oceans
		here.population = map.get(here.rootnode).population;
		here.totbridges = (here.population < 80 ? here.population : 16); // the exact number doesn't matter
		
		for (int x2=x-1;x2>=0;x2--)
		{
			if (map.map[y][x2].population != -1)
			{
				if (map.map[y][x2].population == -2) break;
				
				here.bridgelen[2] = x-x2;
				map.map[y][x2].bridgelen[0] = x-x2;
				for (int x3=x2+1;x3<x;x3++)
				{
					map.map[y][x3].bridgelen[0] = x-x3;
					map.map[y][x3].bridgelen[2] = x3-x2;
					map.map[y][x3].bridges[0] = here.bridges[2];
					map.map[y][x3].bridges[2] = here.bridges[2];
				}
				
				if (map.map[y][x2].rootnode == here.rootnode && x-x2==1)
				{
					here.bridges[2] = 3;
					map.map[y][x2].bridges[0] = 3;
				}
				
				break;
			}
		}
		for (int y2=y-1;y2>=0;y2--)
		{
			if (map.map[y2][x].population != -1)
			{
				if (map.map[y2][x].population == -2) break;
				
				here.bridgelen[1] = y-y2;
				map.map[y2][x].bridgelen[3] = y-y2;
				for (int y3=y2+1;y3<y;y3++)
				{
					map.map[y3][x].bridgelen[1] = y3-y2;
					map.map[y3][x].bridgelen[3] = y-y3;
					map.map[y3][x].bridges[1] = here.bridges[1];
					map.map[y3][x].bridges[3] = here.bridges[1];
				}
				
				if (map.map[y2][x].rootnode == here.rootnode && y-y2==1)
				{
					here.bridges[1] = 3;
					map.map[y2][x].bridges[3] = 3;
				}
				
				break;
			}
		}
	}
	
	for (int y=0;y<map.height;y++)
	for (int x=0;x<map.width;x++)
	{
		int idx = y*100+x;
		if (map.map[y][x].population < 0) continue;  // ignore oceans
		if (map.towalk[idx]==idx) continue;          // ignore small islands
		// I could ignore non-roots, but then I'd rerandomize the root if it moved down. I'd rather not bias it.
		// TODO: examine whether there's some interesting mathematical property on anything in towalk,
		//  for example if the linked lists are strictly increasing except when it loops back to the lowest
		//if (map.map[y][x].rootnode != idx) continue;
		
		int newroot = -1; // a valid root is known to exist, but gcc won't realize that
		int nroots = 0;
		do {
			gamemap::island& here = map.get(idx);
			
			bool valid_root = false;
			
			if (here.population >= 80)
			{
				//castles are always on a 2x2, so this always works, even if it doesn't check that bottom-right is connected
				valid_root = (here.bridges[0]==3 && here.bridges[3]==3);
			}
			else
			{
				valid_root = (here.bridges[0]==3 || here.bridges[3]==3);
			}
			
			if (valid_root)
			{
				nroots++;
				if (rand(nroots) == 0) newroot = idx;
			}
			idx = map.towalk[idx];
		} while (idx != y*100+x);
		
		do {
			map.get(idx).rootnode = newroot;
			idx = map.towalk[idx];
		} while (idx != y*100+x);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
addq $0x10, %rdi
movq %rsi, 0x10(%rbx)
movq %rdi, 0x18(%rsp)
callq 0x12370
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movzbl (%rcx), %edx
movl %edx, (%rax)
movzbl 0x1(%rcx), %r8d
movl %r8d, 0x4(%rax)
andl $0x0, 0x8(%rax)
pushq $0x6
popq %rcx
xorl %edx, %edx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edi, %edi
movslq %r8d, %r8
cmpq %r8, %rdi
jge 0x1df22
movq %rdx, %r8
movq %rcx, %r9
xorl %r10d, %r10d
movq (%rbx), %rax
movslq (%rax), %r11
cmpq %r11, %r10
jge 0x1df0e
movw $0xff, (%rax,%r9,2)
movw %r8w, 0x2(%rax,%r9,2)
movq %rsi, 0x4(%rax,%r9,2)
movq (%rbx), %rax
andw $0x0, 0x1fbe8(%rax,%r8,2)
incq %r10
addq $0x6, %r9
incq %r8
jmp 0x1ded8
incq %rdi
movl 0x4(%rax), %r8d
addq $0x258, %rcx            # imm = 0x258
addq $0x64, %rdx
jmp 0x1dec7
orq $-0x1, 0x1d4d0(%rax)
movq 0x8(%rbx), %rcx
movb 0xb(%rcx), %dl
testb %dl, %dl
jne 0x1df8d
movzbl (%rcx), %esi
movq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x12438
movl %eax, %ebp
movq 0x8(%rbx), %rax
movzbl 0x1(%rax), %esi
movq %r14, %rdi
callq 0x12438
imull $0x64, %eax, %ecx
addl %ebp, %ecx
movq (%rbx), %rdx
movw %cx, 0x1d4ce(%rdx)
movzwl %cx, %ecx
pushq $0x3
popq %r9
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %edx
xorl %r8d, %r8d
callq 0x1f424
movq (%rbx), %rax
movb $0x0, 0x1d4cc(%rax)
movq 0x8(%rbx), %rcx
movb 0xb(%rcx), %dl
movl $0x0, 0x30(%rsp)
testb $0x1, %dl
je 0x1e17a
pushq $0x3
popq %rsi
movq 0x18(%rsp), %rdi
callq 0x12438
movl %eax, %ebp
movl $0x53525150, 0x10(%rsp) # imm = 0x53525150
pushq $0x4
popq %r15
movq %r15, %r14
subq $0x1, %r14
jb 0x1dfe8
movq 0x18(%rsp), %rdi
movl %r15d, %esi
callq 0x12438
movb 0xf(%rsp,%r15), %cl
cltq
movb 0x10(%rsp,%rax), %dl
movb %dl, 0xf(%rsp,%r15)
movb %cl, 0x10(%rsp,%rax)
movq %r14, %r15
jmp 0x1dfbc
movq (%rbx), %rax
movb $0x1, 0x1d4cc(%rax)
movq 0x8(%rbx), %rcx
movb (%rcx), %dl
pushq $0x2
popq %rdi
cmpb $0x7, %dl
jae 0x1e00b
cmpb $0x3, %dl
jb 0x1e01f
movb 0x1(%rcx), %sil
jmp 0x1e019
addl $0x2, %ebp
movb 0x1(%rcx), %sil
cmpb $0x7, %sil
cmovael %ebp, %edi
cmpb $0x2, %sil
ja 0x1e022
pushq $0x1
popq %rdi
cmpb $0x4, %dl
ja 0x1e031
cmpb $0x5, 0x1(%rcx)
pushq $0x1
popq %rcx
cmovbl %ecx, %edi
xorl %r13d, %r13d
testl %edi, %edi
movl $0x0, %ecx
movl %edi, 0x30(%rsp)
cmovgl %edi, %ecx
movq %rcx, 0x8(%rsp)
cmpq 0x8(%rsp), %r13
je 0x1e176
movq 0x8(%rbx), %rax
movzbl (%rax), %esi
decl %esi
movq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x12438
movl %eax, %r15d
movq 0x8(%rbx), %rax
movzbl 0x1(%rax), %esi
decl %esi
movq %r14, %rdi
callq 0x12438
movl %eax, %r12d
movq (%rbx), %rax
imull $0x64, %r12d, %ecx
addl %r15d, %ecx
movslq %ecx, %r14
cmpw $0x1, 0x1fbe8(%rax,%r14,2)
jg 0x1e052
cmpw $0x1, 0x1fbea(%rax,%r14,2)
jg 0x1e052
cmpw $0x1, 0x1fcb0(%rax,%r14,2)
jg 0x1e052
cmpw $0x1, 0x1fcb2(%rax,%r14,2)
jg 0x1e052
movq %r13, (%rsp)
movq (%rsp), %rax
movzbl 0x10(%rsp,%rax), %r13d
movzwl %r14w, %ebp
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
movl %r13d, %r9d
callq 0x1f424
leal 0x1(%r15), %esi
movl %esi, 0x28(%rsp)
movq %rbx, %rdi
movl %r12d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
movl %r13d, %r9d
callq 0x1f424
leal 0x1(%r12), %edx
movl %edx, 0x38(%rsp)
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %ecx
xorl %r8d, %r8d
movl %r13d, %r9d
callq 0x1f424
movq %rbx, %rdi
movl 0x28(%rsp), %esi
movl 0x38(%rsp), %edx
movl %ebp, %ecx
xorl %r8d, %r8d
movl %r13d, %r9d
callq 0x1f424
movq (%rbx), %rax
movslq %r12d, %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rax, %rcx
movslq %r15d, %rdx
imulq $0xc, %rdx, %rdx
movb %r13b, 0xc(%rdx,%rcx)
movw %r13w, 0x1fbe8(%rax,%r14,2)
movw %r14w, 0x1d4ce(%rax)
movw %r14w, 0x1d430(%rax,%r13,2)
movq (%rsp), %r13
incq %r13
jmp 0x1e047
movq 0x8(%rbx), %rcx
cmpb $0x1, 0x9(%rcx)
jne 0x1e1fb
pushq $0xc
popq %r13
movl $0x1fbe8, %r15d         # imm = 0x1FBE8
xorl %r12d, %r12d
pushq $0x64
popq %rbp
movslq 0x4(%rax), %rax
cmpq %rax, %r12
jge 0x1e1f7
movq %r13, (%rsp)
xorl %r14d, %r14d
movq (%rbx), %rax
movslq (%rax), %rcx
cmpq %rcx, %r14
jge 0x1e1e0
movq 0x18(%rsp), %rdi
movl %ebp, %esi
callq 0x12438
cmpl $0x3, %eax
ja 0x1e1d7
movq (%rbx), %rax
leaq (%rax,%r15), %rcx
cmpw $0x2, (%rcx,%r14,2)
jg 0x1e1d7
movw $0x3, (%rcx,%r14,2)
movb $-0x2, (%rax,%r13)
incq %r14
addq $0xc, %r13
jmp 0x1e1a0
incq %r12
movq (%rsp), %r13
addq $0x4b0, %r13            # imm = 0x4B0
addq $0xc8, %r15
jmp 0x1e190
movq 0x8(%rbx), %rcx
pushq $0x1
popq %r14
movzbl (%rcx), %eax
movzbl 0x1(%rcx), %edx
imull %eax, %edx
cvtsi2ss %edx, %xmm0
mulss 0x4(%rcx), %xmm0
cvttss2si %xmm0, %ebp
pushq $0x64
popq %r15
movq 0x18(%rsp), %rdi
movl %r15d, %esi
callq 0x12438
addl $0x32, %eax
imull %ebp, %eax
xorl %edx, %edx
divl %r15d
cmpl $0x5, %eax
pushq $0x4
popq %rcx
cmovael %eax, %ecx
movl %ecx, 0x74(%rsp)
movl %r14d, %esi
movl 0x30(%rsp), %eax
movl %esi, 0x20(%rsp)
imull %eax, %esi
movl %esi, 0x28(%rsp)
movq (%rbx), %rcx
movl 0x74(%rsp), %eax
cmpl %eax, 0x8(%rcx)
jge 0x1edee
movq 0x8(%rbx), %rax
movzbl (%rax), %ecx
movzbl 0x1(%rax), %esi
imull %ecx, %esi
movq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x12438
movl %eax, (%rsp)
movq 0x8(%rbx), %rax
movzbl (%rax), %ecx
movzbl 0x1(%rax), %r14d
imull %ecx, %r14d
leal -0x1(%r14), %esi
movq %r15, %rdi
callq 0x12438
movl %eax, %r12d
incl %r12d
movl %r12d, %ecx
movl %r14d, %esi
testl %esi, %esi
je 0x1e2b7
movl %ecx, %eax
xorl %edx, %edx
divl %esi
movl %esi, %ecx
movl %edx, %esi
jmp 0x1e2a7
movl %r12d, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %r12d
cmpl $0x1, %ecx
ja 0x1e2a1
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
movb (%rax), %sil
movl (%rsp), %r15d
movzbl %sil, %esi
movl %r15d, %eax
cltd
idivl %esi
movl %eax, %r13d
movl %edx, %ebp
movl $0xffff, %edx           # imm = 0xFFFF
andl %edx, %ebp
andl %edx, %r13d
imull $0x64, %r13d, %r14d
addl %ebp, %r14d
movl %r14d, %eax
andl %edx, %eax
cmpw $0x1, 0x1fbe8(%rcx,%rax,2)
jne 0x1e326
orw $-0x1, 0x10(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
movl %r13d, %edx
xorl %ecx, %ecx
leaq 0x10(%rsp), %r8
callq 0x1f80a
testw %ax, %ax
jne 0x1e365
movq (%rbx), %rcx
movl %r14d, %eax
cmpw $0x1, 0x1fbe8(%rcx,%rax,2)
jne 0x1e33d
andw $0x0, 0x1fbe8(%rcx,%rax,2)
addl %r12d, %r15d
movq 0x8(%rbx), %rax
movzbl (%rax), %esi
movzbl 0x1(%rax), %edi
imull %esi, %edi
movl %r15d, %eax
cltd
idivl %edi
movl %edx, %r15d
cmpl (%rsp), %edx
jne 0x1e2d4
jmp 0x1edee
movzwl 0x10(%rsp), %r12d
movzwl %r14w, %r15d
movq %rbx, %rdi
movl %ebp, %esi
movl %r13d, %edx
movl %r15d, %ecx
pushq $0x1
popq %r8
movl %r12d, %r9d
callq 0x1f424
movq 0x8(%rbx), %rax
cmpb $0x1, 0xa(%rax)
jne 0x1e533
movq 0x18(%rsp), %rdi
pushq $0x64
popq %rsi
callq 0x12438
cmpl $0x31, %eax
ja 0x1e533
movq 0x18(%rsp), %rdi
pushq $0xa
popq %rsi
callq 0x12438
cmpl $0x9, %eax
ja 0x1e533
movl %eax, %eax
leaq 0xd207(%rip), %rcx      # 0x2b5d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leal 0x1(%rbp), %esi
movq %rbx, %rdi
movl %r13d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
testb %al, %al
je 0x1e533
addl $0x2, %ebp
jmp 0x1e497
leal 0x1(%r13), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
testb %al, %al
je 0x1e533
addl $0x2, %r13d
jmp 0x1e497
leal 0x1(%rbp), %esi
jmp 0x1e4d4
leal 0x1(%rbp), %esi
movq %rbx, %rdi
movl %r13d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
decl %ebp
jmp 0x1e497
leal -0x1(%r13), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
testb %al, %al
je 0x1e533
addl $-0x2, %r13d
jmp 0x1e497
leal 0x1(%rbp), %esi
jmp 0x1e4b2
leal -0x1(%rbp), %esi
movq %rbx, %rdi
movl %r13d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
testb %al, %al
je 0x1e533
addl $-0x2, %ebp
jmp 0x1e497
leal -0x1(%r13), %edx
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
incl %r13d
movq %rbx, %rdi
movl %ebp, %esi
movl %r13d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
jmp 0x1e533
leal -0x1(%rbp), %esi
movq %rbx, %rdi
movl %esi, (%rsp)
movl %r13d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
movl %r12d, %r14d
movl %eax, %r12d
decl %r13d
jmp 0x1e4f1
leal -0x1(%rbp), %esi
movq %rbx, %rdi
movl %esi, (%rsp)
movl %r13d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x1fbcc
movl %r12d, %r14d
movl %eax, %r12d
incl %r13d
movq %rbx, %rdi
movl %ebp, %esi
movl %r13d, %edx
movl %r15d, %ecx
movl %r14d, %r8d
callq 0x1fbcc
testb %r12b, %r12b
jne 0x1e50d
testb %al, %al
je 0x1e533
movq 0x18(%rsp), %rdi
pushq $0x64
popq %rsi
callq 0x12438
cmpl $0x4a, %eax
ja 0x1e533
movq %rbx, %rdi
movl (%rsp), %esi
movl %r13d, %edx
movl %r15d, %ecx
movl %r14d, %r8d
jmp 0x1e4a5
movq 0x8(%rbx), %rdi
cmpb $0x1, 0xb(%rdi)
jne 0x1e251
cmpl $0x4, 0x28(%rsp)
jg 0x1e251
andq $0x0, 0x10(%rsp)
movq $0x0, 0x58(%rsp)
xorl %ecx, %ecx
movw $0x64, %r8w
movzbl 0x1(%rdi), %eax
decq %rax
cmpq %rax, %rcx
movl 0x20(%rsp), %esi
jge 0x1eb1c
movq %rcx, 0x50(%rsp)
imulq $0x64, %rcx, %rax
movq %rax, 0x80(%rsp)
movq 0x58(%rsp), %rax
movl %eax, %ecx
xorl %edx, %edx
movzbl (%rdi), %eax
decq %rax
cmpq %rax, %rdx
jge 0x1eb02
movq %rdi, 0x78(%rsp)
movl %ecx, 0x38(%rsp)
movq 0x80(%rsp), %rax
movq %rdx, 0x28(%rsp)
leaq (%rdx,%rax), %r9
movq (%rbx), %r15
movl %r9d, %eax
xorl %edx, %edx
divw %r8w
movzwl %ax, %eax
movzwl %dx, %ecx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
leaq (%r15,%rax), %r10
addq $0xc, %r10
imulq $0xc, %rcx, %rdi
movb (%rdi,%r10), %al
movb %al, 0x68(%rsp)
testb %al, %al
movl $0xffff, %ecx           # imm = 0xFFFF
cmovnsl %r9d, %ecx
leal 0x1(%r9), %esi
movl %esi, %eax
xorl %edx, %edx
divw %r8w
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
leaq (%r15,%rax), %r14
addq $0xc, %r14
imulq $0xc, %rdx, %r13
movb (%r13,%r14), %al
movb %al, 0x60(%rsp)
testb %al, %al
cmovnsl %esi, %ecx
leal 0x64(%r9), %esi
movl %esi, %eax
xorl %edx, %edx
divw %r8w
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
leaq (%r15,%rax), %rbp
addq $0xc, %rbp
imulq $0xc, %rdx, %r11
movb (%r11,%rbp), %al
movb %al, 0x27(%rsp)
testb %al, %al
cmovnsl %esi, %ecx
movq %r9, 0x8(%rsp)
leal 0x65(%r9), %esi
movl %esi, %eax
xorl %edx, %edx
divw %r8w
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
movq %r15, (%rsp)
leaq (%r15,%rax), %r8
addq $0xc, %r8
imulq $0xc, %rdx, %r9
movb (%r9,%r8), %r15b
testb %r15b, %r15b
cmovnsl %esi, %ecx
cmpw $-0x1, %cx
je 0x1e6e7
movl %ecx, %eax
xorl %edx, %edx
movw $0x64, %r12w
divw %r12w
movq (%rsp), %rcx
leaq 0xc(%rcx), %rsi
movzwl %ax, %eax
movzwl %dx, %ecx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rcx, %rcx
movzwl 0x2(%rcx,%rax), %eax
movw %ax, 0x36(%rsp)
xorl %edx, %edx
divw %r12w
movzwl %ax, %eax
movzwl %dx, %ecx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rcx, %rcx
cmpb $0x4f, (%rcx,%rax)
jle 0x1e703
movq 0x28(%rsp), %rdx
incq %rdx
movq 0x8(%rbx), %rdi
movl 0x38(%rsp), %ecx
incl %ecx
movw $0x64, %r8w
jmp 0x1e590
addq %rdi, %r10
movzwl 0x36(%rsp), %ecx
movq 0x8(%rsp), %rax
movq (%rsp), %rdx
cmpw $0x3, 0x1fbe8(%rdx,%rax,2)
jl 0x1e728
movswl 0x2(%r10), %eax
cmpl %ecx, %eax
jne 0x1e6e7
addq %r13, %r14
movq 0x8(%rsp), %rax
movq (%rsp), %rdx
cmpw $0x3, 0x1fbea(%rdx,%rax,2)
jl 0x1e748
movswl 0x2(%r14), %eax
cmpl %ecx, %eax
jne 0x1e6e7
addq %r11, %rbp
movq 0x8(%rsp), %rax
movq (%rsp), %rdx
cmpw $0x3, 0x1fcb0(%rdx,%rax,2)
jl 0x1e767
movswl 0x2(%rbp), %eax
cmpl %ecx, %eax
jne 0x1e6e7
addq %r9, %r8
movq 0x8(%rsp), %rax
movq (%rsp), %rdx
cmpw $0x3, 0x1fcb2(%rdx,%rax,2)
jl 0x1e78b
movswl 0x2(%r8), %eax
cmpl %ecx, %eax
jne 0x1e6e7
cmpb $0x0, 0x68(%rsp)
js 0x1e79f
movswl 0x2(%r10), %eax
cmpl %ecx, %eax
jne 0x1e6e7
cmpb $0x0, 0x60(%rsp)
js 0x1e7b3
movswl 0x2(%r14), %eax
cmpl %ecx, %eax
jne 0x1e6e7
cmpb $0x0, 0x27(%rsp)
js 0x1e7c6
movswl 0x2(%rbp), %eax
cmpl %ecx, %eax
jne 0x1e6e7
testb %r15b, %r15b
js 0x1e7d8
movswl 0x2(%r8), %eax
cmpl %ecx, %eax
jne 0x1e6e7
cmpq $0x0, 0x28(%rsp)
je 0x1e84f
movq 0x8(%rsp), %rax
decl %eax
xorl %edx, %edx
movw $0x64, %di
divw %di
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
cmpb $0x0, (%rdx,%rax)
js 0x1e819
addq %rdx, %rax
movswl 0x2(%rax), %eax
cmpl %ecx, %eax
je 0x1e6e7
movq 0x8(%rsp), %rax
addl $0x63, %eax
xorl %edx, %edx
divw %di
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
cmpb $0x0, (%rdx,%rax)
js 0x1e84f
addq %rdx, %rax
movswl 0x2(%rax), %eax
cmpl %ecx, %eax
je 0x1e6e7
cmpq $0x0, 0x50(%rsp)
je 0x1e8c7
movq 0x8(%rsp), %rax
addl $-0x64, %eax
xorl %edx, %edx
movw $0x64, %di
divw %di
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
cmpb $0x0, (%rdx,%rax)
js 0x1e891
addq %rdx, %rax
movswl 0x2(%rax), %eax
cmpl %ecx, %eax
je 0x1e6e7
movq 0x8(%rsp), %rax
addl $-0x63, %eax
xorl %edx, %edx
divw %di
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
cmpb $0x0, (%rdx,%rax)
js 0x1e8c7
addq %rdx, %rax
movswl 0x2(%rax), %eax
cmpl %ecx, %eax
je 0x1e6e7
movq (%rsp), %rax
movslq (%rax), %rax
decq %rax
cmpq %rax, 0x28(%rsp)
jge 0x1e948
movq 0x8(%rsp), %rax
addl $0x2, %eax
xorl %edx, %edx
movw $0x64, %di
divw %di
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
cmpb $0x0, (%rdx,%rax)
js 0x1e912
addq %rdx, %rax
movswl 0x2(%rax), %eax
cmpl %ecx, %eax
je 0x1e6e7
movq 0x8(%rsp), %rax
addl $0x66, %eax
xorl %edx, %edx
divw %di
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
cmpb $0x0, (%rdx,%rax)
js 0x1e948
addq %rdx, %rax
movswl 0x2(%rax), %eax
cmpl %ecx, %eax
je 0x1e6e7
movq (%rsp), %rax
movslq 0x4(%rax), %rax
decq %rax
cmpq %rax, 0x50(%rsp)
jge 0x1e9ce
movq 0x8(%rsp), %rax
addl $0xc8, %eax
xorl %edx, %edx
movw $0x64, %di
divw %di
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
cmpb $0x0, (%rdx,%rax)
js 0x1e996
addq %rdx, %rax
movswl 0x2(%rax), %eax
cmpl %ecx, %eax
je 0x1e6e7
movq 0x8(%rsp), %rax
addl $0xc9, %eax
xorl %edx, %edx
divw %di
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
cmpb $0x0, (%rdx,%rax)
js 0x1e9ce
addq %rdx, %rax
movswl 0x2(%rax), %eax
cmpl %ecx, %eax
je 0x1e6e7
movq 0x78(%rsp), %rax
cmpb $0x0, 0xc(%rax)
movw $0x64, %r14w
je 0x1ea32
movq (%rsp), %rax
movzwl 0x1fbe8(%rax,%rcx,2), %r14d
movzwl -0x90(%rsp,%r14,2), %eax
incl %eax
movw %ax, -0x90(%rsp,%r14,2)
movzwl %ax, %esi
movq 0x18(%rsp), %rdi
callq 0x12438
testl %eax, %eax
jne 0x1e6e7
addl %r14d, %r14d
movq 0x8(%rsp), %rax
movw %ax, -0x58(%rsp,%r14)
movzwl 0x36(%rsp), %eax
movw %ax, -0x60(%rsp,%r14)
jmp 0x1e6e7
movq (%rsp), %rax
leaq 0x10(%rax), %rdi
xorl %r9d, %r9d
cmpq $0x4, %r9
je 0x1e9de
leaq 0xcb7e(%rip), %rax      # 0x2b5c8
movsbl (%r9,%rax), %r8d
movq 0x8(%rsp), %rax
leal (%rax,%r8), %r10d
addl 0x38(%rsp), %r8d
movl %r8d, %eax
movl $0xffff, %ebp           # imm = 0xFFFF
andl %ebp, %eax
xorl %edx, %edx
movq %rsi, %r11
pushq $0x64
popq %rsi
divq %rsi
movq %r11, %rsi
imulq $0x4b0, %rax, %r11      # imm = 0x4B0
movl %r8d, %eax
xorl %edx, %edx
divw %r14w
imull $0x64, %eax, %eax
subl %eax, %r8d
andl %ebp, %r8d
imulq $0xc, %r8, %rax
addq %rdi, %r11
addq %rax, %r11
xorl %r8d, %r8d
cmpq $0x4, %r8
je 0x1eafa
movw $0x64, %bp
movsbl (%r11,%r8), %edx
cmpl $-0x1, %edx
je 0x1eaf0
leaq 0xcb16(%rip), %rax      # 0x2b5cc
movsbl (%r8,%rax), %eax
imull %edx, %eax
addl %r10d, %eax
xorl %edx, %edx
divw %bp
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
movsbl (%rdx,%rax), %eax
movq (%rsp), %rdx
cmpw %ax, 0x1fbe8(%rdx,%rcx,2)
je 0x1e6e7
incq %r8
movw $0x64, %r14w
jmp 0x1ea9b
incq %r9
jmp 0x1ea3d
movq 0x50(%rsp), %rcx
incq %rcx
movq 0x58(%rsp), %rax
addl $0x64, %eax
movq %rax, 0x58(%rsp)
jmp 0x1e562
movq 0x10(%rsp), %xmm0
punpcklwd %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3]
pcmpeqw 0x9642(%rip), %xmm0     # 0x28170
movmskps %xmm0, %ecx
xorl $0xf, %ecx
shll $0x2, %ecx
movabsq $0x4332322132212110, %rax # imm = 0x4332322132212110
shrq %cl, %rax
andl $0x7, %eax
movl 0x30(%rsp), %ecx
cmpl %eax, %ecx
jne 0x1ebba
xorl %eax, %eax
cmpq $0x4, %rax
je 0x1ebc1
movzwl 0x10(%rsp,%rax,2), %ecx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x1ebb5
testw %cx, %cx
je 0x1ebb0
cmpw $0x0, 0x10(%rsp,%rdx,2)
je 0x1ebb0
movzwl 0x48(%rsp,%rax,2), %esi
movzwl 0x48(%rsp,%rdx,2), %edi
movd %edi, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
paddd 0xca14(%rip), %xmm0     # 0x2b5a0
movd %esi, %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
punpcklwd 0x95d3(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1],xmm1[2],mem[2],xmm1[3],mem[3]
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %esi
testl %esi, %esi
movl 0x20(%rsp), %esi
jne 0x1e242
incq %rdx
jmp 0x1eb5e
incq %rax
jmp 0x1eb51
movl %ecx, %eax
jmp 0x1e246
movq (%rbx), %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x1ec05
cmpw $0x0, 0x10(%rsp,%rcx,2)
je 0x1ec00
movzwl 0x48(%rsp,%rcx,2), %edx
leal 0x50(%rcx), %esi
movw %si, 0x1fbe8(%rax,%rdx,2)
movw %si, 0x1fbea(%rax,%rdx,2)
movw %si, 0x1fcb0(%rax,%rdx,2)
movw %si, 0x1fcb2(%rax,%rdx,2)
movl 0x20(%rsp), %esi
incq %rcx
jmp 0x1ebc6
movw $0x50, %di
xorl %r15d, %r15d
movl 0x30(%rsp), %eax
cmpq $0x4, %r15
je 0x1ede7
cmpw $0x0, 0x10(%rsp,%r15,2)
je 0x1eddd
movzwl 0x48(%rsp,%r15,2), %ebp
movq (%rbx), %rcx
movl %ebp, %eax
xorl %edx, %edx
movw $0x64, %r8w
divw %r8w
movl %eax, %r13d
movzwl %ax, %r12d
imulq $0x4b0, %r12, %rax      # imm = 0x4B0
addq %rcx, %rax
movq %rdx, 0x28(%rsp)
movzwl %dx, %r10d
imulq $0xc, %r10, %rdx
cmpb $0x0, 0xc(%rdx,%rax)
movzwl %di, %r14d
movl %edi, (%rsp)
jns 0x1eca2
movzwl 0x40(%rsp,%r15,2), %ecx
movq %rbx, %rdi
movl %r10d, %esi
movl %r12d, %edx
xorl %r8d, %r8d
movl %r14d, %r9d
movq %r13, 0x38(%rsp)
movq %r10, %r13
callq 0x1f424
movq %r13, %r10
movq 0x38(%rsp), %r13
movw $0x64, %r8w
movl (%rsp), %edi
movl 0x20(%rsp), %esi
movq (%rbx), %rcx
leal 0x1(%rbp), %eax
xorl %edx, %edx
divw %r8w
movzwl %ax, %eax
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rcx, %rax
movzwl %dx, %edx
imulq $0xc, %rdx, %rdx
cmpb $0x0, 0xc(%rdx,%rax)
jns 0x1ecfc
movq 0x28(%rsp), %rax
incl %eax
movzwl %ax, %esi
movzwl 0x40(%rsp,%r15,2), %ecx
movq %rbx, %rdi
movl %r12d, %edx
xorl %r8d, %r8d
movl %r14d, %r9d
movq %r10, %r12
callq 0x1f424
movq %r12, %r10
movw $0x64, %r8w
movl (%rsp), %edi
movl 0x20(%rsp), %esi
movq (%rbx), %rcx
leal 0x64(%rbp), %eax
xorl %edx, %edx
divw %r8w
movzwl %ax, %eax
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rcx, %rax
movzwl %dx, %edx
imulq $0xc, %rdx, %rdx
cmpb $0x0, 0xc(%rdx,%rax)
jns 0x1ed4d
leal 0x1(%r13), %eax
movzwl %ax, %edx
movzwl 0x40(%rsp,%r15,2), %ecx
movq %rbx, %rdi
movl %r10d, %esi
xorl %r8d, %r8d
movl %r14d, %r9d
callq 0x1f424
movw $0x64, %r8w
movl (%rsp), %edi
movl 0x20(%rsp), %esi
movq (%rbx), %rcx
addl $0x65, %ebp
movl %ebp, %eax
xorl %edx, %edx
movw $0x64, %r12w
divw %r8w
movzwl %ax, %eax
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rcx, %rax
movzwl %dx, %edx
imulq $0xc, %rdx, %rdx
cmpb $0x0, 0xc(%rdx,%rax)
js 0x1ed80
movzwl 0x40(%rsp,%r15,2), %ebp
jmp 0x1edb8
movq 0x28(%rsp), %rsi
incl %esi
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %esi
incl %r13d
andl %eax, %r13d
movzwl 0x40(%rsp,%r15,2), %ebp
movzwl %bp, %ecx
movq %rbx, %rdi
movl %r13d, %edx
xorl %r8d, %r8d
movl %r14d, %r9d
callq 0x1f424
movl (%rsp), %edi
movl 0x20(%rsp), %esi
movq (%rbx), %rcx
movl %ebp, %eax
xorl %edx, %edx
divw %r12w
movzwl %ax, %eax
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rcx, %rax
movzwl %dx, %ecx
imulq $0xc, %rcx, %rcx
movb %dil, 0xc(%rcx,%rax)
movl 0x30(%rsp), %eax
incq %r15
incl %edi
jmp 0x1ec10
incl %esi
jmp 0x1e246
movl 0x4(%rcx), %eax
xorl %edx, %edx
testl %eax, %eax
movl $0x0, %esi
cmovgl %eax, %esi
xorl %edi, %edi
xorl %r8d, %r8d
cmpq %rsi, %r8
je 0x1ee31
movl (%rcx), %r9d
testl %r9d, %r9d
cmovlel %edx, %r9d
movq %rdi, %r10
subq $0x1, %r9
jb 0x1ee28
movw %r10w, 0x1fbe8(%rcx,%r10,2)
incq %r10
jmp 0x1ee14
incq %r8
addq $0x64, %rdi
jmp 0x1ee02
pushq $-0xc
popq %r13
movq $-0x4b0, %rdi           # imm = 0xFB50
movq $-0x4b0, %rsi           # imm = 0xFB50
xorl %r11d, %r11d
xorl %ebp, %ebp
movslq %eax, %rdx
cmpq %rdx, %rbp
jge 0x1f0e7
imulq $0x64, %rbp, %rax
movq %rax, 0x38(%rsp)
imulq $0x4b0, %rbp, %rax      # imm = 0x4B0
movq %rax, 0x28(%rsp)
movq %rsi, 0x68(%rsp)
movq %rsi, (%rsp)
movq %r13, 0x8(%rsp)
movq %r11, 0x60(%rsp)
xorl %r8d, %r8d
movslq (%rcx), %rax
cmpq %rax, %r8
jge 0x1f0bf
movq 0x28(%rsp), %rax
leaq (%rcx,%rax), %r9
addq $0xc, %r9
imulq $0xc, %r8, %rax
cmpb $0x0, (%rax,%r9)
js 0x1f0a7
addq %rax, %r9
movq 0x38(%rsp), %rax
addq %r8, %rax
movzwl 0x1fbe8(%rcx,%rax,2), %edx
movswq 0x2(%r9), %rsi
movzwl 0x1fbe8(%rcx,%rsi,2), %esi
movw %si, 0x1fbe8(%rcx,%rax,2)
movswq 0x2(%r9), %rax
movw %dx, 0x1fbe8(%rcx,%rax,2)
movzwl 0x2(%r9), %eax
xorl %edx, %edx
movw $0x64, %si
divw %si
leaq 0xc(%rcx), %rsi
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
movzbl (%rdx,%rax), %eax
movb %al, (%r9)
cmpb $0x50, %al
pushq $0x10
popq %rdx
cmovgel %edx, %eax
movb %al, 0x1(%r9)
movq %r13, %r10
movq %r11, %rax
xorl %r15d, %r15d
pushq $-0x1
popq %rdx
movq %r10, %rsi
leaq (%r8,%r15), %r10
testq %r10, %r10
jle 0x1efd2
movq %r15, %r14
movzbl (%rcx,%rax), %r12d
incq %rdx
decq %r15
addq $-0xc, %rax
leaq -0xc(%rsi), %r10
cmpl $0xff, %r12d
je 0x1ef21
cmpl $0xfe, %r12d
je 0x1efd2
negb %r15b
movb %r15b, 0x6(%r9)
movq (%rbx), %rcx
movb %r15b, 0x10(%rcx,%rax)
movq %r8, %rcx
subq %rdx, %rcx
negb %r14b
movb $0x1, %r15b
cmpq %r8, %rcx
jge 0x1efac
movq (%rbx), %r10
movb %r14b, 0x1c(%r10,%rsi)
movq (%rbx), %r10
movb %r15b, 0x1e(%r10,%rsi)
movb 0xa(%r9), %r10b
movq (%rbx), %r12
movb %r10b, 0x20(%r12,%rsi)
movq (%rbx), %r12
movb %r10b, 0x22(%r12,%rsi)
incq %rcx
decb %r14b
incb %r15b
addq $0xc, %rsi
jmp 0x1ef74
movq (%rbx), %rcx
movzwl 0xe(%rcx,%rax), %ecx
cmpw 0x2(%r9), %cx
sete %cl
testl %edx, %edx
sete %dl
testb %dl, %cl
je 0x1efd2
movb $0x3, %dl
movb %dl, 0xa(%r9)
movq (%rbx), %rcx
movb %dl, 0x14(%rcx,%rax)
movq (%rbx), %r14
movq (%rsp), %rsi
movq %r11, %rax
xorl %r15d, %r15d
pushq $-0x1
popq %rcx
movq %rsi, %r10
leaq (%r15,%rbp), %rsi
testq %rsi, %rsi
jle 0x1f0a7
movq %r15, %rdx
movzbl -0x4a4(%r14,%rax), %r12d
incq %rcx
decq %r15
addq %rdi, %rax
leaq (%r10,%rdi), %rsi
cmpl $0xff, %r12d
je 0x1efe2
cmpl $0xfe, %r12d
je 0x1f0a7
negb %r15b
movb %r15b, 0x5(%r9)
movq (%rbx), %rsi
movb %r15b, 0x13(%rsi,%rax)
movq %rbp, %r14
subq %rcx, %r14
negb %dl
movb $0x1, %r15b
cmpq %rbp, %r14
jge 0x1f081
movq (%rbx), %rsi
movb %r15b, 0x4c1(%rsi,%r10)
movq (%rbx), %rsi
movb %dl, 0x4c3(%rsi,%r10)
movb 0x9(%r9), %sil
movq (%rbx), %r12
movb %sil, 0x4c5(%r12,%r10)
movq (%rbx), %r12
movb %sil, 0x4c7(%r12,%r10)
incq %r14
incb %r15b
decb %dl
addq $0x4b0, %r10            # imm = 0x4B0
jmp 0x1f03b
movq (%rbx), %rdx
movzwl 0xe(%rdx,%rax), %edx
cmpw 0x2(%r9), %dx
sete %dl
testl %ecx, %ecx
sete %cl
testb %cl, %dl
je 0x1f0a7
movb $0x3, %dl
movb %dl, 0x9(%r9)
movq (%rbx), %rcx
movb %dl, 0x17(%rcx,%rax)
incq %r8
movq (%rbx), %rcx
addq $0xc, %r11
addq $0xc, %r13
addq $0xc, (%rsp)
jmp 0x1ee7f
incq %rbp
movl 0x4(%rcx), %eax
movl $0x4b0, %edx            # imm = 0x4B0
movq 0x60(%rsp), %r11
addq %rdx, %r11
movq 0x8(%rsp), %r13
addq %rdx, %r13
movq 0x68(%rsp), %rsi
addq %rdx, %rsi
jmp 0x1ee48
movw $0x64, %r13w
xorl %edx, %edx
cltq
cmpq %rax, %rdx
jge 0x1f228
imulq $0x64, %rdx, %rsi
movq %rdx, 0x8(%rsp)
imulq $0x4b0, %rdx, %rdi      # imm = 0x4B0
xorl %r8d, %r8d
movq %rsi, 0x28(%rsp)
movq %rdi, 0x38(%rsp)
movslq (%rcx), %rax
cmpq %rax, %r8
jge 0x1f218
leaq (%rcx,%rdi), %rax
imulq $0xc, %r8, %rdx
cmpb $0x0, 0xc(%rdx,%rax)
js 0x1f210
leaq (%r8,%rsi), %r12
movswq 0x1fbe8(%rcx,%r12,2), %rax
movl %eax, %eax
cmpq %rax, %r12
je 0x1f210
movq %r8, (%rsp)
xorl %ebp, %ebp
movl %r12d, %r15d
pushq $-0x1
popq %r14
movl %r15d, %eax
xorl %edx, %edx
divw %r13w
movzwl %ax, %eax
imulq $0x4b0, %rax, %rsi      # imm = 0x4B0
addq %rcx, %rsi
movzwl %dx, %eax
imulq $0xc, %rax, %rdx
movb 0x14(%rdx,%rsi), %al
cmpb $0x50, 0xc(%rdx,%rsi)
movb 0x17(%rdx,%rsi), %dl
jl 0x1f191
xorb $0x3, %dl
xorb $0x3, %al
orb %dl, %al
je 0x1f1a2
jmp 0x1f1b9
cmpb $0x3, %dl
sete %dl
cmpb $0x3, %al
sete %al
orb %dl, %al
cmpb $0x1, %al
jne 0x1f1b9
incl %ebp
movq 0x18(%rsp), %rdi
movl %ebp, %esi
callq 0x12438
testl %eax, %eax
cmovel %r15d, %r14d
movq (%rbx), %rcx
movslq %r15d, %rax
movswl 0x1fbe8(%rcx,%rax,2), %r15d
cmpq %r15, %r12
jne 0x1f15a
leaq 0xc(%rcx), %rsi
movl %r15d, %eax
xorl %edx, %edx
divw %r13w
movzwl %ax, %eax
movzwl %dx, %edx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
addq %rsi, %rax
imulq $0xc, %rdx, %rdx
movw %r14w, 0x2(%rdx,%rax)
movslq %r15d, %rax
movswl 0x1fbe8(%rcx,%rax,2), %r15d
cmpq %r15, %r12
jne 0x1f1ce
movq 0x28(%rsp), %rsi
movq 0x38(%rsp), %rdi
movq (%rsp), %r8
incq %r8
jmp 0x1f116
movq 0x8(%rsp), %rdx
incq %rdx
movl 0x4(%rcx), %eax
jmp 0x1f0ee
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq