// File: FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: main
int             main(const int argc, char** argv)
{
    int             i;
    double          start, end;
    const char*     mapname_from_arg = NULL;

    g_Program = "hlbsp";

#ifdef ZHLT_PARAMFILE
	int argcold = argc;
	char ** argvold = argv;
	{
		int argc;
		char ** argv;
		ParseParamFile (argcold, argvold, argc, argv);
		{
#endif
#ifdef ZHLT_CONSOLE
	if (InitConsole (argc, argv) < 0)
		Usage();
#endif
    // if we dont have any command line argvars, print out usage and die
    if (argc == 1)
        Usage();

    // check command line args
    for (i = 1; i < argc; i++)
    {
        if (!strcasecmp(argv[i], "-threads"))
        {
            if (i + 1 < argc)	//added "1" .--vluzacn
            {
                int             g_numthreads = atoi(argv[++i]);

                if (g_numthreads < 1)
                {
                    Log("Expected value of at least 1 for '-threads'\n");
                    Usage();
                }
            }
            else
            {
                Usage();
            }
        }
#ifdef ZHLT_CONSOLE
		else if (!strcasecmp(argv[i], "-console"))
		{
#ifndef SYSTEM_WIN32
			Warning("The option '-console #' is only valid for Windows.");
#endif
			if (i + 1 < argc)
				++i;
			else
				Usage();
		}
#endif
        else if (!strcasecmp(argv[i], "-notjunc"))
        {
            g_notjunc = true;
        }
#ifdef HLBSP_BRINKHACK
		else if (!strcasecmp (argv[i], "-nobrink"))
		{
			g_nobrink = true;
		}
#endif
        else if (!strcasecmp(argv[i], "-noclip"))
        {
            g_noclip = true;
        }
        else if (!strcasecmp(argv[i], "-nofill"))
        {
            g_nofill = true;
        }
#ifdef HLBSP_FILL
        else if (!strcasecmp(argv[i], "-noinsidefill"))
        {
            g_noinsidefill = true;
        }
#endif

#ifdef SYSTEM_WIN32
        else if (!strcasecmp(argv[i], "-estimate"))
        {
            g_estimate = true;
        }
#endif

#ifdef SYSTEM_POSIX
        else if (!strcasecmp(argv[i], "-noestimate"))
        {
            g_estimate = false;
        }
#endif

#ifdef ZHLT_NETVIS
        else if (!strcasecmp(argv[i], "-client"))
        {
            if (i + 1 < argc)	//added "1" .--vluzacn
            {
                g_clientid = atoi(argv[++i]);
            }
            else
            {
                Usage();
            }
        }
#endif

#ifdef ZHLT_PROGRESSFILE // AJM
        else if (!strcasecmp(argv[i], "-progressfile"))
        {
            if (i + 1 < argc)	//added "1" .--vluzacn
            {
                g_progressfile = argv[++i];
            }
            else
            {
            	Log("Error: -progressfile: expected path to progress file following parameter\n");
                Usage();
            }
        }
#endif

        else if (!strcasecmp(argv[i], "-dev"))
        {
            if (i + 1 < argc)	//added "1" .--vluzacn
            {
                g_developer = (developer_level_t)atoi(argv[++i]);
            }
            else
            {
                Usage();
            }
        }
        else if (!strcasecmp(argv[i], "-verbose"))
        {
            g_verbose = true;
        }
        else if (!strcasecmp(argv[i], "-noinfo"))
        {
            g_info = false;
        }
        else if (!strcasecmp(argv[i], "-leakonly"))
        {
            g_bLeakOnly = true;
        }
        else if (!strcasecmp(argv[i], "-chart"))
        {
            g_chart = true;
        }
        else if (!strcasecmp(argv[i], "-low"))
        {
            g_threadpriority = eThreadPriorityLow;
        }
        else if (!strcasecmp(argv[i], "-high"))
        {
            g_threadpriority = eThreadPriorityHigh;
        }
        else if (!strcasecmp(argv[i], "-nolog"))
        {
            g_log = false;
        }

#ifdef ZHLT_NULLTEX // AJM
        else if (!strcasecmp(argv[i], "-nonulltex"))
        {
            g_bUseNullTex = false;
        }
#endif

#ifdef ZHLT_DETAIL // AJM
        else if (!strcasecmp(argv[i], "-nodetail"))
        {
            g_bDetailBrushes = false;
        }
#endif

#ifdef HLBSP_REMOVEHULL2
		else if (!strcasecmp (argv[i], "-nohull2"))
		{
			g_nohull2 = true;
		}
#endif

		else if (!strcasecmp(argv[i], "-noopt"))
		{
			g_noopt = true;
		}
#ifdef HLBSP_MERGECLIPNODE
		else if (!strcasecmp (argv[i], "-noclipnodemerge"))
		{
			g_noclipnodemerge = true;
		}
#endif
        else if (!strcasecmp(argv[i], "-subdivide"))
        {
            if (i + 1 < argc)	//added "1" .--vluzacn
            {
                g_subdivide_size = atoi(argv[++i]);
                if (g_subdivide_size > MAX_SUBDIVIDE_SIZE)
                {
                    Warning
                        ("Maximum value for subdivide size is %i, '-subdivide %i' ignored",
                         MAX_SUBDIVIDE_SIZE, g_subdivide_size);
                    g_subdivide_size = MAX_SUBDIVIDE_SIZE;
                }
                else if (g_subdivide_size < MIN_SUBDIVIDE_SIZE)
                {
                    Warning
                        ("Mininum value for subdivide size is %i, '-subdivide %i' ignored",
                         MIN_SUBDIVIDE_SIZE, g_subdivide_size);
                    g_subdivide_size = MIN_SUBDIVIDE_SIZE; //MAX_SUBDIVIDE_SIZE; //--vluzacn
                }
            }
            else
            {
                Usage();
            }
        }
        else if (!strcasecmp(argv[i], "-maxnodesize"))
        {
            if (i + 1 < argc)	//added "1" .--vluzacn
            {
                g_maxnode_size = atoi(argv[++i]);
                if (g_maxnode_size > MAX_MAXNODE_SIZE)
                {
                    Warning
                        ("Maximum value for max node size is %i, '-maxnodesize %i' ignored",
                         MAX_MAXNODE_SIZE, g_maxnode_size);
                    g_maxnode_size = MAX_MAXNODE_SIZE;
                }
                else if (g_maxnode_size < MIN_MAXNODE_SIZE)
                {
                    Warning
                        ("Mininimum value for max node size is %i, '-maxnodesize %i' ignored",
                         MIN_MAXNODE_SIZE, g_maxnode_size);
                    g_maxnode_size = MIN_MAXNODE_SIZE; //MAX_MAXNODE_SIZE; //vluzacn
                }
            }
            else
            {
                Usage();
            }
        }
#ifdef HLBSP_VIEWPORTAL
		else if (!strcasecmp (argv[i], "-viewportal"))
		{
			g_viewportal = true;
		}
#endif
        else if (!strcasecmp(argv[i], "-texdata"))
        {
            if (i + 1 < argc)	//added "1" .--vluzacn
            {
                int             x = atoi(argv[++i]) * 1024;

                //if (x > g_max_map_miptex) //--vluzacn
                {
                    g_max_map_miptex = x;
                }
            }
            else
            {
                Usage();
            }
        }
        else if (!strcasecmp(argv[i], "-lightdata"))
        {
            if (i + 1 < argc)	//added "1" .--vluzacn
            {
                int             x = atoi(argv[++i]) * 1024;

                //if (x > g_max_map_lightdata) //--vluzacn
                {
                    g_max_map_lightdata = x;
                }
            }
            else
            {
                Usage();
            }
        }
#ifdef ZHLT_LANGFILE
		else if (!strcasecmp (argv[i], "-lang"))
		{
			if (i + 1 < argc)
			{
				char tmp[_MAX_PATH];
#ifdef SYSTEM_WIN32
				GetModuleFileName (NULL, tmp, _MAX_PATH);
#else
				safe_strncpy (tmp, argv[0], _MAX_PATH);
#endif
				LoadLangFile (argv[++i], tmp);
			}
			else
			{
				Usage();
			}
		}
#endif
        else if (argv[i][0] == '-')
        {
            Log("Unknown option \"%s\"\n", argv[i]);
            Usage();
        }
        else if (!mapname_from_arg)
        {
            mapname_from_arg = argv[i];
        }
        else
        {
            Log("Unknown option \"%s\"\n", argv[i]);
            Usage();
        }
    }
#ifdef HLBSP_SUBDIVIDE_INMID
	if (g_subdivide_size % TEXTURE_STEP != 0)
	{
		Warning ("Subdivide size must be a multiple of %d", (int)TEXTURE_STEP);
		g_subdivide_size = TEXTURE_STEP * (g_subdivide_size / TEXTURE_STEP);
	}
#endif

    if (!mapname_from_arg)
    {
        Log("No mapfile specified\n");
        Usage();
    }

    safe_strncpy(g_Mapname, mapname_from_arg, _MAX_PATH);
    FlipSlashes(g_Mapname);
    StripExtension(g_Mapname);
    OpenLog(g_clientid);
    atexit(CloseLog);
    ThreadSetDefault();
    ThreadSetPriority(g_threadpriority);
#ifdef ZHLT_PARAMFILE
    LogStart(argcold, argvold);
	{
		int			 i;
		Log("Arguments: ");
		for (i = 1; i < argc; i++)
		{
			if (strchr(argv[i], ' '))
			{
				Log("\"%s\" ", argv[i]);
			}
			else
			{
				Log("%s ", argv[i]);
			}
		}
		Log("\n");
	}
#else
    LogStart(argc, argv);
#endif

    CheckForErrorLog();

#ifdef ZHLT_64BIT_FIX
#ifdef PLATFORM_CAN_CALC_EXTENT
	hlassume (CalcFaceExtents_test (), assume_first);
#endif
#endif
    dtexdata_init();
    atexit(dtexdata_free);
    //Settings();
    // END INIT

    // Load the .void files for allowable entities in the void
    {
#ifndef ZHLT_DEFAULTEXTENSION_FIX
        char            g_source[_MAX_PATH];
#endif
        char            strSystemEntitiesVoidFile[_MAX_PATH];
        char            strMapEntitiesVoidFile[_MAX_PATH];

#ifndef ZHLT_DEFAULTEXTENSION_FIX
        safe_strncpy(g_source, mapname_from_arg, _MAX_PATH);
        StripExtension(g_source);
#endif

        // try looking in the current directory
        safe_strncpy(strSystemEntitiesVoidFile, ENTITIES_VOID, _MAX_PATH);
        if (!q_exists(strSystemEntitiesVoidFile))
        {
            char tmp[_MAX_PATH];
            // try looking in the directory we were run from
#ifdef SYSTEM_WIN32
            GetModuleFileName(NULL, tmp, _MAX_PATH);
#else
            safe_strncpy(tmp, argv[0], _MAX_PATH);
#endif
            ExtractFilePath(tmp, strSystemEntitiesVoidFile);
            safe_strncat(strSystemEntitiesVoidFile, ENTITIES_VOID, _MAX_PATH);
        }

        // Set the optional level specific lights filename
#ifdef ZHLT_DEFAULTEXTENSION_FIX
		safe_snprintf(strMapEntitiesVoidFile, _MAX_PATH, "%s" ENTITIES_VOID_EXT, g_Mapname);
#else
        safe_strncpy(strMapEntitiesVoidFile, g_source, _MAX_PATH);
        DefaultExtension(strMapEntitiesVoidFile, ENTITIES_VOID_EXT);
#endif

        LoadAllowableOutsideList(strSystemEntitiesVoidFile);    // default entities.void
        if (*strMapEntitiesVoidFile)
        {
            LoadAllowableOutsideList(strMapEntitiesVoidFile);   // automatic mapname.void
        }
    }

    // BEGIN BSP
    start = I_FloatTime();

    ProcessFile(g_Mapname);

    end = I_FloatTime();
    LogTimeElapsed(end - start);
    // END BSP

    FreeAllowableOutsideList();

#ifdef ZHLT_PARAMFILE
		}
	}
#endif
    return 0;
}

