	.file	"extr_buffer.c_evbuffer_read.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	evbuffer_read
	.type	evbuffer_read, @function
evbuffer_read:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	mov	r13d, edx
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12d, esi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	EVBUFFER_LOCK@PLT
	cmp	QWORD PTR 24[rbp], 0
	jne	.L9
	mov	edi, r12d
	call	get_n_bytes_readable_on_socket@PLT
	test	eax, eax
	jle	.L26
	mov	rdx, QWORD PTR 16[rbp]
	cmp	eax, edx
	cmovg	eax, edx
.L6:
	test	r13d, r13d
	js	.L11
	cmp	eax, r13d
	jl	.L11
.L7:
	mov	esi, r13d
	mov	rdi, rbp
	call	evbuffer_expand_singlechain@PLT
	mov	rbx, rax
	test	rax, rax
	je	.L9
	movsx	rsi, DWORD PTR 8[rax]
	movsx	rax, DWORD PTR 12[rax]
	mov	edi, r12d
	mov	edx, r13d
	add	rsi, rax
	add	rsi, QWORD PTR [rbx]
	call	read@PLT
	mov	r12d, eax
	cmp	eax, -1
	je	.L9
	test	eax, eax
	jne	.L27
.L3:
	mov	rdi, rbp
	call	EVBUFFER_UNLOCK@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L27:
	.cfi_restore_state
	add	DWORD PTR 12[rbx], eax
	mov	rdi, rbp
	call	advance_last_with_data@PLT
	add	DWORD PTR 0[rbp], r12d
	mov	rdi, rbp
	add	DWORD PTR 4[rbp], r12d
	call	evbuffer_invoke_callbacks_@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L11:
	mov	r13d, eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L26:
	mov	eax, DWORD PTR 16[rbp]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L9:
	mov	r12d, -1
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	evbuffer_read, .-evbuffer_read
	.comm	WSAECONNABORTED,8,8
	.comm	NUM_READ_IOVEC,4,4
	.comm	EVBUFFER_CHAIN_MAX,8,8
	.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_buffer.c_evbuffer_read.c"
	.text
	.align	2
	.global	evbuffer_read
	.syntax unified
	.arm
	.fpu softvfp
	.type	evbuffer_read, %function
evbuffer_read:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r4, r0
	mov	r7, r1
	mov	r5, r2
	bl	EVBUFFER_LOCK
	ldr	r3, [r4, #16]
	cmp	r3, #0
	bne	.L8
	mov	r0, r7
	bl	get_n_bytes_readable_on_socket
	cmp	r0, #0
	ldr	r3, [r4, #12]
	ble	.L6
	cmp	r3, r0
	movge	r3, r0
.L6:
	cmp	r3, r5
	movge	r2, #0
	movlt	r2, #1
	orrs	r2, r2, r5, lsr #31
	movne	r5, r3
	mov	r0, r4
	mov	r1, r5
	bl	evbuffer_expand_singlechain
	subs	r6, r0, #0
	beq	.L8
	ldr	r2, [r6, #8]
	ldr	r3, [r6, #4]
	ldr	r1, [r6]
	add	r3, r3, r2
	mov	r0, r7
	mov	r2, r5
	add	r1, r1, r3
	bl	read
	cmn	r0, #1
	mov	r5, r0
	beq	.L8
	cmp	r0, #0
	bne	.L23
.L3:
	mov	r0, r4
	bl	EVBUFFER_UNLOCK
	mov	r0, r5
	pop	{r4, r5, r6, r7, r8, pc}
.L23:
	ldr	r3, [r6, #8]
	mov	r0, r4
	add	r3, r3, r5
	str	r3, [r6, #8]
	bl	advance_last_with_data
	ldm	r4, {r2, r3}
	add	r2, r2, r5
	add	r3, r3, r5
	mov	r0, r4
	stm	r4, {r2, r3}
	bl	evbuffer_invoke_callbacks_
	b	.L3
.L8:
	mvn	r5, #0
	b	.L3
	.size	evbuffer_read, .-evbuffer_read
	.comm	WSAECONNABORTED,4,4
	.comm	NUM_READ_IOVEC,4,4
	.comm	EVBUFFER_CHAIN_MAX,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
