	.file	"819899.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"Usage ./echo-server [file]"
.LC1:
	.string	"w"
.LC2:
	.string	"file open"
.LC3:
	.string	"socket"
.LC4:
	.string	"bind"
.LC5:
	.string	"listen"
	.align 8
.LC6:
	.string	"accepting client connections on port %hu\n"
.LC7:
	.string	"accept"
.LC8:
	.string	"reading from client socket"
.LC9:
	.string	"read from socket: %zd bytes\n"
.LC10:
	.string	"writing to client socket"
.LC11:
	.string	"ending connection"
.LC12:
	.string	"close"
	.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, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 32
	mov	DWORD PTR -4116[rbp], edi
	mov	QWORD PTR -4128[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -4116[rbp], 2
	jle	.L2
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	syserr@PLT
.L2:
	cmp	DWORD PTR -4116[rbp], 1
	setg	al
	movzx	eax, al
	mov	DWORD PTR -4096[rbp], eax
	mov	DWORD PTR -4092[rbp], 1327
	cmp	DWORD PTR -4096[rbp], 1
	jne	.L3
	mov	rax, QWORD PTR -4128[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC1[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -4080[rbp], rax
	cmp	QWORD PTR -4080[rbp], 0
	jne	.L3
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	syserr@PLT
.L3:
	mov	edx, 0
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR -4088[rbp], eax
	cmp	DWORD PTR -4088[rbp], 0
	jns	.L4
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	syserr@PLT
.L4:
	mov	WORD PTR -4048[rbp], 2
	mov	edi, 0
	call	htonl@PLT
	mov	DWORD PTR -4044[rbp], eax
	mov	eax, DWORD PTR -4092[rbp]
	movzx	eax, ax
	mov	edi, eax
	call	htons@PLT
	mov	WORD PTR -4046[rbp], ax
	lea	rcx, -4048[rbp]
	mov	eax, DWORD PTR -4088[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	bind@PLT
	test	eax, eax
	jns	.L5
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	syserr@PLT
.L5:
	mov	eax, DWORD PTR -4088[rbp]
	mov	esi, 5
	mov	edi, eax
	call	listen@PLT
	test	eax, eax
	jns	.L6
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	syserr@PLT
.L6:
	movzx	eax, WORD PTR -4046[rbp]
	movzx	eax, ax
	mov	edi, eax
	call	ntohs@PLT
	movzx	eax, ax
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
.L14:
	mov	DWORD PTR -4100[rbp], 16
	lea	rdx, -4100[rbp]
	lea	rcx, -4032[rbp]
	mov	eax, DWORD PTR -4088[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	accept@PLT
	mov	DWORD PTR -4084[rbp], eax
	cmp	DWORD PTR -4084[rbp], 0
	jns	.L12
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	syserr@PLT
.L12:
	lea	rcx, -4016[rbp]
	mov	eax, DWORD PTR -4084[rbp]
	mov	edx, 2000
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	mov	QWORD PTR -4072[rbp], rax
	cmp	QWORD PTR -4072[rbp], 0
	jns	.L8
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	syserr@PLT
	jmp	.L9
.L8:
	cmp	DWORD PTR -4096[rbp], 0
	jne	.L10
	mov	rax, QWORD PTR -4072[rbp]
	mov	rsi, rax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L11
.L10:
	mov	rdx, QWORD PTR -4072[rbp]
	mov	rax, QWORD PTR -4080[rbp]
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rax, QWORD PTR -4080[rbp]
	mov	rdi, rax
	call	fflush@PLT
.L11:
	lea	rax, -2016[rbp]
	mov	edx, 2003
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	lea	rax, -2016[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	rdx, rax
	lea	rax, -2016[rbp]
	add	rax, rdx
	mov	DWORD PTR [rax], 3817805
	lea	rdx, -4016[rbp]
	lea	rax, -2016[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcat@PLT
	mov	rax, QWORD PTR -4072[rbp]
	add	rax, 3
	mov	QWORD PTR -4064[rbp], rax
	mov	rdx, QWORD PTR -4064[rbp]
	lea	rcx, -2016[rbp]
	mov	eax, DWORD PTR -4084[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	QWORD PTR -4056[rbp], rax
	mov	rax, QWORD PTR -4056[rbp]
	cmp	rax, QWORD PTR -4064[rbp]
	je	.L9
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	syserr@PLT
.L9:
	cmp	QWORD PTR -4072[rbp], 0
	jg	.L12
	lea	rdi, .LC11[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -4084[rbp]
	mov	edi, eax
	call	close@PLT
	test	eax, eax
	jns	.L14
	lea	rdi, .LC12[rip]
	mov	eax, 0
	call	syserr@PLT
	jmp	.L14
	.cfi_endproc
.LFE6:
	.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	"819899.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Usage ./echo-server [file]\000"
	.align	2
.LC1:
	.ascii	"w\000"
	.align	2
.LC2:
	.ascii	"file open\000"
	.align	2
.LC3:
	.ascii	"socket\000"
	.align	2
.LC4:
	.ascii	"bind\000"
	.align	2
.LC5:
	.ascii	"listen\000"
	.align	2
.LC6:
	.ascii	"accepting client connections on port %hu\012\000"
	.align	2
.LC7:
	.ascii	"accept\000"
	.align	2
.LC8:
	.ascii	"reading from client socket\000"
	.align	2
.LC9:
	.ascii	"read from socket: %zd bytes\012\000"
	.align	2
.LC10:
	.ascii	"MA:\000"
	.align	2
.LC11:
	.ascii	"writing to client socket\000"
	.align	2
.LC12:
	.ascii	"ending connection\000"
	.align	2
.LC13:
	.ascii	"close\000"
	.align	2
.LC14:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 4088
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #4080
	sub	sp, sp, #8
	str	r0, [fp, #-4088]
	str	r1, [fp, #-4092]
	ldr	r3, .L16
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-4088]
	cmp	r3, #2
	ble	.L2
	ldr	r0, .L16+4
	bl	syserr
.L2:
	ldr	r3, [fp, #-4088]
	cmp	r3, #1
	movgt	r3, #1
	movle	r3, #0
	and	r3, r3, #255
	str	r3, [fp, #-4072]
	ldr	r3, .L16+8
	str	r3, [fp, #-4068]
	ldr	r3, [fp, #-4072]
	cmp	r3, #1
	bne	.L3
	ldr	r3, [fp, #-4092]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L16+12
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-4076]
	ldr	r3, [fp, #-4076]
	cmp	r3, #0
	bne	.L3
	ldr	r0, .L16+16
	bl	syserr
.L3:
	mov	r2, #0
	mov	r1, #1
	mov	r0, #2
	bl	socket
	str	r0, [fp, #-4064]
	ldr	r3, [fp, #-4064]
	cmp	r3, #0
	bge	.L4
	ldr	r0, .L16+20
	bl	syserr
.L4:
	sub	r3, fp, #4
	sub	r3, r3, #4032
	sub	r3, r3, #8
	mov	r2, #2
	strh	r2, [r3]	@ movhi
	mov	r0, #0
	bl	htonl
	mov	r3, r0
	str	r3, [fp, #-4040]
	ldr	r3, [fp, #-4068]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	mov	r0, r3
	bl	htons
	mov	r3, r0
	mov	r2, r3
	sub	r3, fp, #4
	sub	r3, r3, #4032
	sub	r3, r3, #8
	strh	r2, [r3, #2]	@ movhi
	sub	r3, fp, #4032
	sub	r3, r3, #4
	sub	r3, r3, #8
	mov	r2, #16
	mov	r1, r3
	ldr	r0, [fp, #-4064]
	bl	bind
	mov	r3, r0
	cmp	r3, #0
	bge	.L5
	ldr	r0, .L16+24
	bl	syserr
.L5:
	mov	r1, #5
	ldr	r0, [fp, #-4064]
	bl	listen
	mov	r3, r0
	cmp	r3, #0
	bge	.L6
	ldr	r0, .L16+28
	bl	syserr
.L6:
	sub	r3, fp, #4
	sub	r3, r3, #4032
	sub	r3, r3, #8
	ldrh	r3, [r3, #2]
	mov	r0, r3
	bl	ntohs
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L16+32
	bl	printf
.L14:
	mov	r3, #16
	str	r3, [fp, #-4080]
	sub	r2, fp, #4064
	sub	r2, r2, #4
	sub	r2, r2, #12
	sub	r3, fp, #4016
	sub	r3, r3, #4
	sub	r3, r3, #8
	mov	r1, r3
	ldr	r0, [fp, #-4064]
	bl	accept
	str	r0, [fp, #-4060]
	ldr	r3, [fp, #-4060]
	cmp	r3, #0
	bge	.L12
	ldr	r0, .L16+36
	bl	syserr
.L12:
	sub	r3, fp, #4000
	sub	r3, r3, #4
	sub	r3, r3, #8
	mov	r2, #2000
	mov	r1, r3
	ldr	r0, [fp, #-4060]
	bl	read
	str	r0, [fp, #-4056]
	ldr	r3, [fp, #-4056]
	cmp	r3, #0
	bge	.L8
	ldr	r0, .L16+40
	bl	syserr
	b	.L9
.L8:
	ldr	r3, [fp, #-4072]
	cmp	r3, #0
	bne	.L10
	ldr	r1, [fp, #-4056]
	ldr	r0, .L16+44
	bl	printf
	b	.L11
.L10:
	ldr	r2, [fp, #-4056]
	ldr	r1, .L16+44
	ldr	r0, [fp, #-4076]
	bl	fprintf
	ldr	r0, [fp, #-4076]
	bl	fflush
.L11:
	sub	r3, fp, #2000
	sub	r3, r3, #4
	sub	r3, r3, #8
	ldr	r2, .L16+48
	mov	r1, #0
	mov	r0, r3
	bl	memset
	sub	r3, fp, #2000
	sub	r3, r3, #4
	sub	r3, r3, #8
	mov	r0, r3
	bl	strlen
	mov	r3, r0
	mov	r2, r3
	sub	r3, fp, #2000
	sub	r3, r3, #4
	sub	r3, r3, #8
	add	r3, r3, r2
	ldr	r2, .L16+52
	mov	r0, r3
	mov	r1, r2
	mov	r3, #4
	mov	r2, r3
	bl	memcpy
	sub	r2, fp, #4000
	sub	r2, r2, #4
	sub	r2, r2, #8
	sub	r3, fp, #2000
	sub	r3, r3, #4
	sub	r3, r3, #8
	mov	r1, r2
	mov	r0, r3
	bl	strcat
	ldr	r3, [fp, #-4056]
	add	r3, r3, #3
	str	r3, [fp, #-4052]
	ldr	r2, [fp, #-4052]
	sub	r3, fp, #2000
	sub	r3, r3, #4
	sub	r3, r3, #8
	mov	r1, r3
	ldr	r0, [fp, #-4060]
	bl	write
	str	r0, [fp, #-4048]
	ldr	r2, [fp, #-4048]
	ldr	r3, [fp, #-4052]
	cmp	r2, r3
	beq	.L9
	ldr	r0, .L16+56
	bl	syserr
.L9:
	ldr	r3, [fp, #-4056]
	cmp	r3, #0
	bgt	.L12
	ldr	r0, .L16+60
	bl	puts
	ldr	r0, [fp, #-4060]
	bl	close
	mov	r3, r0
	cmp	r3, #0
	bge	.L14
	ldr	r0, .L16+64
	bl	syserr
	b	.L14
.L17:
	.align	2
.L16:
	.word	.LC14
	.word	.LC0
	.word	1327
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	2003
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
