	.file	"646411.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 8
.LC0:
	.string	"Usage: %s <Server IP> <Echo Word> [<Echo Port>]\n"
.LC1:
	.string	"socket() failed"
.LC2:
	.string	"connect() failed"
	.align 8
.LC3:
	.string	"send() sent a different number of bytes than expected"
.LC4:
	.string	"Received: "
	.align 8
.LC5:
	.string	"recv() failed or connection closed prematurely"
.LC6:
	.string	"%s"
	.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
	add	rsp, -128
	mov	DWORD PTR -116[rbp], edi
	mov	QWORD PTR -128[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -116[rbp], 2
	jle	.L2
	cmp	DWORD PTR -116[rbp], 4
	jle	.L3
.L2:
	mov	rax, QWORD PTR -128[rbp]
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	mov	rax, QWORD PTR -128[rbp]
	mov	rax, QWORD PTR 8[rax]
	mov	QWORD PTR -80[rbp], rax
	mov	rax, QWORD PTR -128[rbp]
	mov	rax, QWORD PTR 16[rax]
	mov	QWORD PTR -72[rbp], rax
	cmp	DWORD PTR -116[rbp], 4
	jne	.L4
	mov	rax, QWORD PTR -128[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	WORD PTR -98[rbp], ax
	jmp	.L5
.L4:
	mov	WORD PTR -98[rbp], 7
.L5:
	mov	edx, 6
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR -92[rbp], eax
	cmp	DWORD PTR -92[rbp], 0
	jns	.L6
	lea	rdi, .LC1[rip]
	call	DieWithError
.L6:
	lea	rax, -64[rbp]
	mov	edx, 16
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	mov	WORD PTR -64[rbp], 2
	mov	rax, QWORD PTR -80[rbp]
	mov	rdi, rax
	call	inet_addr@PLT
	mov	DWORD PTR -60[rbp], eax
	movzx	eax, WORD PTR -98[rbp]
	mov	edi, eax
	call	htons@PLT
	mov	WORD PTR -62[rbp], ax
	lea	rcx, -64[rbp]
	mov	eax, DWORD PTR -92[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	connect@PLT
	test	eax, eax
	jns	.L7
	lea	rdi, .LC2[rip]
	call	DieWithError
.L7:
	mov	rax, QWORD PTR -72[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	DWORD PTR -88[rbp], eax
	mov	edx, DWORD PTR -88[rbp]
	mov	rsi, QWORD PTR -72[rbp]
	mov	eax, DWORD PTR -92[rbp]
	mov	ecx, 0
	mov	edi, eax
	call	send@PLT
	mov	edx, DWORD PTR -88[rbp]
	cmp	rax, rdx
	je	.L8
	lea	rdi, .LC3[rip]
	call	DieWithError
.L8:
	mov	DWORD PTR -96[rbp], 0
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L9
.L11:
	lea	rsi, -48[rbp]
	mov	eax, DWORD PTR -92[rbp]
	mov	ecx, 0
	mov	edx, 31
	mov	edi, eax
	call	recv@PLT
	mov	DWORD PTR -84[rbp], eax
	cmp	DWORD PTR -84[rbp], 0
	jg	.L10
	lea	rdi, .LC5[rip]
	call	DieWithError
.L10:
	mov	eax, DWORD PTR -84[rbp]
	add	DWORD PTR -96[rbp], eax
	mov	eax, DWORD PTR -84[rbp]
	cdqe
	mov	BYTE PTR -48[rbp+rax], 0
	lea	rax, -48[rbp]
	mov	rsi, rax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
.L9:
	mov	eax, DWORD PTR -96[rbp]
	cmp	DWORD PTR -88[rbp], eax
	ja	.L11
	mov	edi, 10
	call	putchar@PLT
	mov	eax, DWORD PTR -92[rbp]
	mov	edi, eax
	call	close@PLT
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	DieWithError
	.type	DieWithError, @function
DieWithError:
.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	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
	.cfi_endproc
.LFE7:
	.size	DieWithError, .-DieWithError
	.section	.rodata
.LC7:
	.string	"recv() failed"
.LC8:
	.string	"send() failed"
	.text
	.globl	HandleTCPClient
	.type	HandleTCPClient, @function
HandleTCPClient:
.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, 80
	mov	DWORD PTR -68[rbp], edi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rsi, -48[rbp]
	mov	eax, DWORD PTR -68[rbp]
	mov	ecx, 0
	mov	edx, 32
	mov	edi, eax
	call	recv@PLT
	mov	DWORD PTR -52[rbp], eax
	cmp	DWORD PTR -52[rbp], 0
	jns	.L16
	lea	rdi, .LC7[rip]
	call	DieWithError
	jmp	.L16
.L18:
	mov	eax, DWORD PTR -52[rbp]
	movsx	rdx, eax
	lea	rsi, -48[rbp]
	mov	eax, DWORD PTR -68[rbp]
	mov	ecx, 0
	mov	edi, eax
	call	send@PLT
	mov	edx, DWORD PTR -52[rbp]
	movsx	rdx, edx
	cmp	rax, rdx
	je	.L17
	lea	rdi, .LC8[rip]
	call	DieWithError
.L17:
	lea	rsi, -48[rbp]
	mov	eax, DWORD PTR -68[rbp]
	mov	ecx, 0
	mov	edx, 32
	mov	edi, eax
	call	recv@PLT
	mov	DWORD PTR -52[rbp], eax
	cmp	DWORD PTR -52[rbp], 0
	jns	.L16
	lea	rdi, .LC7[rip]
	call	DieWithError
.L16:
	cmp	DWORD PTR -52[rbp], 0
	jg	.L18
	mov	eax, DWORD PTR -68[rbp]
	mov	edi, eax
	call	close@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	HandleTCPClient, .-HandleTCPClient
	.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	"646411.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Usage: %s <Server IP> <Echo Word> [<Echo Port>]\012"
	.ascii	"\000"
	.align	2
.LC1:
	.ascii	"socket() failed\000"
	.align	2
.LC2:
	.ascii	"connect() failed\000"
	.align	2
.LC3:
	.ascii	"send() sent a different number of bytes than expect"
	.ascii	"ed\000"
	.align	2
.LC4:
	.ascii	"Received: \000"
	.align	2
.LC5:
	.ascii	"recv() failed or connection closed prematurely\000"
	.align	2
.LC6:
	.ascii	"%s\000"
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 88
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #88
	str	r0, [fp, #-88]
	str	r1, [fp, #-92]
	ldr	r3, .L13
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-88]
	cmp	r3, #2
	ble	.L2
	ldr	r3, [fp, #-88]
	cmp	r3, #4
	ble	.L3
.L2:
	ldr	r3, .L13+4
	ldr	r0, [r3]
	ldr	r3, [fp, #-92]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L13+8
	bl	fprintf
	mov	r0, #1
	bl	exit
.L3:
	ldr	r3, [fp, #-92]
	ldr	r3, [r3, #4]
	str	r3, [fp, #-76]
	ldr	r3, [fp, #-92]
	ldr	r3, [r3, #8]
	str	r3, [fp, #-72]
	ldr	r3, [fp, #-88]
	cmp	r3, #4
	bne	.L4
	ldr	r3, [fp, #-92]
	add	r3, r3, #12
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	strh	r3, [fp, #-82]	@ movhi
	b	.L5
.L4:
	mov	r3, #7
	strh	r3, [fp, #-82]	@ movhi
.L5:
	mov	r2, #6
	mov	r1, #1
	mov	r0, #2
	bl	socket
	str	r0, [fp, #-68]
	ldr	r3, [fp, #-68]
	cmp	r3, #0
	bge	.L6
	ldr	r0, .L13+12
	bl	DieWithError
.L6:
	sub	r3, fp, #56
	mov	r2, #16
	mov	r1, #0
	mov	r0, r3
	bl	memset
	mov	r3, #2
	strh	r3, [fp, #-56]	@ movhi
	ldr	r0, [fp, #-76]
	bl	inet_addr
	mov	r3, r0
	str	r3, [fp, #-52]
	ldrh	r3, [fp, #-82]
	mov	r0, r3
	bl	htons
	mov	r3, r0
	strh	r3, [fp, #-54]	@ movhi
	sub	r3, fp, #56
	mov	r2, #16
	mov	r1, r3
	ldr	r0, [fp, #-68]
	bl	connect
	mov	r3, r0
	cmp	r3, #0
	bge	.L7
	ldr	r0, .L13+16
	bl	DieWithError
.L7:
	ldr	r0, [fp, #-72]
	bl	strlen
	str	r0, [fp, #-64]
	mov	r3, #0
	ldr	r2, [fp, #-64]
	ldr	r1, [fp, #-72]
	ldr	r0, [fp, #-68]
	bl	send
	mov	r3, r0
	mov	r2, r3
	ldr	r3, [fp, #-64]
	cmp	r3, r2
	beq	.L8
	ldr	r0, .L13+20
	bl	DieWithError
.L8:
	mov	r3, #0
	str	r3, [fp, #-80]
	ldr	r0, .L13+24
	bl	printf
	b	.L9
.L11:
	sub	r1, fp, #40
	mov	r3, #0
	mov	r2, #31
	ldr	r0, [fp, #-68]
	bl	recv
	str	r0, [fp, #-60]
	ldr	r3, [fp, #-60]
	cmp	r3, #0
	bgt	.L10
	ldr	r0, .L13+28
	bl	DieWithError
.L10:
	ldr	r2, [fp, #-80]
	ldr	r3, [fp, #-60]
	add	r3, r2, r3
	str	r3, [fp, #-80]
	sub	r2, fp, #40
	ldr	r3, [fp, #-60]
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3]
	sub	r3, fp, #40
	mov	r1, r3
	ldr	r0, .L13+32
	bl	printf
.L9:
	ldr	r3, [fp, #-80]
	ldr	r2, [fp, #-64]
	cmp	r2, r3
	bhi	.L11
	mov	r0, #10
	bl	putchar
	ldr	r0, [fp, #-68]
	bl	close
	mov	r0, #0
	bl	exit
.L14:
	.align	2
.L13:
	.word	.LC7
	.word	stderr
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.size	main, .-main
	.align	2
	.global	DieWithError
	.syntax unified
	.arm
	.fpu softvfp
	.type	DieWithError, %function
DieWithError:
	@ 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	perror
	mov	r0, #1
	bl	exit
	.size	DieWithError, .-DieWithError
	.section	.rodata
	.align	2
.LC8:
	.ascii	"recv() failed\000"
	.align	2
.LC9:
	.ascii	"send() failed\000"
	.align	2
.LC10:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	HandleTCPClient
	.syntax unified
	.arm
	.fpu softvfp
	.type	HandleTCPClient, %function
HandleTCPClient:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #48
	str	r0, [fp, #-48]
	ldr	r3, .L22
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r1, fp, #40
	mov	r3, #0
	mov	r2, #32
	ldr	r0, [fp, #-48]
	bl	recv
	str	r0, [fp, #-44]
	ldr	r3, [fp, #-44]
	cmp	r3, #0
	bge	.L18
	ldr	r0, .L22+4
	bl	DieWithError
	b	.L18
.L20:
	ldr	r2, [fp, #-44]
	sub	r1, fp, #40
	mov	r3, #0
	ldr	r0, [fp, #-48]
	bl	send
	mov	r2, r0
	ldr	r3, [fp, #-44]
	cmp	r3, r2
	beq	.L19
	ldr	r0, .L22+8
	bl	DieWithError
.L19:
	sub	r1, fp, #40
	mov	r3, #0
	mov	r2, #32
	ldr	r0, [fp, #-48]
	bl	recv
	str	r0, [fp, #-44]
	ldr	r3, [fp, #-44]
	cmp	r3, #0
	bge	.L18
	ldr	r0, .L22+4
	bl	DieWithError
.L18:
	ldr	r3, [fp, #-44]
	cmp	r3, #0
	bgt	.L20
	ldr	r0, [fp, #-48]
	bl	close
	nop
	ldr	r3, .L22
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L21
	bl	__stack_chk_fail
.L21:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	.LC10
	.word	.LC8
	.word	.LC9
	.size	HandleTCPClient, .-HandleTCPClient
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
