	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ## -- Begin function main
	.p2align	4, 0x90
_main:                                  ## @main
	.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	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_PF_INET@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_SOCK_STREAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_socket
	movl	%eax, %r14d
	testl	%eax, %eax
	jns	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_2:
	leaq	-64(%rbp), %rbx
	movq	%rbx, %rdi
	movl	$24, %esi
	callq	_bzero
	movq	_AF_INET@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	%rax, -56(%rbp)
	movl	$24, -64(%rbp)
	movq	_INADDR_LOOPBACK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_htonl
	movl	%eax, -48(%rbp)
	movl	%r14d, %edi
	movq	%rbx, %rsi
	movl	$24, %edx
	callq	_bind
	testq	%rax, %rax
	jns	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_4:
	movl	%r14d, %edi
	movl	$-1, %esi
	callq	_listen
	testq	%rax, %rax
	jns	LBB0_6
## %bb.5:
	leaq	L_.str.2(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_6:
	leaq	-64(%rbp), %rbx
	movq	%rbx, %rdi
	movl	$24, %esi
	callq	_bzero
	movq	(%r15), %rax
	movq	%rax, -56(%rbp)
	movl	$24, -64(%rbp)
	movl	$24, -36(%rbp)
	leaq	-36(%rbp), %rdx
	movl	%r14d, %edi
	movq	%rbx, %rsi
	callq	_getsockname
	testq	%rax, %rax
	jns	LBB0_8
## %bb.7:
	leaq	L_.str.3(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_8:
	movl	-60(%rbp), %r12d
	movl	%r12d, %edi
	callq	_ntohs
	leaq	L_.str.4(%rip), %rdi
	movl	%eax, %esi
	callq	_printf
	movq	_SIGCHLD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_SIG_IGN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_signal
	movq	_SIG_ERR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_10
## %bb.9:
	leaq	L_.str.5(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_10:
	xorl	%eax, %eax
	callq	_getpid
	movq	%rax, %r15
	xorl	%eax, %eax
	callq	_fork
	movq	%rax, %rbx
	testq	%rax, %rax
	js	LBB0_11
## %bb.13:
	jne	LBB0_12
## %bb.14:
	xorl	%eax, %eax
	callq	_getpid
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_tcp_server
	jmp	LBB0_15
LBB0_11:
	leaq	L_.str.6(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_12:
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_tcp_client
LBB0_15:
	xorl	%eax, %eax
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PF_INET,4,2                    ## @PF_INET
	.comm	_SOCK_STREAM,4,2                ## @SOCK_STREAM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"socket"

	.comm	_AF_INET,8,3                    ## @AF_INET
	.comm	_INADDR_LOOPBACK,4,2            ## @INADDR_LOOPBACK
L_.str.1:                               ## @.str.1
	.asciz	"bind"

L_.str.2:                               ## @.str.2
	.asciz	"listen"

L_.str.3:                               ## @.str.3
	.asciz	"getsockname"

L_.str.4:                               ## @.str.4
	.asciz	"Using port %d\n"

	.comm	_SIGCHLD,4,2                    ## @SIGCHLD
	.comm	_SIG_IGN,4,2                    ## @SIG_IGN
	.comm	_SIG_ERR,8,3                    ## @SIG_ERR
L_.str.5:                               ## @.str.5
	.asciz	"signal"

L_.str.6:                               ## @.str.6
	.asciz	"fork"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
Lloh0:
	adrp	x8, _PF_INET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PF_INET@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _SOCK_STREAM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SOCK_STREAM@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_socket
	mov	x19, x0
	tbz	w0, #31, LBB0_2
; %bb.1:
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_2:
	mov	w21, #24
	add	x0, sp, #8
	mov	w1, #24
	bl	_bzero
Lloh8:
	adrp	x20, _AF_INET@GOTPAGE
Lloh9:
	ldr	x20, [x20, _AF_INET@GOTPAGEOFF]
	ldr	x8, [x20]
	str	x8, [sp, #16]
	str	w21, [sp, #8]
Lloh10:
	adrp	x8, _INADDR_LOOPBACK@GOTPAGE
Lloh11:
	ldr	x8, [x8, _INADDR_LOOPBACK@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	bl	_htonl
	str	w0, [sp, #24]
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #24
	bl	_bind
	tbz	x0, #63, LBB0_4
; %bb.3:
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_4:
	mov	x0, x19
	mov	w1, #-1
	bl	_listen
	tbz	x0, #63, LBB0_6
; %bb.5:
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_6:
	mov	w21, #24
	add	x0, sp, #8
	mov	w1, #24
	bl	_bzero
	ldr	x8, [x20]
	str	x8, [sp, #16]
	stp	w21, w21, [sp, #4]
	add	x1, sp, #8
	add	x2, sp, #4
	mov	x0, x19
	bl	_getsockname
	tbz	x0, #63, LBB0_8
; %bb.7:
Lloh17:
	adrp	x1, l_.str.3@PAGE
Lloh18:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_8:
	ldr	w20, [sp, #12]
	mov	x0, x20
	bl	_ntohs
	mov	x1, x0
Lloh19:
	adrp	x0, l_.str.4@PAGE
Lloh20:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_printf
Lloh21:
	adrp	x8, _SIGCHLD@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SIGCHLD@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
Lloh24:
	adrp	x8, _SIG_IGN@GOTPAGE
Lloh25:
	ldr	x8, [x8, _SIG_IGN@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	bl	_signal
Lloh27:
	adrp	x8, _SIG_ERR@GOTPAGE
Lloh28:
	ldr	x8, [x8, _SIG_ERR@GOTPAGEOFF]
Lloh29:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_10
; %bb.9:
Lloh30:
	adrp	x1, l_.str.5@PAGE
Lloh31:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_10:
	bl	_getpid
	mov	x22, x0
	bl	_fork
	mov	x21, x0
	tbnz	x0, #63, LBB0_13
; %bb.11:
	cbnz	x21, LBB0_14
; %bb.12:
	bl	_getpid
	mov	x0, x22
	mov	x1, x19
	bl	_tcp_server
	b	LBB0_15
LBB0_13:
Lloh32:
	adrp	x1, l_.str.6@PAGE
Lloh33:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_14:
	mov	x0, x21
	mov	x1, x20
	bl	_tcp_client
LBB0_15:
	mov	w0, #0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_PF_INET,4,2                    ; @PF_INET
	.comm	_SOCK_STREAM,4,2                ; @SOCK_STREAM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"socket"

	.comm	_AF_INET,8,3                    ; @AF_INET
	.comm	_INADDR_LOOPBACK,4,2            ; @INADDR_LOOPBACK
l_.str.1:                               ; @.str.1
	.asciz	"bind"

l_.str.2:                               ; @.str.2
	.asciz	"listen"

l_.str.3:                               ; @.str.3
	.asciz	"getsockname"

l_.str.4:                               ; @.str.4
	.asciz	"Using port %d\n"

	.comm	_SIGCHLD,4,2                    ; @SIGCHLD
	.comm	_SIG_IGN,4,2                    ; @SIG_IGN
	.comm	_SIG_ERR,8,3                    ; @SIG_ERR
l_.str.5:                               ; @.str.5
	.asciz	"signal"

l_.str.6:                               ; @.str.6
	.asciz	"fork"

.subsections_via_symbols
