	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dib0090_gain_apply
_dib0090_gain_apply:                    ## @dib0090_gain_apply
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$-510, %edx                     ## imm = 0xFE02
	movl	$-511, %eax                     ## imm = 0xFE01
	cmovgel	%edx, %eax
	cmpl	$511, %eax                      ## imm = 0x1FF
	movl	$511, %ebx                      ## imm = 0x1FF
	cmovll	%eax, %ebx
	xorl	%r8d, %r8d
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	testq	%rcx, %rcx
	movq	_WBD_ALPHA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_GAIN_ALPHA@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movl	%edx, %ecx
	cmovel	%r8d, %ecx
	movl	%r9d, %eax
	cmovel	%r8d, %eax
	movq	%rdi, %r13
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %ebx
	movl	%eax, %ecx
	shll	%cl, %esi
	movq	(%rdi), %r11
	movl	(%r11), %edi
	movl	%edx, %ecx
	shll	%cl, %edi
	movl	8(%r13), %eax
	movl	%edi, %ecx
	subl	%eax, %ecx
	addl	%ebx, %eax
	cmpl	%ecx, %ebx
	cmovgel	%edi, %eax
	testl	%eax, %eax
	cmovlel	%r8d, %eax
	movl	%eax, 8(%r13)
	movl	%edx, %ecx
	shrl	%cl, %eax
	movq	16(%r13), %r10
	movl	(%r10), %edx
	addl	%eax, %edx
	movl	%r9d, %ecx
	shll	%cl, %edx
	movl	24(%r13), %edi
	movl	%edx, %ecx
	subl	%edi, %ecx
	addl	%esi, %edi
	cmpl	%ecx, %esi
	cmovgel	%edx, %edi
	testl	%edi, %edi
	cmovlel	%r8d, %edi
	movl	%edi, 24(%r13)
	movl	%r9d, %ecx
	shrl	%cl, %edi
	movl	%edi, %ecx
	movl	$0, %r14d
	subl	%eax, %ecx
	jbe	LBB0_2
## %bb.1:
	movl	(%r10), %r14d
	cmpl	%r14d, %ecx
	cmovll	%ecx, %r14d
	movl	%eax, %edi
LBB0_2:
	movq	32(%r13), %rax
	movl	%edi, (%rax)
	movl	%r14d, 4(%rax)
	movl	4(%r11), %ecx
	testl	%ecx, %ecx
	je	LBB0_7
## %bb.3:
	movl	8(%r11), %edx
	movl	%edx, %esi
	subl	%ecx, %esi
	movl	%edi, %eax
	subl	%esi, %eax
	jl	LBB0_7
## %bb.4:
	cmpl	%edx, %edi
	jge	LBB0_5
## %bb.6:
	imull	12(%r11), %eax
	cltd
	idivl	%ecx
	movl	%eax, %r8d
	jmp	LBB0_7
LBB0_5:
	movl	12(%r11), %r8d
LBB0_7:
	movl	16(%r11), %ecx
	xorl	%ebx, %ebx
	movl	$0, %r9d
	testl	%ecx, %ecx
	je	LBB0_12
## %bb.8:
	movl	20(%r11), %edx
	movl	%edx, %esi
	subl	%ecx, %esi
	movl	%edi, %eax
	movl	$0, %r9d
	subl	%esi, %eax
	jl	LBB0_12
## %bb.9:
	cmpl	%edx, %edi
	jge	LBB0_10
## %bb.11:
	imull	24(%r11), %eax
	cltd
	idivl	%ecx
	movl	%eax, %r9d
	jmp	LBB0_12
LBB0_10:
	movl	24(%r11), %r9d
LBB0_12:
	movl	28(%r11), %ecx
	testl	%ecx, %ecx
	je	LBB0_17
## %bb.13:
	movl	32(%r11), %edx
	movl	%edx, %esi
	subl	%ecx, %esi
	movl	%edi, %eax
	subl	%esi, %eax
	jl	LBB0_17
## %bb.14:
	cmpl	%edx, %edi
	jge	LBB0_15
## %bb.16:
	imull	36(%r11), %eax
	cltd
	idivl	%ecx
	movl	%eax, %ebx
	jmp	LBB0_17
