	.file	"extr_ff-protocol-latter.c_latter_allocate_resources.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	latter_allocate_resources, @function
latter_allocate_resources:
.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
	mov	rbp, rdi
	mov	edi, esi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	imul	rdi, rdi, 274877907
	shr	rdi, 43
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	imul	edi, edi, 32000
	mov	eax, ebx
	sub	eax, edi
	mov	edi, eax
	je	.L2
	imul	eax, ebx, -742513167
	ror	eax, 2
	cmp	eax, 97391
	ja	.L24
	mov	edi, 2
.L2:
	lea	eax, -64000[rbx]
	cmp	eax, 63999
	jbe	.L25
	mov	eax, edi
	lea	edx, -128000[rbx]
	or	eax, 16
	cmp	edx, 64000
	cmovb	edi, eax
.L5:
	call	cpu_to_le32@PLT
	mov	edi, DWORD PTR 4[rbp]
	lea	rcx, 12[rsp]
	xor	r9d, r9d
	mov	edx, DWORD PTR LATTER_STF[rip]
	mov	esi, DWORD PTR TCODE_WRITE_QUADLET_REQUEST[rip]
	mov	r8d, 4
	mov	DWORD PTR 12[rsp], eax
	call	snd_fw_transaction@PLT
	mov	r12d, eax
	test	eax, eax
	js	.L1
	mov	r15d, 1
	lea	r13, 20[rsp]
	lea	r14, 16[rsp]
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rdx, r13
	mov	rsi, r14
	mov	rdi, rbp
	call	latter_get_clock@PLT
	mov	r12d, eax
	test	eax, eax
	js	.L1
	cmp	DWORD PTR 16[rsp], ebx
	je	.L7
	add	r15d, 1
	cmp	r15d, 11
	jne	.L8
.L10:
	mov	rdi, QWORD PTR amdtp_rate_table[rip]
	xor	r12d, r12d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L12:
	mov	eax, DWORD PTR [rdi+r12*4]
	add	r12, 1
	cmp	eax, ebx
	je	.L11
.L9:
	call	ARRAY_SIZE@PLT
	mov	r14d, r12d
	mov	rdi, QWORD PTR amdtp_rate_table[rip]
	cmp	eax, r12d
	jg	.L12
.L11:
	call	ARRAY_SIZE@PLT
	cmp	eax, r14d
	je	.L22
	mov	rsi, r13
	mov	edi, r14d
	call	snd_ff_stream_get_multiplier_mode@PLT
	mov	r12d, eax
	test	eax, eax
	js	.L1
	mov	DWORD PTR 0[rbp], 255
	mov	edi, DWORD PTR 4[rbp]
	call	fw_parent_device@PLT
	lea	rdi, 16[rbp]
	mov	r12d, DWORD PTR [rax]
	call	amdtp_stream_get_max_payload@PLT
	mov	rdi, rbp
	mov	edx, r12d
	mov	esi, eax
	call	fw_iso_resources_allocate@PLT
	mov	r12d, eax
	test	eax, eax
	js	.L1
	mov	DWORD PTR 12[rbp], 255
	mov	edi, DWORD PTR 4[rbp]
	call	fw_parent_device@PLT
	lea	rdi, 8[rbp]
	mov	r12d, DWORD PTR [rax]
	call	amdtp_stream_get_max_payload@PLT
	lea	rdi, 12[rbp]
	mov	edx, r12d
	mov	esi, eax
	call	fw_iso_resources_allocate@PLT
	mov	r12d, eax
	test	eax, eax
	js	.L26
	.p2align 4,,10
	.p2align 3
.L1:
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L27
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r12d
	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
	or	edi, 8
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L24:
	imul	eax, ebx, -1214044089
	mov	edi, 4
	ror	eax, 7
	cmp	eax, 89478
	jbe	.L2
.L22:
	mov	r12d, DWORD PTR EINVAL[rip]
	neg	r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L7:
	cmp	r15d, 10
	jne	.L10
	mov	r12d, DWORD PTR ETIMEDOUT[rip]
	neg	r12d
	jmp	.L1
.L26:
	mov	rdi, rbp
	call	fw_iso_resources_free@PLT
	jmp	.L1
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	latter_allocate_resources, .-latter_allocate_resources
	.comm	amdtp_rate_table,8,8
	.comm	TCODE_WRITE_QUADLET_REQUEST,4,4
	.comm	LATTER_STF,4,4
	.comm	ETIMEDOUT,4,4
	.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_ff-protocol-latter.c_latter_allocate_resources.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	latter_allocate_resources, %function
