	.file	"125139219.c"
	.intel_syntax noprefix
	.text
	.globl	child
	.bss
	.align 32
	.type	child, @object
	.size	child, 968
child:
	.zero	968
	.globl	parent
	.align 32
	.type	parent, @object
	.size	parent, 968
parent:
	.zero	968
	.globl	child_done
	.type	child_done, @object
	.size	child_done, 1
child_done:
	.zero	1
	.section	.rodata
	.align 8
.LC0:
	.string	"child thread running %d of 10\n"
.LC1:
	.string	"Child thread exiting"
	.text
	.globl	threadFunction
	.type	threadFunction, @function
threadFunction:
.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, 16
	mov	DWORD PTR -4[rbp], 1
	jmp	.L2
.L3:
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rsi, parent[rip]
	lea	rdi, child[rip]
	call	swapcontext@PLT
	endbr64
	add	DWORD PTR -4[rbp], 1
.L2:
	cmp	DWORD PTR -4[rbp], 10
	jle	.L3
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	BYTE PTR child_done[rip], 1
	lea	rsi, parent[rip]
	lea	rdi, child[rip]
	call	swapcontext@PLT
	endbr64
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	threadFunction, .-threadFunction
	.section	.rodata
	.align 8
.LC2:
	.string	"malloc: Could not allocate stack"
.LC3:
	.string	"Creating child thread"
.LC4:
	.string	"Switching to child thread"
	.align 8
.LC5:
	.string	"doing parent stuff and then switching back to child"
.LC6:
	.string	"Child done"
	.align 8
.LC7:
	.string	"Child thread returned and stack freed"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	BYTE PTR child_done[rip], 0
	lea	rdi, child[rip]
	call	getcontext@PLT
	endbr64
	mov	QWORD PTR child[rip+8], 0
	mov	edi, 65536
	call	malloc@PLT
	mov	QWORD PTR child[rip+16], rax
	mov	QWORD PTR child[rip+32], 65536
	mov	DWORD PTR child[rip+24], 0
	mov	rax, QWORD PTR child[rip+16]
	test	rax, rax
	jne	.L6
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	lea	rdi, .LC3[rip]
	call	puts@PLT
	mov	edx, 0
	lea	rsi, threadFunction[rip]
	lea	rdi, child[rip]
	mov	eax, 0
	call	makecontext@PLT
	lea	rdi, .LC4[rip]
	call	puts@PLT
	lea	rsi, child[rip]
	lea	rdi, parent[rip]
	call	swapcontext@PLT
	endbr64
	jmp	.L7
.L8:
	lea	rdi, .LC5[rip]
	call	puts@PLT
	lea	rsi, child[rip]
	lea	rdi, parent[rip]
	call	swapcontext@PLT
	endbr64
.L7:
	movzx	eax, BYTE PTR child_done[rip]
	xor	eax, 1
	test	al, al
	jne	.L8
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	rax, QWORD PTR child[rip+16]
	mov	rdi, rax
	call	free@PLT
	lea	rdi, .LC7[rip]
	call	puts@PLT
	mov	eax, 0
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-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	"125139219.c"
	.text
	.comm	child,744,8
	.comm	parent,744,8
	.comm	child_done,1,1
	.section	.rodata
	.align	2
.LC0:
	.ascii	"child thread running %d of 10\012\000"
	.align	2
.LC1:
	.ascii	"Child thread exiting\000"
	.text
	.align	2
	.global	threadFunction
	.syntax unified
	.arm
	.fpu softvfp
	.type	threadFunction, %function
threadFunction:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	mov	r3, #1
	str	r3, [fp, #-8]
	b	.L2
.L3:
	ldr	r1, [fp, #-8]
	ldr	r0, .L4
	bl	printf
	ldr	r1, .L4+4
	ldr	r0, .L4+8
	bl	swapcontext
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L2:
	ldr	r3, [fp, #-8]
	cmp	r3, #10
	ble	.L3
	ldr	r0, .L4+12
	bl	puts
	ldr	r3, .L4+16
	mov	r2, #1
	strb	r2, [r3]
	ldr	r1, .L4+4
	ldr	r0, .L4+8
	bl	swapcontext
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L5:
	.align	2
.L4:
	.word	.LC0
	.word	parent
	.word	child
	.word	.LC1
	.word	child_done
	.size	threadFunction, .-threadFunction
	.section	.rodata
	.align	2
.LC2:
	.ascii	"malloc: Could not allocate stack\000"
	.align	2
.LC3:
	.ascii	"Creating child thread\000"
	.align	2
.LC4:
	.ascii	"Switching to child thread\000"
	.align	2
.LC5:
	.ascii	"doing parent stuff and then switching back to child"
	.ascii	"\000"
	.align	2
.LC6:
	.ascii	"Child done\000"
	.align	2
.LC7:
	.ascii	"Child thread returned and stack freed\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	r3, .L12
	mov	r2, #0
	strb	r2, [r3]
	ldr	r0, .L12+4
	bl	getcontext
	ldr	r3, .L12+4
	mov	r2, #0
	str	r2, [r3, #4]
	mov	r0, #65536
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L12+4
	str	r2, [r3, #8]
	ldr	r3, .L12+4
	mov	r2, #65536
	str	r2, [r3, #16]
	ldr	r3, .L12+4
	mov	r2, #0
	str	r2, [r3, #12]
	ldr	r3, .L12+4
	ldr	r3, [r3, #8]
	cmp	r3, #0
	bne	.L8
	ldr	r0, .L12+8
	bl	perror
	mov	r0, #1
	bl	exit
.L8:
	ldr	r0, .L12+12
	bl	puts
	mov	r2, #0
	ldr	r1, .L12+16
	ldr	r0, .L12+4
	bl	makecontext
	ldr	r0, .L12+20
	bl	puts
	ldr	r1, .L12+4
	ldr	r0, .L12+24
	bl	swapcontext
	b	.L9
.L10:
	ldr	r0, .L12+28
	bl	puts
	ldr	r1, .L12+4
	ldr	r0, .L12+24
	bl	swapcontext
.L9:
	ldr	r3, .L12
	ldrb	r3, [r3]	@ zero_extendqisi2
	eor	r3, r3, #1
	and	r3, r3, #255
	cmp	r3, #0
	bne	.L10
	ldr	r0, .L12+32
	bl	puts
	ldr	r3, .L12+4
	ldr	r3, [r3, #8]
	mov	r0, r3
	bl	free
	ldr	r0, .L12+36
	bl	puts
	mov	r3, #0
	mov	r0, r3
	pop	{fp, pc}
.L13:
	.align	2
.L12:
	.word	child_done
	.word	child
	.word	.LC2
	.word	.LC3
	.word	threadFunction
	.word	.LC4
	.word	parent
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
