	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tegra_i2c_attach
_tegra_i2c_attach:                      ## @tegra_i2c_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	%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
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %r13
	movl	%r14d, 56(%rax)
	movl	%r14d, %edi
	callq	_ofw_bus_get_node
	movl	%eax, %r12d
	movq	%r13, %rdi
	callq	_LOCK_INIT
	movl	$0, -44(%rbp)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ecx
	leaq	-44(%rbp), %rdx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 8(%r13)
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movl	$0, -44(%rbp)
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%rbx), %ecx
	leaq	-44(%rbp), %rdx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 16(%r13)
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	leaq	40(%r13), %rbx
	leaq	L_.str.2(%rip), %rdx
	movl	%r14d, %edi
	xorl	%esi, %esi
	movq	%rbx, %rcx
	callq	_clk_get_by_ofw_name
	testl	%eax, %eax
	je	LBB0_8
## %bb.6:
	movl	%eax, %r15d
	leaq	L_.str.3(%rip), %rsi
LBB0_7:
	movl	%r14d, %edi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_device_printf
	jmp	LBB0_12
LBB0_1:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_2
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
LBB0_2:
	movl	%r14d, %edi
	xorl	%eax, %eax
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_12:
	movq	24(%r13), %rdx
	testq	%rdx, %rdx
	je	LBB0_14
## %bb.13:
	movq	16(%r13), %rsi
	movl	%r14d, %edi
	callq	_bus_teardown_intr
LBB0_14:
	movq	16(%r13), %rcx
	testq	%rcx, %rcx
	je	LBB0_16
## %bb.15:
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
LBB0_16:
	movq	8(%r13), %rcx
	testq	%rcx, %rcx
	je	LBB0_18
## %bb.17:
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
LBB0_18:
	movq	%r13, %rdi
	callq	_LOCK_DESTROY
LBB0_33:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	56(%r13), %edi
	leaq	60(%r13), %rcx
	leaq	L_.str.4(%rip), %rdx
	xorl	%esi, %esi
	callq	_hwreset_get_by_ofw_name
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	56(%r13), %edi
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_33
LBB0_10:
	leaq	L_.str.6(%rip), %rsi
	movl	%r12d, %edi
	movq	%r13, %rdx
	movl	$4, %ecx
	callq	_OF_getencprop
	cmpl	$4, %eax
	jne	LBB0_11
## %bb.19:
	movl	(%rbx), %edi
	movq	_CLK_SET_ROUND_DOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$136000000, %esi                ## imm = 0x81B3200
	callq	_clk_set_freq
	testl	%eax, %eax
	je	LBB0_22
## %bb.20:
	movl	%eax, %r15d
	leaq	L_.str.7(%rip), %rsi
	jmp	LBB0_21
LBB0_11:
	movl	%eax, %r15d
	movl	$100000, (%r13)                 ## imm = 0x186A0
	jmp	LBB0_12
LBB0_22:
	movl	(%rbx), %edi
	leaq	-56(%rbp), %rsi
	callq	_clk_get_freq
	testl	%eax, %eax
	je	LBB0_24
## %bb.23:
	movl	%eax, %r15d
	leaq	L_.str.8(%rip), %rsi
LBB0_21:
	movl	%r14d, %edi
	xorl	%eax, %eax
	callq	_device_printf
	jmp	LBB0_12
LBB0_24:
	movq	-56(%rbp), %rax
	movq	%rax, 48(%r13)
	movl	40(%r13), %edi
	callq	_clk_enable
	testl	%eax, %eax
	je	LBB0_26
## %bb.25:
	movl	%eax, %r15d
	leaq	L_.str.9(%rip), %rsi
	jmp	LBB0_7
LBB0_26:
	movq	%r13, %rdi
	callq	_tegra_i2c_hw_init
	testl	%eax, %eax
	je	LBB0_28
## %bb.27:
	movl	%eax, %r15d
	leaq	L_.str.10(%rip), %rsi
	jmp	LBB0_21
