
.intel_syntax noprefix

.global DefaultConstructor
.global ComAlloc

.extern CreateExternalFromType
.extern SearchInStruct
.extern EvalOperand
.extern InsertLineQueue
.extern RunLineQueue
.extern AddLineQueueX
.extern AddLineQueue
.extern tsprintf
.extern asmerr
.extern SymFind
.extern tstrcat
.extern tstrcpy


.SECTION .text
	.ALIGN	16

$_001:	mov	qword ptr [rsp+0x8], rcx
	mov	qword ptr [rsp+0x18], r8
	mov	qword ptr [rsp+0x20], r9
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 600
	mov	rsi, rdx
	mov	qword ptr [rbp-0x210], rsi
	mov	rax, qword ptr [rbp+0x48]
	mov	qword ptr [rbp-0x208], rax
	cmp	dword ptr [rsi+0x60], 0
	je	$_015
	mov	rdx, qword ptr [rsi+0x78]
	mov	rdi, qword ptr [rdx]
$_002:	test	rdi, rdi
	je	$_015
	cmp	qword ptr [rdi+0x28], 0
	je	$_014
	mov	rdx, qword ptr [rdi+0x28]
	cmp	word ptr [rdx+0x6E], 1
	jnz	$_003
	lea	rax, [rbp-0x210]
	mov	qword ptr [rsp+0x20], rax
	mov	r9d, dword ptr [rbp+0x40]
	mov	r8d, dword ptr [rbp+0x38]
	mov	rcx, qword ptr [rbp+0x28]
	call	$_001
	mov	dword ptr [rbp+0x40], eax
	jmp	$_014

$_003:	mov	dword ptr [rbp-0x214], 0
	mov	byte ptr [rbp-0x216], 0
	mov	byte ptr [rbp-0x215], 1
	mov	rdx, qword ptr [rbp+0x28]
	lea	rcx, [rbp-0x100]
	call	tstrcpy@PLT
	lea	rdx, [DS0000+rip]
	mov	rcx, rax
	call	tstrcat@PLT
	mov	rdx, qword ptr [rdi+0x8]
	mov	rcx, rax
	call	tstrcat@PLT
	mov	rcx, rax
	call	SymFind@PLT
	test	rax, rax
	jz	$_006
	mov	byte ptr [rbp-0x215], 0
	cmp	byte ptr [rax+0x1D], 9
	jz	$_004
	cmp	byte ptr [rax+0x1D], 10
	jnz	$_005
$_004:	mov	dword ptr [rbp-0x214], 1
$_005:	jmp	$_012

$_006:	lea	rbx, [rbp-0x210]
$_007:	test	rbx, rbx
	je	$_012
	mov	rcx, qword ptr [rbx]
	cmp	dword ptr [rcx+0x14], 4
	jle	$_011
	mov	dword ptr [rsp+0x20], 0
	xor	r9d, r9d
	mov	r8d, dword ptr [rdi+0x18]
	mov	edx, dword ptr [rdi+0x14]
	call	SearchInStruct@PLT
	test	rax, rax
	je	$_011
	cmp	byte ptr [rbp-0x216], 0
	jnz	$_008
	mov	rax, qword ptr [rax+0x28]
	mov	qword ptr [rbp-0x220], rax
$_008:	mov	rcx, qword ptr [rbx]
	mov	rdx, qword ptr [rcx+0x8]
	lea	rcx, [rbp-0x200]
	call	tstrcpy@PLT
	mov	rcx, qword ptr [rbx]
	mov	edx, dword ptr [rcx+0x14]
	mov	byte ptr [rbp+rdx-0x204], 95
	mov	byte ptr [rbp+rdx-0x203], 0
	mov	rdx, qword ptr [rdi+0x8]
	mov	rcx, rax
	call	tstrcat@PLT
	mov	rcx, rax
	call	SymFind@PLT
	test	rax, rax
	jz	$_010
	inc	byte ptr [rbp-0x216]
	mov	byte ptr [rbp-0x215], 0
	cmp	byte ptr [rax+0x1D], 9
	jz	$_009
	cmp	byte ptr [rax+0x1D], 10
	jz	$_009
	lea	rdx, [rbp-0x200]
	lea	rcx, [rbp-0x100]
	call	tstrcpy@PLT
$_009:	jmp	$_011

$_010:	cmp	byte ptr [rbp-0x216], 0
	jnz	$_011
	inc	byte ptr [rbp-0x216]
	lea	rdx, [rbp-0x200]
	lea	rcx, [rbp-0x100]
	call	tstrcpy@PLT
$_011:	mov	rbx, qword ptr [rbx+0x8]
	jmp	$_007

$_012:	cmp	dword ptr [rbp-0x214], 0
	jnz	$_014
	cmp	byte ptr [rbp-0x215], 0
	jz	$_013
	cmp	byte ptr [rbp-0x216], 0
	jz	$_013
	mov	rdx, qword ptr [rbp-0x220]
	lea	rcx, [rbp-0x100]
	call	CreateExternalFromType@PLT
$_013:	mov	ebx, dword ptr [rbp+0x38]
	dec	ebx
	lea	r8, [rbp-0x100]
	mov	edx, ebx
	lea	rcx, [DS0001+rip]
	call	AddLineQueueX@PLT
	movzx	eax, byte ptr [r14+0x4]
	shl	eax, 2
	mov	dword ptr [rsp+0x20], ebx
	mov	r9d, eax
	mov	r8d, dword ptr [rbp+0x40]
	mov	edx, dword ptr [rbp+0x38]
	lea	rcx, [DS0002+rip]
	call	AddLineQueueX@PLT
$_014:	mov	rdi, qword ptr [rdi+0x80]
	inc	dword ptr [rbp+0x40]
	jmp	$_002

$_015:
	mov	eax, dword ptr [rbp+0x40]
	dec	eax
	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret

DefaultConstructor:
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 376
	lea	rax, [DS0003+rip]
	mov	qword ptr [rbp-0x18], rax
	mov	dword ptr [rbp-0x8C], 779
	mov	rsi, rcx
	mov	rbx, rdx
	movzx	eax, byte ptr [r14+0x4]
	shl	eax, 2
	mov	dword ptr [rbp-0xC], eax
	mov	edi, dword ptr [r14+0x5C]
	mov	ecx, dword ptr [rsi+0x60]
	lea	edx, [rcx+rax-0x1]
	neg	eax
	and	edx, eax
	mov	dword ptr [rbp-0x8], edx
	jmp	$_024

$_016:	mov	rax, rbx
	sub	rax, qword ptr [r14+0x1D0]
	mov	ecx, 32
	xor	edx, edx
	div	ecx
	mov	dword ptr [rbp-0x1C], eax
	mov	byte ptr [rsp+0x20], 0
	lea	r9, [rbp-0x88]
	mov	r8d, dword ptr [r14+0x64]
	mov	rdx, qword ptr [r14+0x1D0]
	lea	rcx, [rbp-0x1C]
	call	EvalOperand@PLT
	cmp	eax, -1
	je	$_032
	cmp	dword ptr [rbp-0x4C], 0
	je	$_022
	cmp	dword ptr [rbp-0x4C], 1
	jnz	$_017
	cmp	byte ptr [rbp-0x44], 196
	jnz	$_017
	mov	dword ptr [rbp-0x8C], 808
$_017:	imul	edx, dword ptr [rbp-0x1C], 32
	add	rdx, qword ptr [r14+0x1D0]
	lea	rdi, [rbp-0x10C]
	mov	rcx, qword ptr [rdx+0x18]
	mov	rax, qword ptr [rbx+0x18]
	sub	rcx, rax
	xchg	rsi, rax
	rep movsb
	mov	byte ptr [rdi], 0
	mov	rsi, rax
	mov	edi, dword ptr [r14+0x5C]
	cmp	byte ptr [rdx], 44
	jnz	$_020
	cmp	byte ptr [rdx+0x20], 2
	jnz	$_018
	mov	dword ptr [rsp+0x30], edi
	mov	dword ptr [rsp+0x28], edi
	mov	dword ptr [rsp+0x20], 834
	mov	r9d, dword ptr [rsi+0x60]
	mov	r8d, dword ptr [rdx+0x24]
	mov	rdx, qword ptr [rbp-0x18]
	lea	rcx, [DS0004+rip]
	call	AddLineQueueX@PLT
	jmp	$_025

