	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_atmel_hlcdc_crtc_create        ## -- Begin function atmel_hlcdc_crtc_create
	.p2align	4, 0x90
_atmel_hlcdc_crtc_create:               ## @atmel_hlcdc_crtc_create
	.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	%rdi, %rbx
	movq	(%rdi), %r12
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, %r13
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, 8(%rax)
	movq	_ATMEL_HLCDC_MAX_LAYERS@GOTPCREL(%rip), %r15
	cmpl	$0, (%r15)
	jle	LBB0_3
## %bb.4:
	xorl	%r14d, %r14d
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	callq	_atmel_hlcdc_layer_to_plane
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	incq	%r14
	movslq	(%r15), %rax
	cmpq	%rax, %r14
	jge	LBB0_11
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r12), %rax
	movq	(%rax,%r14,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	(%rdi), %rax
	movl	(%rax), %eax
	cmpl	$128, %eax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	cmpl	$129, %eax
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	callq	_atmel_hlcdc_layer_to_plane
	movq	%rax, %rbx
	jmp	LBB0_10
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_20
LBB0_3:
	xorl	%eax, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
LBB0_11:
	addq	$4, %r13
	movq	_atmel_hlcdc_crtc_funcs@GOTPCREL(%rip), %r8
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movq	%rbx, %rdx
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	xorl	%r9d, %r9d
	callq	_drm_crtc_init_with_planes
	testl	%eax, %eax
	js	LBB0_19
## %bb.12:
	movq	%r13, %rdi
	callq	_drm_crtc_index
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	movl	(%r15), %eax
	testl	%eax, %eax
	jle	LBB0_18
## %bb.13:
	xorl	%ebx, %ebx
	movq	_ATMEL_HLCDC_OVERLAY_LAYER@GOTPCREL(%rip), %r14
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_14 Depth=1
	incq	%rbx
	movslq	%eax, %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_18
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r12), %rcx
	movq	(%rcx,%rbx,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_17
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	movq	(%rdi), %rcx
	movl	(%rcx), %ecx
	cmpl	(%r14), %ecx
	jne	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_14 Depth=1
	callq	_atmel_hlcdc_layer_to_plane
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movzbl	(%rcx), %ecx
	movl	$1, %edx
	shll	%cl, %edx
	movl	%edx, (%rax)
	movl	(%r15), %eax
	jmp	LBB0_17
LBB0_18:
	movq	_lcdc_crtc_helper_funcs@GOTPCREL(%rip), %rsi
	movq	%r13, %rdi
	callq	_drm_crtc_helper_add
	movq	%r13, %rdi
	callq	_drm_crtc_vblank_reset
	movq	_ATMEL_HLCDC_CLUT_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r13, %rdi
	callq	_drm_mode_crtc_set_gamma_size
	movl	(%rbx), %ecx
	xorl	%r14d, %r14d
	movq	%r13, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_drm_crtc_enable_color_mgmt
	movq	%r13, (%r12)
	jmp	LBB0_20
LBB0_19:
	movl	%eax, %r14d
	movq	%r13, %rdi
	callq	_atmel_hlcdc_crtc_destroy
LBB0_20:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_ATMEL_HLCDC_MAX_LAYERS,4,2     ## @ATMEL_HLCDC_MAX_LAYERS
	.comm	_atmel_hlcdc_crtc_funcs,4,2     ## @atmel_hlcdc_crtc_funcs
	.comm	_ATMEL_HLCDC_OVERLAY_LAYER,4,2  ## @ATMEL_HLCDC_OVERLAY_LAYER
	.comm	_lcdc_crtc_helper_funcs,4,2     ## @lcdc_crtc_helper_funcs
	.comm	_ATMEL_HLCDC_CLUT_SIZE,4,2      ## @ATMEL_HLCDC_CLUT_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_atmel_hlcdc_crtc_create        ; -- Begin function atmel_hlcdc_crtc_create
	.p2align	2
_atmel_hlcdc_crtc_create:               ; @atmel_hlcdc_crtc_create
	.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	x21, x0
	ldr	x24, [x0]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	cbz	x0, LBB0_9
; %bb.1:
	mov	x19, x0
	str	x24, [x0, #8]
Lloh3:
	adrp	x25, _ATMEL_HLCDC_MAX_LAYERS@GOTPAGE
Lloh4:
	ldr	x25, [x25, _ATMEL_HLCDC_MAX_LAYERS@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.2:
	mov	x20, #0
	mov	x23, #0
	mov	x22, #0
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	bl	_atmel_hlcdc_layer_to_plane
	mov	x22, x0
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x20, x20, #1
	ldrsw	x8, [x25]
	cmp	x20, x8
	b.ge	LBB0_11
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x24, #8]
	ldr	x0, [x8, x20, lsl #3]
	cbz	x0, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x0]
	ldr	w8, [x8]
	cmp	w8, #128
	b.eq	LBB0_3
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	w8, #129
	b.ne	LBB0_4
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	bl	_atmel_hlcdc_layer_to_plane
	mov	x23, x0
	b	LBB0_4
LBB0_9:
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_20
LBB0_10:
	mov	x22, #0
	mov	x23, #0
LBB0_11:
	add	x20, x19, #4
Lloh8:
	adrp	x4, _atmel_hlcdc_crtc_funcs@GOTPAGE
Lloh9:
	ldr	x4, [x4, _atmel_hlcdc_crtc_funcs@GOTPAGEOFF]
	mov	x0, x21
	mov	x1, x20
	mov	x2, x23
	mov	x3, x22
	mov	x5, #0
	bl	_drm_crtc_init_with_planes
	tbnz	w0, #31, LBB0_19
; %bb.12:
	mov	x0, x20
	bl	_drm_crtc_index
	str	w0, [x19]
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.13:
	mov	x21, #0
Lloh10:
	adrp	x22, _ATMEL_HLCDC_OVERLAY_LAYER@GOTPAGE
Lloh11:
	ldr	x22, [x22, _ATMEL_HLCDC_OVERLAY_LAYER@GOTPAGEOFF]
	mov	w23, #1
	b	LBB0_15
LBB0_14:                                ;   in Loop: Header=BB0_15 Depth=1
	add	x21, x21, #1
	cmp	x21, w8, sxtw
	b.ge	LBB0_18
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x24, #8]
	ldr	x0, [x9, x21, lsl #3]
	cbz	x0, LBB0_14
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	ldr	x9, [x0]
	ldr	w9, [x9]
	ldr	w10, [x22]
	cmp	w9, w10
	b.ne	LBB0_14
; %bb.17:                               ;   in Loop: Header=BB0_15 Depth=1
	bl	_atmel_hlcdc_layer_to_plane
	ldr	w8, [x19]
	lsl	w8, w23, w8
	str	w8, [x0]
	ldr	w8, [x25]
	b	LBB0_14
LBB0_18:
Lloh12:
	adrp	x1, _lcdc_crtc_helper_funcs@GOTPAGE
Lloh13:
	ldr	x1, [x1, _lcdc_crtc_helper_funcs@GOTPAGEOFF]
	mov	x0, x20
	bl	_drm_crtc_helper_add
	mov	x0, x20
	bl	_drm_crtc_vblank_reset
Lloh14:
	adrp	x19, _ATMEL_HLCDC_CLUT_SIZE@GOTPAGE
Lloh15:
	ldr	x19, [x19, _ATMEL_HLCDC_CLUT_SIZE@GOTPAGEOFF]
	ldr	w1, [x19]
	mov	x0, x20
	bl	_drm_mode_crtc_set_gamma_size
	ldr	w3, [x19]
	mov	x0, x20
	mov	w1, #0
	mov	w2, #0
	bl	_drm_crtc_enable_color_mgmt
	mov	w21, #0
	str	x20, [x24]
	b	LBB0_20
LBB0_19:
	mov	x21, x0
	mov	x0, x20
	bl	_atmel_hlcdc_crtc_destroy
LBB0_20:
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_ATMEL_HLCDC_MAX_LAYERS,4,2     ; @ATMEL_HLCDC_MAX_LAYERS
	.comm	_atmel_hlcdc_crtc_funcs,4,2     ; @atmel_hlcdc_crtc_funcs
	.comm	_ATMEL_HLCDC_OVERLAY_LAYER,4,2  ; @ATMEL_HLCDC_OVERLAY_LAYER
	.comm	_lcdc_crtc_helper_funcs,4,2     ; @lcdc_crtc_helper_funcs
	.comm	_ATMEL_HLCDC_CLUT_SIZE,4,2      ; @ATMEL_HLCDC_CLUT_SIZE
.subsections_via_symbols
