	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mbedtls_ecdh_calc_secret       ## -- Begin function mbedtls_ecdh_calc_secret
	.p2align	4, 0x90
_mbedtls_ecdh_calc_secret:              ## @mbedtls_ecdh_calc_secret
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.3:
	movq	%rcx, %r12
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	addq	$4, %rdi
	leaq	12(%rbx), %rdx
	leaq	8(%rbx), %rcx
	movq	%rbx, %rsi
	callq	_mbedtls_ecdh_compute_shared
	testl	%eax, %eax
	jne	LBB0_2
## %bb.4:
	movq	%rbx, %rdi
	callq	_mbedtls_mpi_size
	cmpq	%r12, %rax
	jbe	LBB0_5
LBB0_1:
	movq	_MBEDTLS_ERR_ECP_BAD_INPUT_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_2:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	4(%rbx), %eax
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$3, %ecx
	andl	$7, %eax
	cmpl	$1, %eax
	sbbl	$-1, %ecx
	movslq	%ecx, %rdx
	movq	%rdx, (%r15)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mbedtls_mpi_write_binary       ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MBEDTLS_ERR_ECP_BAD_INPUT_DATA,4,2 ## @MBEDTLS_ERR_ECP_BAD_INPUT_DATA
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mbedtls_ecdh_calc_secret       ; -- Begin function mbedtls_ecdh_calc_secret
	.p2align	2
_mbedtls_ecdh_calc_secret:              ; @mbedtls_ecdh_calc_secret
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	cbz	x0, LBB0_3
; %bb.1:
	mov	x22, x3
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	add	x0, x0, #4
	add	x2, x20, #12
	add	x3, x20, #8
	mov	x1, x20
	bl	_mbedtls_ecdh_compute_shared
	cbnz	w0, LBB0_4
; %bb.2:
	mov	x0, x20
	bl	_mbedtls_mpi_size
	cmp	x0, x22
	b.ls	LBB0_5
LBB0_3:
Lloh0:
	adrp	x8, _MBEDTLS_ERR_ECP_BAD_INPUT_DATA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MBEDTLS_ERR_ECP_BAD_INPUT_DATA@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
LBB0_4:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_5:
	ldr	w8, [x20, #4]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w9, w9, w8, lt
	asr	w9, w9, #3
	tst	w8, #0x7
	cinc	w8, w9, ne
	sxtw	x2, w8
	str	x2, [x21]
	mov	x0, x20
	mov	x1, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_mbedtls_mpi_write_binary
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_MBEDTLS_ERR_ECP_BAD_INPUT_DATA,4,2 ; @MBEDTLS_ERR_ECP_BAD_INPUT_DATA
.subsections_via_symbols
