	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function setup_tcp
_setup_tcp:                             ## @setup_tcp
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	leaq	-56(%rbp), %rdi
	movl	$16, %esi
	callq	_bzero
	movl	$16, -56(%rbp)
	movq	_AF_INET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	movq	_INADDR_LOOPBACK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_htonl
	movl	%eax, -52(%rbp)
	movl	%ebx, %edi
	callq	_htons
	movl	%eax, -48(%rbp)
	movq	_PF_INET@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	movq	_SOCK_STREAM@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	xorl	%edx, %edx
	callq	_socket
	movl	%eax, %r13d
	testl	%eax, %eax
	jns	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_2:
	leaq	-56(%rbp), %rsi
	movl	%r13d, %edi
	movl	$16, %edx
	callq	_bind
	testq	%rax, %rax
	jns	LBB0_4
## %bb.3:
	movl	-52(%rbp), %edi
	callq	_inet_ntoa
	movq	_PORT1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_err
LBB0_4:
	movl	%r13d, %edi
	movl	$-1, %esi
	callq	_listen
	testq	%rax, %rax
	jns	LBB0_6
## %bb.5:
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_6:
	movl	(%r14), %edi
	movl	(%rbx), %esi
	xorl	%edx, %edx
	callq	_socket
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_8
## %bb.7:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_8:
	movq	_F_SETFL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_O_NONBLOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%ebx, %edi
	callq	_fcntl
	testq	%rax, %rax
	jns	LBB0_10
## %bb.9:
	leaq	L_.str.3(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_10:
	leaq	-56(%rbp), %rsi
	movl	%ebx, %edi
	movl	$16, %edx
	callq	_connect
	testq	%rax, %rax
	jns	LBB0_13
## %bb.11:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_EINPROGRESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_13
## %bb.12:
	movl	-52(%rbp), %edi
	callq	_inet_ntoa
	movq	_PORT1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	leaq	L_.str.4(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_err
LBB0_13:
	movl	$1, %edi
	callq	_sleep
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	leaq	L_.str.5(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_15:
	movl	%r13d, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_accept
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	jns	LBB0_17
## %bb.16:
	leaq	L_.str.6(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_17:
	movl	$1, %edi
	callq	_sleep
	testq	%rax, %rax
	je	LBB0_19
## %bb.18:
	leaq	L_.str.5(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_19:
	leaq	-68(%rbp), %r12
	movq	%r12, %rdi
	callq	_FD_ZERO
	movl	%ebx, %edi
	movq	%r12, %rsi
	callq	_FD_SET
	movq	%r15, %r14
	leaq	-64(%rbp), %r15
	movq	%r15, %rdi
	callq	_FD_ZERO
	movl	%ebx, %edi
	movq	%r15, %rsi
	callq	_FD_SET
	movl	$1, -96(%rbp)
	movq	$0, -88(%rbp)
	movl	%ebx, %edi
	incl	%edi
	leaq	-96(%rbp), %r8
	xorl	%esi, %esi
	movq	%r12, %rdx
	movq	%r15, %rcx
	callq	_select
	testl	%eax, %eax
	jns	LBB0_21
## %bb.20:
	leaq	L_.str.7(%rip), %rsi
	movl	$1, %edi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_21:
	leaq	-64(%rbp), %rsi
	movl	%ebx, %edi
	callq	_FD_ISSET
	testq	%rax, %rax
	je	LBB0_23
## %bb.22:
	leaq	L_.str.8(%rip), %rsi
	movl	$1, %edi
	movq	%r14, %rdx
	callq	_errx
LBB0_23:
	leaq	-68(%rbp), %rsi
	movl	%ebx, %edi
	callq	_FD_ISSET
	testq	%rax, %rax
	jne	LBB0_25
## %bb.24:
	leaq	L_.str.9(%rip), %rsi
	movl	$1, %edi
	movq	%r14, %rdx
	callq	_errx
LBB0_25:
	movl	%r13d, %edi
	callq	_close
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	%ebx, (%rax)
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, 4(%rax)
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AF_INET,4,2                    ## @AF_INET
	.comm	_INADDR_LOOPBACK,4,2            ## @INADDR_LOOPBACK
	.comm	_PF_INET,4,2                    ## @PF_INET
	.comm	_SOCK_STREAM,4,2                ## @SOCK_STREAM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: setup_tcp: socket"

L_.str.1:                               ## @.str.1
	.asciz	"%s: bind(%s, %d)"

	.comm	_PORT1,4,2                      ## @PORT1
L_.str.2:                               ## @.str.2
	.asciz	"%s: listen"

	.comm	_F_SETFL,4,2                    ## @F_SETFL
	.comm	_O_NONBLOCK,4,2                 ## @O_NONBLOCK
L_.str.3:                               ## @.str.3
	.asciz	"%s: setup_tcp: fcntl(O_NONBLOCK)"

	.comm	_errno,8,3                      ## @errno
	.comm	_EINPROGRESS,8,3                ## @EINPROGRESS
L_.str.4:                               ## @.str.4
	.asciz	"%s: setup_tcp: connect(%s, %d)"

L_.str.5:                               ## @.str.5
	.asciz	"%s: sleep(1)"

L_.str.6:                               ## @.str.6
	.asciz	"%s: accept"

L_.str.7:                               ## @.str.7
	.asciz	"%s: setup_tcp: select"

L_.str.8:                               ## @.str.8
	.asciz	"%s: setup_tcp: select: exception"

L_.str.9:                               ## @.str.9
	.asciz	"%s: setup_tcp: select: not writable"

	.no_dead_strip	_setup_tcp
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function setup_tcp
_setup_tcp:                             ; @setup_tcp
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x21, x2
	mov	x19, x1
	mov	x20, x0
	mov	w22, #16
	add	x0, sp, #40
	mov	w1, #16
	bl	_bzero
Lloh0:
	adrp	x8, _AF_INET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AF_INET@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w22, [sp, #40]
	str	w8, [sp, #52]
Lloh3:
	adrp	x8, _INADDR_LOOPBACK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _INADDR_LOOPBACK@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_htonl
	str	w0, [sp, #44]
	mov	x0, x21
	bl	_htons
	str	w0, [sp, #48]
Lloh6:
	adrp	x22, _PF_INET@GOTPAGE
Lloh7:
	ldr	x22, [x22, _PF_INET@GOTPAGEOFF]
	ldr	w0, [x22]
Lloh8:
	adrp	x23, _SOCK_STREAM@GOTPAGE
Lloh9:
	ldr	x23, [x23, _SOCK_STREAM@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	w2, #0
	bl	_socket
	mov	x21, x0
	tbz	w0, #31, LBB0_2
; %bb.1:
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_2:
	add	x1, sp, #40
	mov	x0, x21
	mov	w2, #16
	bl	_bind
	tbz	x0, #63, LBB0_4
; %bb.3:
	ldr	w0, [sp, #44]
	bl	_inet_ntoa
                                        ; kill: def $w0 killed $w0 def $x0
Lloh12:
	adrp	x8, _PORT1@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PORT1@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	stp	x0, x8, [sp]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_4:
	mov	x0, x21
	mov	w1, #-1
	bl	_listen
	tbz	x0, #63, LBB0_6
; %bb.5:
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_6:
	ldr	w0, [x22]
	ldr	w1, [x23]
	mov	w2, #0
	bl	_socket
	mov	x22, x0
	tbz	w0, #31, LBB0_8
; %bb.7:
Lloh19:
	adrp	x1, l_.str@PAGE
Lloh20:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_8:
Lloh21:
	adrp	x8, _F_SETFL@GOTPAGE
Lloh22:
	ldr	x8, [x8, _F_SETFL@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
Lloh24:
	adrp	x8, _O_NONBLOCK@GOTPAGE
Lloh25:
	ldr	x8, [x8, _O_NONBLOCK@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_fcntl
	tbz	x0, #63, LBB0_10
; %bb.9:
Lloh27:
	adrp	x1, l_.str.3@PAGE
Lloh28:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_10:
	add	x1, sp, #40
	mov	x0, x22
	mov	w2, #16
	bl	_connect
	tbz	x0, #63, LBB0_13
; %bb.11:
Lloh29:
	adrp	x8, _errno@GOTPAGE
Lloh30:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh31:
	ldr	x8, [x8]
Lloh32:
	adrp	x9, _EINPROGRESS@GOTPAGE
Lloh33:
	ldr	x9, [x9, _EINPROGRESS@GOTPAGEOFF]
Lloh34:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_13
; %bb.12:
	ldr	w0, [sp, #44]
	bl	_inet_ntoa
                                        ; kill: def $w0 killed $w0 def $x0
Lloh35:
	adrp	x8, _PORT1@GOTPAGE
Lloh36:
	ldr	x8, [x8, _PORT1@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	stp	x0, x8, [sp]
Lloh38:
	adrp	x1, l_.str.4@PAGE
Lloh39:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_13:
	mov	w0, #1
	bl	_sleep
	cbz	x0, LBB0_15
; %bb.14:
Lloh40:
	adrp	x1, l_.str.5@PAGE
Lloh41:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_15:
	mov	x0, x21
	mov	x1, #0
	mov	x2, #0
	bl	_accept
	mov	x23, x0
	tbz	w0, #31, LBB0_17
; %bb.16:
Lloh42:
	adrp	x1, l_.str.6@PAGE
Lloh43:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_17:
	mov	w24, #1
	mov	w0, #1
	bl	_sleep
	cbz	x0, LBB0_19
; %bb.18:
Lloh44:
	adrp	x1, l_.str.5@PAGE
Lloh45:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_19:
	sub	x0, x29, #52
	bl	_FD_ZERO
	sub	x1, x29, #52
	mov	x0, x22
	bl	_FD_SET
	add	x0, sp, #56
	bl	_FD_ZERO
	add	x1, sp, #56
	mov	x0, x22
	bl	_FD_SET
	str	w24, [sp, #24]
	str	xzr, [sp, #32]
	add	w0, w22, #1
	sub	x2, x29, #52
	add	x3, sp, #56
	add	x4, sp, #24
	mov	x1, #0
	bl	_select
	tbz	w0, #31, LBB0_21
; %bb.20:
Lloh46:
	adrp	x1, l_.str.7@PAGE
Lloh47:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_err
LBB0_21:
	add	x1, sp, #56
	mov	x0, x22
	bl	_FD_ISSET
	cbz	x0, LBB0_23
; %bb.22:
Lloh48:
	adrp	x1, l_.str.8@PAGE
Lloh49:
	add	x1, x1, l_.str.8@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_errx
LBB0_23:
	sub	x1, x29, #52
	mov	x0, x22
	bl	_FD_ISSET
	cbnz	x0, LBB0_25
; %bb.24:
Lloh50:
	adrp	x1, l_.str.9@PAGE
Lloh51:
	add	x1, x1, l_.str.9@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	bl	_errx
LBB0_25:
	mov	x0, x21
	bl	_close
	stp	w22, w23, [x19]
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpAdd	Lloh44, Lloh45
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpAdd	Lloh50, Lloh51
	.cfi_endproc
                                        ; -- End function
	.comm	_AF_INET,4,2                    ; @AF_INET
	.comm	_INADDR_LOOPBACK,4,2            ; @INADDR_LOOPBACK
	.comm	_PF_INET,4,2                    ; @PF_INET
	.comm	_SOCK_STREAM,4,2                ; @SOCK_STREAM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: setup_tcp: socket"

l_.str.1:                               ; @.str.1
	.asciz	"%s: bind(%s, %d)"

	.comm	_PORT1,4,2                      ; @PORT1
l_.str.2:                               ; @.str.2
	.asciz	"%s: listen"

	.comm	_F_SETFL,4,2                    ; @F_SETFL
	.comm	_O_NONBLOCK,4,2                 ; @O_NONBLOCK
l_.str.3:                               ; @.str.3
	.asciz	"%s: setup_tcp: fcntl(O_NONBLOCK)"

	.comm	_errno,8,3                      ; @errno
	.comm	_EINPROGRESS,8,3                ; @EINPROGRESS
l_.str.4:                               ; @.str.4
	.asciz	"%s: setup_tcp: connect(%s, %d)"

l_.str.5:                               ; @.str.5
	.asciz	"%s: sleep(1)"

l_.str.6:                               ; @.str.6
	.asciz	"%s: accept"

l_.str.7:                               ; @.str.7
	.asciz	"%s: setup_tcp: select"

l_.str.8:                               ; @.str.8
	.asciz	"%s: setup_tcp: select: exception"

l_.str.9:                               ; @.str.9
	.asciz	"%s: setup_tcp: select: not writable"

	.no_dead_strip	_setup_tcp
.subsections_via_symbols
