	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_session_pty_cleanup2           ## -- Begin function session_pty_cleanup2
	.p2align	4, 0x90
_session_pty_cleanup2:                  ## @session_pty_cleanup2
	.cfi_startproc
## %bb.0:
	testq	%rdi, %rdi
	je	LBB0_11
## %bb.1:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	cmpl	$-1, (%rdi)
	je	LBB0_10
## %bb.2:
	movl	20(%rbx), %edx
	movl	32(%rbx), %esi
	leaq	L_.str.1(%rip), %rdi
	callq	_debug
	movq	8(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.3:
	movl	20(%rbx), %esi
	movq	24(%rbx), %rax
	movl	(%rax), %edx
	callq	_record_logout
LBB0_4:
	xorl	%eax, %eax
	callq	_getuid
	testq	%rax, %rax
	jne	LBB0_6
## %bb.5:
	movl	20(%rbx), %edi
	callq	_pty_release
LBB0_6:
	movl	16(%rbx), %edi
	cmpl	$-1, %edi
	je	LBB0_9
## %bb.7:
	callq	_close
	testq	%rax, %rax
	jns	LBB0_9
## %bb.8:
	movl	16(%rbx), %r14d
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_strerror
	leaq	L_.str.2(%rip), %rdi
	movl	%r14d, %esi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_error
LBB0_9:
	movl	$-1, (%rbx)
LBB0_10:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_11:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	jmp	_error                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"session_pty_cleanup: no session"

L_.str.1:                               ## @.str.1
	.asciz	"session_pty_cleanup: session %d release %s"

L_.str.2:                               ## @.str.2
	.asciz	"close(s->ptymaster/%d): %s"

	.comm	_errno,4,2                      ## @errno
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_session_pty_cleanup2           ; -- Begin function session_pty_cleanup2
	.p2align	2
_session_pty_cleanup2:                  ; @session_pty_cleanup2
	.cfi_startproc
; %bb.0:
	cbz	x0, LBB0_11
; %bb.1:
	sub	sp, sp, #48
	.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
	mov	x19, x0
	ldr	w8, [x0]
	cmn	w8, #1
	b.eq	LBB0_10
; %bb.2:
	ldr	w1, [x19, #32]
	ldr	w2, [x19, #20]
Lloh0:
	adrp	x0, l_.str.1@PAGE
Lloh1:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_debug
	ldr	x0, [x19, #8]
	cbz	x0, LBB0_4
; %bb.3:
	ldr	w1, [x19, #20]
	ldr	x8, [x19, #24]
	ldr	w2, [x8]
	bl	_record_logout
LBB0_4:
	bl	_getuid
	cbnz	x0, LBB0_6
; %bb.5:
	ldr	w0, [x19, #20]
	bl	_pty_release
LBB0_6:
	ldr	w0, [x19, #16]
	cmn	w0, #1
	b.eq	LBB0_9
; %bb.7:
	bl	_close
	tbz	x0, #63, LBB0_9
; %bb.8:
Lloh2:
	adrp	x8, _errno@GOTPAGE
Lloh3:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	ldr	w20, [x19, #16]
	bl	_strerror
	stp	x20, x0, [sp]
Lloh5:
	adrp	x0, l_.str.2@PAGE
Lloh6:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_error
LBB0_9:
	mov	w8, #-1
	str	w8, [x19]
LBB0_10:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_11:
	.cfi_def_cfa wsp, 0
	.cfi_same_value w30
	.cfi_same_value w29
	.cfi_same_value w19
	.cfi_same_value w20
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	b	_error
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"session_pty_cleanup: no session"

l_.str.1:                               ; @.str.1
	.asciz	"session_pty_cleanup: session %d release %s"

l_.str.2:                               ; @.str.2
	.asciz	"close(s->ptymaster/%d): %s"

	.comm	_errno,4,2                      ; @errno
.subsections_via_symbols
