	.file	"215933.c"
	.intel_syntax noprefix
	.text
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	counter
	.align 4
	.type	counter, @object
	.size	counter, 4
counter:
	.zero	4
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.section	.rodata
.LC0:
	.string	"%s: begin [addr of i: %p]\n"
.LC1:
	.string	"%s: done\n"
	.text
	.globl	mythread
	.type	mythread, @function
mythread:
.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, 48
	mov	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR -16[rbp], rax
	lea	rdx, -20[rbp]
	mov	rax, QWORD PTR -16[rbp]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -20[rbp], 0
	jmp	.L2
.L3:
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR counter[rip]
	add	eax, 1
	mov	DWORD PTR counter[rip], eax
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -20[rbp]
	add	eax, 1
	mov	DWORD PTR -20[rbp], eax
.L2:
	mov	edx, DWORD PTR -20[rbp]
	mov	eax, DWORD PTR max[rip]
	cmp	edx, eax
	jl	.L3
	mov	rax, QWORD PTR -16[rbp]
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	mythread, .-mythread
	.section	.rodata
	.align 8
.LC2:
	.string	"usage: main-first <loopcount>\n"
	.align 8
.LC3:
	.string	"main: begin [counter = %d] [%x]\n"
.LC4:
	.string	"A"
.LC5:
	.string	"B"
	.align 8
.LC6:
	.string	"main: done\n [counter: %d]\n [should: %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
	cmp	DWORD PTR -36[rbp], 2
	je	.L7
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 30
	mov	esi, 1
	lea	rdi, .LC2[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR max[rip], eax
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	pthread_mutex_init@PLT
	lea	rax, counter[rip]
	mov	edx, eax
	mov	eax, DWORD PTR counter[rip]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rax, -24[rbp]
	lea	rcx, .LC4[rip]
	lea	rdx, mythread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -16[rbp]
	lea	rcx, .LC5[rip]
	lea	rdx, mythread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	eax, DWORD PTR max[rip]
	lea	edx, [rax+rax]
	mov	eax, DWORD PTR counter[rip]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.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	"215933.c"
	.text
	.comm	max,4,4
	.global	counter
	.bss
	.align	2
	.type	counter, %object
	.size	counter, 4
counter:
	.space	4
	.comm	mutex,24,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%s: begin [addr of i: %p]\012\000"
	.align	2
.LC1:
	.ascii	"%s: done\012\000"
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	mythread
	.syntax unified
	.arm
	.fpu softvfp
	.type	mythread, %function
mythread:
	@ 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, .L6
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-24]
	str	r3, [fp, #-12]
	sub	r3, fp, #16
	mov	r2, r3
	ldr	r1, [fp, #-12]
	ldr	r0, .L6+4
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L2
.L3:
	ldr	r0, .L6+8
	bl	pthread_mutex_lock
	ldr	r3, .L6+12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L6+12
	str	r3, [r2]
	ldr	r0, .L6+8
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L2:
	ldr	r2, [fp, #-16]
	ldr	r3, .L6+16
	ldr	r3, [r3]
	cmp	r2, r3
	blt	.L3
	ldr	r1, [fp, #-12]
	ldr	r0, .L6+20
	bl	printf
	mov	r3, #0
	ldr	r2, .L6
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L5
	bl	__stack_chk_fail
.L5:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L7:
	.align	2
.L6:
	.word	.LC2
	.word	.LC0
	.word	mutex
	.word	counter
	.word	max
	.word	.LC1
	.size	mythread, .-mythread
	.section	.rodata
	.align	2
.LC3:
	.ascii	"usage: main-first <loopcount>\012\000"
	.align	2
.LC4:
	.ascii	"main: begin [counter = %d] [%x]\012\000"
	.align	2
.LC5:
	.ascii	"A\000"
	.align	2
.LC6:
	.ascii	"B\000"
	.align	2
.LC7:
	.ascii	"main: done\012 [counter: %d]\012 [should: %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 = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	str	r1, [fp, #-28]
	ldr	r3, .L12
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-24]
	cmp	r3, #2
	beq	.L9
	ldr	r3, .L12+4
	ldr	r3, [r3]
	mov	r2, #30
	mov	r1, #1
	ldr	r0, .L12+8
	bl	fwrite
	mov	r0, #1
	bl	exit
.L9:
	ldr	r3, [fp, #-28]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	ldr	r2, .L12+12
	str	r3, [r2]
	mov	r1, #0
	ldr	r0, .L12+16
	bl	pthread_mutex_init
	ldr	r3, .L12+20
	ldr	r3, [r3]
	ldr	r2, .L12+20
	mov	r1, r3
	ldr	r0, .L12+24
	bl	printf
	sub	r0, fp, #16
	ldr	r3, .L12+28
	ldr	r2, .L12+32
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #12
	ldr	r3, .L12+36
	ldr	r2, .L12+32
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-16]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-12]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, .L12+20
	ldr	r1, [r3]
	ldr	r3, .L12+12
	ldr	r3, [r3]
	lsl	r3, r3, #1
	mov	r2, r3
	ldr	r0, .L12+40
	bl	printf
	mov	r3, #0
	ldr	r2, .L12
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L11
	bl	__stack_chk_fail
.L11:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L13:
	.align	2
.L12:
	.word	.LC8
	.word	stderr
	.word	.LC3
	.word	max
	.word	mutex
	.word	counter
	.word	.LC4
	.word	.LC5
	.word	mythread
	.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