$_018:	inc	dword ptr [rbp-0x1C]
	mov	byte ptr [rsp+0x20], 0
	lea	r9, [rbp-0x88]
	mov	r8d, dword ptr [r14+0x64]
	mov	rdx, qword ptr [r14+0x1D0]
	lea	rcx, [rbp-0x1C]
	call	EvalOperand@PLT
	cmp	eax, -1
	je	$_032
	cmp	dword ptr [rbp-0x4C], 0
	jz	$_019
	mov	ecx, 2026
	call	asmerr@PLT
	jmp	$_032

$_019:	mov	ecx, dword ptr [rbp-0x88]
	add	ecx, dword ptr [rsi+0x60]
	jmp	$_021

$_020:	mov	ecx, dword ptr [rsi+0x60]
$_021:	mov	dword ptr [rsp+0x28], edi
	mov	dword ptr [rsp+0x20], edi
	mov	r9d, 834
	mov	r8d, ecx
	mov	rdx, qword ptr [rbp-0x18]
	lea	rcx, [DS0005+rip]
	call	AddLineQueueX@PLT
	jmp	$_025

$_022:	mov	dword ptr [rsp+0x38], edi
	mov	dword ptr [rsp+0x30], edi
	mov	dword ptr [rsp+0x28], 834
	mov	rax, qword ptr [rsi+0x8]
	mov	qword ptr [rsp+0x20], rax
	mov	r9d, dword ptr [rbp-0x8]
	mov	r8d, dword ptr [rbp-0x88]
	mov	rdx, qword ptr [rbp-0x18]
	lea	rcx, [DS0006+rip]
	call	AddLineQueueX@PLT
	xor	ebx, ebx
	jmp	$_025

$_023:	mov	dword ptr [rsp+0x30], edi
	mov	dword ptr [rsp+0x28], edi
	mov	dword ptr [rsp+0x20], 834
	mov	r9, qword ptr [rsi+0x8]
	mov	r8d, dword ptr [rbp-0x8]
	mov	rdx, qword ptr [rbp-0x18]
	lea	rcx, [DS0007+rip]
	call	AddLineQueueX@PLT
	jmp	$_025

$_024:	test	rbx, rbx
	jne	$_016
	jmp	$_023

$_025:	mov	eax, dword ptr [rbp-0xC]
	cmp	dword ptr [rbp-0x8], eax
	jle	$_028
	mov	ecx, eax
	lea	eax, [rdi+0x7]
	lea	edx, [rdi+0x2]
	mov	dword ptr [rbp-0x4], eax
	mov	eax, dword ptr [rbp-0x8]
	mov	dword ptr [rsp+0x50], eax
	mov	eax, dword ptr [rbp-0x4]
	mov	dword ptr [rsp+0x48], eax
	mov	dword ptr [rsp+0x40], edi
	mov	dword ptr [rsp+0x38], ecx
	mov	eax, dword ptr [rbp-0x8]
	mov	dword ptr [rsp+0x30], eax
	mov	dword ptr [rsp+0x28], ecx
	mov	dword ptr [rsp+0x20], edi
	mov	r9d, dword ptr [rbp-0x4]
	mov	r8d, dword ptr [rbp-0x4]
	lea	rcx, [DS0008+rip]
	call	AddLineQueueX@PLT
	lea	edx, [rdi+0x2]
	test	rbx, rbx
	jz	$_026
	lea	rax, [rbp-0x10C]
	mov	qword ptr [rsp+0x28], rax
	mov	dword ptr [rsp+0x20], edx
	mov	r9d, dword ptr [rbp-0x8C]
	mov	r8d, edx
	mov	edx, dword ptr [rbp-0x4]
	lea	rcx, [DS0009+rip]
	call	AddLineQueueX@PLT
	jmp	$_027

