	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_generate_auth_token            ## -- Begin function generate_auth_token
	.p2align	4, 0x90
_generate_auth_token:                   ## @generate_auth_token
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, -120(%rbp)                ## 8-byte Spill
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	xorl	%eax, %eax
	callq	_gc_new
	movl	%eax, -88(%rbp)
	movq	_now@GOTPCREL(%rip), %rax
	movsbl	(%rax), %edi
	callq	_htonll
	movb	%al, -82(%rbp)
	movb	%al, -81(%rbp)
	movq	16(%r12), %r13
	movq	%r13, %rdi
	callq	_hmac_ctx_size
	xorl	%edi, %edi
	cmpl	$32, %eax
	sete	%dil
	callq	_ASSERT
	movq	%rsp, -136(%rbp)                ## 8-byte Spill
	movq	_AUTH_TOKEN_SESSION_ID_LEN@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	movq	%rax, -128(%rbp)                ## 8-byte Spill
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	movq	(%r12), %r14
	testq	%r14, %r14
	je	LBB0_2
## %bb.1:
	movq	_SESSION_ID_PREFIX@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_strlen
	cltq
	addq	%rax, %r14
	movl	(%rbx), %eax
	shll	$3, %eax
	cltq
	imulq	$715827883, %rax, %rax          ## imm = 0x2AAAAAAB
	movq	%rax, %rcx
	shrq	$63, %rcx
	shrq	$32, %rax
	addl	%ecx, %eax
	movslq	%eax, %rbx
	leaq	(%r14,%rbx), %rdi
	movb	$0, 12(%rbx,%r14)
	leaq	-80(%rbp), %rsi
	movl	$9, %edx
	callq	_openvpn_base64_decode
	xorl	%edi, %edi
	cmpl	$9, %eax
	sete	%dil
	callq	_ASSERT
	movb	-80(%rbp), %al
	movb	%al, -81(%rbp)
	movb	$0, (%rbx,%r14)
	movq	_AUTH_TOKEN_SESSION_ID_LEN@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_openvpn_base64_decode
	xorl	%edi, %edi
	cmpl	(%rbx), %eax
	sete	%dil
	callq	_ASSERT
	movq	(%r12), %rdi
	callq	_free
	jmp	LBB0_4
LBB0_2:
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_rand_bytes
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	movq	_M_FATAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_msg
LBB0_4:
	movq	%r13, %rdi
	callq	_hmac_ctx_reset
	movq	_AUTH_TOKEN_VALID_EMPTYUSER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r12)
	movq	%r12, -144(%rbp)                ## 8-byte Spill
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rdi
	xorl	%edx, %edx
	jmp	LBB0_7
LBB0_6:
	movq	-120(%rbp), %rax                ## 8-byte Reload
	movq	(%rax), %r14
	movq	%r14, %rdi
	callq	_strlen
	movq	%r13, %rdi
	movq	%r14, %rsi
	movl	%eax, %edx
