	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vchiq_lib_init
_vchiq_lib_init:                        ## @vchiq_lib_init
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%edi, %r14d
	xorl	%eax, %eax
	callq	_vcos_global_lock
	cmpb	$0, _vchiq_lib_init.mutex_initialised(%rip)
	jne	LBB0_2
## %bb.1:
	leaq	_vchiq_lib_init.vchiq_lib_mutex(%rip), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_vcos_mutex_create
	movq	_vchiq_default_lib_log_level@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_vchiq_lib_log_category@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_vcos_log_set_level
	leaq	L_.str.1(%rip), %rdi
	movq	%rbx, %rsi
	callq	_vcos_log_register
	movb	$1, _vchiq_lib_init.mutex_initialised(%rip)
LBB0_2:
	xorl	%eax, %eax
	callq	_vcos_global_unlock
	leaq	_vchiq_lib_init.vchiq_lib_mutex(%rip), %rdi
	callq	_vcos_mutex_lock
	movq	_vchiq_instance@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	testl	%eax, %eax
	je	LBB0_3
## %bb.9:
	jle	LBB0_11
## %bb.10:
	incl	%eax
	movq	_vchiq_instance@GOTPCREL(%rip), %rbx
	movl	%eax, (%rbx)
	jmp	LBB0_11
LBB0_3:
	cmpl	$-1, %r14d
	je	LBB0_4
## %bb.5:
	movl	%r14d, %edi
	callq	_dup
	jmp	LBB0_6
LBB0_4:
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdi
	callq	_open
LBB0_6:
	movq	_vchiq_instance@GOTPCREL(%rip), %r14
	movq	%rax, 8(%r14)
	testq	%rax, %rax
	js	LBB0_7
## %bb.8:
	movl	$16, -32(%rbp)
	leaq	-48(%rbp), %rcx
	movq	%rcx, -24(%rbp)
	movq	_VCHIQ_IOC_GET_CONFIG@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	leaq	-32(%rbp), %rdx
	movq	%rax, %rdi
	callq	_ioctl
	movl	%eax, %esi
	callq	_RETRY
	leaq	L_.str.5(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_vcos_log_error
	movq	8(%r14), %rdi
	callq	_close
	jmp	LBB0_11
LBB0_7:
	xorl	%ebx, %ebx
LBB0_11:
	leaq	_vchiq_lib_init.vchiq_lib_mutex(%rip), %rdi
	callq	_vcos_mutex_unlock
	movq	%rbx, %rax
	addq	$32, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_vchiq_lib_init.mutex_initialised,1,2 ## @vchiq_lib_init.mutex_initialised
.zerofill __DATA,__bss,_vchiq_lib_init.vchiq_lib_mutex,4,2 ## @vchiq_lib_init.vchiq_lib_mutex
	.comm	_vchiq_instance,32,3            ## @vchiq_instance
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vchiq-init"

	.comm	_vchiq_lib_log_category,4,2     ## @vchiq_lib_log_category
	.comm	_vchiq_default_lib_log_level,4,2 ## @vchiq_default_lib_log_level
L_.str.1:                               ## @.str.1
	.asciz	"vchiq_lib"

L_.str.2:                               ## @.str.2
	.asciz	"/dev/vchiq"

	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_VCHIQ_IOC_GET_CONFIG,4,2       ## @VCHIQ_IOC_GET_CONFIG
	.comm	_VCHIQ_VERSION_MIN,8,3          ## @VCHIQ_VERSION_MIN
	.comm	_VCHIQ_VERSION,8,3              ## @VCHIQ_VERSION
	.comm	_VCHIQ_VERSION_LIB_VERSION,8,3  ## @VCHIQ_VERSION_LIB_VERSION
	.comm	_VCHIQ_IOC_LIB_VERSION,4,2      ## @VCHIQ_IOC_LIB_VERSION
	.comm	_VCHIQ_VERSION_CLOSE_DELIVERED,8,3 ## @VCHIQ_VERSION_CLOSE_DELIVERED
L_.str.5:                               ## @.str.5
	.asciz	"Very incompatible VCHIQ library - cannot retrieve driver version"

	.no_dead_strip	_vchiq_lib_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vchiq_lib_init
_vchiq_lib_init:                        ; @vchiq_lib_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x0
	bl	_vcos_global_lock
	adrp	x21, _vchiq_lib_init.mutex_initialised@PAGE
	ldrb	w8, [x21, _vchiq_lib_init.mutex_initialised@PAGEOFF]
	tbnz	w8, #0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x0, _vchiq_lib_init.vchiq_lib_mutex@PAGE
Lloh1:
	add	x0, x0, _vchiq_lib_init.vchiq_lib_mutex@PAGEOFF
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_vcos_mutex_create
Lloh4:
	adrp	x8, _vchiq_default_lib_log_level@GOTPAGE
Lloh5:
	ldr	x8, [x8, _vchiq_default_lib_log_level@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
Lloh7:
	adrp	x20, _vchiq_lib_log_category@GOTPAGE
Lloh8:
	ldr	x20, [x20, _vchiq_lib_log_category@GOTPAGEOFF]
	mov	x0, x20
	bl	_vcos_log_set_level
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	bl	_vcos_log_register
	mov	w8, #1
	strb	w8, [x21, _vchiq_lib_init.mutex_initialised@PAGEOFF]
LBB0_2:
	bl	_vcos_global_unlock
Lloh11:
	adrp	x0, _vchiq_lib_init.vchiq_lib_mutex@PAGE
Lloh12:
	add	x0, x0, _vchiq_lib_init.vchiq_lib_mutex@PAGEOFF
	bl	_vcos_mutex_lock
Lloh13:
	adrp	x20, _vchiq_instance@GOTPAGE
Lloh14:
	ldr	x20, [x20, _vchiq_instance@GOTPAGEOFF]
	ldr	w8, [x20]
	cbz	w8, LBB0_5
; %bb.3:
Lloh15:
	adrp	x19, _vchiq_instance@GOTPAGE
Lloh16:
	ldr	x19, [x19, _vchiq_instance@GOTPAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.4:
	add	w8, w8, #1
	str	w8, [x19]
	b	LBB0_9
LBB0_5:
	cmn	w19, #1
	b.eq	LBB0_10
; %bb.6:
	mov	x0, x19
	bl	_dup
	str	x0, [x20, #8]
	tbnz	x0, #63, LBB0_8
LBB0_7:
	mov	w8, #16
	str	w8, [sp, #16]
	mov	x8, sp
	str	x8, [sp, #24]
Lloh17:
	adrp	x8, _VCHIQ_IOC_GET_CONFIG@GOTPAGE
Lloh18:
	ldr	x8, [x8, _VCHIQ_IOC_GET_CONFIG@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	add	x2, sp, #16
	bl	_ioctl
	mov	x1, x0
	bl	_RETRY
Lloh20:
	adrp	x0, l_.str.5@PAGE
Lloh21:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_vcos_log_error
	ldr	x0, [x20, #8]
	bl	_close
LBB0_8:
	mov	x19, #0
LBB0_9:
Lloh22:
	adrp	x0, _vchiq_lib_init.vchiq_lib_mutex@PAGE
Lloh23:
	add	x0, x0, _vchiq_lib_init.vchiq_lib_mutex@PAGEOFF
	bl	_vcos_mutex_unlock
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_10:
Lloh24:
	adrp	x8, _O_RDWR@GOTPAGE
Lloh25:
	ldr	x8, [x8, _O_RDWR@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
Lloh27:
	adrp	x0, l_.str.2@PAGE
Lloh28:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_open
	str	x0, [x20, #8]
	tbz	x0, #63, LBB0_7
	b	LBB0_8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_vchiq_lib_init.mutex_initialised,1,2 ; @vchiq_lib_init.mutex_initialised
.zerofill __DATA,__bss,_vchiq_lib_init.vchiq_lib_mutex,4,2 ; @vchiq_lib_init.vchiq_lib_mutex
	.comm	_vchiq_instance,32,3            ; @vchiq_instance
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vchiq-init"

	.comm	_vchiq_lib_log_category,4,2     ; @vchiq_lib_log_category
	.comm	_vchiq_default_lib_log_level,4,2 ; @vchiq_default_lib_log_level
l_.str.1:                               ; @.str.1
	.asciz	"vchiq_lib"

l_.str.2:                               ; @.str.2
	.asciz	"/dev/vchiq"

	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_VCHIQ_IOC_GET_CONFIG,4,2       ; @VCHIQ_IOC_GET_CONFIG
	.comm	_VCHIQ_VERSION_MIN,8,3          ; @VCHIQ_VERSION_MIN
	.comm	_VCHIQ_VERSION,8,3              ; @VCHIQ_VERSION
	.comm	_VCHIQ_VERSION_LIB_VERSION,8,3  ; @VCHIQ_VERSION_LIB_VERSION
	.comm	_VCHIQ_IOC_LIB_VERSION,4,2      ; @VCHIQ_IOC_LIB_VERSION
	.comm	_VCHIQ_VERSION_CLOSE_DELIVERED,8,3 ; @VCHIQ_VERSION_CLOSE_DELIVERED
l_.str.5:                               ; @.str.5
	.asciz	"Very incompatible VCHIQ library - cannot retrieve driver version"

	.no_dead_strip	_vchiq_lib_init
.subsections_via_symbols
