	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wiiusb_hid_scan_for_devices
_wiiusb_hid_scan_for_devices:           ## @wiiusb_hid_scan_for_devices
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	_MAX_USERS@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movl	$24, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_10
## %bb.1:
	movq	%rax, %r14
	movl	(%rbx), %esi
	movq	_USB_CLASS_HID@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-36(%rbp), %rcx
	movq	%r14, %rdi
	callq	_USB_GetDeviceList
	testq	%rax, %rax
	js	LBB0_9
## %bb.2:
	cmpl	$0, -36(%rbp)
	je	LBB0_9
## %bb.3:
	xorl	%r12d, %r12d
	movq	%r14, %rbx
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	incq	%r12
	movl	-36(%rbp), %eax
	addq	$24, %rbx
	cmpq	%rax, %r12
	jae	LBB0_9
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	16(%rbx), %esi
	movq	%r15, %rdi
	callq	_wiiusb_hid_new_device
	testl	%eax, %eax
	je	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	cmpq	$0, (%rbx)
	jle	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	cmpq	$0, 8(%rbx)
	jle	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_wiiusb_hid_add_adapter
	jmp	LBB0_8
LBB0_9:
	movq	%r14, %rdi
	callq	_free
LBB0_10:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_USERS,4,2                  ## @MAX_USERS
	.comm	_USB_CLASS_HID,4,2              ## @USB_CLASS_HID
	.no_dead_strip	_wiiusb_hid_scan_for_devices
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wiiusb_hid_scan_for_devices
_wiiusb_hid_scan_for_devices:           ; @wiiusb_hid_scan_for_devices
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
Lloh0:
	adrp	x21, _MAX_USERS@GOTPAGE
Lloh1:
	ldr	x21, [x21, _MAX_USERS@GOTPAGEOFF]
	ldr	w0, [x21]
	mov	w1, #24
	bl	_calloc
	cbz	x0, LBB0_10
; %bb.1:
	mov	x20, x0
	ldr	w1, [x21]
Lloh2:
	adrp	x8, _USB_CLASS_HID@GOTPAGE
Lloh3:
	ldr	x8, [x8, _USB_CLASS_HID@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	add	x3, sp, #12
	bl	_USB_GetDeviceList
	tbnz	x0, #63, LBB0_9
; %bb.2:
	ldr	w8, [sp, #12]
	cbz	w8, LBB0_9
; %bb.3:
	mov	x22, #0
	mov	x21, x20
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x22, x22, #1
	ldr	w8, [sp, #12]
	add	x21, x21, #24
	cmp	x22, x8
	b.hs	LBB0_9
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x21, #16]
	mov	x0, x19
	bl	_wiiusb_hid_new_device
	cbz	w0, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x21]
	cmp	x8, #1
	b.lt	LBB0_4
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x21, #8]
	cmp	x8, #1
	b.lt	LBB0_4
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x21
	bl	_wiiusb_hid_add_adapter
	b	LBB0_4
LBB0_9:
	mov	x0, x20
	bl	_free
LBB0_10:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_USERS,4,2                  ; @MAX_USERS
	.comm	_USB_CLASS_HID,4,2              ; @USB_CLASS_HID
	.no_dead_strip	_wiiusb_hid_scan_for_devices
.subsections_via_symbols
