// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi-lite/mrope.c
// Function: mr_insert1
int64_t mr_insert1(mrope_t *r, const uint8_t *str)
{
	int64_t tl[6], tu[6], l, u;
	const uint8_t *p;
	int b, is_srt = (r->so != MR_SO_IO), is_comp = (r->so == MR_SO_RCLO);
	for (u = 0, b = 0; b != 6; ++b) u += r->r[b]->c[0];
	l = is_srt? 0 : u;
	for (p = str, b = 0; *p; b = *p++) {
		int a;
		if (l != u) {
			int64_t cnt = 0;
			rope_rank2a(r->r[b], l, u, tl, tu);
			if (is_comp && *p != 5) {
				for (a = 4; a > *p; --a) l += tu[a] - tl[a];
				l += tu[0] - tl[0];
			} else for (a = 0; a < *p; ++a) l += tu[a] - tl[a];
			rope_insert_run(r->r[b], l, *p, 1, 0);
			while (--b >= 0) cnt += r->r[b]->c[*p];
			l = cnt + tl[*p]; u = cnt + tu[*p];
		} else {
			l = rope_insert_run(r->r[b], l, *p, 1, 0);
			while (--b >= 0) l += r->r[b]->c[*p];
			u = l;
		}
	}
	return rope_insert_run(r->r[b], l, 0, 1, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x90(%rbp)
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x94(%rbp)
movq $0x0, -0x80(%rbp)
movl $0x0, -0x8c(%rbp)
cmpl $0x6, -0x8c(%rbp)
je 0x9d3b
movq -0x8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
addq -0x80(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x9d05
cmpl $0x0, -0x90(%rbp)
je 0x9d4f
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
jmp 0x9d5a
movq -0x80(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
movl $0x0, -0x8c(%rbp)
movq -0x88(%rbp), %rax
cmpb $0x0, (%rax)
je 0x9fd3
movq -0x78(%rbp), %rax
cmpq -0x80(%rbp), %rax
je 0x9f38
movq $0x0, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdx
leaq -0x40(%rbp), %rcx
leaq -0x70(%rbp), %r8
callq 0x22ed0
cmpl $0x0, -0x94(%rbp)
je 0x9e41
movq -0x88(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5, %eax
je 0x9e41
movl $0x4, -0x98(%rbp)
movl -0x98(%rbp), %eax
movq -0x88(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jle 0x9e2f
movslq -0x98(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rax
movslq -0x98(%rbp), %rcx
subq -0x40(%rbp,%rcx,8), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x98(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x9dea
movq -0x70(%rbp), %rax
subq -0x40(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x9e92
movl $0x0, -0x98(%rbp)
movl -0x98(%rbp), %eax
movq -0x88(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x9e90
movslq -0x98(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rax
movslq -0x98(%rbp), %rcx
subq -0x40(%rbp,%rcx,8), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x9e4b
jmp 0x9e92
movq -0x8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x78(%rbp), %rsi
movq -0x88(%rbp), %rax
movzbl (%rax), %edx
movl $0x1, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x22600
movl -0x8c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, %eax
jl 0x9f02
movq -0x8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq -0x88(%rbp), %rcx
movzbl (%rcx), %ecx
movq 0x8(%rax,%rcx,8), %rax
addq -0xa0(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0x9ebf
movq -0xa0(%rbp), %rax
movq -0x88(%rbp), %rcx
movzbl (%rcx), %ecx
addq -0x40(%rbp,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq -0xa0(%rbp), %rax
movq -0x88(%rbp), %rcx
movzbl (%rcx), %ecx
addq -0x70(%rbp,%rcx,8), %rax
movq %rax, -0x80(%rbp)
jmp 0x9fae
movq -0x8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x78(%rbp), %rsi
movq -0x88(%rbp), %rax
movzbl (%rax), %edx
movl $0x1, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x22600
movq %rax, -0x78(%rbp)
movl -0x8c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, %eax
jl 0x9fa6
movq -0x8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq -0x88(%rbp), %rcx
movzbl (%rcx), %ecx
movq 0x8(%rax,%rcx,8), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x9f69
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x9fb0
movq -0x88(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x88(%rbp)
movzbl (%rax), %eax
movl %eax, -0x8c(%rbp)
jmp 0x9d7a
movq -0x8(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x78(%rbp), %rsi
xorl %edx, %edx
movl $0x1, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x22600
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)