	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_btpbuf_take                    ## -- Begin function btpbuf_take
	.p2align	4, 0x90
_btpbuf_take:                           ## @btpbuf_take
	.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	%rdi, %r13
	movq	_PBUF_FLAG_REF@GOTPCREL(%rip), %r15
	xorl	%r12d, %r12d
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_1 Depth=1
	leaq	L_.str.6(%rip), %rdi
	xorl	%eax, %eax
	callq	_LOG
	movq	%r13, %rbx
LBB0_10:                                ##   in Loop: Header=BB0_1 Depth=1
	movq	16(%rbx), %r13
	movq	%rbx, %r12
	testq	%r13, %r13
	je	LBB0_11
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rax
	cmpq	(%r15), %rax
	jne	LBB0_9
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	leaq	L_.str(%rip), %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_LOG
	movq	8(%r13), %rsi
	leaq	L_.str.2(%rip), %rdi
	movq	_PBUF_POOL_BUFSIZE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	jg	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_PBUF_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_PBUF_POOL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_btpbuf_alloc
	movq	%rax, %rbx
	leaq	L_.str.1(%rip), %rdi
	testq	%rax, %rax
	jne	LBB0_5
LBB0_4:                                 ##   in Loop: Header=BB0_1 Depth=1
	xorl	%eax, %eax
	callq	_LOG
	movq	_PBUF_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	8(%r13), %rsi
	movq	_PBUF_RAM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_btpbuf_alloc
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_8
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	16(%r13), %rax
	movq	%rax, 16(%rbx)
	movq	$0, 16(%r13)
	movq	%rbx, %r14
	testq	%r12, %r12
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	%rbx, 16(%r12)
	movq	-48(%rbp), %r14                 ## 8-byte Reload
LBB0_7:                                 ##   in Loop: Header=BB0_1 Depth=1
	movl	28(%rbx), %edi
	movl	28(%r13), %esi
	movq	8(%r13), %rdx
	callq	_memcpy
	movl	24(%r13), %eax
	movl	%eax, 24(%rbx)
	movq	8(%r13), %rax
	movq	%rax, 8(%rbx)
	movq	%r13, %rdi
	callq	_btpbuf_free
	leaq	L_.str.4(%rip), %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	_LOG
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_10
LBB0_11:
	leaq	L_.str.7(%rip), %rdi
	xorl	%eax, %eax
	callq	_LOG
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	jmp	LBB0_12
LBB0_8:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_LOG
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_btpbuf_free
	leaq	L_.str.5(%rip), %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_LOG
	xorl	%eax, %eax
LBB0_12:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PBUF_FLAG_REF,8,3              ## @PBUF_FLAG_REF
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pbuf_take: encountered PBUF_REF %p\n"

	.comm	_PBUF_POOL_BUFSIZE,8,3          ## @PBUF_POOL_BUFSIZE
	.comm	_PBUF_RAW,4,2                   ## @PBUF_RAW
	.comm	_PBUF_POOL,4,2                  ## @PBUF_POOL
L_.str.1:                               ## @.str.1
	.asciz	"pbuf_take: Could not allocate PBUF_POOL\n"

L_.str.2:                               ## @.str.2
	.asciz	"pbuf_take: PBUF_POOL too small to replace PBUF_REF\n"

	.comm	_PBUF_RAM,4,2                   ## @PBUF_RAM
L_.str.3:                               ## @.str.3
	.asciz	"pbuf_take: Could not allocate PBUF_RAM\n"

L_.str.4:                               ## @.str.4
	.asciz	"pbuf_take: replaced PBUF_REF %p with %p\n"

L_.str.5:                               ## @.str.5
	.asciz	"pbuf_take: failed to allocate replacement pbuf for %p\n"

L_.str.6:                               ## @.str.6
	.asciz	"pbuf_take: skipping pbuf not of type PBUF_REF\n"

L_.str.7:                               ## @.str.7
	.asciz	"pbuf_take: end of chain reached.\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_btpbuf_take                    ; -- Begin function btpbuf_take
	.p2align	2
_btpbuf_take:                           ; @btpbuf_take
	.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	x19, x0
	mov	x26, #0
Lloh0:
	adrp	x25, _PBUF_FLAG_REF@GOTPAGE
Lloh1:
	ldr	x25, [x25, _PBUF_FLAG_REF@GOTPAGEOFF]
Lloh2:
	adrp	x27, l_.str.2@PAGE
Lloh3:
	add	x27, x27, l_.str.2@PAGEOFF
Lloh4:
	adrp	x28, _PBUF_RAW@GOTPAGE
Lloh5:
	ldr	x28, [x28, _PBUF_RAW@GOTPAGEOFF]
Lloh6:
	adrp	x21, l_.str.4@PAGE
Lloh7:
	add	x21, x21, l_.str.4@PAGEOFF
	mov	x20, x0
Lloh8:
	adrp	x22, l_.str.6@PAGE
Lloh9:
	add	x22, x22, l_.str.6@PAGEOFF
	b	LBB0_3
LBB0_1:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x22
	bl	_LOG
	mov	x24, x19
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x19, [x24, #16]
	mov	x26, x24
	cbz	x19, LBB0_11
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	ldr	x9, [x25]
	cmp	x8, x9
	b.ne	LBB0_1
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	str	x19, [sp]
Lloh10:
	adrp	x0, l_.str@PAGE
Lloh11:
	add	x0, x0, l_.str@PAGEOFF
	bl	_LOG
	ldr	x1, [x19, #8]
Lloh12:
	adrp	x8, _PBUF_POOL_BUFSIZE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PBUF_POOL_BUFSIZE@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	mov	x0, x27
	cmp	x1, x8
	b.gt	LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x28]
Lloh15:
	adrp	x8, _PBUF_POOL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PBUF_POOL@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	bl	_btpbuf_alloc
	mov	x24, x0
	cbnz	x0, LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh18:
	adrp	x0, l_.str.1@PAGE
Lloh19:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	bl	_LOG
	ldr	w0, [x28]
	ldr	x1, [x19, #8]
Lloh20:
	adrp	x8, _PBUF_RAM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _PBUF_RAM@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
	bl	_btpbuf_alloc
	mov	x24, x0
	cbz	x0, LBB0_12
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x19, #16]
	str	x8, [x24, #16]
	str	xzr, [x19, #16]
	mov	x23, x24
	cbz	x26, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	str	x24, [x26, #16]
	mov	x23, x20
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x24, #28]
	ldr	w1, [x19, #28]
	ldr	x2, [x19, #8]
	bl	_memcpy
	ldr	w8, [x19, #24]
	str	w8, [x24, #24]
	ldr	x8, [x19, #8]
	str	x8, [x24, #8]
	mov	x0, x19
	bl	_btpbuf_free
	stp	x19, x24, [sp]
	mov	x0, x21
	bl	_LOG
	mov	x20, x23
	b	LBB0_2
LBB0_11:
Lloh23:
	adrp	x0, l_.str.7@PAGE
Lloh24:
	add	x0, x0, l_.str.7@PAGEOFF
	bl	_LOG
	b	LBB0_13
LBB0_12:
Lloh25:
	adrp	x0, l_.str.3@PAGE
Lloh26:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_LOG
	mov	x0, x20
	bl	_btpbuf_free
	str	x19, [sp]
Lloh27:
	adrp	x0, l_.str.5@PAGE
Lloh28:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_LOG
	mov	x20, #0
LBB0_13:
	mov	x0, x20
	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 AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_PBUF_FLAG_REF,8,3              ; @PBUF_FLAG_REF
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pbuf_take: encountered PBUF_REF %p\n"

	.comm	_PBUF_POOL_BUFSIZE,8,3          ; @PBUF_POOL_BUFSIZE
	.comm	_PBUF_RAW,4,2                   ; @PBUF_RAW
	.comm	_PBUF_POOL,4,2                  ; @PBUF_POOL
l_.str.1:                               ; @.str.1
	.asciz	"pbuf_take: Could not allocate PBUF_POOL\n"

l_.str.2:                               ; @.str.2
	.asciz	"pbuf_take: PBUF_POOL too small to replace PBUF_REF\n"

	.comm	_PBUF_RAM,4,2                   ; @PBUF_RAM
l_.str.3:                               ; @.str.3
	.asciz	"pbuf_take: Could not allocate PBUF_RAM\n"

l_.str.4:                               ; @.str.4
	.asciz	"pbuf_take: replaced PBUF_REF %p with %p\n"

l_.str.5:                               ; @.str.5
	.asciz	"pbuf_take: failed to allocate replacement pbuf for %p\n"

l_.str.6:                               ; @.str.6
	.asciz	"pbuf_take: skipping pbuf not of type PBUF_REF\n"

l_.str.7:                               ; @.str.7
	.asciz	"pbuf_take: end of chain reached.\n"

.subsections_via_symbols
