	.file	"extr_c2_mm.c_c2_nsmr_register_phys_kern.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	c2_nsmr_register_phys_kern
	.type	c2_nsmr_register_phys_kern, @function
c2_nsmr_register_phys_kern:
.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
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	r13, QWORD PTR 96[rsp]
	test	r13, r13
	je	.L2
	test	r8d, r8d
	je	.L2
	mov	r14, rsi
	test	rsi, rsi
	je	.L2
	mov	ebx, ecx
	test	ecx, ecx
	je	.L2
	cmp	DWORD PTR C2_PBL_MAX_DEPTH[rip], ecx
	mov	DWORD PTR 20[rsp], r8d
	mov	DWORD PTR [rsp], edx
	jl	.L2
	mov	rbp, rdi
	mov	r15d, r9d
	call	vq_req_alloc@PLT
	mov	edx, DWORD PTR [rsp]
	mov	r8d, DWORD PTR 20[rsp]
	test	rax, rax
	mov	QWORD PTR 8[rsp], rax
	je	.L25
	mov	esi, DWORD PTR GFP_KERNEL[rip]
	mov	edi, DWORD PTR 0[rbp]
	mov	DWORD PTR 20[rsp], r8d
	mov	DWORD PTR [rsp], edx
	call	kmalloc@PLT
	mov	edx, DWORD PTR [rsp]
	mov	r8d, DWORD PTR 20[rsp]
	test	rax, rax
	mov	r12, rax
	je	.L26
	mov	esi, DWORD PTR CCWR_NSMR_REGISTER[rip]
	mov	rdi, rax
	mov	DWORD PTR 20[rsp], r8d
	mov	DWORD PTR [rsp], edx
	call	c2_wr_set_id@PLT
	movsx	rsi, DWORD PTR 0[rbp]
	mov	rax, QWORD PTR 8[rsp]
	mov	edi, DWORD PTR MEM_VA_BASED[rip]
	or	edi, DWORD PTR MEM_REMOTE[rip]
	sub	rsi, 88
	or	edi, DWORD PTR 104[rsp]
	mov	edx, DWORD PTR [rsp]
	mov	QWORD PTR 80[r12], rax
	shr	rsi, 2
	mov	eax, DWORD PTR 4[rbp]
	mov	r8d, DWORD PTR 20[rsp]
	cmp	ebx, esi
	mov	DWORD PTR 76[r12], eax
	jg	.L9
	or	edi, DWORD PTR MEM_PBL_COMPLETE[rip]
.L9:
	mov	QWORD PTR 24[rsp], rsi
	mov	DWORD PTR 20[rsp], r8d
	mov	DWORD PTR [rsp], edx
	call	cpu_to_be16@PLT
	mov	QWORD PTR 64[r12], 0
	mov	DWORD PTR 72[r12], eax
	mov	edi, DWORD PTR 0[r13]
	call	cpu_to_be64@PLT
	mov	edx, DWORD PTR [rsp]
	mov	QWORD PTR 56[r12], rax
	mov	rax, QWORD PTR 112[rsp]
	mov	edi, edx
	mov	rax, QWORD PTR 8[rax]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR 48[r12], eax
	call	cpu_to_be32@PLT
	mov	r8d, DWORD PTR 20[rsp]
	mov	QWORD PTR 40[r12], rax
	mov	edi, r8d
	call	cpu_to_be32@PLT
	mov	edi, ebx
	mov	QWORD PTR 32[r12], rax
	call	cpu_to_be32@PLT
	mov	edi, r15d
	mov	QWORD PTR 24[r12], rax
	call	cpu_to_be32@PLT
	mov	rsi, QWORD PTR 24[rsp]
	mov	edi, ebx
	mov	QWORD PTR 16[r12], rax
	call	min@PLT
	mov	edi, eax
	mov	r15d, eax
	mov	DWORD PTR 20[rsp], eax
	call	cpu_to_be32@PLT
	mov	QWORD PTR 8[r12], rax
	mov	eax, r15d
	test	r15d, r15d
	jle	.L18
	sub	eax, 1
	xor	r15d, r15d
	mov	QWORD PTR [rsp], rax
	.p2align 4,,10
	.p2align 3
.L11:
	mov	rax, QWORD PTR [r12]
	mov	edi, DWORD PTR [r14+r15*4]
	lea	r13, [rax+r15*8]
	call	cpu_to_be64@PLT
	mov	QWORD PTR 0[r13], rax
	mov	rax, r15
	add	r15, 1
	cmp	QWORD PTR [rsp], rax
	jne	.L11
	mov	eax, DWORD PTR 20[rsp]
	mov	DWORD PTR [rsp], eax
.L10:
	mov	rsi, QWORD PTR 8[rsp]
	mov	rdi, rbp
	call	vq_req_get@PLT
	mov	rsi, r12
	mov	rdi, rbp
	call	vq_send_wr@PLT
	mov	r15d, eax
	test	eax, eax
	jne	.L27
	mov	r13, QWORD PTR 8[rsp]
	mov	rdi, rbp
	mov	rsi, r13
	call	vq_wait_for_reply@PLT
	mov	r15d, eax
	test	eax, eax
	jne	.L13
	mov	rsi, QWORD PTR 0[r13]
	test	rsi, rsi
	jne	.L14
	mov	r15d, DWORD PTR ENOMEM[rip]
	neg	r15d
.L13:
	mov	rdi, r12
	call	kfree@PLT
.L8:
	mov	rsi, QWORD PTR 8[rsp]
	mov	rdi, rbp
	call	vq_req_free@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	mov	r15d, DWORD PTR EINTR[rip]
	neg	r15d
.L1:
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r15d
	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
.L25:
	.cfi_restore_state
	mov	r15d, DWORD PTR ENOMEM[rip]
	neg	r15d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L26:
	mov	r15d, DWORD PTR ENOMEM[rip]
	neg	r15d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L27:
	mov	rsi, QWORD PTR 8[rsp]
	mov	rdi, rbp
	call	vq_req_put@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	mov	rdi, rsi
	mov	QWORD PTR 24[rsp], rsi
	call	c2_errno@PLT
	mov	rsi, QWORD PTR 24[rsp]
	test	eax, eax
	mov	r15d, eax
	jne	.L28
	mov	edi, DWORD PTR [rsi]
	mov	QWORD PTR 24[rsp], rsi
	call	be32_to_cpu@PLT
	mov	rcx, QWORD PTR 112[rsp]
	mov	rsi, QWORD PTR 24[rsp]
	mov	rdi, rbp
	mov	DWORD PTR 4[rcx], eax
	mov	DWORD PTR [rcx], eax
	call	vq_repbuf_free@PLT
	sub	ebx, DWORD PTR 20[rsp]
	je	.L17
	mov	rax, QWORD PTR 8[rsp]
	xor	esi, esi
	mov	QWORD PTR [rax], 0
	lea	rdi, 8[rax]
	call	atomic_set@PLT
	mov	rcx, QWORD PTR 112[rsp]
	mov	r13d, DWORD PTR PBL_PHYS[rip]
	mov	edi, DWORD PTR [rcx]
	call	cpu_to_be32@PLT
	mov	r8, QWORD PTR 8[rsp]
	mov	r9d, r13d
	mov	ecx, ebx
	mov	rsi, rax
	movsx	rax, DWORD PTR [rsp]
	mov	rdi, rbp
	lea	rdx, [r14+rax*4]
	call	send_pbl_messages@PLT
	test	eax, eax
	jne	.L29
.L17:
	mov	rsi, QWORD PTR 8[rsp]
	mov	rdi, rbp
	call	vq_req_free@PLT
	mov	rdi, r12
	call	kfree@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L18:
	mov	DWORD PTR [rsp], 0
	jmp	.L10
.L28:
	mov	rdi, rbp
	call	vq_repbuf_free@PLT
	jmp	.L13
.L29:
	mov	r15d, eax
	jmp	.L13
	.cfi_endproc
.LFE0:
	.size	c2_nsmr_register_phys_kern, .-c2_nsmr_register_phys_kern
	.comm	PBL_PHYS,4,4
	.comm	MEM_VA_BASED,4,4
	.comm	MEM_REMOTE,4,4
	.comm	MEM_PBL_COMPLETE,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.comm	EINTR,4,4
	.comm	CCWR_NSMR_REGISTER,4,4
	.comm	C2_PBL_MAX_DEPTH,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_c2_mm.c_c2_nsmr_register_phys_kern.c"
	.text
	.align	2
	.global	c2_nsmr_register_phys_kern
	.syntax unified
	.arm
	.fpu softvfp
	.type	c2_nsmr_register_phys_kern, %function
