	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function saa7134_go7007_send_firmware
_saa7134_go7007_send_firmware:          ## @saa7134_go7007_send_firmware
	.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	%edx, %r14d
	movq	%rsi, %r15
	movq	(%rdi), %rax
	movq	(%rax), %r13
	movq	_SAA7134_GPIO_GPSTATUS2@GOTPCREL(%rip), %r12
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
                                        ##     Child Loop BB0_6 Depth 2
	testl	%r14d, %r14d
	jle	LBB0_2
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_SAA7134_GPIO_GPMODE0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$255, %esi
	callq	_saa_writeb
	movq	_SAA7134_GPIO_GPSTATUS0@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movq	_HPI_ADDR_INIT_BUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saa_writeb
	movl	(%r12), %edi
	movq	_GPIO_COMMAND_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saa_writeb
	movl	(%r12), %edi
	movq	_GPIO_COMMAND_IDLE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_saa_writeb
	cmpl	$64, %r14d
	movl	$64, %r13d
	cmovll	%r14d, %r13d
	incl	%r13d
	movq	_GPIO_COMMAND_WRITE@GOTPCREL(%rip), %rbx
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_SAA7134_GPIO_GPSTATUS0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r15), %esi
	callq	_saa_writeb
	movl	(%r12), %edi
	movl	(%rbx), %esi
	callq	_saa_writeb
	movl	(%r12), %edi
	movq	_GPIO_COMMAND_IDLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saa_writeb
	addq	$4, %r15
	decl	%r14d
	decl	%r13d
	cmpl	$1, %r13d
	ja	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$100, %ebx
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_HPI_ADDR_INTR_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	leaq	-44(%rbp), %rdx
	callq	_gpio_read
	movl	-44(%rbp), %esi
	testb	$2, %sil
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	decl	%ebx
	jne	LBB0_6
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_1 Depth=1
	testl	%ebx, %ebx
	jne	LBB0_1
LBB0_9:
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movl	$-1, %eax
LBB0_10:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	xorl	%eax, %eax
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_SAA7134_GPIO_GPMODE0,4,2       ## @SAA7134_GPIO_GPMODE0
	.comm	_SAA7134_GPIO_GPSTATUS0,4,2     ## @SAA7134_GPIO_GPSTATUS0
	.comm	_HPI_ADDR_INIT_BUFFER,4,2       ## @HPI_ADDR_INIT_BUFFER
	.comm	_SAA7134_GPIO_GPSTATUS2,4,2     ## @SAA7134_GPIO_GPSTATUS2
	.comm	_GPIO_COMMAND_ADDR,4,2          ## @GPIO_COMMAND_ADDR
	.comm	_GPIO_COMMAND_IDLE,4,2          ## @GPIO_COMMAND_IDLE
	.comm	_GPIO_COMMAND_WRITE,4,2         ## @GPIO_COMMAND_WRITE
	.comm	_HPI_ADDR_INTR_STATUS,4,2       ## @HPI_ADDR_INTR_STATUS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"saa7134-go7007: device is hung, status reg = 0x%04x\n"

	.no_dead_strip	_saa7134_go7007_send_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function saa7134_go7007_send_firmware
_saa7134_go7007_send_firmware:          ; @saa7134_go7007_send_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x19, x2
	mov	x20, x1
	ldr	x8, [x0]
Lloh0:
	adrp	x23, _SAA7134_GPIO_GPSTATUS0@GOTPAGE
Lloh1:
	ldr	x23, [x23, _SAA7134_GPIO_GPSTATUS0@GOTPAGEOFF]
Lloh2:
	adrp	x25, _SAA7134_GPIO_GPSTATUS2@GOTPAGE
Lloh3:
	ldr	x25, [x25, _SAA7134_GPIO_GPSTATUS2@GOTPAGEOFF]
Lloh4:
	adrp	x27, _GPIO_COMMAND_IDLE@GOTPAGE
Lloh5:
	ldr	x27, [x27, _GPIO_COMMAND_IDLE@GOTPAGEOFF]
	ldr	x21, [x8]
	mov	w28, #64
Lloh6:
	adrp	x22, _GPIO_COMMAND_WRITE@GOTPAGE
Lloh7:
	ldr	x22, [x22, _GPIO_COMMAND_WRITE@GOTPAGEOFF]
Lloh8:
	adrp	x24, _HPI_ADDR_INTR_STATUS@GOTPAGE
Lloh9:
	ldr	x24, [x24, _HPI_ADDR_INTR_STATUS@GOTPAGEOFF]
LBB0_1:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
                                        ;     Child Loop BB0_5 Depth 2
	cmp	w19, #1
	b.lt	LBB0_10
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
Lloh10:
	adrp	x8, _SAA7134_GPIO_GPMODE0@GOTPAGE
Lloh11:
	ldr	x8, [x8, _SAA7134_GPIO_GPMODE0@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	mov	w1, #255
	bl	_saa_writeb
	ldr	w0, [x23]
Lloh13:
	adrp	x8, _HPI_ADDR_INIT_BUFFER@GOTPAGE
Lloh14:
	ldr	x8, [x8, _HPI_ADDR_INIT_BUFFER@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	bl	_saa_writeb
	ldr	w0, [x25]
Lloh16:
	adrp	x8, _GPIO_COMMAND_ADDR@GOTPAGE
Lloh17:
	ldr	x8, [x8, _GPIO_COMMAND_ADDR@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_saa_writeb
	ldr	w0, [x25]
	ldr	w1, [x27]
	bl	_saa_writeb
	cmp	w19, #64
	csel	w8, w19, w28, lt
	add	w26, w8, #1
LBB0_3:                                 ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x23]
	ldr	w1, [x20], #4
	bl	_saa_writeb
	ldr	w0, [x25]
	ldr	w1, [x22]
	bl	_saa_writeb
	ldr	w0, [x25]
	ldr	w1, [x27]
	bl	_saa_writeb
	sub	w19, w19, #1
	sub	w26, w26, #1
	cmp	w26, #1
	b.hi	LBB0_3
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w26, #100
LBB0_5:                                 ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x24]
	add	x2, sp, #12
	mov	x0, x21
	bl	_gpio_read
	ldr	w1, [sp, #12]
	tbz	w1, #1, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	subs	w26, w26, #1
	b.ne	LBB0_5
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_1 Depth=1
	cbnz	w26, LBB0_1
LBB0_8:
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	mov	w0, #-1
LBB0_9:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_10:
	mov	w0, #0
	b	LBB0_9
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_SAA7134_GPIO_GPMODE0,4,2       ; @SAA7134_GPIO_GPMODE0
	.comm	_SAA7134_GPIO_GPSTATUS0,4,2     ; @SAA7134_GPIO_GPSTATUS0
	.comm	_HPI_ADDR_INIT_BUFFER,4,2       ; @HPI_ADDR_INIT_BUFFER
	.comm	_SAA7134_GPIO_GPSTATUS2,4,2     ; @SAA7134_GPIO_GPSTATUS2
	.comm	_GPIO_COMMAND_ADDR,4,2          ; @GPIO_COMMAND_ADDR
	.comm	_GPIO_COMMAND_IDLE,4,2          ; @GPIO_COMMAND_IDLE
	.comm	_GPIO_COMMAND_WRITE,4,2         ; @GPIO_COMMAND_WRITE
	.comm	_HPI_ADDR_INTR_STATUS,4,2       ; @HPI_ADDR_INTR_STATUS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"saa7134-go7007: device is hung, status reg = 0x%04x\n"

	.no_dead_strip	_saa7134_go7007_send_firmware
.subsections_via_symbols
