// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/misc/string.cpp
// Function: smooth::String::ImportFrom(char const*, char const*)
S::Int S::String::ImportFrom(const char *format, const char *str)
{
	Clean();

	if (str == NIL) return Success();

	Int	 width = 1;

	if	(strncmp(format, "UCS-4", 5)		== 0) width = 4;
	else if	(strncmp(format, "UCS-2", 5)		== 0) width = 2;
	else if	(strncmp(format, "UTF-32", 6)		== 0) width = 4;
	else if	(strncmp(format, "UTF-16", 6)		== 0) width = 2;
	else if	(strncmp(format, "CSUCS4", 6)		== 0) width = 4;
	else if	(strncmp(format, "ISO-10646-UCS-4", 15)	== 0) width = 4;
	else if	(strncmp(format, "ISO-10646-UCS-2", 15)	== 0) width = 2;
	else if	(strncmp(format, "UNICODELITTLE", 13)	== 0) width = 2;
	else if	(strncmp(format, "UNICODEBIG", 10)	== 0) width = 2;
	else if	(strncmp(format, "CSUNICODE", 9)	== 0) width = 2;
	else if	(strncmp(format, "UNICODE-1-1", 11)	== 0) width = 2;
	else if	(strncmp(format, "CSUNICODE11", 11)	== 0) width = 2;

	Int	 length = -1;

	if	(width == 1) while (true) { if (((char  *) str)[++length] == 0) { length *= 1; break; } }
	else if (width == 2) while (true) { if (((short *) str)[++length] == 0) { length *= 2; break; } }
	else if (width == 4) while (true) { if (((int   *) str)[++length] == 0) { length *= 4; break; } }

	Int	 size = ConvertString(str, length, format, NIL, 0, GetInternalFormat());

	if	(size < 0 && strcmp(format, "ISO-8859-1") != 0) return ImportFrom("ISO-8859-1", str);
	else if (size < 0)					return Error();

	size = size / sizeof(wchar_t) + 1;

	wString.Resize(size);

	ConvertString(str, length, format, (char *) (wchar_t *) wString, size * sizeof(wchar_t), GetInternalFormat());

	wString[size - 1] = 0;

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x5c070
cmpq $0x0, -0x20(%rbp)
jne 0xf2ec4
leaq -0x30(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x5ca80
movq -0x80(%rbp), %rdi
callq 0x59680
movl %eax, -0x74(%rbp)
jmp 0xf2e96
movl -0x74(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5a410
jmp 0xf32fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5a410
jmp 0xf3307
movl $0x1, -0x40(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xb2b73(%rip), %rsi     # 0x1a5a49
movl $0x5, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf2ef1
movl $0x4, -0x40(%rbp)
jmp 0xf309b
movq -0x18(%rbp), %rdi
leaq 0xb2b5d(%rip), %rsi     # 0x1a5a59
movl $0x5, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf2f17
movl $0x2, -0x40(%rbp)
jmp 0xf3099
movq -0x18(%rbp), %rdi
leaq 0xb2b08(%rip), %rsi     # 0x1a5a2a
movl $0x6, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf2f3d
movl $0x4, -0x40(%rbp)
jmp 0xf3097
movq -0x18(%rbp), %rdi
leaq 0xb2ae9(%rip), %rsi     # 0x1a5a31
movl $0x6, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf2f63
movl $0x2, -0x40(%rbp)
jmp 0xf3095
movq -0x18(%rbp), %rdi
leaq 0xb2aca(%rip), %rsi     # 0x1a5a38
movl $0x6, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf2f89
movl $0x4, -0x40(%rbp)
jmp 0xf3093
movq -0x18(%rbp), %rdi
leaq 0xb2aab(%rip), %rsi     # 0x1a5a3f
movl $0xf, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf2faf
movl $0x4, -0x40(%rbp)
jmp 0xf3091
movq -0x18(%rbp), %rdi
leaq 0xb2a95(%rip), %rsi     # 0x1a5a4f
movl $0xf, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf2fd5
movl $0x2, -0x40(%rbp)
jmp 0xf308f
movq -0x18(%rbp), %rdi
leaq 0xb2a7f(%rip), %rsi     # 0x1a5a5f
movl $0xd, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf2ffb
movl $0x2, -0x40(%rbp)
jmp 0xf308d
movq -0x18(%rbp), %rdi
leaq 0xb2a67(%rip), %rsi     # 0x1a5a6d
movl $0xa, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf301e
movl $0x2, -0x40(%rbp)
jmp 0xf308b
movq -0x18(%rbp), %rdi
leaq 0xb2a4f(%rip), %rsi     # 0x1a5a78
movl $0x9, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf3041
movl $0x2, -0x40(%rbp)
jmp 0xf3089
movq -0x18(%rbp), %rdi
leaq 0xb2a36(%rip), %rsi     # 0x1a5a82
movl $0xb, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf3064
movl $0x2, -0x40(%rbp)
jmp 0xf3087
movq -0x18(%rbp), %rdi
leaq 0xb2a1f(%rip), %rsi     # 0x1a5a8e
movl $0xb, %edx
callq 0x59dc0
cmpl $0x0, %eax
jne 0xf3085
movl $0x2, -0x40(%rbp)
jmp 0xf3087
jmp 0xf3089
jmp 0xf308b
jmp 0xf308d
jmp 0xf308f
jmp 0xf3091
jmp 0xf3093
jmp 0xf3095
jmp 0xf3097
jmp 0xf3099
jmp 0xf309b
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
cmpl $0x1, -0x40(%rbp)
jne 0xf30d2
jmp 0xf30aa
movq -0x20(%rbp), %rax
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x44(%rbp)
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xf30ce
movl -0x44(%rbp), %eax
shll $0x0, %eax
movl %eax, -0x44(%rbp)
jmp 0xf30d0
jmp 0xf30aa
jmp 0xf3132
cmpl $0x2, -0x40(%rbp)
jne 0xf3101
jmp 0xf30da
movq -0x20(%rbp), %rax
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x44(%rbp)
movslq %ecx, %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jne 0xf30fd
movl -0x44(%rbp), %eax
shll %eax
movl %eax, -0x44(%rbp)
jmp 0xf30ff
jmp 0xf30da
jmp 0xf3130
cmpl $0x4, -0x40(%rbp)
jne 0xf312e
jmp 0xf3109
movq -0x20(%rbp), %rax
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x44(%rbp)
movslq %ecx, %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0xf312a
movl -0x44(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x44(%rbp)
jmp 0xf312c
jmp 0xf3109
jmp 0xf312e
jmp 0xf3130
jmp 0xf3132
movq -0x20(%rbp), %rax
movq %rax, -0x98(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
callq 0x5a6c0
movq -0x98(%rbp), %rdi
movl -0x8c(%rbp), %esi
movq -0x88(%rbp), %rdx
movq %rax, %r9
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0xf37c0
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jge 0xf31b3
movq -0x18(%rbp), %rdi
leaq 0xb290d(%rip), %rsi     # 0x1a5a9a
callq 0x5c440
cmpl $0x0, %eax
je 0xf31b3
movq -0x70(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0xb28f4(%rip), %rsi     # 0x1a5a9a
callq 0x5ae70
movl %eax, -0x4(%rbp)
jmp 0xf32fb
cmpl $0x0, -0x48(%rbp)
jge 0xf3213
leaq -0x58(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0xa8(%rbp), %rdi
callq 0x59680
movl %eax, -0x9c(%rbp)
jmp 0xf31e2
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5b5b0
jmp 0xf32fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5b5b0
jmp 0xf3307
jmp 0xf3215
movq -0x70(%rbp), %rdi
movslq -0x48(%rbp), %rax
shrq $0x2, %rax
incl %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %esi
callq 0xf5650
movq -0x70(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0xd4(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xd0(%rbp)
callq 0xf5750
movq %rax, -0xc8(%rbp)
movl -0x48(%rbp), %eax
shll $0x2, %eax
movl %eax, -0xbc(%rbp)
callq 0x5a6c0
movq -0xe0(%rbp), %rdi
movl -0xd4(%rbp), %esi
movq -0xd0(%rbp), %rdx
movq -0xc8(%rbp), %rcx
movl -0xbc(%rbp), %r8d
movq %rax, %r9
callq 0xf37c0
movq -0x70(%rbp), %rdi
movl -0x48(%rbp), %esi
decl %esi
callq 0xf5790
movl $0x0, (%rax)
leaq -0x68(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x5ca80
movq -0xb8(%rbp), %rdi
callq 0x59680
movl %eax, -0xac(%rbp)
jmp 0xf32d0
movl -0xac(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5a410
jmp 0xf32fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5a410
jmp 0xf3307
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x5b6b0