// File: /workspace/github_c_makefile_star2_O0/rikuu[P]kermit/miniasm/asm.c
// Function: ma_sg_gen
asg_t *ma_sg_gen(const ma_opt_t *opt, const sdict_t *d, const ma_sub_t *sub, size_t n_hits, const ma_hit_t *hit)
{
	size_t i;
	asg_t *g;
	g = asg_init();
	for (i = 0; i < d->n_seq; ++i) {
		if (sub) asg_seq_set(g, i, sub[i].e - sub[i].s, (sub[i].del || d->seq[i].del));
		else asg_seq_set(g, i, d->seq[i].len, d->seq[i].del);
	}
	for (i = 0; i < n_hits; ++i) {
		int r;
		asg_arc_t t, *p;
		const ma_hit_t *h = &hit[i];
		uint32_t qn = h->qns>>32;
		int ql = sub? sub[qn].e - sub[qn].s : d->seq[qn].len;
		int tl = sub? sub[h->tn].e - sub[h->tn].s : d->seq[h->tn].len;
		r = ma_hit2arc(h, ql, tl, opt->max_hang, opt->int_frac, opt->min_ovlp, &t);
		if (r >= 0) {
			if (qn == h->tn) { // self match
				if ((uint32_t)h->qns == h->ts && h->qe == h->te && h->rev) // PacBio-specific artifact (TODO: is this right when we skip target containment above?)
					g->seq[qn].del = 1;
				continue;
			}
			p = asg_arc_pushp(g);
			*p = t;
		} else if (r == MA_HT_QCONT) g->seq[qn].del = 1;
	}
	asg_cleanup(g);
	fprintf(stderr, "[M::%s] read %d arcs\n", __func__, g->n_arc);
	return g;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
callq 0x3110
movq %rax, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
jae 0x7ef3
cmpq $0x0, -0x18(%rbp)
je 0x7ea2
movq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rax
movl %eax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rdx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subl %ecx, %eax
movl %eax, -0x74(%rbp)
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movl (%rax,%rcx,8), %ecx
shrl $0x1f, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x6d(%rbp)
jne 0x7e89
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x6d(%rbp)
movl -0x74(%rbp), %edx
movl -0x78(%rbp), %esi
movq -0x80(%rbp), %rdi
movb -0x6d(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x3310
jmp 0x7ee0
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %esi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
shrl $0x1f, %ecx
callq 0x3310
jmp 0x7ee2
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7e00
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x80c8
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x64(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7f56
movq -0x18(%rbp), %rax
movl -0x64(%rbp), %ecx
movl 0x4(%rax,%rcx,8), %eax
movq -0x18(%rbp), %rcx
movl -0x64(%rbp), %edx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subl %ecx, %eax
movl %eax, -0x84(%rbp)
jmp 0x7f71
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x64(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x68(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7fae
movq -0x18(%rbp), %rax
movq -0x60(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl 0x4(%rax,%rcx,8), %eax
movq -0x18(%rbp), %rcx
movq -0x60(%rbp), %rdx
movl 0xc(%rdx), %edx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subl %ecx, %eax
movl %eax, -0x88(%rbp)
jmp 0x7fcd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movl 0xc(%rcx), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x60(%rbp), %rdi
movl -0x68(%rbp), %esi
movl -0x6c(%rbp), %edx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x8(%rbp), %rax
movss 0x18(%rax), %xmm0
movq -0x8(%rbp), %rax
movl 0x14(%rax), %r8d
leaq -0x50(%rbp), %r9
callq 0x8110
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x8090
movl -0x64(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0x806e
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq -0x60(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x806c
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x806c
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpl $0x0, %eax
je 0x806c
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x64(%rbp), %ecx
movl (%rax,%rcx,4), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rax,%rcx,4)
jmp 0x80b7
movq -0x38(%rbp), %rdi
callq 0x8390
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, (%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x80b5
cmpl $-0x2, -0x3c(%rbp)
jne 0x80b3
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x64(%rbp), %ecx
movl (%rax,%rcx,4), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rax,%rcx,4)
jmp 0x80b5
jmp 0x80b7
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7efb
movq -0x38(%rbp), %rdi
callq 0x35d0
movq 0xaf20(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq 0x7426(%rip), %rsi      # 0xf515
leaq 0x7435(%rip), %rdx      # 0xf52b
movb $0x0, %al
callq 0x1110
movq -0x38(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)