	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tcp_connect                    ## -- Begin function tcp_connect
	.p2align	4, 0x90
_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	%rdi, %rbx
	callq	_gethostbyname
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	-56(%rbp), %rdi
	movl	(%rax), %esi
	movl	$4, %edx
	callq	_memcpy
	jmp	LBB0_4
LBB0_2:
	movq	%rbx, %rdi
	callq	_inet_addr
	movl	%eax, -56(%rbp)
	movq	_INADDR_NONE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	jmp	LBB0_13
LBB0_4:
	movq	_AF_INET@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movq	_SOCK_STREAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_socket
	movq	_g_sock@GOTPCREL(%rip), %r13
	movl	%eax, (%r13)
	testl	%eax, %eax
	js	LBB0_12
## %bb.5:
	movl	(%rbx), %eax
	movl	%eax, -60(%rbp)
	movq	_g_tcp_port_rdp@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_htons
	movl	%eax, -64(%rbp)
	movl	(%r13), %edi
	leaq	-64(%rbp), %rsi
	movl	$4, %edx
	callq	_connect
	testq	%rax, %rax
	js	LBB0_14
## %bb.6:
	movl	$1, -44(%rbp)
	movl	$4, -48(%rbp)
	movl	(%r13), %edi
	movq	_IPPROTO_TCP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_TCP_NODELAY@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-44(%rbp), %r14
	movq	%r14, %rcx
	movl	$4, %r8d
	callq	_setsockopt
	movl	(%r13), %edi
	movq	_SOL_SOCKET@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_SO_RCVBUF@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	leaq	-48(%rbp), %r8
	movq	%r14, %rcx
	callq	_getsockopt
	testq	%rax, %rax
	jne	LBB0_9
## %bb.7:
	cmpl	$16383, -44(%rbp)               ## imm = 0x3FFF
	jg	LBB0_9
## %bb.8:
	movl	$16384, -44(%rbp)               ## imm = 0x4000
	movl	$4, -48(%rbp)
	movl	(%r13), %edi
	movl	(%r15), %esi
	movl	(%r12), %edx
	leaq	-44(%rbp), %rcx
	movl	$4, %r8d
	callq	_setsockopt
LBB0_9:
	movq	_g_in@GOTPCREL(%rip), %rbx
	movl	$4096, (%rbx)                   ## imm = 0x1000
	movl	$4096, %edi                     ## imm = 0x1000
	callq	_xmalloc
	movq	%rax, 8(%rbx)
	movq	_STREAM_COUNT@GOTPCREL(%rip), %r15
	movq	_True@GOTPCREL(%rip), %r14
	cmpl	$0, (%r15)
	jle	LBB0_18
## %bb.10:
	xorl	%ebx, %ebx
	movq	_g_out@GOTPCREL(%rip), %r12
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rax
	movl	$4096, (%rax,%rbx)              ## imm = 0x1000
	movl	$4096, %edi                     ## imm = 0x1000
	callq	_xmalloc
	movq	(%r12), %rcx
	movq	%rax, 8(%rcx,%rbx)
	incq	%r13
	movslq	(%r15), %rax
	addq	$16, %rbx
	cmpq	%rax, %r13
	jl	LBB0_11
	jmp	LBB0_18
LBB0_12:
	movq	_TCP_STRERROR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	leaq	L_.str.1(%rip), %rdi
LBB0_13:
	callq	_error
	jmp	LBB0_17
LBB0_14:
	movq	_g_reconnect_loop@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jne	LBB0_16
## %bb.15:
	movq	_TCP_STRERROR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	leaq	L_.str.2(%rip), %rdi
	callq	_error
LBB0_16:
	movl	(%r13), %edi
	callq	_TCP_CLOSE
	movl	$-1, (%r13)
LBB0_17:
	movq	_False@GOTPCREL(%rip), %r14
LBB0_18:
	movl	(%r14), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_INADDR_NONE,4,2                ## @INADDR_NONE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: unable to resolve host\n"

	.comm	_False,4,2                      ## @False
	.comm	_AF_INET,4,2                    ## @AF_INET
	.comm	_SOCK_STREAM,4,2                ## @SOCK_STREAM
	.comm	_g_sock,4,2                     ## @g_sock
L_.str.1:                               ## @.str.1
	.asciz	"socket: %s\n"

	.comm	_TCP_STRERROR,8,3               ## @TCP_STRERROR
	.comm	_g_tcp_port_rdp,4,2             ## @g_tcp_port_rdp
	.comm	_g_reconnect_loop,4,2           ## @g_reconnect_loop
L_.str.2:                               ## @.str.2
	.asciz	"connect: %s\n"

	.comm	_IPPROTO_TCP,4,2                ## @IPPROTO_TCP
	.comm	_TCP_NODELAY,4,2                ## @TCP_NODELAY
	.comm	_SOL_SOCKET,4,2                 ## @SOL_SOCKET
	.comm	_SO_RCVBUF,4,2                  ## @SO_RCVBUF
	.comm	_g_in,16,3                      ## @g_in
	.comm	_STREAM_COUNT,4,2               ## @STREAM_COUNT
	.comm	_g_out,8,3                      ## @g_out
	.comm	_True,4,2                       ## @True
	.comm	_AF_UNSPEC,4,2                  ## @AF_UNSPEC
	.comm	_g_ssl_server,8,3               ## @g_ssl_server
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tcp_connect                    ; -- Begin function tcp_connect
	.p2align	2
_tcp_connect:                           ; @tcp_connect
	.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
	bl	_gethostbyname
	cbz	x0, LBB0_2
; %bb.1:
	add	x8, sp, #8
	add	x8, x8, #8
	ldr	w1, [x0]
	mov	x0, x8
	mov	w2, #4
	bl	_memcpy
	b	LBB0_4
LBB0_2:
	mov	x0, x19
	bl	_inet_addr
	str	w0, [sp, #16]
Lloh0:
	adrp	x8, _INADDR_NONE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _INADDR_NONE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_4
; %bb.3:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	b	LBB0_13
LBB0_4:
Lloh5:
	adrp	x20, _AF_INET@GOTPAGE
Lloh6:
	ldr	x20, [x20, _AF_INET@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh7:
	adrp	x8, _SOCK_STREAM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SOCK_STREAM@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_socket
Lloh10:
	adrp	x19, _g_sock@GOTPAGE
Lloh11:
	ldr	x19, [x19, _g_sock@GOTPAGEOFF]
	str	w0, [x19]
	tbnz	w0, #31, LBB0_12
; %bb.5:
	ldr	w8, [x20]
	str	w8, [sp, #12]
Lloh12:
	adrp	x8, _g_tcp_port_rdp@GOTPAGE
Lloh13:
	ldr	x8, [x8, _g_tcp_port_rdp@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	bl	_htons
	str	w0, [sp, #8]
	ldr	w0, [x19]
	mov	w20, #4
	add	x1, sp, #8
	mov	w2, #4
	bl	_connect
	tbnz	x0, #63, LBB0_14
; %bb.6:
	mov	w8, #1
	stp	w8, w20, [sp, #24]
	ldr	w0, [x19]
Lloh15:
	adrp	x8, _IPPROTO_TCP@GOTPAGE
Lloh16:
	ldr	x8, [x8, _IPPROTO_TCP@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	adrp	x8, _TCP_NODELAY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _TCP_NODELAY@GOTPAGEOFF]
Lloh20:
	ldr	w2, [x8]
	add	x3, sp, #24
	mov	w4, #4
	bl	_setsockopt
	ldr	w0, [x19]
Lloh21:
	adrp	x20, _SOL_SOCKET@GOTPAGE
Lloh22:
	ldr	x20, [x20, _SOL_SOCKET@GOTPAGEOFF]
	ldr	w1, [x20]
Lloh23:
	adrp	x21, _SO_RCVBUF@GOTPAGE
Lloh24:
	ldr	x21, [x21, _SO_RCVBUF@GOTPAGEOFF]
	ldr	w2, [x21]
	add	x3, sp, #24
	add	x4, sp, #28
	bl	_getsockopt
	cbnz	x0, LBB0_9
; %bb.7:
	ldr	w8, [sp, #24]
	cmp	w8, #4, lsl #12                 ; =16384
	b.ge	LBB0_9
; %bb.8:
	mov	w9, #16384
	mov	w8, #4
	stp	w9, w8, [sp, #24]
	ldr	w0, [x19]
	ldr	w1, [x20]
	ldr	w2, [x21]
	add	x3, sp, #24
	mov	w4, #4
	bl	_setsockopt
LBB0_9:
Lloh25:
	adrp	x19, _g_in@GOTPAGE
Lloh26:
	ldr	x19, [x19, _g_in@GOTPAGEOFF]
	mov	w20, #4096
	str	w20, [x19]
	mov	w0, #4096
	bl	_xmalloc
	str	x0, [x19, #8]
Lloh27:
	adrp	x21, _STREAM_COUNT@GOTPAGE
Lloh28:
	ldr	x21, [x21, _STREAM_COUNT@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w8, #1
	b.lt	LBB0_19
; %bb.10:
	mov	x22, #0
	mov	x23, #0
Lloh29:
	adrp	x24, _g_out@GOTPAGE
Lloh30:
	ldr	x24, [x24, _g_out@GOTPAGEOFF]
Lloh31:
	adrp	x19, _True@GOTPAGE
Lloh32:
	ldr	x19, [x19, _True@GOTPAGEOFF]
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x24]
	str	w20, [x8, x22]
	mov	w0, #4096
	bl	_xmalloc
	ldr	x8, [x24]
	add	x8, x8, x22
	str	x0, [x8, #8]
	add	x23, x23, #1
	ldrsw	x8, [x21]
	add	x22, x22, #16
	cmp	x23, x8
	b.lt	LBB0_11
	b	LBB0_18
LBB0_12:
Lloh33:
	adrp	x8, _TCP_STRERROR@GOTPAGE
Lloh34:
	ldr	x8, [x8, _TCP_STRERROR@GOTPAGEOFF]
Lloh35:
	ldr	x1, [x8]
Lloh36:
	adrp	x0, l_.str.1@PAGE
Lloh37:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_13:
	bl	_error
	b	LBB0_17
LBB0_14:
Lloh38:
	adrp	x8, _g_reconnect_loop@GOTPAGE
Lloh39:
	ldr	x8, [x8, _g_reconnect_loop@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	cbnz	w8, LBB0_16
; %bb.15:
Lloh41:
	adrp	x8, _TCP_STRERROR@GOTPAGE
Lloh42:
	ldr	x8, [x8, _TCP_STRERROR@GOTPAGEOFF]
Lloh43:
	ldr	x1, [x8]
Lloh44:
	adrp	x0, l_.str.2@PAGE
Lloh45:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_error
LBB0_16:
	ldr	w0, [x19]
	bl	_TCP_CLOSE
	mov	w8, #-1
	str	w8, [x19]
LBB0_17:
Lloh46:
	adrp	x19, _False@GOTPAGE
Lloh47:
	ldr	x19, [x19, _False@GOTPAGEOFF]
LBB0_18:
	ldr	w0, [x19]
	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_19:
Lloh48:
	adrp	x19, _True@GOTPAGE
Lloh49:
	ldr	x19, [x19, _True@GOTPAGEOFF]
	b	LBB0_18
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGot	Lloh46, Lloh47
	.loh AdrpLdrGot	Lloh48, Lloh49
	.cfi_endproc
                                        ; -- End function
	.comm	_INADDR_NONE,4,2                ; @INADDR_NONE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: unable to resolve host\n"

	.comm	_False,4,2                      ; @False
	.comm	_AF_INET,4,2                    ; @AF_INET
	.comm	_SOCK_STREAM,4,2                ; @SOCK_STREAM
	.comm	_g_sock,4,2                     ; @g_sock
l_.str.1:                               ; @.str.1
	.asciz	"socket: %s\n"

	.comm	_TCP_STRERROR,8,3               ; @TCP_STRERROR
	.comm	_g_tcp_port_rdp,4,2             ; @g_tcp_port_rdp
	.comm	_g_reconnect_loop,4,2           ; @g_reconnect_loop
l_.str.2:                               ; @.str.2
	.asciz	"connect: %s\n"

	.comm	_IPPROTO_TCP,4,2                ; @IPPROTO_TCP
	.comm	_TCP_NODELAY,4,2                ; @TCP_NODELAY
	.comm	_SOL_SOCKET,4,2                 ; @SOL_SOCKET
	.comm	_SO_RCVBUF,4,2                  ; @SO_RCVBUF
	.comm	_g_in,16,3                      ; @g_in
	.comm	_STREAM_COUNT,4,2               ; @STREAM_COUNT
	.comm	_g_out,8,3                      ; @g_out
	.comm	_True,4,2                       ; @True
	.comm	_AF_UNSPEC,4,2                  ; @AF_UNSPEC
	.comm	_g_ssl_server,8,3               ; @g_ssl_server
.subsections_via_symbols
