	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_crypto_bignum_legendre         ## -- Begin function crypto_bignum_legendre
	.p2align	4, 0x90
_crypto_bignum_legendre:                ## @crypto_bignum_legendre
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r15
	xorl	%eax, %eax
	callq	_TEST_FAIL
	movl	$-2, %ebx
	testq	%rax, %rax
	jne	LBB0_11
## %bb.1:
	xorl	%eax, %eax
	callq	_BN_CTX_new
	testq	%rax, %rax
	je	LBB0_11
## %bb.2:
	movq	%rax, %r14
	xorl	%eax, %eax
	callq	_BN_new
	movq	%rax, %r12
	xorl	%eax, %eax
	callq	_BN_new
	movq	%rax, %rdi
	movl	$-2, %ebx
	testq	%r12, %r12
	je	LBB0_10
## %bb.3:
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.4:
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	callq	_BN_value_one
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	%eax, %edx
	callq	_BN_sub
	testl	%eax, %eax
	je	LBB0_9
## %bb.5:
	movq	%r12, %rdi
	movq	%r12, %rsi
	callq	_BN_rshift1
	testl	%eax, %eax
	je	LBB0_9
## %bb.6:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	movq	%r14, %r8
	xorl	%r9d, %r9d
	callq	_BN_mod_exp_mont_consttime
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	testl	%eax, %eax
	je	LBB0_10
## %bb.7:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, %esi
	callq	_BN_is_word
	movl	%eax, %edi
	movl	$1, %esi
	callq	_const_time_eq
	movl	%eax, %edi
	movl	$1, %esi
	movl	$-1, %edx
	callq	_const_time_select_int
	movl	%eax, %ebx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_BN_is_zero
	movl	%eax, %edi
	movl	$1, %esi
	callq	_const_time_eq
	movl	%eax, %edi
	xorl	%esi, %esi
	movl	%ebx, %edx
	callq	_const_time_select_int
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %ebx
	jmp	LBB0_10
LBB0_9:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
LBB0_10:
	callq	_BN_clear_free
	movq	%r12, %rdi
	callq	_BN_clear_free
	movq	%r14, %rdi
	callq	_BN_CTX_free
LBB0_11:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_crypto_bignum_legendre         ; -- Begin function crypto_bignum_legendre
	.p2align	2
_crypto_bignum_legendre:                ; @crypto_bignum_legendre
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x22, x1
	mov	x23, x0
	bl	_TEST_FAIL
	cbz	x0, LBB0_2
LBB0_1:
	mov	w24, #-2
	b	LBB0_11
LBB0_2:
	bl	_BN_CTX_new
	cbz	x0, LBB0_1
; %bb.3:
	mov	x19, x0
	bl	_BN_new
	mov	x20, x0
	bl	_BN_new
	mov	x21, x0
	mov	w24, #-2
	cbz	x20, LBB0_10
; %bb.4:
	cbz	x21, LBB0_10
; %bb.5:
	bl	_BN_value_one
	mov	x2, x0
	mov	x0, x20
	mov	x1, x22
	bl	_BN_sub
	cbz	w0, LBB0_9
; %bb.6:
	mov	x0, x20
	mov	x1, x20
	bl	_BN_rshift1
	cbz	w0, LBB0_9
; %bb.7:
	mov	x0, x21
	mov	x1, x23
	mov	x2, x20
	mov	x3, x22
	mov	x4, x19
	mov	x5, #0
	bl	_BN_mod_exp_mont_consttime
	cbz	w0, LBB0_9
; %bb.8:
	mov	x0, x21
	mov	w1, #1
	bl	_BN_is_word
	mov	w1, #1
	bl	_const_time_eq
	mov	w1, #1
	mov	w2, #-1
	bl	_const_time_select_int
	mov	x22, x0
	mov	x0, x21
	bl	_BN_is_zero
	mov	w1, #1
	bl	_const_time_eq
	mov	w1, #0
	mov	x2, x22
	bl	_const_time_select_int
	mov	x24, x0
	b	LBB0_10
LBB0_9:
	mov	w24, #-2
LBB0_10:
	mov	x0, x21
	bl	_BN_clear_free
	mov	x0, x20
	bl	_BN_clear_free
	mov	x0, x19
	bl	_BN_CTX_free
LBB0_11:
	mov	x0, x24
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
