	.file	"257289.c"
	.intel_syntax noprefix
	.text
	.globl	sockfd
	.data
	.align 4
	.type	sockfd, @object
	.size	sockfd, 4
sockfd:
	.long	-1
	.globl	last_char
	.bss
	.type	last_char, @object
	.size	last_char, 1
last_char:
	.zero	1
	.globl	is_last_char_buffered
	.align 4
	.type	is_last_char_buffered, @object
	.size	is_last_char_buffered, 4
is_last_char_buffered:
	.zero	4
	.globl	buffer
	.align 32
	.type	buffer, @object
	.size	buffer, 1048576
buffer:
	.zero	1048576
	.globl	rpointer
	.align 4
	.type	rpointer, @object
	.size	rpointer, 4
rpointer:
	.zero	4
	.globl	wpointer
	.align 4
	.type	wpointer, @object
	.size	wpointer, 4
wpointer:
	.zero	4
	.section	.rodata
.LC0:
	.string	"localhost"
	.text
	.globl	layer2_connect
	.type	layer2_connect, @function
layer2_connect:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	esi, 20000
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	layer2_connect2
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	layer2_connect, .-layer2_connect
	.section	.rodata
.LC1:
	.string	"gethostbyname"
.LC2:
	.string	"socket"
.LC3:
	.string	"connect"
	.text
	.globl	layer2_connect2
	.type	layer2_connect2, @function
layer2_connect2:
.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, 64
	mov	QWORD PTR -56[rbp], rdi
	mov	DWORD PTR -60[rbp], esi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	gethostbyname@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -40[rbp], 0
	jne	.L3
	lea	rdi, .LC1[rip]
	call	herror@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	mov	edx, 0
	mov	esi, 1
	mov	edi, 2
	call	socket@PLT
	mov	DWORD PTR sockfd[rip], eax
	mov	eax, DWORD PTR sockfd[rip]
	cmp	eax, -1
	jne	.L4
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	mov	WORD PTR -32[rbp], 2
	mov	eax, DWORD PTR -60[rbp]
	movzx	eax, ax
	mov	edi, eax
	call	htons@PLT
	mov	WORD PTR -30[rbp], ax
	mov	rax, QWORD PTR -40[rbp]
	mov	rax, QWORD PTR 24[rax]
	mov	rax, QWORD PTR [rax]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -28[rbp], eax
	lea	rax, -32[rbp]
	add	rax, 8
	mov	QWORD PTR [rax], 0
	mov	eax, DWORD PTR sockfd[rip]
	lea	rcx, -32[rbp]
	mov	edx, 16
	mov	rsi, rcx
	mov	edi, eax
	call	connect@PLT
	cmp	eax, -1
	jne	.L7
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	layer2_connect2, .-layer2_connect2
	.globl	layer2_write_readbuffer
	.type	layer2_write_readbuffer, @function
layer2_write_readbuffer:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, edi
	mov	BYTE PTR -20[rbp], al
	mov	eax, DWORD PTR wpointer[rip]
	add	eax, 1
	cdq
	shr	edx, 12
	add	eax, edx
	and	eax, 1048575
	sub	eax, edx
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR rpointer[rip]
	cmp	DWORD PTR -4[rbp], eax
	jne	.L9
	mov	eax, -1
	jmp	.L10
.L9:
	mov	eax, DWORD PTR wpointer[rip]
	cdqe
	lea	rcx, buffer[rip]
	movzx	edx, BYTE PTR -20[rbp]
	mov	BYTE PTR [rax+rcx], dl
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR wpointer[rip], eax
	mov	eax, 0
.L10:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	layer2_write_readbuffer, .-layer2_write_readbuffer
	.globl	layer2_eof
	.type	layer2_eof, @function
layer2_eof:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	edx, DWORD PTR wpointer[rip]
	mov	eax, DWORD PTR rpointer[rip]
	cmp	edx, eax
	jne	.L12
	mov	eax, 0
	jmp	.L13
.L12:
	mov	eax, 1
.L13:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	layer2_eof, .-layer2_eof
	.section	.rodata
.LC4:
	.string	"recv"
	.text
	.globl	layer2_getc
	.type	layer2_getc, @function
layer2_getc:
.LFB10:
	.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	eax, DWORD PTR is_last_char_buffered[rip]
	test	eax, eax
	je	.L15
	mov	DWORD PTR is_last_char_buffered[rip], 0
	jmp	.L16
.L15:
	mov	eax, DWORD PTR sockfd[rip]
	test	eax, eax
	jns	.L17
	mov	edx, DWORD PTR rpointer[rip]
	mov	eax, DWORD PTR wpointer[rip]
	cmp	edx, eax
	jne	.L18
	mov	eax, -1
	jmp	.L19
.L18:
	mov	eax, DWORD PTR rpointer[rip]
	cdqe
	lea	rdx, buffer[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	mov	BYTE PTR last_char[rip], al
	mov	eax, DWORD PTR rpointer[rip]
	add	eax, 1
	cdq
	shr	edx, 12
	add	eax, edx
	and	eax, 1048575
	sub	eax, edx
	mov	DWORD PTR rpointer[rip], eax
	jmp	.L16
.L17:
	mov	eax, DWORD PTR sockfd[rip]
	mov	ecx, 0
	mov	edx, 1
	lea	rsi, last_char[rip]
	mov	edi, eax
	call	recv@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], -1
	jne	.L16
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L16:
	movzx	eax, BYTE PTR last_char[rip]
	movzx	eax, al
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	layer2_getc, .-layer2_getc
	.globl	layer2_ungetc
	.type	layer2_ungetc, @function
layer2_ungetc:
.LFB11:
	.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 is_last_char_buffered[rip], 1
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	layer2_ungetc, .-layer2_ungetc
	.section	.rodata
.LC5:
	.string	"send"
	.text
	.globl	layer2_write
	.type	layer2_write, @function
layer2_write:
.LFB12:
	.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	DWORD PTR -12[rbp], esi
	mov	eax, DWORD PTR sockfd[rip]
	test	eax, eax
	js	.L24
	mov	edx, DWORD PTR -12[rbp]
	mov	eax, DWORD PTR sockfd[rip]
	mov	rsi, QWORD PTR -8[rbp]
	mov	ecx, 0
	mov	edi, eax
	call	send@PLT
	cmp	rax, -1
	jne	.L21
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L24:
	nop
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	layer2_write, .-layer2_write
	.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	"257289.c"
	.text
	.global	sockfd
	.data
	.align	2
	.type	sockfd, %object
	.size	sockfd, 4
sockfd:
	.word	-1
	.comm	last_char,1,1
	.global	is_last_char_buffered
	.bss
	.align	2
	.type	is_last_char_buffered, %object
	.size	is_last_char_buffered, 4
is_last_char_buffered:
	.space	4
	.comm	buffer,1048576,4
	.global	rpointer
	.align	2
	.type	rpointer, %object
	.size	rpointer, 4
rpointer:
	.space	4
	.global	wpointer
	.align	2
	.type	wpointer, %object
	.size	wpointer, 4
wpointer:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"localhost\000"
	.text
	.align	2
	.global	layer2_connect
	.syntax unified
	.arm
	.fpu softvfp
	.type	layer2_connect, %function
layer2_connect:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r1, .L2
	ldr	r0, .L2+4
	bl	layer2_connect2
	nop
	pop	{fp, pc}
.L3:
	.align	2
.L2:
	.word	20000
	.word	.LC0
	.size	layer2_connect, .-layer2_connect
	.section	.rodata
	.align	2
.LC1:
	.ascii	"gethostbyname\000"
	.align	2
.LC2:
	.ascii	"socket\000"
	.align	2
.LC3:
	.ascii	"connect\000"
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	layer2_connect2
	.syntax unified
	.arm
	.fpu softvfp
	.type	layer2_connect2, %function
layer2_connect2:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	ldr	r3, .L10
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r0, [fp, #-32]
	bl	gethostbyname
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L5
	ldr	r0, .L10+4
	bl	herror
	mov	r0, #1
	bl	exit
.L5:
	mov	r2, #0
	mov	r1, #1
	mov	r0, #2
	bl	socket
	mov	r3, r0
	ldr	r2, .L10+8
	str	r3, [r2]
	ldr	r3, .L10+8
	ldr	r3, [r3]
	cmn	r3, #1
	bne	.L6
	ldr	r0, .L10+12
	bl	perror
	mov	r0, #1
	bl	exit
.L6:
	mov	r3, #2
	strh	r3, [fp, #-24]	@ movhi
	ldr	r3, [fp, #-36]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	mov	r0, r3
	bl	htons
	mov	r3, r0
	strh	r3, [fp, #-22]	@ movhi
	ldr	r3, [fp, #-28]
	ldr	r3, [r3, #16]
	ldr	r3, [r3]
	ldr	r3, [r3]
	str	r3, [fp, #-20]
	sub	r3, fp, #24
	add	r3, r3, #8
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2]
	str	r3, [r2, #4]
	ldr	r3, .L10+8
	ldr	r3, [r3]
	sub	r1, fp, #24
	mov	r2, #16
	mov	r0, r3
	bl	connect
	mov	r3, r0
	cmn	r3, #1
	bne	.L9
	ldr	r0, .L10+16
	bl	perror
	mov	r0, #1
	bl	exit
.L9:
	nop
	ldr	r3, .L10
	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}
.L11:
	.align	2
.L10:
	.word	.LC4
	.word	.LC1
	.word	sockfd
	.word	.LC2
	.word	.LC3
	.size	layer2_connect2, .-layer2_connect2
	.align	2
	.global	layer2_write_readbuffer
	.syntax unified
	.arm
	.fpu softvfp
	.type	layer2_write_readbuffer, %function
layer2_write_readbuffer:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #20
	mov	r3, r0
	strb	r3, [fp, #-13]
	ldr	r3, .L15
	ldr	r3, [r3]
	add	r3, r3, #1
	rsbs	r2, r3, #0
	bic	r3, r3, #-16777216
	bic	r3, r3, #15728640
	bic	r2, r2, #-16777216
	bic	r2, r2, #15728640
	rsbpl	r3, r2, #0
	str	r3, [fp, #-8]
	ldr	r3, .L15+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	bne	.L13
	mvn	r3, #0
	b	.L14
.L13:
	ldr	r3, .L15
	ldr	r3, [r3]
	ldr	r1, .L15+8
	ldrb	r2, [fp, #-13]
	strb	r2, [r1, r3]
	ldr	r2, .L15
	ldr	r3, [fp, #-8]
	str	r3, [r2]
	mov	r3, #0
.L14:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L16:
	.align	2
.L15:
	.word	wpointer
	.word	rpointer
	.word	buffer
	.size	layer2_write_readbuffer, .-layer2_write_readbuffer
	.align	2
	.global	layer2_eof
	.syntax unified
	.arm
	.fpu softvfp
	.type	layer2_eof, %function
layer2_eof:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	ldr	r3, .L20
	ldr	r2, [r3]
	ldr	r3, .L20+4
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L18
	mov	r3, #0
	b	.L19
.L18:
	mov	r3, #1
.L19:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L21:
	.align	2
.L20:
	.word	wpointer
	.word	rpointer
	.size	layer2_eof, .-layer2_eof
	.section	.rodata
	.align	2
.LC5:
	.ascii	"recv\000"
	.text
	.align	2
	.global	layer2_getc
	.syntax unified
	.arm
	.fpu softvfp
	.type	layer2_getc, %function
layer2_getc:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r3, .L28
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L23
	ldr	r3, .L28
	mov	r2, #0
	str	r2, [r3]
	b	.L24
.L23:
	ldr	r3, .L28+4
	ldr	r3, [r3]
	cmp	r3, #0
	bge	.L25
	ldr	r3, .L28+8
	ldr	r2, [r3]
	ldr	r3, .L28+12
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L26
	mvn	r3, #0
	b	.L27
.L26:
	ldr	r3, .L28+8
	ldr	r3, [r3]
	ldr	r2, .L28+16
	ldrb	r2, [r2, r3]	@ zero_extendqisi2
	ldr	r3, .L28+20
	strb	r2, [r3]
	ldr	r3, .L28+8
	ldr	r3, [r3]
	add	r3, r3, #1
	rsbs	r2, r3, #0
	bic	r3, r3, #-16777216
	bic	r3, r3, #15728640
	bic	r2, r2, #-16777216
	bic	r2, r2, #15728640
	rsbpl	r3, r2, #0
	ldr	r2, .L28+8
	str	r3, [r2]
	b	.L24
.L25:
	ldr	r3, .L28+4
	ldr	r0, [r3]
	mov	r3, #0
	mov	r2, #1
	ldr	r1, .L28+20
	bl	recv
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L24
	ldr	r0, .L28+24
	bl	perror
	mov	r0, #1
	bl	exit
.L24:
	ldr	r3, .L28+20
	ldrb	r3, [r3]	@ zero_extendqisi2
.L27:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L29:
	.align	2
.L28:
	.word	is_last_char_buffered
	.word	sockfd
	.word	rpointer
	.word	wpointer
	.word	buffer
	.word	last_char
	.word	.LC5
	.size	layer2_getc, .-layer2_getc
	.align	2
	.global	layer2_ungetc
	.syntax unified
	.arm
	.fpu softvfp
	.type	layer2_ungetc, %function
layer2_ungetc:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	ldr	r3, .L31
	mov	r2, #1
	str	r2, [r3]
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L32:
	.align	2
.L31:
	.word	is_last_char_buffered
	.size	layer2_ungetc, .-layer2_ungetc
	.section	.rodata
	.align	2
.LC6:
	.ascii	"send\000"
	.text
	.align	2
	.global	layer2_write
	.syntax unified
	.arm
	.fpu softvfp
	.type	layer2_write, %function
layer2_write:
	@ 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]
	str	r1, [fp, #-12]
	ldr	r3, .L37
	ldr	r3, [r3]
	cmp	r3, #0
	blt	.L36
	ldr	r3, .L37
	ldr	r0, [r3]
	mov	r3, #0
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-8]
	bl	send
	mov	r3, r0
	cmn	r3, #1
	bne	.L33
	ldr	r0, .L37+4
	bl	perror
	mov	r0, #1
	bl	exit
.L36:
	nop
.L33:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L38:
	.align	2
.L37:
	.word	sockfd
	.word	.LC6
	.size	layer2_write, .-layer2_write
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
