// File: /workspace/github_c_makefile_star2_O3/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 0x5355
leaq 0x50d8(%rbx), %r14
movq 0x80(%rbx), %rdx
leaq 0x9eeb(%rip), %rsi      # 0xf1b8
movq %r14, %rdi
xorl %eax, %eax
callq 0x2280
testl %eax, %eax
js 0x53fd
movq (%r14), %rdi
callq 0x21a0
cmpl $-0x1, %eax
je 0x5409
movl %eax, %edi
callq 0x2160
testl %eax, %eax
jne 0x5415
leaq 0x50e0(%rbx), %r14
movq 0x80(%rbx), %rdx
leaq 0x9f21(%rip), %rsi      # 0xf235
movq %r14, %rdi
xorl %eax, %eax
callq 0x2280
testl %eax, %eax
js 0x5421
movq (%r14), %rdi
callq 0x21a0
cmpl $-0x1, %eax
je 0x542d
movl %eax, %edi
callq 0x2160
testl %eax, %eax
jne 0x5439
xorps %xmm0, %xmm0
movups %xmm0, 0x50e8(%rbx)
jmp 0x53e1
movq 0x28(%rbx), %r14
cmpb $0x1, 0x70(%rbx)
jne 0x53b6
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 0x53f1
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 0x53e1
jmp 0x53f1
movq %r14, %rdi
callq 0xc70e
movq %rax, %r15
movq %rax, 0x50e8(%rbx)
movq %r14, %rdi
callq 0xc70e
movq %rax, 0x50f0(%rbx)
testq %r15, %r15
je 0x53f1
testq %rax, %rax
je 0x53f1
xorps %xmm0, %xmm0
movups %xmm0, 0x50f8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x9eba(%rip), %rdi      # 0xf2b2
callq 0x39fc
leaq 0x9dc3(%rip), %rdi      # 0xf1c7
callq 0x39fc
leaq 0x9de0(%rip), %rdi      # 0xf1f0
callq 0x39fc
leaq 0x9df8(%rip), %rdi      # 0xf214
callq 0x39fc
leaq 0x9e1c(%rip), %rdi      # 0xf244
callq 0x39fc
leaq 0x9e39(%rip), %rdi      # 0xf26d
callq 0x39fc
leaq 0x9e51(%rip), %rdi      # 0xf291
callq 0x39fc