Language
C
Compiler
clang 8.0.0
Options
Warnings
Optimization
C11
-pedantic
$ clang prog.c -Wall -Wextra -O2 -march=native -std=c11 -pedantic A (size = 2x2):
   1   3
   2   4
B calculated with OP algorithm (original and modified):
      10      14
      14      20
      10      14
      14      20
B calculated with my algorithm:
      10      14
      14      20
Now the algorithms are timed with a 256 x 256 sized A
OPs_algorithm              64.959 ms
OPs_modified_algorithm     61.490 ms
mine                        4.752 ms
Exit Code: 
0