	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mbedtls_ecdsa_sign             ## -- Begin function mbedtls_ecdsa_sign
	.p2align	4, 0x90
_mbedtls_ecdsa_sign:                    ## @mbedtls_ecdsa_sign
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpq	$0, 8(%rdi)
	je	LBB0_1
## %bb.2:
	movq	%r9, %r14
	movq	%r8, %r12
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	%rdx, -88(%rbp)                 ## 8-byte Spill
	movq	%rcx, -96(%rbp)                 ## 8-byte Spill
	leaq	8(%rdi), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	leaq	-64(%rbp), %rdi
	callq	_mbedtls_ecp_point_init
	leaq	-56(%rbp), %rdi
	callq	_mbedtls_mpi_init
	leaq	-52(%rbp), %rdi
	callq	_mbedtls_mpi_init
	leaq	-48(%rbp), %rdi
	callq	_mbedtls_mpi_init
	xorl	%ebx, %ebx
	movq	%r14, -104(%rbp)                ## 8-byte Spill
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
                                        ##     Child Loop BB0_8 Depth 2
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movl	$12, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r15, %rdi
	leaq	-56(%rbp), %rsi
	leaq	-64(%rbp), %r14
	movq	%r14, %rdx
	movq	16(%rbp), %rcx
	movq	24(%rbp), %r8
	callq	_mbedtls_ecp_gen_keypair
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%r13, %rdi
	movq	%r14, %rsi
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	callq	_mbedtls_mpi_mod_mpi
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	decl	%ebx
	je	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=2
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_mbedtls_mpi_cmp_int
	testq	%rax, %rax
	je	LBB0_4
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	leaq	-52(%rbp), %rsi
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdx
	movq	-104(%rbp), %rcx                ## 8-byte Reload
	callq	_derive_mpi
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movl	$30, %r12d
	leaq	-48(%rbp), %rbx
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r15), %r14d
	leal	7(%r14), %eax
	addl	$14, %r14d
	testl	%eax, %eax
	cmovnsl	%eax, %r14d
	movl	%r14d, %eax
	sarl	$3, %eax
	movslq	%eax, %rsi
	movq	%rbx, %rdi
	movq	16(%rbp), %rdx
	movq	24(%rbp), %rcx
	callq	_mbedtls_mpi_fill_random
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	andl	$-8, %r14d
	subl	(%r15), %r14d
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_mbedtls_mpi_shift_r
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	subl	$1, %r12d
	jb	LBB0_14
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=2
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_mbedtls_mpi_cmp_int
	testq	%rax, %rax
	js	LBB0_8
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=2
	movq	%rbx, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_mbedtls_mpi_cmp_mpi
	testq	%rax, %rax
	jns	LBB0_8
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %r14
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	callq	_mbedtls_mpi_mul_mpi
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	leaq	-52(%rbp), %r12
	movq	%r12, %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	callq	_mbedtls_mpi_add_mpi
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%r12, %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	callq	_mbedtls_mpi_mul_mpi
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	leaq	-56(%rbp), %r14
	movq	%r14, %rdi
	movq	%r14, %rsi
	leaq	-48(%rbp), %rdx
	callq	_mbedtls_mpi_mul_mpi
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdx
	callq	_mbedtls_mpi_inv_mod
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%rbx, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	movq	%rbx, %r12
	callq	_mbedtls_mpi_mul_mpi
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movq	%rbx, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_mbedtls_mpi_mod_mpi
	movl	%eax, %edi
	callq	_MBEDTLS_MPI_CHK
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	cmpl	$11, %ebx
	je	LBB0_5
## %bb.12:                              ##   in Loop: Header=BB0_3 Depth=1
	incl	%ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_mbedtls_mpi_cmp_int
                                        ## implicit-def: $ecx
                                        ## kill: killed $ecx
	testq	%rax, %rax
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_3
	jmp	LBB0_13
LBB0_1:
	movq	_MBEDTLS_ERR_ECP_BAD_INPUT_DATA@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_5:
	movq	_MBEDTLS_ERR_ECP_RANDOM_FAILED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
LBB0_13:
	leaq	-64(%rbp), %rdi
	callq	_mbedtls_ecp_point_free
	leaq	-56(%rbp), %rdi
	callq	_mbedtls_mpi_free
	leaq	-52(%rbp), %rdi
	callq	_mbedtls_mpi_free
	leaq	-48(%rbp), %rdi
	callq	_mbedtls_mpi_free
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	jmp	LBB0_16
LBB0_14:
	movq	_MBEDTLS_ERR_ECP_RANDOM_FAILED@GOTPCREL(%rip), %rax
LBB0_15:
	movl	(%rax), %eax
LBB0_16:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MBEDTLS_ERR_ECP_BAD_INPUT_DATA,4,2 ## @MBEDTLS_ERR_ECP_BAD_INPUT_DATA
	.comm	_MBEDTLS_ERR_ECP_RANDOM_FAILED,4,2 ## @MBEDTLS_ERR_ECP_RANDOM_FAILED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mbedtls_ecdsa_sign             ; -- Begin function mbedtls_ecdsa_sign
	.p2align	2
