// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x8ce3
movq $0x0, -0x8(%rbp)
jmp 0x8f2f
jmp 0x8ce5
movl $0x30, %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
movl $0x4, %edx
callq 0x4500
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0xc, %rsi
movl $0x4, %edx
callq 0x4500
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x10, %rsi
movl $0x4, %edx
callq 0x4500
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x14, %rsi
movl $0x4, %edx
callq 0x4500
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movslq -0x24(%rbp), %rcx
movb $0x1, %al
cmpq $0x10, %rcx
movb %al, -0x29(%rbp)
jne 0x8d9a
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
setne %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %cl
movq -0x20(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
je 0x8dbc
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8f2f
jmp 0x8dbe
movq -0x20(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x8de7
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x4750
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x8df3
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
jmp 0x8df5
jmp 0x8df7
movq -0x20(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x8e20
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x4750
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x8e2c
movq -0x20(%rbp), %rax
movq $0x0, 0x20(%rax)
jmp 0x8e2e
jmp 0x8e30
movq -0x20(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x8e59
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x4750
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x8e65
movq -0x20(%rbp), %rax
movq $0x0, 0x28(%rax)
jmp 0x8e67
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0x8ea7
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x4550
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x28(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x8e6e
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x8ee7
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x4330
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x28(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x8eae
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jae 0x8f27
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x4620
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x28(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x8eee
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)