	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__hx509_public_encrypt          ## -- Begin function _hx509_public_encrypt
	.p2align	4, 0x90
__hx509_public_encrypt:                 ## @_hx509_public_encrypt
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r12
	movq	%rcx, %r14
	movq	%rsi, %r13
	movl	%edi, %ebx
	movq	$0, (%r8)
	movl	$0, 8(%r8)
	movq	(%rdx), %rax
	movq	%rax, -72(%rbp)
	movl	8(%rdx), %eax
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$3, %ecx
	movslq	%ecx, %rdx
	leaq	-72(%rbp), %rsi
	xorl	%edi, %edi
	callq	_d2i_RSAPublicKey
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r15
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movq	%rax, %rdi
	callq	_RSA_size
	movl	%eax, %r14d
	movl	%eax, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r13
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %edi
	movq	(%rax), %rsi
	movq	_RSA_PKCS1_PADDING@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r13, %rdx
	movq	%r15, %rcx
	callq	_RSA_public_encrypt
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_RSA_free
	testl	%ebx, %ebx
	jle	LBB0_5
## %bb.6:
	cmpl	%r14d, %ebx
	jle	LBB0_8
## %bb.7:
	leaq	L_.str.2(%rip), %rdi
	callq	__hx509_abort
LBB0_8:
	movl	%ebx, 8(%r12)
	movq	%r13, (%r12)
	movq	_ASN1_OID_ID_PKCS1_RSAENCRYPTION@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_der_copy_oid
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:
	movq	%r12, %rdi
	callq	_der_free_octet_string
	jmp	LBB0_11
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	leaq	L_.str(%rip), %rcx
	movl	%ebx, %edi
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	_hx509_set_error_string
	movl	(%r14), %eax
	jmp	LBB0_12
LBB0_3:
	movq	%r15, %rdi
	callq	_RSA_free
LBB0_11:
	movq	_ENOMEM@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	leaq	L_.str(%rip), %rcx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	_hx509_set_error_string
	movl	(%rbx), %eax
	jmp	LBB0_12
LBB0_5:
	movq	%r13, %rdi
	callq	_free
	movq	_HX509_CRYPTO_RSA_PUBLIC_ENCRYPT@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	leaq	L_.str.1(%rip), %rcx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	xorl	%esi, %esi
	movl	%ebx, %r8d
	xorl	%eax, %eax
	callq	_hx509_set_error_string
	movl	(%r14), %eax
	jmp	LBB0_12
LBB0_9:
	xorl	%eax, %eax
LBB0_12:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"out of memory"

	.comm	_RSA_PKCS1_PADDING,4,2          ## @RSA_PKCS1_PADDING
	.comm	_HX509_CRYPTO_RSA_PUBLIC_ENCRYPT,4,2 ## @HX509_CRYPTO_RSA_PUBLIC_ENCRYPT
L_.str.1:                               ## @.str.1
	.asciz	"RSA public encrypt failed with %d"

L_.str.2:                               ## @.str.2
	.asciz	"internal rsa decryption failure: ret > tosize"

	.comm	_ASN1_OID_ID_PKCS1_RSAENCRYPTION,4,2 ## @ASN1_OID_ID_PKCS1_RSAENCRYPTION
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__hx509_public_encrypt          ; -- Begin function _hx509_public_encrypt
	.p2align	2
__hx509_public_encrypt:                 ; @_hx509_public_encrypt
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x4
	mov	x21, x3
	mov	x22, x1
	mov	x19, x0
	str	xzr, [x4]
	str	wzr, [x4, #8]
	ldr	x8, [x2]
	str	x8, [sp, #8]
	ldr	w8, [x2, #8]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	sbfx	x2, x8, #3, #29
	add	x1, sp, #8
	mov	x0, #0
	bl	_d2i_RSAPublicKey
	cbz	x0, LBB0_8
; %bb.1:
	mov	x24, x0
	bl	_RSA_size
	mov	x25, x0
	bl	_malloc
	cbz	x0, LBB0_7
; %bb.2:
	mov	x23, x0
	ldr	w0, [x22, #8]
	ldr	x1, [x22]
Lloh0:
	adrp	x8, _RSA_PKCS1_PADDING@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RSA_PKCS1_PADDING@GOTPAGEOFF]
Lloh2:
	ldr	w4, [x8]
	mov	x2, x23
	mov	x3, x24
	bl	_RSA_public_encrypt
	mov	x22, x0
	mov	x0, x24
	bl	_RSA_free
	cmp	w22, #0
	b.le	LBB0_11
; %bb.3:
	cmp	w22, w25
	b.le	LBB0_5
; %bb.4:
Lloh3:
	adrp	x0, l_.str.2@PAGE
Lloh4:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	__hx509_abort
LBB0_5:
	str	w22, [x20, #8]
	str	x23, [x20]
Lloh5:
	adrp	x8, _ASN1_OID_ID_PKCS1_RSAENCRYPTION@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ASN1_OID_ID_PKCS1_RSAENCRYPTION@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	mov	x1, x21
	bl	_der_copy_oid
	cbz	w0, LBB0_10
; %bb.6:
	mov	x0, x20
	bl	_der_free_octet_string
	b	LBB0_8
LBB0_7:
	mov	x0, x24
	bl	_RSA_free
LBB0_8:
Lloh8:
	adrp	x20, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x20, [x20, _ENOMEM@GOTPAGEOFF]
	ldr	w2, [x20]
Lloh10:
	adrp	x3, l_.str@PAGE
Lloh11:
	add	x3, x3, l_.str@PAGEOFF
LBB0_9:
	mov	x0, x19
	mov	w1, #0
	bl	_hx509_set_error_string
	ldr	w0, [x20]
LBB0_10:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_11:
	mov	x0, x23
	bl	_free
Lloh12:
	adrp	x20, _HX509_CRYPTO_RSA_PUBLIC_ENCRYPT@GOTPAGE
Lloh13:
	ldr	x20, [x20, _HX509_CRYPTO_RSA_PUBLIC_ENCRYPT@GOTPAGEOFF]
	ldr	w2, [x20]
	str	x22, [sp]
Lloh14:
	adrp	x3, l_.str.1@PAGE
Lloh15:
	add	x3, x3, l_.str.1@PAGEOFF
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"out of memory"

	.comm	_RSA_PKCS1_PADDING,4,2          ; @RSA_PKCS1_PADDING
	.comm	_HX509_CRYPTO_RSA_PUBLIC_ENCRYPT,4,2 ; @HX509_CRYPTO_RSA_PUBLIC_ENCRYPT
l_.str.1:                               ; @.str.1
	.asciz	"RSA public encrypt failed with %d"

l_.str.2:                               ; @.str.2
	.asciz	"internal rsa decryption failure: ret > tosize"

	.comm	_ASN1_OID_ID_PKCS1_RSAENCRYPTION,4,2 ; @ASN1_OID_ID_PKCS1_RSAENCRYPTION
.subsections_via_symbols
