	.file	"20326.c"
	.intel_syntax noprefix
	.text
	.globl	sem
	.bss
	.align 32
	.type	sem, @object
	.size	sem, 32
sem:
	.zero	32
	.globl	mtx
	.align 32
	.type	mtx, @object
	.size	mtx, 40
mtx:
	.zero	40
	.globl	PTHREAD
	.align 4
	.type	PTHREAD, @object
	.size	PTHREAD, 4
PTHREAD:
	.zero	4
	.globl	nr_thr
	.align 4
	.type	nr_thr, @object
	.size	nr_thr, 4
nr_thr:
	.zero	4
	.text
	.globl	barrier_point
	.type	barrier_point, @function
barrier_point:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, DWORD PTR PTHREAD[rip]
	add	eax, 1
	mov	DWORD PTR PTHREAD[rip], eax
	mov	edx, DWORD PTR PTHREAD[rip]
	mov	eax, DWORD PTR nr_thr[rip]
	cmp	edx, eax
	jne	.L2
	lea	rdi, sem[rip]
	call	sem_post@PLT
	test	eax, eax
	je	.L2
	mov	edi, 0
	call	perror@PLT
	call	__errno_location@PLT
	jmp	.L1
.L2:
	lea	rdi, sem[rip]
	call	sem_wait@PLT
	test	eax, eax
	je	.L4
	mov	edi, 0
	call	perror@PLT
	call	__errno_location@PLT
	jmp	.L1
.L4:
	lea	rdi, sem[rip]
	call	sem_post@PLT
	test	eax, eax
	je	.L1
	mov	edi, 0
	call	perror@PLT
	call	__errno_location@PLT
	nop
.L1:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	barrier_point, .-barrier_point
	.section	.rodata
.LC0:
	.string	"%d reached the barrier\n"
.LC1:
	.string	"%d passed the barrier\n"
	.text
	.globl	tfun
	.type	tfun, @function
