Hex-Rays decompiled (with the assistance of pdb symbols) a piece of code as such: XPerfAddIn::CFramesInfoSource::MatchEventDescriptor( (XPerfAddIn::CFramesInfoSource *)2
And by my following of the assembly, it is correct:
xor r15d, r15d
test rax, rax
jz loc_1800224C7
lea r13, [rax+20h]
cmp [r13+0], r15
jz loc_1800224C7
lea r12, [r14+28h]
mov rax, [rsp+260h+a3]
mov rcx, [rax]
cmp rcx, cs:qword_180044990
jnz loc_1800224C7
mov rax, [rax+8]
cmp rax, cs:qword_180044998
jnz loc_1800224C7
lea ecx, [r15+2]
mov r9d, ecx ; a4
lea r8, MSHTML_CDOC_ONPAINT_START_V1 ; a3
mov rdx, r12 ; a2
call ?MatchEventDescriptor@CFramesInfoSource@XPerfAddIn
MatchEventDescriptor does not use the 'this' parameter in rcx, so it doesn't really matter what gets passed in. So why would the compiler emit an extra lea instruction to pass in a constant 2 instead of just leaving it 0... or passing in the actual, correct this value?