// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/dex_parser.c
// Function: dx_annotationdirectoryitem
DexAnnotationDirectoryItem* dx_annotationdirectoryitem(ByteStream* bs, uint32_t offset) {
  DexAnnotationDirectoryItem* res;
  int check;
  unsigned int i;

  if (bs == NULL) return NULL;

  DX_ALLOC(DexAnnotationDirectoryItem,res);

  bsseek(bs,offset);

  check  = bsread(bs,(uint8_t*) &(res->class_annotations_off),sizeof(uint32_t));
  check += bsread(bs,(uint8_t*) &(res->fields_size),sizeof(uint32_t));
  check += bsread(bs,(uint8_t*) &(res->annotated_methods_size),sizeof(uint32_t));
  check += bsread(bs,(uint8_t*) &(res->annotated_parameters_size),sizeof(uint32_t));

  res->meta.corrupted = (check != sizeof(uint32_t)*4 || bs->exhausted);
  if (res->meta.corrupted) return res;

  DX_ALLOC_LIST(DexFieldAnnotation*,res->field_annotations,
		res->fields_size);
  DX_ALLOC_LIST(DexMethodAnnotation*,res->method_annotations,
		res->annotated_methods_size);
  DX_ALLOC_LIST(DexParameterAnnotation*,res->parameter_annotations,
		res->annotated_parameters_size);

  for (i=0; i<res->fields_size; i++)
    res->field_annotations[i] = dx_fieldannotation(bs,bs->offset);

  for (i=0; i<res->annotated_methods_size; i++)
    res->method_annotations[i] = dx_methodannotation(bs,bs->offset);
  
  for (i=0; i<res->annotated_parameters_size; i++)
    res->parameter_annotations[i] = dx_parameterannotation(bs,bs->offset);

  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7010
movl %esi, %ebp
movq %rdi, %r14
pushq $0x30
popq %rdi
callq 0x46a0
movq %rax, %rbx
movl %ebp, 0x4(%rax)
movb $0x0, (%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x4480
leaq 0x8(%rbx), %rsi
pushq $0x4
popq %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x4490
movl %eax, %r15d
leaq 0xc(%rbx), %r13
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x4490
movl %eax, %ebp
addl %r15d, %ebp
leaq 0x10(%rbx), %rsi
movq %r14, %rdi
movq %rsi, (%rsp)
movq %r12, %rdx
callq 0x4490
movl %eax, %r12d
movq %rbx, %r15
addq $0x14, %r15
movq %r14, %rdi
movq %r15, %rsi
pushq $0x4
popq %rdx
callq 0x4490
addl %r12d, %eax
addl %ebp, %eax
cmpl $0x10, %eax
jne 0x7014
cmpl $0x0, 0x1c(%r14)
setne (%rbx)
jne 0x7017
movl (%r13), %edi
testq %rdi, %rdi
je 0x7029
shlq $0x3, %rdi
callq 0x46a0
jmp 0x702b
xorl %ebx, %ebx
jmp 0x7017
movb $0x1, (%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
movq %rax, 0x18(%rbx)
movl 0x10(%rbx), %edi
testq %rdi, %rdi
je 0x7042
shlq $0x3, %rdi
callq 0x46a0
jmp 0x7044
xorl %eax, %eax
movq %rax, 0x20(%rbx)
movl 0x14(%rbx), %edi
testq %rdi, %rdi
je 0x705b
shlq $0x3, %rdi
callq 0x46a0
jmp 0x705d
xorl %eax, %eax
movq %rax, 0x28(%rbx)
xorl %r12d, %r12d
movl (%r13), %eax
cmpq %rax, %r12
jae 0x7086
movl 0x18(%r14), %esi
movq %r14, %rdi
callq 0x44e0
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
jmp 0x7064
xorl %r12d, %r12d
movq (%rsp), %r13
movl (%r13), %eax
cmpq %rax, %r12
jae 0x70af
movl 0x18(%r14), %esi
movq %r14, %rdi
callq 0x42e0
movq 0x20(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
jmp 0x708d
xorl %r12d, %r12d
movl (%r15), %eax
cmpq %rax, %r12
jae 0x7017
movl 0x18(%r14), %esi
movq %r14, %rdi
callq 0x45a0
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
jmp 0x70b2