	.file	"extr_sys_reason.c_os_reason_alloc_buffer_internal.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	os_reason_alloc_buffer_internal, @function
os_reason_alloc_buffer_internal:
.LFB0:
	.cfi_startproc
	endbr64
	cmp	QWORD PTR OS_REASON_NULL[rip], rdi
	je	.L13
	cmp	DWORD PTR OS_REASON_BUFFER_MAX_SIZE[rip], esi
	mov	eax, DWORD PTR EINVAL[rip]
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	mov	r12d, esi
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	jge	.L14
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	mov	rbp, rdi
	mov	rbx, rdx
	call	lck_mtx_lock@PLT
	mov	rdi, rbp
	call	os_reason_dealloc_buffer@PLT
	test	r12d, r12d
	je	.L15
	mov	esi, DWORD PTR VM_KERN_MEMORY_REASON[rip]
	mov	edi, r12d
	test	rbx, rbx
	jne	.L16
	call	kalloc_noblock_tag@PLT
	mov	QWORD PTR 8[rbp], rax
	mov	rdi, rax
	test	rax, rax
	je	.L17
.L7:
	mov	esi, r12d
	call	bzero@PLT
	mov	DWORD PTR 20[rbp], r12d
	mov	esi, DWORD PTR 8[rbp]
	lea	rdi, 16[rbp]
	mov	r8d, DWORD PTR KCFLAG_USE_MEMCOPY[rip]
	mov	edx, DWORD PTR KCDATA_BUFFER_BEGIN_OS_REASON[rip]
	mov	ecx, r12d
	call	kcdata_memory_static_init@PLT
	cmp	rax, QWORD PTR KERN_SUCCESS[rip]
	mov	rdi, rbp
	je	.L8
	call	os_reason_dealloc_buffer@PLT
	mov	rdi, rbp
	call	lck_mtx_unlock@PLT
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, DWORD PTR EIO[rip]
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	call	kalloc_tag@PLT
	xor	edi, edi
	mov	QWORD PTR 8[rbp], rax
	test	rax, rax
	setne	dil
	call	assert@PLT
	mov	rdi, QWORD PTR 8[rbp]
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	call	lck_mtx_unlock@PLT
	pop	rbx
	.cfi_def_cfa_offset 24
	xor	eax, eax
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	mov	eax, DWORD PTR EINVAL[rip]
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	.cfi_offset 6, -24
	.cfi_offset 12, -16
	mov	rdi, rbp
	call	lck_mtx_unlock@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L17:
	mov	rdi, rbp
	call	lck_mtx_unlock@PLT
	mov	eax, DWORD PTR ENOMEM[rip]
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	os_reason_alloc_buffer_internal, .-os_reason_alloc_buffer_internal
	.comm	VM_KERN_MEMORY_REASON,4,4
	.comm	OS_REASON_NULL,8,8
	.comm	OS_REASON_BUFFER_MAX_SIZE,4,4
	.comm	KERN_SUCCESS,8,8
	.comm	KCFLAG_USE_MEMCOPY,4,4
	.comm	KCDATA_BUFFER_BEGIN_OS_REASON,4,4
	.comm	ENOMEM,4,4
	.comm	EIO,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_sys_reason.c_os_reason_alloc_buffer_internal.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	os_reason_alloc_buffer_internal, %function
os_reason_alloc_buffer_internal:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	ip, .L18
	ldr	r3, [ip]
	cmp	r3, r0
	beq	.L13
	push	{r4, r5, r6, lr}
	ldr	r3, .L18+4
	mov	r4, r1
	ldr	r3, [r3]
	sub	sp, sp, #8
	cmp	r3, r1
	bge	.L14
	ldr	r3, .L18+8
	ldr	r0, [r3]
.L1:
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, pc}
.L14:
	mov	r6, r0
	mov	r5, r2
	bl	lck_mtx_lock
	mov	r0, r6
	bl	os_reason_dealloc_buffer
	cmp	r4, #0
	beq	.L15
	ldr	r3, .L18+12
	cmp	r5, #0
	mov	r0, r4
	ldr	r1, [r3]
	bne	.L16
	bl	kalloc_noblock_tag
	cmp	r0, #0
	str	r0, [r6, #4]
	beq	.L17
.L7:
	mov	r1, r4
	bl	bzero
	ldr	r3, .L18+16
	ldr	r2, .L18+20
	ldr	r1, [r3]
	str	r4, [r6, #12]
	str	r1, [sp]
	mov	r3, r4
	ldr	r2, [r2]
	ldr	r1, [r6, #4]
	add	r0, r6, #8
	bl	kcdata_memory_static_init
	ldr	r3, .L18+24
	ldr	r3, [r3]
	cmp	r0, r3
	mov	r0, r6
	beq	.L8
	bl	os_reason_dealloc_buffer
	mov	r0, r6
	bl	lck_mtx_unlock
	ldr	r3, .L18+28
	ldr	r0, [r3]
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, pc}
.L16:
	bl	kalloc_tag
	str	r0, [r6, #4]
	subs	r0, r0, #0
	movne	r0, #1
	bl	assert
	ldr	r0, [r6, #4]
	b	.L7
.L8:
	bl	lck_mtx_unlock
	mov	r0, #0
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, pc}
.L13:
	ldr	r3, .L18+8
	ldr	r0, [r3]
	bx	lr
.L15:
	mov	r0, r6
	bl	lck_mtx_unlock
	mov	r0, r4
	b	.L1
.L17:
	mov	r0, r6
	bl	lck_mtx_unlock
	ldr	r3, .L18+32
	ldr	r0, [r3]
	b	.L1
.L19:
	.align	2
.L18:
	.word	OS_REASON_NULL
	.word	OS_REASON_BUFFER_MAX_SIZE
	.word	EINVAL
	.word	VM_KERN_MEMORY_REASON
	.word	KCFLAG_USE_MEMCOPY
	.word	KCDATA_BUFFER_BEGIN_OS_REASON
	.word	KERN_SUCCESS
	.word	EIO
	.word	ENOMEM
	.size	os_reason_alloc_buffer_internal, .-os_reason_alloc_buffer_internal
	.comm	VM_KERN_MEMORY_REASON,4,4
	.comm	OS_REASON_NULL,4,4
	.comm	OS_REASON_BUFFER_MAX_SIZE,4,4
	.comm	KERN_SUCCESS,4,4
	.comm	KCFLAG_USE_MEMCOPY,4,4
	.comm	KCDATA_BUFFER_BEGIN_OS_REASON,4,4
	.comm	ENOMEM,4,4
	.comm	EIO,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
