	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_em28xx_capture_start           ## -- Begin function em28xx_capture_start
	.p2align	4, 0x90
_em28xx_capture_start:                  ## @em28xx_capture_start
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movq	_CHIP_ID_EM2874@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.1:
	movq	_CHIP_ID_EM2884@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.2:
	movq	_CHIP_ID_EM28174@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.3:
	movq	_CHIP_ID_EM28178@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.4:
	movq	_EM28XX_R0C_USBSUSP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	testl	%r14d, %r14d
	setne	%dl
	shll	$4, %edx
	movq	%rbx, %rdi
	movl	$16, %ecx
	callq	_em28xx_write_reg_bits
	testl	%eax, %eax
	js	LBB0_28
## %bb.5:
	testl	%r14d, %r14d
	je	LBB0_27
## %bb.6:
	cmpq	$0, 32(%rbx)
	je	LBB0_8
## %bb.7:
	movq	%rbx, %rdi
	movl	$19, %esi
	movl	$12, %edx
	callq	_em28xx_write_reg
LBB0_8:
	movq	%rbx, %rdi
	movl	$72, %esi
	xorl	%edx, %edx
	callq	_em28xx_write_reg
	testl	%eax, %eax
	js	LBB0_28
## %bb.9:
	movq	24(%rbx), %rax
	movq	_EM28XX_ANALOG_MODE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movq	_EM28XX_R12_VINENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$103, %eax
	movl	$55, %edx
	cmovel	%eax, %edx
	movq	%rbx, %rdi
	callq	_em28xx_write_reg
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_29
## %bb.10:
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$11000, %esi                    ## imm = 0x2AF8
	callq	_usleep_range
	jmp	LBB0_21
LBB0_11:
	movq	8(%rbx), %rax
	movq	_PRIMARY_TS@GOTPCREL(%rip), %r15
	cmpq	(%r15), %rax
	jne	LBB0_13
## %bb.12:
	movq	_EM2874_R5D_TS1_PKT_SIZE@GOTPCREL(%rip), %rax
	jmp	LBB0_14
LBB0_28:
	movl	%eax, %r15d
	jmp	LBB0_29
LBB0_13:
	movq	_EM2874_R5E_TS2_PKT_SIZE@GOTPCREL(%rip), %rax
LBB0_14:
	cmpq	$0, 40(%rbx)
	movl	(%rax), %esi
	movl	$255, %edx
	jne	LBB0_16
## %bb.15:
	movslq	16(%rbx), %rax
	imulq	$-1370734243, %rax, %rdx        ## imm = 0xAE4C415D
	shrq	$32, %rdx
	addl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	sarl	$7, %edx
	addl	%eax, %edx
LBB0_16:
	movq	%rbx, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_em28xx_write_reg
	movq	8(%rbx), %rax
	movq	_EM2874_R5F_TS_ENABLE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	cmpq	(%r15), %rax
	jne	LBB0_18
## %bb.17:
	testl	%r14d, %r14d
	movq	_EM2874_TS1_CAPTURE_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %edx
	cmovel	%r14d, %edx
	movq	_EM2874_TS1_FILTER_ENABLE@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movq	_EM2874_TS1_NULL_DISCARD@GOTPCREL(%rip), %rax
	jmp	LBB0_19
LBB0_18:
	testl	%r14d, %r14d
	movq	_EM2874_TS2_CAPTURE_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %edx
	cmovel	%r14d, %edx
	movq	_EM2874_TS2_FILTER_ENABLE@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movq	_EM2874_TS2_NULL_DISCARD@GOTPCREL(%rip), %rax
LBB0_19:
	orl	(%rax), %ecx
	movq	%rbx, %rdi
	callq	_em28xx_write_reg_bits
LBB0_20:
	movl	%eax, %r15d
LBB0_21:
	movq	24(%rbx), %rax
	movq	_EM28XX_ANALOG_MODE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_23
## %bb.22:
	movq	_EM28XX_LED_ANALOG_CAPTURING@GOTPCREL(%rip), %rax
	jmp	LBB0_24
LBB0_23:
	movq	_EM28XX_LED_DIGITAL_CAPTURING@GOTPCREL(%rip), %rax
LBB0_24:
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_em28xx_find_led
	testq	%rax, %rax
	je	LBB0_29
