	.file	"extr_mr.c_rvt_lkey_ok.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	rvt_lkey_ok
	.type	rvt_lkey_ok, @function
rvt_lkey_ok:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rdx
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rcx
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, r8
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rsi
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	cmp	QWORD PTR [r8], 0
	jne	.L2
	mov	edi, DWORD PTR [rsi]
	call	ib_to_rvt@PLT
	cmp	QWORD PTR 8[rbx], 0
	mov	r14, rax
	je	.L3
.L32:
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	r14, rdi
	mov	rsi, r8
	mov	rdi, rcx
	mov	r15d, r9d
	call	rvt_sge_adjacent@PLT
	test	rax, rax
	je	.L34
.L9:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	mov	rsi, rbp
	mov	rdi, r12
	call	rvt_sge_adjacent@PLT
	test	rax, rax
	jne	.L9
	xor	eax, eax
	call	rcu_read_lock@PLT
	mov	edi, DWORD PTR [r14]
	call	rcu_dereference@PLT
	mov	rbx, rax
	test	rax, rax
	je	.L7
	mov	rdi, rax
	call	rvt_get_mr@PLT
	xor	eax, eax
	call	rcu_read_unlock@PLT
	mov	rax, QWORD PTR 8[rbp]
	mov	QWORD PTR 32[r13], rbx
	mov	QWORD PTR 24[r13], rax
	mov	rax, QWORD PTR 16[rbp]
	mov	QWORD PTR 16[r13], 0
	mov	QWORD PTR 0[r13], rax
	mov	QWORD PTR 8[r13], rax
.L8:
	mov	rsi, rbp
	mov	rdi, r13
	call	trace_rvt_sge_new@PLT
	mov	eax, 1
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L34:
	call	rcu_read_lock@PLT
	mov	rcx, QWORD PTR [r14]
	mov	rax, QWORD PTR 0[rbp]
	mov	rdx, QWORD PTR 8[r14]
	sar	rax, cl
	mov	edi, DWORD PTR [rdx+rax*4]
	call	rcu_dereference@PLT
	mov	r12, rax
	test	rax, rax
	je	.L7
	mov	rdi, rax
	call	rvt_get_mr@PLT
	mov	edi, DWORD PTR 60[r12]
	call	READ_ONCE@PLT
	test	eax, eax
	je	.L11
	lea	rdi, 56[r12]
	call	atomic_read@PLT
	mov	edi, 1
	test	rax, rax
	je	.L35
.L12:
	call	unlikely@PLT
	test	rax, rax
	jne	.L11
	mov	rdx, QWORD PTR 8[rbp]
	mov	rax, QWORD PTR 8[r12]
	mov	edi, 1
	mov	rbx, rdx
	sub	rbx, rax
	cmp	rdx, rax
	jb	.L13
	mov	rax, QWORD PTR 16[rbp]
	add	rax, rbx
	cmp	rax, QWORD PTR 16[r12]
	ja	.L13
	mov	eax, DWORD PTR 24[r12]
	xor	edi, edi
	and	eax, r15d
	cmp	eax, r15d
	setne	dil
.L13:
	call	unlikely@PLT
	test	rax, rax
	je	.L36
	.p2align 4,,10
	.p2align 3
.L11:
	mov	rdi, r12
	call	rvt_put_mr@PLT
.L7:
	xor	eax, eax
	call	rcu_read_unlock@PLT
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L35:
	mov	rax, QWORD PTR 0[rbp]
	cmp	QWORD PTR [r12], rax
	jne	.L12
	xor	edi, edi
	cmp	QWORD PTR 48[r12], rbx
	setne	dil
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	call	rcu_read_unlock@PLT
	mov	ecx, DWORD PTR 28[r12]
	add	rbx, QWORD PTR 40[r12]
	mov	rdi, rbx
	test	ecx, ecx
	jne	.L14
	mov	r10, QWORD PTR 32[r12]
	mov	rax, QWORD PTR [r10]
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR [rdx]
	cmp	rbx, rax
	jb	.L37
	mov	r11, QWORD PTR RVT_SEGSZ[rip]
	xor	r9d, r9d
	xor	r8d, r8d
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L38:
	sal	rax, 4
	mov	rsi, rax
