	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hx509_ca_tbs_set_template      ## -- Begin function hx509_ca_tbs_set_template
	.p2align	4, 0x90
_hx509_ca_tbs_set_template:             ## @hx509_ca_tbs_set_template
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r15d
	movl	%edx, %r13d
	movq	%rsi, %r12
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movq	_HX509_CA_TEMPLATE_SUBJECT@GOTPCREL(%rip), %rax
	testl	%edx, (%rax)
	je	LBB0_5
## %bb.1:
	leaq	32(%r12), %rbx
	cmpq	$0, 32(%r12)
	je	LBB0_3
## %bb.2:
	movq	%rbx, %rdi
	callq	_hx509_name_free
LBB0_3:
	movl	%r15d, %edi
	movq	%rbx, %rsi
	callq	_hx509_cert_get_subject
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rcx
	jmp	LBB0_8
LBB0_5:
	movq	_HX509_CA_TEMPLATE_SERIAL@GOTPCREL(%rip), %rax
	testl	%r13d, (%rax)
	je	LBB0_9
## %bb.6:
	leaq	24(%r12), %rbx
	movq	%rbx, %rdi
	callq	_der_free_heim_integer
	movl	%r15d, %edi
	movq	%rbx, %rsi
	callq	_hx509_cert_get_serialnumber
	movl	%eax, %r14d
	xorl	%eax, %eax
	testl	%r14d, %r14d
	sete	%al
	movl	%eax, 4(%r12)
	je	LBB0_9
## %bb.7:
	leaq	L_.str.1(%rip), %rcx
LBB0_8:
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	xorl	%esi, %esi
	movl	%r14d, %edx
	callq	_hx509_set_error_string
LBB0_28:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	_HX509_CA_TEMPLATE_NOTBEFORE@GOTPCREL(%rip), %rax
	testl	%r13d, (%rax)
	je	LBB0_11
## %bb.10:
	movl	%r15d, %edi
	callq	_hx509_cert_get_notBefore
	movl	%eax, 20(%r12)
LBB0_11:
	movq	_HX509_CA_TEMPLATE_NOTAFTER@GOTPCREL(%rip), %rax
	testl	%r13d, (%rax)
	je	LBB0_13
## %bb.12:
	movl	%r15d, %edi
	callq	_hx509_cert_get_notAfter
	movl	%eax, 16(%r12)
LBB0_13:
	movq	_HX509_CA_TEMPLATE_SPKI@GOTPCREL(%rip), %rax
	testl	%r13d, (%rax)
	je	LBB0_15
## %bb.14:
	leaq	12(%r12), %rbx
	movq	%rbx, %rdi
	callq	_free_SubjectPublicKeyInfo
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%r15d, %esi
	movq	%rbx, %rdx
	callq	_hx509_cert_get_SPKI
	movl	%eax, %r14d
	xorl	%eax, %eax
	testl	%r14d, %r14d
	sete	%al
	movl	%eax, 8(%r12)
	jne	LBB0_28
LBB0_15:
	movq	_HX509_CA_TEMPLATE_KU@GOTPCREL(%rip), %rax
	testl	%r13d, (%rax)
	je	LBB0_18
## %bb.16:
	leaq	-64(%rbp), %rdx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%r15d, %esi
	callq	__hx509_cert_get_keyusage
	testl	%eax, %eax
	je	LBB0_17
## %bb.27:
	movl	%eax, %r14d
	jmp	LBB0_28
LBB0_17:
	movl	-64(%rbp), %edi
	callq	_KeyUsage2int
	movl	%eax, (%r12)
LBB0_18:
	movq	_HX509_CA_TEMPLATE_EKU@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	testl	%r13d, (%rax)
	je	LBB0_28
## %bb.19:
	leaq	-64(%rbp), %rdx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%r15d, %esi
	callq	__hx509_cert_get_eku
	movl	%eax, %r15d
	testl	%eax, %eax
	je	LBB0_20
LBB0_25:
	movl	%r15d, %r14d
	jmp	LBB0_28
