
.intel_syntax noprefix

.global dwarf_create_sections

.extern getcwd
.extern CreateIntSegment
.extern SymTables
.extern store_fixup
.extern CreateFixup
.extern LclAlloc
.extern get_logo
.extern asmerr
.extern tstrrchr
.extern tstrlen
.extern tmemcpy


.SECTION .text
	.ALIGN	16

$_001:	mov	qword ptr [rsp+0x8], rcx
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 40
	mov	rsi, rcx
	mov	rbx, qword ptr [r14+0x1E0]
	test	rsi, rsi
	jz	$_002
	cmp	byte ptr [rsi], 0
	jnz	$_003
$_002:	mov	rax, rsi
	jmp	$_022

$_003:	mov	rdi, rbx
	cmp	byte ptr [rsi], 47
	jnz	$_004
	inc	rsi
	jmp	$_006

$_004:	mov	esi, 2048
	mov	rdi, rbx
	call	getcwd@PLT
	test	rax, rax
	je	$_022
	mov	rbx, rax
	mov	rcx, rbx
	call	tstrlen@PLT
	lea	rdi, [rbx+rax]
	cmp	byte ptr [rdi-0x1], 47
	jnz	$_005
	dec	rdi
$_005:	mov	rsi, qword ptr [rbp+0x28]
$_006:	lea	rcx, [rbx+0x7FF]
	mov	byte ptr [rdi], 47
	jmp	$_021

$_007:	mov	ax, word ptr [rsi+0x1]
	cmp	byte ptr [rsi], 46
	jnz	$_012
	cmp	al, 46
	jnz	$_012
	test	ah, ah
	jz	$_008
	cmp	ah, 47
	jnz	$_012
$_008:	dec	rdi
	mov	al, byte ptr [rdi]
	cmp	al, 47
	jz	$_009
	cmp	rdi, rbx
	jnc	$_008
$_009:	cmp	rdi, rbx
	jnc	$_010
	xor	eax, eax
	jmp	$_022

$_010:	add	rsi, 2
	cmp	byte ptr [rsi], 0
	jz	$_011
	inc	rsi
$_011:	jmp	$_021

$_012:	cmp	byte ptr [rsi], 46
	jnz	$_015
	cmp	al, 47
	jz	$_013
	test	al, al
	jnz	$_015
$_013:	inc	rsi
	cmp	byte ptr [rsi], 0
	jz	$_014
	inc	rsi
$_014:	jmp	$_021

$_015:	mov	rdx, rdi
	mov	al, byte ptr [rsi]
	jmp	$_017

$_016:	inc	rsi
	inc	rdi
	mov	byte ptr [rdi], al
	mov	al, byte ptr [rsi]
$_017:	test	al, al
	jz	$_018
	cmp	al, 47
	jz	$_018
	cmp	rdi, rcx
	jc	$_016
$_018:	cmp	rdi, rcx
	jc	$_019
	xor	eax, eax
	jmp	$_022

$_019:	cmp	rdi, rdx
	jnz	$_020
	xor	eax, eax
	jmp	$_022

$_020:	inc	rdi
	mov	byte ptr [rdi], 47
	cmp	byte ptr [rsi], 47
	jnz	$_021
	inc	rsi
$_021:	cmp	byte ptr [rsi], 0
	jne	$_007
	mov	byte ptr [rdi], 0
	mov	rax, rbx
$_022:	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret

$_023:
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 104
	mov	rsi, rcx
	mov	rcx, qword ptr [r14+0x228]
	mov	rcx, qword ptr [rcx]
	call	$_001
	mov	rdi, rax
	test	rax, rax
	jnz	$_024
	mov	ecx, 1017
	call	asmerr@PLT
$_024:	lea	rcx, [rbp-0x40]
	call	get_logo@PLT
	mov	ebx, eax
	mov	rcx, rdi
	call	tstrlen@PLT
	lea	eax, [rbx+rax+0x1]
	mov	ebx, 25
	cmp	byte ptr [r14+0x5], 2
	jnz	$_025
	mov	ebx, 33
