	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function UPDOWN_SetPos
_UPDOWN_SetPos:                         ## @UPDOWN_SetPos
	.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, %rbx
	movl	(%rdi), %r14d
	callq	_UPDOWN_InBounds
	testl	%eax, %eax
	jne	LBB0_5
## %bb.1:
	movl	4(%rbx), %eax
	movl	8(%rbx), %ecx
	cmpl	%r15d, %eax
	jle	LBB0_4
## %bb.2:
	cmpl	%ecx, %eax
	jge	LBB0_4
## %bb.3:
	movl	%eax, %r15d
	jmp	LBB0_5
LBB0_4:
	cmpl	%ecx, %eax
	movl	%ecx, %edx
	cmovgl	%eax, %edx
	cmpl	%r15d, %eax
	cmovgel	%ecx, %edx
	movl	%edx, %r15d
LBB0_5:
	movl	%r15d, (%rbx)
	movq	%rbx, %rdi
	callq	_UPDOWN_SetBuddyInt
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_UPDOWN_InBounds
	testl	%eax, %eax
	jne	LBB0_10
## %bb.6:
	movl	4(%rbx), %eax
	movl	8(%rbx), %ecx
	cmpl	%ecx, %eax
	jge	LBB0_9
## %bb.7:
	cmpl	%eax, %r14d
	jge	LBB0_9
## %bb.8:
	movl	%eax, %r14d
	jmp	LBB0_10
LBB0_9:
	cmpl	%eax, %r14d
	movl	%ecx, %r14d
	cmovgl	%eax, %r14d
	cmpl	%ecx, %eax
	cmovlel	%ecx, %r14d
LBB0_10:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_UPDOWN_SetPos
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function UPDOWN_SetPos
_UPDOWN_SetPos:                         ; @UPDOWN_SetPos
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x21, x1
	mov	x20, x0
	ldr	w22, [x0]
	mov	x19, x22
	bl	_UPDOWN_InBounds
	cbnz	w0, LBB0_2
; %bb.1:
	ldp	w8, w9, [x20, #4]
	cmp	w8, w9
	ccmp	w8, w21, #0, gt
	csel	w10, w8, w9, lt
	cmp	w8, w21
	ccmp	w8, w9, #0, gt
	csel	w21, w8, w10, lt
LBB0_2:
	str	w21, [x20]
	mov	x0, x20
	bl	_UPDOWN_SetBuddyInt
	mov	x0, x20
	mov	x1, x19
	bl	_UPDOWN_InBounds
	cbnz	w0, LBB0_6
; %bb.3:
	ldp	w19, w8, [x20, #4]
	cmp	w19, w8
	b.ge	LBB0_5
; %bb.4:
	cmp	w22, w19
	b.lt	LBB0_6
LBB0_5:
	cmp	w22, w19
	ccmp	w19, w8, #4, gt
	csel	w19, w19, w8, gt
LBB0_6:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_UPDOWN_SetPos
.subsections_via_symbols
