	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$1080, %rsp                     ## imm = 0x438
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_AF_INET@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	movq	_SOCK_STREAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_socket
	testl	%eax, %eax
	js	LBB0_1
## %bb.4:
	movl	%eax, %ebx
	movl	(%r14), %eax
	movl	%eax, -1092(%rbp)
	movq	_INADDR_ANY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -1096(%rbp)
	movq	$0, -1104(%rbp)
	leaq	-1104(%rbp), %rsi
	movl	%ebx, %edi
	movl	$16, %edx
	callq	_bind
	testq	%rax, %rax
	jne	LBB0_5
## %bb.6:
	movl	$16, -1088(%rbp)
	leaq	-1104(%rbp), %rsi
	leaq	-1088(%rbp), %rdx
	movl	%ebx, %edi
	callq	_getsockname
	testq	%rax, %rax
	jne	LBB0_7
## %bb.8:
	movq	-1104(%rbp), %rdi
	callq	_ntohs
	leaq	L_.str.3(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_printf
	movl	%ebx, %edi
	movl	$5, %esi
	callq	_listen
	movl	%ebx, %eax
	incl	%eax
	movl	%eax, -1084(%rbp)               ## 4-byte Spill
	leaq	-1108(%rbp), %r15
	leaq	-1072(%rbp), %r13
	leaq	L_.str.8(%rip), %r12
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_9 Depth=1
	leaq	L_.str.9(%rip), %rdi
	xorl	%eax, %eax
	callq	_printf
LBB0_22:                                ##   in Loop: Header=BB0_9 Depth=1
	movq	_TRUE@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_2
LBB0_9:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_13 Depth 2
	movq	%r15, %rdi
	callq	_FD_ZERO
	movl	%ebx, %edi
	movq	%r15, %rsi
	callq	_FD_SET
	movl	$5, -1080(%rbp)
	movl	-1084(%rbp), %edi               ## 4-byte Reload
	movq	%r15, %rsi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	leaq	-1080(%rbp), %r8
	callq	_select
	testq	%rax, %rax
	js	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%ebx, %edi
	movq	%r15, %rsi
	callq	_FD_ISSET
	testq	%rax, %rax
	je	LBB0_21
## %bb.12:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%ebx, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_accept
	movl	%eax, %r14d
	cmpl	$-1, %eax
	je	LBB0_18
	.p2align	4, 0x90
LBB0_13:                                ##   Parent Loop BB0_9 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r13, %rdi
	movl	$1024, %esi                     ## imm = 0x400
	callq	_bzero
	movl	%r14d, %edi
	movq	%r13, %rsi
	movl	$1024, %edx                     ## imm = 0x400
	callq	_read
	testl	%eax, %eax
	js	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_13 Depth=2
	testl	%eax, %eax
	je	LBB0_16
## %bb.17:                              ##   in Loop: Header=BB0_13 Depth=2
	movq	%r12, %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_printf
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_9 Depth=1
	leaq	L_.str.7(%rip), %rdi
	xorl	%eax, %eax
	callq	_printf
LBB0_20:                                ##   in Loop: Header=BB0_9 Depth=1
	movl	%r14d, %edi
	callq	_close
	jmp	LBB0_22
LBB0_14:                                ##   in Loop: Header=BB0_9 Depth=1
	leaq	L_.str.6(%rip), %rdi
	jmp	LBB0_19
LBB0_10:                                ##   in Loop: Header=BB0_9 Depth=1
	leaq	L_.str.4(%rip), %rdi
	callq	_perror
	jmp	LBB0_22
LBB0_18:                                ##   in Loop: Header=BB0_9 Depth=1
	leaq	L_.str.5(%rip), %rdi
LBB0_19:                                ##   in Loop: Header=BB0_9 Depth=1
	callq	_perror
	jmp	LBB0_20
LBB0_1:
	callq	_main.cold.1
	jmp	LBB0_2
LBB0_5:
	callq	_main.cold.3
	jmp	LBB0_2
LBB0_7:
	callq	_main.cold.2
LBB0_2:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_23
## %bb.3:
	xorl	%eax, %eax
	addq	$1080, %rsp                     ## imm = 0x438
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_23:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.p2align	4, 0x90                         ## -- Begin function main.cold.1
_main.cold.1:                           ## @main.cold.1
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	leaq	L_.str(%rip), %rdi
	callq	_perror
	pushq	$1
	popq	%rdi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.p2align	4, 0x90                         ## -- Begin function main.cold.2
_main.cold.2:                           ## @main.cold.2
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	leaq	L_.str.2(%rip), %rdi
	callq	_perror
	pushq	$1
	popq	%rdi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.p2align	4, 0x90                         ## -- Begin function main.cold.3
_main.cold.3:                           ## @main.cold.3
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	leaq	L_.str.1(%rip), %rdi
	callq	_perror
	pushq	$1
	popq	%rdi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.comm	_AF_INET,4,2                    ## @AF_INET
	.comm	_SOCK_STREAM,4,2                ## @SOCK_STREAM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"opening stream socket"

	.comm	_INADDR_ANY,4,2                 ## @INADDR_ANY
L_.str.1:                               ## @.str.1
	.asciz	"binding stream socket"

L_.str.2:                               ## @.str.2
	.asciz	"getting socket name"

L_.str.3:                               ## @.str.3
	.asciz	"Socket has port #%d\033n"

L_.str.4:                               ## @.str.4
	.asciz	"select"

L_.str.5:                               ## @.str.5
	.asciz	"accept"

L_.str.6:                               ## @.str.6
	.asciz	"reading stream message"

L_.str.7:                               ## @.str.7
	.asciz	"Ending connection\033n"

L_.str.8:                               ## @.str.8
	.asciz	"-->%s\033n"

L_.str.9:                               ## @.str.9
	.asciz	"Do something else\033n"

	.comm	_TRUE,8,3                       ## @TRUE
.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:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #1088
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-96]
Lloh3:
	adrp	x20, _AF_INET@GOTPAGE
Lloh4:
	ldr	x20, [x20, _AF_INET@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh5:
	adrp	x8, _SOCK_STREAM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SOCK_STREAM@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_socket
	tbnz	w0, #31, LBB0_20
; %bb.1:
	mov	x19, x0
	ldr	w8, [x20]
Lloh8:
	adrp	x9, _INADDR_ANY@GOTPAGE
Lloh9:
	ldr	x9, [x9, _INADDR_ANY@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	stp	w9, w8, [sp, #32]
	str	xzr, [sp, #24]
	mov	w20, #16
	add	x1, sp, #24
	mov	w2, #16
	bl	_bind
	cbnz	x0, LBB0_21
; %bb.2:
	str	w20, [sp, #44]
	add	x1, sp, #24
	add	x2, sp, #44
	mov	x0, x19
	bl	_getsockname
	cbnz	x0, LBB0_22
; %bb.3:
	ldr	x0, [sp, #24]
	bl	_ntohs
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh11:
	adrp	x0, l_.str.3@PAGE
Lloh12:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_printf
	mov	w28, #5
	mov	x0, x19
	mov	w1, #5
	bl	_listen
Lloh13:
	adrp	x23, _TRUE@GOTPAGE
Lloh14:
	ldr	x23, [x23, _TRUE@GOTPAGEOFF]
	add	w21, w19, #1
Lloh15:
	adrp	x22, l_.str.9@PAGE
Lloh16:
	add	x22, x22, l_.str.9@PAGEOFF
	add	x20, sp, #48
Lloh17:
	adrp	x24, l_.str.6@PAGE
Lloh18:
	add	x24, x24, l_.str.6@PAGEOFF
Lloh19:
	adrp	x25, l_.str.7@PAGE
Lloh20:
	add	x25, x25, l_.str.7@PAGEOFF
Lloh21:
	adrp	x26, l_.str.8@PAGE
Lloh22:
	add	x26, x26, l_.str.8@PAGEOFF
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x22
	bl	_printf
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x23]
	cbz	x8, LBB0_18
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	add	x0, sp, #20
	bl	_FD_ZERO
	add	x1, sp, #20
	mov	x0, x19
	bl	_FD_SET
	str	w28, [sp, #16]
	add	x1, sp, #20
	add	x4, sp, #16
	mov	x0, x21
	mov	w2, #0
	mov	w3, #0
	bl	_select
	tbnz	x0, #63, LBB0_15
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x1, sp, #20
	mov	x0, x19
	bl	_FD_ISSET
	cbz	x0, LBB0_4
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x19
	mov	x1, #0
	mov	x2, #0
	bl	_accept
	mov	x27, x0
	cmn	w0, #1
	b.eq	LBB0_16
LBB0_9:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x0, sp, #48
	mov	w1, #1024
	bl	_bzero
	add	x1, sp, #48
	mov	x0, x27
	mov	w2, #1024
	bl	_read
	tbnz	w0, #31, LBB0_14
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	cbz	w0, LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=2
	str	x20, [sp]
	mov	x0, x26
	bl	_printf
	b	LBB0_9
LBB0_12:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x25
	bl	_printf
LBB0_13:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x27
	bl	_close
	b	LBB0_5
LBB0_14:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x24
	b	LBB0_17
LBB0_15:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh23:
	adrp	x0, l_.str.4@PAGE
Lloh24:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_perror
	b	LBB0_5
LBB0_16:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh25:
	adrp	x0, l_.str.5@PAGE
Lloh26:
	add	x0, x0, l_.str.5@PAGEOFF
LBB0_17:                                ;   in Loop: Header=BB0_6 Depth=1
	bl	_perror
	b	LBB0_13
LBB0_18:
	ldur	x8, [x29, #-96]
Lloh27:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh28:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_23
; %bb.19:
	mov	w0, #0
	add	sp, sp, #1088
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_20:
	bl	_main.cold.1
LBB0_21:
	bl	_main.cold.3
LBB0_22:
	bl	_main.cold.2
LBB0_23:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function main.cold.1
_main.cold.1:                           ; @main.cold.1
	.cfi_startproc
; %bb.0:
	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
Lloh30:
	adrp	x0, l_.str@PAGE
Lloh31:
	add	x0, x0, l_.str@PAGEOFF
	bl	_perror
	bl	_OUTLINED_FUNCTION_0
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function main.cold.2
_main.cold.2:                           ; @main.cold.2
	.cfi_startproc
; %bb.0:
	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
Lloh32:
	adrp	x0, l_.str.2@PAGE
Lloh33:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_perror
	bl	_OUTLINED_FUNCTION_0
	.loh AdrpAdd	Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function main.cold.3
_main.cold.3:                           ; @main.cold.3
	.cfi_startproc
; %bb.0:
	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
Lloh34:
	adrp	x0, l_.str.1@PAGE
Lloh35:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_perror
	bl	_OUTLINED_FUNCTION_0
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function OUTLINED_FUNCTION_0
_OUTLINED_FUNCTION_0:                   ; @OUTLINED_FUNCTION_0 Thunk
	.cfi_startproc
; %bb.0:
	mov	w0, #1
	b	_exit
	.cfi_endproc
                                        ; -- End function
	.comm	_AF_INET,4,2                    ; @AF_INET
	.comm	_SOCK_STREAM,4,2                ; @SOCK_STREAM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"opening stream socket"

	.comm	_INADDR_ANY,4,2                 ; @INADDR_ANY
l_.str.1:                               ; @.str.1
	.asciz	"binding stream socket"

l_.str.2:                               ; @.str.2
	.asciz	"getting socket name"

l_.str.3:                               ; @.str.3
	.asciz	"Socket has port #%d\033n"

l_.str.4:                               ; @.str.4
	.asciz	"select"

l_.str.5:                               ; @.str.5
	.asciz	"accept"

l_.str.6:                               ; @.str.6
	.asciz	"reading stream message"

l_.str.7:                               ; @.str.7
	.asciz	"Ending connection\033n"

l_.str.8:                               ; @.str.8
	.asciz	"-->%s\033n"

l_.str.9:                               ; @.str.9
	.asciz	"Do something else\033n"

	.comm	_TRUE,8,3                       ; @TRUE
.subsections_via_symbols
