	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_VIDEOMODE_InitialiseDisplay    ## -- Begin function VIDEOMODE_InitialiseDisplay
	.p2align	4, 0x90
_VIDEOMODE_InitialiseDisplay:           ## @VIDEOMODE_InitialiseDisplay
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_resolutions_size@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_PLATFORM_AvailableResolutions
	movq	_resolutions@GOTPCREL(%rip), %r14
	movq	%rax, (%r14)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	(%rbx), %rsi
	movq	_CompareResolutions@GOTPCREL(%rip), %rcx
	movq	%rax, %rdi
	movl	$4, %edx
	callq	_qsort
	xorl	%eax, %eax
	callq	_RemoveDuplicateResolutions
	movq	(%rbx), %r10
	testq	%r10, %r10
	je	LBB0_21
## %bb.3:
	movq	(%r14), %r9
	movq	_init_fs_resolution@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	8(%rax), %rdx
	movq	_current_resolution@GOTPCREL(%rip), %r11
	movq	$0, (%r11)
	movq	%r10, %rax
	negq	%rax
	leaq	8(%r9), %rdi
	movl	$1, %ebx
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	%rbx, (%r11)
	leaq	(%rax,%rbx), %rcx
	incq	%rcx
	incq	%rbx
	addq	$16, %rdi
	cmpq	$1, %rcx
	je	LBB0_7
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	-8(%rdi), %rcx
	cmpq	%rsi, %rcx
	jl	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	(%rdi), %r8
	cmpq	%rdx, %r8
	jl	LBB0_6
## %bb.8:
	cmpq	%rsi, %rcx
	jne	LBB0_10
## %bb.9:
	cmpq	%rdx, %r8
	je	LBB0_12
LBB0_10:
	leaq	L_.str.3(%rip), %rdi
	jmp	LBB0_11
LBB0_1:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_18
LBB0_7:
	decq	%r10
	movq	%r10, (%r11)
	shlq	$4, %r10
	movq	(%r9,%r10), %rcx
	movq	8(%r9,%r10), %r8
	leaq	L_.str.2(%rip), %rdi
LBB0_11:
	xorl	%eax, %eax
	callq	_Log_print
LBB0_12:
	movq	_VIDEOMODE_host_aspect_ratio_w@GOTPCREL(%rip), %rax
	movsd	(%rax), %xmm1                   ## xmm1 = mem[0],zero
	xorpd	%xmm0, %xmm0
	ucomisd	%xmm0, %xmm1
	jne	LBB0_13
	jnp	LBB0_14
LBB0_13:
	movq	_VIDEOMODE_host_aspect_ratio_h@GOTPCREL(%rip), %rax
	movsd	(%rax), %xmm1                   ## xmm1 = mem[0],zero
	ucomisd	%xmm0, %xmm1
	jne	LBB0_15
	jp	LBB0_15
LBB0_14:
	movq	_VIDEOMODE_host_aspect_ratio_w@GOTPCREL(%rip), %rdi
	movq	_VIDEOMODE_host_aspect_ratio_h@GOTPCREL(%rip), %rsi
	callq	_AutodetectHostAspect
LBB0_15:
	xorl	%eax, %eax
	callq	_UpdateTvSystemSettings
	xorl	%eax, %eax
	callq	_VIDEOMODE_Update
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movq	_TRUE@GOTPCREL(%rip), %rax
	jmp	LBB0_20
LBB0_21:
	movq	_display_modes@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edx
	movl	4(%rax), %esi
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
	jmp	LBB0_19
LBB0_17:
	leaq	L_.str.4(%rip), %rdi
LBB0_18:
	xorl	%eax, %eax
	callq	_Log_print
LBB0_19:
	movq	_FALSE@GOTPCREL(%rip), %rax
LBB0_20:
	movl	(%rax), %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_resolutions_size,8,3           ## @resolutions_size
	.comm	_resolutions,8,3                ## @resolutions
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Fatal error: System reports no display resolutions available"

	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_CompareResolutions,4,2         ## @CompareResolutions
L_.str.1:                               ## @.str.1
	.asciz	"Fatal error: System reports no resolution higher than minimal %ux%u available"

	.comm	_display_modes,8,3              ## @display_modes
	.comm	_current_resolution,8,3         ## @current_resolution
	.comm	_init_fs_resolution,16,3        ## @init_fs_resolution
L_.str.2:                               ## @.str.2
	.asciz	"Requested resolution %ux%u is too big, using %ux%u instead."

L_.str.3:                               ## @.str.3
	.asciz	"Requested resolution %ux%u is not available, using %ux%u instead."

	.comm	_VIDEOMODE_host_aspect_ratio_w,8,3 ## @VIDEOMODE_host_aspect_ratio_w
	.comm	_VIDEOMODE_host_aspect_ratio_h,8,3 ## @VIDEOMODE_host_aspect_ratio_h
L_.str.4:                               ## @.str.4
	.asciz	"Fatal error: Cannot initialise video"

	.comm	_TRUE,4,2                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_VIDEOMODE_InitialiseDisplay    ; -- Begin function VIDEOMODE_InitialiseDisplay
	.p2align	2
_VIDEOMODE_InitialiseDisplay:           ; @VIDEOMODE_InitialiseDisplay
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	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
Lloh0:
	adrp	x19, _resolutions_size@GOTPAGE
Lloh1:
	ldr	x19, [x19, _resolutions_size@GOTPAGEOFF]
	mov	x0, x19
	bl	_PLATFORM_AvailableResolutions
Lloh2:
	adrp	x20, _resolutions@GOTPAGE
