	.file	"29133.c"
	.intel_syntax noprefix
	.text
	.globl	open_listenfd
	.type	open_listenfd, @function
open_listenfd:
.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, 64
	mov	DWORD PTR -52[rbp], edi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -40[rbp], 1
	mov	edx, 0
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR -36[rbp], eax
	cmp	DWORD PTR -36[rbp], 0
	jns	.L2
	mov	eax, -1
	jmp	.L8
.L2:
	lea	rdx, -40[rbp]
	mov	eax, DWORD PTR -36[rbp]
	mov	r8d, 4
	mov	rcx, rdx
	mov	edx, 2
	mov	esi, 1
	mov	edi, eax
	call	setsockopt@PLT
	test	eax, eax
	jns	.L4
	mov	eax, -1
	jmp	.L8
.L4:
	lea	rdx, -40[rbp]
	mov	eax, DWORD PTR -36[rbp]
	mov	r8d, 4
	mov	rcx, rdx
	mov	edx, 3
	mov	esi, 6
	mov	edi, eax
	call	setsockopt@PLT
	test	eax, eax
	jns	.L5
	mov	eax, -1
	jmp	.L8
.L5:
	lea	rax, -32[rbp]
	mov	edx, 16
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	mov	WORD PTR -32[rbp], 2
	mov	edi, 0
	call	htonl@PLT
	mov	DWORD PTR -28[rbp], eax
	mov	eax, DWORD PTR -52[rbp]
	movzx	eax, ax
	mov	edi, eax
	call	htons@PLT
	mov	WORD PTR -30[rbp], ax
	lea	rcx, -32[rbp]
	mov	eax, DWORD PTR -36[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	bind@PLT
	test	eax, eax
	jns	.L6
	mov	eax, -1
	jmp	.L8
.L6:
	mov	eax, DWORD PTR -36[rbp]
	mov	esi, 1024
	mov	edi, eax
	call	listen@PLT
	test	eax, eax
	jns	.L7
	mov	eax, -1
	jmp	.L8
.L7:
	mov	eax, DWORD PTR -36[rbp]
.L8:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	open_listenfd, .-open_listenfd
	.section	.rodata
.LC0:
	.string	"TINY WEBSERVER HELP"
	.align 8
.LC1:
	.string	"tiny            #use default port, serve current dir"
	.align 8
.LC2:
	.string	"tiny /tmp       #use default port, serve given dir"
	.align 8
.LC3:
	.string	"tiny 1234       #use given port, serve current dir"
	.align 8
.LC4:
	.string	"tiny /tmp 1234  #use given port, serve given dir"
.LC5:
	.string	"default port is %d.\n"
	.text
	.globl	print_help
	.type	print_help, @function
print_help:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, .LC0[rip]
	call	puts@PLT
	lea	rdi, .LC1[rip]
	call	puts@PLT
	lea	rdi, .LC2[rip]
	call	puts@PLT
	lea	rdi, .LC3[rip]
	call	puts@PLT
	lea	rdi, .LC4[rip]
	call	puts@PLT
	mov	esi, 9999
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	print_help, .-print_help
	.section	.rodata
.LC6:
	.string	"-h"
.LC7:
	.string	"--help"
.LC8:
	.string	"serve directory '%s'\n"
.LC9:
	.string	"listen on port %d, fd is %d\n"
.LC10:
	.string	"ERROR"
	.text
	.globl	tiny_web_server
	.type	tiny_web_server, @function
tiny_web_server:
.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, 304
	mov	DWORD PTR -292[rbp], edi
	mov	QWORD PTR -304[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -292[rbp], 1
	jle	.L12
	mov	rax, QWORD PTR -304[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC6[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	je	.L13
	mov	rax, QWORD PTR -304[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	jne	.L12
.L13:
	mov	eax, 0
	call	print_help
	mov	eax, 0
	jmp	.L21
.L12:
	mov	DWORD PTR -288[rbp], 9999
	lea	rax, -272[rbp]
	mov	esi, 256
	mov	rdi, rax
	call	getcwd@PLT
	mov	QWORD PTR -280[rbp], rax
	cmp	DWORD PTR -292[rbp], 2
	jne	.L15
	mov	rax, QWORD PTR -304[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	movzx	eax, BYTE PTR [rax]
	cmp	al, 47
	jle	.L16
	mov	rax, QWORD PTR -304[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	movzx	eax, BYTE PTR [rax]
	cmp	al, 57
	jg	.L16
	mov	rax, QWORD PTR -304[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -288[rbp], eax
	jmp	.L18
.L16:
	mov	rax, QWORD PTR -304[rbp]
	mov	rax, QWORD PTR 8[rax]
	mov	QWORD PTR -280[rbp], rax
	mov	rax, QWORD PTR -280[rbp]
	mov	rdi, rax
	call	chdir@PLT
	test	eax, eax
	je	.L18
	mov	rax, QWORD PTR -280[rbp]
	mov	rdi, rax
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L15:
	cmp	DWORD PTR -292[rbp], 3
	jne	.L18
	mov	rax, QWORD PTR -304[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -288[rbp], eax
	mov	rax, QWORD PTR -304[rbp]
	mov	rax, QWORD PTR 8[rax]
	mov	QWORD PTR -280[rbp], rax
	mov	rax, QWORD PTR -280[rbp]
	mov	rdi, rax
	call	chdir@PLT
	test	eax, eax
	je	.L18
	mov	rax, QWORD PTR -280[rbp]
	mov	rdi, rax
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L18:
	mov	rax, QWORD PTR -280[rbp]
	mov	rsi, rax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -288[rbp]
	mov	edi, eax
	call	open_listenfd
	mov	DWORD PTR -284[rbp], eax
	cmp	DWORD PTR -284[rbp], 0
	jle	.L19
	mov	edx, DWORD PTR -284[rbp]
	mov	eax, DWORD PTR -288[rbp]
	mov	esi, eax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	mov	esi, 1
	mov	edi, 13
	call	signal@PLT
	mov	eax, DWORD PTR -284[rbp]
	jmp	.L21
.L19:
	lea	rdi, .LC10[rip]
	call	perror@PLT
	mov	eax, DWORD PTR -284[rbp]
	mov	edi, eax
	call	exit@PLT
.L21:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	tiny_web_server, .-tiny_web_server
	.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	"29133.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	open_listenfd
	.syntax unified
	.arm
	.fpu softvfp
	.type	open_listenfd, %function
open_listenfd:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #48
	str	r0, [fp, #-40]
	ldr	r3, .L10
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #1
	str	r3, [fp, #-32]
	mov	r2, #0
	mov	r1, #1
	mov	r0, #2
	bl	socket
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bge	.L2
	mvn	r3, #0
	b	.L8
.L2:
	sub	r3, fp, #32
	mov	r2, #4
	str	r2, [sp]
	mov	r2, #2
	mov	r1, #1
	ldr	r0, [fp, #-28]
	bl	setsockopt
	mov	r3, r0
	cmp	r3, #0
	bge	.L4
	mvn	r3, #0
	b	.L8
.L4:
	sub	r3, fp, #32
	mov	r2, #4
	str	r2, [sp]
	mov	r2, #3
	mov	r1, #6
	ldr	r0, [fp, #-28]
	bl	setsockopt
	mov	r3, r0
	cmp	r3, #0
	bge	.L5
	mvn	r3, #0
	b	.L8
.L5:
	sub	r3, fp, #24
	mov	r2, #16
	mov	r1, #0
	mov	r0, r3
	bl	memset
	mov	r3, #2
	strh	r3, [fp, #-24]	@ movhi
	mov	r0, #0
	bl	htonl
	mov	r3, r0
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	mov	r0, r3
	bl	htons
	mov	r3, r0
	strh	r3, [fp, #-22]	@ movhi
	sub	r3, fp, #24
	mov	r2, #16
	mov	r1, r3
	ldr	r0, [fp, #-28]
	bl	bind
	mov	r3, r0
	cmp	r3, #0
	bge	.L6
	mvn	r3, #0
	b	.L8
.L6:
	mov	r1, #1024
	ldr	r0, [fp, #-28]
	bl	listen
	mov	r3, r0
	cmp	r3, #0
	bge	.L7
	mvn	r3, #0
	b	.L8
.L7:
	ldr	r3, [fp, #-28]
.L8:
	ldr	r2, .L10
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L9
	bl	__stack_chk_fail
.L9:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L11:
	.align	2
.L10:
	.word	.LC0
	.size	open_listenfd, .-open_listenfd
	.section	.rodata
	.align	2
.LC1:
	.ascii	"TINY WEBSERVER HELP\000"
	.align	2
.LC2:
	.ascii	"tiny            #use default port, serve current di"
	.ascii	"r\000"
	.align	2
.LC3:
	.ascii	"tiny /tmp       #use default port, serve given dir\000"
	.align	2
.LC4:
	.ascii	"tiny 1234       #use given port, serve current dir\000"
	.align	2
.LC5:
	.ascii	"tiny /tmp 1234  #use given port, serve given dir\000"
	.align	2
.LC6:
	.ascii	"default port is %d.\012\000"
	.text
	.align	2
	.global	print_help
	.syntax unified
	.arm
	.fpu softvfp
	.type	print_help, %function
print_help:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r0, .L13
	bl	puts
	ldr	r0, .L13+4
	bl	puts
	ldr	r0, .L13+8
	bl	puts
	ldr	r0, .L13+12
	bl	puts
	ldr	r0, .L13+16
	bl	puts
	ldr	r1, .L13+20
	ldr	r0, .L13+24
	bl	printf
	nop
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	9999
	.word	.LC6
	.size	print_help, .-print_help
	.section	.rodata
	.align	2
.LC7:
	.ascii	"-h\000"
	.align	2
.LC8:
	.ascii	"--help\000"
	.align	2
.LC9:
	.ascii	"serve directory '%s'\012\000"
	.align	2
.LC10:
	.ascii	"listen on port %d, fd is %d\012\000"
	.align	2
.LC11:
	.ascii	"ERROR\000"
	.align	2
.LC12:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	tiny_web_server
	.syntax unified
	.arm
	.fpu softvfp
	.type	tiny_web_server, %function
tiny_web_server:
	@ args = 0, pretend = 0, frame = 280
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #280
	str	r0, [fp, #-280]
	str	r1, [fp, #-284]
	ldr	r3, .L27
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-280]
	cmp	r3, #1
	ble	.L16
	ldr	r3, [fp, #-284]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L27+4
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L17
	ldr	r3, [fp, #-284]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L27+8
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L16
.L17:
	bl	print_help
	mov	r3, #0
	b	.L25
.L16:
	ldr	r3, .L27+12
	str	r3, [fp, #-276]
	sub	r3, fp, #264
	mov	r1, #256
	mov	r0, r3
	bl	getcwd
	str	r0, [fp, #-272]
	ldr	r3, [fp, #-280]
	cmp	r3, #2
	bne	.L19
	ldr	r3, [fp, #-284]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #47
	bls	.L20
	ldr	r3, [fp, #-284]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #57
	bhi	.L20
	ldr	r3, [fp, #-284]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-276]
	b	.L22
.L20:
	ldr	r3, [fp, #-284]
	ldr	r3, [r3, #4]
	str	r3, [fp, #-272]
	ldr	r0, [fp, #-272]
	bl	chdir
	mov	r3, r0
	cmp	r3, #0
	beq	.L22
	ldr	r0, [fp, #-272]
	bl	perror
	mov	r0, #1
	bl	exit
.L19:
	ldr	r3, [fp, #-280]
	cmp	r3, #3
	bne	.L22
	ldr	r3, [fp, #-284]
	add	r3, r3, #8
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-276]
	ldr	r3, [fp, #-284]
	ldr	r3, [r3, #4]
	str	r3, [fp, #-272]
	ldr	r0, [fp, #-272]
	bl	chdir
	mov	r3, r0
	cmp	r3, #0
	beq	.L22
	ldr	r0, [fp, #-272]
	bl	perror
	mov	r0, #1
	bl	exit
.L22:
	ldr	r1, [fp, #-272]
	ldr	r0, .L27+16
	bl	printf
	ldr	r0, [fp, #-276]
	bl	open_listenfd
	str	r0, [fp, #-268]
	ldr	r3, [fp, #-268]
	cmp	r3, #0
	ble	.L23
	ldr	r2, [fp, #-268]
	ldr	r1, [fp, #-276]
	ldr	r0, .L27+20
	bl	printf
	mov	r1, #1
	mov	r0, #13
	bl	signal
	ldr	r3, [fp, #-268]
	b	.L25
.L23:
	ldr	r0, .L27+24
	bl	perror
	ldr	r0, [fp, #-268]
	bl	exit
.L25:
	ldr	r2, .L27
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L26
	bl	__stack_chk_fail
.L26:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L28:
	.align	2
.L27:
	.word	.LC12
	.word	.LC7
	.word	.LC8
	.word	9999
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.size	tiny_web_server, .-tiny_web_server
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
