file
stringlengths
18
26
data
stringlengths
3
1.04M
the_stack_data/71098.c
/******************************************************************************* * DISCLAIMER * This software is supplied by Renesas Electronics Corporation and is only * intended for use with Renesas products. No other uses are authorized. This * software is owned by Renesas Electronics Corporation and is protected under * all applicable laws, including copyright laws. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * Renesas reserves the right, without notice, to make changes to this software * and to discontinue the availability of this software. By using this software, * you agree to the additional terms and conditions found by accessing the * following link: * http://www.renesas.com/disclaimer * Copyright (C) 2012 - 2015 Renesas Electronics Corporation. All rights reserved. *******************************************************************************/ /**************************************************************************//** * @file lvds_pll_data.c * @version 1.00 * $Rev: 199 $ * $Date:: 2014-05-23 16:33:52 +0900#$ * @brief lvds pll for vdc5 channel 0 data ******************************************************************************/ /****************************************************************************** Includes <System Includes> , "Project Includes" ******************************************************************************/ #include <stdio.h> #include <stdlib.h> /****************************************************************************** Variables ******************************************************************************/ const double NIDIV_data[] = { 1.0, 2.0, 4.0, 0.0 }; const double NRD_data[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 0.0 }; const double NFD_data[] = { 24.0, 25.0, 26.0, 27.0, 32.0, 33.0, 34.0, 35.0, 36.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0, 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0, 121.0, 122.0, 123.0, 124.0, 125.0, 126.0, 127.0, 128.0, 129.0, 130.0, 131.0, 132.0, 133.0, 134.0, 135.0, 136.0, 137.0, 138.0, 139.0, 140.0, 141.0, 142.0, 143.0, 144.0, 145.0, 146.0, 147.0, 148.0, 149.0, 150.0, 151.0, 152.0, 153.0, 154.0, 155.0, 156.0, 157.0, 158.0, 159.0, 160.0, 161.0, 162.0, 163.0, 164.0, 165.0, 166.0, 167.0, 168.0, 169.0, 170.0, 171.0, 172.0, 173.0, 174.0, 175.0, 176.0, 177.0, 178.0, 179.0, 180.0, 181.0, 182.0, 183.0, 184.0, 185.0, 186.0, 187.0, 188.0, 189.0, 190.0, 191.0, 192.0, 193.0, 194.0, 195.0, 196.0, 197.0, 198.0, 199.0, 200.0, 201.0, 202.0, 203.0, 204.0, 205.0, 206.0, 207.0, 208.0, 209.0, 210.0, 211.0, 212.0, 213.0, 214.0, 215.0, 216.0, 217.0, 218.0, 219.0, 220.0, 221.0, 222.0, 223.0, 224.0, 225.0, 226.0, 227.0, 228.0, 229.0, 230.0, 231.0, 232.0, 233.0, 234.0, 235.0, 236.0, 237.0, 238.0, 239.0, 240.0, 241.0, 242.0, 243.0, 244.0, 245.0, 246.0, 247.0, 248.0, 249.0, 250.0, 251.0, 252.0, 253.0, 254.0, 255.0, 256.0, 257.0, 258.0, 259.0, 260.0, 261.0, 262.0, 263.0, 264.0, 265.0, 266.0, 267.0, 268.0, 269.0, 270.0, 271.0, 272.0, 273.0, 274.0, 275.0, 276.0, 277.0, 278.0, 279.0, 280.0, 281.0, 282.0, 283.0, 284.0, 285.0, 286.0, 287.0, 288.0, 289.0, 290.0, 291.0, 292.0, 293.0, 294.0, 295.0, 296.0, 297.0, 298.0, 299.0, 300.0, 301.0, 302.0, 303.0, 304.0, 305.0, 306.0, 307.0, 308.0, 309.0, 310.0, 311.0, 312.0, 313.0, 314.0, 315.0, 316.0, 317.0, 318.0, 319.0, 320.0, 321.0, 322.0, 323.0, 324.0, 325.0, 326.0, 327.0, 328.0, 329.0, 330.0, 331.0, 332.0, 333.0, 334.0, 335.0, 336.0, 337.0, 338.0, 339.0, 340.0, 341.0, 342.0, 343.0, 344.0, 345.0, 346.0, 347.0, 348.0, 349.0, 350.0, 351.0, 352.0, 353.0, 354.0, 355.0, 356.0, 357.0, 358.0, 359.0, 360.0, 361.0, 362.0, 363.0, 364.0, 365.0, 366.0, 367.0, 368.0, 369.0, 370.0, 371.0, 372.0, 373.0, 374.0, 375.0, 376.0, 377.0, 378.0, 379.0, 380.0, 381.0, 382.0, 383.0, 384.0, 385.0, 386.0, 387.0, 388.0, 389.0, 390.0, 391.0, 392.0, 393.0, 394.0, 395.0, 396.0, 397.0, 398.0, 399.0, 400.0, 401.0, 402.0, 403.0, 404.0, 405.0, 406.0, 407.0, 408.0, 409.0, 410.0, 411.0, 412.0, 413.0, 414.0, 415.0, 416.0, 417.0, 418.0, 419.0, 420.0, 421.0, 422.0, 423.0, 424.0, 425.0, 426.0, 427.0, 428.0, 429.0, 430.0, 431.0, 432.0, 433.0, 434.0, 435.0, 436.0, 437.0, 438.0, 439.0, 440.0, 441.0, 442.0, 443.0, 444.0, 445.0, 446.0, 447.0, 448.0, 449.0, 450.0, 451.0, 452.0, 453.0, 454.0, 455.0, 456.0, 457.0, 458.0, 459.0, 460.0, 461.0, 462.0, 463.0, 464.0, 465.0, 466.0, 467.0, 468.0, 469.0, 470.0, 471.0, 472.0, 473.0, 474.0, 475.0, 476.0, 477.0, 478.0, 479.0, 480.0, 481.0, 482.0, 483.0, 484.0, 485.0, 486.0, 487.0, 488.0, 489.0, 490.0, 491.0, 492.0, 493.0, 494.0, 495.0, 496.0, 497.0, 498.0, 499.0, 500.0, 501.0, 502.0, 503.0, 504.0, 505.0, 506.0, 507.0, 508.0, 509.0, 510.0, 511.0, 512.0, 513.0, 514.0, 515.0, 516.0, 517.0, 518.0, 519.0, 520.0, 521.0, 522.0, 523.0, 524.0, 525.0, 526.0, 527.0, 528.0, 529.0, 530.0, 531.0, 532.0, 533.0, 534.0, 535.0, 536.0, 537.0, 538.0, 539.0, 540.0, 541.0, 542.0, 543.0, 544.0, 545.0, 546.0, 547.0, 548.0, 549.0, 550.0, 551.0, 552.0, 553.0, 554.0, 555.0, 556.0, 557.0, 558.0, 559.0, 560.0, 561.0, 562.0, 563.0, 564.0, 565.0, 566.0, 567.0, 568.0, 569.0, 570.0, 571.0, 572.0, 573.0, 574.0, 575.0, 576.0, 577.0, 578.0, 579.0, 580.0, 581.0, 582.0, 583.0, 584.0, 585.0, 586.0, 587.0, 588.0, 589.0, 590.0, 591.0, 592.0, 593.0, 594.0, 595.0, 596.0, 597.0, 598.0, 599.0, 600.0, 601.0, 602.0, 603.0, 604.0, 605.0, 606.0, 607.0, 608.0, 609.0, 610.0, 611.0, 612.0, 613.0, 614.0, 615.0, 616.0, 617.0, 618.0, 619.0, 620.0, 621.0, 622.0, 623.0, 624.0, 625.0, 626.0, 627.0, 628.0, 629.0, 630.0, 631.0, 632.0, 633.0, 634.0, 635.0, 636.0, 637.0, 638.0, 639.0, 640.0, 641.0, 642.0, 643.0, 644.0, 645.0, 646.0, 647.0, 648.0, 649.0, 650.0, 651.0, 652.0, 653.0, 654.0, 655.0, 656.0, 657.0, 658.0, 659.0, 660.0, 661.0, 662.0, 663.0, 664.0, 665.0, 666.0, 667.0, 668.0, 669.0, 670.0, 671.0, 672.0, 673.0, 674.0, 675.0, 676.0, 677.0, 678.0, 679.0, 680.0, 681.0, 682.0, 683.0, 684.0, 685.0, 686.0, 687.0, 688.0, 689.0, 690.0, 691.0, 692.0, 693.0, 694.0, 695.0, 696.0, 697.0, 698.0, 699.0, 700.0, 701.0, 702.0, 703.0, 704.0, 705.0, 706.0, 707.0, 708.0, 709.0, 710.0, 711.0, 712.0, 713.0, 714.0, 715.0, 716.0, 717.0, 718.0, 719.0, 720.0, 721.0, 722.0, 723.0, 724.0, 725.0, 726.0, 727.0, 728.0, 729.0, 730.0, 731.0, 732.0, 733.0, 734.0, 735.0, 736.0, 737.0, 738.0, 739.0, 740.0, 741.0, 742.0, 743.0, 744.0, 745.0, 746.0, 747.0, 748.0, 749.0, 750.0, 751.0, 752.0, 753.0, 754.0, 755.0, 756.0, 757.0, 758.0, 759.0, 760.0, 761.0, 762.0, 763.0, 764.0, 765.0, 766.0, 767.0, 768.0, 769.0, 770.0, 771.0, 772.0, 773.0, 774.0, 775.0, 776.0, 777.0, 778.0, 779.0, 780.0, 781.0, 782.0, 783.0, 784.0, 785.0, 786.0, 787.0, 788.0, 789.0, 790.0, 791.0, 792.0, 793.0, 794.0, 795.0, 796.0, 797.0, 798.0, 799.0, 800.0, 801.0, 802.0, 803.0, 804.0, 805.0, 806.0, 807.0, 808.0, 809.0, 810.0, 811.0, 812.0, 813.0, 814.0, 815.0, 816.0, 817.0, 818.0, 819.0, 820.0, 821.0, 822.0, 823.0, 824.0, 825.0, 826.0, 827.0, 828.0, 829.0, 830.0, 831.0, 832.0, 833.0, 834.0, 835.0, 836.0, 837.0, 838.0, 839.0, 840.0, 841.0, 842.0, 843.0, 844.0, 845.0, 846.0, 847.0, 848.0, 849.0, 850.0, 851.0, 852.0, 853.0, 854.0, 855.0, 856.0, 857.0, 858.0, 859.0, 860.0, 861.0, 862.0, 863.0, 864.0, 865.0, 866.0, 867.0, 868.0, 869.0, 870.0, 871.0, 872.0, 873.0, 874.0, 875.0, 876.0, 877.0, 878.0, 879.0, 880.0, 881.0, 882.0, 883.0, 884.0, 885.0, 886.0, 887.0, 888.0, 889.0, 890.0, 891.0, 892.0, 893.0, 894.0, 895.0, 896.0, 897.0, 898.0, 899.0, 900.0, 901.0, 902.0, 903.0, 904.0, 905.0, 906.0, 907.0, 908.0, 909.0, 910.0, 911.0, 912.0, 913.0, 914.0, 915.0, 916.0, 917.0, 918.0, 919.0, 920.0, 921.0, 922.0, 923.0, 924.0, 925.0, 926.0, 927.0, 928.0, 929.0, 930.0, 931.0, 932.0, 933.0, 934.0, 935.0, 936.0, 937.0, 938.0, 939.0, 940.0, 941.0, 942.0, 943.0, 944.0, 945.0, 946.0, 947.0, 948.0, 949.0, 950.0, 951.0, 952.0, 953.0, 954.0, 955.0, 956.0, 957.0, 958.0, 959.0, 960.0, 961.0, 962.0, 963.0, 964.0, 965.0, 966.0, 967.0, 968.0, 969.0, 970.0, 971.0, 972.0, 973.0, 974.0, 975.0, 976.0, 977.0, 978.0, 979.0, 980.0, 981.0, 982.0, 983.0, 984.0, 985.0, 986.0, 987.0, 988.0, 989.0, 990.0, 991.0, 992.0, 993.0, 994.0, 995.0, 996.0, 997.0, 998.0, 999.0, 1000.0, 1001.0, 1002.0, 1003.0, 1004.0, 1005.0, 1006.0, 1007.0, 1008.0, 1009.0, 1010.0, 1011.0, 1012.0, 1013.0, 1014.0, 1015.0, 1016.0, 1017.0, 1018.0, 1019.0, 1020.0, 1021.0, 1022.0, 1023.0, 1024.0, 1025.0, 1026.0, 1027.0, 1028.0, 1029.0, 1030.0, 1031.0, 1032.0, 1033.0, 1034.0, 1035.0, 1036.0, 1037.0, 1038.0, 1039.0, 1040.0, 1041.0, 1042.0, 1043.0, 1044.0, 1045.0, 1046.0, 1047.0, 1048.0, 1049.0, 1050.0, 1051.0, 1052.0, 1053.0, 1054.0, 1055.0, 1056.0, 1057.0, 1058.0, 1059.0, 1060.0, 1061.0, 1062.0, 1063.0, 1064.0, 1065.0, 1066.0, 1067.0, 1068.0, 1069.0, 1070.0, 1071.0, 1072.0, 1073.0, 1074.0, 1075.0, 1076.0, 1077.0, 1078.0, 1079.0, 1080.0, 1081.0, 1082.0, 1083.0, 1084.0, 1085.0, 1086.0, 1087.0, 1088.0, 1089.0, 1090.0, 1091.0, 1092.0, 1093.0, 1094.0, 1095.0, 1096.0, 1097.0, 1098.0, 1099.0, 1100.0, 1101.0, 1102.0, 1103.0, 1104.0, 1105.0, 1106.0, 1107.0, 1108.0, 1109.0, 1110.0, 1111.0, 1112.0, 1113.0, 1114.0, 1115.0, 1116.0, 1117.0, 1118.0, 1119.0, 1120.0, 1121.0, 1122.0, 1123.0, 1124.0, 1125.0, 1126.0, 1127.0, 1128.0, 1129.0, 1130.0, 1131.0, 1132.0, 1133.0, 1134.0, 1135.0, 1136.0, 1137.0, 1138.0, 1139.0, 1140.0, 1141.0, 1142.0, 1143.0, 1144.0, 1145.0, 1146.0, 1147.0, 1148.0, 1149.0, 1150.0, 1151.0, 1152.0, 1153.0, 1154.0, 1155.0, 1156.0, 1157.0, 1158.0, 1159.0, 1160.0, 1161.0, 1162.0, 1163.0, 1164.0, 1165.0, 1166.0, 1167.0, 1168.0, 1169.0, 1170.0, 1171.0, 1172.0, 1173.0, 1174.0, 1175.0, 1176.0, 1177.0, 1178.0, 1179.0, 1180.0, 1181.0, 1182.0, 1183.0, 1184.0, 1185.0, 1186.0, 1187.0, 1188.0, 1189.0, 1190.0, 1191.0, 1192.0, 1193.0, 1194.0, 1195.0, 1196.0, 1197.0, 1198.0, 1199.0, 1200.0, 1201.0, 1202.0, 1203.0, 1204.0, 1205.0, 1206.0, 1207.0, 1208.0, 1209.0, 1210.0, 1211.0, 1212.0, 1213.0, 1214.0, 1215.0, 1216.0, 1217.0, 1218.0, 1219.0, 1220.0, 1221.0, 1222.0, 1223.0, 1224.0, 1225.0, 1226.0, 1227.0, 1228.0, 1229.0, 1230.0, 1231.0, 1232.0, 1233.0, 1234.0, 1235.0, 1236.0, 1237.0, 1238.0, 1239.0, 1240.0, 1241.0, 1242.0, 1243.0, 1244.0, 1245.0, 1246.0, 1247.0, 1248.0, 1249.0, 1250.0, 1251.0, 1252.0, 1253.0, 1254.0, 1255.0, 1256.0, 1257.0, 1258.0, 1259.0, 1260.0, 1261.0, 1262.0, 1263.0, 1264.0, 1265.0, 1266.0, 1267.0, 1268.0, 1269.0, 1270.0, 1271.0, 1272.0, 1273.0, 1274.0, 1275.0, 1276.0, 1277.0, 1278.0, 1279.0, 1280.0, 1281.0, 1282.0, 1283.0, 1284.0, 1285.0, 1286.0, 1287.0, 1288.0, 1289.0, 1290.0, 1291.0, 1292.0, 1293.0, 1294.0, 1295.0, 1296.0, 1297.0, 1298.0, 1299.0, 1300.0, 1301.0, 1302.0, 1303.0, 1304.0, 1305.0, 1306.0, 1307.0, 1308.0, 1309.0, 1310.0, 1311.0, 1312.0, 1313.0, 1314.0, 1315.0, 1316.0, 1317.0, 1318.0, 1319.0, 1320.0, 1321.0, 1322.0, 1323.0, 1324.0, 1325.0, 1326.0, 1327.0, 1328.0, 1329.0, 1330.0, 1331.0, 1332.0, 1333.0, 1334.0, 1335.0, 1336.0, 1337.0, 1338.0, 1339.0, 1340.0, 1341.0, 1342.0, 1343.0, 1344.0, 1345.0, 1346.0, 1347.0, 1348.0, 1349.0, 1350.0, 1351.0, 1352.0, 1353.0, 1354.0, 1355.0, 1356.0, 1357.0, 1358.0, 1359.0, 1360.0, 1361.0, 1362.0, 1363.0, 1364.0, 1365.0, 1366.0, 1367.0, 1368.0, 1369.0, 1370.0, 1371.0, 1372.0, 1373.0, 1374.0, 1375.0, 1376.0, 1377.0, 1378.0, 1379.0, 1380.0, 1381.0, 1382.0, 1383.0, 1384.0, 1385.0, 1386.0, 1387.0, 1388.0, 1389.0, 1390.0, 1391.0, 1392.0, 1393.0, 1394.0, 1395.0, 1396.0, 1397.0, 1398.0, 1399.0, 1400.0, 1401.0, 1402.0, 1403.0, 1404.0, 1405.0, 1406.0, 1407.0, 1408.0, 1409.0, 1410.0, 1411.0, 1412.0, 1413.0, 1414.0, 1415.0, 1416.0, 1417.0, 1418.0, 1419.0, 1420.0, 1421.0, 1422.0, 1423.0, 1424.0, 1425.0, 1426.0, 1427.0, 1428.0, 1429.0, 1430.0, 1431.0, 1432.0, 1433.0, 1434.0, 1435.0, 1436.0, 1437.0, 1438.0, 1439.0, 1440.0, 1441.0, 1442.0, 1443.0, 1444.0, 1445.0, 1446.0, 1447.0, 1448.0, 1449.0, 1450.0, 1451.0, 1452.0, 1453.0, 1454.0, 1455.0, 1456.0, 1457.0, 1458.0, 1459.0, 1460.0, 1461.0, 1462.0, 1463.0, 1464.0, 1465.0, 1466.0, 1467.0, 1468.0, 1469.0, 1470.0, 1471.0, 1472.0, 1473.0, 1474.0, 1475.0, 1476.0, 1477.0, 1478.0, 1479.0, 1480.0, 1481.0, 1482.0, 1483.0, 1484.0, 1485.0, 1486.0, 1487.0, 1488.0, 1489.0, 1490.0, 1491.0, 1492.0, 1493.0, 1494.0, 1495.0, 1496.0, 1497.0, 1498.0, 1499.0, 1500.0, 1501.0, 1502.0, 1503.0, 1504.0, 1505.0, 1506.0, 1507.0, 1508.0, 1509.0, 1510.0, 1511.0, 1512.0, 1513.0, 1514.0, 1515.0, 1516.0, 1517.0, 1518.0, 1519.0, 1520.0, 1521.0, 1522.0, 1523.0, 1524.0, 1525.0, 1526.0, 1527.0, 1528.0, 1529.0, 1530.0, 1531.0, 1532.0, 1533.0, 1534.0, 1535.0, 1536.0, 1537.0, 1538.0, 1539.0, 1540.0, 1541.0, 1542.0, 1543.0, 1544.0, 1545.0, 1546.0, 1547.0, 1548.0, 1549.0, 1550.0, 1551.0, 1552.0, 1553.0, 1554.0, 1555.0, 1556.0, 1557.0, 1558.0, 1559.0, 1560.0, 1561.0, 1562.0, 1563.0, 1564.0, 1565.0, 1566.0, 1567.0, 1568.0, 1569.0, 1570.0, 1571.0, 1572.0, 1573.0, 1574.0, 1575.0, 1576.0, 1577.0, 1578.0, 1579.0, 1580.0, 1581.0, 1582.0, 1583.0, 1584.0, 1585.0, 1586.0, 1587.0, 1588.0, 1589.0, 1590.0, 1591.0, 1592.0, 1593.0, 1594.0, 1595.0, 1596.0, 1597.0, 1598.0, 1599.0, 1600.0, 1601.0, 1602.0, 1603.0, 1604.0, 1605.0, 1606.0, 1607.0, 1608.0, 1609.0, 1610.0, 1611.0, 1612.0, 1613.0, 1614.0, 1615.0, 1616.0, 1617.0, 1618.0, 1619.0, 1620.0, 1621.0, 1622.0, 1623.0, 1624.0, 1625.0, 1626.0, 1627.0, 1628.0, 1629.0, 1630.0, 1631.0, 1632.0, 1633.0, 1634.0, 1635.0, 1636.0, 1637.0, 1638.0, 1639.0, 1640.0, 1641.0, 1642.0, 1643.0, 1644.0, 1645.0, 1646.0, 1647.0, 1648.0, 1649.0, 1650.0, 1651.0, 1652.0, 1653.0, 1654.0, 1655.0, 1656.0, 1657.0, 1658.0, 1659.0, 1660.0, 1661.0, 1662.0, 1663.0, 1664.0, 1665.0, 1666.0, 1667.0, 1668.0, 1669.0, 1670.0, 1671.0, 1672.0, 1673.0, 1674.0, 1675.0, 1676.0, 1677.0, 1678.0, 1679.0, 1680.0, 1681.0, 1682.0, 1683.0, 1684.0, 1685.0, 1686.0, 1687.0, 1688.0, 1689.0, 1690.0, 1691.0, 1692.0, 1693.0, 1694.0, 1695.0, 1696.0, 1697.0, 1698.0, 1699.0, 1700.0, 1701.0, 1702.0, 1703.0, 1704.0, 1705.0, 1706.0, 1707.0, 1708.0, 1709.0, 1710.0, 1711.0, 1712.0, 1713.0, 1714.0, 1715.0, 1716.0, 1717.0, 1718.0, 1719.0, 1720.0, 1721.0, 1722.0, 1723.0, 1724.0, 1725.0, 1726.0, 1727.0, 1728.0, 1729.0, 1730.0, 1731.0, 1732.0, 1733.0, 1734.0, 1735.0, 1736.0, 1737.0, 1738.0, 1739.0, 1740.0, 1741.0, 1742.0, 1743.0, 1744.0, 1745.0, 1746.0, 1747.0, 1748.0, 1749.0, 1750.0, 1751.0, 1752.0, 1753.0, 1754.0, 1755.0, 1756.0, 1757.0, 1758.0, 1759.0, 1760.0, 1761.0, 1762.0, 1763.0, 1764.0, 1765.0, 1766.0, 1767.0, 1768.0, 1769.0, 1770.0, 1771.0, 1772.0, 1773.0, 1774.0, 1775.0, 1776.0, 1777.0, 1778.0, 1779.0, 1780.0, 1781.0, 1782.0, 1783.0, 1784.0, 1785.0, 1786.0, 1787.0, 1788.0, 1789.0, 1790.0, 1791.0, 1792.0, 1793.0, 1794.0, 1795.0, 1796.0, 1797.0, 1798.0, 1799.0, 1800.0, 1801.0, 1802.0, 1803.0, 1804.0, 1805.0, 1806.0, 1807.0, 1808.0, 1809.0, 1810.0, 1811.0, 1812.0, 1813.0, 1814.0, 1815.0, 1816.0, 1817.0, 1818.0, 1819.0, 1820.0, 1821.0, 1822.0, 1823.0, 1824.0, 1825.0, 1826.0, 1827.0, 1828.0, 1829.0, 1830.0, 1831.0, 1832.0, 1833.0, 1834.0, 1835.0, 1836.0, 1837.0, 1838.0, 1839.0, 1840.0, 1841.0, 1842.0, 1843.0, 1844.0, 1845.0, 1846.0, 1847.0, 1848.0, 1849.0, 1850.0, 1851.0, 1852.0, 1853.0, 1854.0, 1855.0, 1856.0, 1857.0, 1858.0, 1859.0, 1860.0, 1861.0, 1862.0, 1863.0, 1864.0, 1865.0, 1866.0, 1867.0, 1868.0, 1869.0, 1870.0, 1871.0, 1872.0, 1873.0, 1874.0, 1875.0, 1876.0, 1877.0, 1878.0, 1879.0, 1880.0, 1881.0, 1882.0, 1883.0, 1884.0, 1885.0, 1886.0, 1887.0, 1888.0, 1889.0, 1890.0, 1891.0, 1892.0, 1893.0, 1894.0, 1895.0, 1896.0, 1897.0, 1898.0, 1899.0, 1900.0, 1901.0, 1902.0, 1903.0, 1904.0, 1905.0, 1906.0, 1907.0, 1908.0, 1909.0, 1910.0, 1911.0, 1912.0, 1913.0, 1914.0, 1915.0, 1916.0, 1917.0, 1918.0, 1919.0, 1920.0, 1921.0, 1922.0, 1923.0, 1924.0, 1925.0, 1926.0, 1927.0, 1928.0, 1929.0, 1930.0, 1931.0, 1932.0, 1933.0, 1934.0, 1935.0, 1936.0, 1937.0, 1938.0, 1939.0, 1940.0, 1941.0, 1942.0, 1943.0, 1944.0, 1945.0, 1946.0, 1947.0, 1948.0, 1949.0, 1950.0, 1951.0, 1952.0, 1953.0, 1954.0, 1955.0, 1956.0, 1957.0, 1958.0, 1959.0, 1960.0, 1961.0, 1962.0, 1963.0, 1964.0, 1965.0, 1966.0, 1967.0, 1968.0, 1969.0, 1970.0, 1971.0, 1972.0, 1973.0, 1974.0, 1975.0, 1976.0, 1977.0, 1978.0, 1979.0, 1980.0, 1981.0, 1982.0, 1983.0, 1984.0, 1985.0, 1986.0, 1987.0, 1988.0, 1989.0, 1990.0, 1991.0, 1992.0, 1993.0, 1994.0, 1995.0, 1996.0, 1997.0, 1998.0, 1999.0, 2000.0, 2001.0, 2002.0, 2003.0, 2004.0, 2005.0, 2006.0, 2007.0, 2008.0, 2009.0, 2010.0, 2011.0, 2012.0, 2013.0, 2014.0, 2015.0, 2016.0, 2017.0, 2018.0, 2019.0, 2020.0, 2021.0, 2022.0, 2023.0, 2024.0, 2025.0, 2026.0, 2027.0, 2028.0, 2029.0, 2030.0, 2031.0, 2032.0, 2033.0, 2034.0, 2035.0, 2036.0, 2037.0, 2038.0, 2039.0, 2040.0, 2041.0, 2042.0, 2043.0, 2044.0, 2045.0, 2046.0, 2047.0, 0.0 }; const double NOD_data[] = { 1.0, 2.0, 4.0, 8.0, 0.0 }; const double NODIV_data[] = { 1.0, 2.0, 4.0, 0.0 };
the_stack_data/206392410.c
/* ** my_str_isnum.c for my_str_isnum.c in /home/cedric/delivery/CPool_Day06 ** ** Made by Cédric Thomas ** Login <[email protected]> ** ** Started on Mon Oct 10 17:24:58 2016 Cédric Thomas ** Last update Mon Oct 10 18:08:42 2016 Cédric Thomas */ #include <stdlib.h> int my_str_isnum(char *str) { int i; int bool; i = 0; bool = 1; if (str == NULL) return (0); while (str[i] != 0) { if (str[i] < '0' || str[i] > '9') bool = 0; i += 1; } return (bool); }
the_stack_data/18889091.c
#include <unistd.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <sys/wait.h> #include <time.h> #include <sys/types.h> #include <fcntl.h> int first_child_pid; int main() { printf("startowy pid: %d\n", getpid()); printf("liczba kudosow startowego: 0\n"); switch (first_child_pid = fork()) { case 0: first_child_pid = getpid(); printf("pid dziecka: %d\n", first_child_pid); usleep(60000); return 0; default: usleep(1000); printf("pid dziecka w rodzicu: %d\n", first_child_pid); printf("probuje dac kudosy swojemu dziecku: nie powinno sie udac (moj pid: %d)\n", getpid()); givekudos(first_child_pid); printf("nie udalo sie? sprawdz! (moj pid: %d)\n", getpid()); break; } switch (fork()) { case 0: usleep(1000); printf("pid dziecka w rodzicu: %d\n", first_child_pid); printf("probuje dac kudosy swojemu kuzynowi: powinno sie udac (moj pid: %d)\n", getpid()); givekudos(first_child_pid); printf("udalo sie? sprawdz! (moj pid: %d)\n", getpid()); break; default: usleep(1000); wait(0); break; } return 0; }
the_stack_data/57456.c
/* Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Zack Weinberg <[email protected]>, 1998. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <paths.h> #include <stdlib.h> #include <string.h> #include <unistd.h> /* Unlock the slave pseudo terminal associated with the master pseudo terminal specified by FD. */ int unlockpt (int fd) { char buf[sizeof (_PATH_TTY) + 2]; /* BSD doesn't have a lock, but it does have `revoke'. */ if (__ptsname_r (fd, buf, sizeof (buf))) return -1; return revoke (buf); }
the_stack_data/70310.c
/** * Updated Kernels directive code with better data transfer */ #include <math.h> #include <stdio.h> #include <stdlib.h> // Number of rows and columns in our matrix static const int NUM_ELEMENTS = 2000; // Maximum number of iterations before quiting static const int MAX_ITER = 10000; // Error tolerance for iteration static const float MAX_ERROR = 0.01; // Seed for random number generator static const int SEED = 12345; int main (int argc, char** argv) { // Initialize random number generator srand (SEED); // Create array to calculate on float array[NUM_ELEMENTS][NUM_ELEMENTS]; // Fill array with data for (int i = 0; i < NUM_ELEMENTS; i++) { for (int j = 0; j < NUM_ELEMENTS; j++) { // The following will create random values between [0, 1] array[i][j] = (float) rand () / (float) RAND_MAX; } } // Before starting calculation we will define a few helper variables float arr_new[NUM_ELEMENTS][NUM_ELEMENTS]; float error = __FLT_MAX__; int iterations = 0; // Perform Jacobi iterations until we either have low enough error or too // many iterations #pragma acc data copy(array, arr_new) while (error > MAX_ERROR && iterations < MAX_ITER) { error = 0.; #pragma acc kernels { // For each element take the average of the surrounding elements for (int i = 1; i < NUM_ELEMENTS - 1; i++) { for (int j = 1; j < NUM_ELEMENTS - 1; j++) { arr_new[i][j] = 0.25 * (array[i][j + 1] + array[i][j - 1] + array[i - 1][j] + array[i + 1][j]); error = fmaxf (error, fabsf (arr_new[i][j] - array[i][j])); } } // Transfer new array to old for (int i = 1; i < NUM_ELEMENTS - 1; i++) { for (int j = 1; j < NUM_ELEMENTS - 1; j++) { array[i][j] = arr_new[i][j]; } } } iterations += 1; } return EXIT_SUCCESS; }
the_stack_data/964608.c
//@ ltl invariant negative: ((X AP(x_5 - x_1 > 17)) U (X AP(x_6 - x_1 >= -2))); float x_0; float x_1; float x_2; float x_3; float x_4; float x_5; float x_6; float x_7; float x_8; float x_9; float x_10; float x_11; float x_12; float x_13; float x_14; float x_15; int main() { float x_0_; float x_1_; float x_2_; float x_3_; float x_4_; float x_5_; float x_6_; float x_7_; float x_8_; float x_9_; float x_10_; float x_11_; float x_12_; float x_13_; float x_14_; float x_15_; while(1) { x_0_ = ((((13.0 + x_0) > (18.0 + x_1)? (13.0 + x_0) : (18.0 + x_1)) > ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))? ((13.0 + x_0) > (18.0 + x_1)? (13.0 + x_0) : (18.0 + x_1)) : ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))) > (((3.0 + x_8) > (20.0 + x_9)? (3.0 + x_8) : (20.0 + x_9)) > ((12.0 + x_11) > (3.0 + x_14)? (12.0 + x_11) : (3.0 + x_14))? ((3.0 + x_8) > (20.0 + x_9)? (3.0 + x_8) : (20.0 + x_9)) : ((12.0 + x_11) > (3.0 + x_14)? (12.0 + x_11) : (3.0 + x_14)))? (((13.0 + x_0) > (18.0 + x_1)? (13.0 + x_0) : (18.0 + x_1)) > ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))? ((13.0 + x_0) > (18.0 + x_1)? (13.0 + x_0) : (18.0 + x_1)) : ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))) : (((3.0 + x_8) > (20.0 + x_9)? (3.0 + x_8) : (20.0 + x_9)) > ((12.0 + x_11) > (3.0 + x_14)? (12.0 + x_11) : (3.0 + x_14))? ((3.0 + x_8) > (20.0 + x_9)? (3.0 + x_8) : (20.0 + x_9)) : ((12.0 + x_11) > (3.0 + x_14)? (12.0 + x_11) : (3.0 + x_14)))); x_1_ = ((((18.0 + x_0) > (10.0 + x_1)? (18.0 + x_0) : (10.0 + x_1)) > ((9.0 + x_2) > (15.0 + x_3)? (9.0 + x_2) : (15.0 + x_3))? ((18.0 + x_0) > (10.0 + x_1)? (18.0 + x_0) : (10.0 + x_1)) : ((9.0 + x_2) > (15.0 + x_3)? (9.0 + x_2) : (15.0 + x_3))) > (((12.0 + x_5) > (13.0 + x_9)? (12.0 + x_5) : (13.0 + x_9)) > ((11.0 + x_11) > (13.0 + x_12)? (11.0 + x_11) : (13.0 + x_12))? ((12.0 + x_5) > (13.0 + x_9)? (12.0 + x_5) : (13.0 + x_9)) : ((11.0 + x_11) > (13.0 + x_12)? (11.0 + x_11) : (13.0 + x_12)))? (((18.0 + x_0) > (10.0 + x_1)? (18.0 + x_0) : (10.0 + x_1)) > ((9.0 + x_2) > (15.0 + x_3)? (9.0 + x_2) : (15.0 + x_3))? ((18.0 + x_0) > (10.0 + x_1)? (18.0 + x_0) : (10.0 + x_1)) : ((9.0 + x_2) > (15.0 + x_3)? (9.0 + x_2) : (15.0 + x_3))) : (((12.0 + x_5) > (13.0 + x_9)? (12.0 + x_5) : (13.0 + x_9)) > ((11.0 + x_11) > (13.0 + x_12)? (11.0 + x_11) : (13.0 + x_12))? ((12.0 + x_5) > (13.0 + x_9)? (12.0 + x_5) : (13.0 + x_9)) : ((11.0 + x_11) > (13.0 + x_12)? (11.0 + x_11) : (13.0 + x_12)))); x_2_ = ((((18.0 + x_0) > (4.0 + x_3)? (18.0 + x_0) : (4.0 + x_3)) > ((5.0 + x_6) > (20.0 + x_7)? (5.0 + x_6) : (20.0 + x_7))? ((18.0 + x_0) > (4.0 + x_3)? (18.0 + x_0) : (4.0 + x_3)) : ((5.0 + x_6) > (20.0 + x_7)? (5.0 + x_6) : (20.0 + x_7))) > (((10.0 + x_9) > (15.0 + x_12)? (10.0 + x_9) : (15.0 + x_12)) > ((15.0 + x_14) > (6.0 + x_15)? (15.0 + x_14) : (6.0 + x_15))? ((10.0 + x_9) > (15.0 + x_12)? (10.0 + x_9) : (15.0 + x_12)) : ((15.0 + x_14) > (6.0 + x_15)? (15.0 + x_14) : (6.0 + x_15)))? (((18.0 + x_0) > (4.0 + x_3)? (18.0 + x_0) : (4.0 + x_3)) > ((5.0 + x_6) > (20.0 + x_7)? (5.0 + x_6) : (20.0 + x_7))? ((18.0 + x_0) > (4.0 + x_3)? (18.0 + x_0) : (4.0 + x_3)) : ((5.0 + x_6) > (20.0 + x_7)? (5.0 + x_6) : (20.0 + x_7))) : (((10.0 + x_9) > (15.0 + x_12)? (10.0 + x_9) : (15.0 + x_12)) > ((15.0 + x_14) > (6.0 + x_15)? (15.0 + x_14) : (6.0 + x_15))? ((10.0 + x_9) > (15.0 + x_12)? (10.0 + x_9) : (15.0 + x_12)) : ((15.0 + x_14) > (6.0 + x_15)? (15.0 + x_14) : (6.0 + x_15)))); x_3_ = ((((20.0 + x_7) > (18.0 + x_8)? (20.0 + x_7) : (18.0 + x_8)) > ((5.0 + x_9) > (20.0 + x_11)? (5.0 + x_9) : (20.0 + x_11))? ((20.0 + x_7) > (18.0 + x_8)? (20.0 + x_7) : (18.0 + x_8)) : ((5.0 + x_9) > (20.0 + x_11)? (5.0 + x_9) : (20.0 + x_11))) > (((16.0 + x_12) > (7.0 + x_13)? (16.0 + x_12) : (7.0 + x_13)) > ((18.0 + x_14) > (1.0 + x_15)? (18.0 + x_14) : (1.0 + x_15))? ((16.0 + x_12) > (7.0 + x_13)? (16.0 + x_12) : (7.0 + x_13)) : ((18.0 + x_14) > (1.0 + x_15)? (18.0 + x_14) : (1.0 + x_15)))? (((20.0 + x_7) > (18.0 + x_8)? (20.0 + x_7) : (18.0 + x_8)) > ((5.0 + x_9) > (20.0 + x_11)? (5.0 + x_9) : (20.0 + x_11))? ((20.0 + x_7) > (18.0 + x_8)? (20.0 + x_7) : (18.0 + x_8)) : ((5.0 + x_9) > (20.0 + x_11)? (5.0 + x_9) : (20.0 + x_11))) : (((16.0 + x_12) > (7.0 + x_13)? (16.0 + x_12) : (7.0 + x_13)) > ((18.0 + x_14) > (1.0 + x_15)? (18.0 + x_14) : (1.0 + x_15))? ((16.0 + x_12) > (7.0 + x_13)? (16.0 + x_12) : (7.0 + x_13)) : ((18.0 + x_14) > (1.0 + x_15)? (18.0 + x_14) : (1.0 + x_15)))); x_4_ = ((((20.0 + x_0) > (8.0 + x_1)? (20.0 + x_0) : (8.0 + x_1)) > ((8.0 + x_2) > (20.0 + x_4)? (8.0 + x_2) : (20.0 + x_4))? ((20.0 + x_0) > (8.0 + x_1)? (20.0 + x_0) : (8.0 + x_1)) : ((8.0 + x_2) > (20.0 + x_4)? (8.0 + x_2) : (20.0 + x_4))) > (((7.0 + x_5) > (13.0 + x_8)? (7.0 + x_5) : (13.0 + x_8)) > ((14.0 + x_11) > (2.0 + x_15)? (14.0 + x_11) : (2.0 + x_15))? ((7.0 + x_5) > (13.0 + x_8)? (7.0 + x_5) : (13.0 + x_8)) : ((14.0 + x_11) > (2.0 + x_15)? (14.0 + x_11) : (2.0 + x_15)))? (((20.0 + x_0) > (8.0 + x_1)? (20.0 + x_0) : (8.0 + x_1)) > ((8.0 + x_2) > (20.0 + x_4)? (8.0 + x_2) : (20.0 + x_4))? ((20.0 + x_0) > (8.0 + x_1)? (20.0 + x_0) : (8.0 + x_1)) : ((8.0 + x_2) > (20.0 + x_4)? (8.0 + x_2) : (20.0 + x_4))) : (((7.0 + x_5) > (13.0 + x_8)? (7.0 + x_5) : (13.0 + x_8)) > ((14.0 + x_11) > (2.0 + x_15)? (14.0 + x_11) : (2.0 + x_15))? ((7.0 + x_5) > (13.0 + x_8)? (7.0 + x_5) : (13.0 + x_8)) : ((14.0 + x_11) > (2.0 + x_15)? (14.0 + x_11) : (2.0 + x_15)))); x_5_ = ((((13.0 + x_0) > (12.0 + x_1)? (13.0 + x_0) : (12.0 + x_1)) > ((16.0 + x_5) > (16.0 + x_6)? (16.0 + x_5) : (16.0 + x_6))? ((13.0 + x_0) > (12.0 + x_1)? (13.0 + x_0) : (12.0 + x_1)) : ((16.0 + x_5) > (16.0 + x_6)? (16.0 + x_5) : (16.0 + x_6))) > (((4.0 + x_8) > (17.0 + x_10)? (4.0 + x_8) : (17.0 + x_10)) > ((5.0 + x_11) > (16.0 + x_15)? (5.0 + x_11) : (16.0 + x_15))? ((4.0 + x_8) > (17.0 + x_10)? (4.0 + x_8) : (17.0 + x_10)) : ((5.0 + x_11) > (16.0 + x_15)? (5.0 + x_11) : (16.0 + x_15)))? (((13.0 + x_0) > (12.0 + x_1)? (13.0 + x_0) : (12.0 + x_1)) > ((16.0 + x_5) > (16.0 + x_6)? (16.0 + x_5) : (16.0 + x_6))? ((13.0 + x_0) > (12.0 + x_1)? (13.0 + x_0) : (12.0 + x_1)) : ((16.0 + x_5) > (16.0 + x_6)? (16.0 + x_5) : (16.0 + x_6))) : (((4.0 + x_8) > (17.0 + x_10)? (4.0 + x_8) : (17.0 + x_10)) > ((5.0 + x_11) > (16.0 + x_15)? (5.0 + x_11) : (16.0 + x_15))? ((4.0 + x_8) > (17.0 + x_10)? (4.0 + x_8) : (17.0 + x_10)) : ((5.0 + x_11) > (16.0 + x_15)? (5.0 + x_11) : (16.0 + x_15)))); x_6_ = ((((16.0 + x_0) > (7.0 + x_3)? (16.0 + x_0) : (7.0 + x_3)) > ((13.0 + x_4) > (20.0 + x_5)? (13.0 + x_4) : (20.0 + x_5))? ((16.0 + x_0) > (7.0 + x_3)? (16.0 + x_0) : (7.0 + x_3)) : ((13.0 + x_4) > (20.0 + x_5)? (13.0 + x_4) : (20.0 + x_5))) > (((4.0 + x_9) > (20.0 + x_10)? (4.0 + x_9) : (20.0 + x_10)) > ((10.0 + x_13) > (7.0 + x_15)? (10.0 + x_13) : (7.0 + x_15))? ((4.0 + x_9) > (20.0 + x_10)? (4.0 + x_9) : (20.0 + x_10)) : ((10.0 + x_13) > (7.0 + x_15)? (10.0 + x_13) : (7.0 + x_15)))? (((16.0 + x_0) > (7.0 + x_3)? (16.0 + x_0) : (7.0 + x_3)) > ((13.0 + x_4) > (20.0 + x_5)? (13.0 + x_4) : (20.0 + x_5))? ((16.0 + x_0) > (7.0 + x_3)? (16.0 + x_0) : (7.0 + x_3)) : ((13.0 + x_4) > (20.0 + x_5)? (13.0 + x_4) : (20.0 + x_5))) : (((4.0 + x_9) > (20.0 + x_10)? (4.0 + x_9) : (20.0 + x_10)) > ((10.0 + x_13) > (7.0 + x_15)? (10.0 + x_13) : (7.0 + x_15))? ((4.0 + x_9) > (20.0 + x_10)? (4.0 + x_9) : (20.0 + x_10)) : ((10.0 + x_13) > (7.0 + x_15)? (10.0 + x_13) : (7.0 + x_15)))); x_7_ = ((((13.0 + x_0) > (14.0 + x_2)? (13.0 + x_0) : (14.0 + x_2)) > ((18.0 + x_3) > (3.0 + x_5)? (18.0 + x_3) : (3.0 + x_5))? ((13.0 + x_0) > (14.0 + x_2)? (13.0 + x_0) : (14.0 + x_2)) : ((18.0 + x_3) > (3.0 + x_5)? (18.0 + x_3) : (3.0 + x_5))) > (((15.0 + x_7) > (9.0 + x_9)? (15.0 + x_7) : (9.0 + x_9)) > ((18.0 + x_14) > (5.0 + x_15)? (18.0 + x_14) : (5.0 + x_15))? ((15.0 + x_7) > (9.0 + x_9)? (15.0 + x_7) : (9.0 + x_9)) : ((18.0 + x_14) > (5.0 + x_15)? (18.0 + x_14) : (5.0 + x_15)))? (((13.0 + x_0) > (14.0 + x_2)? (13.0 + x_0) : (14.0 + x_2)) > ((18.0 + x_3) > (3.0 + x_5)? (18.0 + x_3) : (3.0 + x_5))? ((13.0 + x_0) > (14.0 + x_2)? (13.0 + x_0) : (14.0 + x_2)) : ((18.0 + x_3) > (3.0 + x_5)? (18.0 + x_3) : (3.0 + x_5))) : (((15.0 + x_7) > (9.0 + x_9)? (15.0 + x_7) : (9.0 + x_9)) > ((18.0 + x_14) > (5.0 + x_15)? (18.0 + x_14) : (5.0 + x_15))? ((15.0 + x_7) > (9.0 + x_9)? (15.0 + x_7) : (9.0 + x_9)) : ((18.0 + x_14) > (5.0 + x_15)? (18.0 + x_14) : (5.0 + x_15)))); x_8_ = ((((4.0 + x_1) > (9.0 + x_3)? (4.0 + x_1) : (9.0 + x_3)) > ((9.0 + x_6) > (4.0 + x_9)? (9.0 + x_6) : (4.0 + x_9))? ((4.0 + x_1) > (9.0 + x_3)? (4.0 + x_1) : (9.0 + x_3)) : ((9.0 + x_6) > (4.0 + x_9)? (9.0 + x_6) : (4.0 + x_9))) > (((2.0 + x_10) > (16.0 + x_12)? (2.0 + x_10) : (16.0 + x_12)) > ((4.0 + x_13) > (5.0 + x_15)? (4.0 + x_13) : (5.0 + x_15))? ((2.0 + x_10) > (16.0 + x_12)? (2.0 + x_10) : (16.0 + x_12)) : ((4.0 + x_13) > (5.0 + x_15)? (4.0 + x_13) : (5.0 + x_15)))? (((4.0 + x_1) > (9.0 + x_3)? (4.0 + x_1) : (9.0 + x_3)) > ((9.0 + x_6) > (4.0 + x_9)? (9.0 + x_6) : (4.0 + x_9))? ((4.0 + x_1) > (9.0 + x_3)? (4.0 + x_1) : (9.0 + x_3)) : ((9.0 + x_6) > (4.0 + x_9)? (9.0 + x_6) : (4.0 + x_9))) : (((2.0 + x_10) > (16.0 + x_12)? (2.0 + x_10) : (16.0 + x_12)) > ((4.0 + x_13) > (5.0 + x_15)? (4.0 + x_13) : (5.0 + x_15))? ((2.0 + x_10) > (16.0 + x_12)? (2.0 + x_10) : (16.0 + x_12)) : ((4.0 + x_13) > (5.0 + x_15)? (4.0 + x_13) : (5.0 + x_15)))); x_9_ = ((((19.0 + x_0) > (2.0 + x_4)? (19.0 + x_0) : (2.0 + x_4)) > ((1.0 + x_5) > (6.0 + x_6)? (1.0 + x_5) : (6.0 + x_6))? ((19.0 + x_0) > (2.0 + x_4)? (19.0 + x_0) : (2.0 + x_4)) : ((1.0 + x_5) > (6.0 + x_6)? (1.0 + x_5) : (6.0 + x_6))) > (((17.0 + x_7) > (10.0 + x_9)? (17.0 + x_7) : (10.0 + x_9)) > ((4.0 + x_10) > (9.0 + x_14)? (4.0 + x_10) : (9.0 + x_14))? ((17.0 + x_7) > (10.0 + x_9)? (17.0 + x_7) : (10.0 + x_9)) : ((4.0 + x_10) > (9.0 + x_14)? (4.0 + x_10) : (9.0 + x_14)))? (((19.0 + x_0) > (2.0 + x_4)? (19.0 + x_0) : (2.0 + x_4)) > ((1.0 + x_5) > (6.0 + x_6)? (1.0 + x_5) : (6.0 + x_6))? ((19.0 + x_0) > (2.0 + x_4)? (19.0 + x_0) : (2.0 + x_4)) : ((1.0 + x_5) > (6.0 + x_6)? (1.0 + x_5) : (6.0 + x_6))) : (((17.0 + x_7) > (10.0 + x_9)? (17.0 + x_7) : (10.0 + x_9)) > ((4.0 + x_10) > (9.0 + x_14)? (4.0 + x_10) : (9.0 + x_14))? ((17.0 + x_7) > (10.0 + x_9)? (17.0 + x_7) : (10.0 + x_9)) : ((4.0 + x_10) > (9.0 + x_14)? (4.0 + x_10) : (9.0 + x_14)))); x_10_ = ((((16.0 + x_0) > (18.0 + x_2)? (16.0 + x_0) : (18.0 + x_2)) > ((2.0 + x_3) > (15.0 + x_5)? (2.0 + x_3) : (15.0 + x_5))? ((16.0 + x_0) > (18.0 + x_2)? (16.0 + x_0) : (18.0 + x_2)) : ((2.0 + x_3) > (15.0 + x_5)? (2.0 + x_3) : (15.0 + x_5))) > (((1.0 + x_6) > (19.0 + x_8)? (1.0 + x_6) : (19.0 + x_8)) > ((5.0 + x_11) > (17.0 + x_14)? (5.0 + x_11) : (17.0 + x_14))? ((1.0 + x_6) > (19.0 + x_8)? (1.0 + x_6) : (19.0 + x_8)) : ((5.0 + x_11) > (17.0 + x_14)? (5.0 + x_11) : (17.0 + x_14)))? (((16.0 + x_0) > (18.0 + x_2)? (16.0 + x_0) : (18.0 + x_2)) > ((2.0 + x_3) > (15.0 + x_5)? (2.0 + x_3) : (15.0 + x_5))? ((16.0 + x_0) > (18.0 + x_2)? (16.0 + x_0) : (18.0 + x_2)) : ((2.0 + x_3) > (15.0 + x_5)? (2.0 + x_3) : (15.0 + x_5))) : (((1.0 + x_6) > (19.0 + x_8)? (1.0 + x_6) : (19.0 + x_8)) > ((5.0 + x_11) > (17.0 + x_14)? (5.0 + x_11) : (17.0 + x_14))? ((1.0 + x_6) > (19.0 + x_8)? (1.0 + x_6) : (19.0 + x_8)) : ((5.0 + x_11) > (17.0 + x_14)? (5.0 + x_11) : (17.0 + x_14)))); x_11_ = ((((15.0 + x_1) > (2.0 + x_2)? (15.0 + x_1) : (2.0 + x_2)) > ((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6))? ((15.0 + x_1) > (2.0 + x_2)? (15.0 + x_1) : (2.0 + x_2)) : ((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6))) > (((11.0 + x_8) > (1.0 + x_9)? (11.0 + x_8) : (1.0 + x_9)) > ((10.0 + x_11) > (19.0 + x_13)? (10.0 + x_11) : (19.0 + x_13))? ((11.0 + x_8) > (1.0 + x_9)? (11.0 + x_8) : (1.0 + x_9)) : ((10.0 + x_11) > (19.0 + x_13)? (10.0 + x_11) : (19.0 + x_13)))? (((15.0 + x_1) > (2.0 + x_2)? (15.0 + x_1) : (2.0 + x_2)) > ((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6))? ((15.0 + x_1) > (2.0 + x_2)? (15.0 + x_1) : (2.0 + x_2)) : ((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6))) : (((11.0 + x_8) > (1.0 + x_9)? (11.0 + x_8) : (1.0 + x_9)) > ((10.0 + x_11) > (19.0 + x_13)? (10.0 + x_11) : (19.0 + x_13))? ((11.0 + x_8) > (1.0 + x_9)? (11.0 + x_8) : (1.0 + x_9)) : ((10.0 + x_11) > (19.0 + x_13)? (10.0 + x_11) : (19.0 + x_13)))); x_12_ = ((((5.0 + x_0) > (18.0 + x_1)? (5.0 + x_0) : (18.0 + x_1)) > ((5.0 + x_4) > (5.0 + x_8)? (5.0 + x_4) : (5.0 + x_8))? ((5.0 + x_0) > (18.0 + x_1)? (5.0 + x_0) : (18.0 + x_1)) : ((5.0 + x_4) > (5.0 + x_8)? (5.0 + x_4) : (5.0 + x_8))) > (((11.0 + x_10) > (3.0 + x_12)? (11.0 + x_10) : (3.0 + x_12)) > ((15.0 + x_14) > (12.0 + x_15)? (15.0 + x_14) : (12.0 + x_15))? ((11.0 + x_10) > (3.0 + x_12)? (11.0 + x_10) : (3.0 + x_12)) : ((15.0 + x_14) > (12.0 + x_15)? (15.0 + x_14) : (12.0 + x_15)))? (((5.0 + x_0) > (18.0 + x_1)? (5.0 + x_0) : (18.0 + x_1)) > ((5.0 + x_4) > (5.0 + x_8)? (5.0 + x_4) : (5.0 + x_8))? ((5.0 + x_0) > (18.0 + x_1)? (5.0 + x_0) : (18.0 + x_1)) : ((5.0 + x_4) > (5.0 + x_8)? (5.0 + x_4) : (5.0 + x_8))) : (((11.0 + x_10) > (3.0 + x_12)? (11.0 + x_10) : (3.0 + x_12)) > ((15.0 + x_14) > (12.0 + x_15)? (15.0 + x_14) : (12.0 + x_15))? ((11.0 + x_10) > (3.0 + x_12)? (11.0 + x_10) : (3.0 + x_12)) : ((15.0 + x_14) > (12.0 + x_15)? (15.0 + x_14) : (12.0 + x_15)))); x_13_ = ((((3.0 + x_0) > (18.0 + x_1)? (3.0 + x_0) : (18.0 + x_1)) > ((1.0 + x_7) > (14.0 + x_8)? (1.0 + x_7) : (14.0 + x_8))? ((3.0 + x_0) > (18.0 + x_1)? (3.0 + x_0) : (18.0 + x_1)) : ((1.0 + x_7) > (14.0 + x_8)? (1.0 + x_7) : (14.0 + x_8))) > (((15.0 + x_10) > (15.0 + x_11)? (15.0 + x_10) : (15.0 + x_11)) > ((8.0 + x_12) > (8.0 + x_14)? (8.0 + x_12) : (8.0 + x_14))? ((15.0 + x_10) > (15.0 + x_11)? (15.0 + x_10) : (15.0 + x_11)) : ((8.0 + x_12) > (8.0 + x_14)? (8.0 + x_12) : (8.0 + x_14)))? (((3.0 + x_0) > (18.0 + x_1)? (3.0 + x_0) : (18.0 + x_1)) > ((1.0 + x_7) > (14.0 + x_8)? (1.0 + x_7) : (14.0 + x_8))? ((3.0 + x_0) > (18.0 + x_1)? (3.0 + x_0) : (18.0 + x_1)) : ((1.0 + x_7) > (14.0 + x_8)? (1.0 + x_7) : (14.0 + x_8))) : (((15.0 + x_10) > (15.0 + x_11)? (15.0 + x_10) : (15.0 + x_11)) > ((8.0 + x_12) > (8.0 + x_14)? (8.0 + x_12) : (8.0 + x_14))? ((15.0 + x_10) > (15.0 + x_11)? (15.0 + x_10) : (15.0 + x_11)) : ((8.0 + x_12) > (8.0 + x_14)? (8.0 + x_12) : (8.0 + x_14)))); x_14_ = ((((12.0 + x_1) > (13.0 + x_2)? (12.0 + x_1) : (13.0 + x_2)) > ((2.0 + x_3) > (2.0 + x_4)? (2.0 + x_3) : (2.0 + x_4))? ((12.0 + x_1) > (13.0 + x_2)? (12.0 + x_1) : (13.0 + x_2)) : ((2.0 + x_3) > (2.0 + x_4)? (2.0 + x_3) : (2.0 + x_4))) > (((19.0 + x_5) > (19.0 + x_11)? (19.0 + x_5) : (19.0 + x_11)) > ((3.0 + x_13) > (19.0 + x_14)? (3.0 + x_13) : (19.0 + x_14))? ((19.0 + x_5) > (19.0 + x_11)? (19.0 + x_5) : (19.0 + x_11)) : ((3.0 + x_13) > (19.0 + x_14)? (3.0 + x_13) : (19.0 + x_14)))? (((12.0 + x_1) > (13.0 + x_2)? (12.0 + x_1) : (13.0 + x_2)) > ((2.0 + x_3) > (2.0 + x_4)? (2.0 + x_3) : (2.0 + x_4))? ((12.0 + x_1) > (13.0 + x_2)? (12.0 + x_1) : (13.0 + x_2)) : ((2.0 + x_3) > (2.0 + x_4)? (2.0 + x_3) : (2.0 + x_4))) : (((19.0 + x_5) > (19.0 + x_11)? (19.0 + x_5) : (19.0 + x_11)) > ((3.0 + x_13) > (19.0 + x_14)? (3.0 + x_13) : (19.0 + x_14))? ((19.0 + x_5) > (19.0 + x_11)? (19.0 + x_5) : (19.0 + x_11)) : ((3.0 + x_13) > (19.0 + x_14)? (3.0 + x_13) : (19.0 + x_14)))); x_15_ = ((((5.0 + x_0) > (16.0 + x_2)? (5.0 + x_0) : (16.0 + x_2)) > ((15.0 + x_5) > (8.0 + x_6)? (15.0 + x_5) : (8.0 + x_6))? ((5.0 + x_0) > (16.0 + x_2)? (5.0 + x_0) : (16.0 + x_2)) : ((15.0 + x_5) > (8.0 + x_6)? (15.0 + x_5) : (8.0 + x_6))) > (((18.0 + x_7) > (11.0 + x_8)? (18.0 + x_7) : (11.0 + x_8)) > ((6.0 + x_12) > (16.0 + x_15)? (6.0 + x_12) : (16.0 + x_15))? ((18.0 + x_7) > (11.0 + x_8)? (18.0 + x_7) : (11.0 + x_8)) : ((6.0 + x_12) > (16.0 + x_15)? (6.0 + x_12) : (16.0 + x_15)))? (((5.0 + x_0) > (16.0 + x_2)? (5.0 + x_0) : (16.0 + x_2)) > ((15.0 + x_5) > (8.0 + x_6)? (15.0 + x_5) : (8.0 + x_6))? ((5.0 + x_0) > (16.0 + x_2)? (5.0 + x_0) : (16.0 + x_2)) : ((15.0 + x_5) > (8.0 + x_6)? (15.0 + x_5) : (8.0 + x_6))) : (((18.0 + x_7) > (11.0 + x_8)? (18.0 + x_7) : (11.0 + x_8)) > ((6.0 + x_12) > (16.0 + x_15)? (6.0 + x_12) : (16.0 + x_15))? ((18.0 + x_7) > (11.0 + x_8)? (18.0 + x_7) : (11.0 + x_8)) : ((6.0 + x_12) > (16.0 + x_15)? (6.0 + x_12) : (16.0 + x_15)))); x_0 = x_0_; x_1 = x_1_; x_2 = x_2_; x_3 = x_3_; x_4 = x_4_; x_5 = x_5_; x_6 = x_6_; x_7 = x_7_; x_8 = x_8_; x_9 = x_9_; x_10 = x_10_; x_11 = x_11_; x_12 = x_12_; x_13 = x_13_; x_14 = x_14_; x_15 = x_15_; } return 0; }
the_stack_data/266.c
/** </> Single LinkedList Deletion </> 1. Delete from beginning 2. Delete from end 3. Delete from specific position */ #include<stdio.h> #include<stdlib.h> struct node { int data; struct node *next; }; struct node *head, *newnode, *temp; // function prototype call void insertNewNode(); void deleteAtBeg(); void deleteAtEnd(); void deleteAtSpecificPoss(); void traverseElements(); int main() { // STEP-1: insert new node insertNewNode(); traverseElements(); // STEP-2: delete node any position int count=1; while(count) { int pos; printf("Please enter position when you delete node? If delete beginning enter: 1, Delete end enter: 2, Delete at specific position enter: 3 or No delete to exit enter: 0 \n\t Enter decision: "); scanf("%d", &pos); if(pos == 1) { deleteAtBeg(); printf("Do you delete more node? Enter: 1 or Exit enter: 0 \n\t Enter decision: "); scanf("%d", &count); if(count == 0) { break; } } else if(pos == 2) { deleteAtEnd(); printf("Do you delete more node? Enter: 1 or Exit enter: 0 \n\t Enter decision: "); scanf("%d", &count); if(count == 0) { break; } } else if(pos == 3) { deleteAtSpecificPoss(); printf("Do you delete more node? Enter: 1 or Exit enter: 0 \n\t Enter decision: "); scanf("%d", &count); if(count == 0) { break; } } else { printf("\n Something went wrong! Program terminate !!!"); break; } } /// printing / traverse LinkedList elements traverseElements(); return 0; } // delete element in single LinkedList at beginning void deleteAtBeg() { printf("\n ===> Delete At Beginning <=== \n"); temp = head; head = head ->next; free(temp); } // delete element in single LinkedList at end void deleteAtEnd() { printf("\n ===> Delete At End <=== \n"); struct node *prevnode; temp = head; while(temp -> next != 0) { prevnode = temp; temp = temp ->next; } if(temp == head) { head = 0; } else { prevnode = 0; free(temp); } } // delete element in single LinkedList at specific position void deleteAtSpecificPoss() { printf("\n ===> Delete At Specific Position <=== \n"); struct node *nextnode; int pos, i=1; temp = head; printf("Please enter position when you delete node: "); scanf("%d", &pos); while(i < pos-1) { temp = temp ->next; i++; } nextnode = temp ->next; temp ->next = nextnode ->next; free(nextnode); } // create a insertNewNode() function to insert elements on linkedList void insertNewNode() { printf("\n ===> Insert New Node <=== \n"); head=0; int chose=1, count=0; /// here 'count' is size of linkedList while(chose) { newnode = (struct node*)malloc(sizeof(struct node)); printf("Enter elements of linkedList: "); scanf("%d", &newnode -> data); newnode -> next = 0; if (head == 0) { head = temp = newnode; } else { temp -> next = newnode; temp = newnode; } printf("\nDo you continue add elements to linkedList? \n\t(If exit enter: 0 or Enter: 1): "); scanf("%d", &chose); if (chose == 0) { break; } } } // traverse / print elements of linkedList void traverseElements() { int count=0; // traverse / print elements of linkedList temp = head; while (temp != 0) { printf("\n\t Linked elements of [%d] = %d", count+1, temp -> data); temp = temp -> next; count ++; } printf("\n"); }
the_stack_data/18888319.c
#include <stdio.h> #include <stdlib.h> int wcount(char *s) { unsigned int i, k = 0, f = 0; if (strlen(s)==0) return k; if (strlen(s)==1) return 1; for (i=0;i<strlen(s)-1;i++){ if ((s[i]!=' ') && (f==0)){ k++; f = 1; } if ((s[i]==' ')&&(f==1)) f = 0; } return k; } int main() { char s[100]; gets(s); printf("%d", wcount(s)); return 0; }
the_stack_data/36075820.c
// // AOJ0506.c // // // Created by n_knuu on 2014/03/19. // // #include <stdio.h> #include <string.h> int main(void) { int num,i,j,count; char digit[100000],now,new[100000],temp[100000]; while (scanf("%d\n",&num)!=EOF&&num) { scanf("%s\n",digit); for (i=0; i<num; i++) { memset(new,'\0',sizeof(new)); for (j=0; j<strlen(digit); j++) { if (j==0) { now=digit[0]; count=1; } else { if (digit[j]!=now) { sprintf(temp,"%d%c",count,now); strcat(new,temp); now=digit[j]; count=1; } else { count++; } } } sprintf(temp,"%d%c",count,now); strcat(new,temp); strcpy(digit,new); } printf("%s\n",digit); } return 0; }
the_stack_data/176707028.c
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #define MARK_START_TIME \ struct timeval tv_start, tv_stop; \ gettimeofday(&tv_start, NULL); #define MARK_STOP_TIME \ gettimeofday(&tv_stop, NULL); \ if (tv_stop.tv_usec < tv_start.tv_usec) \ { \ tv_stop.tv_usec += 1000*1000; \ tv_stop.tv_sec--; \ } \ \ printf("Count[%d] Elapsed[%ld.%ld]\n", \ times, \ tv_stop.tv_sec - tv_start.tv_sec, \ tv_stop.tv_usec - tv_start.tv_usec); int test1(int times) { MARK_START_TIME; int i = times; while(i--) { pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&mutex); pthread_mutex_unlock(&mutex); } MARK_STOP_TIME; } struct test2_data{ pthread_mutex_t *mutex; int times; }; void *test2_loop(void *arg) { MARK_START_TIME; struct test2_data *data = (struct test2_data *)arg; pthread_mutex_t *mutex = data->mutex; int times = data->times; int i = times; while(i--) { pthread_mutex_lock(mutex); pthread_mutex_unlock(mutex); } MARK_STOP_TIME; } int test2(int times) { printf("start test2\n"); struct test2_data data; data.mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); data.times = times; pthread_mutex_init(data.mutex, NULL); pthread_attr_t attr; pthread_attr_init(&attr); pthread_t tid1, tid2; pthread_create(&tid1, &attr, test2_loop, &data); pthread_create(&tid2, &attr, test2_loop, &data); pthread_attr_destroy(&attr); pthread_join(tid1, NULL); pthread_join(tid2, NULL); printf("stop test2\n"); return 0; } struct test3_data { pthread_mutex_t *mutex; pthread_cond_t *cond1; pthread_cond_t *cond2; int times; }; void *test3_loop1(void *arg) { printf("start test3_loop1\n"); MARK_START_TIME; struct test3_data *data = (struct test3_data *)arg; pthread_mutex_t *mutex = data->mutex; pthread_cond_t *cond1 = data->cond1; pthread_cond_t *cond2 = data->cond2; int times = data->times; int i = times; while(i--) { if (i < 3) { pthread_cond_signal(cond1); printf("loop1[%d]\n", i); break; } pthread_mutex_lock(mutex); pthread_cond_signal(cond1); pthread_cond_wait(cond2, mutex); pthread_mutex_unlock(mutex); } MARK_STOP_TIME; printf("stop test3_loop1\n"); } void *test3_loop2(void *arg) { printf("start test3_loop2\n"); MARK_START_TIME; struct test3_data *data = (struct test3_data *)arg; pthread_mutex_t *mutex = data->mutex; pthread_cond_t *cond1 = data->cond1; pthread_cond_t *cond2 = data->cond2; int times = data->times; int i = times; while(i--) { if (i < 3) { pthread_cond_signal(cond2); printf("loop2[%d]\n", i); break; } pthread_mutex_lock(mutex); pthread_cond_signal(cond2); pthread_cond_wait(cond1, mutex); pthread_mutex_unlock(mutex); } MARK_STOP_TIME; printf("stop test3_loop2\n"); } int test3(int times) { printf("test3 starting\n"); struct test3_data data; data.mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); data.cond1 = (pthread_cond_t *)malloc(sizeof(pthread_cond_t)); data.cond2 = (pthread_cond_t *)malloc(sizeof(pthread_cond_t)); data.times = times; pthread_mutex_init(data.mutex, NULL); pthread_cond_init(data.cond1, NULL); pthread_cond_init(data.cond2, NULL); pthread_attr_t attr; pthread_attr_init(&attr); pthread_t tid1, tid2; pthread_create(&tid1, &attr, test3_loop1, &data); pthread_create(&tid2, &attr, test3_loop2, &data); pthread_attr_destroy(&attr); pthread_join(tid1, NULL); pthread_join(tid2, NULL); printf("test3 stopped\n"); } struct test4_data { pthread_mutex_t *mutex; int times; }; void *test4_loop(void *arg) { MARK_START_TIME; struct test4_data *data = arg; int times = data->times; int i = data->times; while(i--) { pthread_mutex_lock(data->mutex); pthread_mutex_unlock(data->mutex); } MARK_STOP_TIME; return NULL; } int test4(int times, int threads) { printf("test4 starting\n"); pthread_t *tids = (pthread_t *)malloc(sizeof(pthread_t*) * threads); struct test4_data data; data.mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); data.times = times; pthread_mutex_init(data.mutex, NULL); pthread_attr_t attr; pthread_attr_init(&attr); int i = 0; for (i = 0; i < threads; i++) { pthread_create(tids + i, &attr, test4_loop, (void *) &data); } for (i = 0; i < threads; i++) { pthread_join(tids[i], NULL); } printf("test4 stopped\n"); } int main() { test1(1000*1000); // test1(1000*1000*100); test2(1000*1000); test3(1000*1000); test4(1000*1000, 1000); }
the_stack_data/206393798.c
/* * * * * * * * * * * * * * * * The MIT License * * * * * * * * * * * * * * * *\ |* Copyright (c) 2014, Joseph Dykstra *| |* *| |* Permission is hereby granted, free of charge, to any person obtaining a copy *| |* of this software and associated documentation files (the "Software"), to deal *| |* in the Software without restriction, including without limitation the rights *| |* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *| |* copies of the Software, and to permit persons to whom the Software is *| |* furnished to do so, subject to the following conditions: *| |* The above copyright notice and this permission notice shall be included in *| |* all copies or substantial portions of the Software. *| |* *| |* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *| |* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *| |* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *| |* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *| |* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *| |* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN *| |* THE SOFTWARE. *| \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ //This is the file for definitions that should be modified for each robot //Sensor values (these could be replaced with variables that are updated periodically.) #define CURRENT_GYRO SensorValue[GYRO] #define CURRENT_LEFT_ENC SensorValue[QUAD_LEFT] #define CURRENT_RIGHT_ENC SensorValue[QUAD_RIGHT] #define CURRENT_LIFT_HEIGHT SensorValue[POT_LIFT] #define CURRENT_LINE_FOLLOWER SensorValue[LINE_FOLLOWER] //Proportional Constants #define LIFT_P (float)0.45 #define LINE_P (float)0.022 #define WALL_P (float)0.1 #define ENC_DRV_P (float)0.3 #define ENC_STRF_P (float)2.0 #define US_STRF_P (float)8.0 #define GYRO_P (float)0.45 #define GYRO_STRF_P (float)1.0 //Slew rates; smaller = more gradual #define DRIVE_SLEW_RATE 5 //3/8 sec (if LOOP_TIME_MS==15, because 15 * 127 / 5 = ~380ms = ~3/8sec) #define LIFT_SLEW_RATE 5 //3/8 sec (if LOOP_TIME_MS==15, because 15 * 127 / 5 = ~380ms = ~3/8sec) #define INTAKE_SLEW_RATE 10 //3/16 sec (if LOOP_TIME_MS==15, because 15 * 127 / 10 = ~190ms = ~3/16sec) //Other #define LOOP_TIME_MS 15 //17 ms interval between motor updates I think #define LINE_TARGET 2000 //Line follower target #define FOLLOW 100 //Line following target speed #define STRAFE //Comment out to disable strafing //#define H_DRIVE //Comment out to use mecanum or x-drive instead of an h-drive //Preset lift heights typedef enum { GROUND = 430, LOW_POST = 1605, MED_POST = 2750, HIGH_POST = 3920 } T_PRESETS;
the_stack_data/1040801.c
#include <stdio.h> #define TF 50 int main(){ int num, vet1[TF], vet2[TF], i, j, pos, TL1 = 0, TL2 = 0; scanf("%d",&num); while(TL1 < TF && num != 0){ vet1[TL1] = num; TL1++; if(TL1 < TF) scanf("%d",&num); } printf("\n"); for(i = 0; i < TL1; i++) printf("[%d]", vet1[i]); printf("\n"); for(i = 0, j = TL1-1; TL2 < TL1; TL2++){ if (vet1[TL2] > 0){ vet2[j] = vet1[TL2]; j--; } else{ vet2[i] = vet1[TL2]; i++; } } printf("\n"); for(i = 0; i < TL2; i++) printf("[%d]",vet2[i]); return 0; }
the_stack_data/75138346.c
int main(void) { int a = 1 + (2 - 3); return 0; }
the_stack_data/592514.c
// // Created by zhangrongxiang on 2017/10/17 16:26 // File inotify //
the_stack_data/733188.c
void dgemm(const int M,const int N,const int K,const double alpha,const double *A,const int lda,const double *B,const int ldb,const double beta,double *C,const int ldc) { int i; int j; int l; /*@; BEGIN(nest1=MM_pat[type="double";pre_compute=("A","alpha"*"A")]) @*/ for (j = 0; j <= -1 + N; j += 1) { for (i = 0; i <= -1 + M; i += 1) { C[(j * ldc) + i] = (beta * C[(j * ldc) + i]); for (l = 0; l <= -1 + K; l += 1) { C[(j * ldc) + i] = (C[(j * ldc) + i] + ((alpha * A[(l * lda) + i]) * B[(j * ldb) + l])); } } } }
the_stack_data/45449699.c
/* CHALLENGE 4 display your name Task: Use a cstring variable to hold your name. Print your name to the terminal using printf and a formatted string; Print the address of the cstring that is holding your name Example: char* favoriteColor = "blue"; printf("my favorite color is %s\n", favoriteColor); printf("my pointer's address is %p\n", favoriteColor); Note: The char* type is a pointer to a character. It can also point to an array of characters (c string) Use %s to format a char* as a string Use %p to format a char* as a pointer (memory address) $ gcc challenge_4.c && ./a.out */ #include <stdio.h> int main() { // Edit code below v v // Edit code above ^ ^ return 0; }
the_stack_data/132954247.c
#ifdef ZFP_WITH_CUDA #include <math.h> #define PREPEND_CUDA(x) Cuda_ ## x #define DESCRIPTOR_INTERMEDIATE(x) PREPEND_CUDA(x) #define DESCRIPTOR DESCRIPTOR_INTERMEDIATE(DIM_INT_STR) #define ZFP_TEST_CUDA #include "zfpEndtoendBase.c" // cuda entry functions static void _catFunc3(given_, DESCRIPTOR, ReversedArray_when_ZfpCompressDecompressFixedRate_expect_BitstreamAndArrayChecksumsMatch)(void **state) { struct setupVars *bundle = *state; if (bundle->stride != REVERSED) { fail_msg("Invalid stride during test"); } runCompressDecompressTests(state, zfp_mode_fixed_rate, 1); } static void _catFunc3(given_, DESCRIPTOR, PermutedArray_when_ZfpCompressDecompressFixedRate_expect_BitstreamAndArrayChecksumsMatch)(void **state) { struct setupVars *bundle = *state; if (bundle->stride != PERMUTED) { fail_msg("Invalid stride during test"); } runCompressDecompressTests(state, zfp_mode_fixed_rate, 1); } // returns 0 on success, 1 on test failure static int runZfpCompressDecompressIsNoop(void **state) { struct setupVars *bundle = *state; zfp_field* field = bundle->field; zfp_stream* stream = bundle->stream; bitstream* s = zfp_stream_bit_stream(stream); // grab bitstream member vars uint bits = s->bits; word buffer = s->buffer; word* ptr = s->ptr; size_t streamSize = stream_size(s); // perform compression, expect bitstream not to advance if (zfp_compress(stream, field) != streamSize) { printf("Compression advanced the bitstream when expected to be a no-op\n"); return 1; } // expect bitstream untouched if ((s->bits != bits) || (s->buffer != buffer) || (s->ptr != ptr) || (*s->ptr != *ptr)) { printf("Compression modified the bitstream when expected to be a no-op\n"); return 1; } // perform decompression, expect bitstream not to advance if (zfp_decompress(stream, field) != streamSize) { printf("Decompression advanced the bitstream when expected to be a no-op\n"); return 1; } // expect bitstream untouched if ((s->bits != bits) || (s->buffer != buffer) || (s->ptr != ptr) || (*s->ptr != *ptr)) { printf("Decompression modified the bitstream when expected to be a no-op\n"); return 1; } return 0; } static void runCompressDecompressNoopTest(void **state, zfp_mode mode) { struct setupVars *bundle = *state; if (setupCompressParam(bundle, mode, 1) == 1) { fail_msg("ERROR while setting zfp mode"); } if (runZfpCompressDecompressIsNoop(state) == 1) { fail_msg("Compression/Decompression no-op test failed"); } } static void _catFunc3(given_, DESCRIPTOR, InterleavedArray_when_ZfpCompressDecompressFixedRate_expect_BitstreamUntouchedAndReturnsZero)(void **state) { struct setupVars *bundle = *state; if (bundle->stride != INTERLEAVED) { fail_msg("Invalid stride during test"); } runCompressDecompressNoopTest(state, zfp_mode_fixed_rate); } static void _catFunc3(given_, DESCRIPTOR, Array_when_ZfpCompressDecompressFixedRate_expect_BitstreamAndArrayChecksumsMatch)(void **state) { runCompressDecompressTests(state, zfp_mode_fixed_rate, 3); } // cover all non=fixed-rate modes (except expert) static void _catFunc3(given_, DESCRIPTOR, Array_when_ZfpCompressDecompressNonFixedRate_expect_BitstreamUntouchedAndReturnsZero)(void **state) { struct setupVars *bundle = *state; // loop over fixed prec, fixed acc, reversible zfp_mode mode; int failures = 0; for (mode = zfp_mode_fixed_precision; mode <= zfp_mode_reversible; mode++) { zfp_type type = zfp_field_type(bundle->field); if ((mode == zfp_mode_fixed_accuracy) && (type == zfp_type_int32 || type == zfp_type_int64)) { // skip fixed accuracy when unsupported continue; } if (setupCompressParam(bundle, mode, 1) == 1) { failures++; continue; } if (runZfpCompressDecompressIsNoop(state) == 1) { failures++; } } if (failures > 0) { fail_msg("Compression/Decompression no-op test failed\n"); } } static void _catFunc3(given_, DESCRIPTOR, InterleavedArray_when_ZfpCompressFixedRate_expect_BitstreamUntouchedAndReturnsZero)(void **state) { struct setupVars *bundle = *state; if (bundle->stride != INTERLEAVED) { fail_msg("Invalid stride during test"); } else if (zfp_stream_compression_mode(bundle->stream) != zfp_mode_fixed_rate) { fail_msg("Invalid zfp mode during test"); } runCompressDecompressNoopTest(state, zfp_mode_fixed_rate); } /* setup functions */ static int setupCudaConfig(void **state, stride_config stride) { int result = initZfpStreamAndField(state, stride); struct setupVars *bundle = *state; assert_int_equal(zfp_stream_set_execution(bundle->stream, zfp_exec_cuda), 1); return result; } static int setupPermuted(void **state) { return setupCudaConfig(state, PERMUTED); } static int setupInterleaved(void **state) { return setupCudaConfig(state, INTERLEAVED); } static int setupReversed(void **state) { return setupCudaConfig(state, REVERSED); } static int setupDefaultStride(void **state) { return setupCudaConfig(state, AS_IS); } #endif
the_stack_data/200143621.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef __linux__ #include <sys/time.h> #include <time.h> #elif _WIN32 #include <sys/time.h> #endif #define TAM 3 struct pessoa { char nome[30]; int idade; }; void bubblesort(struct pessoa *vetor_pessoa, int n) ; int main() { unsigned int i, j = 0; struct pessoa *vetor = (struct pessoa *)malloc(TAM * sizeof(struct pessoa)); if (vetor == NULL) { printf("Nao foi possivel alocar o vetor"); return 0; } strcpy(vetor[0].nome,"Paulo"); vetor[0].idade = 30; strcpy(vetor[1].nome,"Giselle"); vetor[1].idade = 20; strcpy(vetor[2].nome,"Joaquim"); vetor[2].idade = 8; for(i=0; i<3; i++){ printf("Nome: %s e idade: %d\n", vetor[i].nome, vetor[i].idade); } bubblesort(vetor,TAM); printf("\nOrdenado\n"); for(i=0; i<3; i++){ printf("Nome: %s e idade: %d\n", vetor[i].nome, vetor[i].idade); } free(vetor); } void bubblesort(struct pessoa *vetor_pessoa, int n) { int k, j; struct pessoa aux; for (k = 1; k < n; k++) { for (j = 0; j < n - 1; j++) { if (strcmp(vetor_pessoa[j].nome , vetor_pessoa[j + 1].nome) > 0 ) { aux = vetor_pessoa[j]; vetor_pessoa[j] = vetor_pessoa[j + 1]; vetor_pessoa[j + 1] = aux; } } } }
the_stack_data/98576304.c
/* ******************************************************************************* * Copyright (c) 2020-2021, STMicroelectronics * All rights reserved. * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ******************************************************************************* */ #if defined(ARDUINO_GENERIC_F051T8YX) #include "pins_arduino.h" /** * @brief System Clock Configuration * @param None * @retval None */ WEAK void SystemClock_Config(void) { /* SystemClock_Config can be generated by STM32CubeMX */ #warning "SystemClock_Config() is empty. Default clock at reset is used." } #endif /* ARDUINO_GENERIC_* */
the_stack_data/113238.c
// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify %s // rdar://18716393 extern int a[] __attribute__((weak)); int b[] = {8,13,21}; struct { int x[10]; } c; const char str[] = "text"; void ignore() { if (!a) {} } void test() { if (!b) {} // expected-warning {{address of array 'b' will always evaluate to 'true'}} if (b == 0) {} // expected-warning {{comparison of array 'b' equal to a null pointer is always false}} if (!c.x) {} // expected-warning {{address of array 'c.x' will always evaluate to 'true'}} if (c.x == 0) {} // expected-warning {{comparison of array 'c.x' equal to a null pointer is always false}} if (!str) {} // expected-warning {{address of array 'str' will always evaluate to 'true'}} if (0 == str) {} // expected-warning {{comparison of array 'str' equal to a null pointer is always false}} } int array[2]; int test1() { if (!array) { // expected-warning {{address of array 'array' will always evaluate to 'true'}} return array[0]; } else if (array != 0) { // expected-warning {{comparison of array 'array' not equal to a null pointer is always true}} return array[1]; } if (array == 0) // expected-warning {{comparison of array 'array' equal to a null pointer is always false}} return 1; return 0; } #define NULL (void*)0 int test2(int* pointer, char ch, void * pv) { if (!&pointer) { // expected-warning {{address of 'pointer' will always evaluate to 'true'}} return 0; } if (&pointer) { // expected-warning {{address of 'pointer' will always evaluate to 'true'}} return 0; } if (&pointer == NULL) {} // expected-warning {{comparison of address of 'pointer' equal to a null pointer is always false}} if (&pointer != NULL) {} // expected-warning {{comparison of address of 'pointer' not equal to a null pointer is always true}} return 1; } void test3() { if (array) { } // expected-warning {{address of array 'array' will always evaluate to 'true'}} if (array != 0) {} // expected-warning {{comparison of array 'array' not equal to a null pointer is always true}} if (!array) { } // expected-warning {{address of array 'array' will always evaluate to 'true'}} if (array == 0) {} // expected-warning {{comparison of array 'array' equal to a null pointer is always false}} if (array[0] && array) {} // expected-warning {{address of array 'array' will always evaluate to 'true'}} if (array[0] || array) {} // expected-warning {{address of array 'array' will always evaluate to 'true'}} if (array[0] && !array) {} // expected-warning {{address of array 'array' will always evaluate to 'true'}} if (array[0] || !array) {} // expected-warning {{address of array 'array' will always evaluate to 'true'}} if (array && // expected-warning {{address of array 'array' will always evaluate to 'true'}} array[0]) {} if (!array || // expected-warning {{address of array 'array' will always evaluate to 'true'}} array[0]) {} if (array || // expected-warning {{address of array 'array' will always evaluate to 'true'}} (!array && array[0])) {} // expected-warning {{address of array 'array' will always evaluate to 'true'}} } // rdar://19256338 #define SAVE_READ(PTR) if( (PTR) && (&result) ) *result=*PTR; void _HTTPClientErrorHandler(int me) { int *result; SAVE_READ(&me); } void test_conditional_operator() { int x; x = b ? 1 : 0; // expected-warning {{address of array}} x = c.x ? 1 : 0; // expected-warning {{address of array}} x = str ? 1 : 0; // expected-warning {{address of array}} x = array ? 1 : 0; // expected-warning {{address of array}} x = &x ? 1 : 0; // expected-warning {{address of 'x'}} }
the_stack_data/55905.c
/* * Copyright (C) 2000-2006 Erik Andersen <[email protected]> * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include <time.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> useconds_t ualarm(useconds_t value, useconds_t interval) { struct itimerval otimer; const struct itimerval itimer = { { 0, interval }, { 0, value} }; if (setitimer(ITIMER_REAL, &itimer, &otimer) < 0) { return -1; } return((otimer.it_value.tv_sec * 1000000) + otimer.it_value.tv_usec); }
the_stack_data/225142946.c
#include<stdio.h> int create(int a,int b,int c) { int s; if(a>b & a>c & b>c){ s = s * 10 + a; s = s * 10 + b; s = s * 10 + c; } else if(a>b & a>c & c>b){ s = s * 10 + a; s = s * 10 + c; s = s * 10 + b; } else if(b>a & b>c & a>c){ s = s * 10 + b; s = s * 10 + a; s = s * 10 + c; } else if(b>a &b>c &c>a){ s = s * 10 + b; s = s * 10 +c; s = s * 10 +a; } else if(c>a& c>b& a>b){ s = s * 10 + c; s = s * 10 + a; s = s * 10 + b; } else if(c>a&c>b&b>a){ s = s * 10 + c; s = s * 10 + b; s = s * 10 + a; } return s; } int main() { int x,y,z; printf("Enter X Value: \n"); scanf("%d",&x); printf("Enter Y Value: \n"); scanf("%d",&y); printf("Enter Z Value: \n"); scanf("%d",&z); printf("%d",create(x,y,z)); return 0; }
the_stack_data/67323994.c
/**************************************************************************/ /* */ /* OCaml */ /* */ /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ /* */ /* Copyright 2003 Institut National de Recherche en Informatique et */ /* en Automatique. */ /* */ /* All rights reserved. This file is distributed under the terms of */ /* the GNU Lesser General Public License version 2.1, with the */ /* special exception on linking described in the file LICENSE. */ /* */ /**************************************************************************/ /* Test whether IA32 assembler supports SSE2 instructions */ int main() { asm("pmuludq %mm1, %mm0"); asm("paddq %mm1, %mm0"); asm("psubq %mm1, %mm0"); return 0; }
the_stack_data/181393507.c
#include <stdio.h> #include <pthread.h> #include <unistd.h> int max = 0; pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t condmax = PTHREAD_COND_INITIALIZER; void *thread(void *arg) { char *letter = (char *)arg; printf("%c wants to enter the critical section\n", *letter); pthread_mutex_lock(&lock); while(max>= 3){ pthread_cond_wait(&condmax,&lock); } pthread_mutex_unlock(&lock); max++; printf("%c is in the critical section\n", *letter); sleep(1); printf("%c has left the critical section\n", *letter); pthread_cond_signal(&condmax); max--; return NULL; } int main(int argc, char **argv) { pthread_t threads[8]; int i; char *letters = "abcdefgh"; for(i = 0; i < 8; ++i) { pthread_create(&threads[i], NULL, thread, &letters[i]); if(i == 4) sleep(4); } for(i = 0; i < 8; i++) { pthread_join(threads[i], NULL); } printf("Everything finished...\n"); return 0; }
the_stack_data/182952437.c
/* A simple example to test whether Eclipser can handle strcmp() calls. */ #include <stdio.h> #include <getopt.h> #include <stdlib.h> #include <string.h> int main(int argc, char ** argv) { char c; short s; int i; int64_t i64; if (argc < 2) return -1; if (strcmp(argv[1], "--option") == 0) printf("Found new path 1!\n"); /* Note that this may fail in 32bit environment, since lowest 1-byte field of * %esi, %dsi, %ebp, %esp are not accessible (%sil, %dil, %bpl, %spl are only * accessible in 64bit environment, by using REX prefix). Therefore, our * instrumentation code added in QEMU may not be able to generate 1-byte * subtraction opcode, which results in the failure of flag-search on string. */ c = (char) strcmp(argv[1], "--char"); if (c == 0) printf("Found new path 2!\n"); s = (short) strcmp(argv[1], "--short"); if (s == 0) printf("Found new path 3!\n"); i = strcmp(argv[1], "--int32"); if (i == 0) printf("Found new path 4!\n"); i64 = strcmp(argv[1], "--int64"); if (i64 == 0ll) printf("Found new path 5!\n"); return 0; }
the_stack_data/245153.c
#include <math.h> #include <stdio.h> int main() { //input a, b ,c double a, b, c, discriminant; printf("Enter the A value:"); scanf("%lf", &a); printf("Enter the B value:"); scanf("%lf", &b); printf("Enter the C value:"); scanf("%lf", &c); printf("\n"); discriminant = (b * b - 4 * a * c); //Quadratic eqation way double root1, root2; if (discriminant > 0) { root1 = (-b + sqrt(discriminant)) / (2 * a); root2 = (-b - sqrt(discriminant)) / (2 * a); ("root1 = %lf", root1); ("root2 = %lf", root2); } //Print roots from Quadratic else if (discriminant == 0) { root1 = root2 = -b / (2 * a); printf("root1 = root2 = %lf; \n", root1); } printf("The Quadratic equation will take the inputs a, b, c and put them into the equation (b * b - 4 * a * c) to give us our discriminant.\n"); printf("It will then all go into the equation (-b +/- sqrt(discriminant)) / (2 * a)) to give us our roots.\n\n"); printf("Using the quadratic formula the discriminant and roots are: \n"); printf("The discriminant is: %lf \n", discriminant); printf("root1 = %lf \n", root1); printf("root2 = %lf \n\n", root2); //New way variables double root_1, root_2, m, z, discriminant2; //New way m = (-b / (2 * a)); discriminant2 = (m * m - (c / a)); z = sqrt(discriminant2); root_1 = (m + z); root_2 = (m - z); //Print roots from new way printf("The new way will take a and b to sub into (-b / (2 * a)) to give us m.\n"); printf("Once we have m we sub m, a, and c into (m * m - (c / a)) to give us our discriminant.\n"); printf("Once we have the discriminant we will square it to give us z. We will then sub m and z into (m +/- z) to give us our two roots.\n\n"); printf("Using the new method the discriminant and roots are: \n"); printf("The discriminant is: %lf \n", discriminant2); printf("root_1 = %lf \n", root_1); printf("root_2 = %lf", root_2); return 0; }
the_stack_data/23183.c
/*BHEADER********************************************************************** * Copyright (c) 2008, Lawrence Livermore National Security, LLC. * Produced at the Lawrence Livermore National Laboratory. * This file is part of HYPRE. See file COPYRIGHT for details. * * HYPRE is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License (as published by the Free * Software Foundation) version 2.1 dated February 1999. * * $Revision$ ***********************************************************************EHEADER*/ #ifdef HYPRE_USE_UMALLOC #include "umalloc_local.h" void *_uget_fn(Heap_t usrheap, size_t *length, HYPRE_Int *clean) { void *p; *length = ((*length) / INITIAL_HEAP_SIZE) * INITIAL_HEAP_SIZE + INITIAL_HEAP_SIZE; *clean = _BLOCK_CLEAN; p = (void *) calloc(*length, 1); return p; } void _urelease_fn(Heap_t usrheap, void *p, size_t size) { free (p); return; } #else /* this is used only to eliminate compiler warnings */ char umalloc_empty; #endif
the_stack_data/811591.c
// PROGRAM-NAME : Hello, World! // By Ajmal Nazer // PROGRAM-CODE : #include <stdio.h> int main() { printf("Hello, World!"); return 0; }
the_stack_data/1215075.c
// REKURSYWNY ZSTEPUJACY ANALIZATOR SKŁADNIOWY // // Wczytuje ze standardowego wejscia ciag znakow oznaczajacy wyrazenie // arytmetyczne. // Drukuje na standardowe wyjscie drzewo rozbioru (lub komunikat // bledu). #include<stdio.h> #include<string.h> #include<stdlib.h> #define max_il_synow 3 #define max_szer_druku 100 #define max_wys_druku 40 typedef enum { FALSE = 0, TRUE = 1 } Boolean; typedef enum { W = 0, S = 1 } nieterminal; typedef struct dr { Boolean czyterm; char lk; // o ile czyterm = TRUE nieterminal ntm; // o ile czyterm = FALSE int il_syn; // o ile czyterm = FALSE struct dr* syn[max_il_synow]; // o ile czyterm = FALSE } drzewo; //------------------------------------------------------ // POMOCNICZE: char leks; Boolean nowyleks(char c) { // jesli na wejsciu stoi znak c , to go sczytuje i oddaje TRUE; // jesli tam stoi inny znak, to nic nie wczytuje i oddaje FALSE if (leks == c) { do { scanf("%c", &leks); } while ((leks < '!' || leks > '~') && leks != '\n'); return TRUE; } else return FALSE; } Boolean blad (char s[]) { // sygnalizacja błędu: // drukuje napis s a następnie przerywa wykonanie programu printf ("\n BLAD: %s\n\n", s); exit(1); return FALSE; } //------------------------------------------------------ // Serce parsera: // PO JEDNEJ PROCEDURZE REKURSYWNEJ NA KAZDY NIETERMINAL Boolean WW (drzewo* drz); Boolean SS (drzewo* drz); // <A> ::= y <A> <B> z | x Boolean WW (drzewo* drz) { drzewo drz1,drz2; if (SS(&drz1)){ drz->czyterm = FALSE; drz->ntm = W; drz->il_syn = 1; drz->syn[0] = (drzewo*)malloc(sizeof(drzewo)); *(drz->syn[0]) = drz1; while(nowyleks('+')){ if (SS(&drz2)){ drz1=*drz; drz->czyterm = FALSE; drz->ntm = W; drz->il_syn = 3; drz->syn[0] = (drzewo*)malloc(sizeof(drzewo)); *(drz->syn[0]) = drz1; drz->syn[1] = (drzewo*)malloc(sizeof(drzewo)); drz->syn[1]->czyterm = TRUE; drz->syn[1]->lk = '+'; drz->syn[2] = (drzewo*)malloc(sizeof(drzewo)); *(drz->syn[2]) = drz2; } } return TRUE; } else return FALSE; } // <T> ::= b <T> c | e Boolean SS (drzewo* drz) { drzewo drz1; if (nowyleks('(')) if (WW(&drz1)) if (nowyleks(')')) { // Rozpoznalismy w <T> , robimy z tego drzewo: drz->czyterm = FALSE; drz->ntm = S; drz->il_syn = 3; drz->syn[0] = (drzewo*)malloc(sizeof(drzewo)); drz->syn[0]->czyterm = TRUE; drz->syn[0]->lk = '('; drz->syn[1] = (drzewo*)malloc(sizeof(drzewo)); *(drz->syn[1]) = drz1; drz->syn[2] = (drzewo*)malloc(sizeof(drzewo)); drz->syn[2]->czyterm = TRUE; drz->syn[2]->lk = ')'; return TRUE; } else return blad("( <W> ??? -- oczekiwalem ')' "); else return blad("( ??? -- oczekiwalem <W> "); else if(nowyleks('a')) { // Rozpoznalismy tylko e , robimy z niego drzewo: drz->czyterm = FALSE; drz->ntm = S; drz->il_syn = 1; drz->syn[0] = (drzewo*)malloc(sizeof(drzewo)); drz->syn[0]->czyterm = TRUE; drz->syn[0]->lk = 'a'; return TRUE; } else return FALSE; } //------------------------------------------------------ // Pomocnicze: DRUKOWANIE DRZEWA char druk [max_szer_druku][max_wys_druku]; void dr_drz (drzewo drz, int* szer, int* wys) { int szer_syna[max_il_synow], wys_syna[max_il_synow], i,j; if (drz.czyterm) { *szer=*szer+3; *wys=1; druk[*szer-1][*wys-1] = drz.lk; } else { // Drzewo nieterminalowe: *wys = 0; for (i=0; i<drz.il_syn; i++) { dr_drz (*drz.syn[i], szer, &wys_syna[i]); szer_syna[i] = *szer; if (*wys < wys_syna[i]) *wys = wys_syna[i]; } switch (drz.ntm) { case W : druk[*szer-1][*wys+1] = 'W'; break; case S : druk[*szer-1][*wys+1] = 'S'; break; } if (drz.il_syn > 0) { for (i=0; i<drz.il_syn; i++) for (j=wys_syna[i]; j<*wys+1; j++) druk[szer_syna[i]-1][j] = '|'; for (i=szer_syna[0]; i<*szer-1; i++) druk[i][*wys+1] = '-'; for (i=0; i<drz.il_syn-1; i++) druk[szer_syna[i]-1][*wys+1] = ','; } *wys = *wys+2; } } void drukuj_drzewo (drzewo drz) { int szer,wys,i,j; for (i=0; i<max_szer_druku; i++) for (j=0; j<max_wys_druku; j++) druk[i][j] = ' '; szer=0; dr_drz (drz, &szer, &wys); for (j=wys-1; j>=0; j--) { for (i=0; i<szer; i++) printf("%c",druk[i][j]); printf("\n"); } printf("\n"); } //------------------------------------------------------ // Program główny: int main() { drzewo drz; Boolean ok; // Wczytanie pierwszego znaku (z pominieciem niewidocznych: do { scanf("%c", &leks); } while ((leks < '!' || leks > '~') && leks != '\n'); ok = WW(&drz); printf ("\n"); if (ok && leks == '\n') drukuj_drzewo (drz); else if (ok && leks != '\n') { drukuj_drzewo (drz); printf (" SMIECI NA KONCU: %c\n\n", leks); } else printf (" NAPIS BLEDNY\n\n"); return 0; }
the_stack_data/65936.c
#include <stdio.h> #include <stdlib.h> int dump(char *nom) { FILE *fitxer; char linia[256]; printf("Obrint el fitxer : %s\n",nom); fitxer = fopen(nom,"r"); while(fgets(linia,sizeof(linia),fitxer)) { printf("%s",linia); } fclose(fitxer); return 0; } int main(int estado, char **contenido) { if (estado!=2) { printf("Ajuda: lector 'fitxer'\n\n"); return 1; } int tt = dump(contenido[1]); return tt; }
the_stack_data/48574416.c
/* Author : Sanjay Marreddi Even Fibonacci Numbers Problem Statement :- Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million(4,000,000), find the sum of the even-valued terms.*/ #include <stdio.h> int main(){ int temporary, Sum = 0 ; int current_no = 0 ; int next_no = 1; // Considering the terms in the Fibonacci sequence whose values do not exceed four million. while (next_no < 4e6){ temporary = current_no ; current_no = next_no ; next_no = current_no + temporary ; // Assigning only if the Number is Even. if(current_no%2 == 0){ Sum += current_no;} } printf("\n The Sum of Even Valued Terms of Fibonacci sequence is %d",Sum); }
the_stack_data/90764715.c
#include <stdio.h> int main(void) { int leftNum = -10; unsigned int rightNum = 10; if (leftNum < rightNum) { printf("leftNum(%d) < rightNum(%d)", leftNum, rightNum); } else { printf("leftNum(%d) > rightNum(%d)", leftNum, rightNum); } return 0; }
the_stack_data/810619.c
#include <stdio.h> void *update_size(void* p, size_t OldLength, size_t NewLength) { void *p2 = malloc(NewLength); if (p && p2) { memcpy(p2, p, OldLength < NewLength ? OldLength : NewLength); } if (p2 || (NewLength == 0)) { free(p); // Note A } return p2; } void main(void){ char * p = malloc(20); char * j = update_size ( p , 20 , 30); }
the_stack_data/162644183.c
/*BEGIN_LEGAL Intel Open Source License Copyright (c) 2002-2015 Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. END_LEGAL */ #include <stdio.h> extern int very_big(); int main() { int num = very_big(); printf("Result: 0x%x\n", num); return 0; }
the_stack_data/122183.c
//exemplo retirado do livro "The C Programming language - Brian W.Kernighan & Dennis M. Ritchie" #include <stdio.h> /* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */ int main() { int fahr, celsius; int lower, upper, step; lower = 0; /* lower limit of temperature scale */ upper = 300; /* upper limit */ step = 20; /* step size */ fahr = lower; printf("The fahrenheit -> celsius table: "); while (fahr <= upper) { celsius = 5 * (fahr - 32) / 9; printf("\n%d\t | \t %d", fahr, celsius); fahr = fahr + step; } return 0; }
the_stack_data/43888815.c
/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Undocumented macros, especially those whose name start with YY_, are private implementation details. Do not rely on them. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* First part of user prologue. */ #line 4 "a.y" #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> typedef struct node { char* name; int num_of_children; // number of children int depth; // depth of the subtree rooted at this node int longest_path; // longest path of the subtree rooted at this node struct node** children; // pointer to its children } node; void yyerror(char*); int yylex(void); int max(int, int); int get_longest_path(node*); node* makenode(char*, int, ...); extern FILE* yyin; char* mytext; int longest_path = 0; int longest_if = 0; int longest_while = 0; int longest_switch = 0; int longest_main = 0; int possible_longest_main = 0; int is_main = 0; int is_main_confirmed = 0; #line 103 "y.tab.c" # ifndef YY_CAST # ifdef __cplusplus # define YY_CAST(Type, Val) static_cast<Type> (Val) # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) # else # define YY_CAST(Type, Val) ((Type) (Val)) # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) # endif # endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # else # define YY_NULLPTR ((void*)0) # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Use api.header.include to #include this header instead of duplicating it here. */ #ifndef YY_YY_Y_TAB_H_INCLUDED # define YY_YY_Y_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { IDENTIFIER = 258, NUMBER = 259, PLUS = 260, MINUS = 261, MULT = 262, DIV = 263, IF = 264, ELSE = 265, FOR = 266, WHILE = 267, DO = 268, INT = 269, FLOAT = 270, CHAR = 271, EQ = 272, EQEQ = 273, GEQ = 274, LEQ = 275, GT = 276, LT = 277, NEWOP = 278, NEQ = 279, BITAND = 280, BITOR = 281, BITNOT = 282, BITXOR = 283, AND = 284, OR = 285, NOT = 286, MOD = 287, EXTERN = 288, LONG = 289, SHORT = 290, DOUBLE = 291, VOID = 292, SWITCH = 293, CASE = 294, STRUCT = 295, BREAK = 296, CONTINUE = 297, RETURN = 298, STRLITERAL = 299, CHARLITERAL = 300, INC = 301, DEC = 302, ARROW = 303, SIZEOF = 304, DEFAULT = 305 }; #endif /* Tokens. */ #define IDENTIFIER 258 #define NUMBER 259 #define PLUS 260 #define MINUS 261 #define MULT 262 #define DIV 263 #define IF 264 #define ELSE 265 #define FOR 266 #define WHILE 267 #define DO 268 #define INT 269 #define FLOAT 270 #define CHAR 271 #define EQ 272 #define EQEQ 273 #define GEQ 274 #define LEQ 275 #define GT 276 #define LT 277 #define NEWOP 278 #define NEQ 279 #define BITAND 280 #define BITOR 281 #define BITNOT 282 #define BITXOR 283 #define AND 284 #define OR 285 #define NOT 286 #define MOD 287 #define EXTERN 288 #define LONG 289 #define SHORT 290 #define DOUBLE 291 #define VOID 292 #define SWITCH 293 #define CASE 294 #define STRUCT 295 #define BREAK 296 #define CONTINUE 297 #define RETURN 298 #define STRLITERAL 299 #define CHARLITERAL 300 #define INC 301 #define DEC 302 #define ARROW 303 #define SIZEOF 304 #define DEFAULT 305 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 38 "a.y" struct node* tree; #line 259 "y.tab.c" }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse (void); #endif /* !YY_YY_Y_TAB_H_INCLUDED */ #ifdef short # undef short #endif /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure <limits.h> and (if available) <stdint.h> are included so that the code can choose integer types of a good width. */ #ifndef __PTRDIFF_MAX__ # include <limits.h> /* INFRINGES ON USER NAME SPACE */ # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ # define YY_STDINT_H # endif #endif /* Narrow types that promote to a signed type and that can represent a signed or unsigned integer of at least N bits. In tables they can save space and decrease cache pressure. Promoting to a signed type helps avoid bugs in integer arithmetic. */ #ifdef __INT_LEAST8_MAX__ typedef __INT_LEAST8_TYPE__ yytype_int8; #elif defined YY_STDINT_H typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef __INT_LEAST16_MAX__ typedef __INT_LEAST16_TYPE__ yytype_int16; #elif defined YY_STDINT_H typedef int_least16_t yytype_int16; #else typedef short yytype_int16; #endif #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ && UINT_LEAST8_MAX <= INT_MAX) typedef uint_least8_t yytype_uint8; #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX typedef unsigned char yytype_uint8; #else typedef short yytype_uint8; #endif #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ typedef __UINT_LEAST16_TYPE__ yytype_uint16; #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ && UINT_LEAST16_MAX <= INT_MAX) typedef uint_least16_t yytype_uint16; #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX typedef unsigned short yytype_uint16; #else typedef int yytype_uint16; #endif #ifndef YYPTRDIFF_T # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ # define YYPTRDIFF_T __PTRDIFF_TYPE__ # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ # elif defined PTRDIFF_MAX # ifndef ptrdiff_t # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # endif # define YYPTRDIFF_T ptrdiff_t # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX # else # define YYPTRDIFF_T long # define YYPTRDIFF_MAXIMUM LONG_MAX # endif #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif #define YYSIZE_MAXIMUM \ YY_CAST (YYPTRDIFF_T, \ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ ? YYPTRDIFF_MAXIMUM \ : YY_CAST (YYSIZE_T, -1))) #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) /* Stored state numbers (used for stacks). */ typedef yytype_int16 yy_state_t; /* State numbers in computations. */ typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE_PURE # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define YY_ATTRIBUTE_PURE # endif #endif #ifndef YY_ATTRIBUTE_UNUSED # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else # define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ # define YY_IGNORE_USELESS_CAST_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") # define YY_IGNORE_USELESS_CAST_END \ _Pragma ("GCC diagnostic pop") #endif #ifndef YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_END #endif #define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 23 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 796 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 61 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 64 /* YYNRULES -- Number of rules. */ #define YYNRULES 177 /* YYNSTATES -- Number of states. */ #define YYNSTATES 287 #define YYUNDEFTOK 2 #define YYMAXUTOK 305 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 56, 57, 2, 2, 52, 2, 60, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 55, 51, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 58, 2, 59, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 53, 2, 54, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { 0, 101, 101, 102, 105, 106, 109, 109, 110, 110, 113, 114, 117, 118, 121, 122, 125, 126, 129, 130, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 148, 149, 152, 153, 156, 159, 160, 163, 164, 165, 168, 169, 172, 173, 174, 175, 176, 177, 178, 181, 182, 185, 186, 189, 190, 191, 194, 195, 196, 199, 200, 203, 204, 205, 208, 209, 212, 213, 216, 217, 218, 219, 220, 221, 222, 223, 224, 227, 228, 229, 230, 231, 232, 235, 236, 237, 240, 241, 244, 247, 248, 249, 252, 253, 254, 257, 258, 259, 262, 263, 264, 267, 268, 271, 272, 275, 276, 277, 280, 281, 284, 287, 290, 293, 294, 297, 298, 301, 302, 305, 306, 309, 310, 313, 314, 317, 318, 321, 322, 325, 326, 327, 328, 329, 332, 333, 336, 337, 340, 341, 344, 345, 346, 349, 350, 353, 354, 355, 356, 357, 358, 361, 362, 363, 364, 365, 366, 369, 370, 371, 372, 373, 374, 377, 378, 381, 382, 383, 384, 385, 388, 389, 392, 393, 394 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "IDENTIFIER", "NUMBER", "PLUS", "MINUS", "MULT", "DIV", "IF", "ELSE", "FOR", "WHILE", "DO", "INT", "FLOAT", "CHAR", "EQ", "EQEQ", "GEQ", "LEQ", "GT", "LT", "NEWOP", "NEQ", "BITAND", "BITOR", "BITNOT", "BITXOR", "AND", "OR", "NOT", "MOD", "EXTERN", "LONG", "SHORT", "DOUBLE", "VOID", "SWITCH", "CASE", "STRUCT", "BREAK", "CONTINUE", "RETURN", "STRLITERAL", "CHARLITERAL", "INC", "DEC", "ARROW", "SIZEOF", "DEFAULT", "';'", "','", "'{'", "'}'", "':'", "'('", "')'", "'['", "']'", "'.'", "$accept", "CProgram", "GlobalDeclaration", "FunctionDefinition", "$@1", "$@2", "DeclarationList", "Declaration", "DeclarationType", "InitializerDeclaratorList", "InitializerDeclarator", "Type", "Struct", "StructDeclarationList", "StructDeclaration", "StructDeclaratorList", "StructDeclarator", "Declarator", "RealDeclarator", "Pointer", "ParameterList", "ParameterDeclaration", "UnnamedDeclarator", "IdentifierList", "Initializer", "InitializerList", "TypeName", "BracketDeclarator", "Statement", "LabelStatement", "ExpressionStatement", "ScopeStatement", "FunctionBody", "DecisionStatement", "LoopStatement", "ControlStatement", "Expression", "RobustExpression", "ForRobustExpression", "AssignExpression", "AssignOp", "ConstantExpression", "ConditionalExpression", "OrExpression", "AndExpression", "BitOrExpression", "BitXorExpression", "BitAndExpression", "EqExpression", "EqOp", "RelExpression", "RelOp", "AddExpression", "AddOp", "MultExpression", "MultOp", "TypeCastExpression", "UnaryExpression", "UnaryOp", "PostfixExpression", "PostfixOp", "PrimExpression", "String", "ArgExpressionList", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_int16 yytoknum[] = { 0, 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, 59, 44, 123, 125, 58, 40, 41, 91, 93, 46 }; # endif #define YYPACT_NINF (-232) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) #define YYTABLE_NINF (-19) #define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 570, -232, -232, -232, 151, 86, 46, -232, -232, 67, 716, -232, -232, -232, 11, -232, -232, -232, -232, 74, -232, -232, 57, -232, -232, -232, 96, -232, 31, 14, -232, -2, -31, 41, -232, 151, -232, 37, -232, 31, 620, 570, 70, 287, 174, -31, 16, 732, -232, -232, -232, 113, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 650, 650, 71, 620, 496, -232, -232, -232, 119, 140, 171, 154, 175, 40, 218, 135, 13, -232, 189, 680, 156, -232, 163, 743, -232, 11, -232, -232, -232, -232, 21, -4, -232, 24, -232, 149, -232, -232, 680, 110, -232, 155, -232, -232, 680, -232, -232, 543, -232, 59, 50, 158, 62, -232, 680, 680, 680, 680, 680, -232, -232, 680, -232, -232, -232, -232, -232, 680, -232, -232, 680, -232, -232, -232, 680, -232, 680, -232, -232, -232, 208, 680, 680, 214, -232, -232, -232, -232, 334, 278, 221, -232, 28, -232, 75, 570, -232, 219, -232, -232, -232, -232, 16, 680, 172, 177, 590, -232, 705, 118, -232, 680, 680, -232, 140, 171, 154, 175, 40, 218, 135, 13, -232, -232, -232, -232, 69, -19, -232, 176, 179, 186, 187, 388, 188, 680, 181, 194, 680, 192, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 138, -232, 87, 193, -232, 190, 75, 480, 251, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 680, -232, -232, 388, 680, 442, 680, 239, 680, 198, -232, -232, 207, 209, 388, -232, -232, -232, -232, -232, 91, -232, 202, -232, -232, 99, -232, -232, 143, 680, 100, 206, 107, 388, -232, -232, -232, -232, 388, -232, 212, 388, 680, 388, -232, 254, 680, -232, 111, -232, 388, 215, -232, -232, 388, -232 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 23, 25, 21, 0, 24, 22, 26, 20, 0, 0, 2, 5, 4, 0, 15, 32, 14, 27, 30, 28, 29, 34, 1, 3, 45, 52, 13, 0, 0, 16, 6, 44, 0, 31, 0, 53, 0, 12, 0, 0, 0, 0, 0, 0, 43, 0, 0, 35, 46, 17, 18, 168, 169, 156, 157, 155, 154, 158, 159, 173, 170, 0, 0, 0, 0, 0, 19, 64, 111, 115, 116, 118, 120, 122, 124, 126, 130, 137, 141, 146, 0, 148, 160, 171, 0, 10, 0, 94, 9, 62, 51, 57, 0, 54, 0, 48, 0, 114, 146, 0, 0, 38, 40, 33, 36, 0, 149, 150, 0, 67, 0, 70, 0, 0, 104, 0, 0, 0, 0, 0, 128, 129, 0, 134, 135, 132, 133, 136, 0, 139, 140, 0, 143, 144, 145, 0, 113, 0, 153, 166, 167, 0, 177, 0, 0, 165, 174, 11, 7, 0, 0, 0, 56, 61, 58, 60, 0, 49, 0, 50, 47, 42, 37, 0, 0, 0, 0, 0, 65, 0, 61, 69, 0, 0, 172, 117, 119, 121, 123, 125, 127, 131, 138, 142, 112, 164, 175, 0, 0, 163, 168, 0, 0, 0, 0, 0, 0, 0, 0, 107, 0, 90, 91, 92, 93, 80, 81, 82, 83, 84, 85, 0, 79, 0, 0, 75, 0, 59, 0, 0, 55, 63, 39, 41, 152, 151, 66, 68, 147, 105, 0, 162, 161, 0, 0, 0, 0, 0, 0, 0, 102, 101, 106, 0, 0, 89, 78, 71, 74, 77, 0, 73, 0, 176, 86, 0, 110, 109, 0, 107, 0, 0, 0, 0, 103, 88, 76, 72, 0, 108, 0, 0, 0, 0, 87, 95, 107, 98, 0, 97, 0, 0, 100, 96, 0, 99 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -232, -232, 259, -232, -232, -232, -232, -38, 0, -232, 232, 8, -232, -232, 226, -232, 115, -9, -22, -17, -35, 117, -60, -232, -52, -232, 166, -132, -127, -232, -232, -26, -232, -232, -232, -232, -64, -231, -232, -39, -232, -96, -37, -232, 167, 169, 170, 165, 184, -232, 164, -232, 160, -232, 159, -232, -75, -27, -232, -232, -232, -232, -232, -232 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 10, 11, 12, 41, 42, 85, 13, 92, 29, 30, 15, 16, 47, 48, 101, 102, 37, 32, 33, 214, 94, 215, 95, 67, 111, 113, 156, 205, 206, 207, 208, 150, 209, 210, 211, 212, 244, 260, 115, 138, 97, 69, 70, 71, 72, 73, 74, 75, 123, 76, 129, 77, 132, 78, 136, 79, 80, 81, 82, 146, 83, 84, 188 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 14, 68, 114, 86, 162, 31, 139, 98, 93, 36, 14, 45, 17, 110, 25, 40, 89, 99, 26, 25, 133, 134, 218, 26, 25, 43, 68, 44, 26, 271, 51, 25, 155, 174, 25, 107, 108, 103, 26, 218, 233, 87, 114, 46, 25, 135, 282, 148, 157, -18, -18, -8, 172, 158, 99, 46, 217, 26, 121, 149, 21, 184, 27, 98, 122, 38, 39, 28, 238, 224, 22, 100, 28, 99, 112, 154, 159, 151, 51, 152, 189, 160, 167, 153, 151, 87, 152, 28, 34, 99, 99, 99, 99, 99, 49, 171, 99, 28, 229, 185, 18, 240, 99, 26, 187, 99, 170, 255, 152, 99, 35, 168, 204, 169, 174, 98, 228, 112, 266, 175, 19, 231, 20, 88, 253, 99, 232, 109, 98, 68, 40, 219, 45, 220, 154, 230, 243, 275, 99, 157, 130, 131, 276, 157, 247, 278, 99, 280, 267, 116, 87, 174, 174, 171, 284, 103, 269, 272, 286, 174, 98, 163, 164, 174, 274, 1, 2, 3, 283, 117, 99, 256, 259, 261, 170, 263, 152, 52, 53, 54, 55, 56, 119, 98, 251, 5, 6, 7, 8, 246, 174, 9, 254, 99, 270, 174, 243, 118, 258, 57, 120, 58, 140, 141, 142, 59, 137, 147, 161, 279, 165, 186, 143, 243, 144, 173, 145, 190, 60, 61, 62, 63, 222, 64, 52, 53, 54, 55, 56, 225, 66, 234, 241, 96, 226, 235, 87, 124, 125, 126, 127, 128, 236, 237, 239, 242, 57, 245, 58, 249, 248, 262, 59, 264, 52, 53, 54, 55, 56, 174, 265, 268, 273, 277, 281, 60, 61, 62, 63, 24, 64, 50, 285, 105, 221, 166, 57, 66, 58, 223, 216, 25, 59, 176, 179, 26, 177, 181, 178, 182, 90, 183, 1, 2, 3, 60, 61, 62, 63, 0, 64, 1, 2, 3, 180, 0, 0, 66, 0, 0, 252, 4, 5, 6, 7, 8, 0, 0, 9, 0, 4, 5, 6, 7, 8, 0, 0, 9, 0, 0, 0, 0, 0, 0, 151, 213, 152, 191, 53, 54, 55, 56, 0, 192, 91, 193, 194, 195, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 58, 0, 0, 0, 59, 0, 4, 5, 6, 7, 8, 196, 197, 9, 198, 199, 200, 60, 61, 62, 63, 0, 64, 201, 202, 0, 88, 203, 0, 66, 191, 53, 54, 55, 56, 0, 192, 0, 193, 194, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 58, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 196, 197, 0, 198, 199, 200, 60, 61, 62, 63, 0, 64, 201, 202, 0, 88, 0, 0, 66, 52, 53, 54, 55, 56, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 58, 0, 0, 0, 59, 0, 4, 5, 6, 7, 8, 0, 0, 9, 0, 0, 0, 60, 61, 62, 63, 0, 64, 0, 257, 1, 2, 3, 0, 66, 52, 53, 54, 55, 56, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 9, 57, 0, 58, 0, 0, 0, 59, 0, 0, 5, 6, 7, 8, 0, 0, 9, 250, 0, 0, 60, 61, 62, 63, 0, 64, 52, 53, 54, 55, 56, 0, 66, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 58, 0, 0, 0, 59, 0, 0, 5, 6, 7, 8, 0, 0, 9, 1, 2, 3, 60, 61, 62, 63, 0, 64, 52, 53, 54, 55, 56, 0, 106, 0, 0, 0, 4, 5, 6, 7, 8, 0, 0, 9, 0, 0, 0, 0, 57, 0, 58, 0, 0, 0, 59, 0, 52, 53, 54, 55, 56, 0, 0, 0, 0, 0, 0, 60, 61, 62, 63, 0, 64, 0, 0, 0, 65, 227, 57, 66, 58, 0, 0, 0, 59, 0, 52, 53, 54, 55, 56, 0, 0, 0, 0, 0, 0, 60, 61, 62, 63, 0, 64, 0, 0, 0, 65, 0, 57, 66, 58, 0, 0, 0, 59, 0, 52, 53, 54, 55, 56, 0, 0, 0, 0, 0, 0, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 57, 106, 58, 0, 0, 0, 59, 26, 0, 0, 0, 23, 0, 0, 1, 2, 3, 0, 0, 60, 61, 62, 63, 0, 64, 1, 2, 3, 0, 0, 0, 66, 0, 4, 5, 6, 7, 8, 0, 0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 9, 1, 2, 3, 0, 170, 213, 152, 0, 0, 5, 6, 7, 8, 0, 0, 9, 0, 0, 0, 4, 5, 6, 7, 8, 0, 0, 9, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88 }; static const yytype_int16 yycheck[] = { 0, 40, 66, 41, 100, 14, 81, 44, 43, 26, 10, 33, 4, 65, 3, 17, 42, 44, 7, 3, 7, 8, 154, 7, 3, 56, 65, 58, 7, 260, 39, 3, 92, 52, 3, 62, 63, 46, 7, 171, 59, 41, 106, 35, 3, 32, 277, 85, 52, 51, 52, 53, 112, 57, 81, 47, 152, 7, 18, 85, 14, 136, 51, 100, 24, 51, 52, 56, 195, 165, 3, 55, 56, 100, 66, 92, 52, 56, 87, 58, 144, 57, 109, 92, 56, 85, 58, 56, 14, 116, 117, 118, 119, 120, 57, 112, 123, 56, 173, 138, 14, 197, 129, 7, 143, 132, 56, 234, 58, 136, 53, 52, 150, 54, 52, 152, 168, 109, 245, 57, 34, 52, 36, 53, 220, 152, 57, 56, 165, 168, 17, 56, 154, 58, 151, 174, 200, 264, 165, 52, 5, 6, 269, 52, 57, 272, 173, 274, 57, 30, 150, 52, 52, 170, 281, 164, 57, 57, 285, 52, 197, 51, 52, 52, 57, 14, 15, 16, 57, 29, 197, 235, 236, 237, 56, 239, 58, 3, 4, 5, 6, 7, 28, 220, 219, 34, 35, 36, 37, 51, 52, 40, 231, 220, 51, 52, 260, 26, 236, 25, 25, 27, 46, 47, 48, 31, 17, 44, 59, 273, 55, 3, 56, 277, 58, 57, 60, 3, 44, 45, 46, 47, 3, 49, 3, 4, 5, 6, 7, 57, 56, 55, 51, 59, 57, 56, 236, 19, 20, 21, 22, 23, 56, 56, 56, 51, 25, 55, 27, 59, 57, 12, 31, 55, 3, 4, 5, 6, 7, 52, 51, 59, 56, 51, 10, 44, 45, 46, 47, 10, 49, 39, 57, 47, 157, 109, 25, 56, 27, 164, 59, 3, 31, 116, 119, 7, 117, 123, 118, 129, 3, 132, 14, 15, 16, 44, 45, 46, 47, -1, 49, 14, 15, 16, 120, -1, -1, 56, -1, -1, 59, 33, 34, 35, 36, 37, -1, -1, 40, -1, 33, 34, 35, 36, 37, -1, -1, 40, -1, -1, -1, -1, -1, -1, 56, 57, 58, 3, 4, 5, 6, 7, -1, 9, 57, 11, 12, 13, 14, 15, 16, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, 27, -1, -1, -1, 31, -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 50, 51, -1, 53, 54, -1, 56, 3, 4, 5, 6, 7, -1, 9, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, 27, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, -1, 49, 50, 51, -1, 53, -1, -1, 56, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, 14, 15, 16, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, 27, -1, -1, -1, 31, -1, 33, 34, 35, 36, 37, -1, -1, 40, -1, -1, -1, 44, 45, 46, 47, -1, 49, -1, 51, 14, 15, 16, -1, 56, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, 14, 15, 16, 33, 34, 35, 36, 37, -1, -1, 40, 25, -1, 27, -1, -1, -1, 31, -1, -1, 34, 35, 36, 37, -1, -1, 40, 57, -1, -1, 44, 45, 46, 47, -1, 49, 3, 4, 5, 6, 7, -1, 56, -1, -1, -1, -1, 14, 15, 16, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, 27, -1, -1, -1, 31, -1, -1, 34, 35, 36, 37, -1, -1, 40, 14, 15, 16, 44, 45, 46, 47, -1, 49, 3, 4, 5, 6, 7, -1, 56, -1, -1, -1, 33, 34, 35, 36, 37, -1, -1, 40, -1, -1, -1, -1, 25, -1, 27, -1, -1, -1, 31, -1, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, -1, 49, -1, -1, -1, 53, 54, 25, 56, 27, -1, -1, -1, 31, -1, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, -1, 49, -1, -1, -1, 53, -1, 25, 56, 27, -1, -1, -1, 31, -1, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, -1, 49, -1, -1, -1, -1, -1, 25, 56, 27, -1, -1, -1, 31, 7, -1, -1, -1, 0, -1, -1, 14, 15, 16, -1, -1, 44, 45, 46, 47, -1, 49, 14, 15, 16, -1, -1, -1, 56, -1, 33, 34, 35, 36, 37, -1, -1, 40, 14, 15, 16, 33, 34, 35, 36, 37, -1, -1, 40, 14, 15, 16, -1, 56, 57, 58, -1, -1, 34, 35, 36, 37, -1, -1, 40, -1, -1, -1, 33, 34, 35, 36, 37, -1, -1, 40, -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_int8 yystos[] = { 0, 14, 15, 16, 33, 34, 35, 36, 37, 40, 62, 63, 64, 68, 69, 72, 73, 72, 14, 34, 36, 14, 3, 0, 63, 3, 7, 51, 56, 70, 71, 78, 79, 80, 14, 53, 80, 78, 51, 52, 17, 65, 66, 56, 58, 79, 72, 74, 75, 57, 71, 78, 3, 4, 5, 6, 7, 25, 27, 31, 44, 45, 46, 47, 49, 53, 56, 85, 100, 103, 104, 105, 106, 107, 108, 109, 111, 113, 115, 117, 118, 119, 120, 122, 123, 67, 68, 69, 53, 92, 3, 57, 69, 81, 82, 84, 59, 102, 103, 118, 55, 76, 77, 78, 54, 75, 56, 118, 118, 56, 85, 86, 72, 87, 97, 100, 30, 29, 26, 28, 25, 18, 24, 110, 19, 20, 21, 22, 23, 112, 5, 6, 114, 7, 8, 32, 116, 17, 101, 117, 46, 47, 48, 56, 58, 60, 121, 44, 68, 92, 93, 56, 58, 78, 80, 83, 88, 52, 57, 52, 57, 59, 102, 51, 52, 55, 87, 118, 52, 54, 56, 80, 83, 57, 52, 57, 105, 106, 107, 108, 109, 111, 113, 115, 117, 100, 3, 100, 124, 97, 3, 3, 9, 11, 12, 13, 38, 39, 41, 42, 43, 50, 51, 54, 68, 89, 90, 91, 92, 94, 95, 96, 97, 57, 81, 83, 59, 102, 88, 56, 58, 82, 3, 77, 102, 57, 57, 54, 85, 117, 100, 52, 57, 59, 55, 56, 56, 56, 89, 56, 102, 51, 51, 97, 98, 55, 51, 57, 57, 59, 57, 81, 59, 102, 100, 89, 97, 51, 68, 97, 99, 97, 12, 97, 55, 51, 89, 57, 59, 57, 51, 98, 57, 56, 57, 89, 89, 51, 89, 97, 89, 10, 98, 57, 89, 57, 89 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_int8 yyr1[] = { 0, 61, 62, 62, 63, 63, 65, 64, 66, 64, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 74, 74, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 79, 79, 79, 79, 79, 80, 80, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 85, 85, 85, 86, 86, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 90, 90, 90, 91, 91, 92, 93, 93, 93, 94, 94, 94, 95, 95, 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, 99, 100, 100, 101, 102, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 112, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 116, 117, 117, 118, 118, 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, 121, 121, 122, 122, 122, 122, 122, 123, 123, 124, 124, 124 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_int8 yyr2[] = { 0, 2, 1, 2, 1, 1, 0, 5, 0, 4, 1, 2, 3, 2, 2, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 1, 5, 2, 1, 2, 3, 1, 3, 1, 3, 2, 2, 1, 1, 3, 4, 3, 4, 4, 3, 1, 2, 1, 3, 2, 1, 2, 2, 1, 1, 1, 3, 1, 3, 4, 1, 3, 2, 1, 3, 4, 3, 3, 2, 4, 3, 3, 2, 1, 1, 1, 1, 1, 1, 3, 4, 3, 2, 1, 3, 2, 2, 0, 5, 7, 5, 5, 8, 6, 2, 2, 3, 1, 3, 1, 0, 2, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 4, 1, 2, 2, 4, 4, 2, 1, 1, 1, 1, 1, 1, 1, 4, 4, 3, 3, 2, 1, 1, 1, 1, 1, 1, 3, 1, 2, 1, 3, 0 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*-----------------------------------. | Print this symbol's value on YYO. | `-----------------------------------*/ static void yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { FILE *yyoutput = yyo; YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*---------------------------. | Print this symbol on YYO. | `---------------------------*/ static void yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyo, yytype, yyvaluep); YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[+yyssp[yyi + 1 - yynrhs]], &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ static YYPTRDIFF_T yystrlen (const char *yystr) { YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; else goto append; append: default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (yyres) return yystpcpy (yyres, yystr) - yyres; else return yystrlen (yystr); } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, yy_state_t *yyssp, int yytoken) { enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat: reported tokens (one for the "unexpected", one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Actual size of YYARG. */ int yycount = 0; /* Cumulated lengths of YYARG. */ YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[+*yyssp]; YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYPTRDIFF_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { /* Don't count the "%s"s in the final size, but reserve room for the terminator. */ YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { ++yyp; ++yyformat; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ int yyparse (void) { yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yy_state_t yyssa[YYINITDEPTH]; yy_state_t *yyss; yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYPTRDIFF_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; /*--------------------------------------------------------------------. | yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE goto yyexhaustedlab; #else { /* Get the current used size of the three stacks, in elements. */ YYPTRDIFF_T yysize = yyssp - yyss + 1; # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF (*yyssp), &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yy_state_t *yyss1 = yyss; union yyalloc *yyptr = YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YY_IGNORE_USELESS_CAST_BEGIN YYDPRINTF ((stderr, "Stack size increased to %ld\n", YY_CAST (long, yystacksize))); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Discard the shifted token. */ yychar = YYEMPTY; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 101 "a.y" { (yyval.tree) = makenode("CProgam", 1, (yyvsp[0].tree)); } #line 1759 "y.tab.c" break; case 3: #line 102 "a.y" { (yyval.tree) = makenode("CProgram", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1765 "y.tab.c" break; case 4: #line 105 "a.y" { (yyval.tree) = makenode("GlobalDeclaration", 1, (yyvsp[0].tree)); } #line 1771 "y.tab.c" break; case 5: #line 106 "a.y" { (yyval.tree) = makenode("GlobalDeclaration", 1, (yyvsp[0].tree)); } #line 1777 "y.tab.c" break; case 6: #line 109 "a.y" { if(is_main) {is_main_confirmed = 1; } is_main = 0; } #line 1783 "y.tab.c" break; case 7: #line 109 "a.y" { (yyval.tree) = makenode("FunctionDefinition", 4, (yyvsp[-4].tree), (yyvsp[-3].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); if(is_main_confirmed) {longest_main = max(longest_main, (yyval.tree)->longest_path); is_main_confirmed = 0;} } #line 1789 "y.tab.c" break; case 8: #line 110 "a.y" { if(is_main) {is_main_confirmed = 1;} is_main = 0; } #line 1795 "y.tab.c" break; case 9: #line 110 "a.y" { (yyval.tree) = makenode("FunctionDefinition", 3, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[0].tree)); if(is_main_confirmed) {longest_main = max(longest_main, (yyval.tree)->longest_path); is_main_confirmed = 0;} } #line 1801 "y.tab.c" break; case 10: #line 113 "a.y" { (yyval.tree) = makenode("DeclarationList", 1, (yyvsp[0].tree)); } #line 1807 "y.tab.c" break; case 11: #line 114 "a.y" { (yyval.tree) = makenode("DeclarationList", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1813 "y.tab.c" break; case 12: #line 117 "a.y" { (yyvsp[0].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("Declaration", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1819 "y.tab.c" break; case 13: #line 118 "a.y" { (yyvsp[0].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("Declaration", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1825 "y.tab.c" break; case 14: #line 121 "a.y" { (yyvsp[-1].tree) = makenode("EXTERN", 0); (yyval.tree) = makenode("DeclarationType", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1831 "y.tab.c" break; case 15: #line 122 "a.y" { (yyval.tree) = makenode("DeclarationType", 1, (yyvsp[0].tree)); } #line 1837 "y.tab.c" break; case 16: #line 125 "a.y" { (yyval.tree) = makenode("InitializerDeclaratorList", 1, (yyvsp[0].tree)); } #line 1843 "y.tab.c" break; case 17: #line 126 "a.y" { (yyvsp[-1].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("InitializerDeclaratorList", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1849 "y.tab.c" break; case 18: #line 129 "a.y" { (yyval.tree) = makenode("InitializerDeclarator", 1, (yyvsp[0].tree)); } #line 1855 "y.tab.c" break; case 19: #line 130 "a.y" { (yyvsp[-1].tree) = makenode("EQ", 0); (yyval.tree) = makenode("InitializerDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1861 "y.tab.c" break; case 20: #line 133 "a.y" { (yyvsp[0].tree) = makenode("VOID", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[0].tree)); } #line 1867 "y.tab.c" break; case 21: #line 134 "a.y" { (yyvsp[0].tree) = makenode("CHAR", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[0].tree)); } #line 1873 "y.tab.c" break; case 22: #line 135 "a.y" { (yyvsp[0].tree) = makenode("SHORT", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[0].tree)); } #line 1879 "y.tab.c" break; case 23: #line 136 "a.y" { (yyvsp[0].tree) = makenode("INT", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[0].tree)); } #line 1885 "y.tab.c" break; case 24: #line 137 "a.y" { (yyvsp[0].tree) = makenode("LONG", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[0].tree)); } #line 1891 "y.tab.c" break; case 25: #line 138 "a.y" { (yyvsp[0].tree) = makenode("FLOAT", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[0].tree)); } #line 1897 "y.tab.c" break; case 26: #line 139 "a.y" { (yyvsp[0].tree) = makenode("DOUBLE", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[0].tree)); } #line 1903 "y.tab.c" break; case 27: #line 140 "a.y" { (yyvsp[-1].tree) = makenode("LONG INT", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[-1].tree)); } #line 1909 "y.tab.c" break; case 28: #line 141 "a.y" { (yyvsp[-1].tree) = makenode("LONG DOUBLE", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[-1].tree)); } #line 1915 "y.tab.c" break; case 29: #line 142 "a.y" { (yyvsp[-1].tree) = makenode("SHORT INT", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[-1].tree)); } #line 1921 "y.tab.c" break; case 30: #line 143 "a.y" { (yyvsp[-1].tree) = makenode("LONG LONG", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[-1].tree)); } #line 1927 "y.tab.c" break; case 31: #line 144 "a.y" { (yyvsp[-2].tree) = makenode("LONG LONG INT", 0); (yyval.tree) = makenode("Type", 1, (yyvsp[-2].tree)); } #line 1933 "y.tab.c" break; case 32: #line 145 "a.y" { (yyval.tree) = makenode("Type", 1, (yyvsp[0].tree)); } #line 1939 "y.tab.c" break; case 33: #line 148 "a.y" { (yyvsp[-4].tree) = makenode("STRUCT", 0); (yyvsp[-3].tree) = makenode("IDENTIFIER", 0); (yyvsp[-2].tree) = makenode("LEFT_BRACE", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACE", 0); (yyval.tree) = makenode("Struct", 5, (yyvsp[-4].tree), (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1945 "y.tab.c" break; case 34: #line 149 "a.y" { (yyvsp[-1].tree) = makenode("STRUCT", 0); (yyvsp[0].tree) = makenode("IDENTIFIER", 0); (yyval.tree) = makenode("Struct", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1951 "y.tab.c" break; case 35: #line 152 "a.y" { (yyval.tree) = makenode("StructDeclarationList", 1, (yyvsp[0].tree)); } #line 1957 "y.tab.c" break; case 36: #line 153 "a.y" { (yyval.tree) = makenode("StructDeclarationList", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1963 "y.tab.c" break; case 37: #line 156 "a.y" { (yyvsp[0].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("StructDeclaration", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1969 "y.tab.c" break; case 38: #line 159 "a.y" { (yyval.tree) = makenode("StructDeclaratorList", 1, (yyvsp[0].tree)); } #line 1975 "y.tab.c" break; case 39: #line 160 "a.y" { (yyvsp[-1].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("StructDeclaratorList", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1981 "y.tab.c" break; case 40: #line 163 "a.y" { (yyval.tree) = makenode("StructDeclarator", 1, (yyvsp[0].tree)); } #line 1987 "y.tab.c" break; case 41: #line 164 "a.y" { (yyvsp[-1].tree) = makenode("COLON", 0); (yyval.tree) = makenode("StructDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1993 "y.tab.c" break; case 42: #line 165 "a.y" { (yyvsp[-1].tree) = makenode("COLON", 0); (yyval.tree) = makenode("StructDeclarator", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 1999 "y.tab.c" break; case 43: #line 168 "a.y" { (yyval.tree) = makenode("Declarator", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2005 "y.tab.c" break; case 44: #line 169 "a.y" { (yyval.tree) = makenode("Declarator", 1, (yyvsp[0].tree)); } #line 2011 "y.tab.c" break; case 45: #line 172 "a.y" { (yyvsp[0].tree) = makenode("IDENTIFIER", 0); (yyval.tree) = makenode("RealDeclarator", 1, (yyvsp[0].tree)); if(strcmp(mytext, "main") == 0) is_main = 1; } #line 2017 "y.tab.c" break; case 46: #line 173 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("RealDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2023 "y.tab.c" break; case 47: #line 174 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_BRACKET", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACKET", 0); (yyval.tree) = makenode("RealDeclarator", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2029 "y.tab.c" break; case 48: #line 175 "a.y" { (yyvsp[-1].tree) = makenode("LEFT_BRACKET", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACKET", 0); (yyval.tree) = makenode("RealDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2035 "y.tab.c" break; case 49: #line 176 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("RealDeclarator", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2041 "y.tab.c" break; case 50: #line 177 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("RealDeclarator", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2047 "y.tab.c" break; case 51: #line 178 "a.y" { (yyvsp[-1].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("RealDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2053 "y.tab.c" break; case 52: #line 181 "a.y" { (yyvsp[0].tree) = makenode("MULT", 0); (yyval.tree) = makenode("Pointer", 1, (yyvsp[0].tree)); } #line 2059 "y.tab.c" break; case 53: #line 182 "a.y" { (yyvsp[-1].tree) = makenode("MULT", 0); (yyval.tree) = makenode("Pointer", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2065 "y.tab.c" break; case 54: #line 185 "a.y" { (yyval.tree) = makenode("ParameterList", 1, (yyvsp[0].tree)); } #line 2071 "y.tab.c" break; case 55: #line 186 "a.y" { (yyvsp[-1].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("ParameterList", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2077 "y.tab.c" break; case 56: #line 189 "a.y" { (yyval.tree) = makenode("ParameterDeclaration", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2083 "y.tab.c" break; case 57: #line 190 "a.y" { (yyval.tree) = makenode("ParameterDeclaration", 1, (yyvsp[0].tree)); } #line 2089 "y.tab.c" break; case 58: #line 191 "a.y" { (yyval.tree) = makenode("ParameterDeclaration", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2095 "y.tab.c" break; case 59: #line 194 "a.y" { (yyval.tree) = makenode("UnnamedDeclarator", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2101 "y.tab.c" break; case 60: #line 195 "a.y" { (yyval.tree) = makenode("UnnamedDeclarator", 1, (yyvsp[0].tree)); } #line 2107 "y.tab.c" break; case 61: #line 196 "a.y" { (yyval.tree) = makenode("UnnamedDeclarator", 1, (yyvsp[0].tree)); } #line 2113 "y.tab.c" break; case 62: #line 199 "a.y" { (yyvsp[0].tree) = makenode("IDENTIFIER", 0); (yyval.tree) = makenode("IdentifierList", 1, (yyvsp[0].tree)); } #line 2119 "y.tab.c" break; case 63: #line 200 "a.y" { (yyvsp[-1].tree) = makenode("COMMA", 0); (yyvsp[0].tree) = makenode("IDENTIFIER", 0); (yyval.tree) = makenode("IdentifierList", 1, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2125 "y.tab.c" break; case 64: #line 203 "a.y" { (yyval.tree) = makenode("Initializer", 1, (yyvsp[0].tree)); } #line 2131 "y.tab.c" break; case 65: #line 204 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_BRACE", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACE", 0); (yyval.tree) = makenode("Initializer", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2137 "y.tab.c" break; case 66: #line 205 "a.y" { (yyvsp[-3].tree) = makenode("LEFT_BRACE", 0); (yyvsp[-1].tree) = makenode("COMMA", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACE", 0); (yyval.tree) = makenode("Initializer", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2143 "y.tab.c" break; case 67: #line 208 "a.y" { (yyval.tree) = makenode("InitializerList", 1, (yyvsp[0].tree)); } #line 2149 "y.tab.c" break; case 68: #line 209 "a.y" { (yyvsp[-1].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("InitializerList", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2155 "y.tab.c" break; case 69: #line 212 "a.y" { (yyval.tree) = makenode("TypeName", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2161 "y.tab.c" break; case 70: #line 213 "a.y" {(yyval.tree) = makenode("TypeName", 1, (yyvsp[0].tree)); } #line 2167 "y.tab.c" break; case 71: #line 216 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("BracketDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2173 "y.tab.c" break; case 72: #line 217 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_BRACKET", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACKET", 0); (yyval.tree) = makenode("BracketDeclarator", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2179 "y.tab.c" break; case 73: #line 218 "a.y" { (yyvsp[-1].tree) = makenode("LEFT_BRACKET", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACKET", 0); (yyval.tree) = makenode("BracketDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2185 "y.tab.c" break; case 74: #line 219 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_BRACKET", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACKET", 0); (yyval.tree) = makenode("BracketDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2191 "y.tab.c" break; case 75: #line 220 "a.y" { (yyvsp[-1].tree) = makenode("LEFT_BRACKET", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACKET", 0); (yyval.tree) = makenode("BracketDeclarator", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2197 "y.tab.c" break; case 76: #line 221 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("BracketDeclarator", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2203 "y.tab.c" break; case 77: #line 222 "a.y" { (yyvsp[-1].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("BracketDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2209 "y.tab.c" break; case 78: #line 223 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("BracketDeclarator", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2215 "y.tab.c" break; case 79: #line 224 "a.y" { (yyvsp[-1].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("BracketDeclarator", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2221 "y.tab.c" break; case 80: #line 227 "a.y" { (yyval.tree) = makenode("Statement", 1, (yyvsp[0].tree)); } #line 2227 "y.tab.c" break; case 81: #line 228 "a.y" { (yyval.tree) = makenode("Statement", 1, (yyvsp[0].tree)); } #line 2233 "y.tab.c" break; case 82: #line 229 "a.y" { (yyval.tree) = makenode("Statement", 1, (yyvsp[0].tree)); } #line 2239 "y.tab.c" break; case 83: #line 230 "a.y" { (yyval.tree) = makenode("Statement", 1, (yyvsp[0].tree)); } #line 2245 "y.tab.c" break; case 84: #line 231 "a.y" { (yyval.tree) = makenode("Statement", 1, (yyvsp[0].tree)); } #line 2251 "y.tab.c" break; case 85: #line 232 "a.y" { (yyval.tree) = makenode("Statement", 1, (yyvsp[0].tree)); } #line 2257 "y.tab.c" break; case 86: #line 235 "a.y" { (yyvsp[-2].tree) = makenode("IDENTIFIER", 0); (yyvsp[-1].tree) = makenode("COLON", 0); (yyval.tree) = makenode("LabelStatement", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2263 "y.tab.c" break; case 87: #line 236 "a.y" { (yyvsp[-3].tree) = makenode("CASE", 0); (yyvsp[-1].tree) = makenode("COLON", 0); (yyval.tree) = makenode("LabelStatement", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2269 "y.tab.c" break; case 88: #line 237 "a.y" { (yyvsp[-2].tree) = makenode("DEFAULT", 0); (yyvsp[-1].tree) = makenode("COLON", 0); (yyval.tree) = makenode("LabelStatement", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2275 "y.tab.c" break; case 89: #line 240 "a.y" { (yyvsp[0].tree) = makenode("SEMI_COLON", 0); (yyval.tree) = makenode("ExpressionStatement", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2281 "y.tab.c" break; case 90: #line 241 "a.y" { (yyvsp[0].tree) = makenode("SEMI_COLON", 0); (yyval.tree) = makenode("ExpressionStatement", 1, (yyvsp[0].tree)); } #line 2287 "y.tab.c" break; case 91: #line 244 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_BRACE", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACE", 0); (yyval.tree) = makenode("ScopeStatement", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2293 "y.tab.c" break; case 92: #line 247 "a.y" { (yyval.tree) = makenode("FunctionBody", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2299 "y.tab.c" break; case 93: #line 248 "a.y" { (yyval.tree) = makenode("FunctionBody", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2305 "y.tab.c" break; case 94: #line 249 "a.y" { (yyval.tree) = makenode("FunctionBody", 1, makenode("EPSILON_PROD", 0)); } #line 2311 "y.tab.c" break; case 95: #line 252 "a.y" { (yyvsp[-4].tree) = makenode("IF", 0); (yyvsp[-3].tree) = makenode("LEFT_PAREN", 0); (yyvsp[-1].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("DecisionStatement", 5, (yyvsp[-4].tree), (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); longest_if = max(longest_if, (yyval.tree)->longest_path); } #line 2317 "y.tab.c" break; case 96: #line 253 "a.y" { (yyvsp[-6].tree) = makenode("IF", 0); (yyvsp[-5].tree) = makenode("LEFT_PAREN", 0); (yyvsp[-3].tree) = makenode("RIGHT_PAREN", 0); (yyvsp[-1].tree) = makenode("ELSE", 0); (yyval.tree) = makenode("DecisionStatement", 7, (yyvsp[-6].tree), (yyvsp[-5].tree), (yyvsp[-4].tree), (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); longest_if = max(longest_if, (yyval.tree)->longest_path); } #line 2323 "y.tab.c" break; case 97: #line 254 "a.y" { (yyvsp[-4].tree) = makenode("SWITCH", 0); (yyvsp[-3].tree) = makenode("LEFT_PAREN", 0); (yyvsp[-1].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("DecisionStatement", 5, (yyvsp[-4].tree), (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); longest_switch = max(longest_switch, (yyval.tree)->longest_path); } #line 2329 "y.tab.c" break; case 98: #line 257 "a.y" { (yyvsp[-4].tree) = makenode("WHILE", 0); (yyvsp[-3].tree) = makenode("LEFT_PAREN", 0); (yyvsp[-1].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("LoopStatement", 5, (yyvsp[-4].tree), (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); longest_while = max(longest_while, (yyval.tree)->longest_path); } #line 2335 "y.tab.c" break; case 99: #line 258 "a.y" { (yyvsp[-7].tree) = makenode("FOR", 0); (yyvsp[-6].tree) = makenode("LEFT_PAREN", 0); (yyvsp[-3].tree) = makenode("SEMI_COLON", 0); (yyvsp[-1].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("LoopStatement", 8, (yyvsp[-7].tree), (yyvsp[-6].tree), (yyvsp[-5].tree), (yyvsp[-4].tree), (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2341 "y.tab.c" break; case 100: #line 259 "a.y" { (yyvsp[-5].tree) = makenode("DO", 0); (yyvsp[-3].tree) = makenode("WHILE", 0); (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("LoopStatement", 6, (yyvsp[-5].tree), (yyvsp[-4].tree), (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2347 "y.tab.c" break; case 101: #line 262 "a.y" { (yyvsp[-1].tree) = makenode("CONTINUE", 0); (yyvsp[0].tree) = makenode("SEMI_COLON", 0); (yyval.tree) = makenode("ControlStatement", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2353 "y.tab.c" break; case 102: #line 263 "a.y" { (yyvsp[-1].tree) = makenode("BREAK", 0); (yyvsp[0].tree) = makenode("SEMI_COLON", 0); (yyval.tree) = makenode("ControlStatement", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2359 "y.tab.c" break; case 103: #line 264 "a.y" { (yyvsp[-2].tree) = makenode("RETURN", 0); (yyvsp[0].tree) = makenode("SEMI_COLON", 0); (yyval.tree) = makenode("ControlStatement", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2365 "y.tab.c" break; case 104: #line 267 "a.y" { (yyval.tree) = makenode("Expression", 1, (yyvsp[0].tree)); } #line 2371 "y.tab.c" break; case 105: #line 268 "a.y" { (yyvsp[-1].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("Expression", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2377 "y.tab.c" break; case 106: #line 271 "a.y" {(yyval.tree) = makenode("RobustExpression", 1, (yyvsp[0].tree)); } #line 2383 "y.tab.c" break; case 107: #line 272 "a.y" { (yyval.tree) = makenode("RobustExprerssion", 1, makenode("EPSILON_PROD", 0)); } #line 2389 "y.tab.c" break; case 108: #line 275 "a.y" { (yyvsp[0].tree) = makenode("SEMI_COLON", 0); (yyval.tree) = makenode("ForRobustExpression", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2395 "y.tab.c" break; case 109: #line 276 "a.y" { (yyval.tree) = makenode("ForRobustExpression", 1, (yyvsp[0].tree)); } #line 2401 "y.tab.c" break; case 110: #line 277 "a.y" { (yyvsp[0].tree) = makenode("SEMI_COLON", 0); (yyval.tree) = makenode("ForRobustExpression", 1, (yyvsp[0].tree)); } #line 2407 "y.tab.c" break; case 111: #line 280 "a.y" { (yyval.tree) = makenode("AssignExpression", 1, (yyvsp[0].tree)); } #line 2413 "y.tab.c" break; case 112: #line 281 "a.y" { node* temp = makenode("AssignOp", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("AssignExpression", 1, temp); } #line 2419 "y.tab.c" break; case 114: #line 287 "a.y" { (yyval.tree) = makenode("ConstantExpression", 1, (yyvsp[0].tree)); } #line 2425 "y.tab.c" break; case 115: #line 290 "a.y" { (yyval.tree) = makenode("ConditionalExpression", 1, (yyvsp[0].tree)); } #line 2431 "y.tab.c" break; case 116: #line 293 "a.y" { (yyval.tree) = makenode("OrExpression", 1, (yyvsp[0].tree)); } #line 2437 "y.tab.c" break; case 117: #line 294 "a.y" { node* temp = makenode("OR", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("OrExpression", 1, temp); } #line 2443 "y.tab.c" break; case 118: #line 297 "a.y" { (yyval.tree) = makenode("AndExpression", 1, (yyvsp[0].tree)); } #line 2449 "y.tab.c" break; case 119: #line 298 "a.y" { node* temp = makenode("AND", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("AndExpression", 1, temp); } #line 2455 "y.tab.c" break; case 120: #line 301 "a.y" { (yyval.tree) = makenode("BitOrExpression", 1, (yyvsp[0].tree)); } #line 2461 "y.tab.c" break; case 121: #line 302 "a.y" { node* temp = makenode("BITOR", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("BitOrExpression", 1, temp); } #line 2467 "y.tab.c" break; case 122: #line 305 "a.y" { (yyval.tree) = makenode("BitXorExpression", 1, (yyvsp[0].tree)); } #line 2473 "y.tab.c" break; case 123: #line 306 "a.y" { node* temp = makenode("BITXOR", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("BitXorExpression", 1, temp); } #line 2479 "y.tab.c" break; case 124: #line 309 "a.y" { (yyval.tree) = makenode("BitAndExpression", 1, (yyvsp[0].tree)); } #line 2485 "y.tab.c" break; case 125: #line 310 "a.y" { node* temp = makenode("BITAND", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("BitAndExpression", 1, temp); } #line 2491 "y.tab.c" break; case 126: #line 313 "a.y" { (yyval.tree) = makenode("EqExpression", 1, (yyvsp[0].tree)); } #line 2497 "y.tab.c" break; case 127: #line 314 "a.y" { node* temp = makenode("EqOp", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("EqExpression", 1, temp); } #line 2503 "y.tab.c" break; case 130: #line 321 "a.y" { (yyval.tree) = makenode("RelExpression", 1, (yyvsp[0].tree)); } #line 2509 "y.tab.c" break; case 131: #line 322 "a.y" { node* temp = makenode("RelOp", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("RelExpression", 1, temp); } #line 2515 "y.tab.c" break; case 137: #line 332 "a.y" { (yyval.tree) = makenode("AddExpression", 1, (yyvsp[0].tree)); } #line 2521 "y.tab.c" break; case 138: #line 333 "a.y" { node* temp = makenode("AddOp", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("AddExpression", 1, temp); } #line 2527 "y.tab.c" break; case 141: #line 340 "a.y" { (yyval.tree) = makenode("MultExpression", 1, (yyvsp[0].tree)); } #line 2533 "y.tab.c" break; case 142: #line 341 "a.y" { node* temp = makenode("MultOp", 2, (yyvsp[-2].tree), (yyvsp[0].tree)); (yyval.tree) = makenode("MultExpression", 1, temp); } #line 2539 "y.tab.c" break; case 146: #line 349 "a.y" { (yyval.tree) = makenode("TypeCastExpression", 1, (yyvsp[0].tree)); } #line 2545 "y.tab.c" break; case 147: #line 350 "a.y" { (yyvsp[-3].tree) = makenode("LEFT_PAREN", 0); (yyvsp[-1].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("TypeCastExpression", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2551 "y.tab.c" break; case 148: #line 353 "a.y" { (yyval.tree) = makenode("UnaryExpression", 1, (yyvsp[0].tree)); } #line 2557 "y.tab.c" break; case 149: #line 354 "a.y" { (yyvsp[-1].tree) = makenode("INC", 0); (yyval.tree) = makenode("UnaryExpression", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2563 "y.tab.c" break; case 150: #line 355 "a.y" { (yyvsp[-1].tree) = makenode("DEC", 0); (yyval.tree) = makenode("UnaryExpression", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2569 "y.tab.c" break; case 151: #line 356 "a.y" { (yyvsp[-3].tree) = makenode("SIZEOF", 0); (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("UnaryExpression", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2575 "y.tab.c" break; case 152: #line 357 "a.y" { (yyvsp[-3].tree) = makenode("SIZEOF", 0); (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("UnaryExpression", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2581 "y.tab.c" break; case 153: #line 358 "a.y" { (yyval.tree) = makenode("UnaryExpression", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2587 "y.tab.c" break; case 154: #line 361 "a.y" { (yyvsp[0].tree) = makenode("BITAND", 0); (yyval.tree) = makenode("UnaryOp", 1, (yyvsp[0].tree)); } #line 2593 "y.tab.c" break; case 155: #line 362 "a.y" { (yyvsp[0].tree) = makenode("MULT", 0); (yyval.tree) = makenode("UnaryOp", 1, (yyvsp[0].tree)); } #line 2599 "y.tab.c" break; case 156: #line 363 "a.y" { (yyvsp[0].tree) = makenode("PLUS", 0); (yyval.tree) = makenode("UnaryOp", 1, (yyvsp[0].tree)); } #line 2605 "y.tab.c" break; case 157: #line 364 "a.y" { (yyvsp[0].tree) = makenode("MINUS", 0); (yyval.tree) = makenode("UnaryOp", 1, (yyvsp[0].tree)); } #line 2611 "y.tab.c" break; case 158: #line 365 "a.y" { (yyvsp[0].tree) = makenode("BITNOT", 0); (yyval.tree) = makenode("UnaryOp", 1, (yyvsp[0].tree)); } #line 2617 "y.tab.c" break; case 159: #line 366 "a.y" { (yyvsp[0].tree) = makenode("NOT", 0); (yyval.tree) = makenode("UnaryOp", 1, (yyvsp[0].tree)); } #line 2623 "y.tab.c" break; case 160: #line 369 "a.y" { (yyval.tree) = makenode("PostfixExpression", 1, (yyvsp[0].tree)); } #line 2629 "y.tab.c" break; case 161: #line 370 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_BRACKET", 0); (yyvsp[0].tree) = makenode("RIGHT_BRACKET", 0); (yyval.tree) = makenode("PostfixExpression", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2635 "y.tab.c" break; case 162: #line 371 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("PostfixExpression", 4, (yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2641 "y.tab.c" break; case 163: #line 372 "a.y" { (yyvsp[-1].tree) = makenode("DOT", 0); (yyvsp[0].tree) = makenode("IDENTIFIER", 0); makenode("PostfixExpression", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2647 "y.tab.c" break; case 164: #line 373 "a.y" { (yyvsp[-1].tree) = makenode("ARROW", 0); (yyvsp[0].tree) = makenode("IDENTIFIER", 0); (yyval.tree) = makenode("PostfixExpression", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2653 "y.tab.c" break; case 165: #line 374 "a.y" { (yyval.tree) = makenode("PostfixExpression", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2659 "y.tab.c" break; case 166: #line 377 "a.y" { (yyvsp[0].tree) = makenode("INC", 0); (yyval.tree) = makenode("PostfixOp", 1, (yyvsp[0].tree)); } #line 2665 "y.tab.c" break; case 167: #line 378 "a.y" { (yyvsp[0].tree) = makenode("DEC", 0); (yyval.tree) = makenode("PostfixOp", 1, (yyvsp[0].tree)); } #line 2671 "y.tab.c" break; case 168: #line 381 "a.y" { (yyvsp[0].tree) = makenode("IDENTIFIER", 0); (yyval.tree) = makenode("PrimExpression", 1, (yyvsp[0].tree)); } #line 2677 "y.tab.c" break; case 169: #line 382 "a.y" { (yyvsp[0].tree) = makenode("NUMBER", 0); (yyval.tree) = makenode("PrimExpression", 1, (yyvsp[0].tree)); } #line 2683 "y.tab.c" break; case 170: #line 383 "a.y" { (yyvsp[0].tree) = makenode("CHARLITERAL", 0); (yyval.tree) = makenode("PrimExpression", 1, (yyvsp[0].tree)); } #line 2689 "y.tab.c" break; case 171: #line 384 "a.y" { (yyval.tree) = makenode("PrimExpression", 1, (yyvsp[0].tree)); } #line 2695 "y.tab.c" break; case 172: #line 385 "a.y" { (yyvsp[-2].tree) = makenode("LEFT_PAREN", 0); (yyvsp[0].tree) = makenode("RIGHT_PAREN", 0); (yyval.tree) = makenode("PrimExpression", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2701 "y.tab.c" break; case 173: #line 388 "a.y" { (yyvsp[0].tree) = makenode("STRLITERAL", 0); (yyval.tree) = makenode("String", 1, (yyvsp[0].tree)); } #line 2707 "y.tab.c" break; case 174: #line 389 "a.y" { (yyvsp[0].tree) = makenode("STRLITERAL", 0); (yyval.tree) = makenode("String", 2, (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2713 "y.tab.c" break; case 175: #line 392 "a.y" { (yyval.tree) = makenode("ArgExpressionList", 1, (yyvsp[0].tree)); } #line 2719 "y.tab.c" break; case 176: #line 393 "a.y" { (yyvsp[-1].tree) = makenode("COMMA", 0); (yyval.tree) = makenode("ArgExpressionList", 3, (yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree)); } #line 2725 "y.tab.c" break; case 177: #line 394 "a.y" { (yyval.tree) = makenode("ArgExpressionList", 1, makenode("EPSILON_PROD", 0)); } #line 2731 "y.tab.c" break; #line 2735 "y.tab.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ { const int yylhs = yyr1[yyn] - YYNTOKENS; const int yyi = yypgoto[yylhs] + *yyssp; yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp ? yytable[yyi] : yydefgoto[yylhs]); } goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif /*-----------------------------------------------------. | yyreturn -- parsing is finished, return the result. | `-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[+*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; } #line 397 "a.y" void yyerror(char* s) { printf("***parsing terminated*** [syntax error]\n"); exit(0); } int max(int a, int b) { if(a > b) { return a; } else { return b; } } int get_longest_path(node* root) { int ret = 0; int max_1 = 0; int max_2 = 0; if(root->num_of_children == 0) { return 1; } for(int i = 0; i < root->num_of_children; i++) { ret = max(ret, root->children[i]->longest_path); if(root->children[i]->depth > max_1) { max_2 = max_1; max_1 = root->children[i]->depth; } else if(root->children[i]->depth > max_2) { max_2 = root->children[i]->depth; } } ret = max(ret, max_1 + max_2 + 1); return ret; } node* makenode(char* name, int num_of_children, ...) { node* root = (node*)malloc(sizeof(node)); root->name = (char*)malloc(100 * sizeof(char)); strcpy(root->name, name); root->num_of_children = num_of_children; root->children = (node**)malloc(num_of_children * sizeof(node*)); root->depth = 1; va_list arg_list; va_start(arg_list, num_of_children); for(int i = 0; i < num_of_children; i++) { node* new_node = va_arg(arg_list, node*); root->children[i] = new_node; root->depth = max(root->depth, new_node->depth + 1); } va_end(arg_list); root->longest_path = get_longest_path(root); longest_path = max(longest_path, root->longest_path); return root; } int main(int argc, char** argv) { mytext = (char*)malloc(100 * sizeof(char*)); yyparse(); printf("%d\n", longest_path); printf("%d\n", longest_if); printf("%d\n", longest_while); printf("%d\n", longest_switch); printf("%d\n", longest_main); return 0; }
the_stack_data/1185296.c
// Tests UAF detection where Allocate/Deallocate/Use // happen in separate threads. // RUN: %clang_hwasan %s -o %t && not %run %t > %t.out 2>&1 // RUN: cat %t.out | FileCheck %s // RUN: cat %t.out | FileCheck --check-prefix=CHECK-THREAD %s // REQUIRES: stable-runtime #include <pthread.h> #include <stdlib.h> #include <stdio.h> #include <sanitizer/hwasan_interface.h> char *volatile x; int state; void *Allocate(void *arg) { x = (char*)malloc(10); __sync_fetch_and_add(&state, 1); while (__sync_fetch_and_add(&state, 0) != 3) {} return NULL; } void *Deallocate(void *arg) { free(x); __sync_fetch_and_add(&state, 1); while (__sync_fetch_and_add(&state, 0) != 3) {} return NULL; } void *Use(void *arg) { x[5] = 42; // CHECK: ERROR: HWAddressSanitizer: tag-mismatch on address // CHECK: WRITE of size 1 {{.*}} in thread T3 // CHECK: thread-uaf.c:[[@LINE-3]] // CHECK: Cause: use-after-free // CHECK: freed by thread T2 here // CHECK: in Deallocate // CHECK: previously allocated here: // CHECK: in Allocate // CHECK-THREAD-DAG: Thread: T2 0x // CHECK-THREAD-DAG: Thread: T3 0x // CHECK-THREAD-DAG: Thread: T0 0x // CHECK-THREAD-DAG: Thread: T1 0x __sync_fetch_and_add(&state, 1); return NULL; } int main() { __hwasan_enable_allocator_tagging(); pthread_t t1, t2, t3; pthread_create(&t1, NULL, Allocate, NULL); while (__sync_fetch_and_add(&state, 0) != 1) {} pthread_create(&t2, NULL, Deallocate, NULL); while (__sync_fetch_and_add(&state, 0) != 2) {} pthread_create(&t3, NULL, Use, NULL); pthread_join(t1, NULL); pthread_join(t2, NULL); pthread_join(t3, NULL); }
the_stack_data/68887838.c
/* ヘッダファイルのインクルード */ #include <stdio.h> /* 標準入出力 */ /* main関数の定義 */ int main(void){ /* 変数の宣言 */ FILE *fp; /* ファイルポインタfp */ int i; /* ループ用変数i */ char buf[4]; /* サイズ4のchar型配列バッファbuf. */ /* 高水準入出力関数で使われるバッファサイズを出力 */ printf("BUFSIZ = %d\n", BUFSIZ); /* printfでBUFSIZの値を出力. */ /* ファイルtest_1.txtを開く. */ fp = fopen("test_1.txt", "rb"); /* fopenで"test_1.txt"を"rb"で開く. */ if (fp == NULL){ /* NULLの時はエラー. */ /* エラー処理 */ printf("fopen error!\n"); /* "fopen error!"と出力. */ return -1; /* -1を返す. */ } /* 読込開始 */ printf("fread start\n"); /* "fread start"と出力. */ /* test_1.txt(サイズ8192バイト)の内容を読み込む. */ for (i = 0; i < 2048; i++){ /* 4バイトずつ2048回読み込む.(4 * 2048 = 8192でBUFSIZと同じ.) */ /* 4バイト読み込む. */ fread(buf, 4, 1, fp); /* freadで4バイトずつbufに読み込む.(純粋にfreadだけ呼びたいので出力とかはしない.) */ } /* 読込終了 */ printf("fread end\n"); /* "fread end"と出力. */ /* 閉じる */ fclose(fp); /* fcloseでfpを閉じる. */ /* プログラムの終了 */ return 0; }
the_stack_data/12238.c
#include <assert.h> #include <math.h> int main() { __CPROVER_isunorderedd(); assert(0); return 0; }
the_stack_data/154905.c
#include <stdio.h> #include <string.h> int main() { char arr[6] = {'H', 'i', '\0', 'h', 'i', '\0'}; printf("%s\n", arr); printf("%zu\n", strlen(arr)); return 0; }
the_stack_data/7368.c
#include <stdlib.h> void median(unsigned char * out, unsigned char * in, int w, int h) { int i, j, m, n; /* sorting array (optional) to find median */ unsigned char sort[9]; unsigned char tmp; for(i = 0; i < h; i ++) { for(j = 0; j < w; j ++) { if(i > 0 && i < h - 1 && j > 0 && j < w-1){ // avoid boarder for(m = -1; m <= +1; m++){ for(n = -1; n <= +1; n++){ sort[(m+1)*3+(n+1)] = in[(i+m)*w+(j+n)]; } } for(m = 0; m < 8; m++){ for(n = 0; n < 8-m; n++){ if(sort[n] > sort[n+1]){ tmp = sort[n]; sort[n] = sort[n+1]; sort[n+1] = tmp; } } } out[i*w+j] = sort[4]; }else{ // copy the boarder out[i*w+j] = in[i*w+j]; } } } }
the_stack_data/3263678.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include <event.h> void signalhandler(int fd, short type, void *arg){ struct event *signal_event = (struct event *)arg; static int count = 0; printf("in function signal_cb...\n"); printf("handle signal: %d\n", EVENT_SIGNAL(signal_event)); if (count >= 3) event_del(signal_event); count ++; struct event *ev = arg; printf("SIGINT triggered!!!\n"); } int main (int argc, char * argv[]){ struct event ev; event_init(); event_set(&ev, SIGINT, EV_SIGNAL | EV_PERSIST, signalhandler, &ev); event_add(&ev, NULL); //event_del(&ev); event_dispatch(); return 0; }
the_stack_data/119952.c
#include <stdint.h> #include <inttypes.h> #include <stdbool.h> #include <stddef.h> #include <net/ethernet.h> #include <netinet/ip.h> #include <netinet/udp.h> #define ___constant_swab16(x) ((uint16_t)( \ (((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \ (((uint16_t)(x) & (uint16_t)0xff00U) >> 8))) #define ___constant_swab32(x) ((uint32_t)( \ (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \ (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24))) #define bpf_htons(d) (___constant_swab16((d))) #define bpf_htonl(d) (___constant_swab32((d))) static void (*ubpf_printf)(const char *fmt, ...) = (void *)7; static void *(*ubpf_packet_data)(const void *) = (void *)9; static void *(*ubpf_adjust_head)(const void *, uint64_t) = (void *)8; void* memcpy(void* dest, const void* src, size_t len); struct vxlan_h { uint32_t flags_reserved; uint32_t vni_reserved; }; /* * This program presents more complex example: VXLAN encapsulation. The aim is to show the VXLAN encapsulation, so the * outer Ethernet and IP headers are just a simple copy of inner Etherner/IP headers. In the real-world application * outer Ethernet/IP headers should be filled with addresses of tunnel endpoints. * FIXME: the example can contain some bugs (e.g. calculation of checksum or packet length fields). */ uint64_t entry(void *ctx, uint64_t pkt_len) { bool pass = true; void *pkt = ubpf_packet_data(ctx); if (pkt_len < sizeof(struct ether_header) + sizeof(struct iphdr)) { return 1; } size_t head_len = sizeof(struct vxlan_h) + sizeof(struct udphdr) + sizeof(struct iphdr) + sizeof(struct ether_header); pkt = ubpf_adjust_head(ctx, head_len); struct ether_header *new_eth = (void *) pkt; memcpy(new_eth, (char *)new_eth + head_len, sizeof(struct ether_header)); struct iphdr *new_ip = (void *)(new_eth + 1); memcpy(new_ip, (char *)new_eth + head_len + sizeof(struct ether_header), sizeof(struct iphdr)); new_ip->protocol = 0x11; struct udphdr *udp = (void *)(new_ip + 1); udp->uh_sport = bpf_htons(5555); // random source UDP port udp->uh_dport = bpf_htons(4789); // VXLAN UDP port size_t udp_len = pkt_len + sizeof(struct udphdr) + sizeof(struct vxlan_h); udp->uh_ulen = bpf_htons(udp_len); struct vxlan_h *vxlan = (void *)(udp + 1); // Set VXLAN flags=0x11, reserved fields fill with zeros vxlan->flags_reserved = bpf_htonl(0x11000000); // Set VXLAN VNI=17, reserved fields fill with zeros vxlan->vni_reserved = bpf_htonl(0x00001100); return pass; }
the_stack_data/62638514.c
//program to add two sparse matric created by array #include <stdio.h> #include <stdlib.h> struct element { int row; int col; int el; }; struct sparse { int m, n; int num; struct element *e; }; void create(struct sparse *s) { printf("enter the dimensions of the matrix\n"); scanf("%d %d", &s->m, &s->n); printf("enter the number of non zero elements\n"); scanf("%d", &s->num); s->e = (struct element *)malloc(s->num * sizeof(struct element)); printf("enter the row, column and the element\n"); for (int k = 0; k < s->num; k++) { scanf("%d %d %d", &s->e[k].row, &s->e[k].col, &s->e[k].el); } } struct sparse *add(struct sparse *s1, struct sparse *s2) { //base condition if (s1->m != s2->m || s1->n != s2->n) { return 0; } struct sparse *sum; sum->num; sum->e = (struct element *)malloc((s1->num + s2->num) * sizeof(struct element)); int i = 0, j = 0, k = 0; //i->sparse matrix 1 //j->sparse matrix 2 //k->sparse matrix 3 while (i < s1->num && j < s2->num) { if (s1->e[i].row < s2->e[j].row) { sum->e[k++] = s1->e[i++]; } else if (s1->e[i].row > s2->e[j].row) { sum->e[k++] = s2->e[j++]; } else { if (s1->e[i].col < s2->e[j].col) { sum->e[k++] = s1->e[i++]; } else if (s1->e[i].col > s2->e[j].col) { sum->e[k++] = s2->e[j++]; } else { sum->e[k] = s1->e[i]; sum->e[k++].el = s1->e[i++].el + s2->e[j++].el; } } } if (i == s1->num) { for (; j < s2->num; j++) { sum->e[k++] = s2->e[j++]; } } else { for (; i < s1->num; i++) { sum->e[k++] = s1->e[i++]; } } sum->m = s1->m; sum->n = s1->n; sum->num = k; return sum; } void display(struct sparse s) { int i, j, k = 0; for (i = 0; i < s.m; i++) { for (j = 0; j < s.n; j++) { if (i == s.e[k].row && j == s.e[k].col) { printf("%d ", s.e[k++].el); } else { printf("0 "); } } printf("\n"); } } int main() { struct sparse s1; struct sparse s2; struct sparse *s3; printf("creating first matrix\n"); create(&s1); printf("creating second matrix\n"); create(&s2); s3 = add(&s1, &s2); //printf("%d,%d,%d\n", s3->m, s3->n, s3->num); display(*s3); return 0; }
the_stack_data/78529.c
#include <stdio.h> #include <stdlib.h> void hanoi(int nDisk, int left, int right, int middle) { if(nDisk > 0) { hanoi(nDisk-1, left, middle, right); printf("Move %d to %d\n", left, right); hanoi(nDisk-1, middle, right, left); } } void main() { int disks; scanf("%d", &disks); hanoi(disks,1,3,2); }
the_stack_data/154828675.c
/* * refclock_as2201 - clock driver for the Austron 2201A GPS * Timing Receiver */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #if defined(REFCLOCK) && defined(CLOCK_AS2201) #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" #include <stdio.h> #include <ctype.h> /* * This driver supports the Austron 2200A/2201A GPS Receiver with * Buffered RS-232-C Interface Module. Note that the original 2200/2201 * receivers will not work reliably with this driver, since the older * design cannot accept input commands at any reasonable data rate. * * The program sends a "*toc\r" to the radio and expects a response of * the form "yy:ddd:hh:mm:ss.mmm\r" where yy = year of century, ddd = * day of year, hh:mm:ss = second of day and mmm = millisecond of * second. Then, it sends statistics commands to the radio and expects * a multi-line reply showing the corresponding statistics or other * selected data. Statistics commands are sent in order as determined by * a vector of commands; these might have to be changed with different * radio options. If flag4 of the fudge configuration command is set to * 1, the statistics data are written to the clockstats file for later * processing. * * In order for this code to work, the radio must be placed in non- * interactive mode using the "off" command and with a single <cr> * response using the "term cr" command. The setting of the "echo" * and "df" commands does not matter. The radio should select UTC * timescale using the "ts utc" command. * * There are two modes of operation for this driver. The first with * default configuration is used with stock kernels and serial-line * drivers and works with almost any machine. In this mode the driver * assumes the radio captures a timestamp upon receipt of the "*" that * begins the driver query. Accuracies in this mode are in the order of * a millisecond or two and the receiver can be connected to only one * host. * * The second mode of operation can be used for SunOS kernels that have * been modified with the ppsclock streams module included in this * distribution. The mode is enabled if flag3 of the fudge configuration * command has been set to 1. In this mode a precise timestamp is * available using a gadget box and 1-pps signal from the receiver. This * improves the accuracy to the order of a few tens of microseconds. In * addition, the serial output and 1-pps signal can be bussed to more * than one hosts, but only one of them should be connected to the * radio input data line. */ /* * GPS Definitions */ #define SMAX 200 /* statistics buffer length */ #define DEVICE "/dev/gps%d" /* device name and unit */ #define SPEED232 B9600 /* uart speed (9600 baud) */ #define PRECISION (-20) /* precision assumed (about 1 us) */ #define REFID "GPS\0" /* reference ID */ #define DESCRIPTION "Austron 2201A GPS Receiver" /* WRU */ #define LENTOC 19 /* yy:ddd:hh:mm:ss.mmm timecode lngth */ /* * AS2201 unit control structure. */ struct as2201unit { char *lastptr; /* statistics buffer pointer */ char stats[SMAX]; /* statistics buffer */ int linect; /* count of lines remaining */ int index; /* current statistics command */ }; /* * Radio commands to extract statitistics * * A command consists of an ASCII string terminated by a <cr> (\r). The * command list consist of a sequence of commands terminated by a null * string ("\0"). One command from the list is sent immediately * following each received timecode (*toc\r command) and the ASCII * strings received from the radio are saved along with the timecode in * the clockstats file. Subsequent commands are sent at each timecode, * with the last one in the list followed by the first one. The data * received from the radio consist of ASCII strings, each terminated by * a <cr> (\r) character. The number of strings for each command is * specified as the first line of output as an ASCII-encode number. Note * that the ETF command requires the Input Buffer Module and the LORAN * commands require the LORAN Assist Module. However, if these modules * are not installed, the radio and this driver will continue to operate * successfuly, but no data will be captured for these commands. */ static char stat_command[][30] = { "ITF\r", /* internal time/frequency */ "ETF\r", /* external time/frequency */ "LORAN ENSEMBLE\r", /* GPS/LORAN ensemble statistics */ "LORAN TDATA\r", /* LORAN signal data */ "ID;OPT;VER\r", /* model; options; software version */ "ITF\r", /* internal time/frequency */ "ETF\r", /* external time/frequency */ "LORAN ENSEMBLE\r", /* GPS/LORAN ensemble statistics */ "TRSTAT\r", /* satellite tracking status */ "POS;PPS;PPSOFF\r", /* position, pps source, offsets */ "ITF\r", /* internal time/frequency */ "ETF\r", /* external time/frequency */ "LORAN ENSEMBLE\r", /* GPS/LORAN ensemble statistics */ "LORAN TDATA\r", /* LORAN signal data */ "UTC\r", /* UTC leap info */ "ITF\r", /* internal time/frequency */ "ETF\r", /* external time/frequency */ "LORAN ENSEMBLE\r", /* GPS/LORAN ensemble statistics */ "TRSTAT\r", /* satellite tracking status */ "OSC;ET;TEMP\r", /* osc type; tune volts; oven temp */ "\0" /* end of table */ }; /* * Function prototypes */ static int as2201_start P((int, struct peer *)); static void as2201_shutdown P((int, struct peer *)); static void as2201_receive P((struct recvbuf *)); static void as2201_poll P((int, struct peer *)); /* * Transfer vector */ struct refclock refclock_as2201 = { as2201_start, /* start up driver */ as2201_shutdown, /* shut down driver */ as2201_poll, /* transmit poll message */ noentry, /* not used (old as2201_control) */ noentry, /* initialize driver (not used) */ noentry, /* not used (old as2201_buginfo) */ NOFLAGS /* not used */ }; /* * as2201_start - open the devices and initialize data for processing */ static int as2201_start( int unit, struct peer *peer ) { register struct as2201unit *up; struct refclockproc *pp; int fd; char gpsdev[20]; /* * Open serial port. Use CLK line discipline, if available. */ (void)sprintf(gpsdev, DEVICE, unit); if (!(fd = refclock_open(gpsdev, SPEED232, LDISC_CLK))) return (0); /* * Allocate and initialize unit structure */ if (!(up = (struct as2201unit *) emalloc(sizeof(struct as2201unit)))) { (void) close(fd); return (0); } memset((char *)up, 0, sizeof(struct as2201unit)); pp = peer->procptr; pp->io.clock_recv = as2201_receive; pp->io.srcclock = (caddr_t)peer; pp->io.datalen = 0; pp->io.fd = fd; if (!io_addclock(&pp->io)) { (void) close(fd); free(up); return (0); } pp->unitptr = (caddr_t)up; /* * Initialize miscellaneous variables */ peer->precision = PRECISION; peer->burst = NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); up->lastptr = up->stats; up->index = 0; return (1); } /* * as2201_shutdown - shut down the clock */ static void as2201_shutdown( int unit, struct peer *peer ) { register struct as2201unit *up; struct refclockproc *pp; pp = peer->procptr; up = (struct as2201unit *)pp->unitptr; io_closeclock(&pp->io); free(up); } /* * as2201__receive - receive data from the serial interface */ static void as2201_receive( struct recvbuf *rbufp ) { register struct as2201unit *up; struct refclockproc *pp; struct peer *peer; l_fp trtmp; /* * Initialize pointers and read the timecode and timestamp. */ peer = (struct peer *)rbufp->recv_srcclock; pp = peer->procptr; up = (struct as2201unit *)pp->unitptr; pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &trtmp); #ifdef DEBUG if (debug) printf("gps: timecode %d %d %s\n", up->linect, pp->lencode, pp->a_lastcode); #endif if (pp->lencode == 0) return; /* * If linect is greater than zero, we must be in the middle of a * statistics operation, so simply tack the received data at the * end of the statistics string. If not, we could either have * just received the timecode itself or a decimal number * indicating the number of following lines of the statistics * reply. In the former case, write the accumulated statistics * data to the clockstats file and continue onward to process * the timecode; in the later case, save the number of lines and * quietly return. */ if (pp->sloppyclockflag & CLK_FLAG2) pp->lastrec = trtmp; if (up->linect > 0) { up->linect--; if ((int)(up->lastptr - up->stats + pp->lencode) > SMAX - 2) return; *up->lastptr++ = ' '; (void)strcpy(up->lastptr, pp->a_lastcode); up->lastptr += pp->lencode; return; } else { if (pp->lencode == 1) { up->linect = atoi(pp->a_lastcode); return; } else { record_clock_stats(&peer->srcadr, up->stats); #ifdef DEBUG if (debug) printf("gps: stat %s\n", up->stats); #endif } } up->lastptr = up->stats; *up->lastptr = '\0'; /* * We get down to business, check the timecode format and decode * its contents. If the timecode has invalid length or is not in * proper format, we declare bad format and exit. */ if (pp->lencode < LENTOC) { refclock_report(peer, CEVNT_BADREPLY); return; } /* * Timecode format: "yy:ddd:hh:mm:ss.mmm" */ if (sscanf(pp->a_lastcode, "%2d:%3d:%2d:%2d:%2d.%3ld", &pp->year, &pp->day, &pp->hour, &pp->minute, &pp->second, &pp->nsec) != 6) { refclock_report(peer, CEVNT_BADREPLY); return; } pp->nsec *= 1000000; /* * Test for synchronization (this is a temporary crock). */ if (pp->a_lastcode[2] != ':') pp->leap = LEAP_NOTINSYNC; else pp->leap = LEAP_NOWARNING; /* * Process the new sample in the median filter and determine the * timecode timestamp. */ if (!refclock_process(pp)) { refclock_report(peer, CEVNT_BADTIME); return; } /* * If CLK_FLAG4 is set, initialize the statistics buffer and * send the next command. If not, simply write the timecode to * the clockstats file. */ (void)strcpy(up->lastptr, pp->a_lastcode); up->lastptr += pp->lencode; if (pp->sloppyclockflag & CLK_FLAG4) { *up->lastptr++ = ' '; (void)strcpy(up->lastptr, stat_command[up->index]); up->lastptr += strlen(stat_command[up->index]); up->lastptr--; *up->lastptr = '\0'; (void)write(pp->io.fd, stat_command[up->index], strlen(stat_command[up->index])); up->index++; if (*stat_command[up->index] == '\0') up->index = 0; } } /* * as2201_poll - called by the transmit procedure * * We go to great pains to avoid changing state here, since there may be * more than one eavesdropper receiving the same timecode. */ static void as2201_poll( int unit, struct peer *peer ) { struct refclockproc *pp; /* * Send a "\r*toc\r" to get things going. We go to great pains * to avoid changing state, since there may be more than one * eavesdropper watching the radio. */ pp = peer->procptr; if (write(pp->io.fd, "\r*toc\r", 6) != 6) { refclock_report(peer, CEVNT_FAULT); } else { pp->polls++; if (!(pp->sloppyclockflag & CLK_FLAG2)) get_systime(&pp->lastrec); } if (peer->burst > 0) return; if (pp->coderecv == pp->codeproc) { refclock_report(peer, CEVNT_TIMEOUT); return; } refclock_receive(peer); peer->burst = NSTAGE; } #else int refclock_as2201_bs; #endif /* REFCLOCK */
the_stack_data/171310.c
#include <stdlib.h> #include <string.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/fcntl.h> #include <unistd.h> #include <netdb.h> #include<signal.h> #define MAX_INPUT_SIZE 256 int main(int argc, char *argv[]) { int fd, sockfd, newsockfd, clilen, portno, n, flag; struct sockaddr_in serv_addr, newaddr; pid_t childpd; char buffer[MAX_INPUT_SIZE]; if (argc < 2) { fprintf(stderr, " no port\n"); exit(1); } portno = atoi(argv[1]); sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { perror("error opening socket"); exit(1); } bzero((char *)&serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = (htonl)INADDR_ANY; serv_addr.sin_port = htons(portno); if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { perror("error binding"); exit(0); } if (listen(sockfd, 4) < 0) { perror("error in listening........."); exit(1); } else{ printf("listening...\n"); } while (1) { clilen = sizeof(serv_addr); newsockfd = accept(sockfd, (struct sockaddr *)&newaddr, (socklen_t *)&clilen); if (newsockfd < 0) { perror("error on accept"); exit(1); } else { printf("connected to %s: %d\n", inet_ntoa(newaddr.sin_addr), ntohs(newaddr.sin_port)); } if ((childpd = fork()) == 0) { close(sockfd); while (1) { recv(newsockfd, buffer, sizeof(buffer), 0); if (buffer[0]=='\0') { printf("client disconnected...\n"); exit(0); } else { printf("Client %d message : %s\n",ntohs(newaddr.sin_port), buffer); flag = 0; int num1 = 0, num2 = 0; int c, j; for (int i = 0; i < strlen(buffer) - 1; i++) { if (buffer[i] == '+' || buffer[i] == '-' || buffer[i] == '*' || buffer[i] == '/') { flag = 1; j = i; } else { if (flag == 0) { num1 = (10 * num1) + (buffer[i] - '0'); } else if (flag != 0) { num2 = (10 * num2) + (buffer[i] - '0'); } } } int result; if (buffer[j] == '+') result = num1 + num2; else if (buffer[j] == '-') result = num1 - num2; else if (buffer[j] == '/') result = num1 / num2; else if (buffer[j] == '*') result = num1 * num2; printf("sending reply to client %d:%i\n",ntohs(newaddr.sin_port), result); bzero(buffer, MAX_INPUT_SIZE); sprintf(buffer, "%d", result); send(newsockfd, buffer, strlen(buffer), 0); bzero(buffer, sizeof(buffer)); } } } } if (read(newsockfd, buffer, sizeof(buffer)) <= 0) printf("closing server..\n"); close(newsockfd); return 0; }
the_stack_data/297975.c
int main() { int a=4, b=3; a<<=b; print ("a 32"); printid(a); a>>=b; print ("a 4"); printid(a); return 0; }
the_stack_data/9513597.c
// Program for nCr Calculation #include <stdio.h> int factorial(int n) { // Declaration int i, fact = 1; // Fact variable stores factorial // Iterating over 1-n to find factorial till n for (i = 2; i <= n; i++) fact *= i; return fact; } int main() { // Declaration int n, r; // User Input printf("Enter 'n': "); scanf("%d", &n); printf("Enter 'r': "); scanf("%d", &r); // Get factorial of n, r and n-r int fact_n = factorial(n); int fact_r = factorial(r); int fact_nr = factorial(n - r); // Calculate combination float combination = (float)fact_n / (fact_r * fact_nr); // Output printf("%dC%d = %0.2f", n, r, combination); return 0; }
the_stack_data/31388813.c
#include <math.h> #include <stdint.h> #include <float.h> #if FLT_EVAL_METHOD > 1U && LDBL_MANT_DIG == 64 #define SPLIT (0x1p32 + 1) #else #define SPLIT (0x1p27 + 1) #endif static void sq(double_t* hi, double_t* lo, double x) { double_t xh, xl, xc; xc = (double_t)x * SPLIT; xh = x - xc + xc; xl = x - xh; *hi = (double_t)x * x; *lo = xh * xh - *hi + 2 * xh * xl + xl * xl; } double hypot(double x, double y) { union { double f; uint64_t i; } ux = {x}, uy = {y}, ut; int ex, ey; double_t hx, lx, hy, ly, z; /* arrange |x| >= |y| */ ux.i &= -1ULL >> 1; uy.i &= -1ULL >> 1; if (ux.i < uy.i) { ut = ux; ux = uy; uy = ut; } /* special cases */ ex = ux.i >> 52; ey = uy.i >> 52; x = ux.f; y = uy.f; /* note: hypot(inf,nan) == inf */ if (ey == 0x7ff) return y; if (ex == 0x7ff || uy.i == 0) return x; /* note: hypot(x,y) ~= x + y*y/x/2 with inexact for small y/x */ /* 64 difference is enough for ld80 double_t */ if (ex - ey > 64) return x + y; /* precise sqrt argument in nearest rounding mode without overflow */ /* xh*xh must not overflow and xl*xl must not underflow in sq */ z = 1; if (ex > 0x3ff + 510) { z = 0x1p700; x *= 0x1p-700; y *= 0x1p-700; } else if (ey < 0x3ff - 450) { z = 0x1p-700; x *= 0x1p700; y *= 0x1p700; } sq(&hx, &lx, x); sq(&hy, &ly, y); return z * sqrt(ly + lx + hy + hx); }
the_stack_data/67465.c
int main(){ int a=0; if (a==5) { return a+1; } else { return a+2; }; }
the_stack_data/148692.c
// 包含 stdio.h 是为了使用 printf 函数,在屏幕上输出文字 #include <stdio.h> // 使用 Pthread 相关函数需要包含头文件 pthread.h #include <pthread.h> // 为了使用 sleep 函数,使程序暂停执行一定时间 #include <unistd.h> // 定义的线程函数 void *thread_function (void *arg) { printf("这个是线程函数\n"); } int main(void) { pthread_t thread; int result; result = pthread_create(&thread, NULL, &thread_function, NULL); if (0 != result) { printf("创建线程失败!\n"); return 0; } sleep(1); printf("主程序执行完成。\n"); return 0; } // 更多详细内容,参考 // https://www.man7.org/linux/man-pages/man3/pthread_create.3.html
the_stack_data/40323.c
# 1 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" # 1 "/home/giulianob/gcc_git_gnu/build_temp/libiberty//" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" # 20 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" # 1 "./config.h" 1 # 21 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" 1 # 42 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" # 1 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/ansidecl.h" 1 # 43 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" 2 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 143 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 3 4 # 143 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 3 4 typedef long int ptrdiff_t; # 209 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 3 4 typedef long unsigned int size_t; # 321 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 3 4 typedef int wchar_t; # 415 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 3 4 typedef struct { long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); # 426 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 3 4 } max_align_t; # 46 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" 2 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stdarg.h" 1 3 4 # 40 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stdarg.h" 3 4 typedef __builtin_va_list __gnuc_va_list; # 99 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stdarg.h" 3 4 typedef __gnuc_va_list va_list; # 48 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" 2 # 1 "/usr/include/stdio.h" 1 3 4 # 27 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4 # 33 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 461 "/usr/include/features.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 # 452 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 453 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/long-double.h" 1 3 4 # 454 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 # 462 "/usr/include/features.h" 2 3 4 # 485 "/usr/include/features.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 # 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 # 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 # 486 "/usr/include/features.h" 2 3 4 # 34 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 2 3 4 # 28 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 34 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 # 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/timesize.h" 1 3 4 # 29 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; typedef signed long int __int64_t; typedef unsigned long int __uint64_t; typedef __int8_t __int_least8_t; typedef __uint8_t __uint_least8_t; typedef __int16_t __int_least16_t; typedef __uint16_t __uint_least16_t; typedef __int32_t __int_least32_t; typedef __uint32_t __uint_least32_t; typedef __int64_t __int_least64_t; typedef __uint64_t __uint_least64_t; typedef long int __quad_t; typedef unsigned long int __u_quad_t; typedef long int __intmax_t; typedef unsigned long int __uintmax_t; # 141 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 # 142 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/time64.h" 1 3 4 # 143 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 typedef unsigned long int __dev_t; typedef unsigned int __uid_t; typedef unsigned int __gid_t; typedef unsigned long int __ino_t; typedef unsigned long int __ino64_t; typedef unsigned int __mode_t; typedef unsigned long int __nlink_t; typedef long int __off_t; typedef long int __off64_t; typedef int __pid_t; typedef struct { int __val[2]; } __fsid_t; typedef long int __clock_t; typedef unsigned long int __rlim_t; typedef unsigned long int __rlim64_t; typedef unsigned int __id_t; typedef long int __time_t; typedef unsigned int __useconds_t; typedef long int __suseconds_t; typedef int __daddr_t; typedef int __key_t; typedef int __clockid_t; typedef void * __timer_t; typedef long int __blksize_t; typedef long int __blkcnt_t; typedef long int __blkcnt64_t; typedef unsigned long int __fsblkcnt_t; typedef unsigned long int __fsblkcnt64_t; typedef unsigned long int __fsfilcnt_t; typedef unsigned long int __fsfilcnt64_t; typedef long int __fsword_t; typedef long int __ssize_t; typedef long int __syscall_slong_t; typedef unsigned long int __syscall_ulong_t; typedef __off64_t __loff_t; typedef char *__caddr_t; typedef long int __intptr_t; typedef unsigned int __socklen_t; typedef int __sig_atomic_t; # 39 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h" 1 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h" 1 3 4 # 13 "/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h" 3 4 typedef struct { int __count; union { unsigned int __wch; char __wchb[4]; } __value; } __mbstate_t; # 6 "/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h" 2 3 4 typedef struct _G_fpos_t { __off_t __pos; __mbstate_t __state; } __fpos_t; # 40 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h" 1 3 4 # 10 "/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h" 3 4 typedef struct _G_fpos64_t { __off64_t __pos; __mbstate_t __state; } __fpos64_t; # 41 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__FILE.h" 1 3 4 struct _IO_FILE; typedef struct _IO_FILE __FILE; # 42 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/FILE.h" 1 3 4 struct _IO_FILE; typedef struct _IO_FILE FILE; # 43 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h" 1 3 4 # 35 "/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h" 3 4 struct _IO_FILE; struct _IO_marker; struct _IO_codecvt; struct _IO_wide_data; typedef void _IO_lock_t; struct _IO_FILE { int _flags; char *_IO_read_ptr; char *_IO_read_end; char *_IO_read_base; char *_IO_write_base; char *_IO_write_ptr; char *_IO_write_end; char *_IO_buf_base; char *_IO_buf_end; char *_IO_save_base; char *_IO_backup_base; char *_IO_save_end; struct _IO_marker *_markers; struct _IO_FILE *_chain; int _fileno; int _flags2; __off_t _old_offset; unsigned short _cur_column; signed char _vtable_offset; char _shortbuf[1]; _IO_lock_t *_lock; __off64_t _offset; struct _IO_codecvt *_codecvt; struct _IO_wide_data *_wide_data; struct _IO_FILE *_freeres_list; void *_freeres_buf; size_t __pad5; int _mode; char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; }; # 44 "/usr/include/stdio.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h" 1 3 4 # 27 "/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h" 3 4 typedef __ssize_t cookie_read_function_t (void *__cookie, char *__buf, size_t __nbytes); typedef __ssize_t cookie_write_function_t (void *__cookie, const char *__buf, size_t __nbytes); typedef int cookie_seek_function_t (void *__cookie, __off64_t *__pos, int __w); typedef int cookie_close_function_t (void *__cookie); typedef struct _IO_cookie_io_functions_t { cookie_read_function_t *read; cookie_write_function_t *write; cookie_seek_function_t *seek; cookie_close_function_t *close; } cookie_io_functions_t; # 47 "/usr/include/stdio.h" 2 3 4 # 63 "/usr/include/stdio.h" 3 4 typedef __off_t off_t; typedef __off64_t off64_t; typedef __ssize_t ssize_t; typedef __fpos_t fpos_t; typedef __fpos64_t fpos64_t; # 133 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 # 134 "/usr/include/stdio.h" 2 3 4 extern FILE *stdin; extern FILE *stdout; extern FILE *stderr; extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); extern int renameat (int __oldfd, const char *__old, int __newfd, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); # 164 "/usr/include/stdio.h" 3 4 extern int renameat2 (int __oldfd, const char *__old, int __newfd, const char *__new, unsigned int __flags) __attribute__ ((__nothrow__ , __leaf__)); extern FILE *tmpfile (void) ; # 183 "/usr/include/stdio.h" 3 4 extern FILE *tmpfile64 (void) ; extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; # 204 "/usr/include/stdio.h" 3 4 extern char *tempnam (const char *__dir, const char *__pfx) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; extern int fclose (FILE *__stream); extern int fflush (FILE *__stream); # 227 "/usr/include/stdio.h" 3 4 extern int fflush_unlocked (FILE *__stream); # 237 "/usr/include/stdio.h" 3 4 extern int fcloseall (void); # 246 "/usr/include/stdio.h" 3 4 extern FILE *fopen (const char *__restrict __filename, const char *__restrict __modes) ; extern FILE *freopen (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream) ; # 270 "/usr/include/stdio.h" 3 4 extern FILE *fopen64 (const char *__restrict __filename, const char *__restrict __modes) ; extern FILE *freopen64 (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream) ; extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; extern FILE *fopencookie (void *__restrict __magic_cookie, const char *__restrict __modes, cookie_io_functions_t __io_funcs) __attribute__ ((__nothrow__ , __leaf__)) ; extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)); extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); extern int fprintf (FILE *__restrict __stream, const char *__restrict __format, ...); extern int printf (const char *__restrict __format, ...); extern int sprintf (char *__restrict __s, const char *__restrict __format, ...) __attribute__ ((__nothrow__)); extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg); extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); extern int vsprintf (char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__nothrow__)); extern int snprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, ...) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); extern int vsnprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); extern int vasprintf (char **__restrict __ptr, const char *__restrict __f, __gnuc_va_list __arg) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 0))) ; extern int __asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))) ; extern int asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))) ; extern int vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __arg) __attribute__ ((__format__ (__printf__, 2, 0))); extern int dprintf (int __fd, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) ; extern int scanf (const char *__restrict __format, ...) ; extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") ; extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") ; extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) ; # 432 "/usr/include/stdio.h" 3 4 extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__format__ (__scanf__, 2, 0))) ; extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__format__ (__scanf__, 1, 0))) ; extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") __attribute__ ((__format__ (__scanf__, 2, 0))) ; extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") __attribute__ ((__format__ (__scanf__, 1, 0))) ; extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); # 485 "/usr/include/stdio.h" 3 4 extern int fgetc (FILE *__stream); extern int getc (FILE *__stream); extern int getchar (void); extern int getc_unlocked (FILE *__stream); extern int getchar_unlocked (void); # 510 "/usr/include/stdio.h" 3 4 extern int fgetc_unlocked (FILE *__stream); # 521 "/usr/include/stdio.h" 3 4 extern int fputc (int __c, FILE *__stream); extern int putc (int __c, FILE *__stream); extern int putchar (int __c); # 537 "/usr/include/stdio.h" 3 4 extern int fputc_unlocked (int __c, FILE *__stream); extern int putc_unlocked (int __c, FILE *__stream); extern int putchar_unlocked (int __c); extern int getw (FILE *__stream); extern int putw (int __w, FILE *__stream); extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) ; # 587 "/usr/include/stdio.h" 3 4 extern char *fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) ; # 603 "/usr/include/stdio.h" 3 4 extern __ssize_t __getdelim (char **__restrict __lineptr, size_t *__restrict __n, int __delimiter, FILE *__restrict __stream) ; extern __ssize_t getdelim (char **__restrict __lineptr, size_t *__restrict __n, int __delimiter, FILE *__restrict __stream) ; extern __ssize_t getline (char **__restrict __lineptr, size_t *__restrict __n, FILE *__restrict __stream) ; extern int fputs (const char *__restrict __s, FILE *__restrict __stream); extern int puts (const char *__s); extern int ungetc (int __c, FILE *__stream); extern size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) ; extern size_t fwrite (const void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __s); # 662 "/usr/include/stdio.h" 3 4 extern int fputs_unlocked (const char *__restrict __s, FILE *__restrict __stream); # 673 "/usr/include/stdio.h" 3 4 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) ; extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream); extern int fseek (FILE *__stream, long int __off, int __whence); extern long int ftell (FILE *__stream) ; extern void rewind (FILE *__stream); # 707 "/usr/include/stdio.h" 3 4 extern int fseeko (FILE *__stream, __off_t __off, int __whence); extern __off_t ftello (FILE *__stream) ; # 731 "/usr/include/stdio.h" 3 4 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); extern int fsetpos (FILE *__stream, const fpos_t *__pos); # 750 "/usr/include/stdio.h" 3 4 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence); extern __off64_t ftello64 (FILE *__stream) ; extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos); extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos); extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern void perror (const char *__s); # 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 # 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 extern int sys_nerr; extern const char *const sys_errlist[]; extern int _sys_nerr; extern const char *const _sys_errlist[]; # 782 "/usr/include/stdio.h" 2 3 4 extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; # 800 "/usr/include/stdio.h" 3 4 extern FILE *popen (const char *__command, const char *__modes) ; extern int pclose (FILE *__stream); extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); extern char *cuserid (char *__s); struct obstack; extern int obstack_printf (struct obstack *__restrict __obstack, const char *__restrict __format, ...) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))); extern int obstack_vprintf (struct obstack *__restrict __obstack, const char *__restrict __format, __gnuc_va_list __args) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 0))); extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); # 858 "/usr/include/stdio.h" 3 4 extern int __uflow (FILE *); extern int __overflow (FILE *, int); # 1 "/usr/include/x86_64-linux-gnu/bits/stdio.h" 1 3 4 # 38 "/usr/include/x86_64-linux-gnu/bits/stdio.h" 3 4 extern __inline __attribute__ ((__gnu_inline__)) int vprintf (const char *__restrict __fmt, __gnuc_va_list __arg) { return vfprintf (stdout, __fmt, __arg); } extern __inline __attribute__ ((__gnu_inline__)) int getchar (void) { return getc (stdin); } extern __inline __attribute__ ((__gnu_inline__)) int fgetc_unlocked (FILE *__fp) { return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++); } extern __inline __attribute__ ((__gnu_inline__)) int getc_unlocked (FILE *__fp) { return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++); } extern __inline __attribute__ ((__gnu_inline__)) int getchar_unlocked (void) { return (__builtin_expect (((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end), 0) ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++); } extern __inline __attribute__ ((__gnu_inline__)) int putchar (int __c) { return putc (__c, stdout); } extern __inline __attribute__ ((__gnu_inline__)) int fputc_unlocked (int __c, FILE *__stream) { return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c))); } extern __inline __attribute__ ((__gnu_inline__)) int putc_unlocked (int __c, FILE *__stream) { return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c))); } extern __inline __attribute__ ((__gnu_inline__)) int putchar_unlocked (int __c) { return (__builtin_expect (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end), 0) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c))); } extern __inline __attribute__ ((__gnu_inline__)) __ssize_t getline (char **__lineptr, size_t *__n, FILE *__stream) { return __getdelim (__lineptr, __n, '\n', __stream); } extern __inline __attribute__ ((__gnu_inline__)) int __attribute__ ((__nothrow__ , __leaf__)) feof_unlocked (FILE *__stream) { return (((__stream)->_flags & 0x0010) != 0); } extern __inline __attribute__ ((__gnu_inline__)) int __attribute__ ((__nothrow__ , __leaf__)) ferror_unlocked (FILE *__stream) { return (((__stream)->_flags & 0x0020) != 0); } # 865 "/usr/include/stdio.h" 2 3 4 # 873 "/usr/include/stdio.h" 3 4 # 50 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" 2 # 55 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern void unlock_stream (FILE *); extern void unlock_std_streams (void); extern FILE *fopen_unlocked (const char *, const char *); extern FILE *fdopen_unlocked (int, const char *); extern FILE *freopen_unlocked (const char *, const char *, FILE *); extern char **buildargv (const char *) __attribute__ ((__malloc__)); extern void freeargv (char **); extern char **dupargv (char * const *) __attribute__ ((__malloc__)); extern void expandargv (int *, char ***); extern int writeargv (char * const *, FILE *); extern int countargv (char * const *); # 123 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern const char *lbasename (const char *) __attribute__ ((__returns_nonnull__)) __attribute__ ((__nonnull__ (1))); extern const char *dos_lbasename (const char *) __attribute__ ((__returns_nonnull__)) __attribute__ ((__nonnull__ (1))); extern const char *unix_lbasename (const char *) __attribute__ ((__returns_nonnull__)) __attribute__ ((__nonnull__ (1))); extern char *lrealpath (const char *); extern int is_valid_fd (int fd); extern char *concat (const char *, ...) __attribute__ ((__malloc__)) __attribute__ ((__returns_nonnull__)) __attribute__ ((__sentinel__)); # 157 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern char *reconcat (char *, const char *, ...) __attribute__ ((__malloc__)) __attribute__ ((__returns_nonnull__)) __attribute__ ((__sentinel__)); extern unsigned long concat_length (const char *, ...) __attribute__ ((__sentinel__)); extern char *concat_copy (char *, const char *, ...) __attribute__ ((__returns_nonnull__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__sentinel__)); extern char *concat_copy2 (const char *, ...) __attribute__ ((__returns_nonnull__)) __attribute__ ((__sentinel__)); extern char *libiberty_concat_ptr; # 193 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern int fdmatch (int fd1, int fd2); # 205 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern char * getpwd (void); # 218 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern long get_run_time (void); extern char *make_relative_prefix (const char *, const char *, const char *) __attribute__ ((__malloc__)); extern char *make_relative_prefix_ignore_links (const char *, const char *, const char *) __attribute__ ((__malloc__)); extern const char *choose_tmpdir (void) __attribute__ ((__returns_nonnull__)); extern char *choose_temp_base (void) __attribute__ ((__malloc__)) __attribute__ ((__returns_nonnull__)); extern char *make_temp_file (const char *) __attribute__ ((__malloc__)); extern char *make_temp_file_with_prefix (const char *, const char *) __attribute__ ((__malloc__)); extern int unlink_if_ordinary (const char *); extern const char *spaces (int count); extern int errno_max (void); extern const char *strerrno (int); extern int strtoerrno (const char *); extern char *xstrerror (int) __attribute__ ((__returns_nonnull__)); extern int signo_max (void); # 292 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern const char *strsigno (int); extern int strtosigno (const char *); extern int xatexit (void (*fn) (void)); extern void xexit (int status) __attribute__ ((__noreturn__)); extern void xmalloc_set_program_name (const char *); extern void xmalloc_failed (size_t) __attribute__ ((__noreturn__)); extern void *xmalloc (size_t) __attribute__ ((__malloc__)) __attribute__ ((__returns_nonnull__)) __attribute__ ((alloc_size (1))) __attribute__ ((warn_unused_result)); extern void *xrealloc (void *, size_t) __attribute__ ((__returns_nonnull__)) __attribute__ ((alloc_size (2))) __attribute__ ((warn_unused_result)); extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__)) __attribute__ ((__returns_nonnull__)) __attribute__ ((alloc_size (1, 2))) __attribute__ ((warn_unused_result)); extern char *xstrdup (const char *) __attribute__ ((__malloc__)) __attribute__ ((__returns_nonnull__)) __attribute__ ((warn_unused_result)); extern char *xstrndup (const char *, size_t) __attribute__ ((__malloc__)) __attribute__ ((__returns_nonnull__)) __attribute__ ((warn_unused_result)); extern void *xmemdup (const void *, size_t, size_t) __attribute__ ((__malloc__)) __attribute__ ((__returns_nonnull__)) __attribute__ ((warn_unused_result)); extern double physmem_total (void); extern double physmem_available (void); extern unsigned int xcrc32 (const unsigned char *, int, unsigned int); # 391 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern const unsigned char _hex_value[256]; extern void hex_init (void); # 428 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern struct pex_obj *pex_init (int flags, const char *pname, const char *tempbase) __attribute__ ((__returns_nonnull__)); # 528 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern const char *pex_run (struct pex_obj *obj, int flags, const char *executable, char * const *argv, const char *outname, const char *errname, int *err); # 543 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern const char *pex_run_in_environment (struct pex_obj *obj, int flags, const char *executable, char * const *argv, char * const *env, const char *outname, const char *errname, int *err); extern FILE *pex_input_file (struct pex_obj *obj, int flags, const char *in_name); extern FILE *pex_input_pipe (struct pex_obj *obj, int binary); extern FILE *pex_read_output (struct pex_obj *, int binary); extern FILE *pex_read_err (struct pex_obj *, int binary); extern int pex_get_status (struct pex_obj *, int count, int *vector); struct pex_time { unsigned long user_seconds; unsigned long user_microseconds; unsigned long system_seconds; unsigned long system_microseconds; }; extern int pex_get_times (struct pex_obj *, int count, struct pex_time *vector); extern void pex_free (struct pex_obj *); # 618 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern const char *pex_one (int flags, const char *executable, char * const *argv, const char *pname, const char *outname, const char *errname, int *status, int *err); # 637 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern int pexecute (const char *, char * const *, const char *, const char *, char **, char **, int); extern int pwait (int, int *, int); extern void *bsearch_r (const void *, const void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); # 661 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern char *xasprintf (const char *, ...) __attribute__ ((__malloc__)) __attribute__ ((__format__ (__printf__, 1, 2))) __attribute__ ((__nonnull__ (1))); # 673 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern char *xvasprintf (const char *, va_list) __attribute__ ((__malloc__)) __attribute__ ((__format__ (__printf__, 1, 0))) __attribute__ ((__nonnull__ (1))); # 722 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern void setproctitle (const char *name, ...); extern void stack_limit_increase (unsigned long); # 735 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/libiberty.h" extern void *C_alloca (size_t) __attribute__ ((__malloc__)); # 22 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" 1 # 23 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 24 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" 2 # 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 # 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 # 33 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; typedef __loff_t loff_t; typedef __ino_t ino_t; typedef __ino64_t ino64_t; typedef __dev_t dev_t; typedef __gid_t gid_t; typedef __mode_t mode_t; typedef __nlink_t nlink_t; typedef __uid_t uid_t; # 97 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 typedef __pid_t pid_t; typedef __id_t id_t; # 114 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; typedef __key_t key_t; # 1 "/usr/include/x86_64-linux-gnu/bits/types/clock_t.h" 1 3 4 typedef __clock_t clock_t; # 127 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h" 1 3 4 typedef __clockid_t clockid_t; # 129 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/time_t.h" 1 3 4 typedef __time_t time_t; # 130 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/timer_t.h" 1 3 4 typedef __timer_t timer_t; # 131 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 typedef __useconds_t useconds_t; typedef __suseconds_t suseconds_t; # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 145 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; # 1 "/usr/include/x86_64-linux-gnu/bits/stdint-intn.h" 1 3 4 # 24 "/usr/include/x86_64-linux-gnu/bits/stdint-intn.h" 3 4 typedef __int8_t int8_t; typedef __int16_t int16_t; typedef __int32_t int32_t; typedef __int64_t int64_t; # 156 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 typedef __uint8_t u_int8_t; typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; typedef int register_t __attribute__ ((__mode__ (__word__))); # 176 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 # 1 "/usr/include/endian.h" 1 3 4 # 24 "/usr/include/endian.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 # 35 "/usr/include/x86_64-linux-gnu/bits/endian.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/endianness.h" 1 3 4 # 36 "/usr/include/x86_64-linux-gnu/bits/endian.h" 2 3 4 # 25 "/usr/include/endian.h" 2 3 4 # 35 "/usr/include/endian.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 # 33 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 static __inline __uint16_t __bswap_16 (__uint16_t __bsx) { return __builtin_bswap16 (__bsx); } static __inline __uint32_t __bswap_32 (__uint32_t __bsx) { return __builtin_bswap32 (__bsx); } # 69 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 __extension__ static __inline __uint64_t __bswap_64 (__uint64_t __bsx) { return __builtin_bswap64 (__bsx); } # 36 "/usr/include/endian.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/uintn-identity.h" 1 3 4 # 32 "/usr/include/x86_64-linux-gnu/bits/uintn-identity.h" 3 4 static __inline __uint16_t __uint16_identity (__uint16_t __x) { return __x; } static __inline __uint32_t __uint32_identity (__uint32_t __x) { return __x; } static __inline __uint64_t __uint64_identity (__uint64_t __x) { return __x; } # 37 "/usr/include/endian.h" 2 3 4 # 177 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 # 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 # 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h" 1 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h" 1 3 4 typedef struct { unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; } __sigset_t; # 5 "/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h" 2 3 4 typedef __sigset_t sigset_t; # 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h" 1 3 4 struct timeval { __time_t tv_sec; __suseconds_t tv_usec; }; # 38 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h" 1 3 4 # 10 "/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h" 3 4 struct timespec { __time_t tv_sec; __syscall_slong_t tv_nsec; # 26 "/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h" 3 4 }; # 40 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 # 49 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 typedef long int __fd_mask; # 59 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 typedef struct { __fd_mask fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; } fd_set; typedef __fd_mask fd_mask; # 91 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 # 101 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); # 113 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, const struct timespec *__restrict __timeout, const __sigset_t *__restrict __sigmask); # 126 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 # 180 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 typedef __blksize_t blksize_t; typedef __blkcnt_t blkcnt_t; typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; # 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 typedef __blkcnt64_t blkcnt64_t; typedef __fsblkcnt64_t fsblkcnt64_t; typedef __fsfilcnt64_t fsfilcnt64_t; # 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 # 23 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h" 1 3 4 # 44 "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h" 1 3 4 # 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h" 2 3 4 # 45 "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h" 2 3 4 typedef struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __pthread_list_t; typedef struct __pthread_internal_slist { struct __pthread_internal_slist *__next; } __pthread_slist_t; # 74 "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/struct_mutex.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/struct_mutex.h" 3 4 struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; __pthread_list_t __list; # 53 "/usr/include/x86_64-linux-gnu/bits/struct_mutex.h" 3 4 }; # 75 "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h" 2 3 4 # 87 "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h" 1 3 4 # 23 "/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h" 3 4 struct __pthread_rwlock_arch_t { unsigned int __readers; unsigned int __writers; unsigned int __wrphase_futex; unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; int __cur_writer; int __shared; signed char __rwelision; unsigned char __pad1[7]; unsigned long int __pad2; unsigned int __flags; # 55 "/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h" 3 4 }; # 88 "/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h" 2 3 4 struct __pthread_cond_s { __extension__ union { __extension__ unsigned long long int __wseq; struct { unsigned int __low; unsigned int __high; } __wseq32; }; __extension__ union { __extension__ unsigned long long int __g1_start; struct { unsigned int __low; unsigned int __high; } __g1_start32; }; unsigned int __g_refs[2] ; unsigned int __g_size[2]; unsigned int __g1_orig_size; unsigned int __wrefs; unsigned int __g_signals[2]; }; # 24 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 typedef unsigned long int pthread_t; typedef union { char __size[4]; int __align; } pthread_mutexattr_t; typedef union { char __size[4]; int __align; } pthread_condattr_t; typedef unsigned int pthread_key_t; typedef int pthread_once_t; union pthread_attr_t { char __size[56]; long int __align; }; typedef union pthread_attr_t pthread_attr_t; typedef union { struct __pthread_mutex_s __data; char __size[40]; long int __align; } pthread_mutex_t; typedef union { struct __pthread_cond_s __data; char __size[48]; __extension__ long long int __align; } pthread_cond_t; typedef union { struct __pthread_rwlock_arch_t __data; char __size[56]; long int __align; } pthread_rwlock_t; typedef union { char __size[8]; long int __align; } pthread_rwlockattr_t; typedef volatile int pthread_spinlock_t; typedef union { char __size[32]; long int __align; } pthread_barrier_t; typedef union { char __size[4]; int __align; } pthread_barrierattr_t; # 228 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 # 25 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" 2 # 1 "/usr/include/unistd.h" 1 3 4 # 27 "/usr/include/unistd.h" 3 4 # 202 "/usr/include/unistd.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 # 203 "/usr/include/unistd.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 # 207 "/usr/include/unistd.h" 2 3 4 # 226 "/usr/include/unistd.h" 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 227 "/usr/include/unistd.h" 2 3 4 # 267 "/usr/include/unistd.h" 3 4 typedef __intptr_t intptr_t; typedef __socklen_t socklen_t; # 287 "/usr/include/unistd.h" 3 4 extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int euidaccess (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int eaccess (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int faccessat (int __fd, const char *__file, int __type, int __flag) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; # 334 "/usr/include/unistd.h" 3 4 extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); # 345 "/usr/include/unistd.h" 3 4 extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); extern int close (int __fd); extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; extern ssize_t write (int __fd, const void *__buf, size_t __n) ; # 376 "/usr/include/unistd.h" 3 4 extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) ; extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, __off_t __offset) ; # 404 "/usr/include/unistd.h" 3 4 extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) ; extern ssize_t pwrite64 (int __fd, const void *__buf, size_t __n, __off64_t __offset) ; extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; extern int pipe2 (int __pipedes[2], int __flags) __attribute__ ((__nothrow__ , __leaf__)) ; # 432 "/usr/include/unistd.h" 3 4 extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); # 444 "/usr/include/unistd.h" 3 4 extern unsigned int sleep (unsigned int __seconds); extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) __attribute__ ((__nothrow__ , __leaf__)); extern int usleep (__useconds_t __useconds); # 469 "/usr/include/unistd.h" 3 4 extern int pause (void); extern int chown (const char *__file, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int fchownat (int __fd, const char *__file, __uid_t __owner, __gid_t __group, int __flag) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; # 511 "/usr/include/unistd.h" 3 4 extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; extern char *get_current_dir_name (void) __attribute__ ((__nothrow__ , __leaf__)); extern char *getwd (char *__buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); extern int dup3 (int __fd, int __fd2, int __flags) __attribute__ ((__nothrow__ , __leaf__)); extern char **__environ; extern char **environ; extern int execve (const char *__path, char *const __argv[], char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int execv (const char *__path, char *const __argv[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execle (const char *__path, const char *__arg, ...) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execl (const char *__path, const char *__arg, ...) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execvp (const char *__file, char *const __argv[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execlp (const char *__file, const char *__arg, ...) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int execvpe (const char *__file, char *const __argv[], char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; extern void _exit (int __status) __attribute__ ((__noreturn__)); # 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 # 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 enum { _PC_LINK_MAX, _PC_MAX_CANON, _PC_MAX_INPUT, _PC_NAME_MAX, _PC_PATH_MAX, _PC_PIPE_BUF, _PC_CHOWN_RESTRICTED, _PC_NO_TRUNC, _PC_VDISABLE, _PC_SYNC_IO, _PC_ASYNC_IO, _PC_PRIO_IO, _PC_SOCK_MAXBUF, _PC_FILESIZEBITS, _PC_REC_INCR_XFER_SIZE, _PC_REC_MAX_XFER_SIZE, _PC_REC_MIN_XFER_SIZE, _PC_REC_XFER_ALIGN, _PC_ALLOC_SIZE_MIN, _PC_SYMLINK_MAX, _PC_2_SYMLINKS }; enum { _SC_ARG_MAX, _SC_CHILD_MAX, _SC_CLK_TCK, _SC_NGROUPS_MAX, _SC_OPEN_MAX, _SC_STREAM_MAX, _SC_TZNAME_MAX, _SC_JOB_CONTROL, _SC_SAVED_IDS, _SC_REALTIME_SIGNALS, _SC_PRIORITY_SCHEDULING, _SC_TIMERS, _SC_ASYNCHRONOUS_IO, _SC_PRIORITIZED_IO, _SC_SYNCHRONIZED_IO, _SC_FSYNC, _SC_MAPPED_FILES, _SC_MEMLOCK, _SC_MEMLOCK_RANGE, _SC_MEMORY_PROTECTION, _SC_MESSAGE_PASSING, _SC_SEMAPHORES, _SC_SHARED_MEMORY_OBJECTS, _SC_AIO_LISTIO_MAX, _SC_AIO_MAX, _SC_AIO_PRIO_DELTA_MAX, _SC_DELAYTIMER_MAX, _SC_MQ_OPEN_MAX, _SC_MQ_PRIO_MAX, _SC_VERSION, _SC_PAGESIZE, _SC_RTSIG_MAX, _SC_SEM_NSEMS_MAX, _SC_SEM_VALUE_MAX, _SC_SIGQUEUE_MAX, _SC_TIMER_MAX, _SC_BC_BASE_MAX, _SC_BC_DIM_MAX, _SC_BC_SCALE_MAX, _SC_BC_STRING_MAX, _SC_COLL_WEIGHTS_MAX, _SC_EQUIV_CLASS_MAX, _SC_EXPR_NEST_MAX, _SC_LINE_MAX, _SC_RE_DUP_MAX, _SC_CHARCLASS_NAME_MAX, _SC_2_VERSION, _SC_2_C_BIND, _SC_2_C_DEV, _SC_2_FORT_DEV, _SC_2_FORT_RUN, _SC_2_SW_DEV, _SC_2_LOCALEDEF, _SC_PII, _SC_PII_XTI, _SC_PII_SOCKET, _SC_PII_INTERNET, _SC_PII_OSI, _SC_POLL, _SC_SELECT, _SC_UIO_MAXIOV, _SC_IOV_MAX = _SC_UIO_MAXIOV, _SC_PII_INTERNET_STREAM, _SC_PII_INTERNET_DGRAM, _SC_PII_OSI_COTS, _SC_PII_OSI_CLTS, _SC_PII_OSI_M, _SC_T_IOV_MAX, _SC_THREADS, _SC_THREAD_SAFE_FUNCTIONS, _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_LOGIN_NAME_MAX, _SC_TTY_NAME_MAX, _SC_THREAD_DESTRUCTOR_ITERATIONS, _SC_THREAD_KEYS_MAX, _SC_THREAD_STACK_MIN, _SC_THREAD_THREADS_MAX, _SC_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKSIZE, _SC_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PRIO_INHERIT, _SC_THREAD_PRIO_PROTECT, _SC_THREAD_PROCESS_SHARED, _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN, _SC_PHYS_PAGES, _SC_AVPHYS_PAGES, _SC_ATEXIT_MAX, _SC_PASS_MAX, _SC_XOPEN_VERSION, _SC_XOPEN_XCU_VERSION, _SC_XOPEN_UNIX, _SC_XOPEN_CRYPT, _SC_XOPEN_ENH_I18N, _SC_XOPEN_SHM, _SC_2_CHAR_TERM, _SC_2_C_VERSION, _SC_2_UPE, _SC_XOPEN_XPG2, _SC_XOPEN_XPG3, _SC_XOPEN_XPG4, _SC_CHAR_BIT, _SC_CHAR_MAX, _SC_CHAR_MIN, _SC_INT_MAX, _SC_INT_MIN, _SC_LONG_BIT, _SC_WORD_BIT, _SC_MB_LEN_MAX, _SC_NZERO, _SC_SSIZE_MAX, _SC_SCHAR_MAX, _SC_SCHAR_MIN, _SC_SHRT_MAX, _SC_SHRT_MIN, _SC_UCHAR_MAX, _SC_UINT_MAX, _SC_ULONG_MAX, _SC_USHRT_MAX, _SC_NL_ARGMAX, _SC_NL_LANGMAX, _SC_NL_MSGMAX, _SC_NL_NMAX, _SC_NL_SETMAX, _SC_NL_TEXTMAX, _SC_XBS5_ILP32_OFF32, _SC_XBS5_ILP32_OFFBIG, _SC_XBS5_LP64_OFF64, _SC_XBS5_LPBIG_OFFBIG, _SC_XOPEN_LEGACY, _SC_XOPEN_REALTIME, _SC_XOPEN_REALTIME_THREADS, _SC_ADVISORY_INFO, _SC_BARRIERS, _SC_BASE, _SC_C_LANG_SUPPORT, _SC_C_LANG_SUPPORT_R, _SC_CLOCK_SELECTION, _SC_CPUTIME, _SC_THREAD_CPUTIME, _SC_DEVICE_IO, _SC_DEVICE_SPECIFIC, _SC_DEVICE_SPECIFIC_R, _SC_FD_MGMT, _SC_FIFO, _SC_PIPE, _SC_FILE_ATTRIBUTES, _SC_FILE_LOCKING, _SC_FILE_SYSTEM, _SC_MONOTONIC_CLOCK, _SC_MULTI_PROCESS, _SC_SINGLE_PROCESS, _SC_NETWORKING, _SC_READER_WRITER_LOCKS, _SC_SPIN_LOCKS, _SC_REGEXP, _SC_REGEX_VERSION, _SC_SHELL, _SC_SIGNALS, _SC_SPAWN, _SC_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER, _SC_SYSTEM_DATABASE, _SC_SYSTEM_DATABASE_R, _SC_TIMEOUTS, _SC_TYPED_MEMORY_OBJECTS, _SC_USER_GROUPS, _SC_USER_GROUPS_R, _SC_2_PBS, _SC_2_PBS_ACCOUNTING, _SC_2_PBS_LOCATE, _SC_2_PBS_MESSAGE, _SC_2_PBS_TRACK, _SC_SYMLOOP_MAX, _SC_STREAMS, _SC_2_PBS_CHECKPOINT, _SC_V6_ILP32_OFF32, _SC_V6_ILP32_OFFBIG, _SC_V6_LP64_OFF64, _SC_V6_LPBIG_OFFBIG, _SC_HOST_NAME_MAX, _SC_TRACE, _SC_TRACE_EVENT_FILTER, _SC_TRACE_INHERIT, _SC_TRACE_LOG, _SC_LEVEL1_ICACHE_SIZE, _SC_LEVEL1_ICACHE_ASSOC, _SC_LEVEL1_ICACHE_LINESIZE, _SC_LEVEL1_DCACHE_SIZE, _SC_LEVEL1_DCACHE_ASSOC, _SC_LEVEL1_DCACHE_LINESIZE, _SC_LEVEL2_CACHE_SIZE, _SC_LEVEL2_CACHE_ASSOC, _SC_LEVEL2_CACHE_LINESIZE, _SC_LEVEL3_CACHE_SIZE, _SC_LEVEL3_CACHE_ASSOC, _SC_LEVEL3_CACHE_LINESIZE, _SC_LEVEL4_CACHE_SIZE, _SC_LEVEL4_CACHE_ASSOC, _SC_LEVEL4_CACHE_LINESIZE, _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, _SC_RAW_SOCKETS, _SC_V7_ILP32_OFF32, _SC_V7_ILP32_OFFBIG, _SC_V7_LP64_OFF64, _SC_V7_LPBIG_OFFBIG, _SC_SS_REPL_MAX, _SC_TRACE_EVENT_NAME_MAX, _SC_TRACE_NAME_MAX, _SC_TRACE_SYS_MAX, _SC_TRACE_USER_EVENT_MAX, _SC_XOPEN_STREAMS, _SC_THREAD_ROBUST_PRIO_INHERIT, _SC_THREAD_ROBUST_PRIO_PROTECT }; enum { _CS_PATH, _CS_V6_WIDTH_RESTRICTED_ENVS, _CS_GNU_LIBC_VERSION, _CS_GNU_LIBPTHREAD_VERSION, _CS_V5_WIDTH_RESTRICTED_ENVS, _CS_V7_WIDTH_RESTRICTED_ENVS, _CS_LFS_CFLAGS = 1000, _CS_LFS_LDFLAGS, _CS_LFS_LIBS, _CS_LFS_LINTFLAGS, _CS_LFS64_CFLAGS, _CS_LFS64_LDFLAGS, _CS_LFS64_LIBS, _CS_LFS64_LINTFLAGS, _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, _CS_XBS5_ILP32_OFF32_LDFLAGS, _CS_XBS5_ILP32_OFF32_LIBS, _CS_XBS5_ILP32_OFF32_LINTFLAGS, _CS_XBS5_ILP32_OFFBIG_CFLAGS, _CS_XBS5_ILP32_OFFBIG_LDFLAGS, _CS_XBS5_ILP32_OFFBIG_LIBS, _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, _CS_XBS5_LP64_OFF64_CFLAGS, _CS_XBS5_LP64_OFF64_LDFLAGS, _CS_XBS5_LP64_OFF64_LIBS, _CS_XBS5_LP64_OFF64_LINTFLAGS, _CS_XBS5_LPBIG_OFFBIG_CFLAGS, _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, _CS_XBS5_LPBIG_OFFBIG_LIBS, _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, _CS_POSIX_V6_ILP32_OFF32_CFLAGS, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, _CS_POSIX_V6_ILP32_OFF32_LIBS, _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V6_ILP32_OFFBIG_LIBS, _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, _CS_POSIX_V6_LP64_OFF64_CFLAGS, _CS_POSIX_V6_LP64_OFF64_LDFLAGS, _CS_POSIX_V6_LP64_OFF64_LIBS, _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, _CS_POSIX_V7_ILP32_OFF32_CFLAGS, _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, _CS_POSIX_V7_ILP32_OFF32_LIBS, _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, _CS_POSIX_V7_ILP32_OFFBIG_LIBS, _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, _CS_POSIX_V7_LP64_OFF64_CFLAGS, _CS_POSIX_V7_LP64_OFF64_LDFLAGS, _CS_POSIX_V7_LP64_OFF64_LIBS, _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, _CS_V6_ENV, _CS_V7_ENV }; # 610 "/usr/include/unistd.h" 2 3 4 extern long int pathconf (const char *__path, int __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); # 660 "/usr/include/unistd.h" 3 4 extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; extern int group_member (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)); extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid) __attribute__ ((__nothrow__ , __leaf__)); extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid) __attribute__ ((__nothrow__ , __leaf__)); extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid) __attribute__ ((__nothrow__ , __leaf__)) ; extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid) __attribute__ ((__nothrow__ , __leaf__)) ; extern __pid_t fork (void) __attribute__ ((__nothrow__)); extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern int ttyname_r (int __fd, char *__buf, size_t __buflen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); extern int link (const char *__from, const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; extern int linkat (int __fromfd, const char *__from, int __tofd, const char *__to, int __flags) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; extern int symlink (const char *__from, const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; extern ssize_t readlink (const char *__restrict __path, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; extern int symlinkat (const char *__from, int __tofd, const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; extern ssize_t readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int unlinkat (int __fd, const char *__name, int __flag) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); extern char *getlogin (void); extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 1 "/usr/include/x86_64-linux-gnu/bits/getopt_posix.h" 1 3 4 # 27 "/usr/include/x86_64-linux-gnu/bits/getopt_posix.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h" 3 4 extern char *optarg; # 50 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h" 3 4 extern int optind; extern int opterr; extern int optopt; # 91 "/usr/include/x86_64-linux-gnu/bits/getopt_core.h" 3 4 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); # 28 "/usr/include/x86_64-linux-gnu/bits/getopt_posix.h" 2 3 4 # 49 "/usr/include/x86_64-linux-gnu/bits/getopt_posix.h" 3 4 # 870 "/usr/include/unistd.h" 2 3 4 extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int sethostname (const char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; extern int getdomainname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int setdomainname (const char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int profil (unsigned short int *__sample_buffer, size_t __size, size_t __offset, unsigned int __scale) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); extern int fsync (int __fd); extern int syncfs (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern long int gethostid (void); extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); # 991 "/usr/include/unistd.h" 3 4 extern int truncate (const char *__file, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; # 1003 "/usr/include/unistd.h" 3 4 extern int truncate64 (const char *__file, __off64_t __length) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; # 1014 "/usr/include/unistd.h" 3 4 extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; # 1024 "/usr/include/unistd.h" 3 4 extern int ftruncate64 (int __fd, __off64_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; # 1035 "/usr/include/unistd.h" 3 4 extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); # 1056 "/usr/include/unistd.h" 3 4 extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); # 1079 "/usr/include/unistd.h" 3 4 extern int lockf (int __fd, int __cmd, __off_t __len) ; # 1089 "/usr/include/unistd.h" 3 4 extern int lockf64 (int __fd, int __cmd, __off64_t __len) ; # 1107 "/usr/include/unistd.h" 3 4 ssize_t copy_file_range (int __infd, __off64_t *__pinoff, int __outfd, __off64_t *__poutoff, size_t __length, unsigned int __flags); extern int fdatasync (int __fildes); # 1124 "/usr/include/unistd.h" 3 4 extern char *crypt (const char *__key, const char *__salt) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void swab (const void *__restrict __from, void *__restrict __to, ssize_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); # 1161 "/usr/include/unistd.h" 3 4 int getentropy (void *__buffer, size_t __length) ; # 1170 "/usr/include/unistd.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/unistd_ext.h" 1 3 4 # 34 "/usr/include/x86_64-linux-gnu/bits/unistd_ext.h" 3 4 extern __pid_t gettid (void) __attribute__ ((__nothrow__ , __leaf__)); # 1171 "/usr/include/unistd.h" 2 3 4 # 28 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" 2 # 42 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" # 42 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" typedef struct simple_object_read_struct simple_object_read; # 55 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" extern simple_object_read * simple_object_start_read (int descriptor, off_t offset, const char *segment_name, const char **errmsg, int *err); # 70 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" extern const char * simple_object_find_sections (simple_object_read *simple_object, int (*pfn) (void *data, const char *, off_t offset, off_t length), void *data, int *err); # 93 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" extern int simple_object_find_section (simple_object_read *simple_object, const char *name, off_t *offset, off_t *length, const char **errmsg, int *err); extern void simple_object_release_read (simple_object_read *); typedef struct simple_object_attributes_struct simple_object_attributes; extern simple_object_attributes * simple_object_fetch_attributes (simple_object_read *simple_object, const char **errmsg, int *err); extern const char * simple_object_attributes_merge (simple_object_attributes *to, simple_object_attributes *from, int *err); extern void simple_object_release_attributes (simple_object_attributes *attrs); typedef struct simple_object_write_struct simple_object_write; # 149 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" extern simple_object_write * simple_object_start_write (simple_object_attributes *attrs, const char *segment_name, const char **errmsg, int *err); typedef struct simple_object_write_section_struct simple_object_write_section; # 167 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" extern simple_object_write_section * simple_object_write_create_section (simple_object_write *simple_object, const char *name, unsigned int align, const char **errmsg, int *err); # 179 "/home/giulianob/gcc_git_gnu/gcc/libiberty/../include/simple-object.h" extern const char * simple_object_write_add_data (simple_object_write *simple_object, simple_object_write_section *section, const void *buffer, size_t size, int copy, int *err); extern const char * simple_object_write_to_file (simple_object_write *simple_object, int descriptor, int *err); extern void simple_object_release_write (simple_object_write *); extern const char * simple_object_copy_lto_debug_sections (simple_object_read *src_object, const char *dest, int *err, int rename); # 23 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/usr/include/errno.h" 1 3 4 # 28 "/usr/include/errno.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/errno.h" 1 3 4 # 26 "/usr/include/x86_64-linux-gnu/bits/errno.h" 3 4 # 1 "/usr/include/linux/errno.h" 1 3 4 # 1 "/usr/include/x86_64-linux-gnu/asm/errno.h" 1 3 4 # 1 "/usr/include/asm-generic/errno.h" 1 3 4 # 1 "/usr/include/asm-generic/errno-base.h" 1 3 4 # 6 "/usr/include/asm-generic/errno.h" 2 3 4 # 2 "/usr/include/x86_64-linux-gnu/asm/errno.h" 2 3 4 # 2 "/usr/include/linux/errno.h" 2 3 4 # 27 "/usr/include/x86_64-linux-gnu/bits/errno.h" 2 3 4 # 29 "/usr/include/errno.h" 2 3 4 # 37 "/usr/include/errno.h" 3 4 extern int *__errno_location (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern char *program_invocation_name; extern char *program_invocation_short_name; # 1 "/usr/include/x86_64-linux-gnu/bits/types/error_t.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/types/error_t.h" 3 4 typedef int error_t; # 49 "/usr/include/errno.h" 2 3 4 # 25 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 26 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/usr/include/stdlib.h" 1 3 4 # 25 "/usr/include/stdlib.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4 # 26 "/usr/include/stdlib.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 32 "/usr/include/stdlib.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 # 52 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 typedef enum { P_ALL, P_PID, P_PGID } idtype_t; # 40 "/usr/include/stdlib.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 # 41 "/usr/include/stdlib.h" 2 3 4 # 55 "/usr/include/stdlib.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/floatn.h" 1 3 4 # 120 "/usr/include/x86_64-linux-gnu/bits/floatn.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/floatn-common.h" 1 3 4 # 24 "/usr/include/x86_64-linux-gnu/bits/floatn-common.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/long-double.h" 1 3 4 # 25 "/usr/include/x86_64-linux-gnu/bits/floatn-common.h" 2 3 4 # 121 "/usr/include/x86_64-linux-gnu/bits/floatn.h" 2 3 4 # 56 "/usr/include/stdlib.h" 2 3 4 typedef struct { int quot; int rem; } div_t; typedef struct { long int quot; long int rem; } ldiv_t; __extension__ typedef struct { long long int quot; long long int rem; } lldiv_t; # 97 "/usr/include/stdlib.h" 3 4 extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; extern double atof (const char *__nptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern int atoi (const char *__nptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern long int atol (const char *__nptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; __extension__ extern long long int atoll (const char *__nptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern double strtod (const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern float strtof (const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern long double strtold (const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 140 "/usr/include/stdlib.h" 3 4 extern _Float32 strtof32 (const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern _Float64 strtof64 (const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern _Float128 strtof128 (const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern _Float32x strtof32x (const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern _Float64x strtof64x (const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 176 "/usr/include/stdlib.h" 3 4 extern long int strtol (const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern unsigned long int strtoul (const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); __extension__ extern long long int strtoq (const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); __extension__ extern unsigned long long int strtouq (const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); __extension__ extern long long int strtoll (const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); __extension__ extern unsigned long long int strtoull (const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int strfromd (char *__dest, size_t __size, const char *__format, double __f) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))); extern int strfromf (char *__dest, size_t __size, const char *__format, float __f) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))); extern int strfroml (char *__dest, size_t __size, const char *__format, long double __f) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))); # 232 "/usr/include/stdlib.h" 3 4 extern int strfromf32 (char *__dest, size_t __size, const char * __format, _Float32 __f) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))); extern int strfromf64 (char *__dest, size_t __size, const char * __format, _Float64 __f) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))); extern int strfromf128 (char *__dest, size_t __size, const char * __format, _Float128 __f) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))); extern int strfromf32x (char *__dest, size_t __size, const char * __format, _Float32x __f) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))); extern int strfromf64x (char *__dest, size_t __size, const char * __format, _Float64x __f) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))); # 272 "/usr/include/stdlib.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/locale_t.h" 1 3 4 # 22 "/usr/include/x86_64-linux-gnu/bits/types/locale_t.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h" 1 3 4 # 28 "/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h" 3 4 struct __locale_struct { struct __locale_data *__locales[13]; const unsigned short int *__ctype_b; const int *__ctype_tolower; const int *__ctype_toupper; const char *__names[13]; }; typedef struct __locale_struct *__locale_t; # 23 "/usr/include/x86_64-linux-gnu/bits/types/locale_t.h" 2 3 4 typedef __locale_t locale_t; # 273 "/usr/include/stdlib.h" 2 3 4 extern long int strtol_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4))); extern unsigned long int strtoul_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4))); __extension__ extern long long int strtoll_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4))); __extension__ extern unsigned long long int strtoull_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4))); extern double strtod_l (const char *__restrict __nptr, char **__restrict __endptr, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); extern float strtof_l (const char *__restrict __nptr, char **__restrict __endptr, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); extern long double strtold_l (const char *__restrict __nptr, char **__restrict __endptr, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); # 316 "/usr/include/stdlib.h" 3 4 extern _Float32 strtof32_l (const char *__restrict __nptr, char **__restrict __endptr, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); extern _Float64 strtof64_l (const char *__restrict __nptr, char **__restrict __endptr, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); extern _Float128 strtof128_l (const char *__restrict __nptr, char **__restrict __endptr, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); extern _Float32x strtof32x_l (const char *__restrict __nptr, char **__restrict __endptr, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); extern _Float64x strtof64x_l (const char *__restrict __nptr, char **__restrict __endptr, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))); # 360 "/usr/include/stdlib.h" 3 4 extern __inline __attribute__ ((__gnu_inline__)) int __attribute__ ((__nothrow__ , __leaf__)) atoi (const char *__nptr) { return (int) strtol (__nptr, (char **) ((void *)0), 10); } extern __inline __attribute__ ((__gnu_inline__)) long int __attribute__ ((__nothrow__ , __leaf__)) atol (const char *__nptr) { return strtol (__nptr, (char **) ((void *)0), 10); } __extension__ extern __inline __attribute__ ((__gnu_inline__)) long long int __attribute__ ((__nothrow__ , __leaf__)) atoll (const char *__nptr) { return strtoll (__nptr, (char **) ((void *)0), 10); } # 385 "/usr/include/stdlib.h" 3 4 extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; extern long int a64l (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; # 401 "/usr/include/stdlib.h" 3 4 extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); extern char *initstate (unsigned int __seed, char *__statebuf, size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); struct random_data { int32_t *fptr; int32_t *rptr; int32_t *state; int rand_type; int rand_deg; int rand_sep; int32_t *end_ptr; }; extern int random_r (struct random_data *__restrict __buf, int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int srandom_r (unsigned int __seed, struct random_data *__buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, size_t __statelen, struct random_data *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); extern int setstate_r (char *__restrict __statebuf, struct random_data *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); extern long int nrand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); extern long int jrand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); extern unsigned short int *seed48 (unsigned short int __seed16v[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); struct drand48_data { unsigned short int __x[3]; unsigned short int __old_x[3]; unsigned short int __c; unsigned short int __init; __extension__ unsigned long long int __a; }; extern int drand48_r (struct drand48_data *__restrict __buffer, double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int erand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int lrand48_r (struct drand48_data *__restrict __buffer, long int *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int nrand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, long int *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int mrand48_r (struct drand48_data *__restrict __buffer, long int *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int jrand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, long int *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int srand48_r (long int __seedval, struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int seed48_r (unsigned short int __seed16v[3], struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int lcong48_r (unsigned short int __param[7], struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (1))) ; extern void *calloc (size_t __nmemb, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (1, 2))) ; extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)) __attribute__ ((__alloc_size__ (2))); extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)) __attribute__ ((__alloc_size__ (2, 3))); extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); # 1 "/usr/include/alloca.h" 1 3 4 # 24 "/usr/include/alloca.h" 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 25 "/usr/include/alloca.h" 2 3 4 extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); # 569 "/usr/include/stdlib.h" 2 3 4 extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (1))) ; extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern void *aligned_alloc (size_t __alignment, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern char *secure_getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int setenv (const char *__name, const char *__value, int __replace) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); # 675 "/usr/include/stdlib.h" 3 4 extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 688 "/usr/include/stdlib.h" 3 4 extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; # 698 "/usr/include/stdlib.h" 3 4 extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1))) ; # 710 "/usr/include/stdlib.h" 3 4 extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; # 720 "/usr/include/stdlib.h" 3 4 extern int mkstemps64 (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; # 731 "/usr/include/stdlib.h" 3 4 extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; # 742 "/usr/include/stdlib.h" 3 4 extern int mkostemp (char *__template, int __flags) __attribute__ ((__nonnull__ (1))) ; # 752 "/usr/include/stdlib.h" 3 4 extern int mkostemp64 (char *__template, int __flags) __attribute__ ((__nonnull__ (1))) ; # 762 "/usr/include/stdlib.h" 3 4 extern int mkostemps (char *__template, int __suffixlen, int __flags) __attribute__ ((__nonnull__ (1))) ; # 774 "/usr/include/stdlib.h" 3 4 extern int mkostemps64 (char *__template, int __suffixlen, int __flags) __attribute__ ((__nonnull__ (1))) ; # 784 "/usr/include/stdlib.h" 3 4 extern int system (const char *__command) ; extern char *canonicalize_file_name (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; # 800 "/usr/include/stdlib.h" 3 4 extern char *realpath (const char *__restrict __name, char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; typedef int (*__compar_fn_t) (const void *, const void *); typedef __compar_fn_t comparison_fn_t; typedef int (*__compar_d_fn_t) (const void *, const void *, void *); extern void *bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 2, 5))) ; # 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h" 1 3 4 # 19 "/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h" 3 4 extern __inline __attribute__ ((__gnu_inline__)) void * bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) { size_t __l, __u, __idx; const void *__p; int __comparison; __l = 0; __u = __nmemb; while (__l < __u) { __idx = (__l + __u) / 2; __p = (void *) (((const char *) __base) + (__idx * __size)); __comparison = (*__compar) (__key, __p); if (__comparison < 0) __u = __idx; else if (__comparison > 0) __l = __idx + 1; else return (void *) __p; } return ((void *)0); } # 826 "/usr/include/stdlib.h" 2 3 4 extern void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); extern void qsort_r (void *__base, size_t __nmemb, size_t __size, __compar_d_fn_t __compar, void *__arg) __attribute__ ((__nonnull__ (1, 4))); extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; __extension__ extern long long int llabs (long long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; extern div_t div (int __numer, int __denom) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; extern ldiv_t ldiv (long int __numer, long int __denom) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; __extension__ extern lldiv_t lldiv (long long int __numer, long long int __denom) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; # 872 "/usr/include/stdlib.h" 3 4 extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; extern char *gcvt (double __value, int __ndigit, char *__buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; extern char *qecvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; extern char *qfcvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; extern char *qgcvt (long double __value, int __ndigit, char *__buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); extern int qecvt_r (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); extern int qfcvt_r (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); extern int mbtowc (wchar_t *__restrict __pwc, const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); extern size_t mbstowcs (wchar_t *__restrict __pwcs, const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); extern size_t wcstombs (char *__restrict __s, const wchar_t *__restrict __pwcs, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; # 957 "/usr/include/stdlib.h" 3 4 extern int getsubopt (char **__restrict __optionp, char *const *__restrict __tokens, char **__restrict __valuep) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; extern int posix_openpt (int __oflag) ; extern int grantpt (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern int unlockpt (int __fd) __attribute__ ((__nothrow__ , __leaf__)); extern char *ptsname (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; extern int ptsname_r (int __fd, char *__buf, size_t __buflen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int getpt (void); extern int getloadavg (double __loadavg[], int __nelem) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 1013 "/usr/include/stdlib.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 # 24 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 3 4 extern __inline __attribute__ ((__gnu_inline__)) double __attribute__ ((__nothrow__ , __leaf__)) atof (const char *__nptr) { return strtod (__nptr, (char **) ((void *)0)); } # 1014 "/usr/include/stdlib.h" 2 3 4 # 1023 "/usr/include/stdlib.h" 3 4 # 29 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stdint.h" 1 3 4 # 9 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stdint.h" 3 4 # 1 "/usr/include/stdint.h" 1 3 4 # 26 "/usr/include/stdint.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4 # 27 "/usr/include/stdint.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 # 29 "/usr/include/stdint.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 # 30 "/usr/include/stdint.h" 2 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h" 1 3 4 # 24 "/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h" 3 4 typedef __uint8_t uint8_t; typedef __uint16_t uint16_t; typedef __uint32_t uint32_t; typedef __uint64_t uint64_t; # 38 "/usr/include/stdint.h" 2 3 4 typedef __int_least8_t int_least8_t; typedef __int_least16_t int_least16_t; typedef __int_least32_t int_least32_t; typedef __int_least64_t int_least64_t; typedef __uint_least8_t uint_least8_t; typedef __uint_least16_t uint_least16_t; typedef __uint_least32_t uint_least32_t; typedef __uint_least64_t uint_least64_t; typedef signed char int_fast8_t; typedef long int int_fast16_t; typedef long int int_fast32_t; typedef long int int_fast64_t; # 71 "/usr/include/stdint.h" 3 4 typedef unsigned char uint_fast8_t; typedef unsigned long int uint_fast16_t; typedef unsigned long int uint_fast32_t; typedef unsigned long int uint_fast64_t; # 90 "/usr/include/stdint.h" 3 4 typedef unsigned long int uintptr_t; # 101 "/usr/include/stdint.h" 3 4 typedef __intmax_t intmax_t; typedef __uintmax_t uintmax_t; # 10 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stdint.h" 2 3 4 # 33 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/usr/include/string.h" 1 3 4 # 26 "/usr/include/string.h" 3 4 # 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4 # 27 "/usr/include/string.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 34 "/usr/include/string.h" 2 3 4 # 43 "/usr/include/string.h" 3 4 extern void *memcpy (void *__restrict __dest, const void *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memmove (void *__dest, const void *__src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memccpy (void *__restrict __dest, const void *__restrict __src, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern int memcmp (const void *__s1, const void *__s2, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); # 91 "/usr/include/string.h" 3 4 extern void *memchr (const void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 104 "/usr/include/string.h" 3 4 extern void *rawmemchr (const void *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 115 "/usr/include/string.h" 3 4 extern void *memrchr (const void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strcpy (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strcat (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strncat (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strncmp (const char *__s1, const char *__s2, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcoll (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strxfrm (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern int strcoll_l (const char *__s1, const char *__s2, locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); extern char *strdup (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); extern char *strndup (const char *__string, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); # 226 "/usr/include/string.h" 3 4 extern char *strchr (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 253 "/usr/include/string.h" 3 4 extern char *strrchr (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 266 "/usr/include/string.h" 3 4 extern char *strchrnul (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern size_t strcspn (const char *__s, const char *__reject) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strspn (const char *__s, const char *__accept) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); # 303 "/usr/include/string.h" 3 4 extern char *strpbrk (const char *__s, const char *__accept) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); # 330 "/usr/include/string.h" 3 4 extern char *strstr (const char *__haystack, const char *__needle) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strtok (char *__restrict __s, const char *__restrict __delim) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); extern char *__strtok_r (char *__restrict __s, const char *__restrict __delim, char **__restrict __save_ptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, char **__restrict __save_ptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); # 360 "/usr/include/string.h" 3 4 extern char *strcasestr (const char *__haystack, const char *__needle) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memmem (const void *__haystack, size_t __haystacklen, const void *__needle, size_t __needlelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 3))); extern void *__mempcpy (void *__restrict __dest, const void *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void *mempcpy (void *__restrict __dest, const void *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern size_t strnlen (const char *__string, size_t __maxlen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); # 421 "/usr/include/string.h" 3 4 extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; extern char *strerror_l (int __errnum, locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); # 1 "/usr/include/strings.h" 1 3 4 # 23 "/usr/include/strings.h" 3 4 # 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stddef.h" 1 3 4 # 24 "/usr/include/strings.h" 2 3 4 extern int bcmp (const void *__s1, const void *__s2, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern void bcopy (const void *__src, void *__dest, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 68 "/usr/include/strings.h" 3 4 extern char *index (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); # 96 "/usr/include/strings.h" 3 4 extern char *rindex (const char *__s, int __c) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int ffsl (long int __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); __extension__ extern int ffsll (long long int __ll) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern int strcasecmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); extern int strncasecmp_l (const char *__s1, const char *__s2, size_t __n, locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4))); # 433 "/usr/include/string.h" 2 3 4 extern void explicit_bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern char *strsep (char **__restrict __stringp, const char *__restrict __delim) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *__stpncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern char *stpncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); extern int strverscmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strfry (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); extern void *memfrob (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 487 "/usr/include/string.h" 3 4 extern char *basename (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); # 499 "/usr/include/string.h" 3 4 # 37 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/usr/include/inttypes.h" 1 3 4 # 34 "/usr/include/inttypes.h" 3 4 typedef int __gwchar_t; # 266 "/usr/include/inttypes.h" 3 4 typedef struct { long int quot; long int rem; } imaxdiv_t; # 290 "/usr/include/inttypes.h" 3 4 extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); extern intmax_t strtoimax (const char *__restrict __nptr, char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); extern uintmax_t strtoumax (const char *__restrict __nptr, char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, __gwchar_t **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, __gwchar_t ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); extern long int __strtol_internal (const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern __inline __attribute__ ((__gnu_inline__)) intmax_t __attribute__ ((__nothrow__ , __leaf__)) strtoimax (const char *__restrict nptr, char **__restrict endptr, int base) { return __strtol_internal (nptr, endptr, base, 0); } extern unsigned long int __strtoul_internal (const char *__restrict __nptr, char ** __restrict __endptr, int __base, int __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern __inline __attribute__ ((__gnu_inline__)) uintmax_t __attribute__ ((__nothrow__ , __leaf__)) strtoumax (const char *__restrict nptr, char **__restrict endptr, int base) { return __strtoul_internal (nptr, endptr, base, 0); } extern long int __wcstol_internal (const __gwchar_t * __restrict __nptr, __gwchar_t **__restrict __endptr, int __base, int __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern __inline __attribute__ ((__gnu_inline__)) intmax_t __attribute__ ((__nothrow__ , __leaf__)) wcstoimax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base) { return __wcstol_internal (nptr, endptr, base, 0); } extern unsigned long int __wcstoul_internal (const __gwchar_t * __restrict __nptr, __gwchar_t ** __restrict __endptr, int __base, int __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; extern __inline __attribute__ ((__gnu_inline__)) uintmax_t __attribute__ ((__nothrow__ , __leaf__)) wcstoumax (const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr, int base) { return __wcstoul_internal (nptr, endptr, base, 0); } # 432 "/usr/include/inttypes.h" 3 4 # 41 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 # 1 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-common.h" 1 # 21 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-common.h" # 21 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-common.h" struct simple_object_functions; struct simple_object_read_struct { int descriptor; off_t offset; const struct simple_object_functions *functions; void *data; }; struct simple_object_attributes_struct { const struct simple_object_functions *functions; void *data; }; struct simple_object_write_struct { const struct simple_object_functions *functions; char *segment_name; simple_object_write_section *sections; simple_object_write_section *last_section; void *data; }; struct simple_object_write_section_struct { simple_object_write_section *next; char *name; unsigned int align; struct simple_object_write_section_buffer *buffers; struct simple_object_write_section_buffer *last_buffer; }; struct simple_object_write_section_buffer { struct simple_object_write_section_buffer *next; size_t size; const void *buffer; void *free_buffer; }; struct simple_object_functions { void *(*match) (unsigned char header[(16)], int descriptor, off_t offset, const char *segment_name, const char **errmsg, int *err); const char *(*find_sections) (simple_object_read *, int (*pfn) (void *, const char *, off_t offset, off_t length), void *data, int *err); void *(*fetch_attributes) (simple_object_read *sobj, const char **errmsg, int *err); void (*release_read) (void *); const char *(*attributes_merge) (void *, void *, int *err); void (*release_attributes) (void *); void *(*start_write) (void *attributes_data, const char **errmsg, int *err); const char *(*write_to_file) (simple_object_write *sobj, int descriptor, int *err); void (*release_write) (void *); const char *(*copy_lto_debug_sections) (simple_object_read *sobj, simple_object_write *dobj, char *(*pfn) (const char *), int *err); }; extern const struct simple_object_functions simple_object_coff_functions; extern const struct simple_object_functions simple_object_elf_functions; extern const struct simple_object_functions simple_object_mach_o_functions; extern const struct simple_object_functions simple_object_xcoff_functions; extern int simple_object_internal_read (int descriptor, off_t offset, unsigned char *buffer, size_t size, const char **errmsg, int *err); extern int simple_object_internal_write (int descriptor, off_t offset, const unsigned char *buffer, size_t size, const char **errmsg, int *err); __extension__ typedef uint64_t ulong_type; static inline unsigned short simple_object_fetch_big_16 (const unsigned char *buf) { return ((unsigned short) buf[0] << 8) | (unsigned short) buf[1]; } static inline unsigned short simple_object_fetch_little_16 (const unsigned char *buf) { return ((unsigned short) buf[1] << 8) | (unsigned short) buf[0]; } static inline unsigned int simple_object_fetch_big_32 (const unsigned char *buf) { return (((unsigned int) buf[0] << 24) | ((unsigned int) buf[1] << 16) | ((unsigned int) buf[2] << 8) | (unsigned int) buf[3]); } static inline unsigned int simple_object_fetch_little_32 (const unsigned char *buf) { return (((unsigned int) buf[3] << 24) | ((unsigned int) buf[2] << 16) | ((unsigned int) buf[1] << 8) | (unsigned int) buf[0]); } static inline ulong_type simple_object_fetch_big_32_ulong (const unsigned char *buf) { return (ulong_type) simple_object_fetch_big_32 (buf); } static inline ulong_type simple_object_fetch_little_32_ulong (const unsigned char *buf) { return (ulong_type) simple_object_fetch_little_32 (buf); } static inline ulong_type simple_object_fetch_big_64 (const unsigned char *buf) { return (((ulong_type) buf[0] << 56) | ((ulong_type) buf[1] << 48) | ((ulong_type) buf[2] << 40) | ((ulong_type) buf[3] << 32) | ((ulong_type) buf[4] << 24) | ((ulong_type) buf[5] << 16) | ((ulong_type) buf[6] << 8) | (ulong_type) buf[7]); } static inline ulong_type simple_object_fetch_little_64 (const unsigned char *buf) { return (((ulong_type) buf[7] << 56) | ((ulong_type) buf[6] << 48) | ((ulong_type) buf[5] << 40) | ((ulong_type) buf[4] << 32) | ((ulong_type) buf[3] << 24) | ((ulong_type) buf[2] << 16) | ((ulong_type) buf[1] << 8) | (ulong_type) buf[0]); } static inline void simple_object_set_big_16 (unsigned char *buf, unsigned short val) { buf[0] = (val >> 8) & 0xff; buf[1] = val & 0xff; } static inline void simple_object_set_little_16 (unsigned char *buf, unsigned short val) { buf[1] = (val >> 8) & 0xff; buf[0] = val & 0xff; } static inline void simple_object_set_big_32 (unsigned char *buf, unsigned int val) { buf[0] = (val >> 24) & 0xff; buf[1] = (val >> 16) & 0xff; buf[2] = (val >> 8) & 0xff; buf[3] = val & 0xff; } static inline void simple_object_set_little_32 (unsigned char *buf, unsigned int val) { buf[3] = (val >> 24) & 0xff; buf[2] = (val >> 16) & 0xff; buf[1] = (val >> 8) & 0xff; buf[0] = val & 0xff; } static inline void simple_object_set_big_32_ulong (unsigned char *buf, ulong_type val) { simple_object_set_big_32 (buf, val); } static inline void simple_object_set_little_32_ulong (unsigned char *buf, ulong_type val) { simple_object_set_little_32 (buf, val); } static inline void simple_object_set_big_64 (unsigned char *buf, ulong_type val) { buf[0] = (val >> 56) & 0xff; buf[1] = (val >> 48) & 0xff; buf[2] = (val >> 40) & 0xff; buf[3] = (val >> 32) & 0xff; buf[4] = (val >> 24) & 0xff; buf[5] = (val >> 16) & 0xff; buf[6] = (val >> 8) & 0xff; buf[7] = val & 0xff; } static inline void simple_object_set_little_64 (unsigned char *buf, ulong_type val) { buf[7] = (val >> 56) & 0xff; buf[6] = (val >> 48) & 0xff; buf[5] = (val >> 40) & 0xff; buf[4] = (val >> 32) & 0xff; buf[3] = (val >> 24) & 0xff; buf[2] = (val >> 16) & 0xff; buf[1] = (val >> 8) & 0xff; buf[0] = val & 0xff; } # 44 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 2 struct external_filehdr { unsigned char f_magic[2]; unsigned char f_nscns[2]; unsigned char f_timdat[4]; unsigned char f_symptr[4]; unsigned char f_nsyms[4]; unsigned char f_opthdr[2]; unsigned char f_flags[2]; }; # 68 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr { unsigned char s_name[8]; unsigned char s_paddr[4]; unsigned char s_vaddr[4]; unsigned char s_size[4]; unsigned char s_scnptr[4]; unsigned char s_relptr[4]; unsigned char s_lnnoptr[4]; unsigned char s_nreloc[2]; unsigned char s_nlnno[2]; unsigned char s_flags[4]; }; # 102 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_syment { union { unsigned char e_name[8]; struct { unsigned char e_zeroes[4]; unsigned char e_offset[4]; } e; } e; unsigned char e_value[4]; unsigned char e_scnum[2]; unsigned char e_type[2]; unsigned char e_sclass[1]; unsigned char e_numaux[1]; }; union external_auxent { union { char x_fname[18]; struct { unsigned char x_zeroes[4]; unsigned char x_offset[4]; } x_n; } x_file; struct { unsigned char x_scnlen[4]; unsigned char x_nreloc[2]; unsigned char x_nlinno[2]; unsigned char x_checksum[4]; unsigned char x_associated[2]; unsigned char x_comdat[1]; } x_scn; }; # 165 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct simple_object_coff_read { unsigned short magic; unsigned char is_big_endian; unsigned short nscns; off_t symptr; unsigned int nsyms; unsigned short flags; off_t scnhdr_offset; }; struct simple_object_coff_attributes { unsigned short magic; unsigned char is_big_endian; unsigned short flags; }; struct coff_magic_struct { unsigned short magic; unsigned char is_big_endian; unsigned short non_object_flags; }; static const struct coff_magic_struct coff_magic[] = { { 0x14c, 0, (0x0002) | (0x1000) | (0x2000) }, { 0x8664, 0, (0x0002) | (0x1000) | (0x2000) } }; static void * simple_object_coff_match (unsigned char header[(16)], int descriptor, off_t offset, const char *segment_name __attribute__ ((__unused__)), const char **errmsg, int *err) { size_t c; unsigned short magic_big; unsigned short magic_little; unsigned short magic; size_t i; int is_big_endian; unsigned short (*fetch_16) (const unsigned char *); unsigned int (*fetch_32) (const unsigned char *); unsigned char hdrbuf[sizeof (struct external_filehdr)]; unsigned short flags; struct simple_object_coff_read *ocr; c = sizeof (coff_magic) / sizeof (coff_magic[0]); magic_big = simple_object_fetch_big_16 (header); magic_little = simple_object_fetch_little_16 (header); for (i = 0; i < c; ++i) { if (coff_magic[i].is_big_endian ? coff_magic[i].magic == magic_big : coff_magic[i].magic == magic_little) break; } if (i >= c) { *errmsg = # 257 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 257 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; *err = 0; return # 259 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 259 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; } is_big_endian = coff_magic[i].is_big_endian; magic = is_big_endian ? magic_big : magic_little; fetch_16 = (is_big_endian ? simple_object_fetch_big_16 : simple_object_fetch_little_16); fetch_32 = (is_big_endian ? simple_object_fetch_big_32 : simple_object_fetch_little_32); if (!simple_object_internal_read (descriptor, offset, hdrbuf, sizeof hdrbuf, errmsg, err)) return # 273 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 273 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; flags = fetch_16 (hdrbuf + # 275 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 275 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 275 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 275 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_flags # 275 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 275 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ); if ((flags & coff_magic[i].non_object_flags) != 0) { *errmsg = "not relocatable object file"; *err = 0; return # 280 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 280 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; } ocr = ((struct simple_object_coff_read *) xmalloc (sizeof (struct simple_object_coff_read))); ocr->magic = magic; ocr->is_big_endian = is_big_endian; ocr->nscns = fetch_16 (hdrbuf + # 286 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 286 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 286 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 286 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_nscns # 286 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 286 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ); ocr->symptr = fetch_32 (hdrbuf + # 288 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 288 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 288 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 288 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_symptr # 288 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 288 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ); ocr->nsyms = fetch_32 (hdrbuf + # 289 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 289 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 289 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 289 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_nsyms # 289 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 289 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ); ocr->flags = flags; ocr->scnhdr_offset = (sizeof (struct external_filehdr) + fetch_16 (hdrbuf + # 292 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 292 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 292 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 292 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_opthdr # 292 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 293 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" )); return (void *) ocr; } static char * simple_object_coff_read_strtab (simple_object_read *sobj, size_t *strtab_size, const char **errmsg, int *err) { struct simple_object_coff_read *ocr = (struct simple_object_coff_read *) sobj->data; off_t strtab_offset; unsigned char strsizebuf[4]; size_t strsize; char *strtab; strtab_offset = sobj->offset + ocr->symptr + ocr->nsyms * sizeof (struct external_syment); if (!simple_object_internal_read (sobj->descriptor, strtab_offset, strsizebuf, 4, errmsg, err)) return # 315 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 315 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; strsize = (ocr->is_big_endian ? simple_object_fetch_big_32 (strsizebuf) : simple_object_fetch_little_32 (strsizebuf)); strtab = ((char *) xmalloc (sizeof (char) * (strsize))); if (!simple_object_internal_read (sobj->descriptor, strtab_offset, (unsigned char *) strtab, strsize, errmsg, err)) { free ((void*) (strtab)); return # 325 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 325 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; } *strtab_size = strsize; return strtab; } static const char * simple_object_coff_find_sections (simple_object_read *sobj, int (*pfn) (void *, const char *, off_t offset, off_t length), void *data, int *err) { struct simple_object_coff_read *ocr = (struct simple_object_coff_read *) sobj->data; size_t scnhdr_size; unsigned char *scnbuf; const char *errmsg; unsigned int (*fetch_32) (const unsigned char *); unsigned int nscns; char *strtab; size_t strtab_size; unsigned int i; scnhdr_size = sizeof (struct external_scnhdr); scnbuf = ((unsigned char *) xmalloc (sizeof (unsigned char) * (scnhdr_size * ocr->nscns))); if (!simple_object_internal_read (sobj->descriptor, sobj->offset + ocr->scnhdr_offset, scnbuf, scnhdr_size * ocr->nscns, &errmsg, err)) { free ((void*) (scnbuf)); return errmsg; } fetch_32 = (ocr->is_big_endian ? simple_object_fetch_big_32 : simple_object_fetch_little_32); nscns = ocr->nscns; strtab = # 367 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 367 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; strtab_size = 0; for (i = 0; i < nscns; ++i) { unsigned char *scnhdr; unsigned char *scnname; char namebuf[(8) + 1]; char *name; off_t scnptr; unsigned int size; scnhdr = scnbuf + i * scnhdr_size; scnname = scnhdr + # 379 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 379 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr # 379 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 379 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" s_name # 379 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 379 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; memcpy (namebuf, scnname, (8)); namebuf[(8)] = '\0'; name = &namebuf[0]; if (namebuf[0] == '/') { size_t strindex; char *end; strindex = strtol (namebuf + 1, &end, 10); if (*end == '\0') { if (strtab == # 393 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 393 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ) { strtab = simple_object_coff_read_strtab (sobj, &strtab_size, &errmsg, err); if (strtab == # 398 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 398 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ) { free ((void*) (scnbuf)); return errmsg; } } if (strindex < 4 || strindex >= strtab_size) { free ((void*) (strtab)); free ((void*) (scnbuf)); *err = 0; return "section string index out of range"; } name = strtab + strindex; } } scnptr = fetch_32 (scnhdr + # 417 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 417 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr # 417 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 417 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" s_scnptr # 417 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 417 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ); size = fetch_32 (scnhdr + # 418 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 418 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr # 418 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 418 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" s_size # 418 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 418 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ); if (!(*pfn) (data, name, scnptr, size)) break; } if (strtab != # 424 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 424 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ) free ((void*) (strtab)); free ((void*) (scnbuf)); return # 428 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 428 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; } static void * simple_object_coff_fetch_attributes (simple_object_read *sobj, const char **errmsg __attribute__ ((__unused__)), int *err __attribute__ ((__unused__))) { struct simple_object_coff_read *ocr = (struct simple_object_coff_read *) sobj->data; struct simple_object_coff_attributes *ret; ret = ((struct simple_object_coff_attributes *) xmalloc (sizeof (struct simple_object_coff_attributes))); ret->magic = ocr->magic; ret->is_big_endian = ocr->is_big_endian; ret->flags = ocr->flags; return ret; } static void simple_object_coff_release_read (void *data) { free ((void*) (data)); } static const char * simple_object_coff_attributes_merge (void *todata, void *fromdata, int *err) { struct simple_object_coff_attributes *to = (struct simple_object_coff_attributes *) todata; struct simple_object_coff_attributes *from = (struct simple_object_coff_attributes *) fromdata; if (to->magic != from->magic || to->is_big_endian != from->is_big_endian) { *err = 0; return "COFF object format mismatch"; } return # 472 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 472 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; } static void simple_object_coff_release_attributes (void *data) { free ((void*) (data)); } static void * simple_object_coff_start_write (void *attributes_data, const char **errmsg __attribute__ ((__unused__)), int *err __attribute__ ((__unused__))) { struct simple_object_coff_attributes *attrs = (struct simple_object_coff_attributes *) attributes_data; struct simple_object_coff_attributes *ret; ret = ((struct simple_object_coff_attributes *) xmalloc (sizeof (struct simple_object_coff_attributes))); *ret = *attrs; return ret; } static int simple_object_coff_write_filehdr (simple_object_write *sobj, int descriptor, unsigned int nscns, size_t symtab_offset, unsigned int nsyms, const char **errmsg, int *err) { struct simple_object_coff_attributes *attrs = (struct simple_object_coff_attributes *) sobj->data; unsigned char hdrbuf[sizeof (struct external_filehdr)]; unsigned char *hdr; void (*set_16) (unsigned char *, unsigned short); void (*set_32) (unsigned char *, unsigned int); hdr = &hdrbuf[0]; set_16 = (attrs->is_big_endian ? simple_object_set_big_16 : simple_object_set_little_16); set_32 = (attrs->is_big_endian ? simple_object_set_big_32 : simple_object_set_little_32); memset (hdr, 0, sizeof (struct external_filehdr)); set_16 (hdr + # 527 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 527 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 527 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 527 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_magic # 527 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 527 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , attrs->magic); set_16 (hdr + # 528 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 528 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 528 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 528 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_nscns # 528 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 528 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , nscns); set_32 (hdr + # 530 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 530 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 530 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 530 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_symptr # 530 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 530 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , symtab_offset); set_32 (hdr + # 531 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 531 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 531 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 531 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_nsyms # 531 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 531 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , nsyms); set_16 (hdr + # 533 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 533 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_filehdr # 533 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 533 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" f_flags # 533 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 533 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , attrs->flags); return simple_object_internal_write (descriptor, 0, hdrbuf, sizeof (struct external_filehdr), errmsg, err); } static int simple_object_coff_write_scnhdr (simple_object_write *sobj, int descriptor, const char *name, size_t *name_offset, off_t scnhdr_offset, size_t scnsize, off_t offset, unsigned int align, const char **errmsg, int *err) { struct simple_object_coff_attributes *attrs = (struct simple_object_coff_attributes *) sobj->data; void (*set_32) (unsigned char *, unsigned int); unsigned char hdrbuf[sizeof (struct external_scnhdr)]; unsigned char *hdr; size_t namelen; unsigned int flags; set_32 = (attrs->is_big_endian ? simple_object_set_big_32 : simple_object_set_little_32); memset (hdrbuf, 0, sizeof hdrbuf); hdr = &hdrbuf[0]; namelen = strlen (name); if (namelen <= (8)) strncpy ((char *) hdr + # 566 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 566 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr # 566 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 566 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" s_name # 566 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 566 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , name, (8)); else { snprintf ((char *) hdr + # 570 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 570 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr # 570 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 570 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" s_name # 570 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 570 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , (8), "/%lu", (unsigned long) *name_offset); *name_offset += namelen + 1; } set_32 (hdr + # 577 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 577 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr # 577 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 577 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" s_size # 577 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 577 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , scnsize); set_32 (hdr + # 578 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 578 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr # 578 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 578 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" s_scnptr # 578 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 578 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , offset); flags = ((1 << 6) | (1 << 25) | (1 << 28) | (1 << 30)); if (align > 13) align = 13; flags |= (((align) + 1) << 20); set_32 (hdr + # 589 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 __builtin_offsetof ( # 589 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" struct external_scnhdr # 589 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 , # 589 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" s_flags # 589 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ) # 589 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" , flags); return simple_object_internal_write (descriptor, scnhdr_offset, hdrbuf, sizeof (struct external_scnhdr), errmsg, err); } static const char * simple_object_coff_write_to_file (simple_object_write *sobj, int descriptor, int *err) { struct simple_object_coff_attributes *attrs = (struct simple_object_coff_attributes *) sobj->data; unsigned int nscns, secnum; simple_object_write_section *section; off_t scnhdr_offset; size_t symtab_offset; off_t secsym_offset; unsigned int nsyms; size_t offset; size_t name_offset; const char *errmsg; unsigned char strsizebuf[4]; const char *source_filename = "fake"; size_t sflen; union { struct external_syment sym; union external_auxent aux; } syms[2]; void (*set_16) (unsigned char *, unsigned short); void (*set_32) (unsigned char *, unsigned int); set_16 = (attrs->is_big_endian ? simple_object_set_big_16 : simple_object_set_little_16); set_32 = (attrs->is_big_endian ? simple_object_set_big_32 : simple_object_set_little_32); nscns = 0; for (section = sobj->sections; section != # 635 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 635 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; section = section->next) ++nscns; scnhdr_offset = sizeof (struct external_filehdr); offset = scnhdr_offset + nscns * sizeof (struct external_scnhdr); name_offset = 4; for (section = sobj->sections; section != # 641 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 641 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; section = section->next) { size_t mask; size_t new_offset; size_t scnsize; struct simple_object_write_section_buffer *buffer; mask = (1U << section->align) - 1; new_offset = offset & mask; new_offset &= ~ mask; while (new_offset > offset) { unsigned char zeroes[16]; size_t write; memset (zeroes, 0, sizeof zeroes); write = new_offset - offset; if (write > sizeof zeroes) write = sizeof zeroes; if (!simple_object_internal_write (descriptor, offset, zeroes, write, &errmsg, err)) return errmsg; } scnsize = 0; for (buffer = section->buffers; buffer != # 666 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 666 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; buffer = buffer->next) { if (!simple_object_internal_write (descriptor, offset + scnsize, ((const unsigned char *) buffer->buffer), buffer->size, &errmsg, err)) return errmsg; scnsize += buffer->size; } if (!simple_object_coff_write_scnhdr (sobj, descriptor, section->name, &name_offset, scnhdr_offset, scnsize, offset, section->align, &errmsg, err)) return errmsg; scnhdr_offset += sizeof (struct external_scnhdr); offset += scnsize; } offset += (offset & 1); nsyms = 2 * (nscns + 1); symtab_offset = offset; offset += nsyms * sizeof (struct external_syment); memset (&syms[0], 0, sizeof (syms)); strcpy ((char *)&syms[0].sym.e.e_name[0], ".file"); set_16 (&syms[0].sym.e_scnum[0], (-2)); set_16 (&syms[0].sym.e_type[0], (((0) << 4) | (0))); syms[0].sym.e_sclass[0] = (103); syms[0].sym.e_numaux[0] = 1; sflen = strlen (source_filename); if (sflen <= 18) memcpy (&syms[1].aux.x_file.x_fname[0], source_filename, sflen); else { set_32 (&syms[1].aux.x_file.x_n.x_offset[0], name_offset); if (!simple_object_internal_write (descriptor, offset + name_offset, ((const unsigned char *) source_filename), sflen + 1, &errmsg, err)) return errmsg; name_offset += strlen (source_filename) + 1; } if (!simple_object_internal_write (descriptor, symtab_offset, (const unsigned char *) &syms[0], sizeof (syms), &errmsg, err)) return errmsg; set_32 (strsizebuf, name_offset); if (!simple_object_internal_write (descriptor, offset, strsizebuf, 4, &errmsg, err)) return errmsg; name_offset = 4; secsym_offset = symtab_offset + sizeof (syms); memset (&syms[0], 0, sizeof (syms)); set_16 (&syms[0].sym.e_type[0], (((0) << 4) | (0))); syms[0].sym.e_sclass[0] = (3); syms[0].sym.e_numaux[0] = 1; secnum = 1; for (section = sobj->sections; section != # 738 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 738 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; section = section->next) { size_t namelen; size_t scnsize; struct simple_object_write_section_buffer *buffer; namelen = strlen (section->name); set_16 (&syms[0].sym.e_scnum[0], secnum++); scnsize = 0; for (buffer = section->buffers; buffer != # 747 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 747 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; buffer = buffer->next) scnsize += buffer->size; set_32 (&syms[1].aux.x_scn.x_scnlen[0], scnsize); if (namelen > (8)) { set_32 (&syms[0].sym.e.e.e_zeroes[0], 0); set_32 (&syms[0].sym.e.e.e_offset[0], name_offset); if (!simple_object_internal_write (descriptor, offset + name_offset, ((const unsigned char *) section->name), namelen + 1, &errmsg, err)) return errmsg; name_offset += namelen + 1; } else { memcpy (&syms[0].sym.e.e_name[0], section->name, strlen (section->name)); memset (&syms[0].sym.e.e_name[strlen (section->name)], 0, 8 - strlen (section->name)); } if (!simple_object_internal_write (descriptor, secsym_offset, (const unsigned char *) &syms[0], sizeof (syms), &errmsg, err)) return errmsg; secsym_offset += sizeof (syms); } if (!simple_object_coff_write_filehdr (sobj, descriptor, nscns, symtab_offset, nsyms, &errmsg, err)) return errmsg; return # 780 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 780 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" ; } static void simple_object_coff_release_write (void *data) { free ((void*) (data)); } const struct simple_object_functions simple_object_coff_functions = { simple_object_coff_match, simple_object_coff_find_sections, simple_object_coff_fetch_attributes, simple_object_coff_release_read, simple_object_coff_attributes_merge, simple_object_coff_release_attributes, simple_object_coff_start_write, simple_object_coff_write_to_file, simple_object_coff_release_write, # 804 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" 3 4 ((void *)0) # 805 "/home/giulianob/gcc_git_gnu/gcc/libiberty/simple-object-coff.c" };
the_stack_data/165765548.c
#include "stdlib.h" /* concatenates s2 to the end of s1 and returns s1 */ char *strcat(char *s1, const char *s2) { char *result = s1; while (*s1 != 0) s1++; do { *(s1++) = *(s2); } while (*(s2++) != 0); return result; }
the_stack_data/1070832.c
#include<stdio.h> int maiorDeDoisNumeros(int, int); int maiorDeTresNumeros(int, int, int); main() { int a, b, c; printf("Digite 3 numeros: "); scanf("%d%d%d", &a, &b, &c); printf("O maior entre %d e %d e o %d\n", a, b, maiorDeDoisNumeros(a,b)); printf("O maior entre %d, %d e %d e o %d\n", a, b, c, maiorDeTresNumeros(a,b,c)); } int maiorDeDoisNumeros(int a, int b) { if(a > b) return a; else return b; } int maiorDeTresNumeros(int a, int b, int c) { if (maiorDeDoisNumeros(a, b) > c) return maiorDeDoisNumeros(a, b); else return c; }
the_stack_data/168892565.c
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/mman.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> // レジスタブロックの物理アドレス #define PERI_BASE 0x20000000 #define GPIO_BASE (PERI_BASE + 0x200000) #define BLOCK_SIZE 4096 // gpio[n]: GPIO 関連レジスタ (volatile=必ず実メモリにアクセスさせる) static volatile unsigned int *gpio; // gpio_init: GPIO 初期化(最初に1度だけ呼び出すこと) void gpio_init () { int fd; void *gpio_map; // /dev/mem(物理メモリデバイス)を開く(sudo が必要) fd = open("/dev/mem", O_RDWR | O_SYNC); if (fd == -1) { printf("error: cannot open /dev/mem (gpio_setup)\n"); exit(-1); } // mmap で GPIO(物理メモリ)を gpio_map(仮想メモリ)に対応づける gpio_map = mmap(NULL, BLOCK_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, GPIO_BASE ); if ((int) gpio_map == -1) { printf("error: cannot map /dev/mem on the memory (gpio_setup)\n"); exit(-1); } // mmap 後は不要な fd をクローズ close(fd); // gpio[index]: 整数 uint32 の配列としてレジスタへのアクセスを確立 gpio = (unsigned int *) gpio_map; } // ピン機能(BCM2835) #define GPIO_INPUT 0x0 // 入力 #define GPIO_OUTPUT 0x1 // 出力 #define GPIO_ALT0 0x4 #define GPIO_ALT1 0x5 #define GPIO_ALT2 0x6 #define GPIO_ALT3 0x7 #define GPIO_ALT4 0x3 #define GPIO_ALT5 0x2 // gpio_configure: ピン機能を設定する(ピンを使用する前に必ず設定) // pin : (P1) 2,3,4,7,8,9,10,11,14,15,17,18,22,23,24,25,27 // (P5) 28,29,30,31 // mode: GPIO_INPUT, _OUTPUT, _ALT0, _ALT1, _ALT2, _ALT3, _ALT4, _ALT5 void gpio_configure (int pin, int mode) { // ピン番号チェック if (pin < 0 || pin > 31) { printf("error: pin number out of range (gpio_configure)\n"); exit(-1); } // レジスタ番号(index)と3ビットマスクを生成 int index = pin / 10; unsigned int mask = ~(0x7 << ((pin % 10) * 3)); // GPFSEL0/1 の該当する FSEL (3bit) のみを書き換え gpio[index] = (gpio[index] & mask) | ((mode & 0x7) << ((pin % 10) * 3)); } // gpio_set/clear: ピンをセット (3.3V),クリア (0V) void gpio_set (int pin) { // ピン番号チェック(スピードを追求するなら省略してもよい) if (pin < 0 || pin > 31) { printf("error: pin number out of range (gpio_set)\n"); exit(-1); } // ピンに1を出力(3.3V 出力) gpio[7] = 0x1 << pin; // GPSET0 } void gpio_clear (int pin) { // ピン番号チェック(スピードを追求するなら省略してもよい) if (pin < 0 || pin > 31) { printf("error: pin number out of range (gpio_clear)\n"); exit(-1); } // ピンに0を出力(0V 出力) gpio[10] = 0x1 << pin; // GPCLR0 } int gpio_read (int pin) { // ピン番号チェック(スピードを追求するなら省略してもよい) if (pin < 0 || pin > 31) { printf("error: pin number out of range (gpio_read)\n"); exit(-1); } // ピンの電圧を返す(入力/出力を問わず 3.3V なら 1,0V なら 0) return (gpio[13] & (0x1 << pin)) != 0; // GPLEV0 } #define OPM_D0 2 #define OPM_D1 3 #define OPM_D2 4 #define OPM_D3 7 #define OPM_D4 8 #define OPM_D5 9 #define OPM_D6 10 #define OPM_D7 11 #define OPM_IRQ 14 #define OPM_IC 15 #define OPM_A0 17 #define OPM_WR 18 #define OPM_RD 22 #define OPM_CS 23 #define LVL_OE 24 void set_data_io(int io) { gpio_configure(OPM_D0, io); gpio_configure(OPM_D1, io); gpio_configure(OPM_D2, io); gpio_configure(OPM_D3, io); gpio_configure(OPM_D4, io); gpio_configure(OPM_D5, io); gpio_configure(OPM_D6, io); gpio_configure(OPM_D7, io); } void write_data(unsigned char d) { if (d & 0x01) { gpio_set(OPM_D0); } else { gpio_clear(OPM_D0); } if (d & 0x02) { gpio_set(OPM_D1); } else { gpio_clear(OPM_D1); } if (d & 0x04) { gpio_set(OPM_D2); } else { gpio_clear(OPM_D2); } if (d & 0x08) { gpio_set(OPM_D3); } else { gpio_clear(OPM_D3); } if (d & 0x10) { gpio_set(OPM_D4); } else { gpio_clear(OPM_D4); } if (d & 0x20) { gpio_set(OPM_D5); } else { gpio_clear(OPM_D5); } if (d & 0x40) { gpio_set(OPM_D6); } else { gpio_clear(OPM_D6); } if (d & 0x80) { gpio_set(OPM_D7); } else { gpio_clear(OPM_D7); } } unsigned char read_data(void) { unsigned char d = 0; if (gpio_read(OPM_D0)) { d |= 0x01; } if (gpio_read(OPM_D1)) { d |= 0x02; } if (gpio_read(OPM_D2)) { d |= 0x04; } if (gpio_read(OPM_D3)) { d |= 0x08; } if (gpio_read(OPM_D4)) { d |= 0x10; } if (gpio_read(OPM_D5)) { d |= 0x20; } if (gpio_read(OPM_D6)) { d |= 0x40; } if (gpio_read(OPM_D7)) { d |= 0x80; } return d; } unsigned char read_mem(unsigned int *p) { unsigned char d = 0; if (*p & (1 << 2)) { d |= 0x01; } if (*p & (1 << 3)) { d |= 0x02; } if (*p & (1 << 4)) { d |= 0x04; } if (*p & (1 << 7)) { d |= 0x08; } if (*p & (1 << 8)) { d |= 0x10; } if (*p & (1 << 9)) { d |= 0x20; } if (*p & (1 << 10)) { d |= 0x40; } if (*p & (1 << 11)) { d |= 0x80; } return d; } void main () { int i, sock, fd, rsize, retval; struct sockaddr_in sa; char buf[2]; gpio_init(); set_data_io(GPIO_OUTPUT); write_data(0x0); gpio_configure(OPM_IC, GPIO_OUTPUT); gpio_configure(OPM_A0, GPIO_OUTPUT); gpio_configure(OPM_WR, GPIO_OUTPUT); gpio_configure(OPM_RD, GPIO_OUTPUT); gpio_configure(OPM_CS, GPIO_OUTPUT); gpio_set(OPM_IC); gpio_set(OPM_CS); gpio_set(OPM_WR); gpio_set(OPM_RD); printf("start\n"); usleep(100000); // 0.1秒待ち gpio_clear(OPM_IC); usleep(100000); // 0.1秒待ち gpio_set(OPM_IC); usleep(100000); // 0.1秒待ち sock = socket(AF_INET, SOCK_STREAM, 0); if (sock == -1) { printf("socket error\n"); exit(1); } memset(&sa, 0, sizeof(sa)); sa.sin_family = AF_INET; sa.sin_port = htons(2151); sa.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) == -1) { printf("bind error\n"); close(sock); exit(1); } if (listen(sock, 128) == -1) { printf("listen error\n"); close(sock); exit(1); } printf("listened\n"); fd = accept(sock, NULL, NULL); if (fd == -1) { printf("accept error\n"); close(sock); exit(1); } printf("accepted\n"); while (1) { memset(buf, 0, sizeof(buf)); rsize = recv(fd, buf, sizeof(buf), 0); if (rsize > 0) { //printf("%d 0x%x\n", buf[0], buf[1]); write_data(buf[1]); usleep(1); if (buf[0] == 1) { gpio_clear(OPM_A0); } else { gpio_set(OPM_A0); } gpio_clear(OPM_CS); usleep(1); gpio_clear(OPM_WR); usleep(2); gpio_set(OPM_WR); usleep(1); gpio_set(OPM_CS); usleep(1); usleep(256); } } close(fd); close(sock); exit(0); }
the_stack_data/87123.c
/* Autor: Benja Ajú fecha: Wed May 11 15:20:16 CST 2022 compilador: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 compilar: gcc -o problema4.out problema4.c Librerias: stdio resumen: */ //librerias #include <stdio.h>
the_stack_data/28961.c
#include <stdio.h> #include <stdlib.h> int main(){ int M; printf("M = "); scanf("%d",&M); fflush(stdin); int N; printf("N = "); scanf("%d",&N); fflush(stdin); int array[M][N]; for(int i = 0; i < M; i++) { for(int j = 0; j < N; j++) { printf("array[%d][%d] = ",i,j); scanf("%d",&array[i][j]); } } int minSum = 0; int index = -1; for(int i = 0; i < M; i++) { int temp = 0; for(int j = 0; j < N; j++) { temp+=array[i][j]; } if(temp < minSum || i == 0) { index = i; minSum = temp; } } printf("\nIndex of the string with minimum sum = %d; and value is %d\n",index,minSum); return 0; }
the_stack_data/406043.c
int ft_strcmp(char *s1, char *s2) { while ((*s1 != '\0' && *s2 != '\0') && *s1 == *s2) { s1++; s2++; } if (*s1 == *s2) return (0); else return (*s1 - *s2); } // #include <stdio.h> // int main(void) // { // char string1[] = "his one is long"; // char string2[] = "this one is long"; // printf("%d\n", ft_strcmp(string1, string2)); // }
the_stack_data/32949923.c
/* This is potentially great stuff, but fails against the test program at the end. This would probably be much more efficent than the implementation currently in gd.c if the errors in the output were corrected. TBB */ #if 0 #include "gd.h" #include <math.h> /* Courtesy of F J Franklin. */ static gdPoint gdArcClosest (int width, int height, int angle); void gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int width, int height, int color) { gdImageFilledArc (im, cx, cy, width, height, 0, 360, color, gdChord); } void gdImageFilledArc (gdImagePtr im, int cx, int cy, int width, int height, int s, int e, int color, int style) { gdPoint pt[7]; gdPoint axis_pt[4]; int angle; int have_s = 0; int have_e = 0; int flip_x = 0; int flip_y = 0; int conquer = 0; int i; int a; int b; int x; int y; long s_sin = 0; long s_cos = 0; long e_sin = 0; long e_cos = 0; long w; /* a * 2 */ long h; /* b * 2 */ long x2; /* x * 2 */ long y2; /* y * 2 */ long lx2; /* x * 2 (line) */ long ly2; /* y * 2 (line) */ long ws; /* (a * 2)^2 */ long hs; /* (b * 2)^2 */ long whs; /* (a * 2)^2 * (b * 2)^2 */ long g; /* decision variable */ long lg; /* decision variable (line) */ width = (width & 1) ? (width + 1) : (width); height = (height & 1) ? (height + 1) : (height); a = width / 2; b = height / 2; axis_pt[0].x = a; axis_pt[0].y = 0; axis_pt[1].x = 0; axis_pt[1].y = b; axis_pt[2].x = -a; axis_pt[2].y = 0; axis_pt[3].x = 0; axis_pt[3].y = -b; if (s == e) return; if ((e - s) >= 360) { s = 0; e = 0; } while (s < 0) s += 360; while (s >= 360) s -= 360; while (e < 0) e += 360; while (e >= 360) e -= 360; if (e <= s) e += 360; /* I'm assuming a chord-rule at the moment. Need to add origin to get a * pie-rule, but will need to set chord-rule before recursion... */ for (i = 0; i < 4; i++) { if ((s < (i + 1) * 90) && (e > (i + 1) * 90)) { gdImageFilledArc (im, cx, cy, width, height, s, (i + 1) * 90, color, gdChord); pt[0] = gdArcClosest (width, height, s); pt[0].x += cx; pt[0].y += cy; pt[1].x = cx + axis_pt[(i + 1) & 3].x; pt[1].y = cy + axis_pt[(i + 1) & 3].y; if (e <= (i + 2) * 90) { gdImageFilledArc (im, cx, cy, width, height, (i + 1) * 90, e, color, gdChord); pt[2] = gdArcClosest (width, height, e); pt[2].x += cx; pt[2].y += cy; if (style == gdChord) { gdImageFilledPolygon (im, pt, 3, color); gdImagePolygon (im, pt, 3, color); } else if (style == gdPie) { pt[3].x = cx; pt[3].y = cy; gdImageFilledPolygon (im, pt, 4, color); gdImagePolygon (im, pt, 4, color); } } else { gdImageFilledArc (im, cx, cy, width, height, (i + 1) * 90, (i + 2) * 90, color, gdChord); pt[2].x = cx + axis_pt[(i + 2) & 3].x; pt[2].y = cy + axis_pt[(i + 2) & 3].y; if (e <= (i + 3) * 90) { gdImageFilledArc (im, cx, cy, width, height, (i + 2) * 90, e, color, gdChord); pt[3] = gdArcClosest (width, height, e); pt[3].x += cx; pt[3].y += cy; if (style == gdChord) { gdImageFilledPolygon (im, pt, 4, color); gdImagePolygon (im, pt, 4, color); } else if (style == gdPie) { pt[4].x = cx; pt[4].y = cy; gdImageFilledPolygon (im, pt, 5, color); gdImagePolygon (im, pt, 5, color); } } else { gdImageFilledArc (im, cx, cy, width, height, (i + 2) * 90, (i + 3) * 90, color, gdChord); pt[3].x = cx + axis_pt[(i + 3) & 3].x; pt[3].y = cy + axis_pt[(i + 3) & 3].y; if (e <= (i + 4) * 90) { gdImageFilledArc (im, cx, cy, width, height, (i + 3) * 90, e, color, gdChord); pt[4] = gdArcClosest (width, height, e); pt[4].x += cx; pt[4].y += cy; if (style == gdChord) { gdImageFilledPolygon (im, pt, 5, color); gdImagePolygon (im, pt, 5, color); } else if (style == gdPie) { pt[5].x = cx; pt[5].y = cy; gdImageFilledPolygon (im, pt, 6, color); gdImagePolygon (im, pt, 6, color); } } else { gdImageFilledArc (im, cx, cy, width, height, (i + 3) * 90, (i + 4) * 90, color, gdChord); pt[4].x = cx + axis_pt[(i + 4) & 3].x; pt[4].y = cy + axis_pt[(i + 4) & 3].y; gdImageFilledArc (im, cx, cy, width, height, (i + 4) * 90, e, color, gdChord); pt[5] = gdArcClosest (width, height, e); pt[5].x += cx; pt[5].y += cy; if (style == gdChord) { gdImageFilledPolygon (im, pt, 6, color); gdImagePolygon (im, pt, 6, color); } else if (style == gdPie) { pt[6].x = cx; pt[6].y = cy; gdImageFilledPolygon (im, pt, 7, color); gdImagePolygon (im, pt, 7, color); } } } } return; } } /* At this point we have only arcs that lies within a quadrant - * map this to first quadrant... */ if ((s >= 90) && (e <= 180)) { angle = s; s = 180 - e; e = 180 - angle; flip_x = 1; } if ((s >= 180) && (e <= 270)) { s = s - 180; e = e - 180; flip_x = 1; flip_y = 1; } if ((s >= 270) && (e <= 360)) { angle = s; s = 360 - e; e = 360 - angle; flip_y = 1; } if (s == 0) { s_sin = 0; s_cos = (long) ((double) 32768); } else { s_sin = (long) ((double) 32768 * sin ((double) s * M_PI / (double) 180)); s_cos = (long) ((double) 32768 * cos ((double) s * M_PI / (double) 180)); } if (e == 0) { e_sin = (long) ((double) 32768); e_cos = 0; } else { e_sin = (long) ((double) 32768 * sin ((double) e * M_PI / (double) 180)); e_cos = (long) ((double) 32768 * cos ((double) e * M_PI / (double) 180)); } w = (long) width; h = (long) height; ws = w * w; hs = h * h; whs = 1; while ((ws > 32768) || (hs > 32768)) { ws = (ws + 1) / 2; /* Unfortunate limitations on integers makes */ hs = (hs + 1) / 2; /* drawing large ellipses problematic... */ whs *= 2; } while ((ws * hs) > (0x04000000L / whs)) { ws = (ws + 1) / 2; hs = (hs + 1) / 2; whs *= 2; } whs *= ws * hs; pt[0].x = w / 2; pt[0].y = 0; pt[2].x = 0; pt[2].y = h / 2; have_s = 0; have_e = 0; if (s == 0) have_s = 1; if (e == 90) have_e = 1; x2 = w; y2 = 0; /* Starting point is exactly on ellipse */ g = x2 - 1; g = g * g * hs + 4 * ws - whs; while ((x2 * hs) > (y2 * ws)) /* Keep |tangent| > 1 */ { y2 += 2; g += ws * 4 * (y2 + 1); if (g > 0) /* Need to drop */ { x2 -= 2; g -= hs * 4 * x2; } if ((have_s == 0) && ((s_sin * x2) <= (y2 * s_cos))) { pt[0].x = (int) (x2 / 2); pt[0].y = (int) (y2 / 2); have_s = 1; } if ((have_e == 0) && ((e_sin * x2) <= (y2 * e_cos))) { pt[2].x = (int) (x2 / 2); pt[2].y = (int) (y2 / 2); have_e = 1; } } pt[1].x = (int) (x2 / 2); pt[1].y = (int) (y2 / 2); x2 = 0; y2 = h; /* Starting point is exactly on ellipse */ g = y2 - 1; g = g * g * ws + 4 * hs - whs; while ((x2 * hs) < (y2 * ws)) { x2 += 2; g += hs * 4 * (x2 + 1); if (g > 0) /* Need to drop */ { y2 -= 2; g -= ws * 4 * y2; } if ((have_s == 0) && ((s_sin * x2) >= (y2 * s_cos))) { pt[0].x = (int) (x2 / 2); pt[0].y = (int) (y2 / 2); have_s = 1; } if ((have_e == 0) && ((e_sin * x2) >= (y2 * e_cos))) { pt[2].x = (int) (x2 / 2); pt[2].y = (int) (y2 / 2); have_e = 1; } } if ((have_s == 0) || (have_e == 0)) return; /* Bizarre case */ if (style == gdPie) { pt[3] = pt[0]; pt[4] = pt[1]; pt[5] = pt[2]; pt[0].x = cx + (flip_x ? (-pt[0].x) : pt[0].x); pt[0].y = cy + (flip_y ? (-pt[0].y) : pt[0].y); pt[1].x = cx; pt[1].y = cy; pt[2].x = cx + (flip_x ? (-pt[2].x) : pt[2].x); pt[2].y = cy + (flip_y ? (-pt[2].y) : pt[2].y); gdImageFilledPolygon (im, pt, 3, color); gdImagePolygon (im, pt, 3, color); pt[0] = pt[3]; pt[1] = pt[4]; pt[2] = pt[5]; } if (((s_cos * hs) > (s_sin * ws)) && ((e_cos * hs) < (e_sin * ws))) { /* the points are on different parts of the curve... * this is too tricky to try to handle, so divide and conquer: */ pt[3] = pt[0]; pt[4] = pt[1]; pt[5] = pt[2]; pt[0].x = cx + (flip_x ? (-pt[0].x) : pt[0].x); pt[0].y = cy + (flip_y ? (-pt[0].y) : pt[0].y); pt[1].x = cx + (flip_x ? (-pt[1].x) : pt[1].x); pt[1].y = cy + (flip_y ? (-pt[1].y) : pt[1].y); pt[2].x = cx + (flip_x ? (-pt[2].x) : pt[2].x); pt[2].y = cy + (flip_y ? (-pt[2].y) : pt[2].y); gdImageFilledPolygon (im, pt, 3, color); gdImagePolygon (im, pt, 3, color); pt[0] = pt[3]; pt[2] = pt[4]; conquer = 1; } if (conquer || (((s_cos * hs) > (s_sin * ws)) && ((e_cos * hs) > (e_sin * ws)))) { /* This is the best bit... */ /* steep line + ellipse */ /* go up & left from pt[0] to pt[2] */ x2 = w; y2 = 0; /* Starting point is exactly on ellipse */ g = x2 - 1; g = g * g * hs + 4 * ws - whs; while ((x2 * hs) > (y2 * ws)) /* Keep |tangent| > 1 */ { if ((s_sin * x2) <= (y2 * s_cos)) break; y2 += 2; g += ws * 4 * (y2 + 1); if (g > 0) /* Need to drop */ { x2 -= 2; g -= hs * 4 * x2; } } lx2 = x2; ly2 = y2; lg = lx2 * (pt[0].y - pt[2].y) - ly2 * (pt[0].x - pt[2].x); lg = (lx2 - 1) * (pt[0].y - pt[2].y) - (ly2 + 2) * (pt[0].x - pt[2].x) - lg; while (y2 < (2 * pt[2].y)) { y2 += 2; g += ws * 4 * (y2 + 1); if (g > 0) /* Need to drop */ { x2 -= 2; g -= hs * 4 * x2; } ly2 += 2; lg -= 2 * (pt[0].x - pt[2].x); if (lg < 0) /* Need to drop */ { lx2 -= 2; lg -= 2 * (pt[0].y - pt[2].y); } y = (int) (y2 / 2); for (x = (int) (lx2 / 2); x <= (int) (x2 / 2); x++) { gdImageSetPixel (im, ((flip_x) ? (cx - x) : (cx + x)), ((flip_y) ? (cy - y) : (cy + y)), color); } } } if (conquer) { pt[0] = pt[4]; pt[2] = pt[5]; } if (conquer || (((s_cos * hs) < (s_sin * ws)) && ((e_cos * hs) < (e_sin * ws)))) { /* This is the best bit... */ /* gradual line + ellipse */ /* go down & right from pt[2] to pt[0] */ x2 = 0; y2 = h; /* Starting point is exactly on ellipse */ g = y2 - 1; g = g * g * ws + 4 * hs - whs; while ((x2 * hs) < (y2 * ws)) { x2 += 2; g += hs * 4 * (x2 + 1); if (g > 0) /* Need to drop */ { y2 -= 2; g -= ws * 4 * y2; } if ((e_sin * x2) >= (y2 * e_cos)) break; } lx2 = x2; ly2 = y2; lg = lx2 * (pt[0].y - pt[2].y) - ly2 * (pt[0].x - pt[2].x); lg = (lx2 + 2) * (pt[0].y - pt[2].y) - (ly2 - 1) * (pt[0].x - pt[2].x) - lg; while (x2 < (2 * pt[0].x)) { x2 += 2; g += hs * 4 * (x2 + 1); if (g > 0) /* Need to drop */ { y2 -= 2; g -= ws * 4 * y2; } lx2 += 2; lg += 2 * (pt[0].y - pt[2].y); if (lg < 0) /* Need to drop */ { ly2 -= 2; lg += 2 * (pt[0].x - pt[2].x); } x = (int) (x2 / 2); for (y = (int) (ly2 / 2); y <= (int) (y2 / 2); y++) { gdImageSetPixel (im, ((flip_x) ? (cx - x) : (cx + x)), ((flip_y) ? (cy - y) : (cy + y)), color); } } } } static gdPoint gdArcClosest (int width, int height, int angle) { gdPoint pt; int flip_x = 0; int flip_y = 0; long a_sin = 0; long a_cos = 0; long w; /* a * 2 */ long h; /* b * 2 */ long x2; /* x * 2 */ long y2; /* y * 2 */ long ws; /* (a * 2)^2 */ long hs; /* (b * 2)^2 */ long whs; /* (a * 2)^2 * (b * 2)^2 */ long g; /* decision variable */ w = (long) ((width & 1) ? (width + 1) : (width)); h = (long) ((height & 1) ? (height + 1) : (height)); while (angle < 0) angle += 360; while (angle >= 360) angle -= 360; if (angle == 0) { pt.x = w / 2; pt.y = 0; return (pt); } if (angle == 90) { pt.x = 0; pt.y = h / 2; return (pt); } if (angle == 180) { pt.x = -w / 2; pt.y = 0; return (pt); } if (angle == 270) { pt.x = 0; pt.y = -h / 2; return (pt); } pt.x = 0; pt.y = 0; if ((angle > 90) && (angle < 180)) { angle = 180 - angle; flip_x = 1; } if ((angle > 180) && (angle < 270)) { angle = angle - 180; flip_x = 1; flip_y = 1; } if ((angle > 270) && (angle < 360)) { angle = 360 - angle; flip_y = 1; } a_sin = (long) ((double) 32768 * sin ((double) angle * M_PI / (double) 180)); a_cos = (long) ((double) 32768 * cos ((double) angle * M_PI / (double) 180)); ws = w * w; hs = h * h; whs = 1; while ((ws > 32768) || (hs > 32768)) { ws = (ws + 1) / 2; /* Unfortunate limitations on integers makes */ hs = (hs + 1) / 2; /* drawing large ellipses problematic... */ whs *= 2; } while ((ws * hs) > (0x04000000L / whs)) { ws = (ws + 1) / 2; hs = (hs + 1) / 2; whs *= 2; } whs *= ws * hs; if ((a_cos * hs) > (a_sin * ws)) { x2 = w; y2 = 0; /* Starting point is exactly on ellipse */ g = x2 - 1; g = g * g * hs + 4 * ws - whs; while ((x2 * hs) > (y2 * ws)) /* Keep |tangent| > 1 */ { y2 += 2; g += ws * 4 * (y2 + 1); if (g > 0) /* Need to drop */ { x2 -= 2; g -= hs * 4 * x2; } if ((a_sin * x2) <= (y2 * a_cos)) { pt.x = (int) (x2 / 2); pt.y = (int) (y2 / 2); break; } } } else { x2 = 0; y2 = h; /* Starting point is exactly on ellipse */ g = y2 - 1; g = g * g * ws + 4 * hs - whs; while ((x2 * hs) < (y2 * ws)) { x2 += 2; g += hs * 4 * (x2 + 1); if (g > 0) /* Need to drop */ { y2 -= 2; g -= ws * 4 * y2; } if ((a_sin * x2) >= (y2 * a_cos)) { pt.x = (int) (x2 / 2); pt.y = (int) (y2 / 2); break; } } } if (flip_x) pt.x = -pt.x; if (flip_y) pt.y = -pt.y; return (pt); } #include "gd.h" #include <string.h> #include <math.h> #define WIDTH 500 #define HEIGHT 300 int main (int argc, char *argv[]) { gdImagePtr im = gdImageCreate (WIDTH, HEIGHT); int white = gdImageColorResolve (im, 0xFF, 0xFF, 0xFF), black = gdImageColorResolve (im, 0, 0, 0), red = gdImageColorResolve (im, 0xFF, 0xA0, 0xA0); FILE *out; /* filled arc - circle */ gdImageFilledArc (im, WIDTH / 5, HEIGHT / 4, 200, 200, 45, 90, red, gdPie); gdImageArc (im, WIDTH / 5, HEIGHT / 4, 200, 200, 45, 90, black); /* filled arc - ellipse */ gdImageFilledArc (im, WIDTH / 2, HEIGHT / 4, 200, 150, 45, 90, red, gdPie); gdImageArc (im, WIDTH / 2, HEIGHT / 4, 200, 150, 45, 90, black); /* reference lines */ gdImageLine (im, 0, HEIGHT / 4, WIDTH, HEIGHT / 4, black); gdImageLine (im, WIDTH / 5, 0, WIDTH / 5, HEIGHT, black); gdImageLine (im, WIDTH / 2, 0, WIDTH / 2, HEIGHT, black); gdImageLine (im, WIDTH / 2, HEIGHT / 4, WIDTH / 2 + 300, HEIGHT / 4 + 300, black); gdImageLine (im, WIDTH / 5, HEIGHT / 4, WIDTH / 5 + 300, HEIGHT / 4 + 300, black); /* TBB: Write img to test/arctest.png */ out = fopen ("test/arctest.png", "wb"); if (!out) { php_gd_error("Can't create test/arctest.png\n"); exit (1); } gdImagePng (im, out); fclose (out); php_gd_error("Test image written to test/arctest.png\n"); /* Destroy it */ gdImageDestroy (im); return 0; } #endif
the_stack_data/1139555.c
#include<stdio.h> #include<stdlib.h> int main() { int n; scanf("%d",&n); int **M = (int **)malloc(n * sizeof(int*)); for(int i=0;i<n;i++) { *(M+i) = (int *)malloc(n * sizeof(int)); for(int j=0;j<n;j++) { scanf("%d",&M[i][j]); } } int count=0; for(int i=0; i<n;i++) { for(int j=i+1;j<n;j++) { if(M[i][j]!=1) continue; if(j+1<n && M[i][j+1]==1) { if(i+1<n && M[i+1][j+1]==1) { count++; } } if(i+1<n && M[i+1][j]==1) { if(j-1>i+1 && M[i+1][j-1]==1) { count++; } } if(i-1>=0 && M[i-1][j]==1) { if(j+1<n && M[i-1][j+1]==1) { count++; } } if(j-1>i && M[i][j-1]==1) { if(i-1>=0 && M[i-1][j-1]==1) { count++; } } } } printf("%d",count); for(int i=0;i<n;i++) { free(*(M+i)); } return 0; }
the_stack_data/321018.c
/* Program Name: pythag.c Author: Ankur Patel Program Intent: Print out a table of value of pythagorean triples upto given input value. Pythagorean triples are realtively prime. Ex of Pythagorean triples are 3,4,5 5,12,13 and so on. Input Data: Positive integer Output Data: Table of pythagorean triples upto given input value. */ /*--------------- Include Section ----------------*/ #include <stdio.h> #include <stdlib.h> #include <math.h> /*---------------------------- function ------------------------------------ Name: gcd Purpose: Get the gcd of two integers Pre: Input must be positive Post: Return the gcd of two integers recussively Arguments: i and j are integers whose gcd is determines recursively Returns: gcd of i and j Calls: - ----------------------------------------------------------------------------*/ int gcd( int i, int j ) { if( j == 0 ) return i; else return gcd( j, i % j ); } /*---------------------------- function ------------------------------------ Name: get_hypotenuse Purpose: To determine the hypotenuse given two side lengths Pre: Input must be positive integers Post: Returns the hypotenuse if hypotenuse is an integer else returns a zero Arguments: a and b are length of the two sides of a right triangle Returns: hypnotenuse if it is an integer else return 0 Calls: - ----------------------------------------------------------------------------*/ int get_hypotenuse( int a, int b ) { double hyp = sqrt( pow( a, 2 ) + pow( b, 2 ) ); if( ceil( hyp ) == floor( hyp ) ) return (int)hyp; else return 0; } /*---------------------------- function ------------------------------------ Name: generate_triple Purpose: Creates the table of pythagorean triples upto max input value Pre: Input must be positive integer Post: Generate table of pythagorean triples Arguments: max is the maximum value upto which pythagorean triples will be determined Returns: void Calls: get_hypotenuse, gcd ----------------------------------------------------------------------------*/ void generate_triple( int max ) { int i, j; for( i = 1; i < max; i++ ) { for( j = 1; j < i; j++ ) { if( gcd( i, j ) == 1 ) { int hyp = get_hypotenuse( i, j ); if( hyp ) { printf( "%4d %4d %4d\n", j, i, hyp ); break; } }//end if gcd }//end for index j }//end for index i printf( "\n" ); } /*--------------------------- main function ---------------------------------- Purpose: Start the program Pre: There should be one argument. Argument must be positive integer. Post: Table of values of pythagorean triples Arguments: - Returns: EXIT_SUCCESS Calls: generate_triple ----------------------------------------------------------------------------*/ int main( int argc, char** argv ) { if( argc == 2 ) { printf( "\n Pythagorean Triples\n" ); printf( "=====================\n" ); generate_triple( atoi( argv[ 1 ] ) ); } else { printf( "\nMissing argument\n\n" ); printf( "The command line should be: a.out <an integer>\n\n" ); } return (EXIT_SUCCESS); }
the_stack_data/61075173.c
#include <stdio.h> int main() { int n; /* n<20, the number of test cases */ scanf("%d", &n); int f; /* 0<f<20, the number of farmers in the test */ int i; /* index for test cases */ int j; /* index for farmer */ long size, numAnimals, friendliness; long long premiumPerFarmer, summedBurden; for (i = 0; i < n; i++) { scanf("%d", &f); summedBurden = 0; for (j = 0; j < f; j++) { scanf("%li %li %li", &size, &numAnimals, &friendliness); premiumPerFarmer = size * friendliness; summedBurden += premiumPerFarmer; } printf("%llu\n", summedBurden); } return 0; }
the_stack_data/27977.c
#include <stdio.h> int main() { long int n; scanf("%ld",&n); printf("%ld\n",n/2+1); return 0; }
the_stack_data/88135.c
/****************************************************************** * \file exercise_1_3_tableFahrenheitToCelsius.c * * \brief Program that prints the table with temperatures * conversion from Fahrenheit to Celsius.Values from * 0F to 300F with a step of 20. * * \description This program makes conversion from Fahrenheit to * Celsius. Values from 0F to 300F with a step of 20. * * \author Mihail P. (MP) * \date 09.XI.2021 02:40AM * \tag "The C Programming Language 2nd Edition" * by Brian W. Kernighan and Dennis M. Ritchie * Chapter 1, Section 1.2 * page 13, Exercise 1-3 ******************************************************************/ #include <stdio.h> /* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300; floating-point version */ int main(void) { float fahr, celsius; int lower, upper, step; lower = 0; /* lower limit of temperature table */ upper = 300; /* upper limit */ step = 20; /* step size */ fahr = lower; /* print table header */ printf("Fahrenheit | Celsius\n"); printf("-----------|--------\n"); while (fahr <= upper) { celsius = (5.0/9.0) * (fahr-32.0); printf("%10.0f | %6.1f\n",fahr,celsius); fahr = fahr + step; } return 0; }
the_stack_data/175142276.c
// // main.c // Bill // // Created by MacBook on 08/04/17. // Copyright © 2017 Bruno Botelho. All rights reserved. // #include <stdio.h> int main(int argc, const char * argv[]) { // insert code here... int n,a; scanf("%d",&n); int r=1; for(int i=0;i<n;i++){ r=1; scanf("%d",&a); if(a%2==0) r=0; printf("%d\n",r); } return 0; }
the_stack_data/20451509.c
/********************************************************************************************************************* Author: Lucas Pacheco. Description: Test exercise from "The Audio Programming Book", exercise 1.6.1, adding a description on line 57 . Date: 04/06/2020. **********************************************************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <math.h> /* usage iscale [-m][-i] N startval [outfile.txt] -m : sets format of startval as MIDI note -i : prints the calculated interval as well as the abs freq outfile: optional text filename for output data */ int main(int argc, char *argv[]) { int notes, i; int ismidi = 0; int write_interval = 0; int err = 0; double startval, basefreq, ratio; FILE *fp; double intervals[25]; /* check first arg for flag option: argc at least 2 */ while (argc > 1) { if (argv[1][0] == '-') { if (argv[1][1] == 'm') ismidi = 1; else if (argv[1][1] == 'i') write_interval = 1; else { printf("error: unrecognized option %s\n", argv[1]); return 1; } /* step up to next arg */ argc--; argv++; } else break; } /* required arguments */ if (argc < 3) { printf("insufficient arguments\n"); printf("Usage: itable [-m][-i] N startval [outfile.txt]\n"); printf("Description: \n"); printf("\titable is the name of the program.\n"); printf("\tN is the size of a octave, it could be greater or smaller than 12, but in this case less then 24 and greater then 1.\n"); printf("\tstartval depends of \"-m\", if you omit \"-m\" the startval will be a positive frequency, otherwhise startval will be a midi value on a range from 0 inclusive to 127 inclusive.\n"); printf("\t\"-m\" sets the type of startval.\n"); printf("\t\"-i\" is a option to print the interval ratio.\n"); return 1; } /* Now read and check all arguments We now expected argv[1] to hold N and argv[2] startval */ notes = atoi(argv[1]); if (notes < 1 || notes > 24) { printf("error: N out of range. Must be between 1 and 24.\n"); return 1; } startval = atof(argv[2]); if (ismidi) { if (startval > 127.0) { printf("error: MIDI startval must be <= 127.\n"); return 1; } /* for MIDI, startval = 0 is legal */ if (startval < 0.0) { printf("error: MIDI startval must be >= 0.\n"); return 1; } } else /* it's freq: must be positive number check low limit */ { if (startval <= 0.0) { printf("error: frequency startval must be positive.\n"); return 1; } } /* check for optional filename */ fp = NULL; if (argc == 4) { fp = fopen(argv[3], "w"); if (fp == NULL) { printf("WARNING: unable to create file %s\n", argv[3]); perror(""); } } /* all params ready - fill array and write to file if created find basefreq, if val is MIDI */ if (ismidi) { double c0, c5; /* find base MIDI note */ ratio = pow(2.0, 1.0 / 12.0); c5 = 220.0 * pow(ratio, 3); c0 = c5 * pow(0.5, 5); basefreq = c0 * pow(ratio, startval); } else basefreq = startval; /* calc ratio from notes and fill the array */ ratio = pow(2.0, 1.0 / notes); for (i = 0; i <= notes; i++) { intervals[i] = basefreq; basefreq *= ratio; } /* finally, read array, write to screen, and optionally to file */ for (i = 0; i <= notes; i++) { if (write_interval) printf("%d: \t%f\t%f\n", i, pow(ratio, i), intervals[i]); else printf("%d: \t%f\n", i, intervals[i]); if (fp) { if (write_interval) err = fprintf(fp, "%d: \t%f\t%f\n", i, pow(ratio, i), intervals[i]); else err = fprintf(fp, "%d: \t%f\n", i, intervals[i]); if (err < 0) break; } } if (err < 0) perror("There was an error writing the file.\n"); if (fp) fclose(fp); return 0; }
the_stack_data/500020.c
#ifndef SQLITE_OMIT_DISKIO #ifdef SQLITE_HAS_CODEC #include "codec.h" #include "codecext.h" void sqlite3_activate_see(const char *info) { } /* // Free the encryption data structure associated with a pager instance. // (called from the modified code in pager.c) */ void sqlite3CodecFree(void *pCodecArg) { if (pCodecArg) { CodecTerm(pCodecArg); sqlite3_free(pCodecArg); } } void sqlite3CodecSizeChange(void *pArg, int pageSize, int reservedSize) { } /* // Encrypt/Decrypt functionality, called by pager.c */ void* sqlite3Codec(void* pCodecArg, void* data, Pgno nPageNum, int nMode) { Codec* codec = NULL; int pageSize; if (pCodecArg == NULL) { return data; } codec = (Codec*) pCodecArg; if (!CodecIsEncrypted(codec)) { return data; } pageSize = sqlite3BtreeGetPageSize(CodecGetBtree(codec)); switch(nMode) { case 0: /* Undo a "case 7" journal file encryption */ case 2: /* Reload a page */ case 3: /* Load a page */ if (CodecHasReadKey(codec)) { CodecDecrypt(codec, nPageNum, (unsigned char*) data, pageSize); } break; case 6: /* Encrypt a page for the main database file */ if (CodecHasWriteKey(codec)) { unsigned char* pageBuffer = CodecGetPageBuffer(codec); memcpy(pageBuffer, data, pageSize); data = pageBuffer; CodecEncrypt(codec, nPageNum, (unsigned char*) data, pageSize, 1); } break; case 7: /* Encrypt a page for the journal file */ /* Under normal circumstances, the readkey is the same as the writekey. However, when the database is being rekeyed, the readkey is not the same as the writekey. The rollback journal must be written using the original key for the database file because it is, by nature, a rollback journal. Therefore, for case 7, when the rollback is being written, always encrypt using the database's readkey, which is guaranteed to be the same key that was used to read the original data. */ if (CodecHasReadKey(codec)) { unsigned char* pageBuffer = CodecGetPageBuffer(codec); memcpy(pageBuffer, data, pageSize); data = pageBuffer; CodecEncrypt(codec, nPageNum, (unsigned char*) data, pageSize, 0); } break; } return data; } void* mySqlite3PagerGetCodec( Pager *pPager ); void mySqlite3PagerSetCodec( Pager *pPager, void *(*xCodec)(void*,void*,Pgno,int), void (*xCodecSizeChng)(void*,int,int), void (*xCodecFree)(void*), void *pCodec ); int sqlite3CodecAttach(sqlite3* db, int nDb, const void* zKey, int nKey) { /* Attach a key to a database. */ Codec* codec = (Codec*) sqlite3_malloc(sizeof(Codec)); CodecInit(codec); sqlite3_mutex_enter(db->mutex); /* No key specified, could mean either use the main db's encryption or no encryption */ if (zKey == NULL || nKey <= 0) { /* No key specified */ if (nDb != 0 && nKey > 0) { Codec* mainCodec = (Codec*) mySqlite3PagerGetCodec(sqlite3BtreePager(db->aDb[0].pBt)); /* Attached database, therefore use the key of main database, if main database is encrypted */ if (mainCodec != NULL && CodecIsEncrypted(mainCodec)) { CodecCopy(codec, mainCodec); CodecSetBtree(codec, db->aDb[nDb].pBt); #if (SQLITE_VERSION_NUMBER >= 3006016) mySqlite3PagerSetCodec(sqlite3BtreePager(db->aDb[nDb].pBt), sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, codec); #else #if (SQLITE_VERSION_NUMBER >= 3003014) sqlite3PagerSetCodec(sqlite3BtreePager(db->aDb[nDb].pBt), sqlite3Codec, codec); #else sqlite3pager_set_codec(sqlite3BtreePager(db->aDb[nDb].pBt), sqlite3Codec, codec); #endif db->aDb[nDb].pAux = codec; db->aDb[nDb].xFreeAux = sqlite3CodecFree; #endif } else { CodecSetIsEncrypted(codec, 0); sqlite3_free(codec); } } } else { /* Key specified, setup encryption key for database */ CodecSetIsEncrypted(codec, 1); CodecSetHasReadKey(codec, 1); CodecSetHasWriteKey(codec, 1); CodecGenerateReadKey(codec, (char*) zKey, nKey); CodecCopyKey(codec, 1); CodecSetBtree(codec, db->aDb[nDb].pBt); #if (SQLITE_VERSION_NUMBER >= 3006016) mySqlite3PagerSetCodec(sqlite3BtreePager(db->aDb[nDb].pBt), sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, codec); #else #if (SQLITE_VERSION_NUMBER >= 3003014) sqlite3PagerSetCodec(sqlite3BtreePager(db->aDb[nDb].pBt), sqlite3Codec, codec); #else sqlite3pager_set_codec(sqlite3BtreePager(db->aDb[nDb].pBt), sqlite3Codec, codec); #endif db->aDb[nDb].pAux = codec; db->aDb[nDb].xFreeAux = sqlite3CodecFree; #endif } sqlite3_mutex_leave(db->mutex); return SQLITE_OK; } void sqlite3CodecGetKey(sqlite3* db, int nDb, void** zKey, int* nKey) { /* // The unencrypted password is not stored for security reasons // therefore always return NULL // If the main database is encrypted a key length of 1 is returned. // In that case an attached database will get the same encryption key // as the main database if no key was explicitly given for the attached database. */ Codec* mainCodec = (Codec*) mySqlite3PagerGetCodec(sqlite3BtreePager(db->aDb[0].pBt)); int keylen = (mainCodec != NULL && CodecIsEncrypted(mainCodec)) ? 1 : 0; *zKey = NULL; *nKey = keylen; } static int dbFindIndex(sqlite3* db, const char* zDb) { int dbIndex = 0; if (zDb != NULL) { int found = 0; int index; for (index = 0; found == 0 && index < db->nDb; ++index) { struct Db* pDb = &db->aDb[index]; if (strcmp(pDb->zName, zDb) == 0) { found = 1; dbIndex = index; } } if (found == 0) dbIndex = 0; } return dbIndex; } int sqlite3_key(sqlite3 *db, const void *zKey, int nKey) { /* The key is only set for the main database, not the temp database */ return sqlite3_key_v2(db, "main", zKey, nKey); } int sqlite3_key_v2(sqlite3 *db, const char *zDbName, const void *zKey, int nKey) { /* The key is only set for the main database, not the temp database */ int dbIndex = dbFindIndex(db, zDbName); return sqlite3CodecAttach(db, dbIndex, zKey, nKey); } int sqlite3_rekey_v2(sqlite3 *db, const char *zDbName, const void *zKey, int nKey) { /* Changes the encryption key for an existing database. */ int dbIndex = dbFindIndex(db, zDbName); int rc = SQLITE_ERROR; Btree* pbt = db->aDb[dbIndex].pBt; Pager* pPager = sqlite3BtreePager(pbt); Codec* codec = (Codec*) mySqlite3PagerGetCodec(pPager); if ((zKey == NULL || nKey == 0) && (codec == NULL || !CodecIsEncrypted(codec))) { /* // Database not encrypted and key not specified // therefore do nothing */ return SQLITE_OK; } if (codec == NULL || !CodecIsEncrypted(codec)) { /* // Database not encrypted, but key specified // therefore encrypt database */ if (codec == NULL) { codec = (Codec*) sqlite3_malloc(sizeof(Codec)); CodecInit(codec); } CodecSetIsEncrypted(codec, 1); CodecSetHasReadKey(codec, 0); /* Original database is not encrypted */ CodecSetHasWriteKey(codec, 1); CodecGenerateWriteKey(codec, (char*) zKey, nKey); CodecSetBtree(codec, pbt); #if (SQLITE_VERSION_NUMBER >= 3006016) mySqlite3PagerSetCodec(pPager, sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, codec); #else #if (SQLITE_VERSION_NUMBER >= 3003014) sqlite3PagerSetCodec(pPager, sqlite3Codec, codec); #else sqlite3pager_set_codec(pPager, sqlite3Codec, codec); #endif db->aDb[dbIndex].pAux = codec; db->aDb[dbIndex].xFreeAux = sqlite3CodecFree; #endif } else if (zKey == NULL || nKey == 0) { /* // Database encrypted, but key not specified // therefore decrypt database // Keep read key, drop write key */ CodecSetHasWriteKey(codec, 0); } else { /* // Database encrypted and key specified // therefore re-encrypt database with new key // Keep read key, change write key to new key */ CodecGenerateWriteKey(codec, (char*) zKey, nKey); CodecSetHasWriteKey(codec, 1); } sqlite3_mutex_enter(db->mutex); /* Start transaction */ rc = sqlite3BtreeBeginTrans(pbt, 1); if (!rc) { int pageSize = sqlite3BtreeGetPageSize(pbt); Pgno nSkip = WX_PAGER_MJ_PGNO(pageSize); #if (SQLITE_VERSION_NUMBER >= 3003014) DbPage *pPage; #else void *pPage; #endif Pgno n; /* Rewrite all pages using the new encryption key (if specified) */ #if (SQLITE_VERSION_NUMBER >= 3007001) Pgno nPage; int nPageCount = -1; sqlite3PagerPagecount(pPager, &nPageCount); nPage = nPageCount; #elif (SQLITE_VERSION_NUMBER >= 3006000) int nPageCount = -1; int rc = sqlite3PagerPagecount(pPager, &nPageCount); Pgno nPage = (Pgno) nPageCount; #elif (SQLITE_VERSION_NUMBER >= 3003014) Pgno nPage = sqlite3PagerPagecount(pPager); #else Pgno nPage = sqlite3pager_pagecount(pPager); #endif for (n = 1; rc == SQLITE_OK && n <= nPage; n++) { if (n == nSkip) continue; #if (SQLITE_VERSION_NUMBER >= 3003014) rc = sqlite3PagerGet(pPager, n, &pPage); #else rc = sqlite3pager_get(pPager, n, &pPage); #endif if (!rc) { #if (SQLITE_VERSION_NUMBER >= 3003014) rc = sqlite3PagerWrite(pPage); sqlite3PagerUnref(pPage); #else rc = sqlite3pager_write(pPage); sqlite3pager_unref(pPage); #endif } } } if (rc == SQLITE_OK) { /* Commit transaction if all pages could be rewritten */ rc = sqlite3BtreeCommit(pbt); } if (rc != SQLITE_OK) { /* Rollback in case of error */ #if (SQLITE_VERSION_NUMBER >= 3007011) sqlite3BtreeRollback(pbt, SQLITE_OK, 0); #else sqlite3BtreeRollback(pbt); #endif } sqlite3_mutex_leave(db->mutex); if (rc == SQLITE_OK) { /* Set read key equal to write key if necessary */ if (CodecHasWriteKey(codec)) { CodecCopyKey(codec, 0); CodecSetHasReadKey(codec, 1); } else { CodecSetIsEncrypted(codec, 0); } } else { /* Restore write key if necessary */ if (CodecHasReadKey(codec)) { CodecCopyKey(codec, 1); } else { CodecSetIsEncrypted(codec, 0); } } if (!CodecIsEncrypted(codec)) { /* Remove codec for unencrypted database */ #if (SQLITE_VERSION_NUMBER >= 3006016) mySqlite3PagerSetCodec(pPager, NULL, NULL, NULL, NULL); #else #if (SQLITE_VERSION_NUMBER >= 3003014) sqlite3PagerSetCodec(pPager, NULL, NULL); #else sqlite3pager_set_codec(pPager, NULL, NULL); #endif db->aDb[dbIndex].pAux = NULL; db->aDb[dbIndex].xFreeAux = NULL; sqlite3CodecFree(codec); #endif } return rc; } int sqlite3_rekey(sqlite3 *db, const void *zKey, int nKey) { return sqlite3_rekey_v2(db, "main", zKey, nKey); } #endif /* SQLITE_HAS_CODEC */ #endif /* SQLITE_OMIT_DISKIO */
the_stack_data/237642271.c
/* ------------------------------------------ * Copyright (c) 2018, Synopsys, Inc. All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3) Neither the name of the Synopsys, Inc., nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * --------------------------------------------- */
the_stack_data/147684.c
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % V V M M SSSSS % % V V MM MM SS % % V V M M M SSS % % V V M M SS % % V M M SSSSS % % % % % % MagickCore VMS Utility Methods % % % % Software Design % % Cristy % % October 1994 % % % % % % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization % % dedicated to making software imaging solutions freely available. % % % % You may not use this file except in compliance with the License. You may % % obtain a copy of the License at % % % % https://imagemagick.org/script/license.php % % % % Unless required by applicable law or agreed to in writing, software % % distributed under the License is distributed on an "AS IS" BASIS, % % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % % See the License for the specific language governing permissions and % % limitations under the License. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % The directory methods are strongly based on similar methods written % by Rich Salz. % */ #if defined(vms) /* Include declarations. */ #include "MagickCore/studio.h" #include "MagickCore/string_.h" #include "MagickCore/memory_.h" #include "MagickCore/vms.h" #if !defined(_AXP_) && (!defined(__VMS_VER) || (__VMS_VER < 70000000)) /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % c l o s e d i r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % closedir() closes the named directory stream and frees the DIR structure. % % The format of the closedir method is: % % % A description of each parameter follows: % % o entry: Specifies a pointer to a DIR structure. % % */ void closedir(DIR *directory) { if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); assert(directory != (DIR *) NULL); directory->pattern=DestroyString(directory->pattern); directory=DestroyString(directory); } /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % o p e n d i r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % opendir() opens the directory named by filename and associates a directory % stream with it. % % The format of the opendir method is: % % opendir(entry) % % A description of each parameter follows: % % o entry: Specifies a pointer to a DIR structure. % % */ DIR *opendir(char *name) { DIR *directory; /* Allocate memory for handle and the pattern. */ directory=(DIR *) AcquireMagickMemory(sizeof(DIR)); if (directory == (DIR *) NULL) { errno=ENOMEM; return((DIR *) NULL); } if (strcmp(".",name) == 0) name=""; directory->pattern=(char *) AcquireQuantumMemory(strlen(name)+sizeof("*.*")+ 1UL,sizeof(*directory->pattern)); if (directory->pattern == (char *) NULL) { directory=DestroyString(directory); errno=ENOMEM; return(NULL); } /* Initialize descriptor. */ (void) FormatLocaleString(directory->pattern,MagickPathExtent,"%s*.*",name); directory->context=0; directory->pat.dsc$a_pointer=directory->pattern; directory->pat.dsc$w_length=strlen(directory->pattern); directory->pat.dsc$b_dtype=DSC$K_DTYPE_T; directory->pat.dsc$b_class=DSC$K_CLASS_S; return(directory); } /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % r e a d d i r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % readdir() returns a pointer to a structure representing the directory entry % at the current position in the directory stream to which entry refers. % % The format of the readdir % % readdir(entry) % % A description of each parameter follows: % % o entry: Specifies a pointer to a DIR structure. % % */ struct dirent *readdir(DIR *directory) { char buffer[sizeof(directory->entry.d_name)]; int status; register char *p; register int i; struct dsc$descriptor_s result; /* Initialize the result descriptor. */ result.dsc$a_pointer=buffer; result.dsc$w_length=sizeof(buffer)-2; result.dsc$b_dtype=DSC$K_DTYPE_T; result.dsc$b_class=DSC$K_CLASS_S; status=lib$find_file(&directory->pat,&result,&directory->context); if ((status == RMS$_NMF) || (directory->context == 0L)) return((struct dirent *) NULL); /* Lowercase all filenames. */ buffer[sizeof(buffer)-1]='\0'; for (p=buffer; *p; p++) if (isupper((int) ((unsigned char) *p))) *p=LocaleLowercase(*p); /* Skip any directory component and just copy the name. */ p=buffer; while (isspace((int) ((unsigned char) *p)) == 0) p++; *p='\0'; p=strchr(buffer,']'); if (p) (void) CopyMagickString(directory->entry.d_name,p+1,MagickPathExtent); else (void) CopyMagickString(directory->entry.d_name,buffer,MagickPathExtent); directory->entry.d_namlen=strlen(directory->entry.d_name); return(&directory->entry); } #endif /* !defined(_AXP_) && (!defined(__VMS_VER) || (__VMS_VER < 70000000)) */ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % I s M a g i c k C o n f l i c t % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % VMSIsMagickConflict() returns true if the image format conflicts with a % logical drive (.e.g. SYS$SCRATCH:). % % Contributed by Forrest Cahoon ([email protected]) % % The format of the VMSIsMagickConflict method is: % % MagickBooleanType VMSIsMagickConflict(const char *magick) % % A description of each parameter follows: % % o magick: Specifies the image format. % % */ MagickExport MagickBooleanType VMSIsMagickConflict(const char *magick) { ile3 item_list[2]; int device_class, status; struct dsc$descriptor_s device; assert(magick != (char *) NULL); device.dsc$w_length=strlen(magick); device.dsc$a_pointer=(char *) magick; device.dsc$b_class=DSC$K_CLASS_S; device.dsc$b_dtype=DSC$K_DTYPE_T; item_list[0].ile3$w_length=sizeof(device_class); item_list[0].ile3$w_code=DVI$_DEVCLASS; item_list[0].ile3$ps_bufaddr=&device_class; item_list[0].ile3$ps_retlen_addr=NULL; (void) memset(&item_list[1],0,sizeof(item_list[1])); status=sys$getdviw(0,0,&device,&item_list,0,0,0,0); if ((status == SS$_NONLOCAL) || ((status & 0x01) && (device_class & (DC$_DISK | DC$_TAPE)))) return(MagickTrue); return(MagickFalse); } #endif /* defined(vms) */
the_stack_data/68473.c
// printf関数、及びscanf関数を使用するために必要 #include <stdio.h> // int型を返すmain関数の宣言 int main() { // 変数の宣言 int charCount; // scanf関数。標準入力から入力を取得する。 // scanfには変数のアドレスを渡すため、& を語頭に付与する。 // scanf(フォーマット指定子, 変数) scanf("%d", &charCount); for( ; charCount > 0; charCount--) { printf("*"); } printf("\n"); // main関数の正常終了 return 0; }
the_stack_data/109808.c
// RUN: touch %t.o // RUN: %clang -target x86_64-apple-macos10.13 -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 -### %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=LINKER-OLD %s // RUN: %clang -target x86_64-apple-macos10.13 -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=400 -### %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=LINKER-OLD %s // RUN: env SDKROOT=%S/Inputs/MacOSX10.14.sdk %clang -target x86_64-apple-macos10.13.0.1 -mlinker-version=520 -### %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=LINKER-NEW %s // LINKER-OLD: "-macosx_version_min" "10.13.0" // LINKER-NEW: "-platform_version" "macos" "10.13.0" "10.14" // RUN: %clang -target x86_64-apple-macos10.13 -mlinker-version=520 -### %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=NOSDK %s // NOSDK: "-platform_version" "macos" "10.13.0" "0.0.0"
the_stack_data/31387805.c
#include <stdio.h> static struct sss{ long long f; double snd; } sss; #define _offsetof(st,f) ((char *)&((st *) 16)->f - (char *) 16) int main (void) { printf ("+++Struct longlong-double:\n"); printf ("size=%d,align=%d,offset-longlong=%d,offset-double=%d,\nalign-longlong=%d,align-double=%d\n", sizeof (sss), __alignof__ (sss), _offsetof (struct sss, f), _offsetof (struct sss, snd), __alignof__ (sss.f), __alignof__ (sss.snd)); return 0; }
the_stack_data/22014075.c
// INFO: rcu detected stall in ext4_file_write_iter // https://syzkaller.appspot.com/bug?id=bc195cf62ac17381792072c72a692bf133c528d4 // status:open // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include <dirent.h> #include <endian.h> #include <errno.h> #include <fcntl.h> #include <pthread.h> #include <signal.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> #include <sys/mount.h> #include <sys/prctl.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/types.h> #include <sys/wait.h> #include <time.h> #include <unistd.h> #include <linux/futex.h> unsigned long long procid; static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void use_temporary_dir(void) { char tmpdir_template[] = "./syzkaller.XXXXXX"; char* tmpdir = mkdtemp(tmpdir_template); if (!tmpdir) exit(1); if (chmod(tmpdir, 0777)) exit(1); if (chdir(tmpdir)) exit(1); } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { DIR* dp; struct dirent* ep; int iter = 0; retry: while (umount2(dir, MNT_DETACH) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } while ((ep = readdir(dp))) { if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) continue; char filename[FILENAME_MAX]; snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); while (umount2(filename, MNT_DETACH) == 0) { } struct stat st; if (lstat(filename, &st)) exit(1); if (S_ISDIR(st.st_mode)) { remove_dir(filename); continue; } int i; for (i = 0;; i++) { if (unlink(filename) == 0) break; if (errno == EPERM) { int fd = open(filename, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) close(fd); continue; } } if (errno == EROFS) { break; } if (errno != EBUSY || i > 100) exit(1); if (umount2(filename, MNT_DETACH)) exit(1); } } closedir(dp); int i; for (i = 0;; i++) { if (rmdir(dir) == 0) break; if (i < 100) { if (errno == EPERM) { int fd = open(dir, O_RDONLY); if (fd != -1) { long flags = 0; if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) close(fd); continue; } } if (errno == EROFS) { break; } if (errno == EBUSY) { if (umount2(dir, MNT_DETACH)) exit(1); continue; } if (errno == ENOTEMPTY) { if (iter < 100) { iter++; goto retry; } } } exit(1); } } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); int i; for (i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } #define SYZ_HAVE_SETUP_TEST 1 static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); } #define SYZ_HAVE_RESET_TEST 1 static void reset_test() { int fd; for (fd = 3; fd < 30; fd++) close(fd); } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; int collide = 0; again: for (call = 0; call < 5; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); if (!collide) { collide = 1; goto again; } } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter; for (iter = 0;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); reset_test(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } #ifndef __NR_sched_setattr #define __NR_sched_setattr 314 #endif uint64_t r[1] = {0xffffffffffffffff}; void execute_call(int call) { long res; switch (call) { case 0: memcpy((void*)0x20000040, "./bus\000", 6); res = syscall(__NR_open, 0x20000040, 0x1fe, 0); if (res != -1) r[0] = res; break; case 1: memcpy((void*)0x200001c0, "\x15\x8a\xdd\x00", 4); syscall(__NR_write, r[0], 0x200001c0, 4); break; case 2: *(uint32_t*)0x20000800 = 1; *(uint32_t*)0x20000804 = 0x70; *(uint8_t*)0x20000808 = 0; *(uint8_t*)0x20000809 = 0; *(uint8_t*)0x2000080a = 0; *(uint8_t*)0x2000080b = 0; *(uint32_t*)0x2000080c = 0; *(uint64_t*)0x20000810 = 0x50a; *(uint64_t*)0x20000818 = 0; *(uint64_t*)0x20000820 = 0; STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 7, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0x7fff, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x20000828, 0, 29, 35); *(uint32_t*)0x20000830 = 0; *(uint32_t*)0x20000834 = 0; *(uint64_t*)0x20000838 = 0; *(uint64_t*)0x20000840 = 0; *(uint64_t*)0x20000848 = 0; *(uint64_t*)0x20000850 = 0; *(uint32_t*)0x20000858 = 0; *(uint32_t*)0x2000085c = 0; *(uint64_t*)0x20000860 = 0; *(uint32_t*)0x20000868 = 0xfffffffd; *(uint16_t*)0x2000086c = 0; *(uint16_t*)0x2000086e = 0; syscall(__NR_perf_event_open, 0x20000800, 0, -1, -1, 0); break; case 3: *(uint64_t*)0x20000000 = 0; syscall(__NR_sendfile, r[0], r[0], 0x20000000, 0x8080fffffffe); break; case 4: *(uint32_t*)0x200002c0 = 0; *(uint32_t*)0x200002c4 = 2; *(uint64_t*)0x200002c8 = 0; *(uint32_t*)0x200002d0 = 0; *(uint32_t*)0x200002d4 = 3; *(uint64_t*)0x200002d8 = 0; *(uint64_t*)0x200002e0 = 0; *(uint64_t*)0x200002e8 = 0; syscall(__NR_sched_setattr, 0, 0x200002c0, 0); break; } } int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { use_temporary_dir(); loop(); } } sleep(1000000); return 0; }
the_stack_data/20450681.c
// C Program to design a shell in Linux #include<stdio.h> #include<string.h> #include<stdlib.h> #include<unistd.h> #include<sys/types.h> #include<sys/wait.h> #include<readline/readline.h> #include<readline/history.h> #define MAXCOM 1000 // max number of letters to be supported #define MAXLIST 100 // max number of commands to be supported // Clearing the shell using escape sequences #define clear() printf("\033[H\033[J") // Greeting shell during startup void init_shell() { clear(); printf("\n\n\n\n******************" "************************"); printf("\n\n\n\t****MY SHELL****"); printf("\n\n\t-USE AT YOUR OWN RISK-"); printf("\n\n\n\n*******************" "***********************"); char* username = getenv("USER"); printf("\n\n\nUSER is: @%s", username); printf("\n"); sleep(1); clear(); } // Function to take input int takeInput(char* str) { char* buf; buf = readline("\n>>> "); if (strlen(buf) != 0) { add_history(buf); strcpy(str, buf); return 0; } else { return 1; } } // Function to print Current Directory. void printDir() { char cwd[1024]; getcwd(cwd, sizeof(cwd)); printf("\nDir: %s", cwd); } // Function where the system command is executed void execArgs(char** parsed) { // Forking a child pid_t pid = fork(); if (pid == -1) { printf("\nFailed forking child.."); return; } else if (pid == 0) { if (execvp(parsed[0], parsed) < 0) { printf("\nCould not execute command.."); } exit(0); } else { // waiting for child to terminate wait(NULL); return; } } // Function where the piped system commands is executed void execArgsPiped(char** parsed, char** parsedpipe) { // 0 is read end, 1 is write end int pipefd[2]; pid_t p1, p2; if (pipe(pipefd) < 0) { printf("\nPipe could not be initialized"); return; } p1 = fork(); if (p1 < 0) { printf("\nCould not fork"); return; } if (p1 == 0) { // Child 1 executing.. // It only needs to write at the write end close(pipefd[0]); dup2(pipefd[1], STDOUT_FILENO); close(pipefd[1]); if (execvp(parsed[0], parsed) < 0) { printf("\nCould not execute command 1.."); exit(0); } } else { // Parent executing p2 = fork(); if (p2 < 0) { printf("\nCould not fork"); return; } // Child 2 executing.. // It only needs to read at the read end if (p2 == 0) { close(pipefd[1]); dup2(pipefd[0], STDIN_FILENO); close(pipefd[0]); if (execvp(parsedpipe[0], parsedpipe) < 0) { printf("\nCould not execute command 2.."); exit(0); } } else { // parent executing, waiting for two children wait(NULL); wait(NULL); } } } // Help command builtin void openHelp() { puts("\n***WELCOME TO MY SHELL HELP***" "\nCopyright @ Suprotik Dey" "\n-Use the shell at your own risk..." "\nList of Commands supported:" "\n>cd" "\n>ls" "\n>exit" "\n>all other general commands available in UNIX shell" "\n>pipe handling" "\n>improper space handling"); return; } // Function to execute builtin commands int ownCmdHandler(char** parsed) { int NoOfOwnCmds = 4, i, switchOwnArg = 0; char* ListOfOwnCmds[NoOfOwnCmds]; char* username; ListOfOwnCmds[0] = "exit"; ListOfOwnCmds[1] = "cd"; ListOfOwnCmds[2] = "help"; ListOfOwnCmds[3] = "hello"; for (i = 0; i < NoOfOwnCmds; i++) { if (strcmp(parsed[0], ListOfOwnCmds[i]) == 0) { switchOwnArg = i + 1; break; } } switch (switchOwnArg) { case 1: printf("\nGoodbye\n"); exit(0); case 2: chdir(parsed[1]); return 1; case 3: openHelp(); return 1; case 4: username = getenv("USER"); printf("\nHello %s.\nMind that this is " "not a place to play around." "\nUse help to know more..\n", username); return 1; default: break; } return 0; } // function for finding pipe int parsePipe(char* str, char** strpiped) { int i; for (i = 0; i < 2; i++) { strpiped[i] = strsep(&str, "|"); if (strpiped[i] == NULL) break; } if (strpiped[1] == NULL) return 0; // returns zero if no pipe is found. else { return 1; } } // function for parsing command words void parseSpace(char* str, char** parsed) { int i; for (i = 0; i < MAXLIST; i++) { parsed[i] = strsep(&str, " "); if (parsed[i] == NULL) break; if (strlen(parsed[i]) == 0) i--; } } int processString(char* str, char** parsed, char** parsedpipe) { char* strpiped[2]; int piped = 0; piped = parsePipe(str, strpiped); if (piped) { parseSpace(strpiped[0], parsed); parseSpace(strpiped[1], parsedpipe); } else { parseSpace(str, parsed); } if (ownCmdHandler(parsed)) return 0; else return 1 + piped; } int main() { char inputString[MAXCOM], *parsedArgs[MAXLIST]; char* parsedArgsPiped[MAXLIST]; int execFlag = 0; init_shell(); while (1) { // print shell line printDir(); // take input if (takeInput(inputString)) continue; // process execFlag = processString(inputString, parsedArgs, parsedArgsPiped); // execflag returns zero if there is no command // or it is a builtin command, // 1 if it is a simple command // 2 if it is including a pipe. // execute if (execFlag == 1) execArgs(parsedArgs); if (execFlag == 2) execArgsPiped(parsedArgs, parsedArgsPiped); } return 0; }
the_stack_data/1126419.c
#include <sys/socket.h> #include <sys/types.h> #include <string.h> #include <unistd.h> int main (int argc, char **argv) { int res = accept4(0, NULL, NULL, SOCK_NONBLOCK); (void)res; return(0); }
the_stack_data/97079.c
/* text version of maze 'mazefiles/binary/uk2001f.maz' generated by mazetool (c) Peter Harrison 2018 o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o | | | | | o o o o---o o---o o o---o o---o---o---o---o o o | | | | | | | | | | | o o---o---o o---o o o o o---o o o o o o o | | | | | | | | | | | | | o o o---o o o o---o---o---o o o o o---o o o | | | | | | | | | | | o o o---o o o---o---o o o o o o---o---o---o o | | | | | | | | o o---o---o o---o---o---o---o o o o---o---o---o---o o | | | | | | | o o---o o---o---o o---o---o o o o---o---o---o---o o | | | | | o o---o---o o---o o---o---o---o---o---o---o o---o---o---o | | | | | | | | o o---o---o---o o---o---o o o o---o o---o o---o o | | | | | o o---o---o o---o---o---o o---o o o---o---o---o---o o | | | | | | | o o---o o o---o o o---o o o o o---o---o---o o | | | | | | | | o o---o---o---o o---o o o o o o o---o---o o---o | | | | | | | | | | o o o---o o---o o o o o o o o---o---o---o o | | | | | | | | o o---o o---o---o o o---o o o---o---o---o---o---o o | | | | | | | | o---o o o---o o o o---o o o o---o o---o o o | | | | | | | | | | o o---o o---o---o---o---o---o---o---o---o o---o---o o o | | | | o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o---o */ int uk2001f_maz[] ={ 0x0E, 0x09, 0x0E, 0x08, 0x0A, 0x08, 0x08, 0x08, 0x08, 0x0A, 0x08, 0x08, 0x0A, 0x0A, 0x0A, 0x09, 0x0D, 0x06, 0x09, 0x04, 0x09, 0x05, 0x05, 0x05, 0x05, 0x0D, 0x05, 0x04, 0x0A, 0x09, 0x0E, 0x01, 0x04, 0x08, 0x02, 0x03, 0x07, 0x04, 0x03, 0x07, 0x05, 0x04, 0x01, 0x05, 0x0D, 0x07, 0x0C, 0x01, 0x05, 0x05, 0x0D, 0x0C, 0x09, 0x06, 0x08, 0x09, 0x06, 0x01, 0x06, 0x02, 0x00, 0x0A, 0x01, 0x05, 0x05, 0x04, 0x03, 0x07, 0x06, 0x09, 0x07, 0x04, 0x0B, 0x05, 0x0D, 0x0C, 0x02, 0x09, 0x06, 0x01, 0x05, 0x06, 0x0A, 0x0A, 0x0B, 0x06, 0x0B, 0x05, 0x0C, 0x02, 0x01, 0x05, 0x0E, 0x02, 0x09, 0x05, 0x05, 0x0E, 0x0A, 0x0A, 0x0A, 0x08, 0x09, 0x07, 0x07, 0x0D, 0x07, 0x07, 0x0D, 0x0C, 0x02, 0x03, 0x05, 0x0D, 0x0D, 0x0E, 0x08, 0x03, 0x06, 0x08, 0x09, 0x05, 0x0D, 0x0E, 0x01, 0x04, 0x0A, 0x09, 0x05, 0x06, 0x02, 0x08, 0x02, 0x0A, 0x09, 0x06, 0x03, 0x04, 0x02, 0x0A, 0x03, 0x06, 0x09, 0x07, 0x05, 0x0E, 0x08, 0x02, 0x0A, 0x0A, 0x02, 0x08, 0x09, 0x04, 0x0A, 0x0A, 0x0A, 0x0B, 0x04, 0x0B, 0x05, 0x0E, 0x01, 0x0C, 0x0A, 0x0A, 0x08, 0x01, 0x07, 0x04, 0x08, 0x08, 0x0A, 0x0A, 0x03, 0x0D, 0x04, 0x0B, 0x05, 0x04, 0x08, 0x08, 0x01, 0x04, 0x09, 0x05, 0x05, 0x04, 0x0A, 0x0A, 0x0B, 0x05, 0x05, 0x0C, 0x01, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x03, 0x05, 0x07, 0x0C, 0x0A, 0x09, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x09, 0x0D, 0x05, 0x0D, 0x05, 0x0E, 0x03, 0x05, 0x06, 0x02, 0x01, 0x05, 0x04, 0x01, 0x05, 0x05, 0x05, 0x05, 0x07, 0x05, 0x06, 0x0A, 0x0A, 0x01, 0x0E, 0x0A, 0x02, 0x02, 0x03, 0x06, 0x02, 0x02, 0x03, 0x06, 0x0A, 0x02, 0x0A, 0x0A, 0x0A, 0x03, }; /* end of mazefile */
the_stack_data/170452614.c
/** ***************************************************************************************** * Copyright(c) 2015, Realtek Semiconductor Corporation. All rights reserved. ***************************************************************************************** * @file generic_manufacturer_property_server.c * @brief Source file for generic on off server model. * @details Data types and external functions declaration. * @author bill * @date 2017-12-22 * @version v1.0 * ************************************************************************************* */ /* Add Includes here */
the_stack_data/50279.c
// Adapted from interp.cpp from Caffe util by Pauline Luc // Originally developed by George Papandreou #ifndef TH_GENERIC_FILE #define TH_GENERIC_FILE "generic/SpatialUpSamplingBilinear.c" #else static inline void THNN_(SpatialUpSamplingBilinear_shapeCheck) (THTensor *input, THTensor *gradOutput, int nBatch, int nChannels, int inputHeight, int inputWidth, int outputHeight, int outputWidth) { THArgCheck(inputHeight > 0 && inputWidth > 0 && outputHeight > 0 && outputWidth > 0, 2, "input and output sizes should be greater than 0," " but got input (H: %d, W: %d) output (H: %d, W: %d)", inputHeight, inputWidth, outputHeight, outputWidth); if (input != NULL) { THNN_ARGCHECK(input->nDimension == 4, 2, input, "4D input tensor expected but got: %s"); } if (gradOutput != NULL) { THNN_CHECK_DIM_SIZE(gradOutput, 4, 0, nBatch); THNN_CHECK_DIM_SIZE(gradOutput, 4, 1, nChannels); THNN_CHECK_DIM_SIZE(gradOutput, 4, 2, outputHeight); THNN_CHECK_DIM_SIZE(gradOutput, 4, 3, outputWidth); } } void THNN_(SpatialUpSamplingBilinear_updateOutput)( THNNState *state, THTensor *input, THTensor *output, int outputHeight, int outputWidth, bool align_corners){ int nbatch = THTensor_(size)(input, 0); int channels = THTensor_(size)(input, 1); int inputHeight = THTensor_(size)(input, 2); int inputWidth = THTensor_(size)(input, 3); THNN_(SpatialUpSamplingBilinear_shapeCheck) (input, NULL, nbatch, channels, inputHeight, inputWidth, outputHeight, outputWidth); input = THTensor_(newContiguous)(input); THTensor_(resize4d)(output, THTensor_(size)(input, 0), THTensor_(size)(input, 1), outputHeight, outputWidth); THTensor_(zero)(output); real *idata = THTensor_(data)(input); real *odata = THTensor_(data)(output); channels = nbatch * channels; THAssert(inputHeight > 0 && inputWidth > 0 && outputHeight > 0 && outputWidth > 0); // special case: just copy if (inputHeight == outputHeight && inputWidth == outputWidth) { for (int h2 = 0; h2 < outputHeight; ++h2) { const int h1 = h2; for (int w2 = 0; w2 < outputWidth; ++w2) { const int w1 = w2; const real* pos1 = &idata[h1 * inputWidth + w1]; real* pos2 = &odata[h2 * outputWidth + w2]; for (int c = 0; c < channels; ++c) { pos2[0] = pos1[0]; pos1 += inputWidth * inputHeight; pos2 += outputWidth * outputHeight; } } } return; } const float rheight = THNN_(linear_upsampling_compute_scale)(inputHeight, outputHeight, align_corners); const float rwidth = THNN_(linear_upsampling_compute_scale)(inputWidth, outputWidth, align_corners); for (int h2 = 0; h2 < outputHeight; ++h2) { const float h1r = THNN_(linear_upsampling_compute_source_index)(rheight, h2, align_corners); const int h1 = h1r; const int h1p = (h1 < inputHeight - 1) ? 1 : 0; const real h1lambda = h1r - h1; const real h0lambda = (real)1. - h1lambda; for (int w2 = 0; w2 < outputWidth; ++w2) { const float w1r = THNN_(linear_upsampling_compute_source_index)(rwidth, w2, align_corners); const int w1 = w1r; const int w1p = (w1 < inputWidth - 1) ? 1 : 0; const real w1lambda = w1r - w1; const real w0lambda = (real)1. - w1lambda; const real* pos1 = &idata[h1 * inputWidth + w1]; real* pos2 = &odata[h2 * outputWidth + w2]; for (int c = 0; c < channels; ++c) { pos2[0] = h0lambda * (w0lambda * pos1[0]+ w1lambda * pos1[w1p]) + h1lambda * (w0lambda * pos1[h1p * inputWidth] + w1lambda * pos1[h1p * inputWidth + w1p]); pos1 += inputWidth * inputHeight; pos2 += outputWidth * outputHeight; } } } THTensor_(free)(input); } void THNN_(SpatialUpSamplingBilinear_updateGradInput)( THNNState *state, THTensor *gradOutput, THTensor *gradInput, int nbatch, int channels, int inputHeight, int inputWidth, int outputHeight, int outputWidth, bool align_corners){ THNN_(SpatialUpSamplingBilinear_shapeCheck) (NULL, gradOutput, nbatch, channels, inputHeight, inputWidth, outputHeight, outputWidth); THTensor_(resize4d)(gradInput, nbatch, channels, inputHeight, inputWidth); THTensor_(zero)(gradInput); gradOutput = THTensor_(newContiguous)(gradOutput); real *data1 = THTensor_(data)(gradInput); real *data2 = THTensor_(data)(gradOutput); channels = nbatch * channels; // special case: same-size matching grids if (inputHeight == outputHeight && inputWidth == outputWidth) { for (int h2 = 0; h2 < outputHeight; ++h2) { const int h1 = h2; for (int w2 = 0; w2 < outputWidth; ++w2) { const int w1 = w2; real* pos1 = &data1[h1 * inputWidth + w1]; const real* pos2 = &data2[h2 * outputWidth + w2]; for (int c = 0; c < channels; ++c) { pos1[0] += pos2[0]; pos1 += inputWidth * inputHeight; pos2 += outputWidth * outputHeight; } } } return; } const float rheight = THNN_(linear_upsampling_compute_scale)(inputHeight, outputHeight, align_corners); const float rwidth = THNN_(linear_upsampling_compute_scale)(inputWidth, outputWidth, align_corners); for (int h2 = 0; h2 < outputHeight; ++h2) { const float h1r = THNN_(linear_upsampling_compute_source_index)(rheight, h2, align_corners); const int h1 = h1r; const int h1p = (h1 < inputHeight - 1) ? 1 : 0; const real h1lambda = h1r - h1; const real h0lambda = (real)1. - h1lambda; for (int w2 = 0; w2 < outputWidth; ++w2) { const float w1r = THNN_(linear_upsampling_compute_source_index)(rwidth, w2, align_corners); const int w1 = w1r; const int w1p = (w1 < inputWidth - 1) ? 1 : 0; const real w1lambda = w1r - w1; const real w0lambda = (real)1. - w1lambda; real* pos1 = &data1[h1 * inputWidth + w1]; const real* pos2 = &data2[h2 * outputWidth + w2]; for (int c = 0; c < channels; ++c) { pos1[0] += h0lambda * w0lambda * pos2[0]; pos1[w1p] += h0lambda * w1lambda * pos2[0]; pos1[h1p * inputWidth] += h1lambda * w0lambda * pos2[0]; pos1[h1p * inputWidth + w1p] += h1lambda * w1lambda * pos2[0]; pos1 += inputWidth * inputHeight; pos2 += outputWidth * outputHeight; } } } THTensor_(free)(gradOutput); } #endif
the_stack_data/62637502.c
void iojiofej(void *a) { return a; } int sum(int a, float b) { return 0; } float sub(void) { return 0.0; } int main(void) { return 0; } char* string(void) { return "hello"; } char* string2(void) { return 'h'; }
the_stack_data/116944.c
/* * Copyright 1998 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* * Copyright (c) 1980 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ #pragma ident "%Z%%M% %I% %E% SMI" /* t..c : external declarations */ # include "stdio.h" # include "ctype.h" # define MAXLIN 200 # define MAXHEAD 100 # define MAXCOL 20 # define MAXCHS 2000 # define MAXSTR 1024 # define MAXRPT 100 # define CLLEN 10 # define SHORTLINE 4 # define BIGBUF 8192 extern char *gets1(char *, int); extern int nlin, ncol, iline, nclin, nslin; extern int style[MAXHEAD][MAXCOL]; extern int ctop[MAXHEAD][MAXCOL]; extern char font[MAXHEAD][MAXCOL][2]; extern char csize[MAXHEAD][MAXCOL][4]; extern char vsize[MAXHEAD][MAXCOL][4]; extern char cll[MAXCOL][CLLEN]; extern int stynum[]; extern int F1, F2; extern int lefline[MAXHEAD][MAXCOL]; extern int fullbot[]; extern char *instead[]; extern int expflg; extern int ctrflg; extern int evenflg; extern int evenup[]; extern int boxflg; extern int dboxflg; extern int linsize; extern int tab; extern int pr1403; extern int linsize, delim1, delim2; extern int allflg; extern int textflg; extern int left1flg; extern int rightl; struct colstr {char *col, *rcol;}; extern struct colstr *table[]; extern int *alocv(int); extern char *cspace, *cstore; extern char *chspace(void); extern char *maknew(char *); extern char *exstore, *exlim; extern int sep[]; extern int used[], lused[], rused[]; extern int linestop[]; extern char *leftover; extern char *last, *ifile; extern int texname; extern int texct; extern char texstr[]; extern int linstart; extern FILE *tabin, *tabout; # define CRIGHT 80 # define CLEFT 40 # define CMID 60 # define S1 31 # define S2 32 # define TMP 38 # define SF 35 # define SL 34 # define LSIZE 33 # define SIND 37 # define SVS 36 /* this refers to the relative position of lines */ # define LEFT 1 # define RIGHT 2 # define THRU 3 # define TOP 1 # define BOT 2
the_stack_data/154827663.c
#include <stdio.h> // Function prototype int maximum(int x, int y, int z); int minimum(int x, int y, int z); float average(int x, int y, int z); int product(int x, int y, int z); int main(void) { // Three integers entered by the user int number1; int number2; int number3; while(1) { printf("Enter three integers: "); scanf("%d%d%d", &number1, &number2, &number3); // number1, number2, and number3 are arguments to the maximum function call printf("Maximum is: %d\n", maximum(number1, number2, number3)); printf("Minimum is: %d\n", minimum(number1, number2, number3)); printf("Average is: %.2f\n", average(number1, number2, number3)); printf("Product is: %d\n", product(number1, number2, number3)); } } // Function maximum definition // x, y, and z are parameters // 1 2 3 // 1 3 2 // 2 1 3 // 2 3 1 // 3 1 2 // 3 2 1 int maximum(int x, int y, int z) { int max = x; if(y > max) { max = y; } if(z > max) { max = z; } return max; } // Returns the minimum of three integers int minimum(int x, int y, int z) { int min = x; if(y < min) { min = y; } if(z < min) { min = z; } return min; } // Returns the floating-point average of three integers float average(int x, int y, int z) { return (float)((x + y + z) / 3.0); } // Returns the product of three integers int product(int x, int y, int z) { return x * y * z; }
the_stack_data/198579469.c
/*Exercise 2 - Selection Write a program to calculate the amount to be paid for a rented vehicle. • Input the distance the van has travelled • The first 30 km is at a rate of 50/= per km. • The remaining distance is calculated at the rate of 40/= per km. e.g. Distance -> 20 Amount = 20 x 50 = 1000 Distance -> 50 Amount = 30 x 50 + (50-30) x 40 = 2300*/ #include <stdio.h> int main() { float distance; double amount; printf("Enter the distance : "); scanf("%f", &distance); if(distance <= 30) { amount = distance * 50; } else { amount = (30 * 50) + ((distance - 30) * 40); } printf("The total amount is %.2f", amount); return 0; }
the_stack_data/23576162.c
#include <limits.h> int main() { signed x, y; while(1) { __CPROVER_assume(x >= 10); signed t = x; if((long)x + y <= INT_MAX) x = x + y; y = t; assert(x >= 10); } }
the_stack_data/59512709.c
/*- * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland <[email protected]> * * SPDX-License-Identifier: BSD-2-Clause * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifdef VTEST_WITH_VTC_LOGEXPECT /* SECTION: logexpect logexpect * * Reads the VSL and looks for records matching a given specification. It will * process records trying to match the first pattern, and when done, will * continue processing, trying to match the following pattern. If a pattern * isn't matched, the test will fail. * * logexpect threads are declared this way:: * * logexpect lNAME -v <id> [-g <grouping>] [-d 0|1] [-q query] \ * [vsl arguments] { * expect <skip> <vxid> <tag> <regex> * expect <skip> <vxid> <tag> <regex> * fail add <vxid> <tag> <regex> * fail clear * ... * } [-start|-wait] * * And once declared, you can start them, or wait on them:: * * logexpect lNAME <-start|-wait> * * With: * * lNAME * Name the logexpect thread, it must start with 'l'. * * \-v id * Specify the varnish instance to use (most of the time, id=v1). * * \-g <session|request|vxid|raw * Decide how records are grouped, see -g in ``man varnishlog`` for more * information. * * \-d <0|1> * Start processing log records at the head of the log instead of the * tail. * * \-q query * Filter records using a query expression, see ``man vsl-query`` for * more information. Multiple -q options are not supported. * * \-m * Also emit log records for misses (only for debugging) * * \-err * Invert the meaning of success. Usually called once to expect the * logexpect to fail * * \-start * Start the logexpect thread in the background. * * \-wait * Wait for the logexpect thread to finish * * VSL arguments (similar to the varnishlog options): * * \-C * Use caseless regex * * \-i <taglist> * Include tags * * \-I <[taglist:]regex> * Include by regex * * \-T <seconds> * Transaction end timeout * * expect specification: * * skip: [uint|*|?] * Max number of record to skip * * vxid: [uint|*|=] * vxid to match * * tag: [tagname|*|=] * Tag to match against * * regex: * regular expression to match against (optional) * * For skip, vxid and tag, '*' matches anything, '=' expects the value of the * previous matched record. The '?' marker is equivalent to zero, expecting a * match on the next record. The difference is that '?' can be used when the * order of individual consecutive logs is not deterministic. In other words, * lines from a block of alternatives marked by '?' can be matched in any order, * but all need to match eventually. * * fail specification: * * add: Add to the fail list * * Arguments are equivalent to expect, except for skip missing * * clear: Clear the fail list * * Any number of fail specifications can be active during execution of * a logexpect. All active fail specifications are matched against every * log line and, if any match, the logexpect fails immediately. * * For a logexpect to end successfully, there must be no specs on the fail list, * so logexpects should always end with * * expect <skip> <vxid> <tag> <termination-condition> * fail clear * * .. XXX can we come up with a better solution which is still safe? */ #include "config.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdint.h> #include "vapi/vsm.h" #include "vapi/vsl.h" #include "vtc.h" #include "vtim.h" #include "vre.h" #define LE_ANY (-1) #define LE_LAST (-2) #define LE_ALT (-3) #define LE_SEEN (-4) #define LE_FAIL (-5) #define LE_CLEAR (-6) // clear fail list struct logexp_test { unsigned magic; #define LOGEXP_TEST_MAGIC 0x6F62B350 VTAILQ_ENTRY(logexp_test) list; VTAILQ_ENTRY(logexp_test) faillist; struct vsb *str; int vxid; int tag; vre_t *vre; int skip_max; }; VTAILQ_HEAD(tests_head,logexp_test); struct logexp { unsigned magic; #define LOGEXP_MAGIC 0xE81D9F1B VTAILQ_ENTRY(logexp) list; char *name; char *vname; struct vtclog *vl; char run; struct tests_head tests; struct logexp_test *test; int skip_cnt; int vxid_last; int tag_last; struct tests_head fail; int m_arg; int err_arg; int d_arg; enum VSL_grouping_e g_arg; char *query; struct vsm *vsm; struct VSL_data *vsl; struct VSLQ *vslq; pthread_t tp; }; static VTAILQ_HEAD(, logexp) logexps = VTAILQ_HEAD_INITIALIZER(logexps); static cmd_f cmd_logexp_expect; static cmd_f cmd_logexp_fail; static const struct cmds logexp_cmds[] = { { "expect", cmd_logexp_expect }, { "fail", cmd_logexp_fail }, { NULL, NULL }, }; static void logexp_delete_tests(struct logexp *le) { struct logexp_test *test; CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); while (!VTAILQ_EMPTY(&le->tests)) { test = VTAILQ_FIRST(&le->tests); CHECK_OBJ_NOTNULL(test, LOGEXP_TEST_MAGIC); VTAILQ_REMOVE(&le->tests, test, list); VSB_destroy(&test->str); if (test->vre) VRE_free(&test->vre); FREE_OBJ(test); } } static void logexp_delete(struct logexp *le) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); AZ(le->run); AN(le->vsl); VSL_Delete(le->vsl); AZ(le->vslq); logexp_delete_tests(le); free(le->name); free(le->vname); free(le->query); VSM_Destroy(&le->vsm); vtc_logclose(le->vl); FREE_OBJ(le); } static struct logexp * logexp_new(const char *name, const char *varg) { struct logexp *le; struct vsb *n_arg; ALLOC_OBJ(le, LOGEXP_MAGIC); AN(le); REPLACE(le->name, name); le->vl = vtc_logopen("%s", name); vtc_log_set_cmd(le->vl, logexp_cmds); VTAILQ_INIT(&le->tests); le->d_arg = 0; le->g_arg = VSL_g_vxid; le->vsm = VSM_New(); le->vsl = VSL_New(); AN(le->vsm); AN(le->vsl); VTAILQ_INSERT_TAIL(&logexps, le, list); REPLACE(le->vname, varg); n_arg = macro_expandf(le->vl, "${tmpdir}/%s", varg); if (n_arg == NULL) vtc_fatal(le->vl, "-v argument problems"); if (VSM_Arg(le->vsm, 'n', VSB_data(n_arg)) <= 0) vtc_fatal(le->vl, "-v argument error: %s", VSM_Error(le->vsm)); VSB_destroy(&n_arg); if (VSM_Attach(le->vsm, -1)) vtc_fatal(le->vl, "VSM_Attach: %s", VSM_Error(le->vsm)); return (le); } static void logexp_clean(const struct tests_head *head) { struct logexp_test *test; VTAILQ_FOREACH(test, head, list) if (test->skip_max == LE_SEEN) test->skip_max = LE_ALT; } static struct logexp_test * logexp_alt(struct logexp_test *test) { assert(test->skip_max == LE_ALT); do test = VTAILQ_NEXT(test, list); while (test != NULL && test->skip_max == LE_SEEN); if (test == NULL || test->skip_max != LE_ALT) return (NULL); return (test); } static void logexp_next(struct logexp *le) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); if (le->test && le->test->skip_max == LE_ALT) { /* * if an alternative was not seen, continue at this expection * with the next vsl */ (void)0; } else if (le->test) { CHECK_OBJ_NOTNULL(le->test, LOGEXP_TEST_MAGIC); le->test = VTAILQ_NEXT(le->test, list); } else { logexp_clean(&le->tests); VTAILQ_INIT(&le->fail); le->test = VTAILQ_FIRST(&le->tests); } if (le->test == NULL) return; CHECK_OBJ(le->test, LOGEXP_TEST_MAGIC); switch (le->test->skip_max) { case LE_SEEN: logexp_next(le); return; case LE_CLEAR: vtc_log(le->vl, 3, "cond | fail clear"); VTAILQ_INIT(&le->fail); logexp_next(le); return; case LE_FAIL: vtc_log(le->vl, 3, "cond | %s", VSB_data(le->test->str)); VTAILQ_INSERT_TAIL(&le->fail, le->test, faillist); logexp_next(le); return; default: vtc_log(le->vl, 3, "test | %s", VSB_data(le->test->str)); } } enum le_match_e { LEM_OK, LEM_SKIP, LEM_FAIL }; static enum le_match_e logexp_match(const struct logexp *le, struct logexp_test *test, const char *data, int vxid, int tag, int type, int len) { const char *legend; int ok = 1, skip = 0, alt, fail, vxid_ok = 0; AN(le); AN(test); assert(test->skip_max != LE_SEEN); assert(test->skip_max != LE_CLEAR); if (test->vxid == LE_LAST) { if (le->vxid_last != vxid) ok = 0; vxid_ok = ok; } else if (test->vxid >= 0) { if (test->vxid != vxid) ok = 0; vxid_ok = ok; } if (test->tag == LE_LAST) { if (le->tag_last != tag) ok = 0; } else if (test->tag >= 0) { if (test->tag != tag) ok = 0; } if (test->vre && test->tag >= 0 && test->tag == tag && VRE_ERROR_NOMATCH == VRE_match(test->vre, data, len, 0, NULL)) ok = 0; alt = (test->skip_max == LE_ALT); fail = (test->skip_max == LE_FAIL); if (!ok && !alt && (test->skip_max == LE_ANY || test->skip_max > le->skip_cnt)) skip = 1; if (skip && vxid_ok && tag == SLT_End) fail = 1; if (fail) { if (ok) { legend = "fail"; } else if (skip) { legend = "end"; skip = 0; } else if (le->m_arg) { legend = "fmiss"; } else { legend = NULL; } } else if (ok) legend = "match"; else if (skip && le->m_arg) legend = "miss"; else if (skip || alt) legend = NULL; else legend = "err"; if (legend != NULL) vtc_log(le->vl, 4, "%-5s| %10u %-15s %c %.*s", legend, vxid, VSL_tags[tag], type, len, data); if (ok) { if (alt) test->skip_max = LE_SEEN; return (LEM_OK); } if (alt) { test = logexp_alt(test); if (test == NULL) return (LEM_FAIL); vtc_log(le->vl, 3, "alt | %s", VSB_data(test->str)); return (logexp_match(le, test, data, vxid, tag, type, len)); } if (skip) return (LEM_SKIP); return (LEM_FAIL); } static enum le_match_e logexp_failchk(const struct logexp *le, const char *data, int vxid, int tag, int type, int len) { struct logexp_test *test; static enum le_match_e r; if (VTAILQ_FIRST(&le->fail) == NULL) return (LEM_SKIP); VTAILQ_FOREACH(test, &le->fail, faillist) { r = logexp_match(le, test, data, vxid, tag, type, len); if (r == LEM_OK) return (LEM_FAIL); assert (r == LEM_FAIL); } return (LEM_OK); } static int logexp_done(const struct logexp *le) { return ((VTAILQ_FIRST(&le->fail) == NULL) && le->test == NULL); } static int v_matchproto_(VSLQ_dispatch_f) logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *priv) { struct logexp *le; struct VSL_transaction *t; int i; enum le_match_e r; int vxid, tag, type, len; const char *data; CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC); for (i = 0; (t = pt[i]) != NULL; i++) { while (1 == VSL_Next(t->c)) { if (!VSL_Match(vsl, t->c)) continue; AN(t->c->rec.ptr); tag = VSL_TAG(t->c->rec.ptr); if (tag == SLT__Batch || tag == SLT_Witness) continue; vxid = VSL_ID(t->c->rec.ptr); data = VSL_CDATA(t->c->rec.ptr); len = VSL_LEN(t->c->rec.ptr) - 1; type = VSL_CLIENT(t->c->rec.ptr) ? 'c' : VSL_BACKEND(t->c->rec.ptr) ? 'b' : '-'; r = logexp_failchk(le, data, vxid, tag, type, len); if (r == LEM_FAIL) return (r); if (le->test == NULL) { assert (r == LEM_OK); continue; } CHECK_OBJ_NOTNULL(le->test, LOGEXP_TEST_MAGIC); r = logexp_match(le, le->test, data, vxid, tag, type, len); if (r == LEM_FAIL) return (r); if (r == LEM_SKIP) { le->skip_cnt++; continue; } assert(r == LEM_OK); le->vxid_last = vxid; le->tag_last = tag; le->skip_cnt = 0; logexp_next(le); if (logexp_done(le)) return (1); } } return (0); } static void * logexp_thread(void *priv) { struct logexp *le; int i; CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC); AN(le->run); AN(le->vsm); AN(le->vslq); AZ(le->test); vtc_log(le->vl, 4, "begin|"); if (le->query != NULL) vtc_log(le->vl, 4, "qry | %s", le->query); logexp_next(le); while (!logexp_done(le) && !vtc_stop && !vtc_error) { i = VSLQ_Dispatch(le->vslq, logexp_dispatch, le); if (i == 2 && le->err_arg) { vtc_log(le->vl, 4, "done | failed as expected"); return (NULL); } if (i == 2) vtc_fatal(le->vl, "bad | expectation failed"); else if (i < 0) vtc_fatal(le->vl, "bad | dispatch failed (%d)", i); else if (i == 0 && ! logexp_done(le)) VTIM_sleep(0.01); } if (!logexp_done(le)) vtc_fatal(le->vl, "bad | outstanding expectations"); vtc_log(le->vl, 4, "done |"); return (NULL); } static void logexp_close(struct logexp *le) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); AN(le->vsm); if (le->vslq) VSLQ_Delete(&le->vslq); AZ(le->vslq); } static void logexp_start(struct logexp *le) { struct VSL_cursor *c; CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); AN(le->vsl); AZ(le->vslq); AN(le->vsl); (void)VSM_Status(le->vsm); c = VSL_CursorVSM(le->vsl, le->vsm, (le->d_arg ? 0 : VSL_COPT_TAIL) | VSL_COPT_BATCH); if (c == NULL) vtc_fatal(le->vl, "VSL_CursorVSM: %s", VSL_Error(le->vsl)); le->vslq = VSLQ_New(le->vsl, &c, le->g_arg, le->query); if (le->vslq == NULL) { VSL_DeleteCursor(c); vtc_fatal(le->vl, "VSLQ_New: %s", VSL_Error(le->vsl)); } AZ(c); le->test = NULL; le->skip_cnt = 0; le->vxid_last = le->tag_last = -1; le->run = 1; AZ(pthread_create(&le->tp, NULL, logexp_thread, le)); } static void logexp_wait(struct logexp *le) { void *res; CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); vtc_log(le->vl, 2, "Waiting for logexp"); AZ(pthread_join(le->tp, &res)); logexp_close(le); if (res != NULL && !vtc_stop) vtc_fatal(le->vl, "logexp returned \"%p\"", (char *)res); le->run = 0; } /* shared by expect and fail: parse from av[2] (vxid) onwards */ static void cmd_logexp_common(struct logexp *le, struct vtclog *vl, int skip_max, char * const *av) { vre_t *vre; struct vsb vsb[1]; int err, pos, tag, vxid; struct logexp_test *test; char *end, errbuf[VRE_ERROR_LEN]; if (!strcmp(av[2], "*")) vxid = LE_ANY; else if (!strcmp(av[2], "=")) vxid = LE_LAST; else { vxid = (int)strtol(av[2], &end, 10); if (*end != '\0' || vxid < 0) vtc_fatal(vl, "Not a positive integer: '%s'", av[2]); } if (!strcmp(av[3], "*")) tag = LE_ANY; else if (!strcmp(av[3], "=")) tag = LE_LAST; else { tag = VSL_Name2Tag(av[3], strlen(av[3])); if (tag < 0) vtc_fatal(vl, "Unknown tag name: '%s'", av[3]); } vre = NULL; if (av[4]) { vre = VRE_compile(av[4], 0, &err, &pos, 1); if (vre == NULL) { AN(VSB_init(vsb, errbuf, sizeof errbuf)); AZ(VRE_error(vsb, err)); AZ(VSB_finish(vsb)); VSB_fini(vsb); vtc_fatal(vl, "Regex error (%s): '%s' pos %d", errbuf, av[4], pos); } } ALLOC_OBJ(test, LOGEXP_TEST_MAGIC); AN(test); test->str = VSB_new_auto(); AN(test->str); AZ(VSB_printf(test->str, "%s %s %s %s ", av[0], av[1], av[2], av[3])); if (av[4]) VSB_quote(test->str, av[4], -1, 0); AZ(VSB_finish(test->str)); test->skip_max = skip_max; test->vxid = vxid; test->tag = tag; test->vre = vre; VTAILQ_INSERT_TAIL(&le->tests, test, list); } static void cmd_logexp_expect(CMD_ARGS) { struct logexp *le; int skip_max; char *end; CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC); if (av[1] == NULL || av[2] == NULL || av[3] == NULL) vtc_fatal(vl, "Syntax error"); if (av[4] != NULL && av[5] != NULL) vtc_fatal(vl, "Syntax error"); if (!strcmp(av[1], "*")) skip_max = LE_ANY; else if (!strcmp(av[1], "?")) skip_max = LE_ALT; else { skip_max = (int)strtol(av[1], &end, 10); if (*end != '\0' || skip_max < 0) vtc_fatal(vl, "Not a positive integer: '%s'", av[1]); } cmd_logexp_common(le, vl, skip_max, av); } static void cmd_logexp_fail(CMD_ARGS) { struct logexp *le; struct logexp_test *test; CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC); if (av[1] == NULL) vtc_fatal(vl, "Syntax error"); if (!strcmp(av[1], "clear")) { ALLOC_OBJ(test, LOGEXP_TEST_MAGIC); AN(test); test->skip_max = LE_CLEAR; test->str = VSB_new_auto(); AN(test->str); AZ(VSB_printf(test->str, "%s %s", av[0], av[1])); AZ(VSB_finish(test->str)); VTAILQ_INSERT_TAIL(&le->tests, test, list); return; } if (strcmp(av[1], "add")) vtc_fatal(vl, "Unknown fail argument '%s'", av[1]); if (av[2] == NULL || av[3] == NULL) vtc_fatal(vl, "Syntax error"); cmd_logexp_common(le, vl, LE_FAIL, av); } static void logexp_spec(struct logexp *le, const char *spec) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); logexp_delete_tests(le); parse_string(le->vl, le, spec); } void cmd_logexpect(CMD_ARGS) { struct logexp *le, *le2; int i; (void)priv; if (av == NULL) { /* Reset and free */ VTAILQ_FOREACH_SAFE(le, &logexps, list, le2) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); VTAILQ_REMOVE(&logexps, le, list); if (le->run) { (void)pthread_cancel(le->tp); logexp_wait(le); } logexp_delete(le); } return; } AZ(strcmp(av[0], "logexpect")); av++; VTC_CHECK_NAME(vl, av[0], "Logexpect", 'l'); VTAILQ_FOREACH(le, &logexps, list) { if (!strcmp(le->name, av[0])) break; } if (le == NULL) { if (strcmp(av[1], "-v") || av[2] == NULL) vtc_fatal(vl, "new logexp lacks -v"); le = logexp_new(av[0], av[2]); av += 2; } av++; for (; *av != NULL; av++) { if (vtc_error) break; if (!strcmp(*av, "-wait")) { if (!le->run) vtc_fatal(le->vl, "logexp not -started '%s'", *av); logexp_wait(le); continue; } /* * We do an implict -wait if people muck about with a * running logexp. */ if (le->run) logexp_wait(le); AZ(le->run); if (!strcmp(*av, "-v")) { if (av[1] == NULL || strcmp(av[1], le->vname)) vtc_fatal(le->vl, "-v argument cannot change"); av++; continue; } if (!strcmp(*av, "-d")) { if (av[1] == NULL) vtc_fatal(le->vl, "Missing -d argument"); le->d_arg = atoi(av[1]); av++; continue; } if (!strcmp(*av, "-g")) { if (av[1] == NULL) vtc_fatal(le->vl, "Missing -g argument"); i = VSLQ_Name2Grouping(av[1], strlen(av[1])); if (i < 0) vtc_fatal(le->vl, "Unknown grouping '%s'", av[1]); le->g_arg = (enum VSL_grouping_e)i; av++; continue; } if (!strcmp(*av, "-q")) { if (av[1] == NULL) vtc_fatal(le->vl, "Missing -q argument"); REPLACE(le->query, av[1]); av++; continue; } if (!strcmp(*av, "-m")) { le->m_arg = !le->m_arg; continue; } if (!strcmp(*av, "-err")) { le->err_arg = !le->err_arg; continue; } if (!strcmp(*av, "-start")) { logexp_start(le); continue; } if (!strcmp(*av, "-run")) { logexp_start(le); logexp_wait(le); continue; } if (**av == '-') { if (av[1] != NULL) { if (VSL_Arg(le->vsl, av[0][1], av[1])) { av++; continue; } vtc_fatal(le->vl, "%s", VSL_Error(le->vsl)); } vtc_fatal(le->vl, "Unknown logexp argument: %s", *av); } logexp_spec(le, *av); } } #endif /* VTEST_WITH_VTC_LOGEXPECT */
the_stack_data/64201683.c
#include <stdio.h> int main() { printf("Enter the value of n : "); int n; scanf("%d", &n); printf("\n"); //pattern 1 for (int i = 1; i <= n; i++) { for (int k = 1; k <= i; k++) printf("*"); for (int l = n - i; l > 0; l--) printf("."); printf("\n"); } printf("\n"); //pattern 2 for (int i = n; i > 0; i--) { for (int l = n - i; l > 0; l--) printf("."); for (int k = 1; k <= i; k++) printf("*"); printf("\n"); } printf("\n"); //pattern 3 for (int i = 1; i <= n; i++) { for (int l = n - i; l > 0; l--) printf("."); for (int k = 1; k <= i; k++) printf("*"); for (int k = 1; k < i; k++) printf("*"); for (int l = n - i; l > 0; l--) printf("."); printf("\n"); } printf("\n"); //pattern 4 for (int i = n; i > 0; i--) { for (int k = n - i; k > 0; k--) printf("."); for (int l = 1; l <= i; l++) printf("%d", l); for (int k = i - 1; k > 0; k--) printf("%d", k); for (int k = n - i; k > 0; k--) printf("."); printf("\n"); } printf("\n"); //pattern 5 for (int i = 1; i <= n; i++) { for (int l = n - i; l > 0; l--) printf("."); for (int k = 1; k <= i; k++) printf("*"); for (int k = 1; k < i; k++) printf("*"); for (int l = n - i; l > 0; l--) printf("."); printf("\n"); } for (int i = n - 1; i > 0; i--) { for (int k = n - i; k > 0; k--) printf("."); for (int l = 1; l <= i; l++) printf("*"); for (int k = i - 1; k > 0; k--) printf("*"); for (int k = n - i; k > 0; k--) printf("."); printf("\n"); } printf("\n"); //pattern 6 for (int i = 1; i < n; i++) { for (int l = n - i; l > 0; l--) printf("."); for (int k = 1; k <= i; k++) printf("%d", k); for (int k = 1; k < i; k++) printf("%d", k); for (int l = n - i; l > 0; l--) printf("."); printf("\n"); } for (int i = n; i > 0; i--) { for (int k = n - i; k > 0; k--) printf("."); for (int l = 1; l <= i; l++) printf("%d", l); for (int k = i - 1; k > 0; k--) printf("%d", k); for (int k = n - i; k > 0; k--) printf("."); printf("\n"); } printf("\n"); printf("\n"); return 0; }
the_stack_data/161080968.c
#include <stdio.h> #include <string.h> #define MAXN 200 int bit[MAXN]; char cbit[MAXN]; int sum[MAXN]; void assign (int *n, char *s) { int i=0, j=0; while (s[i] != '\n') ++i; while (i>=1) n[j++] = s[--i]-'0'; } void bigadd (int *sn, int *n) { int i, tmp, c = 0; for (i=0; i<MAXN; i++) { tmp = sn[i] + n[i] + c; sn[i] = tmp % 10; c = tmp / 10; } } void bigprint (int *s) { int i = MAXN-1; while (i>0 && s[i] == 0) i--; while (i>=0) printf ("%d", s[i--]); printf ("\n"); } int main() { memset (sum, 0, sizeof(int)*MAXN); while (fgets(cbit, MAXN, stdin) != NULL) { if (cbit[0] == '0' && cbit[1] == '\n') break; memset (bit, 0, sizeof(int)*MAXN); assign (bit, cbit); bigadd (sum, bit); } bigprint (sum); return 0; }
the_stack_data/132953468.c
#include <stdlib.h> #include <stdio.h> #include <pthread.h> volatile int count = 0; volatile int request[2] = {0,0}; volatile int turn = 0; void lock(int id){ request[id] = 1; int other = 1-id; turn = other; while(request[other] == 1 && turn == other){}; // spin } void unlock(int id){ request[id] = 0; } typedef struct args {int inc; int id;} args; void *increment(void *arg){ int inc = ((args*)arg)->inc; int id = ((args*)arg)->id; for(int i = 0; i < inc; i++){ lock(id); count++; unlock(id); } } int main(int argc, char *argv[]){ if(argc != 2){ printf("usage peterson <inc>\n"); exit(0); } int inc = atoi(argv[1]); pthread_t one_p, two_p; args one_args, two_args; one_args.inc = inc; two_args.inc = inc; one_args.id = 0; two_args.id = 1; pthread_create(&one_p, NULL, increment, &one_args); pthread_create(&two_p, NULL, increment, &two_args); pthread_join(one_p, NULL); pthread_join(two_p, NULL); printf("result is %d\n", count); return 0; }
the_stack_data/59513481.c
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> #include <ctype.h> typedef struct { int data[60]; int dataCount; } buf_t; typedef struct { buf_t player[2]; uint64_t combination[4000]; // player 1 lower 16 Bit player 2 upper 16 bit int combinationCount; int won; int game, round; } game_t; void bufInit(buf_t *r) { r->dataCount = 0; } int takeFromBegin(buf_t *r) { if (r->dataCount == 0) { printf("empty buf\n"); exit(1); } int result = r->data[0]; r->dataCount--; int *to = &r->data[0], *from = &r->data[1]; for (int i = r->dataCount; i > 0; i--) { *to++ = *from++; } return result; } void addToEnd(buf_t *r, int add) { if (r->dataCount >= (sizeof r->data / sizeof r->data[0])) { printf("buf to small\n"); exit(1); } r->data[r->dataCount++] = add; } int bufLen(buf_t *r) { return r->dataCount; } void bufPrint(buf_t *r, int player) { printf("Player %d: ", player + 1); buf_t *rp = &r[player]; for (int i = 0; i < rp->dataCount; i++) { printf("%d, ", rp->data[i]); } puts("\b\b "); } int getGameResult(buf_t *r) { int j = 1; int sum = 0; for (int i = r->dataCount - 1; i >= 0; i--) { sum += j++ * r->data[i]; } return sum; } void play1(game_t *g) { g->won = g->player[1].dataCount == 0 ? 1 : g->player[0].dataCount == 0 ? 2 : 0; if (g->won > 0) { // printf("Player %d wins\n", g->won); return; } int p1 = takeFromBegin(&g->player[0]), p2 = takeFromBegin(&g->player[1]); if (p1 < p2) { addToEnd(&g->player[1], p2); addToEnd(&g->player[1], p1); } else { addToEnd(&g->player[0], p1); addToEnd(&g->player[0], p2); } // bufPrint(&g->player[0], 0); // bufPrint(&g->player[0], 1); play1(g); } bool addTurnWasBefore(game_t *g) { // a hash map would be nicer here uint64_t combined = getGameResult(&g->player[0]) + 100000 * getGameResult(&g->player[1]); for (int i = 0; i < g->combinationCount; i++) { if (g->combination[i] == combined) { return true; } } g->combination[g->combinationCount++] = combined; if (g->combinationCount > sizeof g->combination / sizeof g->combination[0]) { puts("combination array too small"); exit(0); } return false; } void play2(game_t *g) { int len1 = bufLen(&g->player[0]), len2 = bufLen(&g->player[1]); g->won = len2 == 0 ? 1 : len1 == 0 ? 2 : 0; if (addTurnWasBefore(g)) { g->won = 1; } if (g->won > 0) { //printf("Player %d wins\n", g->won); //printGameResult(&g->player[g->won - 1]); return; } int p1 = takeFromBegin(&g->player[0]), p2 = takeFromBegin(&g->player[1]); bool player2Wins = p1 < p2; if (len1 > p1 && len2 > p2) { // len is includuing p1 and p2 game_t subGame = *g; subGame.game++; subGame.round = 0; subGame.player[0].dataCount = p1; subGame.player[1].dataCount = p2; subGame.combinationCount = 0; // printf(">> Game %d <<\n", subGame.game); play2(&subGame); player2Wins = (subGame.won == 2); // printf(">> END Game <<\n"); } if (player2Wins) { addToEnd(&g->player[1], p2); addToEnd(&g->player[1], p1); } else { addToEnd(&g->player[0], p1); addToEnd(&g->player[0], p2); } g->round++; // printf("round %d game %d combinations %d\n", g->round, g->game, g->combinationCount); // bufPrint(&g->player[0], 0); // bufPrint(&g->player[0], 1); play2(g); } int main(void) { FILE* f = fopen("input22.txt", "r"); if (f != NULL) { char buf[256]; int part = 0; game_t game; bufInit(&game.player[0]); bufInit(&game.player[1]); while (fgets(buf, sizeof buf, f) != NULL) { if (*buf != 0 && *buf != 10) { if (isdigit(*buf)) { addToEnd(&game.player[part], strtol(buf, 0, 0)); } } else { part++; if (part == 2) { return 1; } } } // bufPrint(game.player, 0); // bufPrint(game.player, 1); game_t game2 = game; play1(&game); printf("Part 1: %d\n", getGameResult(&game.player[game.won - 1])); play2(&game2); printf("Part 2: %d\n", getGameResult(&game2.player[game2.won - 1])); fclose(f); } return 0; }
the_stack_data/40761628.c
// general protection fault in hash_ip4_uadt // https://syzkaller.appspot.com/bug?id=79c7cd17a7d2b58c5973606a4fa7e63d56974443 // status:dup // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include <endian.h> #include <errno.h> #include <pthread.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/syscall.h> #include <sys/types.h> #include <time.h> #include <unistd.h> #include <linux/futex.h> static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i; for (i = 0; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void loop(void) { int i, call, thread; int collide = 0; again: for (call = 0; call < 4; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); if (!collide) { collide = 1; goto again; } } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_call(int call) { intptr_t res; switch (call) { case 0: res = syscall(__NR_socket, 0x10ul, 3ul, 0xcul); if (res != -1) r[0] = res; break; case 1: *(uint64_t*)0x20000300 = 0; *(uint32_t*)0x20000308 = 0; *(uint64_t*)0x20000310 = 0x200002c0; *(uint64_t*)0x200002c0 = 0x20000440; *(uint32_t*)0x20000440 = 0x50; *(uint8_t*)0x20000444 = 2; *(uint8_t*)0x20000445 = 6; *(uint16_t*)0x20000446 = 1; *(uint32_t*)0x20000448 = 0; *(uint32_t*)0x2000044c = 0; *(uint8_t*)0x20000450 = 0; *(uint8_t*)0x20000451 = 0; *(uint16_t*)0x20000452 = htobe16(0); *(uint16_t*)0x20000454 = 9; *(uint16_t*)0x20000456 = 2; memcpy((void*)0x20000458, "syz2\000", 5); *(uint16_t*)0x20000460 = 0xc; *(uint16_t*)0x20000462 = 3; memcpy((void*)0x20000464, "hash:ip\000", 8); *(uint16_t*)0x2000046c = 0xc; STORE_BY_BITMASK(uint16_t, , 0x2000046e, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000046f, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000046f, 1, 7, 1); *(uint16_t*)0x20000470 = 8; STORE_BY_BITMASK(uint16_t, , 0x20000472, 6, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000473, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000473, 0, 7, 1); *(uint32_t*)0x20000474 = htobe32(3); *(uint16_t*)0x20000478 = 5; *(uint16_t*)0x2000047a = 1; *(uint8_t*)0x2000047c = 7; *(uint16_t*)0x20000480 = 5; *(uint16_t*)0x20000482 = 4; *(uint8_t*)0x20000484 = 0; *(uint16_t*)0x20000488 = 5; *(uint16_t*)0x2000048a = 5; *(uint8_t*)0x2000048c = 2; *(uint64_t*)0x200002c8 = 0x50; *(uint64_t*)0x20000318 = 1; *(uint64_t*)0x20000320 = 0x200000000000000; *(uint64_t*)0x20000328 = 0; *(uint32_t*)0x20000330 = 0; syscall(__NR_sendmsg, r[0], 0x20000300ul, 0ul); break; case 2: res = syscall(__NR_socket, 0x10ul, 3ul, 0xcul); if (res != -1) r[1] = res; break; case 3: *(uint64_t*)0x20000500 = 0; *(uint32_t*)0x20000508 = 0; *(uint64_t*)0x20000510 = 0x200004c0; *(uint64_t*)0x200004c0 = 0x200003c0; *(uint32_t*)0x200003c0 = 0x100; *(uint8_t*)0x200003c4 = 0xb; *(uint8_t*)0x200003c5 = 6; *(uint16_t*)0x200003c6 = 1; *(uint32_t*)0x200003c8 = 0x70bd2d; *(uint32_t*)0x200003cc = 0x25dfdbfb; *(uint8_t*)0x200003d0 = 0x9a; *(uint8_t*)0x200003d1 = 0; *(uint16_t*)0x200003d2 = htobe16(5); *(uint16_t*)0x200003d4 = 8; STORE_BY_BITMASK(uint16_t, , 0x200003d6, 9, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200003d7, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200003d7, 0, 7, 1); *(uint32_t*)0x200003d8 = htobe32(0x40); *(uint16_t*)0x200003dc = 0x44; STORE_BY_BITMASK(uint16_t, , 0x200003de, 8, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200003df, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200003df, 1, 7, 1); *(uint16_t*)0x200003e0 = 0x10; STORE_BY_BITMASK(uint16_t, , 0x200003e2, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200003e3, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200003e3, 1, 7, 1); *(uint16_t*)0x200003e4 = 0xc; STORE_BY_BITMASK(uint16_t, , 0x200003e6, 0x18, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200003e7, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200003e7, 0, 7, 1); *(uint64_t*)0x200003e8 = htobe64(3); *(uint16_t*)0x200003f0 = 0xc; STORE_BY_BITMASK(uint16_t, , 0x200003f2, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200003f3, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200003f3, 1, 7, 1); *(uint16_t*)0x200003f4 = 8; STORE_BY_BITMASK(uint16_t, , 0x200003f6, 0xb, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200003f7, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200003f7, 0, 7, 1); *(uint32_t*)0x200003f8 = htobe32(0x81); *(uint16_t*)0x200003fc = 0xc; STORE_BY_BITMASK(uint16_t, , 0x200003fe, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200003ff, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200003ff, 1, 7, 1); *(uint16_t*)0x20000400 = 5; *(uint16_t*)0x20000402 = 0x1a; memcpy((void*)0x20000404, "\000", 1); *(uint16_t*)0x20000408 = 0xc; STORE_BY_BITMASK(uint16_t, , 0x2000040a, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000040b, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000040b, 1, 7, 1); *(uint16_t*)0x2000040c = 8; STORE_BY_BITMASK(uint16_t, , 0x2000040e, 0xa, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000040f, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000040f, 0, 7, 1); *(uint32_t*)0x20000410 = htobe32(8); *(uint16_t*)0x20000414 = 0xc; STORE_BY_BITMASK(uint16_t, , 0x20000416, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000417, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000417, 1, 7, 1); *(uint16_t*)0x20000418 = 6; STORE_BY_BITMASK(uint16_t, , 0x2000041a, 0x1d, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000041b, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000041b, 0, 7, 1); *(uint16_t*)0x2000041c = htobe16(0x3f); *(uint16_t*)0x20000420 = 8; STORE_BY_BITMASK(uint16_t, , 0x20000422, 9, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000423, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000423, 0, 7, 1); *(uint32_t*)0x20000424 = htobe32(9); *(uint16_t*)0x20000428 = 5; *(uint16_t*)0x2000042a = 1; *(uint8_t*)0x2000042c = 7; *(uint16_t*)0x20000430 = 5; *(uint16_t*)0x20000432 = 1; *(uint8_t*)0x20000434 = 7; *(uint16_t*)0x20000438 = 5; *(uint16_t*)0x2000043a = 1; *(uint8_t*)0x2000043c = 7; *(uint16_t*)0x20000440 = 9; *(uint16_t*)0x20000442 = 2; memcpy((void*)0x20000444, "syz2\000", 5); *(uint16_t*)0x2000044c = 0x30; STORE_BY_BITMASK(uint16_t, , 0x2000044e, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000044f, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000044f, 1, 7, 1); *(uint16_t*)0x20000450 = 0x14; *(uint16_t*)0x20000452 = 0x17; memcpy((void*)0x20000454, "veth0_to_bridge\000", 16); *(uint16_t*)0x20000464 = 8; STORE_BY_BITMASK(uint16_t, , 0x20000466, 0xa, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000467, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000467, 0, 7, 1); *(uint32_t*)0x20000468 = htobe32(0x2b); *(uint16_t*)0x2000046c = 6; STORE_BY_BITMASK(uint16_t, , 0x2000046e, 5, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000046f, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000046f, 0, 7, 1); *(uint16_t*)0x20000470 = htobe16(0x4e24); *(uint16_t*)0x20000474 = 8; STORE_BY_BITMASK(uint16_t, , 0x20000476, 0xb, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000477, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000477, 0, 7, 1); *(uint32_t*)0x20000478 = htobe32(0x1f); *(uint16_t*)0x2000047c = 0x44; STORE_BY_BITMASK(uint16_t, , 0x2000047e, 7, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000047f, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000047f, 1, 7, 1); *(uint16_t*)0x20000480 = 0x18; STORE_BY_BITMASK(uint16_t, , 0x20000482, 1, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000483, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000483, 1, 7, 1); *(uint16_t*)0x20000484 = 0x14; STORE_BY_BITMASK(uint16_t, , 0x20000486, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x20000487, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x20000487, 0, 7, 1); *(uint8_t*)0x20000488 = -1; *(uint8_t*)0x20000489 = 2; *(uint8_t*)0x2000048a = 0; *(uint8_t*)0x2000048b = 0; *(uint8_t*)0x2000048c = 0; *(uint8_t*)0x2000048d = 0; *(uint8_t*)0x2000048e = 0; *(uint8_t*)0x2000048f = 0; *(uint8_t*)0x20000490 = 0; *(uint8_t*)0x20000491 = 0; *(uint8_t*)0x20000492 = 0; *(uint8_t*)0x20000493 = 0; *(uint8_t*)0x20000494 = 0; *(uint8_t*)0x20000495 = 0; *(uint8_t*)0x20000496 = 0; *(uint8_t*)0x20000497 = 1; *(uint16_t*)0x20000498 = 0x18; STORE_BY_BITMASK(uint16_t, , 0x2000049a, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000049b, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000049b, 1, 7, 1); *(uint16_t*)0x2000049c = 0x14; STORE_BY_BITMASK(uint16_t, , 0x2000049e, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000049f, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000049f, 0, 7, 1); *(uint8_t*)0x200004a0 = 0xfe; *(uint8_t*)0x200004a1 = 0x80; *(uint8_t*)0x200004a2 = 0; *(uint8_t*)0x200004a3 = 0; *(uint8_t*)0x200004a4 = 0; *(uint8_t*)0x200004a5 = 0; *(uint8_t*)0x200004a6 = 0; *(uint8_t*)0x200004a7 = 0; *(uint8_t*)0x200004a8 = 0; *(uint8_t*)0x200004a9 = 0; *(uint8_t*)0x200004aa = 0; *(uint8_t*)0x200004ab = 0; *(uint8_t*)0x200004ac = 0; *(uint8_t*)0x200004ad = 0; *(uint8_t*)0x200004ae = 0; *(uint8_t*)0x200004af = 0xa; *(uint16_t*)0x200004b0 = 8; STORE_BY_BITMASK(uint16_t, , 0x200004b2, 9, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200004b3, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200004b3, 0, 7, 1); *(uint32_t*)0x200004b4 = htobe32(0x9b); *(uint16_t*)0x200004b8 = 8; STORE_BY_BITMASK(uint16_t, , 0x200004ba, 6, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x200004bb, 1, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x200004bb, 0, 7, 1); *(uint32_t*)0x200004bc = htobe32(0x80); *(uint64_t*)0x200004c8 = 0x100; *(uint64_t*)0x20000518 = 1; *(uint64_t*)0x20000520 = 0; *(uint64_t*)0x20000528 = 0; *(uint32_t*)0x20000530 = 0x40000; syscall(__NR_sendmsg, r[1], 0x20000500ul, 0ul); break; } } int main(void) { syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0); loop(); return 0; }
the_stack_data/150141042.c
int findMin(int* nums, int numsSize) { int left = 0, right = numsSize-1, pivot = right / 2; while (right-left > 1){ if (nums[pivot] > nums[left]){ if (nums[right] >= nums[pivot]) return nums[left]; left = pivot; pivot = (left + right) / 2; } else if (nums[pivot] == nums[left]){ while (++left < pivot && nums[left] == nums[pivot]); if (left<pivot) return nums[left]<nums[pivot] ? nums[left] : nums[pivot]; /*if(nums[left]<nums[pivot]) return nums[left]; else return nums[pivot];*/ /* while (++left < pivot){ if(nums[left] == nums[pivot]) continue; else if(nums[left] < nums[pivot]) return nums[left]; else return nums[pivot]; }*/ left = pivot; pivot = (left + right) / 2; } else{ right = pivot; pivot = (left + right) / 2; } } //pivot = nums[pivot] <= nums[left] ? pivot : left; //return nums[pivot] <= nums[right] ? nums[pivot] : nums[right]; if(nums[pivot] <= nums[left]){ if(nums[pivot] <= nums[right]) return nums[pivot]; else return nums[right]; } else{ if(nums[left] <= nums[right]) return nums[left]; else return nums[right]; } }
the_stack_data/114417.c
#include <stdio.h> /* printf */ #include <math.h> /* tan */ #include <stdlib.h> #define PI 3.141592654 int main () { double a, b, c, h; while(scanf("%lf %lf %lf", &a, &b, &c)!=EOF) { h = tan ( a * PI / 180.0 )*b + c; h = h*5; printf("%.2lf\n",h); } return 0; }
the_stack_data/133351.c
/* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used * to endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <sys/wait.h> #ifdef LOSCFG_QUICK_START #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <fcntl.h> #include <sys/ioctl.h> #define QUICKSTART_IOC_MAGIC 'T' #define QUICKSTART_INITSTEP2 _IO(QUICKSTART_IOC_MAGIC, 0) #define WAIT_FOR_SAMPLE 300000 // wait 300ms for sample #endif int main(int argc, char * const *argv) { int ret; const char *shellPath = "/bin/shell"; #ifdef LOSCFG_QUICK_START const char *samplePath = "/dev/shm/sample_quickstart"; ret = fork(); if (ret < 0) { printf("Failed to fork for sample_quickstart\n"); } else if (ret == 0) { (void)execve(samplePath, NULL, NULL); exit(0); } usleep(WAIT_FOR_SAMPLE); int fd = open("/dev/quickstart", O_RDONLY); if (fd != -1) { ioctl(fd, QUICKSTART_INITSTEP2); close(fd); } #endif ret = fork(); if (ret < 0) { printf("Failed to fork for shell\n"); } else if (ret == 0) { (void)execve(shellPath, NULL, NULL); exit(0); } while (1) { ret = waitpid(-1, 0, WNOHANG); if (ret == 0) { sleep(1); } }; }
the_stack_data/220454883.c
/** * exact-autotrace.c * * Copyright (c) 2020 Darren Embry * * GPL2. */ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #define EXACT_AUTOTRACE_MODE_DATA 0 #define EXACT_AUTOTRACE_MODE_EPS 1 /* platform dependent */ void exact_autotrace_init(char *); void exact_autotrace_cleanup(); unsigned char exact_autotrace_pixel_value(int x, int y); /* independent */ void exact_autotrace(char *); void exact_autotrace_output_start(); void exact_autotrace_output_pixel(int x, int y); void exact_autotrace_output_end(); int exact_autotrace_puts(int mode, const char* s); int exact_autotrace_printf(int mode, const char* format, ...); int exact_autotrace_echo_mode(int mode); int exact_autotrace_verbose = 0; int main(int argc, char **argv) { if (getenv("EXACT_AUTOTRACE_VERBOSE")) { exact_autotrace_verbose = atoi(getenv("EXACT_AUTOTRACE_VERBOSE")); } argc -= 1; argv += 1; if (argc < 1) { fprintf(stderr, "no filename argument\n"); exit(1); } if (exact_autotrace_verbose) { fprintf(stderr, "exact-autotrace:"); for (int i = 0; i < argc; i += 1) { fprintf(stderr, " %s", argv[i]); } fprintf(stderr, "\n"); } char *filename = argv[argc - 1]; if (exact_autotrace_verbose) { fprintf(stderr, "exact-autotrace: filename = %s\n", filename); } exact_autotrace(filename); if (exact_autotrace_verbose) { fprintf(stderr, "exact-autotrace: done\n"); fflush(stderr); } } int exact_autotrace_width = 0; int exact_autotrace_height = 0; void exact_autotrace_output_start() { exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%!PS-Adobe-3.0 EPSF-3.0"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%Creator: Adobe Illustrator by AutoTrace version 0.31.1"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%Title: "); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%CreationDate: Thu Aug 28 08:09:29 2014"); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_EPS, "%%BoundingBox: 0 0 %d %d\n", exact_autotrace_width, exact_autotrace_height); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%DocumentData: Clean7Bit"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%EndComments"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%BeginProlog"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/bd { bind def } bind def"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/incompound false def"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/m { moveto } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/l { lineto } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/c { curveto } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/F { incompound not {fill} if } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/f { closepath F } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/S { stroke } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/*u { /incompound true def } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/*U { /incompound false def f} bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/k { setcmykcolor } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "/K { k } bd"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%EndProlog"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%BeginSetup"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%EndSetup"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "0.000 0.000 0.000 0.498 k"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "*u"); } void exact_autotrace_output_pixel(int x, int y) { exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d m\n", x, y); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d l\n", x, y + 1); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d l\n", x + 1, y + 1); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d l\n", x + 1, y); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d l\n", x, y); } void exact_autotrace_output_horizontal_pixel_block(int x, int x2, int y) { exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d m\n", x, y); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d l\n", x, y + 1); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d l\n", x2 + 1, y + 1); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d l\n", x2 + 1, y); exact_autotrace_printf(EXACT_AUTOTRACE_MODE_DATA, "%d %d l\n", x, y); } void exact_autotrace_output_end() { exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "*U"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%Trailer"); exact_autotrace_puts(EXACT_AUTOTRACE_MODE_EPS, "%%EOF"); } int lavg; void exact_autotrace_collect() { int l, lmax, lmin, y, x; for (y = 0; y < exact_autotrace_height; y += 1) { if (getenv("EXACT_AUTOTRACE_DEBUG")) { fprintf(stderr, "exact_autotrace_collect: y = %4d:", y); } for (x = 0; x < exact_autotrace_width; x += 1) { l = exact_autotrace_pixel_value(x, y); if (getenv("EXACT_AUTOTRACE_DEBUG")) { fprintf(stderr, " %3d", l); } if (x == 0 && y == 0) { lmin = lmax = l; } else { if (lmin > l) { lmin = l; } if (lmax < l) { lmax = l; } } } if (getenv("EXACT_AUTOTRACE_DEBUG")) { putc('\n', stderr); } } /* * actual data has black pixels 128, white pixels 255. * */ if (lmin == 128 && lmax == 128) { /* all black pixels */ lmin = 128; lmax = 255; } else if (lmin == 255 && lmax == 255) { /* all white pixels */ lmin = 128; lmax = 255; } lavg = (lmin + lmax) / 2; if (getenv("EXACT_AUTOTRACE_DEBUG")) { fprintf(stderr, "exact_autotrace_collect: lmin = %d; lmax = %d; lavg = %d\n", lmin, lmax, lavg); } } /** * output each black pixel separately */ void exact_autotrace_run_brute_force() { exact_autotrace_output_start(); int y, x, l; for (y = 0; y < exact_autotrace_height; y += 1) { for (x = 0; x < exact_autotrace_width; x += 1) { l = exact_autotrace_pixel_value(x, y); if (l < lavg) { /* black pixel */ if (getenv("EXACT_AUTOTRACE_DEBUG")) { fprintf(stderr, "exact_autotrace_run_brute_force: pixel (%d, %d)\n", x, exact_autotrace_height - 1 - y); } exact_autotrace_output_pixel(x, exact_autotrace_height - 1 - y); } } } exact_autotrace_output_end(); } /** * save some space by finding rows of black pixels */ void exact_autotrace_run_2() { exact_autotrace_output_start(); int y, x, x2, l; for (y = 0; y < exact_autotrace_height; y += 1) { for (x = 0; x < exact_autotrace_width; x += 1) { l = exact_autotrace_pixel_value(x, y); if (l < lavg) { /* black pixel */ for (x2 = x + 1; x2 < exact_autotrace_width && (l = exact_autotrace_pixel_value(x2, y)) < lavg; x2 += 1) { } x2 -= 1; if (getenv("EXACT_AUTOTRACE_DEBUG")) { fprintf(stderr, "exact_autotrace_run_2: pixel block (%d to %d, %d)\n", x, x2, exact_autotrace_height - 1 - y); } exact_autotrace_output_horizontal_pixel_block(x, x2, exact_autotrace_height - 1 - y); x = x2 + 1; } } } exact_autotrace_output_end(); } void exact_autotrace(char *filename) { exact_autotrace_init(filename); if (exact_autotrace_verbose) { fprintf(stderr, "exact-autotrace: %s, %d x %d\n", filename, exact_autotrace_width, exact_autotrace_height); } exact_autotrace_collect(); exact_autotrace_run_2(); exact_autotrace_cleanup(); if (exact_autotrace_verbose) { fprintf(stderr, "exact-autotrace: done\n"); } } int exact_autotrace_puts(int mode, const char* s) { int result = puts(s); if (exact_autotrace_echo_mode(mode)) { fputs(s, stderr); fputc('\n', stderr); } return result; } int exact_autotrace_printf(int mode, const char* format, ...) { va_list myargs; va_start(myargs, format); int result = vprintf(format, myargs); va_end(myargs); va_start(myargs, format); if (exact_autotrace_echo_mode(mode)) { vfprintf(stderr, format, myargs); } va_end(myargs); return result; } int exact_autotrace_echo_mode(int mode) { switch (mode) { case EXACT_AUTOTRACE_MODE_DATA: return (getenv("EXACT_AUTOTRACE_ECHO") || getenv("EXACT_AUTOTRACE_ECHO_DATA")) ? 1 : 0; case EXACT_AUTOTRACE_MODE_EPS: return getenv("EXACT_AUTOTRACE_ECHO") ? 1 : 0; } return 0; }
the_stack_data/43887803.c
/* Write a program to print a histogram of the frequencies of different * characters in its input */ #include <stdio.h> int main(void) { int chars[128]; int c; int charfill; int i; /* array of 128 0s, to count occurance of each char */ for ( charfill = 0; charfill < 127; charfill++) { chars[charfill] = 0; } while ((c = getchar()) != EOF) { chars[c]++; } printf("\n"); for ( i = 0; i < 128; i++) { if (chars[i]) { printf("%c: ", i); while (chars[i]) { printf("|"); chars[i]--; } printf("\n"); } } return 0; }
the_stack_data/179831929.c
#ifdef _WIN32 #include <math.h> #include <stdlib.h> #define RAND48_SEED_0 (0x330e) #define RAND48_SEED_1 (0xabcd) #define RAND48_SEED_2 (0x1234) #define RAND48_MULT_0 (0xe66d) #define RAND48_MULT_1 (0xdeec) #define RAND48_MULT_2 (0x0005) #define RAND48_ADD (0x000b) unsigned short _rand48_seed[3] = { RAND48_SEED_0, RAND48_SEED_1, RAND48_SEED_2 }; unsigned short _rand48_mult[3] = { RAND48_MULT_0, RAND48_MULT_1, RAND48_MULT_2 }; unsigned short _rand48_add = RAND48_ADD; void _dorand48(unsigned short xseed[3]) { unsigned long accu; unsigned short temp[2]; accu = (unsigned long) _rand48_mult[0] * (unsigned long) xseed[0] + (unsigned long) _rand48_add; temp[0] = (unsigned short) accu; /* lower 16 bits */ accu >>= sizeof(unsigned short) * 8; accu += (unsigned long) _rand48_mult[0] * (unsigned long) xseed[1] + (unsigned long) _rand48_mult[1] * (unsigned long) xseed[0]; temp[1] = (unsigned short) accu; /* middle 16 bits */ accu >>= sizeof(unsigned short) * 8; accu += _rand48_mult[0] * xseed[2] + _rand48_mult[1] * xseed[1] + _rand48_mult[2] * xseed[0]; xseed[0] = temp[0]; xseed[1] = temp[1]; xseed[2] = (unsigned short) accu; } double erand48(unsigned short xseed[3]) { _dorand48(xseed); return ldexp((double) xseed[0], -48) + ldexp((double) xseed[1], -32) + ldexp((double) xseed[2], -16); } double drand48(void) { return erand48(_rand48_seed); } void srand48(long seed) { _rand48_seed[0] = RAND48_SEED_0; _rand48_seed[1] = (unsigned short) seed; _rand48_seed[2] = (unsigned short) (seed >> 16); _rand48_mult[0] = RAND48_MULT_0; _rand48_mult[1] = RAND48_MULT_1; _rand48_mult[2] = RAND48_MULT_2; _rand48_add = RAND48_ADD; } #else // _WIN32 #include <stdlib.h> #endif // _WIN32 #ifdef DRIVER /* This should print the sequences of integers in Tables 2 and 1 of the TM: 1623, 3442, 1447, 1829, 1305, ... 657EB7255101, D72A0C966378, 5A743C062A23, ... */ #include <stdio.h> main() { int i; srand48(10); for (i = 0; i < 80; i++) { printf("%4d ", (int)(4096 * drand48())); //printf("%.4X%.4X%.4X\n", x[2], x[1], x[0]); } } #endif
the_stack_data/1032873.c
static int a; extern int c; int foo() { static int b; b = 1; return b; } int c; int main() { extern int a; static int b; { static int a = 2; b = a; } c = 1; return a + b + c + foo(); } int c; static int a = 3;
the_stack_data/182954190.c
#include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #define MAX_CONNECTIONS 16 #define MSG_IN "IN" #define MSG_OUT "OUT" #define MSG_OK "OK" static int start_server(char *server_port) { int server_socket; int status; struct addrinfo hints; struct addrinfo *server_info; int yes = 1; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; // IPv4 or IPv6 hints.ai_socktype = SOCK_STREAM; // TCP stream sockets hints.ai_flags = AI_PASSIVE; // Fill own IP automatically status = getaddrinfo(NULL, server_port, &hints, &server_info); if (status != 0) { fprintf(stderr, "--- getaddrinfo error: %s\n", gai_strerror(status)); return 1; } server_socket = socket(server_info->ai_family, server_info->ai_socktype, server_info->ai_protocol); if (server_socket < 0) { fprintf(stderr, "--- socket error: %s\n", strerror(errno)); return -2; } status = setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)); if (status < 0) { fprintf(stderr, "--- setsockopt error: %s\n", strerror(errno)); return -3; } status = bind(server_socket, server_info->ai_addr, server_info->ai_addrlen); if (status < 0) { fprintf(stderr, "--- bind error: %s\n", strerror(errno)); return -4; } freeaddrinfo(server_info); return server_socket; } int server_loop(int server_socket, char *server_port) { fd_set read_set, master_set; int rc = 0; int it, broadcast_it; int selected = 0; int select_max; char buffer[256]; FD_ZERO(&read_set); FD_ZERO(&master_set); rc = listen(server_socket, MAX_CONNECTIONS); if (rc < 0) { rc = errno; fprintf(stderr, "--- listen error: %s\n", strerror(rc)); return -1; } printf("+++ Listening on port '%s' ...\n", server_port); FD_SET(server_socket, &master_set); select_max = server_socket; for (;;) { memset(buffer, 0, sizeof(buffer)); read_set = master_set; selected = select(select_max + 1, &read_set, NULL, NULL, NULL); if (selected < 0) { rc = errno; fprintf(stderr, "--- select error: %s\n", strerror(errno)); return rc; } for (it = 0; it <= select_max; it++) { if (!FD_ISSET(it, &read_set)) { continue; } if (it == server_socket) { struct sockaddr_storage remote_address; socklen_t address_length = sizeof(remote_address); int client_socket = accept(server_socket, (struct sockaddr *)&remote_address, &address_length); if (client_socket < 0) { fprintf(stderr, "--- accept error: %s\n", strerror(errno)); continue; } FD_SET(client_socket, &master_set); if (client_socket > select_max) { select_max = client_socket; } printf(">>> Client %d connected.\n", client_socket); } else { int bytes = recv(it, buffer, sizeof(buffer), 0); if (bytes <= 0) { if (bytes == 0) { // connection closed printf("<<< Client %d disconnected.\n", it); } else { fprintf(stderr, "--- recv error: %s\n", strerror(errno)); } close(it); FD_CLR(it, &master_set); continue; } // broadcast the received data printf("%d: %s", it, buffer); for (broadcast_it = 0; broadcast_it <= select_max; broadcast_it++) { if (!FD_ISSET(broadcast_it, &master_set)) { continue; } if (broadcast_it == it || broadcast_it == server_socket) { continue; } if (send(broadcast_it, buffer, bytes, 0) < -1) { fprintf(stderr, "--- send error: %s\n", strerror(errno)); } } } } }; return rc; } int main(int argc, char *argv[]) { int server_socket; int rc = 0; if (argc < 2) { fprintf(stderr, "usage: %s <port>\n", argv[0]); return -1; } server_socket = start_server(argv[1]); if (server_socket < 0) { return server_socket; } return server_loop(server_socket, argv[1]); }
the_stack_data/178265589.c
/* Copyright 2001, 2002 Georges Menie (www.menie.org) Floating Point additions and other modifications by Coridium Corp 2007 www.coridium.us 2018 -- fixed rounding changing format error -- Coridium This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // #define USE_FLOAT // enables floating point formats #ifdef FOR_BASIC // BASIC doesn't use the length of characters printed #define ADD2CharCnt #define INCCharCnt #define CharCntPLUS #include "basic_pcb.h" #else #define ADD2CharCnt CharCnt+= #define INCCharCnt ++CharCnt #define CharCntPLUS CharCnt+ #endif #include "printf.h" int puts(char *s) { char lastc = 0; while (*s) { lastc = outbyte(*s); s++; } return lastc; } static void printchar(char **str, int c) { // extern int outbyte(int c); if (str) { **str = c; ++(*str); } else (void)outbyte(c); } #define PAD_RIGHT 1 #define PAD_ZERO 2 static int prints(char **out, const char *string, int width, int pad) { int CharCnt = 0, padchar = ' '; if (width > 0) { int len = 0; const char *ptr; for (ptr = string; *ptr; ++ptr) ++len; if (len >= width) width = 0; else width -= len; if (pad & PAD_ZERO) padchar = '0'; } if (!(pad & PAD_RIGHT)) { for ( ; width > 0; --width) { printchar (out, padchar); INCCharCnt; } } for ( ; *string ; ++string) { printchar (out, *string); INCCharCnt; } for ( ; width > 0; --width) { printchar (out, padchar); INCCharCnt; } return CharCnt; } /* the following should be enough for 32 bit int */ #define PRINT_BUF_LEN 14 #ifdef FOR_BASIC extern char dec0x80000000[]; //"2147483648" // extern char hex0x80000000[]; //"80000000" #endif static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase) { char print_buf[PRINT_BUF_LEN]; char *s; int t, neg = 0; #ifdef FOR_BASIC int u = i; // using only signed divide saves lot of code... more than the special case below if ((i == 0x80000000) && (b == 10)) { printchar (out, '-'); INCCharCnt; --width; return prints (out, dec0x80000000, width, pad); } #else int CharCnt = 0; unsigned int u = i; #endif if (i == 0) { print_buf[0] = '0'; print_buf[1] = '\0'; return prints (out, print_buf, width, pad); } if (sg && b == 10 && i < 0) { neg = 1; u = -i; } s = print_buf + PRINT_BUF_LEN-1; *s = '\0'; if (b == 16) { t = u & 0xF; if( t >= 10 ) t += letbase - '0' - 10; *--s = t + '0'; u = (u >> 4) & 0x0FFFFFFF; } while (u) { t = u % b; if( t >= 10 ) t += letbase - '0' - 10; *--s = t + '0'; u /= b; } if (neg) { if( width && (pad & PAD_ZERO) ) { printchar (out, '-'); INCCharCnt; --width; } else { *--s = '-'; } } return CharCntPLUS prints (out, s, width, pad); } #ifdef USE_FLOAT //float flt4print; // normalized value is built here d.dddddd union{ int i; float f; } flt4print; int flt_log10(char **out,float fp, int width, int pad) { // returns the integer portion of log10 of x int exp,j; // or -99 for NaN flt4print.f = fp; j = flt4print.i; if (j & 0x80000000) { flt4print.f = -flt4print.f; printchar (out, '-'); } if( (j & 0x7F800000) == 0x7F800000) { if (j & 0x007FFFFF) prints(out, "NaN", width, pad); else prints(out, "Inf", width, pad); return -99; } exp = (j & 0x3F800000) >> 23; if ((j & (1<<30))==0) exp -= 128; // find the rough log2 of x exp = exp / (float) 3.321928095; // convert to rough log10 of x j = exp; if (exp > 0) { while (j--) flt4print.f /= 10; } else if (exp < 0) { while (j++) flt4print.f *= 10; } if (flt4print.f >= 10) { // adjust log10 exp++; flt4print.f /= 10; } if (flt4print.f < 1) { exp--; flt4print.f *= 10; } return exp; } int scalebyprec (int prec) { int mult = 1; while (prec-- > 0) mult *= 10; return mult; } char flt_digit_rollover; #ifdef FOR_BASIC extern char g_ROUND_PRINT; #else #define g_ROUND_PRINT 0 // set to 1 to round printf for float #endif int printflt (char **out, float x, int width, int prec, int pad, int doEnum) { int M, N, CharCnt=0; int mult, exp, scale=0; exp = flt_log10(out, x, width, pad); // find the base10 exponent and print - sign if (exp == -99) return 3; if (x < 0) { x = -x; INCCharCnt; } if (x > (float) 4294967295.0) { scale = exp - 6; x = x / scalebyprec(scale); mult = 1; } else mult = scalebyprec(prec+1); M = (int) x; N = (int) ((x - M)*mult); if (g_ROUND_PRINT) { // in BASIC this is a compiler flag, in C a #define normally 0 // printchar (out, '['); printi (out, M, 10, 1, width, pad, 'a'); printchar (out, ':'); printi (out, N, 10, 1, width, pad, 'a'); printchar (out, ']'); N += 5; if (N >= mult) { M++; N=0; if (doEnum) { if (M>=10) { M /= 10; flt_digit_rollover = 1; } // } else prec--; // bug reported by user when rounding rollover happens } } } N /= 10; ADD2CharCnt printi (out, M, 10, 1, width, pad, 'a'); while (scale--) { printchar (out, '0'); INCCharCnt; } printchar (out, '.'); INCCharCnt; if (prec>0) ADD2CharCnt printi (out, N, 10, 1, prec, PAD_ZERO, 'a'); return CharCnt; } int printEnote (char **out, float x, int width, int prec, int pad, char Echar) { union{ int i; float f; } fp; // float fp = x; int exp, CharCnt = 0; fp.f = x; flt_digit_rollover = 0; #ifndef FOR_BASIC if (fp.f < 0) INCCharCnt; #endif exp = flt_log10(out, fp.f, width, pad); // find the base10 exponent if (exp == -99) return 3; ADD2CharCnt printflt (out, flt4print.f, 1, prec, pad, 1); if ((fp.i & 0x7ffffFFFF) == 0) return CharCnt; printchar (out, Echar); INCCharCnt; if (flt_digit_rollover) { exp++; } if (exp >= 0) { printchar (out, '+'); INCCharCnt; } else { printchar (out, '-'); INCCharCnt; exp = -exp; // want to see E-02 and the like } ADD2CharCnt printi (out, exp, 10, 1, 2, PAD_ZERO, 'a'); return CharCnt; } #ifdef FOR_BASIC extern char g_BASIC_PRINT; // this 1 when called from PRINT, 0 when PRINTF #else #define g_BASIC_PRINT 0 #endif int printGnote (char **out, float x, int width, int prec, int pad, char Gchar) { float fp = x; int i=1; if (fp < 0) fp = -fp; if((fp < (float) 0.1) || (fp >= (float) 10000000)) return printEnote(out, x, width, prec, pad,Gchar); else { if (g_BASIC_PRINT) { prec++; while (fp > i){ prec--; i *= 10; } } return printflt (out, x, width, prec, pad, 0); } } #endif int f_sprintf(char **out, int *varg) // need to use it in BASIC { int width, pad, prec; int CharCnt = 0; char *format = (char *)(*varg++); char scr[2]; for (; *format != 0; ++format) { if (*format == '%') { ++format; width = prec = pad = 0; if (*format == '\0') break; if (*format == '%') goto outc; if (*format == '-') { ++format; pad = PAD_RIGHT; } while (*format == '0') { ++format; pad |= PAD_ZERO; } for ( ; *format >= '0' && *format <= '9'; ++format) { width *= 10; width += *format - '0'; } #ifdef USE_FLOAT if( *format == '.' ) { ++format; if (*format >= '0' && *format <= '9') { prec += *format++ - '0'; // get real more than 9 digits ?? -- actually breaks at 8 for now prec = (prec>8)? 8 : prec; // to fix this is not worth the time at the moment } } if( *format == 'f' ) { ADD2CharCnt printflt (out, *(float*)varg++, width, prec, pad, 0); continue; } if(( *format == 'E' ) || ( *format == 'e' )) { ADD2CharCnt printEnote (out, *(float*)varg++, width, prec, pad, *format); continue; } if(( *format == 'G' ) || ( *format == 'g' )) { ADD2CharCnt printGnote (out, *(float*)varg++, width, prec, pad, *format - 2); continue; } #endif if( *format == 's' ) { char *s = *((char **)varg++); ADD2CharCnt prints (out, s?s:"(null)", width, pad); continue; } if( *format == 'd' ) { ADD2CharCnt printi (out, *varg++, 10, 1, width, pad, 'a'); continue; } if(( *format == 'x' ) || ( *format == 'X' )) { ADD2CharCnt printi (out, *varg++, 16, 0, width, pad, *format - 23); continue; } #ifndef FOR_BASIC if( *format == 'u' ) { ADD2CharCnt printi (out, *varg++, 10, 0, width, pad, 'a'); continue; } #endif if( *format == 'c' ) { /* char are converted to int then pushed on the stack */ scr[0] = *varg++; scr[1] = '\0'; ADD2CharCnt prints (out, scr, width, pad); continue; } } else { outc: printchar (out, *format); INCCharCnt; } } if (out) **out = '\0'; return CharCnt; } /* assuming sizeof(void *) == sizeof(int) */ int printf(const char *format, ...) { int *varg = (int *)(&format); return f_sprintf(0, varg); } int sprintf(char *out, const char *format, ...) { int *varg = (int *)(&format); return f_sprintf(&out, varg); } #ifdef TEST_PRINTF int main(void) { char *ptr = "Hello world!"; char *np = 0; int i = 5; unsigned int bs = sizeof(int)*8; int mi; char buf[80]; mi = (1 << (bs-1)) + 1; printf("%s\n", ptr); printf("printf test\n"); printf("%s is null pointer\n", np); printf("%d = 5\n", i); printf("%d = - max int\n", mi); printf("char %c = 'a'\n", 'a'); printf("hex %x = ff\n", 0xff); printf("hex %02x = 00\n", 0); printf("signed %d = unsigned %u = hex %x\n", -3, -3, -3); printf("%d %s(s)%", 0, "message"); printf("\n"); printf("%d %s(s) with %%\n", 0, "message"); sprintf(buf, "justif: \"%-10s\"\n", "left"); printf("%s", buf); sprintf(buf, "justif: \"%10s\"\n", "right"); printf("%s", buf); sprintf(buf, " 3: %04d zero padded\n", 3); printf("%s", buf); sprintf(buf, " 3: %-4d left justif.\n", 3); printf("%s", buf); sprintf(buf, " 3: %4d right justif.\n", 3); printf("%s", buf); sprintf(buf, "-3: %04d zero padded\n", -3); printf("%s", buf); sprintf(buf, "-3: %-4d left justif.\n", -3); printf("%s", buf); sprintf(buf, "-3: %4d right justif.\n", -3); printf("%s", buf); return 0; } /* * if you compile this file with * gcc -Wall $(YOUR_C_OPTIONS) -DTEST_PRINTF -c printf.c * you will get a normal warning: * printf.c:214: warning: spurious trailing `%' in format * this line is testing an invalid % at the end of the format string. * * this should display (on 32bit int machine) : * * Hello world! * printf test * (null) is null pointer * 5 = 5 * -2147483647 = - max int * char a = 'a' * hex ff = ff * hex 00 = 00 * signed -3 = unsigned 4294967293 = hex fffffffd * 0 message(s) * 0 message(s) with % * justif: "left " * justif: " right" * 3: 0003 zero padded * 3: 3 left justif. * 3: 3 right justif. * -3: -003 zero padded * -3: -3 left justif. * -3: -3 right justif. */ #endif
the_stack_data/483202.c
//@ ltl invariant positive: <>([]AP(error != 1)); /* Provide Declarations */ #include <stdarg.h> #include <setjmp.h> #include <limits.h> #include <stdint.h> struct l_struct_union_OC_anon; struct l_struct_struct_OC_ArchState; struct l_struct_struct_OC_uint64v8_t; struct l_struct_union_OC_vec512_t; struct l_struct_union_OC_VectorReg; struct l_struct_struct_OC_ArithFlags; struct l_struct_union_OC_SegmentSelector; struct l_struct_struct_OC_Segments; struct l_struct_union_OC_anon_OC_1; struct l_struct_struct_OC_Reg; struct l_struct_struct_OC_AddressSpace; struct l_struct_struct_OC_GPR; struct l_struct_struct_OC_anon_OC_3; struct l_struct_struct_OC_X87Stack; struct l_struct_struct_OC_uint64v1_t; struct l_struct_union_OC_vec64_t; struct l_struct_struct_OC_anon_OC_4; struct l_struct_struct_OC_MMX; struct l_struct_struct_OC_FPUStatusFlags; struct l_struct_union_OC_FPUAbridgedTagWord; struct l_struct_struct_OC_float80_t; struct l_struct_union_OC_anon_OC_11; struct l_struct_struct_OC_FPUStackElem; struct l_struct_struct_OC_uint128v1_t; struct l_struct_union_OC_vec128_t; struct l_struct_struct_OC_FpuFXSAVE; /* Types Definitions */ struct l_array_8_ureplace_u8int { unsigned char array[8]; }; struct l_struct__fp_hw_type { struct l_array_8_ureplace_u8int field0; unsigned int field1; unsigned int field2; } ; struct l_array_4_ureplace_u8int { unsigned char array[4]; }; struct l_struct___DTOR_END___type { struct l_array_4_ureplace_u8int field0; } ; struct l_struct_seg_8049654__bss_type { struct l_array_4_ureplace_u8int field0; struct l_array_4_ureplace_u8int field1; struct l_array_4_ureplace_u8int field2; } ; struct l_struct_union_OC_anon { unsigned long field0; }; struct l_struct_struct_OC_ArchState { unsigned int field0; unsigned int field1; struct l_struct_union_OC_anon field2; }; struct l_array_8_ureplace_u64int { unsigned long array[8]; }; struct l_struct_struct_OC_uint64v8_t { struct l_array_8_ureplace_u64int field0; }; struct l_struct_union_OC_vec512_t { struct l_struct_struct_OC_uint64v8_t field0; }; struct l_struct_union_OC_VectorReg { struct l_struct_union_OC_vec512_t field0; }; struct l_array_32_struct_AC_l_struct_union_OC_VectorReg { struct l_struct_union_OC_VectorReg array[32]; }; struct l_struct_struct_OC_ArithFlags { unsigned char field0; unsigned char field1; unsigned char field2; unsigned char field3; unsigned char field4; unsigned char field5; unsigned char field6; unsigned char field7; unsigned char field8; unsigned char field9; unsigned char field10; unsigned char field11; unsigned char field12; unsigned char field13; unsigned char field14; unsigned char field15; }; struct l_struct_union_OC_SegmentSelector { unsigned short field0; }; struct l_struct_struct_OC_Segments { unsigned short field0; struct l_struct_union_OC_SegmentSelector field1; unsigned short field2; struct l_struct_union_OC_SegmentSelector field3; unsigned short field4; struct l_struct_union_OC_SegmentSelector field5; unsigned short field6; struct l_struct_union_OC_SegmentSelector field7; unsigned short field8; struct l_struct_union_OC_SegmentSelector field9; unsigned short field10; struct l_struct_union_OC_SegmentSelector field11; }; struct l_struct_union_OC_anon_OC_1 { unsigned int field0; }; struct l_struct_struct_OC_Reg { struct l_struct_union_OC_anon_OC_1 field0; unsigned int field1; }; struct l_struct_struct_OC_AddressSpace { unsigned long field0; struct l_struct_struct_OC_Reg field1; unsigned long field2; struct l_struct_struct_OC_Reg field3; unsigned long field4; struct l_struct_struct_OC_Reg field5; unsigned long field6; struct l_struct_struct_OC_Reg field7; unsigned long field8; struct l_struct_struct_OC_Reg field9; unsigned long field10; struct l_struct_struct_OC_Reg field11; }; struct l_struct_struct_OC_GPR { unsigned long field0; struct l_struct_struct_OC_Reg field1; unsigned long field2; struct l_struct_struct_OC_Reg field3; unsigned long field4; struct l_struct_struct_OC_Reg field5; unsigned long field6; struct l_struct_struct_OC_Reg field7; unsigned long field8; struct l_struct_struct_OC_Reg field9; unsigned long field10; struct l_struct_struct_OC_Reg field11; unsigned long field12; struct l_struct_struct_OC_Reg field13; unsigned long field14; struct l_struct_struct_OC_Reg field15; unsigned long field16; struct l_struct_struct_OC_Reg field17; unsigned long field18; struct l_struct_struct_OC_Reg field19; unsigned long field20; struct l_struct_struct_OC_Reg field21; unsigned long field22; struct l_struct_struct_OC_Reg field23; unsigned long field24; struct l_struct_struct_OC_Reg field25; unsigned long field26; struct l_struct_struct_OC_Reg field27; unsigned long field28; struct l_struct_struct_OC_Reg field29; unsigned long field30; struct l_struct_struct_OC_Reg field31; unsigned long field32; struct l_struct_struct_OC_Reg field33; }; struct l_struct_struct_OC_anon_OC_3 { unsigned long field0; double field1; }; struct l_array_8_struct_AC_l_struct_struct_OC_anon_OC_3 { struct l_struct_struct_OC_anon_OC_3 array[8]; }; struct l_struct_struct_OC_X87Stack { struct l_array_8_struct_AC_l_struct_struct_OC_anon_OC_3 field0; }; struct l_array_1_ureplace_u64int { unsigned long array[1]; }; struct l_struct_struct_OC_uint64v1_t { struct l_array_1_ureplace_u64int field0; }; struct l_struct_union_OC_vec64_t { struct l_struct_struct_OC_uint64v1_t field0; }; struct l_struct_struct_OC_anon_OC_4 { unsigned long field0; struct l_struct_union_OC_vec64_t field1; }; struct l_array_8_struct_AC_l_struct_struct_OC_anon_OC_4 { struct l_struct_struct_OC_anon_OC_4 array[8]; }; struct l_struct_struct_OC_MMX { struct l_array_8_struct_AC_l_struct_struct_OC_anon_OC_4 field0; }; struct l_struct_struct_OC_FPUStatusFlags { unsigned char field0; unsigned char field1; unsigned char field2; unsigned char field3; unsigned char field4; unsigned char field5; unsigned char field6; unsigned char field7; unsigned char field8; unsigned char field9; unsigned char field10; unsigned char field11; unsigned char field12; unsigned char field13; unsigned char field14; unsigned char field15; unsigned char field16; unsigned char field17; unsigned char field18; unsigned char field19; struct l_array_4_ureplace_u8int field20; }; struct l_struct_union_OC_FPUAbridgedTagWord { unsigned char field0; }; struct l_array_10_ureplace_u8int { unsigned char array[10]; }; struct l_struct_struct_OC_float80_t { struct l_array_10_ureplace_u8int field0; }; struct l_struct_union_OC_anon_OC_11 { struct l_struct_struct_OC_float80_t field0; }; struct l_array_6_ureplace_u8int { unsigned char array[6]; }; struct l_struct_struct_OC_FPUStackElem { struct l_struct_union_OC_anon_OC_11 field0; struct l_array_6_ureplace_u8int field1; }; struct l_array_8_struct_AC_l_struct_struct_OC_FPUStackElem { struct l_struct_struct_OC_FPUStackElem array[8]; }; struct l_array_96_ureplace_u8int { unsigned char array[96]; }; struct l_struct_struct_OC_SegmentShadow { struct l_struct_union_OC_anon field0; unsigned int field1; unsigned int field2; }; struct l_struct_struct_OC_SegmentCaches { struct l_struct_struct_OC_SegmentShadow field0; struct l_struct_struct_OC_SegmentShadow field1; struct l_struct_struct_OC_SegmentShadow field2; struct l_struct_struct_OC_SegmentShadow field3; struct l_struct_struct_OC_SegmentShadow field4; struct l_struct_struct_OC_SegmentShadow field5; }; struct l_struct_struct_OC_State { struct l_struct_struct_OC_ArchState field0; struct l_array_32_struct_AC_l_struct_union_OC_VectorReg field1; struct l_struct_struct_OC_ArithFlags field2; struct l_struct_union_OC_anon field3; struct l_struct_struct_OC_Segments field4; struct l_struct_struct_OC_AddressSpace field5; struct l_struct_struct_OC_GPR field6; struct l_struct_struct_OC_X87Stack field7; struct l_struct_struct_OC_MMX field8; struct l_struct_struct_OC_FPUStatusFlags field9; struct l_struct_union_OC_anon field10; struct l_struct_struct_OC_SegmentCaches field12; }; /* External Global Variable Declarations */ int error = 0; /* Function Declarations */ extern void __VERIFIER_error() ; void* sub_8048374___VERIFIER_error(struct l_struct_struct_OC_State*, unsigned int, void*) ; void* dummy_main(struct l_struct_struct_OC_State*, unsigned int, void*) ; void __mcsema_constructor(void) ; void __mcsema_destructor(void) ; /* Global Variable Definitions and Initialization */ struct l_struct__fp_hw_type _fp_hw = { { { 3, 0, 0, 0, 1, 0, 2, 0 } }, 0, 0 }; struct l_struct___DTOR_END___type __DTOR_END__; static struct l_struct_seg_8049654__bss_type seg_8049654__bss; /* LLVM Intrinsic Builtin Function Bodies */ static unsigned int llvm_OC_ctpop_OC_i32(unsigned int x) { unsigned int c; for (c = 0; x != 0; x >>= 1) if (x & 1) c++; return c; } static unsigned int llvm_add_u32(unsigned int a, unsigned int b) { unsigned int r = a + b; return r; } static unsigned int llvm_lshr_u32(unsigned int a, unsigned int b) { unsigned int r = a >> b; return r; } static unsigned char llvm_and_u8(unsigned char a, unsigned char b) { unsigned char r = a & b; return r; } static unsigned char llvm_xor_u8(unsigned char a, unsigned char b) { unsigned char r = a ^ b; return r; } /* Function Bodies */ #define kStackSize (1UL<<20UL) char dummyStack[kStackSize]; struct l_struct_struct_OC_State global_state; struct l_struct_struct_OC_State* globalState = &global_state; int main(){ //struct l_struct_struct_OC_State *tmp = malloc(sizeof(struct l_struct_struct_OC_State)); //memset(tmp, 0, sizeof(struct l_struct_struct_OC_State)); struct l_struct_struct_OC_State *tmp = &global_state; // initialize the dummy stack tmp->field6.field13.field0.field0 = &dummyStack[kStackSize - 0x10]; tmp->field6.field15.field0.field0 = &dummyStack[kStackSize - 0x8]; (dummyStack[kStackSize - 0x10]) = (void*)0x40000000; // dummy return address // call func => push rip; jmp function addr dummy_main(tmp, (unsigned long)0, (void*)0); return 0; } void* sub_8048374___VERIFIER_error(struct l_struct_struct_OC_State* tmp__1, unsigned int tmp__2, void* tmp__3) { __VERIFIER_error(); error = 1; unsigned int* tmp__4; unsigned int* tmp__5; unsigned int tmp__6; unsigned int tmp__7; unsigned int tmp__8; unsigned int tmp__9; unsigned int* tmp__10; unsigned int tmp__11; unsigned int tmp__12; tmp__4 = (&tmp__1->field6.field13.field0.field0); tmp__5 = (&tmp__1->field6.field15.field0.field0); tmp__6 = *tmp__5; tmp__7 = *tmp__4; tmp__8 = *((&tmp__1->field5.field1.field0.field0)); tmp__9 = llvm_add_u32(tmp__8, tmp__7); tmp__10 = ((unsigned int*)(llvm_add_u32(tmp__9, -4))); *tmp__10 = tmp__6; *((&tmp__1->field6.field1.field0.field0)) = -1; tmp__11 = *tmp__10; *tmp__5 = tmp__11; tmp__12 = *(((unsigned int*)tmp__9)); *((&tmp__1->field6.field33.field0.field0)) = tmp__12; *tmp__4 = (llvm_add_u32(tmp__7, 4)); return tmp__3; } void* dummy_main(struct l_struct_struct_OC_State* tmp__13, unsigned int tmp__14, void* tmp__15) { unsigned int* tmp__16; unsigned int* tmp__17; unsigned int* tmp__18; unsigned int tmp__19; unsigned int tmp__20; unsigned int tmp__21; unsigned int* tmp__22; unsigned int tmp__23; unsigned int* tmp__24; unsigned int* tmp__25; unsigned int tmp__26; unsigned int* tmp__27; unsigned int tmp__28; unsigned int tmp__29; unsigned int tmp__30; void* tmp__31; unsigned int tmp__32; unsigned int tmp__33; unsigned int* _2e_pre; unsigned int* _2e_pre_2d_phi; unsigned int* _2e_pre_2d_phi__PHI_TEMPORARY; unsigned int tmp__34; unsigned int tmp__34__PHI_TEMPORARY; unsigned int tmp__35; unsigned int tmp__35__PHI_TEMPORARY; void* tmp__36; void* tmp__36__PHI_TEMPORARY; unsigned int tmp__37; unsigned int tmp__38; *((&_fp_hw.field2)) = (((unsigned int)(((unsigned int)((unsigned int)(&seg_8049654__bss))) + ((unsigned int)8)))); *((&_fp_hw.field1)) = (((unsigned int)(((unsigned int)((unsigned int)(&seg_8049654__bss))) + ((unsigned int)8)))); tmp__16 = (&tmp__13->field6.field13.field0.field0); tmp__17 = (&tmp__13->field6.field15.field0.field0); tmp__18 = (&tmp__13->field6.field33.field0.field0); tmp__19 = *tmp__17; tmp__20 = *tmp__16; tmp__21 = llvm_add_u32(tmp__20, -4); tmp__22 = (&tmp__13->field5.field1.field0.field0); tmp__23 = *tmp__22; tmp__24 = ((unsigned int*)(llvm_add_u32(tmp__23, tmp__21))); *tmp__24 = tmp__19; *tmp__17 = tmp__21; *((unsigned int*)(((unsigned int)(((unsigned int)((unsigned int)(&seg_8049654__bss))) + ((unsigned int)8))))) = 1; tmp__25 = *((unsigned int**)(((unsigned int)(((unsigned int)((unsigned int)(&_fp_hw))) + ((unsigned int)12))))); tmp__26 = *tmp__25; *((&tmp__13->field6.field7.field0.field0)) = tmp__26; tmp__27 = *((unsigned int**)(((unsigned int)(((unsigned int)((unsigned int)(&_fp_hw))) + ((unsigned int)8))))); *tmp__27 = tmp__26; *((&tmp__13->field6.field1.field0.field0)) = 0; tmp__28 = *((unsigned int*)(((unsigned int)(((unsigned int)((unsigned int)(&seg_8049654__bss))) + ((unsigned int)8))))); *((&tmp__13->field2.field1)) = 0; tmp__29 = /*tail*/ llvm_OC_ctpop_OC_i32((tmp__28 & 255)); *((&tmp__13->field2.field3)) = (llvm_xor_u8((llvm_and_u8((((unsigned char)tmp__29)), 1)), 1)); *((&tmp__13->field2.field5)) = 0; *((&tmp__13->field2.field7)) = (((unsigned char)(char)(((tmp__28 == 0u)&1)))); *((&tmp__13->field2.field9)) = (((unsigned char)(llvm_lshr_u32(tmp__28, 31)))); *((&tmp__13->field2.field13)) = 0; if ((((tmp__28 == 0u)&1))) { _2e_pre_2d_phi__PHI_TEMPORARY = tmp__24; /* for PHI node */ tmp__34__PHI_TEMPORARY = tmp__23; /* for PHI node */ tmp__35__PHI_TEMPORARY = tmp__21; /* for PHI node */ tmp__36__PHI_TEMPORARY = tmp__15; /* for PHI node */ goto block_80483ac; } else { goto block_80483a7; } block_80483a7: tmp__30 = llvm_add_u32(tmp__20, -8); *(((unsigned int*)(llvm_add_u32(tmp__23, tmp__30)))) = (llvm_add_u32(tmp__14, 46)); *tmp__16 = tmp__30; tmp__31 = /*tail*/ sub_8048374___VERIFIER_error(tmp__13, /*UNDEF*/0, tmp__15); tmp__32 = *tmp__16; tmp__33 = *tmp__22; _2e_pre = ((unsigned int*)(llvm_add_u32(tmp__33, tmp__32))); _2e_pre_2d_phi__PHI_TEMPORARY = _2e_pre; /* for PHI node */ tmp__34__PHI_TEMPORARY = tmp__33; /* for PHI node */ tmp__35__PHI_TEMPORARY = tmp__32; /* for PHI node */ tmp__36__PHI_TEMPORARY = tmp__31; /* for PHI node */ goto block_80483ac; block_80483ac: _2e_pre_2d_phi = _2e_pre_2d_phi__PHI_TEMPORARY; tmp__34 = tmp__34__PHI_TEMPORARY; tmp__35 = tmp__35__PHI_TEMPORARY; tmp__36 = tmp__36__PHI_TEMPORARY; tmp__37 = *_2e_pre_2d_phi; *tmp__17 = tmp__37; tmp__38 = *(((unsigned int*)(llvm_add_u32((llvm_add_u32(tmp__34, 4)), tmp__35)))); *tmp__18 = tmp__38; *tmp__16 = (llvm_add_u32(tmp__35, 8)); return tmp__36; }