	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function phy_init
_phy_init:                              ## @phy_init
	.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
	movq	%rdi, %r15
	movq	_USBPHY_CTRL@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	callq	_PHY_READ4
	movl	%eax, %ebx
	movq	_USBPHY_CTRL_SFTRST@GOTPCREL(%rip), %r12
	orl	(%r12), %ebx
	movl	(%r14), %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_PHY_WRITE4
	movl	$10000, %edi                    ## imm = 0x2710
	callq	_DELAY
	movq	_USBPHY_CTRL_CLKGATE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	orl	(%r12), %edx
	notl	%edx
	andl	%ebx, %edx
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_PHY_WRITE4
	movq	_ENUTMILEVEL2@GOTPCREL(%rip), %rax
	movq	_ENUTMILEVEL3@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	_USBPHY_CTRL_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_PHY_WRITE4
	leaq	L_.str(%rip), %rdi
	callq	_devclass_find
	xorl	%r14d, %r14d
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_devclass_get_device
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %rbx
	movq	_GPIO_USB_PWR@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_GPIO_PIN_OUTPUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_GPIO_PIN_SETFLAGS
	movl	(%r12), %esi
	movq	_GPIO_PIN_HIGH@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_GPIO_PIN_SET
	movq	_USBPHY_PWD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_PHY_WRITE4
	movq	_USBPHY_DEBUG@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_PHY_READ4
	movq	_USBPHY_DEBUG_CLKGATE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	notl	%edx
	andl	%eax, %edx
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_PHY_WRITE4
	jmp	LBB0_3
LBB0_1:
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_device_printf
	movl	$1, %r14d
LBB0_3:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_USBPHY_CTRL,4,2                ## @USBPHY_CTRL
	.comm	_USBPHY_CTRL_SFTRST,4,2         ## @USBPHY_CTRL_SFTRST
	.comm	_USBPHY_CTRL_CLKGATE,4,2        ## @USBPHY_CTRL_CLKGATE
	.comm	_ENUTMILEVEL2,4,2               ## @ENUTMILEVEL2
	.comm	_ENUTMILEVEL3,4,2               ## @ENUTMILEVEL3
	.comm	_USBPHY_CTRL_SET,4,2            ## @USBPHY_CTRL_SET
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"gpio"

L_.str.1:                               ## @.str.1
	.asciz	"Error: failed to get the GPIO dev\n"

	.comm	_GPIO_USB_PWR,4,2               ## @GPIO_USB_PWR
	.comm	_GPIO_PIN_OUTPUT,4,2            ## @GPIO_PIN_OUTPUT
	.comm	_GPIO_PIN_HIGH,4,2              ## @GPIO_PIN_HIGH
	.comm	_USBPHY_PWD,4,2                 ## @USBPHY_PWD
	.comm	_USBPHY_DEBUG,4,2               ## @USBPHY_DEBUG
	.comm	_USBPHY_DEBUG_CLKGATE,4,2       ## @USBPHY_DEBUG_CLKGATE
	.comm	_USBPHY_DEBUG0_STATUS,4,2       ## @USBPHY_DEBUG0_STATUS
	.comm	_USBPHY_DEBUG1,4,2              ## @USBPHY_DEBUG1
	.comm	_USBPHY_IP,4,2                  ## @USBPHY_IP
	.comm	_USBPHY_STATUS,4,2              ## @USBPHY_STATUS
	.no_dead_strip	_phy_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function phy_init
_phy_init:                              ; @phy_init
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
Lloh0:
	adrp	x21, _USBPHY_CTRL@GOTPAGE