tfun:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	call	barrier_point
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	free@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	tfun, .-tfun
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	sub	rsp, 72
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	mov	DWORD PTR -100[rbp], edi
	mov	QWORD PTR -112[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	mov	rax, rsp
	mov	rbx, rax
	mov	rax, QWORD PTR -112[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR nr_thr[rip], eax
	mov	eax, DWORD PTR nr_thr[rip]
	movsx	rdx, eax
	sub	rdx, 1
	mov	QWORD PTR -80[rbp], rdx
	movsx	rdx, eax
	mov	r14, rdx
	mov	r15d, 0
	movsx	rdx, eax
	mov	r12, rdx
	mov	r13d, 0
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	eax, 16
	sub	rax, 1
	add	rax, rdx
	mov	ecx, 16
	mov	edx, 0
	div	rcx
	imul	rax, rax, 16
	mov	rcx, rax
	and	rcx, -4096
	mov	rdx, rsp
	sub	rdx, rcx
.L8:
	cmp	rsp, rdx
	je	.L9
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	jmp	.L8
.L9:
	mov	rdx, rax
	and	edx, 4095
	sub	rsp, rdx
	mov	rdx, rax
	and	edx, 4095
	test	rdx, rdx
	je	.L10
	and	eax, 4095
	sub	rax, 8
	add	rax, rsp
	or	QWORD PTR [rax], 0
.L10:
	mov	rax, rsp
	add	rax, 7
	shr	rax, 3
	sal	rax, 3
	mov	QWORD PTR -72[rbp], rax
	mov	esi, 0
	lea	rdi, mtx[rip]
	call	pthread_mutex_init@PLT
	test	eax, eax
	je	.L11
	mov	edi, 0
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L12
.L11:
	mov	edx, 0
	mov	esi, 0
	lea	rdi, sem[rip]
	call	sem_init@PLT
	test	eax, eax
	je	.L13
	mov	edi, 0
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L12
.L13:
	mov	DWORD PTR -92[rbp], 0
	jmp	.L14
.L16:
	mov	esi, 4
	mov	edi, 1
	call	calloc@PLT
	mov	QWORD PTR -64[rbp], rax
	mov	rax, QWORD PTR -64[rbp]
	mov	edx, DWORD PTR -92[rbp]
	mov	DWORD PTR [rax], edx
	mov	eax, DWORD PTR -92[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -72[rbp]
	lea	rdi, [rdx+rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	rcx, rax
	lea	rdx, tfun[rip]
	mov	esi, 0
	call	pthread_create@PLT
	test	eax, eax
	je	.L15
	mov	edi, 0
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L12
.L15:
	add	DWORD PTR -92[rbp], 1
.L14:
	mov	eax, DWORD PTR nr_thr[rip]
	cmp	DWORD PTR -92[rbp], eax
	jl	.L16
	mov	DWORD PTR -92[rbp], 0
	jmp	.L17
.L19:
	mov	rax, QWORD PTR -72[rbp]
	mov	edx, DWORD PTR -92[rbp]
	movsx	rdx, edx
	mov	rax, QWORD PTR [rax+rdx*8]
	lea	rdx, -88[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	pthread_join@PLT
	test	eax, eax
	je	.L18
	mov	edi, 0
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L12
.L18:
	add	DWORD PTR -92[rbp], 1
.L17:
	mov	eax, DWORD PTR nr_thr[rip]
	cmp	DWORD PTR -92[rbp], eax
	jl	.L19
	lea	rdi, sem[rip]
	call	sem_destroy@PLT
	lea	rdi, mtx[rip]
	call	pthread_mutex_destroy@PLT
	mov	eax, 0
.L12:
	mov	rsp, rbx
	mov	rbx, QWORD PTR -56[rbp]
	sub	rbx, QWORD PTR fs:40
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	lea	rsp, -40[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	"20326.c"
	.text
	.comm	sem,16,4
	.comm	mtx,24,4
	.comm	PTHREAD,4,4
	.comm	nr_thr,4,4
	.align	2
	.global	barrier_point
	.syntax unified
	.arm
	.fpu softvfp
	.type	barrier_point, %function
barrier_point:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r3, .L5
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L5
	str	r3, [r2]
	ldr	r3, .L5
	ldr	r2, [r3]
	ldr	r3, .L5+4
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L2
	ldr	r0, .L5+8
	bl	sem_post
	mov	r3, r0
	cmp	r3, #0
	beq	.L2
	mov	r0, #0
	bl	perror
	bl	__errno_location
	pop	{fp, pc}
.L2:
	ldr	r0, .L5+8
	bl	sem_wait
	mov	r3, r0
	cmp	r3, #0
	beq	.L4
	mov	r0, #0
	bl	perror
	bl	__errno_location
	pop	{fp, pc}
.L4:
	ldr	r0, .L5+8
	bl	sem_post
	mov	r3, r0
	cmp	r3, #0
	popeq	{fp, pc}
	mov	r0, #0
	bl	perror
	bl	__errno_location
	nop
	pop	{fp, pc}
.L6:
	.align	2
.L5:
	.word	PTHREAD
	.word	nr_thr
	.word	sem
	.size	barrier_point, .-barrier_point
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%d reached the barrier\012\000"
	.align	2
.LC1:
	.ascii	"%d passed the barrier\012\000"
	.text
	.align	2
	.global	tfun
	.syntax unified
	.arm
	.fpu softvfp
	.type	tfun, %function
tfun:
	@ 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]
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L9
	bl	printf
	bl	barrier_point
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L9+4
	bl	printf
	ldr	r0, [fp, #-8]
	bl	free
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L10:
	.align	2
.L9:
	.word	.LC0
	.word	.LC1
	.size	tfun, .-tfun
	.section	.rodata
	.align	2
.LC2:
	.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	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #36
	str	r0, [fp, #-40]
	str	r1, [fp, #-44]
	ldr	r3, .L23
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	mov	r3, sp
	mov	r4, r3
	ldr	r3, [fp, #-44]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	ldr	r2, .L23+4
	str	r3, [r2]
	ldr	r3, .L23+4
	ldr	ip, [r3]
	sub	r3, ip, #1
	str	r3, [fp, #-28]
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #5
	orr	r3, r3, r0, lsr #27
	lsl	r2, r0, #5
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #5
	orr	r3, r3, r0, lsr #27
	lsl	r2, r0, #5
	mov	r3, ip
	lsl	r3, r3, #2
	add	r3, r3, #7
	lsr	r3, r3, #3
	lsl	r3, r3, #3
	sub	sp, sp, r3
	mov	r3, sp
	add	r3, r3, #3
	lsr	r3, r3, #2
	lsl	r3, r3, #2
	str	r3, [fp, #-24]
	mov	r1, #0
	ldr	r0, .L23+8
	bl	pthread_mutex_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L12
	mov	r0, #0
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L13
.L12:
	mov	r2, #0
	mov	r1, #0
	ldr	r0, .L23+12
	bl	sem_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L14
	mov	r0, #0
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L13
.L14:
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L15
.L17:
	mov	r1, #4
	mov	r0, #1
	bl	calloc
	mov	r3, r0
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-20]
	ldr	r2, [fp, #-32]
	str	r2, [r3]
	ldr	r3, [fp, #-32]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-24]
	add	r0, r2, r3
	ldr	r3, [fp, #-20]
	ldr	r2, .L23+16
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L16
	mov	r0, #0
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L13
.L16:
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L15:
	ldr	r3, .L23+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-32]
	cmp	r2, r3
	blt	.L17
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L18
.L20:
	ldr	r3, [fp, #-24]
	ldr	r2, [fp, #-32]
	ldr	r3, [r3, r2, lsl #2]
	sub	r2, fp, #36
	mov	r1, r2
	mov	r0, r3
	bl	pthread_join
	mov	r3, r0
	cmp	r3, #0
	beq	.L19
	mov	r0, #0
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L13
.L19:
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L18:
	ldr	r3, .L23+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-32]
	cmp	r2, r3
	blt	.L20
	ldr	r0, .L23+12
	bl	sem_destroy
	ldr	r0, .L23+8
	bl	pthread_mutex_destroy
	mov	r3, #0
.L13:
	mov	sp, r4
	ldr	r2, .L23
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L22
	bl	__stack_chk_fail
.L22:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L24:
	.align	2
.L23:
	.word	.LC2
	.word	nr_thr
	.word	mtx
	.word	sem
	.word	tfun
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
