	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gsc_sw_reset
_gsc_sw_reset:                          ## @gsc_sw_reset
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_GSC_RESET_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_GSC_SW_RESET_SRESET@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_GSC_SW_RESET@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movl	%r15d, %edi
	callq	_gsc_write
	testl	%ebx, %ebx
	je	LBB0_3
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %edi
	callq	_gsc_read
	testl	%eax, %eax
	je	LBB0_5
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$1000, %edi                     ## imm = 0x3E8
	movl	$2000, %esi                     ## imm = 0x7D0
	callq	_usleep_range
	decl	%ebx
	jne	LBB0_1
	jmp	LBB0_4
LBB0_3:
	testl	%r15d, %r15d
	je	LBB0_5
LBB0_4:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_DRM_DEV_ERROR
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_6
LBB0_5:
	movq	_GSC_IN_BASE_ADDR_Y_MASK@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_gsc_read
	movl	%eax, %ebx
	movq	_GSC_IN_BASE_ADDR_MASK@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	xorl	%r14d, %r14d
	xorl	%edi, %edi
	callq	_GSC_IN_BASE_ADDR_PINGPONG
	orl	%eax, %ebx
	movl	(%r15), %esi
	movl	%ebx, %edi
	callq	_gsc_write
	movq	_GSC_IN_BASE_ADDR_CB_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_gsc_write
	movq	_GSC_IN_BASE_ADDR_CR_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_gsc_write
	movq	_GSC_OUT_BASE_ADDR_Y_MASK@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_gsc_read
	movl	%eax, %ebx
	movq	_GSC_OUT_BASE_ADDR_MASK@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	xorl	%edi, %edi
	callq	_GSC_OUT_BASE_ADDR_PINGPONG
	orl	%eax, %ebx
	movl	(%r15), %esi
	movl	%ebx, %edi
	callq	_gsc_write
	movq	_GSC_OUT_BASE_ADDR_CB_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_gsc_write
	movq	_GSC_OUT_BASE_ADDR_CR_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_gsc_write
LBB0_6:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GSC_RESET_TIMEOUT,4,2          ## @GSC_RESET_TIMEOUT
	.comm	_GSC_SW_RESET_SRESET,4,2        ## @GSC_SW_RESET_SRESET
	.comm	_GSC_SW_RESET,4,2               ## @GSC_SW_RESET
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to reset gsc h/w.\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_GSC_IN_BASE_ADDR_Y_MASK,4,2    ## @GSC_IN_BASE_ADDR_Y_MASK
	.comm	_GSC_IN_BASE_ADDR_MASK,4,2      ## @GSC_IN_BASE_ADDR_MASK
	.comm	_GSC_IN_BASE_ADDR_CB_MASK,4,2   ## @GSC_IN_BASE_ADDR_CB_MASK
	.comm	_GSC_IN_BASE_ADDR_CR_MASK,4,2   ## @GSC_IN_BASE_ADDR_CR_MASK
	.comm	_GSC_OUT_BASE_ADDR_Y_MASK,4,2   ## @GSC_OUT_BASE_ADDR_Y_MASK
	.comm	_GSC_OUT_BASE_ADDR_MASK,4,2     ## @GSC_OUT_BASE_ADDR_MASK
	.comm	_GSC_OUT_BASE_ADDR_CB_MASK,4,2  ## @GSC_OUT_BASE_ADDR_CB_MASK
	.comm	_GSC_OUT_BASE_ADDR_CR_MASK,4,2  ## @GSC_OUT_BASE_ADDR_CR_MASK
	.no_dead_strip	_gsc_sw_reset
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gsc_sw_reset
_gsc_sw_reset:                          ; @gsc_sw_reset
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x19, x0
Lloh0:
	adrp	x8, _GSC_RESET_TIMEOUT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GSC_RESET_TIMEOUT@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
Lloh3:
	adrp	x8, _GSC_SW_RESET_SRESET@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GSC_SW_RESET_SRESET@GOTPAGEOFF]
Lloh5:
	ldr	w20, [x8]
Lloh6:
	adrp	x22, _GSC_SW_RESET@GOTPAGE
Lloh7:
	ldr	x22, [x22, _GSC_SW_RESET@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x20
	bl	_gsc_write
	cbz	w21, LBB0_3
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x22]
	bl	_gsc_read
	cbz	w0, LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	sub	w21, w21, #1
	mov	w0, #1000
	mov	w1, #2000
	bl	_usleep_range
	cbnz	w21, LBB0_1
	b	LBB0_4
