	.file	"455612.c"
	.intel_syntax noprefix
	.text
	.globl	is_invalid_errno
	.type	is_invalid_errno, @function
is_invalid_errno:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 13
	je	.L2
	cmp	eax, 98
	jne	.L3
.L2:
	mov	eax, 0
	jmp	.L4
.L3:
	mov	eax, 1
.L4:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	is_invalid_errno, .-is_invalid_errno
	.section	.rodata
	.align 8
.LC0:
	.string	"Usage: %s <unused|used>\n\tunused - Return unused random port and exit\n\tused - Print a port that is being used, and hang on\n"
	.text
	.globl	usage
	.type	usage, @function
usage:
.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 stderr[rip]
	mov	rdx, QWORD PTR -8[rbp]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 3
	call	exit@PLT
	.cfi_endproc
.LFE7:
	.size	usage, .-usage
	.globl	alarm_signal_handler
	.type	alarm_signal_handler, @function
alarm_signal_handler:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -4[rbp], edi
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	alarm_signal_handler, .-alarm_signal_handler
	.section	.rodata
.LC1:
	.string	"unused"
.LC2:
	.string	"used"
.LC3:
	.string	"bind"
.LC4:
	.string	"listen"
.LC5:
	.string	"%d\n"
.LC6:
	.string	"fork"
.LC7:
	.string	"accept"
	.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, 240
	mov	DWORD PTR -228[rbp], edi
	mov	QWORD PTR -240[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -228[rbp], 2
	je	.L8
	mov	rax, QWORD PTR -240[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	usage
.L8:
	mov	DWORD PTR -220[rbp], 0
	mov	rax, QWORD PTR -240[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	call	strcmp@PLT
	test	eax, eax
	jne	.L9
	mov	DWORD PTR -220[rbp], 1
	jmp	.L10
.L9:
	mov	rax, QWORD PTR -240[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	call	strcmp@PLT
	test	eax, eax
	jne	.L11
	mov	DWORD PTR -220[rbp], 2
	jmp	.L10
.L11:
	mov	rax, QWORD PTR -240[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	usage
.L10:
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, -2147450879
	shr	rdx, 32
	add	edx, eax
	sar	edx, 15
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	DWORD PTR -212[rbp], edx
	mov	ecx, DWORD PTR -212[rbp]
	mov	edx, ecx
	sal	edx, 16
	sub	edx, ecx
	sub	eax, edx
	mov	DWORD PTR -212[rbp], eax
	mov	edx, 0
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR -208[rbp], eax
	lea	rax, -192[rbp]
	mov	edx, 16
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	mov	WORD PTR -192[rbp], 2
	mov	edi, 0
	call	htonl@PLT
	mov	DWORD PTR -188[rbp], eax
	mov	eax, DWORD PTR -212[rbp]
	movzx	eax, ax
	mov	edi, eax
	call	htons@PLT
	mov	WORD PTR -190[rbp], ax
	lea	rcx, -192[rbp]
	mov	eax, DWORD PTR -208[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	bind@PLT
	test	eax, eax
	je	.L12
	mov	eax, DWORD PTR -208[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, 0
	call	is_invalid_errno
	test	eax, eax
	je	.L30
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	eax, 1
	jmp	.L28
.L12:
	mov	eax, DWORD PTR -208[rbp]
	mov	esi, 1
	mov	edi, eax
	call	listen@PLT
	test	eax, eax
	je	.L16
	mov	eax, DWORD PTR -208[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, 0
	call	is_invalid_errno
	test	eax, eax
	je	.L31
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	eax, 2
	jmp	.L28
.L16:
	mov	eax, DWORD PTR -212[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	cmp	DWORD PTR -220[rbp], 2
	jne	.L18
	call	getppid@PLT
	mov	DWORD PTR -204[rbp], eax
	call	fork@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], 0
	jns	.L19
	lea	rdi, .LC6[rip]
	call	perror@PLT
	mov	eax, 4
	jmp	.L28
.L19:
	cmp	DWORD PTR -200[rbp], 0
	jle	.L20
	mov	edi, 0
	call	exit@PLT
.L20:
	mov	DWORD PTR -216[rbp], 60
	jmp	.L21
.L26:
	mov	eax, DWORD PTR -216[rbp]
	lea	edx, -1[rax]
	mov	DWORD PTR -216[rbp], edx
	test	eax, eax
	jle	.L32
	lea	rax, -160[rbp]
	mov	edx, 152
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	lea	rax, alarm_signal_handler[rip]
	mov	QWORD PTR -160[rbp], rax
	lea	rax, -160[rbp]
	mov	edx, 0
	mov	rsi, rax
	mov	edi, 14
	call	sigaction@PLT
	mov	edi, 1
	call	alarm@PLT
	lea	rdx, -224[rbp]
	lea	rcx, -176[rbp]
	mov	eax, DWORD PTR -208[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	accept@PLT
	mov	DWORD PTR -196[rbp], eax
	cmp	DWORD PTR -196[rbp], 0
	jns	.L24
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 4
	je	.L21
	lea	rdi, .LC7[rip]
	call	perror@PLT
	jmp	.L18
.L24:
	mov	eax, DWORD PTR -196[rbp]
	mov	edi, eax
	call	close@PLT
.L21:
	mov	eax, DWORD PTR -204[rbp]
	mov	esi, 0
	mov	edi, eax
	call	kill@PLT
	test	eax, eax
	je	.L26
	jmp	.L18
.L32:
	nop
.L18:
	mov	eax, DWORD PTR -208[rbp]
	mov	edi, eax
	call	close@PLT
	jmp	.L27
.L30:
	nop
	jmp	.L27
.L31:
	nop
.L27:
	mov	eax, 0
.L28:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	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	"455612.c"
	.text
	.align	2
	.global	is_invalid_errno
	.syntax unified
	.arm
	.fpu softvfp
	.type	is_invalid_errno, %function
is_invalid_errno:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #13
	beq	.L2
	cmp	r3, #98
	bne	.L3
.L2:
	mov	r3, #0
	b	.L4
.L3:
	mov	r3, #1
.L4:
	mov	r0, r3
	pop	{fp, pc}
	.size	is_invalid_errno, .-is_invalid_errno
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Usage: %s <unused|used>\012\011unused - Return unus"
	.ascii	"ed random port and exit\012\011used - Print a port "
	.ascii	"that is being used, and hang on\012\000"
	.text
	.align	2
	.global	usage
	.syntax unified
	.arm
	.fpu softvfp
	.type	usage, %function
usage:
	@ 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, .L6
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	ldr	r1, .L6+4
	mov	r0, r3
	bl	fprintf
	mov	r0, #3
	bl	exit
.L7:
	.align	2
.L6:
	.word	stderr
	.word	.LC0
	.size	usage, .-usage
	.align	2
	.global	alarm_signal_handler
	.syntax unified
	.arm
	.fpu softvfp
	.type	alarm_signal_handler, %function
alarm_signal_handler:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	alarm_signal_handler, .-alarm_signal_handler
	.section	.rodata
	.align	2
.LC1:
	.ascii	"unused\000"
	.align	2
.LC2:
	.ascii	"used\000"
	.align	2
.LC3:
	.ascii	"bind\000"
	.align	2
.LC4:
	.ascii	"listen\000"
	.align	2
.LC5:
	.ascii	"%d\012\000"
	.align	2
.LC6:
	.ascii	"fork\000"
	.align	2
.LC7:
	.ascii	"accept\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 = 216
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #216
	str	r0, [fp, #-216]
	str	r1, [fp, #-220]
	ldr	r3, .L35
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-216]
	cmp	r3, #2
	beq	.L10
	ldr	r3, [fp, #-220]
	ldr	r3, [r3]
	mov	r0, r3
	bl	usage
.L10:
	mov	r3, #0
	str	r3, [fp, #-208]
	ldr	r3, [fp, #-220]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L35+4
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L11
	mov	r3, #1
	str	r3, [fp, #-208]
	b	.L12
.L11:
	ldr	r3, [fp, #-220]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L35+8
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L13
	mov	r3, #2
	str	r3, [fp, #-208]
	b	.L12
.L13:
	ldr	r3, [fp, #-220]
	ldr	r3, [r3]
	mov	r0, r3
	bl	usage
.L12:
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	bl	rand
	mov	r2, r0
	ldr	r3, .L35+12
	smull	r1, r3, r2, r3
	add	r3, r3, r2
	asr	r1, r3, #15
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #16
	sub	r3, r3, r1
	sub	r3, r2, r3
	str	r3, [fp, #-200]
	mov	r2, #0
	mov	r1, #1
	mov	r0, #2
	bl	socket
	str	r0, [fp, #-196]
	sub	r3, fp, #180
	mov	r2, #16
	mov	r1, #0
	mov	r0, r3
	bl	memset
	mov	r3, #2
	strh	r3, [fp, #-180]	@ movhi
	mov	r0, #0
	bl	htonl
	mov	r3, r0
	str	r3, [fp, #-176]
	ldr	r3, [fp, #-200]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	mov	r0, r3
	bl	htons
	mov	r3, r0
	strh	r3, [fp, #-178]	@ movhi
	sub	r3, fp, #180
	mov	r2, #16
	mov	r1, r3
	ldr	r0, [fp, #-196]
	bl	bind
	mov	r3, r0
	cmp	r3, #0
	beq	.L14
	ldr	r0, [fp, #-196]
	bl	close
	bl	is_invalid_errno
	mov	r3, r0
	cmp	r3, #0
	beq	.L32
	ldr	r0, .L35+16
	bl	perror
	mov	r3, #1
	b	.L30
.L14:
	mov	r1, #1
	ldr	r0, [fp, #-196]
	bl	listen
	mov	r3, r0
	cmp	r3, #0
	beq	.L18
	ldr	r0, [fp, #-196]
	bl	close
	bl	is_invalid_errno
	mov	r3, r0
	cmp	r3, #0
	beq	.L33
	ldr	r0, .L35+20
	bl	perror
	mov	r3, #2
	b	.L30
.L18:
	ldr	r1, [fp, #-200]
	ldr	r0, .L35+24
	bl	printf
	ldr	r3, .L35+28
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	ldr	r3, [fp, #-208]
	cmp	r3, #2
	bne	.L20
	bl	getppid
	str	r0, [fp, #-192]
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-188]
	ldr	r3, [fp, #-188]
	cmp	r3, #0
	bge	.L21
	ldr	r0, .L35+32
	bl	perror
	mov	r3, #4
	b	.L30
.L21:
	ldr	r3, [fp, #-188]
	cmp	r3, #0
	ble	.L22
	mov	r0, #0
	bl	exit
.L22:
	mov	r3, #60
	str	r3, [fp, #-204]
	b	.L23
.L28:
	ldr	r3, [fp, #-204]
	sub	r2, r3, #1
	str	r2, [fp, #-204]
	cmp	r3, #0
	ble	.L34
	sub	r3, fp, #148
	mov	r2, #140
	mov	r1, #0
	mov	r0, r3
	bl	memset
	ldr	r3, .L35+36
	str	r3, [fp, #-148]
	sub	r3, fp, #148
	mov	r2, #0
	mov	r1, r3
	mov	r0, #14
	bl	sigaction
	mov	r0, #1
	bl	alarm
	sub	r2, fp, #212
	sub	r3, fp, #164
	mov	r1, r3
	ldr	r0, [fp, #-196]
	bl	accept
	str	r0, [fp, #-184]
	ldr	r3, [fp, #-184]
	cmp	r3, #0
	bge	.L26
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #4
	beq	.L23
	ldr	r0, .L35+40
	bl	perror
	b	.L20
.L26:
	ldr	r0, [fp, #-184]
	bl	close
.L23:
	mov	r1, #0
	ldr	r0, [fp, #-192]
	bl	kill
	mov	r3, r0
	cmp	r3, #0
	beq	.L28
	b	.L20
.L34:
	nop
.L20:
	ldr	r0, [fp, #-196]
	bl	close
	b	.L29
.L32:
	nop
	b	.L29
.L33:
	nop
.L29:
	mov	r3, #0
.L30:
	ldr	r2, .L35
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L31
	bl	__stack_chk_fail
.L31:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L36:
	.align	2
.L35:
	.word	.LC8
	.word	.LC1
	.word	.LC2
	.word	-2147450879
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	stdout
	.word	.LC6
	.word	alarm_signal_handler
	.word	.LC7
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
