// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap2/index.c
// Function: mm_idx_spsc_read2
int32_t mm_idx_spsc_read2(mm_idx_t *idx, const char *fn, int32_t max_sc, float scale)
{
	gzFile fp;
	kstring_t str = {0,0,0};
	kstream_t *ks;
	int32_t dret, j;
	int64_t n_read = 0;

	fp = fn && strcmp(fn, "-") != 0? gzopen(fn, "rb") : gzdopen(0, "rb");
	if (fp == 0) return -1;
	if (idx->h == 0) mm_idx_index_name(idx);
	if (max_sc > 63) max_sc = 63;
	idx->spsc = Kcalloc(0, mm_idx_spsc_t, idx->n_seq * 2);
	ks = ks_init(fp);
	while (ks_getuntil(ks, KS_SEP_LINE, &str, &dret) >= 0) {
		mm_idx_spsc_t *s;
		char *p, *q, *name = 0;
		int32_t i, type = -1, strand = 0, cid = -1, score = -1;
		int64_t pos = -1;
		for (i = 0, p = q = str.s;; ++p) {
			if (*p == '\t' || *p == 0) {
				int c = *p;
				*p = 0;
				if (i == 0) {
					name = q;
				} else if (i == 1) {
					pos = atol(q);
				} else if (i == 2) {
					strand = *q == '+'? 1 : '-'? -1 : 0;
				} else if (i == 3) {
					type = *q == 'D'? 0 : *q == 'A'? 1 : -1;
				} else if (i == 4) {
					score = atoi(q);
					break;
				}
				if (c == 0) break;
				q = p + 1, ++i;
			}
		}
		if (i < 4) continue; // not enough fields
		if (scale > 0.0f && scale < 1.0f)
			score = score > 0.0f? (int)(score * scale + .499) : (int)(score * scale - .499);
		if (score > max_sc) score = max_sc;
		if (score < -max_sc) score = -max_sc;
		cid = mm_idx_name2id(idx, name);
		if (cid < 0 || type < 0 || strand == 0 || pos < 0) continue; // FIXME: give a warning!
		s = &idx->spsc[cid << 1 | (strand > 0? 0 : 1)];
		Kgrow(0, uint64_t, s->a, s->n, s->m);
		if (pos > 0 && pos < idx->seq[cid].len) { // ignore scores at the ends
			s->a[s->n++] = (uint64_t)pos << 8 | (score + KSW_SPSC_OFFSET) << 1 | type;
			++n_read;
		}
	}
	ks_destroy(ks);
	gzclose(fp);
	for (j = 0; j < idx->n_seq * 2; ++j) {
		mm_idx_spsc_t *s = &idx->spsc[j];
		if (s->n > 0)
			radix_sort_64(s->a, s->a + s->n);
	}
	if (mm_verbose >= 3)
		fprintf(stderr, "[M::%s] read %ld splice scores\n", __func__, (long)n_read);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movss %xmm0, -0x20(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x21b0
movq $0x0, -0x58(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xd5b8
movq -0x18(%rbp), %rdi
leaq 0x49dfd(%rip), %rsi     # 0x57392
callq 0x2230
cmpl $0x0, %eax
je 0xd5b8
movq -0x18(%rbp), %rdi
leaq 0x4996e(%rip), %rsi     # 0x56f18
callq 0x2340
movq %rax, -0xb0(%rbp)
jmp 0xd5cd
xorl %edi, %edi
leaq 0x49957(%rip), %rsi     # 0x56f18
callq 0x20f0
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xd5eb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xda89
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0xd5ff
movq -0x10(%rbp), %rdi
callq 0x8490
cmpl $0x3f, -0x1c(%rbp)
jle 0xd60c
movl $0x3f, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
shll %eax
movl %eax, %eax
movl %eax, %esi
xorl %eax, %eax
movl %eax, %edi
movl $0x10, %edx
callq 0x1a790
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x28(%rbp), %rdi
callq 0x1b040
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movl $0x2, %esi
leaq -0x40(%rbp), %rdx
leaq -0x4c(%rbp), %rcx
callq 0xb330
cmpl $0x0, %eax
jl 0xd9cc
movq $0x0, -0x78(%rbp)
movl $0xffffffff, -0x80(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x84(%rbp)
movl $0xffffffff, -0x88(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x8c(%rbp) # imm = 0xFFFFFFFF
movq $-0x1, -0x98(%rbp)
movl $0x0, -0x7c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
je 0xd6c5
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xd7af
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x9c(%rbp)
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x7c(%rbp)
jne 0xd6ec
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0xd78f
cmpl $0x1, -0x7c(%rbp)
jne 0xd707
movq -0x70(%rbp), %rdi
callq 0x2350
movq %rax, -0x98(%rbp)
jmp 0xd78d
cmpl $0x2, -0x7c(%rbp)
jne 0xd72c
movq -0x70(%rbp), %rax
movsbl (%rax), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl $0x2b, %edx
cmovel %ecx, %eax
movl %eax, -0x84(%rbp)
jmp 0xd78b
cmpl $0x3, -0x7c(%rbp)
jne 0xd770
movq -0x70(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x44, %eax
jne 0xd748
xorl %eax, %eax
movl %eax, -0xb4(%rbp)
jmp 0xd765
movq -0x70(%rbp), %rax
movsbl (%rax), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl $0x41, %edx
cmovel %ecx, %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movl %eax, -0x80(%rbp)
jmp 0xd789
cmpl $0x4, -0x7c(%rbp)
jne 0xd787
movq -0x70(%rbp), %rdi
callq 0x23b0
movl %eax, -0x8c(%rbp)
jmp 0xd7c2
jmp 0xd789
jmp 0xd78b
jmp 0xd78d
jmp 0xd78f
cmpl $0x0, -0x9c(%rbp)
jne 0xd79a
jmp 0xd7c2
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0xd7b1
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0xd6a9
cmpl $0x4, -0x7c(%rbp)
jge 0xd7cd
jmp 0xd63f
movss -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xd854
movss 0x4902e(%rip), %xmm0    # 0x56810
ucomiss -0x20(%rbp), %xmm0
jbe 0xd854
cvtsi2ssl -0x8c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xd821
cvtsi2ssl -0x8c(%rbp), %xmm0
mulss -0x20(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x47807(%rip), %xmm1    # 0x55018
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xb8(%rbp)
jmp 0xd848
cvtsi2ssl -0x8c(%rbp), %xmm0
mulss -0x20(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x477de(%rip), %xmm1    # 0x55018
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jle 0xd868
movl -0x1c(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
xorl %ecx, %ecx
subl -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0xd882
xorl %eax, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x88f0
movl %eax, -0x88(%rbp)
cmpl $0x0, -0x88(%rbp)
jl 0xd8b7
cmpl $0x0, -0x80(%rbp)
jl 0xd8b7
cmpl $0x0, -0x84(%rbp)
je 0xd8b7
cmpq $0x0, -0x98(%rbp)
jge 0xd8bc
jmp 0xd63f
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x88(%rbp), %ecx
shll %ecx
movl -0x84(%rbp), %edi
movl $0x1, %edx
xorl %esi, %esi
cmpl $0x0, %edi
cmovgl %esi, %edx
orl %edx, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movl (%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0xd94d
movq -0x60(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x60(%rbp), %rax
movl 0x4(%rax), %ecx
shrl %ecx
addl $0x10, %ecx
movq -0x60(%rbp), %rax
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x60(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %edx
shlq $0x3, %rdx
xorl %eax, %eax
movl %eax, %edi
callq 0x1ad30
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xd94f
cmpq $0x0, -0x98(%rbp)
jle 0xd9c7
movq -0x98(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
movslq -0x88(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
jge 0xd9c7
movq -0x98(%rbp), %rdx
shlq $0x8, %rdx
movl -0x8c(%rbp), %eax
addl $0x40, %eax
shll %eax
cltq
orq %rax, %rdx
movslq -0x80(%rbp), %rax
orq %rax, %rdx
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0xd63f
movq -0x48(%rbp), %rdi
callq 0x1b0a0
movq -0x28(%rbp), %rdi
callq 0x2030
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shll %ecx
cmpl %ecx, %eax
jae 0xda53
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpl $0x0, (%rax)
jbe 0xda46
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0xa8(%rbp), %rax
movl (%rax), %eax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x5f90
jmp 0xda48
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xd9e5
leaq 0x50cb6(%rip), %rax     # 0x5e710
cmpl $0x3, (%rax)
jl 0xda82
movq 0x50592(%rip), %rax     # 0x5dff8
movq (%rax), %rdi
movq -0x58(%rbp), %rcx
leaq 0x4969c(%rip), %rsi     # 0x57110
leaq 0x496b5(%rip), %rdx     # 0x57130
movb $0x0, %al
callq 0x2250
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)