LBB0_15:
	movl	36(%r11), %ebx
LBB0_17:
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movl	40(%r11), %ecx
	xorl	%r12d, %r12d
	movl	$0, %r15d
	testl	%ecx, %ecx
	je	LBB0_22
## %bb.18:
	movl	44(%r11), %edx
	movl	%edx, %ebx
	subl	%ecx, %ebx
	movl	%edi, %eax
	movl	$0, %r15d
	subl	%ebx, %eax
	jl	LBB0_22
## %bb.19:
	cmpl	%edx, %edi
	jge	LBB0_20
## %bb.21:
	imull	48(%r11), %eax
	cltd
	idivl	%ecx
	movl	%eax, %r15d
	jmp	LBB0_22
LBB0_20:
	movl	48(%r11), %r15d
LBB0_22:
	movl	52(%r11), %ecx
	testl	%ecx, %ecx
	je	LBB0_27
## %bb.23:
	movl	56(%r11), %edx
	movl	%edx, %ebx
	subl	%ecx, %ebx
	movl	%edi, %eax
	subl	%ebx, %eax
	jl	LBB0_27
## %bb.24:
	cmpl	%edx, %edi
	jge	LBB0_25
## %bb.26:
	imull	60(%r11), %eax
	cltd
	idivl	%ecx
	movl	%eax, %r12d
	jmp	LBB0_27
LBB0_25:
	movl	60(%r11), %r12d
LBB0_27:
	orl	40(%r13), %r12d
	movl	4(%r10), %ebx
	xorl	%edi, %edi
	movl	$0, %ecx
	testl	%ebx, %ebx
	je	LBB0_32
## %bb.28:
	movl	8(%r10), %esi
	movl	%esi, %edx
	subl	%ebx, %edx
	movl	%r14d, %eax
	movl	$0, %ecx
	subl	%edx, %eax
	jl	LBB0_32
## %bb.29:
	cmpl	%esi, %r14d
	jge	LBB0_30
## %bb.31:
	imull	12(%r10), %eax
	cltd
	idivl	%ebx
	movl	%eax, %ecx
	jmp	LBB0_32
LBB0_30:
	movl	12(%r10), %ecx
LBB0_32:
	shll	$7, %r9d
	shll	$7, %r15d
	shll	$3, %ecx
	movl	16(%r10), %ebx
	testl	%ebx, %ebx
	je	LBB0_37
## %bb.33:
	movl	20(%r10), %edx
	movl	%edx, %esi
	subl	%ebx, %esi
	movl	%r14d, %eax
	subl	%esi, %eax
	jl	LBB0_37
## %bb.34:
	cmpl	%edx, %r14d
	jge	LBB0_35
## %bb.36:
	imull	24(%r10), %eax
	cltd
	idivl	%ebx
	movl	%eax, %edi
	jmp	LBB0_37
LBB0_35:
	movl	24(%r10), %edi
LBB0_37:
	orl	%r9d, %r8d
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	orl	%r15d, %eax
	movl	%eax, %r15d
	shll	$8, %edi
	movslq	%r14d, %rax
	imulq	$1717986919, %rax, %rax         ## imm = 0x66666667
	movq	%rax, %rdx
	shrq	$63, %rdx
	sarq	$34, %rax
	addl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rax,4), %eax
	subl	%eax, %r14d
	imull	$100, %r14d, %eax
	movswl	%ax, %edx
	imull	$-31981, %edx, %edx             ## imm = 0x8313
	shrl	$16, %edx
	addl	%eax, %edx
	movzwl	%dx, %eax
	movswl	%ax, %edx
	shrl	$15, %eax
	sarl	$6, %edx
	addl	%eax, %edx
	movswl	%dx, %ebx
	orl	44(%r13), %ebx
	orl	%edi, %ecx
	orl	%ecx, %ebx
	movq	48(%r13), %rax
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	testq	%r14, %r14
	je	LBB0_38
## %bb.49:
	movl	%r8d, (%rax)
	movq	_gain_reg_addr@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	%r8d, %edx
	callq	_dib0090_write_reg
	movq	48(%r13), %rax
	jmp	LBB0_41
