	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov51x_alloc
_ov51x_alloc:                           ## @ov51x_alloc
	.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	%rdi, %r15
	movl	(%rdi), %r12d
	movl	4(%rdi), %r14d
	movq	_OV511_NUMFRAMES@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	%r12d, %edi
	movl	%r14d, %esi
	callq	_MAX_DATA_SIZE
	movl	%eax, %r13d
	movl	(%rbx), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	%r12d, %edi
	movl	%r14d, %esi
	callq	_MAX_RAW_DATA_SIZE
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	leaq	L_.str(%rip), %rsi
	movl	$4, %edi
	xorl	%eax, %eax
	callq	_PDEBUG
	leaq	16(%r15), %rbx
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	8(%r15), %rax
	movq	_BUF_ALLOCATED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
LBB0_13:
	movq	%rbx, %rdi
	callq	_mutex_unlock
	leaq	L_.str.3(%rip), %rsi
	movl	$4, %edi
	xorl	%eax, %eax
	callq	_PDEBUG
	xorl	%ebx, %ebx
	jmp	LBB0_15
LBB0_1:
	movl	%r12d, -68(%rbp)                ## 4-byte Spill
	imull	-48(%rbp), %r13d                ## 4-byte Folded Reload
	movl	%r13d, %edi
	callq	_rvmalloc
	movq	%rax, 48(%r15)
	testq	%rax, %rax
	movl	%r14d, -64(%rbp)                ## 4-byte Spill
	movq	%rbx, %r12
	movl	-56(%rbp), %ebx                 ## 4-byte Reload
	je	LBB0_14
## %bb.2:
	imull	-60(%rbp), %ebx                 ## 4-byte Folded Reload
	movl	%ebx, %edi
	callq	_vmalloc
	movq	%rax, 40(%r15)
	testq	%rax, %rax
	je	LBB0_14
## %bb.3:
	movq	%rax, %rdi
	xorl	%esi, %esi
	movl	%ebx, %edx
	callq	_memset
	movl	%ebx, %edi
	callq	_vmalloc
	movq	%rax, 32(%r15)
	testq	%rax, %rax
	je	LBB0_14
## %bb.4:
	movq	%rax, %rdi
	xorl	%esi, %esi
	movl	%ebx, %edx
	callq	_memset
	movq	_OV511_NUMSBUF@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rbx)
	jle	LBB0_8
## %bb.5:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r13
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	_MAX_FRAME_SIZE_PER_DESC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_FRAMES_PER_DESC@GOTPCREL(%rip), %rax
	imull	(%rax), %edi
	movl	(%r13), %esi
	callq	_kmalloc
	movq	56(%r15), %rcx
	movl	%eax, (%rcx,%r14,4)
	testl	%eax, %eax
	je	LBB0_14
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$4, %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_PDEBUG
	incq	%r14
	movslq	(%rbx), %rax
	cmpq	%rax, %r14
	jl	LBB0_6
LBB0_8:
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	movq	_OV511_NUMFRAMES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_12
## %bb.9:
	xorl	%r13d, %r13d
	xorl	%r14d, %r14d
	movl	-68(%rbp), %ebx                 ## 4-byte Reload
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	48(%r15), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	-64(%rbp), %r12d                ## 4-byte Reload
	movl	%ebx, %edi
	movl	%r12d, %esi
	callq	_MAX_DATA_SIZE
	imull	%r14d, %eax
	cltq
	addq	-48(%rbp), %rax                 ## 8-byte Folded Reload
	movq	24(%r15), %rcx
	movq	%rax, 8(%rcx,%r13)
	movq	40(%r15), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	%ebx, %edi
	movl	%r12d, %esi
	callq	_MAX_RAW_DATA_SIZE
	imull	%r14d, %eax
	cltq
	addq	-48(%rbp), %rax                 ## 8-byte Folded Reload
	movq	24(%r15), %rcx
	movq	%rax, 24(%rcx,%r13)
	movq	32(%r15), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	%ebx, %edi
	movl	%r12d, %esi
	callq	_MAX_RAW_DATA_SIZE
	imull	%r14d, %eax
	cltq
	addq	-48(%rbp), %rax                 ## 8-byte Folded Reload
	movq	24(%r15), %rcx
	movq	%rax, 16(%rcx,%r13)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	___get_free_page
	movq	24(%r15), %rcx
	movq	%rax, (%rcx,%r13)
	testq	%rax, %rax
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	8(%rcx,%r13), %rcx
	movl	$4, %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_PDEBUG
	incq	%r14
	movq	_OV511_NUMFRAMES@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$32, %r13
	cmpq	%rax, %r14
	jl	LBB0_10
