    MRC     p15, #1, R0, c0, c0, #1  
    ANDS    R3, R0, #0x7000000       
    MOV     R3, R3, LSR #23          
    BEQ     Finished              
    MOV     R10, #0                  
Loop1:
    ADD     R2, R10, R10, LSR #1     
    MOV     R1, R0, LSR R2           
    AND     R1, R1, #7               
    CMP     R1, #2                   
    BLT     Skip                  

    MCR     p15, #2, R10, c0, c0, #0 
    ISB                              
    MRC     p15, #1, R1, c0, c0, #0  
    AND     R2, R1, #7               
    ADD     R2, R2, #4               
    MOVW    R4, #0x3ff
    ANDS    R4, R4, R1, LSR #3       
    CLZ     R5, R4                   
    MOVW    R7, #0x7fff
    ANDS    R7, R7, R1, LSR #13      
Loop2:
    MOV     R9, R4                   
Loop3:
    ORR     R11, R10, R9, LSL R5     
    ORR     R11, R11, R7, LSL R2     
    MCR     p15, #0, R11, c7, c6, #2 
    SUBS    R9, R9, #1               
    BGE     Loop3
    SUBS    R7, R7, #1               
    BGE     Loop2
Skip:
    ADD     R10, R10, #2             
    CMP     R3, R10
    BGT     Loop1
Finished:
    MOV     R10, #0                  
    MCR     p15, #2, R10, c0, c0, #0 
    ISB                              
