// File: FreeSlave[P]vhlt/hlcsg/textures.cpp
// Function: TexinfoForBrushTexture(plane_t const*, brush_texture_t*, double const*)
int             TexinfoForBrushTexture(const plane_t* const plane, brush_texture_t* bt, const vec3_t origin
#ifdef ZHLT_HIDDENSOUNDTEXTURE
					, bool shouldhide
#endif
					)
{
    vec3_t          vecs[2];
    int             sv, tv;
    vec_t           ang, sinv, cosv;
    vec_t           ns, nt;
    texinfo_t       tx;
    texinfo_t*      tc;
    int             i, j, k;

#ifdef HLCSG_HLBSP_VOIDTEXINFO
	if (!strncasecmp(bt->name, "NULL", 4))
	{
		return -1;
	}
#endif
    memset(&tx, 0, sizeof(tx));
#ifndef HLCSG_CUSTOMHULL
#ifdef HLCSG_PRECISIONCLIP
	if(!strncmp(bt->name,"BEVEL",5))
	{
		tx.flags |= TEX_BEVEL;
		safe_strncpy(bt->name,"NULL",5);
	}
#endif
#endif
#ifndef HLCSG_AUTOWAD_NEW
#ifdef HLCSG_AUTOWAD_TEXTURELIST_FIX
	ThreadLock ();
	autowad_PushName (bt->name);
	ThreadUnlock ();
#endif
#endif
#ifdef HLCSG_TEXMAP64_FIX
	FindMiptex (bt->name);
#else
    tx.miptex = FindMiptex(bt->name);

    // Note: FindMiptex() still needs to be called here to add it to the global miptex array

    // Very Sleazy Hack 104 - since the tx.miptex index will be bogus after we sort the miptex array later
    // Put the string name of the miptex in this "index" until after we are done sorting it in WriteMiptex().
    tx.miptex = texmap64_store(strdup(bt->name));
#endif

    // set the special flag
    if (bt->name[0] == '*'
        || !strncasecmp(bt->name, "sky", 3)

// =====================================================================================
//Cpt_Andrew - Env_Sky Check
// =====================================================================================
        || !strncasecmp(bt->name, "env_sky", 5)
// =====================================================================================

#ifndef HLCSG_CUSTOMHULL
        || !strncasecmp(bt->name, "clip", 4)
#endif
        || !strncasecmp(bt->name, "origin", 6)
#ifdef ZHLT_NULLTEX // AJM
        || !strncasecmp(bt->name, "null", 4)
#endif
        || !strncasecmp(bt->name, "aaatrigger", 10)
       )
    {
		// actually only 'sky' and 'aaatrigger' needs this. --vluzacn
        tx.flags |= TEX_SPECIAL;
    }
#ifdef ZHLT_HIDDENSOUNDTEXTURE
	if (shouldhide)
	{
		tx.flags |= TEX_SHOULDHIDE;
	}
#endif

    if (bt->txcommand)
    {
        memcpy(tx.vecs, bt->vects.quark.vects, sizeof(tx.vecs));
        if (origin[0] || origin[1] || origin[2])
        {
            tx.vecs[0][3] += DotProduct(origin, tx.vecs[0]);
            tx.vecs[1][3] += DotProduct(origin, tx.vecs[1]);
        }
    }
    else
    {
        if (g_nMapFileVersion < 220)
        {
            TextureAxisFromPlane(plane, vecs[0], vecs[1]);
        }

        if (!bt->vects.valve.scale[0])
        {
            bt->vects.valve.scale[0] = 1;
        }
        if (!bt->vects.valve.scale[1])
        {
            bt->vects.valve.scale[1] = 1;
        }

        if (g_nMapFileVersion < 220)
        {
            // rotate axis
            if (bt->vects.valve.rotate == 0)
            {
                sinv = 0;
                cosv = 1;
            }
            else if (bt->vects.valve.rotate == 90)
            {
                sinv = 1;
                cosv = 0;
            }
            else if (bt->vects.valve.rotate == 180)
            {
                sinv = 0;
                cosv = -1;
            }
            else if (bt->vects.valve.rotate == 270)
            {
                sinv = -1;
                cosv = 0;
            }
            else
            {
                ang = bt->vects.valve.rotate / 180 * Q_PI;
                sinv = sin(ang);
                cosv = cos(ang);
            }

            if (vecs[0][0])
            {
                sv = 0;
            }
            else if (vecs[0][1])
            {
                sv = 1;
            }
            else
            {
                sv = 2;
            }

            if (vecs[1][0])
            {
                tv = 0;
            }
            else if (vecs[1][1])
            {
                tv = 1;
            }
            else
            {
                tv = 2;
            }

            for (i = 0; i < 2; i++)
            {
                ns = cosv * vecs[i][sv] - sinv * vecs[i][tv];
                nt = sinv * vecs[i][sv] + cosv * vecs[i][tv];
                vecs[i][sv] = ns;
                vecs[i][tv] = nt;
            }

            for (i = 0; i < 2; i++)
            {
                for (j = 0; j < 3; j++)
                {
                    tx.vecs[i][j] = vecs[i][j] / bt->vects.valve.scale[i];
                }
            }
        }
        else
        {
            vec_t           scale;

            scale = 1 / bt->vects.valve.scale[0];
            VectorScale(bt->vects.valve.UAxis, scale, tx.vecs[0]);

            scale = 1 / bt->vects.valve.scale[1];
            VectorScale(bt->vects.valve.VAxis, scale, tx.vecs[1]);
        }

        tx.vecs[0][3] = bt->vects.valve.shift[0] + DotProduct(origin, tx.vecs[0]);
        tx.vecs[1][3] = bt->vects.valve.shift[1] + DotProduct(origin, tx.vecs[1]);
    }

    //
    // find the g_texinfo
    //
    ThreadLock();
    tc = g_texinfo;
    for (i = 0; i < g_numtexinfo; i++, tc++)
    {
        // Sleazy hack 104, Pt 3 - Use strcmp on names to avoid dups
#ifdef HLCSG_TEXMAP64_FIX
		if (strcmp (texmap_retrieve (tc->miptex), bt->name) != 0)
#else
        if (strcmp(texmap64_retrieve((tc->miptex)), texmap64_retrieve((tx.miptex))) != 0)
#endif
        {
            continue;
        }
        if (tc->flags != tx.flags)
        {
            continue;
        }
        for (j = 0; j < 2; j++)
        {
            for (k = 0; k < 4; k++)
            {
                if (tc->vecs[j][k] != tx.vecs[j][k])
                {
                    goto skip;
                }
            }
        }
        ThreadUnlock();
        return i;
skip:;
    }

#ifdef HLCSG_HLBSP_REDUCETEXTURE
    hlassume(g_numtexinfo < MAX_INTERNAL_MAP_TEXINFO, assume_MAX_MAP_TEXINFO);
#else
    hlassume(g_numtexinfo < MAX_MAP_TEXINFO, assume_MAX_MAP_TEXINFO);
#endif

    *tc = tx;
#ifdef HLCSG_TEXMAP64_FIX
	tc->miptex = texmap_store (bt->name, false);
#endif
    g_numtexinfo++;
    ThreadUnlock();
    return i;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xc8(%rsp)
movq %rsi, 0xc0(%rsp)
movq %rdx, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
addq $0x60, %rdi
leaq 0x5a57(%rip), %rsi      # 0x2ddb9
movl $0x4, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x28381
movl $0xffffffff, 0xd4(%rsp) # imm = 0xFFFFFFFF
jmp 0x28d57
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x4210
movq 0xc0(%rsp), %rdi
addq $0x60, %rdi
callq 0x27710
movq 0xc0(%rsp), %rax
movsbl 0x60(%rax), %eax
cmpl $0x2a, %eax
je 0x28466
movq 0xc0(%rsp), %rdi
addq $0x60, %rdi
leaq 0x58c1(%rip), %rsi      # 0x2dc8c
movl $0x3, %edx
callq 0x44e0
cmpl $0x0, %eax
je 0x28466
movq 0xc0(%rsp), %rdi
addq $0x60, %rdi
leaq 0x5897(%rip), %rsi      # 0x2dc88
movl $0x5, %edx
callq 0x44e0
cmpl $0x0, %eax
je 0x28466
movq 0xc0(%rsp), %rdi
addq $0x60, %rdi
leaq 0x77ad(%rip), %rsi      # 0x2fbc0
movl $0x6, %edx
callq 0x44e0
cmpl $0x0, %eax
je 0x28466
movq 0xc0(%rsp), %rdi
addq $0x60, %rdi
leaq 0x58c6(%rip), %rsi      # 0x2dcfb
movl $0x4, %edx
callq 0x44e0
cmpl $0x0, %eax
je 0x28466
movq 0xc0(%rsp), %rdi
addq $0x60, %rdi
leaq 0x7c0d(%rip), %rsi      # 0x30064
movl $0xa, %edx
callq 0x44e0
cmpl $0x0, %eax
jne 0x28471
movl 0x4c(%rsp), %eax
orl $0x1, %eax
movl %eax, 0x4c(%rsp)
movq 0xc0(%rsp), %rax
cmpb $0x0, (%rax)
je 0x285df
movq 0xc0(%rsp), %rax
movq 0x8(%rax), %rcx
movq %rcx, 0x28(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x20(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0xb8(%rsp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x284fa
jp 0x284fa
movq 0xb8(%rsp), %rax
movsd 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x284fa
jp 0x284fa
movq 0xb8(%rsp), %rax
movsd 0x10(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x284fa
jp 0x284fa
jmp 0x285da
movq 0xb8(%rsp), %rax
movsd (%rax), %xmm0
movss 0x28(%rsp), %xmm1
cvtss2sd %xmm1, %xmm2
movq 0xb8(%rsp), %rax
movsd 0x8(%rax), %xmm1
movss 0x2c(%rsp), %xmm3
cvtss2sd %xmm3, %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0xb8(%rsp), %rax
movsd 0x10(%rax), %xmm1
movss 0x30(%rsp), %xmm2
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movss 0x34(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x34(%rsp)
movq 0xb8(%rsp), %rax
movsd (%rax), %xmm0
movss 0x38(%rsp), %xmm1
cvtss2sd %xmm1, %xmm2
movq 0xb8(%rsp), %rax
movsd 0x8(%rax), %xmm1
movss 0x3c(%rsp), %xmm3
cvtss2sd %xmm3, %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0xb8(%rsp), %rax
movsd 0x10(%rax), %xmm1
movss 0x40(%rsp), %xmm2
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movss 0x44(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x44(%rsp)
jmp 0x28bc9
leaq 0x61b306a(%rip), %rax   # 0x61db650
cmpl $0xdc, (%rax)
jge 0x2860f
movq 0xc8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x80(%rsp), %rdx
addq $0x18, %rdx
callq 0x1a6b0
movq 0xc0(%rsp), %rax
movsd 0x50(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2863c
jp 0x2863c
movq 0xc0(%rsp), %rax
movsd 0x4b41(%rip), %xmm0     # 0x2d178
movsd %xmm0, 0x50(%rax)
movq 0xc0(%rsp), %rax
movsd 0x58(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x28669
jp 0x28669
movq 0xc0(%rsp), %rax
movsd 0x4b14(%rip), %xmm0     # 0x2d178
movsd %xmm0, 0x58(%rax)
leaq 0x61b2fe0(%rip), %rax   # 0x61db650
cmpl $0xdc, (%rax)
jge 0x289ff
movq 0xc0(%rsp), %rax
movsd 0x48(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x286b0
jp 0x286b0
xorps %xmm0, %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x4ad3(%rip), %xmm0     # 0x2d178
movsd %xmm0, 0x60(%rsp)
jmp 0x287ab
movq 0xc0(%rsp), %rax
movsd 0x48(%rax), %xmm0
movsd 0x769b(%rip), %xmm1     # 0x2fd60
ucomisd %xmm1, %xmm0
jne 0x286e9
jp 0x286e9
movsd 0x4aa3(%rip), %xmm0     # 0x2d178
movsd %xmm0, 0x68(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0x287a9
movq 0xc0(%rsp), %rax
movsd 0x48(%rax), %xmm0
movsd 0x197a(%rip), %xmm1     # 0x2a078
ucomisd %xmm1, %xmm0
jne 0x28722
jp 0x28722
xorps %xmm0, %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x4d91(%rip), %xmm0     # 0x2d4a8
movsd %xmm0, 0x60(%rsp)
jmp 0x287a7
movq 0xc0(%rsp), %rax
movsd 0x48(%rax), %xmm0
movsd 0x7631(%rip), %xmm1     # 0x2fd68
ucomisd %xmm1, %xmm0
jne 0x28758
jp 0x28758
movsd 0x4d61(%rip), %xmm0     # 0x2d4a8
movsd %xmm0, 0x68(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0x287a5
movq 0xc0(%rsp), %rax
movsd 0x48(%rax), %xmm0
movsd 0x190b(%rip), %xmm1     # 0x2a078
divsd %xmm1, %xmm0
movsd 0x1907(%rip), %xmm1     # 0x2a080
mulsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x70(%rsp), %xmm0
callq 0x4100
movsd %xmm0, 0x68(%rsp)
movsd 0x70(%rsp), %xmm0
callq 0x4700
movsd %xmm0, 0x60(%rsp)
jmp 0x287a7
jmp 0x287a9
jmp 0x287ab
movsd 0x80(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x287c1
jp 0x287c1
jmp 0x287cb
movl $0x0, 0x7c(%rsp)
jmp 0x287f5
movsd 0x88(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x287e1
jp 0x287e1
jmp 0x287eb
movl $0x1, 0x7c(%rsp)
jmp 0x287f3
movl $0x2, 0x7c(%rsp)
jmp 0x287f5
movsd 0x98(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2880b
jp 0x2880b
jmp 0x28815
movl $0x0, 0x78(%rsp)
jmp 0x2883f
movsd 0xa0(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2882b
jp 0x2882b
jmp 0x28835
movl $0x1, 0x78(%rsp)
jmp 0x2883d
movl $0x2, 0x78(%rsp)
jmp 0x2883f
movl $0x0, 0x1c(%rsp)
cmpl $0x2, 0x1c(%rsp)
jge 0x2896d
movsd 0x60(%rsp), %xmm0
movslq 0x1c(%rsp), %rcx
leaq 0x80(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0x7c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x68(%rsp), %xmm1
movslq 0x1c(%rsp), %rcx
leaq 0x80(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0x78(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x68(%rsp), %xmm0
movslq 0x1c(%rsp), %rcx
leaq 0x80(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0x7c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x60(%rsp), %xmm1
movslq 0x1c(%rsp), %rcx
leaq 0x80(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0x78(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x58(%rsp), %xmm0
movslq 0x1c(%rsp), %rcx
leaq 0x80(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0x7c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x50(%rsp), %xmm0
movslq 0x1c(%rsp), %rcx
leaq 0x80(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0x78(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x28847
movl $0x0, 0x1c(%rsp)
cmpl $0x2, 0x1c(%rsp)
jge 0x289fa
movl $0x0, 0x18(%rsp)
cmpl $0x3, 0x18(%rsp)
jge 0x289e8
movslq 0x1c(%rsp), %rcx
leaq 0x80(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0xc0(%rsp), %rax
movslq 0x1c(%rsp), %rcx
divsd 0x50(%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
leaq 0x28(%rsp), %rax
movslq 0x1c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x18(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x28984
jmp 0x289ea
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x28975
jmp 0x28ae3
movq 0xc0(%rsp), %rax
movsd 0x4769(%rip), %xmm0     # 0x2d178
divsd 0x50(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x8(%rax), %xmm0
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x28(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x10(%rax), %xmm0
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x2c(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x18(%rax), %xmm0
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x30(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x46f7(%rip), %xmm0     # 0x2d178
divsd 0x58(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x20(%rax), %xmm0
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x38(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x28(%rax), %xmm0
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x3c(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x30(%rax), %xmm0
mulsd 0x8(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x40(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x38(%rax), %xmm0
movq 0xb8(%rsp), %rax
movsd (%rax), %xmm2
movss 0x28(%rsp), %xmm1
cvtss2sd %xmm1, %xmm3
movq 0xb8(%rsp), %rax
movsd 0x8(%rax), %xmm1
movss 0x2c(%rsp), %xmm4
cvtss2sd %xmm4, %xmm4
mulsd %xmm4, %xmm1
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
movq 0xb8(%rsp), %rax
movsd 0x10(%rax), %xmm1
movss 0x30(%rsp), %xmm3
cvtss2sd %xmm3, %xmm3
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x34(%rsp)
movq 0xc0(%rsp), %rax
movsd 0x40(%rax), %xmm0
movq 0xb8(%rsp), %rax
movsd (%rax), %xmm2
movss 0x38(%rsp), %xmm1
cvtss2sd %xmm1, %xmm3
movq 0xb8(%rsp), %rax
movsd 0x8(%rax), %xmm1
movss 0x3c(%rsp), %xmm4
cvtss2sd %xmm4, %xmm4
mulsd %xmm4, %xmm1
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
movq 0xb8(%rsp), %rax
movsd 0x10(%rax), %xmm1
movss 0x40(%rsp), %xmm3
cvtss2sd %xmm3, %xmm3
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x44(%rsp)
callq 0xd720
leaq 0x117689b(%rip), %rax   # 0x119f470
movq %rax, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
leaq 0x117687f(%rip), %rcx   # 0x119f46c
cmpl (%rcx), %eax
jge 0x28ce1
movq 0x20(%rsp), %rax
movl 0x20(%rax), %edi
callq 0x28290
movq %rax, %rdi
movq 0xc0(%rsp), %rsi
addq $0x60, %rsi
callq 0x4530
cmpl $0x0, %eax
je 0x28c20
jmp 0x28cc3
movq 0x20(%rsp), %rax
movl 0x24(%rax), %eax
cmpl 0x4c(%rsp), %eax
je 0x28c33
jmp 0x28cc3
movl $0x0, 0x18(%rsp)
cmpl $0x2, 0x18(%rsp)
jge 0x28cac
movl $0x0, 0x14(%rsp)
cmpl $0x4, 0x14(%rsp)
jge 0x28c9d
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x14(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
leaq 0x28(%rsp), %rax
movslq 0x18(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x14(%rsp), %rcx
ucomiss (%rax,%rcx,4), %xmm0
jne 0x28c8c
jp 0x28c8c
jmp 0x28c8e
jmp 0x28cc1
jmp 0x28c90
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x28c4a
jmp 0x28c9f
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x28c3b
callq 0xd740
movl 0x1c(%rsp), %eax
movl %eax, 0xd4(%rsp)
jmp 0x28d57
jmp 0x28cc3
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x20(%rsp)
jmp 0x28be2
leaq 0x1176784(%rip), %rax   # 0x119f46c
cmpl $0x40000, (%rax)        # imm = 0x40000
setl %al
movzbl %al, %edi
andl $0x1, %edi
movl $0x26, %esi
callq 0xc400
movq 0x20(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0x28, %edx
callq 0x4310
movq 0xc0(%rsp), %rdi
addq $0x60, %rdi
xorl %esi, %esi
callq 0x28d70
movl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x20(%rax)
leaq 0x1176733(%rip), %rax   # 0x119f46c
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x1176727(%rip), %rax   # 0x119f46c
movl %ecx, (%rax)
callq 0xd740
movl 0x1c(%rsp), %eax
movl %eax, 0xd4(%rsp)
movl 0xd4(%rsp), %eax
addq $0xd8, %rsp
retq
nopw %cs:(%rax,%rax)