// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi-lite/mrope.c
// Function: mr_rank2a
void mr_rank2a(const mrope_t *mr, int64_t x, int64_t y, int64_t *cx, int64_t *cy)
{
	int a, b;
	int64_t z, c[6], l;
	memset(c, 0, 48);
	for (a = 0, z = 0; a < 6; ++a) {
		const int64_t *ca = mr->r[a]->c;
		l = ca[0] + ca[1] + ca[2] + ca[3] + ca[4] + ca[5];
		if (z + l >= x) break;
		for (b = 0; b < 6; ++b) c[b] += ca[b];
		z += l;
	}
	assert(a != 6);
	if (y >= 0 && z + l >= y) { // [x,y) is in the same bucket
		rope_rank2a(mr->r[a], x - z, y - z, cx, cy);
		for (b = 0; b < 6; ++b)
			cx[b] += c[b], cy[b] += c[b];
		return;
	}
	if (x != z) rope_rank1a(mr->r[a], x - z, cx);
	else memset(cx, 0, 48);
	for (b = 0; b < 6; ++b)
		cx[b] += c[b], c[b] += mr->r[a]->c[b];
	if (y < 0) return;
	for (++a, z += l; a < 6; ++a) {
		const int64_t *ca = mr->r[a]->c;
		l = ca[0] + ca[1] + ca[2] + ca[3] + ca[4] + ca[5];
		if (z + l >= y) break;
		for (b = 0; b < 6; ++b) c[b] += ca[b];
		z += l;
	}
	assert(a != 6);
	if (y != z + l) rope_rank1a(mr->r[a], y - z, cy);
	else for (b = 0; b < 6; ++b) cy[b] = mr->r[a]->c[b];
	for (b = 0; b < 6; ++b) cy[b] += c[b];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2110
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
cmpl $0x6, -0x2c(%rbp)
jge 0xa0fc
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
addq $0x8, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq -0x80(%rbp), %rcx
addq 0x8(%rcx), %rax
movq -0x80(%rbp), %rcx
addq 0x10(%rcx), %rax
movq -0x80(%rbp), %rcx
addq 0x18(%rcx), %rax
movq -0x80(%rbp), %rcx
addq 0x20(%rcx), %rax
movq -0x80(%rbp), %rcx
addq 0x28(%rcx), %rax
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rax
addq -0x78(%rbp), %rax
cmpq -0x10(%rbp), %rax
jl 0xa0b0
jmp 0xa0fc
movl $0x0, -0x30(%rbp)
cmpl $0x6, -0x30(%rbp)
jge 0xa0e2
movq -0x80(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x30(%rbp), %rax
addq -0x70(%rbp,%rax,8), %rcx
movq %rcx, -0x70(%rbp,%rax,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa0b7
movq -0x78(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xa04e
cmpl $0x6, -0x2c(%rbp)
je 0xa104
jmp 0xa123
leaq 0x1b47f(%rip), %rdi     # 0x2558a
leaq 0x1b450(%rip), %rsi     # 0x25562
movl $0x52, %edx
leaq 0x1b473(%rip), %rcx     # 0x25591
callq 0x20f0
cmpq $0x0, -0x18(%rbp)
jl 0xa1b5
movq -0x38(%rbp), %rax
addq -0x78(%rbp), %rax
cmpq -0x18(%rbp), %rax
jl 0xa1b5
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rsi
subq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rdx
subq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x22ed0
movl $0x0, -0x30(%rbp)
cmpl $0x6, -0x30(%rbp)
jge 0xa1b0
movslq -0x30(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rdx
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movslq -0x30(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rdx
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa16d
jmp 0xa408
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0xa1eb
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rsi
subq -0x38(%rbp), %rsi
movq -0x20(%rbp), %rcx
movq $-0x1, %rdx
xorl %eax, %eax
movl %eax, %r8d
callq 0x22ed0
jmp 0xa1fb
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2110
movl $0x0, -0x30(%rbp)
cmpl $0x6, -0x30(%rbp)
jge 0xa250
movslq -0x30(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rdx
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rcx
movslq -0x30(%rbp), %rax
addq -0x70(%rbp,%rax,8), %rcx
movq %rcx, -0x70(%rbp,%rax,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa202
cmpq $0x0, -0x18(%rbp)
jge 0xa25c
jmp 0xa408
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x78(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x6, -0x2c(%rbp)
jge 0xa337
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
addq $0x8, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq (%rax), %rax
movq -0x88(%rbp), %rcx
addq 0x8(%rcx), %rax
movq -0x88(%rbp), %rcx
addq 0x10(%rcx), %rax
movq -0x88(%rbp), %rcx
addq 0x18(%rcx), %rax
movq -0x88(%rbp), %rcx
addq 0x20(%rcx), %rax
movq -0x88(%rbp), %rcx
addq 0x28(%rcx), %rax
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rax
addq -0x78(%rbp), %rax
cmpq -0x18(%rbp), %rax
jl 0xa2e8
jmp 0xa337
movl $0x0, -0x30(%rbp)
cmpl $0x6, -0x30(%rbp)
jge 0xa31d
movq -0x88(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x30(%rbp), %rax
addq -0x70(%rbp,%rax,8), %rcx
movq %rcx, -0x70(%rbp,%rax,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa2ef
movq -0x78(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xa271
cmpl $0x6, -0x2c(%rbp)
je 0xa33f
jmp 0xa35e
leaq 0x1b244(%rip), %rdi     # 0x2558a
leaq 0x1b215(%rip), %rsi     # 0x25562
movl $0x65, %edx
leaq 0x1b238(%rip), %rcx     # 0x25591
callq 0x20f0
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
addq -0x78(%rbp), %rcx
cmpq %rcx, %rax
je 0xa39b
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x18(%rbp), %rsi
subq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rcx
movq $-0x1, %rdx
xorl %eax, %eax
movl %eax, %r8d
callq 0x22ed0
jmp 0xa3d7
movl $0x0, -0x30(%rbp)
cmpl $0x6, -0x30(%rbp)
jge 0xa3d5
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdx
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa3a2
jmp 0xa3d7
movl $0x0, -0x30(%rbp)
cmpl $0x6, -0x30(%rbp)
jge 0xa408
movslq -0x30(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rdx
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa3de
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)