	.file	"extr_SEGGER_RTT.c_SEGGER_RTT_Write.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	SEGGER_RTT_Write
	.type	SEGGER_RTT_Write, @function
SEGGER_RTT_Write:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xor	eax, eax
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rsi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	ebp, edx
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, edi
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	call	SEGGER_RTT_LOCK@PLT
	xor	eax, eax
	call	_Init@PLT
	mov	edi, ebx
	mov	rax, QWORD PTR _SEGGER_RTT[rip]
	lea	r13, [rdi+rdi*2]
	sal	r13, 3
	add	rax, r13
	mov	ecx, DWORD PTR [rax]
	and	ecx, DWORD PTR SEGGER_RTT_MODE_MASK[rip]
	cmp	ecx, DWORD PTR SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL[rip]
	je	.L2
	mov	edx, DWORD PTR 4[rax]
	sub	edx, DWORD PTR 8[rax]
	sub	edx, 1
	js	.L16
	cmp	ebp, edx
	jg	.L17
.L2:
	test	ebp, ebp
	je	.L6
	mov	esi, DWORD PTR 12[rax]
	xor	r14d, r14d
	xor	r15d, r15d
	.p2align 4,,10
	.p2align 3
.L9:
	mov	edx, DWORD PTR 8[rax]
	mov	edi, edx
	not	edi
	add	edi, DWORD PTR 4[rax]
	lea	eax, [rdi+rsi]
	cmovs	edi, eax
	sub	esi, edx
	call	MIN@PLT
	mov	esi, ebp
	mov	edi, eax
	call	MIN@PLT
	mov	rsi, r12
	mov	ebx, eax
	mov	rax, QWORD PTR _SEGGER_RTT[rip]
	mov	edx, ebx
	add	r14d, ebx
	add	rax, r13
	movsx	rdi, DWORD PTR 8[rax]
	add	rdi, QWORD PTR 16[rax]
	call	MEMCPY@PLT
	movsx	rax, ebx
	add	r12, rax
	mov	rax, QWORD PTR _SEGGER_RTT[rip]
	add	rax, r13
	mov	edx, DWORD PTR 8[rax]
	mov	esi, DWORD PTR 12[rax]
	add	edx, ebx
	cmp	edx, esi
	cmove	edx, r15d
	mov	DWORD PTR 8[rax], edx
	sub	ebp, ebx
	jne	.L9
	xor	eax, eax
	call	SEGGER_RTT_UNLOCK@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r14d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	cmp	ecx, DWORD PTR SEGGER_RTT_MODE_NO_BLOCK_SKIP[rip]
	mov	ebp, edx
	jne	.L2
.L6:
	xor	eax, eax
	call	SEGGER_RTT_UNLOCK@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	add	edx, DWORD PTR 12[rax]
	cmp	ebp, edx
	jle	.L2
	jmp	.L17
	.cfi_endproc
.LFE0:
	.size	SEGGER_RTT_Write, .-SEGGER_RTT_Write
	.comm	_SEGGER_RTT,8,8
	.comm	SEGGER_RTT_MODE_NO_BLOCK_SKIP,4,4
	.comm	SEGGER_RTT_MODE_MASK,4,4
	.comm	SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL,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_SEGGER_RTT.c_SEGGER_RTT_Write.c"
	.text
	.align	2
	.global	SEGGER_RTT_Write
	.syntax unified
	.arm
	.fpu softvfp
	.type	SEGGER_RTT_Write, %function
SEGGER_RTT_Write:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r4, r0
	ldr	r8, .L17
	mov	r6, r1
	mov	r5, r2
	add	r4, r4, r4, lsl #2
	bl	SEGGER_RTT_LOCK
	bl	_Init
	ldr	r3, [r8]
	ldr	r1, .L17+4
	ldr	r2, .L17+8
	lsl	r7, r4, #2
	ldr	r0, [r1]
	ldr	r1, [r3, r7]
	ldr	r2, [r2]
	and	r1, r1, r0
	cmp	r1, r2
	add	r3, r3, r4, lsl #2
	beq	.L2
	ldr	r0, [r3, #8]
	ldr	r2, [r3, #4]
	sub	r2, r2, r0
	subs	r2, r2, #1
	ldrmi	r0, [r3, #12]
	addmi	r2, r2, r0
	cmp	r5, r2
	bgt	.L16
.L2:
	cmp	r5, #0
	beq	.L6
	mov	r10, #0
	mov	r9, r10
	ldr	ip, [r3, #12]
.L9:
	ldmib	r3, {r0, r2}
	sub	r0, r0, r2
	subs	r0, r0, #1
	sub	r1, ip, r2
	addmi	r0, r0, ip
	bl	MIN
	mov	r1, r5
	bl	MIN
	mov	r4, r0
	ldr	r3, [r8]
	mov	r2, r0
	add	r3, r3, r7
	ldr	r0, [r3, #16]
	ldr	r3, [r3, #8]
	mov	r1, r6
	add	r0, r0, r3
	bl	MEMCPY
	ldr	r3, [r8]
	sub	r5, r5, r4
	add	r3, r3, r7
	ldr	r2, [r3, #8]
	ldr	ip, [r3, #12]
	add	r2, r4, r2
	cmp	r2, ip
	movne	r1, r2
	moveq	r1, r9
	cmp	r5, #0
	add	r10, r10, r4
	add	r6, r6, r4
	str	r1, [r3, #8]
	bne	.L9
	bl	SEGGER_RTT_UNLOCK
	mov	r0, r10
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L16:
	ldr	r0, .L17+12
	ldr	r0, [r0]
	cmp	r1, r0
	movne	r5, r2
	bne	.L2
.L6:
	bl	SEGGER_RTT_UNLOCK
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L18:
	.align	2
.L17:
	.word	_SEGGER_RTT
	.word	SEGGER_RTT_MODE_MASK
	.word	SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
	.word	SEGGER_RTT_MODE_NO_BLOCK_SKIP
	.size	SEGGER_RTT_Write, .-SEGGER_RTT_Write
	.comm	_SEGGER_RTT,4,4
	.comm	SEGGER_RTT_MODE_NO_BLOCK_SKIP,4,4
	.comm	SEGGER_RTT_MODE_MASK,4,4
	.comm	SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
