// File: /workspace/github_c_makefile_star2_O0/jsh58[P]Genrich/Genrich.c
// Function: saveInterval
uint32_t saveInterval(Chrom* c, int64_t start, int64_t end,
    char* qname, uint8_t count, File bed, bool bedOpt,
    bool gzOut, bool ctrl, int sample, uint64_t* errCount,
    bool verbose) {

  // check validity of positions
  if (start < 0) {
    if (verbose) {
      if (*errCount < MAX_ALNS)
        fprintf(stderr, "Warning! Read %s prevented from extending below 0 on %s\n",
          qname, c->name);
      (*errCount)++;
    }
    start = 0;
  }
  if (start >= c->len) {
    char msg[MAX_ALNS];
    sprintf(msg, "Read %s, ref. %s", qname, c->name);
    exit(error(msg, ERRPOS));
  }
  if (end > c->len) {
    if (verbose) {
      if (*errCount < MAX_ALNS)
        fprintf(stderr, "Warning! Read %s prevented from extending past %d on %s\n",
          qname, c->len, c->name);
      (*errCount)++;
    }
    end = c->len;
  }

  // create 'diff' arrays if necessary
  if (c->diff == NULL) {
    c->diff = (Diff*) memalloc(sizeof(Diff));
    c->diff->frac = (uint8_t*) memalloc((1 + c->len) * sizeof(uint8_t));
    c->diff->cov = (int16_t*) memalloc((1 + c->len) * sizeof(int16_t));
    for (int i = 0; i < 1 + c->len; i++) {
      c->diff->frac[i] = 0;
      c->diff->cov[i] = 0;
    }
  }

  // check for overflow/underflow (c->diff->cov is int16_t)
  if (c->diff->cov[start] == INT16_MAX) {
    if (verbose) {
      fprintf(stderr, "Warning! Read %s, alignment at (%s, %ld-%ld)",
        qname, c->name, start, end);
      fprintf(stderr, " skipped due to overflow\n");
    }
    return 0;
  }
  if (c->diff->cov[end] == INT16_MIN) {
    if (verbose) {
      fprintf(stderr, "Warning! Read %s, alignment at (%s, %ld-%ld)",
        qname, c->name, start, end);
      fprintf(stderr, " skipped due to underflow\n");
    }
    return 0;
  }

  // add counts to diff array(s)
  if (count == 1) {
    c->diff->cov[start]++;
    c->diff->cov[end]--;
  } else {
    // add fractional count
    addFrac(&c->diff->cov[start], &c->diff->frac[start], count);
    subFrac(&c->diff->cov[end], &c->diff->frac[end], count);
  }

  // print BED interval
  if (bedOpt)
    printBED(bed, gzOut, c->name, start, end, qname,
      count, ctrl, sample);

  return end - start;
}

