	.file	"255136.c"
	.intel_syntax noprefix
	.text
	.globl	setnonblock
	.type	setnonblock, @function
setnonblock:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, 3
	mov	edi, eax
	mov	eax, 0
	call	fcntl@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	jns	.L2
	mov	eax, DWORD PTR -4[rbp]
	jmp	.L3
.L2:
	or	DWORD PTR -4[rbp], 2048
	mov	edx, DWORD PTR -4[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, 4
	mov	edi, eax
	mov	eax, 0
	call	fcntl@PLT
	test	eax, eax
	jns	.L4
	mov	eax, -1
	jmp	.L3
.L4:
	mov	eax, 0
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	setnonblock, .-setnonblock
	.section	.rodata
.LC0:
	.string	"Client disconnected."
	.align 8
.LC1:
	.string	"Socket failure, disconnecting client: %s"
	.align 8
.LC2:
	.string	"Short write, not all data echoed back to client."
	.text
	.globl	on_read
	.type	on_read, @function
on_read:
.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, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 48
	mov	DWORD PTR -8228[rbp], edi
	mov	eax, esi
	mov	QWORD PTR -8240[rbp], rdx
	mov	WORD PTR -8232[rbp], ax
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -8240[rbp]
	mov	QWORD PTR -8216[rbp], rax
	lea	rcx, -8208[rbp]
	mov	eax, DWORD PTR -8228[rbp]
	mov	edx, 8196
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	mov	DWORD PTR -8224[rbp], eax
	cmp	DWORD PTR -8224[rbp], 0
	jne	.L6
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -8228[rbp]
	mov	edi, eax
	call	close@PLT
	mov	rax, QWORD PTR -8216[rbp]
	mov	rdi, rax
	call	event_del@PLT
	mov	rax, QWORD PTR -8216[rbp]
	mov	rdi, rax
	call	free@PLT
	jmp	.L5
.L6:
	cmp	DWORD PTR -8224[rbp], 0
	jns	.L8
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -8228[rbp]
	mov	edi, eax
	call	close@PLT
	mov	rax, QWORD PTR -8216[rbp]
	mov	rdi, rax
	call	event_del@PLT
	mov	rax, QWORD PTR -8216[rbp]
	mov	rdi, rax
	call	free@PLT
	jmp	.L5
.L8:
	mov	eax, DWORD PTR -8224[rbp]
	movsx	rdx, eax
	lea	rcx, -8208[rbp]
	mov	eax, DWORD PTR -8228[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	DWORD PTR -8220[rbp], eax
	mov	eax, DWORD PTR -8220[rbp]
	cmp	eax, DWORD PTR -8224[rbp]
	jge	.L5
	lea	rdi, .LC2[rip]
	call	puts@PLT
.L5:
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	on_read, .-on_read
	.section	.rodata
.LC3:
	.string	"accept failed"
	.align 8
.LC4:
	.string	"failed to set client socket non-blocking"
.LC5:
	.string	"malloc failed"
.LC6:
	.string	"Accepted connection from %s\n"
	.text
	.globl	on_accept
	.type	on_accept, @function
on_accept:
.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, 64
	mov	DWORD PTR -52[rbp], edi
	mov	eax, esi
	mov	QWORD PTR -64[rbp], rdx
	mov	WORD PTR -56[rbp], ax
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -48[rbp], 16
	lea	rdx, -48[rbp]
	lea	rcx, -32[rbp]
	mov	eax, DWORD PTR -52[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	accept@PLT
	mov	DWORD PTR -44[rbp], eax
	cmp	DWORD PTR -44[rbp], -1
	jne	.L13
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	warn@PLT
	jmp	.L12
.L13:
	mov	eax, DWORD PTR -44[rbp]
	mov	edi, eax
	call	setnonblock
	test	eax, eax
	jns	.L15
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	warn@PLT
.L15:
	mov	esi, 128
	mov	edi, 1
	call	calloc@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -40[rbp], 0
	jne	.L16
	lea	rsi, .LC5[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L16:
	mov	rax, QWORD PTR -40[rbp]
	mov	rdx, QWORD PTR -40[rbp]
	mov	esi, DWORD PTR -44[rbp]
	mov	r8, rdx
	lea	rcx, on_read[rip]
	mov	edx, 18
	mov	rdi, rax
	call	event_set@PLT
	mov	rax, QWORD PTR -40[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	event_add@PLT
	mov	eax, DWORD PTR -28[rbp]
	mov	edi, eax
	call	inet_ntoa@PLT
	mov	rsi, rax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
.L12:
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	on_accept, .-on_accept
	.section	.rodata
.LC7:
	.string	"listen failed"
.LC8:
	.string	"setsockopt failed"
.LC9:
	.string	"bind failed"
	.align 8
.LC10:
	.string	"failed to set server socket to non-blocking"
	.text
	.globl	main
	.type	main, @function
main:
.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, 192
	mov	DWORD PTR -180[rbp], edi
	mov	QWORD PTR -192[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -168[rbp], 1
	call	event_init@PLT
	mov	edx, 0
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], 0
	jns	.L19
	lea	rsi, .LC7[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L19:
	lea	rdx, -168[rbp]
	mov	eax, DWORD PTR -164[rbp]
	mov	r8d, 4
	mov	rcx, rdx
	mov	edx, 2
	mov	esi, 1
	mov	edi, eax
	call	setsockopt@PLT
	cmp	eax, -1
	jne	.L20
	lea	rsi, .LC8[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L20:
	lea	rax, -32[rbp]
	mov	edx, 16
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	mov	WORD PTR -32[rbp], 2
	mov	DWORD PTR -28[rbp], 0
	mov	edi, 5555
	call	htons@PLT
	mov	WORD PTR -30[rbp], ax
	lea	rcx, -32[rbp]
	mov	eax, DWORD PTR -164[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	bind@PLT
	test	eax, eax
	jns	.L21
	lea	rsi, .LC9[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L21:
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, 5
	mov	edi, eax
	call	listen@PLT
	test	eax, eax
	jns	.L22
	lea	rsi, .LC7[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L22:
	mov	eax, DWORD PTR -164[rbp]
	mov	edi, eax
	call	setnonblock
	test	eax, eax
	jns	.L23
	lea	rsi, .LC10[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L23:
	mov	esi, DWORD PTR -164[rbp]
	lea	rax, -160[rbp]
	mov	r8d, 0
	lea	rcx, on_accept[rip]
	mov	edx, 18
	mov	rdi, rax
	call	event_set@PLT
	lea	rax, -160[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	event_add@PLT
	call	event_dispatch@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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	"255136.c"
	.text
	.align	2
	.global	setnonblock
	.syntax unified
	.arm
	.fpu softvfp
	.type	setnonblock, %function
setnonblock:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	mov	r1, #3
	ldr	r0, [fp, #-16]
	bl	fcntl
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L2
	ldr	r3, [fp, #-8]
	b	.L3
.L2:
	ldr	r3, [fp, #-8]
	orr	r3, r3, #2048
	str	r3, [fp, #-8]
	ldr	r2, [fp, #-8]
	mov	r1, #4
	ldr	r0, [fp, #-16]
	bl	fcntl
	mov	r3, r0
	cmp	r3, #0
	bge	.L4
	mvn	r3, #0
	b	.L3
.L4:
	mov	r3, #0
.L3:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	setnonblock, .-setnonblock
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Client disconnected.\000"
	.align	2
.LC1:
	.ascii	"Socket failure, disconnecting client: %s\000"
	.align	2
.LC2:
	.ascii	"Short write, not all data echoed back to client.\000"
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	on_read
	.syntax unified
	.arm
	.fpu softvfp
	.type	on_read, %function
on_read:
	@ args = 0, pretend = 0, frame = 8232
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #8192
	sub	sp, sp, #44
	sub	r3, fp, #8192
	sub	r3, r3, #12
	str	r0, [r3, #-28]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	str	r2, [r3, #-36]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r1	@ movhi
	strh	r2, [r3, #-30]	@ movhi
	ldr	r3, .L12
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-36]
	str	r3, [r2, #-20]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	sub	r3, r3, #8
	sub	r2, fp, #8192
	sub	r2, r2, #12
	mov	r0, r2
	ldr	r2, .L12+4
	mov	r1, r3
	ldr	r0, [r0, #-28]
	bl	read
	str	r0, [r4, #-16]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-16]
	cmp	r3, #0
	bne	.L6
	ldr	r0, .L12+8
	bl	puts
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r0, [r3, #-28]
	bl	close
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-20]
	mov	r0, r3
	bl	event_del
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r0, [r3, #-20]
	bl	free
	b	.L5
.L6:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-16]
	cmp	r3, #0
	bge	.L8
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L12+12
	bl	printf
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r0, [r3, #-28]
	bl	close
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-20]
	mov	r0, r3
	bl	event_del
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r0, [r3, #-20]
	bl	free
	b	.L5
.L8:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r2, [r3, #-16]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	sub	r3, r3, #8
	sub	r1, fp, #8192
	sub	r1, r1, #12
	mov	r0, r1
	mov	r1, r3
	ldr	r0, [r0, #-28]
	bl	write
	str	r0, [r4, #-12]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r2, [r2, #-12]
	ldr	r3, [r3, #-16]
	cmp	r2, r3
	bge	.L5
	ldr	r0, .L12+16
	bl	puts
.L5:
	ldr	r3, .L12
	ldr	r2, [r3]
	ldr	r3, [fp, #-16]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L11
	bl	__stack_chk_fail
.L11:
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L13:
	.align	2
.L12:
	.word	.LC3
	.word	8196
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.size	on_read, .-on_read
	.section	.rodata
	.align	2
.LC4:
	.ascii	"accept failed\000"
	.align	2
.LC5:
	.ascii	"failed to set client socket non-blocking\000"
	.align	2
.LC6:
	.ascii	"malloc failed\000"
	.align	2
.LC7:
	.ascii	"Accepted connection from %s\012\000"
	.align	2
.LC8:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	on_accept
	.syntax unified
	.arm
	.fpu softvfp
	.type	on_accept, %function
on_accept:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #56
	str	r0, [fp, #-40]
	mov	r3, r1
	str	r2, [fp, #-48]
	strh	r3, [fp, #-42]	@ movhi
	ldr	r3, .L20
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #16
	str	r3, [fp, #-36]
	sub	r2, fp, #36
	sub	r3, fp, #24
	mov	r1, r3
	ldr	r0, [fp, #-40]
	bl	accept
	str	r0, [fp, #-32]
	ldr	r3, [fp, #-32]
	cmn	r3, #1
	bne	.L15
	ldr	r0, .L20+4
	bl	warn
	b	.L14
.L15:
	ldr	r0, [fp, #-32]
	bl	setnonblock
	mov	r3, r0
	cmp	r3, #0
	bge	.L17
	ldr	r0, .L20+8
	bl	warn
.L17:
	mov	r1, #64
	mov	r0, #1
	bl	calloc
	mov	r3, r0
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L18
	ldr	r1, .L20+12
	mov	r0, #1
	bl	err
.L18:
	ldr	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	str	r3, [sp]
	ldr	r3, .L20+16
	mov	r2, #18
	ldr	r1, [fp, #-32]
	bl	event_set
	ldr	r3, [fp, #-28]
	mov	r1, #0
	mov	r0, r3
	bl	event_add
	ldr	r0, [fp, #-20]
	bl	inet_ntoa
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L20+20
	bl	printf
.L14:
	ldr	r3, .L20
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L19
	bl	__stack_chk_fail
.L19:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L21:
	.align	2
.L20:
	.word	.LC8
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	on_read
	.word	.LC7
	.size	on_accept, .-on_accept
	.section	.rodata
	.align	2
.LC9:
	.ascii	"listen failed\000"
	.align	2
.LC10:
	.ascii	"setsockopt failed\000"
	.align	2
.LC11:
	.ascii	"bind failed\000"
	.align	2
.LC12:
	.ascii	"failed to set server socket to non-blocking\000"
	.align	2
.LC13:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 104
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #112
	str	r0, [fp, #-104]
	str	r1, [fp, #-108]
	ldr	r3, .L30
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #1
	str	r3, [fp, #-96]
	bl	event_init
	mov	r2, #0
	mov	r1, #1
	mov	r0, #2
	bl	socket
	str	r0, [fp, #-92]
	ldr	r3, [fp, #-92]
	cmp	r3, #0
	bge	.L23
	ldr	r1, .L30+4
	mov	r0, #1
	bl	err
.L23:
	sub	r3, fp, #96
	mov	r2, #4
	str	r2, [sp]
	mov	r2, #2
	mov	r1, #1
	ldr	r0, [fp, #-92]
	bl	setsockopt
	mov	r3, r0
	cmn	r3, #1
	bne	.L24
	ldr	r1, .L30+8
	mov	r0, #1
	bl	err
.L24:
	sub	r3, fp, #24
	mov	r2, #16
	mov	r1, #0
	mov	r0, r3
	bl	memset
	mov	r3, #2
	strh	r3, [fp, #-24]	@ movhi
	mov	r3, #0
	str	r3, [fp, #-20]
	ldr	r0, .L30+12
	bl	htons
	mov	r3, r0
	strh	r3, [fp, #-22]	@ movhi
	sub	r3, fp, #24
	mov	r2, #16
	mov	r1, r3
	ldr	r0, [fp, #-92]
	bl	bind
	mov	r3, r0
	cmp	r3, #0
	bge	.L25
	ldr	r1, .L30+16
	mov	r0, #1
	bl	err
.L25:
	mov	r1, #5
	ldr	r0, [fp, #-92]
	bl	listen
	mov	r3, r0
	cmp	r3, #0
	bge	.L26
	ldr	r1, .L30+4
	mov	r0, #1
	bl	err
.L26:
	ldr	r0, [fp, #-92]
	bl	setnonblock
	mov	r3, r0
	cmp	r3, #0
	bge	.L27
	ldr	r1, .L30+20
	mov	r0, #1
	bl	err
.L27:
	sub	r0, fp, #88
	mov	r3, #0
	str	r3, [sp]
	ldr	r3, .L30+24
	mov	r2, #18
	ldr	r1, [fp, #-92]
	bl	event_set
	sub	r3, fp, #88
	mov	r1, #0
	mov	r0, r3
	bl	event_add
	bl	event_dispatch
	mov	r3, #0
	ldr	r2, .L30
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L29
	bl	__stack_chk_fail
.L29:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L31:
	.align	2
.L30:
	.word	.LC13
	.word	.LC9
	.word	.LC10
	.word	5555
	.word	.LC11
	.word	.LC12
	.word	on_accept
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
