	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function setup_window_lock
_setup_window_lock:                     ## @setup_window_lock
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	LBB0_7
## %bb.1:
	movq	%rdx, %r15
	movq	_FORMAT_FLAGS_PACKED@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	testl	%edx, (%rax)
	je	LBB0_7
## %bb.2:
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	%r15, %rsi
	movl	%ecx, %edx
	callq	_verify_window_lock
	testl	%eax, %eax
	jne	LBB0_9
## %bb.3:
	movl	(%r15), %r12d
	leal	16(,%r12,4), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_15
## %bb.4:
	movq	%rax, %r13
	testl	%r12d, %r12d
	jle	LBB0_10
## %bb.5:
	leal	(,%r12,4), %edx
	movl	16(%r15), %esi
	movq	%r13, %rdi
	callq	_copy_from_user
	testq	%rax, %rax
	je	LBB0_10
## %bb.6:
	movq	%r13, %rdi
	callq	_kfree
	movq	_EFAULT@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_7:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_8:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	cmpq	$0, 32(%r14)
	je	LBB0_12
## %bb.11:
	movl	24(%r14), %esi
	movl	28(%r14), %edi
	leaq	8(%r15), %rdx
	movq	%r13, %rcx
	movl	%r12d, %r8d
	callq	_btcx_screen_clips
	movl	%eax, %r12d
LBB0_12:
	movq	%r13, %rdi
	movl	%r12d, %esi
	callq	_btcx_sort_clips
	movq	(%rbx), %rax
	movl	4(%rax), %eax
	addl	$-8, %eax
	roll	$29, %eax
	cmpl	$3, %eax
	ja	LBB0_16
## %bb.13:
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_14:
	leaq	8(%r15), %rdi
	movq	%r13, %rsi
	movl	%r12d, %edx
	movl	$3, %ecx
	jmp	LBB0_18
LBB0_15:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_16:
	xorl	%eax, %eax
	callq	_BUG
	jmp	LBB0_19
LBB0_17:
	leaq	8(%r15), %rdi
	movq	%r13, %rsi
	movl	%r12d, %edx
	movl	$1, %ecx
LBB0_18:
	callq	_btcx_align
LBB0_19:
	movq	32(%rbx), %rdi
	callq	_kfree
	movq	%r13, 32(%rbx)
	movl	%r12d, 8(%rbx)
	movq	8(%r15), %rax
	movq	%rax, 20(%rbx)
	movl	4(%r15), %eax
	movl	%eax, 16(%rbx)
	movl	$1, 12(%rbx)
	movl	12(%r15), %ecx
	movl	%ecx, 16(%r14)
	movl	8(%r15), %ecx
	movl	%ecx, 12(%r14)
	movl	%eax, 8(%r14)
	movq	_RESOURCE_OVERLAY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_check_btres
	testq	%rax, %rax
	je	LBB0_21
## %bb.20:
	leaq	8(%rbx), %r15
	movl	$4, %edi
	callq	_videobuf_sg_alloc
	movq	%rax, %r12
	movq	(%r14), %rax
	xorl	%ecx, %ecx
	cmpl	$0, 40(%rbx)
	setne	%cl
	movl	(%rax,%rcx,4), %eax
	movl	%eax, (%r12)
	movq	(%rbx), %rdx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rcx
	callq	_bttv_overlay_risc
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_bttv_switch_overlay            ## TAILCALL
LBB0_21:
	xorl	%eax, %eax
	jmp	LBB0_9
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_14, LBB0_14-LJTI0_0
.set L0_0_set_17, LBB0_17-LJTI0_0
.set L0_0_set_19, LBB0_19-LJTI0_0
LJTI0_0:
	.long	L0_0_set_14
	.long	L0_0_set_17
	.long	L0_0_set_14
	.long	L0_0_set_19
	.end_data_region
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_FORMAT_FLAGS_PACKED,4,2        ## @FORMAT_FLAGS_PACKED
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_RESOURCE_OVERLAY,4,2           ## @RESOURCE_OVERLAY
	.no_dead_strip	_setup_window_lock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function setup_window_lock
