	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function chacha20_cipher
_chacha20_cipher:                       ## @chacha20_cipher
	.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
	movq	%rcx, %rbx
	movq	%rsi, %r10
	movq	%rdi, %r11
	movl	(%rdi), %r9d
	testq	%r9, %r9
	je	LBB0_12
## %bb.1:
	movq	_CHACHA_BLK_SIZE@GOTPCREL(%rip), %r8
	testq	%rbx, %rbx
	je	LBB0_7
## %bb.2:
	cmpl	(%r8), %r9d
	jae	LBB0_7
## %bb.3:
	movq	%r10, %r14
	leaq	(,%r9,4), %r10
	leaq	-1(%rbx), %r15
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movzbl	(%rdx,%rdi), %ecx
	movq	8(%r11), %rax
	addq	%r10, %rax
	xorb	(%rax,%rdi,4), %cl
	movb	%cl, (%r14,%rdi)
	leaq	1(%rdi), %rcx
	cmpq	%rdi, %r15
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	leaq	(%r9,%rdi), %rax
	incq	%rax
	movl	(%r8), %esi
	movq	%rcx, %rdi
	cmpq	%rsi, %rax
	jb	LBB0_4
LBB0_6:
	addl	%ecx, %r9d
	movq	%r14, %r10
	addq	%rcx, %r10
	subq	%rcx, %rbx
	addq	%rcx, %rdx
LBB0_7:
	movl	%r9d, (%r11)
	testq	%rbx, %rbx
	je	LBB0_32
## %bb.8:
	cmpl	(%r8), %r9d
	jne	LBB0_12
## %bb.9:
	movl	$0, (%r11)
	movq	16(%r11), %rax
	incl	(%rax)
	movq	%rdx, %r14
	jne	LBB0_13
## %bb.10:
	incl	4(%rax)
	jmp	LBB0_13
LBB0_12:
	movq	%rdx, %r14
LBB0_13:
	movq	_CHACHA_BLK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rax
	shrq	$32, %rax
	je	LBB0_15
## %bb.14:
	movq	%rbx, %rax
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_16
LBB0_15:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_16:
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	subq	%rdx, %rbx
	cmpq	%rcx, %rbx
	jae	LBB0_20
LBB0_17:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_32
## %bb.18:
	movq	%r14, %r12
	movq	%r10, %r15
	movq	8(%r11), %rdi
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	movl	$8, %edx
	movq	%r11, %r13
	callq	_memset
	movq	_CHACHA_BLK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	24(%r13), %ecx
	movq	8(%r13), %rdi
	movq	%r13, %r14
	movq	16(%r13), %r8
	movq	%rdi, %rsi
	callq	_ChaCha20_ctr32
	movq	-48(%rbp), %r8                  ## 8-byte Reload
	movl	$1, %eax
	cmpq	$2, %r8
	cmovaeq	%r8, %rax
	jae	LBB0_27
## %bb.19:
	movq	%r14, %rdi
	jmp	LBB0_29
LBB0_20:
	movq	16(%r11), %r8
	movl	(%r8), %r15d
	jmp	LBB0_22
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_22 Depth=1
	addq	%r13, %r14
	addq	%r13, %r12
	movq	_CHACHA_BLK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	cmpq	%rcx, %rbx
	movq	%r12, %r10
	jb	LBB0_17
LBB0_22:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rax
	shrq	$32, %rax
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_24
## %bb.23:                              ##   in Loop: Header=BB0_22 Depth=1
	movq	%rbx, %rax
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %r13
	jmp	LBB0_25
	.p2align	4, 0x90
LBB0_24:                                ##   in Loop: Header=BB0_22 Depth=1
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %r13d
LBB0_25:                                ##   in Loop: Header=BB0_22 Depth=1
	cmpq	$268435456, %r13                ## imm = 0x10000000
	movl	$268435456, %eax                ## imm = 0x10000000
	cmovaeq	%rax, %r13
	movl	%r15d, %eax
	addl	%r13d, %eax
	cmpq	%rax, %r13
	movl	$0, %edx
	cmovaq	%rax, %rdx
	movl	%eax, %r15d
	movl	$0, %eax
	cmoval	%eax, %r15d
	subq	%rdx, %r13
	imulq	%rcx, %r13
	movl	24(%r11), %ecx
	movq	%r10, %rdi
	movq	%r14, %rsi
	movl	%r13d, %edx
	movq	%r11, %rbx
	movq	%r10, %r12
	callq	_ChaCha20_ctr32
	movq	%rbx, %r11
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	subq	%r13, %rbx
	movq	16(%r11), %r8
	movl	%r15d, (%r8)
	testl	%r15d, %r15d
	jne	LBB0_21
## %bb.26:                              ##   in Loop: Header=BB0_22 Depth=1
	incl	4(%r8)
	jmp	LBB0_21
LBB0_27:
	movl	%eax, %ecx
	andl	$-2, %ecx
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	.p2align	4, 0x90
LBB0_28:                                ## =>This Inner Loop Header: Depth=1
	movzbl	(%r12,%rbx), %edx
	movq	8(%rdi), %rsi
	xorb	(%rsi,%rbx,4), %dl
	movb	%dl, (%r15,%rbx)
	movzbl	1(%r12,%rbx), %edx
	movq	8(%rdi), %rsi
	xorb	4(%rsi,%rbx,4), %dl
	movb	%dl, 1(%r15,%rbx)
	addq	$2, %rbx
	cmpq	%rcx, %rbx
	jne	LBB0_28
LBB0_29:
	testb	$1, %al
	je	LBB0_31
## %bb.30:
	movb	(%r12,%rbx), %al
	movq	8(%rdi), %rcx
	xorb	(%rcx,%rbx,4), %al
	movb	%al, (%r15,%rbx)
LBB0_31:
	movl	%r8d, (%rdi)
LBB0_32:
	movl	$1, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CHACHA_BLK_SIZE,4,2            ## @CHACHA_BLK_SIZE
	.no_dead_strip	_chacha20_cipher
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function chacha20_cipher
_chacha20_cipher:                       ; @chacha20_cipher
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	ldr	w8, [x0]
Lloh0:
	adrp	x23, _CHACHA_BLK_SIZE@GOTPAGE
Lloh1:
	ldr	x23, [x23, _CHACHA_BLK_SIZE@GOTPAGEOFF]
	cbz	w8, LBB0_11
; %bb.1:
	cbz	x3, LBB0_7
; %bb.2:
	ldr	w9, [x23]
	cmp	w8, w9
	b.hs	LBB0_7
; %bb.3:
	mov	x11, #0
	lsl	x9, x8, #2
	sub	x10, x3, #1
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldrb	w12, [x19, x11]
	ldr	x13, [x20, #8]
	add	x13, x13, x9
	ldr	w13, [x13, x11, lsl #2]
	eor	w12, w12, w13
	strb	w12, [x21, x11]
	add	x12, x11, #1
	cmp	x10, x11
	b.eq	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x11, x8, x11
	add	x13, x11, #1
	ldr	w14, [x23]
	mov	x11, x12
	cmp	x13, x14
	b.lo	LBB0_4
LBB0_6:
	add	w8, w8, w12
	add	x21, x21, x12
	sub	x3, x3, x12
	add	x19, x19, x12
LBB0_7:
	str	w8, [x20]
	cbz	x3, LBB0_16
; %bb.8:
	ldr	w9, [x23]
	cmp	w8, w9
	b.ne	LBB0_11
; %bb.9:
	str	wzr, [x20]
	ldr	x8, [x20, #16]
	ldr	w9, [x8]
	adds	w9, w9, #1
	str	w9, [x8]
	b.lo	LBB0_11
; %bb.10:
	ldr	w9, [x8, #4]
	add	w9, w9, #1
	str	w9, [x8, #4]
LBB0_11:
	ldr	w8, [x23]
	udiv	x9, x3, x8
	mul	x25, x9, x8
	sub	x24, x3, x25
	cmp	x25, x8
	b.hs	LBB0_17
LBB0_12:
	cbz	w24, LBB0_16
; %bb.13:
	ldr	x0, [x20, #8]
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	ldr	w2, [x23]
	ldr	w3, [x20, #24]
	ldp	x0, x4, [x20, #8]
	mov	x1, x0
	bl	_ChaCha20_ctr32
	mov	x8, #0
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldrb	w9, [x19, x8]
	ldr	x10, [x20, #8]
	ldr	w10, [x10, x8, lsl #2]
	eor	w9, w9, w10
	strb	w9, [x21, x8]
	add	x8, x8, #1
	cmp	x8, x24
	b.lo	LBB0_14
; %bb.15:
	str	w24, [x20]
LBB0_16:
	mov	w0, #1
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_17:
	ldr	x4, [x20, #16]
	ldr	w27, [x4]
	mov	w26, #268435456
	b	LBB0_19
LBB0_18:                                ;   in Loop: Header=BB0_19 Depth=1
	add	x19, x19, x22
	add	x21, x21, x22
	ldr	w8, [x23]
	cmp	x25, x8
	b.lo	LBB0_12
LBB0_19:                                ; =>This Inner Loop Header: Depth=1
	udiv	x9, x25, x8
	cmp	x9, x26
	csel	x9, x9, x26, lo
	add	w10, w27, w9
	cmp	x9, x10
	csel	w27, wzr, w10, hi
	csel	x10, x10, xzr, hi
	sub	x9, x9, x10
	mul	x22, x9, x8
	ldr	w3, [x20, #24]
	mov	x0, x21
	mov	x1, x19
	mov	x2, x22
	bl	_ChaCha20_ctr32
	sub	x25, x25, x22
	ldr	x4, [x20, #16]
	str	w27, [x4]
	cbnz	w27, LBB0_18
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=1
	ldr	w8, [x4, #4]
	add	w8, w8, #1
	str	w8, [x4, #4]
	b	LBB0_18
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_CHACHA_BLK_SIZE,4,2            ; @CHACHA_BLK_SIZE
	.no_dead_strip	_chacha20_cipher
.subsections_via_symbols