LBB0_3:
	cbz	w20, LBB0_5
LBB0_4:
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_DRM_DEV_ERROR
Lloh10:
	adrp	x8, _EBUSY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_6
LBB0_5:
Lloh13:
	adrp	x20, _GSC_IN_BASE_ADDR_Y_MASK@GOTPAGE
Lloh14:
	ldr	x20, [x20, _GSC_IN_BASE_ADDR_Y_MASK@GOTPAGEOFF]
	ldr	w0, [x20]
	bl	_gsc_read
	mov	x19, x0
Lloh15:
	adrp	x8, _GSC_IN_BASE_ADDR_MASK@GOTPAGE
Lloh16:
	ldr	x8, [x8, _GSC_IN_BASE_ADDR_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w21, [x8]
	mov	w0, #0
	bl	_GSC_IN_BASE_ADDR_PINGPONG
	orr	w8, w21, w19
	orr	w19, w8, w0
	ldr	w1, [x20]
	mov	x0, x19
	bl	_gsc_write
Lloh18:
	adrp	x8, _GSC_IN_BASE_ADDR_CB_MASK@GOTPAGE
Lloh19:
	ldr	x8, [x8, _GSC_IN_BASE_ADDR_CB_MASK@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_gsc_write
Lloh21:
	adrp	x8, _GSC_IN_BASE_ADDR_CR_MASK@GOTPAGE
Lloh22:
	ldr	x8, [x8, _GSC_IN_BASE_ADDR_CR_MASK@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_gsc_write
Lloh24:
	adrp	x20, _GSC_OUT_BASE_ADDR_Y_MASK@GOTPAGE
Lloh25:
	ldr	x20, [x20, _GSC_OUT_BASE_ADDR_Y_MASK@GOTPAGEOFF]
	ldr	w0, [x20]
	bl	_gsc_read
	mov	x19, x0
Lloh26:
	adrp	x8, _GSC_OUT_BASE_ADDR_MASK@GOTPAGE
Lloh27:
	ldr	x8, [x8, _GSC_OUT_BASE_ADDR_MASK@GOTPAGEOFF]
Lloh28:
	ldr	w21, [x8]
	mov	w0, #0
	bl	_GSC_OUT_BASE_ADDR_PINGPONG
	orr	w8, w21, w19
	orr	w19, w8, w0
	ldr	w1, [x20]
	mov	x0, x19
	bl	_gsc_write
Lloh29:
	adrp	x8, _GSC_OUT_BASE_ADDR_CB_MASK@GOTPAGE
Lloh30:
	ldr	x8, [x8, _GSC_OUT_BASE_ADDR_CB_MASK@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_gsc_write
Lloh32:
	adrp	x8, _GSC_OUT_BASE_ADDR_CR_MASK@GOTPAGE
Lloh33:
	ldr	x8, [x8, _GSC_OUT_BASE_ADDR_CR_MASK@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_gsc_write
	mov	w0, #0
LBB0_6:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_GSC_RESET_TIMEOUT,4,2          ; @GSC_RESET_TIMEOUT
	.comm	_GSC_SW_RESET_SRESET,4,2        ; @GSC_SW_RESET_SRESET
	.comm	_GSC_SW_RESET,4,2               ; @GSC_SW_RESET
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to reset gsc h/w.\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_GSC_IN_BASE_ADDR_Y_MASK,4,2    ; @GSC_IN_BASE_ADDR_Y_MASK
	.comm	_GSC_IN_BASE_ADDR_MASK,4,2      ; @GSC_IN_BASE_ADDR_MASK
	.comm	_GSC_IN_BASE_ADDR_CB_MASK,4,2   ; @GSC_IN_BASE_ADDR_CB_MASK
	.comm	_GSC_IN_BASE_ADDR_CR_MASK,4,2   ; @GSC_IN_BASE_ADDR_CR_MASK
	.comm	_GSC_OUT_BASE_ADDR_Y_MASK,4,2   ; @GSC_OUT_BASE_ADDR_Y_MASK
	.comm	_GSC_OUT_BASE_ADDR_MASK,4,2     ; @GSC_OUT_BASE_ADDR_MASK
	.comm	_GSC_OUT_BASE_ADDR_CB_MASK,4,2  ; @GSC_OUT_BASE_ADDR_CB_MASK
	.comm	_GSC_OUT_BASE_ADDR_CR_MASK,4,2  ; @GSC_OUT_BASE_ADDR_CR_MASK
	.no_dead_strip	_gsc_sw_reset
.subsections_via_symbols
