// File: /workspace/github_c_makefile_star2_O2/joncampbell123[P]swfhax/c4_swfdump.c
// Function: main
int main(int argc,char **argv) {
	swf_reader *swf;
	swf_tag tag;
	int fd;

	if (argc < 2) {
		fprintf(stderr,"c4_swfdump <file>\n");
		return 1;
	}

	fd = open(argv[1],O_RDONLY);
	if (fd < 0) {
		fprintf(stderr,"Unable to open file %s\n",argv[1]);
		return 1;
	}
	if ((swf=swf_reader_create()) == NULL) {
		fprintf(stderr,"Cannot create SWF reader\n");
		return 1;
	}
	if (swf_reader_assign_fd(swf,fd)) {
		fprintf(stderr,"Cannot assign fd\n");
		return 1;
	}
	swf_reader_assign_fd_ownership(swf);
	if (swf_reader_get_file_header(swf)) {
		fprintf(stderr,"Unable to read file header.\n");
		return 1;
	}

	printf("SWF version %u (%c%c%c), file length %lu\n",
		swf->header.Version,
		swf->header.Signature[0],
		swf->header.Signature[1],
		swf->header.Signature[2],
		(unsigned long)swf->header.FileLength);
	printf("   FrameSize: Nbits=%u (%.3f,%.3f)-(%.3f,%.3f) or in twips (%u,%u)-(%u,%u)\n",
		swf->header.FrameSize.Nbits,
		(double)swf->header.FrameSize.Xmin / SWF_TWIPS_PER_PIXEL,
		(double)swf->header.FrameSize.Ymin / SWF_TWIPS_PER_PIXEL,
		(double)swf->header.FrameSize.Xmax / SWF_TWIPS_PER_PIXEL,
		(double)swf->header.FrameSize.Ymax / SWF_TWIPS_PER_PIXEL,
		swf->header.FrameSize.Xmin,
		swf->header.FrameSize.Ymin,
		swf->header.FrameSize.Xmax,
		swf->header.FrameSize.Ymax);
	printf("   Frame rate: %.3f    Frame count: %lu\n",
		(double)swf->header.FrameRate / 256,
		(unsigned long)swf->header.FrameCount);
	printf("   Header ends at offset %llu\n",
		(unsigned long long)swf->header_end);

	while (swf_reader_read_record(swf,&tag)) {
		printf("Tag %u (%s), length %lu at %llu (data %llu)\n",(unsigned int)tag.record.TagCode,
			swf_TagCode_to_str(tag.record.TagCode),
			(unsigned long)tag.record.Length,
			(unsigned long long)tag.absolute_tag_offset,
			(unsigned long long)tag.absolute_offset);

		/* set read stop, so we can read the bitfields */
		swf->read_stop = swf->next_tag;

		switch (tag.record.TagCode) {
			case swftag_SetBackgroundColor: {
				swf_RGB BackgroundColor;

				swf_reader_read_RGB(swf,&BackgroundColor);
				printf("    BackgroundColor:      ");
				dump_RGB(&BackgroundColor);
				printf("\n");
				dump_tag_raw_remainder(swf);
				} break;
			case swftag_DefineShape:
			case swftag_DefineShape2:
			case swftag_DefineShape3: {
				swf_DefineShape nfo;

				if (swf_reader_read_DefineShape_header(swf,&nfo) == 0) {
					printf("    ShapeId:              %u\n",nfo.ShapeId);
					printf("    ShapeBounds:          (%.3f,%.3f)-(%.3f,%.3f) or (%d,%d)-(%d,%d) twips\n",
						(double)nfo.ShapeBounds.Xmin / SWF_TWIPS_PER_PIXEL,
						(double)nfo.ShapeBounds.Ymin / SWF_TWIPS_PER_PIXEL,
						(double)nfo.ShapeBounds.Xmax / SWF_TWIPS_PER_PIXEL,
						(double)nfo.ShapeBounds.Ymax / SWF_TWIPS_PER_PIXEL,

						nfo.ShapeBounds.Xmin,
						nfo.ShapeBounds.Ymin,
						nfo.ShapeBounds.Xmax,
						nfo.ShapeBounds.Ymax);

					/* SHAPEWITHSTYLE follows, which means we read a FILLSTYLEARRAY followed by
					 * a LINESTYLEARRAY, followed by a normal SHAPE definition */
					if (dump_FILLSTYLEARRAY(swf,tag.record.TagCode) == 0) {
						if (dump_LINESTYLEARRAY(swf,tag.record.TagCode) == 0) {
							dump_SHAPE(swf,0,tag.record.TagCode);
						}
					}
				}

				dump_tag_raw_remainder(swf);
				} break;
			case swftag_PlaceObject: {
				swf_PlaceObject nfo;

				if (swf_reader_read_PlaceObject(swf,&nfo) == 0) {
					printf("    CharacterId:          %u\n",nfo.CharacterId);
					printf("    Depth:                %u\n",nfo.Depth);
					printf("    Matrix:               ");
					dump_MATRIX(&nfo.Matrix);
					printf("\n");
					/* TODO: CXFORM */
				}
				} break;
			case swftag_RemoveObject: {
				swf_RemoveObject nfo;

				if (swf_reader_read_RemoveObject(swf,&nfo) == 0) {
					printf("    CharacterId:          %u\n",nfo.CharacterId);
					printf("    Depth:                %u\n",nfo.Depth);
				}
				} break;
			case swftag_DefineShape4: {
				swf_DefineShape nfo;

				if (swf_reader_read_DefineShape4_header(swf,&nfo) == 0) {
					printf("    ShapeId:              %u\n",nfo.ShapeId);
					printf("    ShapeBounds:          (%.3f,%.3f)-(%.3f,%.3f) or (%d,%d)-(%d,%d) twips\n",
						(double)nfo.ShapeBounds.Xmin / SWF_TWIPS_PER_PIXEL,
						(double)nfo.ShapeBounds.Ymin / SWF_TWIPS_PER_PIXEL,
						(double)nfo.ShapeBounds.Xmax / SWF_TWIPS_PER_PIXEL,
						(double)nfo.ShapeBounds.Ymax / SWF_TWIPS_PER_PIXEL,

						nfo.ShapeBounds.Xmin,
						nfo.ShapeBounds.Ymin,
						nfo.ShapeBounds.Xmax,
						nfo.ShapeBounds.Ymax);
					printf("    EdgeBounds:           (%.3f,%.3f)-(%.3f,%.3f) or (%d,%d)-(%d,%d) twips\n",
						(double)nfo.EdgeBounds.Xmin / SWF_TWIPS_PER_PIXEL,
						(double)nfo.EdgeBounds.Ymin / SWF_TWIPS_PER_PIXEL,
						(double)nfo.EdgeBounds.Xmax / SWF_TWIPS_PER_PIXEL,
						(double)nfo.EdgeBounds.Ymax / SWF_TWIPS_PER_PIXEL,

						nfo.EdgeBounds.Xmin,
						nfo.EdgeBounds.Ymin,
						nfo.EdgeBounds.Xmax,
						nfo.EdgeBounds.Ymax);
					printf("    UsesFillWindingRule:  %u\n",
						nfo.UsesFillWindingRule);
					printf("    UsesNonScalingStrokes:%u\n",
						nfo.UsesNonScalingStrokes);
					printf("    UsesScalingStrokes:   %u\n",
						nfo.UsesScalingStrokes);

					/* SHAPEWITHSTYLE follows, which means we read a FILLSTYLEARRAY followed by
					 * a LINESTYLEARRAY, followed by a normal SHAPE definition */
					if (dump_FILLSTYLEARRAY(swf,tag.record.TagCode) == 0) {
						if (dump_LINESTYLEARRAY(swf,tag.record.TagCode) == 0) {
							dump_SHAPE(swf,0,tag.record.TagCode);
						}
					}
				}

				dump_tag_raw_remainder(swf);
				} break;
			case swftag_DefineSound: {
				swf_DefineSound nfo;

				if (swf_reader_read_DefineSound(swf,&nfo) == 0) {
					printf("    SoundId:              %u\n",nfo.SoundId);
					printf("    SoundFormat:          %u (%s)\n",nfo.SoundFormat,nfo.SoundFormat_str);
					printf("    SoundRate:            %u (%uHz)\n",nfo.SoundRate,nfo.SoundRate_value);
					printf("    SoundSize:            %u (%u bits)\n",nfo.SoundSize,nfo.SoundSize_value);
					printf("    SoundType:            %u (%u channels)\n",nfo.SoundType,nfo.SoundType_value);
					printf("    SoundSampleCount:     %u\n",nfo.SoundSampleCount);

					if (nfo.SoundFormat == 2/*MP3*/) {
						swf_UI16 t16;

						t16 = swf_reader_read_UI16(swf);
						printf("    SampleCount [MP3]:    %u\n",t16);
					}
				}

				dump_tag_raw_remainder(swf);
				} break;
			case swftag_DefineFont: {
				swf_DefineFont nfo;

				swf_DefineFont_init(&nfo);
				if (swf_reader_read_DefineFont_step1(swf,&nfo) == 0) {
					printf("    FontID:               %u\n",nfo.FontID);
					printf("    nGlyphs:              %u\n",nfo.nGlyphs);
				}
				if (nfo.nGlyphs != 0 && swf_reader_read_DefineFont_alloc_OffsetTable(&nfo) == 0 &&
					swf_reader_read_DefineFont_read_OffsetTable(swf,&nfo) == 0) {
					unsigned int i;
					uint64_t ofs;

					printf("    OffsetTable:\n");
					for (i=0;i < nfo.nGlyphs;i++) {
						ofs = (unsigned long long)nfo.absoluteOffsetTable + (unsigned long long)nfo.OffsetTable[i];
						printf("        %u from start of OffsetTable (%u into GlyphShapeTable or %llu)\n",
							(unsigned int)nfo.OffsetTable[i],
							(unsigned int)(nfo.OffsetTable[i] - nfo._OffsetTableEntry0),
							(unsigned long long)ofs);
					}

					for (i=0;i < nfo.nGlyphs;i++) {
						ofs = (unsigned long long)nfo.absoluteOffsetTable + (unsigned long long)nfo.OffsetTable[i];
						if (swf_reader_seek(swf,ofs) == 0)
							dump_SHAPE(swf,i,tag.record.TagCode);
						else
							fprintf(stderr,"!! Unable to seek to offset (likely reason: non-sequential offsets)\n");
					}
				}

				swf_DefineFont_free(&nfo);
				dump_tag_raw_remainder(swf);
				} break;
			case swftag_SoundStreamHead:
			case swftag_SoundStreamHead2: {
				swf_SoundStreamHead nfo;

				if (swf_reader_read_SoundStreamHead(swf,&nfo) == 0) {
					printf("    PlaybackSoundRate:    %u (%uHz)\n",nfo.PlaybackSoundRate,nfo.PlaybackSoundRate_value);
					printf("    PlaybackSoundSize:    %u (%u bits)\n",nfo.PlaybackSoundSize,nfo.PlaybackSoundSize_value);
					printf("    PlaybackSoundType:    %u (%u channels)\n",nfo.PlaybackSoundType,nfo.PlaybackSoundType_value);
					printf("    StreamSoundCompression: %u (%s)\n",nfo.StreamSoundCompression,nfo.StreamSoundCompression_str);
					printf("    StreamSoundRate:      %u (%uHz)\n",nfo.StreamSoundRate,nfo.StreamSoundRate_value);
					printf("    StreamSoundSize:      %u (%u bits)\n",nfo.StreamSoundSize,nfo.StreamSoundSize_value);
					printf("    StreamSoundType:      %u (%u channels)\n",nfo.StreamSoundType,nfo.StreamSoundType_value);
					printf("    StreamSoundSampleCount: %u\n",nfo.StreamSoundSampleCount);
					if (nfo.LatencySeek_present)
						printf("    LatencySeek:          %u\n",nfo.LatencySeek);
				}

				dump_tag_raw_remainder(swf);
				} break;
			case swftag_FileAttributes: {
				swf_FileAttributes nfo;

				if (swf_reader_read_FileAttributes(swf,&nfo) == 0) {
					printf("    UseDirectBlit:        %u\n",nfo.UseDirectBlit);
					printf("    UseGPU:               %u\n",nfo.UseGPU);
					printf("    HasMetadata:          %u\n",nfo.HasMetadata);
					printf("    ActionScript3:        %u\n",nfo.ActionScript3);
					printf("    UseNetwork:           %u\n",nfo.UseNetwork);
				}

				dump_tag_raw_remainder(swf);
				} break;
			case swftag_Metadata:
				dump_tag_raw_text(swf);
				break;
			default:
				dump_tag_raw(swf,&tag);
				break;
		}

		/* clear read stop */
		swf->read_stop = 0;
	}

	swf = swf_reader_destroy(swf);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpl $0x1, %edi
jle 0x1b4d
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x1180
testl %eax, %eax
js 0x1b62
movl %eax, %r14d
xorl %eax, %eax
callq 0x29f1
testq %rax, %rax
je 0x1b80
movq %rax, %rbx
movq %rax, %rdi
movl %r14d, %esi
callq 0x2b14
testl %eax, %eax
jne 0x1b95
movq %rbx, %rdi
callq 0x2a31
movq %rbx, %rdi
callq 0x2b5a
testl %eax, %eax
jne 0x1baa
movzbl 0x3b(%rbx), %esi
movzbl 0x38(%rbx), %edx
movzbl 0x39(%rbx), %ecx
movzbl 0x3a(%rbx), %r8d
movl 0x3c(%rbx), %r9d
leaq 0x3db5(%rip), %rdi      # 0x50f0
xorl %eax, %eax
callq 0x1080
movzbl 0x40(%rbx), %esi
movl 0x44(%rbx), %edx
movl 0x48(%rbx), %r8d
cvtsi2sd %edx, %xmm0
movsd 0x3caf(%rip), %xmm4     # 0x5008
divsd %xmm4, %xmm0
movl 0x4c(%rbx), %ecx
cvtsi2sd %ecx, %xmm1
divsd %xmm4, %xmm1
cvtsi2sd %r8d, %xmm2
divsd %xmm4, %xmm2
movl 0x50(%rbx), %r9d
cvtsi2sd %r9d, %xmm3
divsd %xmm4, %xmm3
leaq 0x3d95(%rip), %rdi      # 0x511a
movb $0x4, %al
callq 0x1080
movzwl 0x54(%rbx), %eax
cvtsi2sd %eax, %xmm0
mulsd 0x3c74(%rip), %xmm0     # 0x5010
movzwl 0x56(%rbx), %esi
leaq 0x3dbf(%rip), %rdi      # 0x5166
movb $0x1, %al
callq 0x1080
movl 0x5c(%rbx), %esi
leaq 0x3dd7(%rip), %rdi      # 0x518f
xorl %eax, %eax
callq 0x1080
leaq -0x7c(%rbp), %r14
leaq -0x98(%rbp), %r12
leaq -0x80(%rbp), %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2a41
testl %eax, %eax
je 0x1b41
movzwl -0x98(%rbp), %r15d
movl %r15d, %edi
callq 0x2511
movl -0x94(%rbp), %ecx
movq -0x90(%rbp), %r8
movq -0x88(%rbp), %r9
leaq 0x3da2(%rip), %rdi      # 0x51ae
movl %r15d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1080
movq 0x68(%rbx), %rax
movq %rax, 0x60(%rbx)
movzwl -0x98(%rbp), %eax
leal -0x2(%rax), %ecx
cmpl $0x10, %ecx
ja 0x149a
leaq 0x3bf1(%rip), %rdx      # 0x5028
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq %rbx, %rdi
movq %r13, %rsi
callq 0x31a7
testl %eax, %eax
jne 0x1a3f
movzwl -0x80(%rbp), %esi
leaq 0x3e02(%rip), %rdi      # 0x5260
xorl %eax, %eax
callq 0x1080
movzwl -0x7e(%rbp), %esi
leaq 0x3e0e(%rip), %rdi      # 0x527e
xorl %eax, %eax
callq 0x1080
leaq 0x3e1e(%rip), %rdi      # 0x529c
xorl %eax, %eax
callq 0x1080
movq %r14, %rdi
callq 0x226f
pushq $0xa
popq %rdi
callq 0x1040
jmp 0x1a3f
cmpl $0x16, %eax
je 0x15c5
cmpl $0x20, %eax
je 0x15c5
cmpl $0x2d, %eax
je 0x1672
cmpl $0x45, %eax
je 0x19b8
cmpl $0x4d, %eax
je 0x197c
cmpl $0x53, %eax
jne 0x176a
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3320
testl %eax, %eax
jne 0x1a37
movzwl -0x80(%rbp), %esi
leaq 0x3d08(%rip), %rdi      # 0x51f6
xorl %eax, %eax
callq 0x1080
movl -0x78(%rbp), %esi
movl -0x74(%rbp), %ecx
cvtsi2sd %esi, %xmm0
movsd 0x3b01(%rip), %xmm4     # 0x5008
divsd %xmm4, %xmm0
movl -0x70(%rbp), %edx
cvtsi2sd %edx, %xmm1
divsd %xmm4, %xmm1
cvtsi2sd %ecx, %xmm2
divsd %xmm4, %xmm2
movl -0x6c(%rbp), %r8d
cvtsi2sd %r8d, %xmm3
divsd %xmm4, %xmm3
leaq 0x3ce2(%rip), %rdi      # 0x5214
movb $0x4, %al
callq 0x1080
movl -0x64(%rbp), %esi
movl -0x60(%rbp), %ecx
cvtsi2sd %esi, %xmm0
movsd 0x3abd(%rip), %xmm3     # 0x5008
divsd %xmm3, %xmm0
movl -0x5c(%rbp), %edx
cvtsi2sd %edx, %xmm1
divsd %xmm3, %xmm1
cvtsi2sd %ecx, %xmm2
divsd %xmm3, %xmm2
movapd %xmm3, %xmm4
movl -0x58(%rbp), %r8d
cvtsi2sd %r8d, %xmm3
divsd %xmm4, %xmm3
leaq 0x3d3d(%rip), %rdi      # 0x52b7
movb $0x4, %al
callq 0x1080
movzbl -0x54(%rbp), %esi
andl $0x1, %esi
leaq 0x3d74(%rip), %rdi      # 0x5303
xorl %eax, %eax
callq 0x1080
movl -0x54(%rbp), %esi
shrl %esi
andl $0x1, %esi
leaq 0x3d7c(%rip), %rdi      # 0x5321
xorl %eax, %eax
callq 0x1080
movl -0x54(%rbp), %esi
shrl $0x2, %esi
andl $0x1, %esi
leaq 0x3d83(%rip), %rdi      # 0x533f
xorl %eax, %eax
callq 0x1080
jmp 0x162e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x32f5
testl %eax, %eax
jne 0x1a37
movzwl -0x80(%rbp), %esi
leaq 0x3c13(%rip), %rdi      # 0x51f6
xorl %eax, %eax
callq 0x1080
movl -0x78(%rbp), %esi
movl -0x74(%rbp), %ecx
cvtsi2sd %esi, %xmm0
movsd 0x3a0c(%rip), %xmm4     # 0x5008
divsd %xmm4, %xmm0
movl -0x70(%rbp), %edx
cvtsi2sd %edx, %xmm1
divsd %xmm4, %xmm1
cvtsi2sd %ecx, %xmm2
divsd %xmm4, %xmm2
movl -0x6c(%rbp), %r8d
cvtsi2sd %r8d, %xmm3
divsd %xmm4, %xmm3
leaq 0x3bed(%rip), %rdi      # 0x5214
movb $0x4, %al
callq 0x1080
movzwl -0x98(%rbp), %esi
movq %rbx, %rdi
callq 0x1c89
testl %eax, %eax
jne 0x1a37
movzwl -0x98(%rbp), %esi
movq %rbx, %rdi
callq 0x1d32
testl %eax, %eax
jne 0x1a37
movzwl -0x98(%rbp), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1f68
jmp 0x1a37
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2e2a
testl %eax, %eax
jne 0x1a37
movzwl -0x80(%rbp), %esi
andl $0x3, %esi
movzwl -0x7e(%rbp), %edx
leaq 0x3e85(%rip), %rdi      # 0x551c
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl $0x2, %esi
andl $0x1, %esi
movzbl -0x7c(%rbp), %edx
leaq 0x3e8f(%rip), %rdi      # 0x5541
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl $0x3, %esi
andl $0x1, %esi
movzbl -0x7b(%rbp), %edx
leaq 0x3e9c(%rip), %rdi      # 0x5569
xorl %eax, %eax
callq 0x1080
movzbl -0x7f(%rbp), %esi
andl $0xf, %esi
movq -0x70(%rbp), %rdx
leaq 0x3eaf(%rip), %rdi      # 0x5595
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl $0x5, %esi
andl $0x3, %esi
movzwl -0x7a(%rbp), %edx
leaq 0x3eb9(%rip), %rdi      # 0x55ba
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl $0x7, %esi
andl $0x1, %esi
movzbl -0x78(%rbp), %edx
leaq 0x3ec3(%rip), %rdi      # 0x55df
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl $0xc, %esi
andl $0x1, %esi
movzbl -0x77(%rbp), %edx
leaq 0x3ed0(%rip), %rdi      # 0x5607
xorl %eax, %eax
callq 0x1080
movzwl -0x76(%rbp), %esi
leaq 0x3eea(%rip), %rdi      # 0x5633
xorl %eax, %eax
callq 0x1080
testb $0x10, -0x80(%rbp)
je 0x1a37
movzwl -0x74(%rbp), %esi
leaq 0x3eee(%rip), %rdi      # 0x5653
jmp 0x1a30
movq -0x88(%rbp), %rsi
movq %rbx, %rdi
callq 0x2551
testl %eax, %eax
jne 0x1a3f
movq %rbx, %rdi
movq %r13, %rsi
pushq $0x10
popq %rdx
callq 0x2571
testl %eax, %eax
jle 0x1a3f
movl %eax, %r15d
leaq 0x44dd(%rip), %rdi      # 0x5c7e
xorl %eax, %eax
callq 0x1080
movl %r15d, %r12d
xorl %r14d, %r14d
cmpq %r14, %r12
je 0x1a49
movzbl -0x80(%rbp,%r14), %esi
leaq 0x3f63(%rip), %rdi      # 0x5727
xorl %eax, %eax
callq 0x1080
incq %r14
jmp 0x17ae
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2d49
testl %eax, %eax
jne 0x1a37
movzwl -0x80(%rbp), %esi
leaq 0x3b6f(%rip), %rdi      # 0x535d
xorl %eax, %eax
callq 0x1080
movzbl -0x70(%rbp), %esi
andl $0xf, %esi
movq -0x78(%rbp), %rdx
leaq 0x3b74(%rip), %rdi      # 0x537b
xorl %eax, %eax
callq 0x1080
movl -0x70(%rbp), %esi
shrl $0x4, %esi
andl $0x3, %esi
movzwl -0x6e(%rbp), %edx
leaq 0x3b7c(%rip), %rdi      # 0x539e
xorl %eax, %eax
callq 0x1080
movl -0x70(%rbp), %esi
shrl $0x6, %esi
andl $0x1, %esi
movzbl -0x6c(%rbp), %edx
leaq 0x3b86(%rip), %rdi      # 0x53c3
xorl %eax, %eax
callq 0x1080
movzbl -0x70(%rbp), %esi
shrl $0x7, %esi
movzbl -0x6b(%rbp), %edx
leaq 0x3b95(%rip), %rdi      # 0x53eb
xorl %eax, %eax
callq 0x1080
movl -0x68(%rbp), %esi
leaq 0x3bb0(%rip), %rdi      # 0x5417
xorl %eax, %eax
callq 0x1080
movb -0x70(%rbp), %al
andb $0xf, %al
cmpb $0x2, %al
jne 0x1a37
movq %rbx, %rdi
callq 0x27a3
movzwl %ax, %esi
leaq 0x3ba8(%rip), %rdi      # 0x5435
jmp 0x1a30
movq %r13, %rdi
callq 0x30a6
movq %rbx, %rdi
movq %r13, %rsi
callq 0x30db
testl %eax, %eax
jne 0x18cd
movzwl -0x80(%rbp), %esi
leaq 0x3b9f(%rip), %rdi      # 0x5453
xorl %eax, %eax
callq 0x1080
movzwl -0x7e(%rbp), %esi
leaq 0x3bab(%rip), %rdi      # 0x5471
xorl %eax, %eax
callq 0x1080
cmpw $0x0, -0x7e(%rbp)
je 0x18f3
movq %r13, %rdi
callq 0x3114
testl %eax, %eax
jne 0x18f3
movq %rbx, %rdi
movq %r13, %rsi
callq 0x314d
testl %eax, %eax
je 0x1a9d
movq %r13, %rdi
callq 0x30b7
jmp 0x1a37
movq %rbx, %rdi
movq %r13, %rsi
callq 0x32cd
testl %eax, %eax
jne 0x1a3f
movzwl -0x80(%rbp), %esi
leaq 0x3942(%rip), %rdi      # 0x5260
xorl %eax, %eax
callq 0x1080
movzwl -0x7e(%rbp), %esi
leaq 0x394e(%rip), %rdi      # 0x527e
xorl %eax, %eax
callq 0x1080
jmp 0x1a3f
movq %rbx, %rdi
movq %r13, %rsi
callq 0x25f8
leaq 0x388d(%rip), %rdi      # 0x51db
xorl %eax, %eax
callq 0x1080
movzbl -0x80(%rbp), %esi
movzbl -0x7f(%rbp), %edx
movzbl -0x7e(%rbp), %ecx
leaq 0x3d9f(%rip), %rdi      # 0x5707
xorl %eax, %eax
callq 0x1080
pushq $0xa
popq %rdi
callq 0x1040
jmp 0x1a37
leaq 0x4376(%rip), %rdi      # 0x5cf9
callq 0x1070
movq %rbx, %rdi
movq %r13, %rsi
pushq $0x50
popq %rdx
callq 0x2571
testl %eax, %eax
jle 0x1a3f
movl %eax, %eax
movb $0x0, -0x80(%rbp,%rax)
leaq 0x42c6(%rip), %rdi      # 0x5c72
movq %r13, %rsi
xorl %eax, %eax
callq 0x1080
jmp 0x1988
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2fe4
testl %eax, %eax
jne 0x1a37
movzbl -0x80(%rbp), %esi
andl $0x1, %esi
leaq 0x3c9c(%rip), %rdi      # 0x5671
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl %esi
andl $0x1, %esi
leaq 0x3ca4(%rip), %rdi      # 0x568f
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl $0x2, %esi
andl $0x1, %esi
leaq 0x3cab(%rip), %rdi      # 0x56ad
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl $0x3, %esi
andl $0x1, %esi
leaq 0x3cb2(%rip), %rdi      # 0x56cb
xorl %eax, %eax
callq 0x1080
movl -0x80(%rbp), %esi
shrl $0x4, %esi
andl $0x1, %esi
leaq 0x3cb9(%rip), %rdi      # 0x56e9
xorl %eax, %eax
callq 0x1080
movq %rbx, %rdi
callq 0x1bd8
andq $0x0, 0x60(%rbx)
jmp 0x13ce
leaq -0x7c(%rbp), %r14
cmpl $0x10, %r15d
jae 0x1a66
leaq 0x3859(%rip), %rdi      # 0x52b3
xorl %eax, %eax
callq 0x1080
incl %r15d
jmp 0x1a4d
xorl %r15d, %r15d
cmpq %r15, %r12
je 0x1a8c
movzbl -0x80(%rbp,%r15), %eax
leal -0x20(%rax), %ecx
cmpb $0x5f, %cl
jb 0x1a7f
pushq $0x2e
popq %rax
movzbl %al, %edi
callq 0x1040
incq %r15
jmp 0x1a69
pushq $0xa
popq %rdi
callq 0x1040
leaq -0x98(%rbp), %r12
jmp 0x1a3f
leaq 0x41e4(%rip), %rdi      # 0x5c88
callq 0x1070
xorl %r15d, %r15d
movzwl -0x7e(%rbp), %eax
cmpq %rax, %r15
jae 0x1ae0
movq -0x78(%rbp), %rax
movzwl (%rax,%r15,2), %esi
movq -0x70(%rbp), %rcx
addq %rsi, %rcx
movzwl -0x7c(%rbp), %eax
movl %esi, %edx
subl %eax, %edx
leaq 0x39bb(%rip), %rdi      # 0x548f
xorl %eax, %eax
callq 0x1080
incq %r15
jmp 0x1aac
xorl %r15d, %r15d
movzwl %ax, %eax
cmpq %rax, %r15
jae 0x18f3
movq -0x78(%rbp), %rax
movzwl (%rax,%r15,2), %esi
addq -0x70(%rbp), %rsi
movq %rbx, %rdi
callq 0x2551
testl %eax, %eax
jne 0x1b23
movzwl -0x98(%rbp), %edx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1f68
incq %r15
movzwl -0x7e(%rbp), %eax
jmp 0x1ae3
movq 0x74ce(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x39a3(%rip), %rdi      # 0x54d7
pushq $0x44
popq %rsi
pushq $0x1
popq %rdx
callq 0x11a0
jmp 0x1b1a
movq %rbx, %rdi
callq 0x2a0d
xorl %eax, %eax
jmp 0x1bc9
movq 0x74a4(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x351e(%rip), %rdi      # 0x507c
pushq $0x12
jmp 0x1bbd
movq 0x748f(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movq 0x8(%rbx), %rdx
leaq 0x3518(%rip), %rsi      # 0x508f
xorl %eax, %eax
callq 0x10f0
jmp 0x1bc6
movq 0x7471(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x3516(%rip), %rdi      # 0x50a7
pushq $0x19
jmp 0x1bbd
movq 0x745c(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x351b(%rip), %rdi      # 0x50c1
pushq $0x11
jmp 0x1bbd
movq 0x7447(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x3518(%rip), %rdi      # 0x50d3
pushq $0x1c
popq %rsi
pushq $0x1
popq %rdx
callq 0x11a0
pushq $0x1
popq %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq