// File: /workspace/github_c_makefile_star2_O3/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, %r12
movl $0x38, %esi
callq 0xe8b2b
movq %rax, %r14
movq 0x18(%r12), %rdi
xorl %esi, %esi
callq 0xeed0d
movl %eax, (%r14)
cmpl $0x6ec3af41, %eax       # imm = 0x6EC3AF41
je 0xa10dc
cmpl $0x6ec3af45, %eax       # imm = 0x6EC3AF45
je 0xa10d3
cmpl $0x6ec3af49, %eax       # imm = 0x6EC3AF49
jne 0xa114e
leaq 0x91521(%rip), %rsi     # 0x1325f2
jmp 0xa10e3
leaq 0x91514(%rip), %rsi     # 0x1325ee
jmp 0xa10e3
leaq 0x91513(%rip), %rsi     # 0x1325f6
movq %rsi, 0x8(%r14)
movq %r12, %rdi
callq 0xeb125
movl (%r14), %eax
cmpl $0x6ec3af41, %eax       # imm = 0x6EC3AF41
je 0xa11dc
cmpl $0x6ec3af49, %eax       # imm = 0x6EC3AF49
je 0xa1164
cmpl $0x6ec3af45, %eax       # imm = 0x6EC3AF45
jne 0xa1478
movq %r12, %rdi
movq %r14, %rsi
callq 0xa14bd
testl %eax, %eax
movq %r12, 0x10(%rsp)
je 0xa1468
movq %r12, %r15
cmpl $0x0, 0x30(%r14)
je 0xa12c6
leaq 0x914dd(%rip), %rsi     # 0x132619
xorl %r12d, %r12d
movq %r15, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xa146b
leaq 0x914a5(%rip), %rsi     # 0x1325fa
movq %r12, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xa1478
movq %r12, %rdi
movq %r14, %rsi
callq 0xa14bd
testl %eax, %eax
je 0xa1478
cmpl $0x0, 0x34(%r14)
jne 0xa1478
movl $0x18, %r15d
leaq 0x914fb(%rip), %rbx     # 0x13268a
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r12, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0xa1652
addq $0x8, %r15
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpl $0x0, 0x34(%r14)
je 0xa118f
jmp 0xa1478
movq %r12, %rdi
movq %r14, %rsi
callq 0xa14bd
testl %eax, %eax
je 0xa1478
movq 0x28(%r14), %rbx
imulq 0x20(%r14), %rbx
imulq 0x18(%r14), %rbx
leaq 0x10(%rbx), %r15
leaq 0x91494(%rip), %rsi     # 0x13269c
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
cmpq $0x5f5e0f0, %rbx        # imm = 0x5F5E0F0
ja 0xa1478
movl $0x8, %esi
movq %r15, %rdi
callq 0xe9cb4
cmpl $0x0, 0x34(%r14)
jne 0xa1478
movq %rax, %rbx
movl $0x18, %ebp
leaq (%rbx,%rbp), %r13
movq 0x18(%r12), %rax
cmpq 0x18(%rax), %r13
jg 0xa1478
movq %r12, %rdi
leaq 0x8fb46(%rip), %rsi     # 0x130da5
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r12, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%r12), %rdi
movq %rbp, %rsi
movq %r15, %rdx
leaq 0x91340(%rip), %rcx     # 0x1325c8
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xefd48
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xa1652
addq $0x8, %r13
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpl $0x0, 0x34(%r14)
movq %r13, %rbp
je 0xa1242
jmp 0xa1478
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %r15, %rdi
callq 0xf1db1
testl %eax, %eax
je 0xa1468
movaps 0x8f3eb(%rip), %xmm0    # 0x1306d0
movaps %xmm0, 0x20(%rsp)
movdqa 0x912be(%rip), %xmm0    # 0x1325b0
movdqa %xmm0, 0x30(%rsp)
cmpl $0x0, 0x10(%r14)
je 0xa1311
movq $0x2, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
cmpq $0x8, 0x18(%r14)
jne 0xa1340
xorl %eax, %eax
movdqa 0x894fe(%rip), %xmm0    # 0x12a820
movdqa 0x20(%rsp,%rax,8), %xmm1
paddq %xmm1, %xmm1
por %xmm0, %xmm1
movdqa %xmm1, 0x20(%rsp,%rax,8)
addq $0x2, %rax
cmpq $0x4, %rax
jne 0xa1322
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %r15, %rdi
movl $0x4, %ecx
callq 0xf266a
movq %rax, %r12
movq 0x28(%r14), %rcx
testq %rcx, %rcx
jle 0xa1457
movq 0x20(%r14), %rax
movl $0x10, %r13d
movq $0x0, 0x8(%rsp)
testq %rax, %rax
jle 0xa1441
xorl %ebp, %ebp
movq %r13, %rbx
movq 0x18(%r15), %rdi
movq 0x18(%r14), %rcx
leaq 0x18(%rsp), %rsi
movq %r13, %rdx
callq 0xee8d4
movq 0x18(%r14), %r13
xorl %eax, %eax
movq 0x20(%rsp,%rax,8), %rcx
movb 0x18(%rsp,%rcx), %cl
movb %cl, 0x4(%rsp,%rax)
incq %rax
cmpq $0x4, %rax
jne 0xa13a1
cmpl $0x0, 0x14(%r14)
setne %cl
movb 0x7(%rsp), %al
cmpb $-0x1, %al
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xa13f9
xorl %r15d, %r15d
movzbl 0x4(%rsp,%r15), %edi
movzbl 0x7(%rsp), %esi
callq 0xf3d46
movb %al, 0x4(%rsp,%r15)
incq %r15
cmpq $0x3, %r15
jne 0xa13d2
movb 0x7(%rsp), %al
movq 0x10(%rsp), %r15
addq %rbx, %r13
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 %r12, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
callq 0xf24bf
incq %rbp
movq 0x20(%r14), %rax
cmpq %rax, %rbp
jl 0xa1383
movq 0x28(%r14), %rcx
movq 0x8(%rsp), %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
cmpq %rcx, %rsi
jl 0xa1378
movq %r12, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xf22dc
jmp 0xa146b
xorl %r12d, %r12d
movq %r12, %rdi
callq 0xf228d
movq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq