// File: /workspace/github_cpp_makefile_star2_O2/minirop[P]JDecomqiler/src/ClassFile.cpp
// Function: ClassFile::parseConstant()
bool ClassFile::parseConstant()
{
	bool isDoubleSize = false;
	
	CPinfo info;
	
	stream >> info.tag;
	
	switch(info.tag)
	{
		case CONSTANT_Utf8:
			{
				std::uint16_t length;
				stream >> length;
				char * string = new char[length+1];
				stream.readRawData(string, length);
				string[length] = 0;
				info.UTF8Info.bytes = string;
				toDelete.push_back(string);
			}
			break;
		case CONSTANT_Integer:
			stream >> info.IntegerInfo.bytes;
			break;
		case CONSTANT_Float:
			stream >> info.FloatInfo.bytes;
			break;
		case CONSTANT_Long:
			stream >> info.BigIntInfo.bytes;
			isDoubleSize = true;
			break;
		case CONSTANT_Double:
			stream >> info.DoubleInfo.bytes;
			isDoubleSize = true;
			break;
		case CONSTANT_Class:
			stream >> info.ClassInfo.name_index;
			break;
		case CONSTANT_String:
			stream >> info.StringInfo.string_index;
			break;
		case CONSTANT_Fieldref:
			stream >> info.RefInfo.class_index;
			stream >> info.RefInfo.name_and_type_index;
			break;
		case CONSTANT_Methodref:
			stream >> info.RefInfo.class_index;
			stream >> info.RefInfo.name_and_type_index;
			break;
		case CONSTANT_InterfaceMethodref:
			stream >> info.RefInfo.class_index;
			stream >> info.RefInfo.name_and_type_index;
			break;
		case CONSTANT_NameAndType:
			stream >> info.NameAndTypeInfo.name_index;
			stream >> info.NameAndTypeInfo.descriptor_index;
			break;
		case CONSTANT_MethodHandle:
			stream >> info.MethodHandleInfo.reference_kind;
			stream >> info.MethodHandleInfo.reference_index;
			break;
		case CONSTANT_MethodType:
			stream >> info.MethodTypeInfo.descriptor_index;
			break;
		case CONSTANT_InvokeDynamic:
			stream >> info.InvokeDynamicInfo.bootstrap_method_attr_index;
			stream >> info.InvokeDynamicInfo.name_and_type_index;
			break;
		default:
			cerr << "ERROR: unrecognize TAG" << endl;
			exit(1);
	}
	
	constant_pool.push_back(info);
	
	return isDoubleSize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq 0xa8(%rdi), %rbx
leaq -0x40(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27d2
movzbl (%r15), %eax
decl %eax
cmpl $0x11, %eax
ja 0x2f50
leaq 0xf1ae(%rip), %rcx      # 0x12030
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x280c
leaq -0x36(%rbp), %rsi
jmp 0x2ea1
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x280c
xorl %ebx, %ebx
leaq 0x1637e(%rip), %rdi     # 0x19230
leaq -0x40(%rbp), %rsi
callq 0x3796
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x284c
jmp 0x2ea9
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x2888
movb $0x1, %bl
jmp 0x2eab
leaq -0x42(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x280c
movzwl (%r15), %r15d
leaq 0x1(%r15), %rdi
callq 0x2030
movq %rax, %r12
leaq -0x50(%rbp), %r13
movq %rax, (%r13)
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x26cc
movb $0x0, (%r12,%r15)
movq %r12, -0x30(%rbp)
addq $0x90, %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x3772
jmp 0x2ea9
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x27d2
jmp 0x2e97
movq 0x16099(%rip), %rdi     # 0x18ff0
leaq 0xf1c0(%rip), %rsi      # 0x1211e
callq 0x2230
movq %rax, %rdi
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
nop