LBB0_12:
	movq	_BUF_ALLOCATED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%r15)
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_13
LBB0_14:
	movq	%r15, %rdi
	callq	_ov51x_do_dealloc
	movq	%r12, %rdi
	callq	_mutex_unlock
	leaq	L_.str.4(%rip), %rsi
	xorl	%ebx, %ebx
	movl	$4, %edi
	xorl	%eax, %eax
	callq	_PDEBUG
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_15:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_OV511_NUMFRAMES,4,2            ## @OV511_NUMFRAMES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"entered"

	.comm	_BUF_ALLOCATED,8,3              ## @BUF_ALLOCATED
	.comm	_OV511_NUMSBUF,4,2              ## @OV511_NUMSBUF
	.comm	_FRAMES_PER_DESC,4,2            ## @FRAMES_PER_DESC
	.comm	_MAX_FRAME_SIZE_PER_DESC,4,2    ## @MAX_FRAME_SIZE_PER_DESC
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.1:                               ## @.str.1
	.asciz	"sbuf[%d] @ %p"

L_.str.2:                               ## @.str.2
	.asciz	"frame[%d] @ %p"

L_.str.3:                               ## @.str.3
	.asciz	"leaving"

L_.str.4:                               ## @.str.4
	.asciz	"errored"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_ov51x_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov51x_alloc
_ov51x_alloc:                           ; @ov51x_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x19, x0
	ldp	w20, w21, [x0]
Lloh0:
	adrp	x25, _OV511_NUMFRAMES@GOTPAGE
Lloh1:
	ldr	x25, [x25, _OV511_NUMFRAMES@GOTPAGEOFF]
	ldr	w27, [x25]
	mov	x0, x20
	mov	x1, x21
	bl	_MAX_DATA_SIZE
	mov	x24, x0
	ldr	w26, [x25]
	mov	x0, x20
	mov	x1, x21
	bl	_MAX_RAW_DATA_SIZE
	mov	x23, x0
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #4
	bl	_PDEBUG
	add	x22, x19, #16
	mov	x0, x22
	bl	_mutex_lock
	ldr	x8, [x19, #8]
Lloh4:
	adrp	x9, _BUF_ALLOCATED@GOTPAGE
Lloh5:
	ldr	x9, [x9, _BUF_ALLOCATED@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
LBB0_1:
	mov	x0, x22
	bl	_mutex_unlock
Lloh7:
	adrp	x1, l_.str.3@PAGE
Lloh8:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #4
	bl	_PDEBUG
	mov	w0, #0
	b	LBB0_15
LBB0_2:
	mul	w0, w24, w27
	bl	_rvmalloc
	str	x0, [x19, #48]
	cbz	x0, LBB0_14
; %bb.3:
	mul	w23, w23, w26
	mov	x0, x23
	bl	_vmalloc
	str	x0, [x19, #40]
	cbz	x0, LBB0_14
; %bb.4:
	mov	w1, #0
	mov	x2, x23
	bl	_memset
	mov	x0, x23
	bl	_vmalloc
	str	x0, [x19, #32]
	cbz	x0, LBB0_14
; %bb.5:
	mov	w1, #0
	mov	x2, x23
	bl	_memset
Lloh9:
	adrp	x27, _OV511_NUMSBUF@GOTPAGE
Lloh10:
	ldr	x27, [x27, _OV511_NUMSBUF@GOTPAGEOFF]
	ldr	w8, [x27]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.6:
	mov	x28, #0
Lloh11:
	adrp	x26, _FRAMES_PER_DESC@GOTPAGE
Lloh12:
	ldr	x26, [x26, _FRAMES_PER_DESC@GOTPAGEOFF]
Lloh13:
	adrp	x24, _MAX_FRAME_SIZE_PER_DESC@GOTPAGE
Lloh14:
	ldr	x24, [x24, _MAX_FRAME_SIZE_PER_DESC@GOTPAGEOFF]
Lloh15:
	adrp	x23, l_.str.1@PAGE
Lloh16:
	add	x23, x23, l_.str.1@PAGEOFF
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x26]
	ldr	w9, [x24]
	mul	w0, w9, w8
Lloh17:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	bl	_kmalloc
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	x8, [x19, #56]
	str	w0, [x8, x28, lsl #2]
	cbz	w0, LBB0_14
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	stp	x28, x0, [sp]
	mov	w0, #4
	mov	x1, x23
	bl	_PDEBUG
	add	x28, x28, #1
	ldrsw	x8, [x27]
	cmp	x28, x8
	b.lt	LBB0_7
LBB0_9:
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.10:
	mov	x27, #0
	mov	x28, #0
Lloh20:
	adrp	x23, l_.str.2@PAGE
Lloh21:
	add	x23, x23, l_.str.2@PAGEOFF
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x24, [x19, #48]
	mov	x0, x20
	mov	x1, x21
	bl	_MAX_DATA_SIZE
	mul	w8, w0, w28
	add	x8, x24, w8, sxtw
	ldr	x9, [x19, #24]
	add	x9, x9, x27
	str	x8, [x9, #8]
	ldr	x24, [x19, #40]
	mov	x0, x20
	mov	x1, x21
	bl	_MAX_RAW_DATA_SIZE
	mul	w8, w0, w28
	add	x8, x24, w8, sxtw
	ldp	x9, x24, [x19, #24]
	add	x9, x9, x27
	str	x8, [x9, #24]
	mov	x0, x20
	mov	x1, x21
	bl	_MAX_RAW_DATA_SIZE
	mul	w8, w0, w28
	add	x8, x24, w8, sxtw
	ldr	x9, [x19, #24]
	add	x9, x9, x27
	str	x8, [x9, #16]
Lloh22:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
	bl	___get_free_page
	ldr	x8, [x19, #24]
	str	x0, [x8, x27]
	cbz	x0, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	add	x8, x8, x27
	ldr	x8, [x8, #8]
	stp	x28, x8, [sp]
	mov	w0, #4
	mov	x1, x23
	bl	_PDEBUG
	add	x28, x28, #1
	ldrsw	x8, [x25]
	add	x27, x27, #32
	cmp	x28, x8
	b.lt	LBB0_11
LBB0_13:
Lloh25:
	adrp	x8, _BUF_ALLOCATED@GOTPAGE
Lloh26:
	ldr	x8, [x8, _BUF_ALLOCATED@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
	str	x8, [x19, #8]
	b	LBB0_1
LBB0_14:
	mov	x0, x19
	bl	_ov51x_do_dealloc
	mov	x0, x22
	bl	_mutex_unlock
Lloh28:
	adrp	x1, l_.str.4@PAGE
Lloh29:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #4
	bl	_PDEBUG
Lloh30:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh31:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_OV511_NUMFRAMES,4,2            ; @OV511_NUMFRAMES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"entered"

	.comm	_BUF_ALLOCATED,8,3              ; @BUF_ALLOCATED
	.comm	_OV511_NUMSBUF,4,2              ; @OV511_NUMSBUF
	.comm	_FRAMES_PER_DESC,4,2            ; @FRAMES_PER_DESC
	.comm	_MAX_FRAME_SIZE_PER_DESC,4,2    ; @MAX_FRAME_SIZE_PER_DESC
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.1:                               ; @.str.1
	.asciz	"sbuf[%d] @ %p"

l_.str.2:                               ; @.str.2
	.asciz	"frame[%d] @ %p"

l_.str.3:                               ; @.str.3
	.asciz	"leaving"

l_.str.4:                               ; @.str.4
	.asciz	"errored"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_ov51x_alloc
.subsections_via_symbols
