	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vensync
_vensync:                               ## @vensync
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %ebx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_FD@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	movq	_TIOCCDTR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r14d, %r14d
	xorl	%edx, %edx
	callq	_ioctl
	movl	$1, %edi
	callq	_sleep
	movl	(%r15), %edi
	movq	_TIOCSDTR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_ioctl
	movq	_MAXRETRY@GOTPCREL(%rip), %r12
	cmpl	$0, (%r12)
	jle	LBB0_10
## %bb.1:
	xorl	%r14d, %r14d
	leaq	L_.str(%rip), %r15
	leaq	-112(%rbp), %r13
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_2 Depth=1
	leaq	L_.str.1(%rip), %rdi
	callq	_perror
	cmpl	(%r12), %r14d
	jge	LBB0_5
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
	movl	%ebx, %edi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	_write
	movl	$1, %edi
	movl	$10, %esi
	callq	_delay
	movl	%ebx, %edi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	_write
	movl	$2, %edi
	callq	_sleep
	movq	_FIONREAD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	leaq	-116(%rbp), %rdx
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_ioctl
	testq	%rax, %rax
	js	LBB0_3
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-116(%rbp), %edi
	testl	%edi, %edi
	jle	LBB0_13
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	$60, %esi
	callq	_min
	movl	%ebx, %edi
	movq	%r13, %rsi
	movq	%rax, %rdx
	callq	_read
	movslq	-116(%rbp), %rdi
	movzbl	-1(%rdi,%r13), %eax
	andb	$127, %al
	cmpb	$36, %al
	je	LBB0_9
## %bb.12:                              ##   in Loop: Header=BB0_8 Depth=2
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$60, %esi
	callq	_min
	movl	-116(%rbp), %edi
	subl	%eax, %edi
	movl	%edi, -116(%rbp)
	testl	%edi, %edi
	jg	LBB0_8
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	$1, %edi
	callq	_sleep
	incl	%r14d
	cmpl	(%r12), %r14d
	jl	LBB0_2
LBB0_5:
	xorl	%r14d, %r14d
	jmp	LBB0_10
LBB0_9:
	movl	$1, %r14d
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_14
## %bb.11:
	movl	%r14d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_FD,4,2                         ## @FD
	.comm	_TIOCCDTR,4,2                   ## @TIOCCDTR
	.comm	_TIOCSDTR,4,2                   ## @TIOCSDTR
	.comm	_MAXRETRY,4,2                   ## @MAXRETRY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"\r"

	.comm	_FIONREAD,4,2                   ## @FIONREAD
L_.str.1:                               ## @.str.1
	.asciz	"tip: ioctl"

	.no_dead_strip	_vensync
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vensync
_vensync:                               ; @vensync
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #72]
Lloh3:
	adrp	x20, _FD@GOTPAGE
Lloh4:
	ldr	x20, [x20, _FD@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh5:
	adrp	x8, _TIOCCDTR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _TIOCCDTR@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_ioctl
	mov	w0, #1
	bl	_sleep
	ldr	w0, [x20]
Lloh8:
	adrp	x8, _TIOCSDTR@GOTPAGE
Lloh9:
	ldr	x8, [x8, _TIOCSDTR@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_ioctl
Lloh11:
	adrp	x22, _MAXRETRY@GOTPAGE
Lloh12:
	ldr	x22, [x22, _MAXRETRY@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.1:
	mov	w23, #0
Lloh13:
	adrp	x20, l_.str@PAGE
Lloh14:
	add	x20, x20, l_.str@PAGEOFF
Lloh15:
	adrp	x24, _FIONREAD@GOTPAGE
Lloh16:
	ldr	x24, [x24, _FIONREAD@GOTPAGEOFF]
	add	x25, sp, #12
Lloh17:
	adrp	x21, l_.str.1@PAGE
Lloh18:
	add	x21, x21, l_.str.1@PAGEOFF
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x21
	bl	_perror
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x22]
	cmp	w23, w8
	b.ge	LBB0_9
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
	mov	x0, x19
	mov	x1, x20
	mov	w2, #1
	bl	_write
	mov	w0, #1
	mov	w1, #10
	bl	_delay
	mov	x0, x19
	mov	x1, x20
	mov	w2, #1
	bl	_write
	mov	w0, #2
	bl	_sleep
	ldr	w1, [x24]
	add	x2, sp, #8
	mov	x0, x19
	bl	_ioctl
	tbnz	x0, #63, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w0, [sp, #8]
	cmp	w0, #1
	b.lt	LBB0_8
LBB0_6:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	w1, #60
	bl	_min
	mov	x2, x0
	add	x1, sp, #12
	mov	x0, x19
	bl	_read
	ldrsw	x0, [sp, #8]
	add	x8, x0, x25
	ldurb	w8, [x8, #-1]
	and	w8, w8, #0x7f
	cmp	w8, #36
	b.eq	LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=2
                                        ; kill: def $w0 killed $w0 killed $x0
	mov	w1, #60
	bl	_min
	ldr	w8, [sp, #8]
	sub	w0, w8, w0
	str	w0, [sp, #8]
	cmp	w0, #0
	b.gt	LBB0_6
LBB0_8:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	w0, #1
	bl	_sleep
	add	w23, w23, #1
	b	LBB0_3
LBB0_9:
	mov	w0, #0
	b	LBB0_11
LBB0_10:
	mov	w0, #1
LBB0_11:
	ldr	x8, [sp, #72]
Lloh19:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh20:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_13
; %bb.12:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_13:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_FD,4,2                         ; @FD
	.comm	_TIOCCDTR,4,2                   ; @TIOCCDTR
	.comm	_TIOCSDTR,4,2                   ; @TIOCSDTR
	.comm	_MAXRETRY,4,2                   ; @MAXRETRY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"\r"

	.comm	_FIONREAD,4,2                   ; @FIONREAD
l_.str.1:                               ; @.str.1
	.asciz	"tip: ioctl"

	.no_dead_strip	_vensync
.subsections_via_symbols
