// File: /workspace/github_c_makefile_star2_O3/jsh58[P]Genrich/Genrich.c
// Function: saveChrom
int saveChrom(char* name, uint32_t len, int* chromLen,
    Chrom** chrom, int xcount, char** xchrList,
    int xBedLen, Bed* xBed, bool ctrl, bool verbose) {

  // determine if chrom has been saved already
  for (int i = 0; i < *chromLen; i++) {
    Chrom* c = *chrom + i;
    if (!strcmp(c->name, name)) {
      if (c->len != len)
        exit(error(c->name, ERRCHRLEN));
      if (! ctrl)
        c->save = true;
      return i;
    }
  }

  // save to list
  *chrom = (Chrom*) memrealloc(*chrom,
    (*chromLen + 1) * sizeof(Chrom));
  Chrom* c = *chrom + *chromLen;
  c->name = (char*) memalloc(1 + strlen(name));
  strcpy(c->name, name);
  c->len = len;
  c->skip = checkChrom(c->name, xcount, xchrList);
  c->save = ! ctrl; // do not save if ref in ctrl sample only
  c->diff = NULL;
  c->expt = (Pileup*) memalloc(sizeof(Pileup));
  c->expt->end = NULL;
  c->expt->cov = NULL;
  c->exptLen = 0;
  c->exptMem = 0;
  c->ctrl = (Pileup*) memalloc(sizeof(Pileup));
  c->ctrl->end = NULL;
  c->ctrl->cov = NULL;
  c->ctrlLen = 0;
  c->ctrlMem = 0;
  c->pval = NULL;
  c->pvalLen = NULL;
  c->sample = 0;
  c->qval = NULL;

  // determine if there are regions to be skipped
  c->bed = NULL;
  c->bedLen = 0;
  if (! c->skip)
    saveXBed(c->name, c->len, &c->bedLen, &c->bed,
      xBedLen, xBed, verbose);

  (*chromLen)++;
  return *chromLen - 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r14
movl %r8d, 0xc(%rsp)
movl %esi, 0x8(%rsp)
movq %rdi, %r12
movq %rdx, 0x18(%rsp)
movslq (%rdx), %r13
movq %rcx, 0x20(%rsp)
movq (%rcx), %rax
movq %rax, 0x10(%rsp)
testq %r13, %r13
jle 0xc8c4
movq 0x10(%rsp), %rax
leaq 0xd(%rax), %rbx
xorl %ebp, %ebp
movq -0xd(%rbx), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x21b0
testl %eax, %eax
je 0xc961
incq %rbp
addq $0x68, %rbx
cmpq %rbp, %r13
jne 0xc8a1
incl %r13d
movslq %r13d, %rax
imulq $0x68, %rax, %rsi
movq 0x10(%rsp), %rdi
callq 0x3925
movq %rax, %rbx
movq 0x20(%rsp), %rax
movq %rbx, (%rax)
movq 0x18(%rsp), %rax
movslq (%rax), %rax
imulq $0x68, %rax, %rbp
leaq (%rbx,%rbp), %r15
movq %r12, %rdi
callq 0x20f0
leaq 0x1(%rax), %rdi
callq 0x3913
movq %rax, %r13
movq %rax, (%rbx,%rbp)
movq %rax, %rdi
movq %r12, %rsi
callq 0x2070
movl 0x8(%rsp), %eax
movl %eax, 0x8(%rbx,%rbp)
movl 0xc(%rsp), %ebx
testl %ebx, %ebx
jle 0xc981
movq (%r14), %rdi
movq %r13, %rsi
callq 0x21b0
testl %eax, %eax
je 0xc985
movl %ebx, %ebx
movl $0x1, %ecx
movq %rcx, %r12
cmpq %rcx, %rbx
je 0xc959
movq (%r14,%r12,8), %rdi
movq %r13, %rsi
callq 0x21b0
leaq 0x1(%r12), %rcx
testl %eax, %eax
jne 0xc93c
cmpq %rbx, %r12
setb %al
jmp 0xc987
movl 0x8(%rsp), %eax
cmpl %eax, -0x5(%rbx)
jne 0xca2b
cmpb $0x0, 0x70(%rsp)
jne 0xca1a
movb $0x1, (%rbx)
jmp 0xca1a
xorl %eax, %eax
jmp 0xc987
movb $0x1, %al
movb %al, 0xc(%r15)
movb 0x70(%rsp), %al
xorb $0x1, %al
movb %al, 0xd(%r15)
xorl %ebx, %ebx
movq %rbx, 0x20(%r15)
movl $0x10, %edi
callq 0x3913
movq %rax, 0x28(%r15)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rbx, 0x30(%r15)
movl $0x10, %edi
callq 0x3913
movq %rax, 0x38(%r15)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rbx, 0x60(%r15)
movq %rbx, 0x10(%r15)
movl $0x0, 0x18(%r15)
movups %xmm0, 0x40(%r15)
movups %xmm0, 0x49(%r15)
cmpb $0x0, 0xc(%r15)
jne 0xca0e
movq 0x68(%rsp), %r9
movl 0x60(%rsp), %r8d
leaq 0x10(%r15), %rcx
leaq 0x18(%r15), %rdx
movq (%r15), %rdi
movl 0x8(%r15), %esi
movzbl 0x78(%rsp), %eax
movl %eax, (%rsp)
callq 0x5cad
movq 0x18(%rsp), %rcx
movl (%rcx), %ebp
leal 0x1(%rbp), %eax
movl %eax, (%rcx)
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x2fa5