	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_generate_key_random            ## -- Begin function generate_key_random
	.p2align	4, 0x90
_generate_key_random:                   ## @generate_key_random
	.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	%rsi, %rbx
	movq	%rdi, %r12
	movq	_MAX_CIPHER_KEY_LENGTH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_MAX_HMAC_KEY_LENGTH@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	xorl	%eax, %eax
	callq	_gc_new
	movl	%eax, -48(%rbp)
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rdi
	callq	_CLEAR
	testq	%rbx, %rbx
	je	LBB0_6
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpq	$0, 16(%rbx)
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	(%rbx), %eax
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	cmpl	%edx, %eax
	movl	%eax, %ecx
	cmovgl	%edx, %ecx
	testl	%eax, %eax
	cmovgl	%ecx, %edx
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
LBB0_4:                                 ##   in Loop: Header=BB0_1 Depth=1
	cmpq	$0, 8(%rbx)
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	4(%rbx), %eax
	cmpl	%r13d, %eax
	movl	%eax, %ecx
	cmovgl	%r13d, %ecx
	testl	%eax, %eax
	cmovgl	%ecx, %r13d
LBB0_6:                                 ##   in Loop: Header=BB0_1 Depth=1
	movl	4(%r12), %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_rand_bytes
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	(%r12), %edi
	movl	%r13d, %esi
	callq	_rand_bytes
	testl	%eax, %eax
	jne	LBB0_9
LBB0_8:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	_M_FATAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_msg
LBB0_9:                                 ##   in Loop: Header=BB0_1 Depth=1
	movl	%r13d, %ebx
	movq	_D_SHOW_KEY_SOURCE@GOTPCREL(%rip), %r15
	movl	(%r15), %r13d
	movl	4(%r12), %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	xorl	%edx, %edx
	leaq	-48(%rbp), %r14
	movq	%r14, %rcx
	callq	_format_hex
	movl	%r13d, %edi
	movl	%ebx, %r13d
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	callq	_dmsg
	movl	(%r15), %ebx
	movl	(%r12), %edi
	movl	%r13d, %esi
	xorl	%edx, %edx
	movq	%r14, %rcx
	callq	_format_hex
	movl	%ebx, %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edx
	callq	_dmsg
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	testq	%rbx, %rbx
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_fixup_key
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_check_key
	testl	%eax, %eax
	je	LBB0_1
LBB0_11:
	leaq	-48(%rbp), %rdi
	callq	_gc_free
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_CIPHER_KEY_LENGTH,4,2      ## @MAX_CIPHER_KEY_LENGTH
	.comm	_MAX_HMAC_KEY_LENGTH,4,2        ## @MAX_HMAC_KEY_LENGTH
	.comm	_M_FATAL,4,2                    ## @M_FATAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ERROR: Random number generator cannot obtain entropy for key generation"

	.comm	_D_SHOW_KEY_SOURCE,4,2          ## @D_SHOW_KEY_SOURCE
L_.str.1:                               ## @.str.1
	.asciz	"Cipher source entropy: %s"

L_.str.2:                               ## @.str.2
	.asciz	"HMAC source entropy: %s"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_generate_key_random            ; -- Begin function generate_key_random
	.p2align	2
_generate_key_random:                   ; @generate_key_random
	.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, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _MAX_CIPHER_KEY_LENGTH@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_CIPHER_KEY_LENGTH@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
Lloh3:
	adrp	x8, _MAX_HMAC_KEY_LENGTH@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX_HMAC_KEY_LENGTH@GOTPAGEOFF]
Lloh5:
	ldr	w22, [x8]
	bl	_gc_new
	str	w0, [sp, #8]
Lloh6:
	adrp	x27, _M_FATAL@GOTPAGE
Lloh7:
	ldr	x27, [x27, _M_FATAL@GOTPAGEOFF]
Lloh8:
	adrp	x23, l_.str@PAGE
Lloh9:
	add	x23, x23, l_.str@PAGEOFF
Lloh10:
	adrp	x28, _D_SHOW_KEY_SOURCE@GOTPAGE
Lloh11:
	ldr	x28, [x28, _D_SHOW_KEY_SOURCE@GOTPAGEOFF]
Lloh12:
	adrp	x24, l_.str.1@PAGE
Lloh13:
	add	x24, x24, l_.str.1@PAGEOFF
Lloh14:
	adrp	x25, l_.str.2@PAGE
Lloh15:
	add	x25, x25, l_.str.2@PAGEOFF
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x20]
	bl	_CLEAR
	cbz	x19, LBB0_6
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w8, [x19]
	cmp	w8, w21
	ccmp	w8, #1, #8, le
	csel	w21, w21, w8, lt
LBB0_4:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w8, [x19, #4]
	cmp	w8, w22
	ccmp	w8, #1, #8, le
	csel	w22, w22, w8, lt
LBB0_6:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	w0, [x20, #4]
	mov	x1, x21
	bl	_rand_bytes
	cbz	w0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w0, [x20]
	mov	x1, x22
	bl	_rand_bytes
	cbnz	w0, LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	w0, [x27]
	mov	x1, x23
	bl	_msg
LBB0_9:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	w26, [x28]
	ldr	w0, [x20, #4]
	add	x3, sp, #8
	mov	x1, x21
	mov	w2, #0
	bl	_format_hex
	mov	x2, x0
	mov	x0, x26
	mov	x1, x24
	bl	_dmsg
	ldr	w26, [x28]
	ldr	w0, [x20]
	add	x3, sp, #8
	mov	x1, x22
	mov	w2, #0
	bl	_format_hex
	mov	x2, x0
	mov	x0, x26
	mov	x1, x25
	bl	_dmsg
	cbz	x19, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x20
	mov	x1, x19
	bl	_fixup_key
	mov	x0, x20
	mov	x1, x19
	bl	_check_key
	cbz	w0, LBB0_1
LBB0_11:
	add	x0, sp, #8
	bl	_gc_free
	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 AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_CIPHER_KEY_LENGTH,4,2      ; @MAX_CIPHER_KEY_LENGTH
	.comm	_MAX_HMAC_KEY_LENGTH,4,2        ; @MAX_HMAC_KEY_LENGTH
	.comm	_M_FATAL,4,2                    ; @M_FATAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ERROR: Random number generator cannot obtain entropy for key generation"

	.comm	_D_SHOW_KEY_SOURCE,4,2          ; @D_SHOW_KEY_SOURCE
l_.str.1:                               ; @.str.1
	.asciz	"Cipher source entropy: %s"

l_.str.2:                               ; @.str.2
	.asciz	"HMAC source entropy: %s"

.subsections_via_symbols