latter_allocate_resources:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	r3, .L28
	push	{r4, r5, r6, r7, lr}
	mov	r5, r0
	umull	r2, r0, r3, r1
	lsr	r0, r0, #11
	rsb	r3, r0, r0, lsl #5
	add	r0, r0, r3, lsl #2
	ldr	r3, .L28+4
	sub	sp, sp, #28
	subs	r0, r1, r0, lsl #8
	mov	r6, r1
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	beq	.L2
	ldr	r3, .L28+8
	ldr	r2, .L28+12
	mul	r3, r1, r3
	cmp	r2, r3, ror #2
	bcc	.L24
	mov	r0, #2
.L2:
	sub	r3, r6, #64000
	cmp	r3, #64000
	orrcc	r0, r0, #8
	bcs	.L25
.L5:
	bl	cpu_to_le32
	mov	r1, #4
	mov	ip, r0
	mov	r0, #0
	ldr	r3, .L28+16
	ldr	r2, .L28+20
	str	r0, [sp, #4]
	str	r1, [sp]
	ldr	r1, [r3]
	ldr	r2, [r2]
	ldr	r0, [r5, #4]
	add	r3, sp, #8
	str	ip, [sp, #8]
	bl	snd_fw_transaction
	subs	r4, r0, #0
	blt	.L1
	mov	r7, #1
.L8:
	mov	r0, r5
	add	r2, sp, #16
	add	r1, sp, #12
	bl	latter_get_clock
	subs	r4, r0, #0
	blt	.L1
	ldr	r3, [sp, #12]
	cmp	r3, r6
	beq	.L7
	add	r7, r7, #1
	cmp	r7, #11
	bne	.L8
.L10:
	ldr	r7, .L28+24
	mov	r4, #0
	ldr	r0, [r7]
	b	.L9
.L12:
	ldr	r3, [r0, r4, lsl #2]
	cmp	r3, r6
	beq	.L11
	add	r4, r4, #1
.L9:
	bl	ARRAY_SIZE
	cmp	r0, r4
	ldr	r0, [r7]
	bgt	.L12
.L11:
	bl	ARRAY_SIZE
	cmp	r0, r4
	beq	.L22
	mov	r0, r4
	add	r1, sp, #16
	bl	snd_ff_stream_get_multiplier_mode
	subs	r4, r0, #0
	blt	.L1
	mov	r0, r5
	mov	r6, #255
	str	r6, [r0], #16
	bl	amdtp_stream_get_max_payload
	mov	r4, r0
	ldr	r0, [r5, #4]
	bl	fw_parent_device
	mov	r1, r4
	ldr	r2, [r0]
	mov	r0, r5
	bl	fw_iso_resources_allocate
	subs	r4, r0, #0
	blt	.L1
	str	r6, [r5, #12]
	add	r0, r5, #8
	bl	amdtp_stream_get_max_payload
	mov	r4, r0
	ldr	r0, [r5, #4]
	bl	fw_parent_device
	mov	r1, r4
	ldr	r2, [r0]
	add	r0, r5, #12
	bl	fw_iso_resources_allocate
	subs	r4, r0, #0
	blt	.L26
.L1:
	ldr	r3, .L28+4
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L27
	mov	r0, r4
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, pc}
.L25:
	sub	r3, r6, #128000
	cmp	r3, #64000
	orrcc	r0, r0, #16
	b	.L5
.L24:
	ldr	r3, .L28+28
	sub	r2, r2, #7872
	mul	r3, r1, r3
	sub	r2, r2, #41
	cmp	r2, r3, ror #7
	movcs	r0, #4
	bcs	.L2
.L22:
	ldr	r3, .L28+32
	ldr	r0, [r3]
	rsb	r4, r0, #0
	b	.L1
.L7:
	cmp	r7, #10
	bne	.L10
	ldr	r3, .L28+36
	ldr	r0, [r3]
	rsb	r4, r0, #0
	b	.L1
.L26:
	mov	r0, r5
	bl	fw_iso_resources_free
	b	.L1
.L27:
	bl	__stack_chk_fail
.L29:
	.align	2
.L28:
	.word	274877907
	.word	.LC0
	.word	-742513167
	.word	97391
	.word	TCODE_WRITE_QUADLET_REQUEST
	.word	LATTER_STF
	.word	amdtp_rate_table
	.word	-1214044089
	.word	EINVAL
	.word	ETIMEDOUT
	.size	latter_allocate_resources, .-latter_allocate_resources
	.comm	amdtp_rate_table,4,4
	.comm	TCODE_WRITE_QUADLET_REQUEST,4,4
	.comm	LATTER_STF,4,4
	.comm	ETIMEDOUT,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
