Objdump

    See asm branching

    objdump -Mintel -d --no-addresses --no-show-raw-insn --visualize-jumps loop-1-clang.c.o
    
    run_switches:
                  xor    eax, eax
    loop:
          ╭────➤ movsx  ecx, byte ptr [rdi]
                test   ecx, ecx
           ╭─── je     ret
           │    add    rdi, 1
           │    cmp    ecx, 'p'
           │ ╭─ je     p
           │ │  cmp    ecx, 's'
          ├─│─│─ jne    loop
           │ │  add    eax, 1
          ├─│─│─ jmp    loop
    p:    │ │ ╰➤ add    eax, -1
          ╰─│─── jmp    loop
    ret:    ╰──➤ ret
    

    With the related loop-1-clang.c following code

    int run_switches(char *input) {
      int res = 0;
      while (true) {
        char c = *input++;
        switch (c) {
          case '\0':
            return res;
          case 's':
            res += 1;
            break;
          case 'p':
            res -= 1;
            break;
          default:
            break;
        }
      }
    }
    

    source 1, source 2