c2_nsmr_register_phys_kern:
	@ args = 20, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #20
	ldr	r9, [sp, #56]
	ldr	ip, [sp, #64]
	cmp	r9, #0
	cmpne	ip, #0
	beq	.L2
	cmp	r3, #0
	cmpne	r1, #0
	mov	r7, r1
	mov	r5, r3
	beq	.L2
	ldr	r3, .L29
	ldr	r3, [r3]
	cmp	r3, r5
	blt	.L2
	mov	r4, r2
	mov	r6, r0
	bl	vq_req_alloc
	subs	r10, r0, #0
	beq	.L24
	ldr	r3, .L29+4
	ldr	r0, [r6]
	ldr	r1, [r3]
	bl	kmalloc
	subs	r8, r0, #0
	beq	.L25
	ldr	r3, .L29+8
	mov	fp, #0
	ldr	r1, [r3]
	bl	c2_wr_set_id
	ldr	r1, [r6]
	ldr	r2, .L29+12
	ldr	r3, .L29+16
	ldr	r0, [r2]
	sub	r1, r1, #48
	ldr	r2, [r3]
	ldr	r3, [r6, #4]
	cmp	r5, r1, lsr #2
	str	r3, [r8, #40]
	ldrle	r3, .L29+20
	orr	r0, r0, r2
	ldr	r2, [sp, #68]
	ldrle	r3, [r3]
	orr	r0, r0, r2
	orrle	r0, r0, r3
	lsr	r1, r1, #2
	str	r10, [r8, #44]
	str	r1, [sp, #8]
	bl	cpu_to_be16
	ldr	r3, [sp, #64]
	str	r0, [r8, #36]
	ldr	r0, [r3]
	str	fp, [r8, #32]
	bl	cpu_to_be64
	ldr	r3, [sp, #72]
	ldr	r2, [r3, #8]
	str	r0, [r8, #28]
	ldr	r2, [r2]
	mov	r0, r4
	str	r2, [r8, #24]
	bl	cpu_to_be32
	mov	r2, r0
	mov	r0, r9
	str	r2, [r8, #20]
	bl	cpu_to_be32
	mov	r2, r0
	mov	r0, r5
	str	r2, [r8, #16]
	bl	cpu_to_be32
	mov	r2, r0
	ldr	r0, [sp, #60]
	str	r2, [r8, #12]
	bl	cpu_to_be32
	ldr	r1, [sp, #8]
	str	r0, [r8, #8]
	mov	r0, r5
	bl	min
	mov	r4, r0
	str	r0, [sp, #12]
	bl	cpu_to_be32
	cmp	r4, fp
	mov	r3, r4
	str	r0, [r8, #4]
	ble	.L9
	mov	r4, fp
	mov	r9, r7
	lsl	r3, r3, #2
	str	r3, [sp, #8]
.L10:
	ldr	r0, [r9], #4
	ldr	fp, [r8]
	bl	cpu_to_be64
	ldr	r3, [sp, #8]
	str	r0, [fp, r4]
	add	r4, r4, #4
	cmp	r4, r3
	bne	.L10
	ldr	fp, [sp, #12]
.L9:
	mov	r1, r10
	mov	r0, r6
	bl	vq_req_get
	mov	r1, r8
	mov	r0, r6
	bl	vq_send_wr
	subs	r4, r0, #0
	mov	r1, r10
	mov	r0, r6
	bne	.L26
	bl	vq_wait_for_reply
	subs	r4, r0, #0
	bne	.L12
	ldr	r1, [r10]
	cmp	r1, #0
	bne	.L13
	ldr	r3, .L29+24
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L12:
	mov	r0, r8
	bl	kfree
.L7:
	mov	r1, r10
	mov	r0, r6
	bl	vq_req_free
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L2:
	ldr	r3, .L29+28
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L1:
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L24:
	ldr	r3, .L29+24
	ldr	r4, [r3]
	rsb	r4, r4, #0
	b	.L1
.L25:
	ldr	r3, .L29+24
	ldr	r4, [r3]
	rsb	r4, r4, #0
	b	.L7
.L26:
	bl	vq_req_put
	b	.L12
.L13:
	mov	r0, r1
	str	r1, [sp, #8]
	bl	c2_errno
	subs	r4, r0, #0
	ldr	r1, [sp, #8]
	bne	.L27
	ldr	r0, [r1]
	str	r1, [sp, #8]
	bl	be32_to_cpu
	ldr	r3, [sp, #72]
	ldr	r1, [sp, #8]
	str	r0, [r3, #4]
	str	r0, [r3]
	mov	r0, r6
	bl	vq_repbuf_free
	ldr	r3, [sp, #12]
	subs	r5, r5, r3
	beq	.L16
	mov	r0, r10
	mov	r1, r4
	str	r4, [r0], #4
	bl	atomic_set
	ldr	r3, [sp, #72]
	ldr	r0, [r3]
	bl	cpu_to_be32
	ldr	r3, .L29+32
	mov	r1, r0
	ldr	r0, [r3]
	add	r2, r7, fp, lsl #2
	str	r0, [sp, #4]
	mov	r3, r5
	mov	r0, r6
	str	r10, [sp]
	bl	send_pbl_messages
	cmp	r0, #0
	bne	.L28
.L16:
	mov	r1, r10
	mov	r0, r6
	bl	vq_req_free
	mov	r0, r8
	bl	kfree
	b	.L1
.L27:
	mov	r0, r6
	bl	vq_repbuf_free
	b	.L12
.L28:
	mov	r4, r0
	b	.L12
.L30:
	.align	2
.L29:
	.word	C2_PBL_MAX_DEPTH
	.word	GFP_KERNEL
	.word	CCWR_NSMR_REGISTER
	.word	MEM_VA_BASED
	.word	MEM_REMOTE
	.word	MEM_PBL_COMPLETE
	.word	ENOMEM
	.word	EINTR
	.word	PBL_PHYS
	.size	c2_nsmr_register_phys_kern, .-c2_nsmr_register_phys_kern
	.comm	PBL_PHYS,4,4
	.comm	MEM_VA_BASED,4,4
	.comm	MEM_REMOTE,4,4
	.comm	MEM_PBL_COMPLETE,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.comm	EINTR,4,4
	.comm	CCWR_NSMR_REGISTER,4,4
	.comm	C2_PBL_MAX_DEPTH,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
