// File: /workspace/github_c_makefile_star2_O1/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 0x52af
leaq 0x50d8(%rbx), %r14
movq 0x80(%rbx), %rdx
leaq 0x9f91(%rip), %rsi      # 0xf1b8
movq %r14, %rdi
xorl %eax, %eax
callq 0x2280
testl %eax, %eax
js 0x5357
movq (%r14), %rdi
callq 0x21a0
cmpl $-0x1, %eax
je 0x5363
movl %eax, %edi
callq 0x2160
testl %eax, %eax
jne 0x536f
leaq 0x50e0(%rbx), %r14
movq 0x80(%rbx), %rdx
leaq 0x9fc7(%rip), %rsi      # 0xf235
movq %r14, %rdi
xorl %eax, %eax
callq 0x2280
testl %eax, %eax
js 0x537b
movq (%r14), %rdi
callq 0x21a0
cmpl $-0x1, %eax
je 0x5387
movl %eax, %edi
callq 0x2160
testl %eax, %eax
jne 0x5393
xorps %xmm0, %xmm0
movups %xmm0, 0x50e8(%rbx)
jmp 0x533b
movq 0x28(%rbx), %r14
cmpb $0x1, 0x70(%rbx)
jne 0x5310
xorl %edi, %edi
movq %r14, %rsi
movl $0x3, %edx
movl $0x22, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x2230
movq %rax, 0x50e8(%rbx)
cmpq $-0x1, %rax
je 0x534b
movq 0x28(%rbx), %rsi
xorl %edi, %edi
movl $0x3, %edx
movl $0x22, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x2230
movq %rax, 0x50f0(%rbx)
cmpq $-0x1, %rax
jne 0x533b
jmp 0x534b
movq %r14, %rdi
callq 0xc63a
movq %rax, %r15
movq %rax, 0x50e8(%rbx)
movq %r14, %rdi
callq 0xc63a
movq %rax, 0x50f0(%rbx)
testq %r15, %r15
je 0x534b
testq %rax, %rax
je 0x534b
xorps %xmm0, %xmm0
movups %xmm0, 0x50f8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x9f60(%rip), %rdi      # 0xf2b2
callq 0x3973
leaq 0x9e69(%rip), %rdi      # 0xf1c7
callq 0x3973
leaq 0x9e86(%rip), %rdi      # 0xf1f0
callq 0x3973
leaq 0x9e9e(%rip), %rdi      # 0xf214
callq 0x3973
leaq 0x9ec2(%rip), %rdi      # 0xf244
callq 0x3973
leaq 0x9edf(%rip), %rdi      # 0xf26d
callq 0x3973
leaq 0x9ef7(%rip), %rdi      # 0xf291
callq 0x3973