	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bochs_hw_init                  ## -- Begin function bochs_hw_init
	.p2align	4, 0x90
_bochs_hw_init:                         ## @bochs_hw_init
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %r12
	movq	8(%rdi), %r14
	movq	8(%r12), %rax
	movq	_IORESOURCE_MEM@GOTPCREL(%rip), %r15
	movl	(%r15), %ecx
	testl	%ecx, 8(%rax)
	je	LBB0_3
## %bb.1:
	leaq	L_.str(%rip), %rdx
	movq	%r12, %rdi
	movl	$2, %esi
	callq	_pci_request_region
	testq	%rax, %rax
	je	LBB0_5
## %bb.2:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_17
LBB0_3:
	movq	_VBE_DISPI_IOPORT_INDEX@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	leaq	L_.str(%rip), %rdx
	movl	$2, %esi
	movq	%rbx, %rdi
	callq	_request_region
	testl	%eax, %eax
	je	LBB0_16
## %bb.4:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movl	$2, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movl	$1, (%r14)
	jmp	LBB0_7
LBB0_5:
	movq	%r12, %rdi
	movl	$2, %esi
	callq	_pci_resource_start
	movq	%rax, %r13
	movq	%r12, %rdi
	movl	$2, %esi
	callq	_pci_resource_len
	movq	%rax, %rbx
	movq	%r13, %rdi
	movq	%rax, %rsi
	callq	_ioremap
	movq	%rax, 32(%r14)
	testq	%rax, %rax
	je	LBB0_21
## %bb.6:
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
LBB0_7:
	movq	_VBE_DISPI_INDEX_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_bochs_dispi_read
	movl	%eax, %ebx
	movq	_VBE_DISPI_INDEX_VIDEO_MEMORY_64K@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_bochs_dispi_read
	movl	%eax, %r13d
	movl	%ebx, %eax
	andl	$65520, %eax                    ## imm = 0xFFF0
	movq	_VBE_DISPI_ID0@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_14
## %bb.8:
	movq	8(%r12), %rax
	movl	(%r15), %ecx
	testl	%ecx, (%rax)
	je	LBB0_23
## %bb.9:
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_pci_resource_start
	movq	%rax, %r15
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_pci_resource_len
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	testq	%r15, %r15
	je	LBB0_15
## %bb.10:
	shll	$16, %r13d
	movslq	%r13d, %r15
	cmpq	%r15, %rax
	je	LBB0_12
## %bb.11:
	leaq	L_.str.5(%rip), %rdi
	movq	%rax, %rsi
	movq	%r15, %rdx
	movq	%rax, %rbx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_min
	movq	%rax, %r15
LBB0_12:
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	leaq	L_.str(%rip), %rdx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_pci_request_region
	testq	%rax, %rax
	je	LBB0_24
## %bb.13:
	leaq	L_.str.6(%rip), %rdi
	jmp	LBB0_18
