	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cosa_open
_cosa_open:                             ## @cosa_open
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	_cosa_chardev_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	%r13, %rdi
	callq	_file_inode
	movl	%eax, %edi
	callq	_iminor
	movq	_CARD_MINOR_BITS@GOTPCREL(%rip), %r15
	movb	(%r15), %cl
	sarl	%cl, %eax
	movq	_nr_cards@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jge	LBB0_1
## %bb.3:
	movq	_cosa_cards@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r14
	movslq	%eax, %rbx
	movq	%r13, %rdi
	callq	_file_inode
	movl	%eax, %edi
	callq	_iminor
	movb	(%r15), %cl
	movl	$-1, %edx
	shll	%cl, %edx
	notl	%edx
	andl	%eax, %edx
	leaq	(%rbx,%rbx,2), %rbx
	cmpl	(%r14,%rbx,8), %edx
	jge	LBB0_1
## %bb.4:
	movq	16(%r14,%rbx,8), %r15
	movslq	%edx, %rax
	leaq	(%rax,%rax,2), %r12
	leaq	(%r15,%r12,8), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, (%r13)
	leaq	(%r14,%rbx,8), %r13
	addq	$4, %r13
	movq	%r13, %rdi
	callq	_spin_lock_irqsave
	movq	(%r15,%r12,8), %rax
	testq	%rax, %rax
	js	LBB0_5
## %bb.6:
	incl	8(%r14,%rbx,8)
	incq	%rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	movq	_chrdev_tx_done@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r15,%r12,8)
	movq	_chrdev_setup_rx@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r15,%r12,8)
	movq	_chrdev_rx_done@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r15,%r12,8)
	movq	%r13, %rdi
	callq	_spin_unlock_irqrestore
	xorl	%ebx, %ebx
	jmp	LBB0_7
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_7:
	movq	_cosa_chardev_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	%r13, %rdi
	callq	_spin_unlock_irqrestore
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
	.comm	_cosa_chardev_mutex,4,2         ## @cosa_chardev_mutex
	.comm	_CARD_MINOR_BITS,4,2            ## @CARD_MINOR_BITS
	.comm	_nr_cards,4,2                   ## @nr_cards
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_cosa_cards,8,3                 ## @cosa_cards
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_chrdev_tx_done,4,2             ## @chrdev_tx_done
	.comm	_chrdev_setup_rx,4,2            ## @chrdev_setup_rx
	.comm	_chrdev_rx_done,4,2             ## @chrdev_rx_done
	.no_dead_strip	_cosa_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cosa_open
_cosa_open:                             ; @cosa_open
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x1
Lloh0:
	adrp	x0, _cosa_chardev_mutex@GOTPAGE
Lloh1:
	ldr	x0, [x0, _cosa_chardev_mutex@GOTPAGEOFF]
	bl	_mutex_lock
	mov	x0, x19
	bl	_file_inode
	bl	_iminor
Lloh2:
	adrp	x22, _CARD_MINOR_BITS@GOTPAGE
Lloh3:
	ldr	x22, [x22, _CARD_MINOR_BITS@GOTPAGEOFF]
	ldr	w8, [x22]
	asr	w21, w0, w8
Lloh4:
	adrp	x8, _nr_cards@GOTPAGE
Lloh5:
	ldr	x8, [x8, _nr_cards@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w21, w8
	b.ge	LBB0_4
; %bb.1:
Lloh7:
	adrp	x8, _cosa_cards@GOTPAGE
Lloh8:
	ldr	x8, [x8, _cosa_cards@GOTPAGEOFF]
Lloh9:
	ldr	x20, [x8]
	mov	x0, x19
	bl	_file_inode
	bl	_iminor
	ldr	w8, [x22]
	mov	w9, #-1
	lsl	w8, w9, w8
	bic	w22, w0, w8
	mov	w8, #24
	smull	x9, w21, w8
	ldr	w9, [x20, x9]
	cmp	w22, w9
	b.ge	LBB0_4
; %bb.2:
	sxtw	x24, w21
	madd	x9, x24, x8, x20
	ldr	x21, [x9, #16]
	smaddl	x23, w22, w8, x21
	str	x23, [x19]
	add	x19, x9, #4
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	x8, [x23]
	tbnz	x8, #63, LBB0_7
; %bb.3:
	sxtw	x9, w22
	mov	w10, #24
	madd	x11, x24, x10, x20
	ldr	w12, [x11, #8]
	add	w12, w12, #1
	str	w12, [x11, #8]
	add	x8, x8, #1
Lloh10:
	adrp	x11, _chrdev_tx_done@GOTPAGE
Lloh11:
	ldr	x11, [x11, _chrdev_tx_done@GOTPAGEOFF]
	str	x8, [x23]
Lloh12:
	ldr	w8, [x11]
	madd	x9, x9, x10, x21
	str	w8, [x9, #16]
Lloh13:
	adrp	x8, _chrdev_setup_rx@GOTPAGE
Lloh14:
	ldr	x8, [x8, _chrdev_setup_rx@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	str	w8, [x9, #12]
Lloh16:
	adrp	x8, _chrdev_rx_done@GOTPAGE
Lloh17:
	ldr	x8, [x8, _chrdev_rx_done@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w8, [x9, #8]
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	mov	w19, #0
	b	LBB0_6
LBB0_4:
Lloh19:
	adrp	x8, _ENODEV@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_6:
Lloh21:
	adrp	x0, _cosa_chardev_mutex@GOTPAGE
Lloh22:
	ldr	x0, [x0, _cosa_chardev_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_7:
	mov	x0, x19
	bl	_spin_unlock_irqrestore
Lloh23:
	adrp	x8, _EBUSY@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_cosa_chardev_mutex,4,2         ; @cosa_chardev_mutex
	.comm	_CARD_MINOR_BITS,4,2            ; @CARD_MINOR_BITS
	.comm	_nr_cards,4,2                   ; @nr_cards
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_cosa_cards,8,3                 ; @cosa_cards
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_chrdev_tx_done,4,2             ; @chrdev_tx_done
	.comm	_chrdev_setup_rx,4,2            ; @chrdev_setup_rx
	.comm	_chrdev_rx_done,4,2             ; @chrdev_rx_done
	.no_dead_strip	_cosa_open
.subsections_via_symbols
