	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function chat_expect
_chat_expect:                           ## @chat_expect
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	_chat_debug@GOTPCREL(%rip), %r15
	movq	_CHATDEBUG_EXPECT@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	testl	%eax, (%r15)
	je	LBB0_2
## %bb.1:
	movq	_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	%rbx, %rdi
	callq	_strlen
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_cleanstr
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_syslog
LBB0_2:
	movq	%rbx, %rdi
	callq	_strlen
                                        ## kill: def $eax killed $eax def $rax
	testl	%eax, %eax
	jle	LBB0_3
## %bb.4:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	leal	1(%rax), %r12d
	movl	%r12d, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %r14
	movq	%rax, %rdi
	xorl	%esi, %esi
	movl	%r12d, %edx
	callq	_memset
	movq	_chat_alarm@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_alarm
	movq	_alarmed@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	xorl	%r13d, %r13d
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_16 Depth 2
	movq	_STDIN_FILENO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-41(%rbp), %rsi
	movl	$1, %edx
	callq	_read
	cmpl	$1, %eax
	jne	LBB0_29
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	_CHATDEBUG_RECEIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movb	-41(%rbp), %bl
	movzbl	%bl, %esi
	xorl	%edi, %edi
	callq	_cleanchr
	movl	%r14d, %edi
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_syslog
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	movb	-41(%rbp), %bl
LBB0_11:                                ##   in Loop: Header=BB0_7 Depth=1
	movzbl	%bl, %ecx
	movslq	%r13d, %rax
	movsbl	(%r12,%rax), %edx
	cmpl	%edx, %ecx
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_7 Depth=1
	incl	%r13d
	movb	%bl, (%r14,%rax)
	jmp	LBB0_20
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_7 Depth=1
	testl	%r13d, %r13d
	jle	LBB0_20
## %bb.14:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	$1, %ebx
	cmpl	$1, %r13d
	je	LBB0_19
## %bb.15:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%r13d, %r14d
	leal	-1(%r13), %r12d
	movl	$1, %ebx
	.p2align	4, 0x90
LBB0_16:                                ##   Parent Loop BB0_7 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%rbx), %r15
	movq	%r15, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	%r12d, %edx
	callq	_memcmp
	testq	%rax, %rax
	je	LBB0_28
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=2
	incq	%rbx
	decl	%r12d
	cmpq	%rbx, %r14
	jne	LBB0_16
## %bb.18:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%r14d, %ebx
	movq	_chat_debug@GOTPCREL(%rip), %r15
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_19
LBB0_28:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%r12d, %edx
	callq	_memcpy
	movq	_chat_debug@GOTPCREL(%rip), %r15
	movq	-64(%rbp), %r12                 ## 8-byte Reload
LBB0_19:                                ##   in Loop: Header=BB0_7 Depth=1
	subl	%ebx, %r13d
LBB0_20:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	cmpl	%eax, %r13d
	jge	LBB0_21
## %bb.22:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	_alarmed@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.23:
	movl	$3, %r14d
	jmp	LBB0_24
LBB0_3:
	xorl	%r14d, %r14d
	jmp	LBB0_25
LBB0_5:
	movl	$1, %r14d
	jmp	LBB0_25
LBB0_29:
	movq	_alarmed@GOTPCREL(%rip), %rax
	cmpq	$1, (%rax)
	movl	$3, %r14d
	sbbl	$0, %r14d
	jmp	LBB0_24
LBB0_21:
	xorl	%r14d, %r14d
LBB0_24:
	xorl	%edi, %edi
	callq	_alarm
	xorl	%eax, %eax
	callq	_chat_unalarm
	movq	_alarmed@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
	movq	_CHATDEBUG_EXPECT@GOTPCREL(%rip), %r13
LBB0_25:
	movl	(%r13), %eax
	testl	%eax, (%r15)
	je	LBB0_27
## %bb.26:
	movq	_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	%r14d, %edi
	callq	_result
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_syslog
LBB0_27:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_chat_debug,4,2                 ## @chat_debug
	.comm	_CHATDEBUG_EXPECT,4,2           ## @CHATDEBUG_EXPECT
	.comm	_LOG_DEBUG,4,2                  ## @LOG_DEBUG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"chat_expect '%s'"

	.comm	_chat_alarm,4,2                 ## @chat_alarm
	.comm	_alarmed,8,3                    ## @alarmed
	.comm	_STDIN_FILENO,4,2               ## @STDIN_FILENO
	.comm	_CHATDEBUG_RECEIVE,4,2          ## @CHATDEBUG_RECEIVE
L_.str.1:                               ## @.str.1
	.asciz	"chat_recv '%s' m=%d"

L_.str.2:                               ## @.str.2
	.asciz	"chat_expect %s"

	.no_dead_strip	_chat_expect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function chat_expect
_chat_expect:                           ; @chat_expect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x0
Lloh0:
	adrp	x22, _chat_debug@GOTPAGE
Lloh1:
	ldr	x22, [x22, _chat_debug@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh2:
	adrp	x23, _CHATDEBUG_EXPECT@GOTPAGE
Lloh3:
	ldr	x23, [x23, _CHATDEBUG_EXPECT@GOTPAGEOFF]
	ldr	w9, [x23]
Lloh4:
	adrp	x28, _LOG_DEBUG@GOTPAGE
Lloh5:
	ldr	x28, [x28, _LOG_DEBUG@GOTPAGEOFF]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	ldr	w20, [x28]
	mov	x0, x19
	bl	_strlen
	mov	x1, x0
	mov	x0, x19
	bl	_cleanstr
	mov	x2, x0
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_syslog
LBB0_2:
	mov	x0, x19
	bl	_strlen
	cmp	w0, #1
	b.lt	LBB0_24
; %bb.3:
	mov	x21, x0
	add	w22, w0, #1
	mov	x0, x22
	bl	_malloc
	cbz	x0, LBB0_25
; %bb.4:
	mov	x20, x0
	mov	w1, #0
	mov	x2, x22
	bl	_memset
Lloh8:
	adrp	x8, _chat_alarm@GOTPAGE
Lloh9:
	ldr	x8, [x8, _chat_alarm@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	bl	_alarm
	mov	w27, #0
Lloh11:
	adrp	x26, _alarmed@GOTPAGE
Lloh12:
	ldr	x26, [x26, _alarmed@GOTPAGEOFF]
	str	xzr, [x26]
Lloh13:
	adrp	x25, _STDIN_FILENO@GOTPAGE
Lloh14:
	ldr	x25, [x25, _STDIN_FILENO@GOTPAGEOFF]
Lloh15:
	adrp	x22, _chat_debug@GOTPAGE
Lloh16:
	ldr	x22, [x22, _chat_debug@GOTPAGEOFF]
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_15 Depth 2
	ldr	w0, [x25]
	add	x1, sp, #15
	mov	w2, #1
	bl	_read
	cmp	w0, #1
	b.ne	LBB0_26
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x22]
Lloh17:
	adrp	x9, _CHATDEBUG_RECEIVE@GOTPAGE
Lloh18:
	ldr	x9, [x9, _CHATDEBUG_RECEIVE@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w24, [x28]
	ldrb	w23, [sp, #15]
	mov	x0, #0
	mov	x1, x23
	bl	_cleanchr
	mov	x2, x0
	mov	x8, x27
	str	x8, [sp]
	mov	x0, x24
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_syslog
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldrb	w23, [sp, #15]
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	sxtw	x8, w27
	ldrsb	w9, [x19, x8]
	cmp	w23, w9
	b.ne	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	add	w27, w27, #1
	strb	w23, [x20, x8]
	b	LBB0_21
LBB0_11:                                ;   in Loop: Header=BB0_5 Depth=1
	subs	w23, w27, #1
	b.lt	LBB0_21
; %bb.12:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x25, x26
	b.ne	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	w26, #1
	b	LBB0_20
LBB0_14:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x22, x28
	mov	w28, w27
	mov	w26, #1
LBB0_15:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x24, x20, x26
	mov	x0, x24
	mov	x1, x19
	mov	x2, x23
	bl	_memcmp
	cbz	x0, LBB0_18
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=2
	add	x26, x26, #1
	sub	w23, w23, #1
	cmp	x28, x26
	b.ne	LBB0_15
; %bb.17:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x26, x28
	b	LBB0_19
LBB0_18:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x20
	mov	x1, x24
	mov	x2, x23
	bl	_memcpy
LBB0_19:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x28, x22
Lloh22:
	adrp	x22, _chat_debug@GOTPAGE
Lloh23:
	ldr	x22, [x22, _chat_debug@GOTPAGEOFF]
LBB0_20:                                ;   in Loop: Header=BB0_5 Depth=1
	sub	w27, w27, w26
	mov	x26, x25
Lloh24:
	adrp	x25, _STDIN_FILENO@GOTPAGE
Lloh25:
	ldr	x25, [x25, _STDIN_FILENO@GOTPAGEOFF]
LBB0_21:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	w27, w21
	b.ge	LBB0_27
; %bb.22:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x26]
	cbz	x8, LBB0_5
; %bb.23:
	mov	w19, #3
	b	LBB0_28
LBB0_24:
	mov	w19, #0
	b	LBB0_29
LBB0_25:
	mov	w19, #1
Lloh26:
	adrp	x22, _chat_debug@GOTPAGE
Lloh27:
	ldr	x22, [x22, _chat_debug@GOTPAGEOFF]
	b	LBB0_29
LBB0_26:
	ldr	x8, [x26]
	cmp	x8, #0
	mov	w8, #2
	cinc	w19, w8, ne
	b	LBB0_28
LBB0_27:
	mov	w19, #0
LBB0_28:
	mov	w0, #0
	bl	_alarm
	bl	_chat_unalarm
	str	xzr, [x26]
	mov	x0, x20
	bl	_free
Lloh28:
	adrp	x23, _CHATDEBUG_EXPECT@GOTPAGE
Lloh29:
	ldr	x23, [x23, _CHATDEBUG_EXPECT@GOTPAGEOFF]
LBB0_29:
	ldr	w8, [x22]
	ldr	w9, [x23]
	tst	w9, w8
	b.eq	LBB0_31
; %bb.30:
	ldr	w20, [x28]
	mov	x0, x19
	bl	_result
	mov	x2, x0
Lloh30:
	adrp	x1, l_.str.2@PAGE
Lloh31:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_syslog
LBB0_31:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_chat_debug,4,2                 ; @chat_debug
	.comm	_CHATDEBUG_EXPECT,4,2           ; @CHATDEBUG_EXPECT
	.comm	_LOG_DEBUG,4,2                  ; @LOG_DEBUG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"chat_expect '%s'"

	.comm	_chat_alarm,4,2                 ; @chat_alarm
	.comm	_alarmed,8,3                    ; @alarmed
	.comm	_STDIN_FILENO,4,2               ; @STDIN_FILENO
	.comm	_CHATDEBUG_RECEIVE,4,2          ; @CHATDEBUG_RECEIVE
l_.str.1:                               ; @.str.1
	.asciz	"chat_recv '%s' m=%d"

l_.str.2:                               ; @.str.2
	.asciz	"chat_expect %s"

	.no_dead_strip	_chat_expect
.subsections_via_symbols
