	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function go7007_i2c_xfer
_go7007_i2c_xfer:                       ## @go7007_i2c_xfer
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	xorl	%ebx, %ebx
	movq	(%rdi), %rax
	movq	_STATUS_SHUTDOWN@GOTPCREL(%rip), %rdi
	cmpq	(%rdi), %rax
	jne	LBB0_2
## %bb.1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_2:
	movl	%r8d, -64(%rbp)                 ## 4-byte Spill
	movl	%edx, -68(%rbp)                 ## 4-byte Spill
	movl	%esi, -60(%rbp)                 ## 4-byte Spill
	movl	%ecx, -72(%rbp)                 ## 4-byte Spill
	movq	%r9, -80(%rbp)                  ## 8-byte Spill
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	leaq	16(%r15), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movq	8(%r15), %rax
	movq	_GO7007_BOARDID_ADLINK_MPG24@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	movq	_adlink_mpg24_i2c_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	%r15, %rdi
	movl	$15490, %esi                    ## imm = 0x3C82
	movl	$32, %edx
	callq	_go7007_write_addr
LBB0_4:
	movl	$10, %r13d
	movq	_STATUS_REG_ADDR@GOTPCREL(%rip), %r12
	leaq	-48(%rbp), %r14
	movq	_I2C_STATE_MASK@GOTPCREL(%rip), %rbx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %esi
	movq	%r15, %rdi
	movq	%r14, %rdx
	callq	_go7007_read_addr
	testq	%rax, %rax
	js	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	(%rbx), %eax
	testl	%eax, -48(%rbp)
	je	LBB0_15
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$100, %edi
	callq	_msleep
	decl	%r13d
	jne	LBB0_5
