	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function add_sorted
_add_sorted:                            ## @add_sorted
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testl	%edx, %edx
	jle	LBB0_1
## %bb.2:
	movl	%edx, %r9d
	movq	_INT_MAX@GOTPCREL(%rip), %r10
	movl	(%r10), %ebx
	movq	_INT_MIN@GOTPCREL(%rip), %r11
	movl	(%r11), %r15d
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	testl	%r8d, %r8d
	cmovel	%ebx, %r15d
	xorl	%r13d, %r13d
	movl	%r15d, %r14d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=2
	incq	%r13
	cmpq	%r13, %r9
	je	LBB0_8
LBB0_4:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%rsi,%r13,8), %r15
	movl	(%r15), %r12d
	xorl	%ebx, %ebx
	cmpl	%ecx, %r12d
	setg	%bl
	cmpl	%r8d, %ebx
	je	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	xorl	%ebx, %ebx
	cmpl	%r14d, %r12d
	setl	%bl
	cmpl	%r8d, %ebx
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=2
	movq	%r15, (%rdi,%rax,8)
	movl	%r12d, %r14d
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	testl	%r8d, %r8d
	movl	(%r11), %r15d
	movl	(%r10), %ebx
	movl	%r15d, %ecx
	cmovel	%ebx, %ecx
	cmpl	%ecx, %r14d
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	(%rdi,%rax,8), %rcx
	incq	%rax
	movl	(%rcx), %ecx
	subl	%r8d, %ecx
	testl	%edx, %edx
	jg	LBB0_3
	jmp	LBB0_10
LBB0_1:
	xorl	%eax, %eax
LBB0_10:
                                        ## kill: def $eax killed $eax killed $rax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_INT_MIN,4,2                    ## @INT_MIN
	.comm	_INT_MAX,4,2                    ## @INT_MAX
	.no_dead_strip	_add_sorted
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function add_sorted
_add_sorted:                            ; @add_sorted
	.cfi_startproc
; %bb.0:
	cmp	w2, #1
	b.lt	LBB0_10
; %bb.1:
	mov	x11, #0
	mov	w9, w2
Lloh0:
	adrp	x10, _INT_MAX@GOTPAGE
Lloh1:
	ldr	x10, [x10, _INT_MAX@GOTPAGEOFF]
	ldr	w13, [x10]
Lloh2:
	adrp	x12, _INT_MIN@GOTPAGE
Lloh3:
	ldr	x12, [x12, _INT_MIN@GOTPAGEOFF]
	ldr	w14, [x12]
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	cmp	w4, #0
	csel	w8, w13, w14, eq
	mov	x13, x9
	mov	x14, x1
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=2
	add	x14, x14, #8
	subs	x13, x13, #1
	b.eq	LBB0_7
LBB0_4:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x15, [x14]
	ldr	w16, [x15]
	cmp	w16, w3
	cset	w17, gt
	cmp	w17, w4
	b.eq	LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=2
	cmp	w16, w8
	cset	w17, lt
	cmp	w17, w4
	b.eq	LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=2
	str	x15, [x0, x11, lsl #3]
	mov	x8, x16
	b	LBB0_3
LBB0_7:                                 ;   in Loop: Header=BB0_2 Depth=1
	ldr	w14, [x12]
	ldr	w13, [x10]
	cmp	w4, #0
	csel	w15, w13, w14, eq
	cmp	w8, w15
	b.eq	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x8, x11, #1
	ldr	x11, [x0, x11, lsl #3]
	ldr	w11, [x11]
	sub	w3, w11, w4
	mov	x11, x8
	cmp	w2, #0
	b.gt	LBB0_2
; %bb.9:
	mov	x0, x8
	ret
LBB0_10:
	mov	x8, #0
	mov	x0, x8
	ret
LBB0_11:
	mov	x8, x11
	mov	x0, x8
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_INT_MIN,4,2                    ; @INT_MIN
	.comm	_INT_MAX,4,2                    ; @INT_MAX
	.no_dead_strip	_add_sorted
.subsections_via_symbols
