	.file	"214189.c"
	.intel_syntax noprefix
	.text
	.globl	foo
	.type	foo, @function
foo:
.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, 64
	mov	DWORD PTR -52[rbp], edi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -40[rbp], 0
	mov	WORD PTR -46[rbp], 0
	mov	DWORD PTR -36[rbp], 2
	mov	eax, DWORD PTR -40[rbp]
	mov	DWORD PTR -32[rbp], eax
.L4:
	mov	edx, DWORD PTR -32[rbp]
	mov	eax, DWORD PTR -36[rbp]
	imul	eax, edx
	mov	DWORD PTR -28[rbp], eax
	mov	eax, DWORD PTR -28[rbp]
	mov	ecx, eax
	lea	rdx, -32[rbp]
	mov	eax, DWORD PTR [rdx]
	lock cmpxchg	DWORD PTR -40[rbp], ecx
	mov	ecx, eax
	sete	al
	test	al, al
	jne	.L2
	mov	DWORD PTR [rdx], ecx
.L2:
	test	al, al
	jne	.L3
	jmp	.L4
.L3:
	mov	DWORD PTR -24[rbp], 2
	mov	eax, DWORD PTR -40[rbp]
	mov	DWORD PTR -20[rbp], eax
.L7:
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, DWORD PTR -24[rbp]
	cdq
	idiv	esi
	mov	DWORD PTR -16[rbp], eax
	mov	eax, DWORD PTR -16[rbp]
	mov	ecx, eax
	lea	rdx, -20[rbp]
	mov	eax, DWORD PTR [rdx]
	lock cmpxchg	DWORD PTR -40[rbp], ecx
	mov	ecx, eax
	sete	al
	test	al, al
	jne	.L5
	mov	DWORD PTR [rdx], ecx
.L5:
	test	al, al
	jne	.L6
	jmp	.L7
.L6:
	mov	eax, DWORD PTR -52[rbp]
	mov	DWORD PTR -12[rbp], eax
	movzx	eax, WORD PTR -46[rbp]
	mov	WORD PTR -44[rbp], ax
.L10:
	movzx	eax, WORD PTR -44[rbp]
	cwde
	mov	edi, DWORD PTR -12[rbp]
	cdq
	idiv	edi
	mov	WORD PTR -42[rbp], ax
	movzx	eax, WORD PTR -42[rbp]
	movzx	ecx, ax
	lea	rdx, -44[rbp]
	movzx	eax, WORD PTR [rdx]
	lock cmpxchg	WORD PTR -46[rbp], cx
	mov	ecx, eax
	sete	al
	test	al, al
	jne	.L8
	mov	WORD PTR [rdx], cx
.L8:
	test	al, al
	jne	.L12
	jmp	.L10
.L12:
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	foo, .-foo
	.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	"214189.c"
	.text
	.global	__sync_synchronize
	.global	__sync_val_compare_and_swap_4
	.global	__aeabi_idiv
	.global	__sync_val_compare_and_swap_2
	.section	.rodata
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	foo
	.syntax unified
	.arm
	.fpu softvfp
	.type	foo, %function
foo:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, fp, lr}
	add	fp, sp, #12
	sub	sp, sp, #56
	str	r0, [fp, #-64]
	ldr	r3, .L13
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-48]
	mov	r3, #0
	strh	r3, [fp, #-54]	@ movhi
	mov	r3, #2
	str	r3, [fp, #-44]
	bl	__sync_synchronize
	ldr	r4, [fp, #-48]
	bl	__sync_synchronize
	mov	r3, r4
	str	r3, [fp, #-40]
.L4:
	ldr	r3, [fp, #-40]
	ldr	r2, [fp, #-44]
	mul	r3, r2, r3
	str	r3, [fp, #-36]
	ldr	r3, [fp, #-36]
	mov	r2, r3
	sub	r4, fp, #40
	ldr	r5, [r4]
	sub	r3, fp, #48
	mov	r1, r5
	mov	r0, r3
	bl	__sync_val_compare_and_swap_4
	mov	r3, r0
	cmp	r3, r5
	moveq	r2, #1
	movne	r2, #0
	cmp	r2, #0
	bne	.L2
	str	r3, [r4]
.L2:
	mov	r3, r2
	cmp	r3, #0
	bne	.L3
	b	.L4
.L3:
	mov	r3, #2
	str	r3, [fp, #-32]
	bl	__sync_synchronize
	ldr	r4, [fp, #-48]
	bl	__sync_synchronize
	mov	r3, r4
	str	r3, [fp, #-28]
.L7:
	ldr	r3, [fp, #-28]
	ldr	r2, [fp, #-32]
	mov	r1, r2
	mov	r0, r3
	bl	__aeabi_idiv
	mov	r3, r0
	str	r3, [fp, #-24]
	ldr	r3, [fp, #-24]
	mov	r2, r3
	sub	r4, fp, #28
	ldr	r5, [r4]
	sub	r3, fp, #48
	mov	r1, r5
	mov	r0, r3
	bl	__sync_val_compare_and_swap_4
	mov	r3, r0
	cmp	r3, r5
	moveq	r2, #1
	movne	r2, #0
	cmp	r2, #0
	bne	.L5
	str	r3, [r4]
.L5:
	mov	r3, r2
	cmp	r3, #0
	bne	.L6
	b	.L7
.L6:
	ldr	r3, [fp, #-64]
	str	r3, [fp, #-20]
	bl	__sync_synchronize
	ldrh	r4, [fp, #-54]	@ movhi
	bl	__sync_synchronize
	lsl	r3, r4, #16
	lsr	r3, r3, #16
	lsl	r3, r3, #16
	asr	r3, r3, #16
	strh	r3, [fp, #-52]	@ movhi
.L10:
	ldrsh	r3, [fp, #-52]
	mov	r2, r3
	ldr	r3, [fp, #-20]
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_idiv
	mov	r3, r0
	lsl	r3, r3, #16
	asr	r3, r3, #16
	strh	r3, [fp, #-50]	@ movhi
	ldrsh	r3, [fp, #-50]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	sub	r4, fp, #52
	ldrh	r5, [r4]	@ movhi
	sub	r0, fp, #54
	lsl	r2, r5, #16
	asr	r1, r2, #16
	lsl	r3, r3, #16
	asr	r3, r3, #16
	mov	r2, r3
	bl	__sync_val_compare_and_swap_2
	mov	r3, r0	@ movhi
	lsl	r2, r3, #16
	lsr	r1, r2, #16
	lsl	r2, r5, #16
	lsr	r2, r2, #16
	cmp	r1, r2
	moveq	r2, #1
	movne	r2, #0
	cmp	r2, #0
	bne	.L8
	strh	r3, [r4]	@ movhi
.L8:
	mov	r3, r2
	cmp	r3, #0
	bne	.L12
	b	.L10
.L12:
	nop
	ldr	r3, .L13
	ldr	r2, [r3]
	ldr	r3, [fp, #-16]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L11
	bl	__stack_chk_fail
.L11:
	sub	sp, fp, #12
	@ sp needed
	pop	{r4, r5, fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC0
	.size	foo, .-foo
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
