	.file	"500257.c"
	.intel_syntax noprefix
	.text
	.globl	staircase
	.bss
	.align 32
	.type	staircase, @object
	.size	staircase, 40
staircase:
	.zero	40
	.section	.rodata
.LC0:
	.string	"down"
.LC1:
	.string	"up"
.LC2:
	.string	""
	.text
	.globl	direction
	.type	direction, @function
direction:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -4[rbp], edi
	cmp	DWORD PTR -4[rbp], 0
	jne	.L2
	lea	rax, .LC0[rip]
	jmp	.L3
.L2:
	cmp	DWORD PTR -4[rbp], 1
	jne	.L4
	lea	rax, .LC1[rip]
	jmp	.L3
.L4:
	lea	rax, .LC2[rip]
.L3:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	direction, .-direction
	.section	.rodata
.LC3:
	.string	"THREAD %d: Wanting to go %s.\n"
	.align 8
.LC4:
	.string	"THREAD %d: Going %s in %d seconds.\n"
.LC5:
	.string	"THREAD %d: Ended.\n"
	.text
	.globl	perform_work
	.type	perform_work, @function
perform_work:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR -8[rbp], rax
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1717986919
	shr	rdx, 32
	sar	edx
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	ecx, edx
	sal	ecx, 2
	add	ecx, edx
	sub	eax, ecx
	mov	edx, eax
	lea	eax, 1[rdx]
	mov	DWORD PTR -12[rbp], eax
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR 4[rax]
	mov	edi, eax
	call	direction
	mov	rdx, rax
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, staircase[rip]
	call	pthread_mutex_lock@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR 4[rax]
	mov	edi, eax
	call	direction
	mov	rsi, rax
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	edx, DWORD PTR -12[rbp]
	mov	ecx, edx
	mov	rdx, rsi
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	sleep@PLT
	lea	rdi, staircase[rip]
	call	pthread_mutex_unlock@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	perform_work, .-perform_work
	.section	.rodata
.LC6:
	.string	"IN MAIN: Creating thread %d.\n"
.LC7:
	.string	"the_stack_data/500257.c"
.LC8:
	.string	"!result_code"
	.align 8
.LC9:
	.string	"IN MAIN: All threads are created."
	.align 8
.LC10:
	.string	"IN MAIN: Thread %d has ended.\n"
.LC11:
	.string	"MAIN program has ended."
	.text
	.globl	main
	.type	main, @function
main:
.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, 112
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -104[rbp], 0
	jmp	.L8
.L9:
	mov	edi, 8
	call	malloc@PLT
	mov	rdx, rax
	mov	eax, DWORD PTR -104[rbp]
	cdqe
	mov	QWORD PTR -48[rbp+rax*8], rdx
	add	DWORD PTR -104[rbp], 1
.L8:
	cmp	DWORD PTR -104[rbp], 4
	jle	.L9
	mov	esi, 0
	lea	rdi, staircase[rip]
	call	pthread_mutex_init@PLT
	mov	DWORD PTR -104[rbp], 0
	jmp	.L10
.L12:
	mov	eax, DWORD PTR -104[rbp]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -104[rbp]
	cdqe
	mov	rax, QWORD PTR -48[rbp+rax*8]
	mov	edx, DWORD PTR -104[rbp]
	mov	DWORD PTR [rax], edx
	call	rand@PLT
	mov	edx, DWORD PTR -104[rbp]
	movsx	rdx, edx
	mov	rdx, QWORD PTR -48[rbp+rdx*8]
	mov	ecx, eax
	sar	ecx, 31
	shr	ecx, 31
	add	eax, ecx
	and	eax, 1
	sub	eax, ecx
	mov	DWORD PTR 4[rdx], eax
	mov	eax, DWORD PTR -104[rbp]
	cdqe
	mov	rax, QWORD PTR -48[rbp+rax*8]
	lea	rcx, -96[rbp]
	mov	edx, DWORD PTR -104[rbp]
	movsx	rdx, edx
	sal	rdx, 3
	lea	rdi, [rcx+rdx]
	mov	rcx, rax
	lea	rdx, perform_work[rip]
	mov	esi, 0
	call	pthread_create@PLT
	mov	DWORD PTR -100[rbp], eax
	cmp	DWORD PTR -100[rbp], 0
	je	.L11
	lea	rcx, __PRETTY_FUNCTION__.0[rip]
	mov	edx, 61
	lea	rsi, .LC7[rip]
	lea	rdi, .LC8[rip]
	call	__assert_fail@PLT
.L11:
	add	DWORD PTR -104[rbp], 1
.L10:
	cmp	DWORD PTR -104[rbp], 4
	jle	.L12
	lea	rdi, .LC9[rip]
	call	puts@PLT
	mov	DWORD PTR -104[rbp], 0
	jmp	.L13
