	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tty_set_ldisc                  ## -- Begin function tty_set_ldisc
	.p2align	4, 0x90
_tty_set_ldisc:                         ## @tty_set_ldisc
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	movl	%esi, %edi
	callq	_tty_ldisc_get
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_1
## %bb.23:
	movq	%rbx, %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_1:
	movq	16(%r15), %rax
	movq	(%rax), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_3
## %bb.2:
	movq	%rbx, %rdi
	callq	_tty_ldisc_put
	xorl	%ebx, %ebx
	jmp	LBB0_22
LBB0_3:
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	40(%r15), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_tty_wait_until_sent
	movq	%r15, %rdi
	callq	_mutex_lock
	leaq	24(%r15), %r14
	movq	_TTY_LDISC_CHANGING@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movq	%r14, %rsi
	callq	_test_bit
	testq	%rax, %rax
	je	LBB0_6
## %bb.4:
	movq	_tty_ldisc_wait@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_mutex_unlock
	movl	(%r12), %ebx
	movl	(%r13), %edi
	movq	%r14, %rsi
	callq	_test_bit
	xorl	%esi, %esi
	testq	%rax, %rax
	sete	%sil
	movl	%ebx, %edi
	callq	_wait_event
	movq	%r15, %rdi
	callq	_mutex_lock
	movl	(%r13), %edi
	movq	%r14, %rsi
	callq	_test_bit
	testq	%rax, %rax
	jne	LBB0_5
LBB0_6:
	movl	(%r13), %edi
	movq	%r14, %rsi
	callq	_set_bit
	movq	$0, 32(%r15)
	movq	16(%r15), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_tty_ldisc_halt
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	testq	%r12, %r12
	je	LBB0_8
## %bb.7:
	movq	%r12, %rdi
	callq	_tty_ldisc_halt
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
LBB0_8:
	movq	%r15, %rdi
	callq	_mutex_unlock
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_flush_scheduled_work
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	_TTY_HUPPED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	callq	_test_bit
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	movl	(%r13), %edi
	movq	%r14, %rsi
	callq	_clear_bit
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_tty_ldisc_put
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_22
LBB0_10:
	movq	%r15, %rdi
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rsi
	callq	_tty_ldisc_close
	movq	%r15, %rdi
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rsi
	callq	_tty_ldisc_assign
	movq	%r15, %rdi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	callq	_tty_set_termios_ldisc
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_tty_ldisc_open
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_12
## %bb.11:
	movq	%r14, %rdi
	callq	_tty_ldisc_put
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_tty_ldisc_restore
LBB0_12:
	movq	16(%r15), %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	movq	(%r13), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_15
## %bb.13:
	movq	8(%r15), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	movq	%r15, %rdi
	callq	*%rax
LBB0_15:
	movq	%r13, %rdi
	callq	_tty_ldisc_put
	movq	%r15, %rdi
	callq	_tty_ldisc_enable
	testq	%r12, %r12
	je	LBB0_17
## %bb.16:
	movq	%r12, %rdi
	callq	_tty_ldisc_enable
LBB0_17:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_19
## %bb.18:
	leaq	4(%r15), %rdi
	movl	$1, %esi
	callq	_schedule_delayed_work
LBB0_19:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_21
## %bb.20:
	addq	$4, %r12
	movq	%r12, %rdi
	movl	$1, %esi
	callq	_schedule_delayed_work
LBB0_21:
	movq	%r15, %rdi
	callq	_mutex_unlock
LBB0_22:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TTY_LDISC_CHANGING,4,2         ## @TTY_LDISC_CHANGING
	.comm	_tty_ldisc_wait,4,2             ## @tty_ldisc_wait
	.comm	_TTY_HUPPED,4,2                 ## @TTY_HUPPED
	.comm	_EIO,4,2                        ## @EIO
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tty_set_ldisc                  ; -- Begin function tty_set_ldisc
	.p2align	2