LBB0_38:
	cmpl	%r8d, (%rax)
	je	LBB0_40
## %bb.39:
	movl	%r8d, (%rax)
	movq	_gain_reg_addr@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	%r8d, %edx
	callq	_dib0090_write_reg
LBB0_40:
	movq	48(%r13), %rax
	cmpl	%r15d, 4(%rax)
	je	LBB0_43
LBB0_41:
	movl	%r15d, 4(%rax)
	movq	_gain_reg_addr@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	4(%rax), %esi
	movq	%r13, %rdi
	movl	%r15d, %edx
	callq	_dib0090_write_reg
	testq	%r14, %r14
	je	LBB0_43
## %bb.42:
	movq	48(%r13), %rax
	jmp	LBB0_44
LBB0_43:
	movq	48(%r13), %rax
	cmpl	%r12d, 8(%rax)
	je	LBB0_47
LBB0_44:
	movl	%r12d, 8(%rax)
	movq	_gain_reg_addr@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	8(%rax), %esi
	movq	%r13, %rdi
	movl	%r12d, %edx
	callq	_dib0090_write_reg
	testq	%r14, %r14
	je	LBB0_47
## %bb.45:
	movq	48(%r13), %rax
	jmp	LBB0_46
LBB0_47:
	movq	48(%r13), %rax
	cmpl	%ebx, 12(%rax)
	jne	LBB0_46
## %bb.48:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_46:
	movl	%ebx, 12(%rax)
	movq	_gain_reg_addr@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	12(%rax), %esi
	movq	%r13, %rdi
	movl	%ebx, %edx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dib0090_write_reg              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_WBD_ALPHA,4,2                  ## @WBD_ALPHA
	.comm	_GAIN_ALPHA,4,2                 ## @GAIN_ALPHA
	.comm	_gain_reg_addr,8,3              ## @gain_reg_addr
	.no_dead_strip	_dib0090_gain_apply
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dib0090_gain_apply
_dib0090_gain_apply:                    ; @dib0090_gain_apply
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x3
	mov	x19, x0
	cmn	w2, #511
	mov	w8, #-511
	csel	w8, w2, w8, gt
	mov	w9, #511
Lloh0:
	adrp	x10, _WBD_ALPHA@GOTPAGE
Lloh1:
	ldr	x10, [x10, _WBD_ALPHA@GOTPAGEOFF]
	cmp	w8, #511
	csel	w8, w8, w9, lt
Lloh2:
	ldr	w9, [x10]
Lloh3:
	adrp	x10, _GAIN_ALPHA@GOTPAGE
Lloh4:
	ldr	x10, [x10, _GAIN_ALPHA@GOTPAGEOFF]