Lloh1:
	ldr	x21, [x21, _USBPHY_CTRL@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_PHY_READ4
Lloh2:
	adrp	x22, _USBPHY_CTRL_SFTRST@GOTPAGE
Lloh3:
	ldr	x22, [x22, _USBPHY_CTRL_SFTRST@GOTPAGEOFF]
	ldr	w8, [x22]
	orr	w20, w8, w0
	ldr	w1, [x21]
	mov	x0, x19
	mov	x2, x20
	bl	_PHY_WRITE4
	mov	w0, #10000
	bl	_DELAY
	ldr	w8, [x22]
Lloh4:
	adrp	x9, _USBPHY_CTRL_CLKGATE@GOTPAGE
Lloh5:
	ldr	x9, [x9, _USBPHY_CTRL_CLKGATE@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w2, w20, w8
	ldr	w1, [x21]
	mov	x0, x19
	bl	_PHY_WRITE4
Lloh7:
	adrp	x8, _ENUTMILEVEL2@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENUTMILEVEL2@GOTPAGEOFF]
Lloh9:
	adrp	x9, _ENUTMILEVEL3@GOTPAGE
Lloh10:
	ldr	x9, [x9, _ENUTMILEVEL3@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh13:
	adrp	x8, _USBPHY_CTRL_SET@GOTPAGE
Lloh14:
	ldr	x8, [x8, _USBPHY_CTRL_SET@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_PHY_WRITE4
Lloh16:
	adrp	x0, l_.str@PAGE
Lloh17:
	add	x0, x0, l_.str@PAGEOFF
	bl	_devclass_find
	mov	w1, #0
	bl	_devclass_get_device
	cbz	x0, LBB0_2
; %bb.1:
	mov	x20, x0
Lloh18:
	adrp	x21, _GPIO_USB_PWR@GOTPAGE
Lloh19:
	ldr	x21, [x21, _GPIO_USB_PWR@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh20:
	adrp	x8, _GPIO_PIN_OUTPUT@GOTPAGE
Lloh21:
	ldr	x8, [x8, _GPIO_PIN_OUTPUT@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
	bl	_GPIO_PIN_SETFLAGS
	ldr	w1, [x21]
Lloh23:
	adrp	x8, _GPIO_PIN_HIGH@GOTPAGE
Lloh24:
	ldr	x8, [x8, _GPIO_PIN_HIGH@GOTPAGEOFF]
Lloh25:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_GPIO_PIN_SET
Lloh26:
	adrp	x8, _USBPHY_PWD@GOTPAGE
Lloh27:
	ldr	x8, [x8, _USBPHY_PWD@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_PHY_WRITE4
Lloh29:
	adrp	x20, _USBPHY_DEBUG@GOTPAGE
Lloh30:
	ldr	x20, [x20, _USBPHY_DEBUG@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_PHY_READ4
Lloh31:
	adrp	x8, _USBPHY_DEBUG_CLKGATE@GOTPAGE
Lloh32:
	ldr	x8, [x8, _USBPHY_DEBUG_CLKGATE@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	bic	w2, w0, w8
	ldr	w1, [x20]
	mov	x0, x19
	bl	_PHY_WRITE4
	mov	w0, #0
	b	LBB0_3
LBB0_2:
	ldr	w0, [x19]
Lloh34:
	adrp	x1, l_.str.1@PAGE
Lloh35:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_device_printf
	mov	w0, #1
LBB0_3:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh11
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_USBPHY_CTRL,4,2                ; @USBPHY_CTRL
	.comm	_USBPHY_CTRL_SFTRST,4,2         ; @USBPHY_CTRL_SFTRST
	.comm	_USBPHY_CTRL_CLKGATE,4,2        ; @USBPHY_CTRL_CLKGATE
	.comm	_ENUTMILEVEL2,4,2               ; @ENUTMILEVEL2
	.comm	_ENUTMILEVEL3,4,2               ; @ENUTMILEVEL3
	.comm	_USBPHY_CTRL_SET,4,2            ; @USBPHY_CTRL_SET
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"gpio"

l_.str.1:                               ; @.str.1
	.asciz	"Error: failed to get the GPIO dev\n"

	.comm	_GPIO_USB_PWR,4,2               ; @GPIO_USB_PWR
	.comm	_GPIO_PIN_OUTPUT,4,2            ; @GPIO_PIN_OUTPUT
	.comm	_GPIO_PIN_HIGH,4,2              ; @GPIO_PIN_HIGH
	.comm	_USBPHY_PWD,4,2                 ; @USBPHY_PWD
	.comm	_USBPHY_DEBUG,4,2               ; @USBPHY_DEBUG
	.comm	_USBPHY_DEBUG_CLKGATE,4,2       ; @USBPHY_DEBUG_CLKGATE
	.comm	_USBPHY_DEBUG0_STATUS,4,2       ; @USBPHY_DEBUG0_STATUS
	.comm	_USBPHY_DEBUG1,4,2              ; @USBPHY_DEBUG1
	.comm	_USBPHY_IP,4,2                  ; @USBPHY_IP
	.comm	_USBPHY_STATUS,4,2              ; @USBPHY_STATUS
	.no_dead_strip	_phy_init
.subsections_via_symbols