_tty_set_ldisc:                         ; @tty_set_ldisc
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x1
	mov	x19, x0
	mov	x0, x1
	bl	_tty_ldisc_get
	mov	x21, x0
	bl	_IS_ERR
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_PTR_ERR
LBB0_2:
	ldr	x8, [x19, #16]
	ldr	x8, [x8]
	ldr	w8, [x8]
	cmp	w8, w22
	b.ne	LBB0_4
; %bb.3:
	mov	x0, x21
	bl	_tty_ldisc_put
	mov	w22, #0
	b	LBB0_24
LBB0_4:
	ldr	x20, [x19, #40]
	mov	x0, x19
	mov	w1, #0
	bl	_tty_wait_until_sent
	mov	x0, x19
	bl	_mutex_lock
	add	x25, x19, #24
Lloh0:
	adrp	x27, _TTY_LDISC_CHANGING@GOTPAGE
Lloh1:
	ldr	x27, [x27, _TTY_LDISC_CHANGING@GOTPAGEOFF]
	ldr	w0, [x27]
	mov	x1, x25
	bl	_test_bit
	cbz	x0, LBB0_7
; %bb.5:
Lloh2:
	adrp	x24, _tty_ldisc_wait@GOTPAGE
Lloh3:
	ldr	x24, [x24, _tty_ldisc_wait@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_mutex_unlock
	ldr	w23, [x24]
	ldr	w0, [x27]
	mov	x1, x25
	bl	_test_bit
	cmp	x0, #0
	cset	w1, eq
	mov	x0, x23
	bl	_wait_event
	mov	x0, x19
	bl	_mutex_lock
	ldr	w0, [x27]
	mov	x1, x25
	bl	_test_bit
	cbnz	x0, LBB0_6
LBB0_7:
	ldr	w0, [x27]
	mov	x1, x25
	bl	_set_bit
	str	xzr, [x19, #32]
	ldr	x26, [x19, #16]
	mov	x0, x19
	bl	_tty_ldisc_halt
	mov	x24, x0
	cbz	x20, LBB0_9
; %bb.8:
	mov	x0, x20
	bl	_tty_ldisc_halt
	mov	x23, x0
	b	LBB0_10
LBB0_9:
	mov	w23, #0
LBB0_10:
	mov	x0, x19
	bl	_mutex_unlock
	bl	_flush_scheduled_work
	mov	x0, x19
	bl	_mutex_lock
Lloh4:
	adrp	x8, _TTY_HUPPED@GOTPAGE
Lloh5:
	ldr	x8, [x8, _TTY_HUPPED@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	mov	x1, x25
	bl	_test_bit
	cbz	x0, LBB0_12
; %bb.11:
	ldr	w0, [x27]
	mov	x1, x25
	bl	_clear_bit
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x21
	bl	_tty_ldisc_put
Lloh7:
	adrp	x8, _EIO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_24
LBB0_12:
	mov	x0, x19
	mov	x1, x26
	bl	_tty_ldisc_close
	mov	x0, x19
	mov	x1, x21
	bl	_tty_ldisc_assign
	mov	x0, x19
	mov	x1, x22
	bl	_tty_set_termios_ldisc
	mov	x0, x19
	mov	x1, x21
	bl	_tty_ldisc_open
	mov	x22, x0
	tbz	w0, #31, LBB0_14
; %bb.13:
	mov	x0, x21
	bl	_tty_ldisc_put
	mov	x0, x19
	mov	x1, x26
	bl	_tty_ldisc_restore
LBB0_14:
	ldr	x8, [x19, #16]
	ldr	x8, [x8]
	ldr	w8, [x8]
	ldr	x9, [x26]
	ldr	w9, [x9]
	cmp	w8, w9
	b.eq	LBB0_17
; %bb.15:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	cbz	x8, LBB0_17
; %bb.16:
	mov	x0, x19
	blr	x8
LBB0_17:
	mov	x0, x26
	bl	_tty_ldisc_put
	mov	x0, x19
	bl	_tty_ldisc_enable
	cbz	x20, LBB0_19
; %bb.18:
	mov	x0, x20
	bl	_tty_ldisc_enable
LBB0_19:
	cbz	w24, LBB0_21
; %bb.20:
	add	x0, x19, #4
	mov	w1, #1
	bl	_schedule_delayed_work
LBB0_21:
	cbz	w23, LBB0_23
; %bb.22:
	add	x0, x20, #4
	mov	w1, #1
	bl	_schedule_delayed_work
LBB0_23:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_24:
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_TTY_LDISC_CHANGING,4,2         ; @TTY_LDISC_CHANGING
	.comm	_tty_ldisc_wait,4,2             ; @tty_ldisc_wait
	.comm	_TTY_HUPPED,4,2                 ; @TTY_HUPPED
	.comm	_EIO,4,2                        ; @EIO
.subsections_via_symbols
