// File: /workspace/github_c_makefile_star2_O2/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 $0x48, %rsp
movq %rdi, %rbx
pushq $0x38
popq %rsi
callq 0xdecaf
movq %rax, %r14
movq %rbx, 0x8(%rsp)
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xe404f
movl %eax, (%r14)
cmpl $0x6ec3af41, %eax       # imm = 0x6EC3AF41
je 0x9b38a
cmpl $0x6ec3af45, %eax       # imm = 0x6EC3AF45
je 0x9b381
cmpl $0x6ec3af49, %eax       # imm = 0x6EC3AF49
jne 0x9b3fa
leaq 0x89f73(%rip), %rsi     # 0x1252f2
jmp 0x9b391
leaq 0x89f66(%rip), %rsi     # 0x1252ee
jmp 0x9b391
leaq 0x89f65(%rip), %rsi     # 0x1252f6
movq %rsi, 0x8(%r14)
movq 0x8(%rsp), %rdi
callq 0xe07f7
movl (%r14), %eax
cmpl $0x6ec3af41, %eax       # imm = 0x6EC3AF41
je 0x9b484
cmpl $0x6ec3af49, %eax       # imm = 0x6EC3AF49
je 0x9b412
cmpl $0x6ec3af45, %eax       # imm = 0x6EC3AF45
jne 0x9b6fc
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x9b741
testl %eax, %eax
je 0x9b599
cmpl $0x0, 0x30(%r14)
je 0x9b571
leaq 0x89f33(%rip), %rsi     # 0x125319
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0x9b6f4
leaq 0x89ef9(%rip), %rsi     # 0x1252fa
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0x9b6fc
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x9b741
testl %eax, %eax
je 0x9b6fc
pushq $0x18
popq %r15
leaq 0x89f58(%rip), %r12     # 0x12538a
pushq $0x1
popq %rbp
pushq $-0x1
popq %r13
movq 0x8(%rsp), %rbx
cmpl $0x0, 0x34(%r14)
jne 0x9b6fc
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %ebp, %ecx
callq 0x9b8cc
addq $0x8, %r15
movq %rbx, %rdi
movl %r13d, %esi
callq 0xdeba7
jmp 0x9b43e
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x9b741
testl %eax, %eax
je 0x9b6fc
movq 0x28(%r14), %rbx
imulq 0x20(%r14), %rbx
imulq 0x18(%r14), %rbx
leaq 0x10(%rbx), %rdx
leaq 0x89eea(%rip), %rsi     # 0x12539c
movq 0x8(%rsp), %rdi
movq %rdx, 0x10(%rsp)
xorl %eax, %eax
callq 0xde896
cmpq $0x5f5e0f0, %rbx        # imm = 0x5F5E0F0
ja 0x9b6fc
pushq $0x8
popq %rsi
movq 0x10(%rsp), %rdi
callq 0xdfbb6
movq %rax, %r12
pushq $0x18
popq %r15
pushq $0x1
popq %rbp
movq 0x8(%rsp), %rbx
cmpl $0x0, 0x34(%r14)
jne 0x9b6fc
leaq (%r15,%r12), %r13
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0x18(%rax), %r13
jg 0x9b6fc
movq %rbx, %rdi
leaq 0x885aa(%rip), %rsi     # 0x123ac2
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
movq 0x18(%rbx), %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
leaq 0x89d89(%rip), %rcx     # 0x1252c8
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xe4e0b
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl %ebp, %ecx
callq 0x9b8cc
addq $0x8, %r13
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
movq %r13, %r15
jmp 0x9b4ec
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq 0x8(%rsp), %rdi
callq 0xe6be1
testl %eax, %eax
je 0x9b599
xorl %eax, %eax
cmpq $0x4, %rax
je 0x9b5a1
movq %rax, 0x20(%rsp,%rax,8)
incq %rax
jmp 0x9b589
xorl %r15d, %r15d
jmp 0x9b6f4
cmpl $0x0, 0x10(%r14)
je 0x9b5b7
movq $0x2, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
cmpq $0x8, 0x18(%r14)
jne 0x9b5dd
xorl %eax, %eax
cmpq $0x4, %rax
je 0x9b5dd
movq 0x20(%rsp,%rax,8), %rcx
leaq 0x1(,%rcx,2), %rcx
movq %rcx, 0x20(%rsp,%rax,8)
incq %rax
jmp 0x9b5c0
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
pushq $0x4
popq %rcx
movq 0x8(%rsp), %rdi
callq 0xe7437
movq %rax, %r15
pushq $0x10
popq %r12
xorl %r13d, %r13d
cmpq 0x28(%r14), %r13
jge 0x9b6e7
xorl %ebp, %ebp
cmpq 0x20(%r14), %rbp
jge 0x9b6df
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x18(%r14), %rcx
leaq 0x18(%rsp), %rsi
movq %r12, %rdx
callq 0xe3cb7
movq 0x18(%r14), %rbx
xorl %eax, %eax
cmpq $0x4, %rax
je 0x9b64a
movq 0x20(%rsp,%rax,8), %rcx
movb 0x18(%rsp,%rcx), %cl
movb %cl, 0x4(%rsp,%rax)
incq %rax
jmp 0x9b632
cmpl $0x0, 0x14(%r14)
setne %cl
movb 0x7(%rsp), %al
cmpb $-0x1, %al
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x9b6a5
movq %r12, 0x10(%rsp)
movq %r14, %r12
movq %r13, %r14
movq %r15, %r13
xorl %r15d, %r15d
cmpq $0x3, %r15
je 0x9b693
movzbl 0x4(%rsp,%r15), %edi
movzbl 0x7(%rsp), %esi
callq 0xe8803
movb %al, 0x4(%rsp,%r15)
incq %r15
jmp 0x9b673
movb 0x7(%rsp), %al
movq %r13, %r15
movq %r14, %r13
movq %r12, %r14
movq 0x10(%rsp), %r12
addq %rbx, %r12
movzbl %al, %eax
shll $0x18, %eax
movzbl 0x4(%rsp), %ecx
shll $0x10, %ecx
orl %eax, %ecx
movzbl 0x5(%rsp), %eax
shll $0x8, %eax
orl %ecx, %eax
movzbl 0x6(%rsp), %ecx
orl %eax, %ecx
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xe728c
incq %rbp
jmp 0x9b608
incq %r13
jmp 0x9b5fc
pushq $0x2
popq %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0xe70b7
movq %r15, %rdi
callq 0xe7084
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0xded32
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq