// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %r9, 0x28(%rsp)
movl %r8d, 0x14(%rsp)
movl %esi, 0x10(%rsp)
movq %rdi, %r14
movq %rdx, 0x30(%rsp)
movslq (%rdx), %rbx
xorl %ebp, %ebp
testl %ebx, %ebx
movl $0x0, %r12d
cmovgl %ebx, %r12d
movq %rcx, 0x20(%rsp)
movq (%rcx), %rax
movq %rax, 0x18(%rsp)
leaq 0xd(%rax), %r15
cmpq %rbp, %r12
je 0xb19a
movq -0xd(%r15), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x21a0
testl %eax, %eax
je 0xb2aa
incq %rbp
addq $0x68, %r15
jmp 0xb175
imulq $0x68, %rbx, %rsi
addq $0x68, %rsi
movq 0x18(%rsp), %rdi
callq 0x2776
movq %rax, %rbp
movq 0x20(%rsp), %rax
movq %rbp, (%rax)
movq 0x30(%rsp), %rbx
movslq (%rbx), %rax
imulq $0x68, %rax, %r12
movq %r14, %rdi
callq 0x20f0
leaq 0x1(%rax), %rdi
callq 0x2752
movq %rax, %r15
movq %rax, (%rbp,%r12)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2070
movl 0x10(%rsp), %eax
movl %eax, 0x8(%rbp,%r12)
movq %r15, %rdi
movl 0x14(%rsp), %esi
movq 0x28(%rsp), %rdx
callq 0x4c14
movb %al, 0xc(%rbp,%r12)
movb 0x80(%rsp), %al
xorb $0x1, %al
movb %al, 0xd(%rbp,%r12)
andq $0x0, 0x20(%rbp,%r12)
pushq $0x10
popq %r14
movq %r14, %rdi
callq 0x2752
movq %rax, 0x28(%rbp,%r12)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x30(%rbp,%r12)
movq %r14, %rdi
callq 0x2752
movq %rax, 0x38(%rbp,%r12)
andq $0x0, 0x60(%rbp,%r12)
andq $0x0, 0x10(%rbp,%r12)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andl $0x0, 0x18(%rbp,%r12)
movups %xmm0, 0x40(%rbp,%r12)
movups %xmm0, 0x49(%rbp,%r12)
cmpb $0x0, 0xc(%rbp,%r12)
jne 0xb2a1
leaq (%r12,%rbp), %rax
leaq (%r12,%rbp), %rcx
addq $0x10, %rcx
leaq 0x18(%rbp,%r12), %rdx
movq (%rax), %rdi
movl 0x8(%rax), %esi
movzbl 0x88(%rsp), %eax
movl %eax, (%rsp)
movl 0x70(%rsp), %r8d
movq 0x78(%rsp), %r9
callq 0x4a13
movl (%rbx), %ebp
leal 0x1(%rbp), %eax
movl %eax, (%rbx)
jmp 0xb2c2
movl 0x10(%rsp), %eax
cmpl %eax, -0x5(%r15)
jne 0xb2d3
cmpb $0x0, 0x80(%rsp)
jne 0xb2c2
movb $0x1, (%r15)
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x16
popq %rsi
movq %r13, %rdi
callq 0x2724
pushq $0x1
popq %rdi
callq 0x22a0