	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_channel_limit_inputs      ## -- Begin function pvr2_channel_limit_inputs
	.p2align	4, 0x90
_pvr2_channel_limit_inputs:             ## @pvr2_channel_limit_inputs
	.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
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	24(%rdi), %r14
	movq	%r14, %rdi
	callq	_pvr2_hdw_get_input_available
	andl	%eax, %r15d
	xorl	%r13d, %r13d
	cmpl	(%rbx), %r15d
	je	LBB0_14
## %bb.1:
	movl	%eax, %r12d
	movq	8(%rbx), %rdi
	callq	_pvr2_context_enter
	testl	%r15d, %r15d
	je	LBB0_2
## %bb.3:
	movq	8(%rbx), %rax
	movq	(%rax), %rax
	movl	%r12d, %edx
	testq	%rax, %rax
	je	LBB0_8
## %bb.4:
	movl	%r12d, %edx
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	movq	16(%rax), %rax
	testq	%rax, %rax
	je	LBB0_8
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rbx, %rax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	(%rax), %ecx
	cmpl	$1, %ecx
	movl	$0, %esi
	sbbl	%esi, %esi
	orl	%ecx, %esi
	andl	%esi, %edx
	jmp	LBB0_7
LBB0_8:
	andl	%r15d, %edx
	je	LBB0_9
## %bb.10:
	movq	%r14, %rdi
	movl	%r12d, %esi
	callq	_pvr2_hdw_set_input_allowed
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.11:
	movl	%r15d, (%rbx)
	movq	%r14, %rdi
	callq	_pvr2_hdw_commit_ctl
	jmp	LBB0_12
LBB0_2:
	movl	$0, (%rbx)
	movq	8(%rbx), %rdi
	callq	_pvr2_context_reset_input_limits
LBB0_12:
	xorl	%r13d, %r13d
	jmp	LBB0_13
LBB0_9:
	movq	_EPERM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_13:
	movq	8(%rbx), %rdi
	callq	_pvr2_context_exit
LBB0_14:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EPERM,4,2                      ## @EPERM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_channel_limit_inputs      ; -- Begin function pvr2_channel_limit_inputs
	.p2align	2
_pvr2_channel_limit_inputs:             ; @pvr2_channel_limit_inputs
	.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	x22, x1
	mov	x19, x0
	ldr	x20, [x0, #24]
	mov	x0, x20
	bl	_pvr2_hdw_get_input_available
	and	w22, w0, w22
	ldr	w8, [x19]
	cmp	w22, w8
	b.ne	LBB0_2
; %bb.1:
	mov	w21, #0
	b	LBB0_14
LBB0_2:
	mov	x21, x0
	ldr	x0, [x19, #8]
	bl	_pvr2_context_enter
	cbz	w22, LBB0_11
; %bb.3:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	mov	x9, x21
	cbz	x8, LBB0_8
; %bb.4:
	mov	x9, x21
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x8, #16]
	cbz	x8, LBB0_8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x8, x19
	b.eq	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w10, [x8]
	cmp	w10, #0
	csinv	w10, w10, wzr, ne
	and	w9, w10, w9
	b	LBB0_5
LBB0_8:
	ands	w2, w9, w22
	b.eq	LBB0_12
; %bb.9:
	mov	x0, x20
	mov	x1, x21
	bl	_pvr2_hdw_set_input_allowed
	mov	x21, x0
	cbnz	w0, LBB0_13
; %bb.10:
	str	w22, [x19]
	mov	x0, x20
	bl	_pvr2_hdw_commit_ctl
	b	LBB0_13
LBB0_11:
	str	wzr, [x19]
	ldr	x0, [x19, #8]
	bl	_pvr2_context_reset_input_limits
	mov	w21, #0
	b	LBB0_13
LBB0_12:
Lloh0:
	adrp	x8, _EPERM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_13:
	ldr	x0, [x19, #8]
	bl	_pvr2_context_exit
LBB0_14:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EPERM,4,2                      ; @EPERM
.subsections_via_symbols