_setup_window_lock:                     ; @setup_window_lock
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	x8, [x0]
	cbz	x8, LBB0_7
; %bb.1:
	ldr	w8, [x8]
Lloh0:
	adrp	x9, _FORMAT_FLAGS_PACKED@GOTPAGE
Lloh1:
	ldr	x9, [x9, _FORMAT_FLAGS_PACKED@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.2:
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	mov	x1, x2
	mov	x2, x3
	bl	_verify_window_lock
	cbnz	w0, LBB0_9
; %bb.3:
	ldr	w22, [x21]
	lsl	w24, w22, #2
	add	w0, w24, #16
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_kmalloc
	cbz	x0, LBB0_15
; %bb.4:
	mov	x23, x0
	cmp	w22, #1
	b.lt	LBB0_10
; %bb.5:
	ldr	w1, [x21, #16]
	mov	x0, x23
	mov	x2, x24
	bl	_copy_from_user
	cbz	x0, LBB0_10
; %bb.6:
	mov	x0, x23
	bl	_kfree
Lloh6:
	adrp	x8, _EFAULT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_10:
	ldr	x8, [x20, #32]
	cbz	x8, LBB0_12
; %bb.11:
	ldp	w1, w0, [x20, #24]
	add	x2, x21, #8
	mov	x3, x23
	mov	x4, x22
	bl	_btcx_screen_clips
	mov	x22, x0
LBB0_12:
	mov	x0, x23
	mov	x1, x22
	bl	_btcx_sort_clips
	ldr	x8, [x19]
	ldr	w8, [x8, #4]
	sub	w8, w8, #8
	ror	w8, w8, #3
	cmp	w8, #3
	b.hi	LBB0_16
; %bb.13:
Lloh10:
	adrp	x9, lJTI0_0@PAGE
Lloh11:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_14
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_14:
	add	x0, x21, #8
	mov	x1, x23
	mov	x2, x22
	mov	w3, #3
	b	LBB0_18
LBB0_15:
Lloh12:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_8
LBB0_16:
	bl	_BUG
	b	LBB0_19
LBB0_17:
	add	x0, x21, #8
	mov	x1, x23
	mov	x2, x22
	mov	w3, #1
LBB0_18:
	bl	_btcx_align
LBB0_19:
	ldr	x0, [x19, #32]
	bl	_kfree
	mov	x24, x19
	str	w22, [x24, #8]!
	str	x23, [x19, #32]
	ldr	x8, [x21, #8]
	stur	x8, [x19, #20]
	mov	w8, #1
	str	w8, [x19, #12]
	ldr	w8, [x21, #12]
	str	w8, [x20, #16]
	ldur	d0, [x21, #4]
	str	s0, [x19, #16]
	str	d0, [x20, #8]
Lloh14:
	adrp	x8, _RESOURCE_OVERLAY@GOTPAGE
Lloh15:
	ldr	x8, [x8, _RESOURCE_OVERLAY@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_check_btres
	cbz	x0, LBB0_9
; %bb.20:
	mov	w0, #4
	bl	_videobuf_sg_alloc
	mov	x21, x0
	ldr	x8, [x20]
	ldr	w9, [x19, #40]
	cmp	w9, #0
	cset	w9, ne
	ldr	w8, [x8, w9, uxtw #2]
	str	w8, [x0]
	ldr	x2, [x19]
	mov	x0, x20
	mov	x1, x24
	mov	x3, x21
	bl	_bttv_overlay_risc
	mov	x0, x20
	mov	x1, x19
	mov	x2, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_bttv_switch_overlay
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_14-LBB0_14)>>2
	.byte	(LBB0_17-LBB0_14)>>2
	.byte	(LBB0_14-LBB0_14)>>2
	.byte	(LBB0_19-LBB0_14)>>2
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_FORMAT_FLAGS_PACKED,4,2        ; @FORMAT_FLAGS_PACKED
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_RESOURCE_OVERLAY,4,2           ; @RESOURCE_OVERLAY
	.no_dead_strip	_setup_window_lock
.subsections_via_symbols
