File: gunzip_mod.e

package info (click to toggle)
m68k-vme-tftplilo 1.1.3-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 412 kB
  • ctags: 705
  • sloc: ansic: 5,856; asm: 2,821; makefile: 81
file content (2060 lines) | stat: -rw-r--r-- 39,172 bytes parent folder | download
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
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
# 1 "gunzip_mod.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "gunzip_mod.c"
# 13 "gunzip_mod.c"
# 1 "defs.h" 1
# 10 "defs.h"
# 1 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/stdarg.h" 1 3 4
# 43 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 105 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 11 "defs.h" 2


# 1 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/linux/a.out.h" 1 3 4
# 17 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/linux/a.out.h" 3 4
# 1 "/usr/include/asm/a.out.h" 1 3 4



struct exec
{
  unsigned long a_info;
  unsigned a_text;
  unsigned a_data;
  unsigned a_bss;
  unsigned a_syms;
  unsigned a_entry;
  unsigned a_trsize;
  unsigned a_drsize;
};
# 18 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/linux/a.out.h" 2 3 4




enum machine_type {



  M_OLDSUN2 = 0,




  M_68010 = 1,




  M_68020 = 2,




  M_SPARC = 3,


  M_386 = 100,
  M_MIPS1 = 151,
  M_MIPS2 = 152
};
# 140 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/linux/a.out.h" 3 4
# 1 "/usr/include/asm/page.h" 1 3 4



# 1 "/usr/include/linux/config.h" 1 3 4



# 1 "/usr/include/linux/autoconf.h" 1 3 4
# 5 "/usr/include/linux/config.h" 2 3 4
# 5 "/usr/include/asm/page.h" 2 3 4
# 141 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/linux/a.out.h" 2 3 4
# 166 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/linux/a.out.h" 3 4
struct nlist {
  union {
    char *n_name;
    struct nlist *n_next;
    long n_strx;
  } n_un;
  unsigned char n_type;
  char n_other;
  short n_desc;
  unsigned long n_value;
};
# 244 "/usr/lib/gcc-lib/m68k-linux/3.3.2/include/linux/a.out.h" 3 4
struct relocation_info
{

  int r_address;

  unsigned int r_symbolnum:24;



  unsigned int r_pcrel:1;


  unsigned int r_length:2;






  unsigned int r_extern:1;







  unsigned int r_pad:4;

};
# 14 "defs.h" 2
# 1 "/usr/include/linux/elf.h" 1 3 4



# 1 "/usr/include/linux/types.h" 1 3 4
# 15 "/usr/include/linux/types.h" 3 4
# 1 "/usr/include/linux/posix_types.h" 1 3 4



# 1 "/usr/include/linux/stddef.h" 1 3 4
# 5 "/usr/include/linux/posix_types.h" 2 3 4
# 36 "/usr/include/linux/posix_types.h" 3 4
typedef struct {
        unsigned long fds_bits [(1024/(8 * sizeof(unsigned long)))];
} __kernel_fd_set;


typedef void (*__kernel_sighandler_t)(int);


typedef int __kernel_key_t;

# 1 "/usr/include/asm/posix_types.h" 1 3 4
# 10 "/usr/include/asm/posix_types.h" 3 4
typedef unsigned short __kernel_dev_t;
typedef unsigned long __kernel_ino_t;
typedef unsigned short __kernel_mode_t;
typedef unsigned short __kernel_nlink_t;
typedef long __kernel_off_t;
typedef int __kernel_pid_t;
typedef unsigned short __kernel_ipc_pid_t;
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
typedef long __kernel_suseconds_t;
typedef long __kernel_clock_t;
typedef int __kernel_daddr_t;
typedef char * __kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
typedef unsigned int __kernel_uid32_t;
typedef unsigned int __kernel_gid32_t;

typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;


typedef long long __kernel_loff_t;


typedef struct {



        int __val[2];

} __kernel_fsid_t;
# 47 "/usr/include/linux/posix_types.h" 2 3 4
# 16 "/usr/include/linux/types.h" 2 3 4
# 1 "/usr/include/asm/types.h" 1 3 4
# 12 "/usr/include/asm/types.h" 3 4
typedef unsigned short umode_t;






typedef __signed__ char __s8;
typedef unsigned char __u8;

typedef __signed__ short __s16;
typedef unsigned short __u16;

typedef __signed__ int __s32;
typedef unsigned int __u32;


typedef __signed__ long long __s64;
typedef unsigned long long __u64;
# 17 "/usr/include/linux/types.h" 2 3 4



typedef __kernel_fd_set fd_set;
typedef __kernel_dev_t dev_t;
typedef __kernel_ino_t ino_t;
typedef __kernel_mode_t mode_t;
typedef __kernel_nlink_t nlink_t;
typedef __kernel_off_t off_t;
typedef __kernel_pid_t pid_t;
typedef __kernel_daddr_t daddr_t;
typedef __kernel_key_t key_t;
typedef __kernel_suseconds_t suseconds_t;
# 47 "/usr/include/linux/types.h" 3 4
typedef __kernel_uid_t uid_t;
typedef __kernel_gid_t gid_t;



typedef __kernel_loff_t loff_t;
# 61 "/usr/include/linux/types.h" 3 4
typedef __kernel_size_t size_t;




typedef __kernel_ssize_t ssize_t;




typedef __kernel_ptrdiff_t ptrdiff_t;




typedef __kernel_time_t time_t;




typedef __kernel_clock_t clock_t;




typedef __kernel_caddr_t caddr_t;



typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;


typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;




typedef __u8 u_int8_t;
typedef __s8 int8_t;
typedef __u16 u_int16_t;
typedef __s16 int16_t;
typedef __u32 u_int32_t;
typedef __s32 int32_t;



typedef __u8 uint8_t;
typedef __u16 uint16_t;
typedef __u32 uint32_t;


typedef __u64 uint64_t;
typedef __u64 u_int64_t;
typedef __s64 int64_t;
# 130 "/usr/include/linux/types.h" 3 4
struct ustat {
        __kernel_daddr_t f_tfree;
        __kernel_ino_t f_tinode;
        char f_fname[6];
        char f_fpack[6];
};
# 5 "/usr/include/linux/elf.h" 2 3 4
# 1 "/usr/include/asm/elf.h" 1 3 4
# 9 "/usr/include/asm/elf.h" 3 4
# 1 "/usr/include/asm/ptrace.h" 1 3 4
# 29 "/usr/include/asm/ptrace.h" 3 4
struct pt_regs {
  long d1;
  long d2;
  long d3;
  long d4;
  long d5;
  long a0;
  long a1;
  long a2;
  long d0;
  long orig_d0;
  long stkadj;
  unsigned short sr;
  unsigned long pc;
  unsigned format : 4;
  unsigned vector : 12;
};





struct switch_stack {
        unsigned long d6;
        unsigned long d7;
        unsigned long a3;
        unsigned long a4;
        unsigned long a5;
        unsigned long a6;
        unsigned long retpc;
};
# 10 "/usr/include/asm/elf.h" 2 3 4
# 1 "/usr/include/asm/user.h" 1 3 4
# 33 "/usr/include/asm/user.h" 3 4
struct user_m68kfp_struct {
        unsigned long fpregs[8*3];
        unsigned long fpcntl[3];
};




struct user_regs_struct {
        long d1,d2,d3,d4,d5,d6,d7;
        long a0,a1,a2,a3,a4,a5,a6;
        long d0;
        long usp;
        long orig_d0;
        short stkadj;
        short sr;
        long pc;
        short fmtvec;
        short __fill;
};





struct user{


  struct user_regs_struct regs;

  int u_fpvalid;

  struct user_m68kfp_struct m68kfp;

  unsigned long int u_tsize;
  unsigned long int u_dsize;
  unsigned long int u_ssize;
  unsigned long start_code;
  unsigned long start_stack;



  long int signal;
  int reserved;
  struct user_regs_struct *u_ar0;


  struct user_m68kfp_struct* u_fpstate;
  unsigned long magic;
  char u_comm[32];
};
# 11 "/usr/include/asm/elf.h" 2 3 4

typedef unsigned long elf_greg_t;


typedef elf_greg_t elf_gregset_t[(sizeof(struct user_regs_struct) / sizeof(elf_greg_t))];

typedef struct user_m68kfp_struct elf_fpregset_t;
# 6 "/usr/include/linux/elf.h" 2 3 4


typedef __u32 Elf32_Addr;
typedef __u16 Elf32_Half;
typedef __u32 Elf32_Off;
typedef __s32 Elf32_Sword;
typedef __u32 Elf32_Word;


typedef __u64 Elf64_Addr;
typedef __u16 Elf64_Half;
typedef __s16 Elf64_SHalf;
typedef __u64 Elf64_Off;
typedef __s32 Elf64_Sword;
typedef __u32 Elf64_Word;
typedef __u64 Elf64_Xword;
typedef __s64 Elf64_Sxword;
# 177 "/usr/include/linux/elf.h" 3 4
typedef struct dynamic{
  Elf32_Sword d_tag;
  union{
    Elf32_Sword d_val;
    Elf32_Addr d_ptr;
  } d_un;
} Elf32_Dyn;

typedef struct {
  Elf64_Sxword d_tag;
  union {
    Elf64_Xword d_val;
    Elf64_Addr d_ptr;
  } d_un;
} Elf64_Dyn;
# 373 "/usr/include/linux/elf.h" 3 4
typedef struct elf32_rel {
  Elf32_Addr r_offset;
  Elf32_Word r_info;
} Elf32_Rel;

typedef struct elf64_rel {
  Elf64_Addr r_offset;
  Elf64_Xword r_info;
} Elf64_Rel;

typedef struct elf32_rela{
  Elf32_Addr r_offset;
  Elf32_Word r_info;
  Elf32_Sword r_addend;
} Elf32_Rela;

typedef struct elf64_rela {
  Elf64_Addr r_offset;
  Elf64_Xword r_info;
  Elf64_Sxword r_addend;
} Elf64_Rela;

typedef struct elf32_sym{
  Elf32_Word st_name;
  Elf32_Addr st_value;
  Elf32_Word st_size;
  unsigned char st_info;
  unsigned char st_other;
  Elf32_Half st_shndx;
} Elf32_Sym;

typedef struct elf64_sym {
  Elf64_Word st_name;
  unsigned char st_info;
  unsigned char st_other;
  Elf64_Half st_shndx;
  Elf64_Addr st_value;
  Elf64_Xword st_size;
} Elf64_Sym;




typedef struct elf32_hdr{
  unsigned char e_ident[16];
  Elf32_Half e_type;
  Elf32_Half e_machine;
  Elf32_Word e_version;
  Elf32_Addr e_entry;
  Elf32_Off e_phoff;
  Elf32_Off e_shoff;
  Elf32_Word e_flags;
  Elf32_Half e_ehsize;
  Elf32_Half e_phentsize;
  Elf32_Half e_phnum;
  Elf32_Half e_shentsize;
  Elf32_Half e_shnum;
  Elf32_Half e_shstrndx;
} Elf32_Ehdr;

typedef struct elf64_hdr {
  unsigned char e_ident[16];
  Elf64_Half e_type;
  Elf64_Half e_machine;
  Elf64_Word e_version;
  Elf64_Addr e_entry;
  Elf64_Off e_phoff;
  Elf64_Off e_shoff;
  Elf64_Word e_flags;
  Elf64_Half e_ehsize;
  Elf64_Half e_phentsize;
  Elf64_Half e_phnum;
  Elf64_Half e_shentsize;
  Elf64_Half e_shnum;
  Elf64_Half e_shstrndx;
} Elf64_Ehdr;







typedef struct elf32_phdr{
  Elf32_Word p_type;
  Elf32_Off p_offset;
  Elf32_Addr p_vaddr;
  Elf32_Addr p_paddr;
  Elf32_Word p_filesz;
  Elf32_Word p_memsz;
  Elf32_Word p_flags;
  Elf32_Word p_align;
} Elf32_Phdr;

typedef struct elf64_phdr {
  Elf64_Word p_type;
  Elf64_Word p_flags;
  Elf64_Off p_offset;
  Elf64_Addr p_vaddr;
  Elf64_Addr p_paddr;
  Elf64_Xword p_filesz;
  Elf64_Xword p_memsz;
  Elf64_Xword p_align;
} Elf64_Phdr;
# 518 "/usr/include/linux/elf.h" 3 4
typedef struct {
  Elf32_Word sh_name;
  Elf32_Word sh_type;
  Elf32_Word sh_flags;
  Elf32_Addr sh_addr;
  Elf32_Off sh_offset;
  Elf32_Word sh_size;
  Elf32_Word sh_link;
  Elf32_Word sh_info;
  Elf32_Word sh_addralign;
  Elf32_Word sh_entsize;
} Elf32_Shdr;

typedef struct elf64_shdr {
  Elf64_Word sh_name;
  Elf64_Word sh_type;
  Elf64_Xword sh_flags;
  Elf64_Addr sh_addr;
  Elf64_Off sh_offset;
  Elf64_Xword sh_size;
  Elf64_Word sh_link;
  Elf64_Word sh_info;
  Elf64_Xword sh_addralign;
  Elf64_Xword sh_entsize;
} Elf64_Shdr;
# 581 "/usr/include/linux/elf.h" 3 4
typedef struct elf32_note {
  Elf32_Word n_namesz;
  Elf32_Word n_descsz;
  Elf32_Word n_type;
} Elf32_Nhdr;


typedef struct elf64_note {
  Elf64_Word n_namesz;
  Elf64_Word n_descsz;
  Elf64_Word n_type;
} Elf64_Nhdr;



extern Elf32_Dyn _DYNAMIC [];
# 15 "defs.h" 2
# 1 "/usr/include/linux/linkage.h" 1 3 4
# 16 "defs.h" 2


# 1 "version.h" 1
# 19 "defs.h" 2
# 1 "bootinfo.h" 1
# 27 "bootinfo.h"
struct bi_record {
    unsigned short tag;
    unsigned short size;
    unsigned long data[0];
};
# 90 "bootinfo.h"
struct bootversion {
    unsigned short branch;
    unsigned long magic;
    struct {
                unsigned long machtype;
                unsigned long version;
    } machversions[0];
};
# 170 "bootinfo.h"
struct mem_info {
        unsigned long addr;
        unsigned long size;
};
# 190 "bootinfo.h"
struct compat_mem_info {
    unsigned long addr;
    unsigned long size;
};
# 219 "bootinfo.h"
struct compat_bootinfo {
    unsigned long machtype;
    unsigned long cputype;
    struct compat_mem_info memory[4];
    int num_memory;
    unsigned long ramdisk_size;
    unsigned long ramdisk_addr;
    char command_line[(256)];
};
# 20 "defs.h" 2
# 1 "stream.h" 1
# 16 "stream.h"
typedef struct _module {

    char *name;
    long maxbuf;


    int (*open)( void *data, long size);
    long (*fillbuf)( void *buf );

    int (*skip)( long cnt );

    int (*close)( void );

    char *buf;
    char *bufp;
    long buf_cnt;
    long fpos;
    int eof;

    struct _module *down, *up;
} MODULE;






extern MODULE *currmod;



void stream_init( void );
void stream_push( MODULE *mod );
int sopen( void *data, long size);
long sread( void *buf, long cnt );
int sseek( long offset, int whence );
int sclose( void );
# 21 "defs.h" 2
# 52 "defs.h"
typedef enum {
        IP_CLIENT,
        IP_SERVER,
        IP_GATEWAY,
        IP_BROADCAST,
        IP_NETMASK

} IPTYPE;






extern char _tail;




typedef struct boot_tag {
        struct boot_tag *next;
        char *label;
        char *alias;
        char *description;
        char *kernel;
        char *ramdisk;
        char *cmdline;
        char *append;
        char *root;
        char *console;
        char read_only;
        char restricted;
        char calldbg;
        unsigned long memsize;

} BOOT;



typedef struct crate_tag {
        unsigned long timeout;
        unsigned long delay;
        int prompt;
        char *display;
        char *kernel;
        char *ramdisk;
        char *cmdline;
        char *append;
        char *root;
        char *console;
        char read_only;
        char restricted;
        char calldbg;
        unsigned long memsize;
        BOOT *boot_dflt;
        BOOT *boot_list;

} CRATE;





struct internal_bootinfo
{
        unsigned long machtype;
        unsigned long cputype;
        unsigned long fputype;
        unsigned long mmutype;
        int num_memory;
        struct mem_info memory[(4)];
        struct mem_info ramdisk;
        char command_line[(256)];
};





typedef struct {
        unsigned long d[8];
        void *a[7];

} CALLREGS;





extern MODULE memory_mod;
extern MODULE gunzip_mod;







extern void (*startcode_entry)(void);
extern char *config_data;
extern char *config_data_end;
extern char input_buffer[256];
extern unsigned long detected_mem_size;
extern int debug_mode;
extern int cpu_type;
extern int fpu_type;
extern CALLREGS callregs;
extern struct internal_bootinfo bi;


extern struct compat_bootinfo compat_bootinfo;



extern unsigned long bi_size;
extern union {
                        struct bi_record record;
                        unsigned char fake[(4096)];
                } bi_union;




int check_bootinfo_version (const char *memptr);
int add_bi_record (unsigned short tag,unsigned short size,const void *data);
int add_bi_string (unsigned short tag,const unsigned char *s);
int create_bootinfo (void);
int create_compat_bootinfo (void);
void start_kernel (unsigned long kernel_dest_addr,char *kernel_load_addr,unsigned long kernel_mem_size,unsigned long ramdisk_dest_addr,char *ramdisk_load_addr,unsigned long ramdisk_mem_size,int calldbg);
char * load_kernel (char *file_name,unsigned long mem_start,unsigned long *kernel_size,unsigned long bootinfo_size);
void boot_linux (BOOT *boot,const char *more,int autoboot);


void loader_init (CALLREGS *regs);
void put_char (const int c);
unsigned long get_time (void);
int get_char (unsigned long timeout);
const char * get_ip (IPTYPE type);
const char * config_filename (void);
int tftp_read (const char *filename,unsigned long count,void *buffer);
unsigned long get_compat_booti_version (void);
unsigned long get_booti_version (void);
unsigned long get_compat_machtype (void);
unsigned long get_machtype (void);
void print_model (void);
unsigned long get_vme_type (void);
int add_vme_bootinfo (void);


int keyword (const char *name);
char * goto_line (int line);
int print_display_section (const char *label);
int find_boot_section (const char *label);
int find_crate_section (const char *search);
int get_number (const char *p,unsigned long *result);
int get_bool (const char *text);
void config_error (int line,char *data);
int bool_config_error (int line,char *data,int willuse);
unsigned long number_config_error (int line,char *data,unsigned long willuse);
void ignore_option (int line,char *data);
void duplicate_option (int line,char *data);
BOOT * find_boot_config (BOOT *boot,char *bootname);
BOOT * add_boot (CRATE *crate,BOOT *boot);
void dump_crate (CRATE *crate);
BOOT * parse_boot (int line,CRATE *crate);
void build_boot_from_defaults (CRATE *crate);
void build_boot_list (CRATE *crate);
void parse_globals (CRATE *crate);
void parse_config (CRATE *crate);


int read_line (unsigned long timeout);
void list_records (CRATE *crate);
BOOT * get_boot_record (CRATE *crate,const char **more);
void start_loader (void);
void Main (CALLREGS *regs);


void mem_clear (void *mem,unsigned long count);
void mem_move (void *dest,const void *srce,unsigned long count);
int mem_cmp (void *mem1,void *mem2,unsigned long count);
void malloc_init (void *heap_base,unsigned long heap_size);
int free (void *memaddr);
void * do_malloc (unsigned long size,int high);
void * malloc (unsigned long size);
void * malloc_low (unsigned long size);
unsigned long maxfree (void);
void * move_up (void *memaddr,unsigned long memsize);
void * realloc (void *memaddr,unsigned long size);
unsigned long disable_icache (void);
unsigned long enable_icache (void);
void invalidate_icache (void);
void erase (int n);
int strlen (const char *s);
char * strcpy (char *d,const char *s);
void strcat (char *d,const char *s);
void strcatn (char *d,const char *s,unsigned long n);
void strncpy (char *d,const char *s,unsigned long n);
int vsoutput (void (*output)(const int),const char *fmt,va_list va);
int sprintf (char *buff,const char *fmt,...);
int printf (const char *fmt,...);
int put_estr (const char *str);
int put_str (const char *str);
void panic (const char *fmt,...);
void * xmalloc (int size);
char * skip_white (const char *p);
void trim_white (char *p);
char * despace (char *str);
int equal_strings (const char *s1,const char *s2);
char * extract (char *p1,char *p2,int len,int delim);
int prescan (char *data,int size);
int check_arch (char *text);
char * mkinet (unsigned long ip);
unsigned atou (const char **strp);
int compare_ip (const char *ipstr,const char *pattern);
void substip (char *dest,const char *srce,int maxlen);
char * tftp (char *filename,unsigned long *filesize);
int get_cpu_type (void);
int get_fpu_type (void);
int ram_probe (unsigned long where);


void stream_init(void);
void stream_push(MODULE *mod);
int sopen(void *data,long size);
long sread(void *buf,long cnt);
int sseek(long offset,int whence);
int sclose(void);
# 14 "gunzip_mod.c" 2
# 23 "gunzip_mod.c"
typedef unsigned char uch;
typedef unsigned short ush;
typedef unsigned long ulg;
# 39 "gunzip_mod.c"
static int gunzip_open( void *data, long count );
static long gunzip_fillbuf( void *buf );
static int gunzip_close( void );
static int call_gunzip( void );
static void gzip_mark( void **ptr );
static void gzip_release( void **ptr );
static int fill_inbuf( void );
static void flush_window( void );
static void error( char *x );



MODULE gunzip_mod = {
        "gunzip",
        (32*1024),
        gunzip_open,
        gunzip_fillbuf,
        ((void *)0),
        gunzip_close,
        ((void *)0), ((void *)0), 0, 0, 0, ((void *)0), ((void *)0)
};


static char *gunzip_stack;

static long gunzip_sp, gunzip_jumpback, main_sp, main_fp;




static uch *inbuf;
static uch *window;
static uch *previous_window;

static unsigned insize = 0;
static unsigned inptr = 0;
static unsigned outcnt = 0;
static int exit_code = 0;
static long bytes_out = 0;
static int made_crc_table = 0;
# 96 "gunzip_mod.c"
# 1 "inflate.c" 1
# 124 "inflate.c"
struct huft {
  uch e;
  uch b;
  union {
    ush n;
    struct huft *t;
  } v;
};



static int huft_build (unsigned *, unsigned, unsigned, ush *, ush *, struct huft **, int *);

static int huft_free (struct huft *);
static int inflate_codes (struct huft *, struct huft *, int, int);
static int inflate_stored (void);
static int inflate_fixed (void);
static int inflate_dynamic (void);
static int inflate_block (int *);
static int inflate (void);
# 159 "inflate.c"
static unsigned border[] = {
        16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
static ush cplens[] = {
        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};

static ush cplext[] = {
        0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
        3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99};
static ush cpdist[] = {
        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
        8193, 12289, 16385, 24577};
static ush cpdext[] = {
        0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
        7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
        12, 12, 13, 13};
# 209 "inflate.c"
static ulg bb;
static unsigned bk;

static ush mask_bits[] = {
    0x0000,
    0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
    0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
};
# 256 "inflate.c"
static int lbits = 9;
static int dbits = 6;







static unsigned hufts;


static int huft_build(b, n, s, d, e, t, m)
unsigned *b;
unsigned n;
unsigned s;
ush *d;
ush *e;
struct huft **t;
int *m;





{
  unsigned a;
  unsigned c[16 +1];
  unsigned f;
  int g;
  int h;
  register unsigned i;
  register unsigned j;
  register int k;
  int l;
  register unsigned *p;
  register struct huft *q;
  struct huft r;
  struct huft *u[16];
  unsigned v[288];
  register int w;
  unsigned x[16 +1];
  unsigned *xp;
  int y;
  unsigned z;

;


  mem_clear ((c), (sizeof(c)));
  p = b; i = n;
  do {
    ;

    c[*p]++;
    p++;
  } while (--i);
  if (c[0] == n)
  {
    *t = (struct huft *)((void *)0);
    *m = 0;
    return 0;
  }

;


  l = *m;
  for (j = 1; j <= 16; j++)
    if (c[j])
      break;
  k = j;
  if ((unsigned)l < j)
    l = j;
  for (i = 16; i; i--)
    if (c[i])
      break;
  g = i;
  if ((unsigned)l > i)
    l = i;
  *m = l;

;


  for (y = 1 << j; j < i; j++, y <<= 1)
    if ((y -= c[j]) < 0)
      return 2;
  if ((y -= c[i]) < 0)
    return 2;
  c[i] += y;

;


  x[1] = j = 0;
  p = c + 1; xp = x + 2;
  while (--i) {
    *xp++ = (j += *p++);
  }

;


  p = b; i = 0;
  do {
    if ((j = *p++) != 0)
      v[x[j]++] = i;
  } while (++i < n);

;


  x[0] = i = 0;
  p = v;
  h = -1;
  w = -l;
  u[0] = (struct huft *)((void *)0);
  q = (struct huft *)((void *)0);
  z = 0;
;


  for (; k <= g; k++)
  {
;
    a = c[k];
    while (a--)
    {
;


      while (k > w + l)
      {
;
        h++;
        w += l;


        z = (z = g - w) > (unsigned)l ? l : z;
        if ((f = 1 << (j = k - w)) > a + 1)
        {
;
          f -= a + 1;
          xp = c + k;
          while (++j < z)
          {
            if ((f <<= 1) <= *++xp)
              break;
            f -= *xp;
          }
        }
;
        z = 1 << j;


        if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) ==
            (struct huft *)((void *)0))
        {
          if (h)
            huft_free(u[0]);
          return 3;
        }
;
        hufts += z + 1;
        *t = q + 1;
        *(t = &(q->v.t)) = (struct huft *)((void *)0);
        u[h] = ++q;

;

        if (h)
        {
          x[h] = i;
          r.b = (uch)l;
          r.e = (uch)(16 + j);
          r.v.t = q;
          j = i >> (w - l);
          u[h-1][j] = r;
        }
;
      }
;


      r.b = (uch)(k - w);
      if (p >= v + n)
        r.e = 99;
      else if (*p < s)
      {
        r.e = (uch)(*p < 256 ? 16 : 15);
        r.v.n = (ush)(*p);
        p++;
      }
      else
      {
        r.e = (uch)e[*p - s];
        r.v.n = d[*p++ - s];
      }
;


      f = 1 << (k - w);
      for (j = i >> w; j < z; j += f)
        q[j] = r;


      for (j = 1 << (k - 1); i & j; j >>= 1)
        i ^= j;
      i ^= j;


      while ((i & ((1 << w) - 1)) != x[h])
      {
        h--;
        w -= l;
      }
;
    }
;
  }

;


  return y != 0 && g != 1;
}



static int huft_free(t)
struct huft *t;



{
  register struct huft *p, *q;



  p = t;
  while (p != (struct huft *)((void *)0))
  {
    q = (--p)->v.t;
    free((char*)p);
    p = q;
  }
  return 0;
}