LBB0_20:
	cmpq	$0, -64(%rbp)
	je	LBB0_26
## %bb.21:
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movq	-56(%rbp), %rdx
	addq	%r13, %rdx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movq	%r12, %rsi
	callq	_hx509_ca_tbs_add_eku
	testl	%eax, %eax
	jne	LBB0_24
## %bb.22:                              ##   in Loop: Header=BB0_23 Depth=1
	incq	%rbx
	addq	$4, %r13
	cmpq	-64(%rbp), %rbx
	jb	LBB0_23
LBB0_26:
	leaq	-64(%rbp), %rdi
	callq	_free_ExtKeyUsage
	jmp	LBB0_28
LBB0_24:
	movl	%eax, %r15d
	leaq	-64(%rbp), %rdi
	callq	_free_ExtKeyUsage
	jmp	LBB0_25
	.cfi_endproc
                                        ## -- End function
	.comm	_HX509_CA_TEMPLATE_SUBJECT,4,2  ## @HX509_CA_TEMPLATE_SUBJECT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get subject from template"

	.comm	_HX509_CA_TEMPLATE_SERIAL,4,2   ## @HX509_CA_TEMPLATE_SERIAL
L_.str.1:                               ## @.str.1
	.asciz	"Failed to copy serial number"

	.comm	_HX509_CA_TEMPLATE_NOTBEFORE,4,2 ## @HX509_CA_TEMPLATE_NOTBEFORE
	.comm	_HX509_CA_TEMPLATE_NOTAFTER,4,2 ## @HX509_CA_TEMPLATE_NOTAFTER
	.comm	_HX509_CA_TEMPLATE_SPKI,4,2     ## @HX509_CA_TEMPLATE_SPKI
	.comm	_HX509_CA_TEMPLATE_KU,4,2       ## @HX509_CA_TEMPLATE_KU
	.comm	_HX509_CA_TEMPLATE_EKU,4,2      ## @HX509_CA_TEMPLATE_EKU
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hx509_ca_tbs_set_template      ; -- Begin function hx509_ca_tbs_set_template
	.p2align	2
_hx509_ca_tbs_set_template:             ; @hx509_ca_tbs_set_template
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x21, x3
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _HX509_CA_TEMPLATE_SUBJECT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HX509_CA_TEMPLATE_SUBJECT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w2
	b.eq	LBB0_5
; %bb.1:
	mov	x23, x20
	ldr	x8, [x23, #32]!
	cbz	x8, LBB0_3
; %bb.2:
	mov	x0, x23
	bl	_hx509_name_free
LBB0_3:
	mov	x0, x21
	mov	x1, x23
	bl	_hx509_cert_get_subject
	cbz	w0, LBB0_5
; %bb.4:
	mov	x23, x0
Lloh3:
	adrp	x3, l_.str@PAGE
Lloh4:
	add	x3, x3, l_.str@PAGEOFF
	b	LBB0_8
LBB0_5:
Lloh5:
	adrp	x8, _HX509_CA_TEMPLATE_SERIAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _HX509_CA_TEMPLATE_SERIAL@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_10
; %bb.6:
	add	x23, x20, #24
	mov	x0, x23
	bl	_der_free_heim_integer
	mov	x0, x21
	mov	x1, x23
	bl	_hx509_cert_get_serialnumber
	cmp	w0, #0
	cset	w8, eq
	str	w8, [x20, #4]
	cbz	w0, LBB0_10
; %bb.7:
	mov	x23, x0
Lloh8:
	adrp	x3, l_.str.1@PAGE
Lloh9:
	add	x3, x3, l_.str.1@PAGEOFF
LBB0_8:
	mov	x0, x19
	mov	w1, #0
	mov	x2, x23
	bl	_hx509_set_error_string
LBB0_9:
	mov	x0, x23
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_10:
Lloh10:
	adrp	x8, _HX509_CA_TEMPLATE_NOTBEFORE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _HX509_CA_TEMPLATE_NOTBEFORE@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_12
; %bb.11:
	mov	x0, x21
	bl	_hx509_cert_get_notBefore
	str	w0, [x20, #20]
LBB0_12:
Lloh13:
	adrp	x8, _HX509_CA_TEMPLATE_NOTAFTER@GOTPAGE
Lloh14:
	ldr	x8, [x8, _HX509_CA_TEMPLATE_NOTAFTER@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_14
; %bb.13:
	mov	x0, x21
	bl	_hx509_cert_get_notAfter
	str	w0, [x20, #16]
LBB0_14:
Lloh16:
	adrp	x8, _HX509_CA_TEMPLATE_SPKI@GOTPAGE
Lloh17:
	ldr	x8, [x8, _HX509_CA_TEMPLATE_SPKI@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_16
; %bb.15:
	add	x23, x20, #12
	mov	x0, x23
	bl	_free_SubjectPublicKeyInfo
	mov	x0, x19
	mov	x1, x21
	mov	x2, x23
	bl	_hx509_cert_get_SPKI
	mov	x23, x0
	cmp	w0, #0
	cset	w8, eq
	str	w8, [x20, #8]
	cbnz	w0, LBB0_9
LBB0_16:
Lloh19:
	adrp	x8, _HX509_CA_TEMPLATE_KU@GOTPAGE
Lloh20:
	ldr	x8, [x8, _HX509_CA_TEMPLATE_KU@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_20
; %bb.17:
	mov	x2, sp
	mov	x0, x19
	mov	x1, x21
	bl	__hx509_cert_get_keyusage
	cbz	w0, LBB0_19
; %bb.18:
	mov	x23, x0
	b	LBB0_9
LBB0_19:
	ldr	w0, [sp]
	bl	_KeyUsage2int
	str	w0, [x20]
LBB0_20:
Lloh22:
	adrp	x8, _HX509_CA_TEMPLATE_EKU@GOTPAGE
Lloh23:
	ldr	x8, [x8, _HX509_CA_TEMPLATE_EKU@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_27
; %bb.21:
	mov	x2, sp
	mov	x0, x19
	mov	x1, x21
	bl	__hx509_cert_get_eku
	mov	x23, x0
	cbnz	w0, LBB0_9
; %bb.22:
	ldr	x8, [sp]
	cbz	x8, LBB0_26
; %bb.23:
	mov	x21, #0
	mov	x22, #0
LBB0_24:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [sp, #8]
	add	x2, x8, x21
	mov	x0, x19
	mov	x1, x20
	bl	_hx509_ca_tbs_add_eku
	cbnz	w0, LBB0_28
; %bb.25:                               ;   in Loop: Header=BB0_24 Depth=1
	add	x22, x22, #1
	ldr	x8, [sp]
	add	x21, x21, #4
	cmp	x22, x8
	b.lo	LBB0_24
LBB0_26:
	mov	x0, sp
	bl	_free_ExtKeyUsage
LBB0_27:
	mov	w23, #0
	b	LBB0_9
LBB0_28:
	mov	x23, x0
	mov	x0, sp
	bl	_free_ExtKeyUsage
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_HX509_CA_TEMPLATE_SUBJECT,4,2  ; @HX509_CA_TEMPLATE_SUBJECT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get subject from template"

	.comm	_HX509_CA_TEMPLATE_SERIAL,4,2   ; @HX509_CA_TEMPLATE_SERIAL
l_.str.1:                               ; @.str.1
	.asciz	"Failed to copy serial number"

	.comm	_HX509_CA_TEMPLATE_NOTBEFORE,4,2 ; @HX509_CA_TEMPLATE_NOTBEFORE
	.comm	_HX509_CA_TEMPLATE_NOTAFTER,4,2 ; @HX509_CA_TEMPLATE_NOTAFTER
	.comm	_HX509_CA_TEMPLATE_SPKI,4,2     ; @HX509_CA_TEMPLATE_SPKI
	.comm	_HX509_CA_TEMPLATE_KU,4,2       ; @HX509_CA_TEMPLATE_KU
	.comm	_HX509_CA_TEMPLATE_EKU,4,2      ; @HX509_CA_TEMPLATE_EKU
.subsections_via_symbols
