// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/misc/init.cpp
// Function: smooth::Init()
S::Bool S::Init()
{
	if (initCount++) return True;

	/* Init system backends.
	 */
	if (Backends::Backend::InitBackends() == Error()) return False;

	/* Call registered init functions.
	 */
	foreach (Int (*initFunction)(), (*initFunctions))
	{
		if (initFunction() != Success())
		{
			/* Deinit system backends.
			 */
			Backends::Backend::DeinitBackends();

			return False;
		}
	}

#if defined __WIN32__
	if (hDllInstance == NIL) hDllInstance = hInstance;

	SMOOTHICON = (HICON) LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS | LR_SHARED);

	if (LoadIconvDLL() == True) Setup::useIconv = True;

	use_iconv = (Setup::useIconv ? 1 : 0);
#endif

	/* Init internationalization system.
	 */
	I18n::Translator::defaultTranslator = new I18n::TranslatorInternal();
	I18n::Translator::defaultTranslator->SelectUserDefaultLanguage();

	Setup::rightToLeft = I18n::Translator::defaultTranslator->IsActiveLanguageRightToLeft();

	/* Finished initializing.
	 */
	initializing = False;

	/* Start waiting threads.
	 */
	for (Int i = 0; i < Object::GetNOfObjects(); i++)
	{
		Object	*object = Object::GetNthObject(i);

		if (object == NIL) continue;

		if (object->GetObjectType() == Threads::Thread::classID &&
		    ((Threads::Thread *) object)->GetStatus() == Threads::THREAD_STARTME) ((Threads::Thread *) object)->Start();
	}

	return True;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl 0xfb28f(%rip), %eax     # 0x214530
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0xfb284(%rip)     # 0x214530
cmpl $0x0, %eax
je 0x1192ba
movb $0x1, -0x1(%rbp)
jmp 0x119513
callq 0x60ea0
movl %eax, -0x6c(%rbp)
leaq -0x18(%rbp), %rdi
movq %rdi, -0x68(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0x68(%rbp), %rdi
callq 0x59680
movl %eax, -0x5c(%rbp)
jmp 0x1192e2
leaq -0x18(%rbp), %rdi
callq 0x5b5b0
movl -0x5c(%rbp), %ecx
movl -0x6c(%rbp), %eax
cmpl %ecx, %eax
jne 0x119318
movb $0x0, -0x1(%rbp)
jmp 0x119513
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x5b5b0
jmp 0x119521
movl $0x0, -0x28(%rbp)
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x6d(%rbp)
jne 0x119353
movl -0x2c(%rbp), %eax
movl %eax, -0x74(%rbp)
movq 0xfb1fa(%rip), %rdi     # 0x214538
callq 0x5c990
movl %eax, %ecx
movl -0x74(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x6d(%rbp)
movb -0x6d(%rbp), %al
testb $0x1, %al
jne 0x11935f
jmp 0x11940f
movq 0xfb1d2(%rip), %rdi     # 0x214538
movl -0x2c(%rbp), %esi
addl $0x1, %esi
movl %esi, -0x2c(%rbp)
callq 0x1197e0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x28(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x11938a
jmp 0x1193ff
movq -0x38(%rbp), %rax
callq *%rax
movl %eax, -0x84(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x5ca80
movq -0x80(%rbp), %rdi
callq 0x59680
movl %eax, -0x78(%rbp)
jmp 0x1193b1
leaq -0x48(%rbp), %rdi
callq 0x5a410
movl -0x78(%rbp), %ecx
movl -0x84(%rbp), %eax
cmpl %ecx, %eax
je 0x1193ef
callq 0x61150
movb $0x0, -0x1(%rbp)
jmp 0x119513
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0x119521
jmp 0x1193f1
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x11937b
jmp 0x119401
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x119326
movl $0x80, %edi
callq 0x59820
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
callq 0xe3640
jmp 0x11942d
movq -0x90(%rbp), %rcx
movq 0xeef85(%rip), %rax     # 0x2083c0
movq %rcx, (%rax)
movq 0xeef7b(%rip), %rax     # 0x2083c0
movq (%rax), %rdi
callq 0x5bb20
movq 0xeef6c(%rip), %rax     # 0x2083c0
movq (%rax), %rdi
callq 0x595c0
movb %al, %cl
andb $0x1, %cl
movq 0xef660(%rip), %rax     # 0x208ac8
movb %cl, (%rax)
movb $0x0, 0xf27b7(%rip)     # 0x20bc28
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x94(%rbp)
callq 0x5bd10
movl %eax, %ecx
movl -0x94(%rbp), %eax
cmpl %ecx, %eax
jge 0x11950f
movl -0x4c(%rbp), %edi
callq 0x5d300
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x1194c6
jmp 0x119501
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x80, %esi
callq 0x595b0
jmp 0x119521
movq -0x58(%rbp), %rdi
callq 0x5bb10
movq %rax, %rdi
movq 0xef537(%rip), %rax     # 0x208a10
movswl (%rax), %esi
callq 0x5bc10
testb $0x1, %al
jne 0x1194e7
jmp 0x1194ff
movq -0x58(%rbp), %rdi
callq 0x5ac80
cwtl
cmpl $0x3, %eax
jne 0x1194ff
movq -0x58(%rbp), %rdi
callq 0x5c4a0
jmp 0x119501
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x119478
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x5b6b0
nopw (%rax,%rax)