	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_get_ad_f                       ## -- Begin function get_ad_f
	.p2align	4, 0x90
_get_ad_f:                              ## @get_ad_f
	.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
	testl	%edi, %edi
	je	LBB0_11
## %bb.1:
	movl	%edi, %ebx
	movq	_MAX_ADS@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jbe	LBB0_11
## %bb.2:
	movl	%esi, %r15d
	movl	%ebx, %edi
	callq	_get_ad
	movq	%rax, %r14
	testl	%r15d, %r15d
	je	LBB0_11
## %bb.3:
	testq	%r14, %r14
	jne	LBB0_11
## %bb.4:
	movl	$32, %edi
	callq	_zmalloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %r14
	movq	%rax, %rdi
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	movq	_max_ad_id@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jge	LBB0_8
## %bb.7:
	movl	%ebx, (%rax)
LBB0_8:
	movq	_tot_ads@GOTPCREL(%rip), %rax
	incl	(%rax)
	movl	%ebx, %edi
	callq	_ad_is_ancient
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	movl	%ebx, %ecx
	andb	$7, %cl
	movl	$-2, %eax
	roll	%cl, %eax
	movq	_AncientAdBitmap@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%ebx, %edx
	sarl	$3, %edx
	movslq	%edx, %rdx
	andl	%eax, (%rcx,%rdx,4)
	movq	_ADF_ANCIENT@GOTPCREL(%rip), %rax
	movq	_ADF_NOTLOADED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movl	%ecx, (%r14)
	movq	_ancient_ads_pending@GOTPCREL(%rip), %rax
	incl	(%rax)
LBB0_10:
	leaq	L_.str(%rip), %rsi
	movl	$4, %edi
	movl	%ebx, %edx
	callq	_vkprintf
	movl	%ebx, 4(%r14)
	movq	_Ads@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_AD_TABLE_SIZE@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	decq	%rcx
	movslq	%ebx, %rdx
	andq	%rcx, %rdx
	movq	(%rax,%rdx,8), %rcx
	movq	%rcx, 24(%r14)
	movq	%r14, (%rax,%rdx,8)
	movabsq	$4607182418800017408, %rax      ## imm = 0x3FF0000000000000
	movq	%rax, 8(%r14)
	movl	$65535, 16(%r14)                ## imm = 0xFFFF
	movq	_tot_ad_versions@GOTPCREL(%rip), %rax
	incl	(%rax)
	jmp	LBB0_11
LBB0_5:
	xorl	%r14d, %r14d
LBB0_11:
	movq	%r14, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_ADS,4,2                    ## @MAX_ADS
	.comm	_max_ad_id,4,2                  ## @max_ad_id
	.comm	_tot_ads,4,2                    ## @tot_ads
	.comm	_AncientAdBitmap,8,3            ## @AncientAdBitmap
	.comm	_ADF_ANCIENT,4,2                ## @ADF_ANCIENT
	.comm	_ADF_NOTLOADED,4,2              ## @ADF_NOTLOADED
	.comm	_ancient_ads_pending,4,2        ## @ancient_ads_pending
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"created ad id %d\n"

	.comm	_Ads,8,3                        ## @Ads
	.comm	_AD_TABLE_SIZE,4,2              ## @AD_TABLE_SIZE
	.comm	_tot_ad_versions,4,2            ## @tot_ad_versions
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_get_ad_f                       ; -- Begin function get_ad_f
	.p2align	2
_get_ad_f:                              ; @get_ad_f
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, #0
	cbz	w0, LBB0_10
; %bb.1:
	mov	x20, x0
Lloh0:
	adrp	x8, _MAX_ADS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_ADS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w0
	b.ls	LBB0_10
; %bb.2:
	mov	x21, x1
	mov	x0, x20
	bl	_get_ad
	mov	x19, x0
	cbz	w21, LBB0_10
; %bb.3:
	cbnz	x19, LBB0_10
; %bb.4:
	mov	w0, #32
	bl	_zmalloc
	mov	x19, x0
	cbz	x0, LBB0_10
; %bb.5:
	mov	x0, x19
	mov	w1, #0
	mov	w2, #32
	bl	_memset
Lloh3:
	adrp	x8, _max_ad_id@GOTPAGE
Lloh4:
	ldr	x8, [x8, _max_ad_id@GOTPAGEOFF]
	ldr	w9, [x8]
	cmp	w9, w20
	b.ge	LBB0_7
; %bb.6:
	str	w20, [x8]
LBB0_7:
Lloh5:
	adrp	x8, _tot_ads@GOTPAGE
Lloh6:
	ldr	x8, [x8, _tot_ads@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
	mov	x0, x20
	bl	_ad_is_ancient
	cbz	x0, LBB0_9
; %bb.8:
	and	w8, w20, #0x7
Lloh7:
	adrp	x9, _AncientAdBitmap@GOTPAGE
Lloh8:
	ldr	x9, [x9, _AncientAdBitmap@GOTPAGEOFF]
	mov	w10, #1
Lloh9:
	ldr	x9, [x9]
	asr	w11, w20, #3
	sbfiz	x11, x11, #2, #32
	ldr	w12, [x9, x11]
	lsl	w8, w10, w8
	bic	w8, w12, w8
	str	w8, [x9, x11]
Lloh10:
	adrp	x8, _ADF_ANCIENT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ADF_ANCIENT@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _ADF_NOTLOADED@GOTPAGE
Lloh14:
	ldr	x9, [x9, _ADF_NOTLOADED@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x19]
Lloh16:
	adrp	x8, _ancient_ads_pending@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ancient_ads_pending@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
LBB0_9:
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #4
	mov	x2, x20
	bl	_vkprintf
	str	w20, [x19, #4]
Lloh20:
	adrp	x8, _Ads@GOTPAGE
Lloh21:
	ldr	x8, [x8, _Ads@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
Lloh23:
	adrp	x9, _AD_TABLE_SIZE@GOTPAGE
Lloh24:
	ldr	x9, [x9, _AD_TABLE_SIZE@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x9]
	sub	w9, w9, #1
	and	w9, w9, w20
	sbfiz	x9, x9, #3, #32
	ldr	x10, [x8, x9]
	str	x10, [x19, #24]
	str	x19, [x8, x9]
	mov	x8, #4607182418800017408
	str	x8, [x19, #8]
	mov	w8, #65535
	str	w8, [x19, #16]
Lloh26:
	adrp	x8, _tot_ad_versions@GOTPAGE
Lloh27:
	ldr	x8, [x8, _tot_ad_versions@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
LBB0_10:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_ADS,4,2                    ; @MAX_ADS
	.comm	_max_ad_id,4,2                  ; @max_ad_id
	.comm	_tot_ads,4,2                    ; @tot_ads
	.comm	_AncientAdBitmap,8,3            ; @AncientAdBitmap
	.comm	_ADF_ANCIENT,4,2                ; @ADF_ANCIENT
	.comm	_ADF_NOTLOADED,4,2              ; @ADF_NOTLOADED
	.comm	_ancient_ads_pending,4,2        ; @ancient_ads_pending
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"created ad id %d\n"

	.comm	_Ads,8,3                        ; @Ads
	.comm	_AD_TABLE_SIZE,4,2              ; @AD_TABLE_SIZE
	.comm	_tot_ad_versions,4,2            ; @tot_ad_versions
.subsections_via_symbols
