	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kvp_key_add_or_modify
_kvp_key_add_or_modify:                 ## @kvp_key_add_or_modify
	.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
	movl	%r8d, %r14d
	movq	%rcx, %r15
	movl	%edx, %r12d
	movq	%rsi, %rbx
	movl	%edi, %r13d
	movq	_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %edx
	movq	%rbx, %rcx
	movq	%r15, %r8
	xorl	%eax, %eax
	callq	_KVP_LOG
	movq	_HV_KVP_EXCHANGE_MAX_KEY_SIZE@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	jl	LBB0_2
## %bb.1:
	movq	_HV_KVP_EXCHANGE_MAX_VALUE_SIZE@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jl	LBB0_2
## %bb.3:
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movl	%r13d, %edi
	callq	_kvp_update_mem_state
	movq	_kvp_pools@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%r13d, %rdx
	shlq	$4, %rdx
	movl	(%rax,%rdx), %r15d
	movl	4(%rax,%rdx), %esi
	movq	8(%rax,%rdx), %r14
	testl	%r15d, %r15d
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	jle	LBB0_4
## %bb.5:
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movl	%r13d, -56(%rbp)                ## 4-byte Spill
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r14,%r13,8), %esi
	movq	%rbx, %rdi
	movl	%r12d, %edx
	callq	_memcmp
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	incq	%r13
	cmpq	%r13, %r15
	jne	LBB0_6
## %bb.9:
	movq	%r15, %rdi
	movl	-56(%rbp), %r13d                ## 4-byte Reload
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	jmp	LBB0_10
LBB0_2:
	movq	_LOG_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_KVP_LOG
	movl	$1, %eax
	jmp	LBB0_17
LBB0_4:
	xorl	%edi, %edi
LBB0_10:
	movq	_ENTRIES_PER_BLOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %ecx
	imull	%esi, %ecx
	cmpl	%ecx, %r15d
	jne	LBB0_11
## %bb.12:
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	leal	8(,%rsi,8), %esi
	imull	%eax, %esi
	movq	%r14, %rdi
	callq	_realloc
	testq	%rax, %rax
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	_kvp_pools@GOTPCREL(%rip), %r15
	je	LBB0_13
## %bb.14:
	movq	%rax, %r14
	movq	(%r15), %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	incl	4(%rax,%rcx)
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_15
LBB0_11:
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
LBB0_15:
	movq	%rdi, %r15
	movl	4(%r14,%rdi,8), %edi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_memcpy
	movl	(%r14,%r15,8), %edi
	movq	%rbx, %rsi
	movl	%r12d, %edx
	callq	_memcpy
	movq	_kvp_pools@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rax
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movq	%r14, 8(%rax,%rdx)
	movq	(%rcx), %rax
	incl	(%rax,%rdx)
	movl	%r13d, %edi
	jmp	LBB0_16
LBB0_7:
	movl	4(%r14,%r13,8), %edi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_memcpy
	movl	-56(%rbp), %edi                 ## 4-byte Reload
LBB0_16:
	callq	_kvp_update_file
	xorl	%eax, %eax
LBB0_17:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movl	$1, %eax
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_LOG_DEBUG,4,2                  ## @LOG_DEBUG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"kvp_key_add_or_modify: pool =  %d, key = %s, value = %s\n,"

	.comm	_HV_KVP_EXCHANGE_MAX_KEY_SIZE,4,2 ## @HV_KVP_EXCHANGE_MAX_KEY_SIZE
	.comm	_HV_KVP_EXCHANGE_MAX_VALUE_SIZE,4,2 ## @HV_KVP_EXCHANGE_MAX_VALUE_SIZE
	.comm	_LOG_ERR,4,2                    ## @LOG_ERR
