	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gsc_m2m_device_run
_gsc_m2m_device_run:                    ## @gsc_m2m_device_run
	.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, %rbx
	xorl	%edi, %edi
	testq	%rbx, %rbx
	sete	%dil
	leaq	L_.str(%rip), %rsi
	callq	_WARN
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	16(%rbx), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movq	_ST_M2M_PEND@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	16(%r14), %rsi
	callq	_set_bit
	movq	8(%r14), %rsi
	cmpq	%rbx, %rsi
	je	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rdi
	movq	%rbx, %rdx
	callq	_pr_debug
	movq	_GSC_PARAMS@GOTPCREL(%rip), %rcx
	movl	(%rbx), %eax
	orl	(%rcx), %eax
	movl	%eax, (%rbx)
	movq	%rbx, 8(%r14)
	jmp	LBB0_5
LBB0_4:
	movl	(%rbx), %eax
LBB0_5:
	movq	_GSC_CTX_STOP_REQ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	je	LBB0_7
## %bb.6:
	notl	%ecx
	andl	%ecx, %eax
	movl	%eax, (%rbx)
	movq	_GSC_CTX_ABORT@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%rbx)
	leaq	4(%r14), %rdi
	callq	_wake_up
	jmp	LBB0_10
LBB0_7:
	movq	%rbx, %rdi
	callq	_gsc_get_bufs
	testl	%eax, %eax
	je	LBB0_12
## %bb.8:
	leaq	L_.str.2(%rip), %rdi
LBB0_9:
	callq	_pr_err
LBB0_10:
	movq	_GSC_PARAMS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	%eax, (%rbx)
LBB0_11:
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
LBB0_12:
	leaq	8(%rbx), %r15
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_gsc_set_prefbuf
	movq	_GSC_M2M_BUF_NUM@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_gsc_hw_set_input_addr
	leaq	4(%rbx), %rsi
	movl	(%r12), %edx
	movq	%r14, %rdi
	callq	_gsc_hw_set_output_addr
	movq	_GSC_PARAMS@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	testl	%eax, (%rbx)
	je	LBB0_16
## %bb.13:
	movl	(%r12), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_gsc_hw_set_input_buf_masking
	movl	(%r12), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_gsc_hw_set_output_buf_masking
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_gsc_hw_set_frm_done_irq_mask
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_gsc_hw_set_gsc_irq_enable
	movq	%rbx, %rdi
	callq	_gsc_set_scaler_info
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	leaq	L_.str.3(%rip), %rdi
	jmp	LBB0_9
LBB0_15:
	movq	%rbx, %rdi
	callq	_gsc_hw_set_input_path
	movq	%rbx, %rdi
	callq	_gsc_hw_set_in_size
	movq	%rbx, %rdi
	callq	_gsc_hw_set_in_image_format
	movq	%rbx, %rdi
	callq	_gsc_hw_set_output_path
	movq	%rbx, %rdi
	callq	_gsc_hw_set_out_size
	movq	%rbx, %rdi
	callq	_gsc_hw_set_out_image_format
	movq	%rbx, %rdi
	callq	_gsc_hw_set_prescaler
	movq	%rbx, %rdi
	callq	_gsc_hw_set_mainscaler
	movq	%rbx, %rdi
	callq	_gsc_hw_set_rotation
	movq	%rbx, %rdi
	callq	_gsc_hw_set_global_alpha
LBB0_16:
	movq	%rbx, %rdi
	callq	_gsc_hw_set_sfr_update
	movl	(%r15), %eax
	notl	%eax
	andl	%eax, (%rbx)
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_gsc_hw_enable_control
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"null hardware context\n"

	.comm	_ST_M2M_PEND,4,2                ## @ST_M2M_PEND
L_.str.1:                               ## @.str.1
	.asciz	"gsc->m2m.ctx = 0x%p, current_ctx = 0x%p"

	.comm	_GSC_PARAMS,4,2                 ## @GSC_PARAMS
	.comm	_GSC_CTX_STOP_REQ,4,2           ## @GSC_CTX_STOP_REQ
	.comm	_GSC_CTX_ABORT,4,2              ## @GSC_CTX_ABORT
L_.str.2:                               ## @.str.2
	.asciz	"Wrong address"

	.comm	_GSC_M2M_BUF_NUM,4,2            ## @GSC_M2M_BUF_NUM
L_.str.3:                               ## @.str.3
	.asciz	"Scaler setup error"

	.no_dead_strip	_gsc_m2m_device_run
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gsc_m2m_device_run
_gsc_m2m_device_run:                    ; @gsc_m2m_device_run
	.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	x19, x0
	cmp	x0, #0
	cset	w0, eq
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_WARN
	cbz	x0, LBB0_2
; %bb.1:
	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
