	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function color_balance16
_color_balance16:                       ## @color_balance16
	.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	$168, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movq	(%rsi), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movl	(%rax), %r8d
	movl	%r8d, %eax
	imull	%edx, %eax
	cltd
	idivl	%ecx
	movl	%eax, %r9d
	incl	%ebx
	imull	%r8d, %ebx
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	movl	%eax, -72(%rbp)                 ## 4-byte Spill
	cmpl	%eax, %r9d
	jge	LBB0_11
## %bb.1:
	movq	8(%rdi), %r15
	movq	8(%rsi), %r10
	movl	8(%r15), %edx
	movq	(%r15), %rax
	movq	_A@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movslq	(%rax,%rcx,4), %rcx
	movq	%rcx, -120(%rbp)                ## 8-byte Spill
	movq	_B@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movslq	(%rax,%rcx,4), %rcx
	movq	%rcx, -112(%rbp)                ## 8-byte Spill
	movq	_G@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movslq	(%rax,%rcx,4), %rcx
	movq	%rcx, -104(%rbp)                ## 8-byte Spill
	movq	_R@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movslq	(%rax,%rcx,4), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	-88(%rbp), %r8                  ## 8-byte Reload
	movq	8(%r8), %rax
	movq	16(%r8), %rcx
	movl	(%rax), %r11d
	movl	%r11d, %ebx
	imull	%r9d, %ebx
	movl	%ebx, %esi
	shrl	$31, %esi
	addl	%ebx, %esi
	sarl	%esi
	movslq	%esi, %rax
	shlq	$2, %rax
	addq	(%rcx), %rax
	movq	8(%r10), %rcx
	movl	(%rcx), %r14d
	movl	%r9d, %ebx
	imull	%r14d, %ebx
	movl	%ebx, %esi
	shrl	$31, %esi
	addl	%ebx, %esi
	movq	16(%r10), %rbx
	sarl	%esi
	movslq	%esi, %rcx
	shlq	$2, %rcx
	addq	(%rbx), %rcx
	movl	%edx, %esi
	shrl	$31, %esi
	addl	%edx, %esi
	sarl	%esi
	movq	%r10, -128(%rbp)                ## 8-byte Spill
	cmpq	%r8, %r10
	setne	%r8b
	andl	$-2, %edx
	cmpl	$8, %edx
	movss	16(%r15), %xmm0                 ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, -64(%rbp)                ## 4-byte Spill
	movq	(%rdi), %rdx
	movq	(%rdx), %rdx
	sete	%bl
	andb	%r8b, %bl
	movb	%bl, -41(%rbp)                  ## 1-byte Spill
	movl	12(%r15), %ebx
	movl	%esi, -68(%rbp)                 ## 4-byte Spill
	movslq	%esi, %rsi
	movq	%rsi, -168(%rbp)                ## 8-byte Spill
	movq	%rdx, -176(%rbp)                ## 8-byte Spill
	movl	(%rdx), %edx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-128(%rbp), %rax                ## 8-byte Reload
	movq	8(%rax), %rax
	movl	(%rax), %r14d
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rax
	movl	(%rax), %r11d
	movl	-76(%rbp), %r9d                 ## 4-byte Reload
	movq	-144(%rbp), %rax                ## 8-byte Reload
	movq	-136(%rbp), %rcx                ## 8-byte Reload
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%r14d, %esi
	shrl	$31, %esi
	addl	%r14d, %esi
	sarl	%esi
	movslq	%esi, %rsi
	leaq	(%rcx,%rsi,4), %rcx
	movl	%r11d, %esi
	shrl	$31, %esi
	addl	%r11d, %esi
	sarl	%esi
	movslq	%esi, %rsi
	leaq	(%rax,%rsi,4), %rax
	incl	%r9d
	cmpl	-72(%rbp), %r9d                 ## 4-byte Folded Reload
	je	LBB0_11
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	movl	%edx, %esi
	imull	-68(%rbp), %esi                 ## 4-byte Folded Reload
	testl	%esi, %esi
	jle	LBB0_10
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%r9d, -76(%rbp)                 ## 4-byte Spill
	movq	-120(%rbp), %rdx                ## 8-byte Reload
	leaq	(%rcx,%rdx,4), %rsi
	movq	%rsi, -160(%rbp)                ## 8-byte Spill
	leaq	(%rax,%rdx,4), %rdx
	movq	%rdx, -152(%rbp)                ## 8-byte Spill
	movq	-112(%rbp), %rdx                ## 8-byte Reload
	leaq	(%rcx,%rdx,4), %rsi
	movq	%rsi, -208(%rbp)                ## 8-byte Spill
	leaq	(%rax,%rdx,4), %rdx
	movq	%rdx, -200(%rbp)                ## 8-byte Spill
	movq	-104(%rbp), %rdx                ## 8-byte Reload
	leaq	(%rcx,%rdx,4), %rsi
	movq	%rsi, -192(%rbp)                ## 8-byte Spill
	leaq	(%rax,%rdx,4), %rdx
	movq	%rdx, -184(%rbp)                ## 8-byte Spill
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	movq	%rcx, -136(%rbp)                ## 8-byte Spill
	leaq	(%rcx,%rdx,4), %r12
	movq	%rax, -144(%rbp)                ## 8-byte Spill
	leaq	(%rax,%rdx,4), %r14
	xorl	%r13d, %r13d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=2
	addq	-168(%rbp), %r13                ## 8-byte Folded Reload
	movq	-176(%rbp), %rax                ## 8-byte Reload
	movl	(%rax), %edx
	movl	%edx, %eax
	imull	-68(%rbp), %eax                 ## 4-byte Folded Reload
	cltq
	cmpq	%rax, %r13
	jge	LBB0_9
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movss	(%r12,%r13,4), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	movss	-64(%rbp), %xmm3                ## 4-byte Reload
                                        ## xmm3 = mem[0],zero,zero,zero
	divss	%xmm3, %xmm0
	movss	%xmm0, -60(%rbp)
	movq	-192(%rbp), %rax                ## 8-byte Reload
	movss	(%rax,%r13,4), %xmm1            ## xmm1 = mem[0],zero,zero,zero
	divss	%xmm3, %xmm1
	movss	%xmm1, -56(%rbp)
	movq	-208(%rbp), %rax                ## 8-byte Reload
	movss	(%rax,%r13,4), %xmm2            ## xmm2 = mem[0],zero,zero,zero
	divss	%xmm3, %xmm2
	movss	%xmm2, -52(%rbp)
	callq	_FFMAX3
	movss	%xmm0, -48(%rbp)                ## 4-byte Spill
	movss	-60(%rbp), %xmm0                ## xmm0 = mem[0],zero,zero,zero
	movss	-56(%rbp), %xmm1                ## xmm1 = mem[0],zero,zero,zero
	movss	-52(%rbp), %xmm2                ## xmm2 = mem[0],zero,zero,zero
	callq	_FFMIN3
	movaps	%xmm0, %xmm1
	addss	-48(%rbp), %xmm1                ## 4-byte Folded Reload
	movss	%xmm1, -48(%rbp)                ## 4-byte Spill
	movss	-60(%rbp), %xmm0                ## xmm0 = mem[0],zero,zero,zero
	movl	64(%r15), %edi
	movl	56(%r15), %edx
	movl	60(%r15), %esi
	callq	_get_component
	movss	%xmm0, -60(%rbp)
	movss	-56(%rbp), %xmm0                ## xmm0 = mem[0],zero,zero,zero
	movl	52(%r15), %edi
	movl	44(%r15), %edx
	movl	48(%r15), %esi
	movss	-48(%rbp), %xmm1                ## 4-byte Reload
                                        ## xmm1 = mem[0],zero,zero,zero
	callq	_get_component
	movss	%xmm0, -56(%rbp)
	movss	-52(%rbp), %xmm0                ## xmm0 = mem[0],zero,zero,zero
	movl	40(%r15), %edi
	movl	32(%r15), %edx
	movl	36(%r15), %esi
	movss	-48(%rbp), %xmm1                ## 4-byte Reload
                                        ## xmm1 = mem[0],zero,zero,zero
	callq	_get_component
	movss	%xmm0, -52(%rbp)
	cmpq	$0, 24(%r15)
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	leaq	-60(%rbp), %rdi
	leaq	-56(%rbp), %rsi
	leaq	-52(%rbp), %rdx
	movss	-48(%rbp), %xmm0                ## 4-byte Reload
                                        ## xmm0 = mem[0],zero,zero,zero
	callq	_preservel
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=2
	movss	-60(%rbp), %xmm0                ## xmm0 = mem[0],zero,zero,zero
	mulss	-64(%rbp), %xmm0                ## 4-byte Folded Reload
	movl	%ebx, %edi
	callq	_av_clip_uintp2_c
	movss	%xmm0, (%r14,%r13,4)
	movss	-56(%rbp), %xmm0                ## xmm0 = mem[0],zero,zero,zero
	mulss	-64(%rbp), %xmm0                ## 4-byte Folded Reload
	movl	%ebx, %edi
	callq	_av_clip_uintp2_c
	movq	-184(%rbp), %rax                ## 8-byte Reload
	movss	%xmm0, (%rax,%r13,4)
	movss	-52(%rbp), %xmm0                ## xmm0 = mem[0],zero,zero,zero
	mulss	-64(%rbp), %xmm0                ## 4-byte Folded Reload
	movl	%ebx, %edi
	callq	_av_clip_uintp2_c
	movq	-200(%rbp), %rax                ## 8-byte Reload
	movss	%xmm0, (%rax,%r13,4)
	cmpb	$0, -41(%rbp)                   ## 1-byte Folded Reload
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=2
	movq	-160(%rbp), %rax                ## 8-byte Reload
	movss	(%rax,%r13,4), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	movq	-152(%rbp), %rax                ## 8-byte Reload
	movss	%xmm0, (%rax,%r13,4)
	jmp	LBB0_8
