	.file	"314607.c"
	.intel_syntax noprefix
	.text
	.globl	sockfd
	.bss
	.align 4
	.type	sockfd, @object
	.size	sockfd, 4
sockfd:
	.zero	4
	.globl	clients
	.align 4
	.type	clients, @object
	.size	clients, 4
clients:
	.zero	4
	.section	.rodata
.LC0:
	.string	"ERROR opening socket"
.LC1:
	.string	"ERROR on binding"
.LC2:
	.string	"ERROR on accept"
	.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, 336
	mov	DWORD PTR -324[rbp], edi
	mov	QWORD PTR -336[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edx, 0
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR -312[rbp], eax
	cmp	DWORD PTR -312[rbp], 0
	jns	.L2
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	eax, DWORD PTR -312[rbp]
	mov	edi, eax
	mov	eax, 0
	call	close_sock
	mov	edi, 1
	call	exit@PLT
.L2:
	lea	rax, -304[rbp]
	mov	QWORD PTR [rax], 0
	mov	QWORD PTR 8[rax], 0
	mov	WORD PTR -318[rbp], 5001
	mov	WORD PTR -304[rbp], 2
	mov	DWORD PTR -300[rbp], 0
	movzx	eax, WORD PTR -318[rbp]
	mov	edi, eax
	call	htons@PLT
	mov	WORD PTR -302[rbp], ax
	lea	rcx, -304[rbp]
	mov	eax, DWORD PTR -312[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	bind@PLT
	test	eax, eax
	jns	.L3
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	mov	eax, DWORD PTR -312[rbp]
	mov	esi, 5
	mov	edi, eax
	call	listen@PLT
	mov	DWORD PTR -316[rbp], 16
	lea	rdx, -316[rbp]
	lea	rcx, -288[rbp]
	mov	eax, DWORD PTR -312[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	accept@PLT
	mov	DWORD PTR -308[rbp], eax
	cmp	DWORD PTR -308[rbp], 0
	jns	.L4
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	eax, DWORD PTR -312[rbp]
	mov	edi, eax
	mov	eax, 0
	call	close_sock
	mov	edi, 1
	call	exit@PLT
.L4:
	mov	eax, DWORD PTR -312[rbp]
	mov	edi, eax
	mov	eax, 0
	call	close_sock
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC3:
	.string	"Server is closing\r"
.LC4:
	.string	"Closing clients\r"
.LC5:
	.string	"Server is closing"
	.text
	.globl	close_sock
	.type	close_sock, @function
close_sock:
.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, 16
	mov	DWORD PTR -4[rbp], edi
	lea	rdi, .LC3[rip]
	call	puts@PLT
	jmp	.L8
.L9:
	lea	rdi, .LC4[rip]
	call	puts@PLT
	mov	edi, 1
	call	sleep@PLT
.L8:
	mov	eax, DWORD PTR clients[rip]
	test	eax, eax
	jne	.L9
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, 2
	mov	edi, eax
	call	shutdown@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	close@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	close_sock, .-close_sock
	.section	.rodata
.LC6:
	.string	"Thread closing\r"
	.text
	.globl	thread_close
	.type	thread_close, @function
thread_close:
.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, 16
	mov	DWORD PTR -4[rbp], edi
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, 2
	mov	edi, eax
	call	shutdown@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, DWORD PTR clients[rip]
	sub	eax, 1
	mov	DWORD PTR clients[rip], eax
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE8:
	.size	thread_close, .-thread_close
	.section	.rodata
.LC7:
	.string	"Client disconnected"
.LC8:
	.string	"Fail read"
	.text
	.globl	connection_handler
	.type	connection_handler, @function
connection_handler:
.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, 304
	mov	QWORD PTR -296[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -296[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -280[rbp], eax
	jmp	.L12
.L13:
	lea	rax, -272[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	rdx, rax
	lea	rcx, -272[rbp]
	mov	eax, DWORD PTR -280[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	lea	rax, -272[rbp]
	mov	rdi, rax
	call	puts@PLT
.L12:
	lea	rcx, -272[rbp]
	mov	eax, DWORD PTR -280[rbp]
	mov	edx, 256
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	mov	DWORD PTR -276[rbp], eax
	cmp	DWORD PTR -276[rbp], 0
	jg	.L13
	cmp	DWORD PTR -276[rbp], 0
	jne	.L14
	lea	rdi, .LC7[rip]
	call	puts@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	jmp	.L15
.L14:
	cmp	DWORD PTR -276[rbp], -1
	jne	.L15
	lea	rdi, .LC8[rip]
	call	perror@PLT
.L15:
	mov	eax, DWORD PTR -280[rbp]
	mov	edi, eax
	call	thread_close
	nop
	nop
	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
.LFE9:
	.size	connection_handler, .-connection_handler
	.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	"314607.c"
	.text
	.comm	sockfd,4,4
	.global	clients
	.bss
	.align	2
	.type	clients, %object
	.size	clients, 4
clients:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"ERROR opening socket\000"
	.align	2
.LC1:
	.ascii	"ERROR on binding\000"
	.align	2
.LC2:
	.ascii	"ERROR on accept\000"
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 320
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #320
	str	r0, [fp, #-320]
	str	r1, [fp, #-324]
	ldr	r3, .L7
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r2, #0
	mov	r1, #1
	mov	r0, #2
	bl	socket
	str	r0, [fp, #-304]
	ldr	r3, [fp, #-304]
	cmp	r3, #0
	bge	.L2
	ldr	r0, .L7+4
	bl	perror
	ldr	r0, [fp, #-304]
	bl	close_sock
	mov	r0, #1
	bl	exit
.L2:
	sub	r3, fp, #296
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2]
	str	r3, [r2, #4]
	str	r3, [r2, #8]
	str	r3, [r2, #12]
	sub	r3, fp, #4
	sub	r3, r3, #304
	sub	r3, r3, #2
	ldr	r2, .L7+8
	strh	r2, [r3]	@ movhi
	sub	r3, fp, #4
	sub	r3, r3, #292
	mov	r2, #2
	strh	r2, [r3]	@ movhi
	mov	r3, #0
	str	r3, [fp, #-292]
	sub	r3, fp, #4
	sub	r3, r3, #304
	sub	r3, r3, #2
	ldrh	r3, [r3]
	mov	r0, r3
	bl	htons
	mov	r3, r0
	mov	r2, r3
	sub	r3, fp, #4
	sub	r3, r3, #292
	strh	r2, [r3, #2]	@ movhi
	sub	r3, fp, #296
	mov	r2, #16
	mov	r1, r3
	ldr	r0, [fp, #-304]
	bl	bind
	mov	r3, r0
	cmp	r3, #0
	bge	.L3
	ldr	r0, .L7+12
	bl	perror
	mov	r0, #1
	bl	exit
.L3:
	mov	r1, #5
	ldr	r0, [fp, #-304]
	bl	listen
	mov	r3, #16
	str	r3, [fp, #-308]
	sub	r2, fp, #308
	sub	r3, fp, #280
	mov	r1, r3
	ldr	r0, [fp, #-304]
	bl	accept
	str	r0, [fp, #-300]
	ldr	r3, [fp, #-300]
	cmp	r3, #0
	bge	.L4
	ldr	r0, .L7+16
	bl	perror
	ldr	r0, [fp, #-304]
	bl	close_sock
	mov	r0, #1
	bl	exit
.L4:
	ldr	r0, [fp, #-304]
	bl	close_sock
	mov	r3, #0
	ldr	r2, .L7
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L6
	bl	__stack_chk_fail
.L6:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L8:
	.align	2
.L7:
	.word	.LC3
	.word	.LC0
	.word	5001
	.word	.LC1
	.word	.LC2
	.size	main, .-main
	.section	.rodata
	.align	2
.LC4:
	.ascii	"Server is closing\015\000"
	.align	2
.LC5:
	.ascii	"Closing clients\015\000"
	.align	2
.LC6:
	.ascii	"Server is closing\000"
	.text
	.align	2
	.global	close_sock
	.syntax unified
	.arm
	.fpu softvfp
	.type	close_sock, %function
close_sock:
	@ 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, .L12
	bl	puts
	b	.L10
.L11:
	ldr	r0, .L12+4
	bl	puts
	mov	r0, #1
	bl	sleep
.L10:
	ldr	r3, .L12+8
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L11
	ldr	r0, .L12+12
	bl	puts
	mov	r1, #2
	ldr	r0, [fp, #-8]
	bl	shutdown
	ldr	r0, [fp, #-8]
	bl	close
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L13:
	.align	2
.L12:
	.word	.LC4
	.word	.LC5
	.word	clients
	.word	.LC6
	.size	close_sock, .-close_sock
	.section	.rodata
	.align	2
.LC7:
	.ascii	"Thread closing\015\000"
	.text
	.align	2
	.global	thread_close
	.syntax unified
	.arm
	.fpu softvfp
	.type	thread_close, %function
thread_close:
	@ 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, .L15
	bl	puts
	mov	r1, #2
	ldr	r0, [fp, #-8]
	bl	shutdown
	ldr	r0, [fp, #-8]
	bl	close
	ldr	r3, .L15+4
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L15+4
	str	r3, [r2]
	mov	r0, #0
	bl	pthread_exit
.L16:
	.align	2
.L15:
	.word	.LC7
	.word	clients
	.size	thread_close, .-thread_close
	.section	.rodata
	.align	2
.LC8:
	.ascii	"Client disconnected\000"
	.align	2
.LC9:
	.ascii	"Fail read\000"
	.align	2
.LC10:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	connection_handler
	.syntax unified
	.arm
	.fpu softvfp
	.type	connection_handler, %function
connection_handler:
	@ args = 0, pretend = 0, frame = 280
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #280
	str	r0, [fp, #-280]
	ldr	r3, .L24
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-280]
	ldr	r3, [r3]
	str	r3, [fp, #-272]
	b	.L18
.L19:
	sub	r3, fp, #264
	mov	r0, r3
	bl	strlen
	mov	r2, r0
	sub	r3, fp, #264
	mov	r1, r3
	ldr	r0, [fp, #-272]
	bl	write
	sub	r3, fp, #264
	mov	r0, r3
	bl	puts
.L18:
	sub	r3, fp, #264
	mov	r2, #256
	mov	r1, r3
	ldr	r0, [fp, #-272]
	bl	read
	str	r0, [fp, #-268]
	ldr	r3, [fp, #-268]
	cmp	r3, #0
	bgt	.L19
	ldr	r3, [fp, #-268]
	cmp	r3, #0
	bne	.L20
	ldr	r0, .L24+4
	bl	puts
	ldr	r3, .L24+8
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	b	.L21
.L20:
	ldr	r3, [fp, #-268]
	cmn	r3, #1
	bne	.L21
	ldr	r0, .L24+12
	bl	perror
.L21:
	ldr	r0, [fp, #-272]
	bl	thread_close
	nop
	nop
	ldr	r2, .L24
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L23
	bl	__stack_chk_fail
.L23:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	.LC10
	.word	.LC8
	.word	stdout
	.word	.LC9
	.size	connection_handler, .-connection_handler
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
