	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ad_enable
_ad_enable:                             ## @ad_enable
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%r14d, %r14d
	testq	%rdi, %rdi
	je	LBB0_21
## %bb.1:
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	_ADF_ANCIENT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rdi)
	je	LBB0_5
## %bb.2:
	movq	%rbx, %rdi
	callq	_load_ancient_ad
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movq	_log_last_ts@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_AD_ANCIENT_DELAY@GOTPCREL(%rip), %rcx
	subq	(%rcx), %rax
	xorl	%edi, %edi
	cmpq	%rax, 8(%rbx)
	setle	%dil
	callq	_assert
LBB0_5:
	testl	%r15d, %r15d
	je	LBB0_6
## %bb.7:
	movl	%r15d, 16(%rbx)
	jmp	LBB0_8
LBB0_6:
	movl	16(%rbx), %r15d
LBB0_8:
	movl	%r15d, %edi
	callq	_assert
	movq	_ADF_ON@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	testl	%eax, (%rbx)
	je	LBB0_12
## %bb.9:
	movq	_log_last_ts@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_AD_RECOMPUTE_INTERVAL@GOTPCREL(%rip), %rcx
	subq	(%rcx), %rax
	cmpq	%rax, 24(%rbx)
	jle	LBB0_10
## %bb.11:
	movq	%rbx, %rdi
	callq	_compute_estimated_gain
	jmp	LBB0_21
LBB0_12:
	cmpl	$0, 40(%rbx)
	je	LBB0_15
## %bb.13:
	movq	_log_last_ts@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_AD_ANCIENT_DELAY@GOTPCREL(%rip), %rcx
	movq	%rax, %rdx
	subq	(%rcx), %rdx
	cmpq	%rdx, 8(%rbx)
	jle	LBB0_15
## %bb.14:
	movq	_AD_RECOMPUTE_INTERVAL@GOTPCREL(%rip), %rcx
	subq	(%rcx), %rax
	cmpq	%rax, 24(%rbx)
	jg	LBB0_16
LBB0_15:
	movq	%rbx, %rdi
	callq	_compute_ad_user_list
LBB0_16:
	movq	%rbx, %rdi
	callq	_remove_queue_ad
	movl	(%r15), %eax
	orl	%eax, (%rbx)
	movq	_active_ads@GOTPCREL(%rip), %rax
	incl	(%rax)
	movq	_delay_targeting@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_17
## %bb.18:
	movq	_ADF_DELAYED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%rbx)
	jmp	LBB0_19
LBB0_10:
	movq	%rbx, %rdi
	callq	_change_ad_target
	jmp	LBB0_21
LBB0_3:
	movl	%eax, %r14d
	jmp	LBB0_21
LBB0_17:
	movq	%rbx, %rdi
	callq	_activate_ad
LBB0_19:
	movq	%rbx, %rdi
	callq	_apply_periodic_ad_state
	movq	%rbx, %rdi
	callq	_compute_estimated_gain
	movq	_verbosity@GOTPCREL(%rip), %rax
	movl	$1, %r14d
	cmpl	$3, (%rax)
	jl	LBB0_21
## %bb.20:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	32(%rbx), %edx
	movl	36(%rbx), %ecx
	leaq	L_.str(%rip), %rsi
	callq	_fprintf
LBB0_21:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ADF_ANCIENT,4,2                ## @ADF_ANCIENT
	.comm	_log_last_ts,8,3                ## @log_last_ts
	.comm	_AD_ANCIENT_DELAY,8,3           ## @AD_ANCIENT_DELAY
	.comm	_ADF_ON,4,2                     ## @ADF_ON
	.comm	_AD_RECOMPUTE_INTERVAL,8,3      ## @AD_RECOMPUTE_INTERVAL
	.comm	_active_ads,4,2                 ## @active_ads
	.comm	_delay_targeting,4,2            ## @delay_targeting
	.comm	_ADF_DELAYED,4,2                ## @ADF_DELAYED
	.comm	_verbosity,4,2                  ## @verbosity
	.comm	_stderr,4,2                     ## @stderr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"enabled previously disabled ad #%d: %d users\n"

	.no_dead_strip	_ad_enable
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ad_enable
_ad_enable:                             ; @ad_enable
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	cbz	x0, LBB0_21
; %bb.1:
	mov	x20, x1
	mov	x19, x0
	ldr	w8, [x0]
Lloh0:
	adrp	x9, _ADF_ANCIENT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _ADF_ANCIENT@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.2:
	mov	x0, x19
	bl	_load_ancient_ad
	tbnz	w0, #31, LBB0_21
; %bb.3:
	ldr	x8, [x19, #8]
Lloh3:
	adrp	x9, _log_last_ts@GOTPAGE
Lloh4:
	ldr	x9, [x9, _log_last_ts@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
Lloh6:
	adrp	x10, _AD_ANCIENT_DELAY@GOTPAGE
Lloh7:
	ldr	x10, [x10, _AD_ANCIENT_DELAY@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	sub	x9, x9, x10
	cmp	x8, x9
	cset	w0, le
	bl	_assert
LBB0_4:
	cbz	w20, LBB0_6
; %bb.5:
	str	w20, [x19, #16]
	b	LBB0_7
LBB0_6:
	ldr	w20, [x19, #16]
LBB0_7:
	mov	x0, x20
	bl	_assert
	ldr	w8, [x19]
Lloh9:
	adrp	x20, _ADF_ON@GOTPAGE
Lloh10:
	ldr	x20, [x20, _ADF_ON@GOTPAGEOFF]
	ldr	w9, [x20]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.8:
	ldr	x8, [x19, #24]
Lloh11:
	adrp	x9, _log_last_ts@GOTPAGE
Lloh12:
	ldr	x9, [x9, _log_last_ts@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
Lloh14:
	adrp	x10, _AD_RECOMPUTE_INTERVAL@GOTPAGE
Lloh15:
	ldr	x10, [x10, _AD_RECOMPUTE_INTERVAL@GOTPAGEOFF]
Lloh16:
	ldr	x10, [x10]
	sub	x9, x9, x10
	mov	x0, x19
	cmp	x8, x9
	b.le	LBB0_16
; %bb.9:
	bl	_compute_estimated_gain
	mov	w0, #0
	b	LBB0_21
LBB0_10:
	ldr	w8, [x19, #40]
	cbz	w8, LBB0_13
; %bb.11:
	ldr	x9, [x19, #8]
Lloh17:
	adrp	x8, _log_last_ts@GOTPAGE
Lloh18:
	ldr	x8, [x8, _log_last_ts@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
Lloh20:
	adrp	x10, _AD_ANCIENT_DELAY@GOTPAGE
Lloh21:
	ldr	x10, [x10, _AD_ANCIENT_DELAY@GOTPAGEOFF]
Lloh22:
	ldr	x10, [x10]
	sub	x10, x8, x10
	cmp	x9, x10
	b.le	LBB0_13
; %bb.12:
	ldr	x9, [x19, #24]
Lloh23:
	adrp	x10, _AD_RECOMPUTE_INTERVAL@GOTPAGE
Lloh24:
	ldr	x10, [x10, _AD_RECOMPUTE_INTERVAL@GOTPAGEOFF]
Lloh25:
	ldr	x10, [x10]
	sub	x8, x8, x10
	cmp	x9, x8
	b.gt	LBB0_14
LBB0_13:
	mov	x0, x19
	bl	_compute_ad_user_list
LBB0_14:
	mov	x0, x19
	bl	_remove_queue_ad
	ldr	w8, [x20]
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
Lloh26:
	adrp	x8, _active_ads@GOTPAGE
Lloh27:
	ldr	x8, [x8, _active_ads@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
Lloh28:
	adrp	x8, _delay_targeting@GOTPAGE
Lloh29:
	ldr	x8, [x8, _delay_targeting@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	cbz	w8, LBB0_17
; %bb.15:
Lloh31:
	adrp	x8, _ADF_DELAYED@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ADF_DELAYED@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
	b	LBB0_18
LBB0_16:
	bl	_change_ad_target
	mov	w0, #0
	b	LBB0_21
LBB0_17:
	mov	x0, x19
	bl	_activate_ad
LBB0_18:
	mov	x0, x19
	bl	_apply_periodic_ad_state
	mov	x0, x19
	bl	_compute_estimated_gain
Lloh34:
	adrp	x8, _verbosity@GOTPAGE
Lloh35:
	ldr	x8, [x8, _verbosity@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	cmp	w8, #3
	b.lt	LBB0_20
; %bb.19:
Lloh37:
	adrp	x8, _stderr@GOTPAGE
Lloh38:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh39:
	ldr	w0, [x8]
	ldp	w2, w3, [x19, #32]
Lloh40:
	adrp	x1, l_.str@PAGE
Lloh41:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fprintf
LBB0_20:
	mov	w0, #1
LBB0_21:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_ADF_ANCIENT,4,2                ; @ADF_ANCIENT
	.comm	_log_last_ts,8,3                ; @log_last_ts
	.comm	_AD_ANCIENT_DELAY,8,3           ; @AD_ANCIENT_DELAY
	.comm	_ADF_ON,4,2                     ; @ADF_ON
	.comm	_AD_RECOMPUTE_INTERVAL,8,3      ; @AD_RECOMPUTE_INTERVAL
	.comm	_active_ads,4,2                 ; @active_ads
	.comm	_delay_targeting,4,2            ; @delay_targeting
	.comm	_ADF_DELAYED,4,2                ; @ADF_DELAYED
	.comm	_verbosity,4,2                  ; @verbosity
	.comm	_stderr,4,2                     ; @stderr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"enabled previously disabled ad #%d: %d users\n"

	.no_dead_strip	_ad_enable
.subsections_via_symbols
