	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mbedtls_mpi_gen_prime          ## -- Begin function mbedtls_mpi_gen_prime
	.p2align	4, 0x90
_mbedtls_mpi_gen_prime:                 ## @mbedtls_mpi_gen_prime
	.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	%r8, -48(%rbp)                  ## 8-byte Spill
	cmpq	$3, %rsi
	jb	LBB0_2
## %bb.1:
	movq	%rsi, %r13
	movq	_MBEDTLS_MPI_MAX_BITS@GOTPCREL(%rip), %rax
	cmpq	%rsi, (%rax)
	jb	LBB0_2
## %bb.3:
	movq	%rcx, %r15
	movl	%edx, %r12d
	movq	%rdi, %r14
	leaq	-64(%rbp), %rdi
	callq	_mbedtls_mpi_init
	movq	%r13, %rdi
	callq	_BITS_TO_LIMBS
	movq	_ciL@GOTPCREL(%rip), %rcx
	imulq	(%rcx), %rax
	movq	%r14, %rdi
	movq	%rax, %rsi
	movq	%r15, %rdx
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	callq	_mbedtls_mpi_fill_random
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%r14, %rdi
	callq	_mbedtls_mpi_bitlen
	cmpq	%r13, %rax
	jbe	LBB0_5
## %bb.4:
	subl	%r13d, %eax
	incl	%eax
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_mbedtls_mpi_shift_r
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
LBB0_5:
	decq	%r13
	movq	%r14, %rdi
	movq	%r13, %rsi
	movl	$1, %edx
	callq	_mbedtls_mpi_set_bit
	movq	(%r14), %rax
	movl	(%rax), %ecx
	movl	%ecx, %edx
	orl	$1, %edx
	movl	%edx, (%rax)
	testl	%r12d, %r12d
	je	LBB0_6
## %bb.10:
	orl	$3, %ecx
	movl	%ecx, (%rax)
	leaq	-52(%rbp), %rdi
	movq	%r14, %rsi
	movl	$3, %edx
	callq	_mbedtls_mpi_mod_int
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movl	-52(%rbp), %eax
	testl	%eax, %eax
	je	LBB0_11
## %bb.12:
	cmpl	$1, %eax
	jne	LBB0_15
## %bb.13:
	movl	$4, %edx
	jmp	LBB0_14
LBB0_2:
	movq	_MBEDTLS_ERR_MPI_BAD_INPUT_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_22
LBB0_6:
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_mbedtls_mpi_is_prime
	testl	%eax, %eax
	je	LBB0_20
## %bb.7:
	movl	%eax, %ebx
	movq	_MBEDTLS_ERR_MPI_NOT_ACCEPTABLE@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	(%r12), %ebx
	jne	LBB0_21
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	%r14, %rdi
	movq	%r14, %rsi
	movl	$2, %edx
	callq	_mbedtls_mpi_add_int
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_mbedtls_mpi_is_prime
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_8
LBB0_20:
	xorl	%ebx, %ebx
LBB0_21:
	leaq	-64(%rbp), %rdi
	callq	_mbedtls_mpi_free
LBB0_22:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movl	$8, %edx
LBB0_14:
	movq	%r14, %rdi
	movq	%r14, %rsi
	callq	_mbedtls_mpi_add_int
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
LBB0_15:
	leaq	-64(%rbp), %r12
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_mbedtls_mpi_copy
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%r12, %rdi
	movl	$1, %esi
	callq	_mbedtls_mpi_shift_r
	movq	_MBEDTLS_ERR_MPI_NOT_ACCEPTABLE@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%r14, %rdi
	callq	_mpi_check_small_factors
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_23
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	%r12, %rdi
	callq	_mpi_check_small_factors
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_23
## %bb.18:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_mpi_miller_rabin
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_23
## %bb.19:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_mpi_miller_rabin
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_20
	.p2align	4, 0x90
LBB0_23:                                ##   in Loop: Header=BB0_16 Depth=1
	cmpl	(%r13), %ebx
	jne	LBB0_21
## %bb.24:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	%r14, %rdi
	movq	%r14, %rsi
	movl	$12, %edx
	callq	_mbedtls_mpi_add_int
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%r12, %rdi
	movq	%r12, %rsi
	movl	$6, %edx
	callq	_mbedtls_mpi_add_int
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_MBEDTLS_MPI_MAX_BITS,8,3       ## @MBEDTLS_MPI_MAX_BITS
	.comm	_MBEDTLS_ERR_MPI_BAD_INPUT_DATA,4,2 ## @MBEDTLS_ERR_MPI_BAD_INPUT_DATA
	.comm	_ciL,8,3                        ## @ciL
	.comm	_MBEDTLS_ERR_MPI_NOT_ACCEPTABLE,4,2 ## @MBEDTLS_ERR_MPI_NOT_ACCEPTABLE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mbedtls_mpi_gen_prime          ; -- Begin function mbedtls_mpi_gen_prime
	.p2align	2
_mbedtls_mpi_gen_prime:                 ; @mbedtls_mpi_gen_prime
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	cmp	x1, #3
	b.lo	LBB0_8
; %bb.1:
	mov	x23, x1
Lloh0:
	adrp	x8, _MBEDTLS_MPI_MAX_BITS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MBEDTLS_MPI_MAX_BITS@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x1
	b.lo	LBB0_8
; %bb.2:
	mov	x19, x4
	mov	x20, x3
	mov	x22, x2
	mov	x21, x0
	mov	x0, sp
	bl	_mbedtls_mpi_init
	mov	x0, x23
	bl	_BITS_TO_LIMBS
Lloh3:
	adrp	x8, _ciL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ciL@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	mul	x1, x8, x0
	mov	x0, x21
	mov	x2, x20
	mov	x3, x19
	bl	_mbedtls_mpi_fill_random
	bl	_MBEDTLS_MPI_CHK
	mov	x0, x21
	bl	_mbedtls_mpi_bitlen
	cmp	x0, x23
	b.ls	LBB0_4
; %bb.3:
	sub	w8, w0, w23
	add	w1, w8, #1
	mov	x0, x21
	bl	_mbedtls_mpi_shift_r
	bl	_MBEDTLS_MPI_CHK
LBB0_4:
	sub	x1, x23, #1
	mov	x0, x21
	mov	w2, #1
	bl	_mbedtls_mpi_set_bit
	ldr	x8, [x21]
	ldr	w9, [x8]
	orr	w10, w9, #0x1
	str	w10, [x8]
	cbz	w22, LBB0_9
; %bb.5:
	orr	w9, w9, #0x3
	str	w9, [x8]
	add	x0, sp, #12
	mov	x1, x21
	mov	w2, #3
	bl	_mbedtls_mpi_mod_int
	bl	_MBEDTLS_MPI_CHK
	ldr	w8, [sp, #12]
	cbz	w8, LBB0_15
; %bb.6:
	cmp	w8, #1
	b.ne	LBB0_17
; %bb.7:
	mov	w2, #4
	b	LBB0_16
LBB0_8:
Lloh6:
	adrp	x8, _MBEDTLS_ERR_MPI_BAD_INPUT_DATA@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MBEDTLS_ERR_MPI_BAD_INPUT_DATA@GOTPAGEOFF]
Lloh8:
	ldr	w22, [x8]
	b	LBB0_14
LBB0_9:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_mbedtls_mpi_is_prime
	mov	x22, x0
	cbz	w0, LBB0_13
; %bb.10:
Lloh9:
	adrp	x23, _MBEDTLS_ERR_MPI_NOT_ACCEPTABLE@GOTPAGE
Lloh10:
	ldr	x23, [x23, _MBEDTLS_ERR_MPI_NOT_ACCEPTABLE@GOTPAGEOFF]
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x23]
	cmp	w22, w8
	b.ne	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x0, x21
	mov	x1, x21
	mov	w2, #2
	bl	_mbedtls_mpi_add_int
	bl	_MBEDTLS_MPI_CHK
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_mbedtls_mpi_is_prime
	mov	x22, x0
	cbnz	w0, LBB0_11
LBB0_13:
	mov	x0, sp
	bl	_mbedtls_mpi_free
LBB0_14:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_15:
	mov	w2, #8
LBB0_16:
	mov	x0, x21
	mov	x1, x21
	bl	_mbedtls_mpi_add_int
	bl	_MBEDTLS_MPI_CHK
LBB0_17:
	mov	x0, sp
	mov	x1, x21
	bl	_mbedtls_mpi_copy
	bl	_MBEDTLS_MPI_CHK
	mov	x0, sp
	mov	w1, #1
	bl	_mbedtls_mpi_shift_r
Lloh11:
	adrp	x23, _MBEDTLS_ERR_MPI_NOT_ACCEPTABLE@GOTPAGE
Lloh12:
	ldr	x23, [x23, _MBEDTLS_ERR_MPI_NOT_ACCEPTABLE@GOTPAGEOFF]
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	bl	_MBEDTLS_MPI_CHK
	mov	x0, x21
	bl	_mpi_check_small_factors
	mov	x22, x0
	cbnz	w0, LBB0_22
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=1
	mov	x0, sp
	bl	_mpi_check_small_factors
	mov	x22, x0
	cbnz	w0, LBB0_22
; %bb.20:                               ;   in Loop: Header=BB0_18 Depth=1
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_mpi_miller_rabin
	mov	x22, x0
	cbnz	w0, LBB0_22
; %bb.21:                               ;   in Loop: Header=BB0_18 Depth=1
	mov	x0, sp
	mov	x1, x20
	mov	x2, x19
	bl	_mpi_miller_rabin
	mov	x22, x0
	cbz	w0, LBB0_13
LBB0_22:                                ;   in Loop: Header=BB0_18 Depth=1
	ldr	w8, [x23]
	cmp	w22, w8
	b.ne	LBB0_13
; %bb.23:                               ;   in Loop: Header=BB0_18 Depth=1
	mov	x0, x21
	mov	x1, x21
	mov	w2, #12
	bl	_mbedtls_mpi_add_int
	bl	_MBEDTLS_MPI_CHK
	mov	x0, sp
	mov	x1, sp
	mov	w2, #6
	bl	_mbedtls_mpi_add_int
	b	LBB0_18
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_MBEDTLS_MPI_MAX_BITS,8,3       ; @MBEDTLS_MPI_MAX_BITS
	.comm	_MBEDTLS_ERR_MPI_BAD_INPUT_DATA,4,2 ; @MBEDTLS_ERR_MPI_BAD_INPUT_DATA
	.comm	_ciL,8,3                        ; @ciL
	.comm	_MBEDTLS_ERR_MPI_NOT_ACCEPTABLE,4,2 ; @MBEDTLS_ERR_MPI_NOT_ACCEPTABLE
.subsections_via_symbols
