	.file	"242331660.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 8
.LC0:
	.string	"usage: %s working-string old-str new-str\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	cmp	DWORD PTR -20[rbp], 4
	je	.L2
	mov	rax, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L3
.L2:
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 24
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 16
	mov	rcx, QWORD PTR [rax]
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rsi, rcx
	mov	rdi, rax
	call	string_replace
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	puts@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	free@PLT
	mov	eax, 0
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC1:
	.string	"the_stack_data/242331660.c"
.LC2:
	.string	"new_pos <= new_len"
.LC3:
	.string	"old_pos <= text_len"
.LC4:
	.string	"new_pos == new_len"
	.text
	.type	string_replace, @function
string_replace:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 96
	mov	QWORD PTR -72[rbp], rdi
	mov	QWORD PTR -80[rbp], rsi
	mov	QWORD PTR -88[rbp], rdx
	mov	rax, QWORD PTR -72[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	QWORD PTR -40[rbp], rax
	mov	rax, QWORD PTR -80[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	QWORD PTR -32[rbp], rax
	mov	rax, QWORD PTR -88[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	QWORD PTR -24[rbp], rax
	mov	rdx, QWORD PTR -80[rbp]
	mov	rax, QWORD PTR -72[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	nb_occurrences
	mov	DWORD PTR -60[rbp], eax
	mov	eax, DWORD PTR -60[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -24[rbp]
	sub	rax, QWORD PTR -32[rbp]
	imul	rdx, rax
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rdx
	mov	QWORD PTR -16[rbp], rax
	mov	rax, QWORD PTR -16[rbp]
	add	rax, 1
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	mov	rdx, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR -16[rbp]
	add	rax, rdx
	mov	BYTE PTR [rax], 0
	mov	rax, QWORD PTR -80[rbp]
	movzx	eax, BYTE PTR [rax]
	mov	BYTE PTR -61[rbp], al
	mov	QWORD PTR -56[rbp], 0
	mov	QWORD PTR -48[rbp], 0
	jmp	.L5
.L9:
	mov	rdx, QWORD PTR -72[rbp]
	mov	rax, QWORD PTR -56[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	cmp	BYTE PTR -61[rbp], al
	jne	.L6
	mov	rax, QWORD PTR -40[rbp]
	sub	rax, QWORD PTR -56[rbp]
	cmp	QWORD PTR -32[rbp], rax
	ja	.L6
	mov	rdx, QWORD PTR -72[rbp]
	mov	rax, QWORD PTR -56[rbp]
	lea	rcx, [rdx+rax]
	mov	rdx, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR -80[rbp]
	mov	rsi, rax
	mov	rdi, rcx
	call	memcmp@PLT
	test	eax, eax
	jne	.L6
	mov	rdx, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR -48[rbp]
	lea	rcx, [rdx+rax]
	mov	rdx, QWORD PTR -24[rbp]
	mov	rax, QWORD PTR -88[rbp]
	mov	rsi, rax
	mov	rdi, rcx
	call	memcpy@PLT
	mov	rax, QWORD PTR -24[rbp]
	add	QWORD PTR -48[rbp], rax
	mov	rax, QWORD PTR -32[rbp]
	add	QWORD PTR -56[rbp], rax
	jmp	.L7
.L6:
	mov	rdx, QWORD PTR -72[rbp]
	mov	rax, QWORD PTR -56[rbp]
	add	rax, rdx
	mov	rcx, QWORD PTR -8[rbp]
	mov	rdx, QWORD PTR -48[rbp]
	add	rdx, rcx
	movzx	eax, BYTE PTR [rax]
	mov	BYTE PTR [rdx], al
	add	QWORD PTR -48[rbp], 1
	add	QWORD PTR -56[rbp], 1
.L7:
	mov	rax, QWORD PTR -48[rbp]
	cmp	rax, QWORD PTR -16[rbp]
	jbe	.L8
	lea	rcx, __PRETTY_FUNCTION__.1[rip]
	mov	edx, 97
	lea	rsi, .LC1[rip]
	lea	rdi, .LC2[rip]
	call	__assert_fail@PLT
.L8:
	mov	rax, QWORD PTR -56[rbp]
	cmp	rax, QWORD PTR -40[rbp]
	jbe	.L5
	lea	rcx, __PRETTY_FUNCTION__.1[rip]
	mov	edx, 98
	lea	rsi, .LC1[rip]
	lea	rdi, .LC3[rip]
	call	__assert_fail@PLT
.L5:
	mov	rdx, QWORD PTR -72[rbp]
	mov	rax, QWORD PTR -56[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L9
	mov	rax, QWORD PTR -48[rbp]
	cmp	rax, QWORD PTR -16[rbp]
	je	.L10
	lea	rcx, __PRETTY_FUNCTION__.1[rip]
	mov	edx, 100
	lea	rsi, .LC1[rip]
	lea	rdi, .LC4[rip]
	call	__assert_fail@PLT
.L10:
	mov	rdx, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR -48[rbp]
	add	rax, rdx
	mov	BYTE PTR [rax], 0
	mov	rax, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	string_replace, .-string_replace
	.section	.rodata
.LC5:
	.string	"pos == text_len"
	.text
	.type	nb_occurrences, @function
nb_occurrences:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 48
	mov	QWORD PTR -40[rbp], rdi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	QWORD PTR -16[rbp], rax
	mov	rax, QWORD PTR -48[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -48[rbp]
	movzx	eax, BYTE PTR [rax]
	mov	BYTE PTR -29[rbp], al
	mov	DWORD PTR -28[rbp], 0
	mov	QWORD PTR -24[rbp], 0
	jmp	.L13
.L15:
	mov	rdx, QWORD PTR -40[rbp]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	cmp	BYTE PTR -29[rbp], al
	jne	.L14
	mov	rax, QWORD PTR -16[rbp]
	sub	rax, QWORD PTR -24[rbp]
	cmp	QWORD PTR -8[rbp], rax
	ja	.L14
	mov	rdx, QWORD PTR -40[rbp]
	mov	rax, QWORD PTR -24[rbp]
	lea	rcx, [rdx+rax]
	mov	rdx, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR -48[rbp]
	mov	rsi, rax
	mov	rdi, rcx
	call	memcmp@PLT
	test	eax, eax
	jne	.L14
	add	DWORD PTR -28[rbp], 1
	mov	rax, QWORD PTR -8[rbp]
	add	QWORD PTR -24[rbp], rax
	jmp	.L13
.L14:
	add	QWORD PTR -24[rbp], 1
.L13:
	mov	rdx, QWORD PTR -40[rbp]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L15
	mov	rax, QWORD PTR -24[rbp]
	cmp	rax, QWORD PTR -16[rbp]
	je	.L16
	lea	rcx, __PRETTY_FUNCTION__.0[rip]
	mov	edx, 123
	lea	rsi, .LC1[rip]
	lea	rdi, .LC5[rip]
	call	__assert_fail@PLT
.L16:
	mov	eax, DWORD PTR -28[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	nb_occurrences, .-nb_occurrences
	.section	.rodata
	.align 8
	.type	__PRETTY_FUNCTION__.1, @object
	.size	__PRETTY_FUNCTION__.1, 15
__PRETTY_FUNCTION__.1:
	.string	"string_replace"
	.align 8
	.type	__PRETTY_FUNCTION__.0, @object
	.size	__PRETTY_FUNCTION__.0, 15
__PRETTY_FUNCTION__.0:
	.string	"nb_occurrences"
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.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, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"242331660.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"usage: %s working-string old-str new-str\012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r3, [fp, #-16]
	cmp	r3, #4
	beq	.L2
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L4
	bl	printf
	mvn	r3, #0
	b	.L3
.L2:
	ldr	r3, [fp, #-20]
	add	r3, r3, #4
	ldr	r0, [r3]
	ldr	r3, [fp, #-20]
	add	r3, r3, #8
	ldr	r1, [r3]
	ldr	r3, [fp, #-20]
	add	r3, r3, #12
	ldr	r3, [r3]
	mov	r2, r3
	bl	string_replace
	str	r0, [fp, #-8]
	ldr	r0, [fp, #-8]
	bl	puts
	ldr	r0, [fp, #-8]
	bl	free
	mov	r3, #0
.L3:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L5:
	.align	2
.L4:
	.word	.LC0
	.size	main, .-main
	.section	.rodata
	.align	2
.LC1:
	.ascii	"the_stack_data/242331660.c\000"
	.align	2
.LC2:
	.ascii	"new_pos <= new_len\000"
	.align	2
.LC3:
	.ascii	"old_pos <= text_len\000"
	.align	2
.LC4:
	.ascii	"new_pos == new_len\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	string_replace, %function
string_replace:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #56
	str	r0, [fp, #-48]
	str	r1, [fp, #-52]
	str	r2, [fp, #-56]
	ldr	r0, [fp, #-48]
	bl	strlen
	str	r0, [fp, #-28]
	ldr	r0, [fp, #-52]
	bl	strlen
	str	r0, [fp, #-24]
	ldr	r0, [fp, #-56]
	bl	strlen
	str	r0, [fp, #-20]
	ldr	r1, [fp, #-52]
	ldr	r0, [fp, #-48]
	bl	nb_occurrences
	str	r0, [fp, #-16]
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-24]
	sub	r3, r2, r3
	ldr	r2, [fp, #-16]
	mul	r3, r2, r3
	ldr	r2, [fp, #-28]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-12]
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3]
	ldr	r3, [fp, #-52]
	ldrb	r3, [r3]
	strb	r3, [fp, #-37]
	mov	r3, #0
	str	r3, [fp, #-36]
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L7
.L11:
	ldr	r2, [fp, #-48]
	ldr	r3, [fp, #-36]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	ldrb	r2, [fp, #-37]	@ zero_extendqisi2
	cmp	r2, r3
	bne	.L8
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-36]
	sub	r3, r2, r3
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	bhi	.L8
	ldr	r2, [fp, #-48]
	ldr	r3, [fp, #-36]
	add	r3, r2, r3
	ldr	r2, [fp, #-24]
	ldr	r1, [fp, #-52]
	mov	r0, r3
	bl	memcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L8
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-32]
	add	r3, r2, r3
	ldr	r2, [fp, #-20]
	ldr	r1, [fp, #-56]
	mov	r0, r3
	bl	memcpy
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-20]
	add	r3, r2, r3
	str	r3, [fp, #-32]
	ldr	r2, [fp, #-36]
	ldr	r3, [fp, #-24]
	add	r3, r2, r3
	str	r3, [fp, #-36]
	b	.L9
.L8:
	ldr	r2, [fp, #-48]
	ldr	r3, [fp, #-36]
	add	r2, r2, r3
	ldr	r1, [fp, #-8]
	ldr	r3, [fp, #-32]
	add	r3, r1, r3
	ldrb	r2, [r2]	@ zero_extendqisi2
	strb	r2, [r3]
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
	ldr	r3, [fp, #-36]
	add	r3, r3, #1
	str	r3, [fp, #-36]
.L9:
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	bls	.L10
	ldr	r3, .L14
	mov	r2, #97
	ldr	r1, .L14+4
	ldr	r0, .L14+8
	bl	__assert_fail
.L10:
	ldr	r2, [fp, #-36]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	bls	.L7
	ldr	r3, .L14
	mov	r2, #98
	ldr	r1, .L14+4
	ldr	r0, .L14+12
	bl	__assert_fail
.L7:
	ldr	r2, [fp, #-48]
	ldr	r3, [fp, #-36]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L11
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	beq	.L12
	ldr	r3, .L14
	mov	r2, #100
	ldr	r1, .L14+4
	ldr	r0, .L14+16
	bl	__assert_fail
.L12:
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-32]
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3]
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L15:
	.align	2
.L14:
	.word	__PRETTY_FUNCTION__.8443
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.size	string_replace, .-string_replace
	.section	.rodata
	.align	2
.LC5:
	.ascii	"pos == text_len\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	nb_occurrences, %function
nb_occurrences:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	ldr	r0, [fp, #-32]
	bl	strlen
	str	r0, [fp, #-12]
	ldr	r0, [fp, #-36]
	bl	strlen
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-36]
	ldrb	r3, [r3]
	strb	r3, [fp, #-21]
	mov	r3, #0
	str	r3, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L17
.L19:
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-16]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	ldrb	r2, [fp, #-21]	@ zero_extendqisi2
	cmp	r2, r3
	bne	.L18
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-16]
	sub	r3, r2, r3
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	bhi	.L18
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-16]
	add	r3, r2, r3
	ldr	r2, [fp, #-8]
	ldr	r1, [fp, #-36]
	mov	r0, r3
	bl	memcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L18
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	str	r3, [fp, #-16]
	b	.L17
.L18:
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L17:
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-16]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L19
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	beq	.L20
	ldr	r3, .L22
	mov	r2, #123
	ldr	r1, .L22+4
	ldr	r0, .L22+8
	bl	__assert_fail
.L20:
	ldr	r3, [fp, #-20]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	__PRETTY_FUNCTION__.8459
	.word	.LC1
	.word	.LC5
	.size	nb_occurrences, .-nb_occurrences
	.section	.rodata
	.align	2
	.type	__PRETTY_FUNCTION__.8443, %object
	.size	__PRETTY_FUNCTION__.8443, 15
__PRETTY_FUNCTION__.8443:
	.ascii	"string_replace\000"
	.align	2
	.type	__PRETTY_FUNCTION__.8459, %object
	.size	__PRETTY_FUNCTION__.8459, 15
__PRETTY_FUNCTION__.8459:
	.ascii	"nb_occurrences\000"
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
