I am having some trouble understanding what this is doing.
This is the commented pseudocode.
mightGetUserInput(&std::__1::cin, &userInput) ; this fills the buffer with the user input, naming is a bit weird, but I'm not sure how to improve it?
if ( userInput & 1 ) ; wtf is this doing? IDA flags userInput as _BYTE
{
v54 = &userInput; //
v55 = &userInput; // This is literally junk. Has no use. Would be nice to clean this up but how?
v56 = &userInput; //
length_of_userInput = *((_QWORD *)&userInput + 1); I have been able to only trigger this
}
else
{
v51 = &userInput; //
v52 = &userInput; // This is literally junk. Has no use. Would be nice to clean this up but how?
v53 = &userInput; //
length_of_userInput = (signed int)userInput >> 1; No clue what this is doing
}
This is the actual assembly if you prefer it:
mov [rbp+user_input], rcx
mov rcx, [rbp+user_input]
movzx edx, byte ptr [rcx]
and edx, 1
cmp edx, 0
jz ....
EDIT: Someone in the comments asked for the disassembly of mightGetUserInput: here it is. DISCLAIMER: This is the pseudocode generated by IDA. It's pretty ugly and big.
I don't really know the size of userInput. It's either referred as void * or as __int64. If this is wrong (and can guide me through IDA, feel free to correct me).
userInput
and the disassembly ofmightGetUserInput
. I would say the original code should be something like: int userInput; std::cin >> userInput; if (userInput & 1) {...} else {...}