LBB0_14:
	leaq	L_.str.4(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_ERROR
LBB0_15:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_19
LBB0_16:
	leaq	L_.str.3(%rip), %rdi
LBB0_17:
	xorl	%ebx, %ebx
LBB0_18:
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_19:
	subl	(%rax), %ebx
LBB0_20:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	leaq	L_.str.2(%rip), %rdi
LBB0_22:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_19
LBB0_23:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	jmp	LBB0_19
LBB0_24:
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_ioremap
	movq	%rax, 40(%r14)
	testq	%rax, %rax
	je	LBB0_30
## %bb.25:
	movq	%rbx, 8(%r14)
	movq	%r15, 16(%r14)
	movslq	-52(%rbp), %rsi                 ## 4-byte Folded Reload
	leaq	L_.str.8(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_INFO
	shrq	$10, %r15
	cmpl	$0, (%r14)
	leaq	L_.str.11(%rip), %rax
	leaq	L_.str.10(%rip), %rcx
	cmoveq	%rax, %rcx
	leaq	L_.str.9(%rip), %rdi
	movq	%r15, %rsi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movq	%r13, %r8
	xorl	%eax, %eax
	callq	_DRM_INFO
	movq	32(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_20
## %bb.26:
	cmpl	$2, (%r12)
	jl	LBB0_20
## %bb.27:
	addq	$6144, %rdi                     ## imm = 0x1800
	callq	_readl
	movl	%eax, 24(%r14)
	cmpl	$4, %eax
	jl	LBB0_29
## %bb.28:
	movl	%eax, %esi
	cmpq	%rsi, -72(%rbp)                 ## 8-byte Folded Reload
	jae	LBB0_31
LBB0_29:
	movl	$0, 24(%r14)
	jmp	LBB0_20
LBB0_30:
	leaq	L_.str.7(%rip), %rdi
	jmp	LBB0_22
LBB0_31:
	leaq	L_.str.12(%rip), %rdi
	callq	_DRM_DEBUG
	movq	%r14, %rdi
	callq	_bochs_hw_set_native_endian
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_IORESOURCE_MEM,4,2             ## @IORESOURCE_MEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bochs-drm"

L_.str.1:                               ## @.str.1
	.asciz	"Cannot request mmio region\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
L_.str.2:                               ## @.str.2
	.asciz	"Cannot map mmio region\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_VBE_DISPI_IOPORT_INDEX,8,3     ## @VBE_DISPI_IOPORT_INDEX
L_.str.3:                               ## @.str.3
	.asciz	"Cannot request ioports\n"

	.comm	_VBE_DISPI_INDEX_ID,4,2         ## @VBE_DISPI_INDEX_ID
	.comm	_VBE_DISPI_INDEX_VIDEO_MEMORY_64K,4,2 ## @VBE_DISPI_INDEX_VIDEO_MEMORY_64K
	.comm	_VBE_DISPI_ID0,4,2              ## @VBE_DISPI_ID0
L_.str.4:                               ## @.str.4
	.asciz	"ID mismatch\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.5:                               ## @.str.5
	.asciz	"Size mismatch: pci=%ld, bochs=%ld\n"

L_.str.6:                               ## @.str.6
	.asciz	"Cannot request framebuffer\n"

L_.str.7:                               ## @.str.7
	.asciz	"Cannot map framebuffer\n"

L_.str.8:                               ## @.str.8
	.asciz	"Found bochs VGA, ID 0x%x.\n"

L_.str.9:                               ## @.str.9
	.asciz	"Framebuffer size %ld kB @ 0x%lx, %s @ 0x%lx.\n"

L_.str.10:                              ## @.str.10
	.asciz	"ioports"

L_.str.11:                              ## @.str.11
	.asciz	"mmio"

L_.str.12:                              ## @.str.12
	.asciz	"Found qemu ext regs, size %ld\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bochs_hw_init                  ; -- Begin function bochs_hw_init
	.p2align	2
_bochs_hw_init:                         ; @bochs_hw_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	ldp	x20, x19, [x0]
	ldr	x8, [x20, #8]
	ldr	w8, [x8, #8]
Lloh0:
	adrp	x24, _IORESOURCE_MEM@GOTPAGE
Lloh1:
	ldr	x24, [x24, _IORESOURCE_MEM@GOTPAGEOFF]
	ldr	w9, [x24]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.1:
Lloh2:
	adrp	x2, l_.str@PAGE
Lloh3:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	mov	w1, #2
	bl	_pci_request_region
	cbz	x0, LBB0_5
; %bb.2:
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_16
LBB0_3:
Lloh6:
	adrp	x8, _VBE_DISPI_IOPORT_INDEX@GOTPAGE
Lloh7:
	ldr	x8, [x8, _VBE_DISPI_IOPORT_INDEX@GOTPAGEOFF]
Lloh8:
	ldr	x22, [x8]
Lloh9:
	adrp	x2, l_.str@PAGE
Lloh10:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x22
	mov	w1, #2
	bl	_request_region
	cbz	w0, LBB0_15
; %bb.4:
	mov	w8, #1
	str	w8, [x19]
	mov	w21, #2
	b	LBB0_6
LBB0_5:
	mov	x0, x20
	mov	w1, #2
	bl	_pci_resource_start
	mov	x22, x0
	mov	x0, x20
	mov	w1, #2
	bl	_pci_resource_len
	mov	x21, x0
	mov	x0, x22
	mov	x1, x21
	bl	_ioremap
	str	x0, [x19, #32]
	cbz	x0, LBB0_19
LBB0_6:
Lloh11:
	adrp	x8, _VBE_DISPI_INDEX_ID@GOTPAGE
Lloh12:
	ldr	x8, [x8, _VBE_DISPI_INDEX_ID@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bochs_dispi_read
	mov	x23, x0
Lloh14:
	adrp	x8, _VBE_DISPI_INDEX_VIDEO_MEMORY_64K@GOTPAGE
Lloh15:
	ldr	x8, [x8, _VBE_DISPI_INDEX_VIDEO_MEMORY_64K@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bochs_dispi_read
	and	w8, w23, #0xfff0
Lloh17:
	adrp	x9, _VBE_DISPI_ID0@GOTPAGE
Lloh18:
	ldr	x9, [x9, _VBE_DISPI_ID0@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_13
; %bb.7:
	ldr	x8, [x20, #8]
	ldr	w8, [x8]
	ldr	w9, [x24]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.8:
	mov	x25, x0
	mov	x0, x20
	mov	w1, #0
	bl	_pci_resource_start
	mov	x24, x0
	mov	x0, x20
	mov	w1, #0
	bl	_pci_resource_len
	cbz	x24, LBB0_14
; %bb.9:
	mov	x26, x0
	lsl	w8, w25, #16
	sxtw	x25, w8
	cmp	x0, x25
	b.eq	LBB0_11
; %bb.10:
	stp	x26, x25, [sp]
Lloh20:
	adrp	x0, l_.str.5@PAGE
Lloh21:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_DRM_ERROR
	mov	x0, x26
	mov	x1, x25
	bl	_min
	mov	x25, x0
LBB0_11:
Lloh22:
	adrp	x2, l_.str@PAGE
Lloh23:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	mov	w1, #0
	bl	_pci_request_region
	cbz	x0, LBB0_21
; %bb.12:
Lloh24:
	adrp	x0, l_.str.6@PAGE
Lloh25:
	add	x0, x0, l_.str.6@PAGEOFF
	b	LBB0_16
LBB0_13:
Lloh26:
	adrp	x0, l_.str.4@PAGE
Lloh27:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DRM_ERROR
LBB0_14:
Lloh28:
	adrp	x8, _ENODEV@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_17
LBB0_15:
Lloh30:
	adrp	x0, l_.str.3@PAGE
Lloh31:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_16:
	bl	_DRM_ERROR
Lloh32:
	adrp	x8, _EBUSY@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_17:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_18:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_19:
Lloh34:
	adrp	x0, l_.str.2@PAGE
Lloh35:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_20:
	bl	_DRM_ERROR
Lloh36:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh37:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_17
LBB0_21:
	mov	x0, x24
	mov	x1, x25
	bl	_ioremap
	str	x0, [x19, #40]
	cbz	x0, LBB0_27
; %bb.22:
	stp	x24, x25, [x19, #8]
	sxtw	x1, w23
Lloh38:
	adrp	x0, l_.str.8@PAGE
Lloh39:
	add	x0, x0, l_.str.8@PAGEOFF
	bl	_DRM_INFO
	lsr	x1, x25, #10
	ldr	w8, [x19]
Lloh40:
	adrp	x9, l_.str.10@PAGE
Lloh41:
	add	x9, x9, l_.str.10@PAGEOFF
Lloh42:
	adrp	x10, l_.str.11@PAGE
Lloh43:
	add	x10, x10, l_.str.11@PAGEOFF
	cmp	w8, #0
	csel	x8, x10, x9, eq
	stp	x8, x22, [sp, #8]
	str	x24, [sp]
Lloh44:
	adrp	x0, l_.str.9@PAGE
Lloh45:
	add	x0, x0, l_.str.9@PAGEOFF
	bl	_DRM_INFO
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_29
; %bb.23:
	ldr	w9, [x20]
	cmp	w9, #2
	b.lt	LBB0_29
; %bb.24:
	mov	w9, #6144
	add	x0, x8, x9
	bl	_readl
	str	w0, [x19, #24]
	cmp	w0, #4
	b.lt	LBB0_26
; %bb.25:
	mov	w1, w0
	cmp	x21, x1
	b.hs	LBB0_28
LBB0_26:
	mov	w0, #0
	str	wzr, [x19, #24]
	b	LBB0_18
LBB0_27:
Lloh46:
	adrp	x0, l_.str.7@PAGE
Lloh47:
	add	x0, x0, l_.str.7@PAGEOFF
	b	LBB0_20
LBB0_28:
Lloh48:
	adrp	x0, l_.str.12@PAGE
Lloh49:
	add	x0, x0, l_.str.12@PAGEOFF
	bl	_DRM_DEBUG
	mov	x0, x19
	bl	_bochs_hw_set_native_endian
LBB0_29:
	mov	w0, #0
	b	LBB0_18
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpAdd	Lloh44, Lloh45
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpAdd	Lloh48, Lloh49
	.cfi_endproc
                                        ; -- End function
	.comm	_IORESOURCE_MEM,4,2             ; @IORESOURCE_MEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bochs-drm"

l_.str.1:                               ; @.str.1
	.asciz	"Cannot request mmio region\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
l_.str.2:                               ; @.str.2
	.asciz	"Cannot map mmio region\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_VBE_DISPI_IOPORT_INDEX,8,3     ; @VBE_DISPI_IOPORT_INDEX
l_.str.3:                               ; @.str.3
	.asciz	"Cannot request ioports\n"

	.comm	_VBE_DISPI_INDEX_ID,4,2         ; @VBE_DISPI_INDEX_ID
	.comm	_VBE_DISPI_INDEX_VIDEO_MEMORY_64K,4,2 ; @VBE_DISPI_INDEX_VIDEO_MEMORY_64K
	.comm	_VBE_DISPI_ID0,4,2              ; @VBE_DISPI_ID0
l_.str.4:                               ; @.str.4
	.asciz	"ID mismatch\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.5:                               ; @.str.5
	.asciz	"Size mismatch: pci=%ld, bochs=%ld\n"

l_.str.6:                               ; @.str.6
	.asciz	"Cannot request framebuffer\n"

l_.str.7:                               ; @.str.7
	.asciz	"Cannot map framebuffer\n"

l_.str.8:                               ; @.str.8
	.asciz	"Found bochs VGA, ID 0x%x.\n"

l_.str.9:                               ; @.str.9
	.asciz	"Framebuffer size %ld kB @ 0x%lx, %s @ 0x%lx.\n"

l_.str.10:                              ; @.str.10
	.asciz	"ioports"

l_.str.11:                              ; @.str.11
	.asciz	"mmio"

l_.str.12:                              ; @.str.12
	.asciz	"Found qemu ext regs, size %ld\n"

.subsections_via_symbols
