// File: FreeSlave[P]vhlt/hlrad/loadtextures.cpp
// Function: EmbedLightmapInTextures()
void EmbedLightmapInTextures ()
{
	if (!g_lightdatasize)
	{
		// hlrad hasn't run
		return;
	}
	if (!g_texdatasize)
	{
		// texdata hasn't been initialized
		return;
	}
	if (g_notextures)
	{
		// hlrad didn't load the wad files
		return;
	}

	int i, j, k;
	int miplevel;
	int count = 0;
	int count_bytes = 0;
	bool logged = false;

	for (i = 0; i < g_numfaces; i++)
	{
		dface_t *f = &g_dfaces[i];
		
		if (f->lightofs == -1) // some faces don't have lightmap
		{
			continue;
		}
		if (f->texinfo < 0 || f->texinfo >= g_numtexinfo)
		{
			continue;
		}
		
		entity_t *ent = g_face_entity[i];
		int originaltexinfonum = f->texinfo;
		texinfo_t *originaltexinfo = &g_texinfo[originaltexinfonum];
		char texname[16];
		if (!GetValidTextureName (originaltexinfo->miptex, texname))
		{
			continue;
		}
		radtexture_t *tex = &g_textures[originaltexinfo->miptex];

		if (ent == &g_entities[0]) // world
		{
			continue;
		}
		if (!strncmp (texname, "sky", 3)
			|| originaltexinfo->flags & TEX_SPECIAL) // skip special surfaces
		{
			continue;
		}
		if (!IntForKey (ent, "zhlt_embedlightmap"))
		{
			continue;
		}

		if (!logged)
		{
			Log ("\n");
			Log ("Embed Lightmap : ");
			Developer (DEVELOPER_LEVEL_MESSAGE, "\n");
			logged = true;
		}

		bool poweroftwo = DEFAULT_EMBEDLIGHTMAP_POWEROFTWO;
		vec_t denominator = DEFAULT_EMBEDLIGHTMAP_DENOMINATOR;
		vec_t gamma = DEFAULT_EMBEDLIGHTMAP_GAMMA;
		int resolution = DEFAULT_EMBEDLIGHTMAP_RESOLUTION;
		if (IntForKey (ent, "zhlt_embedlightmapresolution"))
		{
			resolution = IntForKey (ent, "zhlt_embedlightmapresolution");
			if (resolution <= 0 || resolution > TEXTURE_STEP || ((resolution - 1) & resolution) != 0)
			{
				Error ("resolution cannot be %d; valid values are 1, 2, 4 ... %d.", resolution, (int)TEXTURE_STEP);
			}
		}

		// calculate texture size and allocate memory for all miplevels

		int texturesize[2];
		float (*texture)[5]; // red, green, blue and alpha channel; the last one is number of samples
		byte (*texturemips[MIPLEVELS])[4]; // red, green, blue and alpha channel
		int s, t;
		int texmins[2];
		int texmaxs[2];
		int texsize[2]; // texturesize = (texsize + 1) * TEXTURE_STEP
		int side[2];

		GetFaceExtents (i, texmins, texmaxs);
		texsize[0] = texmaxs[0] - texmins[0];
		texsize[1] = texmaxs[1] - texmins[1];
		if (texsize[0] < 0 || texsize[1] < 0 || texsize[0] > MAX_SURFACE_EXTENT || texsize[1] > MAX_SURFACE_EXTENT)
		{
			Warning ("skipped a face with bad surface extents @ (%4.3f %4.3f %4.3f)", g_face_centroids[i][0], g_face_centroids[i][1], g_face_centroids[i][2]);
			continue;
		}

		for (k = 0; k < 2; k++)
		{
			texturesize[k] = (texsize[k] + 1) * TEXTURE_STEP;
			if (texturesize[k] < texsize[k] * TEXTURE_STEP + resolution * 4)
			{
				texturesize[k] = texsize[k] * TEXTURE_STEP + resolution * 4; // prevent edge bleeding
			}
			texturesize[k] = (texturesize[k] + resolution - 1) / resolution;
			texturesize[k] += 15 - (texturesize[k] + 15) % 16; // must be multiples of 16
			if (poweroftwo)
			{
				for (j = 0; j <= 30; j++)
				{
					if ((1 << j) >= texturesize[k])
					{
						texturesize[k] = (1 << j);
						break;
					}
				}
			}
			side[k] = (texturesize[k] * resolution - texsize[k] * TEXTURE_STEP) / 2;
		}
		texture = (float (*)[5])malloc (texturesize[0] * texturesize[1] * sizeof (float [5]));
		hlassume (texture != NULL, assume_NoMemory);
		for (miplevel = 0; miplevel < MIPLEVELS; miplevel++)
		{
			texturemips[miplevel] = (byte (*)[4])malloc ((texturesize[0] >> miplevel) * (texturesize[1] >> miplevel) * sizeof (byte [4]));
			hlassume (texturemips[miplevel] != NULL, assume_NoMemory);
		}

		// calculate the texture

		for (t = 0; t < texturesize[1]; t++)
		{
			for (s = 0; s < texturesize[0]; s++)
			{
				float (*dest)[5] = &texture[t * texturesize[0] + s];
				VectorFill (*dest, 0);
				(*dest)[3] = 0;
				(*dest)[4] = 0;
			}
		}
		for (t = -side[1]; t < texsize[1] * TEXTURE_STEP + side[1]; t++)
		{
			for (s = -side[0]; s < texsize[0] * TEXTURE_STEP + side[0]; s++)
			{
				double s_vec, t_vec;
				double src_s, src_t;
				int src_is, src_it;
				byte src_index;
				byte src_color[3];
				double dest_s, dest_t;
				int dest_is, dest_it;
				float (*dest)[5];
				double light_s, light_t;
				vec3_t light;

				s_vec = s + texmins[0] * TEXTURE_STEP + 0.5;
				t_vec = t + texmins[1] * TEXTURE_STEP + 0.5;

				if (resolution == 1)
				{
					dest_s = s_vec;
					dest_t = t_vec;
				}
				else // the final blurred texture is shifted by a half pixel so that lightmap samples align with the center of pixels
				{
					dest_s = s_vec / resolution + 0.5;
					dest_t = t_vec / resolution + 0.5;
				}
				dest_s = dest_s - texturesize[0] * floor (dest_s / texturesize[0]);
				dest_t = dest_t - texturesize[1] * floor (dest_t / texturesize[1]);
				dest_is = (int)floor (dest_s); // dest_is = dest_s % texturesize[0]
				dest_it = (int)floor (dest_t); // dest_it = dest_t % texturesize[1]
				dest_is = qmax (0, qmin (dest_is, texturesize[0] - 1));
				dest_it = qmax (0, qmin (dest_it, texturesize[1] - 1));
				dest = &texture[dest_it * texturesize[0] + dest_is];

				src_s = s_vec;
				src_t = t_vec;
				src_s = src_s - tex->width * floor (src_s / tex->width);
				src_t = src_t - tex->height * floor (src_t / tex->height);
				src_is = (int)floor (src_s); // src_is = src_s % tex->width
				src_it = (int)floor (src_t); // src_it = src_t % tex->height
				src_is = qmax (0, qmin (src_is, tex->width - 1));
				src_it = qmax (0, qmin (src_it, tex->height - 1));
				src_index = tex->canvas[src_it * tex->width + src_is];
				VectorCopy (tex->palette[src_index], src_color);

				// get light from the center of the destination pixel
				light_s = (s_vec + resolution * (dest_is + 0.5 - dest_s)) / TEXTURE_STEP - texmins[0];
				light_t = (t_vec + resolution * (dest_it + 0.5 - dest_t)) / TEXTURE_STEP - texmins[1];
				GetLight (f, texsize, light_s, light_t, light);

				(*dest)[4] += 1;
				if (!(texname[0] == '{' && src_index == 255))
				{
					for (k = 0; k < 3; k++)
					{
						float v = src_color[k] * pow (light[k] / denominator, gamma);
						(*dest)[k] += 255 * qmax (0, qmin (v, 255));
					}
					(*dest)[3] += 255;
				}
			}
		}
		for (t = 0; t < texturesize[1]; t++)
		{
			for (s = 0; s < texturesize[0]; s++)
			{
				float (*src)[5] = &texture[t * texturesize[0] + s];
				byte (*dest)[4] = &texturemips[0][t * texturesize[0] + s];

				if ((*src)[4] == 0) // no samples (outside face range?)
				{
					VectorFill (*dest, 0);
					(*dest)[3] = 255;
				}
				else
				{
					if ((*src)[3] / (*src)[4] <= 0.4 * 255) // transparent
					{
						VectorFill (*dest, 0);
						(*dest)[3] = 0;
					}
					else // normal
					{
						for (j = 0; j < 3; j++)
						{
							int val = (int)floor ((*src)[j] / (*src)[3] + 0.5);
							(*dest)[j] = qmax (0, qmin (val, 255));
						}
						(*dest)[3] = 255;
					}
				}
			}
		}

		for (miplevel = 1; miplevel < MIPLEVELS; miplevel++)
		{
			for (t = 0; t < (texturesize[1] >> miplevel); t++)
			{
				for (s = 0; s < (texturesize[0] >> miplevel); s++)
				{
					byte (*src[4])[4];
					byte (*dest)[4];
					double average[4];

					dest = &texturemips[miplevel][t * (texturesize[0] >> miplevel) + s];
					src[0] = &texturemips[miplevel - 1][(2 * t) * (texturesize[0] >> (miplevel - 1)) + (2 * s)];
					src[1] = &texturemips[miplevel - 1][(2 * t) * (texturesize[0] >> (miplevel - 1)) + (2 * s + 1)];
					src[2] = &texturemips[miplevel - 1][(2 * t + 1) * (texturesize[0] >> (miplevel - 1)) + (2 * s)];
					src[3] = &texturemips[miplevel - 1][(2 * t + 1) * (texturesize[0] >> (miplevel - 1)) + (2 * s + 1)];

					VectorClear (average);
					average[3] = 0;
					for (k = 0; k < 4; k++)
					{
						for (j = 0; j < 3; j++)
						{
							average[j] += (*src[k])[3] * (*src[k])[j];
						}
						average[3] += (*src[k])[3];
					}

					if (average[3] / 4 <= 0.4 * 255)
					{
						VectorClear (*dest);
						(*dest)[3] = 0;
					}
					else
					{
						for (j = 0; j < 3; j++)
						{
							int val = (int)floor (average[j] / average[3] + 0.5);
							(*dest)[j] = qmax (0, qmin (val, 255));
						}
						(*dest)[3] = 255;
					}
				}
			}
		}

		// create its palette

		byte palette[256][3];
		cq_searchnode_t *palettetree = CQ_AllocSearchTree (256);
		int paletteoffset;
		int palettenumcolors;

		{
			int palettemaxcolors;
			int numsamplepoints;
			unsigned char (*samplepoints)[3];

			if (texname[0] == '{')
			{
				paletteoffset = 0;
				palettemaxcolors = 255;
				VectorCopy (tex->palette[255], palette[255]); // the transparency color
			}
			/*else if (texname[0] == '!')
			{
				paletteoffset = 16; // because the 4th entry and the 5th entry are reserved for fog color and fog density
				for (j = 0; j < 16; j++)
				{
					VectorCopy (tex->palette[j], palette[j]);
				}
				palettemaxcolors = 256 - 16;
			}*/
			else
			{
				paletteoffset = 0;
				palettemaxcolors = 256;
			}

			samplepoints = (unsigned char (*)[3])malloc (texturesize[0] * texturesize[1] * sizeof (unsigned char [3]));
			hlassume (samplepoints != NULL, assume_NoMemory);
			numsamplepoints = 0;
			for (t = 0; t < texturesize[1]; t++)
			{
				for (s = 0; s < texturesize[0]; s++)
				{
					byte (*src)[4] = &texturemips[0][t * texturesize[0] + s];
					if ((*src)[3] > 0)
					{
						VectorCopy (*src, samplepoints[numsamplepoints]);
						numsamplepoints++;
					}
				}
			}

			CQ_CreatePalette (numsamplepoints, samplepoints, palettemaxcolors, &palette[paletteoffset], palettenumcolors, palettetree);
			for (j = palettenumcolors; j < palettemaxcolors; j++)
			{
				VectorClear (palette[paletteoffset + j]);
			}

			free (samplepoints);
		}

		// emit a texinfo

		hlassume (g_numtexinfo < MAX_MAP_TEXINFO, assume_MAX_MAP_TEXINFO);
		f->texinfo = g_numtexinfo;
		texinfo_t *info = &g_texinfo[g_numtexinfo];
		g_numtexinfo++;

		*info = g_texinfo[originaltexinfonum];
		if (resolution != 1)
		{
			// apply a scale and a shift over the original vectors
			for (k = 0; k < 2; k++)
			{
				VectorScale (info->vecs[k], 1.0 / resolution, info->vecs[k]);
				info->vecs[k][3] = info->vecs[k][3] / resolution + 0.5;
			}
		}
		info->miptex = NewTextures_GetCurrentMiptexIndex ();

		// emit a texture

		int miptexsize;
		
		miptexsize = (int)sizeof (miptex_t);
		for (miplevel = 0; miplevel < MIPLEVELS; miplevel++)
		{
			miptexsize += (texturesize[0] >> miplevel) * (texturesize[1] >> miplevel);
		}
		miptexsize += 2 + 256 * 3 + 2;
		miptex_t *miptex = (miptex_t *)malloc (miptexsize);
		hlassume (miptex != NULL, assume_NoMemory);

		memset (miptex, 0, sizeof (miptex_t));
		miptex->width = texturesize[0];
		miptex->height = texturesize[1];
		byte *p = (byte *)miptex + sizeof (miptex_t);
		for (miplevel = 0; miplevel < MIPLEVELS; miplevel++)
		{
			miptex->offsets[miplevel] = p - (byte *)miptex;
			for (int t = 0; t < (texturesize[1] >> miplevel); t++)
			{
				for (int s = 0; s < (texturesize[0] >> miplevel); s++)
				{
					byte (*src)[4] = &texturemips[miplevel][t * (texturesize[0] >> miplevel) + s];
					if ((*src)[3] > 0)
					{
						if (palettenumcolors)
						{
							unsigned char point[3];
							VectorCopy (*src, point);
							*p = paletteoffset + CQ_MapPoint (point, &palette[paletteoffset], palettenumcolors, palettetree);
						}
						else // this should never happen
						{
							*p = paletteoffset + 0;
						}
					}
					else
					{
						*p = 255;
					}
					p++;
				}
			}
		}
		*(short *)p = 256;
		p += 2;
		memcpy (p, palette, 256 * 3);
		p += 256 * 3;
		*(short *)p = 0;
		p += 2;
		if (p != (byte *)miptex + miptexsize)
		{
			Error ("EmbedLightmapInTextures: internal error");
		}

		if (texname[0] == '{')
		{
			strcpy (miptex->name, "{_rad");
		}
		/*else if (texname[0] == '!')
		{
			strcpy (miptex->name, "!_rad");
		}*/
		else
		{
			strcpy (miptex->name, "__rad");
		}
		if (originaltexinfonum < 0 || originaltexinfonum > 99999)
		{
			Error ("EmbedLightmapInTextures: internal error: texinfo out of range");
		}
		miptex->name[5] = '0' + (originaltexinfonum / 10000) % 10; // store the original texinfo
		miptex->name[6] = '0' + (originaltexinfonum / 1000) % 10;
		miptex->name[7] = '0' + (originaltexinfonum / 100) % 10;
		miptex->name[8] = '0' + (originaltexinfonum / 10) % 10;
		miptex->name[9] = '0' + (originaltexinfonum) % 10;
		char table[62];
		for (int k = 0; k < 62; k++)
		{
			table[k] = k >= 36? 'a' + (k - 36): k >= 10? 'A' + (k - 10): '0' + k; // same order as the ASCII table
		}
		miptex->name[10] = '\0';
		miptex->name[11] = '\0';
		miptex->name[12] = '\0';
		miptex->name[13] = '\0';
		miptex->name[14] = '\0';
		miptex->name[15] = '\0';
		unsigned int hash = Hash (miptexsize, miptex);
		miptex->name[10] = table[(hash / 62 / 62) % 52 + 10];
		miptex->name[11] = table[(hash / 62) % 62];
		miptex->name[12] = table[(hash) % 62];
		miptex->name[13] = table[(count / 62) % 62];
		miptex->name[14] = table[(count) % 62];
		miptex->name[15] = '\0';
		NewTextures_PushTexture (miptexsize, miptex);
		count++;
		count_bytes += miptexsize;
		Developer (DEVELOPER_LEVEL_MESSAGE, "Created texture '%s' for face (texture %s) at (%4.3f %4.3f %4.3f)\n", miptex->name, texname, g_face_centroids[i][0], g_face_centroids[i][1], g_face_centroids[i][2]);

		free (miptex);

		CQ_FreeSearchTree (palettetree);
		
		free (texture);
		for (miplevel = 0; miplevel < MIPLEVELS; miplevel++)
		{
			free (texturemips[miplevel]);
		}
	}
	NewTextures_Write (); // update texdata now

	if (logged)
	{
		Log ("added %d texinfos and textures (%d bytes)\n", count, count_bytes);
	}
}

