	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function map_regamma_hw_to_x_user
_map_regamma_hw_to_x_user:              ## @map_regamma_hw_to_x_user
	.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
	movq	24(%rbp), %r11
	movl	16(%rbp), %r10d
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	cmpl	$0, 32(%rbp)
	je	LBB0_2
## %bb.22:
	movq	%r8, %r12
	movq	%rcx, %rbx
	movq	%rdx, %r13
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	%rcx, %rdi
	movl	%r10d, %esi
	movq	%r9, %rdx
	callq	_copy_rgb_regamma_to_coordinates_x
	movq	24(%rbp), %rax
	movq	%rax, (%rsp)
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movq	%rbx, %rcx
	movq	%r12, %r8
	movl	16(%rbp), %r9d
                                        ## kill: def $r9d killed $r9d killed $r9
	callq	_calculate_interpolated_hardware_curve
	movl	16(%rbp), %r10d
	movq	24(%rbp), %r11
	jmp	LBB0_21
LBB0_2:
	testl	%r10d, %r10d
	js	LBB0_21
## %bb.3:
	movq	16(%r11), %rax
	movq	(%r11), %rcx
	movq	8(%r11), %rdx
	leal	1(%r10), %r8d
	cmpl	$3, %r10d
	jae	LBB0_5
## %bb.4:
	xorl	%edi, %edi
	movq	%r9, %rbx
	jmp	LBB0_16
LBB0_5:
	leaq	(%rax,%r8,4), %rdi
	leaq	(%rdx,%r8,4), %rsi
	leaq	(%rcx,%r8,4), %r12
	leaq	(%r8,%r8,2), %rbx
	leaq	(%r9,%rbx,4), %rbx
	cmpq	%rsi, %rax
	setb	-45(%rbp)                       ## 1-byte Folded Spill
	cmpq	%rdi, %rdx
	setb	-44(%rbp)                       ## 1-byte Folded Spill
	cmpq	%r12, %rax
	setb	%r15b
	cmpq	%rdi, %rcx
	setb	-43(%rbp)                       ## 1-byte Folded Spill
	cmpq	%rbx, %rax
	setb	%r13b
	cmpq	%r9, %rdi
	seta	-42(%rbp)                       ## 1-byte Folded Spill
	cmpq	%r12, %rdx
	setb	%r10b
	cmpq	%rsi, %rcx
	setb	-41(%rbp)                       ## 1-byte Folded Spill
	cmpq	%rbx, %rdx
	setb	%r11b
	cmpq	%r9, %rsi
	seta	%sil
	cmpq	%rbx, %rcx
	setb	%r14b
	cmpq	%r9, %r12
	seta	%r12b
	xorl	%edi, %edi
	movb	-44(%rbp), %bl                  ## 1-byte Reload
	testb	%bl, -45(%rbp)                  ## 1-byte Folded Reload
	jne	LBB0_6
## %bb.7:
	andb	-43(%rbp), %r15b                ## 1-byte Folded Reload
	jne	LBB0_6
## %bb.8:
	andb	-42(%rbp), %r13b                ## 1-byte Folded Reload
	jne	LBB0_6
## %bb.9:
	andb	-41(%rbp), %r10b                ## 1-byte Folded Reload
	jne	LBB0_6
## %bb.10:
	andb	%sil, %r11b
	movl	16(%rbp), %r10d
	jne	LBB0_11
## %bb.12:
	andb	%r12b, %r14b
	jne	LBB0_11
## %bb.13:
	movl	%r8d, %edi
	andl	$-4, %edi
	leaq	(%rdi,%rdi,2), %rsi
	leaq	(%r9,%rsi,4), %rbx
	addq	$44, %r9
	leaq	(,%r8,4), %r10
	andq	$-16, %r10
	xorl	%esi, %esi
	movq	24(%rbp), %r11
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movd	-36(%r9), %xmm0                 ## xmm0 = mem[0],zero,zero,zero
	pinsrd	$1, -24(%r9), %xmm0
	pinsrd	$2, -12(%r9), %xmm0
	pinsrd	$3, (%r9), %xmm0
	movdqu	%xmm0, (%rax,%rsi)
	movd	-40(%r9), %xmm0                 ## xmm0 = mem[0],zero,zero,zero
	pinsrd	$1, -28(%r9), %xmm0
	pinsrd	$2, -16(%r9), %xmm0
	pinsrd	$3, -4(%r9), %xmm0
	movdqu	%xmm0, (%rdx,%rsi)
	movd	-44(%r9), %xmm0                 ## xmm0 = mem[0],zero,zero,zero
	pinsrd	$1, -32(%r9), %xmm0
	pinsrd	$2, -20(%r9), %xmm0
	pinsrd	$3, -8(%r9), %xmm0
	movdqu	%xmm0, (%rcx,%rsi)
	addq	$48, %r9
	addq	$16, %rsi
	cmpq	%rsi, %r10
	jne	LBB0_14
## %bb.15:
	cmpq	%r8, %rdi
	movl	16(%rbp), %r10d
	jne	LBB0_16
	jmp	LBB0_21
LBB0_11:
	movq	%r9, %rbx
	movq	24(%rbp), %r11
	jmp	LBB0_16
LBB0_6:
	movq	%r9, %rbx
	movq	24(%rbp), %r11
	movl	16(%rbp), %r10d
