	.file	"642343.c"
	.intel_syntax noprefix
	.text
	.globl	cnt
	.bss
	.align 4
	.type	cnt, @object
	.size	cnt, 4
cnt:
	.zero	4
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 32
mutex:
	.zero	32
	.section	.rodata
	.align 8
.LC0:
	.string	" the mutex is now locked by thread %d \n"
.LC1:
	.string	"unlocking the mutex"
	.align 8
.LC2:
	.string	" the mutex is unlocked by thread %d\n"
	.text
	.globl	Count
	.type	Count, @function
Count:
.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	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	DWORD PTR -8[rbp], eax
	lea	rdi, mutex[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -12[rbp], 0
	jmp	.L2
.L3:
	mov	eax, DWORD PTR cnt[rip]
	mov	DWORD PTR -4[rbp], eax
	add	DWORD PTR -4[rbp], 1
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR cnt[rip], eax
	add	DWORD PTR -12[rbp], 1
.L2:
	cmp	DWORD PTR -12[rbp], 999999
	jle	.L3
	lea	rdi, .LC1[rip]
	call	puts@PLT
	lea	rdi, mutex[rip]
	call	sem_post@PLT
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE6:
	.size	Count, .-Count
	.section	.rodata
.LC3:
	.string	"\n ERROR creating thread 1"
.LC4:
	.string	"\n ERROR creating thread 2"
.LC5:
	.string	"\n ERROR joining thread"
	.align 8
.LC6:
	.string	"\n BOOM! cnt is [%d], should be %d\n"
.LC7:
	.string	"\n OK! cnt is [%d]\n"
	.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
	sub	rsp, 48
	mov	DWORD PTR -36[rbp], edi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -32[rbp], 1
	mov	DWORD PTR -28[rbp], 2
	mov	edx, 1
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	sem_init@PLT
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	mov	rdx, rax
	lea	rax, -24[rbp]
	mov	rcx, rdx
	lea	rdx, Count[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	test	eax, eax
	je	.L5
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L5:
	mov	eax, DWORD PTR -28[rbp]
	cdqe
	mov	rdx, rax
	lea	rax, -16[rbp]
	mov	rcx, rdx
	lea	rdx, Count[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	test	eax, eax
	je	.L6
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	test	eax, eax
	je	.L7
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	test	eax, eax
	je	.L8
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L8:
	mov	eax, DWORD PTR cnt[rip]
	cmp	eax, 1999999
	jg	.L9
	mov	eax, DWORD PTR cnt[rip]
	mov	edx, 2000000
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L10
.L9:
	mov	eax, DWORD PTR cnt[rip]
	mov	esi, eax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
.L10:
	mov	edi, 0
	call	pthread_exit@PLT
	.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	"642343.c"
	.text
	.global	cnt
	.bss
	.align	2
	.type	cnt, %object
	.size	cnt, 4
cnt:
	.space	4
	.comm	mutex,16,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	" the mutex is now locked by thread %d \012\000"
	.align	2
.LC1:
	.ascii	"unlocking the mutex\000"
	.align	2
.LC2:
	.ascii	" the mutex is unlocked by thread %d\012\000"
	.text
	.align	2
	.global	Count
	.syntax unified
	.arm
	.fpu softvfp
	.type	Count, %function
Count:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	str	r3, [fp, #-12]
	ldr	r0, .L4
	bl	sem_wait
	ldr	r1, [fp, #-12]
	ldr	r0, .L4+4
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L2
.L3:
	ldr	r3, .L4+8
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
	ldr	r2, .L4+8
	ldr	r3, [fp, #-8]
	str	r3, [r2]
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L2:
	ldr	r3, [fp, #-16]
	ldr	r2, .L4+12
	cmp	r3, r2
	blt	.L3
	ldr	r0, .L4+16
	bl	puts
	ldr	r0, .L4
	bl	sem_post
	ldr	r1, [fp, #-12]
	ldr	r0, .L4+20
	bl	printf
	mov	r0, #0
	bl	pthread_exit
.L5:
	.align	2
.L4:
	.word	mutex
	.word	.LC0
	.word	cnt
	.word	1000000
	.word	.LC1
	.word	.LC2
	.size	Count, .-Count
	.section	.rodata
	.align	2
.LC3:
	.ascii	"\012 ERROR creating thread 1\000"
	.align	2
.LC4:
	.ascii	"\012 ERROR creating thread 2\000"
	.align	2
.LC5:
	.ascii	"\012 ERROR joining thread\000"
	.align	2
.LC6:
	.ascii	"\012 BOOM! cnt is [%d], should be %d\012\000"
	.align	2
.LC7:
	.ascii	"\012 OK! cnt is [%d]\012\000"
	.align	2
.LC8:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ 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	r3, .L14
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #1
	str	r3, [fp, #-16]
	mov	r3, #2
	str	r3, [fp, #-12]
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L14+4
	bl	sem_init
	ldr	r3, [fp, #-16]
	sub	r0, fp, #24
	ldr	r2, .L14+8
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L7
	ldr	r0, .L14+12
	bl	printf
	mov	r0, #1
	bl	exit
.L7:
	ldr	r3, [fp, #-12]
	sub	r0, fp, #20
	ldr	r2, .L14+8
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L8
	ldr	r0, .L14+16
	bl	printf
	mov	r0, #1
	bl	exit
.L8:
	ldr	r3, [fp, #-24]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, r0
	cmp	r3, #0
	beq	.L9
	ldr	r0, .L14+20
	bl	printf
	mov	r0, #1
	bl	exit
.L9:
	ldr	r3, [fp, #-20]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, r0
	cmp	r3, #0
	beq	.L10
	ldr	r0, .L14+20
	bl	printf
	mov	r0, #1
	bl	exit
.L10:
	ldr	r3, .L14+24
	ldr	r3, [r3]
	ldr	r2, .L14+28
	cmp	r3, r2
	bge	.L11
	ldr	r3, .L14+24
	ldr	r3, [r3]
	ldr	r2, .L14+28
	mov	r1, r3
	ldr	r0, .L14+32
	bl	printf
	b	.L12
.L11:
	ldr	r3, .L14+24
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L14+36
	bl	printf
.L12:
	mov	r0, #0
	bl	pthread_exit
.L15:
	.align	2
.L14:
	.word	.LC8
	.word	mutex
	.word	Count
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	cnt
	.word	2000000
	.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