$_025:	add	ebx, eax
	mov	dword ptr [rsi+0x60], ebx
	mov	ecx, ebx
	call	LclAlloc@PLT
	mov	rdi, rax
	mov	rcx, qword ptr [rsi+0x78]
	mov	qword ptr [rcx+0x10], rdi
	sub	ebx, 4
	mov	dword ptr [rdi], ebx
	mov	word ptr [rdi+0x4], 2
	lea	rcx, [dwarf_seg+rip]
	xor	r8d, r8d
	mov	edx, 6
	mov	rcx, qword ptr [rcx+0x8]
	call	CreateFixup@PLT
	mov	dword ptr [rax+0x14], 6
	lea	rcx, [rdi+0x6]
	mov	r8, rcx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	mov	eax, 4
	cmp	byte ptr [r14+0x5], 2
	jnz	$_026
	mov	eax, 8
$_026:	mov	byte ptr [rdi+0xA], al
	mov	byte ptr [rdi+0xB], 1
	mov	rbx, qword ptr [SymTables+0x20+rip]
$_027:	test	rbx, rbx
	jz	$_028
	mov	rax, qword ptr [rbx+0x78]
	cmp	qword ptr [rax+0x38], 0
	jnz	$_028
	mov	rbx, qword ptr [rbx+0x80]
	jmp	$_027

$_028:
	test	rbx, rbx
	je	$_031
	cmp	byte ptr [r14+0x5], 2
	jne	$_029
	xor	r8d, r8d
	mov	edx, 7
	mov	rcx, rbx
	call	CreateFixup@PLT
	mov	dword ptr [rax+0x14], 12
	lea	rcx, [rdi+0xC]
	mov	r8, rcx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	mov	eax, dword ptr [rbx+0x60]
	mov	dword ptr [rdi+0x14], eax
	xor	r8d, r8d
	mov	edx, 7
	mov	rcx, rbx
	call	CreateFixup@PLT
	mov	dword ptr [rax+0x14], 20
	lea	rcx, [rdi+0x14]
	mov	r8, rcx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	lea	rcx, [dwarf_seg+rip]
	xor	r8d, r8d
	mov	edx, 6
	mov	rcx, qword ptr [rcx+0x10]
	call	CreateFixup@PLT
	mov	dword ptr [rax+0x14], 28
	lea	rcx, [rdi+0x1C]
	mov	r8, rcx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	lea	rdi, [rdi+0x20]
	jmp	$_030

$_029:	xor	r8d, r8d
	mov	edx, 6
	mov	rcx, rbx
	call	CreateFixup@PLT
	mov	dword ptr [rax+0x14], 12
	lea	rcx, [rdi+0xC]
	mov	r8, rcx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	mov	eax, dword ptr [rbx+0x60]
	mov	dword ptr [rdi+0x10], eax
	xor	r8d, r8d
	mov	edx, 6
	mov	rcx, rbx
	call	CreateFixup@PLT
	mov	dword ptr [rax+0x14], 16
	lea	rcx, [rdi+0x10]
	mov	r8, rcx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	lea	rcx, [dwarf_seg+rip]
	xor	r8d, r8d
	mov	edx, 6
	mov	rcx, qword ptr [rcx+0x10]
	call	CreateFixup@PLT
	mov	dword ptr [rax+0x14], 20
	lea	rcx, [rdi+0x14]
	mov	r8, rcx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	lea	rdi, [rdi+0x18]
$_030:	mov	edx, 47
	mov	rcx, qword ptr [r14+0x1E0]
	call	tstrrchr@PLT
	lea	rsi, [rax+0x1]
	mov	byte ptr [rax], 0
	mov	rcx, rsi
	call	tstrlen@PLT
	lea	ecx, [rax+0x1]
	rep movsb
	mov	rsi, qword ptr [r14+0x1E0]
	mov	rcx, rsi
	call	tstrlen@PLT
	lea	ecx, [rax+0x1]
	rep movsb
	lea	rsi, [rbp-0x40]
	mov	rcx, rsi
	call	tstrlen@PLT
	lea	ecx, [rax+0x1]
	rep movsb
