	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aw_pwm_attach
_aw_pwm_attach:                         ## @aw_pwm_attach
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r15d
	callq	_device_get_softc
	movq	%rax, %r14
	movl	%r15d, 28(%rax)
	leaq	24(%rax), %rbx
	movl	%r15d, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	movq	%rbx, %rcx
	callq	_clk_get_by_ofw_index
	testl	%eax, %eax
	je	LBB0_3
## %bb.1:
	movl	%eax, %r12d
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_2
LBB0_3:
	movl	(%rbx), %edi
	callq	_clk_enable
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %r12d
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_2
LBB0_5:
	movl	24(%r14), %edi
	movq	%r14, %rsi
	callq	_clk_get_freq
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r12d
	leaq	L_.str.2(%rip), %rsi
LBB0_2:
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_device_printf
LBB0_9:
	movl	%r15d, %edi
	callq	_aw_pwm_detach
	movl	%r12d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_aw_pwm_spec@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdx
	addq	$20, %rdx
	movl	%r15d, %edi
	callq	_bus_alloc_resources
	testq	%rax, %rax
	je	LBB0_10
## %bb.8:
	leaq	L_.str.3(%rip), %rsi
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	jmp	LBB0_9
LBB0_10:
	movq	_AW_PWM_CTRL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r14, %rdi
	callq	_AW_PWM_READ
	movq	_AW_PWM_CTRL_GATE@GOTPCREL(%rip), %rcx
	movq	_AW_PWM_CTRL_EN@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	testl	%eax, %edx
	je	LBB0_12
## %bb.11:
	movl	$1, 4(%r14)
LBB0_12:
	movl	(%rbx), %esi
	movq	%r14, %rdi
	callq	_AW_PWM_READ
	movl	%eax, %ebx
	movq	_AW_PWM_CTRL_PRESCALE_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %ebx
	movq	_aw_pwm_clk_prescaler@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	callq	_nitems
	cmpl	%eax, %ebx
	jle	LBB0_14
## %bb.13:
	leaq	L_.str.4(%rip), %rsi
	movl	%r15d, %edi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_device_printf
	jmp	LBB0_15
LBB0_14:
	movslq	%ebx, %rcx
	movl	(%r14), %eax
	movq	(%r12), %rsi
	cltd
	idivl	(%rsi,%rcx,4)
	movl	%eax, %r12d
	movq	_AW_PWM_PERIOD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_AW_PWM_READ
	movl	%eax, %ebx
	movq	_NS_PER_SEC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_AW_PWM_PERIOD_TOTAL_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%ebx, %edi
	sarl	%cl, %edi
	movq	_AW_PWM_PERIOD_TOTAL_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %edi
	movl	%r12d, %eax
	cltd
	idivl	%edi
	movl	%eax, %ecx
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, 8(%r14)
	movq	_AW_PWM_PERIOD_ACTIVE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %ebx
	movq	_AW_PWM_PERIOD_ACTIVE_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %ebx
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	movl	%eax, %ecx
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, 12(%r14)
LBB0_15:
	movl	%r15d, %edi
	callq	_ofw_bus_get_node
	movl	%eax, %edi
	callq	_OF_xref_from_node
	movl	%eax, %edi
	movl	%r15d, %esi
	callq	_OF_device_register_xref
	leaq	L_.str.5(%rip), %rsi
	movl	%r15d, %edi
	movl	$-1, %edx
	callq	_device_add_child
	movl	%eax, 16(%r14)
	movl	%r15d, %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_bus_generic_attach             ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot get clock\n"

L_.str.1:                               ## @.str.1
	.asciz	"cannot enable clock\n"

L_.str.2:                               ## @.str.2
	.asciz	"cannot get clock frequency\n"

	.comm	_aw_pwm_spec,4,2                ## @aw_pwm_spec
L_.str.3:                               ## @.str.3
	.asciz	"cannot allocate resources for device\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_AW_PWM_CTRL,4,2                ## @AW_PWM_CTRL
	.comm	_AW_PWM_CTRL_GATE,4,2           ## @AW_PWM_CTRL_GATE
	.comm	_AW_PWM_CTRL_EN,4,2             ## @AW_PWM_CTRL_EN
	.comm	_AW_PWM_CTRL_PRESCALE_MASK,4,2  ## @AW_PWM_CTRL_PRESCALE_MASK
	.comm	_aw_pwm_clk_prescaler,8,3       ## @aw_pwm_clk_prescaler
L_.str.4:                               ## @.str.4
	.asciz	"Bad prescaler %x, cannot guess current settings\n"

	.comm	_AW_PWM_PERIOD,4,2              ## @AW_PWM_PERIOD
	.comm	_NS_PER_SEC,4,2                 ## @NS_PER_SEC
	.comm	_AW_PWM_PERIOD_TOTAL_SHIFT,4,2  ## @AW_PWM_PERIOD_TOTAL_SHIFT
	.comm	_AW_PWM_PERIOD_TOTAL_MASK,4,2   ## @AW_PWM_PERIOD_TOTAL_MASK
	.comm	_AW_PWM_PERIOD_ACTIVE_SHIFT,4,2 ## @AW_PWM_PERIOD_ACTIVE_SHIFT
	.comm	_AW_PWM_PERIOD_ACTIVE_MASK,4,2  ## @AW_PWM_PERIOD_ACTIVE_MASK
L_.str.5:                               ## @.str.5
	.asciz	"pwmbus"

	.no_dead_strip	_aw_pwm_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aw_pwm_attach
_aw_pwm_attach:                         ; @aw_pwm_attach
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	str	w19, [x0, #28]
	add	x22, x0, #24
	mov	x0, x19
	mov	w1, #0
	mov	w2, #0
	mov	x3, x22
	bl	_clk_get_by_ofw_index
	cbz	w0, LBB0_2
; %bb.1:
	mov	x21, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_6
LBB0_2:
	ldr	w0, [x22]
	bl	_clk_enable
	cbz	w0, LBB0_4
; %bb.3:
	mov	x21, x0
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_6
LBB0_4:
	ldr	w0, [x20, #24]
	mov	x1, x20
	bl	_clk_get_freq
	cbz	w0, LBB0_8
; %bb.5:
	mov	x21, x0
Lloh4:
	adrp	x1, l_.str.2@PAGE
Lloh5:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_6:
	mov	x0, x19
	bl	_device_printf
LBB0_7:
	mov	x0, x19
	bl	_aw_pwm_detach
	mov	x0, 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
	add	sp, sp, #64
	ret
LBB0_8:
Lloh6:
	adrp	x8, _aw_pwm_spec@GOTPAGE
Lloh7:
	ldr	x8, [x8, _aw_pwm_spec@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	add	x2, x20, #20
	mov	x0, x19
	bl	_bus_alloc_resources
	cbz	x0, LBB0_10
; %bb.9:
Lloh9:
	adrp	x1, l_.str.3@PAGE
Lloh10:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_device_printf
Lloh11:
	adrp	x8, _ENXIO@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh13:
	ldr	w21, [x8]
	b	LBB0_7
LBB0_10:
Lloh14:
	adrp	x21, _AW_PWM_CTRL@GOTPAGE
Lloh15:
	ldr	x21, [x21, _AW_PWM_CTRL@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x20
	bl	_AW_PWM_READ
Lloh16:
	adrp	x8, _AW_PWM_CTRL_GATE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _AW_PWM_CTRL_GATE@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
Lloh19:
	adrp	x9, _AW_PWM_CTRL_EN@GOTPAGE
Lloh20:
	ldr	x9, [x9, _AW_PWM_CTRL_EN@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w8, w9, w8
	tst	w8, w0
	b.eq	LBB0_12
; %bb.11:
	mov	w8, #1
	str	w8, [x20, #4]
LBB0_12:
	ldr	w1, [x21]
	mov	x0, x20
	bl	_AW_PWM_READ
Lloh22:
	adrp	x8, _AW_PWM_CTRL_PRESCALE_MASK@GOTPAGE
Lloh23:
	ldr	x8, [x8, _AW_PWM_CTRL_PRESCALE_MASK@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	and	w21, w8, w0
Lloh25:
	adrp	x22, _aw_pwm_clk_prescaler@GOTPAGE
Lloh26:
	ldr	x22, [x22, _aw_pwm_clk_prescaler@GOTPAGEOFF]
	ldr	x0, [x22]
	bl	_nitems
	cmp	w21, w0
	b.le	LBB0_14
; %bb.13:
	str	x21, [sp]
Lloh27:
	adrp	x1, l_.str.4@PAGE
Lloh28:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_device_printf
	b	LBB0_15
LBB0_14:
	ldr	w8, [x20]
	ldr	x9, [x22]
	ldr	w9, [x9, w21, sxtw #2]
Lloh29:
	adrp	x10, _AW_PWM_PERIOD@GOTPAGE
Lloh30:
	ldr	x10, [x10, _AW_PWM_PERIOD@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x10]
	sdiv	w21, w8, w9
	mov	x0, x20
	bl	_AW_PWM_READ
Lloh32:
	adrp	x8, _NS_PER_SEC@GOTPAGE
Lloh33:
	ldr	x8, [x8, _NS_PER_SEC@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
Lloh35:
	adrp	x9, _AW_PWM_PERIOD_TOTAL_SHIFT@GOTPAGE
Lloh36:
	ldr	x9, [x9, _AW_PWM_PERIOD_TOTAL_SHIFT@GOTPAGEOFF]
Lloh37:
	ldr	w9, [x9]
	asr	w9, w0, w9
Lloh38:
	adrp	x10, _AW_PWM_PERIOD_TOTAL_MASK@GOTPAGE
Lloh39:
	ldr	x10, [x10, _AW_PWM_PERIOD_TOTAL_MASK@GOTPAGEOFF]
Lloh40:
	ldr	w10, [x10]
	and	w9, w9, w10
	sdiv	w9, w21, w9
	sdiv	w9, w8, w9
Lloh41:
	adrp	x10, _AW_PWM_PERIOD_ACTIVE_SHIFT@GOTPAGE
Lloh42:
	ldr	x10, [x10, _AW_PWM_PERIOD_ACTIVE_SHIFT@GOTPAGEOFF]
Lloh43:
	ldr	w10, [x10]
	asr	w10, w0, w10
Lloh44:
	adrp	x11, _AW_PWM_PERIOD_ACTIVE_MASK@GOTPAGE
Lloh45:
	ldr	x11, [x11, _AW_PWM_PERIOD_ACTIVE_MASK@GOTPAGEOFF]
Lloh46:
	ldr	w11, [x11]
	and	w10, w10, w11
	sdiv	w10, w21, w10
	sdiv	w8, w8, w10
	stp	w9, w8, [x20, #8]
LBB0_15:
	mov	x0, x19
	bl	_ofw_bus_get_node
	bl	_OF_xref_from_node
	mov	x1, x19
	bl	_OF_device_register_xref
Lloh47:
	adrp	x1, l_.str.5@PAGE
Lloh48:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x19
	mov	w2, #-1
	bl	_device_add_child
	str	w0, [x20, #16]
	mov	x0, x19
	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
	add	sp, sp, #64
	b	_bus_generic_attach
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh47, Lloh48
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot get clock\n"

l_.str.1:                               ; @.str.1
	.asciz	"cannot enable clock\n"

l_.str.2:                               ; @.str.2
	.asciz	"cannot get clock frequency\n"

	.comm	_aw_pwm_spec,4,2                ; @aw_pwm_spec
l_.str.3:                               ; @.str.3
	.asciz	"cannot allocate resources for device\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_AW_PWM_CTRL,4,2                ; @AW_PWM_CTRL
	.comm	_AW_PWM_CTRL_GATE,4,2           ; @AW_PWM_CTRL_GATE
	.comm	_AW_PWM_CTRL_EN,4,2             ; @AW_PWM_CTRL_EN
	.comm	_AW_PWM_CTRL_PRESCALE_MASK,4,2  ; @AW_PWM_CTRL_PRESCALE_MASK
	.comm	_aw_pwm_clk_prescaler,8,3       ; @aw_pwm_clk_prescaler
l_.str.4:                               ; @.str.4
	.asciz	"Bad prescaler %x, cannot guess current settings\n"

	.comm	_AW_PWM_PERIOD,4,2              ; @AW_PWM_PERIOD
	.comm	_NS_PER_SEC,4,2                 ; @NS_PER_SEC
	.comm	_AW_PWM_PERIOD_TOTAL_SHIFT,4,2  ; @AW_PWM_PERIOD_TOTAL_SHIFT
	.comm	_AW_PWM_PERIOD_TOTAL_MASK,4,2   ; @AW_PWM_PERIOD_TOTAL_MASK
	.comm	_AW_PWM_PERIOD_ACTIVE_SHIFT,4,2 ; @AW_PWM_PERIOD_ACTIVE_SHIFT
	.comm	_AW_PWM_PERIOD_ACTIVE_MASK,4,2  ; @AW_PWM_PERIOD_ACTIVE_MASK
l_.str.5:                               ; @.str.5
	.asciz	"pwmbus"

	.no_dead_strip	_aw_pwm_attach
.subsections_via_symbols
