	.file	"extr_24857.c_main.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"w"
.LC1:
	.string	"/dev/tty"
.LC2:
	.string	"Can't open /dev/tty"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC3:
	.string	"Couldn't set the signal handler"
	.align 8
.LC4:
	.string	"Can't read \"Connect\" from the net\n"
	.align 8
.LC5:
	.string	"Connection closed before double \\n\n"
	.section	.rodata.str1.1
.LC6:
	.string	"%s\n"
.LC7:
	.string	"Connected (hopefully)\n"
.LC8:
	.string	"GNUTELLA/0.6 200 OK\r\n\r\n"
.LC9:
	.string	"Received a Ping message\n"
.LC10:
	.string	"Payload for Ping > 0 !\n"
.LC11:
	.string	"Sending a Pong message\n"
.LC12:
	.string	"Received a Pong message\n"
.LC13:
	.string	"Received a Query message\n"
.LC14:
	.string	"Sending a QueryHit message\n"
.LC15:
	.string	"QueryHit sent\n"
	.section	.rodata.str1.8
	.align 8
.LC16:
	.string	"NOT sending a QueryHit message\n"
	.section	.rodata.str1.1
.LC17:
	.string	"Received a Push message\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	sub	rsp, 4096
	.cfi_def_cfa_offset 4144
	or	QWORD PTR [rsp], 0
	sub	rsp, 1104
	.cfi_def_cfa_offset 5248
	lea	rsi, .LC0[rip]
	lea	rdi, .LC1[rip]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 5192[rsp], rax
	xor	eax, eax
	call	fopen@PLT
	mov	QWORD PTR out_stream[rip], rax
	test	rax, rax
	je	.L34
.L2:
	mov	esi, DWORD PTR timer_send_ping[rip]
	mov	edi, DWORD PTR SIGALRM[rip]
	call	signal@PLT
	cmp	rax, QWORD PTR SIG_ERR[rip]
	je	.L35
.L3:
	mov	edi, DWORD PTR ITIMER_REAL[rip]
	xor	edx, edx
	lea	rsi, 16[rsp]
	mov	DWORD PTR 32[rsp], 5
	mov	QWORD PTR 40[rsp], 0
	mov	DWORD PTR 16[rsp], 5
	mov	QWORD PTR 24[rsp], 0
	call	setitimer@PLT
	cmp	eax, -1
	je	.L36