LBB0_16:
	movq	%rdi, %r9
	notq	%r9
	testb	$1, %r8b
	je	LBB0_18
## %bb.17:
	movl	8(%rbx), %esi
	movl	%esi, (%rax,%rdi,4)
	movl	4(%rbx), %esi
	movl	%esi, (%rdx,%rdi,4)
	movl	(%rbx), %esi
	movl	%esi, (%rcx,%rdi,4)
	addq	$12, %rbx
	orq	$1, %rdi
LBB0_18:
	addq	%r8, %r9
	je	LBB0_21
## %bb.19:
	addq	$20, %rbx
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movl	-12(%rbx), %esi
	movl	%esi, (%rax,%rdi,4)
	movl	-16(%rbx), %esi
	movl	%esi, (%rdx,%rdi,4)
	movl	-20(%rbx), %esi
	movl	%esi, (%rcx,%rdi,4)
	movl	(%rbx), %esi
	movl	%esi, 4(%rax,%rdi,4)
	movl	-4(%rbx), %esi
	movl	%esi, 4(%rdx,%rdi,4)
	movl	-8(%rbx), %esi
	movl	%esi, 4(%rcx,%rdi,4)
	addq	$2, %rdi
	addq	$24, %rbx
	cmpq	%rdi, %r8
	jne	LBB0_20
LBB0_21:
	movl	%r10d, %edi
	movq	%r11, %rsi
	callq	_build_new_custom_resulted_curve
	movl	$1, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_map_regamma_hw_to_x_user
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function map_regamma_hw_to_x_user
_map_regamma_hw_to_x_user:              ; @map_regamma_hw_to_x_user
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x7
	mov	x20, x6
	cbz	x0, LBB0_3
; %bb.1:
	ldr	w8, [x29, #16]
	cbz	w8, LBB0_3
; %bb.2:
	mov	x21, x4
	mov	x22, x3
	mov	x23, x2
	mov	x24, x1
	mov	x25, x0
	mov	x0, x3
	mov	x1, x20
	mov	x2, x5
	bl	_copy_rgb_regamma_to_coordinates_x
	mov	x0, x25
	mov	x1, x24
	mov	x2, x23
	mov	x3, x22
	mov	x4, x21
	mov	x5, x20
	mov	x6, x19
	bl	_calculate_interpolated_hardware_curve
	b	LBB0_18
LBB0_3:
	tbnz	w20, #31, LBB0_18
; %bb.4:
	ldp	x10, x8, [x19, #8]
	add	w9, w20, #1
	ldr	x11, [x19]
	cmp	w20, #7
	b.hs	LBB0_6
; %bb.5:
	mov	x12, #0
	b	LBB0_15
LBB0_6:
	mov	x12, #0
	lsl	x13, x9, #2
	add	x0, x10, x13
	mov	w14, #12
	madd	x17, x9, x14, x5
	add	x1, x11, x13
	cmp	x8, x1
	add	x2, x8, x13
	ccmp	x11, x2, #2, lo
	cset	w13, lo
	cmp	x8, x17
	ccmp	x2, x5, #0, lo
	cset	w14, hi
	cmp	x10, x1
	ccmp	x11, x0, #2, lo
	cset	w15, lo
	cmp	x10, x17
	ccmp	x0, x5, #0, lo
	cset	w16, hi
	cmp	x11, x17
	ccmp	x1, x5, #0, lo
	cset	w17, hi
	cmp	x10, x2
	ccmp	x8, x0, #2, lo
	b.lo	LBB0_15
; %bb.7:
	tbnz	w13, #0, LBB0_15
; %bb.8:
	tbnz	w14, #0, LBB0_15
; %bb.9:
	tbnz	w15, #0, LBB0_15
; %bb.10:
	tbnz	w16, #0, LBB0_15
; %bb.11:
	tbnz	w17, #0, LBB0_15
; %bb.12:
	and	x12, x9, #0xfffffff8
	mov	w13, #12
	madd	x13, x12, x13, x5
	add	x14, x8, #16
	add	x15, x11, #16
	add	x16, x10, #16
	mov	x17, x12
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x5
	add	x5, x5, #96
	ld3.4s	{ v0, v1, v2 }, [x0], #48
	ld3.4s	{ v3, v4, v5 }, [x0]
	stp	q2, q5, [x14, #-16]
	stp	q1, q4, [x16, #-16]
	stp	q0, q3, [x15, #-16]
	add	x14, x14, #32
	add	x15, x15, #32
	add	x16, x16, #32
	subs	x17, x17, #8
	b.ne	LBB0_13
; %bb.14:
	cmp	x12, x9
	b.eq	LBB0_18
	b	LBB0_16
LBB0_15:
	mov	x13, x5
LBB0_16:
	lsl	x14, x12, #2
	add	x11, x11, x14
	add	x10, x10, x14
	add	x8, x8, x14
	sub	x9, x9, x12
	add	x12, x13, #4
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	w13, [x12, #4]
	str	w13, [x8], #4
	ldr	w13, [x12]
	str	w13, [x10], #4
	ldur	w13, [x12, #-4]
	str	w13, [x11], #4
	add	x12, x12, #12
	subs	x9, x9, #1
	b.ne	LBB0_17
LBB0_18:
	mov	x0, x20
	mov	x1, x19
	bl	_build_new_custom_resulted_curve
	mov	w0, #1
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_map_regamma_hw_to_x_user
.subsections_via_symbols
