	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_octeon_wait_for_bootloader     ## -- Begin function octeon_wait_for_bootloader
	.p2align	4, 0x90
_octeon_wait_for_bootloader:            ## @octeon_wait_for_bootloader
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	(%rdi), %rdi
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdx
	callq	_dev_dbg
	movq	%r14, %rdi
	callq	_octeon_mem_access_ok
	movl	$-1, %r15d
	testq	%rax, %rax
	jne	LBB0_7
## %bb.1:
	testq	%rbx, %rbx
	jle	LBB0_6
## %bb.2:
	movq	_BOOTLOADER_PCI_READ_BUFFER_OWNER_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_octeon_read_device_mem32
	movq	_OCTEON_PCI_IO_BUF_OWNER_HOST@GOTPCREL(%rip), %r13
	cmpq	(%r13), %rax
	je	LBB0_6
## %bb.3:
	incq	%rbx
	movq	_HZ@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	decq	%rbx
	cmpq	$2, %rbx
	jb	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movslq	(%r12), %rax
	imulq	$1374389535, %rax, %rdi         ## imm = 0x51EB851F
	movq	%rdi, %rax
	shrq	$63, %rax
	sarq	$37, %rdi
	addl	%eax, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_schedule_timeout_uninterruptible
	movq	_BOOTLOADER_PCI_READ_BUFFER_OWNER_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_octeon_read_device_mem32
	cmpq	(%r13), %rax
	jne	LBB0_4
LBB0_6:
	xorl	%r15d, %r15d
LBB0_7:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"waiting %d0 ms for bootloader\n"

	.comm	_BOOTLOADER_PCI_READ_BUFFER_OWNER_ADDR,4,2 ## @BOOTLOADER_PCI_READ_BUFFER_OWNER_ADDR
	.comm	_OCTEON_PCI_IO_BUF_OWNER_HOST,8,3 ## @OCTEON_PCI_IO_BUF_OWNER_HOST
	.comm	_HZ,4,2                         ## @HZ
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_octeon_wait_for_bootloader     ; -- Begin function octeon_wait_for_bootloader
	.p2align	2
_octeon_wait_for_bootloader:            ; @octeon_wait_for_bootloader
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x1
	mov	x19, x0
	ldr	x0, [x0]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_dbg
	mov	x0, x19
	bl	_octeon_mem_access_ok
	cbz	x0, LBB0_2
LBB0_1:
	mov	w0, #-1
	b	LBB0_8
LBB0_2:
	cmp	x20, #1
	b.lt	LBB0_7
; %bb.3:
Lloh2:
	adrp	x21, _BOOTLOADER_PCI_READ_BUFFER_OWNER_ADDR@GOTPAGE
Lloh3:
	ldr	x21, [x21, _BOOTLOADER_PCI_READ_BUFFER_OWNER_ADDR@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x19
	bl	_octeon_read_device_mem32
Lloh4:
	adrp	x22, _OCTEON_PCI_IO_BUF_OWNER_HOST@GOTPAGE
Lloh5:
	ldr	x22, [x22, _OCTEON_PCI_IO_BUF_OWNER_HOST@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_7
; %bb.4:
	add	x20, x20, #1
Lloh6:
	adrp	x23, _HZ@GOTPAGE
Lloh7:
	ldr	x23, [x23, _HZ@GOTPAGEOFF]
	mov	w24, #34079
	movk	w24, #20971, lsl #16
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	sub	x20, x20, #1
	cmp	x20, #2
	b.lo	LBB0_1
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldrsw	x8, [x23]
	mul	x8, x8, x24
	lsr	x9, x8, #63
	asr	x8, x8, #37
	add	w0, w8, w9
	bl	_schedule_timeout_uninterruptible
	ldr	w1, [x21]
	mov	x0, x19
	bl	_octeon_read_device_mem32
	ldr	x8, [x22]
	cmp	x0, x8
	b.ne	LBB0_5
LBB0_7:
	mov	w0, #0
LBB0_8:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"waiting %d0 ms for bootloader\n"

	.comm	_BOOTLOADER_PCI_READ_BUFFER_OWNER_ADDR,4,2 ; @BOOTLOADER_PCI_READ_BUFFER_OWNER_ADDR
	.comm	_OCTEON_PCI_IO_BUF_OWNER_HOST,8,3 ; @OCTEON_PCI_IO_BUF_OWNER_HOST
	.comm	_HZ,4,2                         ; @HZ
.subsections_via_symbols
