	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function occ_putsram
_occ_putsram:                           ## @occ_putsram
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r12d
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movl	%esi, -52(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r13
	leal	7(%r12), %eax
	leal	14(%r12), %r15d
	testl	%eax, %eax
	cmovnsl	%eax, %r15d
	movl	%r15d, %eax
	sarl	$3, %eax
	movq	_OCC_SBE_STATUS_WORDS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	movq	%rsi, -48(%rbp)
	addl	%eax, %eax
	addl	$5, %eax
	movslq	%eax, %rbx
	movq	%rbx, %rdi
	callq	_max
	leaq	(,%rax,4), %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	andl	$-8, %r15d
	movl	%ebx, %edi
	callq	_cpu_to_be32
	movl	%eax, (%r14)
	movq	_SBEFIFO_CMD_PUT_OCC_SRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_cpu_to_be32
	movl	%eax, 4(%r14)
	movl	$1, %edi
	callq	_cpu_to_be32
	movl	%eax, 8(%r14)
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	callq	_cpu_to_be32
	movl	%eax, 12(%r14)
	movl	%r15d, %edi
	callq	_cpu_to_be32
	movl	%eax, 16(%r14)
	movq	%r14, %rdi
	addq	$20, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	%r12d, %edx
	callq	_memcpy
	movl	4(%r13), %edi
	leaq	-48(%rbp), %r8
	movq	%r14, %rsi
	movq	%rbx, %rdx
	movq	%r14, %rcx
	callq	_sbefifo_submit
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_9
## %bb.3:
	movl	4(%r13), %edi
	movq	_SBEFIFO_CMD_PUT_OCC_SRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-48(%rbp), %rcx
	leaq	-48(%rbp), %r8
	movq	%r14, %rdx
	callq	_sbefifo_parse_status
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_4
LBB0_9:
	testl	%ebx, %ebx
	jle	LBB0_11
LBB0_10:
	movl	(%r13), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%r15d, %r15d
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EBADMSG@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	movl	%r15d, %ebx
LBB0_11:
	movq	%r14, %rdi
	callq	_kfree
	jmp	LBB0_12
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	-48(%rbp), %rdx
	cmpq	$1, %rdx
	jne	LBB0_5
## %bb.6:
	movl	(%r14), %edi
	callq	_be32_to_cpu
	movslq	%r15d, %rcx
	xorl	%ebx, %ebx
	cmpq	%rcx, %rax
	je	LBB0_11
## %bb.7:
	movl	(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%r15d, %edx
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_8
LBB0_5:
	movl	(%r13), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_8:
	movq	_EBADMSG@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	testl	%ebx, %ebx
	jg	LBB0_10
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_OCC_SBE_STATUS_WORDS,8,3       ## @OCC_SBE_STATUS_WORDS
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SBEFIFO_CMD_PUT_OCC_SRAM,4,2   ## @SBEFIFO_CMD_PUT_OCC_SRAM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SRAM write response length invalid: %zd\n"

	.comm	_EBADMSG,4,2                    ## @EBADMSG
L_.str.1:                               ## @.str.1
	.asciz	"SRAM write expected %d bytes got %zd\n"

L_.str.2:                               ## @.str.2
	.asciz	"SRAM write returned failure status: %08x\n"

	.no_dead_strip	_occ_putsram
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function occ_putsram
_occ_putsram:                           ; @occ_putsram
	.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	x22, x3
	mov	x23, x2
	mov	x25, x1
	mov	x19, x0
	add	w8, w3, #7
	add	w9, w3, #14
	cmp	w8, #0
	csel	w21, w9, w8, lt
Lloh0:
	adrp	x8, _OCC_SBE_STATUS_WORDS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _OCC_SBE_STATUS_WORDS@GOTPAGEOFF]
	asr	w9, w21, #3
Lloh2:
	ldr	x1, [x8]
	str	x1, [sp, #8]
	lsl	w8, w9, #1
	add	w8, w8, #5
	sxtw	x24, w8
	mov	x0, x24
	bl	_max
	lsl	x0, x0, #2
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_kzalloc
	cbz	x0, LBB0_6
; %bb.1:
	mov	x20, x0
	and	w21, w21, #0xfffffff8
	mov	x0, x24
	bl	_cpu_to_be32
	str	w0, [x20]
Lloh6:
	adrp	x26, _SBEFIFO_CMD_PUT_OCC_SRAM@GOTPAGE
Lloh7:
	ldr	x26, [x26, _SBEFIFO_CMD_PUT_OCC_SRAM@GOTPAGEOFF]
	ldr	w0, [x26]
	bl	_cpu_to_be32
	str	w0, [x20, #4]
	mov	w0, #1
	bl	_cpu_to_be32
	str	w0, [x20, #8]
	mov	x0, x25
	bl	_cpu_to_be32
	str	w0, [x20, #12]
	mov	x0, x21
	bl	_cpu_to_be32
	str	w0, [x20, #16]
	add	x0, x20, #20
	mov	x1, x23
	mov	x2, x22
	bl	_memcpy
	ldr	w0, [x19, #4]
	add	x4, sp, #8
	mov	x1, x20
	mov	x2, x24
	mov	x3, x20
	bl	_sbefifo_submit
	mov	x22, x0
	cbnz	w0, LBB0_3
; %bb.2:
	ldr	w0, [x19, #4]
	ldr	w1, [x26]
	ldr	x3, [sp, #8]
	add	x4, sp, #8
	mov	x2, x20
	bl	_sbefifo_parse_status
	mov	x22, x0
	cbz	w0, LBB0_8
LBB0_3:
	cmp	w22, #1
	b.lt	LBB0_5
LBB0_4:
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str.2@PAGE
Lloh9:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x22
	bl	_dev_err
Lloh10:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_5:
	mov	x0, x20
	bl	_kfree
	b	LBB0_7
LBB0_6:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_7:
	mov	x0, x22
	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
LBB0_8:
	ldr	x2, [sp, #8]
	cmp	x2, #1
	b.ne	LBB0_11
; %bb.9:
	ldr	w0, [x20]
	bl	_be32_to_cpu
	cmp	x0, w21, sxtw
	b.ne	LBB0_12
; %bb.10:
	mov	w22, #0
	b	LBB0_5
LBB0_11:
	ldr	w0, [x19]
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
                                        ; kill: def $w2 killed $w2 killed $x2
	b	LBB0_13
LBB0_12:
	ldr	w8, [x19]
	str	x0, [sp]
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x8
	mov	x2, x21
LBB0_13:
	bl	_dev_err
Lloh20:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w22, w8
	cmp	w22, #1
	b.ge	LBB0_4
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_OCC_SBE_STATUS_WORDS,8,3       ; @OCC_SBE_STATUS_WORDS
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SBEFIFO_CMD_PUT_OCC_SRAM,4,2   ; @SBEFIFO_CMD_PUT_OCC_SRAM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SRAM write response length invalid: %zd\n"

	.comm	_EBADMSG,4,2                    ; @EBADMSG
l_.str.1:                               ; @.str.1
	.asciz	"SRAM write expected %d bytes got %zd\n"

l_.str.2:                               ; @.str.2
	.asciz	"SRAM write returned failure status: %08x\n"

	.no_dead_strip	_occ_putsram
.subsections_via_symbols
