	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cudbg_collect_mbox_log         ## -- Begin function cudbg_collect_mbox_log
	.p2align	4, 0x90
_cudbg_collect_mbox_log:                ## @cudbg_collect_mbox_log
	.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	%rsi, %r14
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -64(%rbp)
	movq	(%rax), %r12
	movslq	(%r12), %r13
	leaq	(,%r13,8), %rax
	leaq	(%rax,%rax,2), %rdx
	leaq	-64(%rbp), %rcx
	callq	_cudbg_get_buff
	testl	%eax, %eax
	jne	LBB0_14
## %bb.1:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	testl	%r13d, %r13d
	jle	LBB0_13
## %bb.2:
	movq	-64(%rbp), %r14
	xorl	%r15d, %r15d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_3 Depth=1
	addq	$24, %r14
LBB0_12:                                ##   in Loop: Header=BB0_3 Depth=1
	incl	%r15d
	cmpl	%r13d, %r15d
	je	LBB0_13
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
                                        ##     Child Loop BB0_10 Depth 2
	movl	4(%r12), %esi
	addl	%r15d, %esi
	movl	(%r12), %eax
	cmpl	%eax, %esi
	movl	$0, %ecx
	cmovbl	%ecx, %eax
	subl	%eax, %esi
	movq	%r12, %rdi
	callq	_mbox_cmd_log_entry
	cmpq	$0, (%rax)
	je	LBB0_12
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rax, %rbx
	leaq	16(%r14), %rdi
	movq	%rax, %rsi
	movl	$16, %edx
	callq	_memcpy
	movq	_MBOX_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	cmpl	$8, %edx
	jl	LBB0_11
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	shrq	$3, %rdx
	leaq	-1(%rdx), %rcx
	movl	%edx, %eax
	andl	$3, %eax
	cmpq	$3, %rcx
	jae	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%ecx, %ecx
	jmp	LBB0_9
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	andl	$-4, %edx
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	8(%rbx), %rsi
	movslq	(%rsi,%rcx,4), %rsi
	movq	(%r14), %rdi
	movq	%rsi, (%rdi,%rcx,8)
	movq	8(%rbx), %rsi
	movslq	4(%rsi,%rcx,4), %rsi
	movq	(%r14), %rdi
	movq	%rsi, 8(%rdi,%rcx,8)
	movq	8(%rbx), %rsi
	movslq	8(%rsi,%rcx,4), %rsi
	movq	(%r14), %rdi
	movq	%rsi, 16(%rdi,%rcx,8)
	movq	8(%rbx), %rsi
	movslq	12(%rsi,%rcx,4), %rsi
	movq	(%r14), %rdi
	movq	%rsi, 24(%rdi,%rcx,8)
	addq	$4, %rcx
	cmpq	%rcx, %rdx
	jne	LBB0_8
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	testq	%rax, %rax
	je	LBB0_11
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	8(%rbx), %rdx
	movslq	(%rdx,%rcx,4), %rdx
	movq	(%r14), %rsi
	movq	%rdx, (%rsi,%rcx,8)
	incq	%rcx
	decq	%rax
	jne	LBB0_10
	jmp	LBB0_11
LBB0_13:
	leaq	-64(%rbp), %rsi
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	callq	_cudbg_write_and_release_buff
LBB0_14:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MBOX_LEN,4,2                   ## @MBOX_LEN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cudbg_collect_mbox_log         ; -- Begin function cudbg_collect_mbox_log
	.p2align	2
_cudbg_collect_mbox_log:                ; @cudbg_collect_mbox_log
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x19, x1
	mov	x20, x0
	ldr	x8, [x0]
	stp	xzr, xzr, [sp]
	ldr	x21, [x8]
	ldrsw	x23, [x21]
	add	x8, x23, x23, lsl #1
	lsl	x2, x8, #3
	mov	x3, sp
	bl	_cudbg_get_buff
	cbnz	w0, LBB0_10
; %bb.1:
	cmp	w23, #1
	b.lt	LBB0_9
; %bb.2:
	mov	w24, #0
	ldr	x25, [sp]
Lloh0:
	adrp	x26, _MBOX_LEN@GOTPAGE
Lloh1:
	ldr	x26, [x26, _MBOX_LEN@GOTPAGEOFF]
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x25, x25, #24
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	w24, w24, #1
	cmp	w24, w23
	b.eq	LBB0_9
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	ldp	w9, w8, [x21]
	add	w8, w8, w24
	cmp	w8, w9
	csel	w9, wzr, w9, lo
	sub	w1, w8, w9
	mov	x0, x21
	bl	_mbox_cmd_log_entry
	ldr	x8, [x0]
	cbz	x8, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x22, x0
	add	x0, x25, #16
	mov	x1, x22
	mov	w2, #16
	bl	_memcpy
	ldr	w9, [x26]
	cmp	w9, #8
	b.lt	LBB0_3
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x8, #0
	lsr	x9, x9, #3
LBB0_8:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x10, [x22, #8]
	ldrsw	x10, [x10, x8, lsl #2]
	ldr	x11, [x25]
	str	x10, [x11, x8, lsl #3]
	add	x8, x8, #1
	cmp	x9, x8
	b.ne	LBB0_8
	b	LBB0_3
LBB0_9:
	mov	x1, sp
	mov	x0, x20
	mov	x2, x19
	bl	_cudbg_write_and_release_buff
LBB0_10:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_MBOX_LEN,4,2                   ; @MBOX_LEN
.subsections_via_symbols
