	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tmc_alloc_etr_buf
_tmc_alloc_etr_buf:                     ## @tmc_alloc_etr_buf
	.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
	movq	%r8, -80(%rbp)                  ## 8-byte Spill
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	xorl	%r15d, %r15d
	movq	(%rdi), %rbx
	movq	_TMC_ETR_SG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_tmc_etr_has_cap
	movl	%eax, %r13d
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %edi
	callq	_iommu_get_domain_for_dev
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	%r12, %rdi
	callq	_tmc_etr_get_catu_device
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	%r13d, -52(%rbp)                ## 4-byte Spill
	orl	%r13d, %eax
	setne	%r13b
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%rax, %rbx
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, 8(%rax)
	movq	-80(%rbp), %r8                  ## 8-byte Reload
	testq	%r8, %r8
	je	LBB0_5
## %bb.4:
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	jmp	LBB0_9
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	movl	%r15d, %edi
	jmp	LBB0_2
LBB0_5:
	testb	%r13b, %r13b
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	je	LBB0_8
## %bb.6:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_8
## %bb.7:
	movq	_SZ_1M@GOTPCREL(%rip), %rax
	cmpq	%r15, (%rax)
	jle	LBB0_9
LBB0_8:
	movq	_ETR_MODE_FLAT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	movl	%r13d, %ecx
	movq	%rbx, %r14
	movq	%r8, %rbx
	xorl	%r8d, %r8d
	callq	_tmc_etr_mode_alloc_buf
	movq	%rbx, %r8
	movq	%r14, %rbx
	movl	%eax, %r14d
LBB0_9:
	testl	%r14d, %r14d
	je	LBB0_12
## %bb.10:
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_12
## %bb.11:
	movq	_ETR_MODE_ETR_SG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	movl	%r13d, %ecx
	movq	%rbx, %r14
	movq	%r8, %rbx
	callq	_tmc_etr_mode_alloc_buf
	movq	%rbx, %r8
	movq	%r14, %rbx
	movl	%eax, %r14d
LBB0_12:
	testl	%r14d, %r14d
	je	LBB0_15
## %bb.13:
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_15
## %bb.14:
	movq	_ETR_MODE_CATU@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	movl	%r13d, %ecx
	callq	_tmc_etr_mode_alloc_buf
	movl	%eax, %r14d
LBB0_15:
	testl	%r14d, %r14d
	je	LBB0_17
## %bb.16:
	movq	%rbx, %rdi
	callq	_kfree
	movl	%r14d, %edi
LBB0_2:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_17:
	movq	%rbx, %rdi
	addq	$4, %rdi
	movl	$1, %esi
	callq	_refcount_set
	shrq	$10, %r15
	movl	(%rbx), %ecx
	leaq	L_.str(%rip), %rsi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r15, %rdx
	callq	_dev_dbg
	movq	%rbx, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_TMC_ETR_SG,4,2                 ## @TMC_ETR_SG
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_SZ_1M,8,3                      ## @SZ_1M
	.comm	_ETR_MODE_FLAT,4,2              ## @ETR_MODE_FLAT
	.comm	_ETR_MODE_ETR_SG,4,2            ## @ETR_MODE_ETR_SG
	.comm	_ETR_MODE_CATU,4,2              ## @ETR_MODE_CATU
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"allocated buffer of size %ldKB in mode %d\n"

	.no_dead_strip	_tmc_alloc_etr_buf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tmc_alloc_etr_buf
_tmc_alloc_etr_buf:                     ; @tmc_alloc_etr_buf
	.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
	mov	x21, x4
	str	w3, [sp, #12]                   ; 4-byte Folded Spill
	mov	x20, x1
	mov	x24, x0
Lloh0:
	adrp	x27, _ENOMEM@GOTPAGE
Lloh1:
	ldr	x27, [x27, _ENOMEM@GOTPAGEOFF]
	ldr	w22, [x27]
	ldr	x19, [x0]
Lloh2:
	adrp	x8, _TMC_ETR_SG@GOTPAGE
Lloh3:
	ldr	x8, [x8, _TMC_ETR_SG@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	bl	_tmc_etr_has_cap
	mov	x26, x0
	str	x19, [sp]                       ; 8-byte Folded Spill
	ldr	w0, [x19]
	bl	_iommu_get_domain_for_dev
	mov	x28, x0
	mov	x0, x24
	bl	_tmc_etr_get_catu_device
	mov	x25, x0
	orr	w8, w0, w26
	cmp	w8, #0
	cset	w19, ne
Lloh5:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	cbz	x0, LBB0_3
; %bb.1:
	mov	x23, x0
	neg	w27, w22
	str	x20, [x0, #8]
	mov	x22, x21
	cbz	x21, LBB0_4
; %bb.2:
	ldr	w21, [sp, #12]                  ; 4-byte Folded Reload
	b	LBB0_6
LBB0_3:
	ldr	w8, [x27]
	neg	w0, w8
	b	LBB0_12
LBB0_4:
Lloh8:
	adrp	x8, _SZ_1M@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SZ_1M@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	cmp	w19, #0
	ccmp	w28, #0, #0, ne
	ccmp	x8, x20, #0, eq
	ldr	w21, [sp, #12]                  ; 4-byte Folded Reload
	b.le	LBB0_6
; %bb.5:
Lloh11:
	adrp	x8, _ETR_MODE_FLAT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ETR_MODE_FLAT@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	mov	x1, x24
	mov	x2, x23
	mov	x3, x21
	mov	x4, #0
	bl	_tmc_etr_mode_alloc_buf
	mov	x27, x0
LBB0_6:
	cmp	w27, #0
	ccmp	w26, #0, #4, ne
	b.eq	LBB0_8
; %bb.7:
Lloh14:
	adrp	x8, _ETR_MODE_ETR_SG@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ETR_MODE_ETR_SG@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	mov	x1, x24
	mov	x2, x23
	mov	x3, x21
	mov	x4, x22
	bl	_tmc_etr_mode_alloc_buf
	mov	x27, x0
LBB0_8:
	cmp	w27, #0
	ccmp	w25, #0, #4, ne
	b.eq	LBB0_10
; %bb.9:
Lloh17:
	adrp	x8, _ETR_MODE_CATU@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ETR_MODE_CATU@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
	mov	x1, x24
	mov	x2, x23
	mov	x3, x21
	mov	x4, x22
	bl	_tmc_etr_mode_alloc_buf
	mov	x27, x0
LBB0_10:
	cbz	w27, LBB0_13
; %bb.11:
	mov	x0, x23
	bl	_kfree
	mov	x0, x27
LBB0_12:
	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
	b	_ERR_PTR
LBB0_13:
	add	x0, x23, #4
	mov	w1, #1
	bl	_refcount_set
	lsr	x2, x20, #10
	ldr	w3, [x23]
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	ldr	x0, [sp]                        ; 8-byte Folded Reload
	bl	_dev_dbg
	mov	x0, x23
	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 AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_TMC_ETR_SG,4,2                 ; @TMC_ETR_SG
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_SZ_1M,8,3                      ; @SZ_1M
	.comm	_ETR_MODE_FLAT,4,2              ; @ETR_MODE_FLAT
	.comm	_ETR_MODE_ETR_SG,4,2            ; @ETR_MODE_ETR_SG
	.comm	_ETR_MODE_CATU,4,2              ; @ETR_MODE_CATU
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"allocated buffer of size %ldKB in mode %d\n"

	.no_dead_strip	_tmc_alloc_etr_buf
.subsections_via_symbols