$_026:	mov	r8d, edx
	mov	edx, dword ptr [rbp-0x4]
	lea	rcx, [DS000A+rip]
	call	AddLineQueueX@PLT
$_027:	jmp	$_030

$_028:	test	rbx, rbx
	jz	$_029
	lea	r9, [rbp-0x10C]
	lea	r8, [rdi+0x2]
	mov	edx, dword ptr [rbp-0x8C]
	lea	rcx, [DS0009+0xC+rip]
	call	AddLineQueueX@PLT
	jmp	$_030

$_029:	mov	r9d, dword ptr [rbp-0x8]
	mov	r8d, edi
	lea	rdx, [rdi+0x2]
	lea	rcx, [DS000B+rip]
	call	AddLineQueueX@PLT
$_030:	lea	r8, [rdi+0x2]
	mov	edx, edi
	lea	rcx, [DS000C+rip]
	call	AddLineQueueX@PLT
	test	rbx, rbx
	jnz	$_031
	mov	qword ptr [rsp+0x20], 0
	xor	r9d, r9d
	lea	r8d, [rdi+0x2]
	mov	rdx, qword ptr [rsi+0x40]
	mov	rcx, qword ptr [rsi+0x8]
	call	$_001
$_031:	lea	rcx, [DS000D+rip]
	call	AddLineQueue@PLT
	mov	eax, edi
$_032:	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret

ComAlloc:
	mov	qword ptr [rsp+0x8], rcx
	mov	qword ptr [rsp+0x10], rdx
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 40
	mov	rbx, rdx
	xor	eax, eax
	mov	ecx, 668734541
	sub	ecx, dword ptr [rbx+0x8]
	test	ecx, ecx
	jz	$_036
	jmp	$_035

$_033:	cmp	byte ptr [rbx], 8
	jnz	$_034
	mov	ecx, 668734541
	sub	ecx, dword ptr [rbx+0x8]
	jz	$_036
$_034:	add	rbx, 32
$_035:	cmp	byte ptr [rbx], 0
	jnz	$_033
$_036:	test	ecx, ecx
	jne	$_047
	add	rbx, 64
	cmp	byte ptr [rbx-0x20], 40
	jz	$_037
	xor	eax, eax
	jmp	$_047

$_037:	mov	rcx, qword ptr [rbx+0x10]
	call	SymFind@PLT
	test	rax, rax
	jz	$_038
	cmp	byte ptr [rax+0x1D], 10
	jnz	$_038
	mov	rcx, qword ptr [rax+0x30]
	call	SymFind@PLT
$_038:	test	rax, rax
	jnz	$_039
	mov	rax, -1
	jmp	$_047

$_039:	cmp	byte ptr [rax+0x1D], 7
	jnz	$_042
	jmp	$_041

$_040:	mov	rax, qword ptr [rax+0x28]
$_041:	cmp	qword ptr [rax+0x28], 0
	jnz	$_040
$_042:	test	byte ptr [rax+0x12], 0x02
	jnz	$_043
	xor	eax, eax
	jmp	$_047

$_043:	mov	rsi, rax
	xor	edi, edi
	cmp	byte ptr [rbx+0x20], 44
	jnz	$_044
	cmp	byte ptr [rbx+0x40], 41
	jz	$_044
	lea	rdi, [rbx+0x40]
$_044:	cmp	qword ptr [r14+0x2B0], 0
	jz	$_045
	call	RunLineQueue@PLT
$_045:	mov	rdx, rdi
	mov	rcx, rsi
	call	DefaultConstructor
	mov	edi, eax
	call	InsertLineQueue@PLT
	sub	rbx, 64
	cmp	edi, -1
	jz	$_046
	cmp	rbx, qword ptr [rbp+0x30]
	jz	$_046
	mov	r8d, edi
	lea	rdx, [DS000C+0xB+rip]
	mov	rcx, qword ptr [rbp+0x28]
	call	tsprintf@PLT
$_046:	mov	eax, 1
$_047:	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret


.SECTION .data
	.ALIGN	16

DS0000:
	.byte  0x5F, 0x00

DS0001:
	.byte  0x6C, 0x65, 0x61, 0x20, 0x25, 0x72, 0x2C, 0x20
	.byte  0x25, 0x73, 0x00

DS0002:
	.byte  0x6D, 0x6F, 0x76, 0x20, 0x5B, 0x25, 0x72, 0x2B
	.byte  0x25, 0x64, 0x2A, 0x25, 0x64, 0x5D, 0x2C, 0x20
	.byte  0x25, 0x72, 0x00

DS0003:
	.byte  0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63, 0x00

DS0004:
	.byte  0x25, 0x73, 0x28, 0x61, 0x64, 0x64, 0x72, 0x20
	.byte  0x5B, 0x25, 0x72, 0x2B, 0x25, 0x64, 0x5D, 0x29
	.byte  0x0A, 0x25, 0x72, 0x20, 0x25, 0x72, 0x2C, 0x25
	.byte  0x72, 0x0A, 0x6A, 0x7A, 0x20, 0x40, 0x46, 0x00

DS0005:
	.byte  0x25, 0x73, 0x28, 0x25, 0x64, 0x29, 0x0A, 0x25
	.byte  0x72, 0x20, 0x25, 0x72, 0x2C, 0x25, 0x72, 0x0A
	.byte  0x6A, 0x7A, 0x20, 0x40, 0x46, 0x00

DS0006:
	.byte  0x25, 0x73, 0x28, 0x25, 0x64, 0x2B, 0x25, 0x64
	.byte  0x2B, 0x25, 0x73, 0x56, 0x74, 0x62, 0x6C, 0x29
	.byte  0x0A, 0x25, 0x72, 0x20, 0x25, 0x72, 0x2C, 0x25
	.byte  0x72, 0x0A, 0x6A, 0x7A, 0x20, 0x40, 0x46, 0x00

DS0007:
	.byte  0x25, 0x73, 0x28, 0x25, 0x64, 0x2B, 0x25, 0x73
	.byte  0x56, 0x74, 0x62, 0x6C, 0x29, 0x0A, 0x25, 0x72
	.byte  0x20, 0x25, 0x72, 0x2C, 0x25, 0x72, 0x0A, 0x6A
	.byte  0x7A, 0x20, 0x40, 0x46, 0x00

DS0008:
	.byte  0x20, 0x6D, 0x6F, 0x76, 0x20, 0x25, 0x72, 0x2C
	.byte  0x20, 0x25, 0x72, 0x0A, 0x20, 0x6C, 0x65, 0x61
	.byte  0x20, 0x25, 0x72, 0x2C, 0x20, 0x5B, 0x25, 0x72
	.byte  0x2B, 0x25, 0x64, 0x5D, 0x0A, 0x20, 0x6D, 0x6F
	.byte  0x76, 0x20, 0x65, 0x63, 0x78, 0x2C, 0x20, 0x25
	.byte  0x64, 0x2D, 0x25, 0x64, 0x0A, 0x20, 0x78, 0x6F
	.byte  0x72, 0x20, 0x65, 0x61, 0x78, 0x2C, 0x20, 0x65
	.byte  0x61, 0x78, 0x0A, 0x20, 0x72, 0x65, 0x70, 0x20
	.byte  0x73, 0x74, 0x6F, 0x73, 0x62, 0x0A, 0x20, 0x6C
	.byte  0x65, 0x61, 0x20, 0x25, 0x72, 0x2C, 0x20, 0x5B
	.byte  0x25, 0x72, 0x2D, 0x25, 0x64, 0x5D, 0x00

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

DS000A:
	.byte  0x20, 0x78, 0x63, 0x68, 0x67, 0x20, 0x25, 0x72
	.byte  0x2C, 0x20, 0x25, 0x72, 0x00

DS000B:
	.byte  0x20, 0x6C, 0x65, 0x61, 0x20, 0x25, 0x72, 0x2C
	.byte  0x20, 0x5B, 0x25, 0x72, 0x2B, 0x25, 0x64, 0x5D
	.byte  0x00

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

DS000D:
	.byte  0x40, 0x40, 0x3A, 0x00


.att_syntax prefix
