	.file	"27222.c"
	.intel_syntax noprefix
	.text
	.globl	die
	.type	die, @function
die:
.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, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -8[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	die, .-die
	.section	.rodata
.LC0:
	.string	"usage: %s <server_port>"
.LC1:
	.string	"socket failed"
.LC2:
	.string	"bind failed"
.LC3:
	.string	"listen failed"
.LC4:
	.string	"accept failed"
	.align 8
.LC5:
	.string	"reached max children - couldn't spawn another"
.LC6:
	.string	"client ip: %s\n"
.LC7:
	.string	"recv failed"
.LC8:
	.string	"connection closed prematurely"
.LC9:
	.string	"didn't receive uint32"
.LC10:
	.string	"command length: %u\n"
.LC11:
	.string	"confirmed"
.LC12:
	.string	"send size failed"
.LC13:
	.string	"child closing"
	.text
	.globl	main
	.type	main, @function
main:
.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, 240
	mov	DWORD PTR -4324[rbp], edi
	mov	QWORD PTR -4336[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -4324[rbp], 2
	je	.L3
	mov	rax, QWORD PTR -4336[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 -4336[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	WORD PTR -4318[rbp], ax
	mov	edx, 0
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR -4304[rbp], eax
	cmp	DWORD PTR -4304[rbp], 0
	jns	.L4
	lea	rdi, .LC1[rip]
	call	die
.L4:
	lea	rax, -4272[rbp]
	mov	edx, 16
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	mov	WORD PTR -4272[rbp], 2
	mov	edi, 0
	call	htonl@PLT
	mov	DWORD PTR -4268[rbp], eax
	movzx	eax, WORD PTR -4318[rbp]
	mov	edi, eax
	call	htons@PLT
	mov	WORD PTR -4270[rbp], ax
	lea	rcx, -4272[rbp]
	mov	eax, DWORD PTR -4304[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	bind@PLT
	test	eax, eax
	jns	.L5
	lea	rdi, .LC2[rip]
	call	die
.L5:
	mov	DWORD PTR -4300[rbp], 5
	mov	eax, DWORD PTR -4304[rbp]
	mov	esi, 5
	mov	edi, eax
	call	listen@PLT
	test	eax, eax
	jns	.L6
	lea	rdi, .LC3[rip]
	call	die
.L6:
	mov	DWORD PTR -4296[rbp], 0
.L19:
	mov	DWORD PTR -4316[rbp], 16
	lea	rdx, -4316[rbp]
	lea	rcx, -4256[rbp]
	mov	eax, DWORD PTR -4304[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	accept@PLT
	mov	DWORD PTR -4292[rbp], eax
	cmp	DWORD PTR -4292[rbp], 0
	jns	.L7
	lea	rdi, .LC4[rip]
	call	die
.L7:
	call	fork@PLT
	mov	DWORD PTR -4288[rbp], eax
	cmp	DWORD PTR -4288[rbp], 0
	jns	.L8
	lea	rdi, .LC5[rip]
	call	die
	jmp	.L19
.L8:
	cmp	DWORD PTR -4288[rbp], 0
	jne	.L19
	mov	eax, DWORD PTR -4252[rbp]
	mov	edi, eax
	call	inet_ntoa@PLT
	mov	rdx, rax
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC6[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	lea	rsi, -4312[rbp]
	mov	eax, DWORD PTR -4292[rbp]
	mov	ecx, 256
	mov	edx, 4
	mov	edi, eax
	call	recv@PLT
	mov	DWORD PTR -4284[rbp], eax
	cmp	DWORD PTR -4284[rbp], 4
	je	.L10
	cmp	DWORD PTR -4284[rbp], 0
	jns	.L11
	lea	rdi, .LC7[rip]
	call	die
	jmp	.L10
.L11:
	cmp	DWORD PTR -4284[rbp], 0
	jne	.L12
	lea	rdi, .LC8[rip]
	call	die
	jmp	.L10
.L12:
	lea	rdi, .LC9[rip]
	call	die
.L10:
	mov	eax, DWORD PTR -4312[rbp]
	mov	edi, eax
	call	ntohl@PLT
	mov	DWORD PTR -4280[rbp], eax
	mov	rax, QWORD PTR stderr[rip]
	mov	edx, DWORD PTR -4280[rbp]
	lea	rsi, .LC10[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, DWORD PTR -4280[rbp]
	mov	DWORD PTR -4308[rbp], eax
	jmp	.L13
.L17:
	mov	eax, 4096
	cmp	DWORD PTR -4308[rbp], 4096
	cmovbe	eax, DWORD PTR -4308[rbp]
	mov	DWORD PTR -4276[rbp], eax
	mov	edx, DWORD PTR -4276[rbp]
	lea	rsi, -4112[rbp]
	mov	eax, DWORD PTR -4292[rbp]
	mov	ecx, 0
	mov	edi, eax
	call	recv@PLT
	mov	DWORD PTR -4284[rbp], eax
	cmp	DWORD PTR -4284[rbp], 0
	jns	.L14
	lea	rdi, .LC7[rip]
	call	die
	jmp	.L15
.L14:
	cmp	DWORD PTR -4284[rbp], 0
	jne	.L16
	lea	rdi, .LC8[rip]
	call	die
	jmp	.L15
.L16:
	mov	eax, DWORD PTR -4284[rbp]
	sub	DWORD PTR -4308[rbp], eax
.L15:
	mov	rdx, QWORD PTR stdout[rip]
	lea	rax, -4112[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	fputs@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
.L13:
	cmp	DWORD PTR -4308[rbp], 0
	jne	.L17
	mov	eax, DWORD PTR -4292[rbp]
	mov	ecx, 0
	mov	edx, 10
	lea	rsi, .LC11[rip]
	mov	edi, eax
	call	send@PLT
	cmp	rax, 10
	je	.L18
	lea	rdi, .LC12[rip]
	call	die
.L18:
	mov	eax, DWORD PTR -4292[rbp]
	mov	edi, eax
	call	close@PLT
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 13
	mov	esi, 1
	lea	rdi, .LC13[rip]
	call	fwrite@PLT
	jmp	.L19
	.cfi_endproc
.LFE7:
	.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	"27222.c"
	.text
	.align	2
	.global	die
	.syntax unified
	.arm
	.fpu softvfp
	.type	die, %function
die:
	@ 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	r3, .L2
	ldr	r3, [r3]
	ldr	r1, [fp, #-8]
	mov	r0, r3
	bl	fprintf
	mov	r0, #1
	bl	exit
.L3:
	.align	2
.L2:
	.word	stderr
	.size	die, .-die
	.section	.rodata
	.align	2
.LC0:
	.ascii	"usage: %s <server_port>\000"
	.align	2
.LC1:
	.ascii	"socket failed\000"
	.align	2
.LC2:
	.ascii	"bind failed\000"
	.align	2
.LC3:
	.ascii	"listen failed\000"
	.align	2
.LC4:
	.ascii	"accept failed\000"
	.align	2
.LC5:
	.ascii	"reached max children - couldn't spawn another\000"
	.align	2
.LC6:
	.ascii	"client ip: %s\012\000"
	.align	2
.LC7:
	.ascii	"recv failed\000"
	.align	2
.LC8:
	.ascii	"connection closed prematurely\000"
	.align	2
.LC9:
	.ascii	"didn't receive uint32\000"
	.align	2
.LC10:
	.ascii	"command length: %u\012\000"
	.align	2
.LC11:
	.ascii	"confirmed\000"
	.align	2
.LC12:
	.ascii	"send size failed\000"
	.align	2
.LC13:
	.ascii	"child closing\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 = 4280
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #4224
	sub	sp, sp, #60
	sub	r3, fp, #4096
	sub	r3, r3, #12
	str	r0, [r3, #-180]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	str	r1, [r3, #-184]
	ldr	r3, .L23
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-180]
	cmp	r3, #2
	beq	.L5
	ldr	r3, .L23+4
	ldr	r0, [r3]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-184]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L23+8
	bl	fprintf
	mov	r0, #1
	bl	exit
.L5:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-184]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	sub	r2, fp, #4096
	sub	r2, r2, #12
	strh	r3, [r2, #-170]	@ movhi
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	mov	r2, #0
	mov	r1, #1
	mov	r0, #2
	bl	socket
	str	r0, [r4, #-160]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-160]
	cmp	r3, #0
	bge	.L6
	ldr	r0, .L23+12
	bl	die
.L6:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #36
	mov	r2, #16
	mov	r1, #0
	mov	r0, r3
	bl	memset
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, #2
	strh	r2, [r3, #-36]	@ movhi
	mov	r0, #0
	bl	htonl
	mov	r3, r0
	sub	r2, fp, #4096
	sub	r2, r2, #12
	str	r3, [r2, #-32]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldrh	r3, [r3, #-170]
	mov	r0, r3
	bl	htons
	mov	r3, r0
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	strh	r2, [r3, #-34]	@ movhi
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #36
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r0, r2
	mov	r2, #16
	mov	r1, r3
	ldr	r0, [r0, #-160]
	bl	bind
	mov	r3, r0
	cmp	r3, #0
	bge	.L7
	ldr	r0, .L23+16
	bl	die
.L7:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #5
	str	r3, [r2, #-156]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r1, #5
	ldr	r0, [r3, #-160]
	bl	listen
	mov	r3, r0
	cmp	r3, #0
	bge	.L8
	ldr	r0, .L23+20
	bl	die
.L8:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-152]
.L21:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #16
	str	r3, [r2, #-168]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	sub	r2, fp, #4224
	sub	r2, r2, #12
	sub	r2, r2, #40
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #20
	sub	r1, fp, #4096
	sub	r1, r1, #12
	mov	r0, r1
	mov	r1, r3
	ldr	r0, [r0, #-160]
	bl	accept
	str	r0, [r4, #-148]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-148]
	cmp	r3, #0
	bge	.L9
	ldr	r0, .L23+24
	bl	die
.L9:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	bl	fork
	mov	r3, r0
	str	r3, [r4, #-144]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-144]
	cmp	r3, #0
	bge	.L10
	ldr	r0, .L23+28
	bl	die
	b	.L21
.L10:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-144]
	cmp	r3, #0
	bne	.L21
	ldr	r3, .L23+4
	ldr	r4, [r3]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r0, [r3, #-16]
	bl	inet_ntoa
	mov	r3, r0
	mov	r2, r3
	ldr	r1, .L23+32
	mov	r0, r4
	bl	fprintf
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	sub	r1, fp, #4224
	sub	r1, r1, #12
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r0, r3
	mov	r3, #256
	mov	r2, #4
	ldr	r0, [r0, #-148]
	bl	recv
	str	r0, [r4, #-140]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-140]
	cmp	r3, #4
	beq	.L12
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-140]
	cmp	r3, #0
	bge	.L13
	ldr	r0, .L23+36
	bl	die
	b	.L12
.L13:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-140]
	cmp	r3, #0
	bne	.L14
	ldr	r0, .L23+40
	bl	die
	b	.L12
.L14:
	ldr	r0, .L23+44
	bl	die
.L12:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-128]
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r4, r2
	mov	r0, r3
	bl	ntohl
	str	r0, [r4, #-136]
	ldr	r3, .L23+4
	ldr	r3, [r3]
	sub	r2, fp, #4096
	sub	r2, r2, #12
	ldr	r2, [r2, #-136]
	ldr	r1, .L23+48
	mov	r0, r3
	bl	fprintf
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-136]
	str	r3, [r2, #-164]
	b	.L15
.L19:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-164]
	cmp	r3, #4096
	movcc	r3, r3
	movcs	r3, #4096
	str	r3, [r2, #-132]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	sub	r1, fp, #4096
	sub	r1, r1, #12
	sub	r1, r1, #4
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r0, r3
	mov	r3, #0
	ldr	r2, [r2, #-132]
	ldr	r0, [r0, #-148]
	bl	recv
	str	r0, [r4, #-140]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-140]
	cmp	r3, #0
	bge	.L16
	ldr	r0, .L23+36
	bl	die
	b	.L17
.L16:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-140]
	cmp	r3, #0
	bne	.L18
	ldr	r0, .L23+40
	bl	die
	b	.L17
.L18:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-140]
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r1, r2
	sub	r2, fp, #4096
	sub	r2, r2, #12
	ldr	r2, [r2, #-164]
	sub	r3, r2, r3
	str	r3, [r1, #-164]
.L17:
	ldr	r3, .L23+52
	ldr	r2, [r3]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r1, r2
	mov	r0, r3
	bl	fputs
	ldr	r3, .L23+52
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
.L15:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-164]
	cmp	r3, #0
	bne	.L19
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r0, r3
	mov	r3, #0
	mov	r2, #10
	ldr	r1, .L23+56
	ldr	r0, [r0, #-148]
	bl	send
	mov	r3, r0
	cmp	r3, #10
	beq	.L20
	ldr	r0, .L23+60
	bl	die
.L20:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r0, [r3, #-148]
	bl	close
	ldr	r3, .L23+4
	ldr	r3, [r3]
	mov	r2, #13
	mov	r1, #1
	ldr	r0, .L23+64
	bl	fwrite
	b	.L21
.L24:
	.align	2
.L23:
	.word	.LC14
	.word	stderr
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	stdout
	.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
