// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/shg.c
// Function: de_run_shg
static void de_run_shg(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));

	d->shg_startpos = 0;
	d->signature = de_getu16le(d->shg_startpos);
	if(d->signature==0x506c) {
		de_declare_fmt(c, "SHG");
	}
	else if(d->signature==0x706c) {
		de_declare_fmt(c, "MRB");
	}
	else {
		de_warn(c, "This is probably not an SHG/MRB file.");
	}

	do_shg(c, d);

	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbx
movl $0x18, %esi
callq 0xe969b
movq %rax, %r15
movq $0x0, 0x8(%rax)
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xef1ca
movq %rax, (%r15)
cmpq $0x706c, %rax           # imm = 0x706C
je 0xc6680
cmpq $0x506c, %rax           # imm = 0x506C
jne 0xc6691
leaq 0x748ea(%rip), %rsi     # 0x13af68
jmp 0xc6687
leaq 0x5aa8e(%rip), %rsi     # 0x121115
movq %rbx, %rdi
callq 0xeb6d6
jmp 0xc66a2
leaq 0x748d4(%rip), %rsi     # 0x13af6c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
movq 0x18(%rbx), %rdi
movq 0x8(%r15), %rsi
addq $0x2, %rsi
callq 0xef1ca
movq %rax, 0x10(%r15)
leaq 0x748d4(%rip), %rsi     # 0x13af92
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0xf2509
testl %eax, %eax
je 0xc70f2
cmpq $0x0, 0x10(%r15)
jle 0xc70f2
movl $0x4, %r13d
xorl %r14d, %r14d
movq %r15, 0x10(%rsp)
movl $0x70, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r12
movq %rbx, %rdi
leaq 0x748a0(%rip), %rsi     # 0x13afb1
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
movq 0x8(%r15), %rsi
addq %r13, %rsi
callq 0xef37e
movq %rax, %rbp
addq 0x8(%r15), %rbp
movq %rbx, %rdi
leaq 0x74874(%rip), %rsi     # 0x13afbd
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rbp
jge 0xc70da
movq %rbp, %rsi
callq 0xef0d5
movb %al, (%r12)
movq 0x18(%rbx), %rdi
leaq 0x1(%rbp), %rsi
callq 0xef0d5
movb %al, 0x1(%r12)
movzbl (%r12), %edx
leal -0x5(%rdx), %eax
leaq 0x656dc(%rip), %rcx     # 0x12be69
cmpb $0x3, %al
ja 0xc67a2
movzbl %al, %eax
leaq 0x74ad5(%rip), %rsi     # 0x13b270
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
movq %rbx, %rdi
leaq 0x7482d(%rip), %rsi     # 0x13afd9
xorl %eax, %eax
callq 0xe9226
movzbl 0x1(%r12), %edx
movq %rbx, %rdi
leaq 0x7482c(%rip), %rsi     # 0x13afef
xorl %eax, %eax
callq 0xe9226
movzbl (%r12), %edx
leal -0x5(%rdx), %eax
cmpl $0x2, %eax
jae 0xc6842
leaq 0x2(%rbp), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x30(%rsp), %r15
movq %r15, %rsi
callq 0xf9f48
movq %rax, 0x8(%r12)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9f48
movq %rax, 0x10(%r12)
movl 0x8(%r12), %edx
movq %rbx, %rdi
leaq 0x628c4(%rip), %rsi     # 0x1290da
movl %eax, %ecx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%r12), %rax
cmpq $0xa, %rax
jge 0xc697f
movq %r12, %rax
addq $0x8, %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
jmp 0xc69a6
cmpl $0x8, %edx
jne 0xc6bbe
movq %r14, 0x8(%rsp)
movq %r13, (%rsp)
leaq 0x2(%rbp), %rax
movq %rax, 0x48(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x48(%rsp), %r13
movq %r13, %rsi
callq 0xf9ec9
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq 0x48(%rsp), %rsi
callq 0xef1ca
movq %rax, %r15
movq 0x48(%rsp), %rsi
addq $0x2, %rsi
movq %rsi, 0x48(%rsp)
movq 0x18(%rbx), %rdi
callq 0xef1ca
addq $0x2, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x74919(%rip), %rsi     # 0x13b1c2
movl %r14d, %edx
movl %r15d, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xf9f48
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r13, %rsi
movq %r13, %r14
callq 0xf9f48
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xf9f48
movq %rax, 0x28(%rsp)
movq 0x18(%rbx), %rdi
movq 0x48(%rsp), %rsi
callq 0xef37e
movq %rax, %r14
movq 0x48(%rsp), %rsi
addq $0x4, %rsi
movq %rsi, 0x48(%rsp)
addq %rbp, %r14
movq 0x18(%rbx), %rdi
callq 0xef37e
addq $0x4, 0x48(%rsp)
addl %eax, %ebp
movq %rbx, %rdi
leaq 0x748c7(%rip), %rsi     # 0x13b1ef
movl %r14d, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
leaq 0x748c7(%rip), %rsi     # 0x13b206
movl %ebp, %edx
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0xe9226
leaq (%r14,%r13), %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jle 0xc6c1e
movq %rbx, %rdi
leaq 0x748b8(%rip), %rsi     # 0x13b221
xorl %eax, %eax
callq 0xe9df7
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x10(%rsp), %r15
jmp 0xc6f02
cmpq $0x7530, %rax           # imm = 0x7530
jg 0xc682e
movq 0x10(%r12), %rax
movq $-0x7531, %rcx          # imm = 0x8ACF
addq %rcx, %rax
cmpq $-0x7528, %rax          # imm = 0x8AD8
jbe 0xc682e
movq %r14, 0x8(%rsp)
movq %r13, (%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9ec9
movq %rax, 0x18(%r12)
movq %rbx, %rdi
leaq 0x7472d(%rip), %rsi     # 0x13b0f7
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9ec9
movq %rax, 0x20(%r12)
movq %rbx, %rdi
leaq 0x74631(%rip), %rsi     # 0x13b01f
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9f48
movq %rax, 0x30(%r12)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9f48
movq %rax, 0x38(%r12)
movq 0x30(%r12), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe9b05
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9f48
movq %rax, 0x58(%r12)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9f48
movq %rax, 0x60(%r12)
movl 0x58(%r12), %edx
movq %rbx, %rdi
leaq 0x745d2(%rip), %rsi     # 0x13b02c
movl %eax, %ecx
xorl %eax, %eax
callq 0xe9226
cmpq $0x1, 0x60(%r12)
jne 0xc6a85
movq %rbx, %rdi
leaq 0x745d4(%rip), %rsi     # 0x13b049
xorl %eax, %eax
callq 0xe9b27
movq $0x0, 0x60(%r12)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9f48
movq %r12, 0x28(%rsp)
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xf9f48
movq %rax, 0x40(%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef3a0
movq %rax, %r14
leaq (%rax,%rbp), %r13
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef3a0
movq %rax, %r15
addq %rbp, %rax
movq %rax, 0x38(%rsp)
movq %rbx, %rdi
leaq 0x745a6(%rip), %rsi     # 0x13b084
movq %r14, %rdx
movq %rbp, %rcx
movq %r13, 0x18(%rsp)
movq %r13, %r8
movq %r12, 0x20(%rsp)
movq %r12, %r9
movq 0x28(%rsp), %r12
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
leaq 0x7459f(%rip), %rsi     # 0x13b0a9
movq %r15, %rdx
movq %rbp, %rcx
movq 0x38(%rsp), %r8
movq 0x40(%rsp), %r9
xorl %eax, %eax
callq 0xe9226
movzbl (%r12), %eax
cmpl $0x6, %eax
je 0xc6bd4
cmpl $0x5, %eax
movq 0x10(%rsp), %r15
movq (%rsp), %r13
movq 0x8(%rsp), %r14
jne 0xc6b73
movq 0x20(%r12), %rdx
cmpq $0x8, %rdx
ja 0xc6ee2
movl $0x112, %eax            # imm = 0x112
btq %rdx, %rax
jae 0xc6ee2
movq 0x18(%r12), %rdx
leaq -0x9(%rdx), %rax
cmpq $-0x9, %rax
jbe 0xc6c0f
movq 0x30(%r12), %rsi
movq 0x38(%r12), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0xc6ef3
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
addq %rcx, %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jle 0xc6cad
movq %rbx, %rdi
leaq 0x74550(%rip), %rsi     # 0x13b102
xorl %eax, %eax
callq 0xe9df7
jmp 0xc6ef3
movq %rbx, %rdi
leaq 0x7443a(%rip), %rsi     # 0x13b002
xorl %eax, %eax
callq 0xe9b27
jmp 0xc6f1b
movq 0x20(%r12), %rdx
cmpq $0x18, %rdx
movq 0x10(%rsp), %r15
movq (%rsp), %r13
movq 0x8(%rsp), %r14
ja 0xc6ee2
movl $0x1010112, %eax        # imm = 0x1010112
btq %rdx, %rax
jae 0xc6ee2
movq 0x18(%r12), %rdx
cmpq $0x1, %rdx
je 0xc6b73
movq %rbx, %rdi
leaq 0x744d2(%rip), %rsi     # 0x13b0eb
jmp 0xc6eec
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0xf0faf
movq %rax, %rbp
movq %rax, %rdi
callq 0xf0e3f
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r13, %rcx
movq %rbp, %r8
movq %r15, %r14
movq %r15, %r9
callq 0xc714a
testl %eax, %eax
movq 0x10(%rsp), %r15
je 0xc6eff
movq 0x18(%rbp), %rcx
cmpq %r14, %rcx
movq (%rsp), %r13
je 0xc6c81
movq %rbx, %rdi
leaq 0x745cb(%rip), %rsi     # 0x13b242
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9b27
movq %rbx, %rdi
leaq 0x557dc(%rip), %rsi     # 0x11c467
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r14
movq 0x18(%rbp), %rdx
movq %rbp, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0xefabc
jmp 0xc6f06
movq 0x30(%rsp), %rax
movq %rax, 0x68(%r12)
cmpb $0x5, (%r12)
je 0xc6ccd
movq 0x20(%r12), %rcx
cmpq $0x8, %rcx
jle 0xc6f49
xorl %eax, %eax
movq %rax, 0x40(%r12)
movq %rbx, %rdi
leaq 0x74442(%rip), %rsi     # 0x13b120
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x40(%r12), %rax
shlq $0x2, %rax
movq %rax, 0x48(%r12)
xorl %ecx, %ecx
cmpb $0x5, (%r12)
sete %sil
setne %cl
shll $0x4, %ecx
movq 0x20(%r12), %rax
imulq 0x30(%r12), %rax
addq %rcx, %rax
addq $0xf, %rax
addq $0x10, %rcx
cqto
idivq %rcx
movb $0x2, %cl
subb %sil, %cl
shlq %cl, %rax
movq %rax, 0x28(%r12)
movq 0x18(%r12), %rcx
imulq 0x38(%r12), %rcx
imulq %rax, %rcx
movq %rcx, 0x50(%r12)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xf0faf
movq %rax, %rbp
movq %rax, %rdi
callq 0xf0e3f
movq 0x50(%r12), %r9
movq %rbx, %rdi
movq %r12, %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %rbp, %r8
callq 0xc714a
testl %eax, %eax
je 0xc6ef5
movzbl (%r12), %eax
cmpl $0x6, %eax
je 0xc6f7a
cmpl $0x5, %eax
jne 0xc6ef5
movq 0x50(%r12), %rsi
addq $0xe, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0xf1598
movq 0x30(%r12), %rsi
movq %r14, %rdi
callq 0xf1598
movq 0x38(%r12), %rsi
movq %r14, %rdi
callq 0xf1598
movq 0x28(%r12), %rsi
movq %r14, %rdi
callq 0xf1598
movzbl 0x18(%r12), %esi
movq %r14, %rdi
callq 0xf11be
movzbl 0x20(%r12), %esi
movq %r14, %rdi
callq 0xf11be
movq %r14, %rdi
xorl %esi, %esi
callq 0xf1645
movq 0x50(%r12), %rdx
movq %rbp, %rdi
xorl %esi, %esi
movq %r14, %rcx
callq 0xefabc
movq %rbx, %rdi
leaq 0x74380(%rip), %rsi     # 0x13b1a6
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %r13
movl $0x2, 0x78(%rax)
cvtsi2sdq 0x8(%r12), %xmm0
movsd %xmm0, 0x80(%rax)
xorps %xmm0, %xmm0
cvtsi2sdq 0x10(%r12), %xmm0
movsd %xmm0, 0x88(%rax)
movl $0x70, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r15
leaq 0x4cf93(%rip), %rax     # 0x113e17
movq %rax, (%r15)
movq %r13, 0x28(%r15)
movq 0x18(%r14), %r9
movq %rbx, %rdi
leaq 0x5c354(%rip), %rsi     # 0x1231ed
movq %r15, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0xea5fa
movq %rbx, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %r15
callq 0xe9752
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %r14, %rdi
movq 0x8(%rsp), %r14
callq 0xf0b13
movq %rbx, %rdi
movq %r13, %rsi
movq (%rsp), %r13
callq 0xea9b3
jmp 0xc6ef5
movq %rbx, %rdi
leaq 0x741e5(%rip), %rsi     # 0x13b0d1
xorl %eax, %eax
callq 0xe9df7
xorl %ebp, %ebp
movq %rbp, %rdi
callq 0xf0b13
jmp 0xc6f1b
xorl %r14d, %r14d
movq (%rsp), %r13
movq %r14, %rdi
callq 0xf0b13
movq %rbp, %rdi
callq 0xf0b13
movq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe9752
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
incq %r14
addq $0x4, %r13
cmpq 0x10(%r15), %r14
jl 0xc66f7
jmp 0xc70f2
movq 0x58(%r12), %rax
testq %rax, %rax
je 0xc70cd
setle %dl
movl $0x1, %esi
shlq %cl, %rsi
movq %rax, 0x40(%r12)
cmpq %rsi, %rax
setg %al
orb %dl, %al
je 0xc6cd4
jmp 0xc6ef3
movq %rbx, %rdi
leaq 0x5a0ce(%rip), %rsi     # 0x121052
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r14
movl $0xa0, %edx
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x18140
movq 0x48(%r12), %rax
addq $0x28, %rax
movq %rax, 0xd0(%rsp)
addq 0x50(%r12), %rax
movq %rax, 0xd8(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x48(%rsp), %rdx
xorl %ecx, %ecx
callq 0xf7d41
movl $0x28, %esi
movq %r14, %rdi
callq 0xf1645
movq 0x30(%r12), %rsi
movq %r14, %rdi
callq 0xf1645
movq 0x38(%r12), %rsi
movq %r14, %rdi
callq 0xf1645
movq 0x18(%r12), %rsi
movq %r14, %rdi
callq 0xf1598
movq 0x20(%r12), %rsi
movq %r14, %rdi
callq 0xf1598
movq %r14, %rdi
xorl %esi, %esi
callq 0xf1645
movq %r14, %rdi
xorl %esi, %esi
callq 0xf1645
cvtsi2sdq 0x8(%r12), %xmm0
movsd 0x73eeb(%rip), %xmm1    # 0x13af20
mulsd %xmm1, %xmm0
movsd 0x5068f(%rip), %xmm1    # 0x1176d0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rsi
movq %r14, %rdi
callq 0xf1645
xorps %xmm0, %xmm0
cvtsi2sdq 0x10(%r12), %xmm0
mulsd 0x73ebc(%rip), %xmm0    # 0x13af20
addsd 0x50664(%rip), %xmm0    # 0x1176d0
cvttsd2si %xmm0, %rsi
movq %r14, %rdi
callq 0xf1645
movq 0x58(%r12), %rsi
movq %r14, %rdi
callq 0xf1645
movq 0x60(%r12), %rsi
movq %r14, %rdi
callq 0xf1645
movq 0x18(%rbx), %rdi
movq 0x48(%r12), %rdx
movq 0x68(%r12), %rsi
movq %r14, %rcx
callq 0xefabc
movq 0x50(%r12), %rdx
movq %rbp, %rdi
xorl %esi, %esi
movq %r14, %rcx
callq 0xefabc
movq %r14, %rdi
movq 0x8(%rsp), %r14
callq 0xf0b13
jmp 0xc6ef5
movl $0x1, %eax
shlq %cl, %rax
jmp 0xc6ccf
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe9752
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq