	.file	"extr_nhi.c_nhi_alloc_hop.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"invalid hop: %d\n"
.LC1:
	.string	"TX hop %d already allocated\n"
.LC2:
	.string	"RX hop %d already allocated\n"
	.text
	.p2align 4
	.type	nhi_alloc_hop, @function
nhi_alloc_hop:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	lea	r12, 4[rdi]
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rsi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	rbx, rdi
	mov	rdi, r12
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	spin_lock_irq@PLT
	mov	edx, DWORD PTR 0[rbp]
	cmp	edx, DWORD PTR [rbx]
	jnb	.L9
	mov	eax, edx
	sal	rax, 3
	cmp	QWORD PTR 8[rbp], 0
	je	.L4
	add	rax, QWORD PTR 16[rbx]
	cmp	QWORD PTR [rax], 0
	jne	.L10
.L6:
	mov	QWORD PTR [rax], rbp
	xor	r13d, r13d
.L3:
	mov	rdi, r12
	call	spin_unlock_irq@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r13d
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	add	rax, QWORD PTR 8[rbx]
	cmp	QWORD PTR [rax], 0
	je	.L6
	mov	rdi, QWORD PTR 24[rbx]
	lea	rsi, .LC2[rip]
	call	dev_warn@PLT
	mov	r13d, DWORD PTR EBUSY[rip]
	neg	r13d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L9:
	mov	rdi, QWORD PTR 24[rbx]
	lea	rsi, .LC0[rip]
	call	dev_warn@PLT
	mov	r13d, DWORD PTR EINVAL[rip]
	neg	r13d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L10:
	mov	rdi, QWORD PTR 24[rbx]
	lea	rsi, .LC1[rip]
	call	dev_warn@PLT
	mov	r13d, DWORD PTR EBUSY[rip]
	neg	r13d
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	nhi_alloc_hop, .-nhi_alloc_hop
	.comm	RING_FIRST_USABLE_HOPID,4,4
	.comm	EINVAL,4,4
	.comm	EBUSY,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_nhi.c_nhi_alloc_hop.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"invalid hop: %d\012\000"
	.align	2
.LC1:
	.ascii	"TX hop %d already allocated\012\000"
	.align	2
.LC2:
	.ascii	"RX hop %d already allocated\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	nhi_alloc_hop, %function
nhi_alloc_hop:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r4, r0
	mov	r6, r1
	add	r7, r0, #4
	mov	r0, r7
	bl	spin_lock_irq
	ldr	r2, [r6]
	ldr	r3, [r4]
	cmp	r2, r3
	bcs	.L9
	ldr	r5, [r6, #4]
	cmp	r5, #0
	beq	.L4
	ldr	r3, [r4, #12]
	ldr	r5, [r3, r2, lsl #2]
	cmp	r5, #0
	bne	.L10
.L6:
	str	r6, [r3, r2, lsl #2]
.L3:
	mov	r0, r7
	bl	spin_unlock_irq
	mov	r0, r5
	pop	{r4, r5, r6, r7, r8, pc}
.L4:
	ldr	r3, [r4, #8]
	ldr	r1, [r3, r2, lsl #2]
	cmp	r1, #0
	beq	.L6
	ldr	r0, [r4, #16]
	ldr	r1, .L11
	bl	dev_warn
	ldr	r3, .L11+4
	ldr	r5, [r3]
	rsb	r5, r5, #0
	b	.L3
.L9:
	ldr	r0, [r4, #16]
	ldr	r1, .L11+8
	bl	dev_warn
	ldr	r3, .L11+12
	ldr	r5, [r3]
	rsb	r5, r5, #0
	b	.L3
.L10:
	ldr	r0, [r4, #16]
	ldr	r1, .L11+16
	bl	dev_warn
	ldr	r3, .L11+4
	ldr	r5, [r3]
	rsb	r5, r5, #0
	b	.L3
.L12:
	.align	2
.L11:
	.word	.LC2
	.word	EBUSY
	.word	.LC0
	.word	EINVAL
	.word	.LC1
	.size	nhi_alloc_hop, .-nhi_alloc_hop
	.comm	RING_FIRST_USABLE_HOPID,4,4
	.comm	EINVAL,4,4
	.comm	EBUSY,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
