// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movq %r9, (%rsp)
movq %r8, 0x8(%rsp)
movl %ecx, %r12d
movl %edx, %ebp
movq %rsi, 0x28(%rsp)
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, 0x70(%rsp)
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movl $0x1, 0x24(%rsp)
leaq 0x1a7a4(%rip), %r15     # 0x256e0
movq %r15, %rdi
movl %ebx, %esi
callq 0x1106e
testl %eax, %eax
je 0xaf56
leaq 0x10917(%rip), %rdi     # 0x1b868
jmp 0xb046
movl 0xb8(%rsp), %ecx
movl 0xb0(%rsp), %r13d
movslq %r13d, %rdx
movq 0x28(%r15), %rax
cmpl $0x2, %ebp
je 0xaf95
testl %ecx, %ecx
jne 0xaf95
imulq $0xb0, %rdx, %rsi
movq 0x28(%rax,%rsi), %rsi
andl $0x1000, %esi           # imm = 0x1000
je 0xaf95
leaq 0x108f4(%rip), %rdi     # 0x1b884
jmp 0xb046
cmpl %r13d, 0x18(%r15)
jne 0xafa7
leaq 0x10910(%rip), %rdi     # 0x1b8b2
jmp 0xb046
imulq $0xb0, %rbx, %r8
leaq (%rax,%r8), %rsi
movw $0x0, 0x50(%rax,%r8)
xorl %edi, %edi
cmpl $0x1, %ebp
adcw $0x1, %di
movq %r8, 0x10(%rsp)
movw %di, 0x20(%rax,%r8)
cmpl $0x0, 0xc0(%rsp)
je 0xaffe
orb $0x2, 0x28(%rsi)
movl (%r15), %r13d
movw %r13w, 0x30(%rsi)
movq $0x0, 0x48(%rsi)
movslq %r12d, %rdx
movq %rdx, 0x38(%rsi)
movslq %r13d, %rdx
movl $0x4, %r12d
jmp 0xb023
movl $0x4, %edi
movq $0x1, 0x48(%rsi)
movw %r13w, 0x30(%rsi)
testl %ecx, %ecx
cmovnel %edi, %r12d
je 0xb01c
orb $0x1, 0x29(%rsi)
movslq %r12d, %rdi
movq %rdi, 0x38(%rsi)
imulq $0xb0, %rdx, %r14
cmpl $0x2, %ebp
je 0xb07c
testl %ecx, %ecx
je 0xb07c
movq 0x28(%rax,%r14), %rax
andl $0x1000, %eax           # imm = 0x1000
jne 0xb07c
leaq 0xfea7(%rip), %rdi      # 0x1aeed
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x102f4
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb06a
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3320
movl %r15d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rsp), %rax
cmpl $0x7, (%rax)
jne 0xb134
movq (%rsp), %rdi
callq 0x10e44
movq (%rsp), %rdi
callq 0x10e06
leaq 0x1a63d(%rip), %r15     # 0x256e0
movq %r15, %rdi
movl %eax, %esi
callq 0x1106e
cmpl $0x8, %eax
jne 0xb1a5
movq 0x28(%r15), %rax
movq 0x10(%rsp), %rdx
orq $0x40000, 0x28(%rax,%rdx) # imm = 0x40000
movl $0x0, 0x24(%rsp)
movl $0x4, %r12d
xorl %ecx, %ecx
orb $0x2, 0x28(%rax,%rdx)
movq %rcx, 0x48(%rax,%rdx)
movq (%rsp), %rdi
callq 0x10e44
leaq 0x1a5ee(%rip), %rdi     # 0x256e0
movl %eax, %esi
callq 0x1106e
cmpl $0x8, %eax
jne 0xb2cb
movq (%rsp), %rdi
callq 0x10e06
leaq 0x1a5ce(%rip), %rdi     # 0x256e0
movl %eax, %esi
callq 0x1106e
movq 0x28(%rsp), %rcx
movl %eax, (%rcx)
leal 0x1(%r12), %eax
movslq %eax, %rsi
leaq 0x30(%rsp), %rdi
callq 0xfa22
jmp 0xb149
cmpl $0x5, %r12d
jl 0xb150
leal 0x1(%r12), %esi
leaq 0x30(%rsp), %rdi
callq 0xfa22
movq 0x30(%rsp), %rax
jmp 0xb155
leaq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x1a57f(%rip), %r14     # 0x256e0
movq %r14, %rdi
movl %r13d, %esi
callq 0x124c6
leaq 0x12280(%rip), %rsi     # 0x1d3f3
movq %rax, %rdi
callq 0x3450
xorl %r15d, %r15d
testl %eax, %eax
je 0xb200
movq 0x28(%rsp), %rax
cmpl $0x19, (%rax)
jne 0xb27d
cmpl $0x2, %ebp
jne 0xb2d7
leaq 0x10847(%rip), %rdi     # 0x1b9e7
jmp 0xb046
movq (%rsp), %rdi
callq 0x10e44
leaq 0x1071e(%rip), %rcx     # 0x1b8d3
leaq 0x24(%rsp), %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x601e
movq %r15, %rcx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0xb053
movq 0x28(%rcx), %rax
testb $0x10, 0x2a(%rax,%r14)
jne 0xb35a
movslq 0x24(%rsp), %rcx
testq %rcx, %rcx
jle 0xb37b
imull %ecx, %r12d
movq 0x10(%rsp), %rdx
jmp 0xb0d8
movq 0x28(%r14), %rax
movq 0x10(%rsp), %rcx
orq $0x20, 0x28(%rax,%rcx)
movl $0x80, %edi
callq 0x13f2c
testl %eax, %eax
je 0xb34e
movq 0x28(%r14), %rax
movq 0x10(%rsp), %rcx
testb $0x4, 0x2a(%rax,%rcx)
jne 0xb363
testl %ebp, %ebp
je 0xb3a6
cmpl $0x2, %ebp
je 0xb39a
cmpl $0x1, %ebp
jne 0xb182
movq 0x8(%rsp), %rdi
movl $0xc8, %esi
xorl %edx, %edx
callq 0x13688
cltq
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movl $0x1, %r15d
testl %eax, %eax
jns 0xb182
jmp 0xb64a
cmpl $0x2, %ebp
jne 0xb579
leaq 0x1a453(%rip), %r15     # 0x256e0
movq %r15, %rdi
movl %ebx, %esi
callq 0x124c6
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x1385a
movq 0x28(%r15), %rcx
movq 0x10(%rsp), %rdx
movl %eax, 0x34(%rcx,%rdx)
orb $0x4, 0x28(%rcx,%rdx)
cmpl $-0x1, %eax
jne 0xb6e2
leaq 0x1082d(%rip), %rdi     # 0x1baf3
jmp 0xb046
leaq 0x10678(%rip), %rdi     # 0x1b94a
jmp 0xb046
cmpl $0x0, 0xc0(%rsp)
sete %cl
movq 0x28(%r14), %rax
movq 0x10(%rsp), %rdx
movq 0x28(%rax,%rdx), %rax
movl %eax, %edx
andl $0x40002, %edx          # imm = 0x40002
cmpl $0x2, %edx
sete %dl
testb %dl, %cl
jne 0xb36f
testb $0x20, %al
jne 0xb38e
movq (%rsp), %rdi
callq 0x10e44
movq 0x28(%r14), %rax
movq 0x10(%rsp), %rcx
movq 0x28(%rax,%rcx), %rbx
testl %ebp, %ebp
je 0xb403
testl $0x40100, %ebx          # imm = 0x40100
je 0xb474
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
leaq 0x1071c(%rip), %rdi     # 0x1ba5e
xorl %eax, %eax
callq 0x102f4
jmp 0xb053
leaq 0x10602(%rip), %rdi     # 0x1b957
jmp 0xb046
leaq 0x10594(%rip), %rdi     # 0x1b8f5
jmp 0xb382
leaq 0x10626(%rip), %rdi     # 0x1b990
jmp 0xb046
leaq 0x106a0(%rip), %rdi     # 0x1ba16
jmp 0xb046
leaq 0x105b1(%rip), %rdi     # 0x1b933
xorl %eax, %eax
callq 0x102f4
jmp 0xb053
leaq 0x1069e(%rip), %rdi     # 0x1ba33
jmp 0xb046
leaq 0x1061d(%rip), %rdi     # 0x1b9be
jmp 0xb046
movq 0x8(%rsp), %rdi
movl $0x3, %esi
movl $0x1, %edx
movl $0x5, %ecx
callq 0x1348e
movq 0x8(%rsp), %rdi
addq $0xc8, 0x8d40(%rdi)
movl $0x1, %esi
movl $0x1, %edx
movl $0xc8, %ecx
callq 0x1348e
movq 0x28(%r14), %rax
movq 0x10(%rsp), %rcx
orq $0x10, 0x28(%rax,%rcx)
movq $0x0, 0x18(%rsp)
xorl %r15d, %r15d
jmp 0xb182
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5897
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0xb053
movl %ebx, %eax
shll $0x16, %eax
andl $0x40000000, %eax       # imm = 0x40000000
shll $0xa, %ebx
andl $0x10000000, %ebx       # imm = 0x10000000
orl %eax, %ebx
orl %r13d, %ebx
movq 0x8(%rsp), %rdi
leaq 0x8d4c(%rdi), %r13
movq %r13, %rsi
movl %ebx, %edx
callq 0x7e72
movl (%r13), %edi
movl %ebx, %esi
movl $0x1, %edx
callq 0x75b3
testl %eax, %eax
jne 0xb053
movl $0x2, %r15d
jmp 0xb55b
movq (%rsp), %rdi
callq 0x10e06
leaq 0x1a25c(%rip), %rbx     # 0x256e0
movq %rbx, %rdi
movl %eax, %esi
callq 0x124c6
movb (%rax), %r13b
cmpb $0x2d, %r13b
jne 0xb4a0
movq (%rsp), %rdi
callq 0x10e44
movq 0x28(%rbx), %rax
movq 0x10(%rsp), %rdx
movswl 0x30(%rax,%rdx), %ecx
cmpl %ecx, 0x14(%rbx)
jne 0xb50b
movq (%rsp), %rdi
callq 0x10e06
leaq 0x1a21d(%rip), %rdi     # 0x256e0
movl %eax, %esi
callq 0x1106e
cmpl $0x16, %eax
jne 0xb785
movq (%rsp), %rdi
callq 0x10e44
leaq 0x1a1fd(%rip), %rdi     # 0x256e0
movl %eax, %esi
callq 0x124c6
movq %rax, %rdi
callq 0x3410
cvtsd2ss %xmm0, %xmm0
cmpb $0x2d, %r13b
jne 0xb503
xorps 0xf33d(%rip), %xmm0     # 0x1a840
movd %xmm0, %eax
cltq
jmp 0xb553
addq %rdx, %rax
cmpq $0x5, 0x38(%rax)
jl 0xb521
leaq 0x10598(%rip), %rdi     # 0x1bab4
jmp 0xb78c
movq (%rsp), %rdi
callq 0x10e44
xorl %edx, %edx
cmpb $0x2d, %r13b
sete %dl
leaq 0x10598(%rip), %rcx     # 0x1bad2
leaq 0x50(%rsp), %rsi
movl %eax, %edi
callq 0x601e
testl %eax, %eax
js 0xb64a
movslq 0x50(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movq (%rsp), %rdi
callq 0x10e06
leaq 0x1a175(%rip), %rdi     # 0x256e0
movl %eax, %esi
callq 0x1106e
movq 0x28(%rsp), %rcx
movl %eax, (%rcx)
testl %ebp, %ebp
je 0xb5c4
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movq 0x18(%rsp), %rdx
callq 0x13688
movq 0x28(%r14), %rcx
movq 0x10(%rsp), %rdx
movl %eax, 0x34(%rcx,%rdx)
testl %eax, %eax
js 0xb64a
cmpl $0x1, %r15d
jne 0xb6e2
movq 0x8(%rsp), %rdi
movl %eax, %esi
movl $0x5, %edx
callq 0x1376e
jmp 0xb6e2
movq 0x8(%rsp), %rdi
movl 0x8d40(%rdi), %eax
movq 0x28(%r14), %rcx
movq 0x10(%rsp), %rdx
movl %eax, 0x34(%rcx,%rdx)
movl $0x3, %esi
movl $0x1, %edx
movl $0x2, %ecx
callq 0x1348e
cmpl $0x2, %r15d
jne 0xb655
movq 0x28(%r14), %rax
movq 0x10(%rsp), %rcx
movzwl 0x29(%rax,%rcx), %eax
movl $0x32, %esi
testl $0x401, %eax            # imm = 0x401
jne 0xb639
testl %r12d, %r12d
je 0xb61c
movl %r12d, 0x1a094(%rip)    # 0x256b0
cmpl $0x2, %r12d
movl $0x1b, %eax
movl $0x8, %ecx
cmovel %eax, %ecx
cmpl $0x1, %r12d
movl $0x1a, %esi
cmovnel %ecx, %esi
movq 0x8(%rsp), %rdi
movl $0x3, %edx
callq 0x1346e
jmp 0xb6bc
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0xb053
cmpq $0x0, 0x18(%rsp)
je 0xb684
movl $0x3f, %esi
cmpl $0x3f, 0x19c97(%rip)    # 0x25300
movl %r12d, %edx
jge 0xb68e
movq 0x8(%rsp), %rdi
movl $0x4, %esi
movl %r12d, %edx
xorl %ecx, %ecx
callq 0x1348e
jmp 0xb698
movl $0x5, %edx
movl $0x8, %esi
movq 0x8(%rsp), %rdi
callq 0x1346e
cmpl $0x1, %r15d
jne 0xb6bc
movq 0x28(%r14), %rax
movq 0x10(%rsp), %rcx
orq $0x10, 0x28(%rax,%rcx)
movq 0x8(%rsp), %rdi
movl $0x6, %esi
callq 0x137c6
testl %r12d, %r12d
jle 0xb6e2
movl %r12d, %eax
movq 0x8(%rsp), %rdi
addq %rax, 0x8d40(%rdi)
movl $0x1, %esi
movl $0x1, %edx
movl %r12d, %ecx
callq 0x1348e
movq 0x28(%rsp), %rax
cmpl $0x2a, (%rax)
jne 0xb700
movl $0x2, %r15d
movq (%rsp), %rdi
callq 0x10e44
jmp 0xb053
movq (%rsp), %rdi
callq 0x626b
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0xb053
movq 0x28(%rsp), %rax
cmpl $0x28, (%rax)
jne 0xb732
xorl %r15d, %r15d
movq (%rsp), %rdi
callq 0x10e44
jmp 0xb053
movq (%rsp), %rdi
callq 0x10e06
leaq 0x19f9e(%rip), %rsi     # 0x256e0
leaq 0x50(%rsp), %rdi
movl %eax, %edx
callq 0x11e2c
movq 0x50(%rsp), %rsi
leaq 0x103bf(%rip), %rdi     # 0x1bb19
xorl %eax, %eax
callq 0x102f4
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb053
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3320
jmp 0xb053
leaq 0x10300(%rip), %rdi     # 0x1ba8c
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x102f4
jmp 0xb053
jmp 0xb7ca
jmp 0xb7ca
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb7cd
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3320
jmp 0xb7cd
jmp 0xb7ca
jmp 0xb7ca
jmp 0xb7ca
jmp 0xb7ca
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb7e4
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3320
movq %rbx, %rdi
callq 0x3560