
.intel_syntax noprefix

.global LdrDirective

.extern RunLineQueue
.extern AddLineQueueX
.extern LstWrite
.extern GetCurrOffset
.extern get_fasttype
.extern CurrProc
.extern asmerr
.extern SymFind


.SECTION .text
	.ALIGN	16

$_001:	mov	qword ptr [rsp+0x8], rcx
	mov	qword ptr [rsp+0x10], rdx
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 72
	mov	dword ptr [rbp-0x8], 779
	mov	qword ptr [rbp-0x10], 0
	inc	dword ptr [rbp+0x18]
	imul	ebx, dword ptr [rbp+0x18], 32
	add	rbx, qword ptr [rbp+0x20]
	mov	rax, qword ptr [rbx+0x18]
	mov	qword ptr [rbp-0x18], rax
	mov	eax, dword ptr [rbx+0x4]
	mov	dword ptr [rbp-0x4], eax
	mov	rcx, qword ptr [CurrProc+rip]
	movzx	edx, byte ptr [rcx+0x1F]
	movzx	ecx, byte ptr [rcx+0x20]
	call	get_fasttype@PLT
	mov	al, byte ptr [rax+0xF]
	and	al, 0x31
	mov	byte ptr [rbp-0x19], al
	cmp	byte ptr [rbx], 2
	jz	$_004
	cmp	byte ptr [rbx], 8
	jnz	$_002
	cmp	byte ptr [rbx+0x20], 44
	jz	$_003
$_002:	jmp	$_021

$_003:	mov	rax, qword ptr [rbx+0x10]
	mov	qword ptr [rbp-0x10], rax
	mov	dword ptr [rbp-0x4], 0
$_004:	cmp	byte ptr [rbx], 44
	jz	$_005
	cmp	byte ptr [rbx], 0
	jz	$_005
	add	rbx, 32
	jmp	$_004

$_005:	cmp	byte ptr [rbx], 44
	jz	$_006
	mov	rdx, qword ptr [rbx+0x10]
	mov	ecx, 2008
	call	asmerr@PLT
	jmp	$_022

$_006:	add	rbx, 32
	cmp	byte ptr [rbx], 2
	jnz	$_010
	mov	ecx, dword ptr [rbx+0x4]
	cmp	dword ptr [rbp-0x4], 0
	jnz	$_007
	mov	r9d, ecx
	mov	r8, qword ptr [rbp-0x10]
	mov	edx, 779
	lea	rcx, [DS0000+rip]
	call	AddLineQueueX@PLT
	xor	eax, eax
	jmp	$_022

	jmp	$_009

$_007:	cmp	ecx, dword ptr [rbp-0x4]
	jnz	$_008
	xor	eax, eax
	jmp	$_022

	jmp	$_009

$_008:	cmp	ecx, 25
	jnz	$_009
	cmp	byte ptr [rbx+0x20], 58
	jnz	$_009
	mov	dword ptr [rbp-0x8], 729
$_009:	jmp	$_021

	jmp	$_011

$_010:	cmp	byte ptr [r14+0x4], 0
	jnz	$_011
	cmp	byte ptr [rbx], 91
	jnz	$_011
	jmp	$_021

$_011:	mov	rcx, qword ptr [rbx+0x10]
	call	SymFind@PLT
	test	rax, rax
	jnz	$_012
	mov	rdx, qword ptr [rbx+0x10]
	mov	ecx, 2008
	call	asmerr@PLT
	jmp	$_022

	jmp	$_019

$_012:	cmp	byte ptr [rbp-0x19], 0
	jz	$_019
	test	byte ptr [rax+0x11], 0x10
	jz	$_019
	movzx	ecx, byte ptr [rax+0x58]
	cmp	dword ptr [rbp-0x4], 0
	jnz	$_013
	mov	r9d, ecx
	mov	r8, qword ptr [rbp-0x10]
	mov	edx, 779
	lea	rcx, [DS0000+rip]
	call	AddLineQueueX@PLT
	jmp	$_018

$_013:	cmp	ecx, dword ptr [rbp-0x4]
	jz	$_018
	mov	ebx, 779
	test	byte ptr [rax+0x1E], 0x20
	jz	$_017
	cmp	dword ptr [rax+0x60], 4
	ja	$_014
	mov	ebx, 1143
	jmp	$_017

$_014:	cmp	dword ptr [rax+0x60], 8
	jnz	$_015
	mov	ebx, 709
	jmp	$_017

$_015:	cmp	dword ptr [rax+0x60], 16
	jnz	$_016
	mov	ebx, 1132
	jmp	$_017

$_016:	mov	ebx, 1550
$_017:	mov	r9d, ecx
	mov	r8d, dword ptr [rbp-0x4]
	mov	edx, ebx
	lea	rcx, [DS0001+rip]
	call	AddLineQueueX@PLT
$_018:	xor	eax, eax
	jmp	$_022

$_019:	cmp	byte ptr [r14+0x4], 0
	jnz	$_021
	cmp	dword ptr [rbp-0x4], 0
	jz	$_021
	cmp	byte ptr [rax+0x49], 0
	jz	$_021
	mov	cl, byte ptr [r14+0x15]
	cmp	dword ptr [rax+0x60], 4
	jz	$_020
	cmp	byte ptr [rax+0x1D], 2
	jnz	$_021
	cmp	cl, 3
	jz	$_020
	cmp	cl, 5
	jz	$_020
	cmp	cl, 6
	jnz	$_021
$_020:	mov	dword ptr [rbp-0x8], 729
	cmp	dword ptr [rbp-0x4], 15
	jnz	$_021
	mov	dword ptr [rbp-0x8], 728
$_021:	mov	r8, qword ptr [rbp-0x18]
	mov	edx, dword ptr [rbp-0x8]
	lea	rcx, [DS0002+rip]
	call	AddLineQueueX@PLT
	xor	eax, eax
$_022:	leave
	pop	rbx
	ret

LdrDirective:
	mov	qword ptr [rsp+0x8], rcx
	mov	qword ptr [rsp+0x10], rdx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 48
	cmp	qword ptr [CurrProc+rip], 0
	jnz	$_023
	mov	ecx, 2012
	call	asmerr@PLT
	jmp	$_026

$_023:	mov	rdx, qword ptr [rbp+0x18]
	mov	ecx, dword ptr [rbp+0x10]
	call	$_001
	mov	dword ptr [rbp-0x4], eax
	test	byte ptr [r14], 0x08
	jz	$_024
	call	GetCurrOffset@PLT
	xor	r8d, r8d
	mov	edx, eax
	mov	ecx, 4
	call	LstWrite@PLT
$_024:	cmp	qword ptr [r14+0x2B0], 0
	jz	$_025
	call	RunLineQueue@PLT
$_025:	mov	eax, dword ptr [rbp-0x4]
$_026:	leave
	ret


.SECTION .data
	.ALIGN	16

DS0000:
	.byte  0x20, 0x25, 0x72, 0x20, 0x25, 0x73, 0x2C, 0x20
	.byte  0x25, 0x72, 0x00

DS0001:
	.byte  0x20, 0x25, 0x72, 0x20, 0x25, 0x72, 0x2C, 0x20
	.byte  0x25, 0x72, 0x00

DS0002:
	.byte  0x20, 0x25, 0x72, 0x20, 0x25, 0x73, 0x00


.att_syntax prefix
