// File: /workspace/github_c_makefile_star2_O2/felipelouza[P]egap/util.c
// Function: alloc_merge_arrays
void alloc_merge_arrays(g_data *g) {
  if(g->extMem) { // notice extMem overrules mmap
    int e,fd;
    e = asprintf(&(g->merge_fname),"%s.mrg0_XXXXXX",g->outPath);
    if(e<0) die("merge temp file name creation failed (1)");
    fd = mkstemp(g->merge_fname);
    if(fd == -1) die("merge temp file creation failed (1)");
    if(close(fd)!=0) die("merge temp file close failed (1)");  // we don't need it now
    e = asprintf(&(g->newmerge_fname),"%s.mrg1_XXXXXX",g->outPath);
    if(e<0) die("merge temp file name creation failed (2)");
    fd = mkstemp(g->newmerge_fname);
    if(fd == -1) die("merge temp file creation failed (2)");
    if(close(fd)!=0) die("merge temp file close failed (2)");  // we don't need it now
    g->mergeColor = g->newMergeColor = NULL;
  }
  else if(g->mmapZ) {
    g->mergeColor = mmap(NULL,g->mergeLen*sizeof(palette),PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0);
    if(g->mergeColor== MAP_FAILED) die(__func__);
    g->newMergeColor =  mmap(NULL,g->mergeLen*sizeof(palette),PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0);
    if(g->newMergeColor== MAP_FAILED) die(__func__);
  }
  else {
    g->mergeColor =     malloc(g->mergeLen*sizeof(palette)); 
    g->newMergeColor =  malloc(g->mergeLen*sizeof(palette));
     if(!g->mergeColor || !g->newMergeColor) die(__func__);
  }
  // make sure these are not used 
  g->mergeColor16=NULL;
  g->array32 = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpb $0x1, 0x69(%rdi)
jne 0x4ea4
leaq 0x50d8(%rbx), %r14
movq 0x80(%rbx), %rdx
leaq 0x9361(%rip), %rsi      # 0xe17d
movq %r14, %rdi
xorl %eax, %eax
callq 0x2280
testl %eax, %eax
js 0x4f40
movq (%r14), %rdi
callq 0x21a0
cmpl $-0x1, %eax
je 0x4f4c
movl %eax, %edi
callq 0x2160
testl %eax, %eax
jne 0x4f58
leaq 0x50e0(%rbx), %r14
movq 0x80(%rbx), %rdx
leaq 0x9397(%rip), %rsi      # 0xe1fa
movq %r14, %rdi
xorl %eax, %eax
callq 0x2280
testl %eax, %eax
js 0x4f64
movq (%r14), %rdi
callq 0x21a0
cmpl $-0x1, %eax
je 0x4f70
movl %eax, %edi
callq 0x2160
testl %eax, %eax
jne 0x4f7c
xorps %xmm0, %xmm0
movups %xmm0, 0x50e8(%rbx)
jmp 0x4f24
movq 0x28(%rbx), %r14
cmpb $0x1, 0x70(%rbx)
jne 0x4ef9
pushq $0x3
popq %rdx
pushq $0x22
popq %rcx
pushq $-0x1
popq %r8
xorl %edi, %edi
movq %r14, %rsi
xorl %r9d, %r9d
callq 0x2230
movq %rax, 0x50e8(%rbx)
cmpq $-0x1, %rax
je 0x4f34
movq 0x28(%rbx), %rsi
pushq $0x3
popq %rdx
pushq $0x22
popq %rcx
pushq $-0x1
popq %r8
xorl %edi, %edi
xorl %r9d, %r9d
callq 0x2230
movq %rax, 0x50f0(%rbx)
cmpq $-0x1, %rax
jne 0x4f24
jmp 0x4f34
movq %r14, %rdi
callq 0xbce0
movq %rax, %r15
movq %rax, 0x50e8(%rbx)
movq %r14, %rdi
callq 0xbce0
movq %rax, 0x50f0(%rbx)
testq %r15, %r15
je 0x4f34
testq %rax, %rax
je 0x4f34
xorps %xmm0, %xmm0
movups %xmm0, 0x50f8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x933c(%rip), %rdi      # 0xe277
callq 0x35b7
leaq 0x9245(%rip), %rdi      # 0xe18c
callq 0x35b7
leaq 0x9262(%rip), %rdi      # 0xe1b5
callq 0x35b7
leaq 0x927a(%rip), %rdi      # 0xe1d9
callq 0x35b7
leaq 0x929e(%rip), %rdi      # 0xe209
callq 0x35b7
leaq 0x92bb(%rip), %rdi      # 0xe232
callq 0x35b7
leaq 0x92d3(%rip), %rdi      # 0xe256
callq 0x35b7