	.file	"86001.c"
	.intel_syntax noprefix
	.text
	.globl	toA
	.bss
	.align 32
	.type	toA, @object
	.size	toA, 32
toA:
	.zero	32
	.globl	toB
	.align 32
	.type	toB, @object
	.size	toB, 32
toB:
	.zero	32
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 32
mutex:
	.zero	32
	.globl	xingCnt
	.align 4
	.type	xingCnt, @object
	.size	xingCnt, 4
xingCnt:
	.zero	4
	.globl	xedCnt
	.align 4
	.type	xedCnt, @object
	.size	xedCnt, 4
xedCnt:
	.zero	4
	.globl	toAwaitCnt
	.align 4
	.type	toAwaitCnt, @object
	.size	toAwaitCnt, 4
toAwaitCnt:
	.zero	4
	.globl	toBwaitCnt
	.align 4
	.type	toBwaitCnt, @object
	.size	toBwaitCnt, 4
toBwaitCnt:
	.zero	4
	.globl	xingDir
	.align 4
	.type	xingDir, @object
	.size	xingDir, 4
xingDir:
	.zero	4
	.globl	turnaroundTime
	.align 32
	.type	turnaroundTime, @object
	.size	turnaroundTime, 160
turnaroundTime:
	.zero	160
	.globl	avgTurnaroundTime
	.align 8
	.type	avgTurnaroundTime, @object
	.size	avgTurnaroundTime, 8
avgTurnaroundTime:
	.zero	8
	.globl	responseTime
	.align 32
	.type	responseTime, @object
	.size	responseTime, 160
responseTime:
	.zero	160
	.globl	avgResponseTime
	.align 8
	.type	avgResponseTime, @object
	.size	avgResponseTime, 8
avgResponseTime:
	.zero	8
	.section	.rodata
	.align 8
.LC0:
	.string	"Project 2: Customer crossing problem using pThreads and Semaphores"
.LC1:
	.string	"*****************\n"
.LC2:
	.string	"error! %d"
.LC3:
	.string	"Parent Process PID: %d \n"
	.align 8
.LC4:
	.string	"error in calling pthread_create, %d\n"
	.align 8
.LC5:
	.string	"error in calling pthread_join, %d\n"
	.align 8
.LC8:
	.string	"\n The average Turnaroud time for %d customers is %f seconds \n"
	.align 8
.LC9:
	.string	"\n The average Response time for %d customers is %f seconds \n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 304
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rdi, .LC0[rip]
	call	puts@PLT
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	mov	DWORD PTR -284[rbp], 0
	mov	edx, 1
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	sem_init@PLT
	test	eax, eax
	js	.L2
	mov	edx, 1
	mov	esi, 0
	lea	rdi, toA[rip]
	call	sem_init@PLT
	test	eax, eax
	js	.L2
	mov	edx, 1
	mov	esi, 0
	lea	rdi, toB[rip]
	call	sem_init@PLT
	test	eax, eax
	jns	.L3
.L2:
	mov	eax, DWORD PTR -284[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	call	getpid@PLT
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -296[rbp], 0
	jmp	.L4
.L9:
	mov	eax, DWORD PTR -296[rbp]
	cdqe
	mov	edx, DWORD PTR -296[rbp]
	mov	DWORD PTR -256[rbp+rax*4], edx
	call	rand@PLT
	cdq
	shr	edx, 31
	add	eax, edx
	and	eax, 1
	sub	eax, edx
	cmp	eax, 1
	jne	.L5
	lea	rax, a[rip]
	mov	QWORD PTR -280[rbp], rax
	jmp	.L6
.L5:
	lea	rax, b[rip]
	mov	QWORD PTR -280[rbp], rax
.L6:
	lea	rdx, -256[rbp]
	mov	eax, DWORD PTR -296[rbp]
	cdqe
	sal	rax, 2
	add	rdx, rax
	mov	rax, QWORD PTR -280[rbp]
	lea	rsi, -176[rbp]
	mov	ecx, DWORD PTR -296[rbp]
	movsx	rcx, ecx
	sal	rcx, 3
	lea	rdi, [rsi+rcx]
	mov	rcx, rdx
	mov	rdx, rax
	mov	esi, 0
	call	pthread_create@PLT
	mov	DWORD PTR -284[rbp], eax
	cmp	DWORD PTR -284[rbp], 0
	je	.L7
	mov	eax, DWORD PTR -284[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L15
.L7:
	add	DWORD PTR -296[rbp], 1
.L4:
	cmp	DWORD PTR -296[rbp], 19
	jle	.L9
	mov	DWORD PTR -292[rbp], 0
	jmp	.L10
.L12:
	mov	eax, DWORD PTR -292[rbp]
	cdqe
	mov	rax, QWORD PTR -176[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -284[rbp], eax
	cmp	DWORD PTR -284[rbp], 0
	je	.L11
	mov	eax, DWORD PTR -284[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L15
.L11:
	add	DWORD PTR -292[rbp], 1
.L10:
	cmp	DWORD PTR -292[rbp], 19
	jle	.L12
	pxor	xmm0, xmm0
	movsd	QWORD PTR -272[rbp], xmm0
	pxor	xmm0, xmm0
	movsd	QWORD PTR -264[rbp], xmm0
	mov	DWORD PTR -288[rbp], 0
	jmp	.L13
.L14:
	mov	eax, DWORD PTR -288[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, responseTime[rip]
	movsd	xmm0, QWORD PTR [rdx+rax]
	movsd	xmm1, QWORD PTR -272[rbp]
	addsd	xmm0, xmm1
	movsd	QWORD PTR -272[rbp], xmm0
	mov	eax, DWORD PTR -288[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, turnaroundTime[rip]
	movsd	xmm0, QWORD PTR [rdx+rax]
	movsd	xmm1, QWORD PTR -264[rbp]
	addsd	xmm0, xmm1
	movsd	QWORD PTR -264[rbp], xmm0
	add	DWORD PTR -288[rbp], 1
.L13:
	cmp	DWORD PTR -288[rbp], 19
	jle	.L14
	movsd	xmm0, QWORD PTR -272[rbp]
	movsd	xmm1, QWORD PTR .LC7[rip]
	divsd	xmm0, xmm1
	movsd	QWORD PTR avgResponseTime[rip], xmm0
	movsd	xmm0, QWORD PTR -264[rbp]
	movsd	xmm1, QWORD PTR .LC7[rip]
	divsd	xmm0, xmm1
	movsd	QWORD PTR avgTurnaroundTime[rip], xmm0
	mov	rax, QWORD PTR avgTurnaroundTime[rip]
	movq	xmm0, rax
	mov	esi, 20
	lea	rdi, .LC8[rip]
	mov	eax, 1
	call	printf@PLT
	mov	rax, QWORD PTR avgResponseTime[rip]
	movq	xmm0, rax
	mov	esi, 20
	lea	rdi, .LC9[rip]
	mov	eax, 1
	call	printf@PLT
	mov	eax, 0
.L15:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC10:
	.string	"\n Thread: %d crossing count larger than maxStairs \n"
	.align 8
.LC11:
	.string	"****\nThread %d: About to across from A to B \n"
.LC12:
	.string	"%d is Crossing from A to B\n"
.LC13:
	.string	"%d Signaling Mutex\n"
.LC14:
	.string	"%d is now supposed to wait\n"
	.align 8
.LC15:
	.string	"%d was waiting until signal call"
.LC16:
	.string	"Signal has been called "
.LC17:
	.string	"%d is about to cross \n"
.LC18:
	.string	"Signaling Mutex"
	.align 8
.LC19:
	.string	"%d Crossing Finished. Waiting for mutex \n"
	.align 8
.LC20:
	.string	"\n xingCnt: %d, xedCnt: %d, toAwaitCnt: %d, toBwaitCnt: %d, xingDir: %d \n"
.LC21:
	.string	"Mutex Passed"
	.align 8
.LC22:
	.string	"%d is Signaling customer Crossing to B\n"
	.align 8
.LC23:
	.string	"%d is Changing Direction to turn toward A\n"
	.align 8
.LC24:
	.string	"%d is Signaling customer waiting to cross to A\n"
	.align 8
.LC25:
	.string	"%d: Crossing Direction Reset \n"
.LC26:
	.string	"%d: Signaling Mutex\n"
	.text
	.globl	b
	.type	b, @function
b:
.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, 96
	mov	QWORD PTR -88[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -88[rbp]
	mov	QWORD PTR -72[rbp], rax
	mov	rax, QWORD PTR -72[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -76[rbp], eax
	lea	rax, -64[rbp]
	mov	rsi, rax
	mov	edi, 4
	call	clock_gettime@PLT
	lea	rdi, mutex[rip]
	call	semWait
	jmp	.L18
.L19:
	lea	rdi, mutex[rip]
	call	semSignal
	mov	edi, 1
	call	sleep@PLT
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR xingDir[rip]
	cmp	eax, 1
	jne	.L18
	lea	rdi, toA[rip]
	call	semSignal
.L18:
	mov	eax, DWORD PTR xingCnt[rip]
	cmp	eax, 6
	jg	.L19
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC11[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR xingDir[rip]
	test	eax, eax
	je	.L20
	mov	eax, DWORD PTR xingDir[rip]
	cmp	eax, 1
	jne	.L21
.L20:
	mov	eax, DWORD PTR xingCnt[rip]
	cmp	eax, 5
	jg	.L21
	mov	edx, DWORD PTR xedCnt[rip]
	mov	eax, DWORD PTR xingCnt[rip]
	add	eax, edx
	cmp	eax, 9
	jg	.L21
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC12[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR xingDir[rip], 1
	mov	eax, DWORD PTR xingCnt[rip]
	add	eax, 1
	mov	DWORD PTR xingCnt[rip], eax
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	semSignal
	jmp	.L22
.L21:
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC14[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR toBwaitCnt[rip]
	add	eax, 1
	mov	DWORD PTR toBwaitCnt[rip], eax
	lea	rdi, toB[rip]
	call	semWait
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC15[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC16[rip]
	call	puts@PLT
	mov	eax, DWORD PTR toBwaitCnt[rip]
	sub	eax, 1
	mov	DWORD PTR toBwaitCnt[rip], eax
	mov	eax, DWORD PTR xingCnt[rip]
	add	eax, 1
	mov	DWORD PTR xingCnt[rip], eax
	mov	DWORD PTR xingDir[rip], 1
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC17[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC18[rip]
	call	puts@PLT
	lea	rdi, toB[rip]
	call	semSignal
	lea	rdi, mutex[rip]
	call	semSignal
.L22:
	lea	rax, -48[rbp]
	mov	rsi, rax
	mov	edi, 4
	call	clock_gettime@PLT
	mov	edi, 1
	call	sleep@PLT
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, DWORD PTR xingDir[rip]
	mov	esi, DWORD PTR toBwaitCnt[rip]
	mov	ecx, DWORD PTR toAwaitCnt[rip]
	mov	edx, DWORD PTR xedCnt[rip]
	mov	eax, DWORD PTR xingCnt[rip]
	mov	r9d, edi
	mov	r8d, esi
	mov	esi, eax
	lea	rdi, .LC20[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	semWait
	lea	rdi, .LC21[rip]
	call	puts@PLT
	mov	eax, DWORD PTR xedCnt[rip]
	add	eax, 1
	mov	DWORD PTR xedCnt[rip], eax
	mov	eax, DWORD PTR xingCnt[rip]
	sub	eax, 1
	mov	DWORD PTR xingCnt[rip], eax
	mov	eax, DWORD PTR toBwaitCnt[rip]
	test	eax, eax
	je	.L23
	mov	edx, DWORD PTR xingCnt[rip]
	mov	eax, DWORD PTR xedCnt[rip]
	add	eax, edx
	cmp	eax, 5
	jle	.L24
	mov	edx, DWORD PTR xedCnt[rip]
	mov	eax, DWORD PTR xingCnt[rip]
	add	eax, edx
	cmp	eax, 9
	jle	.L23
	mov	eax, DWORD PTR toAwaitCnt[rip]
	test	eax, eax
	jne	.L23
.L24:
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC22[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, toB[rip]
	call	semSignal
	jmp	.L25
.L23:
	mov	eax, DWORD PTR xingCnt[rip]
	test	eax, eax
	jne	.L26
	mov	eax, DWORD PTR toAwaitCnt[rip]
	test	eax, eax
	je	.L26
	mov	eax, DWORD PTR toBwaitCnt[rip]
	test	eax, eax
	je	.L27
	mov	edx, DWORD PTR xedCnt[rip]
	mov	eax, DWORD PTR toBwaitCnt[rip]
	add	eax, edx
	cmp	eax, 9
	jle	.L26
.L27:
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC23[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC24[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR xingDir[rip], 2
	mov	DWORD PTR xedCnt[rip], 0
	lea	rdi, toA[rip]
	call	semSignal
	jmp	.L25
.L26:
	mov	eax, DWORD PTR xingCnt[rip]
	test	eax, eax
	jne	.L28
	mov	eax, DWORD PTR toBwaitCnt[rip]
	test	eax, eax
	jne	.L28
	mov	eax, DWORD PTR toAwaitCnt[rip]
	test	eax, eax
	jne	.L28
	mov	DWORD PTR xingDir[rip], 0
	mov	DWORD PTR xedCnt[rip], 0
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC25[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	semSignal
	jmp	.L25
.L28:
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC26[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	semSignal
.L25:
	lea	rax, -32[rbp]
	mov	rsi, rax
	mov	edi, 4
	call	clock_gettime@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdx, QWORD PTR -56[rbp]
	sub	rax, rdx
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, rax
	movsd	xmm2, QWORD PTR .LC27[rip]
	movapd	xmm1, xmm0
	divsd	xmm1, xmm2
	mov	rax, QWORD PTR -32[rbp]
	mov	rdx, QWORD PTR -64[rbp]
	sub	rax, rdx
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, rax
	addsd	xmm0, xmm1
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, turnaroundTime[rip]
	movsd	QWORD PTR [rdx+rax], xmm0
	mov	rax, QWORD PTR -40[rbp]
	mov	rdx, QWORD PTR -56[rbp]
	sub	rax, rdx
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, rax
	movsd	xmm2, QWORD PTR .LC27[rip]
	movapd	xmm1, xmm0
	divsd	xmm1, xmm2
	mov	rax, QWORD PTR -48[rbp]
	mov	rdx, QWORD PTR -64[rbp]
	sub	rax, rdx
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, rax
	addsd	xmm0, xmm1
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, responseTime[rip]
	movsd	QWORD PTR [rdx+rax], xmm0
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE7:
	.size	b, .-b
	.section	.rodata
	.align 8
.LC28:
	.string	"****\nThread %d: About to across from B to A \n"
.LC29:
	.string	"%d is Crossing from B to A\n"
	.align 8
.LC30:
	.string	"%d was waiting until signal call."
	.align 8
.LC31:
	.string	"%d: Signaling customer Crossing to A\n"
	.align 8
.LC32:
	.string	"%d: Changing Direction to turn toward B\n"
	.align 8
.LC33:
	.string	"Signaling customer waiting to cross to B"
	.text
	.globl	a
	.type	a, @function
a:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 96
	mov	QWORD PTR -88[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -88[rbp]
	mov	QWORD PTR -72[rbp], rax
	mov	rax, QWORD PTR -72[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -76[rbp], eax
	lea	rax, -64[rbp]
	mov	rsi, rax
	mov	edi, 4
	call	clock_gettime@PLT
	lea	rdi, mutex[rip]
	call	semWait
	jmp	.L31
.L32:
	lea	rdi, mutex[rip]
	call	semSignal
	mov	edi, 1
	call	sleep@PLT
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR xingDir[rip]
	cmp	eax, 2
	jne	.L31
	lea	rdi, toB[rip]
	call	semSignal
.L31:
	mov	eax, DWORD PTR xingCnt[rip]
	cmp	eax, 6
	jg	.L32
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC28[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR xingDir[rip]
	test	eax, eax
	je	.L33
	mov	eax, DWORD PTR xingDir[rip]
	cmp	eax, 2
	jne	.L34
.L33:
	mov	eax, DWORD PTR xingCnt[rip]
	cmp	eax, 5
	jg	.L34
	mov	edx, DWORD PTR xedCnt[rip]
	mov	eax, DWORD PTR xingCnt[rip]
	add	eax, edx
	cmp	eax, 9
	jg	.L34
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC29[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR xingDir[rip], 2
	mov	eax, DWORD PTR xingCnt[rip]
	add	eax, 1
	mov	DWORD PTR xingCnt[rip], eax
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	semSignal
	jmp	.L35
.L34:
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC14[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR toAwaitCnt[rip]
	add	eax, 1
	mov	DWORD PTR toAwaitCnt[rip], eax
	lea	rdi, toA[rip]
	call	semWait
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC30[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC16[rip]
	call	puts@PLT
	mov	eax, DWORD PTR toAwaitCnt[rip]
	sub	eax, 1
	mov	DWORD PTR toAwaitCnt[rip], eax
	mov	eax, DWORD PTR xingCnt[rip]
	add	eax, 1
	mov	DWORD PTR xingCnt[rip], eax
	mov	DWORD PTR xingDir[rip], 2
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC17[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, toA[rip]
	call	semSignal
	lea	rdi, mutex[rip]
	call	semSignal
.L35:
	lea	rax, -48[rbp]
	mov	rsi, rax
	mov	edi, 4
	call	clock_gettime@PLT
	mov	edi, 1
	call	sleep@PLT
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, DWORD PTR xingDir[rip]
	mov	esi, DWORD PTR toBwaitCnt[rip]
	mov	ecx, DWORD PTR toAwaitCnt[rip]
	mov	edx, DWORD PTR xedCnt[rip]
	mov	eax, DWORD PTR xingCnt[rip]
	mov	r9d, edi
	mov	r8d, esi
	mov	esi, eax
	lea	rdi, .LC20[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	semWait
	lea	rdi, .LC21[rip]
	call	puts@PLT
	mov	eax, DWORD PTR xedCnt[rip]
	add	eax, 1
	mov	DWORD PTR xedCnt[rip], eax
	mov	eax, DWORD PTR xingCnt[rip]
	sub	eax, 1
	mov	DWORD PTR xingCnt[rip], eax
	mov	eax, DWORD PTR toAwaitCnt[rip]
	test	eax, eax
	je	.L36
	mov	edx, DWORD PTR xingCnt[rip]
	mov	eax, DWORD PTR xedCnt[rip]
	add	eax, edx
	cmp	eax, 5
	jle	.L37
	mov	edx, DWORD PTR xedCnt[rip]
	mov	eax, DWORD PTR xingCnt[rip]
	add	eax, edx
	cmp	eax, 9
	jle	.L36
	mov	eax, DWORD PTR toBwaitCnt[rip]
	test	eax, eax
	jne	.L36
.L37:
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC31[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, toA[rip]
	call	semSignal
	jmp	.L38
.L36:
	mov	eax, DWORD PTR xingCnt[rip]
	test	eax, eax
	jne	.L39
	mov	eax, DWORD PTR toBwaitCnt[rip]
	test	eax, eax
	je	.L39
	mov	eax, DWORD PTR toAwaitCnt[rip]
	test	eax, eax
	je	.L40
	mov	edx, DWORD PTR xedCnt[rip]
	mov	eax, DWORD PTR toBwaitCnt[rip]
	add	eax, edx
	cmp	eax, 9
	jle	.L39
.L40:
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC32[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC33[rip]
	call	puts@PLT
	mov	DWORD PTR xingDir[rip], 1
	mov	DWORD PTR xedCnt[rip], 0
	lea	rdi, toB[rip]
	call	semSignal
	jmp	.L38
.L39:
	mov	eax, DWORD PTR xingCnt[rip]
	test	eax, eax
	jne	.L41
	mov	eax, DWORD PTR toBwaitCnt[rip]
	test	eax, eax
	jne	.L41
	mov	eax, DWORD PTR toAwaitCnt[rip]
	test	eax, eax
	jne	.L41
	mov	DWORD PTR xingDir[rip], 0
	mov	DWORD PTR xedCnt[rip], 0
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC25[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	semSignal
	jmp	.L38
.L41:
	mov	eax, DWORD PTR -76[rbp]
	mov	esi, eax
	lea	rdi, .LC26[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	semSignal
.L38:
	lea	rax, -32[rbp]
	mov	rsi, rax
	mov	edi, 4
	call	clock_gettime@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdx, QWORD PTR -56[rbp]
	sub	rax, rdx
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, rax
	movsd	xmm2, QWORD PTR .LC27[rip]
	movapd	xmm1, xmm0
	divsd	xmm1, xmm2
	mov	rax, QWORD PTR -32[rbp]
	mov	rdx, QWORD PTR -64[rbp]
	sub	rax, rdx
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, rax
	addsd	xmm0, xmm1
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, turnaroundTime[rip]
	movsd	QWORD PTR [rdx+rax], xmm0
	mov	rax, QWORD PTR -40[rbp]
	mov	rdx, QWORD PTR -56[rbp]
	sub	rax, rdx
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, rax
	movsd	xmm2, QWORD PTR .LC27[rip]
	movapd	xmm1, xmm0
	divsd	xmm1, xmm2
	mov	rax, QWORD PTR -48[rbp]
	mov	rdx, QWORD PTR -64[rbp]
	sub	rax, rdx
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, rax
	addsd	xmm0, xmm1
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, responseTime[rip]
	movsd	QWORD PTR [rdx+rax], xmm0
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE8:
	.size	a, .-a
	.section	.rodata
.LC34:
	.string	"sem_wait is smaller than 0!"
	.text
	.globl	semWait
	.type	semWait, @function
semWait:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	test	eax, eax
	jns	.L45
	lea	rdi, .LC34[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L45:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	semWait, .-semWait
	.section	.rodata
.LC35:
	.string	"sem_post is smaller than 0!"
	.text
	.globl	semSignal
	.type	semSignal, @function
semSignal:
.LFB10:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	test	eax, eax
	jns	.L48
	lea	rdi, .LC35[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L48:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	semSignal, .-semSignal
	.section	.rodata
	.align 8
.LC7:
	.long	0
	.long	1077149696
	.align 8
.LC27:
	.long	0
	.long	1104006501
	.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	"86001.c"
	.text
	.comm	toA,16,4
	.comm	toB,16,4
	.comm	mutex,16,4
	.comm	xingCnt,4,4
	.comm	xedCnt,4,4
	.comm	toAwaitCnt,4,4
	.comm	toBwaitCnt,4,4
	.comm	xingDir,4,4
	.comm	turnaroundTime,160,8
	.comm	avgTurnaroundTime,8,8
	.comm	responseTime,160,8
	.comm	avgResponseTime,8,8
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Project 2: Customer crossing problem using pThreads"
	.ascii	" and Semaphores\000"
	.align	2
.LC1:
	.ascii	"*****************\012\000"
	.align	2
.LC2:
	.ascii	"error! %d\000"
	.align	2
.LC3:
	.ascii	"Parent Process PID: %d \012\000"
	.align	2
.LC4:
	.ascii	"error in calling pthread_create, %d\012\000"
	.align	2
.LC5:
	.ascii	"error in calling pthread_join, %d\012\000"
	.global	__aeabi_dadd
	.global	__aeabi_ddiv
	.align	2
.LC6:
	.ascii	"\012 The average Turnaroud time for %d customers is"
	.ascii	" %f seconds \012\000"
	.align	2
.LC7:
	.ascii	"\012 The average Response time for %d customers is "
	.ascii	"%f seconds \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 = 208
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #208
	ldr	r3, .L17
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r0, .L17+4
	bl	puts
	ldr	r0, .L17+8
	bl	puts
	ldr	r3, .L17+12
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	mov	r3, #0
	str	r3, [fp, #-192]
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L17+16
	bl	sem_init
	mov	r3, r0
	cmp	r3, #0
	blt	.L2
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L17+20
	bl	sem_init
	mov	r3, r0
	cmp	r3, #0
	blt	.L2
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L17+24
	bl	sem_init
	mov	r3, r0
	cmp	r3, #0
	bge	.L3
.L2:
	ldr	r1, [fp, #-192]
	ldr	r0, .L17+28
	bl	printf
	mov	r0, #1
	bl	exit
.L3:
	bl	getpid
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L17+32
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-208]
	b	.L4
.L9:
	ldr	r3, [fp, #-208]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r2, [fp, #-208]
	str	r2, [r3, #-164]
	bl	rand
	mov	r3, r0
	cmp	r3, #0
	and	r3, r3, #1
	rsblt	r3, r3, #0
	cmp	r3, #1
	bne	.L5
	ldr	r3, .L17+36
	str	r3, [fp, #-204]
	b	.L6
.L5:
	ldr	r3, .L17+40
	str	r3, [fp, #-204]
.L6:
	sub	r2, fp, #88
	ldr	r3, [fp, #-208]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r1, [fp, #-204]
	sub	r2, fp, #168
	ldr	r3, [fp, #-208]
	lsl	r3, r3, #2
	add	r3, r2, r3
	mov	r2, r1
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-192]
	ldr	r3, [fp, #-192]
	cmp	r3, #0
	beq	.L7
	ldr	r1, [fp, #-192]
	ldr	r0, .L17+44
	bl	printf
	mov	r3, #1
	b	.L15
.L7:
	ldr	r3, [fp, #-208]
	add	r3, r3, #1
	str	r3, [fp, #-208]
.L4:
	ldr	r3, [fp, #-208]
	cmp	r3, #19
	ble	.L9
	mov	r3, #0
	str	r3, [fp, #-200]
	b	.L10
.L12:
	ldr	r3, [fp, #-200]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-84]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	str	r0, [fp, #-192]
	ldr	r3, [fp, #-192]
	cmp	r3, #0
	beq	.L11
	ldr	r1, [fp, #-192]
	ldr	r0, .L17+48
	bl	printf
	mov	r3, #1
	b	.L15
.L11:
	ldr	r3, [fp, #-200]
	add	r3, r3, #1
	str	r3, [fp, #-200]
.L10:
	ldr	r3, [fp, #-200]
	cmp	r3, #19
	ble	.L12
	mov	r2, #0
	mov	r3, #0
	str	r2, [fp, #-188]
	str	r3, [fp, #-184]
	mov	r2, #0
	mov	r3, #0
	str	r2, [fp, #-180]
	str	r3, [fp, #-176]
	mov	r3, #0
	str	r3, [fp, #-196]
	b	.L13
.L14:
	ldr	r2, .L17+52
	ldr	r3, [fp, #-196]
	lsl	r3, r3, #3
	add	r3, r2, r3
	ldmia	r3, {r2-r3}
	sub	r1, fp, #188
	ldmia	r1, {r0-r1}
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-188]
	str	r3, [fp, #-184]
	ldr	r2, .L17+56
	ldr	r3, [fp, #-196]
	lsl	r3, r3, #3
	add	r3, r2, r3
	ldmia	r3, {r2-r3}
	sub	r1, fp, #180
	ldmia	r1, {r0-r1}
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-180]
	str	r3, [fp, #-176]
	ldr	r3, [fp, #-196]
	add	r3, r3, #1
	str	r3, [fp, #-196]
.L13:
	ldr	r3, [fp, #-196]
	cmp	r3, #19
	ble	.L14
	mov	r2, #0
	ldr	r3, .L17+60
	sub	r1, fp, #188
	ldmia	r1, {r0-r1}
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	ldr	r1, .L17+64
	stm	r1, {r2-r3}
	mov	r2, #0
	ldr	r3, .L17+60
	sub	r1, fp, #180
	ldmia	r1, {r0-r1}
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	ldr	r1, .L17+68
	stm	r1, {r2-r3}
	ldr	r3, .L17+68
	ldmia	r3, {r2-r3}
	mov	r1, #20
	ldr	r0, .L17+72
	bl	printf
	ldr	r3, .L17+64
	ldmia	r3, {r2-r3}
	mov	r1, #20
	ldr	r0, .L17+76
	bl	printf
	mov	r3, #0
.L15:
	ldr	r2, .L17
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L16
	bl	__stack_chk_fail
.L16:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L18:
	.align	2
.L17:
	.word	.LC8
	.word	.LC0
	.word	.LC1
	.word	stdout
	.word	mutex
	.word	toA
	.word	toB
	.word	.LC2
	.word	.LC3
	.word	a
	.word	b
	.word	.LC4
	.word	.LC5
	.word	responseTime
	.word	turnaroundTime
	.word	1077149696
	.word	avgResponseTime
	.word	avgTurnaroundTime
	.word	.LC6
	.word	.LC7
	.size	main, .-main
	.section	.rodata
	.align	2
.LC9:
	.ascii	"\012 Thread: %d crossing count larger than maxStair"
	.ascii	"s \012\000"
	.align	2
.LC10:
	.ascii	"****\012Thread %d: About to across from A to B \012"
	.ascii	"\000"
	.align	2
.LC11:
	.ascii	"%d is Crossing from A to B\012\000"
	.align	2
.LC12:
	.ascii	"%d Signaling Mutex\012\000"
	.align	2
.LC13:
	.ascii	"%d is now supposed to wait\012\000"
	.align	2
.LC14:
	.ascii	"%d was waiting until signal call\000"
	.align	2
.LC15:
	.ascii	"Signal has been called \000"
	.align	2
.LC16:
	.ascii	"%d is about to cross \012\000"
	.align	2
.LC17:
	.ascii	"Signaling Mutex\000"
	.align	2
.LC18:
	.ascii	"%d Crossing Finished. Waiting for mutex \012\000"
	.align	2
.LC19:
	.ascii	"\012 xingCnt: %d, xedCnt: %d, toAwaitCnt: %d, toBwa"
	.ascii	"itCnt: %d, xingDir: %d \012\000"
	.align	2
.LC20:
	.ascii	"Mutex Passed\000"
	.align	2
.LC21:
	.ascii	"%d is Signaling customer Crossing to B\012\000"
	.align	2
.LC22:
	.ascii	"%d is Changing Direction to turn toward A\012\000"
	.align	2
.LC23:
	.ascii	"%d is Signaling customer waiting to cross to A\012\000"
	.align	2
.LC24:
	.ascii	"%d: Crossing Direction Reset \012\000"
	.align	2
.LC25:
	.ascii	"%d: Signaling Mutex\012\000"
	.global	__aeabi_i2d
	.align	2
.LC26:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	b
	.syntax unified
	.arm
	.fpu softvfp
	.type	b, %function
b:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, fp, lr}
	add	fp, sp, #12
	sub	sp, sp, #56
	str	r0, [fp, #-56]
	ldr	r3, .L32
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	ldr	r3, [fp, #-56]
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-48]
	ldr	r3, [r3]
	str	r3, [fp, #-44]
	sub	r3, fp, #40
	mov	r1, r3
	mov	r0, #4
	bl	clock_gettime
	ldr	r0, .L32+4
	bl	semWait
	b	.L20
.L21:
	ldr	r0, .L32+4
	bl	semSignal
	mov	r0, #1
	bl	sleep
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+8
	bl	printf
	ldr	r3, .L32+12
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L20
	ldr	r0, .L32+16
	bl	semSignal
.L20:
	ldr	r3, .L32+20
	ldr	r3, [r3]
	cmp	r3, #6
	bgt	.L21
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+24
	bl	printf
	ldr	r3, .L32+12
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L22
	ldr	r3, .L32+12
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L23
.L22:
	ldr	r3, .L32+20
	ldr	r3, [r3]
	cmp	r3, #5
	bgt	.L23
	ldr	r3, .L32+28
	ldr	r2, [r3]
	ldr	r3, .L32+20
	ldr	r3, [r3]
	add	r3, r2, r3
	cmp	r3, #9
	bgt	.L23
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+32
	bl	printf
	ldr	r3, .L32+12
	mov	r2, #1
	str	r2, [r3]
	ldr	r3, .L32+20
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L32+20
	str	r3, [r2]
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+36
	bl	printf
	ldr	r0, .L32+4
	bl	semSignal
	b	.L24
.L23:
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+40
	bl	printf
	ldr	r3, .L32+44
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L32+44
	str	r3, [r2]
	ldr	r0, .L32+48
	bl	semWait
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+52
	bl	printf
	ldr	r0, .L32+56
	bl	puts
	ldr	r3, .L32+44
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L32+44
	str	r3, [r2]
	ldr	r3, .L32+20
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L32+20
	str	r3, [r2]
	ldr	r3, .L32+12
	mov	r2, #1
	str	r2, [r3]
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+60
	bl	printf
	ldr	r0, .L32+64
	bl	puts
	ldr	r0, .L32+48
	bl	semSignal
	ldr	r0, .L32+4
	bl	semSignal
.L24:
	sub	r3, fp, #32
	mov	r1, r3
	mov	r0, #4
	bl	clock_gettime
	mov	r0, #1
	bl	sleep
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+68
	bl	printf
	ldr	r3, .L32+20
	ldr	r1, [r3]
	ldr	r3, .L32+28
	ldr	r0, [r3]
	ldr	r3, .L32+72
	ldr	ip, [r3]
	ldr	r3, .L32+44
	ldr	r3, [r3]
	ldr	r2, .L32+12
	ldr	r2, [r2]
	str	r2, [sp, #4]
	str	r3, [sp]
	mov	r3, ip
	mov	r2, r0
	ldr	r0, .L32+76
	bl	printf
	ldr	r0, .L32+4
	bl	semWait
	ldr	r0, .L32+80
	bl	puts
	ldr	r3, .L32+28
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L32+28
	str	r3, [r2]
	ldr	r3, .L32+20
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L32+20
	str	r3, [r2]
	ldr	r3, .L32+44
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L25
	ldr	r3, .L32+20
	ldr	r2, [r3]
	ldr	r3, .L32+28
	ldr	r3, [r3]
	add	r3, r2, r3
	cmp	r3, #5
	ble	.L26
	ldr	r3, .L32+28
	ldr	r2, [r3]
	ldr	r3, .L32+20
	ldr	r3, [r3]
	add	r3, r2, r3
	cmp	r3, #9
	ble	.L25
	ldr	r3, .L32+72
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L25
.L26:
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+84
	bl	printf
	ldr	r0, .L32+48
	bl	semSignal
	b	.L27
.L25:
	ldr	r3, .L32+20
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L28
	ldr	r3, .L32+72
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L28
	ldr	r3, .L32+44
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L29
	ldr	r3, .L32+28
	ldr	r2, [r3]
	ldr	r3, .L32+44
	ldr	r3, [r3]
	add	r3, r2, r3
	cmp	r3, #9
	ble	.L28
.L29:
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+88
	bl	printf
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+92
	bl	printf
	ldr	r3, .L32+12
	mov	r2, #2
	str	r2, [r3]
	ldr	r3, .L32+28
	mov	r2, #0
	str	r2, [r3]
	ldr	r0, .L32+16
	bl	semSignal
	b	.L27
.L28:
	ldr	r3, .L32+20
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L30
	ldr	r3, .L32+44
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L30
	ldr	r3, .L32+72
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L30
	ldr	r3, .L32+12
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L32+28
	mov	r2, #0
	str	r2, [r3]
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+96
	bl	printf
	ldr	r0, .L32+4
	bl	semSignal
	b	.L27
.L30:
	ldr	r1, [fp, #-44]
	ldr	r0, .L32+100
	bl	printf
	ldr	r0, .L32+4
	bl	semSignal
.L27:
	sub	r3, fp, #24
	mov	r1, r3
	mov	r0, #4
	bl	clock_gettime
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-36]
	sub	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, #0
	ldr	r3, .L32+104
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	mov	r4, r2
	mov	r5, r3
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-40]
	sub	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L32+108
	ldr	r1, [fp, #-44]
	lsl	r1, r1, #3
	add	r1, r0, r1
	stm	r1, {r2-r3}
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-36]
	sub	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, #0
	ldr	r3, .L32+104
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	mov	r4, r2
	mov	r5, r3
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-40]
	sub	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L32+112
	ldr	r1, [fp, #-44]
	lsl	r1, r1, #3
	add	r1, r0, r1
	stm	r1, {r2-r3}
	mov	r0, #0
	bl	pthread_exit
.L33:
	.align	2
.L32:
	.word	.LC26
	.word	mutex
	.word	.LC9
	.word	xingDir
	.word	toA
	.word	xingCnt
	.word	.LC10
	.word	xedCnt
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	toBwaitCnt
	.word	toB
	.word	.LC14
	.word	.LC15
	.word	.LC16
	.word	.LC17
	.word	.LC18
	.word	toAwaitCnt
	.word	.LC19
	.word	.LC20
	.word	.LC21
	.word	.LC22
	.word	.LC23
	.word	.LC24
	.word	.LC25
	.word	1104006501
	.word	turnaroundTime
	.word	responseTime
	.size	b, .-b
	.section	.rodata
	.align	2
.LC27:
	.ascii	"****\012Thread %d: About to across from B to A \012"
	.ascii	"\000"
	.align	2
.LC28:
	.ascii	"%d is Crossing from B to A\012\000"
	.align	2
.LC29:
	.ascii	"%d was waiting until signal call.\000"
	.align	2
.LC30:
	.ascii	"%d: Signaling customer Crossing to A\012\000"
	.align	2
.LC31:
	.ascii	"%d: Changing Direction to turn toward B\012\000"
	.align	2
.LC32:
	.ascii	"Signaling customer waiting to cross to B\000"
	.align	2
.LC33:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	a
	.syntax unified
	.arm
	.fpu softvfp
	.type	a, %function
a:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, fp, lr}
	add	fp, sp, #12
	sub	sp, sp, #56
	str	r0, [fp, #-56]
	ldr	r3, .L47
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	ldr	r3, [fp, #-56]
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-48]
	ldr	r3, [r3]
	str	r3, [fp, #-44]
	sub	r3, fp, #40
	mov	r1, r3
	mov	r0, #4
	bl	clock_gettime
	ldr	r0, .L47+4
	bl	semWait
	b	.L35
.L36:
	ldr	r0, .L47+4
	bl	semSignal
	mov	r0, #1
	bl	sleep
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+8
	bl	printf
	ldr	r3, .L47+12
	ldr	r3, [r3]
	cmp	r3, #2
	bne	.L35
	ldr	r0, .L47+16
	bl	semSignal
.L35:
	ldr	r3, .L47+20
	ldr	r3, [r3]
	cmp	r3, #6
	bgt	.L36
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+24
	bl	printf
	ldr	r3, .L47+12
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L37
	ldr	r3, .L47+12
	ldr	r3, [r3]
	cmp	r3, #2
	bne	.L38
.L37:
	ldr	r3, .L47+20
	ldr	r3, [r3]
	cmp	r3, #5
	bgt	.L38
	ldr	r3, .L47+28
	ldr	r2, [r3]
	ldr	r3, .L47+20
	ldr	r3, [r3]
	add	r3, r2, r3
	cmp	r3, #9
	bgt	.L38
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+32
	bl	printf
	ldr	r3, .L47+12
	mov	r2, #2
	str	r2, [r3]
	ldr	r3, .L47+20
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L47+20
	str	r3, [r2]
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+36
	bl	printf
	ldr	r0, .L47+4
	bl	semSignal
	b	.L39
.L38:
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+40
	bl	printf
	ldr	r3, .L47+44
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L47+44
	str	r3, [r2]
	ldr	r0, .L47+48
	bl	semWait
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+52
	bl	printf
	ldr	r0, .L47+56
	bl	puts
	ldr	r3, .L47+44
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L47+44
	str	r3, [r2]
	ldr	r3, .L47+20
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L47+20
	str	r3, [r2]
	ldr	r3, .L47+12
	mov	r2, #2
	str	r2, [r3]
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+60
	bl	printf
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+36
	bl	printf
	ldr	r0, .L47+48
	bl	semSignal
	ldr	r0, .L47+4
	bl	semSignal
.L39:
	sub	r3, fp, #32
	mov	r1, r3
	mov	r0, #4
	bl	clock_gettime
	mov	r0, #1
	bl	sleep
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+64
	bl	printf
	ldr	r3, .L47+20
	ldr	r1, [r3]
	ldr	r3, .L47+28
	ldr	r0, [r3]
	ldr	r3, .L47+44
	ldr	ip, [r3]
	ldr	r3, .L47+68
	ldr	r3, [r3]
	ldr	r2, .L47+12
	ldr	r2, [r2]
	str	r2, [sp, #4]
	str	r3, [sp]
	mov	r3, ip
	mov	r2, r0
	ldr	r0, .L47+72
	bl	printf
	ldr	r0, .L47+4
	bl	semWait
	ldr	r0, .L47+76
	bl	puts
	ldr	r3, .L47+28
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L47+28
	str	r3, [r2]
	ldr	r3, .L47+20
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L47+20
	str	r3, [r2]
	ldr	r3, .L47+44
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L40
	ldr	r3, .L47+20
	ldr	r2, [r3]
	ldr	r3, .L47+28
	ldr	r3, [r3]
	add	r3, r2, r3
	cmp	r3, #5
	ble	.L41
	ldr	r3, .L47+28
	ldr	r2, [r3]
	ldr	r3, .L47+20
	ldr	r3, [r3]
	add	r3, r2, r3
	cmp	r3, #9
	ble	.L40
	ldr	r3, .L47+68
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L40
.L41:
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+80
	bl	printf
	ldr	r0, .L47+48
	bl	semSignal
	b	.L42
.L40:
	ldr	r3, .L47+20
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L43
	ldr	r3, .L47+68
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L43
	ldr	r3, .L47+44
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L44
	ldr	r3, .L47+28
	ldr	r2, [r3]
	ldr	r3, .L47+68
	ldr	r3, [r3]
	add	r3, r2, r3
	cmp	r3, #9
	ble	.L43
.L44:
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+84
	bl	printf
	ldr	r0, .L47+88
	bl	puts
	ldr	r3, .L47+12
	mov	r2, #1
	str	r2, [r3]
	ldr	r3, .L47+28
	mov	r2, #0
	str	r2, [r3]
	ldr	r0, .L47+16
	bl	semSignal
	b	.L42
.L43:
	ldr	r3, .L47+20
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L45
	ldr	r3, .L47+68
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L45
	ldr	r3, .L47+44
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L45
	ldr	r3, .L47+12
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L47+28
	mov	r2, #0
	str	r2, [r3]
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+92
	bl	printf
	ldr	r0, .L47+4
	bl	semSignal
	b	.L42
.L45:
	ldr	r1, [fp, #-44]
	ldr	r0, .L47+96
	bl	printf
	ldr	r0, .L47+4
	bl	semSignal
.L42:
	sub	r3, fp, #24
	mov	r1, r3
	mov	r0, #4
	bl	clock_gettime
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-36]
	sub	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, #0
	ldr	r3, .L47+100
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	mov	r4, r2
	mov	r5, r3
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-40]
	sub	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L47+104
	ldr	r1, [fp, #-44]
	lsl	r1, r1, #3
	add	r1, r0, r1
	stm	r1, {r2-r3}
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-36]
	sub	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, #0
	ldr	r3, .L47+100
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	mov	r4, r2
	mov	r5, r3
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-40]
	sub	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L47+108
	ldr	r1, [fp, #-44]
	lsl	r1, r1, #3
	add	r1, r0, r1
	stm	r1, {r2-r3}
	mov	r0, #0
	bl	pthread_exit
.L48:
	.align	2
.L47:
	.word	.LC33
	.word	mutex
	.word	.LC9
	.word	xingDir
	.word	toB
	.word	xingCnt
	.word	.LC27
	.word	xedCnt
	.word	.LC28
	.word	.LC12
	.word	.LC13
	.word	toAwaitCnt
	.word	toA
	.word	.LC29
	.word	.LC15
	.word	.LC16
	.word	.LC18
	.word	toBwaitCnt
	.word	.LC19
	.word	.LC20
	.word	.LC30
	.word	.LC31
	.word	.LC32
	.word	.LC24
	.word	.LC25
	.word	1104006501
	.word	turnaroundTime
	.word	responseTime
	.size	a, .-a
	.section	.rodata
	.align	2
.LC34:
	.ascii	"sem_wait is smaller than 0!\000"
	.text
	.align	2
	.global	semWait
	.syntax unified
	.arm
	.fpu softvfp
	.type	semWait, %function
semWait:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r0, [fp, #-8]
	bl	sem_wait
	mov	r3, r0
	cmp	r3, #0
	bge	.L51
	ldr	r0, .L52
	bl	printf
	mov	r0, #1
	bl	exit
.L51:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L53:
	.align	2
.L52:
	.word	.LC34
	.size	semWait, .-semWait
	.section	.rodata
	.align	2
.LC35:
	.ascii	"sem_post is smaller than 0!\000"
	.text
	.align	2
	.global	semSignal
	.syntax unified
	.arm
	.fpu softvfp
	.type	semSignal, %function
semSignal:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r0, [fp, #-8]
	bl	sem_post
	mov	r3, r0
	cmp	r3, #0
	bge	.L56
	ldr	r0, .L57
	bl	printf
	mov	r0, #1
	bl	exit
.L56:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L58:
	.align	2
.L57:
	.word	.LC35
	.size	semSignal, .-semSignal
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
