	.file	"170491.c"
	.intel_syntax noprefix
	.text
	.type	is_prefix, @function
is_prefix:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	QWORD PTR -16[rbp], rsi
	mov	rdx, QWORD PTR -16[rbp]
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strstr@PLT
	cmp	QWORD PTR -8[rbp], rax
	sete	al
	movzx	eax, al
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	is_prefix, .-is_prefix
	.type	remove_copies, @function
remove_copies:
.LFB1:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 40
	.cfi_offset 3, -24
	mov	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR environ[rip]
	mov	QWORD PTR -32[rbp], rax
	jmp	.L4
.L10:
	mov	rax, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rdx, QWORD PTR -40[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	is_prefix
	test	eax, eax
	je	.L11
	mov	rax, QWORD PTR -32[rbp]
	mov	rbx, QWORD PTR [rax]
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	strlen@PLT
	add	rax, rbx
	movzx	eax, BYTE PTR [rax]
	cmp	al, 61
	jne	.L11
	mov	rax, QWORD PTR -32[rbp]
	mov	QWORD PTR -24[rbp], rax
	jmp	.L8
.L9:
	mov	rax, QWORD PTR -24[rbp]
	mov	rdx, QWORD PTR 8[rax]
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR [rax], rdx
	add	QWORD PTR -24[rbp], 8
.L8:
	mov	rax, QWORD PTR -24[rbp]
	mov	rax, QWORD PTR [rax]
	test	rax, rax
	jne	.L9
	jmp	.L7
.L11:
	nop
.L7:
	add	QWORD PTR -32[rbp], 8
.L4:
	mov	rax, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR [rax]
	test	rax, rax
	jne	.L10
	nop
	nop
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	remove_copies, .-remove_copies
	.globl	my_unsetenv
	.type	my_unsetenv, @function
my_unsetenv:
.LFB2:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	QWORD PTR -8[rbp], rdi
	cmp	QWORD PTR -8[rbp], 0
	je	.L13
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	je	.L13
	mov	rax, QWORD PTR -8[rbp]
	mov	esi, 61
	mov	rdi, rax
	call	strchr@PLT
	test	rax, rax
	je	.L14
.L13:
	call	__errno_location@PLT
	mov	DWORD PTR [rax], 22
	mov	eax, -1
	jmp	.L15
.L14:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	remove_copies
	mov	eax, 0
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	my_unsetenv, .-my_unsetenv
	.globl	my_setenv
	.type	my_setenv, @function
my_setenv:
.LFB3:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 72
	.cfi_offset 3, -24
	mov	QWORD PTR -56[rbp], rdi
	mov	QWORD PTR -64[rbp], rsi
	mov	DWORD PTR -68[rbp], edx
	cmp	QWORD PTR -56[rbp], 0
	je	.L17
	mov	rax, QWORD PTR -56[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	je	.L17
	mov	rax, QWORD PTR -56[rbp]
	mov	esi, 61
	mov	rdi, rax
	call	strchr@PLT
	test	rax, rax
	je	.L18
.L17:
	call	__errno_location@PLT
	mov	DWORD PTR [rax], 22
	mov	eax, -1
	jmp	.L19
.L18:
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	getenv@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -40[rbp], 0
	je	.L20
	cmp	DWORD PTR -68[rbp], 0
	je	.L21
.L20:
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	rbx, rax
	mov	rax, QWORD PTR -64[rbp]
	mov	rdi, rax
	call	strlen@PLT
	add	rax, rbx
	add	rax, 8
	mov	QWORD PTR -32[rbp], rax
	mov	rax, QWORD PTR -32[rbp]
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -24[rbp], rax
	cmp	QWORD PTR -24[rbp], 0
	jne	.L22
	mov	eax, -1
	jmp	.L19
.L22:
	mov	rdx, QWORD PTR -32[rbp]
	mov	rcx, QWORD PTR -56[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rcx
	mov	rdi, rax
	call	strncpy@PLT
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	rdx, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	BYTE PTR [rax], 61
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	strlen@PLT
	lea	rdx, 1[rax]
	mov	rax, QWORD PTR -24[rbp]
	lea	rcx, [rdx+rax]
	mov	rdx, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR -64[rbp]
	mov	rsi, rax
	mov	rdi, rcx
	call	strncpy@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	putenv@PLT
	test	eax, eax
	je	.L21
	mov	eax, -1
	jmp	.L19
.L21:
	mov	eax, 0
.L19:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	my_setenv, .-my_setenv
	.section	.rodata
.LC0:
	.string	"unset"
.LC1:
	.string	"XDG_SESSION_ID"
.LC2:
	.string	"the_stack_data/170491.c"
	.align 8
.LC3:
	.string	"my_unsetenv(\"XDG_SESSION_ID\") == 0"
	.align 8
.LC4:
	.string	"/bin/env | /bin/grep -s XDG_SESSION_ID"
.LC5:
	.string	"\nset non-existing"
.LC6:
	.string	"abc"
	.align 8
.LC7:
	.string	"my_setenv(\"XDG_SESSION_ID\", \"abc\", 0) == 0"
.LC8:
	.string	"\nset existing, no overwrite"
.LC9:
	.string	"def"
	.align 8
.LC10:
	.string	"my_setenv(\"XDG_SESSION_ID\", \"def\", 0) == 0"
.LC11:
	.string	"\nset existing, overwrite"
	.align 8
.LC12:
	.string	"my_setenv(\"XDG_SESSION_ID\", \"def\", 1) == 0"
	.text
	.globl	main
	.type	main, @function
main:
.LFB4:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, .LC0[rip]
	call	puts@PLT
	lea	rdi, .LC1[rip]
	call	my_unsetenv
	test	eax, eax
	je	.L24
	lea	rcx, __PRETTY_FUNCTION__.0[rip]
	mov	edx, 75
	lea	rsi, .LC2[rip]
	lea	rdi, .LC3[rip]
	call	__assert_fail@PLT
.L24:
	lea	rdi, .LC4[rip]
	call	system@PLT
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	edx, 0
	lea	rsi, .LC6[rip]
	lea	rdi, .LC1[rip]
	call	my_setenv
	test	eax, eax
	je	.L25
	lea	rcx, __PRETTY_FUNCTION__.0[rip]
	mov	edx, 79
	lea	rsi, .LC2[rip]
	lea	rdi, .LC7[rip]
	call	__assert_fail@PLT
.L25:
	lea	rdi, .LC4[rip]
	call	system@PLT
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	edx, 0
	lea	rsi, .LC9[rip]
	lea	rdi, .LC1[rip]
	call	my_setenv
	test	eax, eax
	je	.L26
	lea	rcx, __PRETTY_FUNCTION__.0[rip]
	mov	edx, 83
	lea	rsi, .LC2[rip]
	lea	rdi, .LC10[rip]
	call	__assert_fail@PLT
.L26:
	lea	rdi, .LC4[rip]
	call	system@PLT
	lea	rdi, .LC11[rip]
	call	puts@PLT
	mov	edx, 1
	lea	rsi, .LC9[rip]
	lea	rdi, .LC1[rip]
	call	my_setenv
	test	eax, eax
	je	.L27
	lea	rcx, __PRETTY_FUNCTION__.0[rip]
	mov	edx, 87
	lea	rsi, .LC2[rip]
	lea	rdi, .LC12[rip]
	call	__assert_fail@PLT
.L27:
	lea	rdi, .LC4[rip]
	call	system@PLT
	mov	eax, 0
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	main, .-main
	.section	.rodata
	.type	__PRETTY_FUNCTION__.0, @object
	.size	__PRETTY_FUNCTION__.0, 5
__PRETTY_FUNCTION__.0:
	.string	"main"
	.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	"170491.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	is_prefix, %function
is_prefix:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	str	r1, [fp, #-12]
	ldr	r1, [fp, #-12]
	ldr	r0, [fp, #-8]
	bl	strstr
	mov	r2, r0
	ldr	r3, [fp, #-8]
	cmp	r3, r2
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	is_prefix, .-is_prefix
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	remove_copies, %function
remove_copies:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #20
	str	r0, [fp, #-24]
	ldr	r3, .L12
	ldr	r3, [r3]
	str	r3, [fp, #-20]
	b	.L4
.L10:
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	ldr	r1, [fp, #-24]
	mov	r0, r3
	bl	is_prefix
	mov	r3, r0
	cmp	r3, #0
	beq	.L11
	ldr	r3, [fp, #-20]
	ldr	r4, [r3]
	ldr	r0, [fp, #-24]
	bl	strlen
	mov	r3, r0
	add	r3, r4, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #61
	bne	.L11
	ldr	r3, [fp, #-20]
	str	r3, [fp, #-16]
	b	.L8
.L9:
	ldr	r3, [fp, #-16]
	ldr	r2, [r3, #4]
	ldr	r3, [fp, #-16]
	str	r2, [r3]
	ldr	r3, [fp, #-16]
	add	r3, r3, #4
	str	r3, [fp, #-16]
.L8:
	ldr	r3, [fp, #-16]
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L9
	b	.L7
.L11:
	nop
.L7:
	ldr	r3, [fp, #-20]
	add	r3, r3, #4
	str	r3, [fp, #-20]
.L4:
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L10
	nop
	nop
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L13:
	.align	2
.L12:
	.word	environ
	.size	remove_copies, .-remove_copies
	.align	2
	.global	my_unsetenv
	.syntax unified
	.arm
	.fpu softvfp
	.type	my_unsetenv, %function
my_unsetenv:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L15
	ldr	r3, [fp, #-8]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L15
	mov	r1, #61
	ldr	r0, [fp, #-8]
	bl	strchr
	mov	r3, r0
	cmp	r3, #0
	beq	.L16
.L15:
	bl	__errno_location
	mov	r3, r0
	mov	r2, #22
	str	r2, [r3]
	mvn	r3, #0
	b	.L17
.L16:
	ldr	r0, [fp, #-8]
	bl	remove_copies
	mov	r3, #0
.L17:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	my_unsetenv, .-my_unsetenv
	.align	2
	.global	my_setenv
	.syntax unified
	.arm
	.fpu softvfp
	.type	my_setenv, %function
my_setenv:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #36
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	str	r2, [fp, #-40]
	ldr	r3, [fp, #-32]
	cmp	r3, #0
	beq	.L19
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L19
	mov	r1, #61
	ldr	r0, [fp, #-32]
	bl	strchr
	mov	r3, r0
	cmp	r3, #0
	beq	.L20
.L19:
	bl	__errno_location
	mov	r3, r0
	mov	r2, #22
	str	r2, [r3]
	mvn	r3, #0
	b	.L21
.L20:
	ldr	r0, [fp, #-32]
	bl	getenv
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	cmp	r3, #0
	beq	.L22
	ldr	r3, [fp, #-40]
	cmp	r3, #0
	beq	.L23
.L22:
	ldr	r0, [fp, #-32]
	bl	strlen
	mov	r4, r0
	ldr	r0, [fp, #-36]
	bl	strlen
	mov	r3, r0
	add	r3, r4, r3
	add	r3, r3, #8
	str	r3, [fp, #-20]
	ldr	r0, [fp, #-20]
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	bne	.L24
	mvn	r3, #0
	b	.L21
.L24:
	ldr	r2, [fp, #-20]
	ldr	r1, [fp, #-32]
	ldr	r0, [fp, #-16]
	bl	strncpy
	ldr	r0, [fp, #-32]
	bl	strlen
	mov	r2, r0
	ldr	r3, [fp, #-16]
	add	r3, r3, r2
	mov	r2, #61
	strb	r2, [r3]
	ldr	r0, [fp, #-32]
	bl	strlen
	mov	r3, r0
	add	r3, r3, #1
	ldr	r2, [fp, #-16]
	add	r3, r2, r3
	ldr	r2, [fp, #-20]
	ldr	r1, [fp, #-36]
	mov	r0, r3
	bl	strncpy
	ldr	r0, [fp, #-16]
	bl	putenv
	mov	r3, r0
	cmp	r3, #0
	beq	.L23
	mvn	r3, #0
	b	.L21
.L23:
	mov	r3, #0
.L21:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
	.size	my_setenv, .-my_setenv
	.section	.rodata
	.align	2
.LC0:
	.ascii	"unset\000"
	.align	2
.LC1:
	.ascii	"XDG_SESSION_ID\000"
	.align	2
.LC2:
	.ascii	"the_stack_data/170491.c\000"
	.align	2
.LC3:
	.ascii	"my_unsetenv(\"XDG_SESSION_ID\") == 0\000"
	.align	2
.LC4:
	.ascii	"/bin/env | /bin/grep -s XDG_SESSION_ID\000"
	.align	2
.LC5:
	.ascii	"\012set non-existing\000"
	.align	2
.LC6:
	.ascii	"abc\000"
	.align	2
.LC7:
	.ascii	"my_setenv(\"XDG_SESSION_ID\", \"abc\", 0) == 0\000"
	.align	2
.LC8:
	.ascii	"\012set existing, no overwrite\000"
	.align	2
.LC9:
	.ascii	"def\000"
	.align	2
.LC10:
	.ascii	"my_setenv(\"XDG_SESSION_ID\", \"def\", 0) == 0\000"
	.align	2
.LC11:
	.ascii	"\012set existing, overwrite\000"
	.align	2
.LC12:
	.ascii	"my_setenv(\"XDG_SESSION_ID\", \"def\", 1) == 0\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r0, .L31
	bl	puts
	ldr	r0, .L31+4
	bl	my_unsetenv
	mov	r3, r0
	cmp	r3, #0
	beq	.L26
	ldr	r3, .L31+8
	mov	r2, #75
	ldr	r1, .L31+12
	ldr	r0, .L31+16
	bl	__assert_fail
.L26:
	ldr	r0, .L31+20
	bl	system
	ldr	r0, .L31+24
	bl	puts
	mov	r2, #0
	ldr	r1, .L31+28
	ldr	r0, .L31+4
	bl	my_setenv
	mov	r3, r0
	cmp	r3, #0
	beq	.L27
	ldr	r3, .L31+8
	mov	r2, #79
	ldr	r1, .L31+12
	ldr	r0, .L31+32
	bl	__assert_fail
.L27:
	ldr	r0, .L31+20
	bl	system
	ldr	r0, .L31+36
	bl	puts
	mov	r2, #0
	ldr	r1, .L31+40
	ldr	r0, .L31+4
	bl	my_setenv
	mov	r3, r0
	cmp	r3, #0
	beq	.L28
	ldr	r3, .L31+8
	mov	r2, #83
	ldr	r1, .L31+12
	ldr	r0, .L31+44
	bl	__assert_fail
.L28:
	ldr	r0, .L31+20
	bl	system
	ldr	r0, .L31+48
	bl	puts
	mov	r2, #1
	ldr	r1, .L31+40
	ldr	r0, .L31+4
	bl	my_setenv
	mov	r3, r0
	cmp	r3, #0
	beq	.L29
	ldr	r3, .L31+8
	mov	r2, #87
	ldr	r1, .L31+12
	ldr	r0, .L31+52
	bl	__assert_fail
.L29:
	ldr	r0, .L31+20
	bl	system
	mov	r3, #0
	mov	r0, r3
	pop	{fp, pc}
.L32:
	.align	2
.L31:
	.word	.LC0
	.word	.LC1
	.word	__PRETTY_FUNCTION__.4824
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.size	main, .-main
	.section	.rodata
	.align	2
	.type	__PRETTY_FUNCTION__.4824, %object
	.size	__PRETTY_FUNCTION__.4824, 5
__PRETTY_FUNCTION__.4824:
	.ascii	"main\000"
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
