// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/samtools-0.1.18/bam_pileup.c
// Function: bam_plp_push
int bam_plp_push(bam_plp_t iter, const bam1_t *b)
{
	if (iter->error) return -1;
	if (b) {
		if (b->core.tid < 0) return 0;
		if (b->core.flag & iter->flag_mask) return 0;
		if (iter->tid == b->core.tid && iter->pos == b->core.pos && iter->mp->cnt > iter->maxcnt) return 0;
		bam_copy1(&iter->tail->b, b);
		iter->tail->beg = b->core.pos; iter->tail->end = bam_calend(&b->core, bam1_cigar(b));
		iter->tail->s = g_cstate_null; iter->tail->s.end = iter->tail->end - 1; // initialize cstate_t
		if (b->core.tid < iter->max_tid) {
			fprintf(stderr, "[bam_pileup_core] the input is not sorted (chromosomes out of order)\n");
			iter->error = 1;
			return -1;
		}
		if ((b->core.tid == iter->max_tid) && (iter->tail->beg < iter->max_pos)) {
			fprintf(stderr, "[bam_pileup_core] the input is not sorted (reads out of order)\n");
			iter->error = 1;
			return -1;
		}
		iter->max_tid = b->core.tid; iter->max_pos = iter->tail->beg;
		if (iter->tail->end > iter->pos || iter->tail->b.core.tid > iter->tid) {
			iter->tail->next = mp_alloc(iter->mp);
			iter->tail = iter->tail->next;
		}
	} else iter->is_eof = 1;
	return 0;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq %rsi, (%rsp)
movq 0x8(%rsp), %rax
cmpl $0x0, 0x3c(%rax)
je 0x36d485
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x36d6d7
cmpq $0x0, (%rsp)
je 0x36d6c3
movq (%rsp), %rax
cmpl $0x0, (%rax)
jge 0x36d4a6
movl $0x0, 0x14(%rsp)
jmp 0x36d6d7
movq (%rsp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movq 0x8(%rsp), %rcx
andl 0x34(%rcx), %eax
cmpl $0x0, %eax
je 0x36d4d2
movl $0x0, 0x14(%rsp)
jmp 0x36d6d7
movq 0x8(%rsp), %rax
movl 0x20(%rax), %eax
movq (%rsp), %rcx
cmpl (%rcx), %eax
jne 0x36d514
movq 0x8(%rsp), %rax
movl 0x24(%rax), %eax
movq (%rsp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x36d514
movq 0x8(%rsp), %rax
movq (%rax), %rax
movl (%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x40(%rcx), %eax
jle 0x36d514
movl $0x0, 0x14(%rsp)
jmp 0x36d6d7
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movq (%rsp), %rsi
callq 0x36d6e0
movq (%rsp), %rax
movl 0x4(%rax), %ecx
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x38(%rax)
movq (%rsp), %rdi
movq (%rsp), %rax
movq 0x30(%rax), %rsi
movq (%rsp), %rax
movq 0x8(%rax), %rax
shrq $0x18, %rax
andq $0xff, %rax
cltq
addq %rax, %rsi
callq 0x3655d0
movl %eax, %ecx
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x3c(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x2d1ef9(%rip), %rcx    # 0x63f478
movq %rcx, 0x40(%rax)
movq 0x2d1ef6(%rip), %rcx    # 0x63f480
movq %rcx, 0x48(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x3c(%rax), %ecx
subl $0x1, %ecx
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x4c(%rax)
movq (%rsp), %rax
movl (%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x36d5ea
movq 0x2ce9e0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x230601(%rip), %rsi    # 0x59dbcb
movb $0x0, %al
callq 0x199f0
movq 0x8(%rsp), %rax
movl $0x1, 0x3c(%rax)
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x36d6d7
movq (%rsp), %rax
movl (%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x28(%rcx), %eax
jne 0x36d641
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x38(%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x2c(%rcx), %eax
jae 0x36d641
movq 0x2ce989(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2305f0(%rip), %rsi    # 0x59dc11
movb $0x0, %al
callq 0x199f0
movq 0x8(%rsp), %rax
movl $0x1, 0x3c(%rax)
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x36d6d7
movq (%rsp), %rax
movl (%rax), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x28(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x38(%rax), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x2c(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x3c(%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x24(%rcx), %eax
ja 0x36d68e
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movq 0x8(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jle 0x36d6c1
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x36c6b0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x50(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x50(%rax), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0x36d6cf
movq 0x8(%rsp), %rax
movl $0x1, 0x30(%rax)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq