	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function login_receive_chap_r
_login_receive_chap_r:                  ## @login_receive_chap_r
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r13
	xorl	%esi, %esi
	callq	_login_receive
	movq	%rax, %r12
	xorl	%eax, %eax
	callq	_keys_new
	movq	%rax, %r15
	movq	%rax, %rdi
	movq	%r12, %rsi
	callq	_keys_load
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_keys_find
	movq	%rax, %r14
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	movq	%r12, %rdi
	movl	$2, %esi
	movl	$7, %edx
	callq	_login_send_error
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_log_errx
LBB0_2:
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_keys_find
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_4
## %bb.3:
	movq	%r12, %rdi
	movl	$2, %esi
	movl	$7, %edx
	callq	_login_send_error
	leaq	L_.str.3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_log_errx
LBB0_4:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%rbx, %rsi
	callq	_chap_receive
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movq	%r12, %rdi
	movl	$2, %esi
	movl	$7, %edx
	callq	_login_send_error
	leaq	L_.str.4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_log_errx
LBB0_6:
	movq	(%r13), %rax
	movq	_AG_TYPE_CHAP@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	sete	%cl
	movq	_AG_TYPE_CHAP_MUTUAL@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	sete	%al
	orb	%cl, %al
	movzbl	%al, %edi
	callq	_assert
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_auth_find
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:
	movq	%r12, %rdi
	movl	$2, %esi
	movl	$1, %edx
	callq	_login_send_error
	leaq	L_.str.5(%rip), %rsi
	movl	$1, %edi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_log_errx
LBB0_8:
	xorl	%edi, %edi
	cmpq	$0, 8(%rbx)
	setne	%dil
	callq	_assert
	movq	8(%rbx), %rdi
	callq	_strlen
	xorl	%edi, %edi
	testq	%rax, %rax
	setg	%dil
	callq	_assert
	movq	8(%rbx), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_chap_authenticate
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movq	%r12, %rdi
	movl	$2, %esi
	movl	$1, %edx
	callq	_login_send_error
	movq	(%rbx), %rdx
	leaq	L_.str.6(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_log_errx
LBB0_10:
	movq	%r15, %rdi
	callq	_keys_delete
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rbx, (%rax)
	movq	%r12, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"CHAP_N"

L_.str.1:                               ## @.str.1
	.asciz	"received CHAP Login PDU without CHAP_N"

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

L_.str.3:                               ## @.str.3
	.asciz	"received CHAP Login PDU without CHAP_R"

L_.str.4:                               ## @.str.4
	.asciz	"received CHAP Login PDU with malformed CHAP_R"

	.comm	_AG_TYPE_CHAP,8,3               ## @AG_TYPE_CHAP
	.comm	_AG_TYPE_CHAP_MUTUAL,8,3        ## @AG_TYPE_CHAP_MUTUAL
L_.str.5:                               ## @.str.5
	.asciz	"received CHAP Login with invalid user \"%s\""

L_.str.6:                               ## @.str.6
	.asciz	"CHAP authentication failed for user \"%s\""

	.no_dead_strip	_login_receive_chap_r
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function login_receive_chap_r
_login_receive_chap_r:                  ; @login_receive_chap_r
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x19, x3
	mov	x22, x2
	mov	x23, x1
	mov	w1, #0
	bl	_login_receive
	mov	x20, x0
	bl	_keys_new
	mov	x21, x0
	mov	x1, x20
	bl	_keys_load
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_keys_find
	mov	x24, x0
	cbnz	x0, LBB0_2
; %bb.1:
	mov	x0, x20
	mov	w1, #2
	mov	w2, #7
	bl	_login_send_error
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_log_errx
LBB0_2:
Lloh4:
	adrp	x1, l_.str.2@PAGE
Lloh5:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_keys_find
	mov	x25, x0
	cbnz	x0, LBB0_4
; %bb.3:
	mov	x0, x20
	mov	w1, #2
	mov	w2, #7
	bl	_login_send_error
Lloh6:
	adrp	x1, l_.str.3@PAGE
Lloh7:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #1
	bl	_log_errx
LBB0_4:
	mov	x0, x22
	mov	x1, x25
	bl	_chap_receive
	cbz	w0, LBB0_6
; %bb.5:
	mov	x0, x20
	mov	w1, #2
	mov	w2, #7
	bl	_login_send_error
Lloh8:
	adrp	x1, l_.str.4@PAGE
Lloh9:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #1
	bl	_log_errx
LBB0_6:
	ldr	x8, [x23]
Lloh10:
	adrp	x9, _AG_TYPE_CHAP@GOTPAGE
Lloh11:
	ldr	x9, [x9, _AG_TYPE_CHAP@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x8, x9
Lloh13:
	adrp	x9, _AG_TYPE_CHAP_MUTUAL@GOTPAGE
Lloh14:
	ldr	x9, [x9, _AG_TYPE_CHAP_MUTUAL@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	ccmp	x8, x9, #4, ne
	cset	w0, eq
	bl	_assert
	mov	x0, x23
	mov	x1, x24
	bl	_auth_find
	mov	x23, x0
	cbnz	x0, LBB0_8
; %bb.7:
	mov	x0, x20
	mov	w1, #2
	mov	w2, #1
	bl	_login_send_error
	str	x24, [sp]
Lloh16:
	adrp	x1, l_.str.5@PAGE
Lloh17:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	w0, #1
	bl	_log_errx
LBB0_8:
	ldr	x8, [x23, #8]
	cmp	x8, #0
	cset	w0, ne
	bl	_assert
	ldr	x0, [x23, #8]
	bl	_strlen
	cmp	x0, #0
	cset	w0, gt
	bl	_assert
	ldr	x1, [x23, #8]
	mov	x0, x22
	bl	_chap_authenticate
	cbz	w0, LBB0_10
; %bb.9:
	mov	x0, x20
	mov	w1, #2
	mov	w2, #1
	bl	_login_send_error
	ldr	x8, [x23]
	str	x8, [sp]
Lloh18:
	adrp	x1, l_.str.6@PAGE
Lloh19:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	w0, #1
	bl	_log_errx
LBB0_10:
	mov	x0, x21
	bl	_keys_delete
	str	x23, [x19]
	mov	x0, x20
	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
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"CHAP_N"

l_.str.1:                               ; @.str.1
	.asciz	"received CHAP Login PDU without CHAP_N"

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

l_.str.3:                               ; @.str.3
	.asciz	"received CHAP Login PDU without CHAP_R"

l_.str.4:                               ; @.str.4
	.asciz	"received CHAP Login PDU with malformed CHAP_R"

	.comm	_AG_TYPE_CHAP,8,3               ; @AG_TYPE_CHAP
	.comm	_AG_TYPE_CHAP_MUTUAL,8,3        ; @AG_TYPE_CHAP_MUTUAL
l_.str.5:                               ; @.str.5
	.asciz	"received CHAP Login with invalid user \"%s\""

l_.str.6:                               ; @.str.6
	.asciz	"CHAP authentication failed for user \"%s\""

	.no_dead_strip	_login_receive_chap_r
.subsections_via_symbols