Lloh5:
	ldr	w12, [x10]
	cmp	x3, #0
	csel	w10, wzr, w9, eq
	lsl	w8, w8, w10
	csel	w10, wzr, w12, eq
	lsl	w13, w1, w10
	ldr	x10, [x0]
	ldr	w11, [x10]
	lsl	w11, w11, w9
	ldr	w14, [x0, #8]
	add	w15, w14, w8
	sub	w14, w11, w14
	cmp	w8, w14
	csel	w8, w15, w11, lt
	cmp	w8, #0
	csel	w8, w8, wzr, gt
	str	w8, [x0, #8]
	lsr	w11, w8, w9
	ldr	x9, [x0, #16]
	ldr	w8, [x9]
	add	w8, w11, w8
	lsl	w8, w8, w12
	ldr	w14, [x0, #24]
	add	w15, w14, w13
	sub	w14, w8, w14
	cmp	w13, w14
	csel	w8, w15, w8, lt
	cmp	w8, #0
	csel	w8, w8, wzr, gt
	str	w8, [x0, #24]
	lsr	w12, w8, w12
	subs	w8, w12, w11
	b.ls	LBB0_2
; %bb.1:
	ldr	w12, [x9]
	cmp	w8, w12
	csel	w8, w8, w12, lt
	mov	x12, x11
	b	LBB0_3
LBB0_2:
	mov	w8, #0
LBB0_3:
	ldr	x11, [x19, #32]
	stp	w12, w8, [x11]
	ldr	w11, [x10, #4]
	cbz	w11, LBB0_8
; %bb.4:
	ldr	w14, [x10, #8]
	sub	w13, w14, w11
	subs	w13, w12, w13
	b.ge	LBB0_6
; %bb.5:
	mov	w11, #0
	ldr	w13, [x10, #16]
	cbnz	w13, LBB0_9
	b	LBB0_15
LBB0_6:
	cmp	w12, w14
	b.ge	LBB0_13
; %bb.7:
	ldr	w14, [x10, #12]
	mul	w13, w14, w13
	sdiv	w11, w13, w11
LBB0_8:
	ldr	w13, [x10, #16]
	cbz	w13, LBB0_15
LBB0_9:
	ldr	w15, [x10, #20]
	sub	w14, w15, w13
	subs	w14, w12, w14
	b.ge	LBB0_11
; %bb.10:
	mov	w13, #0
	b	LBB0_15
LBB0_11:
	cmp	w12, w15
	b.ge	LBB0_14
; %bb.12:
	ldr	w15, [x10, #24]
	mul	w14, w15, w14
	sdiv	w13, w14, w13
	b	LBB0_15
LBB0_13:
	ldr	w11, [x10, #12]
	ldr	w13, [x10, #16]
	cbnz	w13, LBB0_9
	b	LBB0_15
LBB0_14:
	ldr	w13, [x10, #24]
LBB0_15:
	ldr	w14, [x10, #28]
	cbz	w14, LBB0_20
; %bb.16:
	ldr	w16, [x10, #32]
	sub	w15, w16, w14
	subs	w15, w12, w15
	b.ge	LBB0_18
; %bb.17:
	mov	w14, #0
	ldr	w15, [x10, #40]
	cbnz	w15, LBB0_21
	b	LBB0_27
LBB0_18:
	cmp	w12, w16
	b.ge	LBB0_25
; %bb.19:
	ldr	w16, [x10, #36]
	mul	w15, w16, w15
	sdiv	w14, w15, w14
LBB0_20:
	ldr	w15, [x10, #40]
	cbz	w15, LBB0_27
LBB0_21:
	ldr	w17, [x10, #44]
	sub	w16, w17, w15
	subs	w16, w12, w16
	b.ge	LBB0_23
; %bb.22:
	mov	w15, #0
	b	LBB0_27
LBB0_23:
	cmp	w12, w17
	b.ge	LBB0_26
; %bb.24:
	ldr	w17, [x10, #48]
	mul	w16, w17, w16
	sdiv	w15, w16, w15
	b	LBB0_27
LBB0_25:
	ldr	w14, [x10, #36]
	ldr	w15, [x10, #40]
	cbnz	w15, LBB0_21
	b	LBB0_27
LBB0_26:
	ldr	w15, [x10, #48]
LBB0_27:
	ldr	w16, [x10, #52]
	cbz	w16, LBB0_29
; %bb.28:
	ldr	w0, [x10, #56]
	sub	w17, w0, w16
	subs	w17, w12, w17
	b.ge	LBB0_48
LBB0_29:
	mov	w10, #0
	ldr	w12, [x9, #4]
	cbz	w12, LBB0_31
LBB0_30:
	ldr	w17, [x9, #8]
	sub	w16, w17, w12
	subs	w16, w8, w16
	b.ge	LBB0_50
LBB0_31:
	mov	w16, #0
LBB0_32:
	ldr	w12, [x19, #40]
	lsl	w16, w16, #3
	ldr	w17, [x9, #16]
	orr	w2, w11, w13, lsl #7
	cbz	w17, LBB0_34
; %bb.33:
	ldr	w13, [x9, #20]
	sub	w11, w13, w17
	subs	w11, w8, w11
	b.ge	LBB0_52
LBB0_34:
	mov	w9, #0
LBB0_35:
	orr	w23, w14, w15, lsl #7
	orr	w22, w12, w10
	orr	w9, w16, w9, lsl #8
	ldr	w10, [x19, #44]
	mov	w11, #26215
	movk	w11, #26214, lsl #16
	smull	x11, w8, w11
	lsr	x12, x11, #63
	asr	x11, x11, #34
	add	w11, w11, w12
	mov	w12, #10
	msub	w8, w11, w12, w8
	mov	w11, #100
	mul	w8, w8, w11
	sxth	w11, w8
	mov	w12, #-31981
	mul	w11, w11, w12
	add	w8, w8, w11, lsr #16
	and	w11, w8, #0x8000
	sbfx	w8, w8, #6, #10
	add	w8, w8, w11, lsr #15
	orr	w8, w10, w8
	orr	w21, w8, w9
	ldr	x8, [x19, #48]
Lloh6:
	adrp	x24, _gain_reg_addr@GOTPAGE
Lloh7:
	ldr	x24, [x24, _gain_reg_addr@GOTPAGEOFF]
	cbz	x20, LBB0_37
; %bb.36:
	str	w2, [x8]
	ldr	x8, [x24]
	ldr	w1, [x8]
	mov	x0, x19
	bl	_dib0090_write_reg
	ldr	x8, [x19, #48]
	b	LBB0_40
LBB0_37:
	ldr	w9, [x8]
	cmp	w9, w2
	b.eq	LBB0_39
; %bb.38:
	str	w2, [x8]
	ldr	x8, [x24]
	ldr	w1, [x8]
	mov	x0, x19
	bl	_dib0090_write_reg
LBB0_39:
	ldr	x8, [x19, #48]
	ldr	w9, [x8, #4]
	cmp	w9, w23
	b.eq	LBB0_42
LBB0_40:
	str	w23, [x8, #4]
	ldr	x8, [x24]
	ldr	w1, [x8, #4]
	mov	x0, x19
	mov	x2, x23
	bl	_dib0090_write_reg
	cbz	x20, LBB0_42
; %bb.41:
	ldr	x8, [x19, #48]
	b	LBB0_43
LBB0_42:
	ldr	x8, [x19, #48]
	ldr	w9, [x8, #8]
	cmp	w9, w22
	b.eq	LBB0_45
LBB0_43:
	str	w22, [x8, #8]
	ldr	x8, [x24]
	ldr	w1, [x8, #8]
	mov	x0, x19
	mov	x2, x22
	bl	_dib0090_write_reg
	cbz	x20, LBB0_45
; %bb.44:
	ldr	x8, [x19, #48]
	b	LBB0_47
LBB0_45:
	ldr	x8, [x19, #48]
	ldr	w9, [x8, #12]
	cmp	w9, w21
	b.ne	LBB0_47
; %bb.46:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_47:
	str	w21, [x8, #12]
	ldr	x8, [x24]
	ldr	w1, [x8, #12]
	mov	x0, x19
	mov	x2, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_dib0090_write_reg
LBB0_48:
	cmp	w12, w0
	b.ge	LBB0_54
; %bb.49:
	ldr	w10, [x10, #60]
	mul	w10, w10, w17
	sdiv	w10, w10, w16
	ldr	w12, [x9, #4]
	cbnz	w12, LBB0_30
	b	LBB0_31
LBB0_50:
	cmp	w8, w17
	b.ge	LBB0_55
; %bb.51:
	ldr	w17, [x9, #12]
	mul	w16, w17, w16
	sdiv	w16, w16, w12
	b	LBB0_32
LBB0_52:
	cmp	w8, w13
	b.ge	LBB0_56
; %bb.53:
	ldr	w9, [x9, #24]
	mul	w9, w9, w11
	sdiv	w9, w9, w17
	b	LBB0_35
LBB0_54:
	ldr	w10, [x10, #60]
	ldr	w12, [x9, #4]
	cbnz	w12, LBB0_30
	b	LBB0_31
LBB0_55:
	ldr	w16, [x9, #12]
	b	LBB0_32
LBB0_56:
	ldr	w9, [x9, #24]
	b	LBB0_35
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_WBD_ALPHA,4,2                  ; @WBD_ALPHA
	.comm	_GAIN_ALPHA,4,2                 ; @GAIN_ALPHA
	.comm	_gain_reg_addr,8,3              ; @gain_reg_addr
	.no_dead_strip	_dib0090_gain_apply
.subsections_via_symbols
