	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_eeprom
_set_eeprom:                            ## @set_eeprom
	.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
	movq	%rdx, %r14
	movq	%rsi, %rbx
	callq	_netdev2adap
	movq	(%rbx), %rdx
	movq	_EEPROM_MAGIC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdx
	jne	LBB0_1
## %bb.3:
	movl	8(%rbx), %ecx
	movl	12(%rbx), %edi
	movl	%ecx, %r12d
	andl	$-4, %r12d
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
                                        ## kill: def $ecx killed $ecx killed $rcx def $rcx
	andl	$3, %ecx
	leal	(%rcx,%rdi), %r13d
	addl	$3, %r13d
	andl	$-4, %r13d
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	(%rax), %ecx
	testl	%ecx, %ecx
	jle	LBB0_7
## %bb.4:
	movq	_EEPROMPFSIZE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	imull	%edx, %ecx
	addl	$1024, %ecx                     ## imm = 0x400
	cmpl	%ecx, %r12d
	jl	LBB0_6
## %bb.5:
	leal	(%r12,%r13), %esi
	addl	%edx, %ecx
	cmpl	%ecx, %esi
	jle	LBB0_7
LBB0_6:
	movq	_EPERM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_26:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	cmpl	-48(%rbp), %r12d                ## 4-byte Folded Reload
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	jne	LBB0_9
## %bb.8:
	movq	%r14, %r15
	cmpl	%edi, %r13d
	jne	LBB0_9
LBB0_16:
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_t4_seeprom_wp
	testl	%eax, %eax
	jne	LBB0_23
## %bb.17:
	testl	%r13d, %r13d
	je	LBB0_22
## %bb.18:
	addl	$-4, %r13d
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	andl	$-4, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leal	(%rax,%rbx), %esi
	movl	(%r15,%rbx), %edx
	movq	%r12, %rdi
	callq	_eeprom_wr_phys
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_19 Depth=1
	movq	%rbx, %rax
	addq	$4, %rax
	cmpl	%ebx, %r13d
	movq	%rax, %rbx
	jne	LBB0_19
LBB0_21:
	testl	%r14d, %r14d
	jne	LBB0_24
LBB0_22:
	movq	%r12, %rdi
	movl	$1, %esi
	callq	_t4_seeprom_wp
LBB0_23:
	movl	%eax, %r14d
	jmp	LBB0_24
LBB0_9:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r13d, %edi
	callq	_kvzalloc
	testq	%rax, %rax
	je	LBB0_10
## %bb.11:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r12d, %esi
	movq	%rax, %r15
	movq	%rax, %rdx
	callq	_eeprom_rd_phys
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.12:
	cmpl	$5, %r13d
	jl	LBB0_14
## %bb.13:
	leal	(%r12,%r13), %esi
	addl	$-4, %esi
	leal	-4(%r13), %eax
	leaq	(%r15,%rax,4), %rdx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_eeprom_rd_phys
	movl	%eax, %r14d
LBB0_14:
	testl	%r14d, %r14d
	je	LBB0_15
LBB0_24:
	cmpq	-64(%rbp), %r15                 ## 8-byte Folded Reload
	je	LBB0_26
## %bb.25:
	movq	%r15, %rdi
	callq	_kvfree
	jmp	LBB0_26
LBB0_10:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_15:
	movl	8(%rbx), %eax
	movl	12(%rbx), %edx
	andl	$3, %eax
	leaq	(%r15,%rax,4), %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_memcpy
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_EEPROM_MAGIC,8,3               ## @EEPROM_MAGIC
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EEPROMPFSIZE,4,2               ## @EEPROMPFSIZE
	.comm	_EPERM,4,2                      ## @EPERM
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_set_eeprom
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_eeprom
_set_eeprom:                            ; @set_eeprom
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x2
	mov	x22, x1
	bl	_netdev2adap
	ldr	x8, [x22]
Lloh0:
	adrp	x9, _EEPROM_MAGIC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _EEPROM_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.1:
	mov	x20, x0
	ldp	w26, w8, [x22, #8]
	and	w25, w26, #0xfffffffc
	and	w9, w26, #0x3
	add	w9, w9, w8
	add	w9, w9, #3
	and	w23, w9, #0xfffffffc
	ldr	w9, [x0]
	cmp	w9, #1
	b.lt	LBB0_7
; %bb.2:
Lloh3:
	adrp	x10, _EEPROMPFSIZE@GOTPAGE
Lloh4:
	ldr	x10, [x10, _EEPROMPFSIZE@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	orr	w11, wzr, #0x400
	madd	w9, w10, w9, w11
	cmp	w25, w9
	add	w11, w23, w25
	add	w9, w9, w10
	ccmp	w11, w9, #0, ge
	b.le	LBB0_7
; %bb.3:
Lloh6:
	adrp	x8, _EPERM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_6:
	mov	x0, x24
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_7:
	cmp	w25, w26
	ccmp	w23, w8, #0, eq
	mov	x21, x19
	b.eq	LBB0_13
; %bb.8:
Lloh10:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x23
	bl	_kvzalloc
	cbz	x0, LBB0_22
; %bb.9:
	mov	x21, x0
	mov	x0, x20
	mov	x1, x25
	mov	x2, x21
	bl	_eeprom_rd_phys
	mov	x24, x0
	cmp	w0, #0
	ccmp	w23, #5, #8, eq
	b.lt	LBB0_11
; %bb.10:
	add	w8, w23, w25
	sub	w1, w8, #4
	sub	w8, w23, #4
	add	x2, x21, w8, uxtw #2
	mov	x0, x20
	bl	_eeprom_rd_phys
	mov	x24, x0
LBB0_11:
	cbnz	w24, LBB0_20
; %bb.12:
	ldp	w8, w2, [x22, #8]
	and	x8, x8, #0x3
	add	x0, x21, x8, lsl #2
	mov	x1, x19
	bl	_memcpy
LBB0_13:
	mov	x0, x20
	mov	w1, #0
	bl	_t4_seeprom_wp
	cbnz	w0, LBB0_19
; %bb.14:
	cbz	w23, LBB0_18
; %bb.15:
	mov	x25, #0
	sub	w22, w23, #4
	and	x23, x26, #0xfffffffc
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	add	w1, w23, w25
	ldr	w2, [x21, x25]
	mov	x0, x20
	bl	_eeprom_wr_phys
	cmp	w0, #0
	ccmp	w22, w25, #4, eq
	add	x25, x25, #4
	b.ne	LBB0_16
; %bb.17:
	mov	x24, x0
	cbnz	w0, LBB0_20
LBB0_18:
	mov	x0, x20
	mov	w1, #1
	bl	_t4_seeprom_wp
LBB0_19:
	mov	x24, x0
LBB0_20:
	cmp	x21, x19
	b.eq	LBB0_6
; %bb.21:
	mov	x0, x21
	bl	_kvfree
	b	LBB0_6
LBB0_22:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_EEPROM_MAGIC,8,3               ; @EEPROM_MAGIC
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EEPROMPFSIZE,4,2               ; @EEPROMPFSIZE
	.comm	_EPERM,4,2                      ; @EPERM
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_set_eeprom
.subsections_via_symbols
