// File: /workspace/github_c_makefile_star2_O1/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 0x722e
movl %esi, %ebp
movq %rdi, %r14
movl $0x30, %edi
callq 0x4600
movq %rax, %rbx
movl %ebp, 0x4(%rax)
movb $0x0, (%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x4410
leaq 0x8(%rbx), %rsi
movl $0x4, %edx
movq %r14, %rdi
callq 0x4420
movl %eax, %ebp
leaq 0xc(%rbx), %r13
movl $0x4, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x4420
movl %eax, %r12d
addl %ebp, %r12d
leaq 0x10(%rbx), %rsi
movl $0x4, %edx
movq %r14, %rdi
movq %rsi, (%rsp)
callq 0x4420
movl %eax, %ebp
movq %rbx, %r15
addq $0x14, %r15
movl $0x4, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4420
addl %ebp, %eax
addl %r12d, %eax
cmpl $0x10, %eax
jne 0x7232
cmpl $0x0, 0x1c(%r14)
setne (%rbx)
jne 0x7235
movl (%r13), %edi
testq %rdi, %rdi
je 0x7247
shlq $0x3, %rdi
callq 0x4600
jmp 0x7249
xorl %ebx, %ebx
jmp 0x7235
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 0x7260
shlq $0x3, %rdi
callq 0x4600
jmp 0x7262
xorl %eax, %eax
movq %rax, 0x20(%rbx)
movl 0x14(%rbx), %edi
testq %rdi, %rdi
je 0x7279
shlq $0x3, %rdi
callq 0x4600
jmp 0x727b
xorl %eax, %eax
movq %rax, 0x28(%rbx)
cmpl $0x0, 0xc(%rbx)
je 0x72a7
xorl %r12d, %r12d
movl 0x18(%r14), %esi
movq %r14, %rdi
callq 0x4460
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
movl 0xc(%rbx), %eax
cmpq %rax, %r12
jb 0x7288
movq (%rsp), %rax
cmpl $0x0, (%rax)
je 0x72d2
xorl %r12d, %r12d
movl 0x18(%r14), %esi
movq %r14, %rdi
callq 0x4290
movq 0x20(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
movl 0x10(%rbx), %eax
cmpq %rax, %r12
jb 0x72b3
cmpl $0x0, (%r15)
je 0x7235
xorl %r15d, %r15d
movl 0x18(%r14), %esi
movq %r14, %rdi
callq 0x4520
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
movl 0x14(%rbx), %eax
cmpq %rax, %r15
jb 0x72df
jmp 0x7235