	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tiocsctty
_tiocsctty:                             ## @tiocsctty
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	_current@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	movq	(%rdi), %rax
	cmpq	$0, 8(%rax)
	je	LBB0_2
## %bb.1:
	callq	_task_session
	xorl	%ebx, %ebx
	cmpq	(%r15), %rax
	je	LBB0_11
LBB0_2:
	movq	_tty_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	(%r12), %rdi
	movq	(%rdi), %rax
	cmpq	$0, 8(%rax)
	je	LBB0_4
## %bb.3:
	cmpq	$0, (%rax)
	je	LBB0_5
LBB0_4:
	movq	_EPERM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_10:
	movq	_tty_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
LBB0_11:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	cmpq	$0, (%r15)
	je	LBB0_9
## %bb.6:
	cmpl	$1, %r14d
	jne	LBB0_4
## %bb.7:
	movq	_CAP_SYS_ADMIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_capable
	testq	%rax, %rax
	je	LBB0_4
## %bb.8:
	movq	_tasklist_lock@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_read_lock
	movq	(%r15), %rdi
	callq	_session_clear_tty
	movq	%rbx, %rdi
	callq	_read_unlock
	movq	(%r12), %rdi
LBB0_9:
	movq	%r15, %rsi
	callq	_proc_set_tty
	xorl	%ebx, %ebx
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_current,8,3                    ## @current
	.comm	_tty_mutex,4,2                  ## @tty_mutex
	.comm	_EPERM,4,2                      ## @EPERM
	.comm	_CAP_SYS_ADMIN,4,2              ## @CAP_SYS_ADMIN
	.comm	_tasklist_lock,4,2              ## @tasklist_lock
	.no_dead_strip	_tiocsctty
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tiocsctty
_tiocsctty:                             ; @tiocsctty
	.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
Lloh0:
	adrp	x21, _current@GOTPAGE
Lloh1:
	ldr	x21, [x21, _current@GOTPAGEOFF]
	ldr	x0, [x21]
	ldr	x8, [x0]
	ldr	x8, [x8, #8]
	cbz	x8, LBB0_3
; %bb.1:
	bl	_task_session
	ldr	x8, [x19]
	cmp	x0, x8
	b.ne	LBB0_3
; %bb.2:
	mov	w19, #0
	b	LBB0_7
LBB0_3:
Lloh2:
	adrp	x0, _tty_mutex@GOTPAGE
Lloh3:
	ldr	x0, [x0, _tty_mutex@GOTPAGEOFF]
	bl	_mutex_lock
	ldr	x0, [x21]
	ldr	x8, [x0]
	ldr	x9, [x8, #8]
	cbz	x9, LBB0_5
; %bb.4:
	ldr	x8, [x8]
	cbz	x8, LBB0_8
LBB0_5:
Lloh4:
	adrp	x8, _EPERM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_6:
Lloh7:
	adrp	x0, _tty_mutex@GOTPAGE
Lloh8:
	ldr	x0, [x0, _tty_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
LBB0_7:
	mov	x0, x19
	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_8:
	ldr	x8, [x19]
	cbz	x8, LBB0_12
; %bb.9:
	cmp	w20, #1
	b.ne	LBB0_5
; %bb.10:
Lloh9:
	adrp	x8, _CAP_SYS_ADMIN@GOTPAGE
Lloh10:
	ldr	x8, [x8, _CAP_SYS_ADMIN@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	bl	_capable
	cbz	x0, LBB0_5
; %bb.11:
Lloh12:
	adrp	x20, _tasklist_lock@GOTPAGE
Lloh13:
	ldr	x20, [x20, _tasklist_lock@GOTPAGEOFF]
	mov	x0, x20
	bl	_read_lock
	ldr	x0, [x19]
	bl	_session_clear_tty
	mov	x0, x20
	bl	_read_unlock
	ldr	x0, [x21]
LBB0_12:
	mov	x1, x19
	bl	_proc_set_tty
	mov	w19, #0
	b	LBB0_6
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_current,8,3                    ; @current
	.comm	_tty_mutex,4,2                  ; @tty_mutex
	.comm	_EPERM,4,2                      ; @EPERM
	.comm	_CAP_SYS_ADMIN,4,2              ; @CAP_SYS_ADMIN
	.comm	_tasklist_lock,4,2              ; @tasklist_lock
	.no_dead_strip	_tiocsctty
.subsections_via_symbols
