// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/cs_parser.cpp
// Function: parse_variable_declaration(long, int*, int, int, ccCompiledScript*, ccInternalList*, int, int, int)
int parse_variable_declaration(long cursym,int *next_type,int isglobal,
    int varsize,ccCompiledScript*scrip,ccInternalList*targ, int vtwas,
    int isPointer, int isRawPointer) {
  long lbuffer = 0;
  std::vector<char> xbuffer;
  long *getsvalue = &lbuffer;
  int need_fixup = 0;
  int array_size = 1;
  if (sym.get_type(cursym) != 0) {
    cc_error ("Symbol '%s' already defined");
    return -1;
  }

  if ((sym.entries[vtwas].flags & SFLG_MANAGED) && (!isPointer) && (isglobal != 2)) {
    // managed structs must be allocated via ccRegisterObject,
    // and cannot be declared normally in the script (unless imported)
    cc_error("Cannot declare local instance of managed type");
    return -1;
  }

  if (vtwas == sym.normalVoidSym) {
    cc_error("'void' not a valid variable type");
    return -1;
  }

  sym.entries[cursym].extends = 0;
  sym.entries[cursym].stype = (isglobal != 0) ? SYM_GLOBALVAR : SYM_LOCALVAR;
  if (isRawPointer) {
    sym.entries[cursym].flags |= SFLG_ARRAY;
    sym.entries[cursym].vartype = sym.normalIntSym;
    sym.entries[cursym].arrsize = 0;
    sym.entries[cursym].ssize = varsize;
    vtwas = sym.normalIntSym;
    varsize = 4;
  } else {
    if (isPointer) {
      varsize = 4;
    }
    sym.entries[cursym].arrsize = 1;
    sym.entries[cursym].vartype = vtwas;
    if (isPointer)
      sym.entries[cursym].flags |= SFLG_POINTER;
    sym.entries[cursym].ssize = varsize;
  }

  if (((sym.entries[vtwas].flags & SFLG_MANAGED) == 0) && (isPointer) && (isglobal != 2)) {
    // can only point to managed structs
    cc_error("Cannot declare pointer to non-managed type");
    return -1;
  }

  if (next_type[0] == SYM_OPENBRACKET) {
    // an array
    targ->getnext();  // skip the [

    if (sym.get_type(targ->peeknext()) == SYM_CLOSEBRACKET)
    {
      sym.entries[cursym].flags |= SFLG_DYNAMICARRAY;
      array_size = 0;
      varsize = 4;
      //cc_error("dynamic arrays not yet supported"); return -1;
    }
    else
    {
      int nextt = targ->getnext();

      if (accept_literal_or_constant_value(nextt, array_size, false, "Array size must be constant value") < 0) {
        return -1;
      }

      if (sym.entries[vtwas].flags & SFLG_HASDYNAMICARRAY) {
        cc_error("Cannot declare an array of a type containing dynamic array(s)");
        return -1;
      }

      if (array_size < 1) {
        cc_error("Array size must be >=1");
        return -1;
      }

      varsize *= array_size;
    }
    sym.entries[cursym].flags |= SFLG_ARRAY;
    sym.entries[cursym].arrsize = array_size;

    if (sym.get_type(targ->getnext()) != SYM_CLOSEBRACKET)
    {
      cc_error("expected ']'");
      return -1;
    }

    next_type[0] = sym.get_type(targ->peeknext());
    xbuffer.resize(varsize + 1);
    getsvalue = (long*)&xbuffer.front();
  }
  else if (varsize > 4) {
    xbuffer.resize(varsize + 1);
    getsvalue = (long*)&xbuffer.front();
  }

  if (strcmp(sym.get_name(vtwas),"string")==0) {
    sym.entries[cursym].flags |= SFLG_ISSTRING;
    // if it's a string, allocate it some space
    if (ccGetOption(SCOPT_OLDSTRINGS) == 0) {
      cc_error("type 'string' is no longer supported; use String instead");
      return -1;
    }
    else if (sym.entries[cursym].flags & SFLG_DYNAMICARRAY)
    {
      cc_error("arrays of old-style strings are not supported");
      return -1;
    }
    else if (isglobal == 2) {
      // importing a string
      // cannot import, because string is really char*, and the pointer
      // won't resolve properly
      cc_error("cannot import string; use char[] instead");
      return -1;
    }
    else if (isglobal == 1) {
      getsvalue[0] = scrip->add_global(STRING_LENGTH,NULL);
      if (getsvalue[0] < 0)
        return -1;
      need_fixup = 1;
    }
    else if (isglobal == 0) {
      //getsvalue[0] = scrip->cur_sp;
      getsvalue = NULL;
      // save the address of this bit of memory to assign the pointer to it
      // we can't use scrip->cur_sp since we don't know if we'll be in
      // a nested function call at the time
      scrip->write_cmd2(SCMD_REGTOREG, SREG_SP, SREG_CX);
      //scrip->add_fixup(scrip->codesize-2,FIXUP_STACK);
      scrip->cur_sp += STRING_LENGTH;
      scrip->write_cmd2(SCMD_ADD,SREG_SP,STRING_LENGTH);
      sym.entries[cursym].flags |= SFLG_STRBUFFER;
      //need_fixup = 1;
    }
  }

  // assign an initial value to the variable
  if (next_type[0] == SYM_ASSIGN) {
    if (isglobal == 2) {
      cc_error("cannot set initial value of imported variables");
      return -1;
    }
    if ((sym.entries[cursym].flags & (SFLG_ARRAY | SFLG_DYNAMICARRAY)) == SFLG_ARRAY &&
         !isRawPointer) {
      cc_error("cannot assign value to array");
      return -1;
    }
    if (sym.entries[cursym].flags & SFLG_ISSTRING) {
      cc_error("cannot assign value to string, use StrCopy");
      return -1;
    }
    targ->getnext();  // skip the '='

    int actualVarType = vtwas;
    if (sym.entries[cursym].flags & SFLG_POINTER)
      actualVarType |= STYPE_POINTER;

    if (sym.entries[cursym].flags & SFLG_DYNAMICARRAY)
      actualVarType |= STYPE_DYNARRAY;

    if (isglobal) {
      if ((sym.entries[cursym].flags & (SFLG_POINTER | SFLG_DYNAMICARRAY)) != 0) {
        cc_error("cannot assign initial value to global pointer");
        return -1;
      }
      bool is_neg = false;
      if (sym.get_name(targ->peeknext())[0] == '-') {
        is_neg = true;
        targ->getnext();
      }
      if (sym.entries[cursym].vartype == sym.normalFloatSym) {
        // initialize float
        if (sym.get_type(targ->peeknext()) != SYM_LITERALFLOAT) {
          cc_error("Expected floating point value after '='");
          return -1;
        }
        float tehValue = (float)atof(sym.get_name(targ->getnext()));
        if (is_neg)
          tehValue = -tehValue;
        getsvalue[0] = float_to_int_raw(tehValue);
      }
      else if (sym.entries[cursym].ssize > 4) {
        cc_error("cannot initialize struct type");
        return -1;
      }
      else {
        int getsvalue_int;
        if (accept_literal_or_constant_value(targ->getnext(), getsvalue_int, is_neg, "Expected integer value after '='") < 0) {
          return -1;
        }
        getsvalue[0] = (long)getsvalue_int;

      }
    }
    else {

      if (evaluate_expression(targ,scrip,0,false))
        return -1;

      PerformStringConversionInAX(scrip, &scrip->ax_val_type, actualVarType);

      if (check_type_mismatch(scrip->ax_val_type, actualVarType, 1))
        return -1;
      need_fixup = 2;
    }
    next_type[0] = sym.get_type(targ->peeknext());
  }

  if (isglobal == 2) {
    // an imported variable
    sym.entries[cursym].soffs = scrip->add_new_import(sym.get_name(cursym));
    sym.entries[cursym].flags |= SFLG_IMPORTED;
    if (sym.entries[cursym].soffs == -1) {
      cc_error("Internal error: import table overflow");
      return -1;
      }
    }
  else if (isglobal) {
    // a global variable
    sym.entries[cursym].soffs = scrip->add_global(varsize,reinterpret_cast<const char*>(&getsvalue[0]));
    if (sym.entries[cursym].soffs < 0)
      return -1;
    if (need_fixup == 1) scrip->add_fixup(sym.entries[cursym].soffs,FIXUP_DATADATA);
    }
  else {
    // local variable
    sym.entries[cursym].soffs = scrip->cur_sp;
    scrip->write_cmd2(SCMD_REGTOREG,SREG_SP,SREG_MAR);
    if (need_fixup == 2) {
      // expression worked out into ax
      if ((sym.entries[cursym].flags & (SFLG_POINTER | SFLG_DYNAMICARRAY)) != 0)
      {
        scrip->write_cmd1(SCMD_MEMINITPTR, SREG_AX);
      }
      else
        scrip->write_cmd1(get_readcmd_for_size(varsize,1),SREG_AX);
    }
    else if (getsvalue == NULL)
      // local string, so the memory chunk pointer needs to be written
      scrip->write_cmd1(SCMD_MEMWRITE, SREG_CX);
    else { // local variable without initial value -- zero it
      if(compiler_max_command >= SCMD_ZEROMEMORY)
        scrip->write_cmd1(SCMD_ZEROMEMORY, varsize);
      else
        scrip->write_cmd2(SCMD_WRITELIT, varsize, 0);
    }

    if (need_fixup == 1) {
      sym.entries[cursym].flags |= SFLG_STRBUFFER;
      scrip->fixup_previous(FIXUP_STACK);
    }
    if(varsize > 0) {
      scrip->cur_sp += varsize;
      scrip->write_cmd2(SCMD_ADD,SREG_SP,varsize);
    }
  }
  if (next_type[0] == SYM_COMMA) {
    targ->getnext();  // skip the comma
    return 2;
    }
  if (check_not_eof(*targ))
    return -1;
  if (next_type[0] != SYM_SEMICOLON) {
    cc_error("Expected ',' or ';', not '%s'",sym.get_friendly_name(targ->peeknext()).c_str());
    return -1;
    }
  targ->getnext();  // skip the semicolon
  return 0;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, 0x8(%rsp)
movq %r8, 0x10(%rsp)
movl %ecx, %r14d
movl %edx, %ebp
andq $0x0, 0x60(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movl $0x1, 0x34(%rsp)
leaq 0x1b2be(%rip), %r15     # 0x256f0
movq %r15, %rdi
movl %r12d, %esi
callq 0xfe60
pushq $-0x1
popq %rbx
testl %eax, %eax
je 0xa450
leaq 0xf3fd(%rip), %rdi      # 0x19848
jmp 0xa53d
movl 0xc8(%rsp), %ecx
movl 0xc0(%rsp), %r13d
movslq %r13d, %rdx
movq 0x28(%r15), %rax
cmpl $0x2, %ebp
je 0xa48f
testl %ecx, %ecx
jne 0xa48f
imulq $0xb0, %rdx, %rsi
movq 0x28(%rax,%rsi), %rsi
andl $0x1000, %esi           # imm = 0x1000
je 0xa48f
leaq 0xf3da(%rip), %rdi      # 0x19864
jmp 0xa53d
cmpl %r13d, 0x18(%r15)
jne 0xa4a1
leaq 0xf3f6(%rip), %rdi      # 0x19892
jmp 0xa53d
imulq $0xb0, %r12, %r8
andw $0x0, 0x50(%rax,%r8)
xorl %edi, %edi
cmpl $0x1, %ebp
adcw $0x1, %di
leaq (%rax,%r8), %rsi
movq %r8, 0x18(%rsp)
movw %di, 0x20(%rax,%r8)
pushq $0x4
popq %rdi
cmpl $0x0, 0xd0(%rsp)
movq %rdi, 0x20(%rsp)
je 0xa4fa
orb $0x2, 0x28(%rsi)
movl (%r15), %r13d
movw %r13w, 0x30(%rsi)
andq $0x0, 0x48(%rsi)
movslq %r14d, %rdx
movq %rdx, 0x38(%rsi)
movslq %r13d, %rdx
pushq $0x4
popq %r14
jmp 0xa51a
movq $0x1, 0x48(%rsi)
movw %r13w, 0x30(%rsi)
testl %ecx, %ecx
cmovnel %edi, %r14d
je 0xa513
orb $0x1, 0x29(%rsi)
movslq %r14d, %rdi
movq %rdi, 0x38(%rsi)
imulq $0xb0, %rdx, %r15
cmpl $0x2, %ebp
je 0xa562
testl %ecx, %ecx
je 0xa562
movq 0x28(%rax,%r15), %rax
andl $0x1000, %eax           # imm = 0x1000
jne 0xa562
leaq 0xe990(%rip), %rdi      # 0x18ecd
xorl %eax, %eax
callq 0xf258
leaq 0x40(%rsp), %rdi
callq 0xeb3e
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rsp), %rax
cmpl $0x7, (%rax)
jne 0xa625
movq 0x8(%rsp), %rdi
callq 0xfc84
movq 0x8(%rsp), %rdi
callq 0xfc58
leaq 0x1b165(%rip), %rdi     # 0x256f0
movl %eax, %esi
callq 0xfe60
cmpl $0x8, %eax
jne 0xa69e
leaq 0x1b14e(%rip), %rax     # 0x256f0
movq 0x28(%rax), %rax
movq 0x18(%rsp), %rdx
orq $0x40000, 0x28(%rax,%rdx) # imm = 0x40000
andl $0x0, 0x34(%rsp)
xorl %ecx, %ecx
orb $0x2, 0x28(%rax,%rdx)
movq %rcx, 0x48(%rax,%rdx)
movq 0x8(%rsp), %rdi
callq 0xfc84
leaq 0x1b11a(%rip), %rdi     # 0x256f0
movl %eax, %esi
callq 0xfe60
cmpl $0x8, %eax
jne 0xa7c7
movq 0x8(%rsp), %rdi
callq 0xfc58
leaq 0x1b0f9(%rip), %rdi     # 0x256f0
movl %eax, %esi
callq 0xfe60
movq 0x38(%rsp), %rcx
movl %eax, (%rcx)
movq 0x20(%rsp), %rax
incl %eax
movslq %eax, %rsi
leaq 0x40(%rsp), %rdi
callq 0xe9b8
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0xa64f
cmpl $0x5, %r14d
jl 0xa640
leal 0x1(%r14), %esi
leaq 0x40(%rsp), %rdi
callq 0xe9b8
movq 0x40(%rsp), %rax
jmp 0xa645
leaq 0x60(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %r14, 0x20(%rsp)
leaq 0x1b09a(%rip), %rdi     # 0x256f0
movq %rdi, %r14
movl %r13d, %esi
callq 0x10b48
leaq 0x10d9b(%rip), %rsi     # 0x1b403
movq %rax, %rdi
callq 0x3450
xorl %r15d, %r15d
testl %eax, %eax
je 0xa6fd
movq 0x38(%rsp), %rax
cmpl $0x19, (%rax)
jne 0xa778
cmpl $0x2, %ebp
jne 0xa7d3
leaq 0xf32e(%rip), %rdi      # 0x199c7
jmp 0xa53d
movq 0x8(%rsp), %rdi
callq 0xfc84
leaq 0xf204(%rip), %rcx      # 0x198b3
leaq 0x34(%rsp), %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x5b7b
testl %eax, %eax
js 0xa544
leaq 0x1b024(%rip), %rax     # 0x256f0
movq 0x28(%rax), %rax
testb $0x10, 0x2a(%rax,%r15)
jne 0xa852
movslq 0x34(%rsp), %rcx
testq %rcx, %rcx
jle 0xa873
imull %ecx, %r14d
movq %r14, 0x20(%rsp)
movq 0x18(%rsp), %rdx
jmp 0xa5bb
movq 0x28(%r14), %rax
movq 0x18(%rsp), %rcx
orq $0x20, 0x28(%rax,%rcx)
movl $0x80, %edi
callq 0x127df
testl %eax, %eax
je 0xa846
movq 0x28(%r14), %rax
movq 0x18(%rsp), %rcx
testb $0x4, 0x2a(%rax,%rcx)
jne 0xa85b
testl %ebp, %ebp
je 0xa89e
cmpl $0x2, %ebp
je 0xa892
cmpl $0x1, %ebp
jne 0xa67b
movq 0x10(%rsp), %rdi
movl $0xc8, %esi
xorl %edx, %edx
callq 0x11fa4
cltq
movq 0x28(%rsp), %rcx
movq %rax, (%rcx)
testl %eax, %eax
js 0xa544
pushq $0x1
popq %r15
jmp 0xa67b
cmpl $0x2, %ebp
jne 0xaa69
leaq 0x1af68(%rip), %r14     # 0x256f0
movq %r14, %rdi
movl %r12d, %esi
callq 0x10b48
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x12178
movq 0x28(%r14), %rcx
movq 0x18(%rsp), %rdx
movl %eax, 0x34(%rcx,%rdx)
orb $0x4, 0x28(%rcx,%rdx)
cmpl $-0x1, %eax
jne 0xab99
leaq 0xf311(%rip), %rdi      # 0x19ad3
jmp 0xa53d
leaq 0xf15c(%rip), %rdi      # 0x1992a
jmp 0xa53d
cmpl $0x0, 0xd0(%rsp)
sete %cl
movq 0x28(%r14), %rax
movq 0x18(%rsp), %rdx
movq 0x28(%rax,%rdx), %rax
movl %eax, %edx
andl $0x40002, %edx          # imm = 0x40002
cmpl $0x2, %edx
sete %dl
testb %dl, %cl
jne 0xa867
testb $0x20, %al
jne 0xa886
movq 0x8(%rsp), %rdi
callq 0xfc84
movq 0x28(%r14), %rax
movq 0x18(%rsp), %rcx
movq 0x28(%rax,%rcx), %r12
testl %ebp, %ebp
je 0xa8f0
testl $0x40100, %r12d         # imm = 0x40100
je 0xa95d
leaq 0xf204(%rip), %rdi      # 0x19a3e
xorl %eax, %eax
callq 0xf258
jmp 0xa544
leaq 0xf0ea(%rip), %rdi      # 0x19937
jmp 0xa53d
leaq 0xf07c(%rip), %rdi      # 0x198d5
jmp 0xa87a
leaq 0xf10e(%rip), %rdi      # 0x19970
jmp 0xa53d
leaq 0xf188(%rip), %rdi      # 0x199f6
jmp 0xa53d
leaq 0xf099(%rip), %rdi      # 0x19913
xorl %eax, %eax
callq 0xf258
jmp 0xa544
leaq 0xf186(%rip), %rdi      # 0x19a13
jmp 0xa53d
leaq 0xf105(%rip), %rdi      # 0x1999e
jmp 0xa53d
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
pushq $0x5
popq %rcx
movq 0x10(%rsp), %rdi
callq 0x11e6a
movq 0x10(%rsp), %rdi
addq $0xc8, 0x8d40(%rdi)
pushq $0x1
popq %rdx
movl %edx, %esi
movl $0xc8, %ecx
callq 0x11e6a
movq 0x28(%r14), %rax
movq 0x18(%rsp), %rcx
orq $0x10, 0x28(%rax,%rcx)
movq $0x0, 0x28(%rsp)
xorl %r15d, %r15d
jmp 0xa67b
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x55a5
testl %eax, %eax
jne 0xa544
movl %r12d, %eax
shll $0x16, %eax
andl $0x40000000, %eax       # imm = 0x40000000
shll $0xa, %r12d
andl $0x10000000, %r12d      # imm = 0x10000000
orl %eax, %r12d
orl %r13d, %r12d
movq 0x10(%rsp), %rdi
leaq 0x8d4c(%rdi), %r15
movq %r15, %rsi
movl %r12d, %edx
callq 0x7755
movl (%r15), %edi
pushq $0x1
popq %rdx
movl %r12d, %esi
callq 0x6faa
testl %eax, %eax
jne 0xa544
pushq $0x2
popq %r15
jmp 0xaa4a
movq 0x8(%rsp), %rdi
callq 0xfc58
leaq 0x1ad82(%rip), %r13     # 0x256f0
movq %r13, %rdi
movl %eax, %esi
callq 0x10b48
movb (%rax), %r12b
cmpb $0x2d, %r12b
jne 0xa98b
movq 0x8(%rsp), %rdi
callq 0xfc84
movq 0x28(%r13), %rax
movq 0x18(%rsp), %rdx
movswl 0x30(%rax,%rdx), %ecx
cmpl %ecx, 0x14(%r13)
jne 0xa9f9
movq 0x8(%rsp), %rdi
callq 0xfc58
leaq 0x1ad40(%rip), %rdi     # 0x256f0
movl %eax, %esi
callq 0xfe60
cmpl $0x16, %eax
jne 0xac21
movq 0x8(%rsp), %rdi
callq 0xfc84
leaq 0x1ad1f(%rip), %rdi     # 0x256f0
movl %eax, %esi
callq 0x10b48
movq %rax, %rdi
callq 0x33f0
cvtsd2ss %xmm0, %xmm0
cmpb $0x2d, %r12b
jne 0xa9f1
xorps 0xdf3f(%rip), %xmm0     # 0x18930
movd %xmm0, %eax
cltq
jmp 0xaa42
addq %rdx, %rax
cmpq $0x5, 0x38(%rax)
jl 0xaa0f
leaq 0xf08a(%rip), %rdi      # 0x19a94
jmp 0xac28
movq 0x8(%rsp), %rdi
callq 0xfc84
xorl %edx, %edx
cmpb $0x2d, %r12b
sete %dl
leaq 0xf089(%rip), %rcx      # 0x19ab2
leaq 0x68(%rsp), %rsi
movl %eax, %edi
callq 0x5b7b
testl %eax, %eax
js 0xa544
movslq 0x68(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rax, (%rcx)
movq 0x8(%rsp), %rdi
callq 0xfc58
leaq 0x1ac95(%rip), %rdi     # 0x256f0
movl %eax, %esi
callq 0xfe60
movq 0x38(%rsp), %rcx
movl %eax, (%rcx)
testl %ebp, %ebp
je 0xaab4
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x11fa4
movq 0x28(%r14), %rcx
movq 0x18(%rsp), %rdx
movl %eax, 0x34(%rcx,%rdx)
testl %eax, %eax
js 0xa544
cmpl $0x1, %r15d
jne 0xab99
pushq $0x5
popq %rdx
movq 0x10(%rsp), %rdi
movl %eax, %esi
callq 0x1208c
jmp 0xab99
movq 0x10(%rsp), %rdi
movl 0x8d40(%rdi), %eax
movq 0x28(%r14), %rcx
movq 0x18(%rsp), %rdx
movl %eax, 0x34(%rcx,%rdx)
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
callq 0x11e6a
cmpl $0x2, %r15d
jne 0xaafe
movq 0x28(%r14), %rax
movq 0x18(%rsp), %rcx
movzwl 0x29(%rax,%rcx), %eax
testw $0x401, %ax             # imm = 0x401
movq 0x20(%rsp), %rdi
je 0xab19
pushq $0x32
popq %rsi
jmp 0xab23
cmpq $0x0, 0x28(%rsp)
movq 0x20(%rsp), %rdx
je 0xab32
cmpl $0x3f, 0x1a7ee(%rip)    # 0x25300
jl 0xab44
pushq $0x3f
popq %rsi
jmp 0xab38
pushq $0x1
popq %rsi
callq 0x79d7
movl %eax, %esi
pushq $0x3
popq %rdx
movq 0x10(%rsp), %rdi
callq 0x11e4a
jmp 0xab75
pushq $0x5
popq %rdx
pushq $0x8
popq %rsi
movq 0x10(%rsp), %rdi
callq 0x11e4a
jmp 0xab53
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rdi
xorl %ecx, %ecx
callq 0x11e6a
cmpl $0x1, %r15d
jne 0xab75
movq 0x28(%r14), %rax
movq 0x18(%rsp), %rcx
orq $0x10, 0x28(%rax,%rcx)
pushq $0x6
popq %rsi
movq 0x10(%rsp), %rdi
callq 0x120e4
cmpl $0x0, 0x20(%rsp)
jle 0xab99
movq 0x20(%rsp), %rcx
movl %ecx, %eax
movq 0x10(%rsp), %rdi
addq %rax, 0x8d40(%rdi)
pushq $0x1
popq %rdx
movl %edx, %esi
callq 0x11e6a
movq 0x38(%rsp), %rax
cmpl $0x2a, (%rax)
jne 0xabb5
movq 0x8(%rsp), %rdi
callq 0xfc84
pushq $0x2
popq %rbx
jmp 0xa544
movq 0x8(%rsp), %rdi
callq 0x5d62
testl %eax, %eax
jne 0xa544
movq 0x38(%rsp), %rax
cmpl $0x28, (%rax)
jne 0xabe2
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
callq 0xfc84
jmp 0xa544
movq 0x8(%rsp), %rdi
callq 0xfc58
leaq 0x1aafd(%rip), %rsi     # 0x256f0
leaq 0x68(%rsp), %rdi
movl %eax, %edx
callq 0x10864
movq 0x68(%rsp), %rsi
leaq 0xeeee(%rip), %rdi      # 0x19af9
xorl %eax, %eax
callq 0xf258
leaq 0x68(%rsp), %rdi
callq 0x31a0
jmp 0xa544
leaq 0xee44(%rip), %rdi      # 0x19a6c
xorl %eax, %eax
callq 0xf258
jmp 0xa544
jmp 0xac4f
jmp 0xac4f
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x31a0
jmp 0xac52
jmp 0xac4f
jmp 0xac4f
jmp 0xac4f
jmp 0xac4f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xeb3e
movq %rbx, %rdi
callq 0x3560