	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function send_msg
_send_msg:                              ## @send_msg
	.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, %r15
	testb	$1, (%rdi)
	jne	LBB0_6
## %bb.1:
	movq	%r15, %rdi
	callq	_establish_connection
	movl	$-1, %r12d
	cmpl	$-1, %eax
	je	LBB0_9
## %bb.2:
	leaq	40(%r15), %r14
	movl	(%r15), %eax
	leal	1(%rax), %ecx
	movl	%ecx, (%r15)
	movl	%ecx, 40(%r15)
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	movq	%r14, %rdi
	callq	_gen_session_id
LBB0_4:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_crypt_msg
	cmpq	$0, 32(%r15)
	movq	_TAC_SINGLE_CONNECT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	je	LBB0_10
## %bb.5:
	orl	%eax, 48(%r15)
	jmp	LBB0_11
LBB0_6:
	leaq	L_.str(%rip), %rsi
LBB0_7:
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_generr
LBB0_8:
	movl	$-1, %r12d
LBB0_9:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	notl	%eax
	andl	%eax, 48(%r15)
LBB0_11:
	xorl	%r12d, %r12d
	leaq	-48(%rbp), %rdi
	xorl	%esi, %esi
	callq	_gettimeofday
	movq	8(%r15), %rax
	movq	24(%r15), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	%rax, -48(%rbp)
	movq	_HDRSIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	44(%r15), %edi
	callq	_ntohl
	movl	%eax, %ebx
	addl	%r13d, %ebx
	jle	LBB0_9
## %bb.12:
	leaq	-56(%rbp), %r12
	leaq	-60(%rbp), %r13
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_15 Depth=1
	movslq	%eax, %rcx
	addq	%rcx, %r14
	subl	%eax, %ebx
LBB0_14:                                ##   in Loop: Header=BB0_15 Depth=1
	testl	%ebx, %ebx
	jle	LBB0_21
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	16(%r15), %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_write
	cmpl	$-1, %eax
	jne	LBB0_13
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdi
	jne	LBB0_22
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_gettimeofday
	leaq	-48(%rbp), %rdi
	movq	%r12, %rsi
	movq	%r12, %rdx
	callq	_timersub
	cmpq	$0, -56(%rbp)
	js	LBB0_20
## %bb.18:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	%r13, %rdi
	callq	_FD_ZERO
	movq	16(%r15), %rdi
	movq	%r13, %rsi
	callq	_FD_SET
	movq	16(%r15), %rdi
	incq	%rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	xorl	%ecx, %ecx
	movq	%r12, %r8
	callq	_select
	cmpl	$-1, %eax
	je	LBB0_23
## %bb.19:                              ##   in Loop: Header=BB0_15 Depth=1
	testl	%eax, %eax
	jne	LBB0_14
LBB0_20:
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_7
LBB0_21:
	xorl	%r12d, %r12d
	jmp	LBB0_9
LBB0_22:
	callq	_strerror
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_24
LBB0_23:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_strerror
	leaq	L_.str.2(%rip), %rsi
LBB0_24:
	movq	%r15, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_generr
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Attempt to send message out of sequence"

	.comm	_TAC_SINGLE_CONNECT,4,2         ## @TAC_SINGLE_CONNECT
	.comm	_HDRSIZE,4,2                    ## @HDRSIZE
	.comm	_errno,8,3                      ## @errno
	.comm	_EAGAIN,8,3                     ## @EAGAIN
L_.str.1:                               ## @.str.1
	.asciz	"Network write error: %s"

L_.str.2:                               ## @.str.2
	.asciz	"select: %s"

L_.str.3:                               ## @.str.3
	.asciz	"Network write timed out"

	.no_dead_strip	_send_msg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function send_msg
_send_msg:                              ; @send_msg
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x0
	ldrb	w8, [x0]
	tbnz	w8, #0, LBB0_6
; %bb.1:
	mov	x0, x19
	bl	_establish_connection
	cmn	w0, #1
	b.eq	LBB0_20
; %bb.2:
	ldr	w8, [x19]
	add	w9, w8, #1
	mov	x20, x19
	str	w9, [x20, #40]!
	str	w9, [x19]
	cbnz	w8, LBB0_4
; %bb.3:
	mov	x0, x20
	bl	_gen_session_id
LBB0_4:
	mov	x0, x19
	mov	x1, x20
	bl	_crypt_msg
	ldr	x9, [x19, #32]
Lloh0:
	adrp	x8, _TAC_SINGLE_CONNECT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TAC_SINGLE_CONNECT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cbz	x9, LBB0_8
; %bb.5:
	ldr	w9, [x19, #48]
	orr	w8, w9, w8
	b	LBB0_9
LBB0_6:
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
LBB0_7:
	mov	x0, x19
	bl	_generr
	mov	w0, #-1
	b	LBB0_20
LBB0_8:
	ldr	w9, [x19, #48]
	bic	w8, w9, w8
LBB0_9:
	str	w8, [x19, #48]
	add	x0, sp, #24
	mov	x1, #0
	bl	_gettimeofday
	ldr	x8, [x19, #24]
	ldr	x9, [x19, #8]
	ldr	x8, [x8, x9, lsl #3]
	ldr	x9, [sp, #24]
	add	x8, x9, x8
	str	x8, [sp, #24]
Lloh5:
	adrp	x8, _HDRSIZE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _HDRSIZE@GOTPAGEOFF]
Lloh7:
	ldr	w21, [x8]
	ldr	w0, [x19, #44]
	bl	_ntohl
	add	w21, w0, w21
	cmp	w21, #1
	b.lt	LBB0_19
; %bb.10:
Lloh8:
	adrp	x22, _errno@GOTPAGE
Lloh9:
	ldr	x22, [x22, _errno@GOTPAGEOFF]
Lloh10:
	adrp	x23, _EAGAIN@GOTPAGE
Lloh11:
	ldr	x23, [x23, _EAGAIN@GOTPAGEOFF]
	b	LBB0_13
LBB0_11:                                ;   in Loop: Header=BB0_13 Depth=1
	add	x20, x20, w0, sxtw
	sub	w21, w21, w0
LBB0_12:                                ;   in Loop: Header=BB0_13 Depth=1
	cmp	w21, #0
	b.le	LBB0_19
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x19, #16]
	mov	x1, x20
	mov	x2, x21
	bl	_write
	cmn	w0, #1
	b.ne	LBB0_11
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	x0, [x22]
	ldr	x8, [x23]
	cmp	x0, x8
	b.ne	LBB0_21
; %bb.15:                               ;   in Loop: Header=BB0_13 Depth=1
	add	x0, sp, #16
	mov	x1, #0
	bl	_gettimeofday
	add	x0, sp, #24
	add	x1, sp, #16
	add	x2, sp, #16
	bl	_timersub
	ldr	x8, [sp, #16]
	tbnz	x8, #63, LBB0_18
; %bb.16:                               ;   in Loop: Header=BB0_13 Depth=1
	add	x0, sp, #12
	bl	_FD_ZERO
	ldr	x0, [x19, #16]
	add	x1, sp, #12
	bl	_FD_SET
	ldr	x8, [x19, #16]
	add	x0, x8, #1
	add	x2, sp, #12
	add	x4, sp, #16
	mov	x1, #0
	mov	x3, #0
	bl	_select
	cmn	w0, #1
	b.eq	LBB0_22
; %bb.17:                               ;   in Loop: Header=BB0_13 Depth=1
	cbnz	w0, LBB0_12
LBB0_18:
Lloh12:
	adrp	x1, l_.str.3@PAGE
Lloh13:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_7
LBB0_19:
	mov	w0, #0
LBB0_20:
	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
	add	sp, sp, #96
	ret
LBB0_21:
	bl	_strerror
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_7
LBB0_22:
	ldr	x0, [x22]
	bl	_strerror
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh16:
	adrp	x1, l_.str.2@PAGE
Lloh17:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Attempt to send message out of sequence"

	.comm	_TAC_SINGLE_CONNECT,4,2         ; @TAC_SINGLE_CONNECT
	.comm	_HDRSIZE,4,2                    ; @HDRSIZE
	.comm	_errno,8,3                      ; @errno
	.comm	_EAGAIN,8,3                     ; @EAGAIN
l_.str.1:                               ; @.str.1
	.asciz	"Network write error: %s"

l_.str.2:                               ; @.str.2
	.asciz	"select: %s"

l_.str.3:                               ; @.str.3
	.asciz	"Network write timed out"

	.no_dead_strip	_send_msg
.subsections_via_symbols
