	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function modem_write_cmd
_modem_write_cmd:                       ## @modem_write_cmd
	.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
	testl	%edx, %edx
	je	LBB0_6
## %bb.1:
	movl	%edx, %r12d
	movq	%rdi, %r14
	movq	_MAX_MODEM_BUF@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	(%rdi), %ecx
	movl	%ebx, %eax
	subl	%ecx, %eax
	cmpl	%edx, %eax
	jl	LBB0_6
## %bb.2:
	movq	%rsi, %r15
	addl	4(%r14), %ecx
	leal	-1(%rbx), %eax
	andl	%ecx, %eax
	subl	%eax, %ebx
	cmpl	%r12d, %ebx
	jge	LBB0_4
## %bb.3:
	movslq	%eax, %rdi
	addq	16(%r14), %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_memcpy
	addl	%ebx, (%r14)
	movslq	%ebx, %rax
	leaq	(%r15,%rax,4), %r15
	subl	%ebx, %r12d
	xorl	%eax, %eax
LBB0_4:
	movslq	%eax, %rdi
	addq	16(%r14), %rdi
	movq	%r15, %rsi
	movl	%r12d, %edx
	callq	_memcpy
	addl	%r12d, (%r14)
	je	LBB0_6
## %bb.5:
	movl	8(%r14), %eax
	movq	_UART_IER_THRI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	testl	%eax, %edx
	je	LBB0_7
LBB0_6:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	orl	%eax, %edx
	movl	%edx, 8(%r14)
	movq	_UART_IER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_serial_outp                    ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_MODEM_BUF,4,2              ## @MAX_MODEM_BUF
	.comm	_UART_IER_THRI,4,2              ## @UART_IER_THRI
	.comm	_UART_IER,4,2                   ## @UART_IER
	.no_dead_strip	_modem_write_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function modem_write_cmd
_modem_write_cmd:                       ; @modem_write_cmd
	.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
	cbz	w2, LBB0_6
; %bb.1:
	mov	x20, x2
	mov	x19, x0
Lloh0:
	adrp	x8, _MAX_MODEM_BUF@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_MODEM_BUF@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x8]
	ldr	w8, [x0]
	sub	w10, w9, w8
	cmp	w10, w2
	b.lt	LBB0_6
; %bb.2:
	mov	x21, x1
	ldr	w10, [x19, #4]
	sub	w11, w9, #1
	add	w8, w10, w8
	and	w8, w8, w11
	sub	w22, w9, w8
	cmp	w22, w20
	b.ge	LBB0_4
; %bb.3:
	ldr	x9, [x19, #16]
	add	x0, x9, w8, sxtw
	mov	x1, x21
	mov	x2, x22
	bl	_memcpy
	mov	w8, #0
	ldr	w9, [x19]
	add	w9, w9, w22
	str	w9, [x19]
	add	x21, x21, w22, sxtw #2
	sub	w20, w20, w22
LBB0_4:
	ldr	x9, [x19, #16]
	add	x0, x9, w8, sxtw
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
	ldr	w8, [x19]
	adds	w8, w8, w20
	str	w8, [x19]
	b.eq	LBB0_6
; %bb.5:
	ldr	w8, [x19, #8]
Lloh3:
	adrp	x9, _UART_IER_THRI@GOTPAGE
Lloh4:
	ldr	x9, [x9, _UART_IER_THRI@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
LBB0_6:
	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_7:
	orr	w2, w9, w8
	str	w2, [x19, #8]
Lloh6:
	adrp	x8, _UART_IER@GOTPAGE
Lloh7:
	ldr	x8, [x8, _UART_IER@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	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
	b	_serial_outp
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_MODEM_BUF,4,2              ; @MAX_MODEM_BUF
	.comm	_UART_IER_THRI,4,2              ; @UART_IER_THRI
	.comm	_UART_IER,4,2                   ; @UART_IER
	.no_dead_strip	_modem_write_cmd
.subsections_via_symbols
