// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]egap/mergehm.c
// Function: holtMcMillan
void holtMcMillan(g_data *g, bool lastRound) {
  // init local global vars
  check_g_data(g);
  assert(g->numBwt <= MAX_NUMBER_OF_BWTS); 
  int stop = 0; 
  
  // clear array B if necessary
  if(g->bwtOnly) assert(g->blockBeginsAt==NULL);
  else alloc0_B_array(g); // alloc and clear blockBeginsAt array

  // allocate Z (merge) Znew 
  alloc_merge_arrays(g);
  // allocate firstColumn and inCnt
  g->inCnt = malloc(g->numBwt*sizeof(customInt)); 
  g->firstColumn = malloc(g->sizeOfAlpha*sizeof(customInt));
  if(!g->firstColumn || !g->inCnt) die(__func__);
  // init the above arrays
  if(g->smallAlpha) init_arrays(g);
  else init_arrays_largealpha(g);

  customInt prefixLength = 1;  
  do { // main loop. Add something to do nothing if there is a single BWT as in Gap? 
    prefixLength+= 1;
    if(prefixLength>MAX_LCP_SIZE && !g->bwtOnly) {fprintf(stderr,"LCP too large\n");die(__func__);}
    stop += addCharToPrefix_HM(prefixLength, g);
    if(g->verbose>2 || (g->verbose>1 && lastRound)) { 
      printf("Lcp: "CUSTOM_FORMAT" Stop=%d   ",prefixLength-1,stop);
      #if MALLOC_COUNT_FLAG
        printf("Mem: %zu peak, %zu current, %.2lf/%.2lf bytes/symb\n", malloc_count_peak(),
             malloc_count_current(), (double)malloc_count_peak()/g->mergeLen,
             (double)malloc_count_current()/g->mergeLen);
      #endif
    }
  } while(stop<2);
  
  // computation complete, do the merging. The following call writes the
  // (possibly remapped) merged BWT back to g->bws[0]; and if lcpMerge==true the merged LCP to g->lcps[0]  
  mergeBWTandLCP(g,lastRound);

  free(g->firstColumn); // last four arrays deallocated
  free(g->inCnt);
  free_merge_arrays(g);
  if(!g->bwtOnly) free_B_array(g);
}

// Assembly:
subq $0x58, %rsp
movb %sil, %al
movq %rdi, 0x50(%rsp)
andb $0x1, %al
movb %al, 0x4f(%rsp)
movq 0x50(%rsp), %rdi
callq 0x3dd0
movl $0x0, 0x48(%rsp)
movq 0x50(%rsp), %rax
testb $0x1, 0x3c(%rax)
je 0x11a61
jmp 0x11a6b
movq 0x50(%rsp), %rdi
callq 0x69b0
movq 0x50(%rsp), %rdi
callq 0x6440
movq 0x50(%rsp), %rax
movslq 0x20(%rax), %rdi
shlq $0x3, %rdi
callq 0x127b0
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x5118(%rax)
movq 0x50(%rsp), %rax
movslq 0x38(%rax), %rdi
shlq $0x3, %rdi
callq 0x127b0
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x5108(%rax)
movq 0x50(%rsp), %rax
cmpq $0x0, 0x5108(%rax)
je 0x11ad5
movq 0x50(%rsp), %rax
cmpq $0x0, 0x5118(%rax)
jne 0x11ae1
leaq 0x4807(%rip), %rdi      # 0x162e3
callq 0x3ce0
movq 0x50(%rsp), %rax
testb $0x1, 0x68(%rax)
je 0x11af8
movq 0x50(%rsp), %rdi
callq 0x11cf0
jmp 0x11b02
movq 0x50(%rsp), %rdi
callq 0x11e40
movq $0x1, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
cmpq $0xff, 0x40(%rsp)
jbe 0x11b53
movq 0x50(%rsp), %rax
testb $0x1, 0x3c(%rax)
jne 0x11b53
movq 0x74c2(%rip), %rax      # 0x18ff8
movq (%rax), %rdi
leaq 0x4032(%rip), %rsi      # 0x15b72
movb $0x0, %al
callq 0x21b0
leaq 0x4795(%rip), %rdi      # 0x162e3
callq 0x3ce0
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x11f90
addl 0x48(%rsp), %eax
movl %eax, 0x48(%rsp)
movq 0x50(%rsp), %rax
cmpl $0x2, 0x94(%rax)
jg 0x11b95
movq 0x50(%rsp), %rax
cmpl $0x1, 0x94(%rax)
jle 0x11c84
testb $0x1, 0x4f(%rsp)
je 0x11c84
movq 0x40(%rsp), %rsi
decq %rsi
movl 0x48(%rsp), %edx
leaq 0x4748(%rip), %rdi      # 0x162f0
xorl %eax, %eax
callq 0x20f0
callq 0x12730
movq %rax, 0x28(%rsp)
callq 0x12720
movq %rax, 0x30(%rsp)
callq 0x12730
movq %rax, %xmm0
movaps 0x243c(%rip), %xmm3     # 0x14010
movaps %xmm3, (%rsp)
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x243c(%rip), %xmm2     # 0x14020
movaps %xmm2, 0x10(%rsp)
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x50(%rsp), %rax
movq 0x28(%rax), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
callq 0x12720
movaps (%rsp), %xmm4
movaps 0x10(%rsp), %xmm3
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movsd 0x38(%rsp), %xmm0
movq %rax, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm3, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
movq 0x50(%rsp), %rax
movq 0x28(%rax), %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
divsd %xmm2, %xmm1
leaq 0x4687(%rip), %rdi      # 0x16304
movb $0x2, %al
callq 0x20f0
jmp 0x11c86
cmpl $0x2, 0x48(%rsp)
jl 0x11b0b
movq 0x50(%rsp), %rdi
movb 0x4f(%rsp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x4390
movq 0x50(%rsp), %rax
movq 0x5108(%rax), %rdi
callq 0x12940
movq 0x50(%rsp), %rax
movq 0x5118(%rax), %rdi
callq 0x12940
movq 0x50(%rsp), %rdi
callq 0x66e0
movq 0x50(%rsp), %rax
testb $0x1, 0x3c(%rax)
jne 0x11ce5
movq 0x50(%rsp), %rdi
callq 0x6a60
addq $0x58, %rsp
retq
nopw (%rax,%rax)