	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_task_image_load_handler        ## -- Begin function task_image_load_handler
	.p2align	4, 0x90
_task_image_load_handler:               ## @task_image_load_handler
	.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	%r12
	pushq	%rbx
	subq	$48, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %r15
	movq	8(%r15), %r12
	testq	%r12, %r12
	je	LBB0_36
## %bb.1:
	movq	%rdi, %r14
	movl	(%r12), %eax
	addl	$-128, %eax
	cmpl	$4, %eax
	ja	LBB0_19
## %bb.2:
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	movl	$1, %ebx
	jmpq	*%rax
LBB0_3:
	cmpl	$0, 64(%r12)
	je	LBB0_6
## %bb.4:
	movq	8(%r12), %rax
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	*%rax
	cmpl	$-1, %eax
	je	LBB0_37
LBB0_6:
	movl	$132, %eax
	cmpl	$0, 84(%r12)
	je	LBB0_19
LBB0_7:
	movl	%eax, (%r12)
	cmpq	$0, (%r15)
	jne	LBB0_20
	jmp	LBB0_36
LBB0_9:
	cmpl	$0, 80(%r12)
	jne	LBB0_19
## %bb.10:
	cmpq	$0, 56(%r12)
	jne	LBB0_19
## %bb.11:
	xorl	%eax, %eax
	callq	_cpu_features_get_time_usec
	movq	%rax, %rbx
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	64(%r12), %edi
	movl	68(%r12), %esi
	callq	_image_transfer_iterate
	testl	%eax, %eax
	je	LBB0_35
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	xorl	%eax, %eax
	callq	_cpu_features_get_time_usec
	subq	%rbx, %rax
	cmpq	72(%r12), %rax
	jl	LBB0_12
	jmp	LBB0_19
LBB0_14:
	cmpl	$0, 64(%r12)
	je	LBB0_19
## %bb.15:
	movq	8(%r12), %rax
	testq	%rax, %rax
	je	LBB0_19
## %bb.16:
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	*%rax
	cmpl	$-1, %eax
	jne	LBB0_19
	jmp	LBB0_37
LBB0_17:
	movq	%r12, %rdi
	callq	_task_image_iterate_process_transfer
	cmpl	$-1, %eax
	jne	LBB0_19
## %bb.18:
	movl	$131, %eax
	movl	%eax, (%r12)
LBB0_19:
	cmpq	$0, (%r15)
	je	LBB0_36
LBB0_20:
	cmpq	$0, 56(%r12)
	je	LBB0_36
## %bb.21:
	movq	%r14, %rdi
	callq	_task_get_cancelled
	movl	$1, %ebx
	testl	%eax, %eax
	jne	LBB0_37
## %bb.22:
	movl	$40, %edi
	callq	_malloc
	movq	%rax, %r15
	testq	%rax, %rax
	je	LBB0_33
## %bb.23:
	movq	16(%r12), %rax
	testq	%rax, %rax
	jle	LBB0_32
## %bb.24:
	movq	24(%r12), %rcx
	testq	%rcx, %rcx
	jle	LBB0_32
## %bb.25:
	movq	32(%r12), %rdx
	testq	%rdx, %rdx
	jle	LBB0_32
## %bb.26:
	cmpq	%rax, %rcx
	jb	LBB0_28
## %bb.27:
	cmpq	%rax, %rdx
	jae	LBB0_32
LBB0_28:
	cmpq	%rdx, %rcx
	cmovbq	%rcx, %rdx
	cvtsi2ss	%rax, %xmm0
	movl	%edx, %eax
	cvtsi2ss	%rax, %xmm1
	leaq	24(%r12), %rsi
	divss	%xmm1, %xmm0
	cvttss2si	%xmm0, %rax
	xorps	%xmm1, %xmm1
	movaps	%xmm1, -64(%rbp)
	movaps	%xmm1, -80(%rbp)
	movl	%eax, %ecx
	xorps	%xmm1, %xmm1
	cvtsi2ss	%rcx, %xmm1
	subss	%xmm1, %xmm0
	xorps	%xmm1, %xmm1
	xorl	%edi, %edi
	ucomiss	%xmm1, %xmm0
	movq	$0, -48(%rbp)
	seta	%dil
	addl	%eax, %edi
	leaq	-80(%rbp), %rdx
	callq	_upscale_image
	testq	%rax, %rax
	je	LBB0_32