LBB0_28:
	movq	_INTR_TYPE_MISC@GOTPCREL(%rip), %rax
	movq	_INTR_MPSAFE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	16(%r13), %rsi
	movq	_tegra_i2c_intr@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r13, %rax
	addq	$24, %rax
	movq	%rax, (%rsp)
	movl	%r14d, %edi
	xorl	%ecx, %ecx
	movq	%r13, %r9
	callq	_bus_setup_intr
	testl	%eax, %eax
	je	LBB0_30
## %bb.29:
	movl	%eax, %r15d
	leaq	L_.str.11(%rip), %rsi
	jmp	LBB0_21
LBB0_30:
	leaq	L_.str.12(%rip), %rsi
	movl	%r14d, %edi
	movl	$-1, %edx
	callq	_device_add_child
	movq	%rax, 32(%r13)
	testq	%rax, %rax
	je	LBB0_31
## %bb.32:
	movl	%r14d, %edi
	callq	_bus_generic_attach
	movl	%eax, %r15d
	jmp	LBB0_33
LBB0_31:
	leaq	L_.str.13(%rip), %rsi
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot map registers.\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
L_.str.1:                               ## @.str.1
	.asciz	"Cannot allocate interrupt.\n"

L_.str.2:                               ## @.str.2
	.asciz	"div-clk"

L_.str.3:                               ## @.str.3
	.asciz	"Cannot get i2c clock: %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"i2c"

L_.str.5:                               ## @.str.5
	.asciz	"Cannot get i2c reset\n"

L_.str.6:                               ## @.str.6
	.asciz	"clock-frequency"

	.comm	_CLK_SET_ROUND_DOWN,4,2         ## @CLK_SET_ROUND_DOWN
L_.str.7:                               ## @.str.7
	.asciz	"Cannot set clock frequency\n"

L_.str.8:                               ## @.str.8
	.asciz	"Cannot get clock frequency\n"

L_.str.9:                               ## @.str.9
	.asciz	"Cannot enable clock: %d\n"

L_.str.10:                              ## @.str.10
	.asciz	"tegra_i2c_activate failed\n"

	.comm	_INTR_TYPE_MISC,4,2             ## @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ## @INTR_MPSAFE
	.comm	_tegra_i2c_intr,4,2             ## @tegra_i2c_intr
L_.str.11:                              ## @.str.11
	.asciz	"Cannot setup interrupt.\n"

L_.str.12:                              ## @.str.12
	.asciz	"iicbus"

L_.str.13:                              ## @.str.13
	.asciz	"Could not allocate iicbus instance.\n"

	.no_dead_strip	_tegra_i2c_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tegra_i2c_attach