Lloh3:
	ldr	x20, [x20, _resolutions@GOTPAGEOFF]
	str	x0, [x20]
	cbz	x0, LBB0_8
; %bb.1:
	ldr	x1, [x19]
Lloh4:
	adrp	x3, _CompareResolutions@GOTPAGE
Lloh5:
	ldr	x3, [x3, _CompareResolutions@GOTPAGEOFF]
	mov	w2, #4
	bl	_qsort
	bl	_RemoveDuplicateResolutions
	ldr	x10, [x19]
	cbz	x10, LBB0_16
; %bb.2:
	mov	x12, #0
	ldr	x11, [x20]
Lloh6:
	adrp	x9, _init_fs_resolution@GOTPAGE
Lloh7:
	ldr	x9, [x9, _init_fs_resolution@GOTPAGEOFF]
Lloh8:
	adrp	x13, _current_resolution@GOTPAGE
Lloh9:
	ldr	x13, [x13, _current_resolution@GOTPAGEOFF]
	str	xzr, [x13]
	ldp	x8, x9, [x9]
	add	x14, x11, #8
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x12, x12, #1
	str	x12, [x13]
	add	x14, x14, #16
	cmp	x10, x12
	b.eq	LBB0_9
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldur	x15, [x14, #-8]
	cmp	x15, x8
	b.lt	LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x16, [x14]
	cmp	x16, x9
	b.lt	LBB0_3
; %bb.6:
	cmp	x15, x8
	ccmp	x16, x9, #0, eq
	b.eq	LBB0_11
; %bb.7:
	stp	x15, x16, [sp, #16]
	stp	x8, x9, [sp]
Lloh10:
	adrp	x0, l_.str.3@PAGE
Lloh11:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_10
LBB0_8:
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_18
LBB0_9:
	sub	x10, x10, #1
	str	x10, [x13]
	add	x10, x11, x10, lsl #4
	ldp	x11, x10, [x10]
	stp	x11, x10, [sp, #16]
	stp	x8, x9, [sp]
Lloh14:
	adrp	x0, l_.str.2@PAGE
Lloh15:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_10:
	bl	_Log_print
LBB0_11:
Lloh16:
	adrp	x8, _VIDEOMODE_host_aspect_ratio_w@GOTPAGE
Lloh17:
	ldr	x8, [x8, _VIDEOMODE_host_aspect_ratio_w@GOTPAGEOFF]
Lloh18:
	ldr	d0, [x8]
	fcmp	d0, #0.0
	b.eq	LBB0_13
; %bb.12:
Lloh19:
	adrp	x8, _VIDEOMODE_host_aspect_ratio_h@GOTPAGE
Lloh20:
	ldr	x8, [x8, _VIDEOMODE_host_aspect_ratio_h@GOTPAGEOFF]
Lloh21:
	ldr	d0, [x8]
	fcmp	d0, #0.0
	b.ne	LBB0_14
LBB0_13:
Lloh22:
	adrp	x0, _VIDEOMODE_host_aspect_ratio_w@GOTPAGE
Lloh23:
	ldr	x0, [x0, _VIDEOMODE_host_aspect_ratio_w@GOTPAGEOFF]
Lloh24:
	adrp	x1, _VIDEOMODE_host_aspect_ratio_h@GOTPAGE
Lloh25:
	ldr	x1, [x1, _VIDEOMODE_host_aspect_ratio_h@GOTPAGEOFF]
	bl	_AutodetectHostAspect
LBB0_14:
	bl	_UpdateTvSystemSettings
	bl	_VIDEOMODE_Update
	cbz	w0, LBB0_17
; %bb.15:
Lloh26:
	adrp	x8, _TRUE@GOTPAGE
Lloh27:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
	b	LBB0_19
LBB0_16:
Lloh28:
	adrp	x8, _display_modes@GOTPAGE
Lloh29:
	ldr	x8, [x8, _display_modes@GOTPAGEOFF]
Lloh30:
	ldr	x8, [x8]
	ldp	w8, w9, [x8]
	stp	x9, x8, [sp]
Lloh31:
	adrp	x0, l_.str.1@PAGE
Lloh32:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_18
LBB0_17:
Lloh33:
	adrp	x0, l_.str.4@PAGE
Lloh34:
	add	x0, x0, l_.str.4@PAGEOFF
LBB0_18:
	bl	_Log_print
Lloh35:
	adrp	x8, _FALSE@GOTPAGE
Lloh36:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
LBB0_19:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_resolutions_size,8,3           ; @resolutions_size
	.comm	_resolutions,8,3                ; @resolutions
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Fatal error: System reports no display resolutions available"

	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_CompareResolutions,4,2         ; @CompareResolutions
l_.str.1:                               ; @.str.1
	.asciz	"Fatal error: System reports no resolution higher than minimal %ux%u available"

	.comm	_display_modes,8,3              ; @display_modes
	.comm	_current_resolution,8,3         ; @current_resolution
	.comm	_init_fs_resolution,16,3        ; @init_fs_resolution
l_.str.2:                               ; @.str.2
	.asciz	"Requested resolution %ux%u is too big, using %ux%u instead."

l_.str.3:                               ; @.str.3
	.asciz	"Requested resolution %ux%u is not available, using %ux%u instead."

	.comm	_VIDEOMODE_host_aspect_ratio_w,8,3 ; @VIDEOMODE_host_aspect_ratio_w
	.comm	_VIDEOMODE_host_aspect_ratio_h,8,3 ; @VIDEOMODE_host_aspect_ratio_h
l_.str.4:                               ; @.str.4
	.asciz	"Fatal error: Cannot initialise video"

	.comm	_TRUE,4,2                       ; @TRUE
.subsections_via_symbols
