	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_agp_generic_enable             ## -- Begin function agp_generic_enable
	.p2align	4, 0x90
_agp_generic_enable:                    ## @agp_generic_enable
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	_agp_bridge@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	callq	_get_agp_version
	movq	(%rbx), %rax
	movq	8(%rax), %rdi
	movl	20(%rax), %edx
	movl	16(%rax), %ecx
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_info
	movq	(%rbx), %rax
	movq	8(%rax), %rdi
	movq	_PCI_AGP_STATUS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	(%rax), %rsi
	leaq	-28(%rbp), %rdx
	callq	_pci_read_config_dword
	movq	(%rbx), %rdi
	movl	-28(%rbp), %edx
	movl	%r15d, %esi
	callq	_agp_collect_device_status
	testl	%eax, %eax
	je	LBB0_9
## %bb.1:
	movq	_AGPSTAT_AGP_ENABLE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, -28(%rbp)
	cmpl	$3, (%r14)
	jl	LBB0_7
## %bb.2:
	movq	_AGPSTAT_MODE_3_0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 4(%r14)
	je	LBB0_6
## %bb.3:
	cmpl	$5, 8(%r14)
	jl	LBB0_5
## %bb.4:
	movq	%r14, %rdi
	callq	_agp_3_5_enable
	movl	-28(%rbp), %eax
LBB0_5:
	movl	%eax, %edi
	movl	$1, %esi
	jmp	LBB0_8
LBB0_6:
	andl	$-7169, %eax                    ## imm = 0xE3FF
	movl	%eax, -28(%rbp)
	movq	16(%r14), %rdi
	movq	_AGPCTRL@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rsi
	addq	24(%r14), %rsi
	leaq	-32(%rbp), %rdx
	callq	_pci_read_config_dword
	movl	$512, %edx                      ## imm = 0x200
	orl	-32(%rbp), %edx
	movl	%edx, -32(%rbp)
	movq	16(%r14), %rdi
	movq	(%rbx), %rsi
	addq	24(%r14), %rsi
	callq	_pci_write_config_dword
	movq	16(%r14), %rdi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_info
	movl	-28(%rbp), %eax
LBB0_7:
	movl	%eax, %edi
	xorl	%esi, %esi
LBB0_8:
	callq	_agp_device_command
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_agp_bridge,8,3                 ## @agp_bridge
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"AGP %d.%d bridge\n"

	.comm	_PCI_AGP_STATUS,8,3             ## @PCI_AGP_STATUS
	.comm	_AGPSTAT_AGP_ENABLE,4,2         ## @AGPSTAT_AGP_ENABLE
	.comm	_AGPSTAT_MODE_3_0,4,2           ## @AGPSTAT_MODE_3_0
	.comm	_AGPCTRL,8,3                    ## @AGPCTRL
L_.str.1:                               ## @.str.1
	.asciz	"bridge is in legacy mode, falling back to 2.x\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_agp_generic_enable             ; -- Begin function agp_generic_enable
	.p2align	2
_agp_generic_enable:                    ; @agp_generic_enable
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x21, _agp_bridge@GOTPAGE
Lloh1:
	ldr	x21, [x21, _agp_bridge@GOTPAGEOFF]
	ldr	x0, [x21]
	bl	_get_agp_version
	ldr	x8, [x21]
	ldr	x0, [x8, #8]
	ldp	w8, w9, [x8, #16]
	stp	x9, x8, [sp]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
	ldr	x8, [x21]
	ldp	x8, x0, [x8]
Lloh4:
	adrp	x9, _PCI_AGP_STATUS@GOTPAGE
Lloh5:
	ldr	x9, [x9, _PCI_AGP_STATUS@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
	add	x1, x9, x8
	add	x2, sp, #28
	bl	_pci_read_config_dword
	ldr	x0, [x21]
	ldr	w2, [sp, #28]
	mov	x1, x20
	bl	_agp_collect_device_status
	cbz	w0, LBB0_9
; %bb.1:
Lloh7:
	adrp	x8, _AGPSTAT_AGP_ENABLE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AGPSTAT_AGP_ENABLE@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	orr	w0, w8, w0
	str	w0, [sp, #28]
	ldr	w8, [x19]
	cmp	w8, #3
	b.lt	LBB0_7
; %bb.2:
	ldr	w8, [x19, #4]
Lloh10:
	adrp	x9, _AGPSTAT_MODE_3_0@GOTPAGE
Lloh11:
	ldr	x9, [x9, _AGPSTAT_MODE_3_0@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.3:
	ldr	w8, [x19, #8]
	cmp	w8, #5
	b.lt	LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_agp_3_5_enable
	ldr	w0, [sp, #28]
LBB0_5:
	mov	w1, #1
	b	LBB0_8
LBB0_6:
	and	w8, w0, #0xffffe3ff
	str	w8, [sp, #28]
	ldp	x0, x8, [x19, #16]
Lloh13:
	adrp	x20, _AGPCTRL@GOTPAGE
Lloh14:
	ldr	x20, [x20, _AGPCTRL@GOTPAGEOFF]
	ldr	x9, [x20]
	add	x1, x9, x8
	add	x2, sp, #24
	bl	_pci_read_config_dword
	ldr	w8, [sp, #24]
	orr	w2, w8, #0x200
	str	w2, [sp, #24]
	ldp	x0, x8, [x19, #16]
	ldr	x9, [x20]
	add	x1, x9, x8
	bl	_pci_write_config_dword
	ldr	x0, [x19, #16]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_info
	ldr	w0, [sp, #28]
LBB0_7:
	mov	w1, #0
LBB0_8:
	bl	_agp_device_command
LBB0_9:
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_agp_bridge,8,3                 ; @agp_bridge
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"AGP %d.%d bridge\n"

	.comm	_PCI_AGP_STATUS,8,3             ; @PCI_AGP_STATUS
	.comm	_AGPSTAT_AGP_ENABLE,4,2         ; @AGPSTAT_AGP_ENABLE
	.comm	_AGPSTAT_MODE_3_0,4,2           ; @AGPSTAT_MODE_3_0
	.comm	_AGPCTRL,8,3                    ; @AGPCTRL
l_.str.1:                               ; @.str.1
	.asciz	"bridge is in legacy mode, falling back to 2.x\n"

.subsections_via_symbols
