	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_aspeed_gpio_copro_grab_gpio    ## -- Begin function aspeed_gpio_copro_grab_gpio
	.p2align	4, 0x90
_aspeed_gpio_copro_grab_gpio:           ## @aspeed_gpio_copro_grab_gpio
	.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
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	callq	_gpiod_to_chip
	movq	%rax, %rdi
	callq	_gpiochip_get_data
	movq	%rax, %r13
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	_gpio_chip_hwgpio
	movl	%eax, %r12d
	movl	%eax, %edi
	callq	_to_bank
	movq	%rax, %r14
	cmpq	$0, (%r13)
	jne	LBB0_4
## %bb.1:
	movl	12(%r15), %edi
	sarl	$3, %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_2
LBB0_4:
	testl	%r12d, %r12d
	js	LBB0_6
## %bb.5:
	cmpl	12(%r15), %r12d
	jle	LBB0_7
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_18
LBB0_7:
	movl	%r12d, %ebx
	shrl	$3, %ebx
	addq	$8, %r13
	movq	%r13, %rdi
	callq	_spin_lock_irqsave
	movq	(%r15), %rax
	movl	(%rax,%rbx,4), %ecx
	cmpl	$255, %ecx
	jne	LBB0_9
## %bb.8:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_17
LBB0_2:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_9:
	leal	1(%rcx), %edx
	movl	%edx, (%rax,%rbx,4)
	testl	%ecx, %ecx
	jne	LBB0_11
## %bb.10:
	movq	_GPIO_CMDSRC_COLDFIRE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_aspeed_gpio_change_cmd_source
LBB0_11:
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	testq	%rcx, %rcx
	je	LBB0_13
## %bb.12:
	movl	4(%r14), %eax
	movl	%eax, (%rcx)
LBB0_13:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	testq	%rcx, %rcx
	je	LBB0_15
## %bb.14:
	movl	(%r14), %eax
	movl	%eax, (%rcx)
LBB0_15:
	xorl	%ebx, %ebx
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	testq	%r14, %r14
	je	LBB0_17
## %bb.16:
	movl	%r12d, %edi
	callq	_GPIO_OFFSET
	movl	%eax, (%r14)
LBB0_17:
	movq	%r13, %rdi
	callq	_spin_unlock_irqrestore
LBB0_18:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EIO,4,2                        ## @EIO
	.comm	_GPIO_CMDSRC_COLDFIRE,4,2       ## @GPIO_CMDSRC_COLDFIRE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_aspeed_gpio_copro_grab_gpio    ; -- Begin function aspeed_gpio_copro_grab_gpio
	.p2align	2
_aspeed_gpio_copro_grab_gpio:           ; @aspeed_gpio_copro_grab_gpio
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x3
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
	bl	_gpiod_to_chip
	bl	_gpiochip_get_data
	mov	x25, x0
	mov	x0, x22
	bl	_gpio_chip_hwgpio
	mov	x22, x0
	bl	_to_bank
	mov	x24, x0
	ldr	x8, [x25]
	cbnz	x8, LBB0_2
; %bb.1:
	ldr	w8, [x25, #12]
	asr	w0, w8, #3
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_kzalloc
	str	x0, [x25]
	cbz	x0, LBB0_8
LBB0_2:
	tbnz	w22, #31, LBB0_4
; %bb.3:
	ldr	w8, [x25, #12]
	cmp	w22, w8
	b.le	LBB0_6
LBB0_4:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_19
LBB0_6:
	lsr	w26, w22, #3
	add	x23, x25, #8
	mov	x0, x23
	bl	_spin_lock_irqsave
	ldr	x8, [x25]
	ldr	w9, [x8, w26, uxtw #2]
	cmp	w9, #255
	b.ne	LBB0_9
; %bb.7:
Lloh5:
	adrp	x8, _EIO@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_18
LBB0_8:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_5
LBB0_9:
	add	w10, w9, #1
	str	w10, [x8, x26, lsl #2]
	cbnz	w9, LBB0_11
; %bb.10:
Lloh10:
	adrp	x8, _GPIO_CMDSRC_COLDFIRE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _GPIO_CMDSRC_COLDFIRE@GOTPAGEOFF]
Lloh12:
	ldr	w3, [x8]
	mov	x0, x25
	mov	x1, x24
	mov	x2, x26
	bl	_aspeed_gpio_change_cmd_source
LBB0_11:
	cbz	x21, LBB0_13
; %bb.12:
	ldr	w8, [x24, #4]
	str	w8, [x21]
LBB0_13:
	cbz	x20, LBB0_15
; %bb.14:
	ldr	w8, [x24]
	str	w8, [x20]
LBB0_15:
	cbz	x19, LBB0_17
; %bb.16:
	mov	x0, x22
	bl	_GPIO_OFFSET
	mov	w20, #0
	str	w0, [x19]
	b	LBB0_18
LBB0_17:
	mov	w20, #0
LBB0_18:
	mov	x0, x23
	bl	_spin_unlock_irqrestore
LBB0_19:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EIO,4,2                        ; @EIO
	.comm	_GPIO_CMDSRC_COLDFIRE,4,2       ; @GPIO_CMDSRC_COLDFIRE
.subsections_via_symbols
