// File: /workspace/github_cpp_makefile_star2_O1/maplechori[P]stata-reader-writer/State.cpp
// Function: OpenInnerValueLabel::process(Context&)
bool OpenInnerValueLabel::process(Context &ctx)
{
  char *ctxbuf = (char *)ctx.advance();
  char *txtorig = NULL;
  int curr = 0, sz = 0, totalSize = 0, entries = 0, txtlen = 0, *offsets = NULL;
  StataValueLabel *svl = new StataValueLabel();

  if (ctx.hdr.fileByteorder == LSF)
  {

    switch (ctx.hdr.fileRelease)
    {

    case R119:
    case R118:

      totalSize = GetLSF<uint32_t>(ctxbuf, 4);
      ctxbuf += 4;
      sz = strlen((char *)ctxbuf);
      svl->labname.assign(&ctxbuf[0], sz);
      ctxbuf += 132;
      entries = GetLSF<uint32_t>(ctxbuf, 4);
      ctxbuf += 4;
      txtlen = GetLSF<uint32_t>(ctxbuf, 4);
      ctxbuf += 4;

      offsets = new int[entries];

      for (int i = 0; i < entries; ctxbuf += 4, i++)
        offsets[i] = GetLSF<int32_t>(ctxbuf, 4);

      txtorig = ctxbuf + (entries * 4);

      for (int i = 0; i < entries; i++, ctxbuf += 4)
        svl->valuelabel[GetLSF<uint32_t>(ctxbuf, 4)].assign((char *)(&txtorig[offsets[i]]), strlen(&txtorig[offsets[i]]));

      ctxbuf += txtlen;
      break;

    case R117:
      totalSize = GetLSF<uint32_t>(ctxbuf, 4);
      ctxbuf += 4;
      sz = strlen((char *)ctxbuf);
      svl->labname.assign(&ctxbuf[0], sz);
      ctxbuf += 36;
      entries = GetLSF<uint32_t>(ctxbuf, 4);
      ctxbuf += 4;
      txtlen = GetLSF<uint32_t>(ctxbuf, 4);
      ctxbuf += 4;

      offsets = new int[entries];

      for (int i = 0; i < entries; ctxbuf += 4, i++)
        offsets[i] = GetLSF<int32_t>(ctxbuf, 4);

      txtorig = ctxbuf + (entries * 4);

      for (int i = 0; i < entries; i++, ctxbuf += 4)
        svl->valuelabel[GetLSF<uint32_t>(ctxbuf, 4)].assign((char *)(&txtorig[offsets[i]]), strlen(&txtorig[offsets[i]]));

      ctxbuf += txtlen;
      break;

    case R115:
    case R114:
    case R113:
    case R112:
      break;
    }
  }
  else
  {
  }

  if (ctxbuf[0] == '<' && ctxbuf[1] == '/' && ctxbuf[2] == 'l' && ctxbuf[6] == '<' && ctxbuf[8] != 'v')
  {
    setHasMoreLabels(true);
    ctx.advance();
    ctx.advance();
  }
  else
  {
    setHasMoreLabels(false);
    ctx.advance();
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0xb87a
movq %rax, %r15
movl $0x50, %edi
callq 0x7330
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0xb3e8
cmpl $0x0, 0x64(%rbx)
jne 0xd418
cmpl $0x2, 0x60(%rbx)
jae 0xd2ba
movq %r14, -0x38(%rbp)
movq %rbx, -0x40(%rbp)
leaq 0x4(%r15), %r13
movq %r13, %rdi
callq 0x7160
movslq %eax, %r8
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rdx
xorl %r14d, %r14d
xorl %esi, %esi
movq %r13, %rcx
callq 0x74e0
leaq 0x88(%r15), %rax
xorl %ebx, %ebx
movzbl (%rax), %edx
movl %r14d, %ecx
shll %cl, %edx
orl %edx, %ebx
addq $0x8, %r14
incq %rax
cmpq $0x20, %r14
jne 0xd197
leaq 0x8c(%r15), %rax
xorl %ecx, %ecx
xorl %r14d, %r14d
movzbl (%rax), %edx
shll %cl, %edx
orl %edx, %r14d
addq $0x8, %rcx
incq %rax
cmpq $0x20, %rcx
jne 0xd1ba
addq $0x90, %r15
movslq %ebx, %r12
leaq (,%r12,4), %rax
testl %r12d, %r12d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x7030
movl %ebx, %r9d
testl %r12d, %r12d
jle 0xd22a
xorl %r8d, %r8d
movq %r15, %rdx
xorl %ecx, %ecx
xorl %esi, %esi
movzbl (%rdx), %edi
shll %cl, %edi
orl %edi, %esi
addq $0x8, %rcx
incq %rdx
cmpq $0x20, %rcx
jne 0xd206
movl %esi, (%rax,%r8,4)
addq $0x4, %r15
incq %r8
cmpq %r9, %r8
jne 0xd1ff
testl %ebx, %ebx
jle 0xd40a
movq %rax, -0x58(%rbp)
shll $0x2, %ebx
movslq %ebx, %rax
addq %r15, %rax
movq %rax, -0x48(%rbp)
addq $0x20, -0x30(%rbp)
xorl %r13d, %r13d
movq %r9, -0x50(%rbp)
movq %r15, %rax
xorl %ecx, %ecx
xorl %edx, %edx
movzbl (%rax), %esi
shll %cl, %esi
orl %esi, %edx
addq $0x8, %rcx
incq %rax
cmpq $0x20, %rcx
jne 0xd256
movl %edx, -0x60(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xd846
movq %rax, %rbx
movq -0x58(%rbp), %rax
movslq (%rax,%r13,4), %r12
addq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x7160
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rcx
movq %rax, %r8
callq 0x74e0
incq %r13
addq $0x4, %r15
movq -0x50(%rbp), %r9
cmpq %r9, %r13
jne 0xd24f
jmp 0xd40a
jne 0xd418
movq %r14, -0x38(%rbp)
movq %rbx, -0x40(%rbp)
leaq 0x4(%r15), %rbx
movq %rbx, %rdi
callq 0x7160
movslq %eax, %r8
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rdx
xorl %r14d, %r14d
xorl %esi, %esi
movq %rbx, %rcx
callq 0x74e0
leaq 0x28(%r15), %rax
xorl %ebx, %ebx
movzbl (%rax), %edx
movl %r14d, %ecx
shll %cl, %edx
orl %edx, %ebx
addq $0x8, %r14
incq %rax
cmpq $0x20, %r14
jne 0xd2f2
leaq 0x2c(%r15), %rax
xorl %ecx, %ecx
xorl %r14d, %r14d
movzbl (%rax), %edx
shll %cl, %edx
orl %edx, %r14d
addq $0x8, %rcx
incq %rax
cmpq $0x20, %rcx
jne 0xd312
addq $0x30, %r15
movslq %ebx, %r12
leaq (,%r12,4), %rax
testl %r12d, %r12d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x7030
movl %ebx, %r9d
testl %r12d, %r12d
jle 0xd37f
xorl %r8d, %r8d
movq %r15, %rdx
xorl %ecx, %ecx
xorl %esi, %esi
movzbl (%rdx), %edi
shll %cl, %edi
orl %edi, %esi
addq $0x8, %rcx
incq %rdx
cmpq $0x20, %rcx
jne 0xd35b
movl %esi, (%rax,%r8,4)
addq $0x4, %r15
incq %r8
cmpq %r9, %r8
jne 0xd354
testl %ebx, %ebx
jle 0xd40a
movq %rax, -0x58(%rbp)
shll $0x2, %ebx
movslq %ebx, %rax
addq %r15, %rax
movq %rax, -0x48(%rbp)
addq $0x20, -0x30(%rbp)
xorl %r13d, %r13d
movq %r9, -0x50(%rbp)
movq %r15, %rax
xorl %ecx, %ecx
xorl %edx, %edx
movzbl (%rax), %esi
shll %cl, %esi
orl %esi, %edx
addq $0x8, %rcx
incq %rax
cmpq $0x20, %rcx
jne 0xd3ab
movl %edx, -0x5c(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
callq 0xd846
movq %rax, %rbx
movq -0x58(%rbp), %rax
movslq (%rax,%r13,4), %r12
addq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x7160
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rcx
movq %rax, %r8
callq 0x74e0
incq %r13
addq $0x4, %r15
movq -0x50(%rbp), %r9
cmpq %r9, %r13
jne 0xd3a4
movslq %r14d, %rax
addq %rax, %r15
movq -0x40(%rbp), %rbx
movq -0x38(%rbp), %r14
cmpb $0x3c, (%r15)
jne 0xd43a
cmpb $0x2f, 0x1(%r15)
jne 0xd43a
cmpb $0x6c, 0x2(%r15)
jne 0xd43a
cmpb $0x3c, 0x6(%r15)
jne 0xd43a
cmpb $0x76, 0x8(%r15)
jne 0xd458
movb $0x0, 0x8(%r14)
movq %rbx, %rdi
callq 0xb87a
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x8(%r14)
movq %rbx, %rdi
callq 0xb87a
jmp 0xd43f
movq %rax, %rbx
movl $0x50, %esi
movq -0x30(%rbp), %rdi
callq 0x7340
movq %rbx, %rdi
callq 0x75b0