// File: 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
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x118(%rbp)
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
callq 0x2fcb0
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rcx
movzbl (%rcx), %edx
movq (%rax), %rcx
movl %edx, (%rcx)
movq 0x8(%rax), %rcx
movzbl 0x1(%rcx), %edx
movq (%rax), %rcx
movl %edx, 0x4(%rcx)
movq (%rax), %rax
movl $0x0, 0x8(%rax)
movl $0x0, -0x14(%rbp)
movq -0x118(%rbp), %rcx
movl -0x14(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x50370
movl $0x0, -0x18(%rbp)
movq -0x118(%rbp), %rcx
movl -0x18(%rbp), %eax
movq (%rcx), %rcx
cmpl (%rcx), %eax
jge 0x50360
movq -0x118(%rbp), %rax
movq (%rax), %rcx
addq $0xc, %rcx
movslq -0x14(%rbp), %rdx
imulq $0x4b0, %rdx, %rdx      # imm = 0x4B0
addq %rdx, %rcx
movslq -0x18(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rcx
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movb $-0x1, (%rcx)
movq -0x20(%rbp), %rcx
movb $0x0, 0x1(%rcx)
imull $0x64, -0x14(%rbp), %ecx
addl -0x18(%rbp), %ecx
movw %cx, %dx
movq -0x20(%rbp), %rcx
movw %dx, 0x2(%rcx)
movq -0x20(%rbp), %rcx
movb $-0x1, 0x4(%rcx)
movq -0x20(%rbp), %rcx
movb $-0x1, 0x5(%rcx)
movq -0x20(%rbp), %rcx
movb $-0x1, 0x6(%rcx)
movq -0x20(%rbp), %rcx
movb $-0x1, 0x7(%rcx)
movq -0x20(%rbp), %rcx
movb $0x0, 0x8(%rcx)
movq -0x20(%rbp), %rcx
movb $0x0, 0x9(%rcx)
movq -0x20(%rbp), %rcx
movb $0x0, 0xa(%rcx)
movq -0x20(%rbp), %rcx
movb $0x0, 0xb(%rcx)
movq (%rax), %rax
imull $0x64, -0x14(%rbp), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movw $0x0, 0x1fbe8(%rax,%rcx,2)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x5029a
jmp 0x50362
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5027d
movq -0x118(%rbp), %rax
movq (%rax), %rcx
movw $0xffff, 0x1d4d0(%rcx)  # imm = 0xFFFF
movq (%rax), %rcx
movw $0xffff, 0x1d4d2(%rcx)  # imm = 0xFFFF
movq (%rax), %rcx
movw $0xffff, 0x1d4d4(%rcx)  # imm = 0xFFFF
movq (%rax), %rcx
movw $0xffff, 0x1d4d6(%rcx)  # imm = 0xFFFF
movq 0x8(%rax), %rax
testb $0x1, 0xb(%rax)
jne 0x5043c
movq -0x118(%rbp), %rax
movq %rax, %rdi
addq $0x10, %rdi
movq 0x8(%rax), %rax
movzbl (%rax), %esi
callq 0x2fe60
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, -0x24(%rbp)
movq %rax, %rdi
addq $0x10, %rdi
movq 0x8(%rax), %rax
movzbl 0x1(%rax), %esi
callq 0x2fe60
movq -0x118(%rbp), %rdi
movl %eax, -0x28(%rbp)
imull $0x64, -0x28(%rbp), %eax
addl -0x24(%rbp), %eax
movw %ax, %cx
movq (%rdi), %rax
movw %cx, 0x1d4ce(%rax)
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
imull $0x64, -0x28(%rbp), %eax
addl -0x24(%rbp), %eax
xorl %r8d, %r8d
movl $0x3, %r9d
movzwl %ax, %ecx
callq 0x52600
movq -0x118(%rbp), %rax
movq (%rax), %rax
movb $0x0, 0x1d4cc(%rax)
movq -0x118(%rbp), %rax
movl $0x0, -0x2c(%rbp)
movl $0x1, -0x30(%rbp)
movq 0x8(%rax), %rax
testb $0x1, 0xb(%rax)
je 0x507d9
movq -0x118(%rbp), %rdi
addq $0x10, %rdi
movl $0x3, %esi
callq 0x2fe60
addl $0x2, %eax
movl %eax, -0x2c(%rbp)
movl 0x1617c(%rip), %eax     # 0x665fc
movl %eax, -0x34(%rbp)
movl $0x4, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jle 0x504e0
movq -0x118(%rbp), %rdi
movl -0x38(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
addq $0x10, %rdi
movl -0x38(%rbp), %esi
callq 0x2fe60
movl %eax, -0x40(%rbp)
movslq -0x3c(%rbp), %rax
movb -0x34(%rbp,%rax), %al
movb %al, -0x41(%rbp)
movslq -0x40(%rbp), %rax
movb -0x34(%rbp,%rax), %cl
movslq -0x3c(%rbp), %rax
movb %cl, -0x34(%rbp,%rax)
movb -0x41(%rbp), %cl
movslq -0x40(%rbp), %rax
movb %cl, -0x34(%rbp,%rax)
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5048a
movq -0x118(%rbp), %rax
movq (%rax), %rcx
movb $0x1, 0x1d4cc(%rcx)
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0x7, %eax
jl 0x50511
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
movzbl 0x1(%rax), %eax
cmpl $0x7, %eax
jge 0x50518
movl $0x2, -0x2c(%rbp)
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0x3, %eax
jl 0x5053f
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
movzbl 0x1(%rax), %eax
cmpl $0x3, %eax
jge 0x50546
movl $0x1, -0x2c(%rbp)
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0x5, %eax
jge 0x50574
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
movzbl 0x1(%rax), %eax
cmpl $0x5, %eax
jge 0x50574
movl $0x1, -0x2c(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x507d7
jmp 0x50589
movq -0x118(%rbp), %rax
movq %rax, %rdi
addq $0x10, %rdi
movq 0x8(%rax), %rax
movzbl (%rax), %esi
subl $0x1, %esi
callq 0x2fe60
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, -0x4c(%rbp)
movq %rax, %rdi
addq $0x10, %rdi
movq 0x8(%rax), %rax
movzbl 0x1(%rax), %esi
subl $0x1, %esi
callq 0x2fe60
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, -0x50(%rbp)
movq (%rax), %rax
imull $0x64, -0x50(%rbp), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x1, %eax
jg 0x507c2
movq -0x118(%rbp), %rax
movq (%rax), %rax
imull $0x64, -0x50(%rbp), %ecx
addl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x1, %eax
jg 0x507c2
movq -0x118(%rbp), %rax
movq (%rax), %rax
imull $0x64, -0x50(%rbp), %ecx
addl -0x4c(%rbp), %ecx
addl $0x64, %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x1, %eax
jg 0x507c2
movq -0x118(%rbp), %rax
movq (%rax), %rax
imull $0x64, -0x50(%rbp), %ecx
addl -0x4c(%rbp), %ecx
addl $0x65, %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x1, %eax
jg 0x507c2
movq -0x118(%rbp), %rdi
movl -0x4c(%rbp), %esi
movl -0x50(%rbp), %edx
imull $0x64, -0x50(%rbp), %eax
addl -0x4c(%rbp), %eax
movw %ax, %cx
movslq -0x48(%rbp), %rax
movzbl -0x34(%rbp,%rax), %eax
xorl %r8d, %r8d
movzwl %cx, %ecx
movzwl %ax, %r9d
callq 0x52600
movq -0x118(%rbp), %rdi
movl -0x4c(%rbp), %esi
addl $0x1, %esi
movl -0x50(%rbp), %edx
imull $0x64, -0x50(%rbp), %eax
addl -0x4c(%rbp), %eax
movw %ax, %cx
movslq -0x48(%rbp), %rax
movzbl -0x34(%rbp,%rax), %eax
xorl %r8d, %r8d
movzwl %cx, %ecx
movzwl %ax, %r9d
callq 0x52600
movq -0x118(%rbp), %rdi
movl -0x4c(%rbp), %esi
movl -0x50(%rbp), %edx
addl $0x1, %edx
imull $0x64, -0x50(%rbp), %eax
addl -0x4c(%rbp), %eax
movw %ax, %cx
movslq -0x48(%rbp), %rax
movzbl -0x34(%rbp,%rax), %eax
xorl %r8d, %r8d
movzwl %cx, %ecx
movzwl %ax, %r9d
callq 0x52600
movq -0x118(%rbp), %rdi
movl -0x4c(%rbp), %esi
addl $0x1, %esi
movl -0x50(%rbp), %edx
addl $0x1, %edx
imull $0x64, -0x50(%rbp), %eax
addl -0x4c(%rbp), %eax
movw %ax, %cx
movslq -0x48(%rbp), %rax
movzbl -0x34(%rbp,%rax), %eax
xorl %r8d, %r8d
movzwl %cx, %ecx
movzwl %ax, %r9d
callq 0x52600
movq -0x118(%rbp), %rax
movslq -0x48(%rbp), %rcx
movb -0x34(%rbp,%rcx), %dl
movq (%rax), %rcx
addq $0xc, %rcx
movslq -0x50(%rbp), %rsi
imulq $0x4b0, %rsi, %rsi      # imm = 0x4B0
addq %rsi, %rcx
movslq -0x4c(%rbp), %rsi
imulq $0xc, %rsi, %rsi
addq %rsi, %rcx
movb %dl, (%rcx)
movslq -0x48(%rbp), %rcx
movzbl -0x34(%rbp,%rcx), %ecx
movw %cx, %si
movq (%rax), %rcx
imull $0x64, -0x50(%rbp), %edx
addl -0x4c(%rbp), %edx
movslq %edx, %rdx
movw %si, 0x1fbe8(%rcx,%rdx,2)
imull $0x64, -0x50(%rbp), %ecx
addl -0x4c(%rbp), %ecx
movw %cx, %dx
movq (%rax), %rcx
movw %dx, 0x1d4ce(%rcx)
imull $0x64, -0x50(%rbp), %ecx
addl -0x4c(%rbp), %ecx
movw %cx, %dx
movq (%rax), %rax
movslq -0x48(%rbp), %rcx
movzbl -0x34(%rbp,%rcx), %ecx
subl $0x50, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movw %dx, 0x1d4ce(%rax,%rcx,2)
jmp 0x507c7
jmp 0x50589
jmp 0x507c9
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x5057b
jmp 0x507d9
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
testb $0x1, 0x9(%rax)
je 0x508c7
movl $0x0, -0x54(%rbp)
movq -0x118(%rbp), %rcx
movl -0x54(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x508c5
movl $0x0, -0x58(%rbp)
movq -0x118(%rbp), %rcx
movl -0x58(%rbp), %eax
movq (%rcx), %rcx
cmpl (%rcx), %eax
jge 0x508b5
movq -0x118(%rbp), %rdi
addq $0x10, %rdi
movl $0x64, %esi
callq 0x2fe60
cmpl $0x3, %eax
jbe 0x50843
jmp 0x508a7
movq -0x118(%rbp), %rax
movq (%rax), %rax
imull $0x64, -0x54(%rbp), %ecx
addl -0x58(%rbp), %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x3, %eax
jl 0x50866
jmp 0x508a7
movq -0x118(%rbp), %rax
movq (%rax), %rcx
imull $0x64, -0x54(%rbp), %edx
addl -0x58(%rbp), %edx
movslq %edx, %rdx
movw $0x3, 0x1fbe8(%rcx,%rdx,2)
movq (%rax), %rax
addq $0xc, %rax
movslq -0x54(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0x58(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movb $-0x2, (%rax)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x50812
jmp 0x508b7
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x507f5
jmp 0x508c7
movq -0x118(%rbp), %rdi
movq 0x8(%rdi), %rax
movzbl (%rax), %eax
movq 0x8(%rdi), %rcx
movzbl 0x1(%rcx), %ecx
imull %ecx, %eax
cvtsi2ss %eax, %xmm0
movq 0x8(%rdi), %rax
mulss 0x4(%rax), %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x11c(%rbp)
addq $0x10, %rdi
movl $0x64, %esi
callq 0x2fe60
movl %eax, %ecx
movl -0x11c(%rbp), %eax
addl $0x32, %ecx
imull %ecx, %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x5c(%rbp)
cmpl $0x4, -0x5c(%rbp)
jge 0x50932
movl $0x4, -0x5c(%rbp)
jmp 0x50934
movq -0x118(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
cmpl -0x5c(%rbp), %eax
jge 0x5189f
movq -0x118(%rbp), %rax
movq %rax, %rdi
addq $0x10, %rdi
movq 0x8(%rax), %rcx
movzbl (%rcx), %esi
movq 0x8(%rax), %rax
movzbl 0x1(%rax), %eax
imull %eax, %esi
callq 0x2fe60
movq -0x118(%rbp), %rdi
movl %eax, -0x60(%rbp)
movq 0x8(%rdi), %rax
movzbl (%rax), %esi
movq 0x8(%rdi), %rax
movzbl 0x1(%rax), %eax
imull %eax, %esi
callq 0x52b10
movl %eax, -0x64(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x118(%rbp), %rdi
movl -0x68(%rbp), %eax
movq 0x8(%rdi), %rcx
movzbl (%rcx), %ecx
cltd
idivl %ecx
movw %ax, -0x6a(%rbp)
movl -0x68(%rbp), %eax
movq 0x8(%rdi), %rcx
movzbl (%rcx), %ecx
cltd
idivl %ecx
movw %dx, %ax
movw %ax, -0x6c(%rbp)
movzwl -0x6c(%rbp), %esi
movzwl -0x6a(%rbp), %edx
callq 0x52b70
testb $0x1, %al
jne 0x509d8
jmp 0x509dd
jmp 0x50a61
movq -0x118(%rbp), %rax
movq (%rax), %rax
movzwl -0x6a(%rbp), %ecx
imull $0x64, %ecx, %ecx
movzwl -0x6c(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x1, %eax
jne 0x50a28
movq -0x118(%rbp), %rax
movq (%rax), %rax
movzwl -0x6a(%rbp), %ecx
imull $0x64, %ecx, %ecx
movzwl -0x6c(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movw $0x0, 0x1fbe8(%rax,%rcx,2)
jmp 0x50a2a
movq -0x118(%rbp), %rdx
movl -0x68(%rbp), %eax
addl -0x64(%rbp), %eax
movq 0x8(%rdx), %rcx
movzbl (%rcx), %ecx
movq 0x8(%rdx), %rdx
movzbl 0x1(%rdx), %edx
imull %edx, %ecx
cltd
idivl %ecx
movl %edx, -0x68(%rbp)
movl -0x68(%rbp), %eax
cmpl -0x60(%rbp), %eax
jne 0x50a5c
jmp 0x518a1
jmp 0x50999
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
testb $0x1, 0xb(%rax)
je 0x5189a
movl -0x2c(%rbp), %eax
imull -0x30(%rbp), %eax
cmpl $0x4, %eax
jg 0x5189a
leaq -0x74(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x4170
movl $0x0, -0x88(%rbp)
movq -0x118(%rbp), %rcx
movl -0x88(%rbp), %eax
movq 0x8(%rcx), %rcx
movzbl 0x1(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x513d7
movl $0x0, -0x8c(%rbp)
movq -0x118(%rbp), %rcx
movl -0x8c(%rbp), %eax
movq 0x8(%rcx), %rcx
movzbl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x513c1
movq -0x118(%rbp), %rax
imull $0x64, -0x88(%rbp), %ecx
addl -0x8c(%rbp), %ecx
movw %cx, -0x8e(%rbp)
movw $0xffff, -0x90(%rbp)    # imm = 0xFFFF
movq (%rax), %rdi
movzwl -0x8e(%rbp), %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50b32
movw -0x8e(%rbp), %ax
movw %ax, -0x90(%rbp)
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50b67
movzwl -0x8e(%rbp), %eax
addl $0x1, %eax
movw %ax, -0x90(%rbp)
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x64, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50b9c
movzwl -0x8e(%rbp), %eax
addl $0x64, %eax
movw %ax, -0x90(%rbp)
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x65, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50bd1
movzwl -0x8e(%rbp), %eax
addl $0x65, %eax
movw %ax, -0x90(%rbp)
movzwl -0x90(%rbp), %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x50be4
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x90(%rbp), %esi
callq 0x4e8e0
movq %rax, %rcx
movq -0x118(%rbp), %rax
movw 0x2(%rcx), %cx
movw %cx, -0x90(%rbp)
movq (%rax), %rdi
movzwl -0x90(%rbp), %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x50, %eax
jl 0x50c2b
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rax
movzwl -0x8e(%rbp), %ecx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x3, %eax
jl 0x50c73
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
je 0x50c73
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rax
movzwl -0x8e(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x3, %eax
jl 0x50cc7
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
je 0x50cc7
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rax
movzwl -0x8e(%rbp), %ecx
addl $0x64, %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x3, %eax
jl 0x50d1b
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x64, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
je 0x50d1b
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rax
movzwl -0x8e(%rbp), %ecx
addl $0x65, %ecx
movslq %ecx, %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl $0x3, %eax
jl 0x50d6f
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x65, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
je 0x50d6f
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50db7
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
je 0x50db7
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50e0b
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
je 0x50e0b
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x64, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50e5f
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x64, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
je 0x50e5f
jmp 0x513ad
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x65, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50eb3
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x65, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
je 0x50eb3
jmp 0x513ad
cmpl $0x0, -0x8c(%rbp)
jle 0x50f10
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
subl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50f10
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
subl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jne 0x50f10
jmp 0x513ad
cmpl $0x0, -0x8c(%rbp)
jle 0x50f73
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x64, %eax
subl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50f73
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x64, %eax
subl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jne 0x50f73
jmp 0x513ad
cmpl $0x0, -0x88(%rbp)
jle 0x50fd0
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
subl $0x64, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x50fd0
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
subl $0x64, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jne 0x50fd0
jmp 0x513ad
cmpl $0x0, -0x88(%rbp)
jle 0x51033
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
subl $0x64, %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x51033
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
subl $0x64, %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jne 0x51033
jmp 0x513ad
movq -0x118(%rbp), %rcx
movl -0x8c(%rbp), %eax
movq (%rcx), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x510a0
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x2, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x510a0
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x2, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jne 0x510a0
jmp 0x513ad
movq -0x118(%rbp), %rcx
movl -0x8c(%rbp), %eax
movq (%rcx), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5110d
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x66, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x5110d
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0x66, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jne 0x5110d
jmp 0x513ad
movq -0x118(%rbp), %rcx
movl -0x88(%rbp), %eax
movq (%rcx), %rcx
movl 0x4(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x5117f
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0xc8, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x5117f
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0xc8, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jne 0x5117f
jmp 0x513ad
movq -0x118(%rbp), %rcx
movl -0x88(%rbp), %eax
movq (%rcx), %rcx
movl 0x4(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x511f1
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0xc9, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jl 0x511f1
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x8e(%rbp), %eax
addl $0xc9, %eax
movzwl %ax, %esi
callq 0x4e8e0
movswl 0x2(%rax), %eax
movzwl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jne 0x511f1
jmp 0x513ad
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rax
testb $0x1, 0xc(%rax)
jne 0x5131d
movl $0x0, -0x94(%rbp)
cmpl $0x4, -0x94(%rbp)
jge 0x5131b
movzwl -0x8e(%rbp), %eax
movslq -0x94(%rbp), %rdx
leaq 0x153f7(%rip), %rcx     # 0x66629
movsbl (%rcx,%rdx), %ecx
addl %ecx, %eax
movw %ax, -0x96(%rbp)
movl $0x0, -0x9c(%rbp)
cmpl $0x4, -0x9c(%rbp)
jge 0x51305
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0x96(%rbp), %esi
callq 0x4e8e0
movslq -0x9c(%rbp), %rcx
movb 0x4(%rax,%rcx), %al
movb %al, -0x9d(%rbp)
movsbl -0x9d(%rbp), %eax
cmpl $-0x1, %eax
jne 0x5128b
jmp 0x512f1
movq -0x118(%rbp), %rax
movzwl -0x96(%rbp), %ecx
movsbl -0x9d(%rbp), %edx
movslq -0x9c(%rbp), %rdi
leaq 0x1537f(%rip), %rsi     # 0x6662d
movsbl (%rsi,%rdi), %esi
imull %esi, %edx
addl %edx, %ecx
movw %cx, -0xa0(%rbp)
movq (%rax), %rdi
movzwl -0xa0(%rbp), %esi
callq 0x4e8e0
movq -0x118(%rbp), %rcx
movsbl (%rax), %eax
movq (%rcx), %rcx
movzwl -0x90(%rbp), %edx
movswl 0x1fbe8(%rcx,%rdx,2), %ecx
cmpl %ecx, %eax
jne 0x512ef
jmp 0x51327
jmp 0x512f1
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x51249
jmp 0x51307
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x51210
jmp 0x5131d
xorl %eax, %eax
testb $0x1, %al
jne 0x51325
jmp 0x5132c
jmp 0x51327
jmp 0x513ad
movq -0x118(%rbp), %rdi
movq (%rdi), %rax
movzwl -0x90(%rbp), %ecx
movw 0x1fbe8(%rax,%rcx,2), %ax
movw %ax, -0xa2(%rbp)
addq $0x10, %rdi
movzwl -0xa2(%rbp), %eax
subl $0x50, %eax
movslq %eax, %rcx
movw -0x74(%rbp,%rcx,2), %ax
addw $0x1, %ax
movw %ax, -0x74(%rbp,%rcx,2)
movzwl %ax, %esi
callq 0x2fe60
cmpl $0x0, %eax
je 0x5137a
jmp 0x513ad
movw -0x8e(%rbp), %cx
movzwl -0xa2(%rbp), %eax
subl $0x50, %eax
cltq
movw %cx, -0x7c(%rbp,%rax,2)
movw -0x90(%rbp), %cx
movzwl -0xa2(%rbp), %eax
subl $0x50, %eax
cltq
movw %cx, -0x84(%rbp,%rax,2)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x50aca
jmp 0x513c3
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x50aa0
cmpw $0x0, -0x74(%rbp)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpw $0x0, -0x72(%rbp)
setne %cl
xorb $-0x1, %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
cmpw $0x0, -0x70(%rbp)
setne %cl
xorb $-0x1, %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
cmpw $0x0, -0x6e(%rbp)
setne %cl
xorb $-0x1, %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
cmpl -0x2c(%rbp), %eax
jne 0x51898
movl $0x0, -0xa8(%rbp)
cmpl $0x4, -0xa8(%rbp)
jge 0x51547
movl $0x0, -0xac(%rbp)
cmpl $0x4, -0xac(%rbp)
jge 0x51531
movslq -0xa8(%rbp), %rax
movzwl -0x74(%rbp,%rax,2), %eax
cmpl $0x0, %eax
jne 0x51477
jmp 0x5151d
movslq -0xac(%rbp), %rax
movzwl -0x74(%rbp,%rax,2), %eax
cmpl $0x0, %eax
jne 0x5148d
jmp 0x5151d
movslq -0xa8(%rbp), %rax
movw -0x7c(%rbp,%rax,2), %ax
movw %ax, -0xae(%rbp)
movslq -0xac(%rbp), %rax
movw -0x7c(%rbp,%rax,2), %ax
movw %ax, -0xb0(%rbp)
movzwl -0xae(%rbp), %eax
movzwl -0xb0(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x514cd
jmp 0x51896
movzwl -0xae(%rbp), %eax
movzwl -0xb0(%rbp), %ecx
addl $0x65, %ecx
cmpl %ecx, %eax
jne 0x514e7
jmp 0x51896
movzwl -0xae(%rbp), %eax
movzwl -0xb0(%rbp), %ecx
addl $0x64, %ecx
cmpl %ecx, %eax
jne 0x51501
jmp 0x51896
movzwl -0xae(%rbp), %eax
movzwl -0xb0(%rbp), %ecx
addl $0x63, %ecx
cmpl %ecx, %eax
jne 0x5151b
jmp 0x51896
jmp 0x5151d
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x51454
jmp 0x51533
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x5143d
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0xb4(%rbp)
cmpl $0x4, -0xb4(%rbp)
jge 0x51635
movslq -0xb4(%rbp), %rax
movw -0x7c(%rbp,%rax,2), %ax
movw %ax, -0xb6(%rbp)
movslq -0xb4(%rbp), %rax
movzwl -0x74(%rbp,%rax,2), %eax
cmpl $0x0, %eax
jne 0x51590
jmp 0x51621
movq -0x118(%rbp), %rax
movl -0xb4(%rbp), %ecx
addl $0x50, %ecx
movw %cx, %si
movq (%rax), %rcx
movzwl -0xb6(%rbp), %edx
movw %si, 0x1fbe8(%rcx,%rdx,2)
movl -0xb4(%rbp), %ecx
addl $0x50, %ecx
movw %cx, %si
movq (%rax), %rcx
movzwl -0xb6(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movw %si, 0x1fbe8(%rcx,%rdx,2)
movl -0xb4(%rbp), %ecx
addl $0x50, %ecx
movw %cx, %si
movq (%rax), %rcx
movzwl -0xb6(%rbp), %edx
addl $0x64, %edx
movslq %edx, %rdx
movw %si, 0x1fbe8(%rcx,%rdx,2)
movl -0xb4(%rbp), %ecx
addl $0x50, %ecx
movw %cx, %dx
movq (%rax), %rax
movzwl -0xb6(%rbp), %ecx
addl $0x65, %ecx
movslq %ecx, %rcx
movw %dx, 0x1fbe8(%rax,%rcx,2)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x5155a
movl $0x0, -0xbc(%rbp)
cmpl $0x4, -0xbc(%rbp)
jge 0x51894
movslq -0xbc(%rbp), %rax
movw -0x7c(%rbp,%rax,2), %ax
movw %ax, -0xbe(%rbp)
movslq -0xbc(%rbp), %rax
movzwl -0x74(%rbp,%rax,2), %eax
cmpl $0x0, %eax
jne 0x51675
jmp 0x51880
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0xbe(%rbp), %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jge 0x516e3
movq -0x118(%rbp), %rdi
movzwl -0xbe(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %edx, %esi
movzwl -0xbe(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %edx
movslq -0xbc(%rbp), %rax
movw -0x84(%rbp,%rax,2), %cx
movl -0xbc(%rbp), %eax
addl $0x50, %eax
xorl %r8d, %r8d
movzwl %cx, %ecx
movzwl %ax, %r9d
callq 0x52600
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0xbe(%rbp), %eax
addl $0x1, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jge 0x5175a
movq -0x118(%rbp), %rdi
movzwl -0xbe(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %edx, %esi
addl $0x1, %esi
movzwl -0xbe(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %edx
movslq -0xbc(%rbp), %rax
movw -0x84(%rbp,%rax,2), %cx
movl -0xbc(%rbp), %eax
addl $0x50, %eax
xorl %r8d, %r8d
movzwl %cx, %ecx
movzwl %ax, %r9d
callq 0x52600
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0xbe(%rbp), %eax
addl $0x64, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jge 0x517d1
movq -0x118(%rbp), %rdi
movzwl -0xbe(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %edx, %esi
movzwl -0xbe(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %edx
addl $0x1, %edx
movslq -0xbc(%rbp), %rax
movw -0x84(%rbp,%rax,2), %cx
movl -0xbc(%rbp), %eax
addl $0x50, %eax
xorl %r8d, %r8d
movzwl %cx, %ecx
movzwl %ax, %r9d
callq 0x52600
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movzwl -0xbe(%rbp), %eax
addl $0x65, %eax
movzwl %ax, %esi
callq 0x4e8e0
movsbl (%rax), %eax
cmpl $0x0, %eax
jge 0x5184b
movq -0x118(%rbp), %rdi
movzwl -0xbe(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %edx, %esi
addl $0x1, %esi
movzwl -0xbe(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %edx
addl $0x1, %edx
movslq -0xbc(%rbp), %rax
movw -0x84(%rbp,%rax,2), %cx
movl -0xbc(%rbp), %eax
addl $0x50, %eax
xorl %r8d, %r8d
movzwl %cx, %ecx
movzwl %ax, %r9d
callq 0x52600
movq -0x118(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x50, %ecx
movb %cl, -0x11d(%rbp)
movq (%rax), %rdi
movslq -0xbc(%rbp), %rax
movzwl -0x84(%rbp,%rax,2), %esi
callq 0x4e8e0
movb -0x11d(%rbp), %cl
movb %cl, (%rax)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x5163f
jmp 0x51896
jmp 0x51898
jmp 0x5189a
jmp 0x50934
jmp 0x518a1
movl $0x0, -0xc4(%rbp)
movq -0x118(%rbp), %rcx
movl -0xc4(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x51937
movl $0x0, -0xc8(%rbp)
movq -0x118(%rbp), %rcx
movl -0xc8(%rbp), %eax
movq (%rcx), %rcx
cmpl (%rcx), %eax
jge 0x51921
movq -0x118(%rbp), %rax
imull $0x64, -0xc4(%rbp), %ecx
addl -0xc8(%rbp), %ecx
movw %cx, %dx
movq (%rax), %rax
imull $0x64, -0xc4(%rbp), %ecx
addl -0xc8(%rbp), %ecx
movslq %ecx, %rcx
movw %dx, 0x1fbe8(%rax,%rcx,2)
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x518ca
jmp 0x51923
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x518ab
movl $0x0, -0xcc(%rbp)
movq -0x118(%rbp), %rcx
movl -0xcc(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x51ff7
movl $0x0, -0xd0(%rbp)
movq -0x118(%rbp), %rcx
movl -0xd0(%rbp), %eax
movq (%rcx), %rcx
cmpl (%rcx), %eax
jge 0x51fe1
movq -0x118(%rbp), %rax
movq (%rax), %rax
addq $0xc, %rax
movslq -0xcc(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xd0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jge 0x519c4
jmp 0x51fcd
movq -0x118(%rbp), %rax
movq (%rax), %rcx
imull $0x64, -0xcc(%rbp), %edx
addl -0xd0(%rbp), %edx
movslq %edx, %rdx
movw 0x1fbe8(%rcx,%rdx,2), %cx
movw %cx, -0xda(%rbp)
movq (%rax), %rcx
movq -0xd8(%rbp), %rdx
movswq 0x2(%rdx), %rdx
movw 0x1fbe8(%rcx,%rdx,2), %si
movq (%rax), %rcx
imull $0x64, -0xcc(%rbp), %edx
addl -0xd0(%rbp), %edx
movslq %edx, %rdx
movw %si, 0x1fbe8(%rcx,%rdx,2)
movw -0xda(%rbp), %si
movq (%rax), %rcx
movq -0xd8(%rbp), %rdx
movswq 0x2(%rdx), %rdx
movw %si, 0x1fbe8(%rcx,%rdx,2)
movq (%rax), %rdi
movq -0xd8(%rbp), %rax
movzwl 0x2(%rax), %esi
callq 0x4e8e0
movb (%rax), %cl
movq -0xd8(%rbp), %rax
movb %cl, (%rax)
movq -0xd8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x50, %eax
jge 0x51a7c
movq -0xd8(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x124(%rbp)
jmp 0x51a89
movl $0x10, %eax
movl %eax, -0x124(%rbp)
jmp 0x51a89
movl -0x124(%rbp), %eax
movb %al, %cl
movq -0xd8(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0xd0(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xe0(%rbp)
cmpl $0x0, -0xe0(%rbp)
jl 0x51d33
movq -0x118(%rbp), %rax
movq (%rax), %rax
addq $0xc, %rax
movslq -0xcc(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xe0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movsbl (%rax), %eax
cmpl $-0x1, %eax
je 0x51d1d
movq -0x118(%rbp), %rax
movq (%rax), %rax
addq $0xc, %rax
movslq -0xcc(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xe0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movsbl (%rax), %eax
cmpl $-0x2, %eax
jne 0x51b2a
jmp 0x51d33
movq -0x118(%rbp), %rax
movl -0xd0(%rbp), %ecx
subl -0xe0(%rbp), %ecx
movb %cl, %dl
movq -0xd8(%rbp), %rcx
movb %dl, 0x6(%rcx)
movl -0xd0(%rbp), %ecx
subl -0xe0(%rbp), %ecx
movq (%rax), %rax
addq $0xc, %rax
movslq -0xcc(%rbp), %rdx
imulq $0x4b0, %rdx, %rdx      # imm = 0x4B0
addq %rdx, %rax
movslq -0xe0(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x4(%rax)
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
cmpl -0xd0(%rbp), %eax
jge 0x51c8e
movq -0x118(%rbp), %rax
movl -0xd0(%rbp), %ecx
subl -0xe4(%rbp), %ecx
movb %cl, %dl
movq (%rax), %rcx
addq $0xc, %rcx
movslq -0xcc(%rbp), %rsi
imulq $0x4b0, %rsi, %rsi      # imm = 0x4B0
addq %rsi, %rcx
movslq -0xe4(%rbp), %rsi
imulq $0xc, %rsi, %rsi
addq %rsi, %rcx
movb %dl, 0x4(%rcx)
movl -0xe4(%rbp), %ecx
subl -0xe0(%rbp), %ecx
movb %cl, %dl
movq (%rax), %rcx
addq $0xc, %rcx
movslq -0xcc(%rbp), %rsi
imulq $0x4b0, %rsi, %rsi      # imm = 0x4B0
addq %rsi, %rcx
movslq -0xe4(%rbp), %rsi
imulq $0xc, %rsi, %rsi
addq %rsi, %rcx
movb %dl, 0x6(%rcx)
movq -0xd8(%rbp), %rcx
movb 0xa(%rcx), %dl
movq (%rax), %rcx
addq $0xc, %rcx
movslq -0xcc(%rbp), %rsi
imulq $0x4b0, %rsi, %rsi      # imm = 0x4B0
addq %rsi, %rcx
movslq -0xe4(%rbp), %rsi
imulq $0xc, %rsi, %rsi
addq %rsi, %rcx
movb %dl, 0x8(%rcx)
movq -0xd8(%rbp), %rcx
movb 0xa(%rcx), %cl
movq (%rax), %rax
addq $0xc, %rax
movslq -0xcc(%rbp), %rdx
imulq $0x4b0, %rdx, %rdx      # imm = 0x4B0
addq %rdx, %rax
movslq -0xe4(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0xa(%rax)
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0x51b8d
movq -0x118(%rbp), %rax
movq (%rax), %rax
addq $0xc, %rax
movslq -0xcc(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xe0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movswl 0x2(%rax), %eax
movq -0xd8(%rbp), %rcx
movswl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jne 0x51d1b
movl -0xd0(%rbp), %eax
subl -0xe0(%rbp), %eax
cmpl $0x1, %eax
jne 0x51d1b
movq -0x118(%rbp), %rax
movq -0xd8(%rbp), %rcx
movb $0x3, 0xa(%rcx)
movq (%rax), %rax
addq $0xc, %rax
movslq -0xcc(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xe0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movb $0x3, 0x8(%rax)
jmp 0x51d33
jmp 0x51d1f
movl -0xe0(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xe0(%rbp)
jmp 0x51aaa
movl -0xcc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xe8(%rbp)
cmpl $0x0, -0xe8(%rbp)
jl 0x51fcb
movq -0x118(%rbp), %rax
movq (%rax), %rax
addq $0xc, %rax
movslq -0xe8(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xd0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movsbl (%rax), %eax
cmpl $-0x1, %eax
je 0x51fb5
movq -0x118(%rbp), %rax
movq (%rax), %rax
addq $0xc, %rax
movslq -0xe8(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xd0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movsbl (%rax), %eax
cmpl $-0x2, %eax
jne 0x51dc2
jmp 0x51fcb
movq -0x118(%rbp), %rax
movl -0xcc(%rbp), %ecx
subl -0xe8(%rbp), %ecx
movb %cl, %dl
movq -0xd8(%rbp), %rcx
movb %dl, 0x5(%rcx)
movl -0xcc(%rbp), %ecx
subl -0xe8(%rbp), %ecx
movq (%rax), %rax
addq $0xc, %rax
movslq -0xe8(%rbp), %rdx
imulq $0x4b0, %rdx, %rdx      # imm = 0x4B0
addq %rdx, %rax
movslq -0xd0(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x7(%rax)
movl -0xe8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
cmpl -0xcc(%rbp), %eax
jge 0x51f26
movq -0x118(%rbp), %rax
movl -0xec(%rbp), %ecx
subl -0xe8(%rbp), %ecx
movb %cl, %dl
movq (%rax), %rcx
addq $0xc, %rcx
movslq -0xec(%rbp), %rsi
imulq $0x4b0, %rsi, %rsi      # imm = 0x4B0
addq %rsi, %rcx
movslq -0xd0(%rbp), %rsi
imulq $0xc, %rsi, %rsi
addq %rsi, %rcx
movb %dl, 0x5(%rcx)
movl -0xcc(%rbp), %ecx
subl -0xec(%rbp), %ecx
movb %cl, %dl
movq (%rax), %rcx
addq $0xc, %rcx
movslq -0xec(%rbp), %rsi
imulq $0x4b0, %rsi, %rsi      # imm = 0x4B0
addq %rsi, %rcx
movslq -0xd0(%rbp), %rsi
imulq $0xc, %rsi, %rsi
addq %rsi, %rcx
movb %dl, 0x7(%rcx)
movq -0xd8(%rbp), %rcx
movb 0x9(%rcx), %dl
movq (%rax), %rcx
addq $0xc, %rcx
movslq -0xec(%rbp), %rsi
imulq $0x4b0, %rsi, %rsi      # imm = 0x4B0
addq %rsi, %rcx
movslq -0xd0(%rbp), %rsi
imulq $0xc, %rsi, %rsi
addq %rsi, %rcx
movb %dl, 0x9(%rcx)
movq -0xd8(%rbp), %rcx
movb 0x9(%rcx), %cl
movq (%rax), %rax
addq $0xc, %rax
movslq -0xec(%rbp), %rdx
imulq $0x4b0, %rdx, %rdx      # imm = 0x4B0
addq %rdx, %rax
movslq -0xd0(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0xb(%rax)
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x51e25
movq -0x118(%rbp), %rax
movq (%rax), %rax
addq $0xc, %rax
movslq -0xe8(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xd0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movswl 0x2(%rax), %eax
movq -0xd8(%rbp), %rcx
movswl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jne 0x51fb3
movl -0xcc(%rbp), %eax
subl -0xe8(%rbp), %eax
cmpl $0x1, %eax
jne 0x51fb3
movq -0x118(%rbp), %rax
movq -0xd8(%rbp), %rcx
movb $0x3, 0x9(%rcx)
movq (%rax), %rax
addq $0xc, %rax
movslq -0xe8(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xd0(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movb $0x3, 0xb(%rax)
jmp 0x51fcb
jmp 0x51fb7
movl -0xe8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xe8(%rbp)
jmp 0x51d42
jmp 0x51fcd
movl -0xd0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd0(%rbp)
jmp 0x51964
jmp 0x51fe3
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x51941
movl $0x0, -0xf0(%rbp)
movq -0x118(%rbp), %rcx
movl -0xf0(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x52286
movl $0x0, -0xf4(%rbp)
movq -0x118(%rbp), %rcx
movl -0xf4(%rbp), %eax
movq (%rcx), %rcx
cmpl (%rcx), %eax
jge 0x52270
movq -0x118(%rbp), %rax
imull $0x64, -0xf0(%rbp), %ecx
addl -0xf4(%rbp), %ecx
movl %ecx, -0xf8(%rbp)
movq (%rax), %rax
addq $0xc, %rax
movslq -0xf0(%rbp), %rcx
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq -0xf4(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jge 0x52089
jmp 0x5225c
movq -0x118(%rbp), %rax
movq (%rax), %rax
movslq -0xf8(%rbp), %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
cmpl -0xf8(%rbp), %eax
jne 0x520af
jmp 0x5225c
movl $0xffffffff, -0xfc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x100(%rbp)
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movl -0xf8(%rbp), %eax
movzwl %ax, %esi
callq 0x4e8e0
movq %rax, -0x108(%rbp)
movb $0x0, -0x109(%rbp)
movq -0x108(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x50, %eax
jl 0x52137
movq -0x108(%rbp), %rax
movzbl 0x8(%rax), %ecx
xorl %eax, %eax
cmpl $0x3, %ecx
movb %al, -0x125(%rbp)
jne 0x52127
movq -0x108(%rbp), %rax
movzbl 0xb(%rax), %eax
cmpl $0x3, %eax
sete %al
movb %al, -0x125(%rbp)
movb -0x125(%rbp), %al
andb $0x1, %al
movb %al, -0x109(%rbp)
jmp 0x52174
movq -0x108(%rbp), %rax
movzbl 0x8(%rax), %ecx
movb $0x1, %al
cmpl $0x3, %ecx
movb %al, -0x126(%rbp)
je 0x52166
movq -0x108(%rbp), %rax
movzbl 0xb(%rax), %eax
cmpl $0x3, %eax
sete %al
movb %al, -0x126(%rbp)
movb -0x126(%rbp), %al
andb $0x1, %al
movb %al, -0x109(%rbp)
testb $0x1, -0x109(%rbp)
je 0x521b5
movq -0x118(%rbp), %rdi
movl -0x100(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x100(%rbp)
addq $0x10, %rdi
movl -0x100(%rbp), %esi
callq 0x2fe60
cmpl $0x0, %eax
jne 0x521b3
movl -0xf8(%rbp), %eax
movl %eax, -0xfc(%rbp)
jmp 0x521b5
movq -0x118(%rbp), %rax
movq (%rax), %rax
movslq -0xf8(%rbp), %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
movl %eax, -0xf8(%rbp)
movl -0xf8(%rbp), %eax
imull $0x64, -0xf0(%rbp), %ecx
addl -0xf4(%rbp), %ecx
cmpl %ecx, %eax
jne 0x520c3
jmp 0x521f1
movq -0x118(%rbp), %rax
movl -0xfc(%rbp), %ecx
movw %cx, -0x128(%rbp)
movq (%rax), %rdi
movl -0xf8(%rbp), %eax
movzwl %ax, %esi
callq 0x4e8e0
movw -0x128(%rbp), %dx
movq %rax, %rcx
movq -0x118(%rbp), %rax
movw %dx, 0x2(%rcx)
movq (%rax), %rax
movslq -0xf8(%rbp), %rcx
movswl 0x1fbe8(%rax,%rcx,2), %eax
movl %eax, -0xf8(%rbp)
movl -0xf8(%rbp), %eax
imull $0x64, -0xf0(%rbp), %ecx
addl -0xf4(%rbp), %ecx
cmpl %ecx, %eax
jne 0x521f1
jmp 0x5225c
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x52024
jmp 0x52272
movl -0xf0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf0(%rbp)
jmp 0x52001
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nop