// File: /workspace/github_c_makefile_star2_O0/rchiossi[P]dexterity/lib/dex_parser.c
// Function: dx_stringdata
DexStringDataItem* dx_stringdata(ByteStream* bs, uint32_t offset) {
  DexStringDataItem* res;
  int check;
  uint8_t* tape;

  if (bs == NULL) return NULL;

  DX_ALLOC(DexStringDataItem,res);

  bsseek(bs,offset);

  check = l128read(bs,&(res->size));

  if (check || bs->exhausted) {
    res->meta.corrupted = true;
    return res;
  }

  DX_ALLOC_LIST(uint8_t,res->data,ul128toui(res->size)*3+1);

  tape = (uint8_t*) res->data;

  bsread(bs,tape,sizeof(uint8_t));
  
  while(*tape) {
    if ((*tape & 0xe0) == 0xc0 ) {
      tape++;
      bsread(bs,tape,sizeof(uint8_t));
    }

    else if ((*tape & 0xf0) == 0xe0) {
      tape++;
      bsread(bs,tape,sizeof(uint8_t)*2);      
      tape++;
    }
        
    tape++;
    bsread(bs,tape,sizeof(uint8_t));
  }
  
  res->meta.corrupted |= bs->exhausted;

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x7013
movq $0x0, -0x8(%rbp)
jmp 0x71d7
jmp 0x7015
movl $0x20, %edi
callq 0x4750
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x44f0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x8, %rsi
callq 0x4910
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x7064
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x7078
movq -0x20(%rbp), %rax
movb $0x1, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x71d7
jmp 0x707a
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x40(%rbp)
movl 0x10(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x40(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x41c0
imull $0x3, %eax, %eax
addl $0x1, %eax
cmpl $0x0, %eax
je 0x70e1
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x50(%rbp)
movl 0x10(%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x50(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x41c0
imull $0x3, %eax, %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
shlq $0x0, %rdi
callq 0x4750
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x70ed
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
jmp 0x70ef
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x1, %edx
callq 0x4500
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x71af
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
andl $0xe0, %eax
cmpl $0xc0, %eax
jne 0x714d
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x1, %edx
callq 0x4500
jmp 0x718c
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
andl $0xf0, %eax
cmpl $0xe0, %eax
jne 0x718a
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x2, %edx
callq 0x4500
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x718c
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x1, %edx
callq 0x4500
jmp 0x710d
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %edx
movq -0x20(%rbp), %rax
movb (%rax), %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %edx, %ecx
cmpl $0x0, %ecx
setne %cl
andb $0x1, %cl
movb %cl, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)