// File: /workspace/github_c_makefile_star2_O2/yhg926[P]public_kssd/iseq2comem.c
// Function: write_fqkoc2files
unsigned int write_fqkoc2files(char* cofilename, llong *co)
{
  int comp_code_bits = half_ctx_len - drlevel > COMPONENT_SZ ? 4*(half_ctx_len - drlevel - COMPONENT_SZ ) : 0 ;
  FILE **outf,**abdf;
  outf = malloc(component_num * sizeof(FILE *));
 abdf = malloc(component_num * sizeof(FILE *));
  char cofilename_with_component[PATHLEN];
  for(int i=0;i<component_num ;i++)
  {
    sprintf(cofilename_with_component,"%s.%d",cofilename,i);
    if ( (outf[i] = fopen(cofilename_with_component,"wb") ) == NULL )
      err(errno,"write_fqkoc2files()") ;
  sprintf(cofilename_with_component,"%s.%d.a",cofilename,i);
  if ( (abdf[i] = fopen(cofilename_with_component,"wb") ) == NULL )
      err(errno,"write_fqkoc2files()") ;
  };
  unsigned int count, wr = 0, newid,compi;
 unsigned short abdc;
  for(count=0;count < hashsize; count++)
  {
    if( co[count] > 0 ) {
   compi = (co[count] >> OCCRC_BIT ) % component_num;
      newid = (unsigned int)(co[count] >> (comp_code_bits + OCCRC_BIT));
      fwrite( &newid, sizeof(newid),1,outf[compi] );
   abdc = co[count] & OCCRC_MAX;
   fwrite( &abdc, sizeof(abdc),1,abdf[compi] );
      wr++;
    }
  }
  for(int i=0;i<component_num ;i++){
    fclose(outf[i]);
  fclose(abdf[i]);
 }
  free(outf);
 free(abdf);
  return wr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, 0x8(%rsp)
movl 0x4ae58(%rip), %eax     # 0x5d618
subl 0x4ae5e(%rip), %eax     # 0x5d624
movq %rdi, %r13
cmpl $0x8, %eax
leal -0xc(,%rax,4), %eax
pushq $0x10
popq %rcx
cmovgel %eax, %ecx
movq %rcx, 0x18(%rsp)
movslq 0x4ae4b(%rip), %r14     # 0x5d630
shlq $0x3, %r14
movq %r14, %rdi
callq 0x3340
movq %rax, %rbx
movq %r14, %rdi
callq 0x3340
movq %rax, %r14
leaq 0x20(%rsp), %r12
leaq 0x185f(%rip), %rbp      # 0x1406a
xorl %r15d, %r15d
movslq 0x4ae1b(%rip), %rax     # 0x5d630
cmpq %rax, %r15
jge 0x12888
movq %r12, %rdi
leaq 0x183d(%rip), %rsi      # 0x14061
movq %r13, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3430
movq %r12, %rdi
movq %rbp, %rsi
callq 0x33a0
movq %rax, (%rbx,%r15,8)
testq %rax, %rax
je 0x12873
movq %r12, %rdi
leaq 0x1c78(%rip), %rsi      # 0x144c7
movq %r13, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3430
movq %r12, %rdi
movq %rbp, %rsi
callq 0x33a0
movq %rax, (%r14,%r15,8)
incq %r15
testq %rax, %rax
jne 0x1280e
callq 0x3060
movl (%rax), %edi
leaq 0x4a00(%rip), %rsi      # 0x17281
xorl %eax, %eax
callq 0x3330
xorl %r15d, %r15d
movl 0x4ad97(%rip), %eax     # 0x5d628
pushq $0x1
popq %r13
xorl %ebp, %ebp
movq 0x8(%rsp), %rdx
movl %eax, %ecx
cmpq %rcx, %r15
jae 0x12917
movq (%rdx,%r15,8), %rsi
testq %rsi, %rsi
je 0x12912
movq %rsi, %rax
shrq $0x10, %rax
movslq 0x4ad76(%rip), %rcx     # 0x5d630
xorl %edx, %edx
divq %rcx
movq 0x18(%rsp), %rcx
shrq %cl, %rsi
movl %esi, 0x14(%rsp)
movl %edx, %r12d
movq (%rbx,%r12,8), %rcx
leaq 0x14(%rsp), %rdi
pushq $0x4
popq %rsi
movq %r13, %rdx
callq 0x3450
movq 0x8(%rsp), %rax
movzwl (%rax,%r15,8), %eax
movw %ax, 0x6(%rsp)
movq (%r14,%r12,8), %rcx
leaq 0x6(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r13, %rdx
callq 0x3450
movq 0x8(%rsp), %rdx
incl %ebp
movl 0x4ad16(%rip), %eax     # 0x5d628
incq %r15
jmp 0x1289c
xorl %r15d, %r15d
movslq 0x4ad0f(%rip), %rax     # 0x5d630
cmpq %rax, %r15
jge 0x1293d
movq (%rbx,%r15,8), %rdi
callq 0x3100
movq (%r14,%r15,8), %rdi
callq 0x3100
incq %r15
jmp 0x1291a
movq %rbx, %rdi
callq 0x3040
movq %r14, %rdi
callq 0x3040
movl %ebp, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq