	.file	"7950857.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"Please give port number"
.LC1:
	.string	"socket"
.LC2:
	.string	"bind"
.LC3:
	.string	"listen"
	.align 8
.LC4:
	.string	"Listening for connections to port %d\n"
.LC5:
	.string	"accept"
.LC6:
	.string	"gethostbyaddr"
.LC7:
	.string	"Accepted connection from %s\n"
	.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, 112
	mov	DWORD PTR -100[rbp], edi
	mov	QWORD PTR -112[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rax, -48[rbp]
	mov	QWORD PTR -72[rbp], rax
	lea	rax, -32[rbp]
	mov	QWORD PTR -64[rbp], rax
	cmp	DWORD PTR -100[rbp], 2
	je	.L2
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	mov	rax, QWORD PTR -112[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -84[rbp], eax
	lea	rsi, sigchld_handler[rip]
	mov	edi, 17
	call	signal@PLT
	mov	edx, 0
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR -80[rbp], eax
	cmp	DWORD PTR -80[rbp], 0
	jns	.L3
	lea	rdi, .LC1[rip]
	call	perror_exit
.L3:
	mov	WORD PTR -48[rbp], 2
	mov	edi, 0
	call	htonl@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	eax, DWORD PTR -84[rbp]
	movzx	eax, ax
	mov	edi, eax
	call	htons@PLT
	mov	WORD PTR -46[rbp], ax
	mov	rcx, QWORD PTR -72[rbp]
	mov	eax, DWORD PTR -80[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	bind@PLT
	test	eax, eax
	jns	.L4
	lea	rdi, .LC2[rip]
	call	perror_exit
.L4:
	mov	eax, DWORD PTR -80[rbp]
	mov	esi, 5
	mov	edi, eax
	call	listen@PLT
	test	eax, eax
	jns	.L5
	lea	rdi, .LC3[rip]
	call	perror_exit
.L5:
	mov	eax, DWORD PTR -84[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -88[rbp], 16
	lea	rdx, -88[rbp]
	mov	rcx, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR -80[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	accept@PLT
	mov	DWORD PTR -76[rbp], eax
	cmp	DWORD PTR -76[rbp], 0
	jns	.L6
	lea	rdi, .LC5[rip]
	call	perror_exit
.L6:
	movzx	eax, WORD PTR -32[rbp]
	movzx	eax, ax
	lea	rdx, -32[rbp]
	lea	rcx, 4[rdx]
	mov	edx, eax
	mov	esi, 4
	mov	rdi, rcx
	call	gethostbyaddr@PLT
	mov	QWORD PTR -56[rbp], rax
	cmp	QWORD PTR -56[rbp], 0
	jne	.L7
	lea	rdi, .LC6[rip]
	call	herror@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	mov	rax, QWORD PTR -56[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -76[rbp]
	mov	edi, eax
	call	child_server
	mov	eax, DWORD PTR -76[rbp]
	mov	edi, eax
	call	close@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC8:
	.string	"write"
.LC9:
	.string	"Closing connection."
	.text
	.globl	child_server
	.type	child_server, @function
child_server:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	jmp	.L10
.L11:
	movzx	eax, BYTE PTR -9[rbp]
	movsx	eax, al
	mov	edi, eax
	call	putchar@PLT
	movzx	eax, BYTE PTR -9[rbp]
	movsx	eax, al
	mov	edi, eax
	call	toupper@PLT
	mov	BYTE PTR -9[rbp], al
	lea	rcx, -9[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	test	rax, rax
	jns	.L10
	lea	rdi, .LC8[rip]
	call	perror_exit
.L10:
	lea	rcx, -9[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	test	rax, rax
	jg	.L11
	lea	rdi, .LC9[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -20[rbp]
	mov	edi, eax
	call	close@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	child_server, .-child_server
	.globl	sigchld_handler
	.type	sigchld_handler, @function
sigchld_handler:
.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, 16
	mov	DWORD PTR -4[rbp], edi
	nop
.L14:
	mov	edx, 1
	mov	esi, 0
	mov	edi, -1
	call	waitpid@PLT
	test	eax, eax
	jg	.L14
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sigchld_handler, .-sigchld_handler
	.globl	perror_exit
	.type	perror_exit, @function
perror_exit:
.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, 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
.LFE9:
	.size	perror_exit, .-perror_exit
	.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	"7950857.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Please give port number\000"
	.align	2
.LC1:
	.ascii	"socket\000"
	.align	2
.LC2:
	.ascii	"bind\000"
	.align	2
.LC3:
	.ascii	"listen\000"
	.align	2
.LC4:
	.ascii	"Listening for connections to port %d\012\000"
	.align	2
.LC5:
	.ascii	"accept\000"
	.align	2
.LC6:
	.ascii	"gethostbyaddr\000"
	.align	2
.LC7:
	.ascii	"Accepted connection from %s\012\000"
	.align	2
.LC8:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 72
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #72
	str	r0, [fp, #-72]
	str	r1, [fp, #-76]
	ldr	r3, .L9
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r3, fp, #40
	str	r3, [fp, #-64]
	sub	r3, fp, #24
	str	r3, [fp, #-60]
	ldr	r3, [fp, #-72]
	cmp	r3, #2
	beq	.L2
	ldr	r0, .L9+4
	bl	puts
	mov	r0, #1
	bl	exit
.L2:
	ldr	r3, [fp, #-76]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-56]
	ldr	r1, .L9+8
	mov	r0, #17
	bl	signal
	mov	r2, #0
	mov	r1, #1
	mov	r0, #2
	bl	socket
	str	r0, [fp, #-52]
	ldr	r3, [fp, #-52]
	cmp	r3, #0
	bge	.L3
	ldr	r0, .L9+12
	bl	perror_exit
.L3:
	mov	r3, #2
	strh	r3, [fp, #-40]	@ movhi
	mov	r0, #0
	bl	htonl
	mov	r3, r0
	str	r3, [fp, #-36]
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	mov	r0, r3
	bl	htons
	mov	r3, r0
	strh	r3, [fp, #-38]	@ movhi
	mov	r2, #16
	ldr	r1, [fp, #-64]
	ldr	r0, [fp, #-52]
	bl	bind
	mov	r3, r0
	cmp	r3, #0
	bge	.L4
	ldr	r0, .L9+16
	bl	perror_exit
.L4:
	mov	r1, #5
	ldr	r0, [fp, #-52]
	bl	listen
	mov	r3, r0
	cmp	r3, #0
	bge	.L5
	ldr	r0, .L9+20
	bl	perror_exit
.L5:
	ldr	r1, [fp, #-56]
	ldr	r0, .L9+24
	bl	printf
	mov	r3, #16
	str	r3, [fp, #-68]
	sub	r3, fp, #68
	mov	r2, r3
	ldr	r1, [fp, #-60]
	ldr	r0, [fp, #-52]
	bl	accept
	str	r0, [fp, #-48]
	ldr	r3, [fp, #-48]
	cmp	r3, #0
	bge	.L6
	ldr	r0, .L9+28
	bl	perror_exit
.L6:
	ldrh	r3, [fp, #-24]
	mov	r2, r3
	sub	r3, fp, #24
	add	r3, r3, #4
	mov	r1, #4
	mov	r0, r3
	bl	gethostbyaddr
	str	r0, [fp, #-44]
	ldr	r3, [fp, #-44]
	cmp	r3, #0
	bne	.L7
	ldr	r0, .L9+32
	bl	herror
	mov	r0, #1
	bl	exit
.L7:
	ldr	r3, [fp, #-44]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L9+36
	bl	printf
	ldr	r0, [fp, #-48]
	bl	child_server
	ldr	r0, [fp, #-48]
	bl	close
	nop
	ldr	r3, .L9
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L8
	bl	__stack_chk_fail
.L8:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L10:
	.align	2
.L9:
	.word	.LC8
	.word	.LC0
	.word	sigchld_handler
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.size	main, .-main
	.section	.rodata
	.align	2
.LC9:
	.ascii	"write\000"
	.align	2
.LC10:
	.ascii	"Closing connection.\000"
	.align	2
.LC11:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	child_server
	.syntax unified
	.arm
	.fpu softvfp
	.type	child_server, %function
child_server:
	@ 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]
	ldr	r3, .L15
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	b	.L12
.L13:
	ldrb	r3, [fp, #-12]	@ zero_extendqisi2
	mov	r0, r3
	bl	putchar
	ldrb	r3, [fp, #-12]	@ zero_extendqisi2
	mov	r0, r3
	bl	toupper
	mov	r3, r0
	and	r3, r3, #255
	strb	r3, [fp, #-12]
	sub	r3, fp, #12
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-16]
	bl	write
	mov	r3, r0
	cmp	r3, #0
	bge	.L12
	ldr	r0, .L15+4
	bl	perror_exit
.L12:
	sub	r3, fp, #12
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-16]
	bl	read
	mov	r3, r0
	cmp	r3, #0
	bgt	.L13
	ldr	r0, .L15+8
	bl	puts
	ldr	r0, [fp, #-16]
	bl	close
	nop
	ldr	r3, .L15
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L14
	bl	__stack_chk_fail
.L14:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L16:
	.align	2
.L15:
	.word	.LC11
	.word	.LC9
	.word	.LC10
	.size	child_server, .-child_server
	.align	2
	.global	sigchld_handler
	.syntax unified
	.arm
	.fpu softvfp
	.type	sigchld_handler, %function
sigchld_handler:
	@ 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]
	nop
.L18:
	mov	r2, #1
	mov	r1, #0
	mvn	r0, #0
	bl	waitpid
	mov	r3, r0
	cmp	r3, #0
	bgt	.L18
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	sigchld_handler, .-sigchld_handler
	.align	2
	.global	perror_exit
	.syntax unified
	.arm
	.fpu softvfp
	.type	perror_exit, %function
perror_exit:
	@ 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	perror_exit, .-perror_exit
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
