	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tcp_connect
_tcp_connect:                           ## @tcp_connect
	.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	%rcx, %r14
	movl	%edx, %r15d
	movq	%rsi, %rbx
	movq	%rdi, %r13
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	xorl	%edi, %edi
	cmpb	$0, (%r13)
	setne	%dil
	jmp	LBB0_3
LBB0_1:
	movl	$1, %edi
LBB0_3:
	callq	_PJDLOG_ASSERT
	xorl	%edi, %edi
	testq	%rbx, %rbx
	setne	%dil
	callq	_PJDLOG_ASSERT
	xorl	%edi, %edi
	cmpl	$-1, %r15d
	setge	%dil
	callq	_PJDLOG_ASSERT
	movq	_TCP_SIDE_CLIENT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_tcp_setup_new
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_23
## %bb.4:
	testq	%r13, %r13
	je	LBB0_8
## %bb.5:
	leaq	-56(%rbp), %rdx
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_tcp_addr
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_22
## %bb.6:
	movq	-48(%rbp), %rax
	movl	(%rax), %ebx
	leaq	-56(%rbp), %r12
	movq	%r12, %rdi
	callq	_sockaddr_len
	movl	%ebx, %edi
	movq	%r12, %rsi
	movl	%eax, %edx
	callq	_bind
	cmpl	$-1, %eax
	je	LBB0_7
LBB0_8:
	movq	-48(%rbp), %rax
	movl	(%rax), %edi
	movq	_F_GETFL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%eax, %eax
	callq	_fcntl
	cmpl	$-1, %eax
	je	LBB0_9
## %bb.10:
	movl	%eax, %r12d
	movq	_O_NONBLOCK@GOTPCREL(%rip), %rax
	orl	(%rax), %r12d
	movq	-48(%rbp), %rax
	movl	(%rax), %edi
	movq	_F_SETFL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_fcntl
	cmpl	$-1, %eax
	je	LBB0_11
## %bb.12:
	movq	-48(%rbp), %rbx
	movl	(%rbx), %r13d
	addq	$4, %rbx
	movq	%rbx, %rdi
	callq	_sockaddr_len
	movl	%r13d, %edi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_connect
	cmpl	$-1, %eax
	je	LBB0_13
## %bb.16:
	testl	%r15d, %r15d
	js	LBB0_20
## %bb.17:
	movq	_O_NONBLOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	%eax, %r12d
	movq	-48(%rbp), %rax
	movl	(%rax), %edi
	movq	_F_SETFL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_fcntl
	cmpl	$-1, %eax
	jne	LBB0_20
## %bb.18:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rcx
	jmp	LBB0_15
LBB0_9:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rcx
	jmp	LBB0_15
LBB0_11:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rcx
	jmp	LBB0_15
LBB0_7:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	jmp	LBB0_22
LBB0_13:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_EINPROGRESS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_14
## %bb.19:
	testl	%r15d, %r15d
	js	LBB0_20
## %bb.21:
	movq	-48(%rbp), %rdi
	movl	%r15d, %esi
	callq	_tcp_connect_wait
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_22
LBB0_20:
	movq	-48(%rbp), %rax
	movq	%rax, (%r14)
	xorl	%r12d, %r12d
	jmp	LBB0_23
LBB0_14:
	movq	_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rcx
LBB0_15:
	movl	$1, %esi
	movl	%r12d, %edx
	callq	_pjdlog_common
LBB0_22:
	movq	-48(%rbp), %rdi
	callq	_tcp_close
LBB0_23:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TCP_SIDE_CLIENT,4,2            ## @TCP_SIDE_CLIENT
	.comm	_errno,4,2                      ## @errno
	.comm	_F_GETFL,4,2                    ## @F_GETFL
	.comm	_LOG_DEBUG,4,2                  ## @LOG_DEBUG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"fcntl(F_GETFL) failed"

	.comm	_O_NONBLOCK,4,2                 ## @O_NONBLOCK
	.comm	_F_SETFL,4,2                    ## @F_SETFL
L_.str.1:                               ## @.str.1
	.asciz	"fcntl(F_SETFL, O_NONBLOCK) failed"

	.comm	_EINPROGRESS,4,2                ## @EINPROGRESS
L_.str.2:                               ## @.str.2
	.asciz	"connect() failed"

L_.str.3:                               ## @.str.3
	.asciz	"fcntl(F_SETFL, ~O_NONBLOCK) failed"

	.no_dead_strip	_tcp_connect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tcp_connect
_tcp_connect:                           ; @tcp_connect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x3
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
	cbz	x0, LBB0_2
; %bb.1:
	ldrb	w8, [x22]
	cmp	w8, #0
	cset	w0, ne
	b	LBB0_3
LBB0_2:
	mov	w0, #1
LBB0_3:
	bl	_PJDLOG_ASSERT
	cmp	x21, #0
	cset	w0, ne
	bl	_PJDLOG_ASSERT
	cmn	w20, #2
	cset	w0, gt
	bl	_PJDLOG_ASSERT
Lloh0:
	adrp	x8, _TCP_SIDE_CLIENT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TCP_SIDE_CLIENT@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #24
	mov	x0, x21
	bl	_tcp_setup_new
	mov	x21, x0
	cbnz	w0, LBB0_23
; %bb.4:
	cbz	x22, LBB0_7
; %bb.5:
	add	x2, sp, #16
	mov	x0, x22
	mov	w1, #0
	bl	_tcp_addr
	mov	x21, x0
	cbnz	w0, LBB0_22
; %bb.6:
	ldr	x8, [sp, #24]
	ldr	w21, [x8]
	add	x0, sp, #16
	bl	_sockaddr_len
	mov	x2, x0
	add	x1, sp, #16
	mov	x0, x21
	bl	_bind
	cmn	w0, #1
	b.eq	LBB0_15
LBB0_7:
	ldr	x8, [sp, #24]
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _F_GETFL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _F_GETFL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_fcntl
	cmn	w0, #1
	b.eq	LBB0_13
; %bb.8:
Lloh6:
	adrp	x23, _O_NONBLOCK@GOTPAGE
Lloh7:
	ldr	x23, [x23, _O_NONBLOCK@GOTPAGEOFF]
	ldr	w8, [x23]
	orr	w25, w8, w0
	ldr	x8, [sp, #24]
	ldr	w0, [x8]
Lloh8:
	adrp	x24, _F_SETFL@GOTPAGE
Lloh9:
	ldr	x24, [x24, _F_SETFL@GOTPAGEOFF]
	ldr	w1, [x24]
	str	x25, [sp]
	bl	_fcntl
	cmn	w0, #1
	b.eq	LBB0_14
; %bb.9:
	ldr	x21, [sp, #24]
	ldr	w22, [x21], #4
	mov	x0, x21
	bl	_sockaddr_len
	mov	x2, x0
	mov	x0, x22
	mov	x1, x21
	bl	_connect
	cmn	w0, #1
	b.eq	LBB0_16
; %bb.10:
	tbnz	w20, #31, LBB0_19
; %bb.11:
	ldr	w8, [x23]
	bic	w8, w25, w8
	ldr	x9, [sp, #24]
	ldr	w0, [x9]
	ldr	w1, [x24]
	str	x8, [sp]
	bl	_fcntl
	cmn	w0, #1
	b.ne	LBB0_19
; %bb.12:
Lloh10:
	adrp	x8, _errno@GOTPAGE
Lloh11:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh12:
	ldr	w21, [x8]
Lloh13:
	adrp	x8, _LOG_DEBUG@GOTPAGE
Lloh14:
	ldr	x8, [x8, _LOG_DEBUG@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
Lloh16:
	adrp	x3, l_.str.3@PAGE
Lloh17:
	add	x3, x3, l_.str.3@PAGEOFF
	b	LBB0_21
LBB0_13:
Lloh18:
	adrp	x8, _errno@GOTPAGE
Lloh19:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh20:
	ldr	w21, [x8]
Lloh21:
	adrp	x8, _LOG_DEBUG@GOTPAGE
Lloh22:
	ldr	x8, [x8, _LOG_DEBUG@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
Lloh24:
	adrp	x3, l_.str@PAGE
Lloh25:
	add	x3, x3, l_.str@PAGEOFF
	b	LBB0_21
LBB0_14:
Lloh26:
	adrp	x8, _errno@GOTPAGE
Lloh27:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh28:
	ldr	w21, [x8]
Lloh29:
	adrp	x8, _LOG_DEBUG@GOTPAGE
Lloh30:
	ldr	x8, [x8, _LOG_DEBUG@GOTPAGEOFF]
Lloh31:
	ldr	w0, [x8]
Lloh32:
	adrp	x3, l_.str.1@PAGE
Lloh33:
	add	x3, x3, l_.str.1@PAGEOFF
	b	LBB0_21
LBB0_15:
Lloh34:
	adrp	x8, _errno@GOTPAGE
Lloh35:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh36:
	ldr	w21, [x8]
	b	LBB0_22
LBB0_16:
Lloh37:
	adrp	x8, _errno@GOTPAGE
Lloh38:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh39:
	ldr	w21, [x8]
Lloh40:
	adrp	x8, _EINPROGRESS@GOTPAGE
Lloh41:
	ldr	x8, [x8, _EINPROGRESS@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
	cmp	w21, w8
	b.ne	LBB0_20
; %bb.17:
	tbnz	w20, #31, LBB0_19
; %bb.18:
	ldr	x0, [sp, #24]
	mov	x1, x20
	bl	_tcp_connect_wait
	mov	x21, x0
	cbnz	w0, LBB0_22
LBB0_19:
	mov	w21, #0
	ldr	x8, [sp, #24]
	str	x8, [x19]
	b	LBB0_23
LBB0_20:
Lloh43:
	adrp	x8, _LOG_DEBUG@GOTPAGE
Lloh44:
	ldr	x8, [x8, _LOG_DEBUG@GOTPAGEOFF]
Lloh45:
	ldr	w0, [x8]
Lloh46:
	adrp	x3, l_.str.2@PAGE
Lloh47:
	add	x3, x3, l_.str.2@PAGEOFF
LBB0_21:
	mov	w1, #1
	mov	x2, x21
	bl	_pjdlog_common
LBB0_22:
	ldr	x0, [sp, #24]
	bl	_tcp_close
LBB0_23:
	mov	x0, x21
	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
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.cfi_endproc
                                        ; -- End function
	.comm	_TCP_SIDE_CLIENT,4,2            ; @TCP_SIDE_CLIENT
	.comm	_errno,4,2                      ; @errno
	.comm	_F_GETFL,4,2                    ; @F_GETFL
	.comm	_LOG_DEBUG,4,2                  ; @LOG_DEBUG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"fcntl(F_GETFL) failed"

	.comm	_O_NONBLOCK,4,2                 ; @O_NONBLOCK
	.comm	_F_SETFL,4,2                    ; @F_SETFL
l_.str.1:                               ; @.str.1
	.asciz	"fcntl(F_SETFL, O_NONBLOCK) failed"

	.comm	_EINPROGRESS,4,2                ; @EINPROGRESS
l_.str.2:                               ; @.str.2
	.asciz	"connect() failed"

l_.str.3:                               ; @.str.3
	.asciz	"fcntl(F_SETFL, ~O_NONBLOCK) failed"

	.no_dead_strip	_tcp_connect
.subsections_via_symbols
