	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov51x_v4l1_close
_ov51x_v4l1_close:                      ## @ov51x_v4l1_close
	.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
	movq	%rdi, %r14
	movq	(%rdi), %rdi
	callq	_video_get_drvdata
	movq	%rax, %rbx
	leaq	L_.str(%rip), %rsi
	movl	$4, %edi
	callq	_PDEBUG
	leaq	32(%rbx), %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	decl	36(%rbx)
	movq	%rbx, %rdi
	callq	_ov51x_stop_isoc
	movq	(%rbx), %rax
	movq	_LED_AUTO@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_ov51x_led_control
LBB0_2:
	cmpq	$0, 24(%rbx)
	je	LBB0_4
## %bb.3:
	movq	%rbx, %rdi
	callq	_ov51x_dealloc
LBB0_4:
	movq	%r15, %rdi
	callq	_mutex_unlock
	cmpq	$0, 24(%rbx)
	jne	LBB0_6
## %bb.5:
	movq	%rbx, %r15
	addq	$8, %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	16(%rbx), %rdi
	callq	_kfree
	movq	$0, 16(%rbx)
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	%rbx, %rdi
	callq	_ov51x_dealloc
	movq	%rbx, %rdi
	callq	_kfree
LBB0_6:
	movq	$0, (%r14)
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ov511_close"

	.comm	_LED_AUTO,8,3                   ## @LED_AUTO
	.no_dead_strip	_ov51x_v4l1_close
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov51x_v4l1_close
_ov51x_v4l1_close:                      ; @ov51x_v4l1_close
	.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
	ldr	x0, [x0]
	bl	_video_get_drvdata
	mov	x20, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #4
	bl	_PDEBUG
	add	x21, x20, #32
	mov	x0, x21
	bl	_mutex_lock
	ldr	w8, [x20, #36]
	sub	w8, w8, #1
	str	w8, [x20, #36]
	mov	x0, x20
	bl	_ov51x_stop_isoc
	ldr	x8, [x20]
Lloh2:
	adrp	x9, _LED_AUTO@GOTPAGE
Lloh3:
	ldr	x9, [x9, _LED_AUTO@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x20
	mov	w1, #0
	bl	_ov51x_led_control
LBB0_2:
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_4
; %bb.3:
	mov	x0, x20
	bl	_ov51x_dealloc
LBB0_4:
	mov	x0, x21
	bl	_mutex_unlock
	ldr	x8, [x20, #24]
	cbnz	x8, LBB0_6
; %bb.5:
	add	x21, x20, #8
	mov	x0, x21
	bl	_mutex_lock
	ldr	x0, [x20, #16]
	bl	_kfree
	str	xzr, [x20, #16]
	mov	x0, x21
	bl	_mutex_unlock
	mov	x0, x20
	bl	_ov51x_dealloc
	mov	x0, x20
	bl	_kfree
LBB0_6:
	str	xzr, [x19]
	mov	w0, #0
	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 AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ov511_close"

	.comm	_LED_AUTO,8,3                   ; @LED_AUTO
	.no_dead_strip	_ov51x_v4l1_close
.subsections_via_symbols