$_031:	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret

$_032:
	push	rsi
	push	rdi
	push	rbp
	mov	rbp, rsp
	sub	rsp, 32
	mov	rsi, rcx
	mov	dword ptr [rsi+0x60], 21
	mov	ecx, 21
	call	LclAlloc@PLT
	mov	rdi, rax
	mov	rcx, qword ptr [rsi+0x78]
	mov	qword ptr [rcx+0x10], rdi
	mov	ecx, 21
	lea	rsi, [FlatStandardAbbrevs+rip]
	rep movsb
	leave
	pop	rdi
	pop	rsi
	ret

$_033:
	mov	eax, edx
	and	eax, 0x7F
	sar	edx, 7
	jnz	$_034
	test	eax, 0x40
	jz	$_036
$_034:	cmp	edx, -1
	jnz	$_035
	test	eax, 0x40
	jnz	$_036
$_035:	or	al, 0x80
	mov	byte ptr [rcx], al
	inc	rcx
	jmp	$_033

$_036:
	mov	byte ptr [rcx], al
	lea	rax, [rcx+0x1]
	ret

$_037:
	mov	qword ptr [rsp+0x8], rcx
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 56
	mov	ebx, edx
	mov	rdi, r8
	xor	esi, esi
	cmp	ecx, -1
	jl	$_038
	cmp	ecx, 2
	jle	$_039
$_038:	mov	byte ptr [rdi], 3
	mov	edx, ecx
	lea	rcx, [rdi+0x1]
	call	$_033
	sub	rax, rdi
	mov	esi, eax
	xor	ecx, ecx
$_039:	mov	dword ptr [rbp+0x28], ecx
	cmp	ebx, 0
	jge	$_040
	lea	rcx, [rdi+rsi+0x1]
	mov	byte ptr [rcx-0x1], 2
	mov	edx, ebx
	call	$_033
	sub	rax, rdi
	mov	esi, eax
	xor	ebx, ebx
$_040:	test	ebx, ebx
	jnz	$_041
	cmp	dword ptr [rbp+0x28], 0
	jnz	$_041
	mov	eax, esi
	mov	byte ptr [rdi+rax], 1
	inc	eax
	jmp	$_048

$_041:	sub	dword ptr [rbp+0x28], -1
	imul	eax, ebx, 4
	mov	dword ptr [rbp-0x4], eax
	cmp	eax, ebx
	jge	$_042
	jmp	$_045

$_042:	add	eax, dword ptr [rbp+0x28]
	cmp	eax, dword ptr [rbp-0x4]
	jnc	$_043
	jmp	$_045

$_043:	mov	dword ptr [rbp-0x4], eax
	cmp	eax, 242
	ja	$_044
	add	eax, 13
	mov	byte ptr [rdi+rsi], al
	lea	eax, [rsi+0x1]
	jmp	$_048

$_044:	cmp	ebx, 120
	jge	$_045
	mov	byte ptr [rdi+rsi], 8
	inc	esi
	mov	eax, dword ptr [rbp-0x4]
	sub	eax, 240
	add	eax, 13
	mov	byte ptr [rdi+rsi], al
	lea	eax, [rsi+0x1]
	jmp	$_048

$_045:	mov	byte ptr [rdi+rsi], 2
	cmp	dword ptr [rbp+0x28], 1
	jnz	$_046
	mov	dword ptr [rbp-0x4], 1
	jmp	$_047

$_046:	mov	eax, ebx
	xor	edx, edx
	mov	ecx, 59
	div	ecx
	sub	ebx, edx
	imul	eax, edx, 4
	add	eax, dword ptr [rbp+0x28]
	add	eax, 13
	mov	dword ptr [rbp-0x4], eax
$_047:	mov	edx, ebx
	lea	rcx, [rdi+rsi+0x1]
	call	$_033
	mov	ecx, dword ptr [rbp-0x4]
	mov	byte ptr [rax], cl
	sub	rax, rdi
	inc	eax
$_048:	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret

