Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
/* Generated from polish.sbl by Snowball 3.0.0 - https://snowballstem.org/ */
 
#include "stem_UTF_8_polish.h"
 
#include <stddef.h>
 
#include "snowball_runtime.h"
 
struct SN_local {
    struct SN_env z;
    int i_p1;
};
 
typedef struct SN_local SN_local;
 
#ifdef __cplusplus
extern "C" {
#endif
extern int polish_UTF_8_stem(struct SN_env * z);
#ifdef __cplusplus
}
#endif
 
static int r_R1(struct SN_env * z);
static int r_normalize_consonant(struct SN_env * z);
static int r_remove_endings(struct SN_env * z);
static int r_mark_regions(struct SN_env * z);
 
static const symbol s_0[] = { 's' };
static const symbol s_1[] = { 's' };
static const symbol s_2[] = { 0xC5, 0x82 };
static const symbol s_3[] = { 's' };
static const symbol s_4[] = { 'c' };
static const symbol s_5[] = { 'n' };
static const symbol s_6[] = { 's' };
static const symbol s_7[] = { 'z' };
 
static const symbol s_0_0[7] = { 'b', 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_0_1[3] = { 'b', 'y', 'm' };
static const symbol s_0_2[2] = { 'b', 'y' };
static const symbol s_0_3[6] = { 'b', 'y', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_0_4[4] = { 'b', 'y', 0xC5, 0x9B };
static const struct among a_0[5] = {
{ 7, s_0_0, 0, 1, 0},
{ 3, s_0_1, 0, 1, 0},
{ 2, s_0_2, 0, 1, 0},
{ 6, s_0_3, 0, 1, 0},
{ 4, s_0_4, 0, 1, 0}
};
 
static const symbol s_1_0[3] = { 0xC4, 0x85, 'c' };
static const symbol s_1_1[5] = { 'a', 'j', 0xC4, 0x85, 'c' };
static const symbol s_1_2[5] = { 's', 'z', 0xC4, 0x85, 'c' };
static const symbol s_1_3[2] = { 's', 'z' };
static const symbol s_1_4[5] = { 'i', 'e', 'j', 's', 'z' };
static const struct among a_1[5] = {
{ 3, s_1_0, 0, 1, 0},
{ 5, s_1_1, -1, 1, 0},
{ 5, s_1_2, -2, 2, 0},
{ 2, s_1_3, 0, 1, 0},
{ 5, s_1_4, -1, 1, 0}
};
 
static const symbol s_2_0[1] = { 'a' };
static const symbol s_2_1[4] = { 0xC4, 0x85, 'c', 'a' };
static const symbol s_2_2[6] = { 'a', 'j', 0xC4, 0x85, 'c', 'a' };
static const symbol s_2_3[6] = { 's', 'z', 0xC4, 0x85, 'c', 'a' };
static const symbol s_2_4[2] = { 'i', 'a' };
static const symbol s_2_5[3] = { 's', 'z', 'a' };
static const symbol s_2_6[6] = { 'i', 'e', 'j', 's', 'z', 'a' };
static const symbol s_2_7[4] = { 'a', 0xC5, 0x82, 'a' };
static const symbol s_2_8[5] = { 'i', 'a', 0xC5, 0x82, 'a' };
static const symbol s_2_9[4] = { 'i', 0xC5, 0x82, 'a' };
static const symbol s_2_10[3] = { 0xC4, 0x85, 'c' };
static const symbol s_2_11[5] = { 'a', 'j', 0xC4, 0x85, 'c' };
static const symbol s_2_12[1] = { 'e' };
static const symbol s_2_13[4] = { 0xC4, 0x85, 'c', 'e' };
static const symbol s_2_14[6] = { 'a', 'j', 0xC4, 0x85, 'c', 'e' };
static const symbol s_2_15[6] = { 's', 'z', 0xC4, 0x85, 'c', 'e' };
static const symbol s_2_16[2] = { 'i', 'e' };
static const symbol s_2_17[3] = { 'c', 'i', 'e' };
static const symbol s_2_18[4] = { 'a', 'c', 'i', 'e' };
static const symbol s_2_19[4] = { 'e', 'c', 'i', 'e' };
static const symbol s_2_20[4] = { 'i', 'c', 'i', 'e' };
static const symbol s_2_21[5] = { 'a', 'j', 'c', 'i', 'e' };
static const symbol s_2_22[7] = { 'l', 'i', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_2_23[8] = { 'a', 'l', 'i', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_2_24[9] = { 'i', 'e', 'l', 'i', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_2_25[8] = { 'i', 'l', 'i', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_2_26[8] = { 0xC5, 0x82, 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_2_27[9] = { 'a', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_2_28[10] = { 'i', 'a', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_2_29[9] = { 'i', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'c', 'i', 'e' };
static const symbol s_2_30[3] = { 's', 'z', 'e' };
static const symbol s_2_31[6] = { 'i', 'e', 'j', 's', 'z', 'e' };
static const symbol s_2_32[3] = { 'a', 'c', 'h' };
static const symbol s_2_33[4] = { 'i', 'a', 'c', 'h' };
static const symbol s_2_34[3] = { 'i', 'c', 'h' };
static const symbol s_2_35[3] = { 'y', 'c', 'h' };
static const symbol s_2_36[1] = { 'i' };
static const symbol s_2_37[3] = { 'a', 'l', 'i' };
static const symbol s_2_38[4] = { 'i', 'e', 'l', 'i' };
static const symbol s_2_39[3] = { 'i', 'l', 'i' };
static const symbol s_2_40[3] = { 'a', 'm', 'i' };
static const symbol s_2_41[4] = { 'i', 'a', 'm', 'i' };
static const symbol s_2_42[3] = { 'i', 'm', 'i' };
static const symbol s_2_43[3] = { 'y', 'm', 'i' };
static const symbol s_2_44[3] = { 'o', 'w', 'i' };
static const symbol s_2_45[4] = { 'i', 'o', 'w', 'i' };
static const symbol s_2_46[2] = { 'a', 'j' };
static const symbol s_2_47[2] = { 'e', 'j' };
static const symbol s_2_48[3] = { 'i', 'e', 'j' };
static const symbol s_2_49[2] = { 'a', 'm' };
static const symbol s_2_50[5] = { 'a', 0xC5, 0x82, 'a', 'm' };
static const symbol s_2_51[6] = { 'i', 'a', 0xC5, 0x82, 'a', 'm' };
static const symbol s_2_52[5] = { 'i', 0xC5, 0x82, 'a', 'm' };
static const symbol s_2_53[2] = { 'e', 'm' };
static const symbol s_2_54[3] = { 'i', 'e', 'm' };
static const symbol s_2_55[5] = { 'a', 0xC5, 0x82, 'e', 'm' };
static const symbol s_2_56[6] = { 'i', 'a', 0xC5, 0x82, 'e', 'm' };
static const symbol s_2_57[5] = { 'i', 0xC5, 0x82, 'e', 'm' };
static const symbol s_2_58[2] = { 'i', 'm' };
static const symbol s_2_59[2] = { 'o', 'm' };
static const symbol s_2_60[3] = { 'i', 'o', 'm' };
static const symbol s_2_61[2] = { 'y', 'm' };
static const symbol s_2_62[1] = { 'o' };
static const symbol s_2_63[3] = { 'e', 'g', 'o' };
static const symbol s_2_64[4] = { 'i', 'e', 'g', 'o' };
static const symbol s_2_65[4] = { 'a', 0xC5, 0x82, 'o' };
static const symbol s_2_66[5] = { 'i', 'a', 0xC5, 0x82, 'o' };
static const symbol s_2_67[4] = { 'i', 0xC5, 0x82, 'o' };
static const symbol s_2_68[1] = { 'u' };
static const symbol s_2_69[2] = { 'i', 'u' };
static const symbol s_2_70[3] = { 'e', 'm', 'u' };
static const symbol s_2_71[4] = { 'i', 'e', 'm', 'u' };
static const symbol s_2_72[3] = { 0xC3, 0xB3, 'w' };
static const symbol s_2_73[1] = { 'y' };
static const symbol s_2_74[3] = { 'a', 'm', 'y' };
static const symbol s_2_75[3] = { 'e', 'm', 'y' };
static const symbol s_2_76[3] = { 'i', 'm', 'y' };
static const symbol s_2_77[6] = { 'l', 'i', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_2_78[7] = { 'a', 'l', 'i', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_2_79[8] = { 'i', 'e', 'l', 'i', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_2_80[7] = { 'i', 'l', 'i', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_2_81[7] = { 0xC5, 0x82, 'y', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_2_82[8] = { 'a', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_2_83[9] = { 'i', 'a', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_2_84[8] = { 'i', 0xC5, 0x82, 'y', 0xC5, 0x9B, 'm', 'y' };
static const symbol s_2_85[4] = { 'a', 0xC5, 0x82, 'y' };
static const symbol s_2_86[5] = { 'i', 'a', 0xC5, 0x82, 'y' };
static const symbol s_2_87[4] = { 'i', 0xC5, 0x82, 'y' };
static const symbol s_2_88[3] = { 'a', 's', 'z' };
static const symbol s_2_89[3] = { 'e', 's', 'z' };
static const symbol s_2_90[3] = { 'i', 's', 'z' };
static const symbol s_2_91[3] = { 'a', 0xC5, 0x82 };
static const symbol s_2_92[4] = { 'i', 'a', 0xC5, 0x82 };
static const symbol s_2_93[3] = { 'i', 0xC5, 0x82 };
static const symbol s_2_94[2] = { 0xC4, 0x85 };
static const symbol s_2_95[5] = { 0xC4, 0x85, 'c', 0xC4, 0x85 };
static const symbol s_2_96[7] = { 'a', 'j', 0xC4, 0x85, 'c', 0xC4, 0x85 };
static const symbol s_2_97[7] = { 's', 'z', 0xC4, 0x85, 'c', 0xC4, 0x85 };
static const symbol s_2_98[3] = { 'i', 0xC4, 0x85 };
static const symbol s_2_99[4] = { 'a', 'j', 0xC4, 0x85 };
static const symbol s_2_100[4] = { 's', 'z', 0xC4, 0x85 };
static const symbol s_2_101[7] = { 'i', 'e', 'j', 's', 'z', 0xC4, 0x85 };
static const symbol s_2_102[3] = { 'a', 0xC4, 0x87 };
static const symbol s_2_103[4] = { 'i', 'e', 0xC4, 0x87 };
static const symbol s_2_104[3] = { 'i', 0xC4, 0x87 };
static const symbol s_2_105[4] = { 0xC4, 0x85, 0xC4, 0x87 };
static const symbol s_2_106[5] = { 'a', 0xC5, 0x9B, 0xC4, 0x87 };
static const symbol s_2_107[5] = { 'e', 0xC5, 0x9B, 0xC4, 0x87 };
static const symbol s_2_108[2] = { 0xC4, 0x99 };
static const symbol s_2_109[4] = { 's', 'z', 0xC4, 0x99 };
static const symbol s_2_110[5] = { 0xC5, 0x82, 'a', 0xC5, 0x9B };
static const symbol s_2_111[6] = { 'a', 0xC5, 0x82, 'a', 0xC5, 0x9B };
static const symbol s_2_112[7] = { 'i', 'a', 0xC5, 0x82, 'a', 0xC5, 0x9B };
static const symbol s_2_113[6] = { 'i', 0xC5, 0x82, 'a', 0xC5, 0x9B };
static const symbol s_2_114[5] = { 0xC5, 0x82, 'e', 0xC5, 0x9B };
static const symbol s_2_115[6] = { 'a', 0xC5, 0x82, 'e', 0xC5, 0x9B };
static const symbol s_2_116[7] = { 'i', 'a', 0xC5, 0x82, 'e', 0xC5, 0x9B };
static const symbol s_2_117[6] = { 'i', 0xC5, 0x82, 'e', 0xC5, 0x9B };
static const struct among a_2[118] = {
{ 1, s_2_0, 0, 1, 1},
{ 4, s_2_1, -1, 1, 0},
{ 6, s_2_2, -1, 1, 0},
{ 6, s_2_3, -2, 2, 0},
{ 2, s_2_4, -4, 1, 1},
{ 3, s_2_5, -5, 1, 0},
{ 6, s_2_6, -1, 1, 0},
{ 4, s_2_7, -7, 1, 0},
{ 5, s_2_8, -1, 1, 0},
{ 4, s_2_9, -9, 1, 0},
{ 3, s_2_10, 0, 1, 0},
{ 5, s_2_11, -1, 1, 0},
{ 1, s_2_12, 0, 1, 1},
{ 4, s_2_13, -1, 1, 0},
{ 6, s_2_14, -1, 1, 0},
{ 6, s_2_15, -2, 2, 0},
{ 2, s_2_16, -4, 1, 1},
{ 3, s_2_17, -1, 1, 0},
{ 4, s_2_18, -1, 1, 0},
{ 4, s_2_19, -2, 1, 0},
{ 4, s_2_20, -3, 1, 0},
{ 5, s_2_21, -4, 1, 0},
{ 7, s_2_22, -5, 4, 0},
{ 8, s_2_23, -1, 1, 0},
{ 9, s_2_24, -2, 1, 0},
{ 8, s_2_25, -3, 1, 0},
{ 8, s_2_26, -9, 4, 0},
{ 9, s_2_27, -1, 1, 0},
{ 10, s_2_28, -1, 1, 0},
{ 9, s_2_29, -3, 1, 0},
{ 3, s_2_30, -18, 1, 0},
{ 6, s_2_31, -1, 1, 0},
{ 3, s_2_32, 0, 1, 1},
{ 4, s_2_33, -1, 1, 1},
{ 3, s_2_34, 0, 5, 0},
{ 3, s_2_35, 0, 5, 0},
{ 1, s_2_36, 0, 1, 1},
{ 3, s_2_37, -1, 1, 0},
{ 4, s_2_38, -2, 1, 0},
{ 3, s_2_39, -3, 1, 0},
{ 3, s_2_40, -4, 1, 1},
{ 4, s_2_41, -1, 1, 1},
{ 3, s_2_42, -6, 5, 0},
{ 3, s_2_43, -7, 5, 0},
{ 3, s_2_44, -8, 1, 1},
{ 4, s_2_45, -1, 1, 1},
{ 2, s_2_46, 0, 1, 0},
{ 2, s_2_47, 0, 5, 0},
{ 3, s_2_48, -1, 5, 0},
{ 2, s_2_49, 0, 1, 0},
{ 5, s_2_50, -1, 1, 0},
{ 6, s_2_51, -1, 1, 0},
{ 5, s_2_52, -3, 1, 0},
{ 2, s_2_53, 0, 1, 1},
{ 3, s_2_54, -1, 1, 1},
{ 5, s_2_55, -2, 1, 0},
{ 6, s_2_56, -1, 1, 0},
{ 5, s_2_57, -4, 1, 0},
{ 2, s_2_58, 0, 5, 0},
{ 2, s_2_59, 0, 1, 1},
{ 3, s_2_60, -1, 1, 1},
{ 2, s_2_61, 0, 5, 0},
{ 1, s_2_62, 0, 1, 1},
{ 3, s_2_63, -1, 5, 0},
{ 4, s_2_64, -1, 5, 0},
{ 4, s_2_65, -3, 1, 0},
{ 5, s_2_66, -1, 1, 0},
{ 4, s_2_67, -5, 1, 0},
{ 1, s_2_68, 0, 1, 1},
{ 2, s_2_69, -1, 1, 1},
{ 3, s_2_70, -2, 5, 0},
{ 4, s_2_71, -1, 5, 0},
{ 3, s_2_72, 0, 1, 1},
{ 1, s_2_73, 0, 5, 0},
{ 3, s_2_74, -1, 1, 0},
{ 3, s_2_75, -2, 1, 0},
{ 3, s_2_76, -3, 1, 0},
{ 6, s_2_77, -4, 4, 0},
{ 7, s_2_78, -1, 1, 0},
{ 8, s_2_79, -2, 1, 0},
{ 7, s_2_80, -3, 1, 0},
{ 7, s_2_81, -8, 4, 0},
{ 8, s_2_82, -1, 1, 0},
{ 9, s_2_83, -1, 1, 0},
{ 8, s_2_84, -3, 1, 0},
{ 4, s_2_85, -12, 1, 0},
{ 5, s_2_86, -1, 1, 0},
{ 4, s_2_87, -14, 1, 0},
{ 3, s_2_88, 0, 1, 0},
{ 3, s_2_89, 0, 1, 0},
{ 3, s_2_90, 0, 1, 0},
{ 3, s_2_91, 0, 1, 0},
{ 4, s_2_92, -1, 1, 0},
{ 3, s_2_93, 0, 1, 0},
{ 2, s_2_94, 0, 1, 1},
{ 5, s_2_95, -1, 1, 0},
{ 7, s_2_96, -1, 1, 0},
{ 7, s_2_97, -2, 2, 0},
{ 3, s_2_98, -4, 1, 1},
{ 4, s_2_99, -5, 1, 0},
{ 4, s_2_100, -6, 3, 0},
{ 7, s_2_101, -1, 1, 0},
{ 3, s_2_102, 0, 1, 0},
{ 4, s_2_103, 0, 1, 0},
{ 3, s_2_104, 0, 1, 0},
{ 4, s_2_105, 0, 1, 0},
{ 5, s_2_106, 0, 1, 0},
{ 5, s_2_107, 0, 1, 0},
{ 2, s_2_108, 0, 1, 0},
{ 4, s_2_109, -1, 2, 0},
{ 5, s_2_110, 0, 4, 0},
{ 6, s_2_111, -1, 1, 0},
{ 7, s_2_112, -1, 1, 0},
{ 6, s_2_113, -3, 1, 0},
{ 5, s_2_114, 0, 4, 0},
{ 6, s_2_115, -1, 1, 0},
{ 7, s_2_116, -1, 1, 0},
{ 6, s_2_117, -3, 1, 0}
};
 
static const symbol s_3_0[2] = { 0xC5, 0x84 };
static const symbol s_3_1[2] = { 0xC4, 0x87 };
static const symbol s_3_2[2] = { 0xC5, 0x9B };
static const symbol s_3_3[2] = { 0xC5, 0xBA };
static const struct among a_3[4] = {
{ 2, s_3_0, 0, 2, 0},
{ 2, s_3_1, 0, 1, 0},
{ 2, s_3_2, 0, 3, 0},
{ 2, s_3_3, 0, 4, 0}
};
 
static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 16, 0, 0, 1 };
 
static int r_mark_regions(struct SN_env * z) {
    ((SN_local *)z)->i_p1 = z->l;
    {
        int ret = out_grouping_U(z, g_v, 97, 281, 1);
        if (ret < 0) return 0;
        z->c += ret;
    }
    {
        int ret = in_grouping_U(z, g_v, 97, 281, 1);
        if (ret < 0) return 0;
        z->c += ret;
    }
    ((SN_local *)z)->i_p1 = z->c;
    return 1;
}
 
static int r_R1(struct SN_env * z) {
    return ((SN_local *)z)->i_p1 <= z->c;
}
 
static int r_remove_endings(struct SN_env * z) {
    int among_var;
    {
        int v_1 = z->l - z->c;
        {
            int v_2;
            if (z->c < ((SN_local *)z)->i_p1) goto lab0;
            v_2 = z->lb; z->lb = ((SN_local *)z)->i_p1;
            z->ket = z->c;
            if (!find_among_b(z, a_0, 5, 0)) { z->lb = v_2; goto lab0; }
            z->bra = z->c;
            z->lb = v_2;
        }
        {
            int ret = slice_del(z);
            if (ret < 0) return ret;
        }
    lab0:
        z->c = z->l - v_1;
    }
    z->ket = z->c;
    among_var = find_among_b(z, a_2, 118, r_R1);
    if (!among_var) return 0;
    z->bra = z->c;
    switch (among_var) {
        case 1:
            {
                int ret = slice_del(z);
                if (ret < 0) return ret;
            }
            break;
        case 2:
            {
                int ret = slice_from_s(z, 1, s_0);
                if (ret < 0) return ret;
            }
            break;
        case 3:
            do {
                int v_3 = z->l - z->c;
                {
                    int v_4 = z->l - z->c;
                    {
                        int ret = r_R1(z);
                        if (ret == 0) goto lab1;
                        if (ret < 0) return ret;
                    }
                    z->c = z->l - v_4;
                    {
                        int ret = slice_del(z);
                        if (ret < 0) return ret;
                    }
                }
                break;
            lab1:
                z->c = z->l - v_3;
                {
                    int ret = slice_from_s(z, 1, s_1);
                    if (ret < 0) return ret;
                }
            } while (0);
            break;
        case 4:
            {
                int ret = slice_from_s(z, 2, s_2);
                if (ret < 0) return ret;
            }
            break;
        case 5:
            {
                int ret = slice_del(z);
                if (ret < 0) return ret;
            }
            {
                int v_5 = z->l - z->c;
                z->ket = z->c;
                if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 99 && z->p[z->c - 1] != 122)) { z->c = z->l - v_5; goto lab2; }
                among_var = find_among_b(z, a_1, 5, 0);
                if (!among_var) { z->c = z->l - v_5; goto lab2; }
                z->bra = z->c;
                switch (among_var) {
                    case 1:
                        {
                            int ret = slice_del(z);
                            if (ret < 0) return ret;
                        }
                        break;
                    case 2:
                        {
                            int ret = slice_from_s(z, 1, s_3);
                            if (ret < 0) return ret;
                        }
                        break;
                }
            lab2:
                ;
            }
            break;
    }
    return 1;
}
 
static int r_normalize_consonant(struct SN_env * z) {
    int among_var;
    z->ket = z->c;
    among_var = find_among_b(z, a_3, 4, 0);
    if (!among_var) return 0;
    z->bra = z->c;
    if (z->c > z->lb) goto lab0;
    return 0;
lab0:
    switch (among_var) {
        case 1:
            {
                int ret = slice_from_s(z, 1, s_4);
                if (ret < 0) return ret;
            }
            break;
        case 2:
            {
                int ret = slice_from_s(z, 1, s_5);
                if (ret < 0) return ret;
            }
            break;
        case 3:
            {
                int ret = slice_from_s(z, 1, s_6);
                if (ret < 0) return ret;
            }
            break;
        case 4:
            {
                int ret = slice_from_s(z, 1, s_7);
                if (ret < 0) return ret;
            }
            break;
    }
    return 1;
}
 
extern int polish_UTF_8_stem(struct SN_env * z) {
    {
        int v_1 = z->c;
        {
            int ret = r_mark_regions(z);
            if (ret < 0) return ret;
        }
        z->c = v_1;
    }
    do {
        int v_2 = z->c;
        {
            int ret = skip_utf8(z->p, z->c, z->l, 2);
            if (ret < 0) goto lab0;
            z->c = ret;
        }
        z->lb = z->c; z->c = z->l;
        {
            int ret = r_remove_endings(z);
            if (ret == 0) goto lab0;
            if (ret < 0) return ret;
        }
        z->c = z->lb;
        break;
    lab0:
        z->c = v_2;
        z->lb = z->c; z->c = z->l;
        {
            int ret = r_normalize_consonant(z);
            if (ret <= 0) return ret;
        }
        z->c = z->lb;
    } while (0);
    return 1;
}
 
extern struct SN_env * polish_UTF_8_create_env(void) {
    struct SN_env * z = SN_new_env(sizeof(SN_local));
    if (z) {
        ((SN_local *)z)->i_p1 = 0;
    }
    return z;
}
 
extern void polish_UTF_8_close_env(struct SN_env * z) {
    SN_delete_env(z);
}