Simulate D Flip-Flop
J, 27 23 bytes

-4 bytes thanks to Bubbler!

;@(&lt;@({.\);.1~1,2&lt;/\}.)


Try it online!

CLK is the left argument; D is the right one. When CLK doesn't start with 01, the starting bits are the same as the first bit of D.

                       ;.1  - cut 
                          ] - the right argument (D)
   (          )             - where
         2 /\               - the previous element 
             [              - of the left argument (CLK)
          &lt;                 - is smaller than the next one 
       }.                   - drop
      1                     - the first item
    1,                      - prepend with 1 (for cutting)
               (     )      - for each cut group
                   $        - make a list   
                #           - of the same length as the group
                    {.      - with elements same as the first one  
                 &lt;@         - and box the list
  ;                         - unbox the sublists and flatten them
[:                          - function composition


K (oK), 27  23bytes

-4 bytes thanks to ngn!

{,/&amp;\'|\'(0,&amp;1_&gt;':x)_y}


Try it online!