	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_i915_gpu_state_copy_to_buffer  ## -- Begin function i915_gpu_state_copy_to_buffer
	.p2align	4, 0x90
_i915_gpu_state_copy_to_buffer:         ## @i915_gpu_state_copy_to_buffer
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%eax, %eax
	testq	%rdi, %rdi
	je	LBB0_22
## %bb.1:
	movq	%rcx, %r12
	testq	%rcx, %rcx
	je	LBB0_22
## %bb.2:
	movq	%rdx, %r13
	movq	%rsi, %r15
	movq	%rdi, %rbx
	callq	_err_print_to_sgl
                                        ## kill: def $eax killed $eax def $rax
	testl	%eax, %eax
	jne	LBB0_22
## %bb.3:
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %edi
	callq	_READ_ONCE
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	%rax, %rcx
	cmpq	%r13, %rax
	jle	LBB0_7
LBB0_5:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %r15
	movl	$0, %eax
	testq	%r15, %r15
	je	LBB0_22
## %bb.6:
	movq	(%r15), %rcx
LBB0_7:
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, -88(%rbp)                 ## 8-byte Spill
	movq	%rcx, %r12
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	%rax, %r12
LBB0_20:                                ##   in Loop: Header=BB0_8 Depth=1
	leaq	24(%r15), %rbx
	movl	%r15d, %edi
	callq	_sg_is_last
	movq	%rbx, %r15
	testl	%eax, %eax
	jne	LBB0_21
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_sg_is_chain
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	%r15, %rdi
	callq	_sg_chain_ptr
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_sg_is_chain
	movl	%eax, %edi
	callq	_GEM_BUG_ON
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	8(%r15), %rbx
	leaq	(%rbx,%r12), %rax
	cmpq	%r13, %rax
	jbe	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%r12, %rax
	movq	16(%r15), %r12
	cmpq	%r13, %rax
	jge	LBB0_13
## %bb.14:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%r13, %r14
	subq	%rax, %r14
	xorl	%edi, %edi
	subq	%r14, %rbx
	setb	%dil
	callq	_GEM_BUG_ON
	addq	%r14, %r12
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
LBB0_15:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	%rbx, %rdi
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rsi
	callq	_min
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_16
## %bb.17:                              ##   in Loop: Header=BB0_8 Depth=1
	cmpq	8(%r15), %r14
	seta	%al
	jmp	LBB0_18
LBB0_16:                                ##   in Loop: Header=BB0_8 Depth=1
	movb	$1, %al
LBB0_18:                                ##   in Loop: Header=BB0_8 Depth=1
	movzbl	%al, %edi
	callq	_GEM_BUG_ON
	movq	%r15, %rdi
	callq	_sg_page
	movl	%eax, %edi
	callq	_page_address
	addq	%rax, %r12
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	callq	_memcpy
	addq	%r14, -56(%rbp)                 ## 8-byte Folded Spill
	subq	%r14, %r13
	je	LBB0_23
## %bb.19:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	addq	%r14, %r12
	addq	%r14, %rbx
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	-88(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_20
LBB0_23:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movq	%r15, %rsi
	callq	_WRITE_ONCE
LBB0_21:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
LBB0_22:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_i915_gpu_state_copy_to_buffer  ; -- Begin function i915_gpu_state_copy_to_buffer
	.p2align	2
_i915_gpu_state_copy_to_buffer:         ; @i915_gpu_state_copy_to_buffer
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	w23, #0
	cbz	x0, LBB0_3
; %bb.1:
	mov	x19, x3
	cbz	x3, LBB0_3
; %bb.2:
	mov	x20, x2
	mov	x22, x1
	mov	x21, x0
	bl	_err_print_to_sgl
	mov	x23, x0
	cbz	w0, LBB0_4
LBB0_3:
	mov	x0, x23
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_4:
	ldr	w0, [x21]
	bl	_READ_ONCE
	cbz	x0, LBB0_6
; %bb.5:
	mov	x24, x0
	ldr	x26, [x0]
	cmp	x26, x20
	b.le	LBB0_8
LBB0_6:
	ldr	x24, [x21, #8]
	cbz	x24, LBB0_20
; %bb.7:
	ldr	x26, [x24]
LBB0_8:
	mov	x23, #0
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	x25, x24, #24
	mov	x0, x24
	bl	_sg_is_last
	mov	x24, x25
	mov	x26, x27
	cbnz	w0, LBB0_3
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x24
	bl	_sg_is_chain
	cbz	w0, LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x24
	bl	_sg_chain_ptr
	mov	x24, x0
	bl	_sg_is_chain
	bl	_GEM_BUG_ON
LBB0_12:                                ;   in Loop: Header=BB0_10 Depth=1
	ldr	x25, [x24, #8]
	add	x27, x25, x26
	cmp	x27, x20
	b.ls	LBB0_9
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x27, [x24, #16]
	cmp	x26, x20
	b.ge	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_10 Depth=1
	sub	x26, x20, x26
	subs	x25, x25, x26
	cset	w0, lo
	bl	_GEM_BUG_ON
	add	x27, x27, x26
	mov	x26, x20
LBB0_15:                                ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x25
	mov	x1, x19
	bl	_min
	mov	x25, x0
	cbz	x0, LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x8, [x24, #8]
	cmp	x25, x8
	cset	w0, hi
	b	LBB0_18
LBB0_17:                                ;   in Loop: Header=BB0_10 Depth=1
	mov	w0, #1
LBB0_18:                                ;   in Loop: Header=BB0_10 Depth=1
	bl	_GEM_BUG_ON
	mov	x0, x24
	bl	_sg_page
	bl	_page_address
	add	x1, x0, x27
	mov	x0, x22
	mov	x2, x25
	bl	_memcpy
	add	x23, x25, x23
	subs	x19, x19, x25
	b.eq	LBB0_21
; %bb.19:                               ;   in Loop: Header=BB0_10 Depth=1
	add	x27, x25, x26
	add	x22, x22, x25
	b	LBB0_9
LBB0_20:
	mov	w23, #0
	b	LBB0_3
LBB0_21:
	ldr	w0, [x21]
	mov	x1, x24
	bl	_WRITE_ONCE
	b	LBB0_3
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