.L15:
	mov	eax, DWORD PTR -104[rbp]
	cdqe
	mov	rax, QWORD PTR -96[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -100[rbp], eax
	cmp	DWORD PTR -100[rbp], 0
	je	.L14
	lea	rcx, __PRETTY_FUNCTION__.0[rip]
	mov	edx, 69
	lea	rsi, .LC7[rip]
	lea	rdi, .LC8[rip]
	call	__assert_fail@PLT
.L14:
	mov	eax, DWORD PTR -104[rbp]
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -104[rbp], 1
.L13:
	cmp	DWORD PTR -104[rbp], 4
	jle	.L15
	lea	rdi, .LC11[rip]
	call	puts@PLT
	mov	eax, 0
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	"500257.c"
	.text
	.comm	staircase,24,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"down\000"
	.align	2
.LC1:
	.ascii	"up\000"
	.align	2
.LC2:
	.ascii	"\000"
	.text
	.align	2
	.global	direction
	.syntax unified
	.arm
	.fpu softvfp
	.type	direction, %function
direction:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L2
	ldr	r3, .L5
	b	.L3
.L2:
	ldr	r3, [fp, #-8]
	cmp	r3, #1
	bne	.L4
	ldr	r3, .L5+4
	b	.L3
.L4:
	ldr	r3, .L5+8
.L3:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L6:
	.align	2
.L5:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.size	direction, .-direction
	.section	.rodata
	.align	2
.LC3:
	.ascii	"THREAD %d: Wanting to go %s.\012\000"
	.align	2
.LC4:
	.ascii	"THREAD %d: Going %s in %d seconds.\012\000"
	.align	2
.LC5:
	.ascii	"THREAD %d: Ended.\012\000"
	.text
	.align	2
	.global	perform_work
	.syntax unified
	.arm
	.fpu softvfp
	.type	perform_work, %function
perform_work:
	@ 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, [fp, #-24]
	str	r3, [fp, #-20]
	bl	rand
	mov	r1, r0
	ldr	r3, .L9
	smull	r2, r3, r1, r3
	asr	r2, r3, #1
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	sub	r2, r1, r3
	add	r3, r2, #1
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-20]
	ldr	r4, [r3]
	ldr	r3, [fp, #-20]
	ldr	r3, [r3, #4]
	mov	r0, r3
	bl	direction
	mov	r3, r0
	mov	r2, r3
	mov	r1, r4
	ldr	r0, .L9+4
	bl	printf
	ldr	r0, .L9+8
	bl	pthread_mutex_lock
	ldr	r3, [fp, #-20]
	ldr	r4, [r3]
	ldr	r3, [fp, #-20]
	ldr	r3, [r3, #4]
	mov	r0, r3
	bl	direction
	mov	r2, r0
	ldr	r3, [fp, #-16]
	mov	r1, r4
	ldr	r0, .L9+12
	bl	printf
	ldr	r3, [fp, #-16]
	mov	r0, r3
	bl	sleep
	ldr	r0, .L9+8
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L9+16
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L10:
	.align	2
.L9:
	.word	1717986919
	.word	.LC3
	.word	staircase
	.word	.LC4
	.word	.LC5
	.size	perform_work, .-perform_work
	.section	.rodata
	.align	2
.LC6:
	.ascii	"IN MAIN: Creating thread %d.\012\000"
	.align	2
.LC7:
	.ascii	"the_stack_data/500257.c\000"
	.align	2
.LC8:
	.ascii	"!result_code\000"
	.align	2
.LC9:
	.ascii	"IN MAIN: All threads are created.\000"
	.align	2
.LC10:
	.ascii	"IN MAIN: Thread %d has ended.\012\000"
	.align	2
.LC11:
	.ascii	"MAIN program has ended.\000"
	.align	2
.LC12:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #56
	ldr	r3, .L22
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-56]
	b	.L12
.L13:
	mov	r0, #8
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	sub	r1, fp, #4
	add	r3, r1, r3
	str	r2, [r3, #-24]
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
.L12:
	ldr	r3, [fp, #-56]
	cmp	r3, #4
	ble	.L13
	mov	r1, #0
	ldr	r0, .L22+4
	bl	pthread_mutex_init
	mov	r3, #0
	str	r3, [fp, #-56]
	b	.L14
.L16:
	ldr	r1, [fp, #-56]
	ldr	r0, .L22+8
	bl	printf
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-24]
	ldr	r2, [fp, #-56]
	str	r2, [r3]
	bl	rand
	mov	r2, r0
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	sub	r1, fp, #4
	add	r3, r1, r3
	ldr	r1, [r3, #-24]
	cmp	r2, #0
	and	r3, r2, #1
	rsblt	r3, r3, #0
	str	r3, [r1, #4]
	sub	r2, fp, #48
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-24]
	ldr	r2, .L22+12
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-52]
	ldr	r3, [fp, #-52]
	cmp	r3, #0
	beq	.L15
	ldr	r3, .L22+16
	mov	r2, #61
	ldr	r1, .L22+20
	ldr	r0, .L22+24
	bl	__assert_fail
.L15:
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
.L14:
	ldr	r3, [fp, #-56]
	cmp	r3, #4
	ble	.L16
	ldr	r0, .L22+28
	bl	puts
	mov	r3, #0
	str	r3, [fp, #-56]
	b	.L17
.L19:
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-44]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	str	r0, [fp, #-52]
	ldr	r3, [fp, #-52]
	cmp	r3, #0
	beq	.L18
	ldr	r3, .L22+16
	mov	r2, #69
	ldr	r1, .L22+20
	ldr	r0, .L22+24
	bl	__assert_fail
.L18:
	ldr	r1, [fp, #-56]
	ldr	r0, .L22+32
	bl	printf
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
.L17:
	ldr	r3, [fp, #-56]
	cmp	r3, #4
	ble	.L19
	ldr	r0, .L22+36
	bl	puts
	mov	r3, #0
	ldr	r2, .L22
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L21
	bl	__stack_chk_fail
.L21:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	.LC12
	.word	staircase
	.word	.LC6
	.word	perform_work
	.word	__PRETTY_FUNCTION__.6288
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.size	main, .-main
	.section	.rodata
	.align	2
	.type	__PRETTY_FUNCTION__.6288, %object
	.size	__PRETTY_FUNCTION__.6288, 5
__PRETTY_FUNCTION__.6288:
	.ascii	"main\000"
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
