// File: adamiaonr[P]rid-analytics/src/argvparser.cpp
// Function: CommandLineProcessing::ArgvParser::parse(int, char**)
ArgvParser::ParserResults
ArgvParser::parse(int _argc, char ** _argv)
{
    bool finished_options = false; // flag whether an argument was found (options are passed)

    // loop over all command line arguments
    int i = 1; // argument counter
    while( i< _argc )
    {
        string argument = _argv[i];
        unsigned int key = 0;
        string option; // option name
        string value;  // option value

        // if argument is an option
        if (!isValidOptionString(argument))
        {
            // string is a real argument since values are processed elsewhere
            finished_options=true;
            argument_container.push_back(argument);
        }
        else // can be a long or multiple short options at this point
        {
            // check whether we already found an argument
            if (finished_options)
            {
                error_option = argument;
                return(ParserOptionAfterArgument); // return error code
            }
            // check for long options
            if (isValidLongOptionString(argument))
            {
                // handle long options

                // remove trailing '--'
                argument = argument.substr(2);
                // check for option value assignment 'option=value'
                splitOptionAndValue(argument, option, value);

                if (!isDefinedOption(option)) // is this a known option
                {
                    error_option = option; // store the option that caused the error
                    return(ParserUnknownOption); // return error code if not
                }

                // get the key of this option - now that we know that it is defined
                key = option2key.find(option)->second;
                if (key == help_option) // if help is requested return error code
                    return(ParserHelpRequested);

                // do we need to extract a value
                // AND a value is not already assigned from the previous step
                if ((option2attribute.find(key)->second & OptionRequiresValue) && value.empty())
                {
                    if (i+1 >= _argc) // are there arguments left?
                    {
                        error_option = option; // store the option that caused the error
                        return(ParserMissingValue); // the was no argument left although we need a value
                    }

                    string temp = _argv[i+1]; // get the next element
                    ++i; // increase counter now that we moved forward

                    if (isValidOptionString(temp))
                    {
                        error_option = option; // store the option that caused the error
                        return(ParserMissingValue);  // missing option value
                    }
                    value = temp; // assign value
                }
                // add option-value map entry
                option2value[key] = value;
            }
            else // handle short options
            {
                argument = argument.substr(1);   // remove trailing '-'

                // check for option value assignment 'option=value'
                if (splitOptionAndValue(argument, option, value))
                {
                    // there was an option <- value assignment
                    if (option.length() > 1)
                    {
                        error_option = option; // store the option that caused the error
                        return(ParserMalformedMultipleShortOption); // return error code if option has more than one character
                    }

                    if (!isDefinedOption(option)) // is this a known option
                    {
                        error_option = option; // store the option that caused the error
                        return(ParserUnknownOption); // return error code if not
                    }
                    key = option2key.find(option)->second; // get the key for the extracted option name

                    if (key == help_option) // if help is requested return error code
                        return(ParserHelpRequested);

                    // if value is still empty for some reason: we have an error
                    if ((option2attribute.find(key)->second & OptionRequiresValue) && value.empty())
                    {
                        error_option = option; // store the option that caused the error
                        return(ParserMissingValue);   // missing option value
                    }
                    else
                        // add option-value map entry
                        option2value[key] = value;
                }
                else // no '=' assignment: can be either multiple short options or
                    // something like '-s 4'
                {
                    // handle short options with value like '-s 4'
                    option.clear();
                    value.clear();

                    if (argument.length() == 1) // if a single short option
                    {
                        if (!isDefinedOption(argument)) // is this a known option
                        {
                            error_option = argument; // store the option that caused the error
                            return(ParserUnknownOption); // return error code if not
                        }
                        key = option2key.find(argument)->second; // get the key for the extracted option name

                        if (key == help_option) // if help is requested return error code
                            return(ParserHelpRequested);

                        // check if option needs a value and next arg is not an option
                        if ((option2attribute.find(key)->second & OptionRequiresValue))
                        {
                            if (i+1 >= _argc) // are there arguments left?
                            {
                                error_option = argument; // store the option that caused the error
                                return(ParserMissingValue); // the was no argument left although we need a value
                            }
                            string temp = _argv[i+1]; // get the next element
                            ++i; // increase counter now that we moved forward

                            if (isValidOptionString(temp))
                            {
                                error_option = argument; // store the option that caused the error
                                return(ParserMissingValue);  // missing option value
                            }
                            // add option-value map entry
                            option2value[key] = temp;

                        }
                        else // no value needed
                        {
                            option2value[key] = ""; // assign value
                        }
                    }
                    else // handle multiple short option like '-svxgh'
                    {
                        unsigned int short_option_counter = 0; // position in the multiple short option string
                        while( short_option_counter < argument.length() ) // parse the whole string
                        {
                            option = argument[short_option_counter]; // get the option character

                            if (!isDefinedOption(option)) // is this a known option
                            {
                                error_option = option; // store the option that caused the error
                                return(ParserUnknownOption); // return error code if not
                            }
                            key = option2key.find(option)->second; // get the key for the extracted option name

                            if (key == help_option) // if help is requested return error code
                                return(ParserHelpRequested);

                            option2value[key] = value;

                            ++short_option_counter; // advance one character forward
                        }
                    }
                }
            }
        }
        ++i;
    }

    map<unsigned int, OptionAttributes>::iterator it;
    for( it = option2attribute.begin(); it != option2attribute.end(); it++ )
    {
        // if the current option is required look if we got it
        if (it->second & OptionRequired)
        {
            // is the object missing
            if (option2value.find(it->first) == option2value.end())
            {
                // get the list of alternative names for this option
                list<string> alternatives = getAllOptionAlternatives(it->first);

                unsigned int count = 0;
                for( list<string>::const_iterator alt = alternatives.begin();
                        alt != alternatives.end();
                        ++alt )
                {
                    ++count;
                    // additional '-' for long options
                    if (alt->length() > 1)
                        error_option += "-";

                    error_option += "-" + *alt;

                    // alternatives to come?
                    if (count < alternatives.size())
                        error_option += ", "; // add separator
                }
                return(ParserRequiredOptionMissing);
            }
        }
    }

    return(NoParserError); // everthing went fine -> sucess
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x208(%rbp)
movb $0x0, -0x21(%rbp)
movl $0x1, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x40a91
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x218(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x5930
movq -0x218(%rbp), %rsi
movq -0x210(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x30320
jmp 0x3ffb4
leaq -0x49(%rbp), %rdi
callq 0x5510
movl $0x0, -0x60(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x5730
leaq -0xa0(%rbp), %rdi
callq 0x5730
leaq -0x48(%rbp), %rdi
callq 0x40d90
movb %al, -0x219(%rbp)
jmp 0x3ffea
movb -0x219(%rbp), %al
testb $0x1, %al
jne 0x40043
jmp 0x3fff6
movq -0x208(%rbp), %rdi
movb $0x1, -0x21(%rbp)
addq $0xf8, %rdi
leaq -0x48(%rbp), %rsi
callq 0x430f0
jmp 0x40013
jmp 0x40a27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x5510
jmp 0x40d84
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x40a6e
testb $0x1, -0x21(%rbp)
je 0x40078
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x48(%rbp), %rsi
callq 0x5070
jmp 0x40062
movl $0x4, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
leaq -0x48(%rbp), %rdi
callq 0x40e40
movb %al, -0x21a(%rbp)
jmp 0x40089
movb -0x21a(%rbp), %al
testb $0x1, %al
jne 0x40098
jmp 0x403aa
leaq -0xc8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x2, %edx
movq $-0x1, %rcx
callq 0x54d0
jmp 0x400b6
leaq -0x48(%rbp), %rdi
movq %rdi, -0x228(%rbp)
leaq -0xc8(%rbp), %rsi
movq %rsi, -0x230(%rbp)
callq 0x5600
movq -0x230(%rbp), %rdi
callq 0x52f0
movq -0x228(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x40ea0
jmp 0x400f9
movq -0x208(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3fd80
movb %al, -0x231(%rbp)
jmp 0x40111
movb -0x231(%rbp), %al
testb $0x1, %al
jne 0x4014c
jmp 0x4011d
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x80(%rbp), %rsi
callq 0x5070
jmp 0x40136
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
leaq -0x80(%rbp), %rsi
callq 0x43160
movq %rax, -0x240(%rbp)
jmp 0x40169
movq -0x240(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x43190
movq -0x208(%rbp), %rcx
movl 0x20(%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl 0x130(%rcx), %eax
jne 0x401b1
movl $0x32, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x38, %rdi
leaq -0x60(%rbp), %rsi
callq 0x431b0
movq %rax, -0x248(%rbp)
jmp 0x401ce
movq -0x248(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x431e0
movl 0x4(%rax), %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x249(%rbp)
je 0x4020d
leaq -0xa0(%rbp), %rdi
callq 0x5880
movb %al, -0x249(%rbp)
movb -0x249(%rbp), %al
testb $0x1, %al
jne 0x4021c
jmp 0x40370
movl -0x28(%rbp), %eax
addl $0x1, %eax
cmpl -0x14(%rbp), %eax
jl 0x40256
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x80(%rbp), %rsi
callq 0x5070
jmp 0x40240
movl $0x2, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x260(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x5930
movq -0x260(%rbp), %rsi
movq -0x258(%rbp), %rdx
leaq -0xf8(%rbp), %rdi
callq 0x30320
jmp 0x40299
leaq -0xf9(%rbp), %rdi
callq 0x5510
movl -0x28(%rbp), %eax
incl %eax
movl %eax, -0x28(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x40d90
movb %al, -0x261(%rbp)
jmp 0x402c1
movb -0x261(%rbp), %al
testb $0x1, %al
jne 0x402cd
jmp 0x40333
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x80(%rbp), %rsi
callq 0x5070
jmp 0x402e6
movl $0x2, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40352
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xf9(%rbp), %rdi
callq 0x5510
jmp 0x40a6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x52f0
jmp 0x40a6e
leaq -0xa0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x5070
jmp 0x40348
movl $0x0, -0xa4(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x52f0
movl -0xa4(%rbp), %eax
testl %eax, %eax
jne 0x40a3a
jmp 0x4036e
jmp 0x40370
movq -0x208(%rbp), %rdi
addq $0x98, %rdi
leaq -0x60(%rbp), %rsi
callq 0x43200
movq %rax, -0x270(%rbp)
jmp 0x40390
movq -0x270(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5070
jmp 0x403a5
jmp 0x40a25
leaq -0x120(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x54d0
jmp 0x403c8
leaq -0x48(%rbp), %rdi
movq %rdi, -0x280(%rbp)
leaq -0x120(%rbp), %rsi
movq %rsi, -0x288(%rbp)
callq 0x5600
movq -0x288(%rbp), %rdi
callq 0x52f0
movq -0x280(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x40ea0
movb %al, -0x271(%rbp)
jmp 0x40411
movb -0x271(%rbp), %al
testb $0x1, %al
jne 0x40420
jmp 0x405e9
leaq -0x80(%rbp), %rdi
callq 0x57e0
cmpq $0x1, %rax
jbe 0x4045e
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x80(%rbp), %rsi
callq 0x5070
jmp 0x40448
movl $0x8, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3fd80
movb %al, -0x289(%rbp)
jmp 0x40476
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x404b1
jmp 0x40482
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x80(%rbp), %rsi
callq 0x5070
jmp 0x4049b
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
leaq -0x80(%rbp), %rsi
callq 0x43160
movq %rax, -0x298(%rbp)
jmp 0x404ce
movq -0x298(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x43190
movq -0x208(%rbp), %rcx
movl 0x20(%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl 0x130(%rcx), %eax
jne 0x40516
movl $0x32, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x38, %rdi
leaq -0x60(%rbp), %rsi
callq 0x431b0
movq %rax, -0x2a0(%rbp)
jmp 0x40533
movq -0x2a0(%rbp), %rax
movq %rax, -0x130(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x431e0
movl 0x4(%rax), %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2a1(%rbp)
je 0x40572
leaq -0xa0(%rbp), %rdi
callq 0x5880
movb %al, -0x2a1(%rbp)
movb -0x2a1(%rbp), %al
testb $0x1, %al
jne 0x4057e
jmp 0x405ad
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x80(%rbp), %rsi
callq 0x5070
jmp 0x40597
movl $0x2, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x98, %rdi
leaq -0x60(%rbp), %rsi
callq 0x43200
movq %rax, -0x2b0(%rbp)
jmp 0x405cd
movq -0x2b0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5070
jmp 0x405e2
jmp 0x405e4
jmp 0x40a23
leaq -0x80(%rbp), %rdi
callq 0x5680
leaq -0xa0(%rbp), %rdi
callq 0x5680
leaq -0x48(%rbp), %rdi
callq 0x57e0
cmpq $0x1, %rax
jne 0x408bf
movq -0x208(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3fd80
movb %al, -0x2b1(%rbp)
jmp 0x40629
movb -0x2b1(%rbp), %al
testb $0x1, %al
jne 0x40664
jmp 0x40635
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x48(%rbp), %rsi
callq 0x5070
jmp 0x4064e
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
leaq -0x48(%rbp), %rsi
callq 0x43160
movq %rax, -0x2c0(%rbp)
jmp 0x40681
movq -0x2c0(%rbp), %rax
movq %rax, -0x138(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x43190
movq -0x208(%rbp), %rcx
movl 0x20(%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl 0x130(%rcx), %eax
jne 0x406c9
movl $0x32, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x38, %rdi
leaq -0x60(%rbp), %rsi
callq 0x431b0
movq %rax, -0x2c8(%rbp)
jmp 0x406e6
movq -0x2c8(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x431e0
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x40883
movl -0x28(%rbp), %eax
addl $0x1, %eax
cmpl -0x14(%rbp), %eax
jl 0x40749
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x48(%rbp), %rsi
callq 0x5070
jmp 0x40733
movl $0x2, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x161(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x5930
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
leaq -0x160(%rbp), %rdi
callq 0x30320
jmp 0x4078c
leaq -0x161(%rbp), %rdi
callq 0x5510
movl -0x28(%rbp), %eax
incl %eax
movl %eax, -0x28(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x40d90
movb %al, -0x2d9(%rbp)
jmp 0x407b4
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x407c0
jmp 0x40826
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x48(%rbp), %rsi
callq 0x5070
jmp 0x407d9
movl $0x2, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40865
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x161(%rbp), %rdi
callq 0x5510
jmp 0x40a6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x52f0
jmp 0x40a6e
movq -0x208(%rbp), %rdi
addq $0x98, %rdi
leaq -0x60(%rbp), %rsi
callq 0x43200
movq %rax, -0x2e8(%rbp)
jmp 0x40846
movq -0x2e8(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x5070
jmp 0x4085b
movl $0x0, -0xa4(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x52f0
movl -0xa4(%rbp), %eax
testl %eax, %eax
jne 0x40a3a
jmp 0x40881
jmp 0x408ba
movq -0x208(%rbp), %rdi
addq $0x98, %rdi
leaq -0x60(%rbp), %rsi
callq 0x43200
movq %rax, -0x2f0(%rbp)
jmp 0x408a3
movq -0x2f0(%rbp), %rdi
leaq 0x22c57(%rip), %rsi     # 0x63508
callq 0x5700
jmp 0x408b8
jmp 0x408ba
jmp 0x40a21
movl $0x0, -0x168(%rbp)
movl -0x168(%rbp), %eax
movq %rax, -0x2f8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x57e0
movq %rax, %rcx
movq -0x2f8(%rbp), %rax
cmpq %rcx, %rax
jae 0x40a1f
movl -0x168(%rbp), %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdi
callq 0x5a40
movq %rax, -0x300(%rbp)
jmp 0x4090c
movq -0x300(%rbp), %rax
movsbl (%rax), %esi
leaq -0x80(%rbp), %rdi
callq 0x5870
jmp 0x40921
movq -0x208(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3fd80
movb %al, -0x301(%rbp)
jmp 0x40939
movb -0x301(%rbp), %al
testb $0x1, %al
jne 0x40974
jmp 0x40945
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x80(%rbp), %rsi
callq 0x5070
jmp 0x4095e
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x8, %rdi
leaq -0x80(%rbp), %rsi
callq 0x43160
movq %rax, -0x310(%rbp)
jmp 0x40991
movq -0x310(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x43190
movq -0x208(%rbp), %rcx
movl 0x20(%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl 0x130(%rcx), %eax
jne 0x409d6
movl $0x32, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x40a3a
movq -0x208(%rbp), %rdi
addq $0x98, %rdi
leaq -0x60(%rbp), %rsi
callq 0x43200
movq %rax, -0x318(%rbp)
jmp 0x409f6
movq -0x318(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5070
jmp 0x40a0b
movl -0x168(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x168(%rbp)
jmp 0x408c9
jmp 0x40a21
jmp 0x40a23
jmp 0x40a25
jmp 0x40a27
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0xa4(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x52f0
leaq -0x80(%rbp), %rdi
callq 0x52f0
leaq -0x48(%rbp), %rdi
callq 0x52f0
movl -0xa4(%rbp), %eax
testl %eax, %eax
je 0x40a69
jmp 0x40a64
jmp 0x40d78
jmp 0x3ff6c
leaq -0xa0(%rbp), %rdi
callq 0x52f0
leaq -0x80(%rbp), %rdi
callq 0x52f0
leaq -0x48(%rbp), %rdi
callq 0x52f0
jmp 0x40d84
leaq -0x178(%rbp), %rdi
callq 0x432e0
movq -0x208(%rbp), %rdi
addq $0x38, %rdi
callq 0x43300
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x208(%rbp), %rdi
addq $0x38, %rdi
callq 0x43360
movq %rax, -0x188(%rbp)
leaq -0x178(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x43330
testb $0x1, %al
jne 0x40af5
jmp 0x40d71
leaq -0x178(%rbp), %rdi
callq 0x431e0
movl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x40d55
movq -0x208(%rbp), %rax
addq $0x98, %rax
movq %rax, -0x320(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x431e0
movq -0x320(%rbp), %rdi
movq %rax, %rsi
callq 0x433c0
movq -0x208(%rbp), %rdi
movq %rax, -0x190(%rbp)
addq $0x98, %rdi
callq 0x433f0
movq %rax, -0x198(%rbp)
leaq -0x190(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x43390
testb $0x1, %al
jne 0x40b7c
jmp 0x40d53
leaq -0x178(%rbp), %rdi
callq 0x431e0
movq -0x208(%rbp), %rsi
movl (%rax), %edx
leaq -0x1b0(%rbp), %rdi
callq 0x40fc0
movl $0x0, -0x1b4(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x43420
movq %rax, -0x1c8(%rbp)
leaq -0x1c0(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x43450
leaq -0x1b0(%rbp), %rdi
callq 0x434a0
movq %rax, -0x1d8(%rbp)
leaq -0x1d0(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x43450
leaq -0x1c0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x43470
testb $0x1, %al
jne 0x40c0f
jmp 0x40d26
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x434d0
movq %rax, %rdi
callq 0x57e0
cmpq $0x1, %rax
jbe 0x40c67
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq 0x22ee7(%rip), %rsi     # 0x63b34
callq 0x5460
jmp 0x40c54
jmp 0x40c67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x40d45
leaq -0x1c0(%rbp), %rdi
callq 0x43610
movq %rax, %rdx
leaq 0x22eb7(%rip), %rsi     # 0x63b34
leaq -0x1f8(%rbp), %rdi
callq 0x43500
jmp 0x40c8b
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq -0x1f8(%rbp), %rsi
callq 0x5650
jmp 0x40ca7
leaq -0x1f8(%rbp), %rdi
callq 0x52f0
movl -0x1b4(%rbp), %eax
movq %rax, -0x328(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x43630
movq %rax, %rcx
movq -0x328(%rbp), %rax
cmpq %rcx, %rax
jae 0x40d13
movq -0x208(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq 0x22829(%rip), %rsi     # 0x63519
callq 0x5460
jmp 0x40cf7
jmp 0x40d13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x52f0
jmp 0x40d45
jmp 0x40d15
leaq -0x1c0(%rbp), %rdi
callq 0x43660
jmp 0x40bcd
movl $0x16, -0x4(%rbp)
movl $0x1, -0xa4(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x43680
jmp 0x40d78
leaq -0x1b0(%rbp), %rdi
callq 0x43680
jmp 0x40d84
jmp 0x40d55
jmp 0x40d57
leaq -0x178(%rbp), %rdi
xorl %esi, %esi
callq 0x436a0
movq %rax, -0x200(%rbp)
jmp 0x40ac2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x5920
nopl (%rax)