	.file	"extr_agp_via.c_agp_via_set_aperture.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Invalid aperture size (%dMb)\n"
	.text
	.p2align 4
	.type	agp_via_set_aperture, @function
agp_via_set_aperture:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	ebp, edi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	ebx, esi
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	device_get_softc@PLT
	mov	r13, rax
	mov	rax, QWORD PTR [rax]
	cmp	rax, QWORD PTR via_v2_regs[rip]
	je	.L24
	cmp	ebx, 67108864
	je	.L10
	jg	.L6
	cmp	ebx, 8388608
	je	.L11
	jle	.L25
	cmp	ebx, 16777216
	je	.L14
	cmp	ebx, 33554432
	jne	.L8
	mov	r12d, 3896
	.p2align 4,,10
	.p2align 3
.L5:
	mov	rdx, QWORD PTR REG_APSIZE[rip]
	mov	edi, ebp
	mov	esi, DWORD PTR [rax+rdx*4]
	mov	edx, 2
	call	pci_read_config@PLT
	mov	rcx, QWORD PTR REG_APSIZE[rip]
	mov	edi, ebp
	and	eax, -4096
	mov	edx, eax
	mov	rax, QWORD PTR 0[r13]
	or	edx, r12d
	mov	esi, DWORD PTR [rax+rcx*4]
	mov	ecx, 2
	call	pci_write_config@PLT
	xor	eax, eax
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	cmp	ebx, 536870912
	je	.L16
	jle	.L26
	mov	r12d, 3072
	cmp	ebx, 1073741824
	je	.L5
.L8:
	test	ebx, ebx
	lea	edx, 1048575[rbx]
	lea	rsi, .LC0[rip]
	mov	edi, ebp
	cmovns	edx, ebx
	sar	edx, 20
	call	device_printf@PLT
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L26:
	cmp	ebx, 134217728
	je	.L17
	cmp	ebx, 268435456
	jne	.L8
	mov	r12d, 3840
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L25:
	cmp	ebx, -2147483648
	je	.L12
	cmp	ebx, 4194304
	jne	.L8
	mov	r12d, 3903
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L12:
	mov	r12d, 2048
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L17:
	mov	r12d, 3872
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L14:
	mov	r12d, 3900
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L24:
	lea	edx, -1[rbx]
	sar	edx, 20
	xor	dl, -1
	mov	ecx, edx
	sal	ecx, 20
	xor	ecx, 268435455
	add	ecx, 1
	cmp	ecx, ebx
	je	.L3
.L22:
	mov	eax, DWORD PTR EINVAL[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	mov	r12d, 3584
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L11:
	mov	r12d, 3902
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	mov	rcx, QWORD PTR REG_APSIZE[rip]
	mov	edi, ebp
	mov	esi, DWORD PTR [rax+rcx*4]
	mov	ecx, 1
	call	pci_write_config@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L10:
	mov	r12d, 3888
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	agp_via_set_aperture, .-agp_via_set_aperture
	.comm	via_v2_regs,8,8
	.comm	REG_APSIZE,8,8
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_agp_via.c_agp_via_set_aperture.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Invalid aperture size (%dMb)\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	agp_via_set_aperture, %function
agp_via_set_aperture:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r4, r1
	mov	r5, r0
	bl	device_get_softc
	ldr	r2, .L26
	ldr	r3, [r0]
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L23
	cmp	r4, #67108864
	mov	r6, r0
	beq	.L10
	bgt	.L6
	cmp	r4, #8388608
	beq	.L11
	ble	.L24
	cmp	r4, #16777216
	beq	.L14
	cmp	r4, #33554432
	ldreq	r4, .L26+4
	bne	.L8
.L5:
	ldr	r7, .L26+8
	mov	r2, #2
	ldr	r1, [r7]
	mov	r0, r5
	ldr	r1, [r3, r1, lsl #2]
	bl	pci_read_config
	ldr	r3, [r6]
	ldr	r1, [r7]
	bic	r2, r0, #4080
	bic	r2, r2, #15
	ldr	r1, [r3, r1, lsl #2]
	mov	r0, r5
	mov	r3, #2
	orr	r2, r2, r4
	bl	pci_write_config
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, pc}
.L6:
	cmp	r4, #536870912
	beq	.L16
	ble	.L25
	cmp	r4, #1073741824
	moveq	r4, #3072
	beq	.L5
.L8:
	sub	r2, r4, #-67108863
	sub	r2, r2, #66060288
	cmp	r4, #0
	movlt	r4, r2
	mov	r0, r5
	ldr	r1, .L26+12
	asr	r2, r4, #20
	bl	device_printf
	b	.L21
.L25:
	cmp	r4, #134217728
	beq	.L17
	cmp	r4, #268435456
	moveq	r4, #3840
	beq	.L5
	b	.L8
.L24:
	cmp	r4, #-2147483648
	beq	.L12
	cmp	r4, #4194304
	ldreq	r4, .L26+16
	beq	.L5
	b	.L8
.L12:
	mov	r4, #2048
	b	.L5
.L17:
	mov	r4, #3872
	b	.L5
.L14:
	ldr	r4, .L26+20
	b	.L5
.L23:
	mvn	r1, #-268435456
	sub	r2, r4, #1
	asr	r2, r2, #20
	eor	r2, r2, #255
	eor	r1, r1, r2, lsl #20
	add	r1, r1, #1
	cmp	r1, r4
	beq	.L3
.L21:
	ldr	r3, .L26+24
	ldr	r0, [r3]
	pop	{r4, r5, r6, r7, r8, pc}
.L16:
	mov	r4, #3584
	b	.L5
.L11:
	ldr	r4, .L26+28
	b	.L5
.L3:
	ldr	r1, .L26+8
	mov	r0, r5
	ldr	r1, [r1]
	ldr	r1, [r3, r1, lsl #2]
	mov	r3, #1
	bl	pci_write_config
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, pc}
.L10:
	mov	r4, #3888
	b	.L5
.L27:
	.align	2
.L26:
	.word	via_v2_regs
	.word	3896
	.word	REG_APSIZE
	.word	.LC0
	.word	3903
	.word	3900
	.word	EINVAL
	.word	3902
	.size	agp_via_set_aperture, .-agp_via_set_aperture
	.comm	via_v2_regs,4,4
	.comm	REG_APSIZE,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
