// File: /workspace/github_c_makefile_star2_O2/rikuu[P]kermit/kermit-color.c
// Function: km_align_markers
km_multicolor_t *km_align_markers(char **map_fns, size_t n_maps, km_idx_t *idx, size_t n_reads, int unicolor)
{
	size_t n_markers = 0;
	km_multicolor_t *colors = (km_multicolor_t*) calloc(n_reads, sizeof(km_multicolor_t));
	for (size_t i = 0; i < n_maps; i++) {
		marker_file_t *fp = marker_open(map_fns[i]);
		if (fp == 0) {
			fprintf(stderr, "[E::%s] could not open map file %s\n", __func__, map_fns[i]);
			exit(1);
		}

		marker_rec_t r;
		while (marker_read(fp, &r) >= 0) {
			n_markers++;
			const uint64_t color = unicolor ? (i << 16) : (i << 16 | (r.bin + 1));
			km_hit_v h = km_pileup(idx, r.n, r.p);
			for (size_t j = 0; j < h.n; j++) {
				int32_t id = h.a[j].qn;
				if (id == -1 || id >= (int32_t) n_reads || (colors[id].n > 0 && colors[id].a[colors[id].n - 1] == color)) continue;
				kv_push(uint64_t, colors[id], color);
			}
			free(h.a);
		}
		marker_close(fp);
	}
	fprintf(stderr, "[M::%s] aligned %zu markers\n", __func__, n_markers);
	color_stats(colors, n_reads);
	return colors;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, 0x14(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x18(%rsp)
pushq $0x18
popq %rsi
movq %rcx, 0x8(%rsp)
movq %rcx, %rdi
callq 0x10d0
movq %rax, %r14
xorl %ecx, %ecx
xorl %ebx, %ebx
cmpq 0x28(%rsp), %rcx
je 0x7cd1
movq 0x18(%rsp), %rax
movq (%rax,%rcx,8), %rdi
movq %rcx, %r15
callq 0x7848
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x7d12
movq %r15, 0x30(%rsp)
shlq $0x10, %r15
movq %r15, 0x40(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x78fb
testl %eax, %eax
js 0x7cba
movq %rbx, 0x48(%rsp)
movzwl 0x5c(%rsp), %r12d
incq %r12
cmpl $0x0, 0x14(%rsp)
movl $0x0, %eax
cmovneq %rax, %r12
orq 0x40(%rsp), %r12
movq 0x50(%rsp), %rdx
movl 0x58(%rsp), %ecx
leaq 0x60(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x72b8
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x8(%rsp), %rsi
cmpq 0x60(%rsp), %r15
jae 0x7ca3
movq 0x70(%rsp), %rax
movslq (%rax,%r13), %rax
cmpl $-0x1, %eax
sete %cl
cmpl %esi, %eax
setge %dl
orb %cl, %dl
jne 0x7c97
imulq $0x18, %rax, %rax
leaq (%r14,%rax), %rbp
movq (%r14,%rax), %rbx
testq %rbx, %rbx
je 0x7c57
movq 0x10(%rbp), %rax
cmpq %r12, -0x8(%rax,%rbx,8)
je 0x7c97
cmpq 0x8(%rbp), %rbx
jne 0x7c87
leaq (%rbx,%rbx), %rsi
testq %rbx, %rbx
pushq $0x2
popq %rax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rbp)
movq 0x10(%rbp), %rdi
shlq $0x3, %rsi
callq 0x1160
movq 0x8(%rsp), %rsi
movq %rax, 0x10(%rbp)
jmp 0x7c8b
movq 0x10(%rbp), %rax
leaq 0x1(%rbx), %rcx
movq %rcx, (%rbp)
movq %r12, (%rax,%rbx,8)
incq %r15
addq $0xc, %r13
jmp 0x7c18
movq 0x48(%rsp), %rbx
incq %rbx
movq 0x70(%rsp), %rdi
callq 0x1040
jmp 0x7bbd
movq 0x20(%rsp), %rdi
callq 0x78b7
movq 0x30(%rsp), %rcx
incq %rcx
jmp 0x7b85
movq 0x5320(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x1c62(%rip), %rsi      # 0x9944
leaq 0x1c4a(%rip), %rdx      # 0x9933
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1100
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x7d42
movq %r14, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x52df(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %rcx
leaq 0x1be3(%rip), %rsi      # 0x990f
leaq 0x1c00(%rip), %rdx      # 0x9933
xorl %eax, %eax
callq 0x1100
pushq $0x1
popq %rdi
callq 0x11e0