// Assembly:
subq $0x638, %rsp            # imm = 0x638
leaq 0x840986(%rip), %rax    # 0x886494
cmpl $0x0, (%rax)
jne 0x45b18
jmp 0x4802a
leaq 0x840985(%rip), %rax    # 0x8864a4
cmpl $0x0, (%rax)
jne 0x45b29
jmp 0x4802a
leaq 0x54e9f1b(%rip), %rax   # 0x552fa4b
testb $0x1, (%rax)
je 0x45b3a
jmp 0x4802a
movl $0x0, 0x624(%rsp)
movl $0x0, 0x620(%rsp)
movb $0x0, 0x61f(%rsp)
movl $0x0, 0x634(%rsp)
movl 0x634(%rsp), %eax
leaq 0x1ba0893(%rip), %rcx   # 0x1be6404
cmpl (%rcx), %eax
jge 0x47fff
movslq 0x634(%rsp), %rcx
leaq 0x1ba0888(%rip), %rax   # 0x1be6410
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x610(%rsp)
movq 0x610(%rsp), %rax
cmpl $-0x1, 0x10(%rax)
jne 0x45baa
jmp 0x47fe9
movq 0x610(%rsp), %rax
movswl 0xa(%rax), %eax
cmpl $0x0, %eax
jl 0x45bd2
movq 0x610(%rsp), %rax
movswl 0xa(%rax), %eax
leaq 0x11a082e(%rip), %rcx   # 0x11e63fc
cmpl (%rcx), %eax
jl 0x45bd7
jmp 0x47fe9
movslq 0x634(%rsp), %rcx
leaq 0x52e7e1a(%rip), %rax   # 0x532da00
movq (%rax,%rcx,8), %rax
movq %rax, 0x608(%rsp)
movq 0x610(%rsp), %rax
movswl 0xa(%rax), %eax
movl %eax, 0x604(%rsp)
movslq 0x604(%rsp), %rcx
leaq 0x11a07ec(%rip), %rax   # 0x11e6400
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x5f8(%rsp)
movq 0x5f8(%rsp), %rax
movl 0x20(%rax), %edi
leaq 0x5e0(%rsp), %rsi
callq 0x48040
testb $0x1, %al
jne 0x45c44
jmp 0x47fe9
movq 0x5261d7d(%rip), %rax   # 0x52a79c8
movq 0x5f8(%rsp), %rcx
movslq 0x20(%rcx), %rcx
imulq $0x330, %rcx, %rcx      # imm = 0x330
addq %rcx, %rax
movq %rax, 0x5d8(%rsp)
leaq 0x202e7d0(%rip), %rax   # 0x2074440
cmpq %rax, 0x608(%rsp)
jne 0x45c7f
jmp 0x47fe9
leaq 0x5e0(%rsp), %rdi
leaq 0x299d3(%rip), %rsi     # 0x6f661
movl $0x3, %edx
callq 0x4190
cmpl $0x0, %eax
je 0x45cb0
movq 0x5f8(%rsp), %rax
movl 0x24(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x45cb5
jmp 0x47fe9
movq 0x608(%rsp), %rdi
leaq 0x28c64(%rip), %rsi     # 0x6e928
callq 0x7f70
cmpl $0x0, %eax
jne 0x45cd3
jmp 0x47fe9
testb $0x1, 0x61f(%rsp)
jne 0x45d14
leaq 0x26014(%rip), %rdi     # 0x6bcf8
movb $0x0, %al
callq 0xb0d0
leaq 0x28c49(%rip), %rdi     # 0x6e93b
movb $0x0, %al
callq 0xb0d0
movl $0x3, %edi
leaq 0x25ff3(%rip), %rsi     # 0x6bcf8
movb $0x0, %al
callq 0xbbf0
movb $0x1, 0x61f(%rsp)
movb $0x1, 0x5d7(%rsp)
movss 0x28860(%rip), %xmm0    # 0x6e584
movss %xmm0, 0x5d0(%rsp)
movss 0x2884b(%rip), %xmm0    # 0x6e580
movss %xmm0, 0x5cc(%rsp)
movl $0x1, 0x5c8(%rsp)
movq 0x608(%rsp), %rdi
leaq 0x28bf5(%rip), %rsi     # 0x6e94d
callq 0x7f70
cmpl $0x0, %eax
je 0x45dc3
movq 0x608(%rsp), %rdi
leaq 0x28bdc(%rip), %rsi     # 0x6e94d
callq 0x7f70
movl %eax, 0x5c8(%rsp)
cmpl $0x0, 0x5c8(%rsp)
jle 0x45da7
cmpl $0x10, 0x5c8(%rsp)
jg 0x45da7
movl 0x5c8(%rsp), %eax
subl $0x1, %eax
andl 0x5c8(%rsp), %eax
cmpl $0x0, %eax
je 0x45dc1
movl 0x5c8(%rsp), %esi
leaq 0x28bb5(%rip), %rdi     # 0x6e96a
movl $0x10, %edx
movb $0x0, %al
callq 0xb580
jmp 0x45dc3
movl 0x634(%rsp), %edi
leaq 0x580(%rsp), %rsi
leaq 0x578(%rsp), %rdx
callq 0x6100
movl 0x578(%rsp), %eax
subl 0x580(%rsp), %eax
movl %eax, 0x570(%rsp)
movl 0x57c(%rsp), %eax
subl 0x584(%rsp), %eax
movl %eax, 0x574(%rsp)
cmpl $0x0, 0x570(%rsp)
jl 0x45e31
cmpl $0x0, 0x574(%rsp)
jl 0x45e31
cmpl $0x10, 0x570(%rsp)
jg 0x45e31
cmpl $0x10, 0x574(%rsp)
jle 0x45ea0
movslq 0x634(%rsp), %rcx
leaq 0x4c33af0(%rip), %rax   # 0x4c79930
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movslq 0x634(%rsp), %rcx
leaq 0x4c33ad2(%rip), %rax   # 0x4c79930
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movslq 0x634(%rsp), %rcx
leaq 0x4c33ab3(%rip), %rax   # 0x4c79930
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x28b10(%rip), %rdi     # 0x6e9a4
movb $0x3, %al
callq 0xb9f0
jmp 0x47fe9
movl $0x0, 0x62c(%rsp)
cmpl $0x2, 0x62c(%rsp)
jge 0x46074
movslq 0x62c(%rsp), %rax
movl 0x570(%rsp,%rax,4), %ecx
addl $0x1, %ecx
shll $0x4, %ecx
movslq 0x62c(%rsp), %rax
movl %ecx, 0x5c0(%rsp,%rax,4)
movslq 0x62c(%rsp), %rax
movl 0x5c0(%rsp,%rax,4), %eax
movslq 0x62c(%rsp), %rcx
movl 0x570(%rsp,%rcx,4), %ecx
shll $0x4, %ecx
movl 0x5c8(%rsp), %edx
shll $0x2, %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x45f3b
movslq 0x62c(%rsp), %rax
movl 0x570(%rsp,%rax,4), %ecx
shll $0x4, %ecx
movl 0x5c8(%rsp), %eax
shll $0x2, %eax
addl %eax, %ecx
movslq 0x62c(%rsp), %rax
movl %ecx, 0x5c0(%rsp,%rax,4)
movslq 0x62c(%rsp), %rax
movl 0x5c0(%rsp,%rax,4), %eax
addl 0x5c8(%rsp), %eax
subl $0x1, %eax
cltd
idivl 0x5c8(%rsp)
movl %eax, %ecx
movslq 0x62c(%rsp), %rax
movl %ecx, 0x5c0(%rsp,%rax,4)
movslq 0x62c(%rsp), %rax
movl 0x5c0(%rsp,%rax,4), %eax
addl $0xf, %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl $0xf, %ecx
subl %edx, %ecx
movslq 0x62c(%rsp), %rax
addl 0x5c0(%rsp,%rax,4), %ecx
movl %ecx, 0x5c0(%rsp,%rax,4)
testb $0x1, 0x5d7(%rsp)
je 0x4601a
movl $0x0, 0x630(%rsp)
cmpl $0x1e, 0x630(%rsp)
jg 0x46018
movl 0x630(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movslq 0x62c(%rsp), %rcx
cmpl 0x5c0(%rsp,%rcx,4), %eax
jl 0x46003
movl 0x630(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movslq 0x62c(%rsp), %rax
movl %ecx, 0x5c0(%rsp,%rax,4)
jmp 0x46018
jmp 0x46005
movl 0x630(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x630(%rsp)
jmp 0x45fb9
jmp 0x4601a
movslq 0x62c(%rsp), %rax
movl 0x5c0(%rsp,%rax,4), %eax
imull 0x5c8(%rsp), %eax
movslq 0x62c(%rsp), %rcx
movl 0x570(%rsp,%rcx,4), %ecx
shll $0x4, %ecx
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movslq 0x62c(%rsp), %rax
movl %ecx, 0x568(%rsp,%rax,4)
movl 0x62c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x62c(%rsp)
jmp 0x45eab
movl 0x5c0(%rsp), %eax
imull 0x5c4(%rsp), %eax
cltq
imulq $0x14, %rax, %rdi
callq 0x4430
movq %rax, 0x5b8(%rsp)
cmpq $0x0, 0x5b8(%rsp)
setne %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x1, %esi
callq 0xbf00
movl $0x0, 0x628(%rsp)
cmpl $0x4, 0x628(%rsp)
jge 0x46145
movl 0x5c0(%rsp), %eax
movl 0x628(%rsp), %ecx
sarl %cl, %eax
movl 0x5c4(%rsp), %edx
movl 0x628(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
imull %ecx, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x4430
movq %rax, %rcx
movslq 0x628(%rsp), %rax
movq %rcx, 0x590(%rsp,%rax,8)
movslq 0x628(%rsp), %rax
cmpq $0x0, 0x590(%rsp,%rax,8)
setne %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x1, %esi
callq 0xbf00
movl 0x628(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x628(%rsp)
jmp 0x460bd
movl $0x0, 0x588(%rsp)
movl 0x588(%rsp), %eax
cmpl 0x5c4(%rsp), %eax
jge 0x46230
movl $0x0, 0x58c(%rsp)
movl 0x58c(%rsp), %eax
cmpl 0x5c0(%rsp), %eax
jge 0x46218
movq 0x5b8(%rsp), %rax
movl 0x588(%rsp), %ecx
imull 0x5c0(%rsp), %ecx
addl 0x58c(%rsp), %ecx
movslq %ecx, %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x560(%rsp)
movq 0x560(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, (%rax)
movq 0x560(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x4(%rax)
movq 0x560(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rax)
movq 0x560(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rax)
movq 0x560(%rsp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x10(%rax)
movl 0x58c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58c(%rsp)
jmp 0x4616f
jmp 0x4621a
movl 0x588(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x588(%rsp)
jmp 0x46150
xorl %eax, %eax
subl 0x56c(%rsp), %eax
movl %eax, 0x588(%rsp)
movl 0x588(%rsp), %eax
movl 0x574(%rsp), %ecx
shll $0x4, %ecx
addl 0x56c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x46bce
xorl %eax, %eax
subl 0x568(%rsp), %eax
movl %eax, 0x58c(%rsp)
movl 0x58c(%rsp), %eax
movl 0x570(%rsp), %ecx
shll $0x4, %ecx
addl 0x568(%rsp), %ecx
cmpl %ecx, %eax
jge 0x46bb6
movl 0x58c(%rsp), %eax
movl 0x580(%rsp), %ecx
shll $0x4, %ecx
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0x27241(%rip), %xmm1    # 0x6d4f0
addsd %xmm1, %xmm0
movsd %xmm0, 0x558(%rsp)
movl 0x588(%rsp), %eax
movl 0x584(%rsp), %ecx
shll $0x4, %ecx
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0x27215(%rip), %xmm1    # 0x6d4f0
addsd %xmm1, %xmm0
movsd %xmm0, 0x550(%rsp)
cmpl $0x1, 0x5c8(%rsp)
jne 0x46318
movsd 0x558(%rsp), %xmm0
movsd %xmm0, 0x528(%rsp)
movsd 0x550(%rsp), %xmm0
movsd %xmm0, 0x520(%rsp)
jmp 0x4636e
movsd 0x558(%rsp), %xmm0
cvtsi2sdl 0x5c8(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd 0x271ba(%rip), %xmm1    # 0x6d4f0
addsd %xmm1, %xmm0
movsd %xmm0, 0x528(%rsp)
movsd 0x550(%rsp), %xmm0
cvtsi2sdl 0x5c8(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd 0x2718f(%rip), %xmm1    # 0x6d4f0
addsd %xmm1, %xmm0
movsd %xmm0, 0x520(%rsp)
movsd 0x528(%rsp), %xmm0
movsd %xmm0, 0xa8(%rsp)
cvtsi2sdl 0x5c0(%rsp), %xmm0
movsd %xmm0, 0xb0(%rsp)
movsd 0x528(%rsp), %xmm0
cvtsi2sdl 0x5c0(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x45a0
movsd 0xa8(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0xb0(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x528(%rsp)
movsd 0x520(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
cvtsi2sdl 0x5c4(%rsp), %xmm0
movsd %xmm0, 0xc0(%rsp)
movsd 0x520(%rsp), %xmm0
cvtsi2sdl 0x5c4(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x45a0
movsd 0xb8(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0xc0(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x520(%rsp)
movsd 0x528(%rsp), %xmm0
callq 0x45a0
cvttsd2si %xmm0, %eax
movl %eax, 0x51c(%rsp)
movsd 0x520(%rsp), %xmm0
callq 0x45a0
cvttsd2si %xmm0, %eax
movl %eax, 0x518(%rsp)
movl 0x51c(%rsp), %eax
movl 0x5c0(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x464bd
movl 0x51c(%rsp), %eax
movl %eax, 0xa4(%rsp)
jmp 0x464ce
movl 0x5c0(%rsp), %eax
subl $0x1, %eax
movl %eax, 0xa4(%rsp)
movl 0xa4(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jle 0x464e6
xorl %eax, %eax
movl %eax, 0xa0(%rsp)
jmp 0x4652a
movl 0x51c(%rsp), %eax
movl 0x5c0(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x4650b
movl 0x51c(%rsp), %eax
movl %eax, 0x9c(%rsp)
jmp 0x4651c
movl 0x5c0(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x9c(%rsp)
movl 0x9c(%rsp), %eax
movl %eax, 0xa0(%rsp)
movl 0xa0(%rsp), %eax
movl %eax, 0x51c(%rsp)
movl 0x518(%rsp), %eax
movl 0x5c4(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x4655d
movl 0x518(%rsp), %eax
movl %eax, 0x98(%rsp)
jmp 0x4656e
movl 0x5c4(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x98(%rsp)
movl 0x98(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jle 0x46586
xorl %eax, %eax
movl %eax, 0x94(%rsp)
jmp 0x465ca
movl 0x518(%rsp), %eax
movl 0x5c4(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x465ab
movl 0x518(%rsp), %eax
movl %eax, 0x90(%rsp)
jmp 0x465bc
movl 0x5c4(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x90(%rsp)
movl 0x90(%rsp), %eax
movl %eax, 0x94(%rsp)
movl 0x94(%rsp), %eax
movl %eax, 0x518(%rsp)
movq 0x5b8(%rsp), %rax
movl 0x518(%rsp), %ecx
imull 0x5c0(%rsp), %ecx
addl 0x51c(%rsp), %ecx
movslq %ecx, %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x510(%rsp)
movsd 0x558(%rsp), %xmm0
movsd %xmm0, 0x548(%rsp)
movsd 0x550(%rsp), %xmm0
movsd %xmm0, 0x540(%rsp)
movsd 0x548(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0x5d8(%rsp), %rax
cvtsi2sdl 0x10(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x548(%rsp), %xmm0
movq 0x5d8(%rsp), %rax
cvtsi2sdl 0x10(%rax), %xmm1
divsd %xmm1, %xmm0
callq 0x45a0
movsd 0x70(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x78(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x548(%rsp)
movsd 0x540(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0x5d8(%rsp), %rax
cvtsi2sdl 0x14(%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
movsd 0x540(%rsp), %xmm0
movq 0x5d8(%rsp), %rax
cvtsi2sdl 0x14(%rax), %xmm1
divsd %xmm1, %xmm0
callq 0x45a0
movsd 0x80(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x88(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x540(%rsp)
movsd 0x548(%rsp), %xmm0
callq 0x45a0
cvttsd2si %xmm0, %eax
movl %eax, 0x53c(%rsp)
movsd 0x540(%rsp), %xmm0
callq 0x45a0
cvttsd2si %xmm0, %eax
movl %eax, 0x538(%rsp)
movl 0x53c(%rsp), %eax
movq 0x5d8(%rsp), %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x46780
movl 0x53c(%rsp), %eax
movl %eax, 0x6c(%rsp)
jmp 0x46792
movq 0x5d8(%rsp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, 0x6c(%rsp)
movl 0x6c(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jle 0x467a4
xorl %eax, %eax
movl %eax, 0x68(%rsp)
jmp 0x467e4
movl 0x53c(%rsp), %eax
movq 0x5d8(%rsp), %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x467ca
movl 0x53c(%rsp), %eax
movl %eax, 0x64(%rsp)
jmp 0x467dc
movq 0x5d8(%rsp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
movl %eax, 0x68(%rsp)
movl 0x68(%rsp), %eax
movl %eax, 0x53c(%rsp)
movl 0x538(%rsp), %eax
movq 0x5d8(%rsp), %rcx
movl 0x14(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x46815
movl 0x538(%rsp), %eax
movl %eax, 0x60(%rsp)
jmp 0x46827
movq 0x5d8(%rsp), %rax
movl 0x14(%rax), %eax
subl $0x1, %eax
movl %eax, 0x60(%rsp)
movl 0x60(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jle 0x46839
xorl %eax, %eax
movl %eax, 0x5c(%rsp)
jmp 0x46879
movl 0x538(%rsp), %eax
movq 0x5d8(%rsp), %rcx
movl 0x14(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x4685f
movl 0x538(%rsp), %eax
movl %eax, 0x58(%rsp)
jmp 0x46871
movq 0x5d8(%rsp), %rax
movl 0x14(%rax), %eax
subl $0x1, %eax
movl %eax, 0x58(%rsp)
movl 0x58(%rsp), %eax
movl %eax, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, 0x538(%rsp)
movq 0x5d8(%rsp), %rax
movq 0x18(%rax), %rax
movl 0x538(%rsp), %ecx
movq 0x5d8(%rsp), %rdx
imull 0x10(%rdx), %ecx
addl 0x53c(%rsp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, 0x537(%rsp)
movq 0x5d8(%rsp), %rax
addq $0x20, %rax
movzbl 0x537(%rsp), %ecx
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movb (%rax), %al
movb %al, 0x534(%rsp)
movq 0x5d8(%rsp), %rax
addq $0x20, %rax
movzbl 0x537(%rsp), %ecx
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movb 0x1(%rax), %al
movb %al, 0x535(%rsp)
movq 0x5d8(%rsp), %rax
addq $0x20, %rax
movzbl 0x537(%rsp), %ecx
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movb 0x2(%rax), %al
movb %al, 0x536(%rsp)
movsd 0x558(%rsp), %xmm1
cvtsi2sdl 0x5c8(%rsp), %xmm0
cvtsi2sdl 0x51c(%rsp), %xmm2
movsd 0x26ba8(%rip), %xmm3    # 0x6d4f0
addsd %xmm3, %xmm2
subsd 0x528(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x272c3(%rip), %xmm1    # 0x6dc28
divsd %xmm1, %xmm0
cvtsi2sdl 0x580(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x508(%rsp)
movsd 0x550(%rsp), %xmm1
cvtsi2sdl 0x5c8(%rsp), %xmm0
cvtsi2sdl 0x518(%rsp), %xmm2
movsd 0x26b4e(%rip), %xmm3    # 0x6d4f0
addsd %xmm3, %xmm2
subsd 0x520(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x27269(%rip), %xmm1    # 0x6dc28
divsd %xmm1, %xmm0
cvtsi2sdl 0x584(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x500(%rsp)
movq 0x610(%rsp), %rdi
leaq 0x570(%rsp), %rsi
movsd 0x508(%rsp), %xmm0
movsd 0x500(%rsp), %xmm1
leaq 0x4f4(%rsp), %rdx
callq 0x481a0
movq 0x510(%rsp), %rax
movss 0x23634(%rip), %xmm0    # 0x6a04c
addss 0x10(%rax), %xmm0
movss %xmm0, 0x10(%rax)
movsbl 0x5e0(%rsp), %eax
cmpl $0x7b, %eax
jne 0x46a42
movzbl 0x537(%rsp), %eax
cmpl $0xff, %eax
je 0x46b9e
movl $0x0, 0x62c(%rsp)
cmpl $0x3, 0x62c(%rsp)
jge 0x46b84
movslq 0x62c(%rsp), %rax
movzbl 0x534(%rsp,%rax), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x54(%rsp)
movslq 0x62c(%rsp), %rax
movss 0x4f4(%rsp,%rax,4), %xmm0
divss 0x5d0(%rsp), %xmm0
movss 0x5cc(%rsp), %xmm1
callq 0x44140
movaps %xmm0, %xmm1
movss 0x54(%rsp), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x4f0(%rsp)
movss 0x270dd(%rip), %xmm0    # 0x6db98
ucomiss 0x4f0(%rsp), %xmm0
jbe 0x46ad6
movss 0x4f0(%rsp), %xmm0
movss %xmm0, 0x50(%rsp)
jmp 0x46ae6
movss 0x270ba(%rip), %xmm0    # 0x6db98
movss %xmm0, 0x50(%rsp)
jmp 0x46ae6
movss 0x50(%rsp), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x46aff
xorps %xmm0, %xmm0
movss %xmm0, 0x4c(%rsp)
jmp 0x46b3e
movss 0x27091(%rip), %xmm0    # 0x6db98
ucomiss 0x4f0(%rsp), %xmm0
jbe 0x46b22
movss 0x4f0(%rsp), %xmm0
movss %xmm0, 0x48(%rsp)
jmp 0x46b32
movss 0x2706e(%rip), %xmm0    # 0x6db98
movss %xmm0, 0x48(%rsp)
jmp 0x46b32
movss 0x48(%rsp), %xmm0
movss %xmm0, 0x4c(%rsp)
movss 0x4c(%rsp), %xmm0
movq 0x510(%rsp), %rax
movslq 0x62c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movss 0x27037(%rip), %xmm2    # 0x6db98
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl 0x62c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x62c(%rsp)
jmp 0x46a4d
movq 0x510(%rsp), %rax
movss 0x27004(%rip), %xmm0    # 0x6db98
addss 0xc(%rax), %xmm0
movss %xmm0, 0xc(%rax)
jmp 0x46ba0
movl 0x58c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58c(%rsp)
jmp 0x46270
jmp 0x46bb8
movl 0x588(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x588(%rsp)
jmp 0x46240
movl $0x0, 0x588(%rsp)
movl 0x588(%rsp), %eax
cmpl 0x5c4(%rsp), %eax
jge 0x46e43
movl $0x0, 0x58c(%rsp)
movl 0x58c(%rsp), %eax
cmpl 0x5c0(%rsp), %eax
jge 0x46e2b
movq 0x5b8(%rsp), %rax
movl 0x588(%rsp), %ecx
imull 0x5c0(%rsp), %ecx
addl 0x58c(%rsp), %ecx
movslq %ecx, %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x4e8(%rsp)
movq 0x590(%rsp), %rax
movl 0x588(%rsp), %ecx
imull 0x5c0(%rsp), %ecx
addl 0x58c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x4e0(%rsp)
movq 0x4e8(%rsp), %rax
movss 0x10(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x46cb7
jp 0x46cb7
movq 0x4e0(%rsp), %rax
movb $0x0, (%rax)
movq 0x4e0(%rsp), %rax
movb $0x0, 0x1(%rax)
movq 0x4e0(%rsp), %rax
movb $0x0, 0x2(%rax)
movq 0x4e0(%rsp), %rax
movb $-0x1, 0x3(%rax)
jmp 0x46e13
movq 0x4e8(%rsp), %rax
movss 0xc(%rax), %xmm0
movq 0x4e8(%rsp), %rax
divss 0x10(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x27893(%rip), %xmm0    # 0x6e570
ucomisd %xmm1, %xmm0
jb 0x46d17
movq 0x4e0(%rsp), %rax
movb $0x0, (%rax)
movq 0x4e0(%rsp), %rax
movb $0x0, 0x1(%rax)
movq 0x4e0(%rsp), %rax
movb $0x0, 0x2(%rax)
movq 0x4e0(%rsp), %rax
movb $0x0, 0x3(%rax)
jmp 0x46e11
movl $0x0, 0x630(%rsp)
cmpl $0x3, 0x630(%rsp)
jge 0x46e05
movq 0x4e8(%rsp), %rax
movslq 0x630(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x4e8(%rsp), %rax
divss 0xc(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x26792(%rip), %xmm1    # 0x6d4f0
addsd %xmm1, %xmm0
callq 0x45a0
cvttsd2si %xmm0, %eax
movl %eax, 0x4dc(%rsp)
cmpl $0xff, 0x4dc(%rsp)
jge 0x46d8c
movl 0x4dc(%rsp), %eax
movl %eax, 0x44(%rsp)
jmp 0x46d97
movl $0xff, %eax
movl %eax, 0x44(%rsp)
jmp 0x46d97
movl 0x44(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jle 0x46da9
xorl %eax, %eax
movl %eax, 0x40(%rsp)
jmp 0x46dd6
cmpl $0xff, 0x4dc(%rsp)
jge 0x46dc3
movl 0x4dc(%rsp), %eax
movl %eax, 0x3c(%rsp)
jmp 0x46dce
movl $0xff, %eax
movl %eax, 0x3c(%rsp)
jmp 0x46dce
movl 0x3c(%rsp), %eax
movl %eax, 0x40(%rsp)
movl 0x40(%rsp), %eax
movb %al, %dl
movq 0x4e0(%rsp), %rax
movslq 0x630(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl 0x630(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x630(%rsp)
jmp 0x46d22
movq 0x4e0(%rsp), %rax
movb $-0x1, 0x3(%rax)
jmp 0x46e13
jmp 0x46e15
movl 0x58c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58c(%rsp)
jmp 0x46bf8
jmp 0x46e2d
movl 0x588(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x588(%rsp)
jmp 0x46bd9
movl $0x1, 0x628(%rsp)
cmpl $0x4, 0x628(%rsp)
jge 0x472fa
movl $0x0, 0x588(%rsp)
movl 0x588(%rsp), %eax
movl 0x5c4(%rsp), %edx
movl 0x628(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x472e2
movl $0x0, 0x58c(%rsp)
movl 0x58c(%rsp), %eax
movl 0x5c0(%rsp), %edx
movl 0x628(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x472ca
movslq 0x628(%rsp), %rax
movq 0x590(%rsp,%rax,8), %rax
movl 0x588(%rsp), %ecx
movl %ecx, 0x28(%rsp)
movl 0x5c0(%rsp), %edx
movl 0x628(%rsp), %ecx
sarl %cl, %edx
movl 0x28(%rsp), %ecx
imull %edx, %ecx
addl 0x58c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x4a8(%rsp)
movl 0x628(%rsp), %eax
subl $0x1, %eax
cltq
movq 0x590(%rsp,%rax,8), %rax
movl 0x588(%rsp), %ecx
shll %ecx
movl %ecx, 0x2c(%rsp)
movl 0x5c0(%rsp), %edx
movl 0x628(%rsp), %ecx
subl $0x1, %ecx
sarl %cl, %edx
movl 0x2c(%rsp), %ecx
imull %edx, %ecx
movl 0x58c(%rsp), %edx
shll %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x4b0(%rsp)
movl 0x628(%rsp), %eax
subl $0x1, %eax
cltq
movq 0x590(%rsp,%rax,8), %rax
movl 0x588(%rsp), %ecx
shll %ecx
movl %ecx, 0x30(%rsp)
movl 0x5c0(%rsp), %edx
movl 0x628(%rsp), %ecx
subl $0x1, %ecx
sarl %cl, %edx
movl 0x30(%rsp), %ecx
imull %edx, %ecx
movl 0x58c(%rsp), %edx
shll %edx
addl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x4b8(%rsp)
movl 0x628(%rsp), %eax
subl $0x1, %eax
cltq
movq 0x590(%rsp,%rax,8), %rax
movl 0x588(%rsp), %ecx
shll %ecx
addl $0x1, %ecx
movl %ecx, 0x34(%rsp)
movl 0x5c0(%rsp), %edx
movl 0x628(%rsp), %ecx
subl $0x1, %ecx
sarl %cl, %edx
movl 0x34(%rsp), %ecx
imull %edx, %ecx
movl 0x58c(%rsp), %edx
shll %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x4c0(%rsp)
movl 0x628(%rsp), %eax
subl $0x1, %eax
cltq
movq 0x590(%rsp,%rax,8), %rax
movl 0x588(%rsp), %ecx
shll %ecx
addl $0x1, %ecx
movl %ecx, 0x38(%rsp)
movl 0x5c0(%rsp), %edx
movl 0x628(%rsp), %ecx
subl $0x1, %ecx
sarl %cl, %edx
movl 0x38(%rsp), %ecx
imull %edx, %ecx
movl 0x58c(%rsp), %edx
shll %edx
addl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x4c8(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x490(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x488(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x480(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x498(%rsp)
movl $0x0, 0x62c(%rsp)
cmpl $0x4, 0x62c(%rsp)
jge 0x4716d
movl $0x0, 0x630(%rsp)
cmpl $0x3, 0x630(%rsp)
jge 0x4712d
movslq 0x62c(%rsp), %rax
movq 0x4b0(%rsp,%rax,8), %rax
movzbl 0x3(%rax), %eax
movslq 0x62c(%rsp), %rcx
movq 0x4b0(%rsp,%rcx,8), %rcx
movslq 0x630(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm0
movslq 0x630(%rsp), %rax
addsd 0x480(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x480(%rsp,%rax,8)
movl 0x630(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x630(%rsp)
jmp 0x470bf
movslq 0x62c(%rsp), %rax
movq 0x4b0(%rsp,%rax,8), %rax
movzbl 0x3(%rax), %eax
cvtsi2sd %eax, %xmm0
addsd 0x498(%rsp), %xmm0
movsd %xmm0, 0x498(%rsp)
movl 0x62c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x62c(%rsp)
jmp 0x470a6
movsd 0x498(%rsp), %xmm1
movsd 0x273fa(%rip), %xmm0    # 0x6e578
divsd %xmm0, %xmm1
movsd 0x273e6(%rip), %xmm0    # 0x6e570
ucomisd %xmm1, %xmm0
jb 0x471c4
movq 0x4a8(%rsp), %rax
movb $0x0, 0x2(%rax)
movq 0x4a8(%rsp), %rax
movb $0x0, 0x1(%rax)
movq 0x4a8(%rsp), %rax
movb $0x0, (%rax)
movq 0x4a8(%rsp), %rax
movb $0x0, 0x3(%rax)
jmp 0x472b2
movl $0x0, 0x630(%rsp)
cmpl $0x3, 0x630(%rsp)
jge 0x472a6
movslq 0x630(%rsp), %rax
movsd 0x480(%rsp,%rax,8), %xmm0
divsd 0x498(%rsp), %xmm0
movsd 0x262f1(%rip), %xmm1    # 0x6d4f0
addsd %xmm1, %xmm0
callq 0x45a0
cvttsd2si %xmm0, %eax
movl %eax, 0x47c(%rsp)
cmpl $0xff, 0x47c(%rsp)
jge 0x4722d
movl 0x47c(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x47238
movl $0xff, %eax
movl %eax, 0x24(%rsp)
jmp 0x47238
movl 0x24(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jle 0x4724a
xorl %eax, %eax
movl %eax, 0x20(%rsp)
jmp 0x47277
cmpl $0xff, 0x47c(%rsp)
jge 0x47264
movl 0x47c(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x4726f
movl $0xff, %eax
movl %eax, 0x1c(%rsp)
jmp 0x4726f
movl 0x1c(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
movb %al, %dl
movq 0x4a8(%rsp), %rax
movslq 0x630(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl 0x630(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x630(%rsp)
jmp 0x471cf
movq 0x4a8(%rsp), %rax
movb $-0x1, 0x3(%rax)
jmp 0x472b4
movl 0x58c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58c(%rsp)
jmp 0x46e93
jmp 0x472cc
movl 0x588(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x588(%rsp)
jmp 0x46e67
jmp 0x472e4
movl 0x628(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x628(%rsp)
jmp 0x46e4e
movl $0x100, %edi            # imm = 0x100
callq 0x48750
movq %rax, 0x168(%rsp)
movsbl 0x5e0(%rsp), %eax
cmpl $0x7b, %eax
jne 0x47370
movl $0x0, 0x164(%rsp)
movl $0xff, 0x15c(%rsp)
movq 0x5d8(%rsp), %rax
movb 0x31d(%rax), %al
movb %al, 0x46d(%rsp)
movq 0x5d8(%rsp), %rax
movb 0x31e(%rax), %al
movb %al, 0x46e(%rsp)
movq 0x5d8(%rsp), %rax
movb 0x31f(%rax), %al
movb %al, 0x46f(%rsp)
jmp 0x47386
movl $0x0, 0x164(%rsp)
movl $0x100, 0x15c(%rsp) # imm = 0x100
movl 0x5c0(%rsp), %eax
imull 0x5c4(%rsp), %eax
cltq
imulq $0x3, %rax, %rdi
callq 0x4430
movq %rax, 0x150(%rsp)
cmpq $0x0, 0x150(%rsp)
setne %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x1, %esi
callq 0xbf00
movl $0x0, 0x158(%rsp)
movl $0x0, 0x588(%rsp)
movl 0x588(%rsp), %eax
cmpl 0x5c4(%rsp), %eax
jge 0x474fc
movl $0x0, 0x58c(%rsp)
movl 0x58c(%rsp), %eax
cmpl 0x5c0(%rsp), %eax
jge 0x474e4
movq 0x590(%rsp), %rax
movl 0x588(%rsp), %ecx
imull 0x5c0(%rsp), %ecx
addl 0x58c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x148(%rsp)
movq 0x148(%rsp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x0, %eax
jle 0x474cc
movq 0x148(%rsp), %rax
movb (%rax), %cl
movq 0x150(%rsp), %rax
movslq 0x158(%rsp), %rdx
imulq $0x3, %rdx, %rdx
addq %rdx, %rax
movb %cl, (%rax)
movq 0x148(%rsp), %rax
movb 0x1(%rax), %cl
movq 0x150(%rsp), %rax
movslq 0x158(%rsp), %rdx
imulq $0x3, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x1(%rax)
movq 0x148(%rsp), %rax
movb 0x2(%rax), %cl
movq 0x150(%rsp), %rax
movslq 0x158(%rsp), %rdx
imulq $0x3, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x2(%rax)
movl 0x158(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x158(%rsp)
jmp 0x474ce
movl 0x58c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58c(%rsp)
jmp 0x473f9
jmp 0x474e6
movl 0x588(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x588(%rsp)
jmp 0x473da
movl 0x158(%rsp), %edi
movq 0x150(%rsp), %rsi
movl 0x15c(%rsp), %edx
movslq 0x164(%rsp), %rax
leaq 0x170(%rsp), %rcx
imulq $0x3, %rax, %rax
addq %rax, %rcx
movq 0x168(%rsp), %r9
leaq 0x160(%rsp), %r8
callq 0x487a0
movl 0x160(%rsp), %eax
movl %eax, 0x630(%rsp)
movl 0x630(%rsp), %eax
cmpl 0x15c(%rsp), %eax
jge 0x475e1
movl 0x164(%rsp), %eax
addl 0x630(%rsp), %eax
movslq %eax, %rcx
leaq 0x170(%rsp), %rax
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x2(%rax)
movl 0x164(%rsp), %eax
addl 0x630(%rsp), %eax
movslq %eax, %rcx
leaq 0x170(%rsp), %rax
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x1(%rax)
movl 0x164(%rsp), %eax
addl 0x630(%rsp), %eax
movslq %eax, %rcx
leaq 0x170(%rsp), %rax
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl 0x630(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x630(%rsp)
jmp 0x4754c
movq 0x150(%rsp), %rdi
callq 0x43a0
leaq 0x119ee07(%rip), %rax   # 0x11e63fc
cmpl $0x7fff, (%rax)         # imm = 0x7FFF
setl %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x26, %esi
callq 0xbf00
leaq 0x119ede7(%rip), %rax   # 0x11e63fc
movl (%rax), %eax
movw %ax, %cx
movq 0x610(%rsp), %rax
movw %cx, 0xa(%rax)
leaq 0x119edcf(%rip), %rax   # 0x11e63fc
movslq (%rax), %rcx
leaq 0x119edc9(%rip), %rax   # 0x11e6400
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x140(%rsp)
leaq 0x119edaf(%rip), %rax   # 0x11e63fc
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x119eda3(%rip), %rax   # 0x11e63fc
movl %ecx, (%rax)
movslq 0x604(%rsp), %rax
leaq 0x119ed96(%rip), %rsi   # 0x11e6400
imulq $0x28, %rax, %rax
addq %rax, %rsi
movq 0x140(%rsp), %rdi
movl $0x28, %edx
callq 0x4280
cmpl $0x1, 0x5c8(%rsp)
je 0x47824
movl $0x0, 0x62c(%rsp)
cmpl $0x2, 0x62c(%rsp)
jge 0x47822
movq 0x140(%rsp), %rax
movslq 0x62c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
cvtsi2sdl 0x5c8(%rsp), %xmm2
movsd 0x25b0e(%rip), %xmm1    # 0x6d1e8
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x140(%rsp), %rax
movslq 0x62c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss %xmm0, (%rax)
movq 0x140(%rsp), %rax
movslq 0x62c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
cvtsi2sdl 0x5c8(%rsp), %xmm2
movsd 0x25ab6(%rip), %xmm1    # 0x6d1e8
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x140(%rsp), %rax
movslq 0x62c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss %xmm0, 0x4(%rax)
movq 0x140(%rsp), %rax
movslq 0x62c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
cvtsi2sdl 0x5c8(%rsp), %xmm2
movsd 0x25a5d(%rip), %xmm1    # 0x6d1e8
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x140(%rsp), %rax
movslq 0x62c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss %xmm0, 0x8(%rax)
movq 0x140(%rsp), %rax
movslq 0x62c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss 0xc(%rax), %xmm0
cvtsi2ssl 0x5c8(%rsp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x25d08(%rip), %xmm1    # 0x6d4f0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x140(%rsp), %rax
movslq 0x62c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss %xmm0, 0xc(%rax)
movl 0x62c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x62c(%rsp)
jmp 0x4769c
jmp 0x47824
callq 0x45770
movl %eax, %ecx
movq 0x140(%rsp), %rax
movl %ecx, 0x20(%rax)
movl $0x28, 0x13c(%rsp)
movl $0x0, 0x628(%rsp)
cmpl $0x4, 0x628(%rsp)
jge 0x4789c
movl 0x5c0(%rsp), %eax
movl 0x628(%rsp), %ecx
sarl %cl, %eax
movl 0x5c4(%rsp), %edx
movl 0x628(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
imull %ecx, %eax
addl 0x13c(%rsp), %eax
movl %eax, 0x13c(%rsp)
movl 0x628(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x628(%rsp)
jmp 0x4784c
movl 0x13c(%rsp), %eax
addl $0x304, %eax            # imm = 0x304
movl %eax, 0x13c(%rsp)
movslq 0x13c(%rsp), %rdi
callq 0x4430
movq %rax, 0x130(%rsp)
cmpq $0x0, 0x130(%rsp)
setne %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x1, %esi
callq 0xbf00
movq 0x130(%rsp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x41b0
movl 0x5c0(%rsp), %ecx
movq 0x130(%rsp), %rax
movl %ecx, 0x10(%rax)
movl 0x5c4(%rsp), %ecx
movq 0x130(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x130(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x128(%rsp)
movl $0x0, 0x628(%rsp)
cmpl $0x4, 0x628(%rsp)
jge 0x47b3a
movq 0x128(%rsp), %rax
movq 0x130(%rsp), %rcx
subq %rcx, %rax
movl %eax, %edx
movq 0x130(%rsp), %rax
movslq 0x628(%rsp), %rcx
movl %edx, 0x18(%rax,%rcx,4)
movl $0x0, 0x124(%rsp)
movl 0x124(%rsp), %eax
movl 0x5c4(%rsp), %edx
movl 0x628(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x47b22
movl $0x0, 0x120(%rsp)
movl 0x120(%rsp), %eax
movl 0x5c0(%rsp), %edx
movl 0x628(%rsp), %ecx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x47b0a
movslq 0x628(%rsp), %rax
movq 0x590(%rsp,%rax,8), %rax
movl 0x124(%rsp), %ecx
movl %ecx, 0x18(%rsp)
movl 0x5c0(%rsp), %edx
movl 0x628(%rsp), %ecx
sarl %cl, %edx
movl 0x18(%rsp), %ecx
imull %edx, %ecx
addl 0x120(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x118(%rsp)
movq 0x118(%rsp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x0, %eax
jle 0x47ad5
cmpl $0x0, 0x160(%rsp)
je 0x47abd
movq 0x118(%rsp), %rax
movb (%rax), %al
movb %al, 0x115(%rsp)
movq 0x118(%rsp), %rax
movb 0x1(%rax), %al
movb %al, 0x116(%rsp)
movq 0x118(%rsp), %rax
movb 0x2(%rax), %al
movb %al, 0x117(%rsp)
movl 0x164(%rsp), %eax
movl %eax, 0x14(%rsp)
leaq 0x115(%rsp), %rdi
movslq 0x164(%rsp), %rax
leaq 0x170(%rsp), %rsi
imulq $0x3, %rax, %rax
addq %rax, %rsi
movl 0x160(%rsp), %edx
movq 0x168(%rsp), %rcx
callq 0x49030
movl %eax, %ecx
movl 0x14(%rsp), %eax
addl %ecx, %eax
movb %al, %cl
movq 0x128(%rsp), %rax
movb %cl, (%rax)
jmp 0x47ad3
movl 0x164(%rsp), %eax
addl $0x0, %eax
movb %al, %cl
movq 0x128(%rsp), %rax
movb %cl, (%rax)
jmp 0x47ae0
movq 0x128(%rsp), %rax
movb $-0x1, (%rax)
movq 0x128(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x128(%rsp)
movl 0x120(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x120(%rsp)
jmp 0x479a5
jmp 0x47b0c
movl 0x124(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x124(%rsp)
jmp 0x47979
jmp 0x47b24
movl 0x628(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x628(%rsp)
jmp 0x47937
movq 0x128(%rsp), %rax
movw $0x100, (%rax)          # imm = 0x100
movq 0x128(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x128(%rsp)
movq 0x128(%rsp), %rdi
leaq 0x170(%rsp), %rsi
movl $0x300, %edx            # imm = 0x300
callq 0x4280
movq 0x128(%rsp), %rax
addq $0x300, %rax            # imm = 0x300
movq %rax, 0x128(%rsp)
movq 0x128(%rsp), %rax
movw $0x0, (%rax)
movq 0x128(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x128(%rsp)
movq 0x128(%rsp), %rax
movq 0x130(%rsp), %rcx
movslq 0x13c(%rsp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
je 0x47bda
leaq 0x26e0f(%rip), %rdi     # 0x6e9e2
movb $0x0, %al
callq 0xb580
movsbl 0x5e0(%rsp), %eax
cmpl $0x7b, %eax
jne 0x47bfd
movq 0x130(%rsp), %rdi
leaq 0x26e14(%rip), %rsi     # 0x6ea0a
callq 0x42e0
jmp 0x47c11
movq 0x130(%rsp), %rdi
leaq 0x26e04(%rip), %rsi     # 0x6ea10
callq 0x42e0
cmpl $0x0, 0x604(%rsp)
jl 0x47c28
cmpl $0x1869f, 0x604(%rsp) # imm = 0x1869F
jle 0x47c36
leaq 0x26de7(%rip), %rdi     # 0x6ea16
movb $0x0, %al
callq 0xb580
movl 0x604(%rsp), %eax
movl $0x2710, %ecx           # imm = 0x2710
cltd
idivl %ecx
movl $0xa, %ecx
cltd
idivl %ecx
addl $0x30, %edx
movb %dl, %cl
movq 0x130(%rsp), %rax
movb %cl, 0x5(%rax)
movl 0x604(%rsp), %eax
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
movl $0xa, %ecx
cltd
idivl %ecx
addl $0x30, %edx
movb %dl, %cl
movq 0x130(%rsp), %rax
movb %cl, 0x6(%rax)
movl 0x604(%rsp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl $0xa, %ecx
cltd
idivl %ecx
addl $0x30, %edx
movb %dl, %cl
movq 0x130(%rsp), %rax
movb %cl, 0x7(%rax)
movl 0x604(%rsp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl $0xa, %ecx
cltd
idivl %ecx
addl $0x30, %edx
movb %dl, %cl
movq 0x130(%rsp), %rax
movb %cl, 0x8(%rax)
movl 0x604(%rsp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
addl $0x30, %edx
movb %dl, %cl
movq 0x130(%rsp), %rax
movb %cl, 0x9(%rax)
movl $0x0, 0xcc(%rsp)
cmpl $0x3e, 0xcc(%rsp)
jge 0x47d81
cmpl $0x24, 0xcc(%rsp)
jl 0x47d23
movl 0xcc(%rsp), %eax
subl $0x24, %eax
addl $0x61, %eax
movl %eax, 0x10(%rsp)
jmp 0x47d56
cmpl $0xa, 0xcc(%rsp)
jl 0x47d40
movl 0xcc(%rsp), %eax
subl $0xa, %eax
addl $0x41, %eax
movl %eax, 0xc(%rsp)
jmp 0x47d4e
movl 0xcc(%rsp), %eax
addl $0x30, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
movb %al, %cl
movslq 0xcc(%rsp), %rax
movb %cl, 0xd0(%rsp,%rax)
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x47cfc
movq 0x130(%rsp), %rax
movb $0x0, 0xa(%rax)
movq 0x130(%rsp), %rax
movb $0x0, 0xb(%rax)
movq 0x130(%rsp), %rax
movb $0x0, 0xc(%rax)
movq 0x130(%rsp), %rax
movb $0x0, 0xd(%rax)
movq 0x130(%rsp), %rax
movb $0x0, 0xe(%rax)
movq 0x130(%rsp), %rax
movb $0x0, 0xf(%rax)
movl 0x13c(%rsp), %edi
movq 0x130(%rsp), %rsi
callq 0x49180
movl %eax, 0xc8(%rsp)
movl 0xc8(%rsp), %eax
movl $0x3e, %ecx
xorl %edx, %edx
divl %ecx
movl $0x3e, %ecx
xorl %edx, %edx
divl %ecx
movl $0x34, %ecx
xorl %edx, %edx
divl %ecx
addl $0xa, %edx
movl %edx, %eax
movb 0xd0(%rsp,%rax), %cl
movq 0x130(%rsp), %rax
movb %cl, 0xa(%rax)
movl 0xc8(%rsp), %eax
movl $0x3e, %ecx
xorl %edx, %edx
divl %ecx
movl $0x3e, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movb 0xd0(%rsp,%rax), %cl
movq 0x130(%rsp), %rax
movb %cl, 0xb(%rax)
movl 0xc8(%rsp), %eax
movl $0x3e, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movb 0xd0(%rsp,%rax), %cl
movq 0x130(%rsp), %rax
movb %cl, 0xc(%rax)
movl 0x624(%rsp), %eax
movl $0x3e, %ecx
cltd
idivl %ecx
movl $0x3e, %ecx
cltd
idivl %ecx
movslq %edx, %rax
movb 0xd0(%rsp,%rax), %cl
movq 0x130(%rsp), %rax
movb %cl, 0xd(%rax)
movl 0x624(%rsp), %eax
movl $0x3e, %ecx
cltd
idivl %ecx
movslq %edx, %rax
movb 0xd0(%rsp,%rax), %cl
movq 0x130(%rsp), %rax
movb %cl, 0xe(%rax)
movq 0x130(%rsp), %rax
movb $0x0, 0xf(%rax)
movl 0x13c(%rsp), %edi
movq 0x130(%rsp), %rsi
callq 0x45790
movl 0x624(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x624(%rsp)
movl 0x13c(%rsp), %eax
addl 0x620(%rsp), %eax
movl %eax, 0x620(%rsp)
movq 0x130(%rsp), %rdx
leaq 0x5e0(%rsp), %rcx
movslq 0x634(%rsp), %rsi
leaq 0x4c31a0d(%rip), %rax   # 0x4c79930
imulq $0xc, %rsi, %rsi
addq %rsi, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movslq 0x634(%rsp), %rsi
leaq 0x4c319ef(%rip), %rax   # 0x4c79930
imulq $0xc, %rsi, %rsi
addq %rsi, %rax
movss 0x4(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movslq 0x634(%rsp), %rsi
leaq 0x4c319d0(%rip), %rax   # 0x4c79930
imulq $0xc, %rsi, %rsi
addq %rsi, %rax
movss 0x8(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movl $0x3, %edi
leaq 0x26ad8(%rip), %rsi     # 0x6ea54
movb $0x3, %al
callq 0xbbf0
movq 0x130(%rsp), %rdi
callq 0x43a0
movq 0x168(%rsp), %rdi
callq 0x491d0
movq 0x5b8(%rsp), %rdi
callq 0x43a0
movl $0x0, 0x628(%rsp)
cmpl $0x4, 0x628(%rsp)
jge 0x47fe7
movslq 0x628(%rsp), %rax
movq 0x590(%rsp,%rax,8), %rdi
callq 0x43a0
movl 0x628(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x628(%rsp)
jmp 0x47fb5
jmp 0x47fe9
movl 0x634(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x634(%rsp)
jmp 0x45b63
callq 0x45850
testb $0x1, 0x61f(%rsp)
je 0x4802a
movl 0x624(%rsp), %esi
movl 0x620(%rsp), %edx
leaq 0x26a74(%rip), %rdi     # 0x6ea97
movb $0x0, %al
callq 0xb0d0
addq $0x638, %rsp            # imm = 0x638
retq
nopw %cs:(%rax,%rax)