	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function intel_th_subdevice_alloc
_intel_th_subdevice_alloc:              ## @intel_th_subdevice_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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	(%rsi), %rsi
	movl	32(%r12), %edx
	movl	40(%r12), %ecx
	callq	_intel_th_device_alloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%rax, %r15
	movq	%rbx, -104(%rbp)                ## 8-byte Spill
	movl	40(%rbx), %eax
	movl	%eax, 24(%r15)
	movl	8(%r12), %eax
	movl	36(%r12), %esi
	shll	$2, %eax
	leal	(%rax,%rax,2), %edx
	leaq	-96(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_memcpy
	movl	8(%r12), %edx
	testl	%edx, %edx
	jle	LBB0_17
## %bb.4:
	movq	%r15, -112(%rbp)                ## 8-byte Spill
	xorl	%r13d, %r13d
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r15d, %rcx
	leaq	(%rcx,%rcx,2), %rcx
	movl	8(%r14,%rcx,4), %edx
	addl	%edx, 8(%rbx)
	addl	8(%r14,%rcx,4), %eax
	movl	%eax, (%rbx)
	movq	-104(%rbp), %rax                ## 8-byte Reload
	movl	24(%rax), %edi
	movl	32(%r12), %edx
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %ecx
	movq	%rbx, %r8
	callq	_dev_dbg
	movq	-104(%rbp), %rsi                ## 8-byte Reload
LBB0_15:                                ##   in Loop: Header=BB0_5 Depth=1
	incq	%r13
	movslq	8(%r12), %rdx
	addq	$12, %rbx
	cmpq	%rdx, %r13
	jge	LBB0_16
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	32(%rsi), %r14
	movq	_TH_MMIO_CONFIG@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movl	(%rbx), %eax
	testl	%eax, %eax
	jne	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	4(%rbx), %ecx
	xorl	%eax, %eax
	movq	_IORESOURCE_MEM@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	jne	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	8(%rbx), %r15d
	cmpl	(%rsi), %r15d
	jge	LBB0_31
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r15d, %rax
	movl	$0, 8(%rbx)
	leaq	(%rax,%rax,2), %rax
	leaq	(%r14,%rax,4), %rdi
	callq	_resource_size
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	decl	%eax
	movl	%eax, (%rbx)
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	4(%rbx), %ecx
	movq	_IORESOURCE_MEM@GOTPCREL(%rip), %rdx
	testl	%ecx, (%rdx)
	jne	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	_IORESOURCE_IRQ@GOTPCREL(%rip), %rax
	testl	%ecx, (%rax)
	je	LBB0_15
## %bb.12:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	_has_mintctl@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	callq	_INTEL_TH_CAP
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	testq	%rax, %rax
	je	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	4(%rsi), %eax
	cmpl	$-1, %eax
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	%eax, 8(%rbx)
	jmp	LBB0_15
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	subl	(%rax), %edi
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_35
## %bb.2:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_16:
	movq	-112(%rbp), %r15                ## 8-byte Reload
LBB0_17:
	leaq	-96(%rbp), %rsi
	movq	%r15, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_intel_th_device_add_resources
	testl	%eax, %eax
	je	LBB0_19
## %bb.18:
	movl	%eax, %ebx
	leaq	4(%r15), %rdi
	callq	_put_device
	jmp	LBB0_32
LBB0_19:
	movq	(%r12), %rax
	movq	_INTEL_TH_OUTPUT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_23
## %bb.20:
	cmpq	$0, 24(%r12)
	je	LBB0_22
## %bb.21:
	movq	-104(%rbp), %rax                ## 8-byte Reload
	movl	16(%rax), %esi
	movl	20(%rax), %edi
	callq	_MKDEV
	movl	%eax, 4(%r15)
LBB0_22:
	movl	16(%r12), %eax
	movl	%eax, 20(%r15)
	movl	$-1, 12(%r15)
	movl	12(%r12), %eax
	movl	%eax, 16(%r15)
	jmp	LBB0_27
LBB0_23:
	movq	_INTEL_TH_SWITCH@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_27
## %bb.24:
	movq	_host_mode_only@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	callq	_INTEL_TH_CAP
	movl	$1, %ecx
	testq	%rax, %rax
	jne	LBB0_26
## %bb.25:
	movq	_host_mode@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
LBB0_26:
	movl	%ecx, (%r15)
	movq	-104(%rbp), %rax                ## 8-byte Reload
	movq	%r15, 8(%rax)
LBB0_27:
	leaq	4(%r15), %r14
	movq	%r14, %rdi
	callq	_device_add
	testl	%eax, %eax
	je	LBB0_29
## %bb.28:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_put_device
	movl	8(%r15), %edi
	callq	_kfree
	jmp	LBB0_32
LBB0_29:
	movq	(%r12), %rax
	movq	_INTEL_TH_SWITCH@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_33
## %bb.30:
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	callq	_intel_th_request_hub_module
	jmp	LBB0_33
LBB0_31:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	-112(%rbp), %r15                ## 8-byte Reload
LBB0_32:
	addq	$4, %r15
	movq	%r15, %rdi
	callq	_put_device
	movl	%ebx, %edi
	callq	_ERR_PTR
	movq	%rax, %r15
LBB0_33:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_35
## %bb.34:
	movq	%r15, %rax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_35:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_TH_MMIO_CONFIG,4,2             ## @TH_MMIO_CONFIG
	.comm	_IORESOURCE_MEM,4,2             ## @IORESOURCE_MEM
	.comm	_ENODEV,4,2                     ## @ENODEV
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s:%d @ %pR\n"

	.comm	_IORESOURCE_IRQ,4,2             ## @IORESOURCE_IRQ
	.comm	_has_mintctl,4,2                ## @has_mintctl
	.comm	_INTEL_TH_OUTPUT,8,3            ## @INTEL_TH_OUTPUT
	.comm	_INTEL_TH_SWITCH,8,3            ## @INTEL_TH_SWITCH
	.comm	_host_mode_only,4,2             ## @host_mode_only
	.comm	_host_mode,4,2                  ## @host_mode
	.no_dead_strip	_intel_th_subdevice_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function intel_th_subdevice_alloc
_intel_th_subdevice_alloc:              ; @intel_th_subdevice_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x21, x1
	mov	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #56]
	ldr	x1, [x1]
	ldr	w2, [x21, #32]
	ldr	w3, [x21, #40]
	bl	_intel_th_device_alloc
	cbz	x0, LBB0_15
; %bb.1:
	mov	x19, x0
	ldr	w8, [x20, #40]
	str	w8, [x0, #24]
	ldr	w1, [x21, #36]
	ldr	w8, [x21, #8]
	add	w8, w8, w8, lsl #1
	lsl	w2, w8, #2
	add	x0, sp, #16
	bl	_memcpy
	ldr	w2, [x21, #8]
	cmp	w2, #1
	b.lt	LBB0_18
; %bb.2:
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
	mov	x22, #0
	add	x23, sp, #16
Lloh3:
	adrp	x25, _TH_MMIO_CONFIG@GOTPAGE
Lloh4:
	ldr	x25, [x25, _TH_MMIO_CONFIG@GOTPAGEOFF]
Lloh5:
	adrp	x26, _IORESOURCE_MEM@GOTPAGE
Lloh6:
	ldr	x26, [x26, _IORESOURCE_MEM@GOTPAGEOFF]
	mov	w27, #12
Lloh7:
	adrp	x24, l_.str@PAGE
Lloh8:
	add	x24, x24, l_.str@PAGEOFF
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	smaddl	x9, w19, w27, x28
	ldr	w10, [x9, #8]
	ldr	w11, [x23, #8]
	add	w10, w11, w10
	str	w10, [x23, #8]
	ldr	w9, [x9, #8]
	add	w8, w8, w9
	str	w8, [x23]
	ldr	w0, [x20, #24]
	ldr	w2, [x21, #32]
	mov	x1, x24
	mov	x3, x22
	mov	x4, x23
	bl	_dev_dbg
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x22, x22, #1
	ldrsw	x2, [x21, #8]
	add	x23, x23, #12
	cmp	x22, x2
	b.ge	LBB0_17
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x28, [x20, #32]
	ldr	w19, [x25]
	ldr	w8, [x23]
	cbnz	w8, LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x23, #4]
	ldr	w9, [x26]
	cmp	w8, w9
	b.ne	LBB0_9
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w19, [x23, #8]
	ldr	w8, [x20]
	cmp	w19, w8
	b.ge	LBB0_30
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	sxtw	x8, w19
	str	wzr, [x23, #8]
	madd	x0, x8, x27, x28
	bl	_resource_size
	sub	w8, w0, #1
	str	w8, [x23]
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	w8, #0
LBB0_10:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x23, #4]
	ldr	w10, [x26]
	tst	w10, w9
	b.ne	LBB0_3
; %bb.11:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh9:
	adrp	x8, _IORESOURCE_IRQ@GOTPAGE
Lloh10:
	ldr	x8, [x8, _IORESOURCE_IRQ@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tst	w8, w9
	b.eq	LBB0_4
; %bb.12:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh12:
	adrp	x8, _has_mintctl@GOTPAGE
Lloh13:
	ldr	x8, [x8, _has_mintctl@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_INTEL_TH_CAP
	cbz	x0, LBB0_4
; %bb.13:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x20, #4]
	cmn	w8, #1
	b.eq	LBB0_4
; %bb.14:                               ;   in Loop: Header=BB0_5 Depth=1
	str	w8, [x23, #8]
	b	LBB0_4
LBB0_15:
Lloh15:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	ldr	x9, [sp, #56]
Lloh18:
	adrp	x10, ___stack_chk_guard@GOTPAGE
Lloh19:
	ldr	x10, [x10, ___stack_chk_guard@GOTPAGEOFF]
Lloh20:
	ldr	x10, [x10]
	cmp	x10, x9
	b.ne	LBB0_34
; %bb.16:
	neg	w0, w8
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	b	_ERR_PTR
LBB0_17:
	ldr	x19, [sp, #8]                   ; 8-byte Folded Reload
LBB0_18:
	add	x1, sp, #16
	mov	x0, x19
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_intel_th_device_add_resources
	cbz	w0, LBB0_20
; %bb.19:
	mov	x22, x0
	add	x0, x19, #4
	bl	_put_device
	b	LBB0_31
LBB0_20:
	ldr	x8, [x21]
Lloh21:
	adrp	x9, _INTEL_TH_OUTPUT@GOTPAGE
Lloh22:
	ldr	x9, [x9, _INTEL_TH_OUTPUT@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_24
; %bb.21:
	ldr	x8, [x21, #24]
	cbz	x8, LBB0_23
; %bb.22:
	ldp	w1, w0, [x20, #16]
	bl	_MKDEV
	str	w0, [x19, #4]
LBB0_23:
	mov	w8, #-1
	str	w8, [x19, #12]
	ldur	d0, [x21, #12]
	str	d0, [x19, #16]
	b	LBB0_26
LBB0_24:
Lloh24:
	adrp	x9, _INTEL_TH_SWITCH@GOTPAGE
Lloh25:
	ldr	x9, [x9, _INTEL_TH_SWITCH@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_26
; %bb.25:
Lloh27:
	adrp	x8, _host_mode_only@GOTPAGE
Lloh28:
	ldr	x8, [x8, _host_mode_only@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_INTEL_TH_CAP
Lloh30:
	adrp	x8, _host_mode@GOTPAGE
Lloh31:
	ldr	x8, [x8, _host_mode@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	cmp	x0, #0
	csinc	w8, w8, wzr, eq
	str	w8, [x19]
	str	x19, [x20, #8]
LBB0_26:
	add	x23, x19, #4
	mov	x0, x23
	bl	_device_add
	cbz	w0, LBB0_28
; %bb.27:
	mov	x22, x0
	mov	x0, x23
	bl	_put_device
	ldr	w0, [x19, #8]
	bl	_kfree
	b	LBB0_31
LBB0_28:
	ldr	x8, [x21]
Lloh33:
	adrp	x9, _INTEL_TH_SWITCH@GOTPAGE
Lloh34:
	ldr	x9, [x9, _INTEL_TH_SWITCH@GOTPAGEOFF]
Lloh35:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_32
; %bb.29:
	mov	x0, x20
	bl	_intel_th_request_hub_module
	b	LBB0_32
LBB0_30:
Lloh36:
	adrp	x8, _ENODEV@GOTPAGE
Lloh37:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh38:
	ldr	w8, [x8]
	neg	w22, w8
	ldr	x19, [sp, #8]                   ; 8-byte Folded Reload
LBB0_31:
	add	x0, x19, #4
	bl	_put_device
	mov	x0, x22
	bl	_ERR_PTR
	mov	x19, x0
LBB0_32:
	ldr	x8, [sp, #56]
Lloh39:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh40:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh41:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_34
; %bb.33:
	mov	x0, x19
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_34:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_TH_MMIO_CONFIG,4,2             ; @TH_MMIO_CONFIG
	.comm	_IORESOURCE_MEM,4,2             ; @IORESOURCE_MEM
	.comm	_ENODEV,4,2                     ; @ENODEV
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s:%d @ %pR\n"

	.comm	_IORESOURCE_IRQ,4,2             ; @IORESOURCE_IRQ
	.comm	_has_mintctl,4,2                ; @has_mintctl
	.comm	_INTEL_TH_OUTPUT,8,3            ; @INTEL_TH_OUTPUT
	.comm	_INTEL_TH_SWITCH,8,3            ; @INTEL_TH_SWITCH
	.comm	_host_mode_only,4,2             ; @host_mode_only
	.comm	_host_mode,4,2                  ; @host_mode
	.no_dead_strip	_intel_th_subdevice_alloc
.subsections_via_symbols
