// File: rofl0r[P]ascc/cs_parser.cpp
// Function: process_function_declaration(ccInternalList&, ccCompiledScript*, int*, int, int&, int&, int, int, int, int, int, int, int*, SymbolDef*, int)
int process_function_declaration(ccInternalList &targ, ccCompiledScript*scrip,
                                 int *funcsymptr, int vtwas, int &in_func,
                                 int &nested_level, int next_is_readonly,
                                 int is_const,
                                 int next_is_import, int isMemberFunction,
                                 int returnsPointer, int func_is_static,
								 int *isMemberFunctionPtr, SymbolDef *oldDefinition,
                 int returnsDynArray) {
  int numparams = 1;
  int funcsym = *funcsymptr;
  int varsize = sym.entries[vtwas].ssize;
  // skip the opening (
  targ.getnext();

  char functionName[MAX_SYM_LEN];
  strcpy(functionName, sym.get_name(funcsym));

  if (check_not_eof(targ))
    return -1;
  if (strcmp(sym.get_name(targ.peeknext()), "this") == 0 || sym.get_type(targ.peeknext()) == SYM_STATIC)
  {
    if(sym.get_type(targ.peeknext()) == SYM_STATIC)
      func_is_static = 1;
    // extender function, eg.  function GoAway(this Character *someone)
    targ.getnext();
	  if (sym.get_type(targ.peeknext()) != SYM_VARTYPE)
	  {
	    if(func_is_static)
	      cc_error("'static' must be followed by a struct name");
	    else
	      cc_error("'this' must be followed by a struct name");
	    return -1;
	  }
	  if ((sym.entries[targ.peeknext()].flags & SFLG_STRUCTTYPE) == 0)
	  {
	    if(func_is_static)
	      cc_error("'static' cannot be used with primitive types");
	    else
	      cc_error("'this' cannot be used with primitive types");
	    return -1;
	  }
	  if (strchr(functionName, ':') != NULL)
	  {
	    cc_error("extender functions cannot be part of a struct");
	    return -1;
	  }

	  sprintf(functionName, "%s::%s", sym.get_name(targ.peeknext()), sym.get_name(funcsym));
	  if (isMemberFunctionPtr != NULL)
	  {
		  *isMemberFunctionPtr = targ.peeknext();
	  }

	  funcsym = sym.find(functionName);
	  if (funcsym < 0)
	  {
		  funcsym = sym.add(functionName);
	  }
    *funcsymptr = funcsym;

	  if (next_is_import == 0) {
      if (scrip->remove_any_import(functionName, oldDefinition))
        return -1;
    }

	  if (sym.entries[funcsym].stype != 0)
	  {
	    cc_error("function '%s' is already defined", functionName);
	    return -1;
	  }
	  sym.entries[funcsym].flags = SFLG_STRUCTMEMBER;
	  if(func_is_static) {
	    sym.entries[funcsym].flags |= SFLG_STATIC;
      }

	  targ.getnext();
	  if (!func_is_static && strcmp(sym.get_name(targ.getnext()), "*") != 0)
	  {
	    cc_error("instance extender function must be pointer");
	    return -1;
	  }

	  if ((sym.get_type(targ.peeknext()) != SYM_COMMA) &&
	      (sym.get_type(targ.peeknext()) != SYM_CLOSEPARENTHESIS))
	  {
	    if(strcmp(sym.get_name(targ.getnext()), "*") == 0)
	      cc_error("static extender function cannot be pointer");
	    else
	      cc_error("parameter name cannot be defined for extender type");
	    return -1;
	  }

	  if (sym.get_type(targ.peeknext()) == SYM_COMMA)
	  {
		  targ.getnext();
	  }
  }
  else if(sym.get_type(funcsym) == SYM_VARTYPE) {
      // Attempt to prefix a vartype with the struct name
      // e.g. MyStruct::Object
      if(isMemberFunction)
      {
          sprintf(functionName, "%s::%s", sym.get_name(isMemberFunction), sym.get_name(funcsym));
          funcsym = sym.find(functionName);
          if (funcsym < 0)
              funcsym = sym.add(functionName);
          *funcsymptr = funcsym;
      }
      if (sym.entries[funcsym].stype != 0) 
      {
          cc_error("function '%s' is already defined", functionName);
          return -1;
      }
  }

  sym.entries[funcsym].stype = SYM_FUNCTION;
  sym.entries[funcsym].ssize = varsize;  // save return type size
  sym.entries[funcsym].funcparamtypes[0] = vtwas;  // return type

  if (is_const)
  {
    sym.entries[funcsym].funcparamtypes[0] |= STYPE_CONST;
  }
  if (returnsPointer)
  {
    sym.entries[funcsym].funcparamtypes[0] |= STYPE_POINTER;
  }
  if (returnsDynArray)
  {
    sym.entries[funcsym].funcparamtypes[0] |= STYPE_DYNARRAY;
  }

  if ((!returnsPointer) && (!returnsDynArray) &&
      ((sym.entries[vtwas].flags & SFLG_STRUCTTYPE) != 0))
  {
    cc_error("Cannot return entire struct from function");
    return -1;
  }
  if ((in_func >= 0) || (nested_level > 0)) {
    cc_error("Nested functions not supported (you may have forgotten a closing brace)");
    return -1;
  }
  if (next_is_readonly) {
    cc_error("readonly cannot be applied to a function");
    return -1;
  }

  int funcNum = -1;

  if (next_is_import)
    in_func = scrip->add_new_import(functionName);
  else
    in_func = scrip->add_new_function(functionName, &funcNum);

  if (in_func < 0) {
    // don't overwrite the "used import" error message
    if (in_func != -2)
      cc_error("Internal compiler error: table overflow");
    return -1;
  }
  sym.entries[funcsym].soffs = in_func;  // save code offset of function
  scrip->cur_sp += 4;  // the return address will be pushed

  int prototype = 0;
  bool next_is_const = false;
  char functype[100]="\0";
  while (1) {
    int cursym = targ.getnext();
    int next_type = sym.get_type(cursym);
    if (next_type == SYM_CLOSEPARENTHESIS) break;
    else if (next_type == SYM_VARARGS) {
      // variable number of arguments
      numparams+=100;
      cursym = targ.getnext();
      if (sym.get_type(cursym) != SYM_CLOSEPARENTHESIS) {
        cc_error("expected ')' after variable-args");
        return -1;
      }
      break;
    }
    else if (next_type == SYM_CONST) {
      next_is_const = true;
    }
    else if (next_type == SYM_VARTYPE) {
      // function parameter
      if ((numparams % 100) >= MAX_FUNCTION_PARAMETERS) {
        cc_error("too many parameters defined for function");
        return -1;
      }
      if (cursym == sym.normalVoidSym) {
        cc_error("'void' invalid type for function parameter");
        return -1;
      }
      int isPointerParam = 0, isRawPointer = 0;
      // save the parameter type (numparams starts from 1)
      sym.entries[funcsym].funcparamtypes[numparams % 100] = cursym;
      sym.entries[funcsym].funcParamDefaultValues[numparams % 100] = 0;
      sym.entries[funcsym].funcParamHasDefaultValues[numparams % 100] = false;

      if (next_is_const)
        sym.entries[funcsym].funcparamtypes[numparams % 100] |= STYPE_CONST;

      functype[strlen(functype)+1] = 0;
      functype[strlen(functype)] = (char)cursym;  // save variable type
      if (check_not_eof(targ))
        return -1;
      if (strcmp(sym.get_name(targ.peeknext()), "*") == 0) {
        // pointer
        targ.getnext();
        if(strcmp("char", sym.get_name(cursym)) == 0) isRawPointer = 1;
        else if (strcmp("int", sym.get_name(cursym)) == 0) isRawPointer = 4;
        else if (strcmp("short", sym.get_name(cursym)) == 0) isRawPointer = 2;
        else if (strcmp("long", sym.get_name(cursym)) == 0 ) isRawPointer = 4;
        if(isRawPointer) {
          /* treat the pointer value as if it was an int */
          sym.entries[funcsym].funcparamtypes[numparams % 100] = sym.normalIntSym;
        } else {
          sym.entries[funcsym].funcparamtypes[numparams % 100] |= STYPE_POINTER;
          isPointerParam = 1;
        }
        if ((sym.entries[cursym].flags & SFLG_MANAGED) == 0 && !isRawPointer) {
          // can only point to managed structs
          cc_error("Cannot declare pointer to non-managed type");
          return -1;
        }
        if (sym.entries[cursym].flags & SFLG_AUTOPTR) {
          cc_error("Invalid use of pointer");
          return -1;
        }
      }

      if (sym.entries[cursym].flags & SFLG_AUTOPTR) {
        sym.entries[funcsym].funcparamtypes[numparams % 100] |= STYPE_POINTER;
        isPointerParam = 1;
      }

      bool createdLocalVar = false;

      if (sym.get_type(targ.peeknext()) != 0) {
        // next token is not a variable name, so it must be a prototype
        prototype = 1;

        if ((sym.get_type(targ.peeknext()) == SYM_GLOBALVAR) && (next_is_import)) {
          // if the paramter name is a global var, but this is just an import declaration
          // then ignore it
          targ.getnext();
        }

        if (check_for_default_value(targ, funcsym, numparams))
          return -1;

        numparams++;
      }
      else if ((next_is_import) || (prototype)) {
        // imported function, so ignore the parameter names
        targ.getnext();

        if (check_for_default_value(targ, funcsym, numparams))
          return -1;

        numparams++;
      }
      else {
        // it's a parameter
        int vartypesym = cursym;
        if ((sym.entries[cursym].flags & SFLG_STRUCTTYPE) && (!isPointerParam)) {
          cc_error("struct cannot be passed as parameter");
          return -1;
        }
        cursym = targ.getnext();
        sym.entries[cursym].stype = SYM_LOCALVAR;
        sym.entries[cursym].extends = 0;
        sym.entries[cursym].arrsize = isRawPointer ? 0 : 1;
        sym.entries[cursym].vartype = isRawPointer ? sym.normalIntSym : vartypesym;
        sym.entries[cursym].ssize = isRawPointer ? isRawPointer : 4; //oldsize;  fix param to 4 bytes for djgpp
        sym.entries[cursym].sscope = nested_level + 1;
        sym.entries[cursym].flags |= SFLG_PARAMETER;
        if (isPointerParam)
          sym.entries[cursym].flags |= SFLG_POINTER;
        else if (isRawPointer)
          sym.entries[cursym].flags |= SFLG_ARRAY;
        if (next_is_const)
          sym.entries[cursym].flags |= SFLG_CONST | SFLG_READONLY;
        // the parameters are pushed backwards, so the top of the
        // stack has the first parameter. The +1 is because the
        // call will push the return address onto the stack as well
        sym.entries[cursym].soffs = scrip->cur_sp - (numparams+1)*4;
        createdLocalVar = true;
        numparams++;
      }

      int dynArrayStatus = check_for_dynamic_array_declaration(targ, cursym, !!isPointerParam);
      if (dynArrayStatus < 0)
      {
        return -1;
      }
      else if (dynArrayStatus > 0)
      {
        sym.entries[funcsym].funcparamtypes[(numparams - 1) % 100] |= STYPE_DYNARRAY;
        if (createdLocalVar)
        {
          sym.entries[cursym].flags |= SFLG_DYNAMICARRAY | SFLG_ARRAY;
        }
      }

      next_type = sym.get_type(cursym=targ.getnext());
      if (next_type == SYM_CLOSEPARENTHESIS) break;
      else if (next_type == SYM_GLOBALVAR) {
        cc_error("'%s' is a global var; cannot use as name for local",sym.get_friendly_name(cursym).c_str());
        return -1;
      }
      else if (next_type != SYM_COMMA) {
        cc_error("PE02: Parse error at '%s'",sym.get_friendly_name(cursym).c_str());
        return -1;
      }

      next_is_const = false;
    }
    else {
      // something odd was inside the parentheses
      cc_error("PE03: Parse error at '%s'",sym.get_friendly_name(cursym).c_str());
      return -1;
    }
  }
  // save the number of parameters
  sym.entries[funcsym].sscope = (numparams-1);
  if (funcNum >= 0)
    scrip->funcnumparams[funcNum] = sym.entries[funcsym].sscope;

  if (func_is_static)
    sym.entries[funcsym].flags |= SFLG_STATIC;

  if (next_is_import) {
    sym.entries[funcsym].flags |= SFLG_IMPORTED;

    if (isMemberFunction) {
      // for imported member functions, append the number of parameters
      // to the name of the import
      char appendage[10];
      sprintf(appendage, "^%d", sym.entries[funcsym].sscope);

      strcat(scrip->imports[in_func], appendage);
    }

    int nextvar = targ.peeknext();
    // member function expects the ; to still be there whereas
    // normal function does not
    if (!isMemberFunction)
      nextvar = targ.getnext();

    if (sym.get_type(nextvar) != SYM_SEMICOLON) {
      cc_error("';' expected (cannot define body of imported function)");
      return -1;
    }
    in_func=-1;
  }
  else if (sym.get_type(targ.peeknext()) == SYM_OPENBRACE) {
  }
  else {
    cc_error("Expected '{'");
    return -1;
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x410, %rsp            # imm = 0x410
movl 0x50(%rbp), %eax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x40(%rbp)
movslq -0x24(%rbp), %rsi
leaq 0x39b16(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x38(%rax), %rax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1de00
leaq -0x240(%rbp), %rax
movq %rax, -0x368(%rbp)
movl -0x40(%rbp), %esi
leaq 0x39ae5(%rip), %rdi     # 0x42870
callq 0x1f730
movq -0x368(%rbp), %rdi
movq %rax, %rsi
callq 0x4350
movq -0x10(%rbp), %rdi
callq 0x8a60
cmpl $0x0, %eax
je 0x8db9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x39aa5(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, %rdi
leaq 0x28de0(%rip), %rsi     # 0x31bba
callq 0x4510
cmpl $0x0, %eax
je 0x8e04
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x39a7a(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x2c, %eax
jne 0x9171
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x39a5a(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x2c, %eax
jne 0x8e27
movl $0x1, 0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1de00
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x39a2e(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x2e, %eax
je 0x8e7c
cmpl $0x0, 0x38(%rbp)
je 0x8e62
leaq 0x28d66(%rip), %rdi     # 0x31bbf
movb $0x0, %al
callq 0x1bac0
jmp 0x8e70
leaq 0x28d81(%rip), %rdi     # 0x31bea
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x10(%rbp), %rdi
callq 0x1dd60
movq %rax, %rsi
leaq 0x399e1(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rax
andq $0x400, %rax            # imm = 0x400
cmpq $0x0, %rax
jne 0x8ed8
cmpl $0x0, 0x38(%rbp)
je 0x8ebe
leaq 0x28d5e(%rip), %rdi     # 0x31c13
movb $0x0, %al
callq 0x1bac0
jmp 0x8ecc
leaq 0x28d7b(%rip), %rdi     # 0x31c40
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
leaq -0x240(%rbp), %rdi
movl $0x3a, %esi
callq 0x4180
cmpq $0x0, %rax
je 0x8f09
leaq 0x28d75(%rip), %rdi     # 0x31c6b
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
leaq -0x240(%rbp), %rax
movq %rax, -0x378(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x39947(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, -0x370(%rbp)
movl -0x40(%rbp), %esi
leaq 0x39931(%rip), %rdi     # 0x42870
callq 0x1f730
movq -0x378(%rbp), %rdi
movq -0x370(%rbp), %rdx
movq %rax, %rcx
leaq 0x289a8(%rip), %rsi     # 0x31904
movb $0x0, %al
callq 0x40d0
cmpq $0x0, 0x40(%rbp)
je 0x8f7b
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %ecx
movq 0x40(%rbp), %rax
movl %ecx, (%rax)
leaq -0x240(%rbp), %rsi
leaq 0x398e7(%rip), %rdi     # 0x42870
callq 0x1f050
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jge 0x8fad
leaq -0x240(%rbp), %rsi
leaq 0x398cb(%rip), %rdi     # 0x42870
callq 0x1f870
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, 0x20(%rbp)
jne 0x8fe3
movq -0x18(%rbp), %rdi
leaq -0x240(%rbp), %rsi
movq 0x48(%rbp), %rdx
callq 0x259e0
cmpl $0x0, %eax
je 0x8fe1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
jmp 0x8fe3
movslq -0x40(%rbp), %rsi
leaq 0x39882(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movswl 0x20(%rax), %eax
cmpl $0x0, %eax
je 0x9021
leaq -0x240(%rbp), %rsi
leaq 0x28c8b(%rip), %rdi     # 0x31c99
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movslq -0x40(%rbp), %rsi
leaq 0x39844(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq $0x80, 0x28(%rax)
cmpl $0x0, 0x38(%rbp)
je 0x9066
movslq -0x40(%rbp), %rsi
leaq 0x39822(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rcx
orq $0x2000, %rcx           # imm = 0x2000
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rdi
callq 0x1de00
cmpl $0x0, 0x38(%rbp)
jne 0x90ba
movq -0x10(%rbp), %rdi
callq 0x1de00
movl %eax, %esi
leaq 0x397e9(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, %rdi
leaq 0x2b186(%rip), %rsi     # 0x3421c
callq 0x4510
cmpl $0x0, %eax
je 0x90ba
leaq 0x28c13(%rip), %rdi     # 0x31cba
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x397a4(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x2a, %eax
je 0x9147
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x39788(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x6, %eax
je 0x9147
movq -0x10(%rbp), %rdi
callq 0x1de00
movl %eax, %esi
leaq 0x3976c(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, %rdi
leaq 0x2b109(%rip), %rsi     # 0x3421c
callq 0x4510
cmpl $0x0, %eax
jne 0x912d
leaq 0x28bc1(%rip), %rdi     # 0x31ce5
movb $0x0, %al
callq 0x1bac0
jmp 0x913b
leaq 0x28bdc(%rip), %rdi     # 0x31d10
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x39717(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x2a, %eax
jne 0x916c
movq -0x10(%rbp), %rdi
callq 0x1de00
jmp 0x9262
movl -0x40(%rbp), %esi
leaq 0x396f5(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x2e, %eax
jne 0x9260
cmpl $0x0, 0x28(%rbp)
je 0x9220
leaq -0x240(%rbp), %rax
movq %rax, -0x388(%rbp)
movl 0x28(%rbp), %esi
leaq 0x396c5(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, -0x380(%rbp)
movl -0x40(%rbp), %esi
leaq 0x396af(%rip), %rdi     # 0x42870
callq 0x1f730
movq -0x388(%rbp), %rdi
movq -0x380(%rbp), %rdx
movq %rax, %rcx
leaq 0x28726(%rip), %rsi     # 0x31904
movb $0x0, %al
callq 0x40d0
leaq -0x240(%rbp), %rsi
leaq 0x3967d(%rip), %rdi     # 0x42870
callq 0x1f050
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jge 0x9217
leaq -0x240(%rbp), %rsi
leaq 0x39661(%rip), %rdi     # 0x42870
callq 0x1f870
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movslq -0x40(%rbp), %rsi
leaq 0x39645(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movswl 0x20(%rax), %eax
cmpl $0x0, %eax
je 0x925e
leaq -0x240(%rbp), %rsi
leaq 0x28a4e(%rip), %rdi     # 0x31c99
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
jmp 0x9260
jmp 0x9262
movslq -0x40(%rbp), %rsi
leaq 0x39603(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movw $0x4, 0x20(%rax)
movslq -0x44(%rbp), %rax
movq %rax, -0x398(%rbp)
movslq -0x40(%rbp), %rsi
leaq 0x395de(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq -0x398(%rbp), %rcx
movq %rcx, 0x38(%rax)
movslq -0x24(%rbp), %rax
movq %rax, -0x390(%rbp)
movslq -0x40(%rbp), %rsi
leaq 0x395b4(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x18260
movq -0x390(%rbp), %rcx
movq %rcx, (%rax)
cmpl $0x0, 0x18(%rbp)
je 0x9316
movslq -0x40(%rbp), %rsi
leaq 0x39580(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x18260
movq (%rax), %rcx
orq $0x20000000, %rcx       # imm = 0x20000000
movq %rcx, (%rax)
cmpl $0x0, 0x30(%rbp)
je 0x934d
movslq -0x40(%rbp), %rsi
leaq 0x39549(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x18260
movq (%rax), %rcx
orq $0x40000000, %rcx       # imm = 0x40000000
movq %rcx, (%rax)
cmpl $0x0, 0x50(%rbp)
je 0x9384
movslq -0x40(%rbp), %rsi
leaq 0x39512(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x18260
movq (%rax), %rcx
orq $0x10000000, %rcx       # imm = 0x10000000
movq %rcx, (%rax)
cmpl $0x0, 0x30(%rbp)
jne 0x93ce
cmpl $0x0, 0x50(%rbp)
jne 0x93ce
movslq -0x24(%rbp), %rsi
leaq 0x394d5(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rax
andq $0x400, %rax            # imm = 0x400
cmpq $0x0, %rax
je 0x93ce
leaq 0x28988(%rip), %rdi     # 0x31d43
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
jge 0x93e0
movq -0x38(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x93fa
leaq 0x28986(%rip), %rdi     # 0x31d6d
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
cmpl $0x0, 0x10(%rbp)
je 0x941a
leaq 0x289ae(%rip), %rdi     # 0x31db5
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movl $0xffffffff, -0x244(%rbp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x20(%rbp)
je 0x9444
movq -0x18(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x25930
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
jmp 0x9463
movq -0x18(%rbp), %rdi
leaq -0x240(%rbp), %rsi
leaq -0x244(%rbp), %rdx
callq 0x25850
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
jge 0x948f
movq -0x30(%rbp), %rax
cmpl $-0x2, (%rax)
je 0x9483
leaq 0x28962(%rip), %rdi     # 0x31dde
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x39c(%rbp)
movslq -0x40(%rbp), %rsi
leaq 0x393ca(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movl -0x39c(%rbp), %ecx
movl %ecx, 0x34(%rax)
movq -0x18(%rbp), %rax
movq 0x8d40(%rax), %rcx
addq $0x4, %rcx
movq %rcx, 0x8d40(%rax)
movl $0x0, -0x248(%rbp)
movb $0x0, -0x249(%rbp)
leaq -0x2b0(%rbp), %rdi
xorl %esi, %esi
movl $0x64, %edx
callq 0x4230
movq -0x10(%rbp), %rdi
callq 0x1de00
movl %eax, -0x2b4(%rbp)
movl -0x2b4(%rbp), %esi
leaq 0x39362(%rip), %rdi     # 0x42870
callq 0x1e1e0
movl %eax, -0x2b8(%rbp)
cmpl $0x6, -0x2b8(%rbp)
jne 0x9527
jmp 0xa00a
cmpl $0x1b, -0x2b8(%rbp)
jne 0x957e
movl -0x3c(%rbp), %eax
addl $0x64, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1de00
movl %eax, -0x2b4(%rbp)
movl -0x2b4(%rbp), %esi
leaq 0x3931b(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x6, %eax
je 0x9579
leaq 0x288a0(%rip), %rdi     # 0x31e06
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
jmp 0xa00a
cmpl $0x31, -0x2b8(%rbp)
jne 0x9593
movb $0x1, -0x249(%rbp)
jmp 0xa001
cmpl $0x2e, -0x2b8(%rbp)
jne 0x9f85
movl -0x3c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
cmpl $0xf, %edx
jl 0x95ca
leaq 0x28870(%rip), %rdi     # 0x31e27
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movl -0x2b4(%rbp), %eax
leaq 0x39299(%rip), %rcx     # 0x42870
cmpl 0x18(%rcx), %eax
jne 0x95f6
leaq 0x2886d(%rip), %rdi     # 0x31e50
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movl $0x0, -0x2bc(%rbp)
movl $0x0, -0x2c0(%rbp)
movslq -0x2b4(%rbp), %rax
movq %rax, -0x3a8(%rbp)
movslq -0x40(%rbp), %rsi
leaq 0x3924d(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
movl -0x3c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movslq %edx, %rsi
callq 0x18260
movq -0x3a8(%rbp), %rcx
movq %rcx, (%rax)
movslq -0x40(%rbp), %rsi
leaq 0x39215(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x70, %rdi
movl -0x3c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movslq %edx, %rsi
callq 0x17e00
movl $0x0, (%rax)
movslq -0x40(%rbp), %rsi
leaq 0x391e1(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x88, %rdi
movl -0x3c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movslq %edx, %rsi
callq 0x181b0
movq %rax, -0x2d0(%rbp)
movq %rdx, -0x2c8(%rbp)
leaq -0x2d0(%rbp), %rdi
xorl %esi, %esi
callq 0x18210
testb $0x1, -0x249(%rbp)
je 0x9715
movslq -0x40(%rbp), %rsi
leaq 0x3918b(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
movl -0x3c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movslq %edx, %rsi
callq 0x18260
movq (%rax), %rcx
orq $0x20000000, %rcx       # imm = 0x20000000
movq %rcx, (%rax)
leaq -0x2b0(%rbp), %rdi
callq 0x41d0
movb $0x0, -0x2af(%rbp,%rax)
movl -0x2b4(%rbp), %eax
movb %al, -0x3a9(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x41d0
movb -0x3a9(%rbp), %cl
movb %cl, -0x2b0(%rbp,%rax)
movq -0x10(%rbp), %rdi
callq 0x8a60
cmpl $0x0, %eax
je 0x9768
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x390f6(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, %rdi
leaq 0x2aa93(%rip), %rsi     # 0x3421c
callq 0x4510
cmpl $0x0, %eax
jne 0x9995
movq -0x10(%rbp), %rdi
callq 0x1de00
movl -0x2b4(%rbp), %esi
leaq 0x390c3(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, %rsi
leaq 0x2acd9(%rip), %rdi     # 0x34495
callq 0x4510
cmpl $0x0, %eax
jne 0x97d5
movl $0x1, -0x2c0(%rbp)
jmp 0x986f
movl -0x2b4(%rbp), %esi
leaq 0x3908e(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, %rsi
leaq 0x28cad(%rip), %rdi     # 0x3249e
callq 0x4510
cmpl $0x0, %eax
jne 0x9807
movl $0x4, -0x2c0(%rbp)
jmp 0x986d
movl -0x2b4(%rbp), %esi
leaq 0x3905c(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, %rsi
leaq 0x28658(%rip), %rdi     # 0x31e7b
callq 0x4510
cmpl $0x0, %eax
jne 0x9839
movl $0x2, -0x2c0(%rbp)
jmp 0x986b
movl -0x2b4(%rbp), %esi
leaq 0x3902a(%rip), %rdi     # 0x42870
callq 0x1f730
movq %rax, %rsi
leaq 0x2893d(%rip), %rdi     # 0x32192
callq 0x4510
cmpl $0x0, %eax
jne 0x9869
movl $0x4, -0x2c0(%rbp)
jmp 0x986b
jmp 0x986d
jmp 0x986f
cmpl $0x0, -0x2c0(%rbp)
je 0x98c3
leaq 0x38ff1(%rip), %rax     # 0x42870
movslq (%rax), %rax
movq %rax, -0x3b8(%rbp)
movslq -0x40(%rbp), %rsi
leaq 0x38fdc(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
movl -0x3c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movslq %edx, %rsi
callq 0x18260
movq -0x3b8(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x9908
movslq -0x40(%rbp), %rsi
leaq 0x38fa2(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
movl -0x3c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movslq %edx, %rsi
callq 0x18260
movq (%rax), %rcx
orq $0x40000000, %rcx       # imm = 0x40000000
movq %rcx, (%rax)
movl $0x1, -0x2bc(%rbp)
movslq -0x2b4(%rbp), %rsi
leaq 0x38f5a(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rax
andq $0x1000, %rax           # imm = 0x1000
cmpq $0x0, %rax
jne 0x9952
cmpl $0x0, -0x2c0(%rbp)
jne 0x9952
leaq 0x28542(%rip), %rdi     # 0x31e81
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movslq -0x2b4(%rbp), %rsi
leaq 0x38f10(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rax
andq $0x20000, %rax          # imm = 0x20000
cmpq $0x0, %rax
je 0x9993
leaq 0x2852c(%rip), %rdi     # 0x31eac
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
jmp 0x9995
movslq -0x2b4(%rbp), %rsi
leaq 0x38ecd(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rax
andq $0x20000, %rax          # imm = 0x20000
cmpq $0x0, %rax
je 0x9a01
movslq -0x40(%rbp), %rsi
leaq 0x38ea9(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
movl -0x3c(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movslq %edx, %rsi
callq 0x18260
movq (%rax), %rcx
orq $0x40000000, %rcx       # imm = 0x40000000
movq %rcx, (%rax)
movl $0x1, -0x2bc(%rbp)
movb $0x0, -0x2d1(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x38e56(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x0, %eax
je 0x9a87
movl $0x1, -0x248(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x38e30(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x1, %eax
jne 0x9a59
cmpl $0x0, 0x20(%rbp)
je 0x9a59
movq -0x10(%rbp), %rdi
callq 0x1de00
movq -0x10(%rbp), %rdi
movl -0x40(%rbp), %esi
movl -0x3c(%rbp), %edx
callq 0x8ac0
cmpl $0x0, %eax
je 0x9a79
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x9d89
cmpl $0x0, 0x20(%rbp)
jne 0x9a96
cmpl $0x0, -0x248(%rbp)
je 0x9acd
movq -0x10(%rbp), %rdi
callq 0x1de00
movq -0x10(%rbp), %rdi
movl -0x40(%rbp), %esi
movl -0x3c(%rbp), %edx
callq 0x8ac0
cmpl $0x0, %eax
je 0x9abf
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x9d87
movl -0x2b4(%rbp), %eax
movl %eax, -0x2d8(%rbp)
movslq -0x2b4(%rbp), %rsi
leaq 0x38d89(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rax
andq $0x400, %rax            # imm = 0x400
cmpq $0x0, %rax
je 0x9b23
cmpl $0x0, -0x2bc(%rbp)
jne 0x9b23
leaq 0x283b3(%rip), %rdi     # 0x31ec3
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x10(%rbp), %rdi
callq 0x1de00
movl %eax, -0x2b4(%rbp)
movslq -0x2b4(%rbp), %rsi
leaq 0x38d30(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movw $0x2, 0x20(%rax)
movslq -0x2b4(%rbp), %rsi
leaq 0x38d13(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movw $0x0, 0x50(%rax)
movl -0x2c0(%rbp), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
cltq
movq %rax, -0x3c0(%rbp)
movslq -0x2b4(%rbp), %rsi
leaq 0x38cda(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq -0x3c0(%rbp), %rcx
movq %rcx, 0x48(%rax)
cmpl $0x0, -0x2c0(%rbp)
je 0x9bc4
leaq 0x38cb6(%rip), %rax     # 0x42870
movl (%rax), %eax
movl %eax, -0x3c4(%rbp)
jmp 0x9bd0
movl -0x2d8(%rbp), %eax
movl %eax, -0x3c4(%rbp)
movl -0x3c4(%rbp), %eax
movw %ax, -0x3c6(%rbp)
movslq -0x2b4(%rbp), %rsi
leaq 0x38c85(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movw -0x3c6(%rbp), %cx
movw %cx, 0x30(%rax)
cmpl $0x0, -0x2c0(%rbp)
je 0x9c16
movl -0x2c0(%rbp), %eax
movl %eax, -0x3cc(%rbp)
jmp 0x9c23
movl $0x4, %eax
movl %eax, -0x3cc(%rbp)
jmp 0x9c23
movl -0x3cc(%rbp), %eax
cltq
movq %rax, -0x3d8(%rbp)
movslq -0x2b4(%rbp), %rsi
leaq 0x38c30(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq -0x3d8(%rbp), %rcx
movq %rcx, 0x38(%rax)
movq -0x38(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
movw %ax, -0x3ce(%rbp)
movslq -0x2b4(%rbp), %rsi
leaq 0x38bfe(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movw -0x3ce(%rbp), %cx
movw %cx, 0x40(%rax)
movslq -0x2b4(%rbp), %rsi
leaq 0x38bdc(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rcx
orq $0x1, %rcx
movq %rcx, 0x28(%rax)
cmpl $0x0, -0x2bc(%rbp)
je 0x9cda
movslq -0x2b4(%rbp), %rsi
leaq 0x38bb0(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rcx
orq $0x100, %rcx            # imm = 0x100
movq %rcx, 0x28(%rax)
jmp 0x9d08
cmpl $0x0, -0x2c0(%rbp)
je 0x9d06
movslq -0x2b4(%rbp), %rsi
leaq 0x38b7f(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rcx
orq $0x2, %rcx
movq %rcx, 0x28(%rax)
jmp 0x9d08
testb $0x1, -0x249(%rbp)
je 0x9d37
movslq -0x2b4(%rbp), %rsi
leaq 0x38b51(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rcx
orq $0x10040, %rcx          # imm = 0x10040
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movq 0x8d40(%rax), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movl %eax, -0x3dc(%rbp)
movslq -0x2b4(%rbp), %rsi
leaq 0x38b0b(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movl -0x3dc(%rbp), %ecx
movl %ecx, 0x34(%rax)
movb $0x1, -0x2d1(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x9d89
movq -0x10(%rbp), %rdi
movl -0x2b4(%rbp), %esi
cmpl $0x0, -0x2bc(%rbp)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x8bf0
movl %eax, -0x2dc(%rbp)
cmpl $0x0, -0x2dc(%rbp)
jge 0x9dc7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
cmpl $0x0, -0x2dc(%rbp)
jle 0x9e3f
movslq -0x40(%rbp), %rsi
leaq 0x38a95(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq %rax, %rdi
addq $0x58, %rdi
movl -0x3c(%rbp), %eax
subl $0x1, %eax
movl $0x64, %ecx
cltd
idivl %ecx
movslq %edx, %rsi
callq 0x18260
movq (%rax), %rcx
orq $0x10000000, %rcx       # imm = 0x10000000
movq %rcx, (%rax)
testb $0x1, -0x2d1(%rbp)
je 0x9e3d
movslq -0x2b4(%rbp), %rsi
leaq 0x38a4b(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rcx
orq $0x40002, %rcx          # imm = 0x40002
movq %rcx, 0x28(%rax)
jmp 0x9e3f
jmp 0x9e41
movq -0x10(%rbp), %rdi
callq 0x1de00
movl %eax, %esi
movl %esi, -0x2b4(%rbp)
leaq 0x38a17(%rip), %rdi     # 0x42870
callq 0x1e1e0
movl %eax, -0x2b8(%rbp)
cmpl $0x6, -0x2b8(%rbp)
jne 0x9e72
jmp 0xa00a
cmpl $0x1, -0x2b8(%rbp)
jne 0x9ef5
movl -0x2b4(%rbp), %edx
leaq 0x389e8(%rip), %rsi     # 0x42870
leaq -0x300(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x1f080
movq -0x3e8(%rbp), %rdi
callq 0x41b0
movq %rax, %rsi
leaq 0x28037(%rip), %rdi     # 0x31ee8
xorl %eax, %eax
callq 0x1bac0
jmp 0x9eba
leaq -0x300(%rbp), %rdi
callq 0x4270
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x308(%rbp)
movl %eax, -0x30c(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x4270
jmp 0xa1c5
cmpl $0x2a, -0x2b8(%rbp)
je 0x9f78
movl -0x2b4(%rbp), %edx
leaq 0x38965(%rip), %rsi     # 0x42870
leaq -0x330(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x1f080
movq -0x3f0(%rbp), %rdi
callq 0x41b0
movq %rax, %rsi
leaq 0x27fe7(%rip), %rdi     # 0x31f1b
xorl %eax, %eax
callq 0x1bac0
jmp 0x9f3d
leaq -0x330(%rbp), %rdi
callq 0x4270
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x308(%rbp)
movl %eax, -0x30c(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x4270
jmp 0xa1c5
jmp 0x9f7a
jmp 0x9f7c
movb $0x0, -0x249(%rbp)
jmp 0x9fff
movl -0x2b4(%rbp), %edx
leaq 0x388de(%rip), %rsi     # 0x42870
leaq -0x350(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x1f080
movq -0x3f8(%rbp), %rdi
callq 0x41b0
movq %rax, %rsi
leaq 0x27f7a(%rip), %rdi     # 0x31f35
xorl %eax, %eax
callq 0x1bac0
jmp 0x9fc4
leaq -0x350(%rbp), %rdi
callq 0x4270
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x308(%rbp)
movl %eax, -0x30c(%rbp)
leaq -0x350(%rbp), %rdi
callq 0x4270
jmp 0xa1c5
jmp 0xa001
jmp 0xa003
jmp 0xa005
jmp 0x94f2
movl -0x3c(%rbp), %eax
subl $0x1, %eax
movw %ax, -0x3fa(%rbp)
movslq -0x40(%rbp), %rsi
leaq 0x3884e(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movw -0x3fa(%rbp), %cx
movw %cx, 0x40(%rax)
cmpl $0x0, -0x244(%rbp)
jl 0xa06a
movslq -0x40(%rbp), %rsi
leaq 0x38826(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movw 0x40(%rax), %dx
movq -0x18(%rbp), %rax
movslq -0x244(%rbp), %rcx
movw %dx, 0x7d98(%rax,%rcx,2)
cmpl $0x0, 0x38(%rbp)
je 0xa093
movslq -0x40(%rbp), %rsi
leaq 0x387f5(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rcx
orq $0x2000, %rcx           # imm = 0x2000
movq %rcx, 0x28(%rax)
cmpl $0x0, 0x20(%rbp)
je 0xa17b
movslq -0x40(%rbp), %rsi
leaq 0x387c8(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rcx
orq $0x4, %rcx
movq %rcx, 0x28(%rax)
cmpl $0x0, 0x28(%rbp)
je 0xa11d
leaq -0x35a(%rbp), %rax
movq %rax, -0x408(%rbp)
movslq -0x40(%rbp), %rsi
leaq 0x38794(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq -0x408(%rbp), %rdi
movswl 0x40(%rax), %edx
leaq 0x27e58(%rip), %rsi     # 0x31f4f
movb $0x0, %al
callq 0x40d0
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x35a(%rbp), %rsi
callq 0x4690
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, -0x360(%rbp)
cmpl $0x0, 0x28(%rbp)
jne 0xa141
movq -0x10(%rbp), %rdi
callq 0x1de00
movl %eax, -0x360(%rbp)
movl -0x360(%rbp), %esi
leaq 0x38722(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x28, %eax
je 0xa16f
leaq 0x27df4(%rip), %rdi     # 0x31f53
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
movq -0x30(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0xa1b2
movq -0x10(%rbp), %rdi
callq 0x1dd60
movl %eax, %esi
leaq 0x386e3(%rip), %rdi     # 0x42870
callq 0x1e1e0
cmpl $0x17, %eax
jne 0xa199
jmp 0xa1b0
leaq 0x27dea(%rip), %rdi     # 0x31f8a
movb $0x0, %al
callq 0x1bac0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa1b9
jmp 0xa1b2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x410, %rsp            # imm = 0x410
popq %rbp
retq
movq -0x308(%rbp), %rdi
callq 0x4670
nopw %cs:(%rax,%rax)