L_.str.1:                               ## @.str.1
	.asciz	"kvp_key_add_or_modify: returning 1\n"

	.comm	_kvp_pools,8,3                  ## @kvp_pools
	.comm	_ENTRIES_PER_BLOCK,4,2          ## @ENTRIES_PER_BLOCK
	.no_dead_strip	_kvp_key_add_or_modify
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kvp_key_add_or_modify
_kvp_key_add_or_modify:                 ; @kvp_key_add_or_modify
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x4
	mov	x23, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _LOG_DEBUG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _LOG_DEBUG@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	stp	x1, x3, [sp, #8]
	mov	x8, x19
	str	x8, [sp]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KVP_LOG
Lloh5:
	adrp	x8, _HV_KVP_EXCHANGE_MAX_KEY_SIZE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _HV_KVP_EXCHANGE_MAX_KEY_SIZE@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
Lloh8:
	adrp	x9, _HV_KVP_EXCHANGE_MAX_VALUE_SIZE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _HV_KVP_EXCHANGE_MAX_VALUE_SIZE@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w8, w21
	ccmp	w9, w20, #8, ge
	b.ge	LBB0_2
; %bb.1:
Lloh11:
	adrp	x8, _LOG_ERR@GOTPAGE
Lloh12:
	ldr	x8, [x8, _LOG_ERR@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_KVP_LOG
	mov	w0, #1
	b	LBB0_15
LBB0_2:
	mov	x0, x19
	bl	_kvp_update_mem_state
Lloh16:
	adrp	x8, _kvp_pools@GOTPAGE
Lloh17:
	ldr	x8, [x8, _kvp_pools@GOTPAGEOFF]
Lloh18:
	ldr	x8, [x8]
	add	x8, x8, w19, sxtw #4
	ldr	x24, [x8, #8]
	ldp	w28, w27, [x8]
	cmp	w28, #1
	b.lt	LBB0_7
; %bb.3:
	add	x25, x24, #4
	mov	x26, x28
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldur	w1, [x25, #-4]
	mov	x0, x22
	mov	x2, x21
	bl	_memcmp
	cbz	x0, LBB0_13
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x25, x25, #8
	subs	x26, x26, #1
	b.ne	LBB0_4
; %bb.6:
	mov	x25, x28
	b	LBB0_8
LBB0_7:
	mov	x25, #0
LBB0_8:
	sxtw	x26, w19
Lloh19:
	adrp	x8, _ENTRIES_PER_BLOCK@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ENTRIES_PER_BLOCK@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	mul	w9, w8, w27
	cmp	w28, w9
	b.ne	LBB0_11
; %bb.9:
	lsl	w9, w27, #3
	add	w9, w9, #8
	mul	w1, w9, w8
	mov	x0, x24
	bl	_realloc
	cbz	x0, LBB0_16
; %bb.10:
	mov	x24, x0
Lloh22:
	adrp	x27, _kvp_pools@GOTPAGE
Lloh23:
	ldr	x27, [x27, _kvp_pools@GOTPAGEOFF]
	ldr	x8, [x27]
	add	x8, x8, x26, lsl #4
	ldr	w9, [x8, #4]
	add	w9, w9, #1
	str	w9, [x8, #4]
	b	LBB0_12
LBB0_11:
Lloh24:
	adrp	x27, _kvp_pools@GOTPAGE
Lloh25:
	ldr	x27, [x27, _kvp_pools@GOTPAGEOFF]
LBB0_12:
	add	x25, x24, x25, lsl #3
	ldr	w0, [x25, #4]
	mov	x1, x23
	mov	x2, x20
	bl	_memcpy
	ldr	w0, [x25]
	mov	x1, x22
	mov	x2, x21
	bl	_memcpy
	ldr	x8, [x27]
	lsl	x9, x26, #4
	add	x8, x8, x9
	str	x24, [x8, #8]
	ldr	x8, [x27]
	ldr	w10, [x8, x9]
	add	w10, w10, #1
	str	w10, [x8, x9]
	b	LBB0_14
LBB0_13:
	ldr	w0, [x25]
	mov	x1, x23
	mov	x2, x20
	bl	_memcpy
LBB0_14:
	mov	x0, x19
	bl	_kvp_update_file
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_16:
	mov	w0, #1
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_LOG_DEBUG,4,2                  ; @LOG_DEBUG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"kvp_key_add_or_modify: pool =  %d, key = %s, value = %s\n,"

	.comm	_HV_KVP_EXCHANGE_MAX_KEY_SIZE,4,2 ; @HV_KVP_EXCHANGE_MAX_KEY_SIZE
	.comm	_HV_KVP_EXCHANGE_MAX_VALUE_SIZE,4,2 ; @HV_KVP_EXCHANGE_MAX_VALUE_SIZE
	.comm	_LOG_ERR,4,2                    ; @LOG_ERR
l_.str.1:                               ; @.str.1
	.asciz	"kvp_key_add_or_modify: returning 1\n"

	.comm	_kvp_pools,8,3                  ; @kvp_pools
	.comm	_ENTRIES_PER_BLOCK,4,2          ; @ENTRIES_PER_BLOCK
	.no_dead_strip	_kvp_key_add_or_modify
.subsections_via_symbols
