	.file	"extr_l2cap.c_l2ca_datawrite.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"l2cap_datawrite: State != L2CAP_OPEN. Dropping data\n"
	.align 8
.LC1:
	.string	"l2cap_datawrite: Could not allocate memory for pbuf\n"
	.text
	.p2align 4
	.globl	l2ca_datawrite
	.type	l2ca_datawrite, @function
l2ca_datawrite:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	mov	rax, QWORD PTR L2CAP_OPEN[rip]
	cmp	QWORD PTR [rdi], rax
	je	.L2
	lea	rdi, .LC0[rip]
	call	ERROR@PLT
	mov	r12d, DWORD PTR ERR_CONN[rip]
.L1:
	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
.L2:
	.cfi_restore_state
	mov	edx, DWORD PTR PBUF_RAM[rip]
	mov	rbx, rdi
	mov	rbp, rsi
	mov	edi, DWORD PTR PBUF_RAW[rip]
	mov	rsi, QWORD PTR L2CAP_HDR_LEN[rip]
	call	btpbuf_alloc@PLT
	mov	r13, rax
	test	rax, rax
	je	.L9
	mov	rsi, rbp
	mov	rdi, rax
	call	btpbuf_chain@PLT
	mov	rdi, QWORD PTR 8[rbx]
	mov	r12, QWORD PTR 8[r13]
	call	htole16@PLT
	mov	rdi, QWORD PTR 0[rbp]
	mov	r8, QWORD PTR 24[rbx]
	lea	rbp, 16[rbx]
	mov	QWORD PTR 8[r12], rax
	cmp	rdi, r8
	jle	.L5
	mov	rdi, r8
	call	htole16@PLT
	mov	rdx, QWORD PTR L2CAP_HDR_LEN[rip]
	mov	rsi, r13
	add	rdx, QWORD PTR 24[rbx]
	mov	QWORD PTR [r12], rax
	mov	rdi, rbp
	call	l2cap_write@PLT
	cmp	DWORD PTR ERR_OK[rip], eax
	mov	r12d, eax
	je	.L10
.L6:
	mov	rdi, r13
	call	btpbuf_dechain@PLT
	mov	rdi, r13
	call	btpbuf_free@PLT
.L11:
	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
.L5:
	.cfi_restore_state
	call	htole16@PLT
	mov	rdx, QWORD PTR 0[r13]
	mov	rsi, r13
	mov	rdi, rbp
	mov	QWORD PTR [r12], rax
	call	l2cap_write@PLT
	mov	rdi, r13
	mov	r12d, eax
	call	btpbuf_dechain@PLT
	mov	rdi, r13
	call	btpbuf_free@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	lea	rdi, .LC1[rip]
	call	ERROR@PLT
	mov	r12d, DWORD PTR ERR_MEM[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L10:
	mov	r12d, DWORD PTR ERR_BUF[rip]
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	l2ca_datawrite, .-l2ca_datawrite
	.comm	PBUF_RAW,4,4
	.comm	PBUF_RAM,4,4
	.comm	L2CAP_OPEN,8,8
	.comm	L2CAP_HDR_LEN,8,8
	.comm	ERR_OK,4,4
	.comm	ERR_MEM,4,4
	.comm	ERR_CONN,4,4
	.comm	ERR_BUF,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_l2cap.c_l2ca_datawrite.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"l2cap_datawrite: State != L2CAP_OPEN. Dropping data"
	.ascii	"\012\000"
	.align	2
.LC1:
	.ascii	"l2cap_datawrite: Could not allocate memory for pbuf"
	.ascii	"\012\000"
	.text
	.align	2
	.global	l2ca_datawrite
	.syntax unified
	.arm
	.fpu softvfp
	.type	l2ca_datawrite, %function
l2ca_datawrite:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	r3, .L12
	ldr	r2, [r0]
	ldr	r3, [r3]
	push	{r4, r5, r6, r7, r8, lr}
	cmp	r2, r3
	beq	.L2
	ldr	r0, .L12+4
	bl	ERROR
	ldr	r3, .L12+8
	ldr	r4, [r3]
.L1:
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, pc}
.L2:
	ldr	r3, .L12+12
	ldr	r2, .L12+16
	ldr	r8, .L12+20
	mov	r4, r0
	mov	r6, r1
	ldr	r2, [r2]
	ldr	r1, [r8]
	ldr	r0, [r3]
	bl	btpbuf_alloc
	subs	r5, r0, #0
	beq	.L9
	mov	r1, r6
	bl	btpbuf_chain
	ldr	r0, [r4, #4]
	ldr	r7, [r5, #4]
	bl	htole16
	ldr	r3, [r6]
	ldr	r2, [r4, #12]
	add	r6, r4, #8
	cmp	r3, r2
	str	r0, [r7, #4]
	ble	.L5
	mov	r0, r2
	bl	htole16
	ldr	r2, [r4, #12]
	ldr	r3, [r8]
	mov	r1, r5
	str	r0, [r7]
	add	r2, r2, r3
	mov	r0, r6
	bl	l2cap_write
	ldr	r3, .L12+24
	mov	r4, r0
	ldr	r3, [r3]
	cmp	r3, r0
	beq	.L10
.L6:
	mov	r0, r5
	bl	btpbuf_dechain
	mov	r0, r5
	bl	btpbuf_free
.L11:
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, pc}
.L5:
	mov	r0, r3
	bl	htole16
	ldr	r2, [r5]
	mov	r1, r5
	str	r0, [r7]
	mov	r0, r6
	bl	l2cap_write
	mov	r4, r0
	mov	r0, r5
	bl	btpbuf_dechain
	mov	r0, r5
	bl	btpbuf_free
	b	.L11
.L9:
	ldr	r0, .L12+28
	bl	ERROR
	ldr	r3, .L12+32
	ldr	r4, [r3]
	b	.L1
.L10:
	ldr	r3, .L12+36
	ldr	r4, [r3]
	b	.L6
.L13:
	.align	2
.L12:
	.word	L2CAP_OPEN
	.word	.LC0
	.word	ERR_CONN
	.word	PBUF_RAW
	.word	PBUF_RAM
	.word	L2CAP_HDR_LEN
	.word	ERR_OK
	.word	.LC1
	.word	ERR_MEM
	.word	ERR_BUF
	.size	l2ca_datawrite, .-l2ca_datawrite
	.comm	PBUF_RAW,4,4
	.comm	PBUF_RAM,4,4
	.comm	L2CAP_OPEN,4,4
	.comm	L2CAP_HDR_LEN,4,4
	.comm	ERR_OK,4,4
	.comm	ERR_MEM,4,4
	.comm	ERR_CONN,4,4
	.comm	ERR_BUF,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
