	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function synchronize_audio
LCPI0_0:
	.quad	0x3ff0000000000000              ## double 1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_synchronize_audio:                     ## @synchronize_audio
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_get_master_sync_type
	movq	_AV_SYNC_AUDIO_MASTER@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_9
## %bb.1:
	leaq	48(%rbx), %rdi
	callq	_get_clock
	movsd	%xmm0, -32(%rbp)                ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_get_master_clock
	movsd	-32(%rbp), %xmm1                ## 8-byte Reload
                                        ## xmm1 = mem[0],zero
	subsd	%xmm0, %xmm1
	movsd	%xmm1, -32(%rbp)                ## 8-byte Spill
	movapd	%xmm1, %xmm0
	callq	_isnan
	testl	%eax, %eax
	jne	LBB0_8
## %bb.2:
	movsd	-32(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	callq	_fabs
	movq	_AV_NOSYNC_THRESHOLD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_8
## %bb.3:
	movsd	8(%rbx), %xmm1                  ## xmm1 = mem[0],zero
	movsd	(%rbx), %xmm3                   ## xmm3 = mem[0],zero
	mulsd	%xmm1, %xmm3
	movsd	-32(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	addsd	%xmm0, %xmm3
	movsd	%xmm3, (%rbx)
	movq	16(%rbx), %rax
	movq	_AUDIO_DIFF_AVG_NB@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_5
## %bb.4:
	incq	%rax
	movq	%rax, 16(%rbx)
	jmp	LBB0_9
LBB0_8:
	movq	$0, 16(%rbx)
	movq	$0, (%rbx)
LBB0_9:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movsd	LCPI0_0(%rip), %xmm0            ## xmm0 = mem[0],zero
	subsd	%xmm1, %xmm0
	mulsd	%xmm3, %xmm0
	movsd	%xmm0, -40(%rbp)                ## 8-byte Spill
	callq	_fabs
	movq	24(%rbx), %r9
	movl	%r14d, %r15d
	cmpq	%r9, %rax
	jl	LBB0_7
## %bb.6:
	movsd	40(%rbx), %xmm0                 ## xmm0 = mem[0],zero
	mulsd	-32(%rbp), %xmm0                ## 8-byte Folded Reload
	cvttsd2si	%xmm0, %edi
	addl	%r14d, %edi
	movq	_SAMPLE_CORRECTION_PERCENT_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	$100, %ecx
	subl	%eax, %ecx
	imull	%r14d, %ecx
	movslq	%ecx, %rcx
	imulq	$1374389535, %rcx, %rsi         ## imm = 0x51EB851F
	movq	%rsi, %rcx
	shrq	$63, %rcx
	sarq	$37, %rsi
	addl	%ecx, %esi
	addl	$100, %eax
	imull	%r14d, %eax
	cltq
	imulq	$1374389535, %rax, %rdx         ## imm = 0x51EB851F
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	$37, %rdx
	addl	%eax, %edx
                                        ## kill: def $esi killed $esi killed $rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_av_clip
	movl	%eax, %r15d
	movq	24(%rbx), %r9
LBB0_7:
	movq	_AV_LOG_TRACE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %ecx
	subl	%r14d, %ecx
	movl	32(%rbx), %r8d
	leaq	L_.str(%rip), %rdx
	xorl	%edi, %edi
	movsd	-32(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	movsd	-40(%rbp), %xmm1                ## 8-byte Reload
                                        ## xmm1 = mem[0],zero
	callq	_av_log
	movl	%r15d, %r14d
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_SYNC_AUDIO_MASTER,8,3       ## @AV_SYNC_AUDIO_MASTER
	.comm	_AV_NOSYNC_THRESHOLD,8,3        ## @AV_NOSYNC_THRESHOLD
	.comm	_AUDIO_DIFF_AVG_NB,8,3          ## @AUDIO_DIFF_AVG_NB
	.comm	_SAMPLE_CORRECTION_PERCENT_MAX,4,2 ## @SAMPLE_CORRECTION_PERCENT_MAX
	.comm	_AV_LOG_TRACE,4,2               ## @AV_LOG_TRACE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"diff=%f adiff=%f sample_diff=%d apts=%0.3f %f\n"

	.no_dead_strip	_synchronize_audio
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function synchronize_audio
_synchronize_audio:                     ; @synchronize_audio
	.cfi_startproc
; %bb.0:
	stp	d9, d8, [sp, #-64]!             ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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 b8, -56
	.cfi_offset b9, -64
	mov	x19, x1
	mov	x20, x0
	bl	_get_master_sync_type
Lloh0:
	adrp	x8, _AV_SYNC_AUDIO_MASTER@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AV_SYNC_AUDIO_MASTER@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_6
; %bb.1:
	add	x0, x20, #48
	bl	_get_clock
	fmov	d8, d0
	mov	x0, x20
	bl	_get_master_clock
	fsub	d8, d8, d0
	fmov	d0, d8
	bl	_isnan
	cbnz	w0, LBB0_5
; %bb.2:
	fmov	d0, d8
	bl	_fabs
Lloh3:
	adrp	x8, _AV_NOSYNC_THRESHOLD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AV_NOSYNC_THRESHOLD@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ge	LBB0_5
; %bb.3:
	ldp	d1, d0, [x20]
	fmadd	d1, d0, d1, d8
	str	d1, [x20]
	ldr	x8, [x20, #16]
Lloh6:
	adrp	x9, _AUDIO_DIFF_AVG_NB@GOTPAGE
Lloh7:
	ldr	x9, [x9, _AUDIO_DIFF_AVG_NB@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_7
; %bb.4:
	add	x8, x8, #1
	str	x8, [x20, #16]
	b	LBB0_6
LBB0_5:
	str	xzr, [x20, #16]
	str	xzr, [x20]
LBB0_6:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp], #64               ; 16-byte Folded Reload
	ret
LBB0_7:
	fmov	d2, #1.00000000
	fsub	d0, d2, d0
	fmul	d9, d0, d1
	fmov	d0, d9
	bl	_fabs
	ldr	x5, [x20, #24]
	mov	x21, x19
	cmp	x0, x5
	b.lt	LBB0_9
; %bb.8:
	ldr	d0, [x20, #40]
	fmul	d0, d8, d0
	fcvtzs	w8, d0
	add	w0, w8, w19
Lloh9:
	adrp	x8, _SAMPLE_CORRECTION_PERCENT_MAX@GOTPAGE
Lloh10:
	ldr	x8, [x8, _SAMPLE_CORRECTION_PERCENT_MAX@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	mov	w9, #100
	sub	w9, w9, w8
	mul	w9, w9, w19
	mov	w10, #34079
	movk	w10, #20971, lsl #16
	smull	x9, w9, w10
	lsr	x11, x9, #63
	asr	x9, x9, #37
	add	w1, w9, w11
	add	w8, w8, #100
	mul	w8, w8, w19
	smull	x8, w8, w10
	lsr	x9, x8, #63
	asr	x8, x8, #37
	add	w2, w8, w9
	bl	_av_clip
	mov	x21, x0
	ldr	x5, [x20, #24]
LBB0_9:
Lloh12:
	adrp	x8, _AV_LOG_TRACE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AV_LOG_TRACE@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	sub	w3, w21, w19
	ldr	w4, [x20, #32]
Lloh15:
	adrp	x2, l_.str@PAGE
Lloh16:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, #0
	fmov	d0, d8
	fmov	d1, d9
	bl	_av_log
	mov	x19, x21
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_SYNC_AUDIO_MASTER,8,3       ; @AV_SYNC_AUDIO_MASTER
	.comm	_AV_NOSYNC_THRESHOLD,8,3        ; @AV_NOSYNC_THRESHOLD
	.comm	_AUDIO_DIFF_AVG_NB,8,3          ; @AUDIO_DIFF_AVG_NB
	.comm	_SAMPLE_CORRECTION_PERCENT_MAX,4,2 ; @SAMPLE_CORRECTION_PERCENT_MAX
	.comm	_AV_LOG_TRACE,4,2               ; @AV_LOG_TRACE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"diff=%f adiff=%f sample_diff=%d apts=%0.3f %f\n"

	.no_dead_strip	_synchronize_audio
.subsections_via_symbols