$_049:
	push	rsi
	push	rdi
	push	rbx
	push	rbp
	mov	rbp, rsp
	sub	rsp, 56
	mov	rsi, rcx
	xor	edx, edx
	mov	rcx, qword ptr [SymTables+0x20+rip]
$_050:	test	rcx, rcx
	jz	$_053
	mov	rax, qword ptr [rcx+0x78]
	mov	rax, qword ptr [rax+0x38]
	test	rax, rax
	jz	$_052
	mov	rax, qword ptr [rax]
$_051:	test	rax, rax
	jz	$_052
	inc	edx
	mov	rax, qword ptr [rax]
	jmp	$_051

$_052:	mov	rcx, qword ptr [rcx+0x80]
	jmp	$_050

$_053:
	lea	ecx, [rdx+rdx+0x200]
	call	LclAlloc@PLT
	mov	rdi, rax
	mov	rcx, qword ptr [rsi+0x78]
	mov	qword ptr [rcx+0x10], rdi
	mov	word ptr [rdi+0x4], 2
	mov	byte ptr [rdi+0xA], 1
	mov	byte ptr [rdi+0xB], 1
	mov	byte ptr [rdi+0xC], 255
	mov	byte ptr [rdi+0xD], 4
	mov	byte ptr [rdi+0xE], 13
	mov	r8d, 12
	lea	rdx, [stdopsparms+rip]
	lea	rcx, [rdi+0xF]
	call	tmemcpy@PLT
	lea	rcx, [rax+0xD]
	mov	eax, 1
	mov	byte ptr [rcx-0x1], ah
	mov	rdx, qword ptr [r14+0x228]
	mov	rdx, qword ptr [rdx]
$_054:	test	eax, eax
	jz	$_055
	mov	al, byte ptr [rdx]
	mov	byte ptr [rcx], al
	inc	rdx
	inc	rcx
	jmp	$_054

$_055:
	mov	dword ptr [rcx], eax
	lea	rbx, [rcx+0x4]
	lea	rax, [rdi+0x6]
	sub	rcx, rax
	mov	dword ptr [rdi+0x6], ecx
	mov	rcx, qword ptr [SymTables+0x20+rip]
$_056:	test	rcx, rcx
	je	$_067
	mov	rax, qword ptr [rcx+0x78]
	mov	rax, qword ptr [rax+0x38]
	test	rax, rax
	je	$_066
	mov	rdx, qword ptr [rax]
	mov	qword ptr [rbp-0x10], rdx
	mov	qword ptr [rbp-0x8], rcx
	mov	eax, 131072
	cmp	byte ptr [r14+0x5], 2
	jnz	$_057
	mov	ah, 9
	mov	dword ptr [rbx], eax
	add	rbx, 3
	mov	eax, dword ptr [rdx+0xC]
	mov	qword ptr [rbx], rax
	xor	r8d, r8d
	mov	edx, 7
	call	CreateFixup@PLT
	mov	rcx, rbx
	sub	rcx, rdi
	mov	dword ptr [rax+0x14], ecx
	mov	r8, rbx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	add	rbx, 8
	jmp	$_058

$_057:	mov	ah, 5
	mov	dword ptr [rbx], eax
	add	rbx, 3
	mov	eax, dword ptr [rdx+0xC]
	mov	dword ptr [rbx], eax
	xor	r8d, r8d
	mov	edx, 6
	call	CreateFixup@PLT
	mov	rcx, rbx
	sub	rcx, rdi
	mov	dword ptr [rax+0x14], ecx
	mov	r8, rbx
	mov	rdx, rsi
	mov	rcx, rax
	call	store_fixup@PLT
	add	rbx, 4
$_058:	mov	rdx, qword ptr [rbp-0x10]
	mov	ecx, dword ptr [rdx+0x8]
	dec	ecx
	mov	r8, rbx
	mov	edx, dword ptr [rdx+0xC]
	call	$_037
	add	rbx, rax
	mov	rdx, qword ptr [rbp-0x10]
$_059:	test	rdx, rdx
	jz	$_065
	test	dword ptr [rdx+0xC], 0xFFF00000
	jz	$_060
	jmp	$_064

$_060:	mov	rax, qword ptr [rdx]
	test	rax, rax
	jnz	$_061
	mov	qword ptr [rbp-0x10], rdx
	mov	rcx, qword ptr [rbp-0x8]
	mov	eax, dword ptr [rcx+0x60]
	sub	eax, dword ptr [rdx+0xC]
	mov	r8, rbx
	mov	edx, eax
	mov	ecx, 1
	call	$_037
	jmp	$_063

$_061:	test	dword ptr [rax+0xC], 0xFFF00000
	jz	$_062
	jmp	$_064

	jmp	$_063

$_062:	mov	qword ptr [rbp-0x10], rdx
	mov	ecx, dword ptr [rax+0x8]
	sub	ecx, dword ptr [rdx+0x8]
	mov	eax, dword ptr [rax+0xC]
	sub	eax, dword ptr [rdx+0xC]
	mov	r8, rbx
	mov	edx, eax
	call	$_037
$_063:	add	rbx, rax
	mov	rdx, qword ptr [rbp-0x10]
$_064:	mov	rdx, qword ptr [rdx]
	jmp	$_059

$_065:	mov	rcx, qword ptr [rbp-0x8]
$_066:	mov	rcx, qword ptr [rcx+0x80]
	jmp	$_056

$_067:
	mov	byte ptr [rbx], 0
	mov	byte ptr [rbx+0x1], 1
	mov	byte ptr [rbx+0x2], 1
	add	rbx, 3
	lea	rax, [rdi]
	sub	rbx, rax
	sub	ebx, 4
	mov	dword ptr [rdi], ebx
	add	ebx, 4
	mov	dword ptr [rsi+0x60], ebx
	leave
	pop	rbx
	pop	rdi
	pop	rsi
	ret

dwarf_create_sections:
	push	rsi
	push	rdi
	sub	rsp, 56
	lea	rsi, [dwarf_segnames+rip]
	xor	edi, edi
$_068:	cmp	edi, 3
	jnc	$_069
	mov	dword ptr [rsp+0x20], 0
	movzx	r9d, byte ptr [r14+0x4]
	xor	r8d, r8d
	lea	rdx, [DS0003+rip]
	mov	rcx, qword ptr [rsi+rdi*8]
	call	CreateIntSegment@PLT
	lea	rcx, [dwarf_seg+rip]
	mov	qword ptr [rcx+rdi*8], rax
	inc	edi
	jmp	$_068

$_069:
	lea	rsi, [dwarf_seg+rip]
	mov	rcx, qword ptr [rsi]
	call	$_023
	mov	rcx, qword ptr [rsi+0x8]
	call	$_032
	mov	rcx, qword ptr [rsi+0x10]
	call	$_049
	add	rsp, 56
	pop	rdi
	pop	rsi
	ret


.SECTION .data
	.ALIGN	16

dwarf_segnames:
	.quad  DS0000
	.quad  DS0001
	.quad  DS0002

FlatStandardAbbrevs:
	.byte  0x01, 0x11, 0x00, 0x11, 0x01, 0x12, 0x01, 0x10
	.byte  0x06, 0x03, 0x08, 0x1B, 0x08, 0x25, 0x08, 0x13
	.byte  0x05, 0x00, 0x00, 0x00, 0x00

stdopsparms:
	.byte  0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00
	.byte  0x01, 0x00, 0x00, 0x01

DS0003:
	.byte  0x44, 0x57, 0x41, 0x52, 0x46, 0x00


.SECTION .rodata
	.ALIGN	16

DS0000:
	.byte  0x2E, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5F, 0x69
	.byte  0x6E, 0x66, 0x6F, 0x00

DS0001:
	.byte  0x2E, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5F, 0x61
	.byte  0x62, 0x62, 0x72, 0x65, 0x76, 0x00

DS0002:
	.byte  0x2E, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5F, 0x6C
	.byte  0x69, 0x6E, 0x65, 0x00


.SECTION .bss
	.ALIGN	16

dwarf_seg:
	.zero	24 * 1


.att_syntax prefix