.L4:
	lea	rbp, 64[rsp]
	xor	edi, edi
	mov	edx, 4
	mov	rsi, rbp
	call	read@PLT
	cmp	eax, 4
	je	.L5
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 34
	mov	esi, 1
	lea	rdi, .LC4[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	exit@PLT
.L5:
	mov	rdi, QWORD PTR End[rip]
	call	strlen@PLT
	xor	edi, edi
	mov	rsi, rbp
	mov	edx, eax
	call	read@PLT
	mov	rdi, QWORD PTR End[rip]
	mov	ebx, eax
	call	strlen@PLT
	cmp	eax, ebx
	je	.L6
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 35
	mov	esi, 1
	lea	rdi, .LC5[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	lea	r12, .LC6[rip]
	.p2align 4,,10
	.p2align 3
.L10:
	mov	rdi, QWORD PTR End[rip]
	call	strlen@PLT
	mov	rsi, QWORD PTR End[rip]
	mov	rdi, rbp
	mov	edx, eax
	call	strncmp@PLT
	test	rax, rax
	je	.L37
	mov	rdi, QWORD PTR out_stream[rip]
	mov	rdx, rbp
	mov	rsi, r12
	xor	eax, eax
	mov	rbx, rbp
	call	fprintf@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movzx	eax, BYTE PTR [rbx]
	mov	BYTE PTR -1[rbx], al
.L8:
	mov	rdi, QWORD PTR End[rip]
	add	rbx, 1
	call	strlen@PLT
	lea	edx, -1[rbx]
	sub	eax, 1
	sub	edx, ebp
	cmp	eax, edx
	ja	.L9
	mov	rdi, QWORD PTR End[rip]
	call	strlen@PLT
	xor	edi, edi
	mov	edx, 1
	lea	esi, -1[rax]
	add	rsi, rbp
	call	read@PLT
	cmp	eax, 1
	je	.L10
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 35
	mov	esi, 1
	lea	rdi, .LC5[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	exit@PLT
	jmp	.L10
.L37:
	mov	rdi, QWORD PTR OK[rip]
	xor	r14d, r14d
	lea	rbx, 48[rsp]
	lea	r12, 12[rsp]
	lea	rbp, 11[rsp]
	lea	r13, 1088[rsp]
	call	strlen@PLT
	mov	rsi, QWORD PTR OK[rip]
	mov	edi, 1
	mov	edx, eax
	call	write@PLT
	mov	edx, 22
	mov	rcx, QWORD PTR out_stream[rip]
	mov	esi, 1
	lea	rdi, .LC7[rip]
	call	fwrite@PLT
	lea	rdi, .LC8[rip]
	call	strlen@PLT
	xor	edi, edi
	mov	esi, eax
	call	dump_fd@PLT
	.p2align 4,,10
	.p2align 3
.L28:
	xor	edi, edi
	mov	rcx, rbx
	mov	rdx, r12
	mov	rsi, rbp
	call	read_header@PLT
	test	eax, eax
	je	.L13
	mov	eax, DWORD PTR MAX_PAYLOAD_LEN[rip]
	xor	edi, edi
	cmp	DWORD PTR 12[rsp], eax
	setbe	dil
	call	assert@PLT
	movzx	eax, BYTE PTR 11[rsp]
	cmp	al, -126
	je	.L14
	ja	.L15
	cmp	al, -128
	je	.L16
	cmp	al, -127
	jne	.L28
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 24
	mov	esi, 1
	lea	rdi, .LC17[rip]
	call	fwrite@PLT
	mov	esi, DWORD PTR 12[rsp]
	xor	edi, edi
	call	dump_fd@PLT
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L15:
	cmp	al, -125
	jne	.L28
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 24
	mov	esi, 1
	lea	rdi, .LC9[rip]
	call	fwrite@PLT
	mov	eax, DWORD PTR 12[rsp]
	test	eax, eax
	jne	.L38
.L19:
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 23
	mov	esi, 1
	lea	rdi, .LC11[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	send_pong@PLT
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L14:
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 24
	mov	esi, 1
	lea	rdi, .LC12[rip]
	call	fwrite@PLT
	mov	esi, DWORD PTR 12[rsp]
	xor	edi, edi
	call	dump_fd@PLT
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L16:
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 25
	mov	esi, 1
	lea	rdi, .LC13[rip]
	call	fwrite@PLT
	mov	esi, DWORD PTR 12[rsp]
	xor	edi, edi
	mov	rdx, r13
	call	parse_query_payload@PLT
	test	eax, eax
	je	.L28
	mov	rcx, QWORD PTR out_stream[rip]
	test	r14d, r14d
	jne	.L21
	mov	edx, 27
	mov	esi, 1
	lea	rdi, .LC14[rip]
	mov	r14d, 1
	call	fwrite@PLT
	mov	rdx, rbx
	mov	rsi, r13
	mov	edi, 1
	call	send_queryhit@PLT
	mov	edx, 14
	mov	rcx, QWORD PTR out_stream[rip]
	mov	esi, 1
	lea	rdi, .LC15[rip]
	call	fwrite@PLT
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L38:
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 23
	mov	esi, 1
	lea	rdi, .LC10[rip]
	call	fwrite@PLT
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L21:
	mov	edx, 31
	mov	esi, 1
	lea	rdi, .LC16[rip]
	call	fwrite@PLT
	jmp	.L28
.L13:
	mov	rax, QWORD PTR 5192[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L39
	add	rsp, 5200
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 40
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
.L36:
	.cfi_restore_state
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 31
	mov	esi, 1
	lea	rdi, .LC3[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	exit@PLT
	jmp	.L4
.L35:
	mov	rcx, QWORD PTR out_stream[rip]
	mov	edx, 31
	mov	esi, 1
	lea	rdi, .LC3[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	exit@PLT
	jmp	.L3
.L34:
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	rax, QWORD PTR stderr[rip]
	mov	QWORD PTR out_stream[rip], rax
	jmp	.L2
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.comm	timer_send_ping,4,4
	.comm	stderr,8,8
	.comm	out_stream,8,8
	.comm	SIG_ERR,8,8
	.comm	SIGALRM,4,4
	.comm	OK,8,8
	.comm	MAX_PAYLOAD_LEN,4,4
	.comm	ITIMER_REAL,4,4
	.comm	End,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.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, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_24857.c_main.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"w\000"
	.align	2
.LC1:
	.ascii	"/dev/tty\000"
	.align	2
.LC2:
	.ascii	"Can't open /dev/tty\000"
	.align	2
.LC3:
	.ascii	"Couldn't set the signal handler\000"
	.align	2
.LC4:
	.ascii	"Can't read \"Connect\" from the net\012\000"
	.align	2
.LC5:
	.ascii	"Connection closed before double \\n\012\000"
	.align	2
.LC6:
	.ascii	"%s\012\000"
	.align	2
.LC7:
	.ascii	"Connected (hopefully)\012\000"
	.align	2
.LC8:
	.ascii	"Received a Ping message\012\000"
	.align	2
.LC9:
	.ascii	"Payload for Ping > 0 !\012\000"
	.align	2
.LC10:
	.ascii	"Sending a Pong message\012\000"
	.align	2
.LC11:
	.ascii	"Received a Pong message\012\000"
	.align	2
.LC12:
	.ascii	"Received a Query message\012\000"
	.align	2
.LC13:
	.ascii	"Sending a QueryHit message\012\000"
	.align	2
.LC14:
	.ascii	"QueryHit sent\012\000"
	.align	2
.LC15:
	.ascii	"NOT sending a QueryHit message\012\000"
	.align	2
.LC16:
	.ascii	"Received a Push message\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC17:
	.word	__stack_chk_guard
	.section	.text.startup,"ax",%progbits
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 5176
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	sub	sp, sp, #5120
	sub	sp, sp, #56
	ldr	r2, .L44
	add	r3, sp, #5120
	ldr	r1, .L44+4
	ldr	r0, .L44+8
	add	r3, r3, #52
	ldr	r2, [r2]
	str	r2, [r3]
	mov	r2,#0
	bl	fopen
	ldr	r6, .L44+12
	cmp	r0, #0
	str	r0, [r6]
	beq	.L38
.L2:
	ldr	r3, .L44+16
	ldr	r2, .L44+20
	ldr	r0, [r3]
	ldr	r1, [r2]
	bl	signal
	ldr	r3, .L44+24
	ldr	r3, [r3]
	cmp	r0, r3
	beq	.L39
.L3:
	mov	r2, #0
	mov	r3, #5
	ldr	r1, .L44+28
	str	r2, [sp, #32]
	ldr	r0, [r1]
	add	r1, sp, #20
	str	r2, [sp, #24]
	str	r3, [sp, #28]
	str	r3, [sp, #20]
	bl	setitimer
	cmn	r0, #1
	beq	.L40
.L4:
	add	r3, sp, #52
	mov	r1, r3
	mov	r2, #4
	mov	r0, #0
	str	r3, [sp, #4]
	bl	read
	cmp	r0, #4
	beq	.L5
	mov	r2, #34
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+32
	bl	fwrite
	mov	r0, #1
	bl	exit
.L5:
	ldr	r7, .L44+36
	ldr	r0, [r7]
	bl	strlen
	ldr	r1, [sp, #4]
	mov	r2, r0
	mov	r0, #0
	bl	read
	mov	r4, r0
	ldr	r0, [r7]
	bl	strlen
	cmp	r0, r4
	beq	.L6
	mov	r2, #35
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+40
	bl	fwrite
	mov	r0, #1
	bl	exit
.L6:
	ldr	r8, .L44+44
	ldr	r9, .L44+40
.L10:
	ldr	r4, [r7]
	mov	r0, r4
	bl	strlen
	mov	r1, r4
	mov	r2, r0
	ldr	r0, [sp, #4]
	bl	strncmp
	subs	r4, r0, #0
	beq	.L41
	mov	r1, r8
	ldr	r2, [sp, #4]
	ldr	r0, [r6]
	bl	fprintf
	mov	r4, #0
	ldr	r10, [sp, #4]
	ldr	r5, [r7]
	b	.L8
.L9:
	ldrb	r3, [r10, #1]	@ zero_extendqisi2
	add	r4, r4, #1
	strb	r3, [r10], #1
.L8:
	mov	r0, r5
	bl	strlen
	sub	r0, r0, #1
	cmp	r0, r4
	bhi	.L9
	ldr	r3, [sp, #4]
	mov	r2, #1
	add	r1, r3, r0
	mov	r0, #0
	bl	read
	cmp	r0, #1
	beq	.L10
	mov	r2, #35
	mov	r1, #1
	mov	r0, r9
	ldr	r3, [r6]
	bl	fwrite
	mov	r0, #1
	bl	exit
	b	.L10
.L41:
	ldr	r3, .L44+48
	ldr	r5, .L44+52
	ldr	r7, [r3]
	ldr	r8, .L44+56
	mov	r0, r7
	bl	strlen
	mov	r1, r7
	mov	r2, r0
	mov	r0, #1
	bl	write
	mov	r2, #22
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+60
	bl	fwrite
	mov	r1, #23
	mov	r0, r4
	bl	dump_fd
	ldr	r7, .L44+64
	ldr	r10, .L44+68
	ldr	r9, .L44+72
.L13:
	mov	r0, #0
	add	r3, sp, #36
	add	r2, sp, #16
	add	r1, sp, #15
	bl	read_header
	cmp	r0, #0
	beq	.L14
	ldr	r0, [sp, #16]
	ldr	r3, [r5]
	cmp	r0, r3
	movhi	r0, #0
	movls	r0, #1
	bl	assert
	ldrb	r3, [sp, #15]	@ zero_extendqisi2
	sub	r3, r3, #128
	cmp	r3, #3
	ldrls	pc, [pc, r3, asl #2]
	b	.L13
.L16:
	.word	.L19
	.word	.L18
	.word	.L17
	.word	.L15
.L15:
	ldr	r3, [r6]
	mov	r2, #24
	mov	r1, #1
	ldr	r0, .L44+76
	bl	fwrite
	ldr	r3, [sp, #16]
	cmp	r3, #0
	bne	.L42
.L20:
	mov	r2, #23
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+80
	bl	fwrite
	mov	r0, #1
	bl	send_pong
	b	.L13
.L17:
	mov	r2, #24
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+84
	bl	fwrite
	ldr	r1, [sp, #16]
	mov	r0, #0
	bl	dump_fd
	b	.L13
.L19:
	mov	r2, #25
	mov	r1, #1
	ldr	r3, [r6]
	mov	r0, r7
	bl	fwrite
	add	r2, sp, #1072
	mov	r0, #0
	ldr	r1, [sp, #16]
	add	r2, r2, #4
	bl	parse_query_payload
	cmp	r0, #0
	beq	.L13
	cmp	r4, #0
	ldr	r3, [r6]
	bne	.L22
	mov	r2, #27
	mov	r1, #1
	mov	r0, r9
	bl	fwrite
	add	r1, sp, #1072
	add	r2, sp, #36
	add	r1, r1, #4
	mov	r0, #1
	bl	send_queryhit
	mov	r2, #14
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+88
	bl	fwrite
	mov	r4, #1
	b	.L13
.L18:
	mov	r2, #24
	mov	r1, #1
	mov	r0, r8
	ldr	r3, [r6]
	bl	fwrite
	ldr	r1, [sp, #16]
	mov	r0, #0
	bl	dump_fd
	b	.L13
.L42:
	mov	r2, #23
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+92
	bl	fwrite
	b	.L20
.L22:
	mov	r2, #31
	mov	r1, #1
	mov	r0, r10
	bl	fwrite
	b	.L13
.L14:
	add	r3, sp, #5120
	ldr	r2, .L44
	add	r3, r3, #52
	ldr	r1, [r2]
	ldr	r2, [r3]
	eors	r1, r2, r1
	mov	r2, #0
	bne	.L43
	add	sp, sp, #5120
	add	sp, sp, #56
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L40:
	mov	r2, #31
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+96
	bl	fwrite
	mov	r0, #1
	bl	exit
	b	.L4
.L39:
	mov	r2, #31
	mov	r1, #1
	ldr	r3, [r6]
	ldr	r0, .L44+96
	bl	fwrite
	mov	r0, #1
	bl	exit
	b	.L3
.L38:
	ldr	r0, .L44+100
	bl	perror
	ldr	r3, .L44+104
	ldr	r3, [r3]
	str	r3, [r6]
	b	.L2
.L43:
	bl	__stack_chk_fail
.L45:
	.align	2
.L44:
	.word	.LC17
	.word	.LC0
	.word	.LC1
	.word	out_stream
	.word	SIGALRM
	.word	timer_send_ping
	.word	SIG_ERR
	.word	ITIMER_REAL
	.word	.LC4
	.word	End
	.word	.LC5
	.word	.LC6
	.word	OK
	.word	MAX_PAYLOAD_LEN
	.word	.LC16
	.word	.LC7
	.word	.LC12
	.word	.LC15
	.word	.LC13
	.word	.LC8
	.word	.LC10
	.word	.LC11
	.word	.LC14
	.word	.LC9
	.word	.LC3
	.word	.LC2
	.word	stderr
	.size	main, .-main
	.comm	timer_send_ping,4,4
	.comm	stderr,4,4
	.comm	out_stream,4,4
	.comm	SIG_ERR,4,4
	.comm	SIGALRM,4,4
	.comm	OK,4,4
	.comm	MAX_PAYLOAD_LEN,4,4
	.comm	ITIMER_REAL,4,4
	.comm	End,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
