<?php
define('WAR_CODES', [
' ' => '', // World War 1
'A' => 'Allied Forces',
'AFG' => 'Australian - War on Terrorism',
'AGX' => 'Act of Grace',
'ALX' => 'Algeria - World War 2',
'ARG' => 'Argentina - Gulf War',
'ARX' => 'Argentina - World War 2',
'BAG' => 'Bahrain - Gulf War',
'BAL' => 'Peacekeeping - Balkans',
'BCG' => 'Bangladesh - Gulf War',
'BG' => 'Belgium - World War 1',
'BGG' => 'Belgium - Gulf War',
'BGK' => 'Belgium - Korean War',
'BGX' => 'Belgium - World War 2',
'BRX' => 'Brazil - World War 2',
'BUG' => 'Bulgaria - Gulf War',
'BUR' => 'Burma',
'BUX' => 'Bulgaria - World War 2',
'CAM' => 'Australian - Cambodian Service',
'CCG' => 'Canadian - Gulf War',
'CHX' => 'China - World War 2',
'CIX' => 'Chile - World War 2',
'CLK' => 'Colombia - Korean War',
'CN' => 'Canadian - World War 1',
'CNK' => 'Canadian - Korean War',
'CNS' => 'Canadian - Other Service',
'CNX' => 'Canadian - World War 2',
'CON' => 'Peacekeeping - Congo',
'CYP' => 'Peacekeeping - Cyprus',
'CZG' => 'Czechoslovakia - Gulf War',
'CZX' => 'Czechoslovakia - World War 2',
'DEG' => 'Denmark - Gulf War',
'DNK' => 'Denmark - Korean War',
'DNX' => 'Denmark - World War 2',
'EGG' => 'Egypt - Gulf War',
'EGX' => 'Egypt - World War 2',
'EGY' => 'Peacekeeping - Egypt',
'ESX' => 'Estonia - World War 2',
'ET' => 'Australian - East Timor Service',
'ETK' => 'Ethiopia - Korean War',
'ETX' => 'Ethiopia - World War 2',
'FIJ' => 'Fiji',
'FIX' => 'Finland - World War 2',
'FR' => 'France - World War 1',
'FRG' => 'France - Gulf War',
'FRK' => 'France - Korean War',
'FRX' => 'France - World War 2',
'FW' => 'Australian - World War 1',
'GHA' => 'Ghana',
'GR' => 'Greece - World War 1',
'GRE' => 'Peacekeeping - Greece',
'GRG' => 'Greece - Gulf War',
'GRK' => 'Greece - Korean War',
'GRX' => 'Greece - World War 2',
'GW' => 'Australian - Gulf War Service',
'HKS' => 'Hong Kong',
'HKX' => 'Hong Kong - World War 2',
'HLG' => 'Netherlands - Gulf War',
'HLK' => 'Netherlands - Korea',
'HLX' => 'Netherlands - World War 2',
'HUX' => 'Hungary - World War 2',
'IDA' => 'Peacekeeping - Indonesia',
'IND' => 'India',
'IQ' => 'Australian - War in Iraq',
'ISR' => 'Peacekeeping - Israel',
'IT' => 'Italy - World War 1',
'ITG' => 'Italy - Gulf War',
'ITK' => 'Italy - Korean War',
'ITX' => 'Italy - World War 2',
'IV' => 'Indigenous Veterans of PNG',
'JA' => 'Japan - World War 1',
'KM' => 'Australian - Korean/Malayan Service',
'KO' => 'South Korea - Korean War',
'KOS' => 'South Korea - Vietnam War',
'KSH' => 'Peacekeeping - Kashmir',
'KUG' => 'Kuwait - Gulf War',
'KYA' => 'Kenya',
'LAX' => 'Latvia - World War 2',
'LBX' => 'Liberia - World War 2',
'LXK' => 'Luxembourg - Korean War',
'MAL' => 'Malaysian Pensioners',
'MAR' => 'Allied Mariner- World War 2',
'MAU' => 'Mauritius',
'MLS' => 'Malaysia/Singapore',
'MO' => 'Montenegro - World War 1',
'MOG' => 'Morocco - Gulf War',
'MTX' => 'Malta - World War 2',
'MWI' => 'Malawi',
'N' => 'New Zealand - World War 1',
'NBA' => 'Australian - Namibian Service',
'NCG' => 'New Zealand - Gulf War',
'NF' => 'Newfoundland',
'NG' => 'New Guinea Civilians',
'NGR' => 'Nigeria',
'NIG' => 'Niger - Gulf War',
'NK' => 'New Zealand - Korean War',
'NRD' => 'Northern Zimbabwe (Rhodesia)',
'NSM' => 'New Zealand - Serving Member',
'NSS' => 'New Zealand Special O\'seas Service',
'NSW' => 'New Zealand Merchant Mariner - WW2',
'NWG' => 'Norway - Gulf War',
'NWK' => 'Norway - Korean War',
'NWX' => 'Norway - World War 2',
'NX' => 'New Zealand - World War 2',
'OMG' => 'Oman - Gulf War',
'P' => 'British - World War 1',
'PAD' => 'British Admiralty',
'PAG' => 'Pakistan - Gulf War',
'PAL' => 'Peacekeeping - Palestine',
'PAM' => 'British Air Ministry',
'PAX' => 'Panama - World War 2',
'PCA' => 'British Crown Agents',
'PCG' => 'British - Gulf War',
'PCR' => 'British Ministry O\'seas Development',
'PCV' => 'British Civilians',
'PHK' => 'Philippines - Korean War',
'PHS' => 'Philippines - Vietnam War',
'PHX' => 'Philippines - World War 2',
'PK' => 'British - Korean/Malayan Service',
'PLG' => 'Poland - Gulf War',
'PLX' => 'Poland - World War 2',
'PMS' => 'British Merchant Mariner - WW1',
'PO' => 'Portugal - World War 1',
'PSM' => 'British Serving Member',
'PSW' => 'British Merchant Mariner - WW2',
'PWO' => 'British War Office',
'PX' => 'British - World War 2',
'QAG' => 'Qatar - Gulf War',
'RD' => 'Zimbabwe (Rhodesia) - World War 1',
'RDX' => 'Zimbabwe (Rhodesia) - World War 2',
'RM' => 'Romania - World War 1',
'RU' => 'Russia - World War 1',
'RUG' => 'Russia - Gulf War',
'RUX' => 'Russia - World War 2',
'SA' => 'South Africa - World War 1',
'SAG' => 'Saudi Arabia - Gulf War',
'SAX' => 'South Africa - World War 2',
'SCG' => 'Sierra Leone - Gulf War',
'SE' => 'Serbia - World War 1',
'SEG' => 'Senegal - Gulf War',
'SIN' => 'Peacekeeping - Sinai',
'SL' => 'Sierra Leone',
'SM' => 'Australian - Serving Member',
'SO' => 'Australian - Somalian Service',
'SPG' => 'Spain - Gulf War',
'SR' => 'Australian - Malayan Emergency',
'SS' => 'Australian Special Overseas Service',
'SUD' => 'Sudan',
'SWK' => 'Sweden - Korean War',
'SWP' => 'Australian Merchant Mariner - WW2',
'SYG' => 'Syria - Gulf War',
'SYR' => 'Peacekeeping - Syria',
'SYX' => 'Syria - World War 2',
'THK' => 'Thailand - Korean War',
'THS' => 'Thailand - Vietnam War',
'TRG' => 'Turkey - Gulf War',
'TRK' => 'Turkey - Korean War',
'TZA' => 'Tanzania (Tanzanyika/Zanzibar)',
'UAG' => 'United Arab Emirates - Gulf War',
'UB' => 'Australian - Ubon 1965-68',
'URX' => 'Uruguay - World War 2',
'US' => 'United States - World War 1',
'USG' => 'United States - Gulf War',
'USK' => 'United States - Korean War',
'USS' => 'United States - Vietnam War',
'USX' => 'United States - World War 2',
'V' => 'Australian - Serving Member',
'VEX' => 'Venezuela - World War 2',
'VNS' => 'South Vietnam - Vietnam War',
'X' => 'Australian - World War 2',
'YEM' => 'Peacekeeping - Yemen',
'YGX' => 'Yugoslavia - World War 2',
'YU' => 'Australian - Yugoslavian Service',
'ZIM' => 'Peacekeeping - Zimbabwe',
]);
$groups = [1 => ''];
foreach (WAR_CODES as $code => $description) {
switch (strlen($code)) {
case 1:
$groups[1] .= $code;
break;
case 2:
$groups[2][$code[0]][] = $code[1];
break;
case 3:
$groups[3][$code[0]][$code[1]][] = $code[2];
break;
}
}
$groups[1] = "[{$groups[1]}]\d{6}";
foreach ($groups[2] as $first => &$seconds) {
$seconds = count($seconds) === 1
? "$first{$seconds[0]}"
: sprintf('%s[%s]', $first, implode($seconds));
}
$groups[2] = '(?:' . implode('|', $groups[2]) . ')\d{5}';
foreach ($groups[3] as $first => &$seconds) {
foreach ($seconds as $second => &$thirds) {
$thirds = count($thirds) === 1
? "$second{$thirds[0]}"
: sprintf('%s[%s]', $second, implode($thirds));
}
$seconds = count($seconds) === 1
? "$first$thirds"
: sprintf('%s(?:%s)', $first, implode('|', $seconds));
}
$groups[3] = '(?:' . implode('|', $groups[3]) . ')\d{4}';
ksort($groups);
echo implode("\n|", $groups);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 38
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 38
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 38
2 jumps found. (Code = 125) Position 1 = 47, Position 2 = 68
Branch analysis from position: 47
2 jumps found. (Code = 126) Position 1 = 48, Position 2 = 68
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 57
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Branch analysis from position: 68
2 jumps found. (Code = 125) Position 1 = 80, Position 2 = 124
Branch analysis from position: 80
2 jumps found. (Code = 126) Position 1 = 81, Position 2 = 124
Branch analysis from position: 81
2 jumps found. (Code = 125) Position 1 = 83, Position 2 = 104
Branch analysis from position: 83
2 jumps found. (Code = 126) Position 1 = 84, Position 2 = 104
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 88, Position 2 = 93
Branch analysis from position: 88
1 jumps found. (Code = 42) Position 1 = 102
Branch analysis from position: 102
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
Branch analysis from position: 104
2 jumps found. (Code = 43) Position 1 = 108, Position 2 = 112
Branch analysis from position: 108
1 jumps found. (Code = 42) Position 1 = 122
Branch analysis from position: 122
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
Branch analysis from position: 112
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
Branch analysis from position: 104
Branch analysis from position: 124
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 124
Branch analysis from position: 68
Branch analysis from position: 38
filename: /in/8ECVS
function name: (null)
number of ops: 143
compiled vars: !0 = $groups, !1 = $description, !2 = $code, !3 = $seconds, !4 = $first, !5 = $thirds, !6 = $second
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > INIT_FCALL 'define'
1 SEND_VAL 'WAR_CODES'
4 2 SEND_VAL <array>
3 3 DO_ICALL
180 4 ASSIGN !0, <array>
181 5 FETCH_CONSTANT ~9 'WAR_CODES'
6 > FE_RESET_R $10 ~9, ->38
7 > > FE_FETCH_R ~11 $10, !1, ->38
8 > ASSIGN !2, ~11
182 9 STRLEN ~13 !2
183 10 CASE ~13, 1
11 > JMPNZ ~14, ->17
186 12 > CASE ~13, 2
13 > JMPNZ ~14, ->20
189 14 > CASE ~13, 3
15 > JMPNZ ~14, ->27
16 > > JMP ->36
184 17 > ASSIGN_DIM_OP .= 8 !0, 1
18 OP_DATA !2
185 19 > JMP ->36
187 20 > FETCH_DIM_R ~17 !2, 0
21 FETCH_DIM_R ~20 !2, 1
22 FETCH_DIM_W $16 !0, 2
23 FETCH_DIM_W $18 $16, ~17
24 ASSIGN_DIM $18
25 OP_DATA ~20
188 26 > JMP ->36
190 27 > FETCH_DIM_R ~22 !2, 0
28 FETCH_DIM_R ~24 !2, 1
29 FETCH_DIM_R ~27 !2, 2
30 FETCH_DIM_W $21 !0, 3
31 FETCH_DIM_W $23 $21, ~22
32 FETCH_DIM_W $25 $23, ~24
33 ASSIGN_DIM $25
34 OP_DATA ~27
191 35 > JMP ->36
36 > FREE ~13
181 37 > JMP ->7
38 > FE_FREE $10
194 39 ROPE_INIT 3 ~31 '%5B'
40 FETCH_DIM_R ~29 !0, 1
41 ROPE_ADD 1 ~31 ~31, ~29
42 ROPE_END 2 ~30 ~31, '%5D%5Cd%7B6%7D'
43 ASSIGN_DIM !0, 1
44 OP_DATA ~30
196 45 FETCH_DIM_W $33 !0, 2
46 > FE_RESET_RW $34 $33, ->68
47 > > FE_FETCH_RW ~35 $34, !3, ->68
48 > ASSIGN !4, ~35
197 49 COUNT ~37 !3
50 IS_IDENTICAL ~37, 1
51 > JMPZ ~38, ->57
198 52 > NOP
53 FETCH_DIM_R ~39 !3, 0
54 FAST_CONCAT ~40 !4, ~39
55 QM_ASSIGN ~41 ~40
56 > JMP ->66
199 57 > INIT_FCALL 'sprintf'
58 SEND_VAL '%25s%5B%25s%5D'
59 SEND_VAR !4
60 INIT_FCALL 'implode'
61 SEND_VAR !3
62 DO_ICALL $42
63 SEND_VAR $42
64 DO_ICALL $43
65 QM_ASSIGN ~41 $43
197 66 > ASSIGN !3, ~41
196 67 > JMP ->47
68 > FE_FREE $34
201 69 INIT_FCALL 'implode'
70 SEND_VAL '%7C'
71 FETCH_DIM_R ~46 !0, 2
72 SEND_VAL ~46
73 DO_ICALL $47
74 CONCAT ~48 '%28%3F%3A', $47
75 CONCAT ~49 ~48, '%29%5Cd%7B5%7D'
76 ASSIGN_DIM !0, 2
77 OP_DATA ~49
203 78 FETCH_DIM_W $50 !0, 3
79 > FE_RESET_RW $51 $50, ->124
80 > > FE_FETCH_RW ~52 $51, !3, ->124
81 > ASSIGN !4, ~52
204 82 > FE_RESET_RW $54 !3, ->104
83 > > FE_FETCH_RW ~55 $54, !5, ->104
84 > ASSIGN !6, ~55
205 85 COUNT ~57 !5
86 IS_IDENTICAL ~57, 1
87 > JMPZ ~58, ->93
206 88 > NOP
89 FETCH_DIM_R ~59 !5, 0
90 FAST_CONCAT ~60 !6, ~59
91 QM_ASSIGN ~61 ~60
92 > JMP ->102
207 93 > INIT_FCALL 'sprintf'
94 SEND_VAL '%25s%5B%25s%5D'
95 SEND_VAR !6
96 INIT_FCALL 'implode'
97 SEND_VAR !5
98 DO_ICALL $62
99 SEND_VAR $62
100 DO_ICALL $63
101 QM_ASSIGN ~61 $63
205 102 > ASSIGN !5, ~61
204 103 > JMP ->83
104 > FE_FREE $54
209 105 COUNT ~65 !3
106 IS_IDENTICAL ~65, 1
107 > JMPZ ~66, ->112
210 108 > NOP
109 FAST_CONCAT ~67 !4, !5
110 QM_ASSIGN ~68 ~67
111 > JMP ->122
211 112 > INIT_FCALL 'sprintf'
113 SEND_VAL '%25s%28%3F%3A%25s%29'
114 SEND_VAR !4
115 INIT_FCALL 'implode'
116 SEND_VAL '%7C'
117 SEND_VAR !3
118 DO_ICALL $69
119 SEND_VAR $69
120 DO_ICALL $70
121 QM_ASSIGN ~68 $70
209 122 > ASSIGN !3, ~68
203 123 > JMP ->80
124 > FE_FREE $51
213 125 INIT_FCALL 'implode'
126 SEND_VAL '%7C'
127 FETCH_DIM_R ~73 !0, 3
128 SEND_VAL ~73
129 DO_ICALL $74
130 CONCAT ~75 '%28%3F%3A', $74
131 CONCAT ~76 ~75, '%29%5Cd%7B4%7D'
132 ASSIGN_DIM !0, 3
133 OP_DATA ~76
215 134 INIT_FCALL 'ksort'
135 SEND_REF !0
136 DO_ICALL
216 137 INIT_FCALL 'implode'
138 SEND_VAL '%0A%7C'
139 SEND_VAR !0
140 DO_ICALL $78
141 ECHO $78
142 > RETURN 1
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
138.9 ms | 1014 KiB | 17 Q