	.file	"179830336.c"
	.intel_syntax noprefix
	.text
	.local	cnt
	.comm	cnt,4,4
	.globl	counter
	.bss
	.align 32
	.type	counter, @object
	.size	counter, 40
counter:
	.zero	40
	.text
	.globl	worker
	.type	worker, @function
worker:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	edi, eax
	call	stick_this_thread_to_core
	mov	DWORD PTR -4[rbp], 0
	jmp	.L2
.L3:
	lea	rdi, counter[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR cnt[rip]
	lea	edx, 1[rax]
	mov	DWORD PTR cnt[rip], edx
	mov	DWORD PTR -8[rbp], eax
	lea	rdi, counter[rip]
	call	pthread_mutex_unlock@PLT
	add	DWORD PTR -4[rbp], 1
.L2:
	cmp	DWORD PTR -4[rbp], 99999
	jle	.L3
	mov	eax, DWORD PTR -8[rbp]
	cdqe
	mov	rdi, rax
	call	pthread_exit@PLT
	.cfi_endproc
.LFE0:
	.size	worker, .-worker
	.section	.rodata
.LC0:
	.string	"WTF?"
.LC1:
	.string	"\r%d "
.LC2:
	.string	"\nexpectd: %d\n"
.LC3:
	.string	"result: %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 848
	mov	DWORD PTR -836[rbp], edi
	mov	QWORD PTR -848[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -832[rbp], 0
	mov	esi, 0
	lea	rdi, counter[rip]
	call	pthread_mutex_init@PLT
	mov	DWORD PTR -828[rbp], 0
	jmp	.L5
.L8:
	mov	eax, DWORD PTR -828[rbp]
	lea	rdx, -816[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rdx+rax]
	lea	rax, -828[rbp]
	mov	rcx, rax
	lea	rdx, worker[rip]
	mov	esi, 0
	mov	eax, 0
	call	pthread_pthread_create@PLT
	mov	DWORD PTR -820[rbp], eax
	cmp	DWORD PTR -820[rbp], 0
	je	.L6
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L11
.L6:
	mov	eax, DWORD PTR -828[rbp]
	add	eax, 1
	mov	DWORD PTR -828[rbp], eax
.L5:
	mov	eax, DWORD PTR -828[rbp]
	cmp	eax, 99
	jle	.L8
	mov	DWORD PTR -824[rbp], 0
	jmp	.L9
.L10:
	mov	eax, DWORD PTR -824[rbp]
	cdqe
	mov	rax, QWORD PTR -816[rbp+rax*8]
	lea	rdx, -832[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	pthread_join@PLT
	mov	eax, DWORD PTR -832[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	mov	edi, 10000
	call	usleep@PLT
	add	DWORD PTR -824[rbp], 1
.L9:
	cmp	DWORD PTR -824[rbp], 99
	jle	.L10
	mov	esi, 10000000
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR cnt[rip]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
.L11:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	stick_this_thread_to_core
	.type	stick_this_thread_to_core, @function
stick_this_thread_to_core:
.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, 192
	mov	DWORD PTR -180[rbp], edi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edi, 84
	call	sysconf@PLT
	mov	DWORD PTR -164[rbp], eax
	lea	rax, -144[rbp]
	mov	rsi, rax
	mov	eax, 0
	mov	edx, 16
	mov	rdi, rsi
	mov	rcx, rdx
	rep stosq
	mov	eax, DWORD PTR -180[rbp]
	cdq
	idiv	DWORD PTR -164[rbp]
	mov	eax, edx
	cdqe
	mov	QWORD PTR -160[rbp], rax
	cmp	QWORD PTR -160[rbp], 1023
	ja	.L15
	mov	rax, QWORD PTR -160[rbp]
	shr	rax, 6
	lea	rdx, 0[0+rax*8]
	lea	rcx, -144[rbp]
	add	rdx, rcx
	mov	rsi, QWORD PTR [rdx]
	mov	rdx, QWORD PTR -160[rbp]
	and	edx, 63
	mov	edi, 1
	mov	ecx, edx
	sal	rdi, cl
	mov	rdx, rdi
	lea	rcx, 0[0+rax*8]
	lea	rax, -144[rbp]
	add	rax, rcx
	or	rdx, rsi
	mov	QWORD PTR [rax], rdx
.L15:
	call	pthread_self@PLT
	mov	QWORD PTR -152[rbp], rax
	lea	rdx, -144[rbp]
	mov	rax, QWORD PTR -152[rbp]
	mov	esi, 128
	mov	rdi, rax
	call	pthread_setaffinity_np@PLT
	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
.LFE2:
	.size	stick_this_thread_to_core, .-stick_this_thread_to_core
	.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	"179830336.c"
	.text
	.local	cnt
	.comm	cnt,4,4
	.comm	counter,24,4
	.align	2
	.global	worker
	.syntax unified
	.arm
	.fpu softvfp
	.type	worker, %function
worker:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	mov	r0, r3
	bl	stick_this_thread_to_core
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L2
.L3:
	ldr	r0, .L4
	bl	pthread_mutex_lock
	ldr	r3, .L4+4
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r1, .L4+4
	str	r2, [r1]
	str	r3, [fp, #-12]
	ldr	r0, .L4
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L2:
	ldr	r3, [fp, #-8]
	ldr	r2, .L4+8
	cmp	r3, r2
	blt	.L3
	ldr	r3, [fp, #-12]
	mov	r0, r3
	bl	pthread_exit
.L5:
	.align	2
.L4:
	.word	counter
	.word	cnt
	.word	100000
	.size	worker, .-worker
	.section	.rodata
	.align	2
.LC0:
	.ascii	"WTF?\000"
	.align	2
.LC1:
	.ascii	"\015%d \000"
	.align	2
.LC2:
	.ascii	"\012expectd: %d\012\000"
	.align	2
.LC3:
	.ascii	"result: %d\012\000"
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 432
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #432
	str	r0, [fp, #-432]
	str	r1, [fp, #-436]
	ldr	r3, .L15
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-424]
	mov	r1, #0
	ldr	r0, .L15+4
	bl	pthread_mutex_init
	mov	r3, #0
	str	r3, [fp, #-420]
	b	.L7
.L10:
	ldr	r3, [fp, #-420]
	sub	r2, fp, #408
	lsl	r3, r3, #2
	add	r0, r2, r3
	sub	r3, fp, #420
	ldr	r2, .L15+8
	mov	r1, #0
	bl	pthread_pthread_create
	str	r0, [fp, #-412]
	ldr	r3, [fp, #-412]
	cmp	r3, #0
	beq	.L8
	ldr	r0, .L15+12
	bl	printf
	mvn	r3, #0
	b	.L13
.L8:
	ldr	r3, [fp, #-420]
	add	r3, r3, #1
	str	r3, [fp, #-420]
.L7:
	ldr	r3, [fp, #-420]
	cmp	r3, #99
	ble	.L10
	mov	r3, #0
	str	r3, [fp, #-416]
	b	.L11
.L12:
	ldr	r3, [fp, #-416]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-404]
	sub	r2, fp, #424
	mov	r1, r2
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-424]
	mov	r1, r3
	ldr	r0, .L15+16
	bl	printf
	ldr	r3, .L15+20
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	ldr	r0, .L15+24
	bl	usleep
	ldr	r3, [fp, #-416]
	add	r3, r3, #1
	str	r3, [fp, #-416]
.L11:
	ldr	r3, [fp, #-416]
	cmp	r3, #99
	ble	.L12
	ldr	r1, .L15+28
	ldr	r0, .L15+32
	bl	printf
	ldr	r3, .L15+36
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L15+40
	bl	printf
	mov	r3, #0
.L13:
	ldr	r2, .L15
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L14
	bl	__stack_chk_fail
.L14:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L16:
	.align	2
.L15:
	.word	.LC4
	.word	counter
	.word	worker
	.word	.LC0
	.word	.LC1
	.word	stdout
	.word	10000
	.word	10000000
	.word	.LC2
	.word	cnt
	.word	.LC3
	.size	main, .-main
	.global	__aeabi_idivmod
	.section	.rodata
	.align	2
.LC5:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	stick_this_thread_to_core
	.syntax unified
	.arm
	.fpu softvfp
	.type	stick_this_thread_to_core, %function
stick_this_thread_to_core:
	@ args = 0, pretend = 0, frame = 152
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #152
	str	r0, [fp, #-152]
	ldr	r3, .L22
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r0, #84
	bl	sysconf
	str	r0, [fp, #-148]
	sub	r3, fp, #136
	mov	r0, r3
	mov	r3, #128
	mov	r2, r3
	mov	r1, #0
	bl	memset
	ldr	r3, [fp, #-152]
	ldr	r1, [fp, #-148]
	mov	r0, r3
	bl	__aeabi_idivmod
	mov	r3, r1
	str	r3, [fp, #-144]
	ldr	r3, [fp, #-144]
	cmp	r3, #1024
	bcs	.L19
	ldr	r3, [fp, #-144]
	lsr	r3, r3, #5
	lsl	r2, r3, #2
	sub	r1, fp, #136
	add	r2, r1, r2
	ldr	r1, [r2]
	ldr	r2, [fp, #-144]
	and	r2, r2, #31
	mov	r0, #1
	lsl	r2, r0, r2
	lsl	r3, r3, #2
	sub	r0, fp, #136
	add	r3, r0, r3
	orr	r2, r1, r2
	str	r2, [r3]
.L19:
	bl	pthread_self
	str	r0, [fp, #-140]
	sub	r3, fp, #136
	mov	r2, r3
	mov	r1, #128
	ldr	r0, [fp, #-140]
	bl	pthread_setaffinity_np
	mov	r3, r0
	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	.LC5
	.size	stick_this_thread_to_core, .-stick_this_thread_to_core
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
