// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movl $0x18, %esi
callq 0x10c0
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0xdc5c
movq -0x8(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xd160
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xd9f0
movq 0x5636(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x1ea3(%rip), %rsi      # 0xf87b
leaq 0x1ec0(%rip), %rdx      # 0xf89f
movb $0x0, %al
callq 0x10f0
movl $0x1, %edi
callq 0x11d0
jmp 0xd9f2
movq -0x48(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xd2e0
cmpl $0x0, %eax
jl 0xdc42
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0xda2b
movq -0x40(%rbp), %rax
shlq $0x10, %rax
movq %rax, -0x90(%rbp)
jmp 0xda47
movq -0x40(%rbp), %rax
shlq $0x10, %rax
movzwl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
orq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rsi
movq -0x58(%rbp), %rdx
movl -0x50(%rbp), %ecx
leaq -0x78(%rbp), %rdi
callq 0xc7b0
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x78(%rbp), %rax
jae 0xdc34
movq -0x68(%rbp), %rax
imulq $0xc, -0x80(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x84(%rbp)
cmpl $-0x1, -0x84(%rbp)
je 0xdaf8
movl -0x84(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl %ecx, %eax
jge 0xdaf8
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
jbe 0xdafd
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movslq -0x84(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x60(%rbp), %rax
jne 0xdafd
jmp 0xdc23
jmp 0xdaff
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movslq -0x84(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0xdbe4
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0xdb6b
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x98(%rbp)
jmp 0xdb79
movl $0x2, %eax
movq %rax, -0x98(%rbp)
jmp 0xdb79
movq -0x98(%rbp), %rcx
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x1150
movq %rax, %rcx
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x60(%rbp), %rdx
movq -0x38(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rsi
movslq -0x84(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0xdc23
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0xda6e
movq -0x68(%rbp), %rdi
callq 0x1040
jmp 0xd9f2
movq -0x48(%rbp), %rdi
callq 0xd230
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xd991
movq 0x5395(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
movq -0x30(%rbp), %rcx
leaq 0x1c3f(%rip), %rsi      # 0xf8b0
leaq 0x1c27(%rip), %rdx      # 0xf89f
movb $0x0, %al
callq 0x10f0
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xdca0
movq -0x38(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)