	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_usbvideo_AllocateDevice        ## -- Begin function usbvideo_AllocateDevice
	.p2align	4, 0x90
_usbvideo_AllocateDevice:               ## @usbvideo_AllocateDevice
	.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
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.3:
	movq	%rdi, %rbx
	callq	_usbvideo_find_struct
	cmpl	$-1, %eax
	je	LBB0_4
## %bb.5:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	8(%rbx), %rdx
	movslq	%eax, %rcx
	imulq	$56, %rcx, %rcx
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	leaq	(%rdx,%rcx), %rbx
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	movq	%rbx, %rdx
	callq	_dbg
	movq	%rbx, %rdi
	callq	_usbvideo_ClientIncModCount
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	_USBVIDEO_NUMSBUF@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rbx)
	jle	LBB0_10
## %bb.6:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rax,%rcx), %r15
	addq	$48, %r15
	xorl	%r12d, %r12d
	movq	_FRAMES_PER_DESC@GOTPCREL(%rip), %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r14), %edi
	movl	(%r13), %esi
	callq	_usb_alloc_urb
	movq	(%r15), %rcx
	movq	%rax, (%rcx,%r12,8)
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_8 Depth=1
	incq	%r12
	movslq	(%rbx), %rax
	cmpq	%rax, %r12
	jl	LBB0_8
LBB0_10:
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	leaq	(%r14,%rbx), %rdi
	addq	$8, %rdi
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%r14,%rbx)
	movq	$0, 32(%r14,%rbx)
	callq	_RingQueue_Initialize
	movq	_usbvideo_template@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%edi, 4(%r14,%rbx)
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdx
	leaq	L_.str.4(%rip), %rsi
	callq	_sprintf
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_11
LBB0_1:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_2
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
LBB0_2:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_err
	jmp	LBB0_12
LBB0_9:
	movl	(%r14), %esi
	leaq	L_.str.3(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_err
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	$0, 40(%rax,%rcx)
LBB0_11:
	movq	%rbx, %rdi
	callq	_mutex_unlock
	movq	%rbx, %rdi
	callq	_usbvideo_ClientDecModCount
LBB0_12:
	movq	%rbx, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No usbvideo handle?"

L_.str.1:                               ## @.str.1
	.asciz	"IBM USB camera driver: Too many devices!"

L_.str.2:                               ## @.str.2
	.asciz	"Device entry #%d. at $%p"

	.comm	_USBVIDEO_NUMSBUF,4,2           ## @USBVIDEO_NUMSBUF
	.comm	_FRAMES_PER_DESC,4,2            ## @FRAMES_PER_DESC
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.3:                               ## @.str.3
	.asciz	"usb_alloc_urb(%d.) failed."

	.comm	_usbvideo_template,4,2          ## @usbvideo_template
L_.str.4:                               ## @.str.4
	.asciz	"%.20s USB Camera"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_usbvideo_AllocateDevice        ; -- Begin function usbvideo_AllocateDevice
	.p2align	2
_usbvideo_AllocateDevice:               ; @usbvideo_AllocateDevice
	.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
	cbz	x0, LBB0_7
; %bb.1:
	mov	x20, x0
	bl	_usbvideo_find_struct
	cmn	w0, #1
	b.eq	LBB0_8
; %bb.2:
	mov	x1, x0
	ldr	x21, [x20, #8]
	sxtw	x22, w1
	mov	w8, #56
	smaddl	x19, w0, w8, x21
Lloh0:
	adrp	x0, l_.str.2@PAGE
Lloh1:
	add	x0, x0, l_.str.2@PAGEOFF
                                        ; kill: def $w1 killed $w1 killed $x1
	mov	x2, x19
	bl	_dbg
	mov	x0, x19
	bl	_usbvideo_ClientIncModCount
	mov	x0, x19
	bl	_mutex_lock
Lloh2:
	adrp	x23, _USBVIDEO_NUMSBUF@GOTPAGE
Lloh3:
	ldr	x23, [x23, _USBVIDEO_NUMSBUF@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.3:
	mov	x24, #0
	mov	w8, #56
	madd	x8, x22, x8, x21
	add	x25, x8, #48
Lloh4:
	adrp	x26, _FRAMES_PER_DESC@GOTPAGE
Lloh5:
	ldr	x26, [x26, _FRAMES_PER_DESC@GOTPAGEOFF]
Lloh6:
	adrp	x27, _GFP_KERNEL@GOTPAGE
Lloh7:
	ldr	x27, [x27, _GFP_KERNEL@GOTPAGEOFF]
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x26]
	ldr	w1, [x27]
	bl	_usb_alloc_urb
	ldr	x8, [x25]
	str	x0, [x8, x24, lsl #3]
	cbz	x0, LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x24, x24, #1
	ldrsw	x8, [x23]
	cmp	x24, x8
	b.lt	LBB0_4
LBB0_6:
	mov	w8, #56
	madd	x21, x22, x8, x21
	add	x0, x21, #8
	stp	xzr, xzr, [x21, #16]
	str	xzr, [x21, #32]
	bl	_RingQueue_Initialize
Lloh8:
	adrp	x8, _usbvideo_template@GOTPAGE
Lloh9:
	ldr	x8, [x8, _usbvideo_template@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	str	w0, [x21, #4]
	ldr	x2, [x20]
Lloh11:
	adrp	x1, l_.str.4@PAGE
Lloh12:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_sprintf
	b	LBB0_11
LBB0_7:
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_9
LBB0_8:
Lloh15:
	adrp	x0, l_.str.1@PAGE
Lloh16:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_9:
	bl	_err
	mov	x19, #0
	b	LBB0_12
LBB0_10:
	ldr	w8, [x26]
	str	x8, [sp]
Lloh17:
	adrp	x0, l_.str.3@PAGE
Lloh18:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_err
	mov	x19, #0
	mov	w8, #56
	madd	x8, x22, x8, x21
	str	xzr, [x8, #40]
LBB0_11:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x19
	bl	_usbvideo_ClientDecModCount
LBB0_12:
	mov	x0, x19
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No usbvideo handle?"

l_.str.1:                               ; @.str.1
	.asciz	"IBM USB camera driver: Too many devices!"

l_.str.2:                               ; @.str.2
	.asciz	"Device entry #%d. at $%p"

	.comm	_USBVIDEO_NUMSBUF,4,2           ; @USBVIDEO_NUMSBUF
	.comm	_FRAMES_PER_DESC,4,2            ; @FRAMES_PER_DESC
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.3:                               ; @.str.3
	.asciz	"usb_alloc_urb(%d.) failed."

	.comm	_usbvideo_template,4,2          ; @usbvideo_template
l_.str.4:                               ; @.str.4
	.asciz	"%.20s USB Camera"

.subsections_via_symbols