## %bb.25:
	movl	8(%rax), %esi
	xorl	%ecx, %ecx
	testl	%r14d, %r14d
	sete	%cl
	xorl	%edx, %edx
	cmpl	%ecx, (%rax)
	movl	4(%rax), %ecx
	setne	%dl
	negl	%edx
	xorl	%ecx, %edx
	movq	%rbx, %rdi
	callq	_em28xx_write_reg_bits
LBB0_29:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_27:
	movq	_EM28XX_R12_VINENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$39, %edx
	callq	_em28xx_write_reg
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_CHIP_ID_EM2874,8,3             ## @CHIP_ID_EM2874
	.comm	_CHIP_ID_EM2884,8,3             ## @CHIP_ID_EM2884
	.comm	_CHIP_ID_EM28174,8,3            ## @CHIP_ID_EM28174
	.comm	_CHIP_ID_EM28178,8,3            ## @CHIP_ID_EM28178
	.comm	_PRIMARY_TS,8,3                 ## @PRIMARY_TS
	.comm	_EM2874_R5D_TS1_PKT_SIZE,4,2    ## @EM2874_R5D_TS1_PKT_SIZE
	.comm	_EM2874_R5E_TS2_PKT_SIZE,4,2    ## @EM2874_R5E_TS2_PKT_SIZE
	.comm	_EM2874_R5F_TS_ENABLE,4,2       ## @EM2874_R5F_TS_ENABLE
	.comm	_EM2874_TS1_CAPTURE_ENABLE,4,2  ## @EM2874_TS1_CAPTURE_ENABLE
	.comm	_EM2874_TS1_FILTER_ENABLE,4,2   ## @EM2874_TS1_FILTER_ENABLE
	.comm	_EM2874_TS1_NULL_DISCARD,4,2    ## @EM2874_TS1_NULL_DISCARD
	.comm	_EM2874_TS2_CAPTURE_ENABLE,4,2  ## @EM2874_TS2_CAPTURE_ENABLE
	.comm	_EM2874_TS2_FILTER_ENABLE,4,2   ## @EM2874_TS2_FILTER_ENABLE
	.comm	_EM2874_TS2_NULL_DISCARD,4,2    ## @EM2874_TS2_NULL_DISCARD
	.comm	_EM28XX_R0C_USBSUSP,4,2         ## @EM28XX_R0C_USBSUSP
	.comm	_EM28XX_ANALOG_MODE,8,3         ## @EM28XX_ANALOG_MODE
	.comm	_EM28XX_R12_VINENABLE,4,2       ## @EM28XX_R12_VINENABLE
	.comm	_EM28XX_LED_ANALOG_CAPTURING,4,2 ## @EM28XX_LED_ANALOG_CAPTURING
	.comm	_EM28XX_LED_DIGITAL_CAPTURING,4,2 ## @EM28XX_LED_DIGITAL_CAPTURING
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_em28xx_capture_start           ; -- Begin function em28xx_capture_start
	.p2align	2
_em28xx_capture_start:                  ; @em28xx_capture_start
	.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	x20, x1
	mov	x19, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _CHIP_ID_EM2874@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CHIP_ID_EM2874@GOTPAGEOFF]
Lloh2:
	adrp	x10, _CHIP_ID_EM2884@GOTPAGE