// Assembly:
subq $0x4078, %rsp           # imm = 0x4078
movl $0x0, 0x4074(%rsp)
movl %edi, 0x4070(%rsp)
movq %rsi, 0x4068(%rsp)
movq $0x0, 0x4048(%rsp)
leaq 0x2048c(%rip), %rax     # 0x46300
leaq 0x14873(%rip), %rcx     # 0x3a6ee
movq %rcx, (%rax)
movl 0x4070(%rsp), %eax
movl %eax, 0x4044(%rsp)
movq 0x4068(%rsp), %rax
movq %rax, 0x4038(%rsp)
movl 0x4044(%rsp), %edi
movq 0x4038(%rsp), %rsi
leaq 0x4034(%rsp), %rdx
leaq 0x4028(%rsp), %rcx
callq 0xa3f0
movl 0x4034(%rsp), %edi
movq 0x4028(%rsp), %rsi
callq 0xc120
cmpl $0x0, %eax
jge 0x25ede
callq 0x26ab0
cmpl $0x1, 0x4034(%rsp)
jne 0x25eed
callq 0x26ab0
movl $0x1, 0x4064(%rsp)
movl 0x4064(%rsp), %eax
cmpl 0x4034(%rsp), %eax
jge 0x2682e
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14875(%rip), %rsi     # 0x3a79c
callq 0x4320
cmpl $0x0, %eax
jne 0x25f99
movl 0x4064(%rsp), %eax
addl $0x1, %eax
cmpl 0x4034(%rsp), %eax
jge 0x25f8f
movq 0x4028(%rsp), %rax
movl 0x4064(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x4064(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x44a0
movl %eax, 0x4024(%rsp)
cmpl $0x1, 0x4024(%rsp)
jge 0x25f8d
leaq 0x14824(%rip), %rdi     # 0x3a7a5
movb $0x0, %al
callq 0xb060
callq 0x26ab0
jmp 0x25f94
callq 0x26ab0
jmp 0x26816
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1481e(%rip), %rsi     # 0x3a7d2
callq 0x4320
cmpl $0x0, %eax
jne 0x25ffc
leaq 0x14816(%rip), %rdi     # 0x3a7db
movb $0x0, %al
callq 0xb980
movl 0x4064(%rsp), %eax
addl $0x1, %eax
cmpl 0x4034(%rsp), %eax
jge 0x25ff2
movl 0x4064(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4064(%rsp)
jmp 0x25ff7
callq 0x26ab0
jmp 0x26814
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x147f7(%rip), %rsi     # 0x3a80e
callq 0x4320
cmpl $0x0, %eax
jne 0x2602d
movb $0x1, 0x20c99fc(%rip)   # 0x20efa24
jmp 0x26812
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x147cf(%rip), %rsi     # 0x3a817
callq 0x4320
cmpl $0x0, %eax
jne 0x2605e
movb $0x1, 0x20c99cc(%rip)   # 0x20efa25
jmp 0x26810
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x147a7(%rip), %rsi     # 0x3a820
callq 0x4320
cmpl $0x0, %eax
jne 0x2608f
movb $0x1, 0x20c999c(%rip)   # 0x20efa26
jmp 0x2680e
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1477e(%rip), %rsi     # 0x3a828
callq 0x4320
cmpl $0x0, %eax
jne 0x260c0
movb $0x1, 0x20c9967(%rip)   # 0x20efa22
jmp 0x2680c
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14755(%rip), %rsi     # 0x3a830
callq 0x4320
cmpl $0x0, %eax
jne 0x260f1
movb $0x1, 0x20c9937(%rip)   # 0x20efa23
jmp 0x2680a
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14732(%rip), %rsi     # 0x3a83e
callq 0x4320
cmpl $0x0, %eax
jne 0x26122
movb $0x0, 0x212d3(%rip)     # 0x473f0
jmp 0x26808
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1470d(%rip), %rsi     # 0x3a84a
callq 0x4320
cmpl $0x0, %eax
jne 0x26196
movl 0x4064(%rsp), %eax
addl $0x1, %eax
cmpl 0x4034(%rsp), %eax
jge 0x2618c
movq 0x4028(%rsp), %rax
movl 0x4064(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x4064(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x44a0
movl %eax, %ecx
leaq 0x20b7288(%rip), %rax   # 0x20dd410
movl %ecx, (%rax)
jmp 0x26191
callq 0x26ab0
jmp 0x26806
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1469e(%rip), %rsi     # 0x3a84f
callq 0x4320
cmpl $0x0, %eax
jne 0x261ca
leaq 0x20b7252(%rip), %rax   # 0x20dd414
movb $0x1, (%rax)
jmp 0x26804
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14673(%rip), %rsi     # 0x3a858
callq 0x4320
cmpl $0x0, %eax
jne 0x261fb
movb $0x0, 0x211fb(%rip)     # 0x473f1
jmp 0x26802
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1464a(%rip), %rsi     # 0x3a860
callq 0x4320
cmpl $0x0, %eax
jne 0x2622c
movb $0x1, 0x20c9801(%rip)   # 0x20efa28
jmp 0x26800
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14623(%rip), %rsi     # 0x3a86a
callq 0x4320
cmpl $0x0, %eax
jne 0x2625d
movb $0x1, 0x20c97cf(%rip)   # 0x20efa27
jmp 0x267fe
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x145f9(%rip), %rsi     # 0x3a871
callq 0x4320
cmpl $0x0, %eax
jne 0x26294
leaq 0x20c42e7(%rip), %rax   # 0x20ea570
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x267fc
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x145c7(%rip), %rsi     # 0x3a876
callq 0x4320
cmpl $0x0, %eax
jne 0x262cb
leaq 0x20c42b0(%rip), %rax   # 0x20ea570
movl $0x1, (%rax)
jmp 0x267fa
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14596(%rip), %rsi     # 0x3a87c
callq 0x4320
cmpl $0x0, %eax
jne 0x262ff
leaq 0x21019(%rip), %rax     # 0x47310
movb $0x0, (%rax)
jmp 0x267f8
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14569(%rip), %rsi     # 0x3a883
callq 0x4320
cmpl $0x0, %eax
jne 0x26330
movb $0x0, 0x210cd(%rip)     # 0x473f8
jmp 0x267f6
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14543(%rip), %rsi     # 0x3a88e
callq 0x4320
cmpl $0x0, %eax
jne 0x26361
movb $0x1, 0x20c96ce(%rip)   # 0x20efa2a
jmp 0x267f4
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1451b(%rip), %rsi     # 0x3a897
callq 0x4320
cmpl $0x0, %eax
jne 0x26392
movb $0x1, 0x20c9693(%rip)   # 0x20efa20
jmp 0x267f2
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x144f1(%rip), %rsi     # 0x3a89e
callq 0x4320
cmpl $0x0, %eax
jne 0x263c3
movb $0x1, 0x20c9663(%rip)   # 0x20efa21
jmp 0x267f0
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x144d1(%rip), %rsi     # 0x3a8af
callq 0x4320
cmpl $0x0, %eax
jne 0x26499
movl 0x4064(%rsp), %eax
addl $0x1, %eax
cmpl 0x4034(%rsp), %eax
jge 0x2648f
movq 0x4028(%rsp), %rax
movl 0x4064(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x4064(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x44a0
movl %eax, 0x20fc6(%rip)     # 0x473f4
cmpl $0x200, 0x20fbc(%rip)   # imm = 0x200
jle 0x2645f
movl 0x20fb4(%rip), %edx     # 0x473f4
leaq 0x14473(%rip), %rdi     # 0x3a8ba
movl $0x200, %esi            # imm = 0x200
movb $0x0, %al
callq 0xb980
movl $0x200, 0x20f97(%rip)   # imm = 0x200
jmp 0x2648d
cmpl $0x40, 0x20f8e(%rip)    # 0x473f4
jge 0x2648b
movl 0x20f86(%rip), %edx     # 0x473f4
leaq 0x14485(%rip), %rdi     # 0x3a8fa
movl $0x40, %esi
movb $0x0, %al
callq 0xb980
movl $0x40, 0x20f69(%rip)    # 0x473f4
jmp 0x2648d
jmp 0x26494
callq 0x26ab0
jmp 0x267ee
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14486(%rip), %rsi     # 0x3a93a
callq 0x4320
cmpl $0x0, %eax
jne 0x26586
movl 0x4064(%rsp), %eax
addl $0x1, %eax
cmpl 0x4034(%rsp), %eax
jge 0x2657c
movq 0x4028(%rsp), %rax
movl 0x4064(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x4064(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x44a0
movl %eax, %ecx
leaq 0x20ef5(%rip), %rax     # 0x473fc
movl %ecx, (%rax)
leaq 0x20eec(%rip), %rax     # 0x473fc
cmpl $0x10000, (%rax)        # imm = 0x10000
jle 0x26543
leaq 0x20edd(%rip), %rax     # 0x473fc
movl (%rax), %edx
leaq 0x1441f(%rip), %rdi     # 0x3a947
movl $0x10000, %esi          # imm = 0x10000
movb $0x0, %al
callq 0xb980
leaq 0x20ec1(%rip), %rax     # 0x473fc
movl $0x10000, (%rax)        # imm = 0x10000
jmp 0x2657a
leaq 0x20eb2(%rip), %rax     # 0x473fc
cmpl $0x40, (%rax)
jge 0x26578
leaq 0x20ea6(%rip), %rax     # 0x473fc
movl (%rax), %edx
leaq 0x14429(%rip), %rdi     # 0x3a988
movl $0x40, %esi
movb $0x0, %al
callq 0xb980
leaq 0x20e8a(%rip), %rax     # 0x473fc
movl $0x40, (%rax)
jmp 0x2657a
jmp 0x26581
callq 0x26ab0
jmp 0x267ec
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1442a(%rip), %rsi     # 0x3a9cb
callq 0x4320
cmpl $0x0, %eax
jne 0x265b7
movb $0x1, 0x20c9479(%rip)   # 0x20efa2b
jmp 0x267ea
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14405(%rip), %rsi     # 0x3a9d7
callq 0x4320
cmpl $0x0, %eax
jne 0x2663a
movl 0x4064(%rsp), %eax
addl $0x1, %eax
cmpl 0x4034(%rsp), %eax
jge 0x26630
movq 0x4028(%rsp), %rax
movl 0x4064(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x4064(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x44a0
shll $0xa, %eax
movl %eax, 0x4020(%rsp)
movl 0x4020(%rsp), %ecx
leaq 0x1fcc4(%rip), %rax     # 0x462f0
movl %ecx, (%rax)
jmp 0x26635
callq 0x26ab0
jmp 0x267e8
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1438b(%rip), %rsi     # 0x3a9e0
callq 0x4320
cmpl $0x0, %eax
jne 0x266bd
movl 0x4064(%rsp), %eax
addl $0x1, %eax
cmpl 0x4034(%rsp), %eax
jge 0x266b3
movq 0x4028(%rsp), %rax
movl 0x4064(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x4064(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x44a0
shll $0xa, %eax
movl %eax, 0x401c(%rsp)
movl 0x401c(%rsp), %ecx
leaq 0x1fc45(%rip), %rax     # 0x462f4
movl %ecx, (%rax)
jmp 0x266b8
callq 0x26ab0
jmp 0x267e6
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x14313(%rip), %rsi     # 0x3a9eb
callq 0x4320
cmpl $0x0, %eax
jne 0x2674b
movl 0x4064(%rsp), %eax
addl $0x1, %eax
cmpl 0x4034(%rsp), %eax
jge 0x26741
leaq 0x3010(%rsp), %rdi
movq 0x4028(%rsp), %rax
movq (%rax), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x9580
movq 0x4028(%rsp), %rax
movl 0x4064(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x4064(%rsp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3010(%rsp), %rsi
callq 0xc3e0
jmp 0x26746
callq 0x26ab0
jmp 0x267e4
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x26790
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x1426f(%rip), %rdi     # 0x3a9f1
movb $0x0, %al
callq 0xb060
callq 0x26ab0
jmp 0x267e2
cmpq $0x0, 0x4048(%rsp)
jne 0x267b9
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x4048(%rsp)
jmp 0x267e0
movq 0x4028(%rsp), %rax
movslq 0x4064(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x1421d(%rip), %rdi     # 0x3a9f1
movb $0x0, %al
callq 0xb060
callq 0x26ab0
jmp 0x267e2
jmp 0x267e4
jmp 0x267e6
jmp 0x267e8
jmp 0x267ea
jmp 0x267ec
jmp 0x267ee
jmp 0x267f0
jmp 0x267f2
jmp 0x267f4
jmp 0x267f6
jmp 0x267f8
jmp 0x267fa
jmp 0x267fc
jmp 0x267fe
jmp 0x26800
jmp 0x26802
jmp 0x26804
jmp 0x26806
jmp 0x26808
jmp 0x2680a
jmp 0x2680c
jmp 0x2680e
jmp 0x26810
jmp 0x26812
jmp 0x26814
jmp 0x26816
jmp 0x26818
movl 0x4064(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4064(%rsp)
jmp 0x25ef8
cmpq $0x0, 0x4048(%rsp)
jne 0x2684c
leaq 0x141c6(%rip), %rdi     # 0x3aa06
movb $0x0, %al
callq 0xb060
callq 0x26ab0
movq 0x4048(%rsp), %rsi
leaq 0x1fab5(%rip), %rdi     # 0x46310
movl $0x1000, %edx           # imm = 0x1000
callq 0x9580
leaq 0x1faa4(%rip), %rdi     # 0x46310
callq 0x9040
leaq 0x1fa98(%rip), %rdi     # 0x46310
callq 0x9120
leaq 0x20b6b94(%rip), %rax   # 0x20dd418
movq (%rax), %rax
movl %eax, %edi
callq 0xb310
leaq -0x1b495(%rip), %rdi    # 0xb400
callq 0x35c20
callq 0xd540
leaq 0x20c3cca(%rip), %rax   # 0x20ea570
movl (%rax), %edi
callq 0xd4d0
movl 0x4044(%rsp), %edi
movq 0x4038(%rsp), %rsi
callq 0xbca0
leaq 0x14154(%rip), %rdi     # 0x3aa1c
movb $0x0, %al
callq 0xb060
movl $0x1, 0x300c(%rsp)
movl 0x300c(%rsp), %eax
cmpl 0x4034(%rsp), %eax
jge 0x26970
movq 0x4028(%rsp), %rax
movslq 0x300c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl $0x20, %esi
callq 0x4110
cmpq $0x0, %rax
je 0x26936
movq 0x4028(%rsp), %rax
movslq 0x300c(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x114d6(%rip), %rdi     # 0x37e03
movb $0x0, %al
callq 0xb060
jmp 0x26958
movq 0x4028(%rsp), %rax
movslq 0x300c(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x114b8(%rip), %rdi     # 0x37e09
movb $0x0, %al
callq 0xb060
jmp 0x2695a
movl 0x300c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x300c(%rsp)
jmp 0x268da
leaq 0x11381(%rip), %rdi     # 0x37cf8
movb $0x0, %al
callq 0xb060
callq 0xaff0
callq 0x5f70
movzbl %al, %edi
andl $0x1, %edi
xorl %esi, %esi
callq 0xbe90
callq 0x8c40
leaq -0x1dd01(%rip), %rdi    # 0x8ca0
callq 0x35c20
leaq 0x2000(%rsp), %rdi
leaq 0x14073(%rip), %rsi     # 0x3aa28
movl $0x1000, %edx           # imm = 0x1000
callq 0x9580
leaq 0x2000(%rsp), %rdi
callq 0xaa60
testb $0x1, %al
jne 0x26a11
movq %rsp, %rdi
movq 0x4028(%rsp), %rax
movq (%rax), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x9580
movq %rsp, %rdi
leaq 0x2000(%rsp), %rsi
callq 0x9160
leaq 0x2000(%rsp), %rdi
leaq 0x14021(%rip), %rsi     # 0x3aa28
movl $0x1000, %edx           # imm = 0x1000
callq 0x95c0
leaq 0x1000(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
leaq 0x14011(%rip), %rdx     # 0x3aa36
leaq 0x1f8e4(%rip), %rcx     # 0x46310
movb $0x0, %al
callq 0x9470
leaq 0x2000(%rsp), %rdi
callq 0x216d0
cmpb $0x0, 0x1000(%rsp)
je 0x26a57
leaq 0x1000(%rsp), %rdi
callq 0x216d0
callq 0x8e50
movsd %xmm0, 0x4058(%rsp)
leaq 0x1f8a4(%rip), %rdi     # 0x46310
callq 0x26c50
callq 0x8e50
movsd %xmm0, 0x4050(%rsp)
movsd 0x4050(%rsp), %xmm0
subsd 0x4058(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0xbf80
callq 0x216a0
xorl %eax, %eax
addq $0x4078, %rsp           # imm = 0x4078
retq
nopl (%rax)