static int inflate_codes(tl, td, bl, bd)
struct huft *tl, *td;
int bl, bd;


{
  register unsigned e;
  unsigned n, d;
  unsigned w;
  struct huft *t;
  unsigned ml, md;
  register ulg b;
  register unsigned k;



  b = bb;
  k = bk;
  w = outcnt;


  ml = mask_bits[bl];
  md = mask_bits[bd];
  for (;;)
  {
    {while(k<((unsigned)bl)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
    if ((e = (t = tl + ((unsigned)b & ml))->e) > 16)
      do {
        if (e == 99)
          return 1;
        {b>>=(t->b);k-=(t->b);}
        e -= 16;
        {while(k<(e)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
      } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16);
    {b>>=(t->b);k-=(t->b);}
    if (e == 16)
    {
      window[w++] = (uch)t->v.n;
      ;
      if (w == (32*1024))
      {
        (outcnt=(w),flush_window());
        w = 0;
      }
    }
    else
    {

      if (e == 15)
        break;


      {while(k<(e)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
      n = t->v.n + ((unsigned)b & mask_bits[e]);
      {b>>=(e);k-=(e);};


      {while(k<((unsigned)bd)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
      if ((e = (t = td + ((unsigned)b & md))->e) > 16)
        do {
          if (e == 99)
            return 1;
          {b>>=(t->b);k-=(t->b);}
          e -= 16;
          {while(k<(e)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
        } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16);
      {b>>=(t->b);k-=(t->b);}
      {while(k<(e)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
      d = w - t->v.n - ((unsigned)b & mask_bits[e]);
      {b>>=(e);k-=(e);}
      ;


      do {
        n -= (e = (e = (32*1024) - ((d &= (32*1024)-1) > w ? d : w)) > n ? n : e);

        if (w - d >= e)
        {

                  long adjust = (d > w) ? previous_window - window : 0;
          mem_move(window + w, window + d + adjust, e);



          w += e;
          d += e;
        }
        else

          do {
            window[w++] = window[d++];
            ;
          } while (--e);
        if (w == (32*1024))
        {
          (outcnt=(w),flush_window());
          w = 0;
        }
      } while (n);
    }
  }



  outcnt = w;
  bb = b;
  bk = k;


  return 0;
}



static int inflate_stored()

{
  unsigned n;
  unsigned w;
  register ulg b;
  register unsigned k;

;


  b = bb;
  k = bk;
  w = outcnt;



  n = k & 7;
  {b>>=(n);k-=(n);};



  {while(k<(16)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
  n = ((unsigned)b & 0xffff);
  {b>>=(16);k-=(16);}
  {while(k<(16)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
  if (n != (unsigned)((~b) & 0xffff))
    return 1;
  {b>>=(16);k-=(16);}



  while (n--)
  {
    {while(k<(8)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
    window[w++] = (uch)b;
    if (w == (32*1024))
    {
      (outcnt=(w),flush_window());
      w = 0;
    }
    {b>>=(8);k-=(8);}
  }



  outcnt = w;
  bb = b;
  bk = k;

  ;
  return 0;
}



static int inflate_fixed()



{
  int i;
  struct huft *tl;
  struct huft *td;
  int bl;
  int bd;
  unsigned l[288];

;


  for (i = 0; i < 144; i++)
    l[i] = 8;
  for (; i < 256; i++)
    l[i] = 9;
  for (; i < 280; i++)
    l[i] = 7;
  for (; i < 288; i++)
    l[i] = 8;
  bl = 7;
  if ((i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl)) != 0)
    return i;



  for (i = 0; i < 30; i++)
    l[i] = 5;
  bd = 5;
  if ((i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd)) > 1)
  {
    huft_free(tl);

    ;
    return i;
  }



  if (inflate_codes(tl, td, bl, bd))
    return 1;



  huft_free(tl);
  huft_free(td);
  return 0;
}



static int inflate_dynamic()

{
  int i;
  unsigned j;
  unsigned l;
  unsigned m;
  unsigned n;
  struct huft *tl;
  struct huft *td;
  int bl;
  int bd;
  unsigned nb;
  unsigned nl;
  unsigned nd;



  unsigned ll[286+30];

  register ulg b;
  register unsigned k;

;


  b = bb;
  k = bk;



  {while(k<(5)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
  nl = 257 + ((unsigned)b & 0x1f);
  {b>>=(5);k-=(5);}
  {while(k<(5)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
  nd = 1 + ((unsigned)b & 0x1f);
  {b>>=(5);k-=(5);}
  {while(k<(4)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
  nb = 4 + ((unsigned)b & 0xf);
  {b>>=(4);k-=(4);}



  if (nl > 286 || nd > 30)

    return 1;

;


  for (j = 0; j < nb; j++)
  {
    {while(k<(3)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
    ll[border[j]] = (unsigned)b & 7;
    {b>>=(3);k-=(3);}
  }
  for (; j < 19; j++)
    ll[border[j]] = 0;

;


  bl = 7;
  if ((i = huft_build(ll, 19, 19, ((void *)0), ((void *)0), &tl, &bl)) != 0)
  {
    if (i == 1)
      huft_free(tl);
    return i;
  }

;


  n = nl + nd;
  m = mask_bits[bl];
  i = l = 0;
  while ((unsigned)i < n)
  {
    {while(k<((unsigned)bl)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
    j = (td = tl + ((unsigned)b & m))->b;
    {b>>=(j);k-=(j);}
    j = td->v.n;
    if (j < 16)
      ll[i++] = l = j;
    else if (j == 16)
    {
      {while(k<(2)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
      j = 3 + ((unsigned)b & 3);
      {b>>=(2);k-=(2);}
      if ((unsigned)i + j > n)
        return 1;
      while (j--)
        ll[i++] = l;
    }
    else if (j == 17)
    {
      {while(k<(3)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
      j = 3 + ((unsigned)b & 7);
      {b>>=(3);k-=(3);}
      if ((unsigned)i + j > n)
        return 1;
      while (j--)
        ll[i++] = 0;
      l = 0;
    }
    else
    {
      {while(k<(7)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
      j = 11 + ((unsigned)b & 0x7f);
      {b>>=(7);k-=(7);}
      if ((unsigned)i + j > n)
        return 1;
      while (j--)
        ll[i++] = 0;
      l = 0;
    }
  }

;


  huft_free(tl);

;


  bb = b;
  bk = k;

;


  bl = lbits;
  if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0)
  {
;
    if (i == 1) {
      error(" incomplete literal tree\n");
      huft_free(tl);
    }
    return i;
  }
;
  bd = dbits;
  if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0)
  {
;
    if (i == 1) {
      error(" incomplete distance tree\n");




      huft_free(td);
    }
    huft_free(tl);
    return i;

  }

;


  if (inflate_codes(tl, td, bl, bd))
    return 1;

;


  huft_free(tl);
  huft_free(td);

  ;
  return 0;
}



static int inflate_block(e)
int *e;

{
  unsigned t;
  register ulg b;
  register unsigned k;

  ;


  b = bb;
  k = bk;



  {while(k<(1)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
  *e = (int)b & 1;
  {b>>=(1);k-=(1);}



  {while(k<(2)){b|=((ulg)(uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<k;k+=8;}}
  t = (unsigned)b & 3;
  {b>>=(2);k-=(2);}



  bb = b;
  bk = k;


  if (t == 2)
    return inflate_dynamic();
  if (t == 0)
    return inflate_stored();
  if (t == 1)
    return inflate_fixed();

  ;


  return 2;
}



static int inflate()

{
  int e;
  int r;
  unsigned h;
  void *ptr;


  outcnt = 0;
  bk = 0;
  bb = 0;



  h = 0;
  do {
    hufts = 0;
    gzip_mark(&ptr);
    if ((r = inflate_block(&e)) != 0) {
      gzip_release(&ptr);
      return r;
    }
    gzip_release(&ptr);
    if (hufts > h)
      h = hufts;
  } while (!e);




  while (bk >= 8) {
    bk -= 8;
    inptr--;
  }


  (outcnt=(outcnt),flush_window());






  return 0;
}







static ulg crc_32_tab[256];
static ulg crc = (ulg)0xffffffffL;







static void
makecrc(void)
{


  unsigned long c;
  unsigned long e;
  int i;
  int k;


  static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};


  e = 0;
  for (i = 0; i < sizeof(p)/sizeof(int); i++)
    e |= 1L << (31 - p[i]);

  crc_32_tab[0] = 0;

  for (i = 1; i < 256; i++)
  {
    c = 0;
    for (k = i | 256; k != 1; k >>= 1)
    {
      c = c & 1 ? (c >> 1) ^ e : c >> 1;
      if (k & 1)
        c ^= e;
    }
    crc_32_tab[i] = c;
  }
}
# 1063 "inflate.c"
static int gunzip(void)
{
    uch flags;
    unsigned char magic[2];
    char method;
    ulg orig_crc = 0;
    ulg orig_len = 0;
    int res;

    magic[0] = (unsigned char)(inptr < insize ? inbuf[inptr++] : fill_inbuf());
    magic[1] = (unsigned char)(inptr < insize ? inbuf[inptr++] : fill_inbuf());
    method = (unsigned char)(inptr < insize ? inbuf[inptr++] : fill_inbuf());

    if (magic[0] != 037 ||
        ((magic[1] != 0213) && (magic[1] != 0236))) {
            error("bad gzip magic numbers");
            return -1;
    }


    if (method != 8) {
            error("internal error, invalid method");
            return -1;
    }

    flags = (uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf());
    if ((flags & 0x20) != 0) {
            error("Input is encrypted\n");
            return -1;
    }
    if ((flags & 0x02) != 0) {
            error("Multi part input\n");
            return -1;
    }
    if ((flags & 0xC0) != 0) {
            error("Input has invalid flags\n");
            return -1;
    }
    (ulg)(inptr < insize ? inbuf[inptr++] : fill_inbuf());
    ((ulg)(inptr < insize ? inbuf[inptr++] : fill_inbuf())) << 8;
    ((ulg)(inptr < insize ? inbuf[inptr++] : fill_inbuf())) << 16;
    ((ulg)(inptr < insize ? inbuf[inptr++] : fill_inbuf())) << 24;

    (void)(inptr < insize ? inbuf[inptr++] : fill_inbuf());
    (void)(inptr < insize ? inbuf[inptr++] : fill_inbuf());

    if ((flags & 0x04) != 0) {
            unsigned len = (unsigned)(inptr < insize ? inbuf[inptr++] : fill_inbuf());
            len |= ((unsigned)(inptr < insize ? inbuf[inptr++] : fill_inbuf()))<<8;
            while (len--) (void)(inptr < insize ? inbuf[inptr++] : fill_inbuf());
    }


    if ((flags & 0x08) != 0) {

            while ((inptr < insize ? inbuf[inptr++] : fill_inbuf()) != 0) ;
    }


    if ((flags & 0x10) != 0) {
            while ((inptr < insize ? inbuf[inptr++] : fill_inbuf()) != 0) ;
    }


    if ((res = inflate())) {
            switch (res) {
            case 0:
                    break;
            case 1:
                    error("invalid compressed format (err=1)");
                    break;
            case 2:
                    error("invalid compressed format (err=2)");
                    break;
            case 3:
                    error("out of memory");
                    break;
            default:
                    error("invalid compressed format (other)");
            }
            return -1;
    }





    orig_crc = (ulg) (inptr < insize ? inbuf[inptr++] : fill_inbuf());
    orig_crc |= (ulg) (inptr < insize ? inbuf[inptr++] : fill_inbuf()) << 8;
    orig_crc |= (ulg) (inptr < insize ? inbuf[inptr++] : fill_inbuf()) << 16;
    orig_crc |= (ulg) (inptr < insize ? inbuf[inptr++] : fill_inbuf()) << 24;

    orig_len = (ulg) (inptr < insize ? inbuf[inptr++] : fill_inbuf());
    orig_len |= (ulg) (inptr < insize ? inbuf[inptr++] : fill_inbuf()) << 8;
    orig_len |= (ulg) (inptr < insize ? inbuf[inptr++] : fill_inbuf()) << 16;
    orig_len |= (ulg) (inptr < insize ? inbuf[inptr++] : fill_inbuf()) << 24;


    if (orig_crc != (crc ^ 0xffffffffL)) {
            error("crc error");
            return -1;
    }
    if (orig_len != bytes_out) {
            error("length error");
            return -1;
    }
    return 0;
}
# 97 "gunzip_mod.c" 2

static int gunzip_open( void *data, long count )
{
        int rv;
        unsigned char buf[2];

        insize = 0;
        inptr = 0;
        outcnt = 0;
        exit_code = 0;
        bytes_out = 0;
        crc = (ulg)0xffffffffL;
        if (!made_crc_table)
        {
                ++made_crc_table;
                makecrc();
        }


        if (sopen( data, count ) < 0)
                return( -1 );


        rv = sread( buf, 2 );
        sseek( 0, 0 );
        if (rv < 2) {
                printf( "File shorter than 2 bytes, can't test for gzip\n" );
                return( -1 );
        }
    if (buf[0] != 037 || (buf[1] != 0213 && buf[1] != 0236))

                return( 1 );

        if (!(gunzip_stack = malloc( (4*1024) ))) {
                printf( "Out of memory for gunzip stack!\n" );
                return( -1 );
        }
        gunzip_sp = 0;

        if (!(inbuf = malloc( (32*1024) ))) {
                printf( "Out of memory for gunzip input buffer!\n" );
                return( -1 );
        }




        return( 0 );
}

static __inline__ unsigned long getsp( void )
{
        ulg ret;
        __asm__ __volatile__
                ( "movl	%%sp,%0" : "=r" (ret) : );
        return( ret );
}

static long gunzip_fillbuf( void *buf )
{
        previous_window = window;
        window = buf;
        return( call_gunzip() );
}

static int gunzip_close( void )
{
        free( gunzip_stack );
        free( inbuf );
        sclose();



        return( 0 );
}

static void gzip_mark( void **ptr )
{
}

static void gzip_release( void **ptr )
{
}
# 195 "gunzip_mod.c"
static int call_gunzip( void )
{
        int rv = 0;


        (void)&main_sp;
        (void)&main_fp;
        (void)&gunzip_jumpback;
        (void)gunzip;

        if (!gunzip_sp) {
                register int asm_rv __asm__ ("d0");


                __asm__ __volatile__ (
                        "movl	%%sp,main_sp\n\t"
                        "movl	%%a6,main_fp\n\t"
                        "movl	%1,%%sp\n\t"
                        "jbsr	gunzip\n\t"
                "_return_from_flush:\n\t"
                        "movl	main_sp,%%sp\n\t"
                        "movl	main_fp,%%a6"
                        : "=d" (asm_rv)
                        : "g" (gunzip_stack+(4*1024)-sizeof(int))
                        : "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a0", "a1", "a2", "a3",
                          "a4", "a5", "memory"
                        );
                rv = asm_rv;
        }
        else {

                __asm__ __volatile__ (
                        "movl	%%sp,main_sp\n\t"
                        "movl	%%a6,main_fp\n\t"
                        "movl	gunzip_jumpback,%%a0\n\t"
                        "jmp	%%a0@"
                        :
                        :
                        : "d0", "d1", "a0", "a1", "memory"
                        );
        }
        return( rv );
}
# 258 "gunzip_mod.c"
static int fill_inbuf( void )
{
    if (exit_code)
                return( -1 );

    insize = sread( inbuf, (32*1024) );
    if (insize <= 0)
                return( -1 );

    inptr = 1;
    return( inbuf[0] );
}





static void flush_window( void )
{
    ulg c = crc;
    unsigned n;
    uch *in, ch;

    in = window;
    for( n = 0; n < outcnt; n++ ) {
            ch = *in++;
            c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
    }
    crc = c;
        bytes_out += (ulg)outcnt;





        __asm__ __volatile__ ( "movml	%%d2-%%d7/%%a2-%%a6,%%sp@-\n\t" "movl	%%sp,gunzip_sp\n\t" "movl	#1f,gunzip_jumpback\n\t" "movl	outcnt,%%d0\n\t" "jmp	_return_from_flush\n" "1:\tmovl	gunzip_sp,%%sp\n\t" "movml	%%sp@+,%%d2-%%d7/%%a2-%%a6" : : : "d0", "d1", "a0", "a1", "memory" );

        outcnt = 0;
}

static void error( char *x )
{
    printf( "\n%s\n", x);
    exit_code = 1;
}