Lloh3:
	ldr	x10, [x10, _CHIP_ID_EM2884@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
Lloh5:
	ldr	x10, [x10]
Lloh6:
	adrp	x11, _CHIP_ID_EM28174@GOTPAGE
Lloh7:
	ldr	x11, [x11, _CHIP_ID_EM28174@GOTPAGEOFF]
Lloh8:
	adrp	x12, _CHIP_ID_EM28178@GOTPAGE
Lloh9:
	ldr	x12, [x12, _CHIP_ID_EM28178@GOTPAGEOFF]
Lloh10:
	ldr	x11, [x11]
Lloh11:
	ldr	x12, [x12]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	ccmp	x8, x11, #4, ne
	ccmp	x8, x12, #4, ne
	b.ne	LBB0_3
; %bb.1:
	ldr	x8, [x19, #40]
	ldr	x9, [x19, #8]
Lloh12:
	adrp	x21, _PRIMARY_TS@GOTPAGE
Lloh13:
	ldr	x21, [x21, _PRIMARY_TS@GOTPAGEOFF]
Lloh14:
	adrp	x10, _EM2874_R5D_TS1_PKT_SIZE@GOTPAGE
Lloh15:
	ldr	x10, [x10, _EM2874_R5D_TS1_PKT_SIZE@GOTPAGEOFF]
	ldr	x11, [x21]
Lloh16:
	adrp	x12, _EM2874_R5E_TS2_PKT_SIZE@GOTPAGE
Lloh17:
	ldr	x12, [x12, _EM2874_R5E_TS2_PKT_SIZE@GOTPAGEOFF]
	cmp	x9, x11
	csel	x9, x10, x12, eq
	ldr	w1, [x9]
	cbz	x8, LBB0_11
; %bb.2:
	mov	w2, #255
	b	LBB0_12
LBB0_3:
Lloh18:
	adrp	x8, _EM28XX_R0C_USBSUSP@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EM28XX_R0C_USBSUSP@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	cmp	w20, #0
	cset	w8, ne
	lsl	w2, w8, #4
	mov	x0, x19
	mov	w3, #16
	bl	_em28xx_write_reg_bits
	tbnz	w0, #31, LBB0_10
; %bb.4:
	cbz	w20, LBB0_20
; %bb.5:
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_7
; %bb.6:
	mov	x0, x19
	mov	w1, #19
	mov	w2, #12
	bl	_em28xx_write_reg
LBB0_7:
	mov	x0, x19
	mov	w1, #72
	mov	w2, #0
	bl	_em28xx_write_reg
	tbnz	w0, #31, LBB0_10
; %bb.8:
	ldr	x8, [x19, #24]
Lloh21:
	adrp	x9, _EM28XX_ANALOG_MODE@GOTPAGE
Lloh22:
	ldr	x9, [x9, _EM28XX_ANALOG_MODE@GOTPAGEOFF]
Lloh23:
	adrp	x10, _EM28XX_R12_VINENABLE@GOTPAGE
Lloh24:
	ldr	x10, [x10, _EM28XX_R12_VINENABLE@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
Lloh26:
	ldr	w1, [x10]
	cmp	x8, x9
	mov	w8, #55
	mov	w9, #103
	csel	w2, w9, w8, eq
	mov	x0, x19
	bl	_em28xx_write_reg
	mov	x21, x0
	tbnz	w0, #31, LBB0_19
; %bb.9:
	mov	w0, #10000
	mov	w1, #11000
	bl	_usleep_range
	b	LBB0_17
LBB0_10:
	mov	x21, x0
	b	LBB0_19
LBB0_11:
	ldrsw	x8, [x19, #16]
	mov	x9, #-48803
	movk	x9, #44620, lsl #16
	mul	x9, x8, x9
	lsr	x9, x9, #32
	add	w8, w9, w8
	asr	w9, w8, #7
	add	w2, w9, w8, lsr #31
LBB0_12:
	mov	x0, x19
	bl	_em28xx_write_reg
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
Lloh27:
	adrp	x10, _EM2874_R5F_TS_ENABLE@GOTPAGE
Lloh28:
	ldr	x10, [x10, _EM2874_R5F_TS_ENABLE@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x10]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.13:
Lloh30:
	adrp	x8, _EM2874_TS1_CAPTURE_ENABLE@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EM2874_TS1_CAPTURE_ENABLE@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	cmp	w20, #0
	csel	w2, wzr, w8, eq
Lloh33:
	adrp	x9, _EM2874_TS1_FILTER_ENABLE@GOTPAGE
Lloh34:
	ldr	x9, [x9, _EM2874_TS1_FILTER_ENABLE@GOTPAGEOFF]
Lloh35:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh36:
	adrp	x9, _EM2874_TS1_NULL_DISCARD@GOTPAGE
Lloh37:
	ldr	x9, [x9, _EM2874_TS1_NULL_DISCARD@GOTPAGEOFF]
	b	LBB0_15
LBB0_14:
Lloh38:
	adrp	x8, _EM2874_TS2_CAPTURE_ENABLE@GOTPAGE
Lloh39:
	ldr	x8, [x8, _EM2874_TS2_CAPTURE_ENABLE@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	cmp	w20, #0
	csel	w2, wzr, w8, eq
Lloh41:
	adrp	x9, _EM2874_TS2_FILTER_ENABLE@GOTPAGE
Lloh42:
	ldr	x9, [x9, _EM2874_TS2_FILTER_ENABLE@GOTPAGEOFF]
Lloh43:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh44:
	adrp	x9, _EM2874_TS2_NULL_DISCARD@GOTPAGE
Lloh45:
	ldr	x9, [x9, _EM2874_TS2_NULL_DISCARD@GOTPAGEOFF]
LBB0_15:
	ldr	w9, [x9]
	orr	w3, w8, w9
	mov	x0, x19
	bl	_em28xx_write_reg_bits
LBB0_16:
	mov	x21, x0
LBB0_17:
	ldr	x8, [x19, #24]
Lloh46:
	adrp	x9, _EM28XX_ANALOG_MODE@GOTPAGE
Lloh47:
	ldr	x9, [x9, _EM28XX_ANALOG_MODE@GOTPAGEOFF]
Lloh48:
	adrp	x10, _EM28XX_LED_ANALOG_CAPTURING@GOTPAGE
Lloh49:
	ldr	x10, [x10, _EM28XX_LED_ANALOG_CAPTURING@GOTPAGEOFF]
Lloh50:
	ldr	x9, [x9]
Lloh51:
	adrp	x11, _EM28XX_LED_DIGITAL_CAPTURING@GOTPAGE
Lloh52:
	ldr	x11, [x11, _EM28XX_LED_DIGITAL_CAPTURING@GOTPAGEOFF]
	cmp	x8, x9
	csel	x8, x10, x11, eq
	ldr	w1, [x8]
	mov	x0, x19
	bl	_em28xx_find_led
	cbz	x0, LBB0_19
; %bb.18:
	ldp	w3, w1, [x0, #4]
	cmp	w20, #0
	cset	w8, eq
	ldr	w9, [x0]
	cmp	w9, w8
	cinv	w2, w3, ne
	mov	x0, x19
	bl	_em28xx_write_reg_bits
LBB0_19:
	mov	x0, x21
	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
LBB0_20:
Lloh53:
	adrp	x8, _EM28XX_R12_VINENABLE@GOTPAGE
Lloh54:
	ldr	x8, [x8, _EM28XX_R12_VINENABLE@GOTPAGEOFF]
Lloh55:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #39
	bl	_em28xx_write_reg
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh10
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh4
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh25
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh51, Lloh52
	.loh AdrpLdrGot	Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh50
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.cfi_endproc
                                        ; -- End function
	.comm	_CHIP_ID_EM2874,8,3             ; @CHIP_ID_EM2874
	.comm	_CHIP_ID_EM2884,8,3             ; @CHIP_ID_EM2884
	.comm	_CHIP_ID_EM28174,8,3            ; @CHIP_ID_EM28174
	.comm	_CHIP_ID_EM28178,8,3            ; @CHIP_ID_EM28178
	.comm	_PRIMARY_TS,8,3                 ; @PRIMARY_TS
	.comm	_EM2874_R5D_TS1_PKT_SIZE,4,2    ; @EM2874_R5D_TS1_PKT_SIZE
	.comm	_EM2874_R5E_TS2_PKT_SIZE,4,2    ; @EM2874_R5E_TS2_PKT_SIZE
	.comm	_EM2874_R5F_TS_ENABLE,4,2       ; @EM2874_R5F_TS_ENABLE
	.comm	_EM2874_TS1_CAPTURE_ENABLE,4,2  ; @EM2874_TS1_CAPTURE_ENABLE
	.comm	_EM2874_TS1_FILTER_ENABLE,4,2   ; @EM2874_TS1_FILTER_ENABLE
	.comm	_EM2874_TS1_NULL_DISCARD,4,2    ; @EM2874_TS1_NULL_DISCARD
	.comm	_EM2874_TS2_CAPTURE_ENABLE,4,2  ; @EM2874_TS2_CAPTURE_ENABLE
	.comm	_EM2874_TS2_FILTER_ENABLE,4,2   ; @EM2874_TS2_FILTER_ENABLE
	.comm	_EM2874_TS2_NULL_DISCARD,4,2    ; @EM2874_TS2_NULL_DISCARD
	.comm	_EM28XX_R0C_USBSUSP,4,2         ; @EM28XX_R0C_USBSUSP
	.comm	_EM28XX_ANALOG_MODE,8,3         ; @EM28XX_ANALOG_MODE
	.comm	_EM28XX_R12_VINENABLE,4,2       ; @EM28XX_R12_VINENABLE
	.comm	_EM28XX_LED_ANALOG_CAPTURING,4,2 ; @EM28XX_LED_ANALOG_CAPTURING
	.comm	_EM28XX_LED_DIGITAL_CAPTURING,4,2 ; @EM28XX_LED_DIGITAL_CAPTURING
.subsections_via_symbols
