	.file	"1004168.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 32
	.type	key_chars, @object
	.size	key_chars, 128
key_chars:
	.string	"asdfhgzxcv"
	.string	"bqweryt123465=97-80]ou[ip\nlj'k;\\,/nm.\t `\b"
	.zero	75
	.align 32
	.type	shift_chars, @object
	.size	shift_chars, 128
shift_chars:
	.string	"ASDFHGZXCV"
	.string	"BQWERYT!@#$^%+(&_*)}OU{IP\nLJ\"K:|<?NM>\t ~\b"
	.zero	75
.LC0:
	.string	"open"
	.align 8
.LC1:
	.string	"Error getting current port settings"
.LC2:
	.string	"Error setting port settings"
	.text
	.globl	open_port
	.type	open_port, @function
open_port:
.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	QWORD PTR -104[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -104[rbp]
	mov	esi, 0
	mov	rdi, rax
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -84[rbp], eax
	cmp	DWORD PTR -84[rbp], -1
	jne	.L2
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L6
.L2:
	lea	rdx, -80[rbp]
	mov	eax, DWORD PTR -84[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	tcgetattr@PLT
	test	eax, eax
	je	.L4
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	eax, DWORD PTR -84[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, -1
	jmp	.L6
.L4:
	mov	DWORD PTR -80[rbp], 0
	mov	DWORD PTR -76[rbp], 0
	mov	DWORD PTR -72[rbp], 2224
	mov	DWORD PTR -68[rbp], 0
	lea	rax, -80[rbp]
	add	rax, 17
	mov	edx, 32
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	mov	BYTE PTR -57[rbp], 1
	lea	rax, -80[rbp]
	mov	esi, 13
	mov	rdi, rax
	call	cfsetispeed@PLT
	lea	rax, -80[rbp]
	mov	esi, 13
	mov	rdi, rax
	call	cfsetospeed@PLT
	lea	rdx, -80[rbp]
	mov	eax, DWORD PTR -84[rbp]
	mov	esi, 0
	mov	edi, eax
	call	tcsetattr@PLT
	test	eax, eax
	je	.L5
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	eax, DWORD PTR -84[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, -1
	jmp	.L6
.L5:
	mov	eax, DWORD PTR -84[rbp]
.L6:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	open_port, .-open_port
	.section	.rodata
.LC3:
	.string	"Usage: %s tty\n"
.LC4:
	.string	"Example: %s /dev/ttyUSB0\n"
.LC5:
	.string	"write"
.LC6:
	.string	"read"
.LC7:
	.string	"close"
	.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, 48
	mov	DWORD PTR -36[rbp], edi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -24[rbp], 0
	cmp	DWORD PTR -36[rbp], 2
	je	.L9
	mov	rax, QWORD PTR -48[rbp]
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rax, QWORD PTR -48[rbp]
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, -1
	jmp	.L23
.L9:
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	open_port
	mov	DWORD PTR -20[rbp], eax
	cmp	DWORD PTR -20[rbp], -1
	jne	.L11
	mov	eax, -1
	jmp	.L23
.L11:
	lea	rcx, -25[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	mov	QWORD PTR -16[rbp], rax
	cmp	QWORD PTR -16[rbp], 0
	jle	.L12
	movzx	eax, BYTE PTR -25[rbp]
	cmp	al, -72
	je	.L13
	movzx	eax, BYTE PTR -25[rbp]
	cmp	al, -68
	jne	.L14
.L13:
	mov	DWORD PTR -24[rbp], 1
	jmp	.L21
.L14:
	movzx	eax, BYTE PTR -25[rbp]
	cmp	al, 56
	je	.L16
	movzx	eax, BYTE PTR -25[rbp]
	cmp	al, 60
	jne	.L17
.L16:
	mov	DWORD PTR -24[rbp], 0
	jmp	.L21
.L17:
	movzx	eax, BYTE PTR -25[rbp]
	cmp	al, -71
	jne	.L18
	cmp	DWORD PTR -24[rbp], 0
	sete	al
	movzx	eax, al
	mov	DWORD PTR -24[rbp], eax
	jmp	.L21
.L18:
	movzx	eax, BYTE PTR -25[rbp]
	test	al, al
	jns	.L21
	movzx	eax, BYTE PTR -25[rbp]
	movzx	eax, al
	and	eax, 127
	cdqe
	lea	rdx, key_chars[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	test	al, al
	je	.L21
	cmp	DWORD PTR -24[rbp], 0
	je	.L19
	movzx	eax, BYTE PTR -25[rbp]
	movzx	eax, al
	and	eax, 127
	cdqe
	lea	rdx, shift_chars[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	mov	BYTE PTR -25[rbp], al
	jmp	.L20
.L19:
	movzx	eax, BYTE PTR -25[rbp]
	movzx	eax, al
	and	eax, 127
	cdqe
	lea	rdx, key_chars[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	mov	BYTE PTR -25[rbp], al
.L20:
	lea	rax, -25[rbp]
	mov	edx, 1
	mov	rsi, rax
	mov	edi, 1
	call	write@PLT
	cmp	rax, 1
	je	.L21
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L23
.L12:
	cmp	QWORD PTR -16[rbp], 0
	jns	.L21
	lea	rdi, .LC6[rip]
	call	perror@PLT
.L21:
	cmp	QWORD PTR -16[rbp], 0
	jg	.L11
	mov	eax, DWORD PTR -20[rbp]
	mov	edi, eax
	call	close@PLT
	test	eax, eax
	je	.L22
	lea	rdi, .LC7[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L23
.L22:
	mov	eax, 0
.L23:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	leave
	.cfi_def_cfa 7, 8
	ret
	.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	"1004168.c"
	.text
	.section	.rodata
	.align	2
	.type	key_chars, %object
	.size	key_chars, 128
key_chars:
	.ascii	"asdfhgzxcv\000bqweryt123465=97-80]ou[ip\012lj'k;\\,"
	.ascii	"/nm.\011 `\010\000"
	.space	75
	.align	2
	.type	shift_chars, %object
	.size	shift_chars, 128
shift_chars:
	.ascii	"ASDFHGZXCV\000BQWERYT!@#$^%+(&_*)}OU{IP\012LJ\"K:|<"
	.ascii	"?NM>\011 ~\010\000"
	.space	75
	.align	2
.LC0:
	.ascii	"open\000"
	.align	2
.LC1:
	.ascii	"Error getting current port settings\000"
	.align	2
.LC2:
	.ascii	"Error setting port settings\000"
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	open_port
	.syntax unified
	.arm
	.fpu softvfp
	.type	open_port, %function
open_port:
	@ args = 0, pretend = 0, frame = 80
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #80
	str	r0, [fp, #-80]
	ldr	r3, .L8
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #0
	ldr	r0, [fp, #-80]
	bl	open
	str	r0, [fp, #-72]
	ldr	r3, [fp, #-72]
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L8+4
	bl	perror
	mvn	r3, #0
	b	.L6
.L2:
	sub	r3, fp, #68
	mov	r1, r3
	ldr	r0, [fp, #-72]
	bl	tcgetattr
	mov	r3, r0
	cmp	r3, #0
	beq	.L4
	ldr	r0, .L8+8
	bl	perror
	ldr	r0, [fp, #-72]
	bl	close
	mvn	r3, #0
	b	.L6
.L4:
	mov	r3, #0
	str	r3, [fp, #-68]
	mov	r3, #0
	str	r3, [fp, #-64]
	mov	r3, #2224
	str	r3, [fp, #-60]
	mov	r3, #0
	str	r3, [fp, #-56]
	sub	r3, fp, #68
	add	r3, r3, #17
	mov	r2, #32
	mov	r1, #0
	mov	r0, r3
	bl	memset
	mov	r3, #1
	strb	r3, [fp, #-45]
	sub	r3, fp, #68
	mov	r1, #13
	mov	r0, r3
	bl	cfsetispeed
	sub	r3, fp, #68
	mov	r1, #13
	mov	r0, r3
	bl	cfsetospeed
	sub	r3, fp, #68
	mov	r2, r3
	mov	r1, #0
	ldr	r0, [fp, #-72]
	bl	tcsetattr
	mov	r3, r0
	cmp	r3, #0
	beq	.L5
	ldr	r0, .L8+12
	bl	perror
	ldr	r0, [fp, #-72]
	bl	close
	mvn	r3, #0
	b	.L6
.L5:
	ldr	r3, [fp, #-72]
.L6:
	ldr	r2, .L8
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L7
	bl	__stack_chk_fail
.L7:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L9:
	.align	2
.L8:
	.word	.LC3
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.size	open_port, .-open_port
	.section	.rodata
	.align	2
.LC4:
	.ascii	"Usage: %s tty\012\000"
	.align	2
.LC5:
	.ascii	"Example: %s /dev/ttyUSB0\012\000"
	.align	2
.LC6:
	.ascii	"write\000"
	.align	2
.LC7:
	.ascii	"read\000"
	.align	2
.LC8:
	.ascii	"close\000"
	.align	2
.LC9:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ 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, .L27
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-32]
	cmp	r3, #2
	beq	.L11
	ldr	r3, .L27+4
	ldr	r0, [r3]
	ldr	r3, [fp, #-36]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L27+8
	bl	fprintf
	ldr	r3, .L27+4
	ldr	r0, [r3]
	ldr	r3, [fp, #-36]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L27+12
	bl	fprintf
	mvn	r3, #0
	b	.L25
.L11:
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	open_port
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmn	r3, #1
	bne	.L13
	mvn	r3, #0
	b	.L25
.L13:
	sub	r3, fp, #21
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-16]
	bl	read
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	ble	.L14
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	cmp	r3, #184
	beq	.L15
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	cmp	r3, #188
	bne	.L16
.L15:
	mov	r3, #1
	str	r3, [fp, #-20]
	b	.L23
.L16:
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	cmp	r3, #56
	beq	.L18
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	cmp	r3, #60
	bne	.L19
.L18:
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L23
.L19:
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	cmp	r3, #185
	bne	.L20
	ldr	r3, [fp, #-20]
	cmp	r3, #0
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
	str	r3, [fp, #-20]
	b	.L23
.L20:
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	lsl	r3, r3, #24
	asr	r3, r3, #24
	cmp	r3, #0
	bge	.L23
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	and	r3, r3, #127
	ldr	r2, .L27+16
	ldrb	r3, [r2, r3]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L23
	ldr	r3, [fp, #-20]
	cmp	r3, #0
	beq	.L21
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	and	r3, r3, #127
	ldr	r2, .L27+20
	ldrb	r3, [r2, r3]	@ zero_extendqisi2
	strb	r3, [fp, #-21]
	b	.L22
.L21:
	ldrb	r3, [fp, #-21]	@ zero_extendqisi2
	and	r3, r3, #127
	ldr	r2, .L27+16
	ldrb	r3, [r2, r3]	@ zero_extendqisi2
	strb	r3, [fp, #-21]
.L22:
	sub	r3, fp, #21
	mov	r2, #1
	mov	r1, r3
	mov	r0, #1
	bl	write
	mov	r3, r0
	cmp	r3, #1
	beq	.L23
	ldr	r0, .L27+24
	bl	perror
	mvn	r3, #0
	b	.L25
.L14:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bge	.L23
	ldr	r0, .L27+28
	bl	perror
.L23:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bgt	.L13
	ldr	r0, [fp, #-16]
	bl	close
	mov	r3, r0
	cmp	r3, #0
	beq	.L24
	ldr	r0, .L27+32
	bl	perror
	mvn	r3, #0
	b	.L25
.L24:
	mov	r3, #0
.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	.LC9
	.word	stderr
	.word	.LC4
	.word	.LC5
	.word	key_chars
	.word	shift_chars
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