.L18:
	mov	eax, r9d
	lea	rcx, [r10+rax*8]
	mov	rax, QWORD PTR [rcx]
	mov	rdx, QWORD PTR [rax]
	add	rdx, rsi
	mov	rax, QWORD PTR [rdx]
	cmp	rax, rdi
	ja	.L16
.L19:
	sub	rdi, rax
	lea	eax, 1[r8]
	mov	r8, rax
	cmp	rax, r11
	jb	.L38
	add	r9d, 1
	xor	esi, esi
	xor	r8d, r8d
	jmp	.L18
.L37:
	mov	rcx, r10
	xor	esi, esi
	xor	r9d, r9d
	xor	r8d, r8d
	.p2align 4,,10
	.p2align 3
.L16:
	mov	rax, QWORD PTR 8[rdx]
	mov	QWORD PTR 32[r13], r12
	add	rax, rdi
	mov	QWORD PTR 24[r13], rax
	mov	rax, QWORD PTR [rcx]
	mov	rax, QWORD PTR [rax]
	mov	rax, QWORD PTR [rax+rsi]
	sub	rax, rdi
	mov	QWORD PTR 0[r13], rax
	mov	rax, QWORD PTR 16[rbp]
	mov	DWORD PTR 16[r13], r9d
	mov	QWORD PTR 8[r13], rax
	mov	DWORD PTR 20[r13], r8d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L14:
	mov	rax, rbx
	shr	rax, cl
	mov	rdx, rax
	sal	rdx, cl
	sub	rdi, rdx
	xor	edx, edx
	div	QWORD PTR RVT_SEGSZ[rip]
	mov	esi, edx
	mov	r8d, edx
	mov	rdx, QWORD PTR 32[r12]
	mov	r9d, eax
	mov	eax, eax
	sal	rsi, 4
	lea	rcx, [rdx+rax*8]
	mov	rax, QWORD PTR [rcx]
	mov	rdx, QWORD PTR [rax]
	add	rdx, rsi
	jmp	.L16
	.cfi_endproc
.LFE0:
	.size	rvt_lkey_ok, .-rvt_lkey_ok
	.comm	RVT_SEGSZ,8,8
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_mr.c_rvt_lkey_ok.c"
	.text
	.global	__aeabi_uidivmod
	.align	2
	.global	rvt_lkey_ok
	.syntax unified
	.arm
	.fpu softvfp
	.type	rvt_lkey_ok, %function
rvt_lkey_ok:
	@ args = 8, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r7, [sp, #32]
	mov	r4, r1
	ldr	ip, [r7]
	mov	r6, r2
	cmp	ip, #0
	mov	r5, r3
	bne	.L2
	ldr	r0, [r1]
	bl	ib_to_rvt
	ldr	r3, [r4, #4]
	mov	r4, r0
	cmp	r3, #0
	beq	.L3
.L32:
	ldr	r3, .L37
	ldr	r0, [r3]
	rsb	r0, r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L2:
	mov	r8, r0
	mov	r1, r7
	mov	r0, r3
	bl	rvt_sge_adjacent
	cmp	r0, #0
	beq	.L34
.L9:
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L3:
	mov	r0, r5
	mov	r1, r7
	bl	rvt_sge_adjacent
	subs	r5, r0, #0
	bne	.L9
	bl	rcu_read_lock
	ldr	r0, [r4]
	bl	rcu_dereference
	subs	r4, r0, #0
	beq	.L7
	bl	rvt_get_mr
	bl	rcu_read_unlock
	ldmib	r7, {r2, r3}
	stmib	r6, {r3, r5}
	str	r4, [r6, #20]
	str	r2, [r6, #16]
	str	r3, [r6]
	str	r5, [r6, #12]
.L8:
	mov	r1, r7
	mov	r0, r6
	bl	trace_rvt_sge_new
	mov	r0, #1
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L34:
	bl	rcu_read_lock
	ldm	r8, {r1, r2}
	ldr	r3, [r7]
	asr	r3, r3, r1
	ldr	r0, [r2, r3, lsl #2]
	bl	rcu_dereference
	subs	r5, r0, #0
	beq	.L7
	bl	rvt_get_mr
	ldr	r0, [r5, #36]
	bl	READ_ONCE
	cmp	r0, #0
	beq	.L11
	add	r0, r5, #32
	bl	atomic_read
	cmp	r0, #0
	beq	.L35
.L21:
	mov	r0, #1
.L12:
	bl	unlikely
	cmp	r0, #0
	bne	.L11
	ldr	r4, [r7, #4]
	ldr	r3, [r5, #4]
	cmp	r4, r3
	sub	r4, r4, r3
	bcs	.L36
.L23:
	mov	r0, #1
.L13:
	bl	unlikely
	cmp	r0, #0
	bne	.L11
	bl	rcu_read_unlock
	ldr	r2, [r5, #16]
	ldr	r3, [r5, #24]
	cmp	r2, #0
	add	r4, r4, r3
	bne	.L14
	ldr	lr, [r5, #20]
	ldr	r3, [lr]
	ldr	r3, [r3]
	ldr	ip, [r3]
	cmp	r4, ip
	movcc	r8, lr
	movcc	r0, r2
	movcc	r1, r2
	bcc	.L16
	mov	r0, r2
	mov	r1, r2
	ldr	r3, .L37+4
	ldr	r9, [r3]
.L19:
	add	r1, r1, #1
	cmp	r9, r1
	movls	r1, #0
	movls	r2, r1
	addls	r0, r0, #1
	ldr	r3, [lr, r0, lsl #2]
	lslhi	r2, r1, #3
	ldr	r3, [r3]
	sub	r4, r4, ip
	ldr	ip, [r3, r2]
	add	r8, lr, r0, lsl #2
	cmp	ip, r4
	add	r3, r3, r2
	bls	.L19
.L16:
	ldr	r3, [r3, #4]
	ldr	ip, [r7, #8]
	add	r3, r3, r4
	str	r3, [r6, #16]
	ldr	r3, [r8]
	str	r5, [r6, #20]
	ldr	r3, [r3]
	ldr	r3, [r3, r2]
	str	ip, [r6, #4]
	sub	r4, r3, r4
	str	r4, [r6]
	str	r0, [r6, #8]
	str	r1, [r6, #12]
	b	.L8
.L11:
	mov	r0, r5
	bl	rvt_put_mr
.L7:
	bl	rcu_read_unlock
	b	.L32
.L35:
	ldr	r2, [r5]
	ldr	r3, [r7]
	cmp	r2, r3
	bne	.L21
	ldr	r0, [r5, #28]
	subs	r0, r0, r4
	movne	r0, #1
	b	.L12
.L36:
	ldr	r3, [r7, #8]
	ldr	r2, [r5, #8]
	add	r3, r4, r3
	cmp	r3, r2
	bhi	.L23
	ldr	r3, [r5, #12]
	ldr	r2, [sp, #36]
	bics	r3, r2, r3
	movne	r0, #1
	moveq	r0, #0
	b	.L13
.L14:
	ldr	r3, .L37+4
	lsr	r0, r4, r2
	ldr	r1, [r3]
	sub	r4, r4, r0, lsl r2
	bl	__aeabi_uidivmod
	ldr	r8, [r5, #20]
	lsl	r2, r1, #3
	ldr	r3, [r8, r0, lsl #2]
	add	r8, r8, r0, lsl #2
	ldr	r3, [r3]
	add	r3, r3, r1, lsl #3
	b	.L16
.L38:
	.align	2
.L37:
	.word	EINVAL
	.word	RVT_SEGSZ
	.size	rvt_lkey_ok, .-rvt_lkey_ok
	.comm	RVT_SEGSZ,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
