// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %rax
movq 0x10(%rsp), %rdx
movq %rax, 0x18(%rsp)
movl %esi, %eax
movq 0x18(%rsp), %rsi
movl %eax, 0x24(%rsp)
movq %rdi, %r10
movl 0x24(%rsp), %edi
movb 0x98(%rsp), %al
movb 0x90(%rsp), %cl
movq 0x88(%rsp), %r11
movl 0x80(%rsp), %r11d
movq %r10, 0x68(%rsp)
movl %edi, 0x64(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movl %r8d, 0x4c(%rsp)
movq %r9, 0x40(%rsp)
andb $0x1, %cl
movb %cl, 0x3f(%rsp)
andb $0x1, %al
movb %al, 0x3e(%rsp)
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
movq 0x58(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x13d7f
movq 0x50(%rsp), %rax
movq (%rax), %rax
movslq 0x38(%rsp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x68(%rsp), %rsi
callq 0x21a0
cmpl $0x0, %eax
jne 0x13d6d
movq 0x30(%rsp), %rax
movl 0x8(%rax), %eax
cmpl 0x64(%rsp), %eax
je 0x13d50
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0x16, %esi
callq 0x2840
movl %eax, %edi
callq 0x22b0
testb $0x1, 0x3f(%rsp)
jne 0x13d60
movq 0x30(%rsp), %rax
movb $0x1, 0xd(%rax)
movl 0x38(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x13f93
jmp 0x13d6f
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x13ce8
movq 0x50(%rsp), %rax
movq (%rax), %rdi
movq 0x58(%rsp), %rax
movl (%rax), %eax
addl $0x1, %eax
cltq
imulq $0x68, %rax, %rsi
callq 0x28e0
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, (%rax)
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq 0x58(%rsp), %rcx
movslq (%rcx), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rdi
callq 0x20f0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x2890
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, (%rax)
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq 0x68(%rsp), %rsi
callq 0x2070
movl 0x64(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movl 0x4c(%rsp), %esi
movq 0x40(%rsp), %rdx
callq 0x6d20
movb %al, %cl
movq 0x28(%rsp), %rax
andb $0x1, %cl
movb %cl, 0xc(%rax)
movb 0x3f(%rsp), %cl
xorb $-0x1, %cl
movq 0x28(%rsp), %rax
andb $0x1, %cl
movb %cl, 0xd(%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x20(%rax)
movl $0x10, %edi
callq 0x2890
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movq $0x0, (%rax)
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movq $0x0, 0x8(%rax)
movq 0x28(%rsp), %rax
movl $0x0, 0x30(%rax)
movq 0x28(%rsp), %rax
movl $0x0, 0x34(%rax)
movl $0x10, %edi
callq 0x2890
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rax
movq $0x0, (%rax)
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rax
movq $0x0, 0x8(%rax)
movq 0x28(%rsp), %rax
movl $0x0, 0x40(%rax)
movq 0x28(%rsp), %rax
movl $0x0, 0x44(%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x48(%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x50(%rax)
movq 0x28(%rsp), %rax
movb $0x0, 0x58(%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x60(%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x28(%rsp), %rax
movl $0x0, 0x18(%rax)
movq 0x28(%rsp), %rax
testb $0x1, 0xc(%rax)
jne 0x13f79
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq 0x28(%rsp), %rax
movl 0x8(%rax), %esi
movq 0x28(%rsp), %rdx
addq $0x18, %rdx
movq 0x28(%rsp), %rcx
addq $0x10, %rcx
movl 0x80(%rsp), %r8d
movq 0x88(%rsp), %r9
movb 0x3e(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, (%rsp)
callq 0x6970
movq 0x58(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x58(%rsp), %rax
movl (%rax), %eax
subl $0x1, %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax)