	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tplink_read_header
_tplink_read_header:                    ## @tplink_read_header
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r15
	movl	$8, %edi
	callq	_vmalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.1:
	movq	%rax, %rbx
	leaq	-32(%rbp), %rcx
	movl	$8, %edx
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%rax, %r8
	callq	_mtd_read
	testl	%eax, %eax
	jne	LBB0_6
## %bb.2:
	cmpq	$8, -32(%rbp)
	jne	LBB0_6
## %bb.3:
	movl	4(%rbx), %edi
	callq	_be32_to_cpu
	movq	_TPLINK_HEADER_V1@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_5
## %bb.4:
	movq	_TPLINK_HEADER_V2@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
LBB0_5:
	movl	(%rbx), %edi
	callq	_be32_to_cpu
	cmpq	$8, %rax
	je	LBB0_8
LBB0_6:
	movq	%rbx, %rdi
	callq	_vfree
LBB0_7:
	xorl	%ebx, %ebx
LBB0_8:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TPLINK_HEADER_V1,8,3           ## @TPLINK_HEADER_V1
	.comm	_TPLINK_HEADER_V2,8,3           ## @TPLINK_HEADER_V2
	.no_dead_strip	_tplink_read_header
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tplink_read_header
_tplink_read_header:                    ; @tplink_read_header
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x1
	mov	x21, x0
	mov	w0, #8
	bl	_vmalloc
	mov	x19, x0
	cbz	x0, LBB0_6
; %bb.1:
	add	x3, sp, #8
	mov	x0, x21
	mov	x1, x20
	mov	w2, #8
	mov	x4, x19
	bl	_mtd_read
	cbnz	w0, LBB0_5
; %bb.2:
	ldr	x8, [sp, #8]
	cmp	x8, #8
	b.ne	LBB0_5
; %bb.3:
	ldr	w0, [x19, #4]
	bl	_be32_to_cpu
Lloh0:
	adrp	x8, _TPLINK_HEADER_V1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TPLINK_HEADER_V1@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _TPLINK_HEADER_V2@GOTPAGE
Lloh4:
	ldr	x9, [x9, _TPLINK_HEADER_V2@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x0, x8
	ccmp	x0, x9, #4, ne
	b.ne	LBB0_5
; %bb.4:
	ldr	w0, [x19]
	bl	_be32_to_cpu
	cmp	x0, #8
	b.eq	LBB0_6
LBB0_5:
	mov	x0, x19
	bl	_vfree
	mov	x19, #0
LBB0_6:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_TPLINK_HEADER_V1,8,3           ; @TPLINK_HEADER_V1
	.comm	_TPLINK_HEADER_V2,8,3           ; @TPLINK_HEADER_V2
	.no_dead_strip	_tplink_read_header
.subsections_via_symbols
