// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/ErrorHandler.cpp
// Function: ErrorHandler::log(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ErrorPriority, std::shared_ptr<TokenData>)
void ErrorHandler::log(string msg, ErrorPriority priority, Token token)
{
	if (priority==SOURCE_ERROR || priority==INTERNAL_ERROR || priority==RUNTIME_ERROR)
		errorHasBeenLogged=true;
	
	// gcc style
	//if (token)
	//	cout << token->getFile() << ":" << token->getLine() << ":" << token->getCharPos() << ": ";
	
	//cout << priorityToStr(priority) << ": " << msg << endl;
	
	// Phplus style
	
	cout << priorityToStr(priority);
	
	if (token)
	{
		cout << " di '" << token->getFile()->getFilename() << "' pada baris ke " << token->getLine() << ":" << endl;
		cout << indentString(msg, "    ") << endl;
		
		string line=token->getFile()->getLine(token->getLine());
		
		int wspace=0;
		for (; wspace<int(line.size()) && (line[wspace]==' ' || line[wspace]=='\t' || line[wspace]=='\n'); wspace++) {}
		
		string arrows="";
		for (int i=0; i<token->getCharPos()-1-wspace; i++)
			arrows+=" ";
		for (int i=0; i<int(token->getText().size()); i++)
			arrows+="^";
		
		cout << indentString(""+line.substr(wspace, string::npos)+"\n"+arrows, "    ") << endl;
	}
	else
	{
		cout << ": " << msg << endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rcx, %rbx
movq %rsi, %r14
cmpl $0x4, %edx
ja 0x19a95
pushq $0x19
popq %rax
btl %edx, %eax
jae 0x19a95
movb $0x1, (%rdi)
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movl %edx, %esi
callq 0x199ec
movq 0x60505(%rip), %rdi     # 0x79fb0
movq %r15, %rsi
callq 0xa290
leaq 0x18(%rsp), %rdi
callq 0xa558
cmpq $0x0, (%rbx)
je 0x19c21
movq 0x604e2(%rip), %rdi     # 0x79fb0
leaq 0x3b6b0(%rip), %rsi     # 0x55185
callq 0xa2b0
movq %rax, %r15
movq (%rbx), %rsi
addq $0x20, %rsi
leaq 0x38(%rsp), %r12
movq %r12, %rdi
callq 0x19fe6
movq (%r12), %rsi
leaq 0x18(%rsp), %rdi
callq 0xa3b0
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0xa290
leaq 0x3b678(%rip), %rsi     # 0x5518b
movq %rax, %rdi
callq 0xa2b0
movq (%rbx), %rcx
movl 0x30(%rcx), %esi
movq %rax, %rdi
callq 0xa4f0
leaq 0x3e089(%rip), %rsi     # 0x57bb9
movq %rax, %rdi
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
leaq 0x18(%rsp), %rdi
callq 0xa558
leaq 0x40(%rsp), %rdi
callq 0xc984
leaq 0x3af0e(%rip), %rsi     # 0x54a69
leaq 0x118(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0xa150
leaq 0x18(%rsp), %rdi
leaq 0x118(%rsp), %rdx
pushq $0x1
popq %rcx
movq %r14, %rsi
callq 0x41afa
movq 0x60424(%rip), %rdi     # 0x79fb0
leaq 0x18(%rsp), %rsi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
leaq 0x18(%rsp), %rdi
callq 0xa558
leaq 0x118(%rsp), %rdi
callq 0xa558
movq (%rbx), %rsi
addq $0x20, %rsi
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x19fe6
movq (%r14), %rsi
movq (%rbx), %rax
movl 0x30(%rax), %edx
leaq 0x18(%rsp), %rdi
callq 0x3c6b8
leaq 0x40(%rsp), %rdi
callq 0xc984
movl 0x20(%rsp), %edx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
movq %rdx, 0x10(%rsp)
movabsq $0x100000600, %rdx      # imm = 0x100000600
cmpq %rax, 0x10(%rsp)
je 0x19c51
movzbl (%rcx,%rax), %esi
cmpq $0x20, %rsi
ja 0x19c4c
btq %rsi, %rdx
jae 0x19c4c
incq %rax
jmp 0x19c05
movq 0x60388(%rip), %rdi     # 0x79fb0
leaq 0x4005d(%rip), %rsi     # 0x59c8c
callq 0xa2b0
movq %rax, %rdi
movq %r14, %rsi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
jmp 0x19deb
movq %rax, 0x10(%rsp)
leaq 0x3adc7(%rip), %rsi     # 0x54a1f
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0xa150
movq 0x10(%rsp), %rax
movl %eax, %ebp
notl %ebp
xorl %r12d, %r12d
leaq 0x3adf2(%rip), %r14     # 0x54a6c
leaq 0x38(%rsp), %r15
movq (%rbx), %rsi
movl 0x34(%rsi), %eax
addl %ebp, %eax
cmpl %eax, %r12d
jge 0x19c9c
movq %r15, %rdi
movq %r14, %rsi
callq 0xa520
incl %r12d
jmp 0x19c7f
xorl %ebp, %ebp
leaq 0x58(%rsp), %r14
leaq 0x3b4f2(%rip), %r15     # 0x5519c
leaq 0x38(%rsp), %r12
movq %r14, %rdi
callq 0xa3b0
movl 0x60(%rsp), %r13d
movq %r14, %rdi
callq 0xa558
cmpl %r13d, %ebp
jge 0x19cdb
movq %r12, %rdi
movq %r15, %rsi
callq 0xa520
incl %ebp
movq (%rbx), %rsi
jmp 0x19caf
movl 0x10(%rsp), %edx
leaq 0x98(%rsp), %rdi
leaq 0x18(%rsp), %rsi
pushq $-0x1
popq %rcx
callq 0xa2d0
leaq 0x3ad24(%rip), %rsi     # 0x54a1f
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x11ff8
leaq 0x3b1e1(%rip), %rdx     # 0x54ef8
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xc882
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x184b5
leaq 0x3ad1c(%rip), %rsi     # 0x54a69
leaq 0x78(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xa150
leaq 0x58(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
leaq 0x78(%rsp), %rdx
pushq $0x1
popq %rcx
callq 0x41afa
movq 0x60233(%rip), %rdi     # 0x79fb0
leaq 0x58(%rsp), %rsi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
leaq 0x58(%rsp), %rdi
callq 0xa558
leaq 0x78(%rsp), %rdi
callq 0xa558
leaq 0xf8(%rsp), %rdi
callq 0xa558
leaq 0xd8(%rsp), %rdi
callq 0xa558
leaq 0xb8(%rsp), %rdi
callq 0xa558
leaq 0x98(%rsp), %rdi
callq 0xa558
leaq 0x38(%rsp), %rdi
callq 0xa558
leaq 0x18(%rsp), %rdi
callq 0xa558
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x19e46
movq %rax, %rbx
jmp 0x19e50
movq %rax, %rbx
jmp 0x19e5d
movq %rax, %rbx
jmp 0x19e6a
movq %rax, %rbx
jmp 0x19e77
jmp 0x19eba
jmp 0x19e31
jmp 0x19e2c
movq %rax, %rbx
jmp 0x19e93
movq %rax, %rbx
jmp 0x19ed1
movq %rax, %rbx
jmp 0x19eaa
movq %rax, %rbx
jmp 0x19ec7
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0xa558
leaq 0x78(%rsp), %rdi
callq 0xa558
leaq 0xf8(%rsp), %rdi
callq 0xa558
leaq 0xd8(%rsp), %rdi
callq 0xa558
leaq 0xb8(%rsp), %rdi
callq 0xa558
leaq 0x98(%rsp), %rdi
callq 0xa558
jmp 0x19ebd
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xa558
leaq 0x118(%rsp), %rdi
jmp 0x19ecc
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xa558
leaq 0x40(%rsp), %rdi
callq 0xc984
jmp 0x19ed1
jmp 0x19eba
jmp 0x19eba
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xa558
leaq 0x18(%rsp), %rdi
callq 0xa558
movq %rbx, %rdi
callq 0xa500
nop