	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wait_for_next_frame
_wait_for_next_frame:                   ## @wait_for_next_frame
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r12
	xorl	%eax, %eax
	callq	_get_microseconds64
	cltq
	imulq	$274877907, %rax, %rax          ## imm = 0x10624DD3
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$38, %rax
	addl	%ecx, %eax
	movl	_wait_for_next_frame.complete_time(%rip), %ecx
	cmpl	$-1, %ecx
	jne	LBB0_2
## %bb.1:
	movl	(%r12), %ecx
	addl	%eax, %ecx
	movl	%ecx, _wait_for_next_frame.complete_time(%rip)
LBB0_2:
	movl	$1, %r13d
	cmpl	%ecx, %eax
	jl	LBB0_4
## %bb.3:
	xorl	%r13d, %r13d
	cmpl	$0, (%r12)
	sete	%r13b
LBB0_4:
	movl	4(%r12), %ecx
	addl	$-128, %ecx
	cmpl	$6, %ecx
	ja	LBB0_28
## %bb.5:
	xorl	%ebx, %ebx
	leaq	LJTI0_0(%rip), %rdx
	movslq	(%rdx,%rcx,4), %rcx
	addq	%rdx, %rcx
	jmpq	*%rcx
LBB0_8:
	movl	(%r14), %esi
	incl	%esi
	movl	%esi, (%r14)
	movl	_wait_for_next_frame.next_frame_ms(%rip), %ecx
	cmpl	$-1, %ecx
	je	LBB0_9
## %bb.10:
	movl	%ecx, %r15d
	subl	%eax, %r15d
	js	LBB0_11
## %bb.14:
	movl	%r15d, %edi
	callq	_vcos_sleep
	movl	8(%r12), %eax
	addl	%eax, _wait_for_next_frame.next_frame_ms(%rip)
	jmp	LBB0_28
LBB0_6:
	movl	(%r12), %edi
	callq	_vcos_sleep
	jmp	LBB0_29
LBB0_21:
	leaq	-44(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_sigemptyset
	movq	_SIGUSR1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_sigaddset
	movq	_SIG_BLOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_pthread_sigmask
	cmpl	$0, 12(%r12)
	je	LBB0_23
## %bb.22:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
LBB0_23:
	leaq	-44(%rbp), %rdi
	leaq	-60(%rbp), %rsi
	callq	_sigwait
	cmpl	$0, 12(%r12)
	je	LBB0_27
## %bb.24:
	movq	_stderr@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	testl	%eax, %eax
	je	LBB0_25
## %bb.26:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
	jmp	LBB0_27
LBB0_15:
	cmpl	$0, 12(%r12)
	je	LBB0_17
## %bb.16:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
LBB0_17:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_getchar
	incl	(%r14)
	andl	$-33, %eax
	cmpl	$88, %eax
	cmovel	%ebx, %r13d
	jmp	LBB0_28
LBB0_18:
	cmpl	$0, (%r14)
	movl	$30, %edi
	jne	LBB0_20
## %bb.19:
	movq	_CAMERA_SETTLE_TIME@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
LBB0_20:
	callq	_vcos_sleep
LBB0_27:
	incl	(%r14)
LBB0_28:
	movl	%r13d, %ebx
LBB0_29:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	incl	(%r14)
	movl	$10000, %edi                    ## imm = 0x2710
	callq	_vcos_sleep
	movl	$1, %ebx
	jmp	LBB0_29
LBB0_9:
	movq	_CAMERA_SETTLE_TIME@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_vcos_sleep
	xorl	%eax, %eax
	callq	_get_microseconds64
	cltq
	imulq	$274877907, %rax, %rax          ## imm = 0x10624DD3
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$38, %rax
	addl	%ecx, %eax
	addl	8(%r12), %eax
	movl	%eax, _wait_for_next_frame.next_frame_ms(%rip)
	jmp	LBB0_28
LBB0_25:
	leaq	L_.str.4(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
	jmp	LBB0_27
LBB0_11:
	movl	%r15d, %eax
	negl	%eax
	movl	8(%r12), %edi
	movl	%edi, %edx
	shrl	$31, %edx
	addl	%edi, %edx
	sarl	%edx
	negl	%edx
	cmpl	%eax, %edx
	jle	LBB0_13
## %bb.12:
	addl	%ecx, %edi
	movl	%edi, _wait_for_next_frame.next_frame_ms(%rip)
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	movl	%eax, %edx
	callq	_vcos_log_error
	jmp	LBB0_28
LBB0_13:
	cltd
	idivl	%edi
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	leal	1(%rax), %ebx
	leal	(%rax,%rsi), %edx
	incl	%edx
	leaq	L_.str.1(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_vcos_log_error
	addl	%ebx, (%r14)
	imull	8(%r12), %ebx
	addl	%r15d, %ebx
	movl	%ebx, %edi
	callq	_vcos_sleep
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	addl	$2, %eax
	imull	8(%r12), %eax
	addl	%eax, _wait_for_next_frame.next_frame_ms(%rip)
	jmp	LBB0_28
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_8, LBB0_8-LJTI0_0
.set L0_0_set_6, LBB0_6-LJTI0_0
.set L0_0_set_21, LBB0_21-LJTI0_0
.set L0_0_set_15, LBB0_15-LJTI0_0
.set L0_0_set_18, LBB0_18-LJTI0_0
.set L0_0_set_29, LBB0_29-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
LJTI0_0:
	.long	L0_0_set_8
	.long	L0_0_set_6
	.long	L0_0_set_21
	.long	L0_0_set_15
	.long	L0_0_set_18
	.long	L0_0_set_29
	.long	L0_0_set_7
	.end_data_region
                                        ## -- End function
	.section	__DATA,__data
	.p2align	2                               ## @wait_for_next_frame.complete_time
_wait_for_next_frame.complete_time:
	.long	4294967295                      ## 0xffffffff

	.p2align	2                               ## @wait_for_next_frame.next_frame_ms
_wait_for_next_frame.next_frame_ms:
	.long	4294967295                      ## 0xffffffff

	.comm	_CAMERA_SETTLE_TIME,4,2         ## @CAMERA_SETTLE_TIME
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Frame %d is %d ms late"

L_.str.1:                               ## @.str.1
	.asciz	"Skipping frame %d to restart at frame %d"

	.comm	_stderr,4,2                     ## @stderr
L_.str.2:                               ## @.str.2
	.asciz	"Press Enter to capture, X then ENTER to exit\n"

	.comm	_SIGUSR1,4,2                    ## @SIGUSR1
	.comm	_SIG_BLOCK,4,2                  ## @SIG_BLOCK
L_.str.3:                               ## @.str.3
	.asciz	"Waiting for SIGUSR1 to initiate capture\n"

L_.str.4:                               ## @.str.4
	.asciz	"Received SIGUSR1\n"

L_.str.5:                               ## @.str.5
	.asciz	"Bad signal received - error %d\n"

	.comm	_errno,4,2                      ## @errno
	.no_dead_strip	_wait_for_next_frame
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wait_for_next_frame
_wait_for_next_frame:                   ; @wait_for_next_frame
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x19, x1
	mov	x20, x0
	bl	_get_microseconds64
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	smull	x8, w0, w8
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w8, w8, w9
	adrp	x10, _wait_for_next_frame.complete_time@PAGE
	ldr	w9, [x10, _wait_for_next_frame.complete_time@PAGEOFF]
	cmn	w9, #1
	b.eq	LBB0_3
; %bb.1:
	cmp	w8, w9
	b.ge	LBB0_4
LBB0_2:
	mov	w22, #1
	b	LBB0_5
LBB0_3:
	ldr	w9, [x20]
	add	w9, w9, w8
	str	w9, [x10, _wait_for_next_frame.complete_time@PAGEOFF]
	cmp	w8, w9
	b.lt	LBB0_2
LBB0_4:
	ldr	w9, [x20]
	cmp	w9, #0
	cset	w22, eq
LBB0_5:
	ldr	w9, [x20, #4]
	sub	w9, w9, #128
	cmp	w9, #6
	b.hi	LBB0_25
; %bb.6:
	mov	w0, #0
Lloh0:
	adrp	x10, lJTI0_0@PAGE
Lloh1:
	add	x10, x10, lJTI0_0@PAGEOFF
	adr	x11, LBB0_7
	ldrb	w12, [x10, x9]
	add	x11, x11, x12, lsl #2
	br	x11
LBB0_7:
	ldr	w9, [x19]
	add	w1, w9, #1
	str	w1, [x19]
	adrp	x23, _wait_for_next_frame.next_frame_ms@PAGE
	ldr	w9, [x23, _wait_for_next_frame.next_frame_ms@PAGEOFF]
	cmn	w9, #1
	b.eq	LBB0_21
; %bb.8:
	subs	w21, w9, w8
	b.mi	LBB0_27
; %bb.9:
	mov	x0, x21
	bl	_vcos_sleep
	ldr	w8, [x20, #8]
	ldr	w9, [x23, _wait_for_next_frame.next_frame_ms@PAGEOFF]
	add	w8, w9, w8
	str	w8, [x23, _wait_for_next_frame.next_frame_ms@PAGEOFF]
	b	LBB0_25
LBB0_10:
	ldr	w0, [x20]
	bl	_vcos_sleep
	mov	w0, #0
	b	LBB0_26
LBB0_11:
	add	x0, sp, #12
	bl	_sigemptyset
Lloh2:
	adrp	x8, _SIGUSR1@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SIGUSR1@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	add	x0, sp, #12
	bl	_sigaddset
Lloh5:
	adrp	x8, _SIG_BLOCK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SIG_BLOCK@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	add	x1, sp, #12
	mov	x2, #0
	bl	_pthread_sigmask
	ldr	w8, [x20, #12]
	cbz	w8, LBB0_13
; %bb.12:
Lloh8:
	adrp	x8, _stderr@GOTPAGE
Lloh9:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
Lloh11:
	adrp	x1, l_.str.3@PAGE
Lloh12:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_fprintf
LBB0_13:
	add	x0, sp, #12
	add	x1, sp, #8
	bl	_sigwait
	ldr	w9, [x20, #12]
	cbz	w9, LBB0_24
; %bb.14:
	mov	x8, x0
Lloh13:
	adrp	x9, _stderr@GOTPAGE
Lloh14:
	ldr	x9, [x9, _stderr@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x9]
	cbz	w8, LBB0_22
; %bb.15:
Lloh16:
	adrp	x8, _errno@GOTPAGE
Lloh17:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	x8, [sp]
Lloh19:
	adrp	x1, l_.str.5@PAGE
Lloh20:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_23
LBB0_16:
	ldr	w8, [x20, #12]
	cbz	w8, LBB0_18
; %bb.17:
Lloh21:
	adrp	x8, _stderr@GOTPAGE
Lloh22:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
Lloh24:
	adrp	x1, l_.str.2@PAGE
Lloh25:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_fprintf
LBB0_18:
	bl	_getchar
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
	and	w8, w0, #0xffffffdf
	cmp	w8, #88
	csel	w0, wzr, w22, eq
	b	LBB0_26
LBB0_19:
	ldr	w8, [x19]
Lloh26:
	adrp	x9, _CAMERA_SETTLE_TIME@GOTPAGE
Lloh27:
	ldr	x9, [x9, _CAMERA_SETTLE_TIME@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	mov	w10, #30
	cmp	w8, #0
	csel	w0, w9, w10, eq
	bl	_vcos_sleep
	b	LBB0_24
LBB0_20:
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
	mov	w0, #10000
	bl	_vcos_sleep
	mov	w0, #1
	b	LBB0_26
LBB0_21:
Lloh29:
	adrp	x8, _CAMERA_SETTLE_TIME@GOTPAGE
Lloh30:
	ldr	x8, [x8, _CAMERA_SETTLE_TIME@GOTPAGEOFF]
Lloh31:
	ldr	w0, [x8]
	bl	_vcos_sleep
	bl	_get_microseconds64
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	smull	x8, w0, w8
	lsr	x9, x8, #63
	asr	x8, x8, #38
	ldr	w10, [x20, #8]
	add	w8, w8, w9
	add	w8, w8, w10
	str	w8, [x23, _wait_for_next_frame.next_frame_ms@PAGEOFF]
	b	LBB0_25
LBB0_22:
Lloh32:
	adrp	x1, l_.str.4@PAGE
Lloh33:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_23:
	bl	_fprintf
LBB0_24:
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
LBB0_25:
	mov	x0, x22
LBB0_26:
	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
	add	sp, sp, #96
	ret
LBB0_27:
	ldr	w8, [x20, #8]
	cmp	w8, #0
	cinc	w10, w8, lt
	neg	w10, w10, asr #1
	neg	w2, w21
	cmp	w10, w2
	b.le	LBB0_29
; %bb.28:
	add	w8, w8, w9
	str	w8, [x23, _wait_for_next_frame.next_frame_ms@PAGEOFF]
Lloh34:
	adrp	x0, l_.str@PAGE
Lloh35:
	add	x0, x0, l_.str@PAGEOFF
	bl	_vcos_log_error
	b	LBB0_25
LBB0_29:
	sdiv	w24, w2, w8
	add	w25, w24, #1
	add	w2, w25, w1
Lloh36:
	adrp	x0, l_.str.1@PAGE
Lloh37:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_vcos_log_error
	ldr	w8, [x19]
	add	w8, w8, w25
	str	w8, [x19]
	ldr	w8, [x20, #8]
	madd	w0, w8, w25, w21
	bl	_vcos_sleep
	add	w8, w24, #2
	ldr	w9, [x20, #8]
	ldr	w10, [x23, _wait_for_next_frame.next_frame_ms@PAGEOFF]
	madd	w8, w9, w8, w10
	str	w8, [x23, _wait_for_next_frame.next_frame_ms@PAGEOFF]
	b	LBB0_25
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_7-LBB0_7)>>2
	.byte	(LBB0_10-LBB0_7)>>2
	.byte	(LBB0_11-LBB0_7)>>2
	.byte	(LBB0_16-LBB0_7)>>2
	.byte	(LBB0_19-LBB0_7)>>2
	.byte	(LBB0_26-LBB0_7)>>2
	.byte	(LBB0_20-LBB0_7)>>2
                                        ; -- End function
	.section	__DATA,__data
	.p2align	2                               ; @wait_for_next_frame.complete_time
_wait_for_next_frame.complete_time:
	.long	4294967295                      ; 0xffffffff

	.p2align	2                               ; @wait_for_next_frame.next_frame_ms
_wait_for_next_frame.next_frame_ms:
	.long	4294967295                      ; 0xffffffff

	.comm	_CAMERA_SETTLE_TIME,4,2         ; @CAMERA_SETTLE_TIME
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Frame %d is %d ms late"

l_.str.1:                               ; @.str.1
	.asciz	"Skipping frame %d to restart at frame %d"

	.comm	_stderr,4,2                     ; @stderr
l_.str.2:                               ; @.str.2
	.asciz	"Press Enter to capture, X then ENTER to exit\n"

	.comm	_SIGUSR1,4,2                    ; @SIGUSR1
	.comm	_SIG_BLOCK,4,2                  ; @SIG_BLOCK
l_.str.3:                               ; @.str.3
	.asciz	"Waiting for SIGUSR1 to initiate capture\n"

l_.str.4:                               ; @.str.4
	.asciz	"Received SIGUSR1\n"

l_.str.5:                               ; @.str.5
	.asciz	"Bad signal received - error %d\n"

	.comm	_errno,4,2                      ; @errno
	.no_dead_strip	_wait_for_next_frame
.subsections_via_symbols
