	.file	"extr_pthread.c_pthread_join.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	pthread_join
	.type	pthread_join, @function
pthread_join:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	mov	rbp, rdi
	mov	edi, DWORD PTR pte_thread_reuse_lock[rip]
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	rbx, rsi
	call	pte_osMutexLock@PLT
	test	rbp, rbp
	je	.L2
	mov	edi, DWORD PTR pte_thread_reuse_lock[rip]
	mov	rax, QWORD PTR PTHREAD_CREATE_DETACHED[rip]
	cmp	QWORD PTR 8[rbp], rax
	je	.L3
	call	pte_osMutexUnlock@PLT
.L4:
	xor	eax, eax
	call	pthread_self@PLT
	mov	r12d, DWORD PTR ENOENT[rip]
	mov	rdi, rax
	test	rax, rax
	je	.L1
	mov	rsi, rbp
	call	pthread_equal@PLT
	mov	r12d, DWORD PTR EDEADLK[rip]
	test	rax, rax
	jne	.L1
	mov	edi, DWORD PTR 24[rbp]
	call	pte_osThreadWaitForEnd@PLT
	cmp	DWORD PTR PTE_OS_OK[rip], eax
	je	.L17
	xor	r12d, r12d
	cmp	DWORD PTR PTE_OS_INTERRUPTED[rip], eax
	je	.L1
	mov	r12d, DWORD PTR ESRCH[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L3:
	mov	r12d, DWORD PTR EINVAL[rip]
.L5:
	call	pte_osMutexUnlock@PLT
	test	r12d, r12d
	je	.L4
.L1:
	mov	eax, r12d
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	r12d, DWORD PTR ESRCH[rip]
	mov	edi, DWORD PTR pte_thread_reuse_lock[rip]
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L17:
	test	rbx, rbx
	je	.L10
	mov	rax, QWORD PTR 16[rbp]
	mov	QWORD PTR [rbx], rax
.L10:
	pop	rbx
	.cfi_def_cfa_offset 24
	mov	rdi, rbp
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	jmp	pthread_detach@PLT
	.cfi_endproc
.LFE0:
	.size	pthread_join, .-pthread_join
	.comm	pte_thread_reuse_lock,4,4
	.comm	PTHREAD_CREATE_DETACHED,8,8
	.comm	PTE_OS_OK,4,4
	.comm	PTE_OS_INTERRUPTED,4,4
	.comm	ESRCH,4,4
	.comm	ENOENT,4,4
	.comm	EINVAL,4,4
	.comm	EDEADLK,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_pthread.c_pthread_join.c"
	.text
	.align	2
	.global	pthread_join
	.syntax unified
	.arm
	.fpu softvfp
	.type	pthread_join, %function
pthread_join:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r0
	ldr	r5, .L18
	mov	r6, r1
	ldr	r0, [r5]
	bl	pte_osMutexLock
	cmp	r4, #0
	beq	.L2
	ldr	r3, .L18+4
	ldr	r2, [r4, #4]
	ldr	r3, [r3]
	ldr	r0, [r5]
	cmp	r2, r3
	beq	.L3
	bl	pte_osMutexUnlock
.L4:
	bl	pthread_self
	cmp	r0, #0
	beq	.L16
	mov	r1, r4
	bl	pthread_equal
	subs	r5, r0, #0
	beq	.L8
	ldr	r3, .L18+8
	ldr	r5, [r3]
	mov	r0, r5
	pop	{r4, r5, r6, pc}
.L3:
	ldr	r3, .L18+12
	ldr	r5, [r3]
.L5:
	bl	pte_osMutexUnlock
	cmp	r5, #0
	beq	.L4
.L1:
	mov	r0, r5
	pop	{r4, r5, r6, pc}
.L2:
	ldr	r3, .L18+16
	ldr	r0, [r5]
	ldr	r5, [r3]
	b	.L5
.L16:
	ldr	r3, .L18+20
	ldr	r5, [r3]
	mov	r0, r5
	pop	{r4, r5, r6, pc}
.L8:
	ldr	r0, [r4, #12]
	bl	pte_osThreadWaitForEnd
	ldr	r3, .L18+24
	ldr	r3, [r3]
	cmp	r3, r0
	beq	.L17
	ldr	r3, .L18+28
	ldr	r3, [r3]
	cmp	r3, r0
	ldrne	r3, .L18+16
	ldrne	r5, [r3]
	b	.L1
.L17:
	cmp	r6, #0
	ldrne	r3, [r4, #8]
	mov	r0, r4
	strne	r3, [r6]
	pop	{r4, r5, r6, lr}
	b	pthread_detach
.L19:
	.align	2
.L18:
	.word	pte_thread_reuse_lock
	.word	PTHREAD_CREATE_DETACHED
	.word	EDEADLK
	.word	EINVAL
	.word	ESRCH
	.word	ENOENT
	.word	PTE_OS_OK
	.word	PTE_OS_INTERRUPTED
	.size	pthread_join, .-pthread_join
	.comm	pte_thread_reuse_lock,4,4
	.comm	PTHREAD_CREATE_DETACHED,4,4
	.comm	PTE_OS_OK,4,4
	.comm	PTE_OS_INTERRUPTED,4,4
	.comm	ESRCH,4,4
	.comm	ENOENT,4,4
	.comm	EINVAL,4,4
	.comm	EDEADLK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