LBB0_2:
	ldr	x20, [x19, #16]
	mov	x0, x20
	bl	_spin_lock_irqsave
Lloh2:
	adrp	x8, _ST_M2M_PEND@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ST_M2M_PEND@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	add	x1, x20, #16
	bl	_set_bit
	ldr	x1, [x20, #8]
Lloh5:
	adrp	x22, _GSC_PARAMS@GOTPAGE
Lloh6:
	ldr	x22, [x22, _GSC_PARAMS@GOTPAGEOFF]
	cmp	x1, x19
	b.eq	LBB0_4
; %bb.3:
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_pr_debug
	ldr	w8, [x22]
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
	str	x19, [x20, #8]
	b	LBB0_5
LBB0_4:
	ldr	w8, [x19]
LBB0_5:
Lloh9:
	adrp	x9, _GSC_CTX_STOP_REQ@GOTPAGE
Lloh10:
	ldr	x9, [x9, _GSC_CTX_STOP_REQ@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.6:
	bic	w8, w8, w9
	str	w8, [x19]
Lloh12:
	adrp	x9, _GSC_CTX_ABORT@GOTPAGE
Lloh13:
	ldr	x9, [x9, _GSC_CTX_ABORT@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x19]
	add	x0, x20, #4
	bl	_wake_up
	b	LBB0_10
LBB0_7:
	mov	x0, x19
	bl	_gsc_get_bufs
	cbz	w0, LBB0_12
; %bb.8:
Lloh15:
	adrp	x0, l_.str.2@PAGE
Lloh16:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_9:
	bl	_pr_err
LBB0_10:
	ldr	w8, [x22]
	ldr	w9, [x19]
	bic	w8, w9, w8
	str	w8, [x19]
LBB0_11:
	mov	x0, x20
	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
	b	_spin_unlock_irqrestore
LBB0_12:
	add	x21, x19, #8
	mov	x0, x20
	mov	x1, x21
	bl	_gsc_set_prefbuf
Lloh17:
	adrp	x23, _GSC_M2M_BUF_NUM@GOTPAGE
Lloh18:
	ldr	x23, [x23, _GSC_M2M_BUF_NUM@GOTPAGEOFF]
	ldr	w2, [x23]
	mov	x0, x20
	mov	x1, x21
	bl	_gsc_hw_set_input_addr
	add	x1, x19, #4
	ldr	w2, [x23]
	mov	x0, x20
	bl	_gsc_hw_set_output_addr
	ldr	w8, [x19]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_16
; %bb.13:
	ldr	w1, [x23]
	mov	x0, x20
	mov	w2, #0
	bl	_gsc_hw_set_input_buf_masking
	ldr	w1, [x23]
	mov	x0, x20
	mov	w2, #0
	bl	_gsc_hw_set_output_buf_masking
	mov	x0, x20
	mov	w1, #0
	bl	_gsc_hw_set_frm_done_irq_mask
	mov	x0, x20
	mov	w1, #1
	bl	_gsc_hw_set_gsc_irq_enable
	mov	x0, x19
	bl	_gsc_set_scaler_info
	cbz	x0, LBB0_15
; %bb.14:
Lloh19:
	adrp	x0, l_.str.3@PAGE
Lloh20:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_9
LBB0_15:
	mov	x0, x19
	bl	_gsc_hw_set_input_path
	mov	x0, x19
	bl	_gsc_hw_set_in_size
	mov	x0, x19
	bl	_gsc_hw_set_in_image_format
	mov	x0, x19
	bl	_gsc_hw_set_output_path
	mov	x0, x19
	bl	_gsc_hw_set_out_size
	mov	x0, x19
	bl	_gsc_hw_set_out_image_format
	mov	x0, x19
	bl	_gsc_hw_set_prescaler
	mov	x0, x19
	bl	_gsc_hw_set_mainscaler
	mov	x0, x19
	bl	_gsc_hw_set_rotation
	mov	x0, x19
	bl	_gsc_hw_set_global_alpha
LBB0_16:
	mov	x0, x19
	bl	_gsc_hw_set_sfr_update
	ldr	w8, [x22]
	ldr	w9, [x19]
	bic	w8, w9, w8
	str	w8, [x19]
	mov	x0, x20
	mov	w1, #1
	bl	_gsc_hw_enable_control
	b	LBB0_11
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"null hardware context\n"

	.comm	_ST_M2M_PEND,4,2                ; @ST_M2M_PEND
l_.str.1:                               ; @.str.1
	.asciz	"gsc->m2m.ctx = 0x%p, current_ctx = 0x%p"

	.comm	_GSC_PARAMS,4,2                 ; @GSC_PARAMS
	.comm	_GSC_CTX_STOP_REQ,4,2           ; @GSC_CTX_STOP_REQ
	.comm	_GSC_CTX_ABORT,4,2              ; @GSC_CTX_ABORT
l_.str.2:                               ; @.str.2
	.asciz	"Wrong address"

	.comm	_GSC_M2M_BUF_NUM,4,2            ; @GSC_M2M_BUF_NUM
l_.str.3:                               ; @.str.3
	.asciz	"Scaler setup error"

	.no_dead_strip	_gsc_m2m_device_run
.subsections_via_symbols
