	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gs_write                       ## -- Begin function gs_write
	.p2align	4, 0x90
_gs_write:                              ## @gs_write
	.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	%edx, %r14d
	movq	%rsi, %r13
	movq	%rdi, %r15
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_func_enter
	movq	8(%r15), %rcx
	testq	%rcx, %rcx
	je	LBB0_12
## %bb.1:
	movq	_ASYNC_INITIALIZED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 16(%rcx)
	je	LBB0_12
## %bb.2:
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	%rcx, %rbx
	leaq	20(%rcx), %rdi
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movq	_SERIAL_XMIT_SIZE@GOTPCREL(%rip), %rdi
	movl	(%rdi), %ecx
	movl	(%rbx), %eax
	movq	%rbx, %r12
	movl	4(%rbx), %r15d
	movl	%ecx, %edx
	subl	%eax, %edx
	cmpl	%r14d, %edx
	cmovgel	%r14d, %edx
	notl	%r15d
	addl	%ecx, %r15d
	cmpl	%edx, %r15d
	cmovgel	%edx, %r15d
	testl	%r15d, %r15d
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	jle	LBB0_3
## %bb.4:
	xorl	%ebx, %ebx
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movq	%rdi, %rbx
	movslq	%eax, %rdi
	addq	24(%r12), %rdi
	movq	%r13, %rsi
	movl	%r15d, %edx
	callq	_memcpy
	movq	%rbx, %rdi
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	4(%r12), %ecx
	addl	%r15d, %ecx
	movl	%ecx, 4(%r12)
	movl	(%r12), %edx
	addl	%r15d, %edx
	movl	(%rdi), %eax
	decl	%eax
	andl	%edx, %eax
	movl	%eax, (%r12)
	movl	%r15d, %edx
	addq	%rdx, %r13
	subl	%r15d, %r14d
	addl	%r15d, %ebx
	movl	(%rdi), %edx
	movl	%edx, %esi
	subl	%eax, %esi
	cmpl	%r14d, %esi
	cmovgel	%r14d, %esi
	notl	%ecx
	addl	%edx, %ecx
	cmpl	%esi, %ecx
	cmovgel	%esi, %ecx
	movl	%ecx, %r15d
	testl	%ecx, %ecx
	jg	LBB0_5
	jmp	LBB0_6
LBB0_3:
	xorl	%ebx, %ebx
LBB0_6:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	_GS_DEBUG_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_GS_TX_INTEN@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	andl	16(%r15), %eax
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.1(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str(%rip), %rsi
	callq	_gs_dprintk
	cmpl	$0, 4(%r15)
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	je	LBB0_11
## %bb.7:
	cmpl	$0, 4(%rax)
	jne	LBB0_11
## %bb.8:
	cmpl	$0, (%rax)
	jne	LBB0_11
## %bb.9:
	movq	%r15, %rdi
	movl	16(%r15), %eax
	movl	(%r14), %ecx
	testl	%eax, %ecx
	jne	LBB0_11
## %bb.10:
	orl	%eax, %ecx
	movl	%ecx, 16(%rdi)
	movq	8(%rdi), %rax
	callq	*(%rax)
LBB0_11:
	xorl	%eax, %eax
	callq	_func_exit
LBB0_12:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ASYNC_INITIALIZED,4,2          ## @ASYNC_INITIALIZED
	.comm	_SERIAL_XMIT_SIZE,4,2           ## @SERIAL_XMIT_SIZE
	.comm	_GS_DEBUG_WRITE,4,2             ## @GS_DEBUG_WRITE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write: interrupts are %s\n"

	.comm	_GS_TX_INTEN,4,2                ## @GS_TX_INTEN
L_.str.1:                               ## @.str.1
	.asciz	"enabled"

L_.str.2:                               ## @.str.2
	.asciz	"disabled"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gs_write                       ; -- Begin function gs_write
	.p2align	2
_gs_write:                              ; @gs_write
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x22, x2
	mov	x23, x1
	mov	x20, x0
	bl	_func_enter
	ldr	x19, [x20, #8]
	cbz	x19, LBB0_5
; %bb.1:
	ldr	w8, [x19, #16]
Lloh0:
	adrp	x9, _ASYNC_INITIALIZED@GOTPAGE
Lloh1:
	ldr	x9, [x9, _ASYNC_INITIALIZED@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.2:
	add	x24, x19, #20
	mov	x0, x24
	bl	_mutex_lock
Lloh3:
	adrp	x26, _SERIAL_XMIT_SIZE@GOTPAGE
Lloh4:
	ldr	x26, [x26, _SERIAL_XMIT_SIZE@GOTPAGEOFF]
	ldr	w9, [x26]
	ldp	w8, w10, [x19]
	sub	w11, w9, w8
	cmp	w11, w22
	csel	w11, w11, w22, lt
	mvn	w10, w10
	add	w9, w9, w10
	cmp	w9, w11
	csel	w25, w9, w11, lt
	cmp	w25, #1
	b.lt	LBB0_6
; %bb.3:
	mov	w21, #0
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19, #24]
	add	x0, x9, w8, sxtw
	mov	x1, x23
	mov	x2, x25
	bl	_memcpy
	ldp	w8, w9, [x19]
	ldr	w10, [x26]
	sub	w10, w10, #1
	add	w8, w8, w25
	and	w8, w10, w8
	add	w9, w9, w25
	mvn	w10, w9
	stp	w8, w9, [x19]
	add	x23, x23, w25, uxtw
	sub	w22, w22, w25
	add	w21, w25, w21
	ldr	w9, [x26]
	sub	w11, w9, w8
	cmp	w11, w22
	csel	w11, w11, w22, lt
	add	w9, w9, w10
	cmp	w9, w11
	csel	w25, w9, w11, lt
	cmp	w25, #0
	b.gt	LBB0_4
	b	LBB0_7
LBB0_5:
	mov	w21, #0
	b	LBB0_13
LBB0_6:
	mov	w21, #0
LBB0_7:
	mov	x0, x24
	bl	_mutex_unlock
Lloh5:
	adrp	x8, _GS_DEBUG_WRITE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GS_DEBUG_WRITE@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	ldr	w8, [x19, #16]
Lloh8:
	adrp	x22, _GS_TX_INTEN@GOTPAGE
Lloh9:
	ldr	x22, [x22, _GS_TX_INTEN@GOTPAGEOFF]
	ldr	w9, [x22]
Lloh10:
	adrp	x10, l_.str.1@PAGE
Lloh11:
	add	x10, x10, l_.str.1@PAGEOFF
Lloh12:
	adrp	x11, l_.str.2@PAGE
Lloh13:
	add	x11, x11, l_.str.2@PAGEOFF
	tst	w9, w8
	csel	x2, x11, x10, eq
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	bl	_gs_dprintk
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_12
; %bb.8:
	ldr	w8, [x20, #4]
	cbnz	w8, LBB0_12
; %bb.9:
	ldr	w8, [x20]
	cbnz	w8, LBB0_12
; %bb.10:
	ldr	w8, [x19, #16]
	ldr	w9, [x22]
	tst	w9, w8
	b.ne	LBB0_12
; %bb.11:
	orr	w8, w9, w8
	str	w8, [x19, #16]
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
LBB0_12:
	bl	_func_exit
LBB0_13:
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_ASYNC_INITIALIZED,4,2          ; @ASYNC_INITIALIZED
	.comm	_SERIAL_XMIT_SIZE,4,2           ; @SERIAL_XMIT_SIZE
	.comm	_GS_DEBUG_WRITE,4,2             ; @GS_DEBUG_WRITE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write: interrupts are %s\n"

	.comm	_GS_TX_INTEN,4,2                ; @GS_TX_INTEN
l_.str.1:                               ; @.str.1
	.asciz	"enabled"

l_.str.2:                               ; @.str.2
	.asciz	"disabled"

.subsections_via_symbols
