	.file	"extr_af_hdcd.c_hdcd_scan.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	hdcd_scan, @function
hdcd_scan:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	.cfi_offset 15, -24
	mov	r15d, edx
	push	r14
	.cfi_offset 14, -32
	mov	r14d, r9d
	push	r13
	.cfi_offset 13, -40
	mov	r13d, r8d
	push	r12
	push	rbx
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	mov	rbx, rcx
	sub	rsp, 56
	mov	QWORD PTR -72[rbp], rsi
	mov	QWORD PTR -80[rbp], rdi
	mov	rsi, rsp
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	movsx	rax, DWORD PTR HDCD_MAX_CHANNELS[rip]
	mov	rdx, rax
	lea	rax, 15[0+rax*4]
	mov	rcx, rax
	and	rax, -4096
	sub	rsi, rax
	and	rcx, -16
	mov	rax, rsi
	cmp	rsp, rax
	je	.L3
.L38:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L38
.L3:
	and	ecx, 4095
	sub	rsp, rcx
	test	rcx, rcx
	jne	.L39
.L4:
	mov	r12, rsp
	sal	edx, 2
	xor	esi, esi
	mov	rdi, r12
	mov	QWORD PTR -96[rbp], r12
	call	memset@PLT
	cmp	r14d, r15d
	cmovl	r14d, r15d
	test	r15d, r15d
	jle	.L5
	lea	eax, -1[r15]
	mov	rdx, QWORD PTR -72[rbp]
	mov	rcx, r12
	lea	rsi, 4[r12+rax*4]
	.p2align 4,,10
	.p2align 3
.L9:
	mov	eax, DWORD PTR [rdx]
	test	eax, eax
	je	.L6
	mov	DWORD PTR [rcx], 1
	cmp	eax, r13d
	jbe	.L7
	sub	eax, r13d
.L8:
	mov	DWORD PTR [rdx], eax
.L6:
	add	rcx, 4
	add	rdx, 24
	cmp	rcx, rsi
	jne	.L9
	xor	r12d, r12d
	test	r13d, r13d
	jle	.L23
.L22:
	lea	rax, -60[rbp]
	xor	r12d, r12d
	mov	QWORD PTR -88[rbp], rax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L11:
	imul	eax, r14d
	cdqe
	lea	rbx, [rbx+rax*4]
	cmp	r12d, r13d
	jge	.L18
.L17:
	sub	rsp, 8
	mov	rsi, QWORD PTR -72[rbp]
	mov	rdi, QWORD PTR -80[rbp]
	mov	r9d, r13d
	push	r14
	mov	rcx, QWORD PTR -88[rbp]
	sub	r9d, r12d
	mov	edx, r15d
	mov	r8, rbx
	call	hdcd_integrate@PLT
	mov	edx, DWORD PTR -60[rbp]
	pop	rsi
	add	r12d, eax
	pop	rdi
	test	edx, edx
	je	.L11
	test	r15d, r15d
	jle	.L1
	mov	rcx, QWORD PTR -72[rbp]
	xor	eax, eax
	.p2align 4,,10
	.p2align 3
.L16:
	bt	edx, eax
	jnc	.L14
	mov	esi, DWORD PTR 4[rcx]
	cmp	DWORD PTR 8[rcx], -1
	mov	DWORD PTR [rcx], esi
	jne	.L14
	mov	DWORD PTR 8[rcx], 0
	.p2align 4,,10
	.p2align 3
.L14:
	add	eax, 1
	add	rcx, 24
	cmp	r15d, eax
	jne	.L16
.L18:
	test	r15d, r15d
	jle	.L1
.L23:
	mov	rbx, QWORD PTR -72[rbp]
	xor	eax, eax
	add	rbx, 8
	.p2align 4,,10
	.p2align 3
.L21:
	mov	rdi, QWORD PTR -96[rbp]
	mov	ecx, DWORD PTR [rdi+rax*4]
	test	ecx, ecx
	je	.L20
	mov	edx, DWORD PTR -8[rbx]
	test	edx, edx
	jne	.L20
	add	DWORD PTR [rbx], 1
.L20:
	add	rax, 1
	add	rbx, 24
	cmp	r15d, eax
	jg	.L21