// Assembly:
pushq %rbx
subq $0xe0, %rsp
movq %r9, %rbx
movl %r8d, %eax
movq %rcx, %r8
movq %rdx, %r9
movq %rsi, %r10
movq %rdi, %r11
movb %al, %dil
movb 0x118(%rsp), %al
movq 0x110(%rsp), %rcx
movl 0x108(%rsp), %ecx
movb 0x100(%rsp), %cl
movb 0xf8(%rsp), %dl
movb 0xf0(%rsp), %sil
movq %rbx, 0xd0(%rsp)
movq %r11, 0xc8(%rsp)
movq %r10, 0xc0(%rsp)
movq %r9, 0xb8(%rsp)
movq %r8, 0xb0(%rsp)
movb %dil, 0xaf(%rsp)
andb $0x1, %sil
movb %sil, 0xae(%rsp)
andb $0x1, %dl
movb %dl, 0xad(%rsp)
andb $0x1, %cl
movb %cl, 0xac(%rsp)
andb $0x1, %al
movb %al, 0xab(%rsp)
cmpq $0x0, 0xc0(%rsp)
jge 0xb7a1
testb $0x1, 0xab(%rsp)
je 0xb795
movq 0x110(%rsp), %rax
cmpq $0x80, (%rax)
jae 0xb783
movq 0x17899(%rip), %rax     # 0x22ff8
movq (%rax), %rdi
movq 0xb0(%rsp), %rdx
movq 0xc8(%rsp), %rax
movq (%rax), %rcx
leaq 0x14392(%rip), %rsi     # 0x1fb0e
movb $0x0, %al
callq 0x21c0
movq 0x110(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq $0x0, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movq 0xc8(%rsp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jl 0xb7f5
leaq 0x20(%rsp), %rdi
movq 0xb0(%rsp), %rdx
movq 0xc8(%rsp), %rax
movq (%rax), %rcx
leaq 0x1436f(%rip), %rsi     # 0x1fb47
movb $0x0, %al
callq 0x22a0
leaq 0x20(%rsp), %rdi
movl $0x18, %esi
callq 0x2840
movl %eax, %edi
callq 0x22b0
movq 0xb8(%rsp), %rax
movq 0xc8(%rsp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jle 0xb883
testb $0x1, 0xab(%rsp)
je 0xb870
movq 0x110(%rsp), %rax
cmpq $0x80, (%rax)
jae 0xb85e
movq 0x177c9(%rip), %rax     # 0x22ff8
movq (%rax), %rdi
movq 0xb0(%rsp), %rdx
movq 0xc8(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0xc8(%rsp), %rax
movq (%rax), %r8
leaq 0x14301(%rip), %rsi     # 0x1fb58
movb $0x0, %al
callq 0x21c0
movq 0x110(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq 0xc8(%rsp), %rax
movl 0x8(%rax), %eax
movq %rax, 0xb8(%rsp)
movq 0xc8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xb969
movl $0x10, %edi
callq 0x2890
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0xc8(%rsp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
shlq $0x0, %rdi
callq 0x2890
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rcx, (%rax)
movq 0xc8(%rsp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edi
shlq %rdi
callq 0x2890
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x8(%rax)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movq 0xc8(%rsp), %rcx
movl 0x8(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jae 0xb967
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movslq 0x1c(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movslq 0x1c(%rsp), %rcx
movw $0x0, (%rax,%rcx,2)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xb911
jmp 0xb969
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq 0xc0(%rsp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0xb9f9
testb $0x1, 0xab(%rsp)
je 0xb9e9
movq 0x1765b(%rip), %rax     # 0x22ff8
movq (%rax), %rdi
movq 0xb0(%rsp), %rdx
movq 0xc8(%rsp), %rax
movq (%rax), %rcx
movq 0xc0(%rsp), %r8
movq 0xb8(%rsp), %r9
leaq 0x141c7(%rip), %rsi     # 0x1fb91
movb $0x0, %al
callq 0x21c0
movq 0x17620(%rip), %rax     # 0x22ff8
movq (%rax), %rdi
leaq 0x141dc(%rip), %rsi     # 0x1fbbe
movb $0x0, %al
callq 0x21c0
movl $0x0, 0xdc(%rsp)
jmp 0xbbf8
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq 0xb8(%rsp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0xffff8000, %eax       # imm = 0xFFFF8000
jne 0xba89
testb $0x1, 0xab(%rsp)
je 0xba79
movq 0x175cb(%rip), %rax     # 0x22ff8
movq (%rax), %rdi
movq 0xb0(%rsp), %rdx
movq 0xc8(%rsp), %rax
movq (%rax), %rcx
movq 0xc0(%rsp), %r8
movq 0xb8(%rsp), %r9
leaq 0x14137(%rip), %rsi     # 0x1fb91
movb $0x0, %al
callq 0x21c0
movq 0x17590(%rip), %rax     # 0x22ff8
movq (%rax), %rdi
leaq 0x14166(%rip), %rsi     # 0x1fbd8
movb $0x0, %al
callq 0x21c0
movl $0x0, 0xdc(%rsp)
jmp 0xbbf8
movzbl 0xaf(%rsp), %eax
cmpl $0x1, %eax
jne 0xbae3
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq 0xc0(%rsp), %rcx
movw (%rax,%rcx,2), %dx
addw $0x1, %dx
movw %dx, (%rax,%rcx,2)
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq 0xb8(%rsp), %rcx
movw (%rax,%rcx,2), %dx
addw $-0x1, %dx
movw %dx, (%rax,%rcx,2)
jmp 0xbb67
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rdi
movq 0xc0(%rsp), %rax
shlq %rax
addq %rax, %rdi
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rsi
addq 0xc0(%rsp), %rsi
movzbl 0xaf(%rsp), %edx
callq 0xad40
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rdi
movq 0xb8(%rsp), %rax
shlq %rax
addq %rax, %rdi
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rsi
addq 0xb8(%rsp), %rsi
movzbl 0xaf(%rsp), %edx
callq 0xb1e0
testb $0x1, 0xae(%rsp)
je 0xbbe1
movb 0xad(%rsp), %sil
movq 0xc8(%rsp), %rax
movq (%rax), %rdx
movq 0xc0(%rsp), %rcx
movq 0xb8(%rsp), %r8
movq 0xb0(%rsp), %r9
movb 0xaf(%rsp), %r11b
movb 0xac(%rsp), %r10b
movl 0x108(%rsp), %eax
movq 0xd0(%rsp), %rdi
andb $0x1, %sil
andb $0x1, %r10b
movzbl %sil, %esi
movzbl %r11b, %r11d
movl %r11d, (%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0xb590
movq 0xb8(%rsp), %rax
subq 0xc0(%rsp), %rax
movl %eax, 0xdc(%rsp)
movl 0xdc(%rsp), %eax
addq $0xe0, %rsp
popq %rbx
retq
nopl (%rax,%rax)