// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi-lite/mrope.c
// Function: mr_insert_multi_aux
static void mr_insert_multi_aux(rope_t *rope, int64_t m, triple64_t *a, int is_comp)
{
	int64_t k, beg;
	rpcache_t cache;
	memset(&cache, 0, sizeof(rpcache_t));
	for (k = 0; k != m; ++k) // set the base to insert
		a[k].c = *a[k].p++;
	for (k = 1, beg = 0; k <= m; ++k) {
		if (k == m || a[k].u != a[k-1].u) {
			int64_t x, i, l = a[beg].l, u = a[beg].u, tl[6], tu[6], c[6];
			int start, end, step, b;
			if (l == u && k == beg + 1) { // special case; still works without the following block
				a[beg].l = a[beg].u = rope_insert_run(rope, l, a[beg].c, 1, &cache);
				beg = k;
				continue;
			} else if (l == u) {
				memset(tl, 0, 48);
				memset(tu, 0, 48);
			} else rope_rank2a(rope, l, u, tl, tu);
			memset(c, 0, 48);
			for (i = beg; i < k; ++i) ++c[a[i].c];
			// insert sentinel
			if (c[0]) rope_insert_run(rope, l, 0, c[0], &cache);
			// insert A/C/G/T
			x =  l + c[0] + (tu[0] - tl[0]);
			if (is_comp) start = 4, end = 0, step = -1;
			else start = 1, end = 5, step = 1;
			for (b = start; b != end; b += step) {
				int64_t size = tu[b] - tl[b];
				if (c[b]) {
					tl[b] = rope_insert_run(rope, x, b, c[b], &cache);
					tu[b] = tl[b] + size;
				}
				x += c[b] + size;
			}
			// insert N
			if (c[5]) {
				tu[5] -= tl[5];
				tl[5] = rope_insert_run(rope, x, 5, c[5], &cache);
				tu[5] += tl[5];
			}
			// update a[]
			for (i = beg; i < k; ++i) {
				triple64_t *p = &a[i];
				p->l = tl[p->c], p->u = tu[p->c];
			}
			beg = k;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x2110
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0xaf56
movq -0x18(%rbp), %rcx
imulq $0x18, -0x28(%rbp), %rax
addq %rax, %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movzbl (%rax), %eax
movl %eax, %edx
movq -0x18(%rbp), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
andq $0x7, %rdx
shlq $0x3d, %rdx
movabsq $0x1fffffffffffffff, %rsi # imm = 0x1FFFFFFFFFFFFFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xaef2
movq $0x1, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
jg 0xb3e0
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0xafc2
movq -0x18(%rbp), %rcx
imulq $0x18, -0x28(%rbp), %rax
addq %rax, %rcx
movabsq $0x1fffffffffffffff, %rax # imm = 0x1FFFFFFFFFFFFFFF
andq 0x8(%rcx), %rax
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
subq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rdx
movabsq $0x1fffffffffffffff, %rcx # imm = 0x1FFFFFFFFFFFFFFF
andq 0x8(%rdx), %rcx
cmpq %rcx, %rax
je 0xb3cd
movq -0x18(%rbp), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rcx
imulq $0x18, -0x30(%rbp), %rax
addq %rax, %rcx
movabsq $0x1fffffffffffffff, %rax # imm = 0x1FFFFFFFFFFFFFFF
andq 0x8(%rcx), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
jne 0xb09d
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0xb09d
movq -0x8(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x18(%rbp), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shrq $0x3d, %rax
movl %eax, %edx
movl $0x1, %ecx
leaq -0x70(%rbp), %r8
callq 0x22600
movq %rax, %rcx
movq -0x18(%rbp), %rax
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rax
movq 0x8(%rax), %rdx
movabsq $0x1fffffffffffffff, %rsi # imm = 0x1FFFFFFFFFFFFFFF
andq %rsi, %rcx
movabsq $-0x2000000000000000, %rsi # imm = 0xE000000000000000
andq %rsi, %rdx
orq %rcx, %rdx
movq %rdx, 0x8(%rax)
movq -0x18(%rbp), %rax
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xb3cf
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
jne 0xb0d5
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2110
leaq -0xf0(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2110
jmp 0xb0fa
movq -0x8(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
leaq -0xf0(%rbp), %r8
callq 0x22ed0
jmp 0xb0fc
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2110
movq -0x30(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0xb157
movq -0x18(%rbp), %rax
imulq $0x18, -0x80(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shrq $0x3d, %rax
movq -0x120(%rbp,%rax,8), %rcx
addq $0x1, %rcx
movq %rcx, -0x120(%rbp,%rax,8)
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0xb117
cmpq $0x0, -0x120(%rbp)
je 0xb17e
movq -0x8(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x120(%rbp), %rcx
xorl %edx, %edx
leaq -0x70(%rbp), %r8
callq 0x22600
movq -0x88(%rbp), %rax
addq -0x120(%rbp), %rax
movq -0xf0(%rbp), %rcx
subq -0xc0(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0xb1c7
movl $0x4, -0x124(%rbp)
movl $0x0, -0x128(%rbp)
movl $0xffffffff, -0x12c(%rbp) # imm = 0xFFFFFFFF
jmp 0xb1e5
movl $0x1, -0x124(%rbp)
movl $0x5, -0x128(%rbp)
movl $0x1, -0x12c(%rbp)
movl -0x124(%rbp), %eax
movl %eax, -0x130(%rbp)
movl -0x130(%rbp), %eax
cmpl -0x128(%rbp), %eax
je 0xb2cc
movslq -0x130(%rbp), %rax
movq -0xf0(%rbp,%rax,8), %rax
movslq -0x130(%rbp), %rcx
subq -0xc0(%rbp,%rcx,8), %rax
movq %rax, -0x138(%rbp)
movslq -0x130(%rbp), %rax
cmpq $0x0, -0x120(%rbp,%rax,8)
je 0xb297
movq -0x8(%rbp), %rdi
movq -0x78(%rbp), %rsi
movl -0x130(%rbp), %edx
movslq -0x130(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rcx
leaq -0x70(%rbp), %r8
callq 0x22600
movq %rax, %rcx
movslq -0x130(%rbp), %rax
movq %rcx, -0xc0(%rbp,%rax,8)
movslq -0x130(%rbp), %rax
movq -0xc0(%rbp,%rax,8), %rcx
addq -0x138(%rbp), %rcx
movslq -0x130(%rbp), %rax
movq %rcx, -0xf0(%rbp,%rax,8)
movslq -0x130(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
addq -0x138(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x12c(%rbp), %eax
addl -0x130(%rbp), %eax
movl %eax, -0x130(%rbp)
jmp 0xb1f1
cmpq $0x0, -0xf8(%rbp)
je 0xb327
movq -0x98(%rbp), %rcx
movq -0xc8(%rbp), %rax
subq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0xf8(%rbp), %rcx
movl $0x5, %edx
leaq -0x70(%rbp), %r8
callq 0x22600
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
addq -0xc8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0xb3c5
movq -0x18(%rbp), %rax
imulq $0x18, -0x80(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x3d, %rax
movq -0xc0(%rbp,%rax,8), %rcx
movq -0x140(%rbp), %rax
movq %rcx, (%rax)
movq -0x140(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x3d, %rax
movq -0xf0(%rbp,%rax,8), %rdx
movq -0x140(%rbp), %rax
movq 0x8(%rax), %rcx
movabsq $0x1fffffffffffffff, %rsi # imm = 0x1FFFFFFFFFFFFFFF
andq %rsi, %rdx
movabsq $-0x2000000000000000, %rsi # imm = 0xE000000000000000
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x8(%rax)
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0xb32f
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xb3cf
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xaf66
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax)