	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ws_get_handshake
_ws_get_handshake:                      ## @ws_get_handshake
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r12
	movq	8(%rdi), %rax
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	xorl	%eax, %eax
	callq	_new_wsheader
	movq	%rax, 8(%r12)
LBB0_2:
	movq	(%rax), %rbx
	movslq	8(%rax), %rax
	leaq	(%rbx,%rax), %rsi
	movq	_BUFSIZ@GOTPCREL(%rip), %r13
	movq	(%r13), %rdx
	subq	%rax, %rdx
	movq	%r12, %rdi
	callq	_read_socket
	movl	%eax, %r14d
	testl	%eax, %eax
	jle	LBB0_3
## %bb.6:
	movq	8(%r12), %rax
	movslq	8(%rax), %rcx
	movslq	%r14d, %rdx
	addq	%rcx, %rdx
	movl	%edx, 8(%rax)
	movb	$0, (%rbx,%rdx)
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	callq	_strstr
	testq	%rax, %rax
	je	LBB0_7
## %bb.10:
	movq	8(%r12), %rdi
	callq	_parse_headers
	testq	%rax, %rax
	jne	LBB0_12
## %bb.11:
	movq	8(%r12), %rdi
	callq	_ws_verify_req_headers
	testq	%rax, %rax
	jne	LBB0_12
## %bb.13:
	movq	8(%r12), %rdi
	callq	_ws_set_handshake_headers
	movq	8(%r12), %rsi
	movq	%r12, %rdi
	callq	_ws_send_handshake_headers
	movq	8(%r15), %rax
	movq	_wsconfig@GOTPCREL(%rip), %rbx
	testq	%rax, %rax
	je	LBB0_17
## %bb.14:
	cmpq	$0, 16(%rbx)
	je	LBB0_17
## %bb.15:
	cmpl	$0, 8(%rbx)
	jne	LBB0_17
## %bb.16:
	movl	4(%r15), %edi
	movq	%r12, %rsi
	callq	*%rax
LBB0_17:
	movq	8(%r12), %rax
	movq	$0, 16(%rax)
	leaq	4(%r12), %rdi
	xorl	%esi, %esi
	callq	_gettimeofday
	cmpq	$0, (%rbx)
	je	LBB0_19
## %bb.18:
	movq	%r12, %rdi
	movl	$101, %esi
	callq	_access_log
LBB0_19:
	movl	(%r15), %edi
	callq	_list_count
	movslq	%eax, %rdi
	callq	_LOG
	movq	_WS_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_3:
	movq	_WS_CLOSE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_5
## %bb.4:
	movq	_WS_BAD_REQUEST_STR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_http_error
LBB0_5:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	%rbx, %rdi
	callq	_strlen
	cmpq	(%r13), %rax
	jge	LBB0_12
## %bb.8:
	movq	_WS_READING@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_12:
	movq	_WS_BAD_REQUEST_STR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_http_error
	movq	_WS_CLOSE@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	%r14d, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ws_set_status                  ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_BUFSIZ,8,3                     ## @BUFSIZ
	.comm	_WS_CLOSE,4,2                   ## @WS_CLOSE
	.comm	_WS_BAD_REQUEST_STR,4,2         ## @WS_BAD_REQUEST_STR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"\r\n\r\n"

	.comm	_WS_READING,4,2                 ## @WS_READING
	.comm	_wsconfig,24,3                  ## @wsconfig
	.comm	_WS_OK,4,2                      ## @WS_OK
	.no_dead_strip	_ws_get_handshake
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ws_get_handshake
_ws_get_handshake:                      ; @ws_get_handshake
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x1
	mov	x19, x0
	ldr	x0, [x0, #8]
	cbnz	x0, LBB0_2
; %bb.1:
	bl	_new_wsheader
	str	x0, [x19, #8]
LBB0_2:
	ldr	x22, [x0]
	ldrsw	x8, [x0, #8]
	add	x1, x22, x8
Lloh0:
	adrp	x23, _BUFSIZ@GOTPAGE
Lloh1:
	ldr	x23, [x23, _BUFSIZ@GOTPAGEOFF]
	ldr	x9, [x23]
	sub	x2, x9, x8
	mov	x0, x19
	bl	_read_socket
	mov	x20, x0
	cmp	w0, #0
	b.le	LBB0_13
; %bb.3:
	ldr	x8, [x19, #8]
	ldrsw	x9, [x8, #8]
	add	x9, x9, w20, sxtw
	str	w9, [x8, #8]
	strb	wzr, [x22, x9]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	bl	_strstr
	cbz	x0, LBB0_16
; %bb.4:
	ldr	x0, [x19, #8]
	bl	_parse_headers
	cbnz	x0, LBB0_18
; %bb.5:
	ldr	x0, [x19, #8]
	bl	_ws_verify_req_headers
	cbnz	x0, LBB0_18
; %bb.6:
	ldr	x0, [x19, #8]
	bl	_ws_set_handshake_headers
	ldr	x1, [x19, #8]
	mov	x0, x19
	bl	_ws_send_handshake_headers
	ldr	x8, [x21, #8]
Lloh4:
	adrp	x22, _wsconfig@GOTPAGE
Lloh5:
	ldr	x22, [x22, _wsconfig@GOTPAGEOFF]
	cbz	x8, LBB0_10
; %bb.7:
	ldr	x9, [x22, #16]
	cbz	x9, LBB0_10
; %bb.8:
	ldr	w9, [x22, #8]
	cbnz	w9, LBB0_10
; %bb.9:
	ldr	w0, [x21, #4]
	mov	x1, x19
	blr	x8
LBB0_10:
	ldr	x8, [x19, #8]
	str	xzr, [x8, #16]
	add	x0, x19, #4
	mov	x1, #0
	bl	_gettimeofday
	ldr	x8, [x22]
	cbz	x8, LBB0_12
; %bb.11:
	mov	x0, x19
	mov	w1, #101
	bl	_access_log
LBB0_12:
	ldr	w0, [x21]
	bl	_list_count
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x0, w0
	bl	_LOG
Lloh6:
	adrp	x8, _WS_OK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _WS_OK@GOTPAGEOFF]
	b	LBB0_19
LBB0_13:
	ldr	w8, [x19]
Lloh8:
	adrp	x9, _WS_CLOSE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _WS_CLOSE@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.14:
Lloh11:
	adrp	x8, _WS_BAD_REQUEST_STR@GOTPAGE
Lloh12:
	ldr	x8, [x8, _WS_BAD_REQUEST_STR@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_http_error
LBB0_15:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_16:
	mov	x0, x22
	bl	_strlen
	ldr	x8, [x23]
	cmp	x0, x8
	b.ge	LBB0_18
; %bb.17:
Lloh14:
	adrp	x8, _WS_READING@GOTPAGE
Lloh15:
	ldr	x8, [x8, _WS_READING@GOTPAGEOFF]
	b	LBB0_19
LBB0_18:
Lloh16:
	adrp	x8, _WS_BAD_REQUEST_STR@GOTPAGE
Lloh17:
	ldr	x8, [x8, _WS_BAD_REQUEST_STR@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_http_error
Lloh19:
	adrp	x8, _WS_CLOSE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _WS_CLOSE@GOTPAGEOFF]
LBB0_19:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_ws_set_status
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_BUFSIZ,8,3                     ; @BUFSIZ
	.comm	_WS_CLOSE,4,2                   ; @WS_CLOSE
	.comm	_WS_BAD_REQUEST_STR,4,2         ; @WS_BAD_REQUEST_STR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"\r\n\r\n"

	.comm	_WS_READING,4,2                 ; @WS_READING
	.comm	_wsconfig,24,3                  ; @wsconfig
	.comm	_WS_OK,4,2                      ; @WS_OK
	.no_dead_strip	_ws_get_handshake
.subsections_via_symbols