## %bb.29:
	pmovzxdq	-76(%rbp), %xmm0                ## xmm0 = mem[0],zero,mem[1],zero
	movdqu	%xmm0, 24(%r12)
	movq	48(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_31
## %bb.30:
	callq	_free
LBB0_31:
	movq	-64(%rbp), %rax
	movq	%rax, 48(%r12)
LBB0_32:
	movdqu	24(%r12), %xmm0
	pshufd	$232, %xmm0, %xmm0              ## xmm0 = xmm0[0,2,2,3]
	movq	%xmm0, 4(%r15)
	movq	48(%r12), %rax
	movq	%rax, 16(%r15)
	movl	40(%r12), %eax
	movl	%eax, 12(%r15)
LBB0_33:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_task_set_data
	xorl	%ebx, %ebx
	jmp	LBB0_37
LBB0_36:
	movl	$1, %ebx
LBB0_37:
	movl	%ebx, %eax
	addq	$48, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_35:
	movl	$129, %eax
	jmp	LBB0_7
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_37, LBB0_37-LJTI0_0
.set L0_0_set_3, LBB0_3-LJTI0_0
.set L0_0_set_9, LBB0_9-LJTI0_0
.set L0_0_set_14, LBB0_14-LJTI0_0
.set L0_0_set_17, LBB0_17-LJTI0_0
LJTI0_0:
	.long	L0_0_set_37
	.long	L0_0_set_3
	.long	L0_0_set_9
	.long	L0_0_set_14
	.long	L0_0_set_17
	.end_data_region
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_task_image_load_handler        ; -- Begin function task_image_load_handler
	.p2align	2
_task_image_load_handler:               ; @task_image_load_handler
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	ldr	x21, [x0]
	ldr	x20, [x21, #8]
	cbz	x20, LBB0_22
; %bb.1:
	mov	x19, x0
	ldr	w8, [x20]
	sub	w8, w8, #128
	cmp	w8, #4
	b.hi	LBB0_19
; %bb.2:
	mov	w0, #1
Lloh0:
	adrp	x9, lJTI0_0@PAGE
Lloh1:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_3
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_3:
	ldr	w8, [x20, #64]
	cbz	w8, LBB0_6
; %bb.4:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_6
; %bb.5:
	mov	x0, x21
	mov	x1, #0
	blr	x8
	cmn	w0, #1
	b.eq	LBB0_35
LBB0_6:
	ldr	w8, [x20, #84]
	cbz	w8, LBB0_19
; %bb.7:
	mov	w8, #132
LBB0_8:
	str	w8, [x20]
	ldr	x8, [x21]
	cbnz	x8, LBB0_20
	b	LBB0_22
LBB0_9:
	ldr	w8, [x20, #80]
	cbnz	w8, LBB0_19
; %bb.10:
	ldr	x8, [x20, #56]
	cbnz	x8, LBB0_19
; %bb.11:
	bl	_cpu_features_get_time_usec
	mov	x22, x0
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldp	w0, w1, [x20, #64]
	bl	_image_transfer_iterate
	cbz	w0, LBB0_36
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	bl	_cpu_features_get_time_usec
	ldr	x8, [x20, #72]
	sub	x9, x0, x22
	cmp	x9, x8
	b.lt	LBB0_12
	b	LBB0_19
LBB0_14:
	ldr	w8, [x20, #64]
	cbz	w8, LBB0_19
; %bb.15:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_19
; %bb.16:
	mov	x0, x21
	mov	x1, #0
	blr	x8
	cmn	w0, #1
	b.ne	LBB0_19
	b	LBB0_35
LBB0_17:
	mov	x0, x20
	bl	_task_image_iterate_process_transfer
	cmn	w0, #1
	b.ne	LBB0_19
; %bb.18:
	mov	w8, #131
	str	w8, [x20]
LBB0_19:
	ldr	x8, [x21]
	cbz	x8, LBB0_22
LBB0_20:
	ldr	x8, [x20, #56]
	cbz	x8, LBB0_22
; %bb.21:
	mov	x0, x19
	bl	_task_get_cancelled
	cbz	w0, LBB0_24
LBB0_22:
	mov	w0, #1
LBB0_23:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_24:
	mov	w0, #40
	bl	_malloc
	mov	x21, x0
	cbz	x0, LBB0_34
; %bb.25:
	ldr	x8, [x20, #16]
	cmp	x8, #1
	b.lt	LBB0_33
; %bb.26:
	mov	x1, x20
	ldr	x9, [x1, #24]!
	cmp	x9, #1
	b.lt	LBB0_33
; %bb.27:
	ldr	x10, [x20, #32]
	cmp	x10, #1
	b.lt	LBB0_33
; %bb.28:
	cmp	x9, x8
	ccmp	x10, x8, #0, hs
	b.hs	LBB0_33
; %bb.29:
	cmp	x9, x10
	csel	x9, x9, x10, lo
	scvtf	s0, x8
	ucvtf	s1, w9
	fdiv	s0, s0, s1
	fcvtzu	w8, s0
	str	xzr, [sp, #32]
	movi.2d	v1, #0000000000000000
	stp	q1, q1, [sp]
	fcvtzu	s1, s0
	ucvtf	s1, s1
	fsub	s0, s0, s1
	fcmp	s0, #0.0
	cinc	w0, w8, gt
	mov	x2, sp
	bl	_upscale_image
	cbz	x0, LBB0_33
; %bb.30:
	ldur	d0, [sp, #4]
	ushll.2d	v0, v0, #0
	stur	q0, [x20, #24]
	ldr	x0, [x20, #48]
	cbz	x0, LBB0_32
; %bb.31:
	bl	_free
LBB0_32:
	ldr	x8, [sp, #16]
	str	x8, [x20, #48]
LBB0_33:
	ldur	q0, [x20, #24]
	xtn.2s	v0, v0
	stur	d0, [x21, #4]
	ldr	x8, [x20, #48]
	str	x8, [x21, #16]
	ldr	w8, [x20, #40]
	str	w8, [x21, #12]
LBB0_34:
	mov	x0, x19
	mov	x1, x21
	bl	_task_set_data
LBB0_35:
	mov	w0, #0
	b	LBB0_23
LBB0_36:
	mov	w8, #129
	b	LBB0_8
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_23-LBB0_3)>>2
	.byte	(LBB0_3-LBB0_3)>>2
	.byte	(LBB0_9-LBB0_3)>>2
	.byte	(LBB0_14-LBB0_3)>>2
	.byte	(LBB0_17-LBB0_3)>>2
                                        ; -- End function
.subsections_via_symbols
