	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sm2_sign                       ## -- Begin function sm2_sign
	.p2align	4, 0x90
_sm2_sign:                              ## @sm2_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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %rbx
	movq	%rcx, %r15
	movq	%rdx, -40(%rbp)
	xorl	%edx, %edx
	callq	_BN_bin2bn
	movq	%rax, %r12
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_sm2_sig_gen
	movq	%rax, %r14
	leaq	-40(%rbp), %rsi
	movq	%rax, %rdi
	callq	_i2d_ECDSA_SIG
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movl	%eax, (%r15)
	movl	$1, %ebx
	jmp	LBB0_5
LBB0_1:
	movq	_SM2_F_SM2_SIGN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_ERR_R_BN_LIB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_SM2err
	movl	$-1, %ebx
	xorl	%r14d, %r14d
	jmp	LBB0_5
LBB0_3:
	movq	_SM2_F_SM2_SIGN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_ERR_R_INTERNAL_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_SM2err
	movl	$-1, %ebx
LBB0_5:
	movq	%r14, %rdi
	callq	_ECDSA_SIG_free
	movq	%r12, %rdi
	callq	_BN_free
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SM2_F_SM2_SIGN,4,2             ## @SM2_F_SM2_SIGN
	.comm	_ERR_R_BN_LIB,4,2               ## @ERR_R_BN_LIB
	.comm	_ERR_R_INTERNAL_ERROR,4,2       ## @ERR_R_INTERNAL_ERROR
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sm2_sign                       ; -- Begin function sm2_sign
	.p2align	2
_sm2_sign:                              ; @sm2_sign
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x4
	mov	x21, x3
	str	x2, [sp, #8]
	mov	x2, #0
	bl	_BN_bin2bn
	mov	x19, x0
	cbz	x0, LBB0_3
; %bb.1:
	mov	x0, x20
	mov	x1, x19
	bl	_sm2_sig_gen
	mov	x20, x0
	add	x1, sp, #8
	bl	_i2d_ECDSA_SIG
	tbnz	w0, #31, LBB0_4
; %bb.2:
	str	w0, [x21]
	mov	w21, #1
	b	LBB0_6
LBB0_3:
Lloh0:
	adrp	x8, _SM2_F_SM2_SIGN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SM2_F_SM2_SIGN@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _ERR_R_BN_LIB@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ERR_R_BN_LIB@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_SM2err
	mov	x20, #0
	b	LBB0_5
LBB0_4:
Lloh6:
	adrp	x8, _SM2_F_SM2_SIGN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SM2_F_SM2_SIGN@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
Lloh9:
	adrp	x8, _ERR_R_INTERNAL_ERROR@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ERR_R_INTERNAL_ERROR@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	bl	_SM2err
LBB0_5:
	mov	w21, #-1
LBB0_6:
	mov	x0, x20
	bl	_ECDSA_SIG_free
	mov	x0, x19
	bl	_BN_free
	mov	x0, x21
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_SM2_F_SM2_SIGN,4,2             ; @SM2_F_SM2_SIGN
	.comm	_ERR_R_BN_LIB,4,2               ; @ERR_R_BN_LIB
	.comm	_ERR_R_INTERNAL_ERROR,4,2       ; @ERR_R_INTERNAL_ERROR
.subsections_via_symbols
