	.file	"extr_core-card.c_fw_core_add_descriptor.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	fw_core_add_descriptor
	.type	fw_core_add_descriptor, @function
fw_core_add_descriptor:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	mov	rbx, rdi
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	mov	rcx, QWORD PTR [rdi]
	test	rcx, rcx
	je	.L2
	mov	rsi, QWORD PTR 8[rdi]
	xor	edx, edx
	.p2align 4,,10
	.p2align 3
.L3:
	movsx	eax, WORD PTR 2[rsi+rdx*4]
	add	eax, 1
	cdqe
	add	rdx, rax
	cmp	rcx, rdx
	ja	.L3
	je	.L2
	mov	r12d, DWORD PTR EINVAL[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbx
	.cfi_def_cfa_offset 16
	neg	r12d
	mov	eax, r12d
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	lea	rdi, card_mutex[rip]
	call	mutex_lock@PLT
	mov	rdi, rbx
	call	required_space@PLT
	add	eax, DWORD PTR config_rom_length[rip]
	cmp	eax, 256
	jle	.L5
	mov	r12d, DWORD PTR EBUSY[rip]
	neg	r12d
.L6:
	lea	rdi, card_mutex[rip]
	call	mutex_unlock@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	lea	rdi, 24[rbx]
	lea	rsi, descriptor_list[rip]
	call	list_add_tail@PLT
	mov	rdi, rbx
	call	required_space@PLT
	add	DWORD PTR config_rom_length[rip], eax
	cmp	QWORD PTR 16[rbx], 0
	mov	eax, DWORD PTR descriptor_count[rip]
	lea	edx, 1[rax]
	mov	DWORD PTR descriptor_count[rip], edx
	jle	.L7
	add	eax, 2
	mov	DWORD PTR descriptor_count[rip], eax
.L7:
	xor	eax, eax
	xor	r12d, r12d
	call	update_config_roms@PLT
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	fw_core_add_descriptor, .-fw_core_add_descriptor
	.comm	descriptor_list,4,4
	.comm	descriptor_count,4,4
	.comm	config_rom_length,4,4
	.comm	card_mutex,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_core-card.c_fw_core_add_descriptor.c"
	.text
	.align	2
	.global	fw_core_add_descriptor
	.syntax unified
	.arm
	.fpu softvfp
	.type	fw_core_add_descriptor, %function
fw_core_add_descriptor:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	r1, [r0]
	push	{r4, r5, r6, lr}
	cmp	r1, #0
	mov	r4, r0
	beq	.L2
	mov	r3, #0
	ldr	ip, [r0, #4]
.L3:
	ldr	r2, [ip, r3, lsl #2]
	add	r3, r3, r2, asr #16
	add	r3, r3, #1
	cmp	r1, r3
	bhi	.L3
	beq	.L2
	ldr	r3, .L14
	ldr	r4, [r3]
	rsb	r4, r4, #0
	mov	r0, r4
	pop	{r4, r5, r6, pc}
.L2:
	ldr	r0, .L14+4
	bl	mutex_lock
	mov	r0, r4
	bl	required_space
	ldr	r5, .L14+8
	ldr	r3, [r5]
	add	r0, r0, r3
	cmp	r0, #256
	ble	.L5
	ldr	r3, .L14+12
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L6:
	ldr	r0, .L14+4
	bl	mutex_unlock
	mov	r0, r4
	pop	{r4, r5, r6, pc}
.L5:
	ldr	r1, .L14+16
	add	r0, r4, #12
	bl	list_add_tail
	mov	r0, r4
	bl	required_space
	ldr	r1, .L14+20
	ldr	ip, [r4, #8]
	ldr	r2, [r1]
	ldr	r3, [r5]
	cmp	ip, #0
	add	r3, r3, r0
	add	r0, r2, #1
	addgt	r2, r2, #2
	str	r0, [r1]
	str	r3, [r5]
	strgt	r2, [r1]
	mov	r4, #0
	bl	update_config_roms
	b	.L6
.L15:
	.align	2
.L14:
	.word	EINVAL
	.word	card_mutex
	.word	config_rom_length
	.word	EBUSY
	.word	descriptor_list
	.word	descriptor_count
	.size	fw_core_add_descriptor, .-fw_core_add_descriptor
	.comm	descriptor_list,4,4
	.comm	descriptor_count,4,4
	.comm	config_rom_length,4,4
	.comm	card_mutex,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
