// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bmp.c
// Function: de_run_picjpeg
static void de_run_picjpeg(deark *c, de_module_params *mparams)
{
	i64 bits_offset;
	i64 jpeg_data_len;
	UI lum_setting;
	UI chr_setting;
	int need_errmsg = 0;
	i64 srcpos;
	dbuf *outf = NULL;
	i64 i;
	u32 hdr[7];
	struct de_bmpinfo bi;
	struct de_scan_jpeg_data_ctx sd;

	de_declare_fmt(c, "Pegasus JPEG or KQP");

	(void)fmtutil_get_bmpinfo(c, c->infile, &bi, 0, c->infile->len,
		DE_BMPINFO_HAS_FILEHEADER|DE_BMPINFO_CMPR_IS_4CC|DE_BMPINFO_NOERR);
	// TODO?: Read the palette (for dbg info)

	bits_offset = de_getu32le(10);
	jpeg_data_len = c->infile->len - bits_offset;
	if(jpeg_data_len<2) {
		need_errmsg = 1;
		goto done;
	}

	// Extended BMP header fields
	for(i=0; i<7; i++) {
		hdr[i] = (u32)de_getu32le(54+4*i);
		de_dbg(c, "bmp ext hdr[%u]: %u", (UI)i, (UI)hdr[i]);
	}

	// Validate the extra BMP fields.
	// Not sure what all these are.
	// [5] & [6] are related to sampling factors.
	if(hdr[0]!=44 || hdr[1]!=24 || hdr[2]!=0 || hdr[3]!=2 ||
		hdr[4]!=8)
	{
		need_errmsg = 1;
		goto done;
	}

	de_zeromem(&sd, sizeof(struct de_scan_jpeg_data_ctx));
	de_scan_jpeg_data(c, c->infile, bits_offset, c->infile->len-bits_offset, &sd);
	if(sd.error_flag) {
		need_errmsg = 1;
		goto done;
	}
	if(!sd.found_pic || !sd.found_sof || !sd.found_sos) {
		need_errmsg = 1;
		goto done;
	}
	if(sd.pic_pos >= sd.sof_pos) {
		need_errmsg = 1;
		goto done;
	}

	// Read from "PIC" segment.
	lum_setting = (UI)de_getbyte(sd.pic_pos+9);
	chr_setting = (UI)de_getbyte(sd.pic_pos+10);
	de_dbg(c, "luminance: %u", lum_setting);
	de_dbg(c, "chrominance: %u", chr_setting);

	de_dbg(c, "has DHT: %u", (UI)sd.found_dht);

	outf = dbuf_create_output_file(c, "jpg", NULL, 0);

	srcpos = sd.soi_pos;
	dbuf_copy(c->infile, srcpos, 2, outf);
	srcpos += 2;

	if(sd.found_jfif && sd.jfif_pos==srcpos) {
		// Copy everything before the JFIF version number
		dbuf_copy(c->infile, srcpos, 9, outf);
		// Sometimes the JFIF version number is wrong, so we correct it.
		dbuf_writebyte(outf, 1);
		dbuf_writebyte(outf, 2);
		srcpos += 11;
	}

	// Copy everything up to the PIC segment
	dbuf_copy(c->infile, srcpos, sd.pic_pos-srcpos, outf);

	srcpos = sd.pic_pos + sd.pic_len; // Skip the PIC segment

	// Convert the Photoshop Resources segment to a more standard format
	if(sd.found_8bim && sd._8bim_pos>=srcpos && sd._8bim_pos<sd.sof_pos) {
		// Copy everything up to 8BIM
		dbuf_copy(c->infile, srcpos, sd._8bim_pos-srcpos, outf);

		dbuf_writeu16be(outf, 0xffed);
		dbuf_writeu16be(outf, 2 + 14 + (sd._8bim_len-4));
		dbuf_write(outf, (const u8*)"Photoshop 3.0\0", 14);
		dbuf_copy(c->infile, sd._8bim_pos+4, sd._8bim_len-4, outf);
		srcpos = sd._8bim_pos + sd._8bim_len;
	}

	// Copy everything up to SOF
	dbuf_copy(c->infile, srcpos, sd.sof_pos-srcpos, outf);
	srcpos = sd.sof_pos;

	// Insert DQT segments
	if(!sd.found_dqt) {
		u8 tmptbl[64];

		dbuf_write(outf, (const u8*)"\xff\xdb\x00\x43\x00", 5);
		fmtutil_get_std_jpeg_qtable(0, tmptbl);
		picjpeg_scale_qtable(tmptbl, lum_setting);
		dbuf_write(outf, tmptbl, 64);

		dbuf_write(outf, (const u8*)"\xff\xdb\x00\x43\x01", 5);
		fmtutil_get_std_jpeg_qtable(1, tmptbl);
		picjpeg_scale_qtable(tmptbl, chr_setting);
		dbuf_write(outf, tmptbl, 64);
	}

	// Copy everything up to SOS
	dbuf_copy(c->infile, srcpos, sd.sos_pos-srcpos, outf);
	srcpos = sd.sos_pos;

	// Insert DHT segment
	if(!sd.found_dht) {
		dbuf_write(outf, (const u8*)"\xff\xc4\x01\xa2\x00", 5);
		fmtutil_write_std_jpeg_dht(outf, 0);
		dbuf_writebyte(outf, 0x10);
		fmtutil_write_std_jpeg_dht(outf, 1);
		dbuf_writebyte(outf, 0x01);
		fmtutil_write_std_jpeg_dht(outf, 2);
		dbuf_writebyte(outf, 0x11);
		fmtutil_write_std_jpeg_dht(outf, 3);
	}

	// Copy the rest of the file
	dbuf_copy(c->infile, srcpos, c->infile->len-srcpos, outf);

done:
	if(need_errmsg) {
		de_err(c, "Can't convert this Pegasus JPEG file");
	}
	dbuf_close(outf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %rbx
leaq 0xe3a91(%rip), %rsi     # 0x117ddc
callq 0xeb125
movq 0x18(%rbx), %rsi
movq 0x18(%rsi), %r8
leaq 0xe8(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
movl $0x19, %r9d
callq 0xf7425
movq 0x18(%rbx), %rdi
movl $0xa, %esi
callq 0xeed61
movq 0x18(%rbx), %rcx
movq 0x18(%rcx), %rcx
movq %rax, 0x18(%rsp)
subq %rax, %rcx
cmpq $0x2, %rcx
jge 0x343c2
leaq 0xe3a93(%rip), %rsi     # 0x117e2e
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %r13, %rdi
callq 0xf052b
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x36, %r14d
leaq 0xe3a21(%rip), %r15     # 0x117df0
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed61
movl %eax, 0x8a(%rsp,%r14)
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
addq $0x4, %r14
incl %ebp
cmpq $0x52, %r14
jne 0x343d1
movdqa 0xc0(%rsp), %xmm0
pcmpeqd 0xe33ad(%rip), %xmm0    # 0x1177c0
movmskps %xmm0, %eax
xorl $0xf, %eax
jne 0x34394
cmpl $0x8, 0xd0(%rsp)
jne 0x34394
movq 0x18(%rbx), %rdx
movq 0x18(%rdx), %rax
movq %rax, 0x50(%rsp)
movq 0x18(%rsp), %rcx
subq %rcx, %rax
movq %rcx, 0x80(%rsp)
cmpq $0x4, %rax
jl 0x34394
movq 0x18(%rsp), %rax
leaq 0x4(%rax), %rcx
movq %rcx, 0x20(%rsp)
movq $0x0, 0x38(%rsp)
leaq 0x80(%rsp), %r12
movq $0x0, 0x70(%rsp)
movq $0x0, 0x78(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
movq $0x0, 0x48(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x30(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x60(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x58(%rsp)
movq %rax, 0x8(%rsp)
movq %rdx, %r13
movq %rdx, %rdi
movq %r12, %rsi
callq 0xeeb4b
cmpb $-0x1, %al
jne 0x34394
movq %r13, %rdi
movq %r12, %rsi
callq 0xeeb4b
movl %eax, %r14d
leal 0x1(%r14), %eax
cmpb $0x2, %al
jb 0x34394
movq 0x18(%rsp), %rax
cmpq %rax, 0x8(%rsp)
movq %r15, 0x28(%rsp)
jne 0x3453a
cmpb $-0x28, %r14b
jne 0x34394
movq %r13, %rdx
movq 0x80(%rsp), %r15
movq 0x18(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x34683
cmpb $-0x27, %r14b
je 0x34394
movq %r13, %rdi
movq %r12, %rsi
callq 0xeeb91
leaq 0x2(%rax), %r15
movzbl %r14b, %ecx
addl $0xffffff40, %ecx       # imm = 0xFFFFFF40
cmpl $0x22, %ecx
ja 0x34670
leaq 0xe32ef(%rip), %rdx     # 0x11785c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movb $0x1, %al
movq %rax, 0x78(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x34675
movb $0x1, %al
movq %rax, 0x38(%rsp)
jmp 0x34670
cmpq $0x9, %rax
setge %al
cmpb $0x0, 0x14(%rsp)
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x34670
movl $0x4, %ecx
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0xe3349(%rip), %rdx     # 0x11790f
callq 0xefc85
testl %eax, %eax
je 0x346ae
movl $0x0, 0x14(%rsp)
jmp 0x34670
cmpq $0x7, %rax
setge %al
cmpb $0x0, 0x10(%rsp)
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x34670
movl $0x4, %ecx
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x115e9b(%rip), %rdx    # 0x14a4a5
callq 0xefc85
testl %eax, %eax
je 0x346c5
movl $0x0, 0x10(%rsp)
jmp 0x34670
cmpq $0x9, %rax
jl 0x34670
cmpb $0x0, 0x40(%rsp)
jne 0x346a4
movl $0x5, %ecx
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0xe32c7(%rip), %rdx     # 0x117909
callq 0xefc85
movq %r13, %rdx
testl %eax, %eax
sete %al
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %rax
movq 0x30(%rsp), %rcx
cmoveq %rax, %rcx
movq %rcx, 0x30(%rsp)
jmp 0x34678
movb $0x1, %al
movq %rax, 0x70(%rsp)
movq 0x8(%rsp), %rax
movq %r13, %rdx
addq %rax, %r15
movq %r15, 0x80(%rsp)
leaq 0x4(%r15), %rcx
movq %r15, %rax
movq %rcx, 0x20(%rsp)
cmpq 0x50(%rsp), %rcx
movq 0x28(%rsp), %r15
jle 0x344d0
jmp 0x34394
movq %r13, %rdx
movq 0x8(%rsp), %rax
jmp 0x34678
movb $0x1, %al
movl %eax, 0x14(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x68(%rsp)
movq %r15, 0x60(%rsp)
jmp 0x34675
movb $0x1, %al
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq %rax, %rbp
movq %r15, 0x58(%rsp)
jmp 0x34675
cmpb $0x0, 0x14(%rsp)
movq 0x28(%rsp), %r15
movq 0x68(%rsp), %r12
je 0x34394
cmpb $0x0, 0x78(%rsp)
je 0x34394
cmpq %r15, %r12
jge 0x34394
movq 0x18(%rbx), %rdi
leaq 0x9(%r12), %rsi
callq 0xeead3
movzbl %al, %r13d
movq 0x18(%rbx), %rdi
leaq 0xa(%r12), %rsi
callq 0xeead3
movzbl %al, %r14d
leaq 0xe36d6(%rip), %rsi     # 0x117e04
movq %rbx, %rdi
movl %r13d, 0x50(%rsp)
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0xe36cb(%rip), %rsi     # 0x117e12
movq %rbx, %rdi
movl %r14d, 0x18(%rsp)
movl %r14d, %edx
xorl %eax, %eax
callq 0xe8617
movzbl 0x38(%rsp), %edx
leaq 0xe36bd(%rip), %rsi     # 0x117e22
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
leaq 0xff13c(%rip), %rsi     # 0x1338b2
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r13
movq 0x18(%rbx), %rdi
movl $0x2, %edx
movq 0x48(%rsp), %r14
movq %r14, %rsi
movq %rax, %rcx
callq 0xef481
leaq 0x2(%r14), %rsi
cmpb $0x0, 0x40(%rsp)
je 0x347ea
movq 0x30(%rsp), %rax
cmpq %rsi, %rax
jne 0x347ea
movq 0x18(%rbx), %rdi
movl $0x9, %edx
movq %rax, %rsi
movq %r13, %rcx
callq 0xef481
movq %r13, %rdi
movl $0x1, %esi
callq 0xf0bd6
movq %r13, %rdi
movl $0x2, %esi
callq 0xf0bd6
movq 0x48(%rsp), %rsi
addq $0xd, %rsi
movq 0x18(%rbx), %rdi
movq %r12, %rdx
subq %rsi, %rdx
movq %r13, %rcx
callq 0xef481
movq 0x60(%rsp), %rsi
addq %r12, %rsi
cmpb $0x0, 0x10(%rsp)
je 0x3487d
movq %rbp, %rdx
subq %rsi, %rdx
setge %al
cmpq %r15, %rbp
setl %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3487d
movq %rbp, %r12
movq 0x18(%rbx), %rdi
movq %r13, %rcx
callq 0xef481
movl $0xffed, %esi           # imm = 0xFFED
movq %r13, %rdi
callq 0xf0fad
movq 0x58(%rsp), %rbp
leaq 0xc(%rbp), %rsi
movq %r13, %rdi
callq 0xf0fad
leaq 0xe3093(%rip), %rsi     # 0x1178e8
movl $0xe, %edx
movq %r13, %rdi
callq 0xef547
movq 0x18(%rbx), %rdi
leaq 0x4(%r12), %rsi
leaq -0x4(%rbp), %rdx
movq %r13, %rcx
callq 0xef481
addq %r12, %rbp
movq %rbp, %rsi
movq 0x18(%rbx), %rdi
movq %r15, %rdx
subq %rsi, %rdx
movq %r13, %rcx
callq 0xef481
cmpb $0x0, 0x70(%rsp)
jne 0x34b6d
leaq 0xe3056(%rip), %rsi     # 0x1178f7
movl $0x5, %edx
movq %r13, %rdi
callq 0xef547
xorl %r15d, %r15d
leaq 0x80(%rsp), %rsi
xorl %edi, %edi
callq 0xf9c08
movd 0x50(%rsp), %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
pxor %xmm1, %xmm1
movdqa 0xe2ef8(%rip), %xmm10   # 0x1177d0
movdqa 0xe2eff(%rip), %xmm11   # 0x1177e0
movdqa 0xe2f06(%rip), %xmm12   # 0x1177f0
movdqa 0x80(%rsp,%r15), %xmm2
movdqa %xmm2, %xmm3
punpckhbw %xmm1, %xmm3    # xmm3 = xmm3[8],xmm1[8],xmm3[9],xmm1[9],xmm3[10],xmm1[10],xmm3[11],xmm1[11],xmm3[12],xmm1[12],xmm3[13],xmm1[13],xmm3[14],xmm1[14],xmm3[15],xmm1[15]
movdqa %xmm3, %xmm5
punpckhwd %xmm1, %xmm5    # xmm5 = xmm5[4],xmm1[4],xmm5[5],xmm1[5],xmm5[6],xmm1[6],xmm5[7],xmm1[7]
punpcklwd %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1],xmm3[2],xmm1[2],xmm3[3],xmm1[3]
punpcklbw %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7]
movdqa %xmm2, %xmm4
punpckhwd %xmm1, %xmm4    # xmm4 = xmm4[4],xmm1[4],xmm4[5],xmm1[5],xmm4[6],xmm1[6],xmm4[7],xmm1[7]
punpcklwd %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
pmaddwd %xmm0, %xmm2
pmaddwd %xmm0, %xmm4
pmaddwd %xmm0, %xmm3
pmaddwd %xmm0, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm10, %xmm6
movdqa %xmm3, %xmm7
pcmpgtd %xmm10, %xmm7
packssdw %xmm6, %xmm7
movdqa %xmm4, %xmm8
pcmpgtd %xmm10, %xmm8
movdqa %xmm2, %xmm6
pcmpgtd %xmm10, %xmm6
packssdw %xmm8, %xmm6
packsswb %xmm7, %xmm6
movdqa %xmm11, %xmm7
pcmpgtd %xmm5, %xmm7
psrld $0x5, %xmm5
movdqa %xmm11, %xmm8
pcmpgtd %xmm3, %xmm8
psrld $0x5, %xmm3
packssdw %xmm7, %xmm8
movdqa %xmm11, %xmm7
pcmpgtd %xmm4, %xmm7
psrld $0x5, %xmm4
movdqa %xmm11, %xmm9
pcmpgtd %xmm2, %xmm9
psrld $0x5, %xmm2
packssdw %xmm7, %xmm9
packsswb %xmm8, %xmm9
pand %xmm12, %xmm5
pand %xmm12, %xmm3
packuswb %xmm5, %xmm3
pand %xmm12, %xmm4
pand %xmm12, %xmm2
packuswb %xmm4, %xmm2
packuswb %xmm3, %xmm2
movdqa %xmm9, %xmm3
pandn %xmm2, %xmm3
psubb %xmm9, %xmm3
por %xmm6, %xmm3
movdqa %xmm3, 0x80(%rsp,%r15)
addq $0x10, %r15
cmpq $0x40, %r15
jne 0x348ea
leaq 0x80(%rsp), %r14
movl $0x40, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0xef547
leaq 0xe2ef1(%rip), %rsi     # 0x1178fd
movl $0x5, %edx
movq %r13, %rdi
callq 0xef547
movl $0x1, %edi
movq %r14, %rsi
callq 0xf9c08
movdqa 0xe2dc1(%rip), %xmm12   # 0x1177f0
movdqa 0xe2da8(%rip), %xmm11   # 0x1177e0
movdqa 0xe2d8f(%rip), %xmm10   # 0x1177d0
movd 0x18(%rsp), %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
xorl %eax, %eax
pxor %xmm1, %xmm1
movdqa 0x80(%rsp,%rax), %xmm2
movdqa %xmm2, %xmm3
punpckhbw %xmm1, %xmm3    # xmm3 = xmm3[8],xmm1[8],xmm3[9],xmm1[9],xmm3[10],xmm1[10],xmm3[11],xmm1[11],xmm3[12],xmm1[12],xmm3[13],xmm1[13],xmm3[14],xmm1[14],xmm3[15],xmm1[15]
movdqa %xmm3, %xmm5
punpckhwd %xmm1, %xmm5    # xmm5 = xmm5[4],xmm1[4],xmm5[5],xmm1[5],xmm5[6],xmm1[6],xmm5[7],xmm1[7]
punpcklwd %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1],xmm3[2],xmm1[2],xmm3[3],xmm1[3]
punpcklbw %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7]
movdqa %xmm2, %xmm4
punpckhwd %xmm1, %xmm4    # xmm4 = xmm4[4],xmm1[4],xmm4[5],xmm1[5],xmm4[6],xmm1[6],xmm4[7],xmm1[7]
punpcklwd %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
pmaddwd %xmm0, %xmm2
pmaddwd %xmm0, %xmm4
pmaddwd %xmm0, %xmm3
pmaddwd %xmm0, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm10, %xmm6
movdqa %xmm3, %xmm7
pcmpgtd %xmm10, %xmm7
packssdw %xmm6, %xmm7
movdqa %xmm4, %xmm8
pcmpgtd %xmm10, %xmm8
movdqa %xmm2, %xmm6
pcmpgtd %xmm10, %xmm6
packssdw %xmm8, %xmm6
packsswb %xmm7, %xmm6
movdqa %xmm11, %xmm7
pcmpgtd %xmm5, %xmm7
psrld $0x5, %xmm5
movdqa %xmm11, %xmm8
pcmpgtd %xmm3, %xmm8
psrld $0x5, %xmm3
packssdw %xmm7, %xmm8
movdqa %xmm11, %xmm7
pcmpgtd %xmm4, %xmm7
psrld $0x5, %xmm4
movdqa %xmm11, %xmm9
pcmpgtd %xmm2, %xmm9
psrld $0x5, %xmm2
packssdw %xmm7, %xmm9
packsswb %xmm8, %xmm9
pand %xmm12, %xmm5
pand %xmm12, %xmm3
packuswb %xmm5, %xmm3
pand %xmm12, %xmm4
pand %xmm12, %xmm2
packuswb %xmm4, %xmm2
packuswb %xmm3, %xmm2
movdqa %xmm9, %xmm3
pandn %xmm2, %xmm3
psubb %xmm9, %xmm3
por %xmm6, %xmm3
movdqa %xmm3, 0x80(%rsp,%rax)
addq $0x10, %rax
cmpq $0x40, %rax
jne 0x34a52
leaq 0x80(%rsp), %rsi
movl $0x40, %edx
movq %r13, %rdi
callq 0xef547
movq 0x28(%rsp), %r15
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %r14
movq %r14, %rdx
subq %r15, %rdx
movq %r15, %rsi
movq %r13, %rcx
callq 0xef481
cmpb $0x0, 0x38(%rsp)
jne 0x34bfa
leaq 0xe2d6e(%rip), %rsi     # 0x117903
movl $0x5, %edx
movq %r13, %rdi
callq 0xef547
movq %r13, %rdi
xorl %esi, %esi
callq 0xf9c51
movq %r13, %rdi
movl $0x10, %esi
callq 0xf0bd6
movq %r13, %rdi
movl $0x1, %esi
callq 0xf9c51
movq %r13, %rdi
movl $0x1, %esi
callq 0xf0bd6
movq %r13, %rdi
movl $0x2, %esi
callq 0xf9c51
movq %r13, %rdi
movl $0x11, %esi
callq 0xf0bd6
movq %r13, %rdi
movl $0x3, %esi
callq 0xf9c51
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %rdx
subq %r14, %rdx
movq %r14, %rsi
movq %r13, %rcx
callq 0xef481
jmp 0x343a8