
.intel_syntax noprefix

.global FindDotSymbol
.global AssignPointer
.global HandleIndirection

.extern AddLineQueueX
.extern SearchNameInStruct
.extern RetLineQueue
.extern asmerr
.extern SymFindID


.SECTION .text
	.ALIGN	16

$_001:	push	rbx
	push	rbp
	mov	rbp, rsp
	mov	rbx, rcx
	xor	edx, edx
	mov	ecx, 1
	add	rbx, 32
$_002:	test	ecx, ecx
	jz	$_007
	cmp	byte ptr [rbx], 0
	jz	$_007
	mov	al, byte ptr [rbx]
	cmp	al, 40
	jnz	$_003
	inc	edx
	jmp	$_006

$_003:	cmp	al, 41
	jnz	$_004
	dec	edx
	jmp	$_006

$_004:	test	edx, edx
	jnz	$_005
	cmp	al, 91
	jnz	$_005
	inc	ecx
	jmp	$_006

$_005:	test	edx, edx
	jnz	$_006
	cmp	al, 93
	jnz	$_006
	dec	ecx
	jnz	$_006
	add	rbx, 32
	mov	rax, rbx
	jmp	$_008

$_006:	add	rbx, 32
	jmp	$_002

$_007:	xor	eax, eax
$_008:	leave
	pop	rbx
	ret

$_009:
	push	rsi
	push	rdi
	push	rbp
	mov	rbp, rsp
	sub	rsp, 32
	mov	rdi, rdx
	mov	rsi, rcx
	call	$_001
	test	rax, rax
	jz	$_010
	mov	rcx, qword ptr [rax+0x18]
	mov	rsi, qword ptr [rsi+0x18]
	sub	rcx, rsi
	rep movsb
	mov	byte ptr [rdi], 0
$_010:	leave
	pop	rdi
	pop	rsi
	ret

FindDotSymbol:
	mov	qword ptr [rsp+0x8], rcx
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 40
	mov	rbx, rcx
$_011:	cmp	byte ptr [rbx-0x20], 44
	jz	$_012
	cmp	byte ptr [rbx-0x20], 3
	jz	$_012
	sub	rbx, 32
	jmp	$_011

$_012:
	mov	rcx, rbx
	call	SymFindID@PLT
	test	rax, rax
	jz	$_019
	mov	rsi, rax
	add	rbx, 32
	jmp	$_018

$_013:	cmp	byte ptr [rbx], 44
	jnz	$_014
	xor	eax, eax
	jmp	$_019

$_014:	cmp	byte ptr [rbx], 91
	jnz	$_015
	mov	rcx, rbx
	call	$_001
	test	rax, rax
	jz	$_019
	mov	rbx, rax
$_015:	xor	eax, eax
	cmp	byte ptr [rbx], 46
	jnz	$_019
	add	rbx, 32
	cmp	byte ptr [rsi+0x1E], 196
	jnz	$_016
	mov	rsi, qword ptr [rsi+0x28]
$_016:	cmp	byte ptr [rsi+0x1E], 195
	jnz	$_017
	mov	rsi, qword ptr [rsi+0x50]
$_017:	test	rsi, rsi
	jz	$_019
	cmp	byte ptr [rsi+0x1D], 7
	jnz	$_019
	xor	r9d, r9d
	xor	r8d, r8d
	mov	rdx, qword ptr [rbx+0x10]
	mov	rcx, rsi
	call	SearchNameInStruct@PLT
	mov	rsi, rax
	test	rsi, rsi
	jz	$_019
	cmp	rbx, qword ptr [rbp+0x28]
	jz	$_019
	add	rbx, 32
$_018:	cmp	byte ptr [rbx], 0
	jnz	$_013
$_019:	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret

$_020:
	push	rsi
	push	rdi
	push	rbp
	mov	rbp, rsp
	sub	rsp, 176
	mov	rsi, rcx
	mov	edi, edx
	cmp	byte ptr [rbx], 91
	jnz	$_022
	lea	rdx, [rbp-0x80]
	mov	rcx, rbx
	call	$_009
	test	rax, rax
	jnz	$_021
	jmp	$_031

$_021:	mov	rbx, rax
	lea	r9, [rbp-0x80]
	mov	r8d, edi
	mov	edx, edi
	lea	rcx, [DS0000+rip]
	call	AddLineQueueX@PLT
$_022:	cmp	byte ptr [rbx], 46
	jz	$_023
	xor	eax, eax
	jmp	$_031

$_023:	add	rbx, 32
	cmp	byte ptr [rsi+0x1E], 196
	jnz	$_024
	mov	rsi, qword ptr [rsi+0x28]
$_024:	cmp	byte ptr [rsi+0x1E], 195
	jnz	$_025
	mov	rsi, qword ptr [rsi+0x50]
$_025:	test	rsi, rsi
	jz	$_026
	cmp	byte ptr [rsi+0x1D], 7
	jz	$_027
$_026:	xor	eax, eax
	jmp	$_031

$_027:	xor	r9d, r9d
	xor	r8d, r8d
	mov	rdx, qword ptr [rbx+0x10]
	mov	rcx, rsi
	call	SearchNameInStruct@PLT
	mov	rdx, rax
	mov	ecx, 779
	test	rax, rax
	jz	$_030
$_028:	cmp	byte ptr [rax+0x1E], 196
	jnz	$_029
	mov	rax, qword ptr [rax+0x28]
	jmp	$_028

$_029:	cmp	byte ptr [rax+0x49], 0
	jnz	$_030
	mov	ecx, 808
$_030:	xchg	rsi, rdx
	mov	rax, qword ptr [rbx+0x10]
	mov	qword ptr [rsp+0x28], rax
	mov	rax, qword ptr [rdx+0x8]
	mov	qword ptr [rsp+0x20], rax
	mov	r9d, edi
	mov	r8d, edi
	mov	edx, ecx
	lea	rcx, [DS0001+rip]
	call	AddLineQueueX@PLT
	mov	rax, rsi
$_031:	leave
	pop	rdi
	pop	rsi
	ret

AssignPointer:
	mov	qword ptr [rsp+0x10], rdx
	mov	qword ptr [rsp+0x20], r9
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 40
	mov	rbx, r8
	mov	rsi, rcx
	test	rsi, rsi
	jnz	$_035
	cmp	byte ptr [rbx], 2
	jnz	$_033
	mov	eax, dword ptr [rbp+0x30]
	cmp	dword ptr [rbx+0x4], eax
	jz	$_032
	mov	r8d, dword ptr [rbx+0x4]
	mov	edx, dword ptr [rbp+0x30]
	lea	rcx, [DS0002+rip]
	call	AddLineQueueX@PLT
$_032:	jmp	$_034

$_033:	mov	r8, qword ptr [rbx+0x18]
	mov	edx, dword ptr [rbp+0x30]
	lea	rcx, [DS0003+rip]
	call	AddLineQueueX@PLT
$_034:	mov	rax, rsi
	jmp	$_048

$_035:	mov	byte ptr [rbp-0x5], 0
	mov	rdi, qword ptr [rbp+0x40]
	test	rdi, rdi
	je	$_043
	test	byte ptr [rdi+0x13], 0x01
	je	$_043
	xor	eax, eax
	jmp	$_040

$_036:	mov	eax, 170
	jmp	$_041

$_037:	mov	r8d, 21
	mov	edx, dword ptr [rbp+0x30]
	lea	rcx, [DS0004+rip]
	call	AddLineQueueX@PLT
	mov	eax, dword ptr [rbp+0x30]
	mov	qword ptr [rbp+0x50], rsi
	jmp	$_041

$_038:	mov	eax, 1
$_039:	add	eax, dword ptr [r14+0x5C]
	jmp	$_041

$_040:	cmp	dword ptr [rbp+0x48], 2
	jz	$_036
	cmp	dword ptr [rbp+0x48], 1
	jz	$_037
	cmp	dword ptr [rbp+0x48], 3
	jz	$_037
	cmp	dword ptr [rbp+0x48], 7
	jz	$_038
	cmp	dword ptr [rbp+0x48], 9
	jz	$_039
	cmp	dword ptr [rbp+0x48], 10
	jz	$_039
$_041:	test	eax, eax
	jz	$_043
	mov	ecx, dword ptr [rbp+0x30]
	mov	dword ptr [rbp+0x30], eax
	mov	edi, eax
	mov	dword ptr [rbp-0x4], ecx
	add	rbx, 32
	mov	edx, edi
	mov	rcx, rsi
	call	$_020
	test	rax, rax
	jnz	$_042
	mov	rax, rsi
	jmp	$_048

$_042:	mov	rsi, rax
	inc	byte ptr [rbp-0x5]
$_043:	cmp	byte ptr [rbp-0x5], 0
	jnz	$_044
	mov	r8, qword ptr [rsi+0x8]
	mov	edx, dword ptr [rbp+0x30]
	lea	rcx, [DS0003+rip]
	call	AddLineQueueX@PLT
$_044:	add	rbx, 32
$_045:	cmp	byte ptr [rbx], 44
	jz	$_046
	cmp	byte ptr [rbx], 0
	jz	$_046
	mov	edx, dword ptr [rbp+0x30]
	mov	rcx, rsi
	call	$_020
	test	rax, rax
	jz	$_046
	mov	rsi, rax
	add	rbx, 32
	jmp	$_045

$_046:	cmp	byte ptr [rbp-0x5], 0
	jz	$_047
	cmp	qword ptr [rbp+0x50], 0
	jnz	$_047
	mov	r8d, dword ptr [rbp+0x30]
	mov	edx, dword ptr [rbp-0x4]
	lea	rcx, [DS0004+rip]
	call	AddLineQueueX@PLT
$_047:	mov	rax, rsi
$_048:	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret

HandleIndirection:
	mov	qword ptr [rsp+0x8], rcx
	mov	qword ptr [rsp+0x18], r8
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 200
	mov	rbx, rdx
	cmp	dword ptr [rbp+0x38], 0
	jz	$_050
	mov	byte ptr [rbp-0x8D], 0
	mov	eax, dword ptr [rbx-0x1C]
	cmp	byte ptr [rbx-0x20], 40
	jnz	$_049
	mov	eax, dword ptr [rbx-0x3C]
	inc	byte ptr [rbp-0x8D]
$_049:	mov	dword ptr [rbp-0x8], eax
	jmp	$_051

$_050:	mov	eax, dword ptr [rbx-0x5C]
	mov	dword ptr [rbp-0x8], eax
	mov	eax, dword ptr [rbx-0x3C]
	mov	dword ptr [rbp-0xC], eax
$_051:	mov	eax, dword ptr [r14+0x5C]
	mov	dword ptr [rbp-0x4], eax
	mov	r8, qword ptr [rbx+0x10]
	mov	edx, eax
	lea	rcx, [DS0003+rip]
	call	AddLineQueueX@PLT
	add	rbx, 32
	mov	rsi, qword ptr [rbp+0x28]
	jmp	$_061

$_052:	cmp	byte ptr [rbx], 91
	jnz	$_053
	lea	rdx, [rbp-0x8C]
	mov	rcx, rbx
	call	$_009
	test	rax, rax
	je	$_062
	mov	rbx, rax
	lea	r9, [rbp-0x8C]
	mov	r8d, dword ptr [rbp-0x4]
	mov	edx, dword ptr [rbp-0x4]
	lea	rcx, [DS0000+rip]
	call	AddLineQueueX@PLT
$_053:	cmp	byte ptr [rbx], 46
	jne	$_062
	cmp	dword ptr [rbp+0x38], 0
	jz	$_056
	cmp	byte ptr [rbx+0x40], 91
	jnz	$_054
	lea	rcx, [rbx+0x40]
	call	$_001
	test	rax, rax
	je	$_062
	cmp	byte ptr [rax], 46
	jne	$_062
	jmp	$_055

$_054:	cmp	byte ptr [rbx+0x40], 46
	jne	$_062
$_055:	jmp	$_057

$_056:	cmp	byte ptr [rbx+0x40], 46
	jne	$_062
$_057:	cmp	byte ptr [rsi+0x1E], 196
	jnz	$_058
	mov	rsi, qword ptr [rsi+0x28]
$_058:	cmp	byte ptr [rsi+0x1E], 195
	jnz	$_059
	mov	rsi, qword ptr [rsi+0x50]
$_059:	xor	r9d, r9d
	xor	r8d, r8d
	mov	rdx, qword ptr [rbx+0x30]
	mov	rcx, rsi
	call	SearchNameInStruct@PLT
	test	rax, rax
	jnz	$_060
	mov	ecx, 2166
	call	asmerr@PLT
	jmp	$_068

$_060:	mov	rdi, rax
	cmp	byte ptr [rax+0x1E], 196
	jnz	$_062
	mov	rax, qword ptr [rax+0x28]
	cmp	byte ptr [rax+0x1E], 195
	jnz	$_062
	mov	rax, qword ptr [rbx+0x30]
	mov	qword ptr [rsp+0x20], rax
	mov	r9, qword ptr [rsi+0x8]
	mov	r8d, dword ptr [rbp-0x4]
	mov	edx, dword ptr [rbp-0x4]
	lea	rcx, [DS0005+rip]
	call	AddLineQueueX@PLT
	add	rbx, 64
	mov	rsi, rdi
$_061:	cmp	byte ptr [rbx], 0
	jz	$_062
	cmp	byte ptr [rbx], 44
	jne	$_052
$_062:	cmp	byte ptr [rsi+0x1E], 196
	jnz	$_063
	mov	rsi, qword ptr [rsi+0x28]
$_063:	cmp	byte ptr [rsi+0x1E], 195
	jnz	$_064
	mov	rsi, qword ptr [rsi+0x50]
$_064:	cmp	dword ptr [rbp+0x38], 0
	jz	$_066
	lea	rcx, [DS0006+rip]
	cmp	byte ptr [rbp-0x8D], 0
	jz	$_065
	lea	rcx, [DS0007+rip]
$_065:	mov	rax, qword ptr [rbx+0x18]
	mov	qword ptr [rsp+0x20], rax
	mov	r9, qword ptr [rsi+0x8]
	mov	r8d, dword ptr [rbp-0x4]
	mov	edx, dword ptr [rbp-0x8]
	call	AddLineQueueX@PLT
	jmp	$_067

$_066:	mov	rax, qword ptr [rbx+0x38]
	mov	qword ptr [rsp+0x28], rax
	mov	rax, qword ptr [rsi+0x8]
	mov	qword ptr [rsp+0x20], rax
	mov	r9d, dword ptr [rbp-0x4]
	mov	r8d, dword ptr [rbp-0xC]
	mov	edx, dword ptr [rbp-0x8]
	lea	rcx, [DS0001+rip]
	call	AddLineQueueX@PLT
$_067:	call	RetLineQueue@PLT
$_068:	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret


.SECTION .data
	.ALIGN	16

DS0000:
	.byte  0x20, 0x6C, 0x65, 0x61, 0x20, 0x25, 0x72, 0x2C
	.byte  0x20, 0x5B, 0x25, 0x72, 0x5D, 0x25, 0x73, 0x00

DS0001:
	.byte  0x20, 0x25, 0x72, 0x20, 0x25, 0x72, 0x2C, 0x20
	.byte  0x5B, 0x25, 0x72, 0x5D, 0x2E, 0x25, 0x73, 0x2E
	.byte  0x25, 0x73, 0x00

DS0002:
	.byte  0x20, 0x6D, 0x6F, 0x76, 0x20, 0x25, 0x72, 0x2C
	.byte  0x20, 0x25, 0x72, 0x00

DS0003:
	.byte  0x20, 0x6D, 0x6F, 0x76, 0x20, 0x25, 0x72, 0x2C
	.byte  0x20, 0x25, 0x73, 0x00

DS0004:
	.byte  0x20, 0x6D, 0x6F, 0x76, 0x20, 0x25, 0x72, 0x2C
	.byte  0x20, 0x5B, 0x25, 0x72, 0x5D, 0x00

DS0005:
	.byte  0x20, 0x6D, 0x6F, 0x76, 0x20, 0x25, 0x72, 0x2C
	.byte  0x20, 0x5B, 0x25, 0x72, 0x5D, 0x2E, 0x25, 0x73
	.byte  0x2E, 0x25, 0x73, 0x00

DS0006:
	.byte  0x20, 0x25, 0x72, 0x20, 0x5B, 0x25, 0x72, 0x5D
	.byte  0x2E, 0x25, 0x73, 0x25, 0x73, 0x00

DS0007:
	.byte  0x20, 0x25, 0x72, 0x20, 0x28, 0x20, 0x5B, 0x25
	.byte  0x72, 0x5D, 0x2E, 0x25, 0x73, 0x25, 0x73, 0x00


.att_syntax prefix
