3v4l.org

run code in 500+ PHP versions simultaneously
<?php error_reporting(E_ALL & ~E_NOTICE); function f($n){for($x=$n;$x;$y++){for(;$n*$n<$x*$x+$y*$y;$x--);$c+=$x;}return$c*4+1;} $n=1001;$s=microtime(1);$v=f($n);$t=microtime(1)-$s; printf("f(%d)=%d\ntime=%f seconds.\n",$n,$v,$t);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bC0cY
function name:  (null)
number of ops:  24
compiled vars:  !0 = $n, !1 = $s, !2 = $v, !3 = $t
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                                   'error_reporting'
          1        SEND_VAL                                                     30711
          2        DO_ICALL                                                     
    4     3        ASSIGN                                                       !0, 1001
          4        INIT_FCALL                                                   'microtime'
          5        SEND_VAL                                                     1
          6        DO_ICALL                                             $6      
          7        ASSIGN                                                       !1, $6
          8        INIT_FCALL                                                   'f'
          9        SEND_VAR                                                     !0
         10        DO_FCALL                                          0  $8      
         11        ASSIGN                                                       !2, $8
         12        INIT_FCALL                                                   'microtime'
         13        SEND_VAL                                                     1
         14        DO_ICALL                                             $10     
         15        SUB                                                  ~11     $10, !1
         16        ASSIGN                                                       !3, ~11
    5    17        INIT_FCALL                                                   'printf'
         18        SEND_VAL                                                     'f%28%25d%29%3D%25d%0Atime%3D%25f+seconds.%0A'
         19        SEND_VAR                                                     !0
         20        SEND_VAR                                                     !2
         21        SEND_VAR                                                     !3
         22        DO_ICALL                                                     
         23      > RETURN                                                       1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
Branch analysis from position: 3
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
Branch analysis from position: 4
filename:       /in/bC0cY
function name:  f
number of ops:  18
compiled vars:  !0 = $n, !1 = $x, !2 = $y, !3 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        ASSIGN                                                       !1, !0
          2      > JMP                                                          ->13
          3    > > JMP                                                          ->5
          4    >   PRE_DEC                                                      !1
          5    >   MUL                                                  ~6      !0, !0
          6        MUL                                                  ~7      !1, !1
          7        MUL                                                  ~8      !2, !2
          8        ADD                                                  ~9      ~7, ~8
          9        IS_SMALLER                                                   ~6, ~9
         10      > JMPNZ                                                        ~10, ->4
         11    >   ASSIGN_OP                                         1          !3, !1
         12        PRE_INC                                                      !2
         13    > > JMPNZ                                                        !1, ->3
         14    >   MUL                                                  ~13     !3, 4
         15        ADD                                                  ~14     ~13, 1
         16      > RETURN                                                       ~14
         17*     > RETURN                                                       null

End of function f

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.16 ms | 1384 KiB | 17 Q