// File: /workspace/github_c_makefile_star2_O0/yhg926[P]public_kssd/command_set.c
// Function: organize_taxf
compan_t *organize_taxf(char* taxfile){
 FILE *tf = fopen(taxfile,"r");
 if(tf == NULL) err(errno,"%s",taxfile);
 int ln = 0;
 for (char c = getc(tf); c != EOF; c = getc(tf))
  if (c == '\n') ln++;
 rewind(tf);
#define D_TAXID (-1)
 int hashsz = nextPrime( (int)((double) ln / LD_FCTR) );
 subset_t *tmphs = malloc(hashsz * sizeof(subset_t));
 for(int i = 0 ; i < hashsz ; i++) {
  tmphs[i].taxid = D_TAXID;
  tmphs[i].taxname = NULL;
 }
 char tmpstr[PATHLEN+1];
 const char s[2] = "\t";
 int tax_count = 0 ;
 for(int i= 0; i< ln ; i++) {
  fgets(tmpstr,PATHLEN,tf);
  if( tmpstr[strlen(tmpstr)-1] != '\n')
   err(errno,"organize_taxf(): %dth line %s is not full read, exceed PATHLEN %d ",i,tmpstr,PATHLEN);
  else tmpstr[strlen(tmpstr)-1] = '\0' ;
  int taxid = atoi(strtok(tmpstr,s)) ;
  char *taxname = strtok(NULL,s);
  for(int n = 0; n<hashsz ;n++){
   int hv = HASH(taxid,n,hashsz);
   if(tmphs[hv].taxid == D_TAXID) {
    tmphs[hv].taxid = taxid;
    tax_count++;
    if(taxname != NULL){
     tmphs[hv].taxname = malloc(strlen(taxname)+1);
     strcpy(tmphs[hv].taxname,taxname);
    }
    tmphs[hv].gids = malloc(2*sizeof(int));
    tmphs[hv].gids[0] = 1;
    tmphs[hv].gids[1] = i;
    break;
   }
   else if(tmphs[hv].taxid == taxid){
    if( (tmphs[hv].taxname == NULL && taxname != NULL )
     ||(tmphs[hv].taxname != NULL && taxname == NULL)
     || (taxname != NULL && strcmp(tmphs[hv].taxname,taxname) != 0)
     ) err(errno,"organize_taxf() abort!: taxid %d has different taxnames in %dth and %dth lines",taxid,tmphs[hv].gids[1],i);
     tmphs[hv].gids[0]++;
     tmphs[hv].gids = realloc(tmphs[hv].gids,(tmphs[hv].gids[0]+1) * sizeof(int));
     tmphs[hv].gids[tmphs[hv].gids[0]] = i;
     break;
   }
  }
 }
 fclose(tf);
 compan_t * subset = malloc(sizeof(compan_t));
 subset->taxn = tax_count;
 subset->gn = ln;
 subset->tax = malloc(tax_count * sizeof(subset_t)) ;
 int it = 0;
 for(int n = 0; n <hashsz; n++){
  if(tmphs[n].taxid != D_TAXID){
   subset->tax[it] = tmphs[n];
   it++;
  }
 }
 free(tmphs);
 return subset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x91fe(%rip), %rsi      # 0x1dcd8
callq 0x3370
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x14b03
callq 0x3050
movl (%rax), %edi
movq -0x8(%rbp), %rdx
leaq 0x884a(%rip), %rsi      # 0x1d346
movb $0x0, %al
callq 0x3300
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3480
movb %al, -0x15(%rbp)
movsbl -0x15(%rbp), %eax
cmpl $-0x1, %eax
je 0x14b41
movsbl -0x15(%rbp), %eax
cmpl $0xa, %eax
jne 0x14b31
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x14b33
movq -0x10(%rbp), %rdi
callq 0x3480
movb %al, -0x15(%rbp)
jmp 0x14b16
movq -0x10(%rbp), %rdi
callq 0x3170
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0x7681(%rip), %xmm1     # 0x1c1d8
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %edi
callq 0x17c70
movl %eax, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
imulq $0x18, %rax, %rdi
callq 0x3310
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x14bbe
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x14b7f
movw 0x7773(%rip), %ax       # 0x1c338
movw %ax, -0x132(%rbp)
movl $0x0, -0x138(%rbp)
movl $0x0, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x14fa0
leaq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x3260
leaq -0x130(%rbp), %rdi
callq 0x3110
subq $0x1, %rax
movsbl -0x130(%rbp,%rax), %eax
cmpl $0xa, %eax
je 0x14c49
callq 0x3050
movl (%rax), %edi
movl -0x13c(%rbp), %edx
leaq -0x130(%rbp), %rcx
leaq 0x938e(%rip), %rsi      # 0x1dfca
movl $0x100, %r8d            # imm = 0x100
movb $0x0, %al
callq 0x3300
leaq -0x130(%rbp), %rdi
callq 0x3110
subq $0x1, %rax
movb $0x0, -0x130(%rbp,%rax)
leaq -0x130(%rbp), %rdi
leaq -0x132(%rbp), %rsi
callq 0x3390
movq %rax, %rdi
callq 0x33e0
movl %eax, -0x140(%rbp)
leaq -0x132(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x3390
movq %rax, -0x148(%rbp)
movl $0x0, -0x14c(%rbp)
movl -0x14c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x14f8a
movl -0x140(%rbp), %eax
cltd
idivl -0x1c(%rbp)
movl %edx, -0x164(%rbp)
movl -0x14c(%rbp), %ecx
movl -0x140(%rbp), %eax
movl -0x1c(%rbp), %esi
subl $0x1, %esi
cltd
idivl %esi
movl -0x164(%rbp), %eax
addl $0x1, %edx
imull %edx, %ecx
addl %ecx, %eax
cltd
idivl -0x1c(%rbp)
movl %edx, -0x150(%rbp)
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
jne 0x14df3
movl -0x140(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x138(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
cmpq $0x0, -0x148(%rbp)
je 0x14d90
movq -0x148(%rbp), %rdi
callq 0x3110
movq %rax, %rdi
addq $0x1, %rdi
callq 0x3310
movq %rax, %rcx
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq -0x148(%rbp), %rsi
callq 0x3070
movl $0x8, %edi
callq 0x3310
movq %rax, %rcx
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl $0x1, (%rax)
movl -0x13c(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq 0x10(%rax), %rax
movl %ecx, 0x4(%rax)
jmp 0x14f8a
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x140(%rbp), %eax
jne 0x14f72
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
jne 0x14e36
cmpq $0x0, -0x148(%rbp)
jne 0x14e8a
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x14e59
cmpq $0x0, -0x148(%rbp)
je 0x14e8a
cmpq $0x0, -0x148(%rbp)
je 0x14ec5
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq -0x148(%rbp), %rsi
callq 0x3280
cmpl $0x0, %eax
je 0x14ec5
callq 0x3050
movl (%rax), %edi
movl -0x140(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %ecx
movl -0x13c(%rbp), %r8d
leaq 0x914f(%rip), %rsi      # 0x1e00d
movb $0x0, %al
callq 0x3300
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
shlq $0x2, %rsi
callq 0x3320
movq %rax, %rcx
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x13c(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x150(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
movslq -0x150(%rbp), %rsi
imulq $0x18, %rsi, %rsi
addq %rsi, %rcx
movq 0x10(%rcx), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x14f8a
jmp 0x14f74
jmp 0x14f76
movl -0x14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14c(%rbp)
jmp 0x14ca3
jmp 0x14f8c
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x14be0
movq -0x10(%rbp), %rdi
callq 0x30e0
movl $0x10, %edi
callq 0x3310
movq %rax, -0x158(%rbp)
movl -0x138(%rbp), %ecx
movq -0x158(%rbp), %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %ecx
movq -0x158(%rbp), %rax
movl %ecx, 0x4(%rax)
movslq -0x138(%rbp), %rax
imulq $0x18, %rax, %rdi
callq 0x3310
movq %rax, %rcx
movq -0x158(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x15c(%rbp)
movl $0x0, -0x160(%rbp)
movl -0x160(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x15090
movq -0x28(%rbp), %rax
movslq -0x160(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x1507a
movq -0x158(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x15c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0x28(%rbp), %rcx
movslq -0x160(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movl -0x15c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x15c(%rbp)
jmp 0x1507c
movl -0x160(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x160(%rbp)
jmp 0x15008
movq -0x28(%rbp), %rdi
callq 0x3040
movq -0x158(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopl (%rax)