_mbedtls_ecdsa_sign:                    ; @mbedtls_ecdsa_sign
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x27, x0
	ldr	x8, [x27, #8]!
	cbz	x8, LBB0_12
; %bb.1:
	mov	x19, x7
	mov	x20, x6
	mov	x21, x5
	mov	x22, x4
	mov	x24, x2
	mov	x25, x1
	mov	x26, x0
	str	x3, [sp, #16]                   ; 8-byte Folded Spill
	add	x0, sp, #40
	bl	_mbedtls_ecp_point_init
	add	x0, sp, #36
	bl	_mbedtls_mpi_init
	add	x0, sp, #32
	bl	_mbedtls_mpi_init
	add	x0, sp, #28
	bl	_mbedtls_mpi_init
	mov	w23, #0
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
                                        ;     Child Loop BB0_7 Depth 2
	mov	w28, #12
LBB0_3:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x1, sp, #36
	add	x2, sp, #40
	mov	x0, x26
	mov	x3, x20
	mov	x4, x19
	bl	_mbedtls_ecp_gen_keypair
	bl	_MBEDTLS_MPI_CHK
	add	x1, sp, #40
	mov	x0, x25
	mov	x2, x27
	bl	_mbedtls_mpi_mod_mpi
	bl	_MBEDTLS_MPI_CHK
	subs	w28, w28, #1
	b.eq	LBB0_13
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=2
	mov	x0, x25
	mov	w1, #0
	bl	_mbedtls_mpi_cmp_int
	cbz	x0, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x1, sp, #32
	mov	x0, x26
	mov	x2, x22
	str	x21, [sp, #8]                   ; 8-byte Folded Spill
	mov	x3, x21
	bl	_derive_mpi
	bl	_MBEDTLS_MPI_CHK
	mov	w28, #30
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=2
	sub	w28, w28, #1
LBB0_7:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w8, [x26]
	add	w9, w8, #7
	add	w8, w8, #14
	cmp	w9, #0
	csel	w21, w8, w9, lt
	sbfx	x1, x21, #3, #29
	add	x0, sp, #28
	mov	x2, x20
	mov	x3, x19
	bl	_mbedtls_mpi_fill_random
	bl	_MBEDTLS_MPI_CHK
	and	w8, w21, #0xfffffff8
	ldr	w9, [x26]
	sub	w1, w8, w9
	add	x0, sp, #28
	bl	_mbedtls_mpi_shift_r
	bl	_MBEDTLS_MPI_CHK
	cbz	w28, LBB0_15
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	add	x0, sp, #28
	mov	w1, #1
	bl	_mbedtls_mpi_cmp_int
	tbnz	x0, #63, LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=2
	add	x0, sp, #28
	mov	x1, x27
	bl	_mbedtls_mpi_cmp_mpi
	tbz	x0, #63, LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_2 Depth=1
	mov	x0, x24
	mov	x1, x25
	ldr	x2, [sp, #16]                   ; 8-byte Folded Reload
	bl	_mbedtls_mpi_mul_mpi
	bl	_MBEDTLS_MPI_CHK
	add	x0, sp, #32
	add	x1, sp, #32
	mov	x2, x24
	bl	_mbedtls_mpi_add_mpi
	bl	_MBEDTLS_MPI_CHK
	add	x0, sp, #32
	add	x1, sp, #32
	add	x2, sp, #28
	bl	_mbedtls_mpi_mul_mpi
	bl	_MBEDTLS_MPI_CHK
	add	x0, sp, #36
	add	x1, sp, #36
	add	x2, sp, #28
	bl	_mbedtls_mpi_mul_mpi
	bl	_MBEDTLS_MPI_CHK
	add	x1, sp, #36
	mov	x0, x24
	mov	x2, x27
	bl	_mbedtls_mpi_inv_mod
	bl	_MBEDTLS_MPI_CHK
	add	x2, sp, #32
	mov	x0, x24
	mov	x1, x24
	bl	_mbedtls_mpi_mul_mpi
	bl	_MBEDTLS_MPI_CHK
	mov	x0, x24
	mov	x1, x24
	mov	x2, x27
	bl	_mbedtls_mpi_mod_mpi
	bl	_MBEDTLS_MPI_CHK
	cmp	w23, #11
	b.eq	LBB0_13
; %bb.11:                               ;   in Loop: Header=BB0_2 Depth=1
	add	w23, w23, #1
	mov	x0, x24
	mov	w1, #0
	bl	_mbedtls_mpi_cmp_int
                                        ; implicit-def: $w28
	ldr	x21, [sp, #8]                   ; 8-byte Folded Reload
	cbz	x0, LBB0_2
	b	LBB0_14
LBB0_12:
Lloh0:
	adrp	x8, _MBEDTLS_ERR_ECP_BAD_INPUT_DATA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MBEDTLS_ERR_ECP_BAD_INPUT_DATA@GOTPAGEOFF]
	b	LBB0_16
LBB0_13:
Lloh2:
	adrp	x8, _MBEDTLS_ERR_ECP_RANDOM_FAILED@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MBEDTLS_ERR_ECP_RANDOM_FAILED@GOTPAGEOFF]
Lloh4:
	ldr	w28, [x8]
LBB0_14:
	add	x0, sp, #40
	bl	_mbedtls_ecp_point_free
	add	x0, sp, #36
	bl	_mbedtls_mpi_free
	add	x0, sp, #32
	bl	_mbedtls_mpi_free
	add	x0, sp, #28
	bl	_mbedtls_mpi_free
	b	LBB0_17
LBB0_15:
Lloh5:
	adrp	x8, _MBEDTLS_ERR_ECP_RANDOM_FAILED@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MBEDTLS_ERR_ECP_RANDOM_FAILED@GOTPAGEOFF]
LBB0_16:
	ldr	w28, [x8]
LBB0_17:
	mov	x0, x28
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_MBEDTLS_ERR_ECP_BAD_INPUT_DATA,4,2 ; @MBEDTLS_ERR_ECP_BAD_INPUT_DATA
	.comm	_MBEDTLS_ERR_ECP_RANDOM_FAILED,4,2 ; @MBEDTLS_ERR_ECP_RANDOM_FAILED
.subsections_via_symbols
