// File: /workspace/github_c_makefile_star2_O0/DReichLab[P]adna/sam.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 = b->core.pos + bam_cigar2rlen(b->core.n_cigar, bam_get_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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
je 0x12056
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1229c
cmpq $0x0, -0x18(%rbp)
je 0x1228a
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jge 0x12076
movl $0x0, -0x4(%rbp)
jmp 0x1229c
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movq -0x10(%rbp), %rcx
andl 0x34(%rcx), %eax
cmpl $0x0, %eax
je 0x120a0
movl $0x0, -0x4(%rbp)
jmp 0x1229c
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x120dd
movq -0x10(%rbp), %rax
movl 0x24(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x120dd
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x40(%rcx), %eax
jle 0x120dd
movl $0x0, -0x4(%rbp)
jmp 0x1229c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0xcec0
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x30, %rax
movl %eax, %edi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x18, %rax
andq $0xff, %rax
cltq
addq %rax, %rsi
callq 0xd020
movl -0x1c(%rbp), %ecx
addl %eax, %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x51f9(%rip), %rcx      # 0x17354
movq %rcx, 0x38(%rax)
movq 0x51f6(%rip), %rcx      # 0x1735c
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x34(%rax), %ecx
subl $0x1, %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %ecx, 0x44(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x121c1
movq 0x4e5f(%rip), %rax      # 0x16ff8
movq (%rax), %rdi
leaq 0x15e6(%rip), %rsi      # 0x13789
movb $0x0, %al
callq 0x2230
movq -0x10(%rbp), %rax
movl $0x1, 0x3c(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1229c
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jne 0x12213
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x2c(%rcx), %eax
jge 0x12213
movq 0x4e0d(%rip), %rax      # 0x16ff8
movq (%rax), %rdi
leaq 0x15da(%rip), %rsi      # 0x137cf
movb $0x0, %al
callq 0x2230
movq -0x10(%rbp), %rax
movl $0x1, 0x3c(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1229c
movq -0x18(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x34(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x24(%rcx), %eax
jg 0x12259
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jle 0x12288
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x113e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x12295
movq -0x10(%rbp), %rax
movl $0x1, 0x30(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)