// File: /workspace/github_c_makefile_star2_O0/rikuu[P]kermit/miniasm/miniasm.h
// Function: ma_hit2arc
static inline int ma_hit2arc(const ma_hit_t *h, int ql, int tl, int max_hang, float int_frac, int min_ovlp, asg_arc_t *p)
{
	int32_t tl5, tl3, ext5, ext3, qs = (int32_t)h->qns;
	uint32_t u, v, l; // u: query end; v: target end; l: length from u to v
	if (h->rev) tl5 = tl - h->te, tl3 = h->ts; // tl5: 5'-end overhang (on the query strand); tl3: similar
	else tl5 = h->ts, tl3 = tl - h->te;
	ext5 = qs < tl5? qs : tl5;
	ext3 = ql - h->qe < tl3? ql - h->qe : tl3;
	if (ext5 > max_hang || ext3 > max_hang || h->qe - qs < (h->qe - qs + ext5 + ext3) * int_frac)
		return MA_HT_INT;
	if (qs <= tl5 && ql - h->qe <= tl3) return MA_HT_QCONT; // query contained
	else if (qs >= tl5 && ql - h->qe >= tl3) return MA_HT_TCONT; // target contained
	else if (qs > tl5) u = 0, v = !!h->rev, l = qs - tl5;
	else u = 1, v = !h->rev, l = (ql - h->qe) - tl3;
	if (h->qe - qs + ext5 + ext3 < min_ovlp || h->te - h->ts + ext5 + ext3 < min_ovlp) return MA_HT_SHORT_OVLP; // short overlap
	u |= h->qns>>32<<1, v |= h->tn<<1;
	p->ul = (uint64_t)u<<32 | l, p->v = v, p->ol = ql - l, p->del = 0;
	return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movss %xmm0, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpl $0x0, %eax
je 0x7786
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x38(%rbp)
jmp 0x779d
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x77ad
movl -0x44(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0x77b3
movl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x8(%rcx), %eax
cmpl -0x38(%rbp), %eax
jae 0x77d7
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x8(%rcx), %eax
movl %eax, -0x58(%rbp)
jmp 0x77dd
movl -0x38(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x781f
movl -0x40(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x781f
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl -0x44(%rbp), %ecx
subl %ecx, %eax
movl %eax, %ecx
cvtsi2ss %rcx, %xmm1
movl -0x3c(%rbp), %ecx
addl %ecx, %eax
movl -0x40(%rbp), %ecx
addl %ecx, %eax
cvtsi2ss %rax, %xmm0
mulss -0x20(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x782b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x799c
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x784e
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x8(%rcx), %eax
cmpl -0x38(%rbp), %eax
ja 0x784e
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x799c
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jl 0x7871
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x8(%rcx), %eax
cmpl -0x38(%rbp), %eax
jb 0x7871
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x799c
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jle 0x78ad
movl $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4c(%rbp)
movl -0x44(%rbp), %eax
subl -0x34(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x78e4
movl $0x1, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4c(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x8(%rcx), %eax
subl -0x38(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x78e6
jmp 0x78e8
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
subl -0x44(%rbp), %eax
addl -0x3c(%rbp), %eax
addl -0x40(%rbp), %eax
cmpl -0x24(%rbp), %eax
jb 0x7916
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
subl 0x10(%rcx), %eax
addl -0x3c(%rbp), %eax
addl -0x40(%rbp), %eax
cmpl -0x24(%rbp), %eax
jae 0x791f
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x799c
movq -0x10(%rbp), %rax
movq (%rax), %rcx
shrq $0x20, %rcx
shlq %rcx
movl -0x48(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
orl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
movl %eax, %ecx
shlq $0x20, %rcx
movl -0x50(%rbp), %eax
orq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl -0x4c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x14(%rbp), %edx
subl -0x50(%rbp), %edx
movq -0x30(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x30(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
movl -0x50(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)