.L1:
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L40
	lea	rsp, -40[rbp]
	mov	eax, r12d
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	mov	r13d, eax
	mov	QWORD PTR 16[rdx], 0
	xor	eax, eax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L39:
	or	QWORD PTR -8[rsp+rcx], 0
	jmp	.L4
.L5:
	xor	r12d, r12d
	test	r13d, r13d
	jg	.L22
	jmp	.L1
.L40:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	hdcd_scan, .-hdcd_scan
	.comm	HDCD_MAX_CHANNELS,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_af_hdcd.c_hdcd_scan.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	hdcd_scan, %function
hdcd_scan:
	@ args = 8, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #36
	mov	r5, r2
	ldr	r2, .L36
	mov	r10, r0
	ldr	r2, [r2]
	ldr	r9, [fp, #8]
	lsl	r2, r2, #2
	add	r0, r2, #7
	bic	r0, r0, #7
	sub	sp, sp, r0
	add	r0, sp, #16
	mov	r7, r3
	ldr	r3, .L36+4
	str	r0, [fp, #-48]
	mov	r6, r1
	mov	r1, #0
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	ldr	r8, [fp, #4]
	bl	memset
	cmp	r9, r5
	movlt	r9, r5
	cmp	r5, #0
	ble	.L2
	mov	r3, #0
	mov	r1, #1
	mov	ip, r3
	add	r0, r6, #12
.L6:
	ldr	r2, [r6, r3, lsl #4]
	cmp	r2, #0
	beq	.L3
	cmp	r2, r8
	movls	r8, r2
	movls	r2, #0
	ldr	lr, [fp, #-48]
	subhi	r2, r2, r8
	strls	ip, [r0, r3, lsl #4]
	str	r1, [lr, r3, lsl #2]
	str	r2, [r6, r3, lsl #4]
.L3:
	add	r3, r3, #1
	cmp	r5, r3
	bne	.L6
	cmp	r8, #0
	movle	r4, #0
	ble	.L20
.L19:
	mov	r4, #0
	b	.L14
.L8:
	mul	r0, r9, r0
	cmp	r4, r8
	add	r7, r7, r0, lsl #2
	bge	.L15
.L14:
	sub	r3, r8, r4
	mov	r2, r5
	str	r3, [sp, #4]
	mov	r1, r6
	mov	r0, r10
	str	r9, [sp, #8]
	str	r7, [sp]
	sub	r3, fp, #44
	bl	hdcd_integrate
	ldr	r2, [fp, #-44]
	add	r4, r4, r0
	cmp	r2, #0
	beq	.L8
	cmp	r5, #0
	ble	.L1
	mov	r3, #0
	mov	lr, r3
	add	ip, r6, #4
	add	r0, r6, #8
.L13:
	asr	r1, r2, r3
	tst	r1, #1
	beq	.L11
	ldr	r1, [ip, r3, lsl #4]
	str	r1, [r6, r3, lsl #4]
	ldr	r1, [r0, r3, lsl #4]
	cmn	r1, #1
	streq	lr, [r0, r3, lsl #4]
.L11:
	add	r3, r3, #1
	cmp	r5, r3
	bne	.L13
.L15:
	cmp	r5, #0
	ble	.L1
.L20:
	mov	r3, #0
	ldr	r2, [fp, #-48]
	add	r0, r6, #8
	sub	r2, r2, #4
.L18:
	ldr	r1, [r2, #4]!
	cmp	r1, #0
	beq	.L17
	ldr	r1, [r6, r3, lsl #4]
	cmp	r1, #0
	ldreq	r1, [r0, r3, lsl #4]
	addeq	r1, r1, #1
	streq	r1, [r0, r3, lsl #4]
.L17:
	add	r3, r3, #1
	cmp	r5, r3
	bgt	.L18
.L1:
	ldr	r3, .L36+4
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L35
	mov	r0, r4
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L2:
	cmp	r8, #0
	movle	r4, #0
	bgt	.L19
	b	.L1
.L35:
	bl	__stack_chk_fail
.L37:
	.align	2
.L36:
	.word	HDCD_MAX_CHANNELS
	.word	.LC0
	.size	hdcd_scan, .-hdcd_scan
	.comm	HDCD_MAX_CHANNELS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
