	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function em28xx_copy_video
_em28xx_copy_video:                     ## @em28xx_copy_video
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r8
	movq	(%rdi), %rbx
	movl	(%rbx), %r14d
	addl	%r14d, %r14d
	movq	(%rsi), %rax
	movq	8(%rsi), %r9
	leaq	(%rax,%rcx), %rsi
	movq	%r9, %rdi
	subq	%rax, %rdi
	cmpq	%r9, %rsi
	cmovbeq	%rcx, %rdi
	movq	%rdx, %r15
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	8(%rbx), %rcx
	testq	%rcx, %rcx
	jne	LBB0_2
## %bb.1:
	cmpq	$0, 24(%r8)
	je	LBB0_3
LBB0_2:
	movq	16(%r8), %rbx
	movslq	%r14d, %rsi
	movq	%rbx, %r12
LBB0_4:
	movq	%rax, %rdx
	orq	%rsi, %rdx
	shrq	$32, %rdx
	je	LBB0_5
## %bb.6:
	xorl	%edx, %edx
	divq	%rsi
	jmp	LBB0_7
LBB0_5:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%esi
                                        ## kill: def $edx killed $edx def $rdx
                                        ## kill: def $eax killed $eax def $rax
LBB0_7:
	testq	%rcx, %rcx
	sete	%cl
	imull	%r14d, %eax
	shll	%cl, %eax
	addl	%edx, %eax
	cltq
	addq	%rax, %r12
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	subl	%edx, %r14d
	cmpl	%edi, %r14d
	cmovgel	%edi, %r14d
	movslq	%r14d, %rsi
	addq	%r12, %rsi
	addq	%r9, %rbx
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movl	%edi, %r13d
	cmpq	%rbx, %rsi
	movq	%r8, -48(%rbp)                  ## 8-byte Spill
	jbe	LBB0_9
## %bb.8:
	subl	%ebx, %esi
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_em28xx_isocdbg
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	16(%rax), %r14d
	addl	8(%rax), %r14d
	subl	%r12d, %r14d
	movl	%r14d, %r13d
LBB0_9:
	testl	%r14d, %r14d
	jle	LBB0_16
## %bb.10:
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	%r14d, %edx
	callq	_memcpy
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	subl	%r14d, %r13d
	jle	LBB0_15
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	cmpq	$0, 8(%rax)
	movq	%r12, %rax
	movl	$0, %ecx
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	cmovel	%esi, %ecx
	addl	%r14d, %ecx
	movslq	%ecx, %r12
	addq	%rax, %r12
	cmpl	%r13d, %esi
	movl	%r13d, %ebx
	cmovll	%esi, %ebx
	movslq	%ebx, %rsi
	addq	%r12, %rsi
	movq	16(%rdx), %rax
	addq	8(%rdx), %rax
	cmpq	%rax, %rsi
	jbe	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	subl	%eax, %esi
	leaq	L_.str.1(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_em28xx_isocdbg
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movl	16(%rdx), %ebx
	addl	8(%rdx), %ebx
	subl	%r12d, %ebx
	movl	%ebx, %r13d
LBB0_13:                                ##   in Loop: Header=BB0_11 Depth=1
	testl	%ebx, %ebx
	jle	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_11 Depth=1
	movl	%r14d, %eax
	addq	%rax, %r15
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_memcpy
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movl	%ebx, %r14d
	subl	%ebx, %r13d
	jg	LBB0_11
LBB0_15:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	addq	%rax, (%rdx)
LBB0_16:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	16(%r8), %rbx
	movslq	%r14d, %rsi
	leaq	(%rbx,%rsi), %r12
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Overflow of %zu bytes past buffer end (1)\n"

L_.str.1:                               ## @.str.1
	.asciz	"Overflow of %zu bytes past buffer end(2)\n"

	.no_dead_strip	_em28xx_copy_video
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function em28xx_copy_video
_em28xx_copy_video:                     ; @em28xx_copy_video
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x2
	mov	x19, x1
	ldr	x25, [x0]
	ldr	w8, [x25]
	lsl	w26, w8, #1
	ldp	x9, x8, [x1]
	sub	x10, x8, x9
	add	x11, x9, x3
	cmp	x11, x8
	csel	x27, x10, x3, hi
	mov	x23, x27
	ldr	x11, [x25, #8]
	cbnz	x11, LBB0_2
; %bb.1:
	ldr	x10, [x19, #24]
	cbz	x10, LBB0_14
LBB0_2:
	ldr	x10, [x19, #16]
	sxtw	x12, w26
	mov	x13, x10
LBB0_3:
	cmp	x11, #0
	cset	w11, eq
	udiv	x14, x9, x12
	msub	w9, w14, w12, w9
	mul	w12, w26, w14
	lsl	w11, w12, w11
	add	w11, w11, w9
	add	x21, x13, w11, sxtw
	sub	w9, w26, w9
	cmp	w9, w23
	csel	w22, w9, w23, lt
	add	x9, x21, w22, sxtw
	add	x8, x10, x8
	cmp	x9, x8
	b.ls	LBB0_5
; %bb.4:
	sub	w1, w9, w8
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_em28xx_isocdbg
	ldr	w8, [x19, #16]
	ldr	w9, [x19, #8]
	add	w8, w8, w9
	sub	w22, w8, w21
	mov	x23, x22
LBB0_5:
	cmp	w22, #1
	b.lt	LBB0_13
; %bb.6:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x22
	bl	_memcpy
	sub	w28, w23, w22
	cmp	w28, #1
	b.lt	LBB0_12
; %bb.7:
Lloh2:
	adrp	x23, l_.str.1@PAGE
Lloh3:
	add	x23, x23, l_.str.1@PAGEOFF
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x25, #8]
	cmp	x8, #0
	csel	w8, w26, wzr, eq
	add	w8, w8, w22
	add	x21, x21, w8, sxtw
	cmp	w26, w28
	csel	w24, w26, w28, lt
	add	x8, x21, w24, sxtw
	ldp	x10, x9, [x19, #8]
	add	x9, x9, x10
	cmp	x8, x9
	b.ls	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	sub	w1, w8, w9
	mov	x0, x23
	bl	_em28xx_isocdbg
	ldr	w8, [x19, #16]
	ldr	w9, [x19, #8]
	add	w8, w8, w9
	sub	w24, w8, w21
	mov	x28, x24
LBB0_10:                                ;   in Loop: Header=BB0_8 Depth=1
	cmp	w24, #1
	b.lt	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	add	x20, x20, w22, uxtw
	mov	x0, x21
	mov	x1, x20
	mov	x2, x24
	bl	_memcpy
	sub	w28, w28, w24
	mov	x22, x24
	cmp	w28, #0
	b.gt	LBB0_8
LBB0_12:
	ldr	x8, [x19]
	add	x8, x8, x27
	str	x8, [x19]
LBB0_13:
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_14:
	ldr	x10, [x19, #16]
	mov	x12, x26
	sxtw	x12, w12
	add	x13, x10, x12
	b	LBB0_3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Overflow of %zu bytes past buffer end (1)\n"

l_.str.1:                               ; @.str.1
	.asciz	"Overflow of %zu bytes past buffer end(2)\n"

	.no_dead_strip	_em28xx_copy_video
.subsections_via_symbols
