// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-data.c
// Function: de_windows_codepage_to_encoding
de_encoding de_windows_codepage_to_encoding(deark *c, int wincodepage,
	char *encname, size_t encname_len, unsigned int flags)
{
	size_t k;
	const struct de_encmapwin_item *cpinfo = NULL;

	for(k=0; k<DE_ARRAYCOUNT(de_encmapwin_arr); k++) {
		if(de_encmapwin_arr[k].wincodepage == wincodepage) {
			cpinfo = &de_encmapwin_arr[k];
			break;
		}
	}

	if(cpinfo) {
		// Code page is known, though not necessarily supported.
		if(encname) {
			char note_tmp[80];
			if(cpinfo->encname_note) {
				de_snprintf(note_tmp, sizeof(note_tmp), " (%s)", cpinfo->encname_note);
			}
			else {
				note_tmp[0] = '\0';
			}
			de_snprintf(encname, encname_len, "%s%s%s", cpinfo->encname, note_tmp,
				((cpinfo->flags&0x1)==0 && (flags&0x1)!=0)?" (unsupported)":"");
		}
		return (cpinfo->flags&0x1) ? cpinfo->enc : DE_ENCODING_UNKNOWN;
	}

	if(encname) {
		de_strlcpy(encname, "?", encname_len);
	}
	return DE_ENCODING_UNKNOWN;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0xf, -0x38(%rbp)
jae 0x161ed7
movq -0x38(%rbp), %rcx
leaq 0xc2b80(%rip), %rax     # 0x224a20
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x161ec7
movq -0x38(%rbp), %rcx
leaq 0xc2b66(%rip), %rax     # 0x224a20
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
jmp 0x161ed7
jmp 0x161ec9
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x161e8e
cmpq $0x0, -0x40(%rbp)
je 0x161ff5
cmpq $0x0, -0x20(%rbp)
je 0x161fc3
movq -0x40(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x161f1c
leaq -0x90(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rcx
movl $0x50, %esi
leaq 0x559d7(%rip), %rdx     # 0x1b78ea
movb $0x0, %al
callq 0x15a980
jmp 0x161f23
movb $0x0, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x91(%rbp)
jne 0x161f7e
movl -0x2c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x91(%rbp)
movq -0xa0(%rbp), %r8
movq -0xa8(%rbp), %rcx
movq -0xb0(%rbp), %rsi
movq -0xb8(%rbp), %rdi
movb -0x91(%rbp), %dl
leaq 0x6ec29(%rip), %r9      # 0x1d0bd0
leaq 0x728c8(%rip), %rax     # 0x1d4876
testb $0x1, %dl
cmovneq %rax, %r9
leaq 0x4acff(%rip), %rdx     # 0x1accbb
movb $0x0, %al
callq 0x15a980
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x161fe0
movq -0x40(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xbc(%rbp)
jmp 0x161fea
xorl %eax, %eax
movl %eax, -0xbc(%rbp)
jmp 0x161fea
movl -0xbc(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x162017
cmpq $0x0, -0x20(%rbp)
je 0x162010
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x55c22(%rip), %rsi     # 0x1b7c2d
callq 0x15aa30
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)