哇这个 GCC 9.3 的杂鱼展开好可爱呀

· · 科技·工程

来源:cyffff 的神秘挂分。

那我可就来兴趣了啊。直接拿来他的代码丢进 Compiler Explorer 里面编译,使用 GCC 9.3,开 O2 优化,启动!

若干秒之后

:::error[这 tm 啥啊???]

        lea     eax, [rbx+1]
        sar     eax
        lea     r14d, [rax+1]
        mov     ebp, eax
        lea     eax, [r14+rbx]
        sar     eax
        lea     ecx, [rax+1]
        mov     r12d, eax
        lea     eax, [rcx+rbx]
        mov     DWORD PTR [rsp+56], ecx
        sar     eax
        lea     edx, [rax+1]
        mov     esi, eax
        mov     DWORD PTR [rsp+72], eax
        lea     eax, [rdx+rbx]
        mov     DWORD PTR [rsp+120], edx
        sar     eax
        lea     r10d, [rax+1]
        mov     edi, eax
        mov     DWORD PTR [rsp+104], eax
        lea     eax, [r10+rbx]
        mov     DWORD PTR [rsp+364], r10d
        sar     eax
        mov     r11d, eax
        mov     DWORD PTR [rsp+180], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+300], eax
        add     eax, ebx
        sar     eax
        mov     DWORD PTR [rsp+776], eax
        add     eax, 1
        mov     DWORD PTR [rsp+780], eax
        mov     eax, r11d
        add     eax, r10d
        sar     eax
        mov     r8d, eax
        mov     DWORD PTR [rsp+268], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+856], eax
        add     eax, r11d
        sar     eax
        mov     DWORD PTR [rsp+768], eax
        add     eax, 1
        mov     DWORD PTR [rsp+772], eax
        mov     eax, r8d
        add     eax, r10d
        sar     eax
        mov     DWORD PTR [rsp+760], eax
        add     eax, 1
        mov     DWORD PTR [rsp+764], eax
        mov     eax, edi
        add     eax, edx
        sar     eax
        mov     r11d, eax
        mov     DWORD PTR [rsp+176], eax
        lea     eax, [rax+1]
        add     edi, eax
        mov     DWORD PTR [rsp+296], eax
        mov     eax, edi
        sar     eax
        mov     DWORD PTR [rsp+752], eax
        add     eax, 1
        mov     DWORD PTR [rsp+756], eax
        mov     eax, edx
        add     eax, r11d
        sar     eax
        mov     edi, eax
        mov     DWORD PTR [rsp+264], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+844], eax
        add     eax, r11d
        sar     eax
        mov     DWORD PTR [rsp+744], eax
        add     eax, 1
        mov     DWORD PTR [rsp+748], eax
        mov     eax, edi
        add     eax, edx
        mov     edx, esi
        sar     eax
        mov     DWORD PTR [rsp+736], eax
        add     eax, 1
        mov     DWORD PTR [rsp+740], eax
        mov     eax, ecx
        add     eax, esi
        sar     eax
        lea     edi, [rax+1]
        mov     esi, eax
        mov     DWORD PTR [rsp+88], eax
        mov     eax, edi
        mov     DWORD PTR [rsp+292], edi
        add     eax, edx
        sar     eax
        mov     r11d, eax
        mov     DWORD PTR [rsp+172], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+356], eax
        add     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+728], eax
        add     eax, 1
        mov     DWORD PTR [rsp+732], eax
        mov     eax, edi
        add     eax, r11d
        sar     eax
        mov     DWORD PTR [rsp+260], eax
        mov     edx, eax
        lea     eax, [rax+1]
        add     r11d, eax
        mov     DWORD PTR [rsp+848], eax
        mov     eax, r11d
        sar     eax
        mov     DWORD PTR [rsp+720], eax
        add     eax, 1
        mov     DWORD PTR [rsp+724], eax
        mov     eax, edi
        add     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+712], eax
        add     eax, 1
        mov     DWORD PTR [rsp+716], eax
        mov     eax, esi
        add     eax, ecx
        sar     eax
        lea     r8d, [rax+1]
        mov     edi, eax
        mov     DWORD PTR [rsp+168], eax
        mov     eax, r8d
        mov     DWORD PTR [rsp+360], r8d
        add     eax, esi
        sar     eax
        mov     edx, eax
        mov     DWORD PTR [rsp+256], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+852], eax
        add     eax, esi
        sar     eax
        mov     DWORD PTR [rsp+704], eax
        add     eax, 1
        mov     DWORD PTR [rsp+708], eax
        mov     eax, edx
        add     eax, r8d
        sar     eax
        mov     DWORD PTR [rsp+696], eax
        add     eax, 1
        mov     DWORD PTR [rsp+700], eax
        mov     eax, edi
        add     eax, ecx
        sar     eax
        mov     esi, eax
        mov     DWORD PTR [rsp+252], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+792], eax
        add     eax, edi
        sar     eax
        mov     DWORD PTR [rsp+688], eax
        add     eax, 1
        mov     DWORD PTR [rsp+692], eax
        mov     eax, esi
        add     eax, ecx
        sar     eax
        mov     DWORD PTR [rsp+680], eax
        add     eax, 1
        mov     DWORD PTR [rsp+684], eax
        lea     eax, [r12+r14]
        sar     eax
        lea     esi, [rax+1]
        mov     edi, eax
        mov     DWORD PTR [rsp+68], eax
        lea     eax, [r12+rsi]
        mov     DWORD PTR [rsp+112], esi
        sar     eax
        lea     r10d, [rax+1]
        mov     ecx, eax
        mov     DWORD PTR [rsp+100], eax
        lea     eax, [r12+r10]
        mov     DWORD PTR [rsp+352], r10d
        sar     eax
        mov     edx, eax
        mov     DWORD PTR [rsp+164], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+288], eax
        add     eax, r12d
        sar     eax
        mov     DWORD PTR [rsp+672], eax
        add     eax, 1
        mov     DWORD PTR [rsp+676], eax
        mov     eax, edx
        add     eax, r10d
        sar     eax
        mov     r11d, eax
        mov     DWORD PTR [rsp+248], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+840], eax
        add     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+664], eax
        add     eax, 1
        mov     DWORD PTR [rsp+668], eax
        mov     eax, r11d
        add     eax, r10d
        mov     r10d, r14d
        sar     eax
        mov     DWORD PTR [rsp+656], eax
        add     eax, 1
        mov     DWORD PTR [rsp+660], eax
        mov     eax, ecx
        add     eax, esi
        sar     eax
        mov     edx, eax
        mov     DWORD PTR [rsp+160], eax
        lea     eax, [rax+1]
        add     ecx, eax
        mov     DWORD PTR [rsp+284], eax
        mov     eax, ecx
        sar     eax
        mov     DWORD PTR [rsp+648], eax
        add     eax, 1
        mov     DWORD PTR [rsp+652], eax
        mov     eax, esi
        add     eax, edx
        sar     eax
        mov     ecx, eax
        mov     DWORD PTR [rsp+244], eax
        lea     eax, [rax+1]
        add     edx, eax
        mov     DWORD PTR [rsp+836], eax
        add     esi, ecx
        mov     ecx, edi
        mov     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+640], eax
        add     eax, 1
        mov     DWORD PTR [rsp+644], eax
        mov     eax, esi
        sar     eax
        mov     DWORD PTR [rsp+632], eax
        add     eax, 1
        mov     DWORD PTR [rsp+636], eax
        lea     eax, [rdi+r14]
        sar     eax
        lea     edi, [rax+1]
        mov     esi, eax
        mov     DWORD PTR [rsp+84], eax
        mov     eax, edi
        mov     DWORD PTR [rsp+280], edi
        add     eax, ecx
        sar     eax
        mov     edx, eax
        mov     DWORD PTR [rsp+156], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+340], eax
        add     eax, ecx
        sar     eax
        mov     DWORD PTR [rsp+624], eax
        add     eax, 1
        mov     DWORD PTR [rsp+628], eax
        mov     eax, edi
        add     eax, edx
        sar     eax
        sar     r10d
        mov     ecx, eax
        mov     DWORD PTR [rsp+240], eax
        lea     eax, [rax+1]
        add     edx, eax
        mov     DWORD PTR [rsp+828], eax
        mov     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+616], eax
        add     eax, 1
        mov     DWORD PTR [rsp+620], eax
        mov     eax, edi
        add     eax, ecx
        sar     eax
        mov     DWORD PTR [rsp+608], eax
        add     eax, 1
        mov     DWORD PTR [rsp+612], eax
        lea     eax, [rsi+r14]
        sar     eax
        lea     edx, [rax+1]
        mov     ecx, eax
        mov     DWORD PTR [rsp+152], eax
        mov     eax, edx
        mov     DWORD PTR [rsp+348], edx
        add     eax, esi
        sar     eax
        mov     edi, eax
        mov     DWORD PTR [rsp+236], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+832], eax
        add     eax, esi
        sar     eax
        mov     DWORD PTR [rsp+600], eax
        add     eax, 1
        mov     DWORD PTR [rsp+604], eax
        mov     eax, edi
        add     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+592], eax
        add     eax, 1
        mov     DWORD PTR [rsp+596], eax
        lea     eax, [rcx+r14]
        sar     eax
        mov     edi, eax
        mov     DWORD PTR [rsp+232], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+788], eax
        add     eax, ecx
        lea     ecx, [r10+1]
        sar     eax
        mov     DWORD PTR [rsp+584], eax
        add     eax, 1
        mov     DWORD PTR [rsp+588], eax
        lea     eax, [rdi+r14]
        sar     eax
        mov     DWORD PTR [rsp+8], r10d
        mov     DWORD PTR [rsp+576], eax
        add     eax, 1
        mov     DWORD PTR [rsp+580], eax
        lea     eax, [rcx+rbp]
        sar     eax
        mov     DWORD PTR [rsp+52], ecx
        lea     r8d, [rax+1]
        mov     edi, eax
        mov     DWORD PTR [rsp+64], eax
        lea     eax, [r8+rbp]
        mov     DWORD PTR [rsp+116], r8d
        sar     eax
        lea     edx, [rax+1]
        mov     esi, eax
        mov     DWORD PTR [rsp+96], eax
        lea     eax, [rdx+rbp]
        mov     DWORD PTR [rsp+276], edx
        sar     eax
        mov     r11d, eax
        mov     DWORD PTR [rsp+148], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+344], eax
        add     eax, ebp
        sar     eax
        mov     DWORD PTR [rsp+568], eax
        add     eax, 1
        mov     DWORD PTR [rsp+572], eax
        mov     eax, edx
        add     eax, r11d
        sar     eax
        mov     r13d, eax
        mov     DWORD PTR [rsp+228], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+800], eax
        add     eax, r11d
        sar     eax
        mov     DWORD PTR [rsp+560], eax
        add     eax, 1
        mov     DWORD PTR [rsp+564], eax
        mov     eax, edx
        add     eax, r13d
        mov     r13, r9
        sar     eax
        mov     DWORD PTR [rsp+552], eax
        add     eax, 1
        mov     DWORD PTR [rsp+556], eax
        mov     eax, esi
        add     eax, r8d
        sar     eax
        mov     edx, eax
        mov     DWORD PTR [rsp+144], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+336], eax
        add     eax, esi
        sar     eax
        mov     DWORD PTR [rsp+544], eax
        add     eax, 1
        mov     DWORD PTR [rsp+548], eax
        mov     eax, edx
        add     eax, r8d
        sar     eax
        mov     esi, eax
        mov     DWORD PTR [rsp+224], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+796], eax
        add     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+536], eax
        add     eax, 1
        mov     DWORD PTR [rsp+540], eax
        mov     eax, esi
        add     eax, r8d
        sar     eax
        mov     DWORD PTR [rsp+528], eax
        add     eax, 1
        mov     DWORD PTR [rsp+532], eax
        mov     eax, edi
        add     eax, ecx
        sar     eax
        lea     r11d, [rax+1]
        mov     esi, eax
        mov     DWORD PTR [rsp+80], eax
        mov     eax, edi
        add     eax, r11d
        mov     DWORD PTR [rsp+324], r11d
        sar     eax
        mov     edx, eax
        mov     DWORD PTR [rsp+140], eax
        lea     eax, [rax+1]
        add     edi, eax
        mov     DWORD PTR [rsp+332], eax
        mov     eax, edi
        sar     eax
        mov     DWORD PTR [rsp+520], eax
        add     eax, 1
        mov     DWORD PTR [rsp+524], eax
        mov     eax, edx
        add     eax, r11d
        sar     eax
        mov     edi, eax
        mov     DWORD PTR [rsp+220], eax
        lea     eax, [rax+1]
        add     edx, eax
        mov     DWORD PTR [rsp+824], eax
        mov     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+512], eax
        add     eax, 1
        mov     DWORD PTR [rsp+516], eax
        mov     eax, edi
        add     eax, r11d
        sar     eax
        mov     DWORD PTR [rsp+504], eax
        add     eax, 1
        mov     DWORD PTR [rsp+508], eax
        mov     eax, esi
        add     eax, ecx
        sar     eax
        lea     r8d, [rax+1]
        mov     edi, eax
        mov     DWORD PTR [rsp+136], eax
        mov     eax, esi
        add     eax, r8d
        mov     DWORD PTR [rsp+328], r8d
        sar     eax
        mov     edx, eax
        mov     DWORD PTR [rsp+216], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+816], eax
        add     eax, esi
        sar     eax
        mov     DWORD PTR [rsp+496], eax
        add     eax, 1
        mov     DWORD PTR [rsp+500], eax
        mov     eax, edx
        add     eax, r8d
        sar     eax
        mov     DWORD PTR [rsp+488], eax
        add     eax, 1
        mov     DWORD PTR [rsp+492], eax
        mov     eax, edi
        add     eax, ecx
        sar     eax
        mov     esi, eax
        mov     DWORD PTR [rsp+212], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+812], eax
        add     eax, edi
        sar     eax
        mov     DWORD PTR [rsp+480], eax
        add     eax, 1
        mov     DWORD PTR [rsp+484], eax
        mov     eax, esi
        add     eax, ecx
        sar     ecx
        sar     eax
        mov     edi, ecx
        mov     DWORD PTR [rsp+60], ecx
        lea     ecx, [rcx+1]
        mov     DWORD PTR [rsp+472], eax
        add     eax, 1
        mov     DWORD PTR [rsp+476], eax
        mov     eax, ecx
        add     eax, r10d
        mov     DWORD PTR [rsp+108], ecx
        sar     eax
        lea     edx, [rax+1]
        mov     esi, eax
        mov     DWORD PTR [rsp+92], eax
        mov     eax, edx
        mov     DWORD PTR [rsp+272], edx
        add     eax, r10d
        sar     eax
        mov     r11d, eax
        mov     DWORD PTR [rsp+132], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+320], eax
        add     eax, r10d
        sar     eax
        mov     DWORD PTR [rsp+464], eax
        add     eax, 1
        mov     DWORD PTR [rsp+468], eax
        mov     eax, edx
        add     eax, r11d
        sar     eax
        mov     DWORD PTR [rsp+208], eax
        mov     r8d, eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+820], eax
        add     eax, r11d
        sar     eax
        mov     DWORD PTR [rsp+456], eax
        add     eax, 1
        mov     DWORD PTR [rsp+460], eax
        mov     eax, edx
        add     eax, r8d
        sar     eax
        mov     DWORD PTR [rsp+448], eax
        add     eax, 1
        mov     DWORD PTR [rsp+452], eax
        mov     eax, esi
        add     eax, ecx
        sar     eax
        lea     r10d, [rax+1]
        mov     edx, eax
        mov     DWORD PTR [rsp+128], eax
        add     esi, r10d
        mov     DWORD PTR [rsp+316], r10d
        mov     eax, esi
        sar     eax
        lea     esi, [rax+1]
        mov     DWORD PTR [rsp+204], eax
        add     eax, r10d
        sar     eax
        mov     DWORD PTR [rsp+436], esi
        mov     DWORD PTR [rsp+440], eax
        add     eax, 1
        mov     DWORD PTR [rsp+444], eax
        mov     eax, ecx
        add     eax, edx
        sar     eax
        mov     esi, eax
        mov     DWORD PTR [rsp+200], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+808], eax
        add     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+428], eax
        add     eax, 1
        mov     DWORD PTR [rsp+432], eax
        mov     eax, esi
        add     eax, ecx
        sar     ecx
        sar     eax
        lea     esi, [rcx+1]
        mov     DWORD PTR [rsp+76], ecx
        mov     DWORD PTR [rsp+420], eax
        add     eax, 1
        mov     DWORD PTR [rsp+424], eax
        mov     eax, edi
        add     eax, esi
        mov     DWORD PTR [rsp+312], esi
        sar     eax
        mov     edx, eax
        mov     DWORD PTR [rsp+124], eax
        lea     eax, [rax+1]
        add     edi, eax
        mov     DWORD PTR [rsp+308], eax
        mov     eax, edi
        mov     edi, esi
        sar     eax
        mov     DWORD PTR [rsp+412], eax
        add     eax, 1
        mov     DWORD PTR [rsp+416], eax
        mov     eax, edx
        add     eax, esi
        sar     eax
        mov     esi, eax
        mov     DWORD PTR [rsp+196], eax
        lea     eax, [rax+1]
        mov     DWORD PTR [rsp+784], eax
        add     eax, edx
        sar     eax
        mov     DWORD PTR [rsp+404], eax
        add     eax, 1
        mov     DWORD PTR [rsp+408], eax
        mov     eax, esi
        add     eax, edi
        sar     eax
        mov     DWORD PTR [rsp+396], eax
        add     eax, 1
        sar     edi
        mov     DWORD PTR [rsp+400], eax
        mov     eax, ecx
        mov     DWORD PTR [rsp+184], edi
        add     edi, 1
        add     eax, edi
        mov     DWORD PTR [rsp+304], edi
        sar     eax
        mov     DWORD PTR [rsp+192], eax
        mov     esi, eax
        lea     eax, [rax+1]
        add     ecx, eax
        mov     DWORD PTR [rsp+804], eax
        mov     eax, ecx
        sar     eax
        mov     DWORD PTR [rsp+388], eax
        add     eax, 1
        mov     DWORD PTR [rsp+392], eax
        mov     eax, esi
        add     eax, edi
        sar     edi
        mov     DWORD PTR [rsp+16], r12d
        sar     eax
        mov     DWORD PTR [rsp+188], edi
        mov     DWORD PTR [rsp+380], eax
        add     eax, 1
        mov     DWORD PTR [rsp+384], eax
        lea     eax, [rdi+1]
        mov     DWORD PTR [rsp+368], eax
        sar     eax
        mov     DWORD PTR [rsp+372], eax
        add     eax, 1
        mov     DWORD PTR [rsp+376], eax

:::

温馨提醒:上面的所有东西都是从同一个函数里炸出来的:

inline int query(int rt,int l,int r,int p){
    if(!rt) return 0;
    if(l==r) return a[rt].tag;
    int mid=l+r>>1;
    if(p<=mid) return query(ls,l,mid,p)+a[rt].tag;
    else return query(rs,mid+1,r,p)+a[rt].tag;
}

不行赶紧关掉 O2,它在干啥啊???

若干秒之后

:::info[哎呀你看这不就正常多了吗]

Segment_Tree::query(int, int, int, int):
        push    rbp
        mov     rbp, rsp
        sub     rsp, 48
        mov     QWORD PTR [rbp-24], rdi
        mov     DWORD PTR [rbp-28], esi
        mov     DWORD PTR [rbp-32], edx
        mov     DWORD PTR [rbp-36], ecx
        mov     DWORD PTR [rbp-40], r8d
        cmp     DWORD PTR [rbp-28], 0
        jne     .L42
        mov     eax, 0
        jmp     .L43
.L42:
        mov     eax, DWORD PTR [rbp-32]
        cmp     eax, DWORD PTR [rbp-36]
        jne     .L44
        mov     rcx, QWORD PTR [rbp-24]
        mov     eax, DWORD PTR [rbp-28]
        movsx   rdx, eax
        mov     rax, rdx
        add     rax, rax
        add     rax, rdx
        sal     rax, 2
        add     rax, rcx
        add     rax, 8
        mov     eax, DWORD PTR [rax]
        jmp     .L43
.L44:
        mov     edx, DWORD PTR [rbp-32]
        mov     eax, DWORD PTR [rbp-36]
        add     eax, edx
        sar     eax
        mov     DWORD PTR [rbp-4], eax
        mov     eax, DWORD PTR [rbp-40]
        cmp     eax, DWORD PTR [rbp-4]
        jg      .L45
        mov     rcx, QWORD PTR [rbp-24]
        mov     eax, DWORD PTR [rbp-28]
        movsx   rdx, eax
        mov     rax, rdx
        add     rax, rax
        add     rax, rdx
        sal     rax, 2
        add     rax, rcx
        mov     esi, DWORD PTR [rax]
        mov     edi, DWORD PTR [rbp-40]
        mov     ecx, DWORD PTR [rbp-4]
        mov     edx, DWORD PTR [rbp-32]
        mov     rax, QWORD PTR [rbp-24]
        mov     r8d, edi
        mov     rdi, rax
        call    Segment_Tree::query(int, int, int, int)
        mov     ecx, eax
        mov     rsi, QWORD PTR [rbp-24]
        mov     eax, DWORD PTR [rbp-28]
        movsx   rdx, eax
        mov     rax, rdx
        add     rax, rax
        add     rax, rdx
        sal     rax, 2
        add     rax, rsi
        add     rax, 8
        mov     eax, DWORD PTR [rax]
        add     eax, ecx
        jmp     .L43
.L45:
        mov     eax, DWORD PTR [rbp-4]
        lea     edi, [rax+1]
        mov     rcx, QWORD PTR [rbp-24]
        mov     eax, DWORD PTR [rbp-28]
        movsx   rdx, eax
        mov     rax, rdx
        add     rax, rax
        add     rax, rdx
        sal     rax, 2
        add     rax, rcx
        add     rax, 4
        mov     esi, DWORD PTR [rax]
        mov     ecx, DWORD PTR [rbp-40]
        mov     edx, DWORD PTR [rbp-36]
        mov     rax, QWORD PTR [rbp-24]
        mov     r8d, ecx
        mov     ecx, edx
        mov     edx, edi
        mov     rdi, rax
        call    Segment_Tree::query(int, int, int, int)
        mov     ecx, eax
        mov     rsi, QWORD PTR [rbp-24]
        mov     eax, DWORD PTR [rbp-28]
        movsx   rdx, eax
        mov     rax, rdx
        add     rax, rax
        add     rax, rdx
        sal     rax, 2
        add     rax, rsi
        add     rax, 8
        mov     eax, DWORD PTR [rax]
        add     eax, ecx
.L43:
        leave
        ret

:::

那是不是旧的编译器太笨了啊?换个编译器试试(选中 GCC 15.2)。

若干秒之后

:::info[你看这不就是正常的吗???]

Segment_Tree::query(int, int, int, int):
        xor     eax, eax
        test    esi, esi
        je      .L366
        cmp     edx, ecx
        je      .L370
        mov     r10d, ecx
        movsx   rsi, esi
        lea     ecx, [rdx+rcx]
        sub     rsp, 24
        lea     rax, [rsi+rsi*2]
        sar     ecx
        lea     r9, [rdi+rax*4]
        cmp     ecx, r8d
        jl      .L350
        movsx   rax, DWORD PTR [r9]
        test    eax, eax
        je      .L354
        cmp     edx, ecx
        je      .L368
        lea     r10d, [rdx+rcx]
        lea     rax, [rax+rax*2]
        mov     QWORD PTR [rsp+8], r9
        sar     r10d
        lea     r11, [rdi+rax*4]
        cmp     r8d, r10d
        jg      .L353
        mov     esi, DWORD PTR [r11]
.L369:
        mov     ecx, r10d
        mov     QWORD PTR [rsp], r11
        call    Segment_Tree::query(int, int, int, int)
        mov     r11, QWORD PTR [rsp]
        mov     r9, QWORD PTR [rsp+8]
        add     eax, DWORD PTR [r11+8]
.L354:
        add     eax, DWORD PTR [r9+8]
        add     rsp, 24
        ret
.L350:
        movsx   rax, DWORD PTR [r9+4]
        test    eax, eax
        je      .L354
        lea     edx, [rcx+1]
        cmp     edx, r10d
        je      .L368
        lea     ecx, [rdx+r10]
        mov     QWORD PTR [rsp+8], r9
        lea     rax, [rax+rax*2]
        sar     ecx
        cmp     r8d, ecx
        jg      .L356
        lea     r10, [rdi+rax*4]
        mov     esi, DWORD PTR [r10]
        mov     QWORD PTR [rsp], r10
        call    Segment_Tree::query(int, int, int, int)
        mov     r10, QWORD PTR [rsp]
        mov     r9, QWORD PTR [rsp+8]
        add     eax, DWORD PTR [r10+8]
        jmp     .L354
.L366:
        ret
.L370:
        movsx   rsi, esi
        lea     rax, [rsi+rsi*2]
        mov     eax, DWORD PTR [rdi+8+rax*4]
        ret
.L368:
        lea     rax, [rax+rax*2]
        mov     eax, DWORD PTR [rdi+8+rax*4]
        jmp     .L354
.L356:
        lea     r11, [rdi+rax*4]
        lea     edx, [rcx+1]
        mov     esi, DWORD PTR [r11+4]
        jmp     .L369
.L353:
        mov     esi, DWORD PTR [r11+4]
        lea     edx, [r10+1]
        mov     QWORD PTR [rsp], r11
        call    Segment_Tree::query(int, int, int, int)
        mov     r11, QWORD PTR [rsp]
        mov     r9, QWORD PTR [rsp+8]
        add     eax, DWORD PTR [r11+8]
        jmp     .L354

:::

欸你说它展开是不是因为它看到了那个 inline 啊?把配置调回去删掉 inline 试试。

若干秒之后

你完全不听是吧?还在展开?

评价是某协会都 2025 年了有 GCC 15.2 了还在用 GCC 9.3 完全就是不知所云。不过对于普通选手的我们还有救吗?完全不知道,还是听天由命吧。