	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_base64_encode                  ## -- Begin function base64_encode
	.p2align	4, 0x90
_base64_encode:                         ## @base64_encode
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rcx, %rcx
	je	LBB0_19
## %bb.1:
	movq	%rdx, %r8
	leaq	(,%rcx,8), %r9
	movabsq	$-6148914691236517205, %r10     ## imm = 0xAAAAAAAAAAAAAAAB
	movq	%r9, %rax
	mulq	%r10
	shrq	$2, %rdx
	leaq	(%rdx,%rdx), %rax
	leaq	(%rax,%rax,2), %rax
	subq	%rax, %r9
	cmpq	$4, %r9
	je	LBB0_4
## %bb.2:
	cmpq	$2, %r9
	jne	LBB0_5
## %bb.3:
	addq	$3, %rdx
LBB0_5:
	cmpq	%rdx, (%rsi)
	jbe	LBB0_6
LBB0_7:
	movq	%rcx, %rax
	mulq	%r10
	shrq	%rdx
	leaq	(%rdx,%rdx,2), %r9
	xorl	%r14d, %r14d
	testq	%r9, %r9
	jne	LBB0_9
## %bb.8:
	movq	%rdi, %r11
	cmpq	%rcx, %r14
	jb	LBB0_13
	jmp	LBB0_18
LBB0_4:
	addq	$2, %rdx
	cmpq	%rdx, (%rsi)
	ja	LBB0_7
LBB0_6:
	incq	%rdx
	movq	%rdx, (%rsi)
	movq	_POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_20
LBB0_9:
	movq	_base64_enc_map@GOTPCREL(%rip), %r10
	movq	%rdi, %r11
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movzbl	(%r8,%r14), %eax
	movzbl	1(%r8,%r14), %r13d
	movzbl	2(%r8,%r14), %r12d
	movq	(%r10), %r15
	movl	%eax, %edx
	andl	$-4, %edx
	movzbl	(%r15,%rdx,2), %edx
	movb	%dl, (%r11)
	movq	(%r10), %rdx
	shll	$4, %eax
	movq	%r13, %rbx
	shrq	$4, %rbx
	andl	$48, %eax
	orq	%rbx, %rax
	movzbl	(%rdx,%rax,8), %eax
	movb	%al, 1(%r11)
	movq	(%r10), %rax
	movq	%r12, %rdx
	shrq	$6, %rdx
	andl	$15, %r13d
	leaq	(%rdx,%r13,4), %rdx
	movzbl	(%rax,%rdx,8), %eax
	movb	%al, 2(%r11)
	movq	(%r10), %rax
	andl	$63, %r12d
	movzbl	(%rax,%r12,8), %eax
	movb	%al, 3(%r11)
	addq	$4, %r11
	addq	$3, %r14
	cmpq	%r9, %r14
	jb	LBB0_10
## %bb.11:
	addq	%r14, %r8
	cmpq	%rcx, %r14
	jae	LBB0_18
LBB0_13:
	movzbl	(%r8), %eax
	incq	%r14
	xorl	%r9d, %r9d
	cmpq	%rcx, %r14
	jae	LBB0_15
## %bb.14:
	movzbl	1(%r8), %r9d
LBB0_15:
	movl	%eax, %edx
	andl	$-4, %edx
	movq	_base64_enc_map@GOTPCREL(%rip), %r8
	movq	(%r8), %rbx
	movb	(%rbx,%rdx,2), %dl
	shll	$4, %eax
	movl	%r9d, %ebx
	shrq	$4, %rbx
	andl	$48, %eax
	orq	%rbx, %rax
	movb	%dl, (%r11)
	movq	(%r8), %rdx
	movb	(%rdx,%rax,8), %al
	movb	%al, 1(%r11)
	movb	$61, %al
	cmpq	%rcx, %r14
	jae	LBB0_17
## %bb.16:
	movq	(%r8), %rax
	shll	$2, %r9d
	andl	$60, %r9d
	movb	(%rax,%r9,8), %al
LBB0_17:
	movb	%al, 2(%r11)
	movb	$61, 3(%r11)
	addq	$4, %r11
LBB0_18:
	movq	%r11, %rax
	subq	%rdi, %rax
	movq	%rax, (%rsi)
	movb	$0, (%r11)
LBB0_19:
	xorl	%eax, %eax
LBB0_20:
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL,4,2 ## @POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL
	.comm	_base64_enc_map,8,3             ## @base64_enc_map
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_base64_encode                  ; -- Begin function base64_encode
	.p2align	2
_base64_encode:                         ; @base64_encode
	.cfi_startproc
; %bb.0:
	cbz	x3, LBB0_4
; %bb.1:
	lsl	x9, x3, #3
	mov	x8, #-6148914691236517206
	movk	x8, #43691
	umulh	x10, x9, x8
	lsr	x10, x10, #2
	mov	x11, #-6
	madd	x9, x10, x11, x9
	add	x11, x10, #2
	add	x12, x10, #3
	cmp	x9, #2
	csel	x10, x10, x12, ne
	cmp	x9, #4
	csel	x9, x11, x10, eq
	ldr	x10, [x1]
	cmp	x10, x9
	b.ls	LBB0_5
; %bb.2:
	umulh	x8, x3, x8
	lsr	x8, x8, #1
	adds	x10, x8, x8, lsl #1
	b.ne	LBB0_6
; %bb.3:
	mov	x8, #0
	mov	x9, x0
	cmp	x8, x3
	b.lo	LBB0_9
	b	LBB0_15
LBB0_4:
	mov	w0, #0
	ret
LBB0_5:
	add	x8, x9, #1
	str	x8, [x1]
Lloh0:
	adrp	x8, _POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	ret
LBB0_6:
	mov	x8, #0
Lloh3:
	adrp	x11, _base64_enc_map@GOTPAGE
Lloh4:
	ldr	x11, [x11, _base64_enc_map@GOTPAGEOFF]
	mov	x12, x0
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	add	x9, x2, x8
	ldrb	w13, [x9]
	ldrb	w14, [x9, #1]
	ldrb	w9, [x9, #2]
	ldr	x15, [x11]
	lsl	w16, w13, #1
	and	x16, x16, #0x1f8
	ldr	x15, [x15, x16]
	strb	w15, [x12]
	ldr	x15, [x11]
	lsl	w13, w13, #4
	and	x13, x13, #0x30
	orr	x13, x13, x14, lsr #4
	ldr	x13, [x15, x13, lsl #3]
	strb	w13, [x12, #1]
	ldr	x13, [x11]
	lsl	w14, w14, #2
	and	x14, x14, #0x3c
	orr	x14, x14, x9, lsr #6
	ldr	x13, [x13, x14, lsl #3]
	strb	w13, [x12, #2]
	ldr	x13, [x11]
	and	x9, x9, #0x3f
	ldr	x13, [x13, x9, lsl #3]
	add	x9, x12, #4
	strb	w13, [x12, #3]
	add	x8, x8, #3
	mov	x12, x9
	cmp	x8, x10
	b.lo	LBB0_7
; %bb.8:
	add	x2, x2, x8
	cmp	x8, x3
	b.hs	LBB0_15
LBB0_9:
	ldrb	w11, [x2]
	add	x8, x8, #1
	cmp	x8, x3
	b.hs	LBB0_11
; %bb.10:
	ldrb	w10, [x2, #1]
	b	LBB0_12
LBB0_11:
	mov	w10, #0
LBB0_12:
Lloh5:
	adrp	x12, _base64_enc_map@GOTPAGE
Lloh6:
	ldr	x12, [x12, _base64_enc_map@GOTPAGEOFF]
	ldr	x13, [x12]
	lsl	w14, w11, #1
	and	x14, x14, #0x1f8
	ldr	x13, [x13, x14]
	strb	w13, [x9]
	ldr	x13, [x12]
	lsl	w11, w11, #4
	mov	w14, w10
	and	x11, x11, #0x30
	orr	x11, x11, x14, lsr #4
	ldr	x11, [x13, x11, lsl #3]
	strb	w11, [x9, #1]
	mov	w11, #61
	mov	w13, #61
	cmp	x8, x3
	b.hs	LBB0_14
; %bb.13:
	ldr	x8, [x12]
	ubfiz	w10, w10, #2, #4
	ldr	x13, [x8, w10, uxtw #3]
LBB0_14:
	strb	w13, [x9, #2]
	strb	w11, [x9, #3]
	add	x9, x9, #4
LBB0_15:
	sub	x10, x9, x0
	str	x10, [x1]
	strb	wzr, [x9]
	mov	w0, #0
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL,4,2 ; @POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL
	.comm	_base64_enc_map,8,3             ; @base64_enc_map
.subsections_via_symbols