LBB0_8:
	movl	20(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
LBB0_9:
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
LBB0_10:
	movq	_GO7007_BOARDID_ADLINK_MPG24@GOTPCREL(%rip), %rcx
LBB0_11:
	movq	8(%r15), %rax
	cmpq	(%rcx), %rax
	jne	LBB0_13
## %bb.12:
	movq	%r15, %rdi
	movl	$15490, %esi                    ## imm = 0x3C82
	xorl	%edx, %edx
	callq	_go7007_write_addr
	movq	_adlink_mpg24_i2c_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
LBB0_13:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_14:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movq	_I2C_CTRL_REG_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	-64(%rbp), %edx                 ## 4-byte Reload
	callq	_go7007_write_addr
	movq	_I2C_LO_ADDR_REG_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	-72(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edx
	callq	_go7007_write_addr
	movq	_I2C_DATA_REG_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	cmpl	$0, -68(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_21
## %bb.16:
	leaq	-48(%rbp), %rdx
	movq	%r15, %rdi
	callq	_go7007_read_addr
	testq	%rax, %rax
	js	LBB0_9
## %bb.17:
	movq	_I2C_DEV_UP_ADDR_REG_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	shll	$9, %eax
	sarl	$8, %ebx
	orl	%eax, %ebx
	orl	$256, %ebx                      ## imm = 0x100
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_go7007_write_addr
	movl	$10, %ebx
	leaq	-48(%rbp), %r14
	movq	_I2C_READ_READY_MASK@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %esi
	movq	%r15, %rdi
	movq	%r14, %rdx
	callq	_go7007_read_addr
	testq	%rax, %rax
	js	LBB0_9
## %bb.19:                              ##   in Loop: Header=BB0_18 Depth=1
	movl	(%r13), %eax
	testl	%eax, -48(%rbp)
	jne	LBB0_22
## %bb.20:                              ##   in Loop: Header=BB0_18 Depth=1
	movl	$100, %edi
	callq	_msleep
	decl	%ebx
	jne	LBB0_18
	jmp	LBB0_8
LBB0_21:
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_go7007_write_addr
	movq	_I2C_DEV_UP_ADDR_REG_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	shll	$9, %eax
	sarl	$8, %ebx
	orl	%eax, %ebx
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_go7007_write_addr
	xorl	%ebx, %ebx
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_10
LBB0_22:
	movq	_I2C_DATA_REG_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r15, %rdi
	callq	_go7007_read_addr
	testq	%rax, %rax
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movq	_GO7007_BOARDID_ADLINK_MPG24@GOTPCREL(%rip), %rcx
	js	LBB0_11
## %bb.23:
	movl	-48(%rbp), %eax
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, (%rdx)
	xorl	%ebx, %ebx
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_EIO,4,2                        ## @EIO
	.comm	_STATUS_SHUTDOWN,8,3            ## @STATUS_SHUTDOWN
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_GO7007_BOARDID_ADLINK_MPG24,8,3 ## @GO7007_BOARDID_ADLINK_MPG24
	.comm	_adlink_mpg24_i2c_lock,4,2      ## @adlink_mpg24_i2c_lock
	.comm	_STATUS_REG_ADDR,4,2            ## @STATUS_REG_ADDR
	.comm	_I2C_STATE_MASK,4,2             ## @I2C_STATE_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"go7007-i2c: I2C adapter is hung\n"

	.comm	_I2C_CTRL_REG_ADDR,4,2          ## @I2C_CTRL_REG_ADDR
	.comm	_I2C_LO_ADDR_REG_ADDR,4,2       ## @I2C_LO_ADDR_REG_ADDR
	.comm	_I2C_DATA_REG_ADDR,4,2          ## @I2C_DATA_REG_ADDR
	.comm	_I2C_DEV_UP_ADDR_REG_ADDR,4,2   ## @I2C_DEV_UP_ADDR_REG_ADDR
	.comm	_I2C_READ_READY_MASK,4,2        ## @I2C_READ_READY_MASK
	.no_dead_strip	_go7007_i2c_xfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function go7007_i2c_xfer
_go7007_i2c_xfer:                       ; @go7007_i2c_xfer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _STATUS_SHUTDOWN@GOTPAGE
Lloh1:
	ldr	x9, [x9, _STATUS_SHUTDOWN@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _ENODEV@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_20
LBB0_2:
	mov	x26, x4
	mov	x23, x3
	mov	x25, x2
	mov	x24, x1
	mov	x20, x0
	str	x5, [sp]                        ; 8-byte Folded Spill
Lloh6:
	adrp	x8, _EIO@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w21, w8
	add	x19, x0, #16
	mov	x0, x19
	bl	_mutex_lock
	ldr	x8, [x20, #8]
Lloh9:
	adrp	x9, _GO7007_BOARDID_ADLINK_MPG24@GOTPAGE
Lloh10:
	ldr	x9, [x9, _GO7007_BOARDID_ADLINK_MPG24@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.3:
Lloh12:
	adrp	x0, _adlink_mpg24_i2c_lock@GOTPAGE
Lloh13:
	ldr	x0, [x0, _adlink_mpg24_i2c_lock@GOTPAGEOFF]
	bl	_mutex_lock
	mov	x0, x20
	mov	w1, #15490
	mov	w2, #32
	bl	_go7007_write_addr
LBB0_4:
	mov	w27, #10
Lloh14:
	adrp	x28, _STATUS_REG_ADDR@GOTPAGE
Lloh15:
	ldr	x28, [x28, _STATUS_REG_ADDR@GOTPAGEOFF]
Lloh16:
	adrp	x22, _I2C_STATE_MASK@GOTPAGE
Lloh17:
	ldr	x22, [x22, _I2C_STATE_MASK@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x28]
	add	x2, sp, #12
	mov	x0, x20
	bl	_go7007_read_addr
	tbnz	x0, #63, LBB0_16
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [sp, #12]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w0, #100
	bl	_msleep
	subs	w27, w27, #1
	b.ne	LBB0_5
LBB0_8:
	ldr	w0, [x20, #20]
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_16
LBB0_9:
Lloh20:
	adrp	x8, _I2C_CTRL_REG_ADDR@GOTPAGE
Lloh21:
	ldr	x8, [x8, _I2C_CTRL_REG_ADDR@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x26
	bl	_go7007_write_addr
Lloh23:
	adrp	x8, _I2C_LO_ADDR_REG_ADDR@GOTPAGE
Lloh24:
	ldr	x8, [x8, _I2C_LO_ADDR_REG_ADDR@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x23
	bl	_go7007_write_addr
Lloh26:
	adrp	x26, _I2C_DATA_REG_ADDR@GOTPAGE
Lloh27:
	ldr	x26, [x26, _I2C_DATA_REG_ADDR@GOTPAGEOFF]
	ldr	w1, [x26]
	cbz	w25, LBB0_15
; %bb.10:
	add	x2, sp, #12
	mov	x0, x20
	bl	_go7007_read_addr
	tbnz	x0, #63, LBB0_16
; %bb.11:
Lloh28:
	adrp	x8, _I2C_DEV_UP_ADDR_REG_ADDR@GOTPAGE
Lloh29:
	ldr	x8, [x8, _I2C_DEV_UP_ADDR_REG_ADDR@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	lsl	w8, w24, #9
	orr	w8, w8, w23, asr #8
	orr	w2, w8, #0x100
	mov	x0, x20
	bl	_go7007_write_addr
	mov	w23, #10
Lloh31:
	adrp	x22, _I2C_READ_READY_MASK@GOTPAGE
Lloh32:
	ldr	x22, [x22, _I2C_READ_READY_MASK@GOTPAGEOFF]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x28]
	add	x2, sp, #12
	mov	x0, x20
	bl	_go7007_read_addr
	tbnz	x0, #63, LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	w8, [sp, #12]
	ldr	w9, [x22]
	tst	w9, w8
	b.ne	LBB0_21
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	w0, #100
	bl	_msleep
	subs	w23, w23, #1
	b.ne	LBB0_12
	b	LBB0_8
LBB0_15:
	ldr	x8, [sp]                        ; 8-byte Folded Reload
	ldr	w2, [x8]
	mov	x0, x20
	bl	_go7007_write_addr
Lloh33:
	adrp	x8, _I2C_DEV_UP_ADDR_REG_ADDR@GOTPAGE
Lloh34:
	ldr	x8, [x8, _I2C_DEV_UP_ADDR_REG_ADDR@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	asr	w8, w23, #8
	orr	w2, w8, w24, lsl #9
	mov	x0, x20
	bl	_go7007_write_addr
	mov	w21, #0
LBB0_16:
Lloh36:
	adrp	x9, _GO7007_BOARDID_ADLINK_MPG24@GOTPAGE
Lloh37:
	ldr	x9, [x9, _GO7007_BOARDID_ADLINK_MPG24@GOTPAGEOFF]
LBB0_17:
	ldr	x8, [x20, #8]
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_19
; %bb.18:
	mov	x0, x20
	mov	w1, #15490
	mov	w2, #0
	bl	_go7007_write_addr
Lloh38:
	adrp	x0, _adlink_mpg24_i2c_lock@GOTPAGE
Lloh39:
	ldr	x0, [x0, _adlink_mpg24_i2c_lock@GOTPAGEOFF]
	bl	_mutex_unlock
LBB0_19:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_20:
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_21:
	ldr	w1, [x26]
	add	x2, sp, #12
	mov	x0, x20
	bl	_go7007_read_addr
Lloh40:
	adrp	x9, _GO7007_BOARDID_ADLINK_MPG24@GOTPAGE
Lloh41:
	ldr	x9, [x9, _GO7007_BOARDID_ADLINK_MPG24@GOTPAGEOFF]
	tbnz	x0, #63, LBB0_17
; %bb.22:
	mov	w21, #0
	ldr	w8, [sp, #12]
	ldr	x10, [sp]                       ; 8-byte Folded Reload
	str	w8, [x10]
	b	LBB0_17
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_EIO,4,2                        ; @EIO
	.comm	_STATUS_SHUTDOWN,8,3            ; @STATUS_SHUTDOWN
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_GO7007_BOARDID_ADLINK_MPG24,8,3 ; @GO7007_BOARDID_ADLINK_MPG24
	.comm	_adlink_mpg24_i2c_lock,4,2      ; @adlink_mpg24_i2c_lock
	.comm	_STATUS_REG_ADDR,4,2            ; @STATUS_REG_ADDR
	.comm	_I2C_STATE_MASK,4,2             ; @I2C_STATE_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"go7007-i2c: I2C adapter is hung\n"

	.comm	_I2C_CTRL_REG_ADDR,4,2          ; @I2C_CTRL_REG_ADDR
	.comm	_I2C_LO_ADDR_REG_ADDR,4,2       ; @I2C_LO_ADDR_REG_ADDR
	.comm	_I2C_DATA_REG_ADDR,4,2          ; @I2C_DATA_REG_ADDR
	.comm	_I2C_DEV_UP_ADDR_REG_ADDR,4,2   ; @I2C_DEV_UP_ADDR_REG_ADDR
	.comm	_I2C_READ_READY_MASK,4,2        ; @I2C_READ_READY_MASK
	.no_dead_strip	_go7007_i2c_xfer
.subsections_via_symbols
