// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]egap/./merge128ext.h
// Function: init_arrays128ext
static void init_arrays128ext(g_data *g)
{
  assert(g->numBwt>0 && g->numBwt<128);
  customInt i=0; // position inside Z newZ and B  
  // open merge files 
  FILE *fnewmerge=NULL, *fmerge=NULL;
  fnewmerge = fopen(g->newmerge_fname,"wb");
  if(!fnewmerge) die("mergegap:init_arrays:fnewmerge open");
  fmerge = fopen(g->merge_fname,"wb");
  if(!fmerge) die("mergegap:init_arrays:fmerge open");
  // scan bwtOcc
  for(int j=0;j<g->sizeOfAlpha;j++) {
    bool bit=1; // printf("1 at %ld\n",i);  // start of symbol j
    g->firstColumn[j] = i;  // symbol j starts at position i
    for(int b=0;b<g->numBwt;b++) {
      for(customInt t=0;t<g->bwtOcc[b][j];t++) { 
        if(j==0) { // zero chars are all different, Z, Znew never change 
          bit=1;
          fwrite_color(b,fnewmerge); //for 0-chars write b also to newmerge aka newZ 
        }
        // all colors are written to merge aka Z
        fwrite_color(b|(bit<<7),fmerge);
        i++; bit=0;
      } // end for t
    } // end for b 
  } // end for j
  assert(i==g->mergeLen); 
  // extra check on mergeColor, can be commented out
  assert(ftell(fmerge)==g->mergeLen*sizeof(palette));
  if(fclose(fmerge)!=0) die("init_arrays:fmerge close"); 
  if(fclose(fnewmerge)!=0) die("mergegap:init_arrays:fnewmerge close"); 
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq 0x50e0(%rax), %rdi
leaq 0x7768(%rip), %rsi      # 0x14aef
callq 0x21d0
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0xd3a5
leaq 0x8df8(%rip), %rdi      # 0x16198
callq 0x3ce0
movq 0x30(%rsp), %rax
movq 0x50d8(%rax), %rdi
leaq 0x7737(%rip), %rsi      # 0x14aef
callq 0x21d0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0xd3d6
leaq 0x8deb(%rip), %rdi      # 0x161bc
callq 0x3ce0
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl 0x38(%rcx), %eax
jge 0xd4cd
movb $0x1, 0x13(%rsp)
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rax
movq 0x5108(%rax), %rax
movslq 0x14(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jge 0xd4bb
movq $0x0, (%rsp)
movq (%rsp), %rax
movq 0x30(%rsp), %rcx
movq 0x18(%rcx), %rcx
movslq 0xc(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq 0x14(%rsp), %rdx
cmpq (%rcx,%rdx,8), %rax
jae 0xd4a9
cmpl $0x0, 0x14(%rsp)
jne 0xd46c
movb $0x1, 0x13(%rsp)
movl 0xc(%rsp), %edi
movq 0x20(%rsp), %rsi
callq 0x11410
movl 0xc(%rsp), %edi
movb 0x13(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
shll $0x7, %eax
orl %eax, %edi
movq 0x18(%rsp), %rsi
callq 0x11410
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
movb $0x0, 0x13(%rsp)
movq (%rsp), %rax
addq $0x1, %rax
movq %rax, (%rsp)
jmp 0xd431
jmp 0xd4ab
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xd417
jmp 0xd4bd
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xd3de
movq 0x18(%rsp), %rdi
callq 0x20d0
cmpl $0x0, %eax
je 0xd4e8
leaq 0x8cfa(%rip), %rdi      # 0x161dd
callq 0x3ce0
movq 0x20(%rsp), %rdi
callq 0x20d0
cmpl $0x0, %eax
je 0xd503
leaq 0x8cf8(%rip), %rdi      # 0x161f6
callq 0x3ce0
addq $0x38, %rsp
retq
nopl (%rax,%rax)