Advent of code 2018/19
Ajax Direct

Answer

Part 1 :
Part 2 :
/*
Input specific answer, because we needs to reverse-engineer what the program does.
Basically, part 1 set a target (register 1) to a small number and part 2 to a bigger one.
The final answer is the sum of all dividers of that target.
Hereafter is the breakdown of my input. See notes.php for the less clean version.

#ip 5
0  : addi 5 16 5   - Jump to 17 [SETUP], only executed once
1  : seti 1 1 4        - Init Multiplyer to 1
2  : seti 1 8 2        - [OUTER LOOP] Init Increment to 1
3  : mulr 4 2 3            - [INNER LOOP] Value is set to Increment * Multiplyer
4  : eqrr 3 1 3            - If Value is equal to Target (register 1)...
5  : addr 3 5 5            - Then don't (else do)
6  : addi 5 1 5            - Skip the next one
7  : addr 4 0 0            - Add Multiplyer to final Answer
8  : addi 2 1 2            - Increment + 1
9  : gtrr 2 1 3            - If Increment > Target
10 : addr 5 3 5            - Then don't (else do)
11 : seti 2 6 5            - Restart [INNER LOOP]
12 : addi 4 1 4        - Multiplyer + 1
13 : gtrr 4 1 3        - If Multiplyer > Target
14 : addr 3 5 5        - Then don't (else do)
15 : seti 1 4 5        - Restart [OUTER LOOP]
16 : mulr 5 5 5        - EXIT CONDITION, 16*16 is out of bound
17 : addi 1 2 1    - [SETUP] Set Target to 2    (2)
18 : mulr 1 1 1    - Square it                  (2 * 2 = 4)
19 : mulr 5 1 1    - Multiply by pointer (19)   (4 * 19 = 76)
20 : muli 1 11 1   - Multiply it by 11          (76 * 11 = 836)
21 : addi 3 7 3    - Add 7                      (836 + 7...)
22 : mulr 3 5 3    - ... times pointer (22)     (836 + 154)
23 : addi 3 8 3    - ... plus 8                 (836 + 162 = 998)
24 : addr 1 3 1    - Target is 836 + 162 = 998
25 : addr 5 0 5    - If [register 0] is 0... (part 1)
26 : seti 0 9 5    - Jump to 1 [OUTER LOOP - 1] now
27 : setr 5 8 3    - Else save pointer            (27)
28 : mulr 3 5 3    - ... Multiply by pointer (28) (27 * 28 = 756)
29 : addr 5 3 3    - ... Add pointer (29)         (756 + 29 = 785)
30 : mulr 5 3 3    - ... Multiply by pointer (30) (785 * 30 = 23550)
31 : muli 3 14 3   - ... Multiply by 14           (23550 * 14 = 329700)
32 : mulr 3 5 3    - ... Multiply by pointer (32) (329700 * 32 = 10550400)
33 : addr 1 3 1    - Add that to the Target, Target is now 10551398
34 : seti 0 4 0    - Set [register 0] to 0 (useless)
35 : seti 0 3 5    - Jump to 1 [OUTER LOOP - 1] with big target
*/

// ==================================================
// > PART 1
// ==================================================
$target_1 = (4 * 19 * 11) + (7 * 22 + 8); // Pointers 17 to 24
$solution_1 = array_sum(Math::divisors($target_1));

// ==================================================
// > PART 2
// ==================================================
$target_2 = $target_1 + (((27 * 28 + 29) * 30) * 14 * 32); // Add pointers 27 to 33
$solution_2 = array_sum(Math::divisors($target_2));