_tegra_i2c_attach:                      ; @tegra_i2c_attach
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x20, x0
	bl	_device_get_softc
	mov	x19, x0
	str	w20, [x0, #56]
	mov	x0, x20
	bl	_ofw_bus_get_node
	mov	x22, x0
	mov	x0, x19
	bl	_LOCK_INIT
	str	wzr, [sp, #28]
Lloh0:
	adrp	x24, _SYS_RES_MEMORY@GOTPAGE
Lloh1:
	ldr	x24, [x24, _SYS_RES_MEMORY@GOTPAGEOFF]
	ldr	w1, [x24]
Lloh2:
	adrp	x21, _RF_ACTIVE@GOTPAGE
Lloh3:
	ldr	x21, [x21, _RF_ACTIVE@GOTPAGEOFF]
	ldr	w3, [x21]
	add	x2, sp, #28
	mov	x0, x20
	bl	_bus_alloc_resource_any
	str	x0, [x19, #8]
Lloh4:
	adrp	x25, _SYS_RES_IRQ@GOTPAGE
Lloh5:
	ldr	x25, [x25, _SYS_RES_IRQ@GOTPAGEOFF]
	cbz	x0, LBB0_5
; %bb.1:
	str	wzr, [sp, #28]
	ldr	w1, [x25]
	ldr	w3, [x21]
	add	x2, sp, #28
	mov	x0, x20
	bl	_bus_alloc_resource_any
	str	x0, [x19, #16]
	cbz	x0, LBB0_6
; %bb.2:
	add	x23, x19, #40
Lloh6:
	adrp	x2, l_.str.2@PAGE
Lloh7:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x20
	mov	w1, #0
	mov	x3, x23
	bl	_clk_get_by_ofw_name
	cbz	w0, LBB0_16
; %bb.3:
	mov	x21, x0
	str	x21, [sp]
Lloh8:
	adrp	x1, l_.str.3@PAGE
Lloh9:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_4:
	mov	x0, x20
	bl	_device_printf
	b	LBB0_8
LBB0_5:
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_7
LBB0_6:
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_7:
	mov	x0, x20
	bl	_device_printf
Lloh14:
	adrp	x8, _ENXIO@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh16:
	ldr	w21, [x8]
LBB0_8:
	ldr	x2, [x19, #24]
	cbz	x2, LBB0_10
; %bb.9:
	ldr	x1, [x19, #16]
	mov	x0, x20
	bl	_bus_teardown_intr
LBB0_10:
	ldr	x3, [x19, #16]
	cbz	x3, LBB0_12
; %bb.11:
	ldr	w1, [x25]
	mov	x0, x20
	mov	w2, #0
	bl	_bus_release_resource
LBB0_12:
	ldr	x3, [x19, #8]
	cbz	x3, LBB0_14
; %bb.13:
	ldr	w1, [x24]
	mov	x0, x20
	mov	w2, #0
	bl	_bus_release_resource
LBB0_14:
	mov	x0, x19
	bl	_LOCK_DESTROY
LBB0_15:
	mov	x0, x21
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_16:
	ldr	w0, [x19, #56]
	add	x3, x19, #60
Lloh17:
	adrp	x2, l_.str.4@PAGE
Lloh18:
	add	x2, x2, l_.str.4@PAGEOFF
	mov	w1, #0
	bl	_hwreset_get_by_ofw_name
	cbz	w0, LBB0_18
; %bb.17:
	ldr	w0, [x19, #56]
Lloh19:
	adrp	x1, l_.str.5@PAGE
Lloh20:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_device_printf
Lloh21:
	adrp	x8, _ENXIO@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh23:
	ldr	w21, [x8]
	b	LBB0_15
LBB0_18:
Lloh24:
	adrp	x1, l_.str.6@PAGE
Lloh25:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	x0, x22
	mov	x2, x19
	mov	w3, #4
	bl	_OF_getencprop
	cmp	w0, #4
	b.ne	LBB0_21
; %bb.19:
	ldr	w0, [x23]
Lloh26:
	adrp	x8, _CLK_SET_ROUND_DOWN@GOTPAGE
Lloh27:
	ldr	x8, [x8, _CLK_SET_ROUND_DOWN@GOTPAGEOFF]
Lloh28:
	ldr	w2, [x8]
	mov	w1, #12800
	movk	w1, #2075, lsl #16
	bl	_clk_set_freq
	cbz	w0, LBB0_22
; %bb.20:
	mov	x21, x0
Lloh29:
	adrp	x1, l_.str.7@PAGE
Lloh30:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_4
LBB0_21:
	mov	x21, x0
	mov	w8, #34464
	movk	w8, #1, lsl #16
	str	w8, [x19]
	b	LBB0_8
LBB0_22:
	ldr	w0, [x23]
	add	x1, sp, #16
	bl	_clk_get_freq
	cbz	w0, LBB0_24
; %bb.23:
	mov	x21, x0
Lloh31:
	adrp	x1, l_.str.8@PAGE
Lloh32:
	add	x1, x1, l_.str.8@PAGEOFF
	b	LBB0_4
LBB0_24:
	ldr	x8, [sp, #16]
	str	x8, [x19, #48]
	ldr	w0, [x19, #40]
	bl	_clk_enable
	cbz	w0, LBB0_26
; %bb.25:
	mov	x21, x0
	str	x21, [sp]
Lloh33:
	adrp	x1, l_.str.9@PAGE
Lloh34:
	add	x1, x1, l_.str.9@PAGEOFF
	mov	x0, x20
	bl	_device_printf
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	b	LBB0_8
LBB0_26:
	mov	x0, x19
	bl	_tegra_i2c_hw_init
	cbz	w0, LBB0_28
; %bb.27:
	mov	x21, x0
Lloh35:
	adrp	x1, l_.str.10@PAGE
Lloh36:
	add	x1, x1, l_.str.10@PAGEOFF
	b	LBB0_4
LBB0_28:
	ldr	x1, [x19, #16]
Lloh37:
	adrp	x8, _INTR_TYPE_MISC@GOTPAGE
Lloh38:
	ldr	x8, [x8, _INTR_TYPE_MISC@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
Lloh40:
	adrp	x9, _INTR_MPSAFE@GOTPAGE
Lloh41:
	ldr	x9, [x9, _INTR_MPSAFE@GOTPAGEOFF]
Lloh42:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh43:
	adrp	x8, _tegra_i2c_intr@GOTPAGE
Lloh44:
	ldr	x8, [x8, _tegra_i2c_intr@GOTPAGEOFF]
Lloh45:
	ldr	w4, [x8]
	add	x6, x19, #24
	mov	x0, x20
	mov	x3, #0
	mov	x5, x19
	bl	_bus_setup_intr
	cbz	w0, LBB0_30
; %bb.29:
	mov	x21, x0
Lloh46:
	adrp	x1, l_.str.11@PAGE
Lloh47:
	add	x1, x1, l_.str.11@PAGEOFF
	b	LBB0_4
LBB0_30:
Lloh48:
	adrp	x1, l_.str.12@PAGE
Lloh49:
	add	x1, x1, l_.str.12@PAGEOFF
	mov	x0, x20
	mov	w2, #-1
	bl	_device_add_child
	str	x0, [x19, #32]
	cbz	x0, LBB0_32
; %bb.31:
	mov	x0, x20
	bl	_bus_generic_attach
	mov	x21, x0
	b	LBB0_15
LBB0_32:
Lloh50:
	adrp	x1, l_.str.13@PAGE
Lloh51:
	add	x1, x1, l_.str.13@PAGEOFF
	b	LBB0_7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpAdd	Lloh50, Lloh51
	.cfi_endproc
                                        ; -- End function
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot map registers.\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
l_.str.1:                               ; @.str.1
	.asciz	"Cannot allocate interrupt.\n"

l_.str.2:                               ; @.str.2
	.asciz	"div-clk"

l_.str.3:                               ; @.str.3
	.asciz	"Cannot get i2c clock: %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"i2c"

l_.str.5:                               ; @.str.5
	.asciz	"Cannot get i2c reset\n"

l_.str.6:                               ; @.str.6
	.asciz	"clock-frequency"

	.comm	_CLK_SET_ROUND_DOWN,4,2         ; @CLK_SET_ROUND_DOWN
l_.str.7:                               ; @.str.7
	.asciz	"Cannot set clock frequency\n"

l_.str.8:                               ; @.str.8
	.asciz	"Cannot get clock frequency\n"

l_.str.9:                               ; @.str.9
	.asciz	"Cannot enable clock: %d\n"

l_.str.10:                              ; @.str.10
	.asciz	"tegra_i2c_activate failed\n"

	.comm	_INTR_TYPE_MISC,4,2             ; @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ; @INTR_MPSAFE
	.comm	_tegra_i2c_intr,4,2             ; @tegra_i2c_intr
l_.str.11:                              ; @.str.11
	.asciz	"Cannot setup interrupt.\n"

l_.str.12:                              ; @.str.12
	.asciz	"iicbus"

l_.str.13:                              ; @.str.13
	.asciz	"Could not allocate iicbus instance.\n"

	.no_dead_strip	_tegra_i2c_attach
.subsections_via_symbols
