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

	d = de_malloc(c, sizeof(lctx));
	d->sig = (unsigned int)de_getu32be(0);

	if(d->sig==SIG_NIE) {
		d->fmtname = "NIE";
	}
	else if(d->sig==SIG_NII) {
		d->fmtname = "NII";
	}
	else if(d->sig==SIG_NIA) {
		d->fmtname = "NIA";
	}
	else {
		de_err(c, "File not in NIE/NII/NIA format");
		goto done;
	}

	de_declare_fmt(c, d->fmtname);

	if(d->sig==SIG_NIE) {
		do_decode_nie(c, d);
	}
	else if(d->sig==SIG_NII) {
		do_decode_nii(c, d);
	}
	else if(d->sig==SIG_NIA) {
		do_decode_nia(c, d);
	}

done:
	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movl $0x38, %esi
callq 0xe969b
movq %rax, %r14
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xef32a
movl %eax, (%r14)
cmpl $0x6ec3af41, %eax       # imm = 0x6EC3AF41
je 0xa198f
cmpl $0x6ec3af45, %eax       # imm = 0x6EC3AF45
je 0xa1986
cmpl $0x6ec3af49, %eax       # imm = 0x6EC3AF49
jne 0xa19fe
leaq 0x908d6(%rip), %rsi     # 0x13225a
jmp 0xa1996
leaq 0x908c9(%rip), %rsi     # 0x132256
jmp 0xa1996
leaq 0x908c8(%rip), %rsi     # 0x13225e
movq %rsi, 0x8(%r14)
movq %rbx, %rdi
callq 0xeb6d6
movl (%r14), %eax
cmpl $0x6ec3af41, %eax       # imm = 0x6EC3AF41
je 0xa1a8c
cmpl $0x6ec3af49, %eax       # imm = 0x6EC3AF49
je 0xa1a14
cmpl $0x6ec3af45, %eax       # imm = 0x6EC3AF45
jne 0xa1d14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa1d59
testl %eax, %eax
movq %r14, 0x10(%rsp)
je 0xa1d04
cmpl $0x0, 0x30(%r14)
je 0xa1b7a
leaq 0x90895(%rip), %rsi     # 0x132281
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xa1d07
leaq 0x9085d(%rip), %rsi     # 0x132262
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xa1d14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa1d59
testl %eax, %eax
je 0xa1d14
cmpl $0x0, 0x34(%r14)
jne 0xa1d14
movl $0x18, %r15d
leaq 0x908b3(%rip), %r12     # 0x1322f2
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0xa1ee4
addq $0x8, %r15
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpl $0x0, 0x34(%r14)
je 0xa1a3f
jmp 0xa1d14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa1d59
testl %eax, %eax
je 0xa1d14
movq %rbx, %r12
movq 0x28(%r14), %rbx
imulq 0x20(%r14), %rbx
imulq 0x18(%r14), %rbx
leaq 0x10(%rbx), %r15
leaq 0x90849(%rip), %rsi     # 0x132304
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
cmpq $0x5f5e0f0, %rbx        # imm = 0x5F5E0F0
movq %r12, %rbx
ja 0xa1d14
movl $0x8, %esi
movq %r15, %rdi
callq 0xea80b
cmpl $0x0, 0x34(%r14)
jne 0xa1d14
movq %rax, %r12
movl $0x18, %ebp
leaq (%r12,%rbp), %r13
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %r13
jg 0xa1d14
movq %rbx, %rdi
leaq 0x8ef56(%rip), %rsi     # 0x130a6a
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
movq %r15, %rdx
leaq 0x906f4(%rip), %rcx     # 0x132230
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xf0321
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xa1ee4
addq $0x8, %r13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpl $0x0, 0x34(%r14)
movq %r13, %rbp
je 0xa1af8
jmp 0xa1d14
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0xa1d04
xorl %eax, %eax
movq %rax, 0x30(%rsp,%rax,8)
incq %rax
cmpq $0x4, %rax
jne 0xa1b94
cmpl $0x0, 0x10(%r14)
je 0xa1bbb
movq $0x2, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
cmpq $0x8, 0x18(%r14)
jne 0xa1bdf
xorl %eax, %eax
movq 0x30(%rsp,%rax,8), %rcx
leaq 0x1(,%rcx,2), %rcx
movq %rcx, 0x30(%rsp,%rax,8)
incq %rax
cmpq $0x4, %rax
jne 0xa1bc4
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %ecx
callq 0xf2cab
movq %rax, %r13
cmpq $0x0, 0x28(%r14)
jle 0xa1cf3
movl $0x10, %r12d
movq $0x0, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
cmpq $0x0, 0x20(%r14)
jle 0xa1cd7
xorl %ebp, %ebp
movq 0x10(%rsp), %r14
movq 0x18(%rbx), %rdi
movq 0x18(%r14), %rcx
leaq 0x28(%rsp), %rsi
movq %r12, %rdx
callq 0xeeee8
movq 0x18(%r14), %rbx
xorl %eax, %eax
movq 0x30(%rsp,%rax,8), %rcx
movb 0x28(%rsp,%rcx), %cl
movb %cl, 0xc(%rsp,%rax)
incq %rax
cmpq $0x4, %rax
jne 0xa1c43
cmpl $0x0, 0x14(%r14)
je 0xa1c88
cmpb $-0x1, 0xf(%rsp)
je 0xa1c88
xorl %r15d, %r15d
movzbl 0xc(%rsp,%r15), %edi
movzbl 0xf(%rsp), %esi
callq 0xf424e
movb %al, 0xc(%rsp,%r15)
incq %r15
cmpq $0x3, %r15
jne 0xa1c6a
addq %rbx, %r12
movzbl 0xf(%rsp), %eax
shll $0x18, %eax
movzbl 0xc(%rsp), %ecx
shll $0x10, %ecx
orl %eax, %ecx
movzbl 0xd(%rsp), %eax
shll $0x8, %eax
orl %ecx, %eax
movzbl 0xe(%rsp), %ecx
orl %eax, %ecx
movq %r13, %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
callq 0xf2b02
incq %rbp
movq 0x10(%rsp), %r14
cmpq 0x20(%r14), %rbp
movq 0x20(%rsp), %rbx
jl 0xa1c28
jmp 0xa1cdc
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %rcx
incq %rcx
movq %rcx, 0x18(%rsp)
cmpq 0x28(%r14), %rcx
jl 0xa1c16
movq %r13, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xf2923
jmp 0xa1d07
xorl %r13d, %r13d
movq %r13, %rdi
callq 0xf28d4
movq 0x10(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq