	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ssh_packet_write_wait          ## -- Begin function ssh_packet_write_wait
	.p2align	4, 0x90
_ssh_packet_write_wait:                 ## @ssh_packet_write_wait
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movl	$0, -44(%rbp)
	movq	(%rdi), %r15
	movq	8(%r15), %rdi
	incq	%rdi
	movq	_NFDBITS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_howmany
	movl	%eax, %edi
	movl	$4, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	%rax, %r12
	movq	%r14, %rdi
	callq	_ssh_packet_write_poll
	testl	%eax, %eax
	je	LBB0_6
LBB0_2:
	movl	%eax, %r13d
	movq	%r12, %rdi
	callq	_free
	jmp	LBB0_5
LBB0_3:
	movq	_SSH_ERR_ALLOC_FAIL@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %r13d
LBB0_5:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	xorl	%ebx, %ebx
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_9 Depth=1
	je	LBB0_21
LBB0_8:                                 ##   in Loop: Header=BB0_9 Depth=1
	movq	%r14, %rdi
	callq	_ssh_packet_write_poll
	testl	%eax, %eax
	jne	LBB0_2
LBB0_9:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_12 Depth 2
                                        ##       Child Loop BB0_14 Depth 3
	movq	%r14, %rdi
	callq	_ssh_packet_have_data_to_write
	testq	%rax, %rax
	je	LBB0_22
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	8(%r15), %rdi
	incq	%rdi
	movq	_NFDBITS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_howmany
                                        ## kill: def $eax killed $eax def $rax
	leal	(,%rax,4), %edx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_memset
	movq	8(%r15), %rdi
	movq	%r12, %rsi
	callq	_FD_SET
	movl	(%r15), %eax
	testl	%eax, %eax
	leaq	-56(%rbp), %r13
	jle	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%eax, -44(%rbp)
	movq	%r13, %rbx
LBB0_12:                                ##   Parent Loop BB0_9 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_14 Depth 3
	movl	(%r15), %eax
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_14 Depth=3
	movl	$-1, %eax
	cmpl	$-1, (%r15)
	jne	LBB0_20
LBB0_14:                                ##   Parent Loop BB0_9 Depth=1
                                        ##     Parent Loop BB0_12 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	cmpl	$-1, %eax
	je	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=3
	movl	-44(%rbp), %esi
	movq	%r13, %rdi
	callq	_ms_to_timeval
	leaq	-48(%rbp), %rdi
	callq	_monotime_tv
LBB0_16:                                ##   in Loop: Header=BB0_14 Depth=3
	movq	8(%r15), %rdi
	incq	%rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	xorl	%ecx, %ecx
	movq	%rbx, %r8
	callq	_select
	testl	%eax, %eax
	jns	LBB0_7
## %bb.17:                              ##   in Loop: Header=BB0_14 Depth=3
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_EAGAIN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_13
## %bb.18:                              ##   in Loop: Header=BB0_14 Depth=3
	movq	_EINTR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_13
## %bb.19:                              ##   in Loop: Header=BB0_14 Depth=3
	movq	_EWOULDBLOCK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_13
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_12 Depth=2
	leaq	-48(%rbp), %rdi
	leaq	-44(%rbp), %rsi
	callq	_ms_subtract_diff
	cmpl	$0, -44(%rbp)
	jg	LBB0_12
LBB0_21:
	movq	%r12, %rdi
	callq	_free
	movq	_SSH_ERR_CONN_TIMEOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_22:
	movq	%r12, %rdi
	callq	_free
	xorl	%r13d, %r13d
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_NFDBITS,4,2                    ## @NFDBITS
	.comm	_SSH_ERR_ALLOC_FAIL,4,2         ## @SSH_ERR_ALLOC_FAIL
	.comm	_errno,8,3                      ## @errno
	.comm	_EAGAIN,8,3                     ## @EAGAIN
	.comm	_EINTR,8,3                      ## @EINTR
	.comm	_EWOULDBLOCK,8,3                ## @EWOULDBLOCK
	.comm	_SSH_ERR_CONN_TIMEOUT,4,2       ## @SSH_ERR_CONN_TIMEOUT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ssh_packet_write_wait          ; -- Begin function ssh_packet_write_wait
	.p2align	2
_ssh_packet_write_wait:                 ; @ssh_packet_write_wait
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x19, x0
	str	wzr, [sp, #12]
	ldr	x23, [x0]
	ldr	x8, [x23, #8]
	add	x0, x8, #1
Lloh0:
	adrp	x24, _NFDBITS@GOTPAGE
Lloh1:
	ldr	x24, [x24, _NFDBITS@GOTPAGEOFF]
	ldr	w1, [x24]
	bl	_howmany
	mov	w1, #4
	bl	_calloc
	cbz	x0, LBB0_3
; %bb.1:
	mov	x20, x0
	mov	x0, x19
	bl	_ssh_packet_write_poll
	cbz	w0, LBB0_6
LBB0_2:
	mov	x22, x0
	mov	x0, x20
	bl	_free
	b	LBB0_5
LBB0_3:
Lloh2:
	adrp	x8, _SSH_ERR_ALLOC_FAIL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SSH_ERR_ALLOC_FAIL@GOTPAGEOFF]
LBB0_4:
	ldr	w22, [x8]
LBB0_5:
	mov	x0, x22
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_6:
	mov	x21, #0
Lloh4:
	adrp	x25, _errno@GOTPAGE
Lloh5:
	ldr	x25, [x25, _errno@GOTPAGEOFF]
Lloh6:
	adrp	x26, _EAGAIN@GOTPAGE
Lloh7:
	ldr	x26, [x26, _EAGAIN@GOTPAGEOFF]
Lloh8:
	adrp	x27, _EINTR@GOTPAGE
Lloh9:
	ldr	x27, [x27, _EINTR@GOTPAGEOFF]
Lloh10:
	adrp	x28, _EWOULDBLOCK@GOTPAGE
Lloh11:
	ldr	x28, [x28, _EWOULDBLOCK@GOTPAGEOFF]
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
	cbz	w0, LBB0_19
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	mov	x0, x19
	bl	_ssh_packet_write_poll
	cbnz	w0, LBB0_2
LBB0_9:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_12 Depth 2
                                        ;       Child Loop BB0_13 Depth 3
	mov	x0, x19
	bl	_ssh_packet_have_data_to_write
	cbz	x0, LBB0_20
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x23, #8]
	add	x0, x8, #1
	ldr	w1, [x24]
	bl	_howmany
	lsl	w2, w0, #2
	mov	x0, x20
	mov	w1, #0
	bl	_memset
	ldr	x0, [x23, #8]
	mov	x1, x20
	bl	_FD_SET
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=1
	str	w8, [sp, #12]
	mov	x21, sp
LBB0_12:                                ;   Parent Loop BB0_9 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_13 Depth 3
	ldr	w8, [x23]
LBB0_13:                                ;   Parent Loop BB0_9 Depth=1
                                        ;     Parent Loop BB0_12 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	cmn	w8, #1
	b.eq	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=3
	ldr	w1, [sp, #12]
	mov	x0, sp
	bl	_ms_to_timeval
	add	x0, sp, #8
	bl	_monotime_tv
LBB0_15:                                ;   in Loop: Header=BB0_13 Depth=3
	ldr	x8, [x23, #8]
	add	x0, x8, #1
	mov	x1, #0
	mov	x2, x20
	mov	x3, #0
	mov	x4, x21
	bl	_select
	tbz	w0, #31, LBB0_7
; %bb.16:                               ;   in Loop: Header=BB0_13 Depth=3
	ldr	x8, [x25]
	ldr	x9, [x26]
	ldr	x10, [x27]
	ldr	x11, [x28]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	ccmp	x8, x11, #4, ne
	b.ne	LBB0_8
; %bb.17:                               ;   in Loop: Header=BB0_13 Depth=3
	ldr	w9, [x23]
	mov	w8, #-1
	cmn	w9, #1
	b.eq	LBB0_13
; %bb.18:                               ;   in Loop: Header=BB0_12 Depth=2
	add	x0, sp, #8
	add	x1, sp, #12
	bl	_ms_subtract_diff
	ldr	w8, [sp, #12]
	cmp	w8, #1
	b.ge	LBB0_12
LBB0_19:
	mov	x0, x20
	bl	_free
Lloh12:
	adrp	x8, _SSH_ERR_CONN_TIMEOUT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SSH_ERR_CONN_TIMEOUT@GOTPAGEOFF]
	b	LBB0_4
LBB0_20:
	mov	x0, x20
	bl	_free
	mov	w22, #0
	b	LBB0_5
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_NFDBITS,4,2                    ; @NFDBITS
	.comm	_SSH_ERR_ALLOC_FAIL,4,2         ; @SSH_ERR_ALLOC_FAIL
	.comm	_errno,8,3                      ; @errno
	.comm	_EAGAIN,8,3                     ; @EAGAIN
	.comm	_EINTR,8,3                      ; @EINTR
	.comm	_EWOULDBLOCK,8,3                ; @EWOULDBLOCK
	.comm	_SSH_ERR_CONN_TIMEOUT,4,2       ; @SSH_ERR_CONN_TIMEOUT
.subsections_via_symbols
