	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kex_derive_keys                ## -- Begin function kex_derive_keys
	.p2align	4, 0x90
_kex_derive_keys:                       ## @kex_derive_keys
	.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	%rcx, -80(%rbp)                 ## 8-byte Spill
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %r15
	movq	_NKEYS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%rbx, %rax
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r13
	testl	%ebx, %ebx
	jle	LBB0_7
## %bb.1:
	xorl	%r12d, %r12d
	movq	%r13, %r14
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	leal	65(%r12), %eax
	movq	%r15, %rbx
	movl	16(%r15), %edx
	subq	$8, %rsp
	movsbl	%al, %esi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	-52(%rbp), %r8d                 ## 4-byte Reload
	movq	-80(%rbp), %r9                  ## 8-byte Reload
	pushq	%r14
	callq	_derive_key
	addq	$16, %rsp
	testl	%eax, %eax
	jne	LBB0_3
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	incq	%r12
	movq	_NKEYS@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$8, %r14
	cmpq	%rax, %r12
	movq	%rbx, %r15
	jl	LBB0_2
LBB0_7:
	movq	_MODE_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	testl	%r14d, %r14d
	jle	LBB0_15
## %bb.8:
	movq	8(%r15), %rcx
	leaq	24(%r13), %r10
	movq	%r13, %r11
	addq	$16, %r11
	xorl	%edi, %edi
	movq	_MODE_OUT@GOTPCREL(%rip), %r9
	movq	_MODE_IN@GOTPCREL(%rip), %r8
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_9 Depth=1
	movq	(%r13), %rdx
	movq	(%r15), %rsi
	leaq	(%rsi,%rdi,8), %rbx
	movq	(%rsi,%rdi,8), %rsi
	movq	%rdx, 16(%rsi)
LBB0_13:                                ##   in Loop: Header=BB0_9 Depth=1
	movl	$4, %edx
	movq	%r11, %rsi
LBB0_14:                                ##   in Loop: Header=BB0_9 Depth=1
	movq	(%rsi), %rax
	movq	(%rbx), %rsi
	movq	%rax, 8(%rsi)
	movq	(%r13,%rdx,8), %rax
	movq	(%rbx), %rdx
	movq	%rax, (%rdx)
	incq	%rdi
	cmpq	%r14, %rdi
	je	LBB0_15
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	testq	%rcx, %rcx
	jne	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	(%r9), %edx
	cmpq	%rdx, %rdi
	je	LBB0_11
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=1
	testq	%rcx, %rcx
	sete	%dl
	movl	(%r8), %esi
	cmpq	%rsi, %rdi
	setne	%bl
	orb	%dl, %bl
	movzbl	%bl, %eax
	movq	(%r13,%rax,8), %rdx
	movq	(%r15), %rsi
	leaq	(%rsi,%rdi,8), %rbx
	movq	(%rsi,%rdi,8), %rsi
	movq	%rdx, 16(%rsi)
	movl	$5, %edx
	movq	%r10, %rsi
	testb	%al, %al
	je	LBB0_13
	jmp	LBB0_14
LBB0_15:
	xorl	%r15d, %r15d
	jmp	LBB0_16
LBB0_3:
	movl	%eax, %r15d
	testl	%r12d, %r12d
	je	LBB0_16
## %bb.4:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r13,%rbx,8), %rdi
	callq	_free
	incq	%rbx
	cmpq	%rbx, %r12
	jne	LBB0_5
LBB0_16:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_18
## %bb.17:
	movl	%r15d, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_NKEYS,4,2                      ## @NKEYS
	.comm	_MODE_MAX,4,2                   ## @MODE_MAX
	.comm	_MODE_OUT,4,2                   ## @MODE_OUT
	.comm	_MODE_IN,4,2                    ## @MODE_IN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kex_derive_keys                ; -- Begin function kex_derive_keys
	.p2align	2
_kex_derive_keys:                       ; @kex_derive_keys
	.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, #16
	mov	x19, x3
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	ldr	x26, [x0]
Lloh3:
	adrp	x28, _NKEYS@GOTPAGE
Lloh4:
	ldr	x28, [x28, _NKEYS@GOTPAGEOFF]
	ldr	w12, [x28]
	lsl	x8, x12, #3
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xffffffff0
	sub	x25, x9, x8
	mov	sp, x25
	cmp	w12, #1
	b.lt	LBB0_4
; %bb.1:
	mov	x27, #0
	mov	x24, x25
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	add	w8, w27, #65
	ldr	w2, [x26, #16]
	sxtb	w1, w8
	mov	x0, x22
	mov	x3, x21
	mov	x4, x20
	mov	x5, x19
	mov	x6, x24
	bl	_derive_key
	cbnz	w0, LBB0_14
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x27, x27, #1
	ldrsw	x8, [x28]
	add	x24, x24, #8
	cmp	x27, x8
	b.lt	LBB0_2
LBB0_4:
Lloh7:
	adrp	x8, _MODE_MAX@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MODE_MAX@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.5:
	mov	x9, #0
	ldr	x10, [x26, #8]
	add	x11, x25, #24
	add	x12, x25, #16
Lloh10:
	adrp	x13, _MODE_OUT@GOTPAGE
Lloh11:
	ldr	x13, [x13, _MODE_OUT@GOTPAGEOFF]
Lloh12:
	adrp	x14, _MODE_IN@GOTPAGE
Lloh13:
	ldr	x14, [x14, _MODE_IN@GOTPAGEOFF]
	b	LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
	mov	x16, x11
	mov	w17, #5
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	ldr	x16, [x16]
	ldr	x0, [x15]
	str	x16, [x0, #8]
	ldr	x16, [x25, x17, lsl #3]
	ldr	x15, [x15]
	str	x16, [x15]
	add	x9, x9, #1
	cmp	x9, x8
	b.eq	LBB0_13
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	cbnz	x10, LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	w15, [x13]
	cmp	x9, x15
	b.ne	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	x16, [x25]
	ldr	x15, [x26]
	add	x15, x15, x9, lsl #3
	ldr	x17, [x15]
	str	x16, [x17, #16]
	b	LBB0_12
LBB0_11:                                ;   in Loop: Header=BB0_8 Depth=1
	cmp	x10, #0
	ldr	w15, [x14]
	ccmp	x9, x15, #0, ne
	cset	w15, ne
	ldr	x16, [x25, w15, uxtw #3]
	ldr	x15, [x26]
	add	x15, x15, x9, lsl #3
	ldr	x17, [x15]
	str	x16, [x17, #16]
	b.ne	LBB0_6
LBB0_12:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	x16, x12
	mov	w17, #4
	b	LBB0_7
LBB0_13:
	mov	w23, #0
	b	LBB0_17
LBB0_14:
	mov	x23, x0
	cbz	w27, LBB0_17
; %bb.15:
	mov	x19, #0
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x25, x19, lsl #3]
	bl	_free
	add	x19, x19, #1
	cmp	x27, x19
	b.ne	LBB0_16
LBB0_17:
	ldur	x8, [x29, #-88]
Lloh14:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh15:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_19
; %bb.18:
	mov	x0, x23
	sub	sp, x29, #80
	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_19:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_NKEYS,4,2                      ; @NKEYS
	.comm	_MODE_MAX,4,2                   ; @MODE_MAX
	.comm	_MODE_OUT,4,2                   ; @MODE_OUT
	.comm	_MODE_IN,4,2                    ; @MODE_IN
.subsections_via_symbols
