// File: /workspace/github_c_makefile_star2_O0/rchiossi[P]dexterity/lib/dex_builder.c
// Function: dx_build
void dx_build(Dex* dx, char* filename) {
  ByteStream* bs;
  unsigned int i;

  if (dx == NULL) return;

  bs = bsalloc(dx->header->file_size);

  if (bs == NULL) return;

  
  dxb_header(bs,dx->header);
  dxb_maplist(bs,dx->map_list);

  for (i=0; i<dx->header->string_ids_size; i++)
    dxb_stringid(bs,dx->string_ids[i]);

  for (i=0; i<dx->header->type_ids_size; i++)
    dxb_typeid(bs,dx->type_ids[i]);

  for (i=0; i<dx->header->proto_ids_size; i++)
    dxb_protoid(bs,dx->proto_ids[i]);

  for (i=0; i<dx->header->field_ids_size; i++)
    dxb_fieldid(bs,dx->field_ids[i]);

  for (i=0; i<dx->header->method_ids_size; i++)
    dxb_methodid(bs,dx->method_ids[i]);

  for (i=0; i<dx->header->class_defs_size; i++)
    dxb_classdef(bs,dx->class_defs[i]);

  //Data
  for (i=0; i<dx->meta.string_data_list_size; i++)
    dxb_stringdata(bs,dx->string_data_list[i]);
  
  for (i=0; i<dx->meta.type_lists_size; i++)
    dxb_typelist(bs,dx->type_lists[i]);

  for (i=0; i<dx->meta.an_directories_size; i++)
    dxb_annotationdirectoryitem(bs,dx->an_directories[i]);

  for (i=0; i<dx->meta.class_data_size; i++)
    dxb_classdata(bs,dx->class_data[i]);

  for (i=0; i<dx->meta.encoded_arrays_size; i++)
    dxb_encodedarray(bs,dx->encoded_arrays[i]);

  for (i=0; i<dx->meta.code_list_size; i++)
    dxb_codeitem(bs,dx->code_list[i]);

  for (i=0; i<dx->meta.debug_info_list_size; i++)
    dxb_debuginfo(bs,dx->debug_info_list[i]);

  for (i=0; i<dx->meta.an_set_size; i++)
    dxb_annotationsetitem(bs,dx->an_set[i]);

  for (i=0; i<dx->meta.an_set_ref_lists_size; i++)
    dxb_annotationsetreflist(bs,dx->an_set_ref_lists[i]);

  for (i=0; i<dx->meta.annotations_size; i++)
    dxb_annotationitem(bs,dx->annotations[i]);

  bssave(bs,filename);

  bsfree(bs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x67ec
jmp 0x6be2
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x28(%rax), %edi
callq 0x4450
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x680b
jmp 0x6be2
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
callq 0x4070
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x49a0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x40(%rcx), %eax
jae 0x6865
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4840
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6833
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x48(%rcx), %eax
jae 0x689e
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4990
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x686c
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x50(%rcx), %eax
jae 0x68d7
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4120
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x68a5
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x58(%rcx), %eax
jae 0x6910
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x43f0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x68de
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x60(%rcx), %eax
jae 0x6949
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4340
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6917
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x68(%rcx), %eax
jae 0x6982
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4170
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6950
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0xc8(%rcx), %rax
jae 0x69bc
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4050
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6989
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0xd8(%rcx), %rax
jae 0x69f6
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4480
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x69c3
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0xe8(%rcx), %rax
jae 0x6a30
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x43e0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x69fd
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0xf8(%rcx), %rax
jae 0x6a6a
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4280
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6a37
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x108(%rcx), %rax
jae 0x6aa4
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4940
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6a71
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x118(%rcx), %rax
jae 0x6ade
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x42a0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6aab
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x128(%rcx), %rax
jae 0x6b18
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x46f0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6ae5
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x138(%rcx), %rax
jae 0x6b52
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4370
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6b1f
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x148(%rcx), %rax
jae 0x6b8f
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x4180
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6b59
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x158(%rcx), %rax
jae 0x6bcc
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x43d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6b96
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x42e0
movq -0x18(%rbp), %rdi
callq 0x4380
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)