LBB0_11:
	xorl	%eax, %eax
	addq	$168, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_R,8,3                          ## @R
	.comm	_G,8,3                          ## @G
	.comm	_B,8,3                          ## @B
	.comm	_A,8,3                          ## @A
	.no_dead_strip	_color_balance16
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function color_balance16
_color_balance16:                       ; @color_balance16
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #272
	.cfi_def_cfa_offset 272
	stp	d9, d8, [sp, #160]              ; 16-byte Folded Spill
	stp	x28, x27, [sp, #176]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #192]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #208]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #224]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #240]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #256]            ; 16-byte Folded Spill
	add	x29, sp, #256
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	.cfi_offset b8, -104
	.cfi_offset b9, -112
	ldr	x20, [x0, #8]
	ldr	x8, [x1]
	str	x8, [sp, #48]                   ; 8-byte Folded Spill
	ldr	w8, [x8]
	mul	w9, w8, w2
	sdiv	w2, w9, w3
	add	w8, w8, w9
	sdiv	w9, w8, w3
	ldr	w10, [x20, #8]
	cmp	w10, #0
	cinc	w8, w10, lt
	str	w9, [sp, #60]                   ; 4-byte Folded Spill
	cmp	w2, w9
	b.ge	LBB0_11
; %bb.1:
	ldr	x1, [x1, #8]
	ldr	x9, [x20]
Lloh0:
	adrp	x11, _A@GOTPAGE
Lloh1:
	ldr	x11, [x11, _A@GOTPAGEOFF]
Lloh2:
	ldr	x11, [x11]
	ldrsw	x11, [x9, x11, lsl #2]
	asr	w3, w8, #1
Lloh3:
	adrp	x8, _B@GOTPAGE
Lloh4:
	ldr	x8, [x8, _B@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	ldrsw	x12, [x9, x8, lsl #2]
	ldr	w19, [x20, #12]
Lloh6:
	adrp	x8, _G@GOTPAGE
Lloh7:
	ldr	x8, [x8, _G@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	ldrsw	x13, [x9, x8, lsl #2]
	ldr	s9, [x20, #16]
Lloh9:
	adrp	x8, _R@GOTPAGE
Lloh10:
	ldr	x8, [x8, _R@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	ldrsw	x14, [x9, x8, lsl #2]
	ldr	x17, [sp, #48]                  ; 8-byte Folded Reload
	ldp	x9, x8, [x17, #8]
	ldr	x15, [x8]
	ldr	w8, [x9]
	mul	w9, w8, w2
	cmp	w9, #0
	cinc	w9, w9, lt
	asr	w9, w9, #1
	add	x4, x15, w9, sxtw #2
	ldp	x15, x9, [x1, #8]
	ldr	x16, [x9]
	ldr	w9, [x15]
	mul	w15, w9, w2
	cmp	w15, #0
	cinc	w15, w15, lt
	asr	w15, w15, #1
	add	x16, x16, w15, sxtw #2
	ldr	x15, [x0]
	ldr	x15, [x15]
	cmp	x1, x17
	and	w10, w10, #0xfffffffe
	ccmp	w10, #8, #0, ne
	cset	w10, eq
	str	w10, [sp, #116]                 ; 4-byte Folded Spill
	stp	x15, x3, [sp, #120]             ; 16-byte Folded Spill
	sxtw	x10, w3
	str	x10, [sp, #104]                 ; 8-byte Folded Spill
	lsl	x10, x11, #2
	stp	x10, x1, [sp, #32]              ; 16-byte Folded Spill
	lsl	x10, x12, #2
	str	x10, [sp, #24]                  ; 8-byte Folded Spill
	ldr	w10, [x15]
	lsl	x11, x13, #2
	str	x11, [sp, #16]                  ; 8-byte Folded Spill
	lsl	x11, x14, #2
	str	x11, [sp, #8]                   ; 8-byte Folded Spill
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [sp, #40]                   ; 8-byte Folded Reload
	ldr	x8, [x8, #8]
	ldr	w9, [x8]
	ldr	x8, [sp, #48]                   ; 8-byte Folded Reload
	ldr	x8, [x8, #8]
	ldr	w8, [x8]
	ldr	w2, [sp, #84]                   ; 4-byte Folded Reload
	ldp	x16, x4, [sp, #64]              ; 16-byte Folded Reload
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	cmp	w9, #0
	cinc	w11, w9, lt
	asr	w11, w11, #1
	add	x16, x16, w11, sxtw #2
	cmp	w8, #0
	cinc	w11, w8, lt
	asr	w11, w11, #1
	add	x4, x4, w11, sxtw #2
	add	w2, w2, #1
	ldr	w11, [sp, #60]                  ; 4-byte Folded Reload
	cmp	w2, w11
	b.eq	LBB0_11
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	ldr	x11, [sp, #128]                 ; 8-byte Folded Reload
	mul	w11, w10, w11
	cmp	w11, #1
	b.lt	LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	str	w2, [sp, #84]                   ; 4-byte Folded Spill
	mov	x23, #0
	ldr	x8, [sp, #32]                   ; 8-byte Folded Reload
	add	x9, x16, x8
	add	x8, x4, x8
	stp	x8, x9, [sp, #88]               ; 16-byte Folded Spill
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	add	x27, x16, x8
	add	x22, x4, x8
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	add	x26, x16, x8
	add	x25, x4, x8
	stp	x16, x4, [sp, #64]              ; 16-byte Folded Spill
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	add	x28, x16, x8
	add	x24, x4, x8
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=2
	ldr	x8, [sp, #104]                  ; 8-byte Folded Reload
	add	x23, x23, x8
	ldr	x8, [sp, #120]                  ; 8-byte Folded Reload
	ldr	w10, [x8]
	ldr	x8, [sp, #128]                  ; 8-byte Folded Reload
	mul	w8, w10, w8
	cmp	x23, w8, sxtw
	b.ge	LBB0_2
LBB0_7:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	lsl	x21, x23, #2
	ldr	s0, [x28, x21]
	fdiv	s0, s0, s9
	stur	s0, [x29, #-108]
	ldr	s1, [x26, x21]
	fdiv	s1, s1, s9
	stur	s1, [x29, #-112]
	ldr	s2, [x27, x21]
	fdiv	s2, s2, s9
	stur	s2, [x29, #-116]
	bl	_FFMAX3
	fmov	s8, s0
	ldp	s1, s0, [x29, #-112]
	ldur	s2, [x29, #-116]
	bl	_FFMIN3
	fadd	s8, s8, s0
	ldur	s0, [x29, #-108]
	ldp	w1, w0, [x20, #60]
	ldr	w2, [x20, #56]
	fmov	s1, s8
	bl	_get_component
	stur	s0, [x29, #-108]
	ldur	s0, [x29, #-112]
	ldp	w1, w0, [x20, #48]
	ldr	w2, [x20, #44]
	fmov	s1, s8
	bl	_get_component
	stur	s0, [x29, #-112]
	ldur	s0, [x29, #-116]
	ldp	w1, w0, [x20, #36]
	ldr	w2, [x20, #32]
	fmov	s1, s8
	bl	_get_component
	stur	s0, [x29, #-116]
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	sub	x0, x29, #108
	sub	x1, x29, #112
	sub	x2, x29, #116
	fmov	s0, s8
	bl	_preservel
LBB0_9:                                 ;   in Loop: Header=BB0_7 Depth=2
	ldur	s0, [x29, #-108]
	fmul	s0, s9, s0
	mov	x0, x19
	bl	_av_clip_uintp2_c
	str	s0, [x24, x21]
	ldur	s0, [x29, #-112]
	fmul	s0, s9, s0
	mov	x0, x19
	bl	_av_clip_uintp2_c
	str	s0, [x25, x21]
	ldur	s0, [x29, #-116]
	fmul	s0, s9, s0
	mov	x0, x19
	bl	_av_clip_uintp2_c
	str	s0, [x22, x21]
	ldr	w8, [sp, #116]                  ; 4-byte Folded Reload
	cbz	w8, LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=2
	ldr	x8, [sp, #96]                   ; 8-byte Folded Reload
	ldr	s0, [x8, x21]
	ldr	x8, [sp, #88]                   ; 8-byte Folded Reload
	str	s0, [x8, x21]
	b	LBB0_6
LBB0_11:
	mov	w0, #0
	ldp	x29, x30, [sp, #256]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #240]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #224]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #208]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #192]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #176]            ; 16-byte Folded Reload
	ldp	d9, d8, [sp, #160]              ; 16-byte Folded Reload
	add	sp, sp, #272
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_R,8,3                          ; @R
	.comm	_G,8,3                          ; @G
	.comm	_B,8,3                          ; @B
	.comm	_A,8,3                          ; @A
	.no_dead_strip	_color_balance16
.subsections_via_symbols