LBB0_7:
	callq	_hmac_ctx_update
	movl	(%rbx), %edx
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_hmac_ctx_update
	leaq	-81(%rbp), %r12
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	$1, %edx
	callq	_hmac_ctx_update
	leaq	-82(%rbp), %rsi
	movq	%r13, %rdi
	movl	$1, %edx
	callq	_hmac_ctx_update
	leaq	-80(%rbp), %rsi
	movq	%r13, %rdi
	movq	%rsi, %r13
	callq	_hmac_ctx_final
	movl	(%rbx), %edi
	addl	$34, %edi
	leaq	-88(%rbp), %rsi
	callq	_alloc_buf_gc
	movl	%eax, -112(%rbp)
	leaq	-112(%rbp), %r14
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	-128(%rbp), %rdx                ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_buf_write
	movl	%eax, %edi
	callq	_ASSERT
	movq	%r14, %rdi
	movq	%r12, %rsi
	movl	$1, %edx
	callq	_buf_write
	movl	%eax, %edi
	callq	_ASSERT
	movq	%r14, %rdi
	leaq	-82(%rbp), %rsi
	movl	$1, %edx
	callq	_buf_write
	movl	%eax, %edi
	callq	_ASSERT
	movq	%r14, %rdi
	movq	%r13, %rsi
	movl	$32, %edx
	callq	_buf_write
	movl	%eax, %edi
	callq	_ASSERT
	movq	%r14, %rdi
	callq	_BPTR
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_BLEN
	leaq	-104(%rbp), %rdx
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_openvpn_base64_encode
	movq	_SESSION_ID_PREFIX@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	callq	_strlen
	movl	%eax, %ebx
	movq	-104(%rbp), %rdi
	callq	_strlen
                                        ## kill: def $eax killed $eax def $rax
	leal	(%rbx,%rax), %edi
	incl	%edi
	leaq	-88(%rbp), %r15
	movq	%r15, %rsi
	callq	_alloc_buf_gc
	movl	%eax, -96(%rbp)
	movq	(%r14), %rbx
	movq	%rbx, %rdi
	callq	_strlen
	leaq	-96(%rbp), %r14
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_buf_write
	movl	%eax, %edi
	callq	_ASSERT
	movq	-104(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_strlen
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_buf_write
	movl	%eax, %edi
	callq	_ASSERT
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_buf_write_u8
	movl	%eax, %edi
	callq	_ASSERT
	movq	-104(%rbp), %rdi
	callq	_free
	movq	%r14, %rdi
	callq	_BPTR
	movq	%rax, %rdi
	callq	_strdup
	movq	-144(%rbp), %rcx                ## 8-byte Reload
	movq	%rax, (%rcx)
	movq	_D_SHOW_KEYS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movq	-120(%rbp), %rcx                ## 8-byte Reload
	movq	(%rcx), %rcx
	leaq	L_.str.2(%rip), %rsi
	movq	%rax, %rdx
	callq	_dmsg
	movq	%r15, %rdi
	callq	_gc_free
	movq	-136(%rbp), %rsp                ## 8-byte Reload
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_9
## %bb.8:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_now,8,3                        ## @now
	.comm	_AUTH_TOKEN_SESSION_ID_LEN,4,2  ## @AUTH_TOKEN_SESSION_ID_LEN
	.comm	_SESSION_ID_PREFIX,8,3          ## @SESSION_ID_PREFIX
	.comm	_M_FATAL,4,2                    ## @M_FATAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get enough randomness for authentication token"

	.comm	_AUTH_TOKEN_VALID_EMPTYUSER,4,2 ## @AUTH_TOKEN_VALID_EMPTYUSER
L_.str.1:                               ## @.str.1
	.space	1

	.comm	_D_SHOW_KEYS,4,2                ## @D_SHOW_KEYS
L_.str.2:                               ## @.str.2
	.asciz	"Generated token for client: %s (%s)"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_generate_auth_token            ; -- Begin function generate_auth_token
	.p2align	2
_generate_auth_token:                   ; @generate_auth_token
	.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
	sub	sp, sp, #80
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	bl	_gc_new
	stur	w0, [x29, #-128]
Lloh3:
	adrp	x8, _now@GOTPAGE
Lloh4:
	ldr	x8, [x8, _now@GOTPAGEOFF]
Lloh5:
	ldrsb	w0, [x8]
	bl	_htonll
	sturb	w0, [x29, #-129]
	sturb	w0, [x29, #-130]
	ldr	x22, [x20, #16]
	mov	x0, x22
	bl	_hmac_ctx_size
	cmp	w0, #32
	cset	w0, eq
	bl	_ASSERT
	mov	x26, sp
Lloh6:
	adrp	x28, _AUTH_TOKEN_SESSION_ID_LEN@GOTPAGE
Lloh7:
	ldr	x28, [x28, _AUTH_TOKEN_SESSION_ID_LEN@GOTPAGEOFF]
	ldr	w21, [x28]
	mov	x9, x21
Lloh8:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh9:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	add	x9, x21, #15
	and	x9, x9, #0x1fffffff0
	sub	x23, x8, x9
	mov	sp, x23
	ldr	x24, [x20]
Lloh10:
	adrp	x27, _SESSION_ID_PREFIX@GOTPAGE
Lloh11:
	ldr	x27, [x27, _SESSION_ID_PREFIX@GOTPAGEOFF]
	cbz	x24, LBB0_2
; %bb.1:
	ldr	x0, [x27]
	bl	_strlen
	add	x24, x24, w0, sxtw
	ldr	w8, [x28]
	lsl	w8, w8, #3
	mov	w9, #43691
	movk	w9, #10922, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	lsr	x8, x8, #32
	add	w8, w8, w9
	add	x25, x24, w8, sxtw
	strb	wzr, [x25, #12]
	sub	x1, x29, #120
	mov	x0, x25
	mov	w2, #9
	bl	_openvpn_base64_decode
	cmp	w0, #9
	cset	w0, eq
	bl	_ASSERT
	ldurb	w8, [x29, #-120]
	sturb	w8, [x29, #-130]
	strb	wzr, [x25]
	ldr	w2, [x28]
	mov	x0, x24
	mov	x1, x23
	bl	_openvpn_base64_decode
	ldr	w8, [x28]
	cmp	w0, w8
	cset	w0, eq
	bl	_ASSERT
	ldr	x0, [x20]
	bl	_free
	b	LBB0_4
LBB0_2:
	ldr	w1, [x28]
	mov	x0, x23
	bl	_rand_bytes
	cbnz	w0, LBB0_4
; %bb.3:
Lloh12:
	adrp	x8, _M_FATAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _M_FATAL@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	bl	_msg
LBB0_4:
	mov	x0, x22
	bl	_hmac_ctx_reset
	ldr	w8, [x20, #8]
Lloh17:
	adrp	x9, _AUTH_TOKEN_VALID_EMPTYUSER@GOTPAGE
Lloh18:
	ldr	x9, [x9, _AUTH_TOKEN_VALID_EMPTYUSER@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.5:
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x22
	mov	w2, #0
	b	LBB0_7
LBB0_6:
	ldr	x24, [x19]
	mov	x0, x24
	bl	_strlen
	mov	x2, x0
	mov	x0, x22
	mov	x1, x24
LBB0_7:
	bl	_hmac_ctx_update
	ldr	w2, [x28]
	mov	x0, x22
	mov	x1, x23
	bl	_hmac_ctx_update
	sub	x1, x29, #130
	mov	x0, x22
	mov	w2, #1
	bl	_hmac_ctx_update
	sub	x1, x29, #129
	mov	x0, x22
	mov	w2, #1
	bl	_hmac_ctx_update
	sub	x1, x29, #120
	mov	x0, x22
	bl	_hmac_ctx_final
	ldr	w8, [x28]
	add	w0, w8, #34
	sub	x1, x29, #128
	bl	_alloc_buf_gc
	stur	w0, [x29, #-136]
	sub	x0, x29, #136
	mov	x1, x23
	mov	x2, x21
	bl	_buf_write
	bl	_ASSERT
	sub	x0, x29, #136
	sub	x1, x29, #130
	mov	w2, #1
	bl	_buf_write
	bl	_ASSERT
	sub	x0, x29, #136
	sub	x1, x29, #129
	mov	w2, #1
	bl	_buf_write
	bl	_ASSERT
	sub	x0, x29, #136
	sub	x1, x29, #120
	mov	w2, #32
	bl	_buf_write
	bl	_ASSERT
	sub	x0, x29, #136
	bl	_BPTR
	mov	x21, x0
	sub	x0, x29, #136
	bl	_BLEN
	mov	x1, x0
	sub	x2, x29, #144
	mov	x0, x21
	bl	_openvpn_base64_encode
	ldr	x0, [x27]
	bl	_strlen
	mov	x21, x0
	ldur	x0, [x29, #-144]
	bl	_strlen
	add	w8, w21, w0
	add	w0, w8, #1
	sub	x1, x29, #128
	bl	_alloc_buf_gc
	stur	w0, [x29, #-152]
	ldr	x21, [x27]
	mov	x0, x21
	bl	_strlen
	mov	x2, x0
	sub	x0, x29, #152
	mov	x1, x21
	bl	_buf_write
	bl	_ASSERT
	ldur	x21, [x29, #-144]
	mov	x0, x21
	bl	_strlen
	mov	x2, x0
	sub	x0, x29, #152
	mov	x1, x21
	bl	_buf_write
	bl	_ASSERT
	sub	x0, x29, #152
	mov	w1, #0
	bl	_buf_write_u8
	bl	_ASSERT
	ldur	x0, [x29, #-144]
	bl	_free
	sub	x0, x29, #152
	bl	_BPTR
	bl	_strdup
	mov	x2, x0
	str	x0, [x20]
Lloh22:
	adrp	x8, _D_SHOW_KEYS@GOTPAGE
Lloh23:
	ldr	x8, [x8, _D_SHOW_KEYS@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
	ldr	x3, [x19]
Lloh25:
	adrp	x1, l_.str.2@PAGE
Lloh26:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dmsg
	sub	x0, x29, #128
	bl	_gc_free
	mov	sp, x26
	ldur	x8, [x29, #-88]
Lloh27:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh28:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_9
; %bb.8:
	sub	sp, x29, #80
	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_9:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_now,8,3                        ; @now
	.comm	_AUTH_TOKEN_SESSION_ID_LEN,4,2  ; @AUTH_TOKEN_SESSION_ID_LEN
	.comm	_SESSION_ID_PREFIX,8,3          ; @SESSION_ID_PREFIX
	.comm	_M_FATAL,4,2                    ; @M_FATAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get enough randomness for authentication token"

	.comm	_AUTH_TOKEN_VALID_EMPTYUSER,4,2 ; @AUTH_TOKEN_VALID_EMPTYUSER
l_.str.1:                               ; @.str.1
	.space	1

	.comm	_D_SHOW_KEYS,4,2                ; @D_SHOW_KEYS
l_.str.2:                               ; @.str.2
	.asciz	"Generated token for client: %s (%s)"

.subsections_via_symbols
