	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i2c_hack_cx25840
_i2c_hack_cx25840:                      ## @i2c_hack_cx25840
	.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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movl	%r9d, %eax
	orl	%ecx, %eax
	je	LBB0_22
## %bb.1:
	movq	%r8, %r14
	movq	%rdi, %rbx
	movl	(%rdi), %r15d
	cmpl	$3, %r15d
	jne	LBB0_4
## %bb.2:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-32(%rbp), %rax
	jne	LBB0_25
## %bb.3:
	movq	%rbx, %rdi
	movq	%r14, %r8
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_pvr2_i2c_basic_op              ## TAILCALL
LBB0_4:
	cmpl	$2, %ecx
	je	LBB0_10
## %bb.5:
	testl	%ecx, %ecx
	jne	LBB0_9
## %bb.6:
	cmpl	$1, %r15d
	je	LBB0_7
## %bb.8:
	cmpl	$2, %r15d
	je	LBB0_13
	jmp	LBB0_9
LBB0_10:
	movl	(%rdx), %eax
	shll	$8, %eax
	orl	4(%rdx), %eax
	cmpl	$256, %eax                      ## imm = 0x100
	je	LBB0_11
## %bb.12:
	cmpl	$257, %eax                      ## imm = 0x101
	jne	LBB0_9
LBB0_13:
	movl	$2, %r15d
	movl	$257, %eax                      ## imm = 0x101
	testl	%r9d, %r9d
	jne	LBB0_15
	jmp	LBB0_21
LBB0_7:
	movl	$256, %eax                      ## imm = 0x100
	testl	%r9d, %r9d
	jne	LBB0_15
	jmp	LBB0_21
LBB0_11:
	movl	$1, %r15d
	testl	%r9d, %r9d
	je	LBB0_21
LBB0_15:
	xorl	%r15d, %r15d
	cmpl	$1, %r9d
	jne	LBB0_9
## %bb.16:
	movl	$1, -40(%rbp)
	movl	%eax, -36(%rbp)
	leaq	-40(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$2, %ecx
	movq	%r14, %r8
	movl	$1, %r9d
	callq	_pvr2_i2c_basic_op
	testl	%eax, %eax
	je	LBB0_17
LBB0_19:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_pvr2_trace
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_pvr2_trace
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_pvr2_trace
	movq	8(%rbx), %rax
	movq	$0, 544(%rax)
	movq	%rbx, %rdi
	callq	_pvr2_hdw_render_useless
LBB0_9:
	movl	%r15d, (%rbx)
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_23
LBB0_17:
	movl	(%r14), %eax
	cmpl	$10, %eax
	je	LBB0_19
## %bb.18:
	cmpl	$4, %eax
	je	LBB0_19
## %bb.20:
	movq	_PVR2_TRACE_CHIPS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_pvr2_trace
	movl	$3, %r15d
LBB0_21:
	movl	%r15d, (%rbx)
LBB0_22:
	xorl	%eax, %eax
LBB0_23:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-32(%rbp), %rcx
	jne	LBB0_25
## %bb.24:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_25:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ## @PVR2_TRACE_ERROR_LEGS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"***WARNING*** Detected a wedged cx25840 chip; the device will not work."

L_.str.1:                               ## @.str.1
	.asciz	"***WARNING*** Try power cycling the pvrusb2 device."

L_.str.2:                               ## @.str.2
	.asciz	"***WARNING*** Disabling further access to the device to prevent other foul-ups."

	.comm	_PVR2_TRACE_CHIPS,4,2           ## @PVR2_TRACE_CHIPS
L_.str.3:                               ## @.str.3
	.asciz	"cx25840 appears to be OK."

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_i2c_hack_cx25840
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i2c_hack_cx25840
_i2c_hack_cx25840:                      ; @i2c_hack_cx25840
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #8]
	orr	w8, w5, w3
	cbz	w8, LBB0_4
; %bb.1:
	mov	x20, x4
	mov	x19, x0
	ldr	w8, [x0]
	cmp	w8, #3
	b.ne	LBB0_5
; %bb.2:
	ldr	x8, [sp, #8]
Lloh3:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh4:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_26
; %bb.3:
	mov	x0, x19
	mov	x4, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	b	_pvr2_i2c_basic_op
LBB0_4:
	mov	w0, #0
	b	LBB0_20
LBB0_5:
	cmp	w3, #2
	b.eq	LBB0_10
; %bb.6:
	cbnz	w3, LBB0_19
; %bb.7:
	cmp	w8, #1
	b.eq	LBB0_13
; %bb.8:
	cmp	w8, #2
	b.ne	LBB0_19
; %bb.9:
	mov	w9, #257
	cbnz	w5, LBB0_15
	b	LBB0_25
LBB0_10:
	ldp	w9, w10, [x2]
	orr	w9, w10, w9, lsl #8
	cmp	w9, #256
	b.eq	LBB0_14
; %bb.11:
	cmp	w9, #257
	b.ne	LBB0_19
; %bb.12:
	mov	w8, #2
	cbnz	w5, LBB0_15
	b	LBB0_25
LBB0_13:
	mov	w9, #256
	cbnz	w5, LBB0_15
	b	LBB0_25
LBB0_14:
	mov	w8, #1
	cbz	w5, LBB0_25
LBB0_15:
	cmp	w5, #1
	b.ne	LBB0_18
; %bb.16:
	mov	w8, #1
	stp	w8, w9, [sp]
	mov	x2, sp
	mov	x0, x19
	mov	w3, #2
	mov	x4, x20
	bl	_pvr2_i2c_basic_op
	cbz	w0, LBB0_22
LBB0_17:
Lloh6:
	adrp	x20, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh7:
	ldr	x20, [x20, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_pvr2_trace
	ldr	w0, [x20]
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_pvr2_trace
	ldr	w0, [x20]
Lloh12:
	adrp	x1, l_.str.2@PAGE
Lloh13:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_pvr2_trace
	ldr	x8, [x19, #8]
	str	xzr, [x8, #544]
	mov	x0, x19
	bl	_pvr2_hdw_render_useless
LBB0_18:
	mov	w8, #0
LBB0_19:
	str	w8, [x19]
Lloh14:
	adrp	x8, _EIO@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_20:
	ldr	x8, [sp, #8]
Lloh17:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh18:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_26
; %bb.21:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_22:
	ldr	w8, [x20]
	cmp	w8, #10
	b.eq	LBB0_17
; %bb.23:
	cmp	w8, #4
	b.eq	LBB0_17
; %bb.24:
Lloh20:
	adrp	x8, _PVR2_TRACE_CHIPS@GOTPAGE
Lloh21:
	ldr	x8, [x8, _PVR2_TRACE_CHIPS@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
Lloh23:
	adrp	x1, l_.str.3@PAGE
Lloh24:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_pvr2_trace
	mov	w8, #3
LBB0_25:
	mov	w0, #0
	str	w8, [x19]
	b	LBB0_20
LBB0_26:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ; @PVR2_TRACE_ERROR_LEGS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"***WARNING*** Detected a wedged cx25840 chip; the device will not work."

l_.str.1:                               ; @.str.1
	.asciz	"***WARNING*** Try power cycling the pvrusb2 device."

l_.str.2:                               ; @.str.2
	.asciz	"***WARNING*** Disabling further access to the device to prevent other foul-ups."

	.comm	_PVR2_TRACE_CHIPS,4,2           ; @PVR2_TRACE_CHIPS
l_.str.3:                               ; @.str.3
	.asciz	"cx25840 appears to be OK."

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_i2c_hack_cx25840
.subsections_via_symbols
