From 163dcbd961d2ccf1070c89fe2adbc5408d3c367a Mon Sep 17 00:00:00 2001 From: Sergey Date: Sat, 21 Mar 2015 14:11:41 -0700 Subject: [PATCH] Branch "uflash" imported from GoogleCode. --- Makefile | 18 +- sdram-fpga.S | 755 - share/lccom/Makefile | 21 + share/lccom/hello.c | 6 + share/lccom/sys.s | 100 + share/smallc/Makefile | 27 + share/smallc/lib.c | 37 + share/smallc/primelist.c | 24 + share/smallc/primesum.c | 27 + share/smallc/sys.s | 159 + share/smallc/test1.c | 231 + share/smallc/test2.c | 150 + src/cmd/Makefile | 6 +- src/cmd/as/as.c | 43 +- src/cmd/cron/Makefile | 109 + src/cmd/cron/README | 72 + src/cmd/cron/README.2BSD | 58 + src/cmd/cron/bitstring.3 | 168 + src/cmd/cron/bitstring.h | 122 + src/cmd/cron/compat.c | 58 + src/cmd/cron/compat.h | 32 + src/cmd/cron/config.h | 86 + src/cmd/cron/cron.8 | 61 + src/cmd/cron/cron.c | 277 + src/cmd/cron/cron.h | 275 + src/cmd/cron/crontab.1 | 100 + src/cmd/cron/crontab.5 | 188 + src/cmd/cron/crontab.c | 586 + src/cmd/cron/database.c | 261 + src/cmd/cron/do_command.c | 433 + src/cmd/cron/entry.c | 504 + src/cmd/cron/env.c | 178 + src/cmd/cron/externs.h | 28 + src/cmd/cron/grot/CHANGES | 155 + src/cmd/cron/grot/CONVERSION | 85 + src/cmd/cron/grot/FEATURES | 84 + src/cmd/cron/grot/INSTALL | 87 + src/cmd/cron/grot/MAIL | 475 + src/cmd/cron/grot/MANIFEST | 33 + src/cmd/cron/grot/THANKS | 29 + src/cmd/cron/grot/diffs | 1933 ++ src/cmd/cron/job.c | 74 + src/cmd/cron/misc.c | 649 + src/cmd/cron/pathnames.h | 79 + src/cmd/cron/popen.c | 170 + src/cmd/cron/putman.sh | 26 + src/cmd/cron/user.c | 102 + src/cmd/lccom-1/CPYRIGHT | 62 + src/cmd/lccom-1/LOG | 383 + src/cmd/lccom-1/Makefile | 189 + src/cmd/lccom-1/README | 22 + src/cmd/lccom-1/alloc.c | 101 + src/cmd/lccom-1/alpha.md | 1188 + src/cmd/lccom-1/bind.c | 40 + src/cmd/lccom-1/bytecode.c | 287 + src/cmd/lccom-1/c.h | 598 + src/cmd/lccom-1/config.h | 103 + src/cmd/lccom-1/crt0.c | 123 + src/cmd/lccom-1/dag.c | 741 + src/cmd/lccom-1/dagcheck.md | 212 + src/cmd/lccom-1/decl.c | 1174 + src/cmd/lccom-1/doc/install.html | 774 + src/cmd/lccom-1/enode.c | 550 + src/cmd/lccom-1/error.c | 136 + src/cmd/lccom-1/event.c | 26 + src/cmd/lccom-1/expr.c | 711 + src/cmd/lccom-1/gen.c | 828 + src/cmd/lccom-1/init.c | 317 + src/cmd/lccom-1/inits.c | 6 + src/cmd/lccom-1/input.c | 144 + src/cmd/lccom-1/lburg/gram.c | 673 + src/cmd/lccom-1/lburg/gram.y | 202 + src/cmd/lccom-1/lburg/lburg.1 | 358 + src/cmd/lccom-1/lburg/lburg.c | 682 + src/cmd/lccom-1/lburg/lburg.h | 132 + src/cmd/lccom-1/lex.c | 930 + src/cmd/lccom-1/lib/assert.c | 19 + src/cmd/lccom-1/lib/bbexit.c | 136 + src/cmd/lccom-1/lib/yynull.c | 16 + src/cmd/lccom-1/list.c | 55 + src/cmd/lccom-1/main.c | 245 + src/cmd/lccom-1/mips.md | 1143 + src/cmd/lccom-1/null.c | 73 + src/cmd/lccom-1/ops.h | 131 + src/cmd/lccom-1/output.c | 133 + src/cmd/lccom-1/prof.c | 231 + src/cmd/lccom-1/profio.c | 285 + src/cmd/lccom-1/simp.c | 614 + src/cmd/lccom-1/sparc.md | 1176 + src/cmd/lccom-1/stab.c | 329 + src/cmd/lccom-1/stab.h | 108 + src/cmd/lccom-1/stmt.c | 707 + src/cmd/lccom-1/string.c | 125 + src/cmd/lccom-1/sym.c | 334 + src/cmd/lccom-1/symbolic.c | 524 + src/cmd/lccom-1/token.h | 133 + src/cmd/lccom-1/trace.c | 169 + src/cmd/lccom-1/tree.c | 240 + src/cmd/lccom-1/tst/8q.c | 39 + src/cmd/lccom-1/tst/array.c | 48 + src/cmd/lccom-1/tst/cf.c | 32 + src/cmd/lccom-1/tst/cq.c | 5316 ++++ src/cmd/lccom-1/tst/cvt.c | 35 + src/cmd/lccom-1/tst/fields.c | 34 + src/cmd/lccom-1/tst/front.c | 120 + src/cmd/lccom-1/tst/incr.c | 39 + src/cmd/lccom-1/tst/init.c | 59 + src/cmd/lccom-1/tst/limits.c | 19 + src/cmd/lccom-1/tst/mips-eb/8q.1bk | 92 + src/cmd/lccom-1/tst/mips-eb/8q.2bk | 2 + src/cmd/lccom-1/tst/mips-eb/8q.sbk | 169 + src/cmd/lccom-1/tst/mips-eb/array.1bk | 4 + src/cmd/lccom-1/tst/mips-eb/array.2bk | 2 + src/cmd/lccom-1/tst/mips-eb/array.sbk | 235 + src/cmd/lccom-1/tst/mips-eb/assert.h | 14 + src/cmd/lccom-1/tst/mips-eb/cf.1bk | 51 + src/cmd/lccom-1/tst/mips-eb/cf.2bk | 0 src/cmd/lccom-1/tst/mips-eb/cf.sbk | 153 + src/cmd/lccom-1/tst/mips-eb/cq.1bk | 48 + src/cmd/lccom-1/tst/mips-eb/cq.2bk | 25 + src/cmd/lccom-1/tst/mips-eb/cq.sbk | 13620 ++++++++++ src/cmd/lccom-1/tst/mips-eb/ctype.h | 40 + src/cmd/lccom-1/tst/mips-eb/cvt.1bk | 11 + src/cmd/lccom-1/tst/mips-eb/cvt.2bk | 2 + src/cmd/lccom-1/tst/mips-eb/cvt.sbk | 557 + src/cmd/lccom-1/tst/mips-eb/errno.h | 8 + src/cmd/lccom-1/tst/mips-eb/fields.1bk | 5 + src/cmd/lccom-1/tst/mips-eb/fields.2bk | 4 + src/cmd/lccom-1/tst/mips-eb/fields.sbk | 304 + src/cmd/lccom-1/tst/mips-eb/float.h | 37 + src/cmd/lccom-1/tst/mips-eb/front.2bk | 29 + src/cmd/lccom-1/tst/mips-eb/front.sbk | 416 + src/cmd/lccom-1/tst/mips-eb/incr.2bk | 9 + src/cmd/lccom-1/tst/mips-eb/incr.sbk | 149 + src/cmd/lccom-1/tst/mips-eb/init.1bk | 16 + src/cmd/lccom-1/tst/mips-eb/init.2bk | 3 + src/cmd/lccom-1/tst/mips-eb/init.sbk | 325 + src/cmd/lccom-1/tst/mips-eb/limits.1bk | 14 + src/cmd/lccom-1/tst/mips-eb/limits.2bk | 0 src/cmd/lccom-1/tst/mips-eb/limits.h | 30 + src/cmd/lccom-1/tst/mips-eb/limits.sbk | 396 + src/cmd/lccom-1/tst/mips-eb/locale.h | 38 + src/cmd/lccom-1/tst/mips-eb/math.h | 29 + src/cmd/lccom-1/tst/mips-eb/paranoia.1bk | 178 + src/cmd/lccom-1/tst/mips-eb/paranoia.2bk | 16 + src/cmd/lccom-1/tst/mips-eb/paranoia.sbk | 18657 ++++++++++++++ src/cmd/lccom-1/tst/mips-eb/setjmp.h | 11 + src/cmd/lccom-1/tst/mips-eb/signal.h | 20 + src/cmd/lccom-1/tst/mips-eb/sort.1bk | 20 + src/cmd/lccom-1/tst/mips-eb/sort.2bk | 5 + src/cmd/lccom-1/tst/mips-eb/sort.sbk | 309 + src/cmd/lccom-1/tst/mips-eb/spill.2bk | 6 + src/cmd/lccom-1/tst/mips-eb/spill.sbk | 271 + src/cmd/lccom-1/tst/mips-eb/stdarg.1bk | 6 + src/cmd/lccom-1/tst/mips-eb/stdarg.2bk | 1 + src/cmd/lccom-1/tst/mips-eb/stdarg.h | 27 + src/cmd/lccom-1/tst/mips-eb/stdarg.sbk | 396 + src/cmd/lccom-1/tst/mips-eb/stddef.h | 35 + src/cmd/lccom-1/tst/mips-eb/stdio.h | 102 + src/cmd/lccom-1/tst/mips-eb/stdlib.h | 66 + src/cmd/lccom-1/tst/mips-eb/string.h | 38 + src/cmd/lccom-1/tst/mips-eb/struct.1bk | 5 + src/cmd/lccom-1/tst/mips-eb/struct.2bk | 2 + src/cmd/lccom-1/tst/mips-eb/struct.sbk | 485 + src/cmd/lccom-1/tst/mips-eb/switch.1bk | 76 + src/cmd/lccom-1/tst/mips-eb/switch.2bk | 5 + src/cmd/lccom-1/tst/mips-eb/switch.sbk | 836 + src/cmd/lccom-1/tst/mips-eb/time.h | 51 + src/cmd/lccom-1/tst/mips-eb/wf1.1bk | 74 + src/cmd/lccom-1/tst/mips-eb/wf1.2bk | 2 + src/cmd/lccom-1/tst/mips-eb/wf1.sbk | 378 + src/cmd/lccom-1/tst/mips-eb/yacc.1bk | 10 + src/cmd/lccom-1/tst/mips-eb/yacc.2bk | 3 + src/cmd/lccom-1/tst/mips-eb/yacc.sbk | 2240 ++ src/cmd/lccom-1/tst/paranoia.c | 2203 ++ src/cmd/lccom-1/tst/run.sh | 37 + src/cmd/lccom-1/tst/sort.c | 65 + src/cmd/lccom-1/tst/spill.c | 17 + src/cmd/lccom-1/tst/stdarg.c | 51 + src/cmd/lccom-1/tst/struct.c | 69 + src/cmd/lccom-1/tst/switch.c | 137 + src/cmd/lccom-1/tst/wf1.c | 101 + src/cmd/lccom-1/tst/x86-linux/8q.1bk | 92 + src/cmd/lccom-1/tst/x86-linux/8q.2bk | 2 + src/cmd/lccom-1/tst/x86-linux/8q.sbk | 180 + src/cmd/lccom-1/tst/x86-linux/array.1bk | 4 + src/cmd/lccom-1/tst/x86-linux/array.2bk | 2 + src/cmd/lccom-1/tst/x86-linux/array.sbk | 235 + src/cmd/lccom-1/tst/x86-linux/assert.h | 14 + src/cmd/lccom-1/tst/x86-linux/cf.1bk | 51 + src/cmd/lccom-1/tst/x86-linux/cf.2bk | 0 src/cmd/lccom-1/tst/x86-linux/cf.sbk | 164 + src/cmd/lccom-1/tst/x86-linux/cq.1bk | 48 + src/cmd/lccom-1/tst/x86-linux/cq.2bk | 25 + src/cmd/lccom-1/tst/x86-linux/cq.sbk | 16528 +++++++++++++ src/cmd/lccom-1/tst/x86-linux/cvt.1bk | 11 + src/cmd/lccom-1/tst/x86-linux/cvt.2bk | 2 + src/cmd/lccom-1/tst/x86-linux/cvt.sbk | 993 + src/cmd/lccom-1/tst/x86-linux/fields.1bk | 5 + src/cmd/lccom-1/tst/x86-linux/fields.2bk | 4 + src/cmd/lccom-1/tst/x86-linux/fields.sbk | 321 + src/cmd/lccom-1/tst/x86-linux/float.h | 37 + src/cmd/lccom-1/tst/x86-linux/front.2bk | 29 + src/cmd/lccom-1/tst/x86-linux/front.sbk | 530 + src/cmd/lccom-1/tst/x86-linux/incr.1bk | 0 src/cmd/lccom-1/tst/x86-linux/incr.2bk | 9 + src/cmd/lccom-1/tst/x86-linux/incr.sbk | 181 + src/cmd/lccom-1/tst/x86-linux/init.1bk | 16 + src/cmd/lccom-1/tst/x86-linux/init.2bk | 3 + src/cmd/lccom-1/tst/x86-linux/init.sbk | 336 + src/cmd/lccom-1/tst/x86-linux/limits.1bk | 14 + src/cmd/lccom-1/tst/x86-linux/limits.2bk | 0 src/cmd/lccom-1/tst/x86-linux/limits.h | 30 + src/cmd/lccom-1/tst/x86-linux/limits.sbk | 396 + src/cmd/lccom-1/tst/x86-linux/math.h | 29 + src/cmd/lccom-1/tst/x86-linux/paranoia.1bk | 183 + src/cmd/lccom-1/tst/x86-linux/paranoia.2bk | 16 + src/cmd/lccom-1/tst/x86-linux/paranoia.sbk | 20618 ++++++++++++++++ src/cmd/lccom-1/tst/x86-linux/sort.1bk | 20 + src/cmd/lccom-1/tst/x86-linux/sort.2bk | 5 + src/cmd/lccom-1/tst/x86-linux/sort.sbk | 331 + src/cmd/lccom-1/tst/x86-linux/spill.1bk | 0 src/cmd/lccom-1/tst/x86-linux/spill.2bk | 6 + src/cmd/lccom-1/tst/x86-linux/spill.sbk | 286 + src/cmd/lccom-1/tst/x86-linux/stdarg.1bk | 6 + src/cmd/lccom-1/tst/x86-linux/stdarg.2bk | 1 + src/cmd/lccom-1/tst/x86-linux/stdarg.h | 26 + src/cmd/lccom-1/tst/x86-linux/stdarg.sbk | 400 + src/cmd/lccom-1/tst/x86-linux/struct.1bk | 5 + src/cmd/lccom-1/tst/x86-linux/struct.2bk | 2 + src/cmd/lccom-1/tst/x86-linux/struct.sbk | 476 + src/cmd/lccom-1/tst/x86-linux/switch.1bk | 76 + src/cmd/lccom-1/tst/x86-linux/switch.2bk | 5 + src/cmd/lccom-1/tst/x86-linux/switch.sbk | 899 + src/cmd/lccom-1/tst/x86-linux/wf1.1bk | 74 + src/cmd/lccom-1/tst/x86-linux/wf1.2bk | 2 + src/cmd/lccom-1/tst/x86-linux/wf1.sbk | 437 + src/cmd/lccom-1/tst/x86-linux/yacc.1bk | 10 + src/cmd/lccom-1/tst/x86-linux/yacc.2bk | 3 + src/cmd/lccom-1/tst/x86-linux/yacc.sbk | 2384 ++ src/cmd/lccom-1/tst/yacc.c | 592 + src/cmd/lccom-1/types.c | 754 + .../cmd/lccom-1}/using-bootloader.ld | 40 +- src/cmd/lccom-1/x86.md | 1011 + src/cmd/lccom-1/x86linux.md | 1078 + src/cmd/picoc-1/Makefile | 115 + src/cmd/picoc-1/README | 91 + src/cmd/picoc-1/clibrary.c | 679 + src/cmd/picoc-1/crt0.c | 117 + src/cmd/picoc-1/cstdlib/ctype.c | 110 + src/cmd/picoc-1/cstdlib/errno.c | 655 + src/cmd/picoc-1/cstdlib/math.c | 187 + src/cmd/picoc-1/cstdlib/stdbool.c | 22 + src/cmd/picoc-1/cstdlib/stdio.c | 742 + src/cmd/picoc-1/cstdlib/stdlib.c | 174 + src/cmd/picoc-1/cstdlib/string.c | 190 + src/cmd/picoc-1/cstdlib/time.c | 140 + src/cmd/picoc-1/cstdlib/unistd.c | 531 + src/cmd/picoc-1/debug.c | 127 + src/cmd/picoc-1/expression.c | 1492 ++ src/cmd/picoc-1/heap.c | 289 + src/cmd/picoc-1/include.c | 115 + src/cmd/picoc-1/interpreter.h | 523 + src/cmd/picoc-1/lex.c | 978 + src/cmd/picoc-1/msvc/picoc/picoc.sln | 20 + src/cmd/picoc-1/msvc/picoc/picoc.vcxproj | 111 + .../picoc-1/msvc/picoc/picoc.vcxproj.filters | 99 + src/cmd/picoc-1/parse.c | 917 + src/cmd/picoc-1/picoc.c | 111 + src/cmd/picoc-1/picoc.h | 52 + src/cmd/picoc-1/platform.c | 242 + src/cmd/picoc-1/platform.h | 147 + src/cmd/picoc-1/platform/library_ffox.c | 13 + src/cmd/picoc-1/platform/library_msvc.c | 5 + src/cmd/picoc-1/platform/library_srv1.c | 809 + src/cmd/picoc-1/platform/library_surveyor.c | 944 + src/cmd/picoc-1/platform/library_unix.c | 29 + src/cmd/picoc-1/platform/platform_ffox.c | 51 + src/cmd/picoc-1/platform/platform_msvc.c | 80 + src/cmd/picoc-1/platform/platform_surveyor.c | 71 + src/cmd/picoc-1/platform/platform_unix.c | 138 + src/cmd/picoc-1/retrobsd.c | 20 + src/cmd/picoc-1/table.c | 190 + src/cmd/picoc-1/tests/00_assignment.c | 13 + src/cmd/picoc-1/tests/00_assignment.expect | 3 + src/cmd/picoc-1/tests/01_comment.c | 10 + src/cmd/picoc-1/tests/01_comment.expect | 5 + src/cmd/picoc-1/tests/02_printf.c | 13 + src/cmd/picoc-1/tests/02_printf.expect | 15 + src/cmd/picoc-1/tests/03_struct.c | 21 + src/cmd/picoc-1/tests/03_struct.expect | 2 + src/cmd/picoc-1/tests/04_for.c | 10 + src/cmd/picoc-1/tests/04_for.expect | 10 + src/cmd/picoc-1/tests/05_array.c | 16 + src/cmd/picoc-1/tests/05_array.expect | 10 + src/cmd/picoc-1/tests/06_case.c | 24 + src/cmd/picoc-1/tests/06_case.expect | 8 + src/cmd/picoc-1/tests/07_function.c | 25 + src/cmd/picoc-1/tests/07_function.expect | 4 + src/cmd/picoc-1/tests/08_while.c | 19 + src/cmd/picoc-1/tests/08_while.expect | 11 + src/cmd/picoc-1/tests/09_do_while.c | 20 + src/cmd/picoc-1/tests/09_do_while.expect | 11 + src/cmd/picoc-1/tests/10_pointer.c | 37 + src/cmd/picoc-1/tests/10_pointer.expect | 7 + src/cmd/picoc-1/tests/11_precedence.c | 38 + src/cmd/picoc-1/tests/11_precedence.expect | 15 + src/cmd/picoc-1/tests/12_hashdefine.c | 10 + src/cmd/picoc-1/tests/12_hashdefine.expect | 2 + src/cmd/picoc-1/tests/13_integer_literals.c | 16 + .../picoc-1/tests/13_integer_literals.expect | 5 + src/cmd/picoc-1/tests/14_if.c | 17 + src/cmd/picoc-1/tests/14_if.expect | 2 + src/cmd/picoc-1/tests/15_recursion.c | 16 + src/cmd/picoc-1/tests/15_recursion.expect | 10 + src/cmd/picoc-1/tests/16_nesting.c | 16 + src/cmd/picoc-1/tests/16_nesting.expect | 18 + src/cmd/picoc-1/tests/17_enum.c | 24 + src/cmd/picoc-1/tests/17_enum.expect | 4 + src/cmd/picoc-1/tests/18_include.c | 7 + src/cmd/picoc-1/tests/18_include.expect | 3 + src/cmd/picoc-1/tests/18_include.h | 1 + src/cmd/picoc-1/tests/19_pointer_arithmetic.c | 24 + .../tests/19_pointer_arithmetic.expect | 3 + src/cmd/picoc-1/tests/20_pointer_comparison.c | 20 + .../tests/20_pointer_comparison.expect | 6 + src/cmd/picoc-1/tests/21_char_array.c | 29 + src/cmd/picoc-1/tests/21_char_array.expect | 7 + src/cmd/picoc-1/tests/22_floating_point.c | 45 + .../picoc-1/tests/22_floating_point.expect | 16 + src/cmd/picoc-1/tests/23_type_coercion.c | 49 + src/cmd/picoc-1/tests/23_type_coercion.expect | 15 + src/cmd/picoc-1/tests/24_math_library.c | 23 + src/cmd/picoc-1/tests/24_math_library.expect | 18 + src/cmd/picoc-1/tests/25_quicksort.c | 80 + src/cmd/picoc-1/tests/25_quicksort.expect | 2 + .../picoc-1/tests/26_character_constants.c | 13 + .../tests/26_character_constants.expect | 8 + src/cmd/picoc-1/tests/27_sizeof.c | 12 + src/cmd/picoc-1/tests/27_sizeof.expect | 3 + src/cmd/picoc-1/tests/28_strings.c | 41 + src/cmd/picoc-1/tests/28_strings.expect | 19 + src/cmd/picoc-1/tests/29_array_address.c | 8 + src/cmd/picoc-1/tests/29_array_address.expect | 1 + src/cmd/picoc-1/tests/30_hanoi.c | 125 + src/cmd/picoc-1/tests/30_hanoi.expect | 71 + src/cmd/picoc-1/tests/31_args.c | 12 + src/cmd/picoc-1/tests/31_args.expect | 6 + src/cmd/picoc-1/tests/32_led.c | 264 + src/cmd/picoc-1/tests/32_led.expect | 4 + src/cmd/picoc-1/tests/33_ternary_op.c | 10 + src/cmd/picoc-1/tests/33_ternary_op.expect | 10 + src/cmd/picoc-1/tests/34_array_assignment.c | 18 + .../picoc-1/tests/34_array_assignment.expect | 2 + src/cmd/picoc-1/tests/35_sizeof.c | 9 + src/cmd/picoc-1/tests/35_sizeof.expect | 2 + src/cmd/picoc-1/tests/36_array_initialisers.c | 16 + .../tests/36_array_initialisers.expect | 20 + src/cmd/picoc-1/tests/37_sprintf.c | 12 + src/cmd/picoc-1/tests/37_sprintf.expect | 20 + .../picoc-1/tests/38_multiple_array_index.c | 29 + .../tests/38_multiple_array_index.expect | 4 + src/cmd/picoc-1/tests/39_typedef.c | 26 + src/cmd/picoc-1/tests/39_typedef.expect | 3 + src/cmd/picoc-1/tests/40_stdio.c | 47 + src/cmd/picoc-1/tests/40_stdio.expect | 27 + src/cmd/picoc-1/tests/41_hashif.c | 80 + src/cmd/picoc-1/tests/41_hashif.expect | 6 + src/cmd/picoc-1/tests/42_function_pointer.c | 15 + src/cmd/picoc-1/tests/43_void_param.c | 10 + src/cmd/picoc-1/tests/43_void_param.expect | 1 + .../picoc-1/tests/44_scoped_declarations.c | 12 + .../tests/44_scoped_declarations.expect | 1 + src/cmd/picoc-1/tests/45_empty_for.c | 16 + src/cmd/picoc-1/tests/45_empty_for.expect | 10 + src/cmd/picoc-1/tests/46_grep.c | 562 + src/cmd/picoc-1/tests/47_switch_return.c | 23 + src/cmd/picoc-1/tests/47_switch_return.expect | 4 + src/cmd/picoc-1/tests/48_nested_break.c | 24 + src/cmd/picoc-1/tests/48_nested_break.expect | 1 + src/cmd/picoc-1/tests/49_bracket_evaluation.c | 21 + .../tests/49_bracket_evaluation.expect | 1 + src/cmd/picoc-1/tests/50_logical_second_arg.c | 27 + .../tests/50_logical_second_arg.expect | 20 + src/cmd/picoc-1/tests/51_static.c | 26 + src/cmd/picoc-1/tests/51_static.expect | 8 + src/cmd/picoc-1/tests/52_unnamed_enum.c | 24 + src/cmd/picoc-1/tests/52_unnamed_enum.expect | 9 + src/cmd/picoc-1/tests/54_goto.c | 52 + src/cmd/picoc-1/tests/54_goto.expect | 8 + src/cmd/picoc-1/tests/55_array_initialiser.c | 12 + .../picoc-1/tests/55_array_initialiser.expect | 2 + src/cmd/picoc-1/tests/Makefile | 74 + src/cmd/picoc-1/type.c | 549 + src/cmd/picoc-1/using-bootloader.ld | 108 + src/cmd/picoc-1/variable.c | 370 + src/cmd/smallc/Makefile | 7 +- src/cmd/smallc/README | 48 +- src/cmd/smallc/code8080.c | 963 +- src/cmd/smallc/codemips.c | 576 +- src/cmd/smallc/data.c | 33 +- src/cmd/smallc/data.h | 25 +- src/cmd/smallc/defs.h | 328 +- src/cmd/smallc/error.c | 42 +- src/cmd/smallc/expr.c | 707 +- src/cmd/smallc/function.c | 278 +- src/cmd/smallc/gen.c | 181 +- src/cmd/smallc/initialise.c | 103 + src/cmd/smallc/io.c | 83 +- src/cmd/smallc/lex.c | 363 +- src/cmd/smallc/main.c | 389 +- src/cmd/smallc/preproc.c | 371 + src/cmd/smallc/primary.c | 284 +- src/cmd/smallc/stmt.c | 427 +- src/cmd/smallc/sym.c | 367 +- src/cmd/smallc/while.c | 120 +- src/cmd/uflash.c | 62 + src/cmd/uflash_r/Makefile | 72 + src/cmd/uflash_r/uflash_r.c | 89 + sys/include/uflash.h | 41 + sys/pic32/Makefile | 2 +- sys/pic32/adc.c | 2 +- sys/pic32/baremetal/Makefile | 8 +- sys/pic32/devsw.c | 26 + sys/pic32/dip/Makefile | 3 + sys/pic32/drivers.mk | 5 + sys/pic32/duinomite-uart/Makefile | 3 + sys/pic32/duinomite/Makefile | 3 + sys/pic32/explorer16/Makefile | 3 + sys/pic32/fubarino/Makefile | 11 +- sys/pic32/machdep.c | 35 +- sys/pic32/machparam.h | 11 - sys/pic32/max32-eth/Makefile | 3 + sys/pic32/max32/Makefile | 7 +- sys/pic32/maximite/Makefile | 3 + sys/pic32/meb/Makefile | 3 + sys/pic32/pinguino-micro/Makefile | 3 + sys/pic32/retroone/Makefile | 3 + sys/pic32/sdram.S | 735 - sys/pic32/sdram.h | 32 - sys/pic32/sdramp.c | 221 - sys/pic32/starter-kit/Makefile | 5 +- sys/pic32/ubw32-uart-sdramswap/Makefile | 158 - sys/pic32/ubw32-uart/Makefile | 3 + sys/pic32/ubw32/Makefile | 3 + sys/pic32/uflash.c | 458 + sys/pic32/usb_boot.c | 2 +- sys/pic32/usb_console.c | 2 + sys/pic32/usbboot/Makefile | 4 +- test.txt | 1 - tools/virtualmips/mips_memory.c | 19 +- tools/virtualmips/pic32.h | 10 + tools/virtualmips/pic32_dev_flash.c | 56 +- tools/virtualmips/pic32_dev_syscon.c | 103 +- tools/virtualmips/pic32mx.h | 25 + tools/virtualmips/vm.c | 10 + tools/virtualmips/vm.h | 1 + 457 files changed, 146252 insertions(+), 4193 deletions(-) delete mode 100644 sdram-fpga.S create mode 100644 share/lccom/Makefile create mode 100644 share/lccom/hello.c create mode 100644 share/lccom/sys.s create mode 100644 share/smallc/Makefile create mode 100644 share/smallc/lib.c create mode 100644 share/smallc/primelist.c create mode 100644 share/smallc/primesum.c create mode 100644 share/smallc/sys.s create mode 100644 share/smallc/test1.c create mode 100644 share/smallc/test2.c create mode 100755 src/cmd/cron/Makefile create mode 100755 src/cmd/cron/README create mode 100755 src/cmd/cron/README.2BSD create mode 100755 src/cmd/cron/bitstring.3 create mode 100755 src/cmd/cron/bitstring.h create mode 100755 src/cmd/cron/compat.c create mode 100755 src/cmd/cron/compat.h create mode 100755 src/cmd/cron/config.h create mode 100755 src/cmd/cron/cron.8 create mode 100755 src/cmd/cron/cron.c create mode 100755 src/cmd/cron/cron.h create mode 100755 src/cmd/cron/crontab.1 create mode 100755 src/cmd/cron/crontab.5 create mode 100755 src/cmd/cron/crontab.c create mode 100755 src/cmd/cron/database.c create mode 100755 src/cmd/cron/do_command.c create mode 100755 src/cmd/cron/entry.c create mode 100755 src/cmd/cron/env.c create mode 100755 src/cmd/cron/externs.h create mode 100755 src/cmd/cron/grot/CHANGES create mode 100755 src/cmd/cron/grot/CONVERSION create mode 100755 src/cmd/cron/grot/FEATURES create mode 100755 src/cmd/cron/grot/INSTALL create mode 100755 src/cmd/cron/grot/MAIL create mode 100755 src/cmd/cron/grot/MANIFEST create mode 100755 src/cmd/cron/grot/THANKS create mode 100755 src/cmd/cron/grot/diffs create mode 100755 src/cmd/cron/job.c create mode 100755 src/cmd/cron/misc.c create mode 100755 src/cmd/cron/pathnames.h create mode 100755 src/cmd/cron/popen.c create mode 100755 src/cmd/cron/putman.sh create mode 100755 src/cmd/cron/user.c create mode 100644 src/cmd/lccom-1/CPYRIGHT create mode 100644 src/cmd/lccom-1/LOG create mode 100644 src/cmd/lccom-1/Makefile create mode 100644 src/cmd/lccom-1/README create mode 100644 src/cmd/lccom-1/alloc.c create mode 100644 src/cmd/lccom-1/alpha.md create mode 100644 src/cmd/lccom-1/bind.c create mode 100644 src/cmd/lccom-1/bytecode.c create mode 100644 src/cmd/lccom-1/c.h create mode 100644 src/cmd/lccom-1/config.h create mode 100644 src/cmd/lccom-1/crt0.c create mode 100644 src/cmd/lccom-1/dag.c create mode 100644 src/cmd/lccom-1/dagcheck.md create mode 100644 src/cmd/lccom-1/decl.c create mode 100644 src/cmd/lccom-1/doc/install.html create mode 100644 src/cmd/lccom-1/enode.c create mode 100644 src/cmd/lccom-1/error.c create mode 100644 src/cmd/lccom-1/event.c create mode 100644 src/cmd/lccom-1/expr.c create mode 100644 src/cmd/lccom-1/gen.c create mode 100644 src/cmd/lccom-1/init.c create mode 100644 src/cmd/lccom-1/inits.c create mode 100644 src/cmd/lccom-1/input.c create mode 100644 src/cmd/lccom-1/lburg/gram.c create mode 100644 src/cmd/lccom-1/lburg/gram.y create mode 100644 src/cmd/lccom-1/lburg/lburg.1 create mode 100644 src/cmd/lccom-1/lburg/lburg.c create mode 100644 src/cmd/lccom-1/lburg/lburg.h create mode 100644 src/cmd/lccom-1/lex.c create mode 100644 src/cmd/lccom-1/lib/assert.c create mode 100644 src/cmd/lccom-1/lib/bbexit.c create mode 100644 src/cmd/lccom-1/lib/yynull.c create mode 100644 src/cmd/lccom-1/list.c create mode 100644 src/cmd/lccom-1/main.c create mode 100644 src/cmd/lccom-1/mips.md create mode 100644 src/cmd/lccom-1/null.c create mode 100644 src/cmd/lccom-1/ops.h create mode 100644 src/cmd/lccom-1/output.c create mode 100644 src/cmd/lccom-1/prof.c create mode 100644 src/cmd/lccom-1/profio.c create mode 100644 src/cmd/lccom-1/simp.c create mode 100644 src/cmd/lccom-1/sparc.md create mode 100644 src/cmd/lccom-1/stab.c create mode 100644 src/cmd/lccom-1/stab.h create mode 100644 src/cmd/lccom-1/stmt.c create mode 100644 src/cmd/lccom-1/string.c create mode 100644 src/cmd/lccom-1/sym.c create mode 100644 src/cmd/lccom-1/symbolic.c create mode 100644 src/cmd/lccom-1/token.h create mode 100644 src/cmd/lccom-1/trace.c create mode 100644 src/cmd/lccom-1/tree.c create mode 100644 src/cmd/lccom-1/tst/8q.c create mode 100644 src/cmd/lccom-1/tst/array.c create mode 100644 src/cmd/lccom-1/tst/cf.c create mode 100644 src/cmd/lccom-1/tst/cq.c create mode 100644 src/cmd/lccom-1/tst/cvt.c create mode 100644 src/cmd/lccom-1/tst/fields.c create mode 100644 src/cmd/lccom-1/tst/front.c create mode 100644 src/cmd/lccom-1/tst/incr.c create mode 100644 src/cmd/lccom-1/tst/init.c create mode 100644 src/cmd/lccom-1/tst/limits.c create mode 100644 src/cmd/lccom-1/tst/mips-eb/8q.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/8q.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/8q.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/array.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/array.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/array.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/assert.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/cf.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/cf.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/cf.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/cq.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/cq.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/cq.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/ctype.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/cvt.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/cvt.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/cvt.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/errno.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/fields.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/fields.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/fields.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/float.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/front.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/front.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/incr.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/incr.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/init.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/init.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/init.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/limits.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/limits.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/limits.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/limits.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/locale.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/math.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/paranoia.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/paranoia.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/paranoia.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/setjmp.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/signal.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/sort.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/sort.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/sort.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/spill.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/spill.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/stdarg.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/stdarg.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/stdarg.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/stdarg.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/stddef.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/stdio.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/stdlib.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/string.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/struct.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/struct.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/struct.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/switch.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/switch.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/switch.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/time.h create mode 100644 src/cmd/lccom-1/tst/mips-eb/wf1.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/wf1.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/wf1.sbk create mode 100644 src/cmd/lccom-1/tst/mips-eb/yacc.1bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/yacc.2bk create mode 100644 src/cmd/lccom-1/tst/mips-eb/yacc.sbk create mode 100644 src/cmd/lccom-1/tst/paranoia.c create mode 100755 src/cmd/lccom-1/tst/run.sh create mode 100644 src/cmd/lccom-1/tst/sort.c create mode 100644 src/cmd/lccom-1/tst/spill.c create mode 100644 src/cmd/lccom-1/tst/stdarg.c create mode 100644 src/cmd/lccom-1/tst/struct.c create mode 100644 src/cmd/lccom-1/tst/switch.c create mode 100644 src/cmd/lccom-1/tst/wf1.c create mode 100644 src/cmd/lccom-1/tst/x86-linux/8q.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/8q.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/8q.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/array.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/array.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/array.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/assert.h create mode 100644 src/cmd/lccom-1/tst/x86-linux/cf.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/cf.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/cf.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/cq.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/cq.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/cq.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/cvt.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/cvt.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/cvt.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/fields.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/fields.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/fields.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/float.h create mode 100644 src/cmd/lccom-1/tst/x86-linux/front.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/front.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/incr.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/incr.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/incr.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/init.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/init.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/init.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/limits.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/limits.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/limits.h create mode 100644 src/cmd/lccom-1/tst/x86-linux/limits.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/math.h create mode 100644 src/cmd/lccom-1/tst/x86-linux/paranoia.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/paranoia.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/paranoia.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/sort.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/sort.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/sort.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/spill.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/spill.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/spill.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/stdarg.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/stdarg.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/stdarg.h create mode 100644 src/cmd/lccom-1/tst/x86-linux/stdarg.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/struct.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/struct.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/struct.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/switch.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/switch.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/switch.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/wf1.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/wf1.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/wf1.sbk create mode 100644 src/cmd/lccom-1/tst/x86-linux/yacc.1bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/yacc.2bk create mode 100644 src/cmd/lccom-1/tst/x86-linux/yacc.sbk create mode 100644 src/cmd/lccom-1/tst/yacc.c create mode 100644 src/cmd/lccom-1/types.c rename {sys/pic32/ubw32-uart-sdramswap => src/cmd/lccom-1}/using-bootloader.ld (77%) create mode 100644 src/cmd/lccom-1/x86.md create mode 100644 src/cmd/lccom-1/x86linux.md create mode 100644 src/cmd/picoc-1/Makefile create mode 100644 src/cmd/picoc-1/README create mode 100644 src/cmd/picoc-1/clibrary.c create mode 100644 src/cmd/picoc-1/crt0.c create mode 100644 src/cmd/picoc-1/cstdlib/ctype.c create mode 100644 src/cmd/picoc-1/cstdlib/errno.c create mode 100644 src/cmd/picoc-1/cstdlib/math.c create mode 100644 src/cmd/picoc-1/cstdlib/stdbool.c create mode 100644 src/cmd/picoc-1/cstdlib/stdio.c create mode 100644 src/cmd/picoc-1/cstdlib/stdlib.c create mode 100644 src/cmd/picoc-1/cstdlib/string.c create mode 100644 src/cmd/picoc-1/cstdlib/time.c create mode 100644 src/cmd/picoc-1/cstdlib/unistd.c create mode 100644 src/cmd/picoc-1/debug.c create mode 100644 src/cmd/picoc-1/expression.c create mode 100644 src/cmd/picoc-1/heap.c create mode 100644 src/cmd/picoc-1/include.c create mode 100644 src/cmd/picoc-1/interpreter.h create mode 100644 src/cmd/picoc-1/lex.c create mode 100644 src/cmd/picoc-1/msvc/picoc/picoc.sln create mode 100644 src/cmd/picoc-1/msvc/picoc/picoc.vcxproj create mode 100644 src/cmd/picoc-1/msvc/picoc/picoc.vcxproj.filters create mode 100644 src/cmd/picoc-1/parse.c create mode 100644 src/cmd/picoc-1/picoc.c create mode 100644 src/cmd/picoc-1/picoc.h create mode 100644 src/cmd/picoc-1/platform.c create mode 100644 src/cmd/picoc-1/platform.h create mode 100644 src/cmd/picoc-1/platform/library_ffox.c create mode 100644 src/cmd/picoc-1/platform/library_msvc.c create mode 100644 src/cmd/picoc-1/platform/library_srv1.c create mode 100644 src/cmd/picoc-1/platform/library_surveyor.c create mode 100644 src/cmd/picoc-1/platform/library_unix.c create mode 100644 src/cmd/picoc-1/platform/platform_ffox.c create mode 100644 src/cmd/picoc-1/platform/platform_msvc.c create mode 100644 src/cmd/picoc-1/platform/platform_surveyor.c create mode 100644 src/cmd/picoc-1/platform/platform_unix.c create mode 100644 src/cmd/picoc-1/retrobsd.c create mode 100644 src/cmd/picoc-1/table.c create mode 100644 src/cmd/picoc-1/tests/00_assignment.c create mode 100644 src/cmd/picoc-1/tests/00_assignment.expect create mode 100644 src/cmd/picoc-1/tests/01_comment.c create mode 100644 src/cmd/picoc-1/tests/01_comment.expect create mode 100644 src/cmd/picoc-1/tests/02_printf.c create mode 100644 src/cmd/picoc-1/tests/02_printf.expect create mode 100644 src/cmd/picoc-1/tests/03_struct.c create mode 100644 src/cmd/picoc-1/tests/03_struct.expect create mode 100644 src/cmd/picoc-1/tests/04_for.c create mode 100644 src/cmd/picoc-1/tests/04_for.expect create mode 100644 src/cmd/picoc-1/tests/05_array.c create mode 100644 src/cmd/picoc-1/tests/05_array.expect create mode 100644 src/cmd/picoc-1/tests/06_case.c create mode 100644 src/cmd/picoc-1/tests/06_case.expect create mode 100644 src/cmd/picoc-1/tests/07_function.c create mode 100644 src/cmd/picoc-1/tests/07_function.expect create mode 100644 src/cmd/picoc-1/tests/08_while.c create mode 100644 src/cmd/picoc-1/tests/08_while.expect create mode 100644 src/cmd/picoc-1/tests/09_do_while.c create mode 100644 src/cmd/picoc-1/tests/09_do_while.expect create mode 100644 src/cmd/picoc-1/tests/10_pointer.c create mode 100644 src/cmd/picoc-1/tests/10_pointer.expect create mode 100644 src/cmd/picoc-1/tests/11_precedence.c create mode 100644 src/cmd/picoc-1/tests/11_precedence.expect create mode 100644 src/cmd/picoc-1/tests/12_hashdefine.c create mode 100644 src/cmd/picoc-1/tests/12_hashdefine.expect create mode 100644 src/cmd/picoc-1/tests/13_integer_literals.c create mode 100644 src/cmd/picoc-1/tests/13_integer_literals.expect create mode 100644 src/cmd/picoc-1/tests/14_if.c create mode 100644 src/cmd/picoc-1/tests/14_if.expect create mode 100644 src/cmd/picoc-1/tests/15_recursion.c create mode 100644 src/cmd/picoc-1/tests/15_recursion.expect create mode 100644 src/cmd/picoc-1/tests/16_nesting.c create mode 100644 src/cmd/picoc-1/tests/16_nesting.expect create mode 100644 src/cmd/picoc-1/tests/17_enum.c create mode 100644 src/cmd/picoc-1/tests/17_enum.expect create mode 100644 src/cmd/picoc-1/tests/18_include.c create mode 100644 src/cmd/picoc-1/tests/18_include.expect create mode 100644 src/cmd/picoc-1/tests/18_include.h create mode 100644 src/cmd/picoc-1/tests/19_pointer_arithmetic.c create mode 100644 src/cmd/picoc-1/tests/19_pointer_arithmetic.expect create mode 100644 src/cmd/picoc-1/tests/20_pointer_comparison.c create mode 100644 src/cmd/picoc-1/tests/20_pointer_comparison.expect create mode 100644 src/cmd/picoc-1/tests/21_char_array.c create mode 100644 src/cmd/picoc-1/tests/21_char_array.expect create mode 100644 src/cmd/picoc-1/tests/22_floating_point.c create mode 100644 src/cmd/picoc-1/tests/22_floating_point.expect create mode 100644 src/cmd/picoc-1/tests/23_type_coercion.c create mode 100644 src/cmd/picoc-1/tests/23_type_coercion.expect create mode 100644 src/cmd/picoc-1/tests/24_math_library.c create mode 100644 src/cmd/picoc-1/tests/24_math_library.expect create mode 100644 src/cmd/picoc-1/tests/25_quicksort.c create mode 100644 src/cmd/picoc-1/tests/25_quicksort.expect create mode 100644 src/cmd/picoc-1/tests/26_character_constants.c create mode 100644 src/cmd/picoc-1/tests/26_character_constants.expect create mode 100644 src/cmd/picoc-1/tests/27_sizeof.c create mode 100644 src/cmd/picoc-1/tests/27_sizeof.expect create mode 100644 src/cmd/picoc-1/tests/28_strings.c create mode 100644 src/cmd/picoc-1/tests/28_strings.expect create mode 100644 src/cmd/picoc-1/tests/29_array_address.c create mode 100644 src/cmd/picoc-1/tests/29_array_address.expect create mode 100644 src/cmd/picoc-1/tests/30_hanoi.c create mode 100644 src/cmd/picoc-1/tests/30_hanoi.expect create mode 100644 src/cmd/picoc-1/tests/31_args.c create mode 100644 src/cmd/picoc-1/tests/31_args.expect create mode 100644 src/cmd/picoc-1/tests/32_led.c create mode 100644 src/cmd/picoc-1/tests/32_led.expect create mode 100644 src/cmd/picoc-1/tests/33_ternary_op.c create mode 100644 src/cmd/picoc-1/tests/33_ternary_op.expect create mode 100644 src/cmd/picoc-1/tests/34_array_assignment.c create mode 100644 src/cmd/picoc-1/tests/34_array_assignment.expect create mode 100644 src/cmd/picoc-1/tests/35_sizeof.c create mode 100644 src/cmd/picoc-1/tests/35_sizeof.expect create mode 100644 src/cmd/picoc-1/tests/36_array_initialisers.c create mode 100644 src/cmd/picoc-1/tests/36_array_initialisers.expect create mode 100644 src/cmd/picoc-1/tests/37_sprintf.c create mode 100644 src/cmd/picoc-1/tests/37_sprintf.expect create mode 100644 src/cmd/picoc-1/tests/38_multiple_array_index.c create mode 100644 src/cmd/picoc-1/tests/38_multiple_array_index.expect create mode 100644 src/cmd/picoc-1/tests/39_typedef.c create mode 100644 src/cmd/picoc-1/tests/39_typedef.expect create mode 100644 src/cmd/picoc-1/tests/40_stdio.c create mode 100644 src/cmd/picoc-1/tests/40_stdio.expect create mode 100644 src/cmd/picoc-1/tests/41_hashif.c create mode 100644 src/cmd/picoc-1/tests/41_hashif.expect create mode 100644 src/cmd/picoc-1/tests/42_function_pointer.c create mode 100644 src/cmd/picoc-1/tests/43_void_param.c create mode 100644 src/cmd/picoc-1/tests/43_void_param.expect create mode 100644 src/cmd/picoc-1/tests/44_scoped_declarations.c create mode 100644 src/cmd/picoc-1/tests/44_scoped_declarations.expect create mode 100644 src/cmd/picoc-1/tests/45_empty_for.c create mode 100644 src/cmd/picoc-1/tests/45_empty_for.expect create mode 100644 src/cmd/picoc-1/tests/46_grep.c create mode 100644 src/cmd/picoc-1/tests/47_switch_return.c create mode 100644 src/cmd/picoc-1/tests/47_switch_return.expect create mode 100644 src/cmd/picoc-1/tests/48_nested_break.c create mode 100644 src/cmd/picoc-1/tests/48_nested_break.expect create mode 100644 src/cmd/picoc-1/tests/49_bracket_evaluation.c create mode 100644 src/cmd/picoc-1/tests/49_bracket_evaluation.expect create mode 100644 src/cmd/picoc-1/tests/50_logical_second_arg.c create mode 100644 src/cmd/picoc-1/tests/50_logical_second_arg.expect create mode 100644 src/cmd/picoc-1/tests/51_static.c create mode 100644 src/cmd/picoc-1/tests/51_static.expect create mode 100644 src/cmd/picoc-1/tests/52_unnamed_enum.c create mode 100644 src/cmd/picoc-1/tests/52_unnamed_enum.expect create mode 100644 src/cmd/picoc-1/tests/54_goto.c create mode 100644 src/cmd/picoc-1/tests/54_goto.expect create mode 100644 src/cmd/picoc-1/tests/55_array_initialiser.c create mode 100644 src/cmd/picoc-1/tests/55_array_initialiser.expect create mode 100644 src/cmd/picoc-1/tests/Makefile create mode 100644 src/cmd/picoc-1/type.c create mode 100644 src/cmd/picoc-1/using-bootloader.ld create mode 100644 src/cmd/picoc-1/variable.c create mode 100644 src/cmd/smallc/initialise.c create mode 100644 src/cmd/smallc/preproc.c create mode 100644 src/cmd/uflash.c create mode 100644 src/cmd/uflash_r/Makefile create mode 100644 src/cmd/uflash_r/uflash_r.c create mode 100644 sys/include/uflash.h delete mode 100644 sys/pic32/sdram.S delete mode 100644 sys/pic32/sdram.h delete mode 100644 sys/pic32/sdramp.c delete mode 100644 sys/pic32/ubw32-uart-sdramswap/Makefile create mode 100644 sys/pic32/uflash.c delete mode 100644 test.txt diff --git a/Makefile b/Makefile index 3b6b042..2cd9804 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ MAX32 = pic32/max32 UBW32 = pic32/ubw32 UBW32UART = pic32/ubw32-uart -UBW32UARTSDRSW = pic32/ubw32-uart-sdramswap MAXIMITE = pic32/maximite EXPLORER16 = pic32/explorer16 STARTERKIT = pic32/starter-kit @@ -25,7 +24,7 @@ BAREMETAL = pic32/baremetal RETROONE = pic32/retroone # Select target board -TARGET ?= $(UBW32UARTSDRSW) +TARGET ?= $(MAX32) # Filesystem and swap sizes. FS_KBYTES = 16384 @@ -50,6 +49,7 @@ FSUTIL = tools/fsutil/fsutil # BIN_FILES := $(wildcard bin/*) SBIN_FILES := $(wildcard sbin/*) +UFLASH_FILES := $(wildcard uflash/*) GAMES_FILES := $(shell find games -type f ! -path '*/.*') LIB_FILES := $(wildcard lib/*) LIBEXEC_FILES := $(wildcard libexec/*) @@ -62,13 +62,16 @@ SHARE_FILES = share/re.help share/example/Makefile \ share/example/ashello.S share/example/chello.c \ share/example/blkjack.bas share/example/hilow.bas \ share/example/stars.bas share/example/prime.scm \ - share/example/fact.fth share/example/echo.S + share/example/fact.fth share/example/echo.S \ + share/smallc/lib.c share/smallc/Makefile share/smallc/primelist.c \ + share/smallc/primesum.c share/smallc/sys.s share/smallc/test1.c \ + share/smallc/test2.c $(wildcard share/lccom/*) ALLFILES = $(SBIN_FILES) $(ETC_FILES) $(BIN_FILES) $(LIB_FILES) $(LIBEXEC_FILES) \ - $(INC_FILES) $(SHARE_FILES) $(GAMES_FILES) \ + $(INC_FILES) $(SHARE_FILES) $(GAMES_FILES) $(UFLASH_FILES) \ var/log/messages var/log/wtmp .profile ALLDIRS = sbin/ bin/ dev/ etc/ tmp/ lib/ libexec/ share/ share/example/ \ - share/misc/ var/ var/run/ var/log/ u/ include/ include/sys/ \ - games/ games/lib/ + share/lccom/ share/misc/ share/smallc/ var/ var/run/ var/log/ u/ include/ include/sys/ \ + games/ games/lib/ uflash/ BDEVS = dev/sd0!b0:0 dev/sd1!b0:1 dev/sw0!b1:0 CDEVS = dev/console!c0:0 \ dev/mem!c1:0 dev/kmem!c1:1 dev/null!c1:2 dev/zero!c1:3 \ @@ -82,7 +85,7 @@ CDEVS = dev/console!c0:0 \ dev/confa!c7:64 dev/confb!c7:65 dev/confc!c7:66 \ dev/confd!c7:67 dev/confe!c7:68 dev/conff!c7:69 dev/confg!c7:70 \ dev/spi1!c9:0 dev/spi2!c9:1 dev/spi3!c9:2 dev/spi4!c9:3 \ - dev/glcd0!c10:0 + dev/glcd0!c10:0 dev/uflash!c12:0 FDDEVS = dev/fd/ dev/fd/0!c5:0 dev/fd/1!c5:1 dev/fd/2!c5:2 \ dev/fd/3!c5:3 dev/fd/4!c5:4 dev/fd/5!c5:5 dev/fd/6!c5:6 \ dev/fd/7!c5:7 dev/fd/8!c5:8 dev/fd/9!c5:9 dev/fd/10!c5:10 \ @@ -139,6 +142,7 @@ cleanall: clean rm -f share/re.help rm -f share/misc/more.help rm -f etc/termcap + rm -f uflash/* # TODO diff --git a/sdram-fpga.S b/sdram-fpga.S deleted file mode 100644 index 2e7ed9f..0000000 --- a/sdram-fpga.S +++ /dev/null @@ -1,755 +0,0 @@ -/* - * SDRAM Access Routines for PIC32. - * - * Retromaster - 10.05.2010 - * - * This file is in the public domain. You can use, modify, and distribute the source code - * and executable programs based on the source code. This file is provided "as is" and - * without any express or implied warranties whatsoever. Use at your own risk! - * - * Changes by jmcgee for inclusion in the retrobsd project. - */ - -/* SDRAM Used: HY57V281620 - * SDRAM Pin to PIC32 Pin Mapping: - * SDRAM PIC32 - * ------ ------ - * note: the order of An to RBn DOES matter - * At the moment it is a bit of a mess and - * needs to be cleaned up. - * A0 23 RB11 - * A1 24 RB12 - * A2 25 RB13 - * A3 26 RB14 - * A4 29 RB5 - * A5 30 RB4 - * A6 31 RB3 - * A7 32 RB2 - * A8 33 RB6 - * A9 34 RB7 - * A10 22 RB15 - * A11 35 RB9 - * - * BA0 20 RD4 - * BA1 21 RD5 - * - * note: the order of DQn to RAn does not matter - * DQ0 2 RA6 - * DQ1 4 RA1 - * DQ2 5 RA7 - * DQ3 7 RA2 - * DQ4 8 RA3 - * DQ5 10 RA4 - * DQ6 11 RA5 - * DQ7 13 RA0 - - * CLK 38 OC1-RD0 - * CKE 37 A10 - * CS 19 RF12 - * WE 16 RF0 - * CAS 17 RF1 - * RAS 18 RF13 - * - * SDRam 42, 44, 45, 47, 48, 50, 51, 53 - (d8-d15) should be pulled up, but - * on the prototype board these were simply left floating - * - * Power connections not listed. - */ - - -/* - * Retrobsd does not currently contain a good header - * for pulling the pic32 port addresses into an assembly - * file, so define some needed registers here for the moment. - */ - -#define TRISA 0xBF886000 -#define T2CON 0xBF800800 -#define TMR2 0xBF800810 -#define PR2 0xBF800820 -#define T2CONSET 0xBF800808 - -#define OC1CON 0xBF803000 -#define OC4CON 0xBF803600 -#define OCXR_OFFSET 0x10 -#define OCXRS_OFFSET 0x20 - -#define AD1PCFGSET 0xBF809068 - -/* Offsets (from TRISA) for the io ports */ -#define SDR_OFFSET_A 0 -#define SDR_OFFSET_B 0x40 -#define SDR_OFFSET_C 0x80 -#define SDR_OFFSET_D 0xc0 -#define SDR_OFFSET_E 0x100 -#define SDR_OFFSET_F 0x140 -#define SDR_OFFSET_G 0x180 - -/* Offsets (from TRISA) for the various port control registers */ -#define TRIS_OFFSET 0x0 -#define PORT_OFFSET 0x10 -#define LAT_OFFSET 0x20 -#define ODCF_OFFSET 0x30 - -/* Offsets (from TRISA) for the various io port bit manipulator registers */ -#define NOP_OP_OFFSET 0x0 -#define CLR_OP_OFFSET 0x4 -#define SET_OP_OFFSET 0x8 -#define INV_OP_OFFSET 0xc - - -/* - * Specific assignments of ports ports used - * Note: In general, it is not sufficient to - * change the constants below - corresponding - * changes to the code below will likely be - * required if any of the following values - * are changed. - */ - -/* DATA_PORT_TRIS must be assigned to a TRIS of the port - * that has the low 8 bits tied the 8 data bits on the ram. - */ -#define SDR_OCR OC1CON - -#define SDR_DATA_IO SDR_OFFSET_A -#define SDR_DATA_TRIS SDR_OFFSET_A - -#define SDR_ADDRESS_IO SDR_OFFSET_B -#define SDR_ADDRESS_TRIS SDR_OFFSET_B -#define ADDRESS_MASK 0xfafc - -#define SDR_BANK_IO SDR_OFFSET_D -#define SDR_BANK_TRIS SDR_OFFSET_D -#define BANK_0_BIT 4 -#define BANK_1_BIT 5 - -#define SDR_CONTROL_IO SDR_OFFSET_F -#define SDR_CONTROL_TRIS SDR_OFFSET_F -#define CONTROL_WE_BIT 0 -#define CONTROL_CAS_BIT 1 -#define CONTROL_CS_BIT 12 -#define CONTROL_RAS_BIT 13 - -#define SDR_CKE_IO SDR_OFFSET_A -#define SDR_CKE_TRIS SDR_OFFSET_A -#define CKE_BIT 10 -#define DATA_DIR_BIT 15 - -#define CONTROL_ALL_MASK ( (1< $*.s + as -o $@ $*.s + +.s.o: + as -o $@ $< + +.S.o: + as -o $@ $< + +all: hello + +hello: hello.o sys.o + ld -o hello -e main hello.o sys.o + +clean: + rm -f *.o *.s hello + diff --git a/share/lccom/hello.c b/share/lccom/hello.c new file mode 100644 index 0000000..47dcaeb --- /dev/null +++ b/share/lccom/hello.c @@ -0,0 +1,6 @@ +int main() +{ + + write(1,"hello\n",6); + exit(1); +} diff --git a/share/lccom/sys.s b/share/lccom/sys.s new file mode 100644 index 0000000..9319cf7 --- /dev/null +++ b/share/lccom/sys.s @@ -0,0 +1,100 @@ + .text + +# +# int open( char* file, int flags, int mode ) +# +open: + + # errno handling code after syscall is not ideal, + # but I don't think the assembler handles specifying + # relocations for %hi and %lo yet, so the handling + # shown in the retrobsd code is not really doable + + syscall 5 + nop + j serrn + nop + + jr $ra + nop + +# +# int read( int fd, void* dest, int count) +# returns: count of chars read or -1 if error (see errno) +# +read: + + # errno handling code after syscall is not ideal, + # but I don't think the assembler handles specifying + # relocations for %hi and %lo yet, so the handling + # shown in the retrobsd code is not really doable + + syscall 3 + nop + j serrn + nop + + jr $ra + nop + + + +# +# int write( int fd, void* string, int count ); +# returns: count of chars written or -1 if error (see errno) +# +write: + # errno handling code after syscall is not ideal, + # but I don't think the assembler handles specifying + # relocations for %hi and %lo yet, so the handling + # shown in the retrobsd code is not really doable + + syscall 4 + nop + j serrn + nop + + jr $ra + nop + +# +# int close( int fd ); +# +close: + # errno handling code after syscall is not ideal, + # but I don't think the assembler handles specifying + # relocations for %hi and %lo yet, so the handling + # shown in the retrobsd code is not really doable + + syscall 6 + nop + j serrn + nop + + jr $ra + nop + +# +# exit( int n ); +# +exit: + syscall 1 + nop + + +serrn: + la $t1, _errno + sw $t0, 0($t1) + jr $ra + nop + + .data +_errno: .byte 0,0,0,0 + + .globl open + .globl read + .globl write + .globl close + .globl exit + .globl _errno + diff --git a/share/smallc/Makefile b/share/smallc/Makefile new file mode 100644 index 0000000..1788aef --- /dev/null +++ b/share/smallc/Makefile @@ -0,0 +1,27 @@ + +.SUFFIXES: .c .s .o + +.c.o: + smallc $< + as -o $@ $*.s + +.s.o: + as -o $@ $< + +all: primelist primesum test1 test2 + +primelist: primelist.o lib.o sys.o + ld -o primelist -e _main primelist.o lib.o sys.o + +primesum: primesum.o lib.o sys.o + ld -o primesum -e _main primesum.o lib.o sys.o + +test1: test1.o lib.o sys.o + ld -o $@ -e _main test1.o lib.o sys.o + +test2: test2.o lib.o sys.o + ld -o $@ -e _main test2.o lib.o sys.o + +clean: + rm *.o primelist primesum test1 test2 primelist.s primesum.s test1.s test2.s + diff --git a/share/smallc/lib.c b/share/smallc/lib.c new file mode 100644 index 0000000..8a225b0 --- /dev/null +++ b/share/smallc/lib.c @@ -0,0 +1,37 @@ +w_s(s) +char*s; +{ + write( 1, s, strlen(s) ); +} + +strlen(s) +char*s; +{ + char *e; + e = s; + while(*e != 0) ++e; + return e-s; +} + +w_c(c) +char c; +{ + write( 1, &c, 1 ); +} + +w_n(number, radix) +int number, radix; +{ + int i; + char *drp; + drp = "0123456789ABCDEF"; + + if (number < 0 & radix == 10) + { + w_c('-'); + number = -number; + } + if ((i = number / radix) != 0) + w_n(i, radix); + w_c(drp[number % radix]); +} \ No newline at end of file diff --git a/share/smallc/primelist.c b/share/smallc/primelist.c new file mode 100644 index 0000000..2ee2d4a --- /dev/null +++ b/share/smallc/primelist.c @@ -0,0 +1,24 @@ +main() +{ + int n; + for(n=2;n<100;++n){ + if( isprime(n) ){ + w_n(n,10); + w_c(' '); + } + } + w_c('\n'); + + exit(1); +} + +isprime(n) +int n; +{ + int j; + if( n == 2 ) return 1; + if( n % 2 == 0 ) return 0; + for(j=3;j*j<=n;j+=2) + if( n % j == 0 ) return 0; + return 1; +} diff --git a/share/smallc/primesum.c b/share/smallc/primesum.c new file mode 100644 index 0000000..df1f862 --- /dev/null +++ b/share/smallc/primesum.c @@ -0,0 +1,27 @@ +main() +{ + int sum; + int n; + sum = 0; + for(n=2;n<10000;++n){ + if( isprime(n) ){ + sum += n; + } + } + w_s("sum of primes less than 10000: "); + w_n(sum,10); + w_c('\n'); + + exit(1); +} + +isprime(n) +int n; +{ + int j; + if( n == 2 ) return 1; + if( n % 2 == 0 ) return 0; + for(j=3;j*j<=n;j+=2) + if( n % j == 0 ) return 0; + return 1; +} diff --git a/share/smallc/sys.s b/share/smallc/sys.s new file mode 100644 index 0000000..a59e1d8 --- /dev/null +++ b/share/smallc/sys.s @@ -0,0 +1,159 @@ + .text + +# +# int open( char* file, int flags, int mode ) +# +_open: + lw $a0, 8($sp) + lw $a1, 4($sp) + lw $a2, 0($sp) + + # errno handling code after syscall is not ideal, + # but I don't think the assembler handles specifying + # relocations for %hi and %lo yet, so the handling + # shown in the retrobsd code is not really doable + + syscall 5 + nop + j serrn + nop + + jr $ra + nop + +# +# int read( int fd, void* dest, int count) +# returns: count of chars read or -1 if error (see errno) +# +_read: + lw $a0, 8($sp) + lw $a1, 4($sp) + lw $a2, 0($sp) + + # errno handling code after syscall is not ideal, + # but I don't think the assembler handles specifying + # relocations for %hi and %lo yet, so the handling + # shown in the retrobsd code is not really doable + + syscall 3 + nop + j serrn + nop + + jr $ra + nop + + + +# +# int write( int fd, void* string, int count ); +# returns: count of chars written or -1 if error (see errno) +# +_write: + lw $a0, 8($sp) + lw $a1, 4($sp) + lw $a2, 0($sp) + + # errno handling code after syscall is not ideal, + # but I don't think the assembler handles specifying + # relocations for %hi and %lo yet, so the handling + # shown in the retrobsd code is not really doable + + syscall 4 + nop + j serrn + nop + + jr $ra + nop + +# +# int close( int fd ); +# +_close: + lw $a0, 0($sp) + + # errno handling code after syscall is not ideal, + # but I don't think the assembler handles specifying + # relocations for %hi and %lo yet, so the handling + # shown in the retrobsd code is not really doable + + syscall 6 + nop + j serrn + nop + + jr $ra + nop + +# +# exit( int n ); +# +_exit: + lw $a0, 0($sp) + addiu $sp, $sp, -4 + syscall 1 + nop + + + + + +serrn: + la $t1, _errno + sw $t0, 0($t1) + jr $ra + nop + +# +# $v0 = value to switch on +# 0($sp) = pointer to list of value,ptr cases +# ended where ptr=0, value is used as pointer to jump to in default case +# looks like stack is popped as part of this +# FIXME - The assembler/linker only stores the bottom 16 bits +# of the labels in pair, so we construct the address by merging the 16 bits +# in the cell with the upper 16 bits in the return address of the code that +# called this. Is there a way to get the assembler linker to store the full +# address? If so, that should be used instead. +# +Tcase: + lw $t1, 0($sp) # t1=pointer to list of value/ptr pairs + addiu $sp, $sp, 4 # pop stack that held pointer +.Tcl: + lw $t2, 0($t1) # get value from pair + lw $t3, 4($t1) # get ptr from pair + beq $t3, $zero, .Tcd + nop + + beq $t2, $v0, .Tcm + nop + + addiu $t1, $t1, 8 # t1 += size of pair + j .Tcl + nop + +.Tcd: + move $t3, $t2 +.Tcm: + lui $t2, 0xffff + and $t2, $t2, $ra + or $t3, $t3, $t2 + jr $t3 + nop + +Tcallstk: + jr $t1 + nop + + .data +_errno: .byte 0,0,0,0 + + .globl _open + .globl _read + .globl _write + .globl _close + .globl _exit + .globl _errno + .globl Tcase + .globl Tcallstk + diff --git a/share/smallc/test1.c b/share/smallc/test1.c new file mode 100644 index 0000000..e06d8dd --- /dev/null +++ b/share/smallc/test1.c @@ -0,0 +1,231 @@ +main() +{ + int a,b,c,d; + int arr[5]; + int *pi; + char arrc[5]; + char *pic; + int s1,s2; + int z; + int t; + int *pip; + int *picp; + int e1,e2; + + a = 21; + b = 31; + c = 71; + d = 82; + + arr[0] = 10; + arr[1] = 20; + arr[2] = 30; + arr[3] = 40; + arr[4] = 50; + pi = &arr[0]; + + arrc[0] = 13; + arrc[1] = 23; + arrc[2] = 33; + arrc[3] = 43; + arrc[4] = 53; + pic = &arrc[0]; + + w_s("21+31="); w_n(a+b,10); w_s(" (52)\n"); + w_s("21-31="); w_n(a-b,10); w_s(" (-10)\n"); + w_s("21&71="); w_n(a&c,10); w_s(" (5)\n"); + w_s("21|82="); w_n(a|d,10); w_s(" (87)\n"); + w_s("21^82="); w_n(a^d,10); w_s(" (71)\n"); + w_s("21*82="); w_n(a*d,10); w_s(" (1722)\n"); + w_s("82%21="); w_n(d%a,10); w_s(" (19)\n"); + w_s("82/21="); w_n(d/a,10); w_s(" (3)\n"); + w_s("*pi="); w_n(*pi,10); w_s(" (10)\n"); + w_s("*pi+1="); w_n(*pi+1,10); w_s(" (11)\n"); + w_s("*(pi+1)="); w_n(*(pi+1),10); w_s(" (20)\n"); + w_s("&arr[3]-&arr[0]="); w_n(&arr[3]-&arr[0],10); w_s(" (3)\n"); + + w_s("*pic="); w_n(*pic,10); w_s(" (13)\n"); + w_s("*pic+1="); w_n(*pic+1,10); w_s(" (14)\n"); + w_s("*(pic+1)="); w_n(*(pic+1),10); w_s(" (23)\n"); + w_s("&arrc[3]-&arrc[0]="); w_n(&arrc[3]-&arrc[0],10); w_s(" (3)\n"); + + s1 = 3; + s2 = -200; + w_s("82<<3="); w_n(d<>3="); w_n(d>>s1,10); w_s(" (10)\n"); + w_s("-200>>3="); w_n(s2>>s1,10); w_s(" (-25)\n"); + w_s("-200<<3="); w_n(s2<4="); w_n(t>4,10); w_s(" (0)\n"); + w_s("t>3="); w_n(t>3,10); w_s(" (1)\n"); + w_s("t>5="); w_n(t>5,10); w_s(" (0)\n"); + w_s("t>-1="); w_n(t>-1,10); w_s(" (1)\n"); + + w_s("t>=4="); w_n(t>=4,10); w_s(" (1)\n"); + w_s("t>=3="); w_n(t>=3,10); w_s(" (1)\n"); + w_s("t>=5="); w_n(t>=5,10); w_s(" (0)\n"); + w_s("t>=-1="); w_n(t>=-1,10); w_s(" (1)\n"); + + + pi = -100; + w_s("pi<4="); w_n(pi<4,10); w_s(" (0)\n"); + w_s("pi<3="); w_n(pi<3,10); w_s(" (0)\n"); + w_s("pi<-100="); w_n(pi<-100,10); w_s(" (0)\n"); + w_s("pi<-1="); w_n(pi<-1,10); w_s(" (1)\n"); + + w_s("pi<=4="); w_n(pi<=4,10); w_s(" (0)\n"); + w_s("pi<=3="); w_n(pi<=3,10); w_s(" (0)\n"); + w_s("pi<=-100="); w_n(pi<=-100,10); w_s(" (1)\n"); + w_s("pi<=-1="); w_n(pi<=-1,10); w_s(" (1)\n"); + + pi = -100; + w_s("pi>4="); w_n(pi>4,10); w_s(" (1)\n"); + w_s("pi>3="); w_n(pi>3,10); w_s(" (1)\n"); + w_s("pi>-100="); w_n(pi>-100,10); w_s(" (0)\n"); + w_s("pi>-1="); w_n(pi>-1,10); w_s(" (0)\n"); + + w_s("pi>=4="); w_n(pi>=4,10); w_s(" (1)\n"); + w_s("pi>=3="); w_n(pi>=3,10); w_s(" (1)\n"); + w_s("pi>=-100="); w_n(pi>=-100,10); w_s(" (1)\n"); + w_s("pi>=-1="); w_n(pi>=-1,10); w_s(" (0)\n"); + + w_s("switch test: "); + switch(t) + { + case 3: + w_s("failure"); + break; + case 4: + w_s("success"); + break; + case 5: + w_s("failure"); + break; + } + w_s("\n"); + + w_s("switch fallthrough test: "); + switch(t) + { + case 3: + w_s("failure"); + break; + case 4: + w_s("OKSOFAR: "); + case 5: + w_s("success if oksofar printed before this in caps"); + break; + } + w_s("\n"); + + pi = &arr[0]; + pip = &arr[3]; + w_s("*pip-*pi: "); w_n(*pip-*pi,10); w_s(" 30\n"); + w_s("pip-pi: "); w_n(pip-pi,10); w_s(" 3\n"); + w_s("*pip: "); w_n( *pip, 10 ); w_s(" 40\n"); + w_s("*(pip-3): "); w_n(*(pip-3),10); w_s(" 10\n"); + w_s("*&arr[3]: "); w_n( *&arr[3], 10 ); w_s(" 40\n"); + // The following causes an address error, so it has been removed + // and needs to be fixed + w_s("*(&arr[3]-3): "); w_n(0/**(&arr[3]-3)*/,10); w_s(" 10 broken - causes address error\n"); + exit(0); +} + +printt(t,str) +int t; +char *str; +{ + w_s("bool t test on value "); + w_n(t,10); + w_s(" "); + w_s(str); +} diff --git a/share/smallc/test2.c b/share/smallc/test2.c new file mode 100644 index 0000000..0ff6ff4 --- /dev/null +++ b/share/smallc/test2.c @@ -0,0 +1,150 @@ + +#define O_RDONLY 0x0000 /* open for reading only */ +#define O_WRONLY 0x0001 /* open for writing only */ +#define O_RDWR 0x0002 /* open for reading and writing */ +#define O_ACCMODE 0x0003 /* mask for above modes */ + +#define O_NONBLOCK 0x0004 /* no delay */ +#define O_APPEND 0x0008 /* set append mode */ +#define O_SHLOCK 0x0010 /* open with shared file lock */ +#define O_EXLOCK 0x0020 /* open with exclusive file lock */ +#define O_ASYNC 0x0040 /* signal pgrp when data ready */ +#define O_FSYNC 0x0080 /* synchronous writes */ +#define O_CREAT 0x0200 /* create if nonexistant */ +#define O_TRUNC 0x0400 /* truncate to zero length */ +#define O_EXCL 0x0800 /* error if already exists */ + +int aaa; +int bbb; +int ccc; +char gc; +char gbuffer[3]; +int gibuffer[4]; + +extern errno; + +main() +{ + char b; + int la; + unsigned int u1, u2; + int s1, s2; + unsigned char uc1, uc2; + char sc1, sc2; + int fd; + char buffer[6]; + int ibuffer[7]; + + w_s( "sizeof(uc1): "); w_n( sizeof(uc1), 10 ); w_s( " 1\n" ); + w_s( "sizeof(sc1): "); w_n( sizeof(sc1), 10 ); w_s( " 1\n" ); + w_s( "sizeof(u1): "); w_n( sizeof(u1), 10 ); w_s( " 4\n" ); + w_s( "sizeof(s1): "); w_n( sizeof(s1), 10 ); w_s( " 4\n" ); + w_s( "sizeof(aaa): "); w_n( sizeof(aaa), 10 ); w_s( " 4\n" ); + w_s( "sizeof(bbb): "); w_n( sizeof(bbb), 10 ); w_s( " 4\n" ); + w_s( "sizeof(gc): "); w_n( sizeof(gc), 10 ); w_s( " 1\n" ); + w_s( "sizeof(buffer): "); w_n( sizeof(buffer), 10 ); w_s( " 6\n" ); + w_s( "sizeof(ibuffer): "); w_n( sizeof(ibuffer), 10 ); w_s( " 28\n" ); + w_s( "sizeof(char): "); w_n( sizeof(char), 10 ); w_s( " 1\n" ); + w_s( "sizeof(int): "); w_n( sizeof(int), 10 ); w_s( " 4\n" ); + w_s( "sizeof(gbuffer): "); w_n( sizeof(gbuffer), 10 ); w_s( " 3\n" ); + w_s( "sizeof(gibuffer): "); w_n( sizeof(gibuffer), 10 ); w_s( " 16\n" ); + // sizeof(ibuffer[0]) is not supported, so the following can be used... + w_s( "sizeof(ibuffer)/sizeof(int): "); w_n( sizeof(ibuffer)/sizeof(int), 10 ); w_s( " 7\n" ); + + aaa = 1; + bbb = 2; + la = 4; + + + w_n(aaa,10); + w_s(" 1\n"); + w_n(bbb,10); + w_s(" 2\n"); + w_n(la,10); + w_s(" 4\n"); + + uc1 = 0x80; + sc1 = 0x80; + s1 = uc1; + s2 = sc1; + w_s( "unsigned char (0x80) -> int: "); w_n( s1, 10 ); w_s( " 128\n" ); + w_s( "signed char (0x80) -> int: "); w_n( s2, 10 ); w_s( " -128\n" ); + + u1 = uc1; + u2 = sc1; + w_s( "unsigned char (0x80) -> unsigned: "); w_n( u1, 10 ); w_s( " 128\n" ); + w_s( "signed char (0x80) -> unsigned: "); w_n( u2, 10 ); w_s( " -128\n" ); + + la = errno; + w_s("errno: "); w_n(la,10); w_s( " 0\n"); + + write( 1, "abcd ", 5 ); + la = errno; + w_s("errno after good write call: "); w_n(la,10); w_s( " 0\n"); + + write( 10, "abcde", 5 ); + la = errno; + w_s("errno after bad write call: "); w_n(la,10); w_s( " 9\n"); + + write( 1, "abcd ", 5 ); + la = errno; + w_s("good write after failed should not overwrite errno: "); w_n(la,10); w_s( " 9\n"); + + errno = 0; + write( 1, "abcd ", 5 ); + la = errno; + w_s("good write after errno set to zero: "); w_n(la,10); w_s( " 0\n"); + + la = write( 1, "abcd ", 5 ); + w_s( "write() return: " ); w_n(la,10); w_s( " 5\n" ); + + la = write( 10, "abcd ", 5 ); + w_s( "write(bad fd) return: " ); w_n(la,10); w_s( " -1\n" ); + + fd = open( "/a.txt", O_WRONLY|O_CREAT, 0666 ); + if( fd != -1 ) + { + w_s("open success\n"); + la = write( fd, "abcd\n", 5 ); + if( la == 5 ) w_s( "write success\n" ); else w_s( "write failed\n" ); + la = close( fd ); + if( la != -1 ) w_s( "close success\n" ); else w_s( "close failed\n" ); + } + else + { + w_s("open failed\n"); + } + + buffer[0] = 0; + buffer[1] = 0; + buffer[2] = 0; + buffer[3] = 0; + buffer[4] = 0; + buffer[5] = 0; + + fd = open( "/a.txt", O_RDONLY, 0666 ); + if( fd != -1 ) + { + w_s("open success\n"); + la = read( fd, buffer, 5 ); + w_s( buffer ); + if( la == 5 ) w_s( "read success\n" ); else w_s( "read failed\n" ); + la = close( fd ); + if( la != -1 ) w_s( "close success\n" ); else w_s( "close failed\n" ); + } + else + { + w_s("open failed\n"); + } + + if( buffer[0] != 'a') w_s("data0 readback from file MISMATCH\n"); + if( buffer[1] != 'b') w_s("data1 readback from file MISMATCH\n"); + if( buffer[2] != 'c') w_s("data2 readback from file MISMATCH\n"); + if( buffer[3] != 'd') w_s("data3 readback from file MISMATCH\n"); + if( buffer[4] != '\n') w_s("data4 readback from file MISMATCH\n"); + + if( buffer[0] != 'a' || buffer[1] != 'b' || buffer[2] != 'c' || buffer[3] != 'd' || buffer[4] != '\n') w_s("data readback from file MISMATCH\n"); + else w_s("data readback from file OK\n"); + + exit(0); +} diff --git a/src/cmd/Makefile b/src/cmd/Makefile index e080fc7..e6f264d 100644 --- a/src/cmd/Makefile +++ b/src/cmd/Makefile @@ -13,10 +13,10 @@ CFLAGS += -Werror SUBDIR = adb adc-demo ar as awk basic cc chflags chpass \ cpp dc diff env find forth fstat glcdtest hostname \ id la lcc lcpp ld ls login make man med \ - more nm passwd picoc portio printf pwm \ + more nm passwd portio printf pwm \ ranlib re renice retroforth scm setty sl \ sed sh smallc stty sysctl test uname wiznet xargs \ - zmodem gtest + zmodem gtest cron uflash_r picoc-1 lccom-1 # /sbin SUBDIR += chown chroot disktool fsck getty init \ @@ -36,7 +36,7 @@ STD = basename cal cat cb chgrp chmod cmp col comm cp date dd du \ echo ed fgrep file grep head hostid join kill last ln \ mesg mkdir mv nice od pagesize pr printenv pwd rev rm rmail rmdir \ size sleep sort split sum sync tail tar tee time touch tr \ - tsort tty uniq w wc whereis who + tsort tty uniq w wc whereis who uflash # C programs that live in the current directory and need explicit make lines. # diff --git a/src/cmd/as/as.c b/src/cmd/as/as.c index fe33b96..fdaa36e 100644 --- a/src/cmd/as/as.c +++ b/src/cmd/as/as.c @@ -58,6 +58,8 @@ enum { LTEXT, /* .text */ LEQU, /* .equ */ LWORD, /* .word */ + LBYTE, /* .byte */ + LSPACE, /* .space */ }; /* @@ -589,6 +591,7 @@ int lookacmd () break; case 'b': if (! strcmp (".bss", name)) return (LBSS); + if (! strcmp (".byte", name)) return (LBYTE); break; case 'c': if (! strcmp (".comm", name)) return (LCOMM); @@ -604,6 +607,7 @@ int lookacmd () break; case 's': if (! strcmp (".short", name)) return (LSHORT); + if (! strcmp (".space", name)) return (LSPACE); if (! strcmp (".strng", name)) return (LSTRNG); break; case 't': @@ -1411,7 +1415,7 @@ void makeascii () void pass1 () { register int clex; - int cval, tval, csegm; + int cval, tval, csegm, nbytes, c, nwords; register unsigned addr; segm = STEXT; @@ -1506,7 +1510,7 @@ void pass1 () addr |= RSETINDEX (extref); fputword (intval, sfile[segm]); fputrel (addr, rfile[segm]); - count[segm] += 2; + count[segm] += WORDSZ; clex = getlex (&cval); if (clex != ',') { ungetlex (clex, cval); @@ -1514,6 +1518,41 @@ void pass1 () } } break; + case LBYTE: + nbytes = 0; + for (;;) { + getexpr (&cval); + fputc (intval, sfile[segm]); + nbytes++; + clex = getlex (&cval); + if (clex != ',') { + ungetlex (clex, cval); + break; + } + } + + c = (WORDSZ - (unsigned) nbytes % WORDSZ) % WORDSZ; + count[segm] += nbytes + c; + nwords = (unsigned) (nbytes + c) / WORDSZ; + while (c--) + fputc (0, sfile[segm]); + while (nwords--) + fputrel (RABS, rfile[segm]); + break; + case LSPACE: + getexpr (&cval); + for (nbytes=0;nbytes uunet!decwrl!vixie!paul +# */ + +# Makefile for vixie's cron +# +# $Id: Makefile,v 2.9 1994/01/15 20:43:43 vixie Exp $ +# +# vix 03mar88 [moved to RCS, rest of log is in there] +# vix 30mar87 [goodbye, time.c; hello, getopt] +# vix 12feb87 [cleanup for distribution] +# vix 30dec86 [written] + +# NOTES: +# 'make' can be done by anyone +# 'make install' must be done by root +# +# this package needs getopt(3), bitstring(3), and BSD install(8). +# +# the configurable stuff in this makefile consists of compilation +# options (use -O, cron runs forever) and destination directories. +# SHELL is for the 'augumented make' systems where 'make' imports +# SHELL from the environment and then uses it to run its commands. +# if your environment SHELL variable is /bin/csh, make goes real +# slow and sometimes does the wrong thing. +# +# this package needs the 'bitstring macros' library, which is +# available from me or from the comp.sources.unix archive. if you +# put 'bitstring.h' in a non-standard place (i.e., not intuited by +# cc(1)), you will have to define INCLUDE to set the include +# directory for cc. INCLUDE should be `-Isomethingorother'. +# +# there's more configuration info in config.h; edit that first! + +TOPSRC = $(shell cd ../../..; pwd) +include $(TOPSRC)/target.mk + +CFLAGS += -Werror -I. + + +DESTROOT = $(DESTDIR) +DESTSBIN = $(DESTROOT)/sbin +DESTBIN = $(DESTROOT)/bin +DESTMAN = $(DESTROOT)/share/man +INCLUDE = -I. +OPTIM = -O +#<> +LINTFLAGS = -hbxa $(INCLUDE) +#CC = cc +DEFS = +INSTALL = install +#LDFLAGS = -i +#################################### end configurable stuff + +SHELL = /bin/sh +#CFLAGS = $(OPTIM) $(INCLUDE) $(DEFS) + +LINT_CRON = cron.c database.c user.c entry.c compat.c \ + misc.c job.c do_command.c env.c popen.c +LINT_CRONTAB = crontab.c misc.c entry.c env.c compat.c +CRON_OBJ = cron.o database.o user.o entry.o job.o do_command.o \ + misc.o env.o popen.o compat.o +CRONTAB_OBJ = crontab.o misc.o entry.o env.o compat.o + +all: cron crontab + +lint: + lint $(LINTFLAGS) $(LINT_CRON) $(LIBS) \ + |grep -v "constant argument to NOT" 2>&1 + lint $(LINTFLAGS) $(LINT_CRONTAB) $(LIBS) \ + |grep -v "constant argument to NOT" 2>&1 + +cron: $(CRON_OBJ) + ${CC} ${LDFLAGS} -o $@.elf ${CRON_OBJ} ${LIBS} + ${OBJDUMP} -S $@.elf > $@.dis + ${SIZE} $@.elf + ${ELF2AOUT} $@.elf $@ + +crontab: $(CRONTAB_OBJ) + ${CC} ${LDFLAGS} -o $@.elf ${CRONTAB_OBJ} ${LIBS} + ${OBJDUMP} -S $@.elf > $@.dis + ${SIZE} $@.elf + ${ELF2AOUT} $@.elf $@ + +install: all + cp cron $(DESTSBIN)/ + cp crontab $(DESTBIN)/ + sh putman.sh crontab.1 $(DESTMAN) + sh putman.sh cron.8 $(DESTMAN) + sh putman.sh crontab.5 $(DESTMAN) + +clean: + rm -f *.o cron crontab a.out core tags *~ *.elf *.dis + +$(CRON_OBJ) : cron.h compat.h config.h externs.h pathnames.h Makefile +$(CRONTAB_OBJ) : cron.h compat.h config.h externs.h pathnames.h Makefile diff --git a/src/cmd/cron/README b/src/cmd/cron/README new file mode 100755 index 0000000..751f04f --- /dev/null +++ b/src/cmd/cron/README @@ -0,0 +1,72 @@ +#/* Copyright 1988,1990,1993 by Paul Vixie +# * All rights reserved +# * +# * Distribute freely, except: don't remove my name from the source or +# * documentation (don't take credit for my work), mark your changes (don't +# * get me blamed for your possible bugs), don't alter or remove this +# * notice. May be sold if buildable source is provided to buyer. No +# * warrantee of any kind, express or implied, is included with this +# * software; use at your own risk, responsibility for damages (if any) to +# * anyone resulting from the use of this software rests entirely with the +# * user. +# * +# * Send bug reports, bug fixes, enhancements, requests, flames, etc., and +# * I'll try to keep a version up to date. I can be reached as follows: +# * Paul Vixie uunet!decwrl!vixie!paul +# */ + +Vixie Cron V3.0 +December 27, 1993 +[V2.2 was some time in 1992] +[V2.1 was May 29, 1991] +[V2.0 was July 5, 1990] +[V2.0-beta was December 9, 1988] +[V1.0 was May 6, 1987] +Paul Vixie + +This is a version of 'cron' that is known to run on BSD 4.[23] systems. It +is functionally based on the SysV cron, which means that each user can have +their own crontab file (all crontab files are stored in a read-protected +directory, usually /var/cron/tabs). No direct support is provided for +'at'; you can continue to run 'atrun' from the crontab as you have been +doing. If you don't have atrun (i.e., System V) you are in trouble. + +A messages is logged each time a command is executed; also, the files +"allow" and "deny" in /var/cron can be used to control access to the +"crontab" command (which installs crontabs). It hasn't been tested on +SysV, although some effort has gone into making the port an easy one. + +This is more or less the copyright that USENET contributed software usually +has. Since ATT couldn't use this version if they had to freely distribute +source, and since I'd love to see them use it, I'll offer some rediculously +low license fee just to have them take it. In the unlikely event that they +do this, I will continue to support and distribute the pseudo-PD version, so +please, don't flame me for wanting my work to see a wider distribution. + +To use this: Sorry, folks, there is no cutesy 'Configure' script. You'll +have to go edit a couple of files... So, here's the checklist: + + Read all the FEATURES, INSTALL, and CONVERSION files + Edit config.h + Edit Makefile + (both of these files have instructions inside; note that + some things in config.h are definable in Makefile and are + therefore surrounded by #ifndef...#endif) + 'make' + 'su' and 'make install' + (you may have to install the man pages by hand) + kill your existing cron process + (actually you can run your existing cron if you want, but why?) + build new crontabs using /usr/lib/{crontab,crontab.local} + (either put them all in "root"'s crontab, or divide it up + and rip out all the 'su' commands, collapse the lengthy + lists into ranges with steps -- basically, this step is + as much work as you want to make it) + start up the new cron + (must be done as root) + watch it. test it with 'crontab -r' and watch the daemon track your + changes. + if you like it, change your /etc/{rc,rc.local} to use it instead of + the old one. + +$Id: README,v 2.3 1993/12/28 08:34:43 vixie Exp $ diff --git a/src/cmd/cron/README.2BSD b/src/cmd/cron/README.2BSD new file mode 100755 index 0000000..4fbe0e8 --- /dev/null +++ b/src/cmd/cron/README.2BSD @@ -0,0 +1,58 @@ + This is the 2.11BSD port of the 'Vixie cron-3.0 patch1'. + + Updated 1999/8/9: Fix an off by one condition in entry.c that was + causing the 'dow' (day of week) bitmap to be overrun by one bit. + Properly ifdef'd some rcs/sccs id strings so that they do not get + compiled in (data space is at a premium on a 16 bit machine). Fix + a bug in bitstring.h (fortunately nothing uses the macro bit_alloc + at this time) that was using 'malloc' with two arguments. Do some + minor cosmetic cleanup (trailing and extra blank lines, etc). Fix + the sigmask handling in cron_pclose() - it was using 'int' as the + signal mask type instead of 'long' or more properly 'sigmask_t'. + In addition to fixing the sigmask type the code was revised to use + modern signal and wait calls. In crontab one of the 'swap_uids' + calls should have been 'swap_uids_back' in case "SAVED_UIDS" is + supported by the system. + + The files Part01, Part02 and Patch01 were retrieved from + ftp://ftp.vix.com/pub/vixie/cron-3.0/ + + In an attempt to 'mark my changes' (so Paul Vixie doesn't get + blamed for my mistakes) this file (README.2BSD) has been created + and the following paragraph added: + + "DO NOT SEND BUG OR PROBLEM REPORTS to Paul Vixie! If 'cron' + misbehaves under 2.11BSD use the 'sendbug' program OR look for the + mail address in that script and send mail there." + + The major change made was to remove the '#ifdef' statements. + The removal of the ifdefs was prompted by several factors: + + 2.11BSD defines the symbol 'BSD' as "211". Thus the + datestamp based ifdefs ("#if BSD > 930811" for example) were + wrong - 2.11 has almost all of the capabilities of later + systems. + + 2.11BSD has all but one of the capabilities ('setsid') that + were conditionalized on "POSIX" . Thus POSIX could not be + defined. Neither could POSIX be left undefined because + that left out too much. Sigh. + + Conditionalized code is messy to read. + + The probability that this version will ever be ported back + to a 'sequent', 'convex' or 'att' system is not at this + time distinguishable from 0. + + Other changes include: + + Adding a lot more 'register' declarations (which helps + code size - this cron is still over twice as big as the + old one). + + Revised the Makefile and 'putman.sh' script to fit in better + with 2BSD's philosophy of life. + + Moved a few files into a 'grot' subdirectory to avoid + cluttering the main build area. The file "diffs" is the + summary of the changes made. diff --git a/src/cmd/cron/bitstring.3 b/src/cmd/cron/bitstring.3 new file mode 100755 index 0000000..efe9ae3 --- /dev/null +++ b/src/cmd/cron/bitstring.3 @@ -0,0 +1,168 @@ +.\" Copyright (c) 1989 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" Paul Vixie. +.\" +.\" Redistribution and use in source and binary forms are permitted +.\" provided that the above copyright notice and this paragraph are +.\" duplicated in all such forms and that any documentation, +.\" advertising materials, and other materials related to such +.\" distribution and use acknowledge that the software was developed +.\" by the University of California, Berkeley. The name of the +.\" University may not be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" @(#)bitstring.3 5.1 (Berkeley) 12/13/89 +.\" +.TH BITSTRING 3 "December 13, 1989" +.UC 4 +.SH NAME +bit_alloc, bit_clear, bit_decl, bit_ffs, bit_nclear, bit_nset, +bit_set, bitstr_size, bit_test \- bit-string manipulation macros +.SH SYNOPSIS +.ft B +.nf +#include + +name = bit_alloc(nbits) +bitstr_t *name; +int nbits; + +bit_decl(name, nbits) +bitstr_t name; +int nbits; + +bit_clear(name, bit) +bitstr_t name; +int bit; + +bit_ffc(name, nbits, value) +bitstr_t name; +int nbits, *value; + +bit_ffs(name, nbits, value) +bitstr_t name; +int nbits, *value; + +bit_nclear(name, start, stop) +bitstr_t name; +int start, stop; + +bit_nset(name, start, stop) +bitstr_t name; +int start, stop; + +bit_set(name, bit) +bitstr_t name; +int bit; + +bitstr_size(nbits) +int nbits; + +bit_test(name, bit) +bitstr_t name; +int bit; +.fi +.ft R +.SH DESCRIPTION +These macros operate on strings of bits. +.PP +.I Bit_alloc +returns a pointer of type +.I bitstr_t\ * +to sufficient space to store +.I nbits +bits, or NULL if no space is available. +.PP +.I Bit_decl +is a macro for allocating sufficient space to store +.I nbits +bits on the stack. +.PP +.I Bitstr_size +returns the number of elements of type +.I bitstr_t +necessary to store +.I nbits +bits. +This is useful for copying bit strings. +.PP +.I Bit_clear +and +.I bit_set +clear or set the zero-based numbered bit +.IR bit , +in the bit string +.IR name . +.PP +.I Bit_nset +and +.I bit_nclear +set or clear the zero-based numbered bits from +.I start +to +.I stop +in the bit string +.IR name . +.PP +.I Bit_test +evaluates to zero if the zero-based numbered bit +.I bit +of bit string +.I name +is set, and non-zero otherwise. +.PP +.I Bit_ffs +sets +.I *value +to the zero-based number of the first bit set in the array of +.I nbits +bits referenced by +.IR name . +If no bits are set, +.I *value +is set to -1. +.PP +.I Bit_ffc +sets +.I *value +to the zero-based number of the first bit not set in the array of +.I nbits +bits referenced by +.IR name . +If all bits are set, +.I value +is set to -1. +.SH EXAMPLE +.nf +.in +5 +#include +#include + +... +#define LPR_BUSY_BIT 0 +#define LPR_FORMAT_BIT 1 +#define LPR_DOWNLOAD_BIT 2 +... +#define LPR_AVAILABLE_BIT 9 +#define LPR_MAX_BITS 10 + +make_lpr_available() +{ + bitstr_t bit_decl(bitlist, LPR_MAX_BITS); + ... + bit_nclear(bitlist, 0, LPR_MAX_BITS - 1); + ... + if (!bit_test(bitlist, LPR_BUSY_BIT)) { + bit_clear(bitlist, LPR_FORMAT_BIT); + bit_clear(bitlist, LPR_DOWNLOAD_BIT); + bit_set(bitlist, LPR_AVAILABLE_BIT); + } +} +.fi +.SH "SEE ALSO" +malloc(3) diff --git a/src/cmd/cron/bitstring.h b/src/cmd/cron/bitstring.h new file mode 100755 index 0000000..fe22c22 --- /dev/null +++ b/src/cmd/cron/bitstring.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Vixie. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)bitstring.h 5.2.1 (2.11BSD) 1999/8/5 + */ + +typedef unsigned char bitstr_t; + +/* internal macros */ + /* byte of the bitstring bit is in */ +#define _bit_byte(bit) \ + ((bit) >> 3) + + /* mask for the bit within its byte */ +#define _bit_mask(bit) \ + (1 << ((bit)&0x7)) + +/* external macros */ + /* bytes in a bitstring of nbits bits */ +#define bitstr_size(nbits) \ + ((((nbits) - 1) >> 3) + 1) + + /* allocate a bitstring */ +#define bit_alloc(nbits) \ + (bitstr_t *)calloc(1, \ + (unsigned int)bitstr_size(nbits) * sizeof(bitstr_t)) + + /* allocate a bitstring on the stack */ +#define bit_decl(name, nbits) \ + (name)[bitstr_size(nbits)] + + /* is bit N of bitstring name set? */ +#define bit_test(name, bit) \ + ((name)[_bit_byte(bit)] & _bit_mask(bit)) + + /* set bit N of bitstring name */ +#define bit_set(name, bit) \ + (name)[_bit_byte(bit)] |= _bit_mask(bit) + + /* clear bit N of bitstring name */ +#define bit_clear(name, bit) \ + (name)[_bit_byte(bit)] &= ~_bit_mask(bit) + + /* clear bits start ... stop in bitstring */ +#define bit_nclear(name, start, stop) { \ + register bitstr_t *_name = name; \ + register int _start = start, _stop = stop; \ + register int _startbyte = _bit_byte(_start); \ + register int _stopbyte = _bit_byte(_stop); \ + if (_startbyte == _stopbyte) { \ + _name[_startbyte] &= ((0xff >> (8 - (_start&0x7))) | \ + (0xff << ((_stop&0x7) + 1))); \ + } else { \ + _name[_startbyte] &= 0xff >> (8 - (_start&0x7)); \ + while (++_startbyte < _stopbyte) \ + _name[_startbyte] = 0; \ + _name[_stopbyte] &= 0xff << ((_stop&0x7) + 1); \ + } \ +} + + /* set bits start ... stop in bitstring */ +#define bit_nset(name, start, stop) { \ + register bitstr_t *_name = name; \ + register int _start = start, _stop = stop; \ + register int _startbyte = _bit_byte(_start); \ + register int _stopbyte = _bit_byte(_stop); \ + if (_startbyte == _stopbyte) { \ + _name[_startbyte] |= ((0xff << (_start&0x7)) & \ + (0xff >> (7 - (_stop&0x7)))); \ + } else { \ + _name[_startbyte] |= 0xff << ((_start)&0x7); \ + while (++_startbyte < _stopbyte) \ + _name[_startbyte] = 0xff; \ + _name[_stopbyte] |= 0xff >> (7 - (_stop&0x7)); \ + } \ +} + + /* find first bit clear in name */ +#define bit_ffc(name, nbits, value) { \ + register bitstr_t *_name = name; \ + register int _byte, _nbits = nbits; \ + register int _stopbyte = _bit_byte(_nbits), _value = -1; \ + for (_byte = 0; _byte <= _stopbyte; ++_byte) \ + if (_name[_byte] != 0xff) { \ + _value = _byte << 3; \ + for (_stopbyte = _name[_byte]; (_stopbyte&0x1); \ + ++_value, _stopbyte >>= 1); \ + break; \ + } \ + *(value) = _value; \ +} + + /* find first bit set in name */ +#define bit_ffs(name, nbits, value) { \ + register bitstr_t *_name = name; \ + register int _byte, _nbits = nbits; \ + register int _stopbyte = _bit_byte(_nbits), _value = -1; \ + for (_byte = 0; _byte <= _stopbyte; ++_byte) \ + if (_name[_byte]) { \ + _value = _byte << 3; \ + for (_stopbyte = _name[_byte]; !(_stopbyte&0x1); \ + ++_value, _stopbyte >>= 1); \ + break; \ + } \ + *(value) = _value; \ +} diff --git a/src/cmd/cron/compat.c b/src/cmd/cron/compat.c new file mode 100755 index 0000000..5b7886f --- /dev/null +++ b/src/cmd/cron/compat.c @@ -0,0 +1,58 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && !defined(LINT) +static char rcsid[] = "$Id: compat.c,v 1.6 1994/01/15 20:43:43 vixie Exp $"; +#endif + +/* vix 30dec93 [broke this out of misc.c - see RCS log for history] + * vix 15jan87 [added TIOCNOTTY, thanks csg@pyramid] + */ + + +#include "cron.h" + +#include +#include +#include + +/* + * Ripped off from daemon(3) - differences are this sets the process group + * and does not fork (because that has been done already). +*/ +int +setsid() +{ + int newpgrp; + register int fd; + + newpgrp = setpgrp(0, getpid()); + if ((fd = open(_PATH_TTY, 2)) >= 0) + { + (void) ioctl(fd, TIOCNOTTY, (char*)0); + (void) close(fd); + } + if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) + { + (void)dup2(fd, 0); + (void)dup2(fd, 1); + (void)dup2(fd, 2); + if (fd > 2) + (void)close(fd); + } + return newpgrp; +} diff --git a/src/cmd/cron/compat.h b/src/cmd/cron/compat.h new file mode 100755 index 0000000..30d203c --- /dev/null +++ b/src/cmd/cron/compat.h @@ -0,0 +1,32 @@ +/* Copyright 1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +/* + * $Id: compat.h,v 1.8 1994/01/15 20:43:43 vixie Exp $ + */ + +#ifndef __P +#define __P(x) () +#define const +#endif + +/*****************************************************************/ + +#define WAIT_T int +//union wait +#define PID_T pid_t +#define TIME_T time_t diff --git a/src/cmd/cron/config.h b/src/cmd/cron/config.h new file mode 100755 index 0000000..7a8e2fc --- /dev/null +++ b/src/cmd/cron/config.h @@ -0,0 +1,86 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +/* config.h - configurables for Vixie Cron + * + * $Id: config.h,v 2.6 1994/01/15 20:43:43 vixie Exp $ + */ + +#if !defined(_PATH_SENDMAIL) +# define _PATH_SENDMAIL "/usr/lib/sendmail" +#endif /*SENDMAIL*/ + +/* + * these are site-dependent + */ + +#ifndef DEBUGGING +#define DEBUGGING 1 /* 1 or 0 -- do you want debugging code built in? */ +#endif + + /* + * choose one of these MAILCMD commands. I use + * /bin/mail for speed; it makes biff bark but doesn't + * do aliasing. /usr/lib/sendmail does aliasing but is + * a hog for short messages. aliasing is not needed + * if you make use of the MAILTO= feature in crontabs. + * (hint: MAILTO= was added for this reason). + */ + +#define MAILCMD _PATH_SENDMAIL /*-*/ +#define MAILARGS "%s -FCronDaemon -odi -oem -or0s %s" /*-*/ + /* -Fx = set full-name of sender + * -odi = Option Deliverymode Interactive + * -oem = Option Errors Mailedtosender + * -or0s = Option Readtimeout -- don't time out + */ + +/* #define MAILCMD "/bin/mail" /*-*/ +/* #define MAILARGS "%s -d %s" /*-*/ + /* -d = undocumented but common flag: deliver locally? + */ + +/* #define MAILCMD "/usr/mmdf/bin/submit" /*-*/ +/* #define MAILARGS "%s -mlrxto %s" /*-*/ + +/* #define MAIL_DATE /*-*/ + /* should we include an ersatz Date: header in + * generated mail? if you are using sendmail + * for MAILCMD, it is better to let sendmail + * generate the Date: header. + */ + + /* if ALLOW_FILE and DENY_FILE are not defined or are + * defined but neither exists, should crontab(1) be + * usable only by root? + */ +/*#define ALLOW_ONLY_ROOT /*-*/ + + /* if you want to use syslog(3) instead of appending + * to CRONDIR/LOG_FILE (/var/cron/log, e.g.), define + * SYSLOG here. Note that quite a bit of logging + * info is written, and that you probably don't want + * to use this on 4.2bsd since everything goes in + * /usr/spool/mqueue/syslog. On 4.[34]bsd you can + * tell /etc/syslog.conf to send cron's logging to + * a separate file. + * + * Note that if this and LOG_FILE in "pathnames.h" + * are both defined, then logging will go to both + * places. + */ +#define SYSLOG /*-*/ diff --git a/src/cmd/cron/cron.8 b/src/cmd/cron/cron.8 new file mode 100755 index 0000000..1d6dcda --- /dev/null +++ b/src/cmd/cron/cron.8 @@ -0,0 +1,61 @@ +.\"/* Copyright 1988,1990,1993 by Paul Vixie +.\" * All rights reserved +.\" * +.\" * Distribute freely, except: don't remove my name from the source or +.\" * documentation (don't take credit for my work), mark your changes (don't +.\" * get me blamed for your possible bugs), don't alter or remove this +.\" * notice. May be sold if buildable source is provided to buyer. No +.\" * warrantee of any kind, express or implied, is included with this +.\" * software; use at your own risk, responsibility for damages (if any) to +.\" * anyone resulting from the use of this software rests entirely with the +.\" * user. +.\" * +.\" * Send bug reports, bug fixes, enhancements, requests, flames, etc., and +.\" * I'll try to keep a version up to date. I can be reached as follows: +.\" * Paul Vixie uunet!decwrl!vixie!paul +.\" */ +.\" +.\" $Id: cron.8,v 2.2 1993/12/28 08:34:43 vixie Exp $ +.\" +.TH CRON 8 "20 December 1993" +.UC 4 +.SH NAME +cron \- daemon to execute scheduled commands (Vixie Cron) +.SH SYNOPSIS +cron +.SH DESCRIPTION +.I Cron +should be started from /etc/rc or /etc/rc.local. It will return immediately, +so you don't need to start it with '&'. +.PP +.I Cron +searches /var/cron/tabs for crontab files which are named after accounts in +/etc/passwd; crontabs found are loaded into memory. +.I Cron +also searches for /etc/crontab which is in a different format (see +.IR crontab(5)). +.I Cron +then wakes up every minute, examining all stored crontabs, checking each +command to see if it should be run in the current minute. When executing +commands, any output is mailed to the owner of the crontab (or to the user +named in the MAILTO environment variable in the crontab, if such exists). +.PP +Additionally, +.I cron +checks each minute to see if its spool directory's modtime (or the modtime +on +.IR /etc/crontab) +has changed, and if it has, +.I cron +will then examine the modtime on all crontabs and reload those which have +changed. Thus +.I cron +need not be restarted whenever a crontab file is modified. Note that the +.IR Crontab (1) +command updates the modtime of the spool directory whenever it changes a +crontab. +.SH "SEE ALSO" +crontab(1), crontab(5) +.SH AUTHOR +.nf +Paul Vixie diff --git a/src/cmd/cron/cron.c b/src/cmd/cron/cron.c new file mode 100755 index 0000000..2212886 --- /dev/null +++ b/src/cmd/cron/cron.c @@ -0,0 +1,277 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && defined(DOSCCS) +static char sccsid[] = "@(#)cron.c 2.11.1 (2.11BSD) 1999/08/05"; +#endif + +#define MAIN_PROGRAM + +#include "cron.h" +#include +#include + +static void usage __P((void)), + run_reboot_jobs __P((cron_db *)), + cron_tick __P((cron_db *)), + cron_sync __P((void)), + cron_sleep __P((void)), + sigchld_handler __P((int)), + sighup_handler __P((int)), + parse_args __P((int c, char *v[])); + + +static void +usage() { + fprintf(stderr, "usage: %s [-x debugflag[,...]]\n", ProgramName); + exit(ERROR_EXIT); +} + + +int +main(argc, argv) + int argc; + char *argv[]; +{ + cron_db database; + + ProgramName = argv[0]; + + setlinebuf(stdout); + setlinebuf(stderr); + + parse_args(argc, argv); + + (void) signal(SIGCHLD, sigchld_handler); + (void) signal(SIGHUP, sighup_handler); + + acquire_daemonlock(0); + set_cron_uid(); + set_cron_cwd(); + + setenv("PATH", _PATH_DEFPATH, 1); + + /* if there are no debug flags turned on, fork as a daemon should. + */ +# if DEBUGGING + if (DebugFlags) { +# else + if (0) { +# endif + (void) fprintf(stderr, "[%d] cron started\n", getpid()); + } else { + switch (fork()) { + case -1: + log_it("CRON",getpid(),"DEATH","can't fork"); + exit(0); + break; + case 0: + /* child process */ + log_it("CRON",getpid(),"STARTUP","fork ok"); + (void) setsid(); + break; + default: + /* parent process should just die */ + _exit(0); + } + } + + acquire_daemonlock(0); + database.head = NULL; + database.tail = NULL; + database.mtime = (time_t) 0; + load_database(&database); + run_reboot_jobs(&database); + cron_sync(); + while (TRUE) { +# if DEBUGGING + if (!(DebugFlags & DTEST)) +# endif /*DEBUGGING*/ + cron_sleep(); + + load_database(&database); + + /* do this iteration + */ + cron_tick(&database); + + /* sleep 1 minute + */ + TargetTime += 60; + } +} + + +static void +run_reboot_jobs(db) + cron_db *db; +{ + register user *u; + register entry *e; + + for (u = db->head; u != NULL; u = u->next) { + for (e = u->crontab; e != NULL; e = e->next) { + if (e->flags & WHEN_REBOOT) { + job_add(e, u); + } + } + } + (void) job_runqueue(); +} + + +static void +cron_tick(db) + cron_db *db; +{ + register struct tm *tm = localtime(&TargetTime); + register int minute, hour, dom, month, dow; + register user *u; + register entry *e; + + /* make 0-based values out of these so we can use them as indicies + */ + minute = tm->tm_min -FIRST_MINUTE; + hour = tm->tm_hour -FIRST_HOUR; + dom = tm->tm_mday -FIRST_DOM; + month = tm->tm_mon +1 /* 0..11 -> 1..12 */ -FIRST_MONTH; + dow = tm->tm_wday -FIRST_DOW; + + Debug(DSCH, ("[%d] tick(%d,%d,%d,%d,%d)\n", + getpid(), minute, hour, dom, month, dow)) + + /* the dom/dow situation is odd. '* * 1,15 * Sun' will run on the + * first and fifteenth AND every Sunday; '* * * * Sun' will run *only* + * on Sundays; '* * 1,15 * *' will run *only* the 1st and 15th. this + * is why we keep 'e->dow_star' and 'e->dom_star'. yes, it's bizarre. + * like many bizarre things, it's the standard. + */ + for (u = db->head; u != NULL; u = u->next) { + for (e = u->crontab; e != NULL; e = e->next) { + Debug(DSCH|DEXT, ("user [%s:%d:%d:...] cmd=\"%s\"\n", + env_get("LOGNAME", e->envp), + e->uid, e->gid, e->cmd)) + if (bit_test(e->minute, minute) + && bit_test(e->hour, hour) + && bit_test(e->month, month) + && ( ((e->flags & DOM_STAR) || (e->flags & DOW_STAR)) + ? (bit_test(e->dow,dow) && bit_test(e->dom,dom)) + : (bit_test(e->dow,dow) || bit_test(e->dom,dom)) + ) + ) { + job_add(e, u); + } + } + } +} + + +/* the task here is to figure out how long it's going to be until :00 of the + * following minute and initialize TargetTime to this value. TargetTime + * will subsequently slide 60 seconds at a time, with correction applied + * implicitly in cron_sleep(). it would be nice to let cron execute in + * the "current minute" before going to sleep, but by restarting cron you + * could then get it to execute a given minute's jobs more than once. + * instead we have the chance of missing a minute's jobs completely, but + * that's something sysadmin's know to expect what with crashing computers.. + */ +static void +cron_sync() { + register struct tm *tm; + + TargetTime = time((time_t*)0); + tm = localtime(&TargetTime); + TargetTime += (60 - tm->tm_sec); +} + + +static void +cron_sleep() { + register int seconds_to_wait; + + do { + seconds_to_wait = (int) (TargetTime - time((time_t*)0)); + Debug(DSCH, ("[%d] TargetTime=%ld, sec-to-wait=%d\n", + getpid(), TargetTime, seconds_to_wait)) + + /* if we intend to sleep, this means that it's finally + * time to empty the job queue (execute it). + * + * if we run any jobs, we'll probably screw up our timing, + * so go recompute. + * + * note that we depend here on the left-to-right nature + * of &&, and the short-circuiting. + */ + } while (seconds_to_wait > 0 && job_runqueue()); + + while (seconds_to_wait > 0) { + Debug(DSCH, ("[%d] sleeping for %d seconds\n", + getpid(), seconds_to_wait)) + seconds_to_wait = (int) sleep((unsigned int) seconds_to_wait); + } +} + + +static void +sigchld_handler(x) { + WAIT_T waiter; + PID_T pid; + + for (;;) { + pid = waitpid(-1, &waiter, WNOHANG); + switch (pid) { + case -1: + Debug(DPROC, + ("[%d] sigchld...no children\n", getpid())) + return; + case 0: + Debug(DPROC, + ("[%d] sigchld...no dead kids\n", getpid())) + return; + default: + Debug(DPROC, + ("[%d] sigchld...pid #%d died, stat=%d\n", + getpid(), pid, WEXITSTATUS(waiter))) + } + } +} + +static void +sighup_handler(x) { + log_close(); +} + + +static void +parse_args(argc, argv) + int argc; + char *argv[]; +{ + int argch; + + while (EOF != (argch = getopt(argc, argv, "x:"))) { + switch (argch) { + default: + usage(); + case 'x': + if (!set_debug_flags(optarg)) + usage(); + break; + } + } +} diff --git a/src/cmd/cron/cron.h b/src/cmd/cron/cron.h new file mode 100755 index 0000000..612e69b --- /dev/null +++ b/src/cmd/cron/cron.h @@ -0,0 +1,275 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +/* cron.h - header for vixie's cron + * + * $Id: cron.h,v 2.10 1994/01/15 20:43:43 vixie Exp $ + * + * vix 14nov88 [rest of log is in RCS] + * vix 14jan87 [0 or 7 can be sunday; thanks, mwm@berkeley] + * vix 30dec86 [written] + */ + +/* reorder these #include's at your peril */ + +#include +#include +#include "compat.h" + +#include +#include +#include +#include +#include + +#include "pathnames.h" +#include "config.h" +#include "externs.h" + + /* these are really immutable, and are + * defined for symbolic convenience only + * TRUE, FALSE, and ERR must be distinct + * ERR must be < OK. + */ +#define TRUE 1 +#define FALSE 0 + /* system calls return this on success */ +#define OK 0 + /* or this on error */ +#define ERR (-1) + + /* turn this on to get '-x' code */ +#ifndef DEBUGGING +#define DEBUGGING FALSE +#endif + +#define READ_PIPE 0 /* which end of a pipe pair do you read? */ +#define WRITE_PIPE 1 /* or write to? */ +#define STDIN 0 /* what is stdin's file descriptor? */ +#define STDOUT 1 /* stdout's? */ +#define STDERR 2 /* stderr's? */ +#define ERROR_EXIT 1 /* exit() with this will scare the shell */ +#define OK_EXIT 0 /* exit() with this is considered 'normal' */ +#define MAX_FNAME 100 /* max length of internally generated fn */ +#define MAX_COMMAND 1000 /* max length of internally generated cmd */ +#define MAX_ENVSTR 1000 /* max length of envvar=value\0 strings */ +#define MAX_TEMPSTR 100 /* obvious */ +#define MAX_UNAME 20 /* max length of username, should be overkill */ +#define ROOT_UID 0 /* don't change this, it really must be root */ +#define ROOT_USER "root" /* ditto */ + + /* NOTE: these correspond to DebugFlagNames, + * defined below. + */ +#define DEXT 0x0001 /* extend flag for other debug masks */ +#define DSCH 0x0002 /* scheduling debug mask */ +#define DPROC 0x0004 /* process control debug mask */ +#define DPARS 0x0008 /* parsing debug mask */ +#define DLOAD 0x0010 /* database loading debug mask */ +#define DMISC 0x0020 /* misc debug mask */ +#define DTEST 0x0040 /* test mode: don't execute any commands */ +#define DBIT 0x0080 /* bit twiddling shown (long) */ + +#define CRON_TAB(u) "%s/%s", SPOOL_DIR, u +#define REG register +#define PPC_NULL ((char **)NULL) + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + +#define Skip_Blanks(c, f) \ + while (c == '\t' || c == ' ') \ + c = get_char(f); + +#define Skip_Nonblanks(c, f) \ + while (c!='\t' && c!=' ' && c!='\n' && c != EOF) \ + c = get_char(f); + +#define Skip_Line(c, f) \ + do {c = get_char(f);} while (c != '\n' && c != EOF); + +#if DEBUGGING +# define Debug(mask, message) \ + if ( (DebugFlags & (mask) ) == (mask) ) \ + printf message; +#else /* !DEBUGGING */ +# define Debug(mask, message) \ + ; +#endif /* DEBUGGING */ + +#define Set_LineNum(ln) {Debug(DPARS|DEXT,("linenum=%d\n",ln)); \ + LineNumber = ln; \ + } + +#define FIRST_MINUTE 0 +#define LAST_MINUTE 59 +#define MINUTE_COUNT (LAST_MINUTE - FIRST_MINUTE + 1) + +#define FIRST_HOUR 0 +#define LAST_HOUR 23 +#define HOUR_COUNT (LAST_HOUR - FIRST_HOUR + 1) + +#define FIRST_DOM 1 +#define LAST_DOM 31 +#define DOM_COUNT (LAST_DOM - FIRST_DOM + 1) + +#define FIRST_MONTH 1 +#define LAST_MONTH 12 +#define MONTH_COUNT (LAST_MONTH - FIRST_MONTH + 1) + +/* note on DOW: 0 and 7 are both Sunday, for compatibility reasons. */ +#define FIRST_DOW 0 +#define LAST_DOW 7 +#define DOW_COUNT (LAST_DOW - FIRST_DOW + 1) + + /* each user's crontab will be held as a list of + * the following structure. + * + * These are the cron commands. + */ + +typedef struct _entry { + struct _entry *next; + uid_t uid; + gid_t gid; + char **envp; + char *cmd; + bitstr_t bit_decl(minute, MINUTE_COUNT); + bitstr_t bit_decl(hour, HOUR_COUNT); + bitstr_t bit_decl(dom, DOM_COUNT); + bitstr_t bit_decl(month, MONTH_COUNT); + bitstr_t bit_decl(dow, DOW_COUNT); + int flags; +#define DOM_STAR 0x01 +#define DOW_STAR 0x02 +#define WHEN_REBOOT 0x04 +} entry; + + /* the crontab database will be a list of the + * following structure, one element per user + * plus one for the system. + * + * These are the crontabs. + */ + +typedef struct _user { + struct _user *next, *prev; /* links */ + char *name; + time_t mtime; /* last modtime of crontab */ + entry *crontab; /* this person's crontab */ +} user; + +typedef struct _cron_db { + user *head, *tail; /* links */ + time_t mtime; /* last modtime on spooldir */ +} cron_db; + + +void set_cron_uid __P((void)), + set_cron_cwd __P((void)), + load_database __P((cron_db *)), + open_logfile __P((void)), + sigpipe_func __P((void)), + job_add __P((entry *, user *)), + do_command __P((entry *, user *)), + link_user __P((cron_db *, user *)), + unlink_user __P((cron_db *, user *)), + free_user __P((user *)), + env_free __P((char **)), + unget_char __P((int, FILE *)), + free_entry __P((entry *)), + acquire_daemonlock __P((int)), + skip_comments __P((FILE *)), + log_it __P((char *, int, char *, char *)), + log_close __P((void)); + +int job_runqueue __P((void)), + set_debug_flags __P((char *)), + get_char __P((FILE *)), + get_string __P((char *, int, FILE *, char *)), + swap_uids __P((void)), + load_env __P((char *, FILE *)), + cron_pclose __P((FILE *)), + strcmp_until __P((char *, char *, int)), + allowed __P((char *)), + strdtb __P((char *)); + +char *env_get __P((char *, char **)), + *arpadate __P((time_t *)), + *mkprints __P((unsigned char *, unsigned int)), + *first_word __P((char *, char *)), + **env_init __P((void)), + **env_copy __P((char **)), + **env_set __P((char **, char *)); + +user *load_user __P((int, struct passwd *, char *)), + *find_user __P((cron_db *, char *)); + +entry *load_entry __P((FILE *, void (*)(), + struct passwd *, char **)); + +FILE *cron_popen __P((char *, char *)); + + + /* in the C tradition, we only create + * variables for the main program, just + * extern them elsewhere. + */ + +#ifdef MAIN_PROGRAM +# if !defined(LINT) && !defined(lint) +char *copyright[] = { + "@(#) Copyright 1988,1989,1990,1993,1994 by Paul Vixie", + "@(#) All rights reserved" + }; +# endif + +char *MonthNames[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + NULL + }; + +char *DowNames[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", + NULL + }; + +char *ProgramName; +int LineNumber; +time_t TargetTime; + +# if DEBUGGING +int DebugFlags; +char *DebugFlagNames[] = { /* sync with #defines */ + "ext", "sch", "proc", "pars", "load", "misc", "test", "bit", + NULL /* NULL must be last element */ + }; +# endif /* DEBUGGING */ +#else /*MAIN_PROGRAM*/ +extern char *copyright[], + *MonthNames[], + *DowNames[], + *ProgramName; +extern int LineNumber; +extern time_t TargetTime; +# if DEBUGGING +extern int DebugFlags; +extern char *DebugFlagNames[]; +# endif /* DEBUGGING */ +#endif /*MAIN_PROGRAM*/ diff --git a/src/cmd/cron/crontab.1 b/src/cmd/cron/crontab.1 new file mode 100755 index 0000000..c3c3943 --- /dev/null +++ b/src/cmd/cron/crontab.1 @@ -0,0 +1,100 @@ +.\"/* Copyright 1988,1990,1993 by Paul Vixie +.\" * All rights reserved +.\" * +.\" * Distribute freely, except: don't remove my name from the source or +.\" * documentation (don't take credit for my work), mark your changes (don't +.\" * get me blamed for your possible bugs), don't alter or remove this +.\" * notice. May be sold if buildable source is provided to buyer. No +.\" * warrantee of any kind, express or implied, is included with this +.\" * software; use at your own risk, responsibility for damages (if any) to +.\" * anyone resulting from the use of this software rests entirely with the +.\" * user. +.\" * +.\" * Send bug reports, bug fixes, enhancements, requests, flames, etc., and +.\" * I'll try to keep a version up to date. I can be reached as follows: +.\" * Paul Vixie uunet!decwrl!vixie!paul +.\" */ +.\" +.\" $Id: crontab.1,v 2.4 1993/12/31 10:47:33 vixie Exp $ +.\" +.TH CRONTAB 1 "29 December 1993" +.UC 4 +.SH NAME +crontab \- maintain crontab files for individual users (V3) +.SH SYNOPSIS +crontab [ -u user ] file +.br +crontab [ -u user ] { -l | -r | -e } +.SH DESCRIPTION +.I Crontab +is the program used to install, deinstall or list the tables +used to drive the +.IR cron (8) +daemon in Vixie Cron. Each user can have their own crontab, and though +these are files in /var, they are not intended to be edited directly. +.PP +If the +.I allow +file exists, then you must be listed therein in order to be allowed to use +this command. If the +.I allow +file does not exist but the +.I deny +file does exist, then you must \fBnot\fR be listed in the +.I deny +file in order to use this command. If neither of these files exists, then +depending on site-dependent configuration parameters, only the super user +will be allowed to use this command, or all users will be able to use this +command. +.PP +If the +.I -u +option is given, it specifies the name of the user whose crontab is to be +tweaked. If this option is not given, +.I crontab +examines "your" crontab, i.e., the crontab of the person executing the +command. Note that +.IR su (8) +can confuse +.I crontab +and that if you are running inside of +.IR su (8) +you should always use the +.I -u +option for safety's sake. +.PP +The first form of this command is used to install a new crontab from some +named file or standard input if the pseudo-filename ``-'' is given. +.PP +The +.I -l +option causes the current crontab to be displayed on standard output. +.PP +The +.I -r +option causes the current crontab to be removed. +.PP +The +.I -e +option is used to edit the current crontab using the editor specified by +the \s-1VISUAL\s+1 or \s-1EDITOR\s+1 environment variables. After you exit +from the editor, the modified crontab will be installed automatically. +.SH "SEE ALSO" +crontab(5), cron(8) +.SH FILES +.nf +/var/cron/allow +/var/cron/deny +.fi +.SH STANDARDS +The +.I crontab +command conforms to IEEE Std1003.2-1992 (``POSIX''). This new command syntax +differs from previous versions of Vixie Cron, as well as from the classic +SVR3 syntax. +.SH DIAGNOSTICS +A fairly informative usage message appears if you run it with a bad command +line. +.SH AUTHOR +.nf +Paul Vixie diff --git a/src/cmd/cron/crontab.5 b/src/cmd/cron/crontab.5 new file mode 100755 index 0000000..01b52f0 --- /dev/null +++ b/src/cmd/cron/crontab.5 @@ -0,0 +1,188 @@ +.\"/* Copyright 1988,1990,1993,1994 by Paul Vixie +.\" * All rights reserved +.\" * +.\" * Distribute freely, except: don't remove my name from the source or +.\" * documentation (don't take credit for my work), mark your changes (don't +.\" * get me blamed for your possible bugs), don't alter or remove this +.\" * notice. May be sold if buildable source is provided to buyer. No +.\" * warrantee of any kind, express or implied, is included with this +.\" * software; use at your own risk, responsibility for damages (if any) to +.\" * anyone resulting from the use of this software rests entirely with the +.\" * user. +.\" * +.\" * Send bug reports, bug fixes, enhancements, requests, flames, etc., and +.\" * I'll try to keep a version up to date. I can be reached as follows: +.\" * Paul Vixie uunet!decwrl!vixie!paul +.\" */ +.\" +.\" $Id: crontab.5,v 2.4 1994/01/15 20:43:43 vixie Exp $ +.\" +.TH CRONTAB 5 "24 January 1994" +.UC 4 +.SH NAME +crontab \- tables for driving cron +.SH DESCRIPTION +A +.I crontab +file contains instructions to the +.IR cron (8) +daemon of the general form: ``run this command at this time on this date''. +Each user has their own crontab, and commands in any given crontab will be +executed as the user who owns the crontab. Uucp and News will usually have +their own crontabs, eliminating the need for explicitly running +.IR su (1) +as part of a cron command. +.PP +Blank lines and leading spaces and tabs are ignored. Lines whose first +non-space character is a pound-sign (#) are comments, and are ignored. +Note that comments are not allowed on the same line as cron commands, since +they will be taken to be part of the command. Similarly, comments are not +allowed on the same line as environment variable settings. +.PP +An active line in a crontab will be either an environment setting or a cron +command. An environment setting is of the form, +.PP + name = value +.PP +where the spaces around the equal-sign (=) are optional, and any subsequent +non-leading spaces in +.I value +will be part of the value assigned to +.IR name . +The +.I value +string may be placed in quotes (single or double, but matching) to preserve +leading or trailing blanks. +.PP +Several environment variables are set up +automatically by the +.IR cron (8) +daemon. +SHELL is set to /bin/sh, and LOGNAME and HOME are set from the /etc/passwd +line of the crontab's owner. +HOME and SHELL may be overridden by settings in the crontab; LOGNAME may not. +.PP +(Another note: the LOGNAME variable is sometimes called USER on BSD systems... +on these systems, USER will be set also.) +.PP +In addition to LOGNAME, HOME, and SHELL, +.IR cron (8) +will look at MAILTO if it has any reason to send mail as a result of running +commands in ``this'' crontab. If MAILTO is defined (and non-empty), mail is +sent to the user so named. If MAILTO is defined but empty (MAILTO=""), no +mail will be sent. Otherwise mail is sent to the owner of the crontab. This +option is useful if you decide on /bin/mail instead of /usr/lib/sendmail as +your mailer when you install cron -- /bin/mail doesn't do aliasing, and UUCP +usually doesn't read its mail. +.PP +The format of a cron command is very much the V7 standard, with a number of +upward-compatible extensions. Each line has five time and date fields, +followed by a user name if this is the system crontab file, +followed by a command. Commands are executed by +.IR cron (8) +when the minute, hour, and month of year fields match the current time, +.I and +when at least one of the two day fields (day of month, or day of week) +match the current time (see ``Note'' below). +.IR cron (8) +examines cron entries once every minute. +The time and date fields are: +.IP +.ta 1.5i +field allowed values +.br +----- -------------- +.br +minute 0-59 +.br +hour 0-23 +.br +day of month 0-31 +.br +month 0-12 (or names, see below) +.br +day of week 0-7 (0 or 7 is Sun, or use names) +.br +.PP +A field may be an asterisk (*), which always stands for ``first\-last''. +.PP +Ranges of numbers are allowed. Ranges are two numbers separated +with a hyphen. The specified range is inclusive. For example, +8-11 for an ``hours'' entry specifies execution at hours 8, 9, 10 +and 11. +.PP +Lists are allowed. A list is a set of numbers (or ranges) +separated by commas. Examples: ``1,2,5,9'', ``0-4,8-12''. +.PP +Step values can be used in conjunction with ranges. Following +a range with ``/'' specifies skips of the number's value +through the range. For example, ``0-23/2'' can be used in the hours +field to specify command execution every other hour (the alternative +in the V7 standard is ``0,2,4,6,8,10,12,14,16,18,20,22''). Steps are +also permitted after an asterisk, so if you want to say ``every two +hours'', just use ``*/2''. +.PP +Names can also be used for the ``month'' and ``day of week'' +fields. Use the first three letters of the particular +day or month (case doesn't matter). Ranges or +lists of names are not allowed. +.PP +The ``sixth'' field (the rest of the line) specifies the command to be +run. +The entire command portion of the line, up to a newline or % +character, will be executed by /bin/sh or by the shell +specified in the SHELL variable of the cronfile. +Percent-signs (%) in the command, unless escaped with backslash +(\\), will be changed into newline characters, and all data +after the first % will be sent to the command as standard +input. +.PP +Note: The day of a command's execution can be specified by two +fields \(em day of month, and day of week. If both fields are +restricted (ie, aren't *), the command will be run when +.I either +field matches the current time. For example, +.br +``30 4 1,15 * 5'' +would cause a command to be run at 4:30 am on the 1st and 15th of each +month, plus every Friday. +.SH EXAMPLE CRON FILE +.nf + +# use /bin/sh to run commands, no matter what /etc/passwd says +SHELL=/bin/sh +# mail any output to `paul', no matter whose crontab this is +MAILTO=paul +# +# run five minutes after midnight, every day +5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1 +# run at 2:15pm on the first of every month -- output mailed to paul +15 14 1 * * $HOME/bin/monthly +# run at 10 pm on weekdays, annoy Joe +0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?% +23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday" +5 4 * * sun echo "run at 5 after 4 every sunday" +.fi +.SH SEE ALSO +cron(8), crontab(1) +.SH EXTENSIONS +When specifying day of week, both day 0 and day 7 will be considered Sunday. +BSD and ATT seem to disagree about this. +.PP +Lists and ranges are allowed to co-exist in the same field. "1-3,7-9" would +be rejected by ATT or BSD cron -- they want to see "1-3" or "7,8,9" ONLY. +.PP +Ranges can include "steps", so "1-9/2" is the same as "1,3,5,7,9". +.PP +Names of months or days of the week can be specified by name. +.PP +Environment variables can be set in the crontab. In BSD or ATT, the +environment handed to child processes is basically the one from /etc/rc. +.PP +Command output is mailed to the crontab owner (BSD can't do this), can be +mailed to a person other than the crontab owner (SysV can't do this), or the +feature can be turned off and no mail will be sent at all (SysV can't do this +either). +.SH AUTHOR +.nf +Paul Vixie diff --git a/src/cmd/cron/crontab.c b/src/cmd/cron/crontab.c new file mode 100755 index 0000000..2e4d4a1 --- /dev/null +++ b/src/cmd/cron/crontab.c @@ -0,0 +1,586 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +static char sccsid[] = "@(#) crontab.c 2.13.1 (2.11BSD) 1999/8/9"; + +/* crontab - install and manage per-user crontab files + * vix 02may87 [RCS has the rest of the log] + * vix 26jan87 [original] + */ + +#define MAIN_PROGRAM + +#include "cron.h" +#include +#include +#include +#include +#include + +#define NHEADER_LINES 3 + +enum opt_t { opt_unknown, opt_list, opt_delete, opt_edit, opt_replace }; + +#if DEBUGGING +static char *Options[] = { "???", "list", "delete", "edit", "replace" }; +#endif + + +static PID_T Pid; +static char User[MAX_UNAME], RealUser[MAX_UNAME]; +static char Filename[MAX_FNAME]; +static FILE *NewCrontab; +static int CheckErrorCount; +static enum opt_t Option; +static struct passwd *pw; +static void list_cmd __P((void)), + delete_cmd __P((void)), + edit_cmd __P((void)), + poke_daemon __P((void)), + check_error __P((char *)), + parse_args __P((int c, char *v[])); +static int replace_cmd __P((void)); + + +static void +usage(msg) + char *msg; +{ + fprintf(stderr, "%s: usage error: %s\n", ProgramName, msg); + fprintf(stderr, "usage:\t%s [-u user] file\n", ProgramName); + fprintf(stderr, "\t%s [-u user] { -e | -l | -r }\n", ProgramName); + fprintf(stderr, "\t\t(default operation is replace, per 1003.2)\n"); + fprintf(stderr, "\t-e\t(edit user's crontab)\n"); + fprintf(stderr, "\t-l\t(list user's crontab)\n"); + fprintf(stderr, "\t-r\t(delete user's crontab)\n"); + exit(ERROR_EXIT); +} + + +int +main(argc, argv) + int argc; + char *argv[]; +{ + int exitstatus; + + Pid = getpid(); + ProgramName = argv[0]; + + setlinebuf(stderr); + + parse_args(argc, argv); /* sets many globals, opens a file */ + set_cron_uid(); + set_cron_cwd(); + if (!allowed(User)) { + fprintf(stderr, + "You (%s) are not allowed to use this program (%s)\n", + User, ProgramName); + fprintf(stderr, "See crontab(1) for more information\n"); + log_it(RealUser, Pid, "AUTH", "crontab command not allowed"); + exit(ERROR_EXIT); + } + exitstatus = OK_EXIT; + switch (Option) { + case opt_list: list_cmd(); + break; + case opt_delete: delete_cmd(); + break; + case opt_edit: edit_cmd(); + break; + case opt_replace: if (replace_cmd() < 0) + exitstatus = ERROR_EXIT; + break; + } + exit(0); + /*NOTREACHED*/ +} + + +static void +parse_args(argc, argv) + int argc; + char *argv[]; +{ + int argch; + + if (!(pw = getpwuid(getuid()))) { + fprintf(stderr, "%s: your UID isn't in the passwd file.\n", + ProgramName); + fprintf(stderr, "bailing out.\n"); + exit(ERROR_EXIT); + } + strcpy(User, pw->pw_name); + strcpy(RealUser, User); + Filename[0] = '\0'; + Option = opt_unknown; + while (EOF != (argch = getopt(argc, argv, "u:lerx:"))) { + switch (argch) { + case 'x': + if (!set_debug_flags(optarg)) + usage("bad debug option"); + break; + case 'u': + if (getuid() != ROOT_UID) + { + fprintf(stderr, + "must be privileged to use -u\n"); + exit(ERROR_EXIT); + } + if (!(pw = getpwnam(optarg))) + { + fprintf(stderr, "%s: user `%s' unknown\n", + ProgramName, optarg); + exit(ERROR_EXIT); + } + (void) strcpy(User, optarg); + break; + case 'l': + if (Option != opt_unknown) + usage("only one operation permitted"); + Option = opt_list; + break; + case 'r': + if (Option != opt_unknown) + usage("only one operation permitted"); + Option = opt_delete; + break; + case 'e': + if (Option != opt_unknown) + usage("only one operation permitted"); + Option = opt_edit; + break; + default: + usage("unrecognized option"); + } + } + + endpwent(); + + if (Option != opt_unknown) { + if (argv[optind] != NULL) { + usage("no arguments permitted after this option"); + } + } else { + if (argv[optind] != NULL) { + Option = opt_replace; + (void) strcpy (Filename, argv[optind]); + } else { + usage("file name must be specified for replace"); + } + } + + if (Option == opt_replace) { + /* we have to open the file here because we're going to + * chdir(2) into /var/cron before we get around to + * reading the file. + */ + if (!strcmp(Filename, "-")) { + NewCrontab = stdin; + } else { + /* relinquish the setuid status of the binary during + * the open, lest nonroot users read files they should + * not be able to read. we can't use access() here + * since there's a race condition. thanks go out to + * Arnt Gulbrandsen for spotting + * the race. + */ + + if (swap_uids() < OK) { + perror("swapping uids"); + exit(ERROR_EXIT); + } + if (!(NewCrontab = fopen(Filename, "r"))) { + perror(Filename); + exit(ERROR_EXIT); + } + if (swap_uids_back() < OK) { + perror("swapping uids back"); + exit(ERROR_EXIT); + } + } + } + + Debug(DMISC, ("user=%s, file=%s, option=%s\n", + User, Filename, Options[(int)Option])) +} + + +static void +list_cmd() { + char n[MAX_FNAME]; + register FILE *f; + int ch; + + log_it(RealUser, Pid, "LIST", User); + (void) sprintf(n, CRON_TAB(User)); + if (!(f = fopen(n, "r"))) { + if (errno == ENOENT) + fprintf(stderr, "no crontab for %s\n", User); + else + perror(n); + exit(ERROR_EXIT); + } + + /* file is open. copy to stdout, close. + */ + Set_LineNum(1) + while (EOF != (ch = get_char(f))) + putchar(ch); + fclose(f); +} + + +static void +delete_cmd() { + char n[MAX_FNAME]; + + log_it(RealUser, Pid, "DELETE", User); + (void) sprintf(n, CRON_TAB(User)); + if (unlink(n)) { + if (errno == ENOENT) + fprintf(stderr, "no crontab for %s\n", User); + else + perror(n); + exit(ERROR_EXIT); + } + poke_daemon(); +} + + +static void +check_error(msg) + char *msg; +{ + CheckErrorCount++; + fprintf(stderr, "\"%s\":%d: %s\n", Filename, LineNumber-1, msg); +} + + +static void +edit_cmd() { + char n[MAX_FNAME], q[MAX_TEMPSTR], *editor; + register FILE *f; + register int ch; + int t, x; + struct stat statbuf; + time_t mtime; + WAIT_T waiter; + PID_T pid, xpid; + + log_it(RealUser, Pid, "BEGIN EDIT", User); + (void) sprintf(n, CRON_TAB(User)); + if (!(f = fopen(n, "r"))) { + if (errno != ENOENT) { + perror(n); + exit(ERROR_EXIT); + } + fprintf(stderr, "no crontab for %s - using an empty one\n", + User); + if (!(f = fopen("/dev/null", "r"))) { + perror("/dev/null"); + exit(ERROR_EXIT); + } + } + + (void) sprintf(Filename, "/tmp/crontab.%d", Pid); + if (-1 == (t = open(Filename, O_CREAT|O_EXCL|O_RDWR, 0600))) { + perror(Filename); + goto fatal; + } + if (fchown(t, getuid(), getgid()) < 0) { + perror("fchown"); + goto fatal; + } + if (!(NewCrontab = fdopen(t, "r+"))) { + perror("fdopen"); + goto fatal; + } + + Set_LineNum(1) + + /* ignore the top few comments since we probably put them there. + */ + for (x = 0; x < NHEADER_LINES; x++) { + ch = get_char(f); + if (EOF == ch) + break; + if ('#' != ch) { + putc(ch, NewCrontab); + break; + } + while (EOF != (ch = get_char(f))) + if (ch == '\n') + break; + if (EOF == ch) + break; + } + + /* copy the rest of the crontab (if any) to the temp file. + */ + if (EOF != ch) + while (EOF != (ch = get_char(f))) + putc(ch, NewCrontab); + fclose(f); + if (fflush(NewCrontab) < OK) { + perror(Filename); + exit(ERROR_EXIT); + } + again: + rewind(NewCrontab); + if (ferror(NewCrontab)) { + fprintf(stderr, "%s: error while writing new crontab to %s\n", + ProgramName, Filename); + fatal: unlink(Filename); + exit(ERROR_EXIT); + } + if (fstat(t, &statbuf) < 0) { + perror("fstat"); + goto fatal; + } + mtime = statbuf.st_mtime; + + if ((!(editor = getenv("VISUAL"))) + && (!(editor = getenv("EDITOR"))) + ) { + editor = EDITOR; + } + + /* we still have the file open. editors will generally rewrite the + * original file rather than renaming/unlinking it and starting a + * new one; even backup files are supposed to be made by copying + * rather than by renaming. if some editor does not support this, + * then don't use it. the security problems are more severe if we + * close and reopen the file around the edit. + */ + + switch (pid = fork()) { + case -1: + perror("fork"); + goto fatal; + case 0: + /* child */ + if (setuid(getuid()) < 0) { + perror("setuid(getuid())"); + exit(ERROR_EXIT); + } + if (chdir("/tmp") < 0) { + perror("chdir(/tmp)"); + exit(ERROR_EXIT); + } + if (strlen(editor) + strlen(Filename) + 2 >= MAX_TEMPSTR) { + fprintf(stderr, "%s: editor or filename too long\n", + ProgramName); + exit(ERROR_EXIT); + } + sprintf(q, "%s %s", editor, Filename); + execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", q, NULL); + perror(editor); + exit(ERROR_EXIT); + /*NOTREACHED*/ + default: + /* parent */ + break; + } + + /* parent */ + xpid = wait(&waiter); + if (xpid != pid) { + fprintf(stderr, "%s: wrong PID (%d != %d) from \"%s\"\n", + ProgramName, xpid, pid, editor); + goto fatal; + } + if (WIFEXITED(waiter) && WEXITSTATUS(waiter)) { + fprintf(stderr, "%s: \"%s\" exited with status %d\n", + ProgramName, editor, WEXITSTATUS(waiter)); + goto fatal; + } + if (WIFSIGNALED(waiter)) { + fprintf(stderr, + "%s: \"%s\" killed; signal %d (%score dumped)\n", + ProgramName, editor, WTERMSIG(waiter), + WCOREDUMP(waiter) ?"" :"no "); + goto fatal; + } + if (fstat(t, &statbuf) < 0) { + perror("fstat"); + goto fatal; + } + if (mtime == statbuf.st_mtime) { + fprintf(stderr, "%s: no changes made to crontab\n", + ProgramName); + goto remove; + } + fprintf(stderr, "%s: installing new crontab\n", ProgramName); + switch (replace_cmd()) { + case 0: + break; + case -1: + for (;;) { + printf("Do you want to retry the same edit? "); + fflush(stdout); + q[0] = '\0'; + (void) fgets(q, sizeof q, stdin); + switch (islower(q[0]) ? q[0] : tolower(q[0])) { + case 'y': + goto again; + case 'n': + goto abandon; + default: + fprintf(stderr, "Enter Y or N\n"); + } + } + /*NOTREACHED*/ + case -2: + abandon: + fprintf(stderr, "%s: edits left in %s\n", + ProgramName, Filename); + goto done; + default: + fprintf(stderr, "%s: panic: bad switch() in replace_cmd()\n"); + goto fatal; + } + remove: + unlink(Filename); + done: + log_it(RealUser, Pid, "END EDIT", User); +} + + +/* returns 0 on success + * -1 on syntax error + * -2 on install error + */ +static int +replace_cmd() { + char n[MAX_FNAME], envstr[MAX_ENVSTR], tn[MAX_FNAME]; + register FILE *tmp; + register int ch; + int eof; + entry *e; + time_t now = time(NULL); + char **envp = env_init(); + + (void) sprintf(n, "tmp.%d", Pid); + (void) sprintf(tn, CRON_TAB(n)); + if (!(tmp = fopen(tn, "w+"))) { + perror(tn); + return (-2); + } + + /* write a signature at the top of the file. + * + * VERY IMPORTANT: make sure NHEADER_LINES agrees with this code. + */ + fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n"); + fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now)); + fprintf(tmp, "# (Cron version -- %s)\n", sccsid); + + /* copy the crontab to the tmp + */ + rewind(NewCrontab); + Set_LineNum(1) + while (EOF != (ch = get_char(NewCrontab))) + putc(ch, tmp); + ftruncate(fileno(tmp), ftell(tmp)); + fflush(tmp); rewind(tmp); + + if (ferror(tmp)) { + fprintf(stderr, "%s: error while writing new crontab to %s\n", + ProgramName, tn); + fclose(tmp); unlink(tn); + return (-2); + } + + /* check the syntax of the file being installed. + */ + + /* BUG: was reporting errors after the EOF if there were any errors + * in the file proper -- kludged it by stopping after first error. + * vix 31mar87 + */ + Set_LineNum(1 - NHEADER_LINES) + CheckErrorCount = 0; eof = FALSE; + while (!CheckErrorCount && !eof) { + switch (load_env(envstr, tmp)) { + case ERR: + eof = TRUE; + break; + case FALSE: + e = load_entry(tmp, check_error, pw, envp); + if (e) + free(e); + break; + case TRUE: + break; + } + } + + if (CheckErrorCount != 0) { + fprintf(stderr, "errors in crontab file, can't install.\n"); + fclose(tmp); unlink(tn); + return (-1); + } + + if (fchown(fileno(tmp), ROOT_UID, -1) < OK) + { + perror("chown"); + fclose(tmp); unlink(tn); + return (-2); + } + + if (fchmod(fileno(tmp), 0600) < OK) + { + perror("chown"); + fclose(tmp); unlink(tn); + return (-2); + } + + if (fclose(tmp) == EOF) { + perror("fclose"); + unlink(tn); + return (-2); + } + + (void) sprintf(n, CRON_TAB(User)); + if (rename(tn, n)) { + fprintf(stderr, "%s: error renaming %s to %s\n", + ProgramName, tn, n); + perror("rename"); + unlink(tn); + return (-2); + } + log_it(RealUser, Pid, "REPLACE", User); + + poke_daemon(); + + return (0); +} + + +static void +poke_daemon() { + struct timeval tvs[2]; + + (void) gettimeofday(&tvs[0], NULL); + tvs[1] = tvs[0]; + if (utimes(SPOOL_DIR, tvs) < OK) { + fprintf(stderr, "crontab: can't update mtime on spooldir\n"); + perror(SPOOL_DIR); + return; + } +} diff --git a/src/cmd/cron/database.c b/src/cmd/cron/database.c new file mode 100755 index 0000000..d768948 --- /dev/null +++ b/src/cmd/cron/database.c @@ -0,0 +1,261 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && !defined(LINT) +static char rcsid[] = "$Id: database.c,v 2.8 1994/01/15 20:43:43 vixie Exp $"; +#endif + +/* vix 26jan87 [RCS has the log] + */ + + +#include "cron.h" +#include +#include +#include + + +#define TMAX(a,b) ((a)>(b)?(a):(b)) + + +static void process_crontab __P((char *, char *, char *, + struct stat *, + cron_db *, cron_db *)); + + +void +load_database(old_db) + cron_db *old_db; +{ + DIR *dir; + struct stat statbuf; + struct stat syscron_stat; + register DIR_T *dp; + cron_db new_db; + user *u, *nu; + + Debug(DLOAD, ("[%d] load_database()\n", getpid())) + + /* before we start loading any data, do a stat on SPOOL_DIR + * so that if anything changes as of this moment (i.e., before we've + * cached any of the database), we'll see the changes next time. + */ + if (stat(SPOOL_DIR, &statbuf) < OK) { + log_it("CRON", getpid(), "STAT FAILED", SPOOL_DIR); + (void) exit(ERROR_EXIT); + } + + /* track system crontab file + */ + if (stat(SYSCRONTAB, &syscron_stat) < OK) + syscron_stat.st_mtime = 0; + + /* if spooldir's mtime has not changed, we don't need to fiddle with + * the database. + * + * Note that old_db->mtime is initialized to 0 in main(), and + * so is guaranteed to be different than the stat() mtime the first + * time this function is called. + */ + if (old_db->mtime == TMAX(statbuf.st_mtime, syscron_stat.st_mtime)) { + Debug(DLOAD, ("[%d] spool dir mtime unch, no load needed.\n", + getpid())) + return; + } + + /* something's different. make a new database, moving unchanged + * elements from the old database, reloading elements that have + * actually changed. Whatever is left in the old database when + * we're done is chaff -- crontabs that disappeared. + */ + new_db.mtime = TMAX(statbuf.st_mtime, syscron_stat.st_mtime); + new_db.head = new_db.tail = NULL; + + if (syscron_stat.st_mtime) { + process_crontab("root", "*system*", + SYSCRONTAB, &syscron_stat, + &new_db, old_db); + } + + /* we used to keep this dir open all the time, for the sake of + * efficiency. however, we need to close it in every fork, and + * we fork a lot more often than the mtime of the dir changes. + */ + if (!(dir = opendir(SPOOL_DIR))) { + log_it("CRON", getpid(), "OPENDIR FAILED", SPOOL_DIR); + (void) exit(ERROR_EXIT); + } + + while (NULL != (dp = readdir(dir))) { + char fname[MAXNAMLEN+1], + tabname[MAXNAMLEN+1]; + + /* avoid file names beginning with ".". this is good + * because we would otherwise waste two guaranteed calls + * to getpwnam() for . and .., and also because user names + * starting with a period are just too nasty to consider. + */ + if (dp->d_name[0] == '.') + continue; + + (void) strcpy(fname, dp->d_name); + sprintf(tabname, CRON_TAB(fname)); + + process_crontab(fname, fname, tabname, + &statbuf, &new_db, old_db); + } + closedir(dir); + + /* if we don't do this, then when our children eventually call + * getpwnam() in do_command.c's child_process to verify MAILTO=, + * they will screw us up (and v-v). + */ + endpwent(); + + /* whatever's left in the old database is now junk. + */ + Debug(DLOAD, ("unlinking old database:\n")) + for (u = old_db->head; u != NULL; u = nu) { + Debug(DLOAD, ("\t%s\n", u->name)) + nu = u->next; + unlink_user(old_db, u); + free_user(u); + } + + /* overwrite the database control block with the new one. + */ + *old_db = new_db; + Debug(DLOAD, ("load_database is done\n")) +} + + +void +link_user(db, u) + register cron_db *db; + register user *u; +{ + if (db->head == NULL) + db->head = u; + if (db->tail) + db->tail->next = u; + u->prev = db->tail; + u->next = NULL; + db->tail = u; +} + + +void +unlink_user(db, u) + register cron_db *db; + register user *u; +{ + if (u->prev == NULL) + db->head = u->next; + else + u->prev->next = u->next; + + if (u->next == NULL) + db->tail = u->prev; + else + u->next->prev = u->prev; +} + + +user * +find_user(db, name) + cron_db *db; + register char *name; +{ + char *env_get(); + register user *u; + + for (u = db->head; u != NULL; u = u->next) + if (!strcmp(u->name, name)) + break; + return u; +} + + +static void +process_crontab(uname, fname, tabname, statbuf, new_db, old_db) + char *uname; + char *fname; + char *tabname; + struct stat *statbuf; + cron_db *new_db; + cron_db *old_db; +{ + struct passwd *pw = NULL; + int crontab_fd = OK - 1; + register user *u; + + if (strcmp(fname, "*system*") && !(pw = getpwnam(uname))) { + /* file doesn't have a user in passwd file. + */ + log_it(fname, getpid(), "ORPHAN", "no passwd entry"); + goto next_crontab; + } + + if ((crontab_fd = open(tabname, O_RDONLY, 0)) < OK) { + /* crontab not accessible? + */ + log_it(fname, getpid(), "CAN'T OPEN", tabname); + goto next_crontab; + } + + if (fstat(crontab_fd, statbuf) < OK) { + log_it(fname, getpid(), "FSTAT FAILED", tabname); + goto next_crontab; + } + + Debug(DLOAD, ("\t%s:", fname)) + u = find_user(old_db, fname); + if (u != NULL) { + /* if crontab has not changed since we last read it + * in, then we can just use our existing entry. + */ + if (u->mtime == statbuf->st_mtime) { + Debug(DLOAD, (" [no change, using old data]")) + unlink_user(old_db, u); + link_user(new_db, u); + goto next_crontab; + } + + /* before we fall through to the code that will reload + * the user, let's deallocate and unlink the user in + * the old database. This is more a point of memory + * efficiency than anything else, since all leftover + * users will be deleted from the old database when + * we finish with the crontab... + */ + Debug(DLOAD, (" [delete old data]")) + unlink_user(old_db, u); + free_user(u); + log_it(fname, getpid(), "RELOAD", tabname); + } + u = load_user(crontab_fd, pw, fname); + if (u != NULL) { + u->mtime = statbuf->st_mtime; + link_user(new_db, u); + } + +next_crontab: + if (crontab_fd >= OK) { + Debug(DLOAD, (" [done]\n")) + close(crontab_fd); + } +} diff --git a/src/cmd/cron/do_command.c b/src/cmd/cron/do_command.c new file mode 100755 index 0000000..1bb90ca --- /dev/null +++ b/src/cmd/cron/do_command.c @@ -0,0 +1,433 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && !defined(LINT) +static char rcsid[] = "$Id: do_command.c,v 2.12 1994/01/15 20:43:43 vixie Exp $"; +#endif + +#include "cron.h" +#include +#if defined(SYSLOG) +# include +#endif + +static void child_process __P((entry *, user *)); + +void +do_command(e, u) + entry *e; + user *u; +{ + Debug(DPROC, ("[%d] do_command(%s, (%s,%d,%d))\n", + getpid(), e->cmd, u->name, e->uid, e->gid)) + + /* fork to become asynchronous -- parent process is done immediately, + * and continues to run the normal cron code, which means return to + * tick(). the child and grandchild don't leave this function, alive. + * + * vfork() is unsuitable, since we have much to do, and the parent + * needs to be able to run off and fork other processes. + */ + switch (fork()) { + case -1: + log_it("CRON",getpid(),"error","can't fork"); + break; + case 0: + /* child process */ + acquire_daemonlock(1); + child_process(e, u); + Debug(DPROC, ("[%d] child process done, exiting\n", getpid())) + _exit(OK_EXIT); + break; + default: + /* parent process */ + break; + } + Debug(DPROC, ("[%d] main process returning to work\n", getpid())) +} + + +static void +child_process(e, u) + entry *e; + user *u; +{ + int stdin_pipe[2], stdout_pipe[2]; + register char *input_data; + char *usernm, *mailto; + register int ch; + int children = 0, escaped; + + Debug(DPROC, ("[%d] child_process('%s')\n", getpid(), e->cmd)) + + /* mark ourselves as different to PS command watchers by upshifting + * our program name. This has no effect on some kernels. + */ + for (input_data = ProgramName; ch = *input_data; input_data++) + *input_data = (islower(ch) ? toupper(ch) : ch); + + /* discover some useful and important environment settings + */ + usernm = env_get("LOGNAME", e->envp); + mailto = env_get("MAILTO", e->envp); + + /* our parent is watching for our death by catching SIGCHLD. we + * do not care to watch for our children's deaths this way -- we + * use wait() explictly. so we have to disable the signal (which + * was inherited from the parent). + */ + (void) signal(SIGCHLD, SIG_IGN); + + /* create some pipes to talk to our future child + */ + pipe(stdin_pipe); /* child's stdin */ + pipe(stdout_pipe); /* child's stdout */ + + /* since we are a forked process, we can diddle the command string + * we were passed -- nobody else is going to use it again, right? + * + * if a % is present in the command, previous characters are the + * command, and subsequent characters are the additional input to + * the command. Subsequent %'s will be transformed into newlines, + * but that happens later. + */ + escaped = FALSE; + for (input_data = e->cmd; ch = *input_data; input_data++) { + if (escaped) { + escaped = FALSE; + continue; + } + if (ch == '\\') { + escaped = TRUE; + continue; + } + if (ch == '%') { + *input_data++ = '\0'; + break; + } + } + + /* fork again, this time so we can exec the user's command. + */ + switch (vfork()) { + case -1: + log_it("CRON",getpid(),"error","can't vfork"); + exit(ERROR_EXIT); + /*NOTREACHED*/ + case 0: + Debug(DPROC, ("[%d] grandchild process Vfork()'ed\n", + getpid())) + + /* write a log message. we've waited this long to do it + * because it was not until now that we knew the PID that + * the actual user command shell was going to get and the + * PID is part of the log message. + */ + /*local*/{ + char *x = mkprints((u_char *)e->cmd, strlen(e->cmd)); + + log_it(usernm, getpid(), "CMD", x); + free(x); + } + + /* that's the last thing we'll log. close the log files. + */ +#ifdef SYSLOG + closelog(); +#endif + + /* get new pgrp, void tty, etc. + */ + (void) setsid(); + + /* close the pipe ends that we won't use. this doesn't affect + * the parent, who has to read and write them; it keeps the + * kernel from recording us as a potential client TWICE -- + * which would keep it from sending SIGPIPE in otherwise + * appropriate circumstances. + */ + close(stdin_pipe[WRITE_PIPE]); + close(stdout_pipe[READ_PIPE]); + + /* grandchild process. make std{in,out} be the ends of + * pipes opened by our daddy; make stderr go to stdout. + */ + close(STDIN); dup2(stdin_pipe[READ_PIPE], STDIN); + close(STDOUT); dup2(stdout_pipe[WRITE_PIPE], STDOUT); + close(STDERR); dup2(STDOUT, STDERR); + + /* close the pipes we just dup'ed. The resources will remain. + */ + close(stdin_pipe[READ_PIPE]); + close(stdout_pipe[WRITE_PIPE]); + + /* set our directory, uid and gid. Set gid first, since once + * we set uid, we've lost root privledges. + */ + setgid(e->gid); + initgroups(env_get("LOGNAME", e->envp), e->gid); + setuid(e->uid); /* we aren't root after this... */ + chdir(env_get("HOME", e->envp)); + + /* exec the command. + */ + { + char *shell = env_get("SHELL", e->envp); + +# if DEBUGGING + if (DebugFlags & DTEST) { + fprintf(stderr, + "debug DTEST is on, not exec'ing command.\n"); + fprintf(stderr, + "\tcmd='%s' shell='%s'\n", e->cmd, shell); + _exit(OK_EXIT); + } +# endif /*DEBUGGING*/ + execle(shell, shell, "-c", e->cmd, (char *)0, e->envp); + fprintf(stderr, "execl: couldn't exec `%s'\n", shell); + perror("execl"); + _exit(ERROR_EXIT); + } + break; + default: + /* parent process */ + break; + } + + children++; + + /* middle process, child of original cron, parent of process running + * the user's command. + */ + + Debug(DPROC, ("[%d] child continues, closing pipes\n", getpid())) + + /* close the ends of the pipe that will only be referenced in the + * grandchild process... + */ + close(stdin_pipe[READ_PIPE]); + close(stdout_pipe[WRITE_PIPE]); + + /* + * write, to the pipe connected to child's stdin, any input specified + * after a % in the crontab entry. while we copy, convert any + * additional %'s to newlines. when done, if some characters were + * written and the last one wasn't a newline, write a newline. + * + * Note that if the input data won't fit into one pipe buffer (2K + * or 4K on most BSD systems), and the child doesn't read its stdin, + * we would block here. thus we must fork again. + */ + + if (*input_data && fork() == 0) { + register FILE *out = fdopen(stdin_pipe[WRITE_PIPE], "w"); + register int need_newline = FALSE; + register int escaped = FALSE; + register int ch; + + Debug(DPROC, ("[%d] child2 sending data to grandchild\n", getpid())) + + /* close the pipe we don't use, since we inherited it and + * are part of its reference count now. + */ + close(stdout_pipe[READ_PIPE]); + + /* translation: + * \% -> % + * % -> \n + * \x -> \x for all x != % + */ + while (ch = *input_data++) { + if (escaped) { + if (ch != '%') + putc('\\', out); + } else { + if (ch == '%') + ch = '\n'; + } + + if (!(escaped = (ch == '\\'))) { + putc(ch, out); + need_newline = (ch != '\n'); + } + } + if (escaped) + putc('\\', out); + if (need_newline) + putc('\n', out); + + /* close the pipe, causing an EOF condition. fclose causes + * stdin_pipe[WRITE_PIPE] to be closed, too. + */ + fclose(out); + + Debug(DPROC, ("[%d] child2 done sending to grandchild\n", getpid())) + exit(0); + } + + /* close the pipe to the grandkiddie's stdin, since its wicked uncle + * ernie back there has it open and will close it when he's done. + */ + close(stdin_pipe[WRITE_PIPE]); + + children++; + + /* + * read output from the grandchild. it's stderr has been redirected to + * it's stdout, which has been redirected to our pipe. if there is any + * output, we'll be mailing it to the user whose crontab this is... + * when the grandchild exits, we'll get EOF. + */ + + Debug(DPROC, ("[%d] child reading output from grandchild\n", getpid())) + + /*local*/{ + register FILE *in = fdopen(stdout_pipe[READ_PIPE], "r"); + register int ch = getc(in); + + if (ch != EOF) { + register FILE *mail; + register int bytes = 1; + int status = 0; + + Debug(DPROC|DEXT, + ("[%d] got data (%x:%c) from grandchild\n", + getpid(), ch, ch)) + + /* get name of recipient. this is MAILTO if set to a + * valid local username; USER otherwise. + */ + if (mailto) { + /* MAILTO was present in the environment + */ + if (!*mailto) { + /* ... but it's empty. set to NULL + */ + mailto = NULL; + } + } else { + /* MAILTO not present, set to USER. + */ + mailto = usernm; + } + + /* if we are supposed to be mailing, MAILTO will + * be non-NULL. only in this case should we set + * up the mail command and subjects and stuff... + */ + + if (mailto) { + register char **env; + auto char mailcmd[MAX_COMMAND]; + auto char hostname[MAXHOSTNAMELEN]; + + (void) gethostname(hostname, MAXHOSTNAMELEN); + (void) sprintf(mailcmd, MAILARGS, + MAILCMD, mailto); + if (!(mail = cron_popen(mailcmd, "w"))) { + perror(MAILCMD); + (void) _exit(ERROR_EXIT); + } + fprintf(mail, "From: root (Cron Daemon)\n"); + fprintf(mail, "To: %s\n", mailto); + fprintf(mail, "Subject: Cron <%s@%s> %s\n", + usernm, first_word(hostname, "."), + e->cmd); +# if defined(MAIL_DATE) + fprintf(mail, "Date: %s\n", + arpadate(&TargetTime)); +# endif /* MAIL_DATE */ + for (env = e->envp; *env; env++) + fprintf(mail, "X-Cron-Env: <%s>\n", + *env); + fprintf(mail, "\n"); + + /* this was the first char from the pipe + */ + putc(ch, mail); + } + + /* we have to read the input pipe no matter whether + * we mail or not, but obviously we only write to + * mail pipe if we ARE mailing. + */ + + while (EOF != (ch = getc(in))) { + bytes++; + if (mailto) + putc(ch, mail); + } + + /* only close pipe if we opened it -- i.e., we're + * mailing... + */ + + if (mailto) { + Debug(DPROC, ("[%d] closing pipe to mail\n", + getpid())) + /* Note: the pclose will probably see + * the termination of the grandchild + * in addition to the mail process, since + * it (the grandchild) is likely to exit + * after closing its stdout. + */ + status = cron_pclose(mail); + } + + /* if there was output and we could not mail it, + * log the facts so the poor user can figure out + * what's going on. + */ + if (mailto && status) { + char buf[MAX_TEMPSTR]; + + sprintf(buf, + "mailed %d byte%s of output but got status 0x%04x\n", + bytes, (bytes==1)?"":"s", + status); + log_it(usernm, getpid(), "MAIL", buf); + } + + } /*if data from grandchild*/ + + Debug(DPROC, ("[%d] got EOF from grandchild\n", getpid())) + + fclose(in); /* also closes stdout_pipe[READ_PIPE] */ + } + + /* wait for children to die. + */ + for (; children > 0; children--) + { + WAIT_T waiter; + PID_T pid; + + Debug(DPROC, ("[%d] waiting for grandchild #%d to finish\n", + getpid(), children)) + pid = wait(&waiter); + if (pid < OK) { + Debug(DPROC, ("[%d] no more grandchildren--mail written?\n", + getpid())) + break; + } + Debug(DPROC, ("[%d] grandchild #%d finished, status=%04x", + getpid(), pid, WEXITSTATUS(waiter))) + if (WIFSIGNALED(waiter) && WCOREDUMP(waiter)) + Debug(DPROC, (", dumped core")) + Debug(DPROC, ("\n")) + } +} diff --git a/src/cmd/cron/entry.c b/src/cmd/cron/entry.c new file mode 100755 index 0000000..af8289e --- /dev/null +++ b/src/cmd/cron/entry.c @@ -0,0 +1,504 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && defined(DOSCCS) +static char sccsid[] = "@(#)entry.c 2.12.2 (2.11BSD) 1999/08/05"; +#endif + +/* vix 26jan87 [RCS'd; rest of log is in RCS file] + * vix 01jan87 [added line-level error recovery] + * vix 31dec86 [added /step to the from-to range, per bob@acornrc] + * vix 30dec86 [written] + */ + +#include "cron.h" + +typedef enum ecode { + e_none, e_minute, e_hour, e_dom, e_month, e_dow, + e_cmd, e_timespec, e_username +} ecode_e; + +static char get_list __P((bitstr_t *, int, int, char *[], int, FILE *)), + get_range __P((bitstr_t *, int, int, char *[], int, FILE *)), + get_number __P((int *, int, char *[], int, FILE *)); +static int set_element __P((bitstr_t *, int, int, int)); + +static char *ecodes[] = + { + "no error", + "bad minute", + "bad hour", + "bad day-of-month", + "bad month", + "bad day-of-week", + "bad command", + "bad time specifier", + "bad username", + }; + + +void +free_entry(e) + register entry *e; +{ + free(e->cmd); + env_free(e->envp); + free(e); +} + + +/* return NULL if eof or syntax error occurs; + * otherwise return a pointer to a new entry. + */ +entry * +load_entry(file, error_func, pw, envp) + FILE *file; + void (*error_func)(); + register struct passwd *pw; + char **envp; +{ + /* this function reads one crontab entry -- the next -- from a file. + * it skips any leading blank lines, ignores comments, and returns + * EOF if for any reason the entry can't be read and parsed. + * + * the entry is also parsed here. + * + * syntax: + * user crontab: + * minutes hours doms months dows cmd\n + * system crontab (/etc/crontab): + * minutes hours doms months dows USERNAME cmd\n + */ + + ecode_e ecode = e_none; + register entry *e; + int ch; + char cmd[MAX_COMMAND]; + char envstr[MAX_ENVSTR]; + + Debug(DPARS, ("load_entry()...about to eat comments\n")) + + skip_comments(file); + + ch = get_char(file); + if (ch == EOF) + return NULL; + + /* ch is now the first useful character of a useful line. + * it may be an @special or it may be the first character + * of a list of minutes. + */ + + e = (entry *) calloc(sizeof(entry), sizeof(char)); + + if (ch == '@') { + /* all of these should be flagged and load-limited; i.e., + * instead of @hourly meaning "0 * * * *" it should mean + * "close to the front of every hour but not 'til the + * system load is low". Problems are: how do you know + * what "low" means? (save me from /etc/cron.conf!) and: + * how to guarantee low variance (how low is low?), which + * means how to we run roughly every hour -- seems like + * we need to keep a history or let the first hour set + * the schedule, which means we aren't load-limited + * anymore. too much for my overloaded brain. (vix, jan90) + * HINT + */ + ch = get_string(cmd, MAX_COMMAND, file, " \t\n"); + if (!strcmp("reboot", cmd)) { + e->flags |= WHEN_REBOOT; + } else if (!strcmp("yearly", cmd) || !strcmp("annually", cmd)){ + bit_set(e->minute, 0); + bit_set(e->hour, 0); + bit_set(e->dom, 0); + bit_set(e->month, 0); + bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); + } else if (!strcmp("monthly", cmd)) { + bit_set(e->minute, 0); + bit_set(e->hour, 0); + bit_set(e->dom, 0); + bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); + bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); + } else if (!strcmp("weekly", cmd)) { + bit_set(e->minute, 0); + bit_set(e->hour, 0); + bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); + bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); + bit_set(e->dow, 0); + } else if (!strcmp("daily", cmd) || !strcmp("midnight", cmd)) { + bit_set(e->minute, 0); + bit_set(e->hour, 0); + bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); + bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); + bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); + } else if (!strcmp("hourly", cmd)) { + bit_set(e->minute, 0); + bit_set(e->hour, (LAST_HOUR-FIRST_HOUR+1)); + bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); + bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); + bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); + } else { + ecode = e_timespec; + goto eof; + } + } else { + Debug(DPARS, ("load_entry()...about to parse numerics\n")) + + ch = get_list(e->minute, FIRST_MINUTE, LAST_MINUTE, + PPC_NULL, ch, file); + if (ch == EOF) { + ecode = e_minute; + goto eof; + } + + /* hours + */ + + ch = get_list(e->hour, FIRST_HOUR, LAST_HOUR, + PPC_NULL, ch, file); + if (ch == EOF) { + ecode = e_hour; + goto eof; + } + + /* DOM (days of month) + */ + + if (ch == '*') + e->flags |= DOM_STAR; + ch = get_list(e->dom, FIRST_DOM, LAST_DOM, + PPC_NULL, ch, file); + if (ch == EOF) { + ecode = e_dom; + goto eof; + } + + /* month + */ + + ch = get_list(e->month, FIRST_MONTH, LAST_MONTH, + MonthNames, ch, file); + if (ch == EOF) { + ecode = e_month; + goto eof; + } + + /* DOW (days of week) + */ + + if (ch == '*') + e->flags |= DOW_STAR; + ch = get_list(e->dow, FIRST_DOW, LAST_DOW, + DowNames, ch, file); + if (ch == EOF) { + ecode = e_dow; + goto eof; + } + } + + /* make sundays equivilent */ + if (bit_test(e->dow, 0) || bit_test(e->dow, 7)) { + bit_set(e->dow, 0); + bit_set(e->dow, 7); + } + + /* ch is the first character of a command, or a username */ + unget_char(ch, file); + + if (!pw) { + char *username = cmd; /* temp buffer */ + + Debug(DPARS, ("load_entry()...about to parse username\n")) + ch = get_string(username, MAX_COMMAND, file, " \t"); + + Debug(DPARS, ("load_entry()...got %s\n",username)) + if (ch == EOF) { + ecode = e_cmd; + goto eof; + } + + pw = getpwnam(username); + if (pw == NULL) { + ecode = e_username; + goto eof; + } + Debug(DPARS, ("load_entry()...uid %d, gid %d\n",e->uid,e->gid)) + } + + e->uid = pw->pw_uid; + e->gid = pw->pw_gid; + + /* copy and fix up environment. some variables are just defaults and + * others are overrides. + */ + e->envp = env_copy(envp); + if (!env_get("SHELL", e->envp)) { + sprintf(envstr, "SHELL=%s", _PATH_BSHELL); + e->envp = env_set(e->envp, envstr); + } + if (!env_get("HOME", e->envp)) { + sprintf(envstr, "HOME=%s", pw->pw_dir); + e->envp = env_set(e->envp, envstr); + } + if (!env_get("PATH", e->envp)) { + sprintf(envstr, "PATH=%s", _PATH_DEFPATH); + e->envp = env_set(e->envp, envstr); + } + sprintf(envstr, "%s=%s", "LOGNAME", pw->pw_name); + e->envp = env_set(e->envp, envstr); + sprintf(envstr, "%s=%s", "USER", pw->pw_name); + e->envp = env_set(e->envp, envstr); + + Debug(DPARS, ("load_entry()...about to parse command\n")) + + /* Everything up to the next \n or EOF is part of the command... + * too bad we don't know in advance how long it will be, since we + * need to malloc a string for it... so, we limit it to MAX_COMMAND. + * XXX - should use realloc(). + */ + ch = get_string(cmd, MAX_COMMAND, file, "\n"); + + /* a file without a \n before the EOF is rude, so we'll complain... + */ + if (ch == EOF) { + ecode = e_cmd; + goto eof; + } + + /* got the command in the 'cmd' string; save it in *e. + */ + e->cmd = strdup(cmd); + + Debug(DPARS, ("load_entry()...returning successfully\n")) + + /* success, fini, return pointer to the entry we just created... + */ + return e; + + eof: + free(e); + if (ecode != e_none && error_func) + (*error_func)(ecodes[(int)ecode]); + while (ch != EOF && ch != '\n') + ch = get_char(file); + return NULL; +} + + +static char +get_list(bits, low, high, names, ch, file) + bitstr_t *bits; /* one bit per flag, default=FALSE */ + int low, high; /* bounds, impl. offset for bitstr */ + char *names[]; /* NULL or *[] of names for these elements */ + int ch; /* current character being processed */ + register FILE *file; /* file being read */ +{ + register int done; + + /* we know that we point to a non-blank character here; + * must do a Skip_Blanks before we exit, so that the + * next call (or the code that picks up the cmd) can + * assume the same thing. + */ + + Debug(DPARS|DEXT, ("get_list()...entered\n")) + + /* list = range {"," range} + */ + + /* clear the bit string, since the default is 'off'. DONT add an + * extra bit here, that's done in the macro! + */ + bit_nclear(bits, 0, (high-low)); + + /* process all ranges + */ + done = FALSE; + while (!done) { + ch = get_range(bits, low, high, names, ch, file); + if (ch == ',') + ch = get_char(file); + else + done = TRUE; + } + + /* exiting. skip to some blanks, then skip over the blanks. + */ + Skip_Nonblanks(ch, file) + Skip_Blanks(ch, file) + + Debug(DPARS|DEXT, ("get_list()...exiting w/ %02x\n", ch)) + + return ch; +} + + +static char +get_range(bits, low, high, names, ch, file) + bitstr_t *bits; /* one bit per flag, default=FALSE */ + int low, high; /* bounds, impl. offset for bitstr */ + char *names[]; /* NULL or names of elements */ + register int ch; /* current character being processed */ + FILE *file; /* file being read */ +{ + /* range = number | number "-" number [ "/" number ] + */ + + register int i; + auto int num1, num2, num3; + + Debug(DPARS|DEXT, ("get_range()...entering, exit won't show\n")) + + if (ch == '*') { + /* '*' means "first-last" but can still be modified by /step + */ + num1 = low; + num2 = high; + ch = get_char(file); + if (ch == EOF) + return EOF; + } else { + if (EOF == (ch = get_number(&num1, low, names, ch, file))) + return EOF; + + if (ch != '-') { + /* not a range, it's a single number. + */ + if (EOF == set_element(bits, low, high, num1)) + return EOF; + return ch; + } else { + /* eat the dash + */ + ch = get_char(file); + if (ch == EOF) + return EOF; + + /* get the number following the dash + */ + ch = get_number(&num2, low, names, ch, file); + if (ch == EOF) + return EOF; + } + } + + /* check for step size + */ + if (ch == '/') { + /* eat the slash + */ + ch = get_char(file); + if (ch == EOF) + return EOF; + + /* get the step size -- note: we don't pass the + * names here, because the number is not an + * element id, it's a step size. 'low' is + * sent as a 0 since there is no offset either. + */ + ch = get_number(&num3, 0, PPC_NULL, ch, file); + if (ch == EOF) + return EOF; + } else { + /* no step. default==1. + */ + num3 = 1; + } + + /* range. set all elements from num1 to num2, stepping + * by num3. (the step is a downward-compatible extension + * proposed conceptually by bob@acornrc, syntactically + * designed then implmented by paul vixie). + */ + for (i = num1; i <= num2; i += num3) + if (EOF == set_element(bits, low, high, i)) + return EOF; + + return ch; +} + + +static char +get_number(numptr, low, names, ch, file) + int *numptr; /* where does the result go? */ + int low; /* offset applied to result if symbolic enum used */ + char *names[]; /* symbolic names, if any, for enums */ + register int ch; /* current character */ + FILE *file; /* source */ +{ + char temp[MAX_TEMPSTR], *pc; + int len, i, all_digits; + + /* collect alphanumerics into our fixed-size temp array + */ + pc = temp; + len = 0; + all_digits = TRUE; + while (isalnum(ch)) { + if (++len >= MAX_TEMPSTR) + return EOF; + + *pc++ = ch; + + if (!isdigit(ch)) + all_digits = FALSE; + + ch = get_char(file); + } + *pc = '\0'; + + /* try to find the name in the name list + */ + if (names) { + for (i = 0; names[i] != NULL; i++) { + Debug(DPARS|DEXT, + ("get_num, compare(%s,%s)\n", names[i], temp)) + if (!strcasecmp(names[i], temp)) { + *numptr = i+low; + return ch; + } + } + } + + /* no name list specified, or there is one and our string isn't + * in it. either way: if it's all digits, use its magnitude. + * otherwise, it's an error. + */ + if (all_digits) { + *numptr = atoi(temp); + return ch; + } + + return EOF; +} + + +static int +set_element(bits, low, high, number) + bitstr_t *bits; /* one bit per flag, default=FALSE */ + int low; + int high; + int number; +{ + Debug(DPARS|DEXT, ("set_element(?,%d,%d,%d)\n", low, high, number)) + + if (number < low || number > high) + return EOF; + + bit_set(bits, (number-low)); + return OK; +} diff --git a/src/cmd/cron/env.c b/src/cmd/cron/env.c new file mode 100755 index 0000000..3b1620d --- /dev/null +++ b/src/cmd/cron/env.c @@ -0,0 +1,178 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && !defined(LINT) +static char rcsid[] = "$Id: env.c,v 2.7 1994/01/26 02:25:50 vixie Exp vixie $"; +#endif + + +#include "cron.h" + + +char ** +env_init() +{ + register char **p = (char **) malloc(sizeof(char **)); + + p[0] = NULL; + return (p); +} + + +void +env_free(envp) + char **envp; +{ + register char **p; + + for (p = envp; *p; p++) + free(*p); + free(envp); +} + + +char ** +env_copy(envp) + char **envp; +{ + register int count, i; + register char **p; + + for (count = 0; envp[count] != NULL; count++) + ; + p = (char **) malloc((count+1) * sizeof(char *)); /* 1 for the NULL */ + for (i = 0; i < count; i++) + p[i] = strdup(envp[i]); + p[count] = NULL; + return (p); +} + + +char ** +env_set(envp, envstr) + char **envp; + char *envstr; +{ + register int count, found; + register char **p; + + /* + * count the number of elements, including the null pointer; + * also set 'found' to -1 or index of entry if already in here. + */ + found = -1; + for (count = 0; envp[count] != NULL; count++) { + if (!strcmp_until(envp[count], envstr, '=')) + found = count; + } + count++; /* for the NULL */ + + if (found != -1) { + /* + * it exists already, so just free the existing setting, + * save our new one there, and return the existing array. + */ + free(envp[found]); + envp[found] = strdup(envstr); + return (envp); + } + + /* + * it doesn't exist yet, so resize the array, move null pointer over + * one, save our string over the old null pointer, and return resized + * array. + */ + p = (char **) realloc((void *) envp, + (unsigned) ((count+1) * sizeof(char **))); + p[count] = p[count-1]; + p[count-1] = strdup(envstr); + return (p); +} + + +/* return ERR = end of file + * FALSE = not an env setting (file was repositioned) + * TRUE = was an env setting + */ +int +load_env(envstr, f) + char *envstr; + FILE *f; +{ + long filepos; + int fileline; + char name[MAX_TEMPSTR], val[MAX_ENVSTR]; + int fields; + + filepos = ftell(f); + fileline = LineNumber; + skip_comments(f); + if (EOF == get_string(envstr, MAX_ENVSTR, f, "\n")) + return (ERR); + + Debug(DPARS, ("load_env, read <%s>\n", envstr)) + + name[0] = val[0] = '\0'; + fields = sscanf(envstr, "%[^ =] = %[^\n#]", name, val); + if (fields != 2) { + Debug(DPARS, ("load_env, not 2 fields (%d)\n", fields)) + fseek(f, filepos, 0); + Set_LineNum(fileline); + return (FALSE); + } + + /* 2 fields from scanf; looks like an env setting + */ + + /* + * process value string + */ + /*local*/{ + int len = strdtb(val); + + if (len >= 2) { + if (val[0] == '\'' || val[0] == '"') { + if (val[len-1] == val[0]) { + val[len-1] = '\0'; + (void) strcpy(val, val+1); + } + } + } + } + + (void) sprintf(envstr, "%s=%s", name, val); + Debug(DPARS, ("load_env, <%s> <%s> -> <%s>\n", name, val, envstr)) + return (TRUE); +} + + +char * +env_get(name, envp) + char *name; + char **envp; +{ + register int len = strlen(name); + register char *p, *q; + + while (p = *envp++) { + if (!(q = strchr(p, '='))) + continue; + if ((q - p) == len && !strncmp(p, name, len)) + return (q+1); + } + return (NULL); +} diff --git a/src/cmd/cron/externs.h b/src/cmd/cron/externs.h new file mode 100755 index 0000000..08b6241 --- /dev/null +++ b/src/cmd/cron/externs.h @@ -0,0 +1,28 @@ +/* Copyright 1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#include +#include +#include +#include + +#define DIR_T struct direct +//#define WEXITSTATUS(x) ((x).w_retcode) +//#define WTERMSIG(x) ((x).w_termsig) +//#define WCOREDUMP(x) ((x).w_coredump) + +extern int setsid __P((void)); diff --git a/src/cmd/cron/grot/CHANGES b/src/cmd/cron/grot/CHANGES new file mode 100755 index 0000000..59f6803 --- /dev/null +++ b/src/cmd/cron/grot/CHANGES @@ -0,0 +1,155 @@ +Vixie Cron Changes from V2 to V3 +Paul Vixie +29-Dec-1993 + +The crontab command now conforms to POSIX 1003.2. This means that when you +install it, if you have any "crontab" command lines floating around in shell +scripts (such as /etc/rc or /etc/rc.local), you will need to change them. + +I have integrated several changes made by BSDi for their BSD/386 operating +system; these were offerred to me before I started consulting for them, so +it is safe to say that they were intended for publication. Most notably, +the name of the cron daemon has changed from "crond" to "cron". This was +done for compatibility with 4.3BSD. Another change made for the same reason +is the ability to read in an /etc/crontab file which has an extra field in +each entry, between the time fields and the command. This field is a user +name, and it permits the /etc/crontab command to contain commands which are +to be run by any user on the system. /etc/crontab is not "installed" via +the crontab(1) command; it is automatically read at startup time and it will +be reread whenever it changes. + +I also added a "-e" option to crontab(1). Nine people also sent me diffs +to add this option, but I had already implemented it on my own. I actually +released an interrim version (V2.2, I think) for limited testing, and got a +chance to fix a bad security bug in the "-e" option thanks to XXX. + +The daemon used to be extraordinarily sloppy in its use of file descriptors. +A heck of a lot of them were left open in spawned jobs, which caused problems +for the daemon and also caused problems with the spawned jobs if they were +shell scripts since "sh" and "csh" have traditionally used hidden file +descriptors to pass information to subshells, and cron was causing them to +think they were subshells. If you had trouble with "sh" or "csh" scripts in +V2, chances are good that V3 will fix your problems. + +About a dozen people have reminded me that I forgot to initialize +"crontab_fd" in database.c. Keith Cantrell was the first, so he gets the +point. + +Steve Simmons reminded me that once an account has been deleted from the +system, "crontab -u USER -d" will not work. My solution is to suggest to +all of you that before you delete a user's account, you first delete that +user's crontab file if any. From cron's point of view, usernames can never +be treated as arbitrary strings. Either they are valid user names, or they +are not. I will not make an exception for the "-d" case, for security +reasons that I consider reasonable. It is trivial for a root user to delete +the entry by hand if necessary. + +Dan O'Neil reminded me that I forgot to reset "log_fd" in misc.c. A lot of +others also reminded me of this, but Dan gets the point. I didn't fix it +there, since the real bug was that it should have been open in the parent. + +Peter Kabal reminded me that I forgot to "#ifdef DEBUGGING" some code in +misc.c. Hans Trompert actually told me first, but Peter sent the patch so +he gets the point. + +Russell Nelson told me that I'd forgotten to "#include " in misc.c, +which explains why a lot of other people complained that it wasn't using +syslog even when they configured it that way :-). Steve Simmons told me +first, though, so he gets the point. + +An interrim version of the daemon tried to "stat" every file before +executing it; this turned out to be a horribly bad idea since finding the +name of a file from a shell command is a hard job (that's why we have +shells, right?) I removed this bogus code. Dave Burgess gets the point. + +Dennis R. Conley sent a suggestion for MMDF systems, which I've added to the +comments in cron.h. + +Mike Heisler noted that I use comments in the CONVERSION file which are +documented as illegal in the man pages. Thanks, Mike. + +Irving Wolfe sent me some very cheerful changes for a NeXT system, but I +consider the system itself broken and I can't bring myself to #ifdef for +something as screwed up as this system seems to be. However, various others +did send me smaller patches which appear to have cause cron to build and run +correctly on (the latest) NeXT machines, with or without the "-posix" CFLAG. +Irving also asked for a per-job MAILTO, and this was finally added later when +I integrated the BSD/386 changes contributed by BSDi, and generalized some of +the parsing. + +Lots of folks complained that the autogenerated "Date:" header wasn't in +ARPA format. I didn't understand this -- either folks will use Sendmail and +not generate a Date: at all (since Sendmail will do it), or folks will use +something other than Sendmail which won't care about Date: formats. But +I've "fixed" it anyway... + +Several people suggested that "*" should be able to take a "/step". One person +suggested that "N/step" ought to mean "N-last/step", but that's stretching things +a bit far. "*/step" seems quite intuitive to me, so I've added it. Colin Plumb +sent in the first and most polite request for this feature. + +As with every release of Cron, BIND, and seemingly everything else I do, one +user stands out with the most critical but also the most useful analysis. +Cron V3's high score belongs to Peter Holzer, who sent in the nicest looking +patch for the "%" interpretation problem and also helped me understand a +tricky bit of badness in the "log_fd" problem. + +agulbra@flode.nvg.unit.no wins the honors for being the first to point out the +nasty security hole in "crontab -r". 'Nuff said. + +Several folks pointed out that log_it() needed to exist even if logging was +disabled. Some day I will create a tool that will compile a subsystem with +every possible combination and permutation of #ifdef options, but meanwhile +thanks to everybody. + +job_runqueue() was using storage after freeing it, since Jordan told me back +in 1983 that C let you do that, and I believed him in 1986 when I wrote all +this junk. Linux was the first to die from this error, and the Linux people +sent me the most amazing, um, collection of patches for this problem. Thanks +for all the fish. + +Jeremy Bettis reminded me that popen() isn't safe. I grabbed Ken Arnold's +version of popen/pclose from the ftpd and hacked it to taste. We're safe now, +from this at least. + +Branko Lankester sent me a very timely and helpful fix for a looming security +problem in my "crontab -e" implementation. + +-------- + +Vixie Cron Changes from V1 to V2 +Paul Vixie +8-Feb-1988 + +Many changes were made in a rash of activity about six months ago, the exact +list of which is no longer clear in my memory. I know that V1 used a file +called POKECRON in /usr/spool/cron to tell it that it was time to re-read +all the crontab files; V2 uses the modtime the crontab directory as a flag to +check out the crontab files; those whose modtime has changed will be re-read, +and the others left alone. Note that the crontab(1) command will do a utimes +call to make sure the mtime of the dir changes, since the filename/inode will +often remain the same after a replacement and the mtime wouldn't change in +that case. + +8-Feb-88: made it possible to use much larger environment variable strings. + V1 allowed 100 characters; V2 allows 1000. This was needed for PATH + variables on some systems. Thanks to Toerless Eckert for this idea. + E-mail: UUCP: ...pyramid!fauern!faui10!eckert + +16-Feb-88: added allow/deny, moved /usr/spool/cron/crontabs to + /usr/lib/cron/tabs. allow and deny are /usr/lib/cron/{allow,deny}, + since the sysv naming for this depends on 'at' using the same + dir, which would be stupid (hint: use /usr/{lib,spool}/at). + +22-Feb-88: made it read the spool directory for crontabs and look each one + up using getpwnam() rather than reading all passwds with getpwent() + and trying to open each crontab. + +9-Dec-88: made it sync to :00 after the minute, makes cron predictable. + added logging to /var/cron/log. + +14-Apr-90: (actually, changes since December 1989) + fixed a number of bugs reported from the net and from John Gilmore. + added syslog per Keith Bostic. security features including not + being willing to run a command owned or writable by other than + the owner of the crontab 9not working well yet) diff --git a/src/cmd/cron/grot/CONVERSION b/src/cmd/cron/grot/CONVERSION new file mode 100755 index 0000000..b86427d --- /dev/null +++ b/src/cmd/cron/grot/CONVERSION @@ -0,0 +1,85 @@ +$Id: CONVERSION,v 2.2 1993/12/28 08:34:43 vixie Exp $ + +Conversion of BSD 4.[23] crontab files: + +Edit your current crontab (/usr/lib/crontab) into little pieces, with each +users' commands in a different file. This is different on 4.2 and 4.3, +but I'll get to that below. The biggest feature of this cron is that you +can move 'news' and 'uucp' cron commands into files owned and maintainable +by those two users. You also get to rip all the fancy 'su' footwork out +of the cron commands. On 4.3, there's no need for the 'su' stuff since the +user name appears on each command -- but I'd still rather have separate +crontabs with seperate environments and so on. + +Leave the original /usr/lib/crontab! This cron doesn't use it, so you may +as well keep it around for a while in case something goes wakko with this +fancy version. + +Most commands in most crontabs are run by root, have to run by root, and +should continue to be run by root. They still have to be in their own file; +I recommend /etc/crontab.src or /usr/adm/crontab.src. + +'uucp's commands need their own file; how about /usr/lib/uucp/crontab.src? +'news' also, perhaps in /usr/lib/news/crontab.src... + +I say `how about' and `perhaps' because it really doesn't matter to anyone +(except you) where you put the crontab source files. The `crontab' command +COPIES them into a protected directory (CRONDIR/SPOOL_DIR in cron.h), named +after the user whose crontab it is. If you want to examine, replace, or +delete a crontab, the `crontab' command does all of those things. The +various `crontab.src' (my suggested name for them) files are just source +files---they have to be copied to SPOOLDIR using `crontab' before they'll be +executed. + +On 4.2, your crontab might have a few lines like this: + + 5 * * * * su uucp < /usr/lib/uucp/uudemon.hr + 10 4 * * * su uucp < /usr/lib/uucp/uudemon.day + 15 5 * * 0 su uucp < /usr/lib/uucp/uudemon.wk + +...or like this: + + 5 * * * * echo /usr/lib/uucp/uudemon.hr | su uucp + 10 4 * * * echo /usr/lib/uucp/uudemon.day | su uucp + 15 5 * * 0 echo /usr/lib/uucp/uudemon.wk | su uucp + +On 4.3, they'd look a little bit better, but not much: + + 5 * * * * uucp /usr/lib/uucp/uudemon.hr + 10 4 * * * uucp /usr/lib/uucp/uudemon.day + 15 5 * * 0 uucp /usr/lib/uucp/uudemon.wk + +For this cron, you'd create /usr/lib/uucp/crontab.src (or wherever you want +to keep uucp's commands) which would look like this: + + # /usr/lib/uucp/crontab.src - uucp's crontab + # + PATH=/usr/lib/uucp:/bin:/usr/bin + SHELL=/bin/sh + HOME=/usr/lib/uucp + # + 5 * * * * uudemon.hr + 10 4 * * * uudemon.day + 15 5 * * 0 uudemon.wk + +The application to the `news' cron commands (if any) is left for you to +figure out. Likewise if there are any other cruddy-looking 'su' commands in +your crontab commands, you don't need them anymore: just find a good place +to put the `crontab.src' (or whatever you want to call it) file for that +user, put the cron commands into it, and install it using the `crontab' +command (probably with "-u USERNAME", but see the man page). + +If you run a 4.2-derived cron, you could of course just install your current +crontab in toto as root's crontab. It would work exactly the way your +current one does, barring the extra steps in installing or changing it. +There would still be advantages to this cron, mostly that you get mail if +there is any output from your cron commands. + +One note about getting mail from cron: you will probably find, after you +install this version of cron, that your cron commands are generating a lot +of irritating output. The work-around for this is to redirect all EXPECTED +output to a per-execution log file, which you can examine if you want to +see the output from the "last time" a command was executed; if you get any +UNEXPECTED output, it will be mailed to you. This takes a while to get +right, but it's amazingly convenient. Trust me. + diff --git a/src/cmd/cron/grot/FEATURES b/src/cmd/cron/grot/FEATURES new file mode 100755 index 0000000..209b1e9 --- /dev/null +++ b/src/cmd/cron/grot/FEATURES @@ -0,0 +1,84 @@ +$Id: FEATURES,v 2.1 1993/12/28 08:34:43 vixie Exp $ + +Features of Vixie's cron relative to BSD 4.[23] and SysV crons: + +-- Environment variables can be set in each crontab. SHELL, USER, + LOGNAME, and HOME are set from the user's passwd entry; all except + USER can be changed in the crontab. PATH is especially useful to + set there. TZ can be set, but cron ignores it other than passing + it on through to the commands it runs. Format is + + variable=value + + Blanks surrounding the '=' will be eaten; other blanks in value are + okay. Leading or trailing blanks can be preserved by quoting, single + or double quotes are okay, just so they match. + + PATH=.:/bin:/usr/bin + SHELL=/bin/sh + FOOBAR = this is a long blanky example + + Above, FOOBAR would get "this is a long blanky example" as its value. + + SHELL and HOME will be used when it's time to run a command; if + you don't set them, HOME defaults to your /etc/passwd entry + and SHELL defaults to /bin/sh. + + MAILTO, if set to the login name of a user on your system, will be the + person that cron mails the output of commands in that crontab. This is + useful if you decide on BINMAIL when configuring cron.h, since binmail + doesn't know anything about aliasing. + +-- Weekdays can be specified by name. Case is not significant, but only + the first three letters should be specified. + +-- Months can likewise be specified by name. Three letters only. + +-- Ranges and lists can be mixed. Standard crons won't allow '1,3-5'. + +-- Ranges can specify 'step' values. '10-16/2' is like '10,12,14,16'. + +-- Sunday is both day 0 and day 7 -- apparently BSD and ATT disagree + about this. + +-- Each user gets their own crontab file. This is a win over BSD 4.2, + where only root has one, and over BSD 4.3, where they made the crontab + format incompatible and although the commands can be run by non-root + uid's, root is still the only one who can edit the crontab file. This + feature mimics the SysV cron. + +-- The 'crontab' command is loosely compatible with SysV, but has more + options which just generally make more sense. Running crontab with + no arguments will print a cute little summary of the command syntax. + +-- Comments and blank lines are allowed in the crontab file. Comments + must be on a line by themselves; leading whitespace is ignored, and + a '#' introduces the comment. + +-- (big win) If the `crontab' command changes anything in any crontab, + the 'cron' daemon will reload all the tables before running the + next iteration. In some crons, you have to kill and restart the + daemon whenever you change a crontab. In other crons, the crontab + file is reread and reparsed every minute even if it didn't change. + +-- In order to support the automatic reload, the crontab files are not + readable or writable except by 'crontab' or 'cron'. This is not a + problem, since 'crontab' will let you do pretty much whatever you + want to your own crontab, or if you are root, to anybody's crontab. + +-- If any output is generated by a command (on stdout OR stderr), it will + be mailed to the owner of the crontab that contained the command (or + MAILTO, see discussion of environment variables, above). The headers + of the mail message will include the command that was run, and a + complete list of the environment that was passed to it, which will + contain (at least) the USER (LOGNAME on SysV), HOME, and SHELL. + +-- the dom/dow situation is odd. '* * 1,15 * Sun' will run on the + first and fifteenth AND every Sunday; '* * * * Sun' will run *only* + on Sundays; '* * 1,15 * *' will run *only* the 1st and 15th. this + is why we keep 'e->dow_star' and 'e->dom_star'. I didn't think up + this behaviour; it's how cron has always worked but the documentation + hasn't been very clear. I have been told that some AT&T crons do not + act this way and do the more reasonable thing, which is (IMHO) to "or" + the various field-matches together. In that sense this cron may not + be completely similar to some AT&T crons. diff --git a/src/cmd/cron/grot/INSTALL b/src/cmd/cron/grot/INSTALL new file mode 100755 index 0000000..cc660ff --- /dev/null +++ b/src/cmd/cron/grot/INSTALL @@ -0,0 +1,87 @@ +/* Copyright 1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +$Id: INSTALL,v 2.5 1994/01/15 20:43:43 vixie Exp $ + +Read the comments at the top of the Makefile, then edit the area marked +'configurable stuff'. + +Edit config.h. The stuff I expect you to change is down a bit from the +top of the file, but it's clearly marked. Also look at pathnames.h. + +You don't have to create the /var/cron or /var/cron/tabs directories, since +both the daemon and the `crontab' program will do this the first time they +run if they don't exist. You do need to have a /var, though -- just "mkdir +/var" if you don't have one, or you can "mkdir /usr/var; ln -s /usr/var /var" +if you expect your /var to have a lot of stuff in it. + +You will also need /usr/local/etc and /usr/local/bin directories unless you +change the Makefile. These will have to be created by hand, but if you are +a long-time Usenet user you probably have them already. /usr/local/man is +where I keep my man pages, but I have the source for `man' and you probably +do not. Therefore you may have to put the man pages into /usr/man/manl, +which will be hard since there will be name collisions. (Note that the man +command was originally written by Bill Joy before he left Berkeley, and it +contains no AT&T code, so it is in UUNET's archive of freely-distributable +BSD code.) + +LINUX note: /usr/include/paths.h on some linux systems shows _PATH_SENDMAIL + to be /usr/bin/sendmail even though sendmail is installed in /usr/lib. + you should check this out. + +say: + make all + +su and say: + make install + +Note that if I can get you to "su and say" something just by asking, you have +a very serious security problem on your system and you should look into it. + +Edit your /usr/lib/crontab file into little pieces -- see the CONVERSION file +for help on this. + +Use the `crontab' command to install all the little pieces you just created. +Some examples (see below before trying any of these!) + + crontab -u uucp -r /usr/lib/uucp/crontab.src + crontab -u news -r /usr/lib/news/crontab.src + crontab -u root -r /usr/adm/crontab.src + +Notes on above examples: (1) the .src files are copied at the time the +command is issued; changing the source files later will have no effect until +they are reinstalled with another `crontab -r' command. (2) The crontab +command will affect the crontab of the person using the command unless `-u +USER' is given; `-u' only works for root. When using most `su' commands +under most BSD's, `crontab' will still think of you as yourself even though +you may think of yourself as root -- so use `-u' liberally. (3) the `-r' +option stands for `replace'; check the man page for crontab(1) for other +possibilities. + +Kill your existing cron daemon -- do `ps aux' and look for /etc/cron. + +Edit your /etc/rc or /etc/rc.local, looking for the line that starts up +/etc/cron. Comment it out and add a line to start the new cron daemon +-- usually /usr/local/etc/cron, unless you changed it in the Makefile. + +Start up this cron daemon yourself as root. Just type /usr/local/etc/cron +(or whatever); no '&' is needed since the daemon forks itself and the +process you executed returns immediately. + +ATT notes: for those people unfortunate enough to be stuck on a AT&T UNIX, +you will need the public-domain "libndir", found in the B News source and in +any comp.sources.unix archive. You will also need to hack the code some. diff --git a/src/cmd/cron/grot/MAIL b/src/cmd/cron/grot/MAIL new file mode 100755 index 0000000..b066e7e --- /dev/null +++ b/src/cmd/cron/grot/MAIL @@ -0,0 +1,475 @@ +[ this is really old mail that came to me in response to my 1986 posting + to usenet asking for feature suggestions before releasing the first + version of cron. it is presented here for its entertainment value. + --vix ] + +$Id: MAIL,v 1.1 1993/12/28 08:30:36 vixie Exp $ + +From ptsfa!lll-crg!ames!acornrc!bob Wed Dec 31 10:07:08 1986 +Date: Wed, 31 Dec 86 08:59:31 pst +From: lll-crg!ames!acornrc!bob (Bob Weissman) +To: ptsfa!vixie!paul +Status: RO + +Sure, here's a suggestion: I'd like to be able to run a program, say, +every two hours. Current cron requires me to write +0,2,4,6,8,10,12,14,16,18,20,22 in the hours field. How about a notation +to handle this more elegantly? + +<< Okay, I've allowed 0-22/2 as a means of handling this. + The time specification for my cron is as follows: + specification = range {"," range} + range = (start "-" finish ["/" step]) | single-unit + This allows "1,3,5-7", which the current cron doesn't (it won't + do a range inside a list), and handles your specific need. >> + +From drw@mit-eddie Wed Dec 31 18:25:27 1986 +Date: Wed, 31 Dec 86 14:28:19 est +From: drw@mit-eddie (Dale Worley) +To: mit-eddie!vixie!paul +Status: RO + +We have a lot of lines in our crontab of the form + + 00 12 * * * su user < /usr/users/user/script.file + +This barfs (silently!) on our system (Dec Ultrix 1.2 == 4.2bsd) if +user's shell is csh. This, I am told, is because csh requires that +the environment be set up in certain ways, which cron doesn't do. +(Actually, I believe, it is because /etc/rc, which runs cron, doesn't +set up the environment enough for csh to run, and cron just inherits +the situation.) Anyway, the point is that if you find out what csh +really needs in its environment, you might want to set up cron to +provide some reasonable defaults (if it isn't supplied by cron's +parent). Also, could you tell me what csh needs, if you find out, so +we can hack our /etc/rc? + +<< well, the environment IS a problem. processes that cron forks + will inherit the environment of the person who ran the cron + daemon... I plan to edit out such useless things as TERMCAP, + TERM, and the like; supply correct values for HOME, USER, CWD, + and whatever else comes to mind. I'll make sure csh works... >> +From ptsfa!ames!seismo!dgis!generous Thu Jan 1 07:33:17 1987 +Date: Thu Jan 1 10:29:20 1987 +From: ames!seismo!dgis!generous (Curtis Generous) +To: nike!ptsfa!vixie!paul +Status: RO + +Paul: + +One of the limitations of the present versions of cron is the lack +of the capability of specifying a way to execute a command every +n units of time. + +Here is a good example: + +# Present method to start up uucico +02,12,22,32,42,52 * * * * exec /usr/lib/uucp/uucico -r1 + +# New method ?? (the ':' here is just one possibility for syntax) +02:10 * * * * exec /usr/lib/uucp/uucico -r1 + +This method would prove very helpful for those programs that get started +every few minutes, making the entry long and not easily readable. The first +number would specify the base time, and the second number the repetition +interval. + +<< Good idea, but bob@acornrc beat you to it. I used '/' instead of + ':'. This is my personal preference, and seems intuitive when you + think of the divide operator in C... Does anyone have a preference? >> + +From ptsfa!lll-lcc!seismo!decuac!c3pe!c3engr!charles Thu Jan 1 17:04:24 1987 +From: lll-lcc!seismo!c3pe!c3engr!charles (Charles Green) +To: c3pe!decuac!dolqci!vrdxhq!seismo!lll-lcc!ptsfa!vixie!paul +Date: Thu Jan 1 19:22:47 1987 +Status: RO + +Well, this isn't a compatible extension, but I have in times past wondered +about a facility to let you start a process at intervals of, say, 17 minutes, +instead of particular minutes out of each hour. + +<< This was a popular request! >> + +From seismo!uwvax!astroatc!nicmad!norvax!mann Sun Jan 4 13:04:01 1987 +Date: Fri, 2 Jan 87 09:23:53 cst +From: lll-lcc!seismo!uwvax!astroatc!nicmad!norvax!mann (Tom Mann) +To: ptsfa!vixie!paul +Status: RO + +I'm not sure if it is in cron (either SysV or BSD ... if it is, I haven't +figured it out ) but a comment feature would SURE BE NICE!. +There are times when I want to comment out an entry +for a period of time; it might also make it a lot more legible. + +<< My cron allows blank lines and standard #-type comments. I know + that one BSD4.2 cron I've used had it. I don't know about SysV. >> + +From ptsfa!hoptoad!hugh Mon Jan 5 10:26:46 1987 +Date: Mon, 5 Jan 87 01:22:17 PST +From: hoptoad!hugh (Hugh Daniel) +To: ptsfa!vixie!paul +Status: RO + + Hi, I do have a BIG one that I would like. I want to log ALL output +from command lines into a file for each line. Thus I might have a chance +of finding out why my crontab entry did not work. + This would seem to work best if done by cron, as it is now I have a google +of shell scripts laying about just to put the error output where I can see +it. + +<< My cron (and the SysV cron) will send mail to the owner of the + particular crontab file if a command generates any output on stdout + or stderr. This can be irritating, but if you write a script such + that any output means a problem occurred, you can avoid most logfile + needs, and not generate mail except in unforeseen circumstances. >> + +From ptsfa!dual!ucbvax!ihnp4!anvil!es!Robert_Toxen Mon Jan 5 13:08:46 1987 +From: dual!ucbvax!ihnp4!anvil!es!Robert_Toxen +Date: Fri, 2 Jan 87 14:25:29 EST +To: anvil!ihnp4!ucbvax!dual!ptsfa!vixie!paul +Status: RO + +Here are some suggestions: +1. Run it through the C preprocessor via "/lib/". + +<< hmmm. this seems of limited utility, and if you really wanted + to do it that way, you could do it yourself (since users can + write to their own crontab files). I'll add '-' (read stdin) + to the crontab installer program to facilitate this. >> + +2. Allow specifying every Nth day of week, i.e., every second Wednesday. + I did this to calendar by separating the day of week (Wed=4, which one + to start on and N with slashes). I took modulo the day of year as a + starting point so that someone with a desk calendar documenting such + things can easily determine the offset (second number). I did this + while at SGI; alas I don't have a copy of the code. + +<< I can see how this could be useful, but I'm not sure how I'd + implement it. Cron currently doesn't keep track of the last time + a given command was run; whether the current Wednesday is the first + or second since the command was last run would be pretty hard to + figure out. I'd have to keep a database of commands and their + execution around, and purge it when the crontab was overwritten. + This is too much work for me, but if someone adds it, let me know. >> + +From ptsfa!ames!seismo!cbmvax!devon!paul Tue Jan 6 05:50:17 1987 +From: ames!seismo!cbmvax!devon!paul +To: cbmvax!seismo!nike!ptsfa!vixie!paul +Date: Mon Jan 5 09:29:57 1987 +Status: RO + +One problem that has always plagued me with cron is the assumed ORing. +I'd like to see some type of ANDing implemented. I guess I can best +describe this by example. Say I have the following line in my crontab +file: + +* * 4-31 * 1-6 /usr/bin/command + +What this does is run 'command' on the 4th thru 31st days of the +month, AND on Monday thru Saturday; which probably means running it +every day of the month (unless Sunday falls on days 1-3). This +happens because cron runs the command if the day-of-month OR the +day-of-week is true. + +What I'd like to happen with the above line is to run the command ONLY +on Monday thru Saturday any time after the 3rd of the month, e.g. if +the day-of-month AND the day-of-week are true. + +My proposal to you is to implement some special chars for the first +five fields. Examples: + +* * !1-3 * 1-6 /usr/bin/command + +(run command Mon-Sat, but NOT [!] on the first 3 days of the month) + +* * &4-31 * &1-6 /usr/bin/command + +(run command if day-of-month AND day-of-week are true) + +Get the picture? This would be compatable with existing versions of +cron (which wouldn't currently be using any special characters, so +that old crontabs would be handled correctly). + +<< This message made me aware of the actual boolean expression involved + in a crontab entry. I'd assumed that it was + (minute && hour && DoM && month && DoW) + But it's really + (minute && hour && month && (DoM || DoW)) + + I can see some value in changing this, but with a fixed order of + fields, operators get to be kindof unary, which && and || really + aren't. If someone has an idea on a syntax that allows useful + variations to the standard (&& && && (||)) default, please suggest. >> + +From bobkat!pedz Tue Jan 6 20:02:10 1987 +From: pedz@bobkat.UUCP (Pedz Thing) +Date: 2 Jan 87 17:34:44 GMT +Status: RO + +Log files! It would be nice to be able to specify a log for cron +itself and also a log for each program's stdout and stderr to go to. +The latter can of course be done with > and 2> but it would be nice if +there could be a single line with some sort of pattern like +`> /usr/spool/log/%' and the command would be substituted for the %. +Another thing which would be nice is to be able to specify which shell +to call to give the command to. + +<< Log files are done with mail. The '%' idea could be useful if + a different character were used (% is special to cron, see man + page); a different directory would have to be chosen, since each + user has their own crontab file; and something intelligent would + have to be done in the file naming, since the first word of the + command might be ambiguous (with other commands). In short, it's + too much work. Sorry. >> + +From guy%gorodish@sun Tue Jan 6 20:03:13 1987 +From: guy%gorodish@sun (Guy Harris) +Message-ID: <10944@sun.uucp> +Date: 5 Jan 87 12:09:09 GMT +References: <429@vixie.UUCP> <359@bobkat.UUCP> +Sender: news@sun.uucp +Status: RO + +> Another thing which would be nice is to be able to specify which shell +> to call to give the command to. + +Well, the obvious choice would be the user's shell, but this wouldn't work +for accounts like "uucico". + +<< I use the owning user's shell, and to handle "uucico" I check a + list of "acceptable shells" (currently compiled in, does anybody + mind?), substituting a default (compiled in) shell if the user's + shell isn't on the list. + + BTW, "compiled in" means that it's in a .h file, easily changed + during installation, but requiring recompilation to modify. You + don't have to go digging through the code to find it... >> + +From qantel!hplabs!ucbvax!mwm@violet.berkeley.edu Tue Jan 6 21:24:48 1987 +To: hplabs!qantel!vixie!paul (Paul Vixie Esq) +Date: 04 Jan 87 00:42:35 PST (Sun) +From: Mike Meyer +Status: RO + +<<[Discussion of RMS/FSF, and mwm's GNU Cron deleted]>> + +Oh, yeah - here are the extensions on my cron: + +1) Sunday is both day 0 and day 7, so it complies with both SysV and +BSD cron. + +<< Good idea. I did it too, thanks for informing me. >> + +2) At is integrated into the cron. Instead of atrun to scan the +/usr/spool/at directory, at files are put into the /usr/lib/cron +directory along with users cron files, and cron fabricates a line from +a crontab file to run them. This is considered a major win by all who +use it. + +<< I don't use 'at', and my cron doesn't do anything with it. To run + 'at', I use 'atrun' the same way the current BSD cron does. My + crontab files are in /usr/spool/cron/crontabs, in the SysV + tradition -- not in /usr/lib/cron. This is a configuration + parameter, of course. >> + +There are two known restrictions: + +1) I don't support any of the SysV security hooks. I don't have a use +for them, and RMS didn't like the idea at all :-). + +<< This means cron.allow and cron.deny. I plan to support them, as + they've been quite helpful at various HPUX sites I've administered. >> + +2) Cron expects to be able to create files with names longer than 14 +characters, which makes it hard to run on SysV. At least one person +was working on a port, but I don't know how it's going. That might +make for a good reason for releasing yours, right there. + +<< If someone has SysV (with the 14-character limit), they probably + won't want my cron, since it doesn't add much to the standard + version (which they may have support for). My cron is not currently + portable to non-BSD systems, since it relies on interval timers (I + needed to sleep for intervals more granular than seconds alone would + allow). The port would be trivial, and I will do it if a lot of + people ask for it... >> + +Oh, yeah - I'm going to see about getting this cron integrated into +the next 4BSD release. + +<< How does one go about this? I have a few nifty gadgets I'd like + to contribute, this cron being one of them... >> + +<<[more FSF/GNU discussion deleted]>> + +From qantel!hplabs!ames!ut-sally!ut-ngp!melpad!bigtex!james Tue Jan 6 21:24:57 1987 +Posted-Date: Fri, 2 Jan 87 19:26:16 est +Date: Fri, 2 Jan 87 19:26:16 est +From: hplabs!ames!ut-sally!ut-ngp!bigtex!james +To: vixie!paul +Status: RO + +Yes!!! There are several critical failures in System V cron... + +1. Pass all variables in cron's environment into the environment of things + cron starts up, or at least into the crontab entries started up (at jobs + will inherit the environment of the user). If nothing else it is critically + important that the TZ variable be passed on. PATH should be passed on too. + Basically, passing environment values allows one to design a standard + environment with TZ and PATH and have that run by everything. If anyone + tells you this is no big deal, consider what happens when uucico is + started by cron in CA to make a long distance phone link... Unless the + administrator is really on his/her toes, calls scheduled at 5pm will really + go at two in the afternoon, needlessly incurring huge phone bills, all + because System V refuses to pass the TZ from its environment down. There + are work arounds, but only putting it in cron will really work. This is + not a security hole. + +<< delete TERM and TERMCAP; modify HOME, USER, and CWD; pass TZ and + PATH through undisturbed. any other requests out there? + + BSD doesn't have this problem -- TZ is passed right on through if + you define it in the shell before starting my cron daemon. However, + the BSD I'm running this on doesn't need TZ to be defined anyway... + The default in the kernel has been just fine so far... But just the + same, if/when I port to SysV (I guess I really should), I'll make + sure this works right. + + I guess I've been spoiled. HPUX is SysV-based, and I never had a + problem with cron and TZ when I used it. >> + +2. A way to avoid logging stuff in /usr/lib/cron/log. I have a cron entry + run uudemon.hr every 10 minutes. This is 144 times/day. Each run generates + three lines of text, for a total of 432 lines of text I don't want to see. + Obviously this should be optional, but it would be nice if there were a + way to flag an entry so that it wasn't logged at all unless there was an + error. + +<< I don't know nothin' 'bout no /usr/lib/cron/log. What is this file? + I don't see any reason to create log entries, given the mail-the- + output behaviour. Opinions, anyone? >> + +I will come up with other ideas no doubt, but I can always implement them +myself. + +<< That's what I like about PD software. Please send me the diffs! >> + +The other problem you have is making sure you can run standard +crontabs. I would suggest something like this: if the command part of the +entry starts with an unescaped -, then flags and options follow immediately +thereafter. As in: + +2,12,22,32,42,52 * * * * -q /usr/lib/uucp/uudemon.hr + +This could mean do not log the uudemon.hr run unless there is a problem of +some kind. This is probably safe as not many filenames start with "-", and +those that do are already a problem for people. + +<< Since I don't plan on supporting /usr/lib/cron/log in ANY form unless + many people request it, I won't be needing -q as you've defined it. + I could use something like this to avoid sending mail on errors, for + the occasional script that you don't want to bullet-proof. + + The compatibility issue is CRITICAL. The 4.3BSD crontab format is + a crime against the whole philosophy of Unix(TM), in my opinion. >> + +One other minor thing to consider is the ulimit: can different users get +different ulimits for their crontab entries? + +<< Boy I'm ignorant today. What's a ulimit, and what should I do with + it in a crontab? Suggestions, enlightenment, etc ?? >> + +From qantel!lll-crg!ames!uw-beaver!uw-nsr!john Tue Jan 6 23:32:44 1987 +Date: Thu, 1 Jan 87 10:53:05 pst +From: lll-crg!ames!uw-beaver!uw-nsr!john (John Sambrook 5-7433) +To: vixie!paul +Status: RO + +How about not hardwiring the default environment that cron builds for its +children in the cron program itself? Our cron does this and it's the pits +because we are TZ=PST8PDT not TZ=EST5EDT ! + +<< yeachk. I assure you, I will not hardwire the TZ! >> +From ptsfa!well!dv Fri Jan 9 04:01:50 1987 +Date: Thu, 8 Jan 87 23:50:40 pst +From: well!dv (David W. Vezie) +To: ptsfa!vixie!paul +Status: RO + +6, have a special notation called 'H' which would expand to weekends + and holidays (you'd have to keep a database somewhere of real + holidays), and also 'W' for workdays (neither weekend or holiday). + +<< Too much work. There should be a standard way to define and + detect holidays under Unix(TM); if there were, I'd use it. As + it is, I'll leave this for someone else to add. + + I can see the usefulness; it just doesn't quite seem worth it. >> +From qantel!gatech!akgua!blnt1!jat Wed Jan 14 20:00:40 1987 +Date: Tue, 13 Jan 87 16:39:38 EST +From: gatech!akgua!blnt1!jat +Status: RO + +1) Add some way to tell cron to reread the files, say kill -1 + +<< whenever the 'crontab' program is run and updates a crontab file, + a file /usr/spool/cron/POKECRON is created; next time the cron + daemon wakes up, it sees it, and re-reads the crontab files. + + I thought of handling the signal; even implemented it. Then this + clever idea hit me and I ripped it all out and added a single + IF-statement to handle the POKECRON file. >> + +2) Have some kind of retry time so that if a command fails, cron will try to + execute it again after a certain period. This is useful if you have some + type of cleanup program that can run at the scheduled time for some reason + (such as locked device, unmounted filesystem, etc). + +<< Hmmm, sounds useful. I could do this by submitting an 'at' job... + I'll think about it. >> +From ptsfa!dual!ucbvax!ihnp4!mtuxo!ender Sat Jan 3 16:54:00 1987 +From: dual!ucbvax!ihnp4!mtuxo!ender +Date: Sat, 3 Jan 87 14:05:13 PST +To: ucbvax!dual!ptsfa!vixie!paul +Status: RO + +It would be nice if nonprivileged users can setup personal crontab files +(~/.cronrc, say) and be able to run personal jobs at regular intervals. + +<< this is done, but in the SysV style: the 'crontab' program installs + a new crontab file for the executing user (can be overridden by root + for setup of uucp and news). the advantage of this is that (1) when + a crontab is changed, the daemon can be informed automatically; and + (2) the file can be syntax-checked before installation. >> +From ptsfa!ames!seismo!ihnp4!lcc!richard Fri Jan 16 04:47:33 1987 +Date: Fri, 16 Jan 87 07:44:57 EST +To: nike!ptsfa!vixie!paul +Status: RO + +The System V cron is nice, but it has a few annoying features. One is that +its mail files will say that the previous message is the output of "one of your +cron commands." I wish it would say WHICH cron commmand. + +<< Done. Also which shell, which user (useful when the mail gets + forwarded), which home directory, and other useful crud. >> + +Another problem is with timezones. It is necessary to specify TZ=PST8PDT (or +whatever) when you invoke cron (from inittab, or /etc/rc) and it is also +necessary to add TZ=PST8PDT to each crontab line which might need it. Cron +should automatically export its idea of the "TZ" to each invoked command, and +it should be possible to put a line in the crontab file which overrides that +for every command in the file (e.g., most users are on EST, so cron is run +with TZ=EST5EDT; but one user is usually on PST and wants all of his cron +commands to run with TZ=PST8PDT). This might be extended to allow any +environment variable to be specified once for the whole crontab file (e.g., +PATH). + +<< Well, since I run the user's shell, you could put this into .cshrc. + generic environment-variable setting could be useful, though. Since + I have to modify the environment anyway, I'll consider this. >> + +A log file might be a nice idea, but the System V cron log is too verbose. +I seem to remember that cron keeps it open, too; so you can't even have +something go and periodically clean it out. + +<< I don't do /usr/lib/cron/log. I wasn't aware of this file until I + got all these suggestions. Do people want this file? Tell me! >> diff --git a/src/cmd/cron/grot/MANIFEST b/src/cmd/cron/grot/MANIFEST new file mode 100755 index 0000000..aed1d4f --- /dev/null +++ b/src/cmd/cron/grot/MANIFEST @@ -0,0 +1,33 @@ + File Name Archive # Description +----------------------------------------------------------- + CHANGES 2 + CONVERSION 1 + FEATURES 1 + INSTALL 1 + MAIL 2 + MANIFEST 1 This shipping list + Makefile 1 + README 1 + THANKS 1 + bitstring.3 1 + bitstring.h 1 + compat.c 1 + compat.h 1 + config.h 1 + cron.8 1 + cron.c 1 + cron.h 1 + crontab.1 1 + crontab.5 1 + crontab.c 2 + database.c 1 + do_command.c 2 + entry.c 2 + env.c 1 + externs.h 1 + job.c 1 + misc.c 2 + pathnames.h 1 + popen.c 1 + putman.sh 1 + user.c 1 diff --git a/src/cmd/cron/grot/THANKS b/src/cmd/cron/grot/THANKS new file mode 100755 index 0000000..3787c29 --- /dev/null +++ b/src/cmd/cron/grot/THANKS @@ -0,0 +1,29 @@ +15 January 1990 +Paul Vixie + +Many people have contributed to cron. Many more than I can remember, in fact. +Rich Salz and Carl Gutekunst were each of enormous help to me in V1; Carl for +helping me understand UNIX well enough to write it, and Rich for helping me +get the features right. + +John Gilmore wrote me a wonderful review of V2, which took me a whole year to +answer even though it made me clean up some really awful things in the code. +(According to John the most awful things are still in here, of course.) + +Paul Close made a suggestion which led to /etc/crond.pid and the mutex locking +on it. Kevin Braunsdorf of Purdue made a suggestion that led to @reboot and +its brothers and sisters; he also sent some diffs that lead cron toward compil- +ability with System V, though without at(1) capabilities, this cron isn't going +to be that useful on System V. Bob Alverson fixed a silly bug in the line +number counting. Brian Reid made suggestions which led to the run queue and +the source-file labelling in installed crontabs. + +Scott Narveson ported V2 to a Sequent, and sent in the most useful single batch +of diffs I got from anybody. Changes attributable to Scott are: + -> sendmail won't time out if the command is slow to generate output + -> day-of-week names aren't off by one anymore + -> crontab says the right thing if you do something you shouldn't do + -> crontab(5) man page is longer and more informative + -> misc changes related to the side effects of fclose() + -> Sequent "universe" support added (may also help on Pyramids) + -> null pw_shell is dealt with now; default is /bin/sh diff --git a/src/cmd/cron/grot/diffs b/src/cmd/cron/grot/diffs new file mode 100755 index 0000000..e989fa7 --- /dev/null +++ b/src/cmd/cron/grot/diffs @@ -0,0 +1,1933 @@ +diff -c -r /tmp/cron/Makefile cron/Makefile +*** /tmp/cron/Makefile Fri Jun 18 19:37:52 1999 +--- cron/Makefile Tue Jun 15 20:53:11 1999 +*************** +*** 45,96 **** + # + # there's more configuration info in config.h; edit that first! + +- #################################### begin configurable stuff +- #<> + DESTROOT = $(DESTDIR)/usr + DESTSBIN = $(DESTROOT)/sbin + DESTBIN = $(DESTROOT)/bin +! DESTMAN = $(DESTROOT)/share/man +! #<> + INCLUDE = -I. +- #INCLUDE = +- #<> + LIBS = +! #<> +! #OPTIM = -O +! OPTIM = -g +! #<> +! # (ATT untested) +! #COMPAT = -DATT +! #(BSD is only needed if does not define it, as on ULTRIX) +! #COMPAT = -DBSD +! # (POSIX) +! #COMPAT = -DPOSIX + #<> +! LINTFLAGS = -hbxa $(INCLUDE) $(COMPAT) $(DEBUGGING) +! #<> +! #CC = vcc +! #<> + DEFS = +! #(SGI IRIX systems need this) +! #DEFS = -D_BSD_SIGNALS -Dconst= +! #<> +! #INSTALL = installbsd +! INSTALL = install +! #<> +! LDFLAGS = + #################################### end configurable stuff + + SHELL = /bin/sh +! CFLAGS = $(OPTIM) $(INCLUDE) $(COMPAT) $(DEFS) + +- INFOS = README CHANGES FEATURES INSTALL CONVERSION THANKS MAIL +- MANPAGES = bitstring.3 crontab.5 crontab.1 cron.8 putman.sh +- HEADERS = bitstring.h cron.h config.h pathnames.h \ +- externs.h compat.h +- SOURCES = cron.c crontab.c database.c do_command.c entry.c \ +- env.c job.c user.c popen.c misc.c compat.c +- SHAR_SOURCE = $(INFOS) $(MANPAGES) Makefile $(HEADERS) $(SOURCES) + LINT_CRON = cron.c database.c user.c entry.c compat.c \ + misc.c job.c do_command.c env.c popen.c + LINT_CRONTAB = crontab.c misc.c entry.c env.c compat.c +--- 45,68 ---- + # + # there's more configuration info in config.h; edit that first! + + DESTROOT = $(DESTDIR)/usr + DESTSBIN = $(DESTROOT)/sbin + DESTBIN = $(DESTROOT)/bin +! DESTMAN = $(DESTROOT)/man + INCLUDE = -I. + LIBS = +! OPTIM = -O + #<> +! LINTFLAGS = -hbxa $(INCLUDE) +! CC = cc + DEFS = +! INSTALL = install +! LDFLAGS = -i + #################################### end configurable stuff + + SHELL = /bin/sh +! CFLAGS = $(OPTIM) $(INCLUDE) $(DEFS) + + LINT_CRON = cron.c database.c user.c entry.c compat.c \ + misc.c job.c do_command.c env.c popen.c + LINT_CRONTAB = crontab.c misc.c entry.c env.c compat.c +*************** +*** 98,128 **** + misc.o env.o popen.o compat.o + CRONTAB_OBJ = crontab.o misc.o entry.o env.o compat.o + +! all : cron crontab + +! lint : +! lint $(LINTFLAGS) $(LINT_CRON) $(LIBS) \ +! |grep -v "constant argument to NOT" 2>&1 +! lint $(LINTFLAGS) $(LINT_CRONTAB) $(LIBS) \ +! |grep -v "constant argument to NOT" 2>&1 + +! cron : $(CRON_OBJ) +! $(CC) $(LDFLAGS) -o cron $(CRON_OBJ) $(LIBS) + +! crontab : $(CRONTAB_OBJ) +! $(CC) $(LDFLAGS) -o crontab $(CRONTAB_OBJ) $(LIBS) + +! install : all +! $(INSTALL) -c -m 111 -o root -s cron $(DESTSBIN)/ +! $(INSTALL) -c -m 4111 -o root -s crontab $(DESTBIN)/ +! sh putman.sh crontab.1 $(DESTMAN) +! sh putman.sh cron.8 $(DESTMAN) +! sh putman.sh crontab.5 $(DESTMAN) + +! clean :; rm -f *.o cron crontab a.out core tags *~ #* +! +! kit : $(SHAR_SOURCE) +! makekit -m -s99k $(SHAR_SOURCE) + + $(CRON_OBJ) : cron.h compat.h config.h externs.h pathnames.h Makefile + $(CRONTAB_OBJ) : cron.h compat.h config.h externs.h pathnames.h Makefile +--- 70,98 ---- + misc.o env.o popen.o compat.o + CRONTAB_OBJ = crontab.o misc.o entry.o env.o compat.o + +! all: cron crontab + +! lint: +! lint $(LINTFLAGS) $(LINT_CRON) $(LIBS) \ +! |grep -v "constant argument to NOT" 2>&1 +! lint $(LINTFLAGS) $(LINT_CRONTAB) $(LIBS) \ +! |grep -v "constant argument to NOT" 2>&1 + +! cron: $(CRON_OBJ) +! $(CC) $(LDFLAGS) -o cron $(CRON_OBJ) $(LIBS) + +! crontab: $(CRONTAB_OBJ) +! $(CC) $(LDFLAGS) -o crontab $(CRONTAB_OBJ) $(LIBS) + +! install: all +! $(INSTALL) -c -m 111 -o root -s cron $(DESTSBIN)/cron +! $(INSTALL) -c -m 4111 -o root -s crontab $(DESTBIN)/crontab +! sh putman.sh crontab.1 $(DESTMAN) +! sh putman.sh cron.8 $(DESTMAN) +! sh putman.sh crontab.5 $(DESTMAN) + +! clean: +! rm -f *.o cron crontab a.out core tags *~ #* + + $(CRON_OBJ) : cron.h compat.h config.h externs.h pathnames.h Makefile + $(CRONTAB_OBJ) : cron.h compat.h config.h externs.h pathnames.h Makefile +diff -c -r /tmp/cron/compat.c cron/compat.c +*** /tmp/cron/compat.c Fri Jun 18 19:37:52 1999 +--- cron/compat.c Tue Jun 15 22:04:11 1999 +*************** +*** 25,233 **** + + + #include "cron.h" +- #ifdef NEED_GETDTABLESIZE +- # include +- #endif +- #if defined(NEED_SETSID) && defined(BSD) +- # include +- #endif +- #include + + +! /* the code does not depend on any of vfork's +! * side-effects; it just uses it as a quick +! * fork-and-exec. +! */ +! #ifdef NEED_VFORK +! PID_T +! vfork() { +! return (fork()); +! } +! #endif +! +! +! #ifdef NEED_STRDUP +! char * +! strdup(str) +! char *str; +! { +! char *temp; +! +! temp = malloc(strlen(str) + 1); +! (void) strcpy(temp, str); +! return temp; +! } +! #endif +! +! +! #ifdef NEED_STRERROR +! char * +! strerror(error) +! int error; +! { +! extern char *sys_errlist[]; +! extern int sys_nerr; +! static char buf[32]; +! +! if ((error <= sys_nerr) && (error > 0)) { +! return sys_errlist[error]; +! } +! +! sprintf(buf, "Unknown error: %d", error); +! return buf; +! } +! #endif +! +! +! #ifdef NEED_STRCASECMP + int +- strcasecmp(left, right) +- char *left; +- char *right; +- { +- while (*left && (MkLower(*left) == MkLower(*right))) { +- left++; +- right++; +- } +- return MkLower(*left) - MkLower(*right); +- } +- #endif +- +- +- #ifdef NEED_SETSID +- int + setsid() + { + int newpgrp; +! # if defined(BSD) +! int fd; +! # if defined(POSIX) +! newpgrp = setpgid((pid_t)0, getpid()); +! # else + newpgrp = setpgrp(0, getpid()); +! # endif +! if ((fd = open("/dev/tty", 2)) >= 0) +! { + (void) ioctl(fd, TIOCNOTTY, (char*)0); + (void) close(fd); +! } +! # else /*BSD*/ +! newpgrp = setpgrp(); +! +! (void) close(STDIN); (void) open("/dev/null", 0); +! (void) close(STDOUT); (void) open("/dev/null", 1); +! (void) close(STDERR); (void) open("/dev/null", 2); +! # endif /*BSD*/ + return newpgrp; + } +- #endif /*NEED_SETSID*/ +- +- +- #ifdef NEED_GETDTABLESIZE +- int +- getdtablesize() { +- #ifdef _SC_OPEN_MAX +- return sysconf(_SC_OPEN_MAX); +- #else +- return _POSIX_OPEN_MAX; +- #endif +- } +- #endif +- +- +- #ifdef NEED_FLOCK +- /* The following flock() emulation snarfed intact *) from the HP-UX +- * "BSD to HP-UX porting tricks" maintained by +- * system@alchemy.chem.utoronto.ca (System Admin (Mike Peterson)) +- * from the version "last updated: 11-Jan-1993" +- * Snarfage done by Jarkko Hietaniemi +- * *) well, almost, had to K&R the function entry, HPUX "cc" +- * does not grok ANSI function prototypes */ +- +- /* +- * flock (fd, operation) +- * +- * This routine performs some file locking like the BSD 'flock' +- * on the object described by the int file descriptor 'fd', +- * which must already be open. +- * +- * The operations that are available are: +- * +- * LOCK_SH - get a shared lock. +- * LOCK_EX - get an exclusive lock. +- * LOCK_NB - don't block (must be ORed with LOCK_SH or LOCK_EX). +- * LOCK_UN - release a lock. +- * +- * Return value: 0 if lock successful, -1 if failed. +- * +- * Note that whether the locks are enforced or advisory is +- * controlled by the presence or absence of the SETGID bit on +- * the executable. +- * +- * Note that there is no difference between shared and exclusive +- * locks, since the 'lockf' system call in SYSV doesn't make any +- * distinction. +- * +- * The file "" should be modified to contain the definitions +- * of the available operations, which must be added manually (see below +- * for the values). +- */ +- +- /* this code has been reformatted by vixie */ +- +- int +- flock(fd, operation) +- int fd; +- int operation; +- { +- int i; +- +- switch (operation) { +- case LOCK_SH: /* get a shared lock */ +- case LOCK_EX: /* get an exclusive lock */ +- i = lockf (fd, F_LOCK, 0); +- break; +- +- case LOCK_SH|LOCK_NB: /* get a non-blocking shared lock */ +- case LOCK_EX|LOCK_NB: /* get a non-blocking exclusive lock */ +- i = lockf (fd, F_TLOCK, 0); +- if (i == -1) +- if ((errno == EAGAIN) || (errno == EACCES)) +- errno = EWOULDBLOCK; +- break; +- +- case LOCK_UN: /* unlock */ +- i = lockf (fd, F_ULOCK, 0); +- break; +- +- default: /* can't decipher operation */ +- i = -1; +- errno = EINVAL; +- break; +- } +- +- return (i); +- } +- #endif /*NEED_FLOCK*/ +- +- +- #ifdef NEED_SETENV +- int +- setenv(name, value, overwrite) +- char *name, *value; +- int overwrite; +- { +- char *tmp; +- +- if (overwrite && getenv(name)) +- return -1; +- +- if (!(tmp = malloc(strlen(name) + strlen(value) + 2))) { +- errno = ENOMEM; +- return -1; +- } +- +- sprintf("%s=%s", name, value); +- return putenv(tmp); /* intentionally orphan 'tmp' storage */ +- } +- #endif +--- 25,57 ---- + + + #include "cron.h" + ++ #include ++ #include + +! /* +! * Ripped off from daemon(3) - differences are this sets the process group +! * and does not fork (because that has been done already). +! */ + int + setsid() + { + int newpgrp; +! register int fd; +! + newpgrp = setpgrp(0, getpid()); +! if ((fd = open(_PATH_TTY, 2)) >= 0) +! { + (void) ioctl(fd, TIOCNOTTY, (char*)0); + (void) close(fd); +! } +! if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) +! { +! (void)dup2(fd, 0); +! (void)dup2(fd, 1); +! (void)dup2(fd, 2); +! if (fd > 2) +! (void)close(fd); +! } + return newpgrp; + } +diff -c -r /tmp/cron/compat.h cron/compat.h +*** /tmp/cron/compat.h Fri Jun 18 19:37:52 1999 +--- cron/compat.h Tue Jun 15 20:32:58 1999 +*************** +*** 20,137 **** + */ + + #ifndef __P +! # ifdef __STDC__ +! # define __P(x) x +! # else +! # define __P(x) () +! # define const +! # endif + #endif + +- #if defined(UNIXPC) || defined(unixpc) +- # define UNIXPC 1 +- # define ATT 1 +- #endif +- +- #if defined(hpux) || defined(_hpux) || defined(__hpux) +- # define HPUX 1 +- # define seteuid(e) setresuid(-1,e,-1) +- # define setreuid(r,e) setresuid(r,e,-1) +- #endif +- +- #if defined(_IBMR2) +- # define AIX 1 +- #endif +- +- #if defined(__convex__) +- # define CONVEX 1 +- #endif +- +- #if defined(sgi) || defined(_sgi) || defined(__sgi) +- # define IRIX 1 +- /* IRIX 4 hdrs are broken: one cannot #include both +- * and because they disagree on system(), perror(). +- * Therefore we must zap the "const" keyword BEFORE including +- * either of them. +- */ +- # define const +- #endif +- +- #if defined(_UNICOS) +- # define UNICOS 1 +- #endif +- +- #ifndef POSIX +- # if (BSD >= 199103) || defined(__linux) || defined(ultrix) || defined(AIX) ||\ +- defined(HPUX) || defined(CONVEX) || defined(IRIX) +- # define POSIX +- # endif +- #endif +- +- #ifndef BSD +- # if defined(ultrix) +- # define BSD 198902 +- # endif +- #endif +- + /*****************************************************************/ + +! #if !defined(BSD) && !defined(HPUX) && !defined(CONVEX) && !defined(__linux) +! # define NEED_VFORK +! #endif +! +! #if (!defined(BSD) || (BSD < 198902)) && !defined(__linux) && \ +! !defined(IRIX) && !defined(NeXT) && !defined(HPUX) +! # define NEED_STRCASECMP +! #endif +! +! #if (!defined(BSD) || (BSD < 198911)) && !defined(__linux) &&\ +! !defined(IRIX) && !defined(UNICOS) && !defined(HPUX) +! # define NEED_STRDUP +! #endif +! +! #if (!defined(BSD) || (BSD < 198911)) && !defined(POSIX) && !defined(NeXT) +! # define NEED_STRERROR +! #endif +! +! #if defined(HPUX) || defined(AIX) || defined(UNIXPC) +! # define NEED_FLOCK +! #endif +! +! #ifndef POSIX +! # define NEED_SETSID +! #endif +! +! #if (defined(POSIX) && !defined(BSD)) && !defined(__linux) +! # define NEED_GETDTABLESIZE +! #endif +! +! #if (BSD >= 199103) +! # define HAVE_SAVED_UIDS +! #endif +! +! #if !defined(ATT) && !defined(__linux) && !defined(IRIX) && !defined(UNICOS) +! # define USE_SIGCHLD +! #endif +! +! #if !defined(AIX) && !defined(UNICOS) +! # define SYS_TIME_H 1 +! #else +! # define SYS_TIME_H 0 +! #endif +! +! #if defined(BSD) && !defined(POSIX) +! # define USE_UTIMES +! #endif +! +! #if defined(AIX) || defined(HPUX) || defined(IRIX) +! # define NEED_SETENV +! #endif +! +! #if !defined(UNICOS) && !defined(UNIXPC) +! # define HAS_FCHOWN +! #endif +! +! #if !defined(UNICOS) && !defined(UNIXPC) +! # define HAS_FCHMOD +! #endif +--- 20,31 ---- + */ + + #ifndef __P +! #define __P(x) () +! #define const + #endif + + /*****************************************************************/ + +! #define WAIT_T union wait +! #define PID_T pid_t +! #define TIME_T time_t +diff -c -r /tmp/cron/cron.c cron/cron.c +*** /tmp/cron/cron.c Fri Jun 18 19:37:52 1999 +--- cron/cron.c Tue Jun 15 21:11:15 1999 +*************** +*** 25,45 **** + + #include "cron.h" + #include +! #if SYS_TIME_H +! # include +! #else +! # include +! #endif + +- + static void usage __P((void)), + run_reboot_jobs __P((cron_db *)), + cron_tick __P((cron_db *)), + cron_sync __P((void)), + cron_sleep __P((void)), +- #ifdef USE_SIGCHLD + sigchld_handler __P((int)), +- #endif + sighup_handler __P((int)), + parse_args __P((int c, char *v[])); + +--- 25,38 ---- + + #include "cron.h" + #include +! #include + + static void usage __P((void)), + run_reboot_jobs __P((cron_db *)), + cron_tick __P((cron_db *)), + cron_sync __P((void)), + cron_sleep __P((void)), + sigchld_handler __P((int)), + sighup_handler __P((int)), + parse_args __P((int c, char *v[])); + +*************** +*** 60,77 **** + + ProgramName = argv[0]; + +- #if defined(BSD) + setlinebuf(stdout); + setlinebuf(stderr); +- #endif + + parse_args(argc, argv); + +- #ifdef USE_SIGCHLD + (void) signal(SIGCHLD, sigchld_handler); +- #else +- (void) signal(SIGCLD, SIG_IGN); +- #endif + (void) signal(SIGHUP, sighup_handler); + + acquire_daemonlock(0); +--- 53,64 ---- +*************** +*** 78,86 **** + set_cron_uid(); + set_cron_cwd(); + +- #if defined(POSIX) + setenv("PATH", _PATH_DEFPATH, 1); +- #endif + + /* if there are no debug flags turned on, fork as a daemon should. + */ +--- 65,71 ---- +*************** +*** 244,250 **** + } + + +- #ifdef USE_SIGCHLD + static void + sigchld_handler(x) { + WAIT_T waiter; +--- 229,234 ---- +*************** +*** 251,261 **** + PID_T pid; + + for (;;) { +- #ifdef POSIX + pid = waitpid(-1, &waiter, WNOHANG); +- #else +- pid = wait3(&waiter, WNOHANG, (struct rusage *)0); +- #endif + switch (pid) { + case -1: + Debug(DPROC, +--- 235,241 ---- +*************** +*** 272,279 **** + } + } + } +- #endif /*USE_SIGCHLD*/ +- + + static void + sighup_handler(x) { +--- 252,257 ---- +diff -c -r /tmp/cron/cron.h cron/cron.h +*** /tmp/cron/cron.h Fri Jun 18 19:37:52 1999 +--- cron/cron.h Tue Jun 15 20:31:36 1999 +*************** +*** 112,119 **** + ; + #endif /* DEBUGGING */ + +- #define MkLower(ch) (isupper(ch) ? tolower(ch) : ch) +- #define MkUpper(ch) (islower(ch) ? toupper(ch) : ch) + #define Set_LineNum(ln) {Debug(DPARS|DEXT,("linenum=%d\n",ln)); \ + LineNumber = ln; \ + } +--- 112,117 ---- +diff -c -r /tmp/cron/crontab.c cron/crontab.c +*** /tmp/cron/crontab.c Fri Jun 18 19:48:38 1999 +--- cron/crontab.c Tue Jun 15 21:11:42 1999 +*************** +*** 33,52 **** + #include + #include + #include +! #ifdef USE_UTIMES +! # include +! #else +! # include +! # include +! #endif +! #if defined(POSIX) +! # include +! #endif + +- + #define NHEADER_LINES 3 + +- + enum opt_t { opt_unknown, opt_list, opt_delete, opt_edit, opt_replace }; + + #if DEBUGGING +--- 33,42 ---- + #include + #include + #include +! #include + + #define NHEADER_LINES 3 + + enum opt_t { opt_unknown, opt_list, opt_delete, opt_edit, opt_replace }; + + #if DEBUGGING +*************** +*** 95,107 **** + Pid = getpid(); + ProgramName = argv[0]; + +- #if defined(POSIX) +- setlocale(LC_ALL, ""); +- #endif +- +- #if defined(BSD) + setlinebuf(stderr); +! #endif + parse_args(argc, argv); /* sets many globals, opens a file */ + set_cron_uid(); + set_cron_cwd(); +--- 85,92 ---- + Pid = getpid(); + ProgramName = argv[0]; + + setlinebuf(stderr); +! + parse_args(argc, argv); /* sets many globals, opens a file */ + set_cron_uid(); + set_cron_cwd(); +*************** +*** 242,248 **** + static void + list_cmd() { + char n[MAX_FNAME]; +! FILE *f; + int ch; + + log_it(RealUser, Pid, "LIST", User); +--- 227,233 ---- + static void + list_cmd() { + char n[MAX_FNAME]; +! register FILE *f; + int ch; + + log_it(RealUser, Pid, "LIST", User); +*************** +*** 293,300 **** + static void + edit_cmd() { + char n[MAX_FNAME], q[MAX_TEMPSTR], *editor; +! FILE *f; +! int ch, t, x; + struct stat statbuf; + time_t mtime; + WAIT_T waiter; +--- 278,286 ---- + static void + edit_cmd() { + char n[MAX_FNAME], q[MAX_TEMPSTR], *editor; +! register FILE *f; +! register int ch; +! int t, x; + struct stat statbuf; + time_t mtime; + WAIT_T waiter; +*************** +*** 320,330 **** + perror(Filename); + goto fatal; + } +- #ifdef HAS_FCHOWN + if (fchown(t, getuid(), getgid()) < 0) { +- #else +- if (chown(Filename, getuid(), getgid()) < 0) { +- #endif + perror("fchown"); + goto fatal; + } +--- 306,312 ---- +*************** +*** 490,497 **** + static int + replace_cmd() { + char n[MAX_FNAME], envstr[MAX_ENVSTR], tn[MAX_FNAME]; +! FILE *tmp; +! int ch, eof; + entry *e; + time_t now = time(NULL); + char **envp = env_init(); +--- 472,480 ---- + static int + replace_cmd() { + char n[MAX_FNAME], envstr[MAX_ENVSTR], tn[MAX_FNAME]; +! register FILE *tmp; +! register int ch; +! int eof; + entry *e; + time_t now = time(NULL); + char **envp = env_init(); +*************** +*** 557,583 **** + return (-1); + } + +- #ifdef HAS_FCHOWN + if (fchown(fileno(tmp), ROOT_UID, -1) < OK) +! #else +! if (chown(tn, ROOT_UID, -1) < OK) +! #endif +! { + perror("chown"); + fclose(tmp); unlink(tn); + return (-2); +! } + +- #ifdef HAS_FCHMOD + if (fchmod(fileno(tmp), 0600) < OK) +! #else +! if (chmod(tn, 0600) < OK) +! #endif +! { + perror("chown"); + fclose(tmp); unlink(tn); + return (-2); +! } + + if (fclose(tmp) == EOF) { + perror("fclose"); +--- 540,558 ---- + return (-1); + } + + if (fchown(fileno(tmp), ROOT_UID, -1) < OK) +! { + perror("chown"); + fclose(tmp); unlink(tn); + return (-2); +! } + + if (fchmod(fileno(tmp), 0600) < OK) +! { + perror("chown"); + fclose(tmp); unlink(tn); + return (-2); +! } + + if (fclose(tmp) == EOF) { + perror("fclose"); +*************** +*** 603,613 **** + + static void + poke_daemon() { +- #ifdef USE_UTIMES + struct timeval tvs[2]; +- struct timezone tz; + +! (void) gettimeofday(&tvs[0], &tz); + tvs[1] = tvs[0]; + if (utimes(SPOOL_DIR, tvs) < OK) { + fprintf(stderr, "crontab: can't update mtime on spooldir\n"); +--- 578,586 ---- + + static void + poke_daemon() { + struct timeval tvs[2]; + +! (void) gettimeofday(&tvs[0], NULL); + tvs[1] = tvs[0]; + if (utimes(SPOOL_DIR, tvs) < OK) { + fprintf(stderr, "crontab: can't update mtime on spooldir\n"); +*************** +*** 614,624 **** + perror(SPOOL_DIR); + return; + } +- #else +- if (utime(SPOOL_DIR, NULL) < OK) { +- fprintf(stderr, "crontab: can't update mtime on spooldir\n"); +- perror(SPOOL_DIR); +- return; +- } +- #endif /*USE_UTIMES*/ + } +--- 587,590 ---- +diff -c -r /tmp/cron/database.c cron/database.c +*** /tmp/cron/database.c Fri Jun 18 19:37:52 1999 +--- cron/database.c Sat Jun 12 16:04:08 1999 +*************** +*** 44,50 **** + DIR *dir; + struct stat statbuf; + struct stat syscron_stat; +! DIR_T *dp; + cron_db new_db; + user *u, *nu; + +--- 44,50 ---- + DIR *dir; + struct stat statbuf; + struct stat syscron_stat; +! register DIR_T *dp; + cron_db new_db; + user *u, *nu; + +*************** +*** 145,152 **** + + void + link_user(db, u) +! cron_db *db; +! user *u; + { + if (db->head == NULL) + db->head = u; +--- 145,152 ---- + + void + link_user(db, u) +! register cron_db *db; +! register user *u; + { + if (db->head == NULL) + db->head = u; +*************** +*** 160,167 **** + + void + unlink_user(db, u) +! cron_db *db; +! user *u; + { + if (u->prev == NULL) + db->head = u->next; +--- 160,167 ---- + + void + unlink_user(db, u) +! register cron_db *db; +! register user *u; + { + if (u->prev == NULL) + db->head = u->next; +*************** +*** 178,187 **** + user * + find_user(db, name) + cron_db *db; +! char *name; + { + char *env_get(); +! user *u; + + for (u = db->head; u != NULL; u = u->next) + if (!strcmp(u->name, name)) +--- 178,187 ---- + user * + find_user(db, name) + cron_db *db; +! register char *name; + { + char *env_get(); +! register user *u; + + for (u = db->head; u != NULL; u = u->next) + if (!strcmp(u->name, name)) +*************** +*** 201,207 **** + { + struct passwd *pw = NULL; + int crontab_fd = OK - 1; +! user *u; + + if (strcmp(fname, "*system*") && !(pw = getpwnam(uname))) { + /* file doesn't have a user in passwd file. +--- 201,207 ---- + { + struct passwd *pw = NULL; + int crontab_fd = OK - 1; +! register user *u; + + if (strcmp(fname, "*system*") && !(pw = getpwnam(uname))) { + /* file doesn't have a user in passwd file. +diff -c -r /tmp/cron/do_command.c cron/do_command.c +*** /tmp/cron/do_command.c Fri Jun 18 19:37:56 1999 +--- cron/do_command.c Tue Jun 15 21:24:29 1999 +*************** +*** 19,39 **** + static char rcsid[] = "$Id: do_command.c,v 2.12 1994/01/15 20:43:43 vixie Exp $"; + #endif + +- + #include "cron.h" + #include +- #if defined(sequent) +- # include +- #endif + #if defined(SYSLOG) + # include + #endif + + +- static void child_process __P((entry *, user *)), +- do_univ __P((user *)); +- +- + void + do_command(e, u) + entry *e; +--- 19,32 ---- + static char rcsid[] = "$Id: do_command.c,v 2.12 1994/01/15 20:43:43 vixie Exp $"; + #endif + + #include "cron.h" + #include + #if defined(SYSLOG) + # include + #endif + ++ static void child_process __P((entry *, user *)); + + void + do_command(e, u) + entry *e; +*************** +*** 76,82 **** + int stdin_pipe[2], stdout_pipe[2]; + register char *input_data; + char *usernm, *mailto; +! int children = 0; + + Debug(DPROC, ("[%d] child_process('%s')\n", getpid(), e->cmd)) + +--- 69,76 ---- + int stdin_pipe[2], stdout_pipe[2]; + register char *input_data; + char *usernm, *mailto; +! register int ch; +! int children = 0, escaped; + + Debug(DPROC, ("[%d] child_process('%s')\n", getpid(), e->cmd)) + +*************** +*** 83,101 **** + /* mark ourselves as different to PS command watchers by upshifting + * our program name. This has no effect on some kernels. + */ +! /*local*/{ +! register char *pch; + +- for (pch = ProgramName; *pch; pch++) +- *pch = MkUpper(*pch); +- } +- + /* discover some useful and important environment settings + */ + usernm = env_get("LOGNAME", e->envp); + mailto = env_get("MAILTO", e->envp); + +- #ifdef USE_SIGCHLD + /* our parent is watching for our death by catching SIGCHLD. we + * do not care to watch for our children's deaths this way -- we + * use wait() explictly. so we have to disable the signal (which +--- 77,90 ---- + /* mark ourselves as different to PS command watchers by upshifting + * our program name. This has no effect on some kernels. + */ +! for (input_data = ProgramName; ch = *input_data; input_data++) +! *input_data = (islower(ch) ? toupper(ch) : ch); + + /* discover some useful and important environment settings + */ + usernm = env_get("LOGNAME", e->envp); + mailto = env_get("MAILTO", e->envp); + + /* our parent is watching for our death by catching SIGCHLD. we + * do not care to watch for our children's deaths this way -- we + * use wait() explictly. so we have to disable the signal (which +*************** +*** 102,114 **** + * was inherited from the parent). + */ + (void) signal(SIGCHLD, SIG_IGN); +- #else +- /* on system-V systems, we are ignoring SIGCLD. we have to stop +- * ignoring it now or the wait() in cron_pclose() won't work. +- * because of this, we have to wait() for our children here, as well. +- */ +- (void) signal(SIGCLD, SIG_DFL); +- #endif /*BSD*/ + + /* create some pipes to talk to our future child + */ +--- 91,96 ---- +*************** +*** 123,146 **** + * the command. Subsequent %'s will be transformed into newlines, + * but that happens later. + */ +! /*local*/{ +! register int escaped = FALSE; +! register int ch; +! +! for (input_data = e->cmd; ch = *input_data; input_data++) { +! if (escaped) { +! escaped = FALSE; +! continue; +! } +! if (ch == '\\') { +! escaped = TRUE; +! continue; +! } +! if (ch == '%') { +! *input_data++ = '\0'; +! break; +! } + } + } + + /* fork again, this time so we can exec the user's command. +--- 105,124 ---- + * the command. Subsequent %'s will be transformed into newlines, + * but that happens later. + */ +! escaped = FALSE; +! for (input_data = e->cmd; ch = *input_data; input_data++) { +! if (escaped) { +! escaped = FALSE; +! continue; + } ++ if (ch == '\\') { ++ escaped = TRUE; ++ continue; ++ } ++ if (ch == '%') { ++ *input_data++ = '\0'; ++ break; ++ } + } + + /* fork again, this time so we can exec the user's command. +*************** +*** 197,215 **** + close(stdin_pipe[READ_PIPE]); + close(stdout_pipe[WRITE_PIPE]); + +- /* set our login universe. Do this in the grandchild +- * so that the child can invoke /usr/lib/sendmail +- * without surprises. +- */ +- do_univ(u); +- + /* set our directory, uid and gid. Set gid first, since once + * we set uid, we've lost root privledges. + */ + setgid(e->gid); +- # if defined(BSD) + initgroups(env_get("LOGNAME", e->envp), e->gid); +- # endif + setuid(e->uid); /* we aren't root after this... */ + chdir(env_get("HOME", e->envp)); + +--- 175,185 ---- +*************** +*** 460,501 **** + Debug(DPROC, (", dumped core")) + Debug(DPROC, ("\n")) + } +- } +- +- +- static void +- do_univ(u) +- user *u; +- { +- #if defined(sequent) +- /* Dynix (Sequent) hack to put the user associated with +- * the passed user structure into the ATT universe if +- * necessary. We have to dig the gecos info out of +- * the user's password entry to see if the magic +- * "universe(att)" string is present. +- */ +- +- struct passwd *p; +- char *s; +- int i; +- +- p = getpwuid(u->uid); +- (void) endpwent(); +- +- if (p == NULL) +- return; +- +- s = p->pw_gecos; +- +- for (i = 0; i < 4; i++) +- { +- if ((s = strchr(s, ',')) == NULL) +- return; +- s++; +- } +- if (strcmp(s, "universe(att)")) +- return; +- +- (void) universe(U_ATT); +- #endif + } +--- 430,433 ---- +diff -c -r /tmp/cron/entry.c cron/entry.c +*** /tmp/cron/entry.c Fri Jun 18 19:37:56 1999 +--- cron/entry.c Tue Jun 15 21:11:55 1999 +*************** +*** 55,61 **** + + void + free_entry(e) +! entry *e; + { + free(e->cmd); + env_free(e->envp); +--- 55,61 ---- + + void + free_entry(e) +! register entry *e; + { + free(e->cmd); + env_free(e->envp); +*************** +*** 70,76 **** + load_entry(file, error_func, pw, envp) + FILE *file; + void (*error_func)(); +! struct passwd *pw; + char **envp; + { + /* this function reads one crontab entry -- the next -- from a file. +--- 70,76 ---- + load_entry(file, error_func, pw, envp) + FILE *file; + void (*error_func)(); +! register struct passwd *pw; + char **envp; + { + /* this function reads one crontab entry -- the next -- from a file. +*************** +*** 87,93 **** + */ + + ecode_e ecode = e_none; +! entry *e; + int ch; + char cmd[MAX_COMMAND]; + char envstr[MAX_ENVSTR]; +--- 87,93 ---- + */ + + ecode_e ecode = e_none; +! register entry *e; + int ch; + char cmd[MAX_COMMAND]; + char envstr[MAX_ENVSTR]; +*************** +*** 262,271 **** + } + sprintf(envstr, "%s=%s", "LOGNAME", pw->pw_name); + e->envp = env_set(e->envp, envstr); +- #if defined(BSD) + sprintf(envstr, "%s=%s", "USER", pw->pw_name); + e->envp = env_set(e->envp, envstr); +- #endif + + Debug(DPARS, ("load_entry()...about to parse command\n")) + +--- 262,269 ---- +*************** +*** 309,315 **** + int low, high; /* bounds, impl. offset for bitstr */ + char *names[]; /* NULL or *[] of names for these elements */ + int ch; /* current character being processed */ +! FILE *file; /* file being read */ + { + register int done; + +--- 307,313 ---- + int low, high; /* bounds, impl. offset for bitstr */ + char *names[]; /* NULL or *[] of names for these elements */ + int ch; /* current character being processed */ +! register FILE *file; /* file being read */ + { + register int done; + +*************** +*** 355,361 **** + bitstr_t *bits; /* one bit per flag, default=FALSE */ + int low, high; /* bounds, impl. offset for bitstr */ + char *names[]; /* NULL or names of elements */ +! int ch; /* current character being processed */ + FILE *file; /* file being read */ + { + /* range = number | number "-" number [ "/" number ] +--- 353,359 ---- + bitstr_t *bits; /* one bit per flag, default=FALSE */ + int low, high; /* bounds, impl. offset for bitstr */ + char *names[]; /* NULL or names of elements */ +! register int ch; /* current character being processed */ + FILE *file; /* file being read */ + { + /* range = number | number "-" number [ "/" number ] +*************** +*** 440,446 **** + int *numptr; /* where does the result go? */ + int low; /* offset applied to result if symbolic enum used */ + char *names[]; /* symbolic names, if any, for enums */ +! int ch; /* current character */ + FILE *file; /* source */ + { + char temp[MAX_TEMPSTR], *pc; +--- 438,444 ---- + int *numptr; /* where does the result go? */ + int low; /* offset applied to result if symbolic enum used */ + char *names[]; /* symbolic names, if any, for enums */ +! register int ch; /* current character */ + FILE *file; /* source */ + { + char temp[MAX_TEMPSTR], *pc; +diff -c -r /tmp/cron/env.c cron/env.c +*** /tmp/cron/env.c Fri Jun 18 19:48:38 1999 +--- cron/env.c Sat Jun 12 16:11:43 1999 +*************** +*** 37,43 **** + env_free(envp) + char **envp; + { +! char **p; + + for (p = envp; *p; p++) + free(*p); +--- 37,43 ---- + env_free(envp) + char **envp; + { +! register char **p; + + for (p = envp; *p; p++) + free(*p); +*************** +*** 47,53 **** + + char ** + env_copy(envp) +! register char **envp; + { + register int count, i; + register char **p; +--- 47,53 ---- + + char ** + env_copy(envp) +! char **envp; + { + register int count, i; + register char **p; +*************** +*** 162,169 **** + + char * + env_get(name, envp) +! register char *name; +! register char **envp; + { + register int len = strlen(name); + register char *p, *q; +--- 162,169 ---- + + char * + env_get(name, envp) +! char *name; +! char **envp; + { + register int len = strlen(name); + register char *p, *q; +diff -c -r /tmp/cron/externs.h cron/externs.h +*** /tmp/cron/externs.h Fri Jun 18 19:37:52 1999 +--- cron/externs.h Tue Jun 15 20:32:34 1999 +*************** +*** 15,145 **** + * Paul Vixie uunet!decwrl!vixie!paul + */ + +! #if defined(POSIX) || defined(ATT) +! # include +! # include +! # include +! # include +! # define DIR_T struct dirent +! # define WAIT_T int +! # define WAIT_IS_INT 1 +! extern char *tzname[2]; +! # define TZONE(tm) tzname[(tm).tm_isdst] +! #endif + +! #if defined(UNIXPC) +! # undef WAIT_T +! # undef WAIT_IS_INT +! # define WAIT_T union wait +! #endif + +- #if defined(POSIX) +- # define SIG_T sig_t +- # define TIME_T time_t +- # define PID_T pid_t +- #endif +- +- #if defined(ATT) +- # define SIG_T void +- # define TIME_T long +- # define PID_T int +- #endif +- +- #if !defined(POSIX) && !defined(ATT) +- /* classic BSD */ +- extern time_t time(); +- extern unsigned sleep(); +- extern struct tm *localtime(); +- extern struct passwd *getpwnam(); +- extern int errno; +- extern void perror(), exit(), free(); +- extern char *getenv(), *strcpy(), *strchr(), *strtok(); +- extern void *malloc(), *realloc(); +- # define SIG_T void +- # define TIME_T long +- # define PID_T int +- # define WAIT_T union wait +- # define DIR_T struct direct +- # include +- # define TZONE(tm) (tm).tm_zone +- #endif +- +- /* getopt() isn't part of POSIX. some systems define it in anyway. +- * of those that do, some complain that our definition is different and some +- * do not. to add to the misery and confusion, some systems define getopt() +- * in ways that we cannot predict or comprehend, yet do not define the adjunct +- * external variables needed for the interface. +- */ +- #if (!defined(BSD) || (BSD < 198911)) && !defined(ATT) && !defined(UNICOS) +- int getopt __P((int, char * const *, const char *)); +- #endif +- +- #if (!defined(BSD) || (BSD < 199103)) +- extern char *optarg; +- extern int optind, opterr, optopt; +- #endif +- +- #if WAIT_IS_INT +- # ifndef WEXITSTATUS +- # define WEXITSTATUS(x) (((x) >> 8) & 0xff) +- # endif +- # ifndef WTERMSIG +- # define WTERMSIG(x) ((x) & 0x7f) +- # endif +- # ifndef WCOREDUMP +- # define WCOREDUMP(x) ((x) & 0x80) +- # endif +- #else /*WAIT_IS_INT*/ +- # ifndef WEXITSTATUS +- # define WEXITSTATUS(x) ((x).w_retcode) +- # endif +- # ifndef WTERMSIG +- # define WTERMSIG(x) ((x).w_termsig) +- # endif +- # ifndef WCOREDUMP +- # define WCOREDUMP(x) ((x).w_coredump) +- # endif +- #endif /*WAIT_IS_INT*/ +- +- #ifndef WIFSIGNALED +- #define WIFSIGNALED(x) (WTERMSIG(x) != 0) +- #endif +- #ifndef WIFEXITED +- #define WIFEXITED(x) (WTERMSIG(x) == 0) +- #endif +- +- #ifdef NEED_STRCASECMP +- extern int strcasecmp __P((char *, char *)); +- #endif +- +- #ifdef NEED_STRDUP +- extern char *strdup __P((char *)); +- #endif +- +- #ifdef NEED_STRERROR +- extern char *strerror __P((int)); +- #endif +- +- #ifdef NEED_FLOCK +- extern int flock __P((int, int)); +- # define LOCK_SH 1 +- # define LOCK_EX 2 +- # define LOCK_NB 4 +- # define LOCK_UN 8 +- #endif +- +- #ifdef NEED_SETSID + extern int setsid __P((void)); +- #endif +- +- #ifdef NEED_GETDTABLESIZE +- extern int getdtablesize __P((void)); +- #endif +- +- #ifdef NEED_SETENV +- extern int setenv __P((char *, char *, int)); +- #endif +- +- #ifdef NEED_VFORK +- extern PID_T vfork __P((void)); +- #endif +--- 15,28 ---- + * Paul Vixie uunet!decwrl!vixie!paul + */ + +! #include +! #include +! #include +! #include + +! #define DIR_T struct direct +! #define WEXITSTATUS(x) ((x).w_retcode) +! #define WTERMSIG(x) ((x).w_termsig) +! #define WCOREDUMP(x) ((x).w_coredump) + + extern int setsid __P((void)); +diff -c -r /tmp/cron/misc.c cron/misc.c +*** /tmp/cron/misc.c Fri Jun 18 19:37:56 1999 +--- cron/misc.c Fri Jun 18 20:55:14 1999 +*************** +*** 25,35 **** + + + #include "cron.h" +! #if SYS_TIME_H +! # include +! #else +! # include +! #endif + #include + #include + #include +--- 25,31 ---- + + + #include "cron.h" +! #include + #include + #include + #include +*************** +*** 44,57 **** + #define LOG_CRON LOG_DAEMON + #endif + +- + static int LogFD = ERR; + +- + int + strcmp_until(left, right, until) +! char *left; +! char *right; + int until; + { + register int diff; +--- 40,51 ---- + #define LOG_CRON LOG_DAEMON + #endif + + static int LogFD = ERR; + + int + strcmp_until(left, right, until) +! register char *left; +! register char *right; + int until; + { + register int diff; +*************** +*** 76,84 **** + */ + int + strdtb(s) +! char *s; + { +! char *x = s; + + /* scan forward to the null + */ +--- 70,78 ---- + */ + int + strdtb(s) +! register char *s; + { +! register char *x = s; + + /* scan forward to the null + */ +*************** +*** 120,126 **** + + #else /* DEBUGGING */ + +! char *pc = flags; + + DebugFlags = 0; + +--- 114,120 ---- + + #else /* DEBUGGING */ + +! register char *pc = flags; + + DebugFlags = 0; + +*************** +*** 173,189 **** + void + set_cron_uid() + { +- #if defined(BSD) || defined(POSIX) + if (seteuid(ROOT_UID) < OK) { + perror("seteuid"); + exit(ERROR_EXIT); + } +- #else +- if (setuid(ROOT_UID) < OK) { +- perror("setuid"); +- exit(ERROR_EXIT); +- } +- #endif + } + + +--- 167,176 ---- +*************** +*** 302,310 **** + */ + int + get_char(file) +! FILE *file; + { +! int ch; + + ch = getc(file); + if (ch == '\n') +--- 289,297 ---- + */ + int + get_char(file) +! register FILE *file; + { +! register int ch; + + ch = getc(file); + if (ch == '\n') +*************** +*** 317,324 **** + */ + void + unget_char(ch, file) +! int ch; +! FILE *file; + { + ungetc(ch, file); + if (ch == '\n') +--- 304,311 ---- + */ + void + unget_char(ch, file) +! register int ch; +! register FILE *file; + { + ungetc(ch, file); + if (ch == '\n') +*************** +*** 334,345 **** + */ + int + get_string(string, size, file, terms) +! char *string; + int size; + FILE *file; + char *terms; + { +! int ch; + + while (EOF != (ch = get_char(file)) && !strchr(terms, ch)) { + if (size > 1) { +--- 321,332 ---- + */ + int + get_string(string, size, file, terms) +! register char *string; + int size; + FILE *file; + char *terms; + { +! register int ch; + + while (EOF != (ch = get_char(file)) && !strchr(terms, ch)) { + if (size > 1) { +*************** +*** 359,367 **** + */ + void + skip_comments(file) +! FILE *file; + { +! int ch; + + while (EOF != (ch = get_char(file))) { + /* ch is now the first character of a line. +--- 346,354 ---- + */ + void + skip_comments(file) +! register FILE *file; + { +! register int ch; + + while (EOF != (ch = get_char(file))) { + /* ch is now the first character of a line. +*************** +*** 475,481 **** + #if defined(LOG_FILE) + /* we assume that MAX_TEMPSTR will hold the date, time, &punctuation. + */ +! msg = malloc(strlen(username) + + strlen(event) + + strlen(detail) + + MAX_TEMPSTR); +--- 462,468 ---- + #if defined(LOG_FILE) + /* we assume that MAX_TEMPSTR will hold the date, time, &punctuation. + */ +! msg = (char *)malloc(strlen(username) + + strlen(event) + + strlen(detail) + + MAX_TEMPSTR); +*************** +*** 518,528 **** + * our client may not be our own. therefore we want to + * print the pid ourselves. + */ +- # ifdef LOG_DAEMON + openlog(ProgramName, LOG_PID, LOG_CRON); +- # else +- openlog(ProgramName, LOG_PID); +- # endif + syslog_open = TRUE; /* assume openlog success */ + } + +--- 505,511 ---- +*************** +*** 555,561 **** + char * + first_word(s, t) + register char *s; /* string we want the first word of */ +! register char *t; /* terminators, implicitly including \0 */ + { + static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */ + static int retsel = 0; +--- 538,544 ---- + char * + first_word(s, t) + register char *s; /* string we want the first word of */ +! char *t; /* terminators, implicitly including \0 */ + { + static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */ + static int retsel = 0; +*************** +*** 617,626 **** + */ + char * + mkprints(src, len) +! register unsigned char *src; +! register unsigned int len; + { +! register char *dst = malloc(len*4 + 1); + + mkprint(dst, src, len); + +--- 600,609 ---- + */ + char * + mkprints(src, len) +! unsigned char *src; +! unsigned int len; + { +! register char *dst = (char *)malloc(len*4 + 1); + + mkprint(dst, src, len); + +*************** +*** 653,664 **** + } + #endif /*MAIL_DATE*/ + +- +- #ifdef HAVE_SAVED_SUIDS + static int save_euid; +! int swap_uids() { save_euid = geteuid(); return seteuid(getuid()); } +! int swap_uids_back() { return seteuid(save_euid); } +! #else /*HAVE_SAVED_UIDS*/ +! int swap_uids() { return setreuid(geteuid(), getuid()); } +! int swap_uids_back() { return swap_uids(); } +! #endif /*HAVE_SAVED_UIDS*/ +--- 636,649 ---- + } + #endif /*MAIL_DATE*/ + + static int save_euid; +! int swap_uids() +! { +! save_euid = geteuid(); +! return(seteuid(getuid())); +! } +! +! int swap_uids_back() +! { +! return(seteuid(save_euid)); +! } +diff -c -r /tmp/cron/pathnames.h cron/pathnames.h +*** /tmp/cron/pathnames.h Fri Jun 18 19:37:52 1999 +--- cron/pathnames.h Fri Jun 18 20:56:50 1999 +*************** +*** 19,27 **** + * $Id: pathnames.h,v 1.3 1994/01/15 20:43:43 vixie Exp $ + */ + +! #if (defined(BSD)) && (BSD >= 199103) || defined(__linux) || defined(AIX) +! # include +! #endif /*BSD*/ + + #ifndef CRONDIR + /* CRONDIR is where crond(8) and crontab(1) both chdir +--- 19,25 ---- + * $Id: pathnames.h,v 1.3 1994/01/15 20:43:43 vixie Exp $ + */ + +! #include + + #ifndef CRONDIR + /* CRONDIR is where crond(8) and crontab(1) both chdir +*************** +*** 49,55 **** + */ + #define ALLOW_FILE "allow" /*-*/ + #define DENY_FILE "deny" /*-*/ +! #define LOG_FILE "log" /*-*/ + + /* where should the daemon stick its PID? + */ +--- 47,53 ---- + */ + #define ALLOW_FILE "allow" /*-*/ + #define DENY_FILE "deny" /*-*/ +! #undef LOG_FILE /* "log" */ + + /* where should the daemon stick its PID? + */ +diff -c -r /tmp/cron/putman.sh cron/putman.sh +*** /tmp/cron/putman.sh Fri Jun 18 19:37:52 1999 +--- cron/putman.sh Tue Jun 15 21:04:25 1999 +*************** +*** 9,23 **** + DIR=$2 + + SECT=`expr $PAGE : '[a-z]*.\([0-9]\)'` + +! [ -d $DIR/man$SECT ] && { +! set -x +! cp $PAGE $DIR/man$SECT/$PAGE +! set +x +! } || { +! set -x +! nroff -man $PAGE >$DIR/cat$SECT/`basename $PAGE .$SECT`.0 +! set +x +! } + + exit 0 +--- 9,26 ---- + DIR=$2 + + SECT=`expr $PAGE : '[a-z]*.\([0-9]\)'` ++ MDIR="$DIR/cat$SECT" ++ DEST="$MDIR/`basename $PAGE .$SECT`.0" + +! set -x +! if [ ! -d $MDIR ]; then +! rm -f $MDIR +! mkdir -p $MDIR +! chmod 755 $MDIR +! fi +! +! nroff -man $PAGE >$DEST +! chmod 444 $DEST +! set +x + + exit 0 +diff -c -r /tmp/cron/user.c cron/user.c +*** /tmp/cron/user.c Fri Jun 18 19:37:52 1999 +--- cron/user.c Sat Jun 12 16:16:24 1999 +*************** +*** 30,36 **** + free_user(u) + user *u; + { +! entry *e, *ne; + + free(u->name); + for (e = u->crontab; e != NULL; e = ne) { +--- 30,36 ---- + free_user(u) + user *u; + { +! register entry *e, *ne; + + free(u->name); + for (e = u->crontab; e != NULL; e = ne) { +*************** +*** 49,56 **** + { + char envstr[MAX_ENVSTR]; + FILE *file; +! user *u; +! entry *e; + int status; + char **envp; + +--- 49,56 ---- + { + char envstr[MAX_ENVSTR]; + FILE *file; +! register user *u; +! register entry *e; + int status; + char **envp; + diff --git a/src/cmd/cron/job.c b/src/cmd/cron/job.c new file mode 100755 index 0000000..adaa072 --- /dev/null +++ b/src/cmd/cron/job.c @@ -0,0 +1,74 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && !defined(LINT) +static char rcsid[] = "$Id: job.c,v 1.6 1994/01/15 20:43:43 vixie Exp $"; +#endif + + +#include "cron.h" + + +typedef struct _job { + struct _job *next; + entry *e; + user *u; +} job; + + +static job *jhead = NULL, *jtail = NULL; + + +void +job_add(e, u) + register entry *e; + register user *u; +{ + register job *j; + + /* if already on queue, keep going */ + for (j=jhead; j; j=j->next) + if (j->e == e && j->u == u) { return; } + + /* build a job queue element */ + j = (job*)malloc(sizeof(job)); + j->next = (job*) NULL; + j->e = e; + j->u = u; + + /* add it to the tail */ + if (!jhead) { jhead=j; } + else { jtail->next=j; } + jtail = j; +} + + +int +job_runqueue() +{ + register job *j, *jn; + register int run = 0; + + for (j=jhead; j; j=jn) { + do_command(j->e, j->u); + jn = j->next; + free(j); + run++; + } + jhead = jtail = NULL; + return run; +} diff --git a/src/cmd/cron/misc.c b/src/cmd/cron/misc.c new file mode 100755 index 0000000..07a8ead --- /dev/null +++ b/src/cmd/cron/misc.c @@ -0,0 +1,649 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && !defined(LINT) +static char rcsid[] = "$Id: misc.c,v 2.9 1994/01/15 20:43:43 vixie Exp $"; +#endif + +/* vix 26jan87 [RCS has the rest of the log] + * vix 30dec86 [written] + */ + + +#include "cron.h" +#include +#include +#include +#include +#include +#include +#if defined(SYSLOG) +# include +#endif + + +#if defined(LOG_DAEMON) && !defined(LOG_CRON) +#define LOG_CRON LOG_DAEMON +#endif + +static int LogFD = ERR; + +int +strcmp_until(left, right, until) + register char *left; + register char *right; + int until; +{ + register int diff; + + while (*left && *left != until && *left == *right) { + left++; + right++; + } + + if ((*left=='\0' || *left == until) && + (*right=='\0' || *right == until)) { + diff = 0; + } else { + diff = *left - *right; + } + + return diff; +} + + +/* strdtb(s) - delete trailing blanks in string 's' and return new length + */ +int +strdtb(s) + register char *s; +{ + register char *x = s; + + /* scan forward to the null + */ + while (*x) + x++; + + /* scan backward to either the first character before the string, + * or the last non-blank in the string, whichever comes first. + */ + do {x--;} + while (x >= s && isspace(*x)); + + /* one character beyond where we stopped above is where the null + * goes. + */ + *++x = '\0'; + + /* the difference between the position of the null character and + * the position of the first character of the string is the length. + */ + return x - s; +} + + +int +set_debug_flags(flags) + char *flags; +{ + /* debug flags are of the form flag[,flag ...] + * + * if an error occurs, print a message to stdout and return FALSE. + * otherwise return TRUE after setting ERROR_FLAGS. + */ + +#if !DEBUGGING + + printf("this program was compiled without debugging enabled\n"); + return FALSE; + +#else /* DEBUGGING */ + + register char *pc = flags; + + DebugFlags = 0; + + while (*pc) { + char **test; + int mask; + + /* try to find debug flag name in our list. + */ + for ( test = DebugFlagNames, mask = 1; + *test && strcmp_until(*test, pc, ','); + test++, mask <<= 1 + ) + ; + + if (!*test) { + fprintf(stderr, + "unrecognized debug flag <%s> <%s>\n", + flags, pc); + return FALSE; + } + + DebugFlags |= mask; + + /* skip to the next flag + */ + while (*pc && *pc != ',') + pc++; + if (*pc == ',') + pc++; + } + + if (DebugFlags) { + int flag; + + fprintf(stderr, "debug flags enabled:"); + + for (flag = 0; DebugFlagNames[flag]; flag++) + if (DebugFlags & (1 << flag)) + fprintf(stderr, " %s", DebugFlagNames[flag]); + fprintf(stderr, "\n"); + } + + return TRUE; + +#endif /* DEBUGGING */ +} + + +void +set_cron_uid() +{ + if (seteuid(ROOT_UID) < OK) { + perror("seteuid"); + exit(ERROR_EXIT); + } +} + + +void +set_cron_cwd() +{ + struct stat sb; + + /* first check for CRONDIR ("/var/cron" or some such) + */ + if (stat(CRONDIR, &sb) < OK && errno == ENOENT) { + perror(CRONDIR); + if (OK == mkdir(CRONDIR, 0700)) { + fprintf(stderr, "%s: created\n", CRONDIR); + stat(CRONDIR, &sb); + } else { + fprintf(stderr, "%s: ", CRONDIR); + perror("mkdir"); + exit(ERROR_EXIT); + } + } + if (!(sb.st_mode & S_IFDIR)) { + fprintf(stderr, "'%s' is not a directory, bailing out.\n", + CRONDIR); + exit(ERROR_EXIT); + } + if (chdir(CRONDIR) < OK) { + fprintf(stderr, "cannot chdir(%s), bailing out.\n", CRONDIR); + perror(CRONDIR); + exit(ERROR_EXIT); + } + + /* CRONDIR okay (now==CWD), now look at SPOOL_DIR ("tabs" or some such) + */ + if (stat(SPOOL_DIR, &sb) < OK && errno == ENOENT) { + perror(SPOOL_DIR); + if (OK == mkdir(SPOOL_DIR, 0700)) { + fprintf(stderr, "%s: created\n", SPOOL_DIR); + stat(SPOOL_DIR, &sb); + } else { + fprintf(stderr, "%s: ", SPOOL_DIR); + perror("mkdir"); + exit(ERROR_EXIT); + } + } + if (!(sb.st_mode & S_IFDIR)) { + fprintf(stderr, "'%s' is not a directory, bailing out.\n", + SPOOL_DIR); + exit(ERROR_EXIT); + } +} + + +/* acquire_daemonlock() - write our PID into /etc/cron.pid, unless + * another daemon is already running, which we detect here. + * + * note: main() calls us twice; once before forking, once after. + * we maintain static storage of the file pointer so that we + * can rewrite our PID into the PIDFILE after the fork. + * + * it would be great if fflush() disassociated the file buffer. + */ +void +acquire_daemonlock(closeflag) + int closeflag; +{ + static FILE *fp = NULL; + + if (closeflag && fp) { + fclose(fp); + fp = NULL; + return; + } + + if (!fp) { + char pidfile[MAX_FNAME]; + char buf[MAX_TEMPSTR]; + int fd, otherpid; + + (void) sprintf(pidfile, PIDFILE, PIDDIR); + if ((-1 == (fd = open(pidfile, O_RDWR|O_CREAT, 0644))) + || (NULL == (fp = fdopen(fd, "r+"))) + ) { + sprintf(buf, "can't open or create %s: %s", + pidfile, strerror(errno)); + fprintf(stderr, "%s: %s\n", ProgramName, buf); + log_it("CRON", getpid(), "DEATH", buf); + exit(ERROR_EXIT); + } + + if (flock(fd, LOCK_EX|LOCK_NB) < OK) { + int save_errno = errno; + + fscanf(fp, "%d", &otherpid); + sprintf(buf, "can't lock %s, otherpid may be %d: %s", + pidfile, otherpid, strerror(save_errno)); + fprintf(stderr, "%s: %s\n", ProgramName, buf); + log_it("CRON", getpid(), "DEATH", buf); + exit(ERROR_EXIT); + } + + (void) fcntl(fd, F_SETFD, 1); + } + + rewind(fp); + fprintf(fp, "%d\n", getpid()); + fflush(fp); + (void) ftruncate(fileno(fp), ftell(fp)); + + /* abandon fd and fp even though the file is open. we need to + * keep it open and locked, but we don't need the handles elsewhere. + */ +} + +/* get_char(file) : like getc() but increment LineNumber on newlines + */ +int +get_char(file) + register FILE *file; +{ + register int ch; + + ch = getc(file); + if (ch == '\n') + Set_LineNum(LineNumber + 1) + return ch; +} + + +/* unget_char(ch, file) : like ungetc but do LineNumber processing + */ +void +unget_char(ch, file) + register int ch; + register FILE *file; +{ + ungetc(ch, file); + if (ch == '\n') + Set_LineNum(LineNumber - 1) +} + + +/* get_string(str, max, file, termstr) : like fgets() but + * (1) has terminator string which should include \n + * (2) will always leave room for the null + * (3) uses get_char() so LineNumber will be accurate + * (4) returns EOF or terminating character, whichever + */ +int +get_string(string, size, file, terms) + register char *string; + int size; + FILE *file; + char *terms; +{ + register int ch; + + while (EOF != (ch = get_char(file)) && !strchr(terms, ch)) { + if (size > 1) { + *string++ = (char) ch; + size--; + } + } + + if (size > 0) + *string = '\0'; + + return ch; +} + + +/* skip_comments(file) : read past comment (if any) + */ +void +skip_comments(file) + register FILE *file; +{ + register int ch; + + while (EOF != (ch = get_char(file))) { + /* ch is now the first character of a line. + */ + + while (ch == ' ' || ch == '\t') + ch = get_char(file); + + if (ch == EOF) + break; + + /* ch is now the first non-blank character of a line. + */ + + if (ch != '\n' && ch != '#') + break; + + /* ch must be a newline or comment as first non-blank + * character on a line. + */ + + while (ch != '\n' && ch != EOF) + ch = get_char(file); + + /* ch is now the newline of a line which we're going to + * ignore. + */ + } + if (ch != EOF) + unget_char(ch, file); +} + + +/* int in_file(char *string, FILE *file) + * return TRUE if one of the lines in file matches string exactly, + * FALSE otherwise. + */ +static int +in_file(string, file) + char *string; + FILE *file; +{ + char line[MAX_TEMPSTR]; + + rewind(file); + while (fgets(line, MAX_TEMPSTR, file)) { + if (line[0] != '\0') + line[strlen(line)-1] = '\0'; + if (0 == strcmp(line, string)) + return TRUE; + } + return FALSE; +} + + +/* int allowed(char *username) + * returns TRUE if (ALLOW_FILE exists and user is listed) + * or (DENY_FILE exists and user is NOT listed) + * or (neither file exists but user=="root" so it's okay) + */ +int +allowed(username) + char *username; +{ + static int init = FALSE; + static FILE *allow, *deny; + + if (!init) { + init = TRUE; +#if defined(ALLOW_FILE) && defined(DENY_FILE) + allow = fopen(ALLOW_FILE, "r"); + deny = fopen(DENY_FILE, "r"); + Debug(DMISC, ("allow/deny enabled, %d/%d\n", !!allow, !!deny)) +#else + allow = NULL; + deny = NULL; +#endif + } + + if (allow) + return (in_file(username, allow)); + if (deny) + return (!in_file(username, deny)); + +#if defined(ALLOW_ONLY_ROOT) + return (strcmp(username, ROOT_USER) == 0); +#else + return TRUE; +#endif +} + + +void +log_it(username, xpid, event, detail) + char *username; + int xpid; + char *event; + char *detail; +{ + PID_T pid = xpid; +#if defined(LOG_FILE) + char *msg; + TIME_T now = time((TIME_T) 0); + register struct tm *t = localtime(&now); +#endif /*LOG_FILE*/ + +#if defined(SYSLOG) + static int syslog_open = 0; +#endif + +#if defined(LOG_FILE) + /* we assume that MAX_TEMPSTR will hold the date, time, &punctuation. + */ + msg = (char *)malloc(strlen(username) + + strlen(event) + + strlen(detail) + + MAX_TEMPSTR); + + if (LogFD < OK) { + LogFD = open(LOG_FILE, O_WRONLY|O_APPEND|O_CREAT, 0600); + if (LogFD < OK) { + fprintf(stderr, "%s: can't open log file\n", + ProgramName); + perror(LOG_FILE); + } else { + (void) fcntl(LogFD, F_SETFD, 1); + } + } + + /* we have to sprintf() it because fprintf() doesn't always write + * everything out in one chunk and this has to be atomically appended + * to the log file. + */ + sprintf(msg, "%s (%02d/%02d-%02d:%02d:%02d-%d) %s (%s)\n", + username, + t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, pid, + event, detail); + + /* we have to run strlen() because sprintf() returns (char*) on old BSD + */ + if (LogFD < OK || write(LogFD, msg, strlen(msg)) < OK) { + if (LogFD >= OK) + perror(LOG_FILE); + fprintf(stderr, "%s: can't write to log file\n", ProgramName); + write(STDERR, msg, strlen(msg)); + } + + free(msg); +#endif /*LOG_FILE*/ + +#if defined(SYSLOG) + if (!syslog_open) { + /* we don't use LOG_PID since the pid passed to us by + * our client may not be our own. therefore we want to + * print the pid ourselves. + */ + openlog(ProgramName, LOG_PID, LOG_CRON); + syslog_open = TRUE; /* assume openlog success */ + } + + syslog(LOG_INFO, "(%s) %s (%s)\n", username, event, detail); + +#endif /*SYSLOG*/ + +#if DEBUGGING + if (DebugFlags) { + fprintf(stderr, "log_it: (%s %d) %s (%s)\n", + username, pid, event, detail); + } +#endif +} + + +void +log_close() { + if (LogFD != ERR) { + close(LogFD); + LogFD = ERR; + } +} + + +/* two warnings: + * (1) this routine is fairly slow + * (2) it returns a pointer to static storage + */ +char * +first_word(s, t) + register char *s; /* string we want the first word of */ + char *t; /* terminators, implicitly including \0 */ +{ + static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */ + static int retsel = 0; + register char *rb, *rp; + + /* select a return buffer */ + retsel = 1-retsel; + rb = &retbuf[retsel][0]; + rp = rb; + + /* skip any leading terminators */ + while (*s && (NULL != strchr(t, *s))) { + s++; + } + + /* copy until next terminator or full buffer */ + while (*s && (NULL == strchr(t, *s)) && (rp < &rb[MAX_TEMPSTR])) { + *rp++ = *s++; + } + + /* finish the return-string and return it */ + *rp = '\0'; + return rb; +} + + +/* warning: + * heavily ascii-dependent. + */ +void +mkprint(dst, src, len) + register char *dst; + register unsigned char *src; + register int len; +{ + while (len-- > 0) + { + register unsigned char ch = *src++; + + if (ch < ' ') { /* control character */ + *dst++ = '^'; + *dst++ = ch + '@'; + } else if (ch < 0177) { /* printable */ + *dst++ = ch; + } else if (ch == 0177) { /* delete/rubout */ + *dst++ = '^'; + *dst++ = '?'; + } else { /* parity character */ + sprintf(dst, "\\%03o", ch); + dst += 4; + } + } + *dst = '\0'; +} + + +/* warning: + * returns a pointer to malloc'd storage, you must call free yourself. + */ +char * +mkprints(src, len) + unsigned char *src; + unsigned int len; +{ + register char *dst = (char *)malloc(len*4 + 1); + + mkprint(dst, src, len); + + return dst; +} + + +#ifdef MAIL_DATE +/* Sat, 27 Feb 93 11:44:51 CST + * 123456789012345678901234567 + */ +char * +arpadate(clock) + time_t *clock; +{ + time_t t = clock ?*clock :time(0L); + struct tm *tm = localtime(&t); + static char ret[30]; /* zone name might be >3 chars */ + + (void) sprintf(ret, "%s, %2d %s %2d %02d:%02d:%02d %s", + DowNames[tm->tm_wday], + tm->tm_mday, + MonthNames[tm->tm_mon], + tm->tm_year, + tm->tm_hour, + tm->tm_min, + tm->tm_sec, + TZONE(*tm)); + return ret; +} +#endif /*MAIL_DATE*/ + +static int save_euid; +int swap_uids() + { + save_euid = geteuid(); + return(seteuid(getuid())); + } + +int swap_uids_back() + { + return(seteuid(save_euid)); + } diff --git a/src/cmd/cron/pathnames.h b/src/cmd/cron/pathnames.h new file mode 100755 index 0000000..a843601 --- /dev/null +++ b/src/cmd/cron/pathnames.h @@ -0,0 +1,79 @@ +/* Copyright 1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +/* + * $Id: pathnames.h,v 1.3 1994/01/15 20:43:43 vixie Exp $ + */ + +#include + +#ifndef CRONDIR + /* CRONDIR is where crond(8) and crontab(1) both chdir + * to; SPOOL_DIR, ALLOW_FILE, DENY_FILE, and LOG_FILE + * are all relative to this directory. + */ +#define CRONDIR "/var/cron" +#endif + + /* SPOOLDIR is where the crontabs live. + * This directory will have its modtime updated + * whenever crontab(1) changes a crontab; this is + * the signal for crond(8) to look at each individual + * crontab file and reload those whose modtimes are + * newer than they were last time around (or which + * didn't exist last time around...) + */ +#define SPOOL_DIR "tabs" + + /* undefining these turns off their features. note + * that ALLOW_FILE and DENY_FILE must both be defined + * in order to enable the allow/deny code. If neither + * LOG_FILE or SYSLOG is defined, we don't log. If + * both are defined, we log both ways. + */ +#define ALLOW_FILE "allow" /*-*/ +#define DENY_FILE "deny" /*-*/ +#undef LOG_FILE /* "log" */ + + /* where should the daemon stick its PID? + */ +#ifdef _PATH_VARRUN +# define PIDDIR _PATH_VARRUN +#else +# define PIDDIR "/etc/" +#endif +#define PIDFILE "%scron.pid" + + /* 4.3BSD-style crontab */ +#define SYSCRONTAB "/etc/crontab" + + /* what editor to use if no EDITOR or VISUAL + * environment variable specified. + */ +#if defined(_PATH_VI) +# define EDITOR _PATH_VI +#else +# define EDITOR "/usr/ucb/vi" +#endif + +#ifndef _PATH_BSHELL +# define _PATH_BSHELL "/bin/sh" +#endif + +#ifndef _PATH_DEFPATH +# define _PATH_DEFPATH "/usr/bin:/bin" +#endif diff --git a/src/cmd/cron/popen.c b/src/cmd/cron/popen.c new file mode 100755 index 0000000..700d6c1 --- /dev/null +++ b/src/cmd/cron/popen.c @@ -0,0 +1,170 @@ +/* + * Copyright (c) 1988 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software written by Ken Arnold and + * published in UNIX Review, Vol. 6, No. 8. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +/* this came out of the ftpd sources; it's been modified to avoid the + * globbing stuff since we don't need it. also execvp instead of execv. + */ + +#if !defined(lint) && defined(DOSCCS) +static char sccsid[] = "@(#)popen.c 5.7.2 (2.11BSD) 1999/08/05"; +#endif + +#include "cron.h" +#include +#include + +#define WANT_GLOBBING 0 + +/* + * Special version of popen which avoids call to shell. This insures noone + * may create a pipe to a hidden program as a side effect of a list or dir + * command. + */ +static PID_T *pids; +static int fds; + +FILE * +cron_popen(program, type) + char *program, *type; +{ + register char *cp; + FILE *iop; + int argc, pdes[2]; + PID_T pid; + char *argv[100]; +#if WANT_GLOBBING + char **pop, *vv[2]; + int gargc; + char *gargv[1000]; + extern char **glob(), **copyblk(); +#endif + + if (*type != 'r' && *type != 'w' || type[1]) + return(NULL); + + if (!pids) { + if ((fds = getdtablesize()) <= 0) + return(NULL); + if (!(pids = (PID_T *)malloc((u_int)(fds * sizeof(PID_T))))) + return(NULL); + bzero((char *)pids, fds * sizeof(PID_T)); + } + if (pipe(pdes) < 0) + return(NULL); + + /* break up string into pieces */ + for (argc = 0, cp = program;; cp = NULL) + if (!(argv[argc++] = strtok(cp, " \t\n"))) + break; + +#if WANT_GLOBBING + /* glob each piece */ + gargv[0] = argv[0]; + for (gargc = argc = 1; argv[argc]; argc++) { + if (!(pop = glob(argv[argc]))) { /* globbing failed */ + vv[0] = argv[argc]; + vv[1] = NULL; + pop = copyblk(vv); + } + argv[argc] = (char *)pop; /* save to free later */ + while (*pop && gargc < 1000) + gargv[gargc++] = *pop++; + } + gargv[gargc] = NULL; +#endif + + iop = NULL; + switch(pid = vfork()) { + case -1: /* error */ + (void)close(pdes[0]); + (void)close(pdes[1]); + goto pfree; + /* NOTREACHED */ + case 0: /* child */ + if (*type == 'r') { + if (pdes[1] != 1) { + dup2(pdes[1], 1); + dup2(pdes[1], 2); /* stderr, too! */ + (void)close(pdes[1]); + } + (void)close(pdes[0]); + } else { + if (pdes[0] != 0) { + dup2(pdes[0], 0); + (void)close(pdes[0]); + } + (void)close(pdes[1]); + } +#if WANT_GLOBBING + execvp(gargv[0], gargv); +#else + execvp(argv[0], argv); +#endif + _exit(1); + } + /* parent; assume fdopen can't fail... */ + if (*type == 'r') { + iop = fdopen(pdes[0], type); + (void)close(pdes[1]); + } else { + iop = fdopen(pdes[1], type); + (void)close(pdes[0]); + } + pids[fileno(iop)] = pid; + +pfree: +#if WANT_GLOBBING + for (argc = 1; argv[argc] != NULL; argc++) { +/* blkfree((char **)argv[argc]); */ + free((char *)argv[argc]); + } +#endif + return(iop); +} + +int +cron_pclose(iop) + FILE *iop; +{ + register int fdes; + sigset_t omask, nmask; + WAIT_T stat_loc; + register PID_T pid; + + /* + * pclose returns -1 if stream is not associated with a + * `popened' command, or, if already `pclosed'. + */ + if (pids == 0 || pids[fdes = fileno(iop)] == 0) + return(-1); + (void)fclose(iop); + sigemptyset(&nmask); + sigaddset(&nmask, SIGINT); + sigaddset(&nmask, SIGQUIT); + sigaddset(&nmask, SIGHUP); + sigprocmask(SIG_BLOCK, &nmask, &omask); + do { + pid = waitpid(pids[fdes], &stat_loc, NULL); + } while (pid == -1 && errno == EINTR); + (void)sigprocmask(SIG_SETMASK, &omask, NULL); + pids[fdes] = 0; + return (pid == -1 ? -1 : WEXITSTATUS(stat_loc)); +} diff --git a/src/cmd/cron/putman.sh b/src/cmd/cron/putman.sh new file mode 100755 index 0000000..84bf496 --- /dev/null +++ b/src/cmd/cron/putman.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# putman.sh - install a man page according to local custom +# vixie 27dec93 [original] +# +# $Id:$ + +PAGE=$1 +DIR=$2 + +SECT=`expr $PAGE : '[a-z]*.\([0-9]\)'` +MDIR="$DIR/cat$SECT" +DEST="$MDIR/`basename $PAGE .$SECT`.0" + +set -x +if [ ! -d $MDIR ]; then + rm -f $MDIR + mkdir -p $MDIR + chmod 755 $MDIR +fi + +nroff -man $PAGE >$DEST +chmod 644 $DEST +set +x + +exit 0 diff --git a/src/cmd/cron/user.c b/src/cmd/cron/user.c new file mode 100755 index 0000000..81b5bb9 --- /dev/null +++ b/src/cmd/cron/user.c @@ -0,0 +1,102 @@ +/* Copyright 1988,1990,1993,1994 by Paul Vixie + * All rights reserved + * + * Distribute freely, except: don't remove my name from the source or + * documentation (don't take credit for my work), mark your changes (don't + * get me blamed for your possible bugs), don't alter or remove this + * notice. May be sold if buildable source is provided to buyer. No + * warrantee of any kind, express or implied, is included with this + * software; use at your own risk, responsibility for damages (if any) to + * anyone resulting from the use of this software rests entirely with the + * user. + * + * Send bug reports, bug fixes, enhancements, requests, flames, etc., and + * I'll try to keep a version up to date. I can be reached as follows: + * Paul Vixie uunet!decwrl!vixie!paul + */ + +#if !defined(lint) && !defined(LINT) +static char rcsid[] = "$Id: user.c,v 2.8 1994/01/15 20:43:43 vixie Exp $"; +#endif + +/* vix 26jan87 [log is in RCS file] + */ + + +#include "cron.h" + + +void +free_user(u) + user *u; +{ + register entry *e, *ne; + + free(u->name); + for (e = u->crontab; e != NULL; e = ne) { + ne = e->next; + free_entry(e); + } + free(u); +} + + +user * +load_user(crontab_fd, pw, name) + int crontab_fd; + struct passwd *pw; /* NULL implies syscrontab */ + char *name; +{ + char envstr[MAX_ENVSTR]; + FILE *file; + register user *u; + register entry *e; + int status; + char **envp; + + if (!(file = fdopen(crontab_fd, "r"))) { + perror("fdopen on crontab_fd in load_user"); + return NULL; + } + + Debug(DPARS, ("load_user()\n")) + + /* file is open. build user entry, then read the crontab file. + */ + u = (user *) malloc(sizeof(user)); + u->name = strdup(name); + u->crontab = NULL; + + /* + * init environment. this will be copied/augmented for each entry. + */ + envp = env_init(); + + /* + * load the crontab + */ + while ((status = load_env(envstr, file)) >= OK) { + switch (status) { + case ERR: + free_user(u); + u = NULL; + goto done; + case FALSE: + e = load_entry(file, NULL, pw, envp); + if (e) { + e->next = u->crontab; + u->crontab = e; + } + break; + case TRUE: + envp = env_set(envp, envstr); + break; + } + } + + done: + env_free(envp); + fclose(file); + Debug(DPARS, ("...load_user() done\n")) + return u; +} diff --git a/src/cmd/lccom-1/CPYRIGHT b/src/cmd/lccom-1/CPYRIGHT new file mode 100644 index 0000000..342e697 --- /dev/null +++ b/src/cmd/lccom-1/CPYRIGHT @@ -0,0 +1,62 @@ +The authors of this software are Christopher W. Fraser and +David R. Hanson. + +Copyright (c) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002 +by AT&T, Christopher W. Fraser, and David R. Hanson. All Rights Reserved. + +Permission to use, copy, modify, and distribute this software for any +purpose, subject to the provisions described below, without fee is +hereby granted, provided that this entire notice is included in all +copies of any software that is or includes a copy or modification of +this software and in all copies of the supporting documentation for +such software. + +THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED +WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY +REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY +OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + + +lcc is not public-domain software, shareware, and it is not protected +by a `copyleft' agreement, like the code from the Free Software +Foundation. + +lcc is available free for your personal research and instructional use +under the `fair use' provisions of the copyright law. You may, however, +redistribute lcc in whole or in part provided you acknowledge its +source and include this CPYRIGHT file. You may, for example, include +the distribution in a CDROM of free software, provided you charge only +for the media, or mirror the distribution files at your site. + +You may not sell lcc or any product derived from it in which it is a +significant part of the value of the product. Using the lcc front end +to build a C syntax checker is an example of this kind of product. + +You may use parts of lcc in products as long as you charge for only +those components that are entirely your own and you acknowledge the use +of lcc clearly in all product documentation and distribution media. You +must state clearly that your product uses or is based on parts of lcc +and that lcc is available free of charge. You must also request that +bug reports on your product be reported to you. Using the lcc front +end to build a C compiler for the Motorola 88000 chip and charging for +and distributing only the 88000 code generator is an example of this +kind of product. + +Using parts of lcc in other products is more problematic. For example, +using parts of lcc in a C++ compiler could save substantial time and +effort and therefore contribute significantly to the profitability of +the product. This kind of use, or any use where others stand to make a +profit from what is primarily our work, requires a license agreement +with Addison-Wesley. Per-copy and unlimited use licenses are +available; for more information, contact + + Mike Hendrickson + Addison Wesley Professional + 75 Arlington St. + Boston, MA 02116 + 617/848-6522 FAX: 617/848-6569 mikeh@awl.com + +----- +Chris Fraser / cwfraser@microsoft.com +David Hanson / drh@microsoft.com +$Revision: 1.8 $ $Date: 2002/08/27 00:02:26 $ diff --git a/src/cmd/lccom-1/LOG b/src/cmd/lccom-1/LOG new file mode 100644 index 0000000..be23e1c --- /dev/null +++ b/src/cmd/lccom-1/LOG @@ -0,0 +1,383 @@ +From lcc 4.1 to 4.2: + +Below is a summary of the source-control log entries for those files +changed for lcc 4.2. +$Id: LOG,v 1.26 2002/08/26 23:59:51 drh Exp $ + +src/alloc.c: +Fixed subtle alignment bug on p. 28. + +src/dag.c: +Renamed kill to killnodes to avoid possible clash with kill in . + +Made address interface function optional. + +Ensured that generated locals, even if not temps, are +added to the code list. + +Avoided calls to undag when errcnt>0. + +Changed listnodes so that array types decay to pointers; bug +tickled by -n option. + +src/decl.c: +Moved call to retcode that injects a return at the end of a function +into compound so that temps created by retcode will be +scoped properly. + +Fixed bug in which functions that return const struct S {...} issued +an incorrect diagnostic. + +Ensure addressed is set for local arrays. + +src/enode.c: +Corrected type conversions in addtree for ADD+P nodes; +stripped qualifiers from pointer types in eqtree and cmptree. + +src/event.c: +Revise functions called at events so all have the same signature, +modulo pointer types. + +src/expr.c: +With -b, avoid instrumenting constant ?: expressions. + +Fixed bug in wide-character literals. + +Fix allocation error for identifiers injected to quell +undeclared identifier errors; +Correct int type added to addresses in field offsets. + +src/gen.c: +Made emitasm extern. + +src/input.c: +Fixed bug in resynch that caused infinite loop. + +Added #ident recognition, which simply ignores it. + +src/symbolic.c: +Revised symbolic back end to emit -0.0 correctly. + +Emit flags in symbolic output. + +src/bytecode.c: +Fixed double output botch in defconst in bytecode backend. + +src/dagcheck.c: +Added mssing cases in dagcheck's reduce for types signedptr +and unsignedptr. Without these, reduce can fail. + +src/lex.c: +Permit \ to escape newline in string literals. + +Fixed scon() so that it accepts and concatenates adjacent wide-character literals. + +src/main.c: +Fixed long-standing bug in which -n, -b, -C, and -a options caused +interface functions to be called before progbeg. + +src/mips.md: +Fixed FP comparisons to handle NaNs correctly. + +Round up framesize to a multiple of 16 for Irix 6.x; +added casts in defconst to discard unused bits. + +src/prof.c: +Revise functions called at events so all have the same signature, +modulo pointer types. + +Change ftype to build arbitrary prototypes. + +Fixed long-standing bug in which -n, -b, -C, and -a options caused +interface functions to be called before progbeg. +Also, added missing call to space. + +Relaxed assertion in loop that searches for +embedded CALL nodes. + +Emit correct padding in generated -b strutures. + +Revised call hook to find CALL nodes embedded +at any depth. + +Edited bbincr so that it doesn't inject increments in constant expressions. + +src/profio.c: +Change compare's prototype to conform to ANSI standard; +change calls to qsort accordingly. + +Fixed implicit assumption that execution point i in file f always +refers to the same x,y. This isn't true for noweb files. + +src/simp.c: +Made address interface function optional. + +Tighten test that avoids folding addressing expressions +for switch tables when the offset exceeds 16 bits. Without +this addition, lcc can emit erroneous "initializer must be +constant" diagnostics. + +Revised simplify() so that if doesn't call address to +fold (ADDGRP a n) when n exceeds 16 bits. + +Reordered tests in MOD+I case so expressions like 6%1 fold correctly. + +src/sparc.md: +Fixed FP comparisons to handle NaNs correctly. + +Added casts in defconst() to emit constants with proper sizes. + +Replaced pseudo-instructions st2/ld2 with pairs of st/ld instructions. + +src/stmt.c: +Fixed botch in 2.16 revision. + +Fixed return statement so that "return;" in a function that returns +a value returns 0. Similar code is already in decl.nw. + +Resynch to distributable version. + +Used dynamic variables for loop and switch handles. + +Fixed bug in which functions that return const struct S {...} issued +an incorrect diagnostic. + +Appended a missing \n to a warning. + +src/sym.c: +Revised 2.19's code for comparing -0.0 and 0.0 so that it works +correctly when long double's occupy more bytes than the actual +values, as on the x86 under gcc. +Fix constant() so that it treats -0.0 and +0.0 as different constants. + +Added newtable() to allocate empty symbol tables. + +src/trace.c: +Revise functions called at events so all have the same signature, +modulo pointer types. + +Change ftype to build arbitrary prototypes. + +Fixed long-standing bug in which -n, -b, -C, and -a options caused +interface functions to be called before progbeg. + +src/tree.c: +Correct revision 2.9's implementation of check to avoid +superfluous diagnostics on widening conversions. + +Avoid diagnostics for superfluous widening conversions. + +src/types.c: +Revise fieldmask definition so it works +for all values of fieldsize. + +Change ftype to build arbitrary prototypes. + +src/x86.md: +Fixed FP comparisons to handle NaNs correctly. + +Changed ARGB instruction sequence to decrement +esp by the size of the structure rounded up to 4. +Changed struct allignment to 1; this required changing local to +insure that on-stack structs are aligned to at least 4 bytes. + +Added cast in defconst to eliminate extraneous bits. + +Fixed float-to-int conversions so they truncate properly; +fixed assembler syntax errors on x86/linux. + +Fixed frame size adjustment for frames >= 4096; now calls _chkstk +to allocate large frames. + +Fixed overly specific opcode for loading constants. + +Changed add/sub to addl/subl in potentially ambiguous +instructions in the x86/linux back end. + +cpp/cpp.c: +Added line to fix Nelson Beebe's bug using #defined x X. + +cpp/cpp.h: +Revised to use stdio for output. + +Converted to use stdio for input. + +cpp/eval.c: +Added evaluation stack overflow checks. + +Included stdio.h. + +cpp/getopt.c: +Include ; cut decl. for strchr. + +cpp/hideset.c: +Fixed potential sizeof botches. + +cpp/include.c: +Revised to use stdio for output. + +Removed unused wd[]. + +Fixed incorrect check of fopen return value. + +Converted to use stdio for input. + +cpp/lex.c: +Fixed incorrect test of fd value; fixed comments. + +Converted to use stdio for input. + +cpp/macro.c: +Fixed obscure bug that occurs when string literals are stored +in read-only memory. -DX attempts to append a null byte to "1". +Found by Nelson Beebe. + +Converted to use stdio for input. + +cpp/nlist.c: +Removed unused wd[]. + +Added #ident; ignored as for #pragma. + +cpp/tokens.c: +Revised to use stdio for output. + +Fixed erroneous initialization and check of FILE * value. + +cpp/unix.c: +Revised to use stdio for output. + +Fixed erroneous initialization and check of FILE * value. + +Converted to use stdio for input. + +etc/irix.c: +Added -D_LONGLONG, because some SGI assume this. +Reported by Nelson Beebe. + +Added -32 option to insure O32 object files and libraries are used. + +etc/lcc.c: +Fixed -l file so that file doesn't have to exist. + +Changed \ to / at the end of Win32 include paths. + +Added casts and prototypes to make _spawnvp compatible +with Win32 version. + +Permit -dynamic -static on all systems, using option to check +for validity. +Edited help messages. + +Look for -Wf-unsigned_char=1 and added +-D__CHAR_IUNSIGNED__ and -U_CHAR_IS_SIGNED to the cpp +command line. These options interact with changes to the +standard header limits.h to set CHAR_MIN and CHAR_MAX correctly. +Look for -Wf-wchar_t=... and define _WCHAR_T_SIZE appropriately, +which interacts with stddef.h and stdlib.h to typedef wchar_t correctly. + +Fixed botch in initinputs that cleared LCCINPUTS. + +etc/win32.c: +Added oldnames.lib to link command. + +Cut useless -align directive in ld command. + +include/*/*/limits.h: +Corrected name: __CHAR_IS_UNSIGNED__ should be __CHAR_UNSIGNED__. + +Define CHAR_MIN/CHAR_MAX depending on defintion of __CHAR_IS_UNSIGNED__. + +include/*/*/locale.h: +Change NULL to ((void*)0). + +Protected definition of NULL; +defined NULL as 0L on osf systems. + +include/*/*/stdarg.h: +Fixed typedef for __va_list so it's protected by #ifdef. + +Fixed missing #endif; +protected definition of va_list by _VA_LIST_DEFINED. + +Changed the type of va_list. + +Insured only va_list was conditionally defined. + +Insured _VA_LIST is defined. + +Revised __va_arg macro to handle va_arg(float) correctly; +this addition required a static double temporary, which is +less than elegant and subject to order-of-evaluation bugs. + +include/*/*/stddef.h: +Change NULL to ((void*)0). + +Added _x_T_DEFINED flag macros for Windows compatibility. + +Added code to typedef wchar_t to unsigned char, short, or int +depending on the value of _WCHAR_T_SIZE. + +Protected definition of NULL; +defined NULL as 0L on osf systems. + +include/*/*/stdio.h: +Change NULL to ((void*)0). + +Added _x_T_DEFINED flag macros for Windows compatibility. + +Changed the type of va_list. + +Protected definition of size_t by _SIZE_T_DEFINED; +added definition for va_list protected by _VA_LIST. + +Protected definition of NULL; +defined NULL as 0L on osf systems. + +include/*/*/stdlib.h: +Change NULL to ((void*)0). + +Added _x_T_DEFINED flag macros for Windows compatibility. + +Added code to typedef wchar_t to unsigned char, short, or int +depending on the value of _WCHAR_T_SIZE. + +Protected definition of NULL; +defined NULL as 0L on osf systems. + +include/*/*/string.h: +Change NULL to ((void*)0). + +Added _x_T_DEFINED flag macros for Windows compatibility. + +Protected definition of NULL; +defined NULL as 0L on osf systems. + +include/*/*/time.h: +Change NULL to ((void*)0). + +Added _x_T_DEFINED flag macros for Windows compatibility. + +Protected definition of NULL; +defined NULL as 0L on osf systems. + +lburg/lburg.c: +Simplified use of va_arg to accommodate gcc bug. + +Added ()s to avoid bogus compilation error on Linux. + +lib/assert.c: +Added EXPORT and default definition. + +lib/bbexit.c: +Access _caller via indirection; add _setcallerp. + +Added EXPORT and default definition. + +Changed profiling counters to ints. + +lib/yynull.c: +Added EXPORT and default definition. + +tst/cq.c: +Added prototypes to function pointer initializations. diff --git a/src/cmd/lccom-1/Makefile b/src/cmd/lccom-1/Makefile new file mode 100644 index 0000000..d02c235 --- /dev/null +++ b/src/cmd/lccom-1/Makefile @@ -0,0 +1,189 @@ +# +# Makefile for lccom +# +TOPSRC = $(shell cd ../../..; pwd) +#include $(TOPSRC)/target.mk +#include $(TOPSRC)/cross.mk +MACHINE = mips +DESTDIR ?= $(TOPSRC) + +# chipKIT PIC32 compiler on Linux +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Download from https://github.com/jasonkajita/chipKIT-cxx/downloads +# and unzip to /usr/local. +# Need to copy pic32-tools/pic32mx/include/stdarg.h +# to pic32-tools/lib/gcc/pic32mx/4.5.1/include. +# MPLABX C32 compiler doesn't support some functionality +# we need, so use chipKIT compiler by default. +ifndef GCCPREFIX + GCCPREFIX = /usr/local/pic32-tools/bin/pic32- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips + INCLUDES = -I/usr/local/pic32-tools/lib/gcc/pic32mx/4.5.1/include +endif + +CC = $(GCCPREFIX)gcc -mips32r2 -EL -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) +CXX = $(GCCPREFIX)g++ -mips32r2 -EL -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) +LD = $(GCCPREFIX)ld +AR = $(GCCPREFIX)ar +RANLIB = $(GCCPREFIX)ranlib +SIZE = $(GCCPREFIX)size +OBJDUMP = $(GCCPREFIX)objdump -mmips:isa32r2 +AS = $(CC) -x assembler-with-cpp -c +YACC = byacc +LEX = flex +INSTALL = install -m 644 +INSTALLDIR = install -m 755 -d +TAGSFILE = tags +MANROFF = nroff -man -h +ELF2AOUT = $(TOPSRC)/tools/elf2aout/elf2aout + +CFLAGS = -O -g + +#LDFLAGS += -N -nostartfiles -fno-dwarf2-cfi-asm -T$(TOPSRC)/src/elf32-mips.ld \ +# $(TOPSRC)/src/crt0.o -L$(TOPSRC)/src + +LIBS = -lc + +### END OF TARGET INCLUDE + +CFLAGS += -Os -Wall -Werror +LDFLAGS += +LDFLAGS += -N -nostartfiles -fno-dwarf2-cfi-asm \ + -L$(TOPSRC)/src +LDFLAGS += -T using-bootloader.ld -Wl,-Map=picoc.map + +OBJCOPY = $(GCCPREFIX)objcopy + +OBJS = $Balloc.o $Bbind.o $Bdag.o $Bdagcheck.o $Bdecl.o $Benode.o \ + $Berror.o $Bexpr.o $Bevent.o $Binit.o $Binits.o $Binput.o \ + $Blex.o $Blist.o $Boutput.o $Bprof.o $Bprofio.o \ + $Bsimp.o $Bstmt.o $Bstring.o $Bsym.o $Btrace.o $Btree.o \ + $Btypes.o $Bnull.o $Bsymbolic.o $Bgen.o $Bbytecode.o \ + $Bmain.o $Bmips.o + +TARGET = TARGET_MIPS +BUILDDIR = build +TSTDIR = tst/mips-eb +B = $(BUILDDIR)/ +T = $(TSTDIR)/ + +all: build $Blburg lccom.bin liblcc.a + +clean: + rm -rf lccom lccom.bin *.a *.dis *~ $B $T/*.1 $T/*.2 $T/*.s + rm -f $T8q $Tarray $Tcf $Tcq $Tcvt $Tfields $Tfront $Tincr \ + $Tinit $Tlimits $Tparanoia $Tsort $Tspill $Tstdarg \ + $Tstruct $Tswitch $Twf1 $Tyacc + +install: all + install lccom.bin $(TOPSRC)/uflash/ + +build: + mkdir -p $(BUILDDIR) + +# +# lccom: the C compiler +# +lccom.bin: ${OBJS} crt0.o + ${CC} ${LDFLAGS} -o lccom.elf crt0.o ${OBJS} ${LIBS} + ${OBJDUMP} -S lccom.elf > lccom.dis + ${SIZE} lccom.elf + $(OBJCOPY) -O binary lccom.elf lccom.bin && rm lccom.elf + #$(OBJCOPY) -O ihex --change-addresses=0xa0000000 lccom.elf lccom.hex + #${ELF2AOUT} lccom.elf $@ && rm lccom.elf + +$(OBJS): c.h ops.h token.h config.h + + +$Balloc.o: alloc.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bbind.o: bind.c; $(CC) $(CFLAGS) -D$(TARGET) -c -I. -o $@ $< +$Bdag.o: dag.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bdecl.o: decl.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Benode.o: enode.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Berror.o: error.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bevent.o: event.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bexpr.o: expr.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bgen.o: gen.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Binit.o: init.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Binits.o: inits.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Binput.o: input.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Blex.o: lex.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Blist.o: list.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bmain.o: main.c; $(CC) $(CFLAGS) -DVERSION=\"`svnversion`\" -c -I. -o $@ $< +$Bnull.o: null.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Boutput.o: output.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bprof.o: prof.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bprofio.o: profio.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bsimp.o: simp.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bstmt.o: stmt.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bstring.o: string.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bsym.o: sym.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bsymbolic.o: symbolic.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bbytecode.o: bytecode.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Btrace.o: trace.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Btree.o: tree.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Btypes.o: types.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bstab.o: stab.c stab.h; $(CC) $(CFLAGS) -c -I. -o $@ $< + +$Bdagcheck.o: $Bdagcheck.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Balpha.o: $Balpha.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bmips.o: $Bmips.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bsparc.o: $Bsparc.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bx86.o: $Bx86.c; $(CC) $(CFLAGS) -c -I. -o $@ $< +$Bx86linux.o: $Bx86linux.c; $(CC) $(CFLAGS) -c -I. -o $@ $< + +$Bdagcheck.c: $Blburg dagcheck.md; $Blburg -n dagcheck.md $@ +$Balpha.c: $Blburg alpha.md; $Blburg alpha.md $@ +$Bmips.c: $Blburg mips.md; $Blburg mips.md $@ +$Bsparc.c: $Blburg sparc.md; $Blburg sparc.md $@ +$Bx86.c: $Blburg x86.md; $Blburg x86.md $@ +$Bx86linux.c: $Blburg x86linux.md; $Blburg x86linux.md $@ + +# +# lburg: code generator generator +# +$Blburg: $Blburg.o $Bgram.o + cc -g -o $@ $Blburg.o $Bgram.o + +$Blburg.o $Bgram.o: lburg/lburg.h + +$Blburg.o: lburg/lburg.c; cc -g -Wall -O -c -Ilburg -o $@ $< +$Bgram.o: lburg/gram.c; cc -g -Wall -O -c -Ilburg -o $@ $< + +# +# liblcc: run time library +# +LIBOBJS = $Bassert.o $Bbbexit.o $Byynull.o + +liblcc.a: $(LIBOBJS) + $(AR) ruv $@ $Bassert.o $Bbbexit.o $Byynull.o; $(RANLIB) $@ || true + +$Bassert.o: lib/assert.c; $(CC) $(CFLAGS) -c -o $@ $< +$Byynull.o: lib/yynull.c; $(CC) $(CFLAGS) -c -o $@ $< +$Bbbexit.o: lib/bbexit.c; $(CC) $(CFLAGS) -c -o $@ $< + +# +# Tests +# +test: $T8q.s $Tarray.s $Tcf.s $Tcq.s $Tcvt.s $Tfields.s $Tfront.s \ + $Tincr.s $Tinit.s $Tlimits.s $Tparanoia.s $Tsort.s \ + $Tspill.s $Tstdarg.s $Tstruct.s $Tswitch.s $Twf1.s $Tyacc.s + +$T8q.s: tst/8q.c tst/8q.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tarray.s: tst/array.c tst/array.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tcf.s: tst/cf.c tst/cf.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tcq.s: tst/cq.c tst/cq.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tcvt.s: tst/cvt.c tst/cvt.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tfields.s: tst/fields.c tst/fields.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tfront.s: tst/front.c tst/front.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tincr.s: tst/incr.c tst/incr.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tinit.s: tst/init.c tst/init.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tlimits.s: tst/limits.c tst/limits.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tparanoia.s: tst/paranoia.c tst/paranoia.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tsort.s: tst/sort.c tst/sort.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tspill.s: tst/spill.c tst/spill.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tstdarg.s: tst/stdarg.c tst/stdarg.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tstruct.s: tst/struct.c tst/struct.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tswitch.s: tst/switch.c tst/switch.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Twf1.s: tst/wf1.c tst/wf1.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ +$Tyacc.s: tst/yacc.c tst/yacc.0 all; @env BUILDDIR=$(BUILDDIR) TSTDIR=$(TSTDIR) tst/run.sh $@ diff --git a/src/cmd/lccom-1/README b/src/cmd/lccom-1/README new file mode 100644 index 0000000..1deccaf --- /dev/null +++ b/src/cmd/lccom-1/README @@ -0,0 +1,22 @@ +This hierarchy is the distribution for lcc version 4.2. + +lcc version 3.x is described in the book "A Retargetable C Compiler: +Design and Implementation" (Addison-Wesley, 1995, ISBN 0-8053-1670-1). +There are significant differences between 3.x and 4.x, most notably in +the intermediate code. For details, see +http://www.research.microsoft.com/~drh/pubs/interface4.pdf. + +VERSION 4.2 IS INCOMPATIBLE WITH EARLIER VERSIONS OF LCC. DO NOT +UNLOAD THIS DISTRIBUTION ON TOP OF A 3.X DISTRIBUTION. + +LOG describes the changes since the last release. + +CPYRIGHT describes the conditions under you can use, copy, modify, and +distribute lcc or works derived from lcc. + +doc/install.html is an HTML file that gives a complete description of +the distribution and installation instructions. + +Chris Fraser / cwfraser@microsoft.com +David Hanson / drh@microsoft.com +$Revision: 2.7 $ $Date: 2003/06/19 22:07:06 $ diff --git a/src/cmd/lccom-1/alloc.c b/src/cmd/lccom-1/alloc.c new file mode 100644 index 0000000..0aa0000 --- /dev/null +++ b/src/cmd/lccom-1/alloc.c @@ -0,0 +1,101 @@ +#include "c.h" + +struct block { + struct block *next; + char *limit; + char *avail; +}; + +union align { + long l; + char *p; + double d; + int (*f)(void); +}; + +union header { + struct block b; + union align a; +}; + +#ifdef PURIFY + +union header *arena[3]; + +void *allocate(unsigned long n, unsigned a) { + union header *new = malloc(sizeof *new + n); + + assert(a < NELEMS(arena)); + if (new == NULL) { + error("insufficient memory\n"); + exit(1); + } + new->b.next = (void *)arena[a]; + arena[a] = new; + return new + 1; +} + +void deallocate(unsigned a) { + union header *p, *q; + + assert(a < NELEMS(arena)); + for (p = arena[a]; p; p = q) { + q = (void *)p->b.next; + free(p); + } + arena[a] = NULL; +} + +void *newarray(unsigned long m, unsigned long n, unsigned a) { + return allocate(m*n, a); +} +#else +static struct block + first[] = { { NULL }, { NULL }, { NULL } }, + *arena[] = { &first[0], &first[1], &first[2] }; + +static struct block *freeblocks; + +void *allocate(unsigned long n, unsigned a) { + struct block *ap; + + assert(a < NELEMS(arena)); + assert(n > 0); + ap = arena[a]; + n = roundup(n, sizeof (union align)); + while (n > ap->limit - ap->avail) { + if ((ap->next = freeblocks) != NULL) { + freeblocks = freeblocks->next; + ap = ap->next; + } else + { + unsigned m = sizeof (union header) + n + roundup(3*1024, sizeof (union align)); + ap->next = malloc(m); + ap = ap->next; + if (ap == NULL) { + error("insufficient memory\n"); + exit(1); + } + ap->limit = (char *)ap + m; + } + ap->avail = (char *)((union header *)ap + 1); + ap->next = NULL; + arena[a] = ap; + + } + ap->avail += n; + return ap->avail - n; +} + +void *newarray(unsigned long m, unsigned long n, unsigned a) { + return allocate(m*n, a); +} + +void deallocate(unsigned a) { + assert(a < NELEMS(arena)); + arena[a]->next = freeblocks; + freeblocks = first[a].next; + first[a].next = NULL; + arena[a] = &first[a]; +} +#endif diff --git a/src/cmd/lccom-1/alpha.md b/src/cmd/lccom-1/alpha.md new file mode 100644 index 0000000..09bfb08 --- /dev/null +++ b/src/cmd/lccom-1/alpha.md @@ -0,0 +1,1188 @@ +%{ +#define INTTMP ((0xff<<1)|(1<<22)|(1<<25)|(1<<27)) +#define INTVAR (0x3f<<9) +#define FLTTMP ((0x3f<<10)|(0x1ff<<22)) +#define FLTVAR (0xff<<2) + +#define INTRET 0x00000001 +#define FLTRET 0x00000003 + +#define readsreg(p) \ + (generic((p)->op)==INDIR && (p)->kids[0]->op==VREG+P) +#define setsrc(d) ((d) && (d)->x.regnode && \ + (d)->x.regnode->set == src->x.regnode->set && \ + (d)->x.regnode->mask&src->x.regnode->mask) + +#define relink(a, b) ((b)->x.prev = (a), (a)->x.next = (b)) + +#include "c.h" +#define NODEPTR_TYPE Node +#define OP_LABEL(p) ((p)->op) +#define LEFT_CHILD(p) ((p)->kids[0]) +#define RIGHT_CHILD(p) ((p)->kids[1]) +#define STATE_LABEL(p) ((p)->x.state) +static void address(Symbol, Symbol, long); +static void blkfetch(int, int, int, int); +static void blkloop(int, int, int, int, int, int[]); +static void blkstore(int, int, int, int); +static void defaddress(Symbol); +static void defconst(int, int, Value); +static void defstring(int, char *); +static void defsymbol(Symbol); +static void doarg(Node); +static void emit2(Node); +static void export(Symbol); +static void clobber(Node); +static void function(Symbol, Symbol [], Symbol [], int); +static void global(Symbol); +static void import(Symbol); +static void local(Symbol); +static void progbeg(int, char **); +static void progend(void); +static void segment(int); +static void space(int); +static void target(Node); +static Symbol ireg[32], freg[32]; +static Symbol iregw, fregw; + +static int tmpregs[] = {4, 2, 3}; +static Symbol blkreg; + +static int cseg; + +static char *currentfile; + +%} +%start stmt +%term CNSTF4=4113 +%term CNSTF8=8209 +%term CNSTF16=16401 +%term CNSTI1=1045 +%term CNSTI2=2069 +%term CNSTI4=4117 +%term CNSTI8=8213 +%term CNSTP4=4119 +%term CNSTP8=8215 +%term CNSTU1=1046 +%term CNSTU2=2070 +%term CNSTU4=4118 +%term CNSTU8=8214 + +%term ARGB=41 +%term ARGF4=4129 +%term ARGF8=8225 +%term ARGF16=16417 +%term ARGI4=4133 +%term ARGI8=8229 +%term ARGP4=4135 +%term ARGP8=8231 +%term ARGU4=4134 +%term ARGU8=8230 + +%term ASGNB=57 +%term ASGNF4=4145 +%term ASGNF8=8241 +%term ASGNF16=16433 +%term ASGNI1=1077 +%term ASGNI2=2101 +%term ASGNI4=4149 +%term ASGNI8=8245 +%term ASGNP4=4151 +%term ASGNP8=8247 +%term ASGNU1=1078 +%term ASGNU2=2102 +%term ASGNU4=4150 +%term ASGNU8=8246 + +%term INDIRB=73 +%term INDIRF4=4161 +%term INDIRF8=8257 +%term INDIRF16=16449 +%term INDIRI1=1093 +%term INDIRI2=2117 +%term INDIRI4=4165 +%term INDIRI8=8261 +%term INDIRP4=4167 +%term INDIRP8=8263 +%term INDIRU1=1094 +%term INDIRU2=2118 +%term INDIRU4=4166 +%term INDIRU8=8262 + +%term CVFF4=4209 +%term CVFF8=8305 +%term CVFF16=16497 +%term CVFI4=4213 +%term CVFI8=8309 + +%term CVIF4=4225 +%term CVIF8=8321 +%term CVIF16=16513 +%term CVII1=1157 +%term CVII2=2181 +%term CVII4=4229 +%term CVII8=8325 +%term CVIU1=1158 +%term CVIU2=2182 +%term CVIU4=4230 +%term CVIU8=8326 + +%term CVPP4=4247 +%term CVPP8=8343 +%term CVPP16=16535 +%term CVPU4=4246 +%term CVPU8=8342 + +%term CVUI1=1205 +%term CVUI2=2229 +%term CVUI4=4277 +%term CVUI8=8373 +%term CVUP4=4279 +%term CVUP8=8375 +%term CVUP16=16567 +%term CVUU1=1206 +%term CVUU2=2230 +%term CVUU4=4278 +%term CVUU8=8374 + +%term NEGF4=4289 +%term NEGF8=8385 +%term NEGF16=16577 +%term NEGI4=4293 +%term NEGI8=8389 + +%term CALLB=217 +%term CALLF4=4305 +%term CALLF8=8401 +%term CALLF16=16593 +%term CALLI4=4309 +%term CALLI8=8405 +%term CALLP4=4311 +%term CALLP8=8407 +%term CALLU4=4310 +%term CALLU8=8406 +%term CALLV=216 + +%term RETF4=4337 +%term RETF8=8433 +%term RETF16=16625 +%term RETI4=4341 +%term RETI8=8437 +%term RETP4=4343 +%term RETP8=8439 +%term RETU4=4342 +%term RETU8=8438 +%term RETV=248 + +%term ADDRGP4=4359 +%term ADDRGP8=8455 + +%term ADDRFP4=4375 +%term ADDRFP8=8471 + +%term ADDRLP4=4391 +%term ADDRLP8=8487 + +%term ADDF4=4401 +%term ADDF8=8497 +%term ADDF16=16689 +%term ADDI4=4405 +%term ADDI8=8501 +%term ADDP4=4407 +%term ADDP8=8503 +%term ADDU4=4406 +%term ADDU8=8502 + +%term SUBF4=4417 +%term SUBF8=8513 +%term SUBF16=16705 +%term SUBI4=4421 +%term SUBI8=8517 +%term SUBP4=4423 +%term SUBP8=8519 +%term SUBU4=4422 +%term SUBU8=8518 + +%term LSHI4=4437 +%term LSHI8=8533 +%term LSHU4=4438 +%term LSHU8=8534 + +%term MODI4=4453 +%term MODI8=8549 +%term MODU4=4454 +%term MODU8=8550 + +%term RSHI4=4469 +%term RSHI8=8565 +%term RSHU4=4470 +%term RSHU8=8566 + +%term BANDI4=4485 +%term BANDI8=8581 +%term BANDU4=4486 +%term BANDU8=8582 + +%term BCOMI4=4501 +%term BCOMI8=8597 +%term BCOMU4=4502 +%term BCOMU8=8598 + +%term BORI4=4517 +%term BORI8=8613 +%term BORU4=4518 +%term BORU8=8614 + +%term BXORI4=4533 +%term BXORI8=8629 +%term BXORU4=4534 +%term BXORU8=8630 + +%term DIVF4=4545 +%term DIVF8=8641 +%term DIVF16=16833 +%term DIVI4=4549 +%term DIVI8=8645 +%term DIVU4=4550 +%term DIVU8=8646 + +%term MULF4=4561 +%term MULF8=8657 +%term MULF16=16849 +%term MULI4=4565 +%term MULI8=8661 +%term MULU4=4566 +%term MULU8=8662 + +%term EQF4=4577 +%term EQF8=8673 +%term EQF16=16865 +%term EQI4=4581 +%term EQI8=8677 +%term EQU4=4582 +%term EQU8=8678 + +%term GEF4=4593 +%term GEF8=8689 +%term GEI4=4597 +%term GEI8=8693 +%term GEI16=16885 +%term GEU4=4598 +%term GEU8=8694 + +%term GTF4=4609 +%term GTF8=8705 +%term GTF16=16897 +%term GTI4=4613 +%term GTI8=8709 +%term GTU4=4614 +%term GTU8=8710 + +%term LEF4=4625 +%term LEF8=8721 +%term LEF16=16913 +%term LEI4=4629 +%term LEI8=8725 +%term LEU4=4630 +%term LEU8=8726 + +%term LTF4=4641 +%term LTF8=8737 +%term LTF16=16929 +%term LTI4=4645 +%term LTI8=8741 +%term LTU4=4646 +%term LTU8=8742 + +%term NEF4=4657 +%term NEF8=8753 +%term NEF16=16945 +%term NEI4=4661 +%term NEI8=8757 +%term NEU4=4662 +%term NEU8=8758 + +%term JUMPV=584 + +%term LABELV=600 + +%term LOADB=233 +%term LOADF4=4321 +%term LOADF8=8417 +%term LOADF16=16609 +%term LOADI1=1253 +%term LOADI2=2277 +%term LOADI4=4325 +%term LOADI8=8421 +%term LOADP4=4327 +%term LOADP8=8423 +%term LOADU1=1254 +%term LOADU2=2278 +%term LOADU4=4326 +%term LOADU8=8422 + +%term VREGP=711 +%% +reg: INDIRI1(VREGP) "# read register\n" +reg: INDIRU1(VREGP) "# read register\n" + +reg: INDIRI2(VREGP) "# read register\n" +reg: INDIRU2(VREGP) "# read register\n" + +reg: INDIRF4(VREGP) "# read register\n" +reg: INDIRI4(VREGP) "# read register\n" +reg: INDIRP4(VREGP) "# read register\n" +reg: INDIRU4(VREGP) "# read register\n" + +reg: INDIRF8(VREGP) "# read register\n" +reg: INDIRI8(VREGP) "# read register\n" +reg: INDIRP8(VREGP) "# read register\n" +reg: INDIRU8(VREGP) "# read register\n" + +stmt: ASGNI1(VREGP,reg) "# write register\n" +stmt: ASGNU1(VREGP,reg) "# write register\n" + +stmt: ASGNI2(VREGP,reg) "# write register\n" +stmt: ASGNU2(VREGP,reg) "# write register\n" + +stmt: ASGNF4(VREGP,reg) "# write register\n" +stmt: ASGNI4(VREGP,reg) "# write register\n" +stmt: ASGNP4(VREGP,reg) "# write register\n" +stmt: ASGNU4(VREGP,reg) "# write register\n" + +stmt: ASGNF8(VREGP,reg) "# write register\n" +stmt: ASGNI8(VREGP,reg) "# write register\n" +stmt: ASGNP8(VREGP,reg) "# write register\n" +stmt: ASGNU8(VREGP,reg) "# write register\n" +con: CNSTI1 "%a" +con: CNSTU1 "%a" + +con: CNSTI2 "%a" +con: CNSTU2 "%a" + +con: CNSTI4 "%a" +con: CNSTU4 "%a" +con: CNSTP4 "%a" + +con: CNSTI8 "%a" +con: CNSTU8 "%a" +con: CNSTP8 "%a" +stmt: reg "" +acon: con "%0" +acon: ADDRGP8 "%a" + +addr: ADDI4(reg,acon) "%1($%0)" +addr: ADDI8(reg,acon) "%1($%0)" +addr: ADDU8(reg,acon) "%1($%0)" +addr: ADDP8(reg,acon) "%1($%0)" + +addr: acon "%0" +addr: reg "($%0)" + +addr: ADDRFP8 "%a+%F($sp)" +addr: ADDRLP8 "%a+%F($sp)" + +reg: addr "lda $%c,%0\n" 1 + +reg: CNSTI1 "# reg\n" range(a, 0, 0) +reg: CNSTI2 "# reg\n" range(a, 0, 0) +reg: CNSTI4 "# reg\n" range(a, 0, 0) +reg: CNSTI8 "# reg\n" range(a, 0, 0) +reg: CNSTU1 "# reg\n" range(a, 0, 0) +reg: CNSTU2 "# reg\n" range(a, 0, 0) +reg: CNSTU4 "# reg\n" range(a, 0, 0) +reg: CNSTU8 "# reg\n" range(a, 0, 0) +reg: CNSTP8 "# reg\n" range(a, 0, 0) + +stmt: ASGNI1(addr,reg) "stb $%1,%0\n" 1 +stmt: ASGNU1(addr,reg) "stb $%1,%0\n" 1 +stmt: ASGNI2(addr,reg) "stw $%1,%0\n" 1 +stmt: ASGNU2(addr,reg) "stw $%1,%0\n" 1 + +stmt: ASGNI4(addr,reg) "stl $%1,%0\n" 1 +stmt: ASGNU4(addr,reg) "stl $%1,%0\n" 1 +stmt: ASGNI8(addr,reg) "stq $%1,%0\n" 1 +stmt: ASGNU8(addr,reg) "stq $%1,%0\n" 1 +stmt: ASGNP8(addr,reg) "stq $%1,%0\n" 1 + +reg: INDIRI1(reg) "ldb $%c,($%0)\n" 1 +reg: INDIRI2(reg) "ldw $%c,($%0)\n" 1 +reg: INDIRI4(addr) "ldl $%c,%0\n" 1 +reg: INDIRI8(addr) "ldq $%c,%0\n" 1 +reg: INDIRP8(addr) "ldq $%c,%0\n" 1 +reg: INDIRU1(reg) "ldbu $%c,($%0)\n" 1 +reg: INDIRU2(reg) "ldwu $%c,($%0)\n" 1 +reg: INDIRU4(addr) "ldl $%c,%0\nzap $%c,240,$%c\n" 2 +reg: INDIRU8(addr) "ldq $%c,%0\n" 1 + +reg: CVII4(INDIRI1(reg)) "ldb $%c,($%0)\n" 1 +reg: CVII8(INDIRI1(reg)) "ldb $%c,($%0)\n" 1 +reg: CVII4(INDIRI2(reg)) "ldw $%c,($%0)\n" 1 +reg: CVII8(INDIRI2(reg)) "ldw $%c,($%0)\n" 1 +reg: CVII8(INDIRI4(addr)) "ldl $%c,%0\n" 1 + +reg: CVUU4(INDIRU1(reg)) "ldbu $%c,($%0)\n" 1 +reg: CVUU8(INDIRU1(reg)) "ldbu $%c,($%0)\n" 1 +reg: CVUU4(INDIRU2(reg)) "ldwu $%c,($%0)\n" 1 +reg: CVUU8(INDIRU2(reg)) "ldwu $%c,($%0)\n" 1 +reg: CVUU8(INDIRU4(addr)) "ldl $%c,%0\nzap $%c,240,$%c\n" 2 + +reg: CVUI4(INDIRU1(reg)) "ldbu $%c,($%0)\n" 1 +reg: CVUI8(INDIRU1(reg)) "ldbu $%c,($%0)\n" 1 +reg: CVUI4(INDIRU2(reg)) "ldwu $%c,($%0)\n" 1 +reg: CVUI8(INDIRU2(reg)) "ldwu $%c,($%0)\n" 1 +reg: CVUI8(INDIRU4(addr)) "ldl $%c,%0\nzap $%c,240,$%c\n" 2 + +reg: CVIU8(reg) "mov $%0,$%c\n" move(a) + +reg: INDIRF4(addr) "lds $f%c,%0\n" 1 +reg: INDIRF8(addr) "ldt $f%c,%0\n" 1 +stmt: ASGNF4(addr,reg) "sts $f%1,%0\n" 1 +stmt: ASGNF8(addr,reg) "stt $f%1,%0\n" 1 + +reg: MULI4(reg,rc) "mull $%0,%1,$%c\n" 1 +reg: MULI8(reg,rc) "mulq $%0,%1,$%c\n" 1 +reg: MULU4(reg,rc) "mull $%0,%1,$%c\nzap $%c,240,$%c\n" 2 +reg: MULU8(reg,rc) "mulq $%0,%1,$%c\n" 1 + +reg: DIVI4(reg,rc) "divl $%0,%1,$%c\n" 1 +reg: DIVI8(reg,rc) "divq $%0,%1,$%c\n" 1 +reg: DIVU4(reg,rc) "divlu $%0,%1,$%c\n" 1 +reg: DIVU8(reg,rc) "divqu $%0,%1,$%c\n" 1 +reg: MODI4(reg,rc) "reml $%0,%1,$%c\n" 1 +reg: MODI8(reg,rc) "remq $%0,%1,$%c\n" 1 +reg: MODU4(reg,rc) "remlu $%0,%1,$%c\n" 1 +reg: MODU8(reg,rc) "remqu $%0,%1,$%c\n" 1 + +rc: con "%0" +rc: reg "$%0" + +reg: ADDI4(reg,rc) "addl $%0,%1,$%c\n" 1 +reg: ADDI8(reg,rc) "addq $%0,%1,$%c\n" 1 +reg: ADDP8(reg,rc) "addq $%0,%1,$%c\n" 1 +reg: ADDU4(reg,rc) "addl $%0,%1,$%c\nzap $%c,240,$%c\n" 2 +reg: ADDU8(reg,rc) "addq $%0,%1,$%c\n" 1 +reg: SUBI4(reg,rc) "subl $%0,%1,$%c\n" 1 +reg: SUBI8(reg,rc) "subq $%0,%1,$%c\n" 1 +reg: SUBP8(reg,rc) "subq $%0,%1,$%c\n" 1 +reg: SUBU4(reg,rc) "subl $%0,%1,$%c\nzap $%c,240,$%c\n" 2 +reg: SUBU8(reg,rc) "subq $%0,%1,$%c\n" 1 + +reg: BANDI4(reg,rc) "and $%0,%1,$%c\naddl $%c,0,$%c\n" 2 +reg: BANDI8(reg,rc) "and $%0,%1,$%c\n" 1 +reg: BANDU4(reg,rc) "and $%0,%1,$%c\n" 1 +reg: BANDU8(reg,rc) "and $%0,%1,$%c\n" 1 +reg: BORI4(reg,rc) "or $%0,%1,$%c\naddl $%c,0,$%c\n" 2 +reg: BORI8(reg,rc) "or $%0,%1,$%c\n" 1 +reg: BORU4(reg,rc) "or $%0,%1,$%c\n" 1 +reg: BORU8(reg,rc) "or $%0,%1,$%c\n" 1 +reg: BXORI4(reg,rc) "xor $%0,%1,$%c\naddl $%c,0,$%c\n" 2 +reg: BXORI8(reg,rc) "xor $%0,%1,$%c\n" 1 +reg: BXORU4(reg,rc) "xor $%0,%1,$%c\n" 1 +reg: BXORU8(reg,rc) "xor $%0,%1,$%c\n" 1 + +rc6: CNSTI4 "%a" range(a,0,63) +rc6: CNSTI8 "%a" range(a,0,63) +rc6: reg "$%0" + +reg: LSHI4(reg,rc6) "sll $%0,%1,$%c\naddl $%c,0,$%c\n" 2 +reg: LSHI8(reg,rc6) "sll $%0,%1,$%c\n" 1 +reg: LSHU4(reg,rc6) "sll $%0,%1,$%c\nzap $%c,240,$%c\n" 2 +reg: LSHU8(reg,rc6) "sll $%0,%1,$%c\n" 1 +reg: RSHI4(reg,rc6) "sra $%0,%1,$%c\naddl $%c,0,$%c\n" 2 +reg: RSHI8(reg,rc6) "sra $%0,%1,$%c\n" 1 +reg: RSHU4(reg,rc6) "srl $%0,%1,$%c\n" 1 +reg: RSHU8(reg,rc6) "srl $%0,%1,$%c\n" 1 + +reg: BCOMI4(reg) "not $%0,$%c\naddl $%c,0,$%c\n" 2 +reg: BCOMU4(reg) "not $%0,$%c\nzap $%c,240,$%c\n" 2 +reg: BCOMI8(reg) "not $%0,$%c\n" 1 +reg: BCOMU8(reg) "not $%0,$%c\n" 1 +reg: NEGI4(reg) "negl $%0,$%c\n" 1 +reg: NEGI8(reg) "negq $%0,$%c\n" 1 +reg: LOADI1(reg) "mov $%0,$%c\n" move(a) +reg: LOADI2(reg) "mov $%0,$%c\n" move(a) +reg: LOADI4(reg) "mov $%0,$%c\n" move(a) +reg: LOADI8(reg) "mov $%0,$%c\n" move(a) +reg: LOADP8(reg) "mov $%0,$%c\n" move(a) +reg: LOADU1(reg) "mov $%0,$%c\n" move(a) +reg: LOADU2(reg) "mov $%0,$%c\n" move(a) +reg: LOADU4(reg) "mov $%0,$%c\n" move(a) +reg: LOADU8(reg) "mov $%0,$%c\n" move(a) + +reg: ADDF4(reg,reg) "adds $f%0,$f%1,$f%c\n" 1 +reg: ADDF8(reg,reg) "addt $f%0,$f%1,$f%c\n" 1 +reg: DIVF4(reg,reg) "divs $f%0,$f%1,$f%c\n" 1 +reg: DIVF8(reg,reg) "divt $f%0,$f%1,$f%c\n" 1 +reg: MULF4(reg,reg) "muls $f%0,$f%1,$f%c\n" 1 +reg: MULF8(reg,reg) "mult $f%0,$f%1,$f%c\n" 1 +reg: SUBF4(reg,reg) "subs $f%0,$f%1,$f%c\n" 1 +reg: SUBF8(reg,reg) "subt $f%0,$f%1,$f%c\n" 1 +reg: LOADF4(reg) "fmov $f%0,$f%c\n" move(a) +reg: LOADF8(reg) "fmov $f%0,$f%c\n" move(a) +reg: NEGF4(reg) "negs $f%0,$f%c\n" 1 +reg: NEGF8(reg) "negt $f%0,$f%c\n" 1 +reg: CVII4(reg) "sll $%0,8*(8-%a),$%c\nsra $%c,8*(8-%a),$%c\n" 2 +reg: CVII8(reg) "sll $%0,8*(8-%a),$%c\nsra $%c,8*(8-%a),$%c\n" 2 +reg: CVUI4(reg) "and $%0,(1<<(8*%a))-1,$%c\n" 1 +reg: CVUI8(reg) "and $%0,(1<<(8*%a))-1,$%c\n" 1 +reg: CVUU4(reg) "and $%0,(1<<(8*%a))-1,$%c\n" 1 +reg: CVUU8(reg) "and $%0,(1<<(8*%a))-1,$%c\n" 1 + +reg: CVUP8(reg) "and $%0,(1<<(8*%a))-1,$%c\n" 1 + +reg: CVFF4(reg) "cvtts $f%0,$f%c\n" 1 +reg: CVFF8(reg) "cvtst $f%0,$f%c\n" 1 + +reg: CVIF4(reg) "stq $%0,-56+%F($sp)\nldt $%f%c,-56+%F($sp)\ncvtqs $f%c,$f%c\n" 3 +reg: CVIF8(reg) "stq $%0,-56+%F($sp)\nldt $%f%c,-56+%F($sp)\ncvtqt $f%c,$f%c\n" 3 +reg: CVIF4(INDIRI4(addr)) "lds $f%c,%0\ncvtlq $f%c,$f%c\ncvtqs $f%c,$f%c\n" 3 +reg: CVIF4(INDIRI8(addr)) "ldt $f%c,%0\ncvtqs $f%c,$f%c\n" 2 +reg: CVIF8(INDIRI4(addr)) "lds $f%c,%0\ncvtlq $f%c,$f%c\ncvtqt $f%c,$f%c\n" 3 +reg: CVIF8(INDIRI8(addr)) "ldt $f%c,%0\ncvtqt $f%c,$f%c\n" 2 + +reg: CVFI4(reg) "cvttqc $f%0,$f1\ncvtql $f1,$f1\nsts $f1,-56+%F($sp)\nldl $%c,-56+%F($sp)\n" 4 +reg: CVFI8(reg) "cvttqc $f%0,$f1\nstt $f1,-56+%F($sp)\nldq $%c,-56+%F($sp)\n" 3 + +stmt: LABELV "%a:\n" + +stmt: JUMPV(acon) "br %0\n" 1 +stmt: JUMPV(reg) "jmp ($%0)\n" 1 + +stmt: EQI4(reg,rc6) "cmpeq $%0,%1,$23\nbne $23,%a\n" 2 +stmt: EQU4(reg,rc6) "cmpeq $%0,%1,$23\nbne $23,%a\n" 2 +stmt: EQI8(reg,rc6) "cmpeq $%0,%1,$23\nbne $23,%a\n" 2 +stmt: EQU8(reg,rc6) "cmpeq $%0,%1,$23\nbne $23,%a\n" 2 +stmt: NEI4(reg,rc6) "cmpeq $%0,%1,$23\nbeq $23,%a\n" 2 +stmt: NEU4(reg,rc6) "cmpeq $%0,%1,$23\nbeq $23,%a\n" 2 +stmt: NEI8(reg,rc6) "cmpeq $%0,%1,$23\nbeq $23,%a\n" 2 +stmt: NEU8(reg,rc6) "cmpeq $%0,%1,$23\nbeq $23,%a\n" 2 +stmt: GEI4(reg,rc6) "cmplt $%0,%1,$23\nbeq $23,%a\n" 2 +stmt: GEI8(reg,rc6) "cmplt $%0,%1,$23\nbeq $23,%a\n" 2 +stmt: GEU4(reg,rc6) "cmpult $%0,%1,$23\nbeq $23,%a\n" 1 +stmt: GEU8(reg,rc6) "cmpult $%0,%1,$23\nbeq $23,%a\n" 1 +stmt: GTI4(reg,rc6) "cmple $%0,%1,$23\nbeq $23,%a\n" 2 +stmt: GTI8(reg,rc6) "cmple $%0,%1,$23\nbeq $23,%a\n" 2 +stmt: GTU4(reg,rc6) "cmpule $%0,%1,$23\nbeq $23,%a\n" 1 +stmt: GTU8(reg,rc6) "cmpule $%0,%1,$23\nbeq $23,%a\n" 1 +stmt: LEI4(reg,rc6) "cmple $%0,%1,$23\nbne $23,%a\n" 2 +stmt: LEI8(reg,rc6) "cmple $%0,%1,$23\nbne $23,%a\n" 2 +stmt: LEU4(reg,rc6) "cmpule $%0,%1,$23\nbne $23,%a\n" 2 +stmt: LEU8(reg,rc6) "cmpule $%0,%1,$23\nbne $23,%a\n" 2 +stmt: LTI4(reg,rc6) "cmplt $%0,%1,$23\nbne $23,%a\n" 2 +stmt: LTI8(reg,rc6) "cmplt $%0,%1,$23\nbne $23,%a\n" 2 +stmt: LTU4(reg,rc6) "cmpult $%0,%1,$23\nbne $23,%a\n" 2 +stmt: LTU8(reg,rc6) "cmpult $%0,%1,$23\nbne $23,%a\n" 2 + +stmt: EQF4(reg,reg) "cmpteq $f%0,$f%1,$f1\nfbne $f1,%a\n" 2 +stmt: EQF8(reg,reg) "cmpteq $f%0,$f%1,$f1\nfbne $f1,%a\n" 2 +stmt: LEF4(reg,reg) "cmptle $f%0,$f%1,$f1\nfbne $f1,%a\n" 2 +stmt: LEF8(reg,reg) "cmptle $f%0,$f%1,$f1\nfbne $f1,%a\n" 2 +stmt: LTF4(reg,reg) "cmptlt $f%0,$f%1,$f1\nfbne $f1,%a\n" 2 +stmt: LTF8(reg,reg) "cmptlt $f%0,$f%1,$f1\nfbne $f1,%a\n" 2 + +stmt: NEF4(reg,reg) "cmpteq $f%0,$f%1,$f1\nfbeq $f1,%a\n" 2 +stmt: NEF8(reg,reg) "cmpteq $f%0,$f%1,$f1\nfbeq $f1,%a\n" 2 +stmt: GEF4(reg,reg) "cmptlt $f%0,$f%1,$f1\nfbeq $f1,%a\n" 2 +stmt: GEF8(reg,reg) "cmptlt $f%0,$f%1,$f1\nfbeq $f1,%a\n" 2 +stmt: GTF4(reg,reg) "cmptle $f%0,$f%1,$f1\nfbeq $f1,%a\n" 2 +stmt: GTF8(reg,reg) "cmptle $f%0,$f%1,$f1\nfbeq $f1,%a\n" 2 + +ar: ADDRGP8 "%a" +ar: reg "($%0)" + +reg: CALLF4(ar) "jsr $26,%0\nldgp $gp,0($26)\n" 2 +reg: CALLF8(ar) "jsr $26,%0\nldgp $gp,0($26)\n" 2 +reg: CALLI4(ar) "jsr $26,%0\nldgp $gp,0($26)\n" 2 +reg: CALLI8(ar) "jsr $26,%0\nldgp $gp,0($26)\n" 2 +reg: CALLP8(ar) "jsr $26,%0\nldgp $gp,0($26)\n" 2 +reg: CALLU4(ar) "jsr $26,%0\nldgp $gp,0($26)\n" 2 +reg: CALLU8(ar) "jsr $26,%0\nldgp $gp,0($26)\n" 2 +stmt: CALLV(ar) "jsr $26,%0\nldgp $gp,0($26)\n" 2 + +stmt: RETF4(reg) "# ret\n" 1 +stmt: RETF8(reg) "# ret\n" 1 +stmt: RETI4(reg) "# ret\n" 1 +stmt: RETU4(reg) "# ret\n" 1 +stmt: RETI8(reg) "# ret\n" 1 +stmt: RETU8(reg) "# ret\n" 1 +stmt: RETP8(reg) "# ret\n" 1 +stmt: RETV(reg) "# ret\n" 1 + +stmt: ARGF4(reg) "# arg\n" 1 +stmt: ARGF8(reg) "# arg\n" 1 +stmt: ARGI4(reg) "# arg\n" 1 +stmt: ARGI8(reg) "# arg\n" 1 +stmt: ARGP8(reg) "# arg\n" 1 +stmt: ARGU4(reg) "# arg\n" 1 +stmt: ARGU8(reg) "# arg\n" 1 + +stmt: ARGB(INDIRB(reg)) "# argb %0\n" 1 +stmt: ASGNB(reg,INDIRB(reg)) "# asgnb %0 %1\n" 1 + +%% +static void progend(void){} + +static void progbeg(int argc, char *argv[]) { + int i; + + { + union { + char c; + int i; + } u; + u.i = 0; + u.c = 1; + swap = ((int)(u.i == 1)) != IR->little_endian; + } + parseflags(argc, argv); + + for (i = 0; i < 32; i++) + freg[i] = mkreg("%d", i, 1, FREG); + for (i = 0; i < 32; i++) + ireg[i] = mkreg("%d", i, 1, IREG); + ireg[29]->x.name = "gp"; + ireg[30]->x.name = "sp"; + fregw = mkwildcard(freg); + iregw = mkwildcard(ireg); + + tmask[IREG] = INTTMP; tmask[FREG] = FLTTMP; + vmask[IREG] = INTVAR; vmask[FREG] = FLTVAR; + + blkreg = mkreg("1", 1, 0xf, IREG); + +} + +static Symbol rmap(int opk) { + switch (optype(opk)) { + case I: case U: case P: case B: + return iregw; + case F: + return fregw; + default: + return 0; + } +} + +static Symbol argreg(int offset, int ty) { + if (offset >= 48) + return NULL; + else if (ty == F) + return freg[(offset/8) + 16]; + else + return ireg[(offset/8) + 16]; +} + +static void target(Node p) { + assert(p); + switch (specific(p->op)) { + case CNST+I: case CNST+U: case CNST+P: + if (range(p, 0, 0) == 0) { + setreg(p, ireg[31]); + p->x.registered = 1; + } + break; + case CNST+F: + if (p->syms[0]->u.c.v.d == 0) { + setreg(p, freg[31]); + p->x.registered = 1; + } + break; + + case CALL+V: + rtarget(p, 0, ireg[27]); + break; + case CALL+F: + rtarget(p, 0, ireg[27]); + setreg(p, freg[0]); + break; + case CALL+I: case CALL+P: case CALL+U: + rtarget(p, 0, ireg[27]); + setreg(p, ireg[0]); + break; + case RET+F: + rtarget(p, 0, freg[0]); + break; + case RET+I: case RET+U: case RET+P: + rtarget(p, 0, ireg[0]); + break; + + case ARG+F: case ARG+I: case ARG+P: case ARG+U: { + Symbol q = argreg(p->syms[2]->u.c.v.i, optype(p->op)); + if (q) + rtarget(p, 0, q); + break; + } + + + case ASGN+B: rtarget(p->kids[1], 0, blkreg); break; + case ARG+B: rtarget(p->kids[0], 0, blkreg); break; + + } +} + +static void clobber(Node p) { + assert(p); + switch (specific(p->op)) { + case ASGN+I: case ASGN+U: + if (opsize(p->op) <= 2) + spill(1<<24, IREG, p); + break; + + case DIV+I: case DIV+U: case MOD+I: case MOD+U: + spill(((1<<27)|(3<<24))&~p->syms[RX]->x.regnode->mask, IREG, p); + break; + + case CALL+F: + spill(INTTMP | INTRET, IREG, p); + spill(FLTTMP, FREG, p); + break; + case CALL+I: case CALL+P: case CALL+U: + spill(INTTMP, IREG, p); + spill(FLTTMP | FLTRET, FREG, p); + break; + case CALL+V: + spill(INTTMP | INTRET, IREG, p); + spill(FLTTMP | FLTRET, FREG, p); + break; + + } +} + +static void emit2(Node p) { + int dst, n, src, sz, ty; + static int ty0; + Symbol q; + + switch (specific(p->op)) { + case ARG+F: case ARG+I: case ARG+P: case ARG+U: + ty = optype(p->op); + sz = opsize(p->op); + q = argreg(p->syms[2]->u.c.v.i, ty); + src = getregnum(p->x.kids[0]); + if (q) + break; + else if (ty == F && sz == 4) + print("sts $f%d,%d($sp)\n", src, p->syms[2]->u.c.v.i - 48); + else if (ty == F && sz == 8) + print("stt $f%d,%d($sp)\n", src, p->syms[2]->u.c.v.i - 48); + else if (sz == 4) + print("stq $%d,%d($sp)\n", src, p->syms[2]->u.c.v.i - 48); + else if (sz == 8) + print("stq $%d,%d($sp)\n", src, p->syms[2]->u.c.v.i - 48); + else + assert(0); + break; + + case ASGN+B: + dalign = salign = p->syms[1]->u.c.v.i; + blkcopy(getregnum(p->x.kids[0]), 0, + getregnum(p->x.kids[1]), 0, + p->syms[0]->u.c.v.i, tmpregs); + break; + + + case ARG+B: { + int doff = p->syms[2]->u.c.v.i, soff = 0, sreg = getregnum(p->x.kids[0]); + dalign = 8; + salign = p->syms[1]->u.c.v.i; + n = p->syms[0]->u.c.v.i; + for ( ; doff <= 40 && n > 0; doff += 8) { + print("uldq $%d,%d($%d)\n", (doff/8)+16, soff, sreg); + soff += 8; + n -= 8; + } + if (n > 0) + blkcopy(30, doff - 48, sreg, soff, n, tmpregs); + break; + } + + } +} + +static void doarg(Node p) { + p->syms[2] = intconst(mkactual(8, roundup(p->syms[0]->u.c.v.i,8))); +} + +static void local(Symbol p) { + if (askregvar(p, rmap(ttob(p->type))) == 0) + mkauto(p); +} + +static int bitcount(unsigned mask) { + unsigned i, n = 0; + + for (i = 1; i; i <<= 1) + if (mask&i) + n++; + return n; +} + +static void function(Symbol f, Symbol caller[], Symbol callee[], int ncalls) { + int i, sizeargs, saved, sizefsave, sizeisave, varargs; + Symbol r, argregs[6]; + + usedmask[0] = usedmask[1] = 0; + freemask[0] = freemask[1] = ~(unsigned)0; + maxargoffset = offset = maxoffset = 0; + + for (i = 0; callee[i]; i++) + ; + varargs = variadic(f->type) + || i > 0 && strcmp(callee[i-1]->name, "va_alist") == 0; + if (varargs) + sizeargs = 2*48; + else + sizeargs = 48; + + for (i = 0; callee[i]; i++) { + Symbol p = callee[i]; + Symbol q = caller[i]; + assert(q); + if (isfloat(p->type) && varargs) { + p->x.offset = q->x.offset = offset - 2*48; + p->x.name = q->x.name = stringd(offset - 2*48); + } else { + p->x.offset = q->x.offset = offset - 48; + p->x.name = q->x.name = stringd(offset - 48); + } + offset = roundup(offset, q->type->align); + r = argreg(offset, optype(ttob(q->type))); + if (i < 6) + argregs[i] = r; + offset = roundup(offset + q->type->size, 8); + if (varargs) + p->sclass = AUTO; + else if (r && ncalls == 0 && !isstruct(q->type) && !p->addressed +) { + p->sclass = q->sclass = REGISTER; + askregvar(p, r); + assert(p->x.regnode && p->x.regnode->vbl == p); + q->x = p->x; + q->type = p->type; + } else if (askregvar(p, rmap(ttob(p->type))) + && r != NULL /* + && (isint(p->type) || p->type == q->type) */ +) { + assert(q->sclass != REGISTER); + p->sclass = q->sclass = REGISTER; + q->type = p->type; + } + + } + assert(!caller[i]); + + offset = sizeargs + 8; + gencode(caller, callee); + usedmask[IREG] &= ~(INTTMP|(0x3f<<16)|INTRET); + usedmask[FREG] &= ~(FLTTMP|(0x3f<<16)|FLTRET); + if (ncalls || usedmask[IREG] || usedmask[FREG]) + usedmask[IREG] |= 1<<26; + sizefsave = 8*bitcount(usedmask[FREG]); + sizeisave = 8*bitcount(usedmask[IREG]); + if (maxargoffset > 48) + maxargoffset -= 48; + else + maxargoffset = 0; + if (maxoffset < sizeargs) + maxoffset = sizeargs; + framesize = roundup(maxargoffset + sizefsave + sizeisave + maxoffset, 16); + segment(CODE); + print(".ent %s\n", f->x.name); + print("%s:\n", f->x.name); + print("ldgp $gp,0($27)\n"); + i = maxargoffset + sizefsave - framesize; + if (framesize > 0) + print("lda $sp,%d($sp)\n", -framesize); + if (usedmask[FREG]) + print(".fmask 0x%x,%d\n", usedmask[FREG], i - 8); + if (usedmask[IREG]) + print(".mask 0x%x,%d\n", usedmask[IREG], i + sizeisave - 8); + print(".frame $sp,%d,$26,%d\n", framesize, sizeargs); + + saved = maxargoffset; + for (i = 2; i <= 9; i++) + if (usedmask[FREG]&(1<x.regnode != callee[i]->x.regnode) { + Symbol out = callee[i]; + Symbol in = caller[i]; + int rn = r->x.regnode->number; + int rs = r->x.regnode->set; + int tyin = ttob(in->type); + + assert(out && in && r && r->x.regnode); + assert(out->sclass != REGISTER || out->x.regnode); + if (out->sclass == REGISTER) { + if (rs == FREG) + print("fmov $f%d,$f%d\n", rn, out->x.regnode->number); + else + print("mov $%d,$%d\n", rn, out->x.regnode->number); + + } else { + int off = in->x.offset + framesize; + if (rs == FREG && tyin == F+sizeop(8)) + print("stt $f%d,%d($sp)\n", rn, off); + else if (rs == FREG && tyin == F+sizeop(4)) + print("sts $f%d,%d($sp)\n", rn, off); + else { + int i, n = (in->type->size + 7)/8; + for (i = rn; i < rn+n && i <= 21; i++) + print("stq $%d,%d($sp)\n", i, off + (i-rn)*8); + } + + } + + } + } + if (varargs && callee[i-1]) { + i = callee[i-1]->x.offset + roundup(callee[i-1]->type->size, 8); + for (i = (48+i)/8; i < 6; i++) { + print("stq $%d,%d($sp)\n", i + 16, framesize - 48 + 8*i); + print("stt $f%d,%d($sp)\n", i + 16, framesize - 2*48 + 8*i); + } + } + print(".prologue 1\n"); + + emitcode(); + saved = maxargoffset; + for (i = 2; i <= 9; i++) + if (usedmask[FREG]&(1< 0) + print("lda $sp,%d($sp)\n", framesize); + print("ret\n"); + print(".end %s\n", f->x.name); + +} + +static void defconst(int suffix, int size, Value v) { + if (suffix == F && size == 4) { + float f = v.d; + print(".long 0x%x\n", *(unsigned *)&f); + } else if (suffix == F && size == 8) { + double d = v.d; + unsigned *p = (unsigned *)&d; + print(".long 0x%x\n.long 0x%x\n", p[swap], p[!swap]); + } else if (suffix == P) + print(".quad 0x%X\n", v.p); + else if (size == 1) + print(".byte 0x%x\n", suffix == I ? v.i : v.u); + else if (size == 2) + print(".word 0x%x\n", suffix == I ? v.i&0xFFFF : v.u&0xFFFF); + else if (size == 4) + print(".long 0x%x\n", suffix == I ? v.i : v.u); + else if (size == 8) + print(".quad 0x%X\n", suffix == I ? v.i : v.u); + +} + +static void defaddress(Symbol p) { + print(".quad %s\n", p->x.name); +} + +static void defstring(int n, char *str) { + char *s; + + for (s = str; s < str + n; s++) + print(".byte %d\n", (*s)&0377); +} + +static void export(Symbol p) { + print(".globl %s\n", p->x.name); +} + +static void import(Symbol p) { + if (!isfunc(p->type)) + print(".extern %s %d\n", p->name, p->type->size); +} + +static void defsymbol(Symbol p) { + if (p->scope >= LOCAL && p->sclass == STATIC) + p->x.name = stringf("L.%d", genlabel(1)); + else if (p->generated) + p->x.name = stringf("L.%s", p->name); + else + assert(p->scope != CONSTANTS || isint(p->type) || isptr(p->type)), + p->x.name = p->name; +} + +static void address(Symbol q, Symbol p, long n) { + if (p->scope == GLOBAL + || p->sclass == STATIC || p->sclass == EXTERN) + q->x.name = stringf("%s%s%D", p->x.name, + n >= 0 ? "+" : "", n); + else { + assert(n <= INT_MAX && n >= INT_MIN); + q->x.offset = p->x.offset + n; + q->x.name = stringd(q->x.offset); + } +} + +static void global(Symbol p) { + if (p->u.seg == DATA || p->u.seg == LIT) { + assert(p->type->align <= 8); + print(".align %c\n", ".01.2...3"[p->type->align]); + print("%s:\n", p->x.name); + } else if (p->sclass == STATIC || Aflag >= 2) + print(".lcomm %s,%d\n", p->x.name, p->type->size); + else + print( ".comm %s,%d\n", p->x.name, p->type->size); +} + +static void segment(int n) { + cseg = n; + switch (n) { + case DATA: print(".sdata\n"); break; + case CODE: print(".text\n"); break; + case LIT: print(".rdata\n"); break; + } +} + +static void space(int n) { + if (cseg != BSS) + print(".space %d\n", n); +} + +static void blkloop(int dreg, int doff, int sreg, int soff, int size, int tmps[]) { + int lab = genlabel(1); + + print("addq $%d,%d,$%d\n", sreg, size&~7, sreg); + print("addq $%d,%d,$%d\n", dreg, size&~7, tmps[2]); + blkcopy(tmps[2], doff, sreg, soff, size&7, tmps); + print("L.%d:\n", lab); + print("addq $%d,%d,$%d\n", sreg, -8, sreg); + print("addq $%d,%d,$%d\n", tmps[2], -8, tmps[2]); + blkcopy(tmps[2], doff, sreg, soff, 8, tmps); + print("cmpult $%d,$%d,$23\nbne $23,L.%d\n", dreg, tmps[2], lab); +} + +static void blkfetch(int size, int off, int reg, int tmp) { + assert(size == 1 || size == 2 || size == 4 || size == 8); + if (size == 1) + print("ldb $%d,%d($%d)\n", tmp, off, reg); + else if (size == 2) + print("ldw $%d,%d($%d)\n", tmp, off, reg); + else if (salign >= size && size == 4) + print("ldl $%d,%d($%d)\n", tmp, off, reg); + else if (salign >= size && size == 8) + print("ldq $%d,%d($%d)\n", tmp, off, reg); + else if (size == 4) + print("uldl $%d,%d($%d)\n", tmp, off, reg); + else + print("uldq $%d,%d($%d)\n", tmp, off, reg); +} + +static void blkstore(int size, int off, int reg, int tmp) { + assert(size == 1 || size == 2 || size == 4 || size == 8); + if (size == 1) + print("stb $%d,%d($%d)\n", tmp, off, reg); + else if (size == 2) + print("stw $%d,%d($%d)\n", tmp, off, reg); + else if (dalign >= size && size == 4) + print("stl $%d,%d($%d)\n", tmp, off, reg); + else if (dalign >= size && size == 8) + print("stq $%d,%d($%d)\n", tmp, off, reg); + else if (size == 4) + print("ustl $%d,%d($%d)\n", tmp, off, reg); + else + print("ustq $%d,%d($%d)\n", tmp, off, reg); +} + +/* stabinit - initialize stab output */ +static void stabinit(char *file, int argc, char *argv[]) { + if (file) { + print(".file 2,\"%s\"\n", file); + currentfile = file; + } +} + +/* stabline - emit stab entry for source coordinate *cp */ +static void stabline(Coordinate *cp) { + if (cp->file && cp->file != currentfile) { + print(".file 2,\"%s\"\n", cp->file); + currentfile = cp->file; + } + print(".loc 2,%d\n", cp->y); +} + +/* stabsym - output a stab entry for symbol p */ +static void stabsym(Symbol p) { + if (p == cfunc && IR->stabline) + (*IR->stabline)(&p->src); +} +Interface alphaIR = { + 1, 1, 0, /* char */ + 2, 2, 0, /* short */ + 4, 4, 0, /* int */ + 8, 8, 0, /* long */ + 8, 8, 0, /* long long */ + 4, 4, 1, /* float */ + 8, 8, 1, /* double */ + 8, 8, 1, /* long double */ + 8, 8, 0, /* T * */ + 0, 1, 0, /* struct */ + + 1, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 1, /* wants_argb */ + 1, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + address, + blockbeg, + blockend, + defaddress, + defconst, + defstring, + defsymbol, + emit, + export, + function, + gen, + global, + import, + local, + progbeg, + progend, + segment, + space, + 0, 0, 0, stabinit, stabline, stabsym, 0, + { + 1, /* max_unaligned_load */ + rmap, + blkfetch, blkstore, blkloop, + _label, + _rule, + _nts, + _kids, + _string, + _templates, + _isinstruction, + _ntname, + emit2, + doarg, + target, + clobber, + + } + +}; diff --git a/src/cmd/lccom-1/bind.c b/src/cmd/lccom-1/bind.c new file mode 100644 index 0000000..e509571 --- /dev/null +++ b/src/cmd/lccom-1/bind.c @@ -0,0 +1,40 @@ +#include "c.h" + +extern Interface symbolic64IR; +extern Interface symbolicIR; +extern Interface bytecodeIR; +extern Interface nullIR; + +extern Interface alphaIR; +extern Interface mipsebIR; +extern Interface mipselIR; +extern Interface sparcIR; +extern Interface solarisIR; +extern Interface x86IR; +extern Interface x86linuxIR; + +Binding bindings[] = { +#ifdef TARGET_ALPHA + { "alpha-osf", &alphaIR }, +#endif +#ifdef TARGET_MIPS + { "mips-eb", &mipsebIR }, + { "mips-el", &mipselIR }, +#endif +#ifdef TARGET_SPARC + { "sparc-sun", &sparcIR }, +#endif +#ifdef TARGET_SOLARIS + { "sparc-solaris", &solarisIR }, +#endif +#ifdef TARGET_X86 + { "x86-win32", &x86IR }, + { "x86-linux", &x86linuxIR }, +#endif + { "symbolic64", &symbolic64IR }, + { "symbolic", &symbolicIR }, + { "bytecode", &bytecodeIR }, + { "null", &nullIR }, + + { NULL, NULL }, +}; diff --git a/src/cmd/lccom-1/bytecode.c b/src/cmd/lccom-1/bytecode.c new file mode 100644 index 0000000..fe81e3a --- /dev/null +++ b/src/cmd/lccom-1/bytecode.c @@ -0,0 +1,287 @@ +#include "c.h" +#define I(f) b_##f + +static void I(segment)(int n) { + static int cseg; + + if (cseg != n) + switch (cseg = n) { + case CODE: print("code\n"); return; + case DATA: print("data\n"); return; + case BSS: print("bss\n"); return; + case LIT: print("lit\n"); return; + default: assert(0); + } +} + +static void I(address)(Symbol q, Symbol p, long n) { + q->x.name = stringf("%s%s%D", p->x.name, n > 0 ? "+" : "", n); +} + +static void I(defaddress)(Symbol p) { + print("address %s\n", p->x.name); +} + +static void I(defconst)(int suffix, int size, Value v) { + switch (suffix) { + case I: + if (size > sizeof (int)) + print("byte %d %D\n", size, v.i); + else + print("byte %d %d\n", size, v.i); + return; + case U: + if (size > sizeof (unsigned)) + print("byte %d %U\n", size, v.u); + else + print("byte %d %u\n", size, v.u); + return; + case P: print("byte %d %U\n", size, (unsigned long)v.p); return; + case F: + if (size == 4) { + union { + float f32; + unsigned u32; + } u; + u.f32 = v.d; + print("byte 4 %u\n", u.u32); + } else { + union { + double d64; + unsigned u32[2]; + } u; + u.d64 = v.d; + print("byte 4 %u\n", u.u32[swap]); + print("byte 4 %u\n", u.u32[1 - swap]); + } + return; + } + assert(0); +} + +static void I(defstring)(int len, char *str) { + char *s; + + for (s = str; s < str + len; s++) + print("byte 1 %d\n", (*s)&0377); +} + +static void I(defsymbol)(Symbol p) { + if (p->scope == CONSTANTS) + switch (optype(ttob(p->type))) { + case I: p->x.name = stringf("%D", p->u.c.v.i); break; + case U: p->x.name = stringf("%U", p->u.c.v.u); break; + case P: p->x.name = stringf("%U", p->u.c.v.p); break; + default: assert(0); + } + else if (p->scope >= LOCAL && p->sclass == STATIC) + p->x.name = stringf("$%d", genlabel(1)); + else if (p->scope == LABELS || p->generated) + p->x.name = stringf("$%s", p->name); + else + p->x.name = p->name; +} + +static void dumptree(Node p) { + switch (specific(p->op)) { + case ASGN+B: + assert(p->kids[0]); + assert(p->kids[1]); + assert(p->syms[0]); + dumptree(p->kids[0]); + dumptree(p->kids[1]); + print("%s %d\n", opname(p->op), p->syms[0]->u.c.v.u); + return; + case RET+V: + assert(!p->kids[0]); + assert(!p->kids[1]); + print("%s\n", opname(p->op)); + return; + } + switch (generic(p->op)) { + case CNST: case ADDRG: case ADDRF: case ADDRL: case LABEL: + assert(!p->kids[0]); + assert(!p->kids[1]); + assert(p->syms[0] && p->syms[0]->x.name); + print("%s %s\n", opname(p->op), p->syms[0]->x.name); + return; + case CVF: case CVI: case CVP: case CVU: + assert(p->kids[0]); + assert(!p->kids[1]); + assert(p->syms[0]); + dumptree(p->kids[0]); + print("%s %d\n", opname(p->op), p->syms[0]->u.c.v.i); + return; + case ARG: case BCOM: case NEG: case INDIR: case JUMP: case RET: + assert(p->kids[0]); + assert(!p->kids[1]); + dumptree(p->kids[0]); + print("%s\n", opname(p->op)); + return; + case CALL: + assert(p->kids[0]); + assert(!p->kids[1]); + assert(optype(p->op) != B); + dumptree(p->kids[0]); + print("%s\n", opname(p->op)); + return; + case ASGN: case BOR: case BAND: case BXOR: case RSH: case LSH: + case ADD: case SUB: case DIV: case MUL: case MOD: + assert(p->kids[0]); + assert(p->kids[1]); + dumptree(p->kids[0]); + dumptree(p->kids[1]); + print("%s\n", opname(p->op)); + return; + case EQ: case NE: case GT: case GE: case LE: case LT: + assert(p->kids[0]); + assert(p->kids[1]); + assert(p->syms[0]); + assert(p->syms[0]->x.name); + dumptree(p->kids[0]); + dumptree(p->kids[1]); + print("%s %s\n", opname(p->op), p->syms[0]->x.name); + return; + } + assert(0); +} + +static void I(emit)(Node p) { + for (; p; p = p->link) + dumptree(p); +} + +static void I(export)(Symbol p) { + print("export %s\n", p->x.name); +} + +static void I(function)(Symbol f, Symbol caller[], Symbol callee[], int ncalls) { + int i; + + (*IR->segment)(CODE); + offset = 0; + for (i = 0; caller[i] && callee[i]; i++) { + offset = roundup(offset, caller[i]->type->align); + caller[i]->x.name = callee[i]->x.name = stringf("%d", offset); + caller[i]->x.offset = callee[i]->x.offset = offset; + offset += caller[i]->type->size; + } + maxargoffset = maxoffset = argoffset = offset = 0; + gencode(caller, callee); + print("proc %s %d %d\n", f->x.name, maxoffset, maxargoffset); + emitcode(); + print("endproc %s %d %d\n", f->x.name, maxoffset, maxargoffset); + +} + +static void gen02(Node p) { + assert(p); + if (generic(p->op) == ARG) { + assert(p->syms[0]); + argoffset += (p->syms[0]->u.c.v.i < 4 ? 4 : p->syms[0]->u.c.v.i); + } else if (generic(p->op) == CALL) { + maxargoffset = (argoffset > maxargoffset ? argoffset : maxargoffset); + argoffset = 0; + } +} + +static void gen01(Node p) { + if (p) { + gen01(p->kids[0]); + gen01(p->kids[1]); + gen02(p); + } +} + +static Node I(gen)(Node p) { + Node q; + + assert(p); + for (q = p; q; q = q->link) + gen01(q); + return p; +} + +static void I(global)(Symbol p) { + print("align %d\n", p->type->align > 4 ? 4 : p->type->align); + print("LABELV %s\n", p->x.name); +} + +static void I(import)(Symbol p) { + print("import %s\n", p->x.name); +} + +static void I(local)(Symbol p) { + offset = roundup(offset, p->type->align); + p->x.name = stringf("%d", offset); + p->x.offset = offset; + offset += p->type->size; +} + +static void I(progbeg)(int argc, char *argv[]) {} + +static void I(progend)(void) {} + +static void I(space)(int n) { + print("skip %d\n", n); +} + +static void I(stabline)(Coordinate *cp) { + static char *prevfile; + static int prevline; + + if (cp->file && (prevfile == NULL || strcmp(prevfile, cp->file) != 0)) { + print("file \"%s\"\n", prevfile = cp->file); + prevline = 0; + } + if (cp->y != prevline) + print("line %d\n", prevline = cp->y); +} + +#define b_blockbeg blockbeg +#define b_blockend blockend + +Interface bytecodeIR = { + { 1, 1, 0 }, /* char */ + { 2, 2, 0 }, /* short */ + { 4, 4, 0 }, /* int */ + { 4, 4, 0 }, /* long */ + { 4, 4, 0 }, /* long long */ + { 4, 4, 1 }, /* float */ + { 8, 8, 1 }, /* double */ + { 8, 8, 1 }, /* long double */ + { 4, 4, 0 }, /* T* */ + { 0, 4, 0 }, /* struct */ + 0, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 0, /* wants_argb */ + 1, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + I(address), + I(blockbeg), + I(blockend), + I(defaddress), + I(defconst), + I(defstring), + I(defsymbol), + I(emit), + I(export), + I(function), + I(gen), + I(global), + I(import), + I(local), + I(progbeg), + I(progend), + I(segment), + I(space), + 0, /* I(stabblock) */ + 0, /* I(stabend) */ + 0, /* I(stabfend) */ + 0, /* I(stabinit) */ + I(stabline), + 0, /* I(stabsym) */ + 0, /* I(stabtype) */ +}; diff --git a/src/cmd/lccom-1/c.h b/src/cmd/lccom-1/c.h new file mode 100644 index 0000000..0a77860 --- /dev/null +++ b/src/cmd/lccom-1/c.h @@ -0,0 +1,598 @@ +#include +#include +#include +#include +#include +#include + +#define NEW(p,a) ((p) = allocate(sizeof *(p), (a))) +#define NEW0(p,a) memset(NEW((p),(a)), 0, sizeof *(p)) +#define isaddrop(op) (specific(op)==ADDRG+P || specific(op)==ADDRL+P \ + || specific(op)==ADDRF+P) + +#define MAXLINE 512 +#define BUFSIZE 4096 + +#define istypename(t,tsym) (kind[t] == CHAR \ + || (t == ID && tsym && tsym->sclass == TYPEDEF)) +#define sizeop(n) ((n)<<10) +#define generic(op) ((op)&0x3F0) +#define specific(op) ((op)&0x3FF) +#define opindex(op) (((op)>>4)&0x3F) +#define opkind(op) ((op)&~0x3F0) +#define opsize(op) ((op)>>10) +#define optype(op) ((op)&0xF) +#ifdef __LCC__ +#ifndef __STDC__ +#define __STDC__ +#endif +#endif +#define NELEMS(a) ((int)(sizeof (a)/sizeof ((a)[0]))) +#undef roundup +#define roundup(x,n) (((x)+((n)-1))&(~((n)-1))) +#define mkop(op,ty) (specific((op) + ttob(ty))) + +#define extend(x,ty) ((x)&(1<<(8*(ty)->size-1)) ? (x)|((~0UL)<<(8*(ty)->size-1)) : (x)&ones(8*(ty)->size)) +#define ones(n) ((n)>=8*sizeof (unsigned long) ? ~0UL : ~((~0UL)<<(n))) + +#define isqual(t) ((t)->op >= CONST) +#define unqual(t) (isqual(t) ? (t)->type : (t)) + +#define isvolatile(t) ((t)->op == VOLATILE \ + || (t)->op == CONST+VOLATILE) +#define isconst(t) ((t)->op == CONST \ + || (t)->op == CONST+VOLATILE) +#define isarray(t) (unqual(t)->op == ARRAY) +#define isstruct(t) (unqual(t)->op == STRUCT \ + || unqual(t)->op == UNION) +#define isunion(t) (unqual(t)->op == UNION) +#define isfunc(t) (unqual(t)->op == FUNCTION) +#define isptr(t) (unqual(t)->op == POINTER) +#define ischar(t) ((t)->size == 1 && isint(t)) +#define isint(t) (unqual(t)->op == INT \ + || unqual(t)->op == UNSIGNED) +#define isfloat(t) (unqual(t)->op == FLOAT) +#define isarith(t) (unqual(t)->op <= UNSIGNED) +#define isunsigned(t) (unqual(t)->op == UNSIGNED) +#define isscalar(t) (unqual(t)->op <= POINTER \ + || unqual(t)->op == ENUM) +#define isenum(t) (unqual(t)->op == ENUM) +#define fieldsize(p) (p)->bitsize +#define fieldright(p) ((p)->lsb - 1) +#define fieldleft(p) (8*(p)->type->size - \ + fieldsize(p) - fieldright(p)) +#define fieldmask(p) (~(fieldsize(p) < 8*unsignedtype->size ? ~0u< +#include +#include +#include + +struct uflash_head ufh __attribute__ ((section (".uflash_head"))) = +{ + UFLASH_MAGIC, "lccom" +}; + +/* + * C runtime startoff. When an a.out is loaded by the kernel, the kernel + * sets up the stack as follows: + * + * _________________________________ + * | (NULL) | top of memory + * |-------------------------------| + * | | + * | environment strings | + * | | + * |-------------------------------| + * | | + * | argument strings | + * | | + * |-------------------------------| + * | envv[envc] (NULL) | end of environment vector tag, a 0 + * |-------------------------------| + * | envv[envc-1] | pointer to last environment string + * |-------------------------------| + * | ... | + * |-------------------------------| + * | envv[0] | pointer to first environment string + * |-------------------------------| + * | argv[argc] (NULL) | end of argument vector tag, a 0 + * |-------------------------------| + * | argv[argc-1] | pointer to last argument string + * |-------------------------------| + * | ... | + * |-------------------------------| + * | argv[0] | pointer to first argument string + * |-------------------------------| + * | | space for fourth argument + * |-------------------------------| + * | | space for third argument + * |-------------------------------| + * | | space for second argument + * |-------------------------------| + * sp-> | | space for first + * --------------------------------- + * + * Arguments are passed in registers $a0, $a1 and $a2. + * Register $gp is set to the start of data section. + * + * Crt0 simply moves the env to environ variable, calculates + * the __progname and then calls main. + */ +extern int main (int, char ** /*, char ** */ ); + +char **environ; +const char *__progname = ""; + +void _start (int, char **, char **); + +extern void __data_start(); +extern void _etext(); + + +/* The entry function. */ +void +_start (argc, argv, env) + int argc; + char **argv; + char **env; +{ + asm volatile ("la $gp, _gp"); + + /* Copy the .data image from flash to ram. + * Linker places it at the end of .text segment. */ + extern unsigned _edata; + unsigned *src = (unsigned*) &_etext; + unsigned *dest = (unsigned*)&__data_start; + unsigned *limit = (unsigned*)&_edata; //0x7d03b554 0x7f00b550; + + + + extern char _end[]; + //extern const char *_curbrk; + //_curbrk = _end; + + _brk (_end); + + //sbrk((char*) - (char*)dest); + //brk((char*)0x7f00f000); //0x7f00c000 + + while (dest < limit) { + /*printf ("copy %08x from (%08x) to (%08x)\n", *src, src, dest);*/ + *dest++ = *src++; + } + //unsigned *bssend = (unsigned*)_end; + while( dest < (unsigned*)_end ) + *dest++ = 0; + + //printf("%p %p %p\n",(char*)&_edata,(char*)&__data_start,(char*)&_edata-(char*)&__data_start); + + environ = env; + if (argc > 0 && argv[0] != 0) { + const char *s; + + __progname = argv[0]; + for (s = __progname; *s != '\0'; s++) + if (*s == '/') + __progname = s + 1; + } + + //printf("%p %p %p %p\n",(char*)&_edata,(char*)&__data_start,(char*)&_edata-(char*)&__data_start, _end); + + exit (main (argc, argv)); +} diff --git a/src/cmd/lccom-1/dag.c b/src/cmd/lccom-1/dag.c new file mode 100644 index 0000000..6a8addb --- /dev/null +++ b/src/cmd/lccom-1/dag.c @@ -0,0 +1,741 @@ +#include "c.h" + +#define iscall(op) (generic(op) == CALL \ + || (IR->mulops_calls \ + && (generic(op)==DIV||generic(op)==MOD||generic(op)==MUL) \ + && ( optype(op)==U || optype(op)==I))) +static Node forest; +static struct dag { + struct node node; + struct dag *hlink; +} *buckets[16]; +int nodecount; +static Tree firstarg; +int assignargs = 1; +int prunetemps = -1; +static Node *tail; + +static int depth = 0; +static Node replace(Node); +static Node prune(Node); +static Node asgnnode(Symbol, Node); +static struct dag *dagnode(int, Node, Node, Symbol); +static Symbol equated(Symbol); +static void fixup(Node); +static void labelnode(int); +static void list(Node); +static void killnodes(Symbol); +static Node node(int, Node, Node, Symbol); +static void printdag1(Node, int, int); +static void printnode(Node, int, int); +static void reset(void); +static Node tmpnode(Node); +static void typestab(Symbol, void *); +static Node undag(Node); +static Node visit(Node, int); +static void unlist(void); +void walk(Tree tp, int tlab, int flab) { + listnodes(tp, tlab, flab); + if (forest) { + Node list = forest->link; + forest->link = NULL; + if (!IR->wants_dag && errcnt == 0) + list = undag(list); + code(Gen)->u.forest = list; + forest = NULL; + } + reset(); + deallocate(STMT); +} + +static Node node(int op, Node l, Node r, Symbol sym) { + int i; + struct dag *p; + + i = (opindex(op)^((unsigned long)sym>>2))&(NELEMS(buckets)-1); + for (p = buckets[i]; p; p = p->hlink) + if (p->node.op == op && p->node.syms[0] == sym + && p->node.kids[0] == l && p->node.kids[1] == r) + return &p->node; + p = dagnode(op, l, r, sym); + p->hlink = buckets[i]; + buckets[i] = p; + ++nodecount; + return &p->node; +} +static struct dag *dagnode(int op, Node l, Node r, Symbol sym) { + struct dag *p; + + NEW0(p, FUNC); + p->node.op = op; + if ((p->node.kids[0] = l) != NULL) + ++l->count; + if ((p->node.kids[1] = r) != NULL) + ++r->count; + p->node.syms[0] = sym; + return p; +} +Node newnode(int op, Node l, Node r, Symbol sym) { + return &dagnode(op, l, r, sym)->node; +} +static void killnodes(Symbol p) { + int i; + struct dag **q; + + for (i = 0; i < NELEMS(buckets); i++) + for (q = &buckets[i]; *q; ) + if (generic((*q)->node.op) == INDIR && + (!isaddrop((*q)->node.kids[0]->op) + || (*q)->node.kids[0]->syms[0] == p)) { + *q = (*q)->hlink; + --nodecount; + } else + q = &(*q)->hlink; +} +static void reset(void) { + if (nodecount > 0) + memset(buckets, 0, sizeof buckets); + nodecount = 0; +} +Node listnodes(Tree tp, int tlab, int flab) { + Node p = NULL, l, r; + int op; + + assert(tlab || flab || (tlab == 0 && flab == 0)); + if (tp == NULL) + return NULL; + if (tp->node) + return tp->node; + if (isarray(tp->type)) + op = tp->op + sizeop(voidptype->size); + else + op = tp->op + sizeop(tp->type->size); + switch (generic(tp->op)) { + case AND: { if (depth++ == 0) reset(); + if (flab) { + listnodes(tp->kids[0], 0, flab); + listnodes(tp->kids[1], 0, flab); + } else { + listnodes(tp->kids[0], 0, flab = genlabel(1)); + listnodes(tp->kids[1], tlab, 0); + labelnode(flab); + } + depth--; } break; + case OR: { if (depth++ == 0) + reset(); + if (tlab) { + listnodes(tp->kids[0], tlab, 0); + listnodes(tp->kids[1], tlab, 0); + } else { + tlab = genlabel(1); + listnodes(tp->kids[0], tlab, 0); + listnodes(tp->kids[1], 0, flab); + labelnode(tlab); + } + depth--; + } break; + case NOT: { return listnodes(tp->kids[0], flab, tlab); } + case COND: { Tree q = tp->kids[1]; + assert(tlab == 0 && flab == 0); + if (tp->u.sym) + addlocal(tp->u.sym); + flab = genlabel(2); + listnodes(tp->kids[0], 0, flab); + assert(q && q->op == RIGHT); + reset(); + listnodes(q->kids[0], 0, 0); + if (forest->op == LABEL+V) { + equatelab(forest->syms[0], findlabel(flab + 1)); + unlist(); + } + list(jump(flab + 1)); + labelnode(flab); + listnodes(q->kids[1], 0, 0); + if (forest->op == LABEL+V) { + equatelab(forest->syms[0], findlabel(flab + 1)); + unlist(); + } + labelnode(flab + 1); + + if (tp->u.sym) + p = listnodes(idtree(tp->u.sym), 0, 0); } break; + case CNST: { Type ty = unqual(tp->type); + assert(ty->u.sym); + if (tlab || flab) { + assert(ty == inttype); + if (tlab && tp->u.v.i != 0) + list(jump(tlab)); + else if (flab && tp->u.v.i == 0) + list(jump(flab)); + } + else if (ty->u.sym->addressed) + p = listnodes(cvtconst(tp), 0, 0); + else + p = node(op, NULL, NULL, constant(ty, tp->u.v)); } break; + case RIGHT: { if ( tp->kids[0] && tp->kids[1] + && generic(tp->kids[1]->op) == ASGN + && ((generic(tp->kids[0]->op) == INDIR + && tp->kids[0]->kids[0] == tp->kids[1]->kids[0]) + || (tp->kids[0]->op == FIELD + && tp->kids[0] == tp->kids[1]->kids[0]))) { + assert(tlab == 0 && flab == 0); + if (generic(tp->kids[0]->op) == INDIR) { + p = listnodes(tp->kids[0], 0, 0); + list(p); + listnodes(tp->kids[1], 0, 0); + } + else { + assert(generic(tp->kids[0]->kids[0]->op) == INDIR); + list(listnodes(tp->kids[0]->kids[0], 0, 0)); + p = listnodes(tp->kids[0], 0, 0); + listnodes(tp->kids[1], 0, 0); + } + } else if (tp->kids[1]) { + listnodes(tp->kids[0], 0, 0); + p = listnodes(tp->kids[1], tlab, flab); + } else + p = listnodes(tp->kids[0], tlab, flab); } break; + case JUMP: { assert(tlab == 0 && flab == 0); + assert(tp->u.sym == 0); + assert(tp->kids[0]); + l = listnodes(tp->kids[0], 0, 0); + list(newnode(JUMP+V, l, NULL, NULL)); + reset(); } break; + case CALL: { Tree save = firstarg; + firstarg = NULL; + assert(tlab == 0 && flab == 0); + if (tp->op == CALL+B && !IR->wants_callb) { + Tree arg0 = tree(ARG+P, tp->kids[1]->type, + tp->kids[1], NULL); + if (IR->left_to_right) + firstarg = arg0; + l = listnodes(tp->kids[0], 0, 0); + if (!IR->left_to_right || firstarg) { + firstarg = NULL; + listnodes(arg0, 0, 0); + } + p = newnode(CALL+V, l, NULL, NULL); + } else { + l = listnodes(tp->kids[0], 0, 0); + r = listnodes(tp->kids[1], 0, 0); + p = newnode(tp->op == CALL+B ? tp->op : op, l, r, NULL); + } + NEW0(p->syms[0], FUNC); + assert(isptr(tp->kids[0]->type)); + assert(isfunc(tp->kids[0]->type->type)); + p->syms[0]->type = tp->kids[0]->type->type; + list(p); + reset(); + cfunc->u.f.ncalls++; + firstarg = save; + } break; + case ARG: { assert(tlab == 0 && flab == 0); + if (IR->left_to_right) + listnodes(tp->kids[1], 0, 0); + if (firstarg) { + Tree arg = firstarg; + firstarg = NULL; + listnodes(arg, 0, 0); + } + l = listnodes(tp->kids[0], 0, 0); + list(newnode(tp->op == ARG+B ? tp->op : op, l, NULL, NULL)); + forest->syms[0] = intconst(tp->type->size); + forest->syms[1] = intconst(tp->type->align); + if (!IR->left_to_right) + listnodes(tp->kids[1], 0, 0); } break; + case EQ: case NE: case GT: case GE: case LE: + case LT: { assert(tp->u.sym == 0); + assert(errcnt || tlab || flab); + l = listnodes(tp->kids[0], 0, 0); + r = listnodes(tp->kids[1], 0, 0); + assert(errcnt || opkind(l->op) == opkind(r->op)); + assert(errcnt || optype(op) == optype(l->op)); + if (tlab) { + assert(flab == 0); + list(newnode(generic(tp->op) + opkind(l->op), l, r, findlabel(tlab))); + } else if (flab) { + switch (generic(tp->op)) { + case EQ: op = NE; break; + case NE: op = EQ; break; + case GT: op = LE; break; + case LT: op = GE; break; + case GE: op = LT; break; + case LE: op = GT; break; + default: assert(0); + } + list(newnode(op + opkind(l->op), l, r, findlabel(flab))); + } + if (forest && forest->syms[0]) + forest->syms[0]->ref++; } break; + case ASGN: { assert(tlab == 0 && flab == 0); + if (tp->kids[0]->op == FIELD) { + Tree x = tp->kids[0]->kids[0]; + Field f = tp->kids[0]->u.field; + assert(generic(x->op) == INDIR); + reset(); + l = listnodes(lvalue(x), 0, 0); + if (fieldsize(f) < 8*f->type->size) { + unsigned int fmask = fieldmask(f); + unsigned int mask = fmask<kids[1]; + if ((q->op == CNST+I && q->u.v.i == 0) || + (q->op == CNST+U && q->u.v.u == 0)) { + q = bittree(BAND, x, cnsttree(unsignedtype, (unsigned long)~mask)); + } else if ((q->op == CNST+I && (q->u.v.i&fmask) == fmask) || + (q->op == CNST+U && (q->u.v.u&fmask) == fmask)) { + q = bittree(BOR, x, cnsttree(unsignedtype, (unsigned long)mask)); + } else { + listnodes(q, 0, 0); + q = bittree(BOR, + bittree(BAND, rvalue(lvalue(x)), + cnsttree(unsignedtype, (unsigned long)~mask)), + bittree(BAND, shtree(LSH, cast(q, unsignedtype), + cnsttree(unsignedtype, (unsigned long)fieldright(f))), + cnsttree(unsignedtype, (unsigned long)mask))); + } + r = listnodes(q, 0, 0); + op = ASGN + ttob(q->type); + } else { + r = listnodes(tp->kids[1], 0, 0); + op = ASGN + ttob(tp->kids[1]->type); + } + } else { + l = listnodes(tp->kids[0], 0, 0); + r = listnodes(tp->kids[1], 0, 0); + } + list(newnode(tp->op == ASGN+B ? tp->op : op, l, r, NULL)); + forest->syms[0] = intconst(tp->kids[1]->type->size); + forest->syms[1] = intconst(tp->kids[1]->type->align); + if (isaddrop(tp->kids[0]->op) + && !tp->kids[0]->u.sym->computed) + killnodes(tp->kids[0]->u.sym); + else + reset(); + p = listnodes(tp->kids[1], 0, 0); } break; + case BOR: case BAND: case BXOR: + case ADD: case SUB: case RSH: + case LSH: { assert(tlab == 0 && flab == 0); + l = listnodes(tp->kids[0], 0, 0); + r = listnodes(tp->kids[1], 0, 0); + p = node(op, l, r, NULL); } break; + case DIV: case MUL: + case MOD: { assert(tlab == 0 && flab == 0); + l = listnodes(tp->kids[0], 0, 0); + r = listnodes(tp->kids[1], 0, 0); + p = node(op, l, r, NULL); + if (IR->mulops_calls && isint(tp->type)) { + list(p); + cfunc->u.f.ncalls++; + } } break; + case RET: { assert(tlab == 0 && flab == 0); + l = listnodes(tp->kids[0], 0, 0); + list(newnode(op, l, NULL, NULL)); } break; + case CVF: case CVI: case CVP: + case CVU: { assert(tlab == 0 && flab == 0); + assert(optype(tp->kids[0]->op) != optype(tp->op) || tp->kids[0]->type->size != tp->type->size); + l = listnodes(tp->kids[0], 0, 0); + p = node(op, l, NULL, intconst(tp->kids[0]->type->size)); + } break; + case BCOM: + case NEG: { assert(tlab == 0 && flab == 0); + l = listnodes(tp->kids[0], 0, 0); + p = node(op, l, NULL, NULL); } break; + case INDIR: { Type ty = tp->kids[0]->type; + assert(tlab == 0 && flab == 0); + l = listnodes(tp->kids[0], 0, 0); + if (isptr(ty)) + ty = unqual(ty)->type; + if (isvolatile(ty) + || (isstruct(ty) && unqual(ty)->u.sym->u.s.vfields)) + p = newnode(tp->op == INDIR+B ? tp->op : op, l, NULL, NULL); + else + p = node(tp->op == INDIR+B ? tp->op : op, l, NULL, NULL); } break; + case FIELD: { Tree q = tp->kids[0]; + if (tp->type == inttype) { + long n = fieldleft(tp->u.field); + q = shtree(RSH, + shtree(LSH, q, cnsttree(inttype, n)), + cnsttree(inttype, n + fieldright(tp->u.field))); + } else if (fieldsize(tp->u.field) < 8*tp->u.field->type->size) + q = bittree(BAND, + shtree(RSH, q, cnsttree(inttype, (long)fieldright(tp->u.field))), + cnsttree(unsignedtype, (unsigned long)fieldmask(tp->u.field))); + assert(tlab == 0 && flab == 0); + p = listnodes(q, 0, 0); } break; + case ADDRG: + case ADDRF: { assert(tlab == 0 && flab == 0); + p = node(tp->op + sizeop(voidptype->size), NULL, NULL, tp->u.sym); + } break; + case ADDRL: { assert(tlab == 0 && flab == 0); + if (tp->u.sym->generated) + addlocal(tp->u.sym); + p = node(tp->op + sizeop(voidptype->size), NULL, NULL, tp->u.sym); } break; + default:assert(0); + } + tp->node = p; + return p; +} +static void list(Node p) { + if (p && p->link == NULL) { + if (forest) { + p->link = forest->link; + forest->link = p; + } else + p->link = p; + forest = p; + } +} +static void labelnode(int lab) { + assert(lab); + if (forest && forest->op == LABEL+V) + equatelab(findlabel(lab), forest->syms[0]); + else + list(newnode(LABEL+V, NULL, NULL, findlabel(lab))); + reset(); +} +static void unlist(void) { + Node p; + + assert(forest); + assert(forest != forest->link); + p = forest->link; + while (p->link != forest) + p = p->link; + p->link = forest->link; + forest = p; +} +Tree cvtconst(Tree p) { + Symbol q = constant(p->type, p->u.v); + Tree e; + + if (q->u.c.loc == NULL) + q->u.c.loc = genident(STATIC, p->type, GLOBAL); + if (isarray(p->type)) { + e = simplify(ADDRG, atop(p->type), NULL, NULL); + e->u.sym = q->u.c.loc; + } else + e = idtree(q->u.c.loc); + return e; +} +void gencode(Symbol caller[], Symbol callee[]) { + Code cp; + Coordinate save; + + if (prunetemps == -1) + prunetemps = !IR->wants_dag; + save = src; + if (assignargs) { + int i; + Symbol p, q; + cp = codehead.next->next; + codelist = codehead.next; + for (i = 0; (p = callee[i]) != NULL + && (q = caller[i]) != NULL; i++) + if (p->sclass != q->sclass || p->type != q->type) + walk(asgn(p, idtree(q)), 0, 0); + codelist->next = cp; + cp->prev = codelist; + } + if (glevel && IR->stabsym) { + int i; + Symbol p, q; + for (i = 0; (p = callee[i]) != NULL + && (q = caller[i]) != NULL; i++) { + (*IR->stabsym)(p); + if (p->sclass != q->sclass || p->type != q->type) + (*IR->stabsym)(q); + } + swtoseg(CODE); + } + cp = codehead.next; + for ( ; errcnt <= 0 && cp; cp = cp->next) + switch (cp->kind) { + case Address: assert(IR->address); + (*IR->address)(cp->u.addr.sym, cp->u.addr.base, + cp->u.addr.offset); break; + case Blockbeg: { + Symbol *p = cp->u.block.locals; + (*IR->blockbeg)(&cp->u.block.x); + for ( ; *p; p++) + if ((*p)->ref != 0.0) + (*IR->local)(*p); + else if (glevel) (*IR->local)(*p); + } + break; + case Blockend: (*IR->blockend)(&cp->u.begin->u.block.x); break; + case Defpoint: src = cp->u.point.src; break; + case Gen: case Jump: + case Label: if (prunetemps) + cp->u.forest = prune(cp->u.forest); + fixup(cp->u.forest); + cp->u.forest = (*IR->gen)(cp->u.forest); break; + case Local: (*IR->local)(cp->u.var); break; + case Switch: break; + default: assert(0); + } + src = save; +} +static void fixup(Node p) { + for ( ; p; p = p->link) + switch (generic(p->op)) { + case JUMP: + if (specific(p->kids[0]->op) == ADDRG+P) + p->kids[0]->syms[0] = + equated(p->kids[0]->syms[0]); + break; + case LABEL: assert(p->syms[0] == equated(p->syms[0])); break; + case EQ: case GE: case GT: case LE: case LT: case NE: + assert(p->syms[0]); + p->syms[0] = equated(p->syms[0]); + } +} +static Symbol equated(Symbol p) { + { Symbol q; for (q = p->u.l.equatedto; q; q = q->u.l.equatedto) assert(p != q); } + while (p->u.l.equatedto) + p = p->u.l.equatedto; + return p; +} +void emitcode(void) { + Code cp; + Coordinate save; + + save = src; + cp = codehead.next; + for ( ; errcnt <= 0 && cp; cp = cp->next) + switch (cp->kind) { + case Address: break; + case Blockbeg: if (glevel && IR->stabblock) { + (*IR->stabblock)('{', cp->u.block.level - LOCAL, cp->u.block.locals); + swtoseg(CODE); + } + break; + case Blockend: if (glevel && IR->stabblock) { + Code bp = cp->u.begin; + foreach(bp->u.block.identifiers, bp->u.block.level, typestab, NULL); + foreach(bp->u.block.types, bp->u.block.level, typestab, NULL); + (*IR->stabblock)('}', bp->u.block.level - LOCAL, bp->u.block.locals); + swtoseg(CODE); + } + break; + case Defpoint: src = cp->u.point.src; + if (glevel > 0 && IR->stabline) { + (*IR->stabline)(&cp->u.point.src); swtoseg(CODE); } break; + case Gen: case Jump: + case Label: if (cp->u.forest) + (*IR->emit)(cp->u.forest); break; + case Local: if (glevel && IR->stabsym) { + (*IR->stabsym)(cp->u.var); + swtoseg(CODE); + } break; + case Switch: { int i; + defglobal(cp->u.swtch.table, LIT); + (*IR->defaddress)(equated(cp->u.swtch.labels[0])); + for (i = 1; i < cp->u.swtch.size; i++) { + long k = cp->u.swtch.values[i-1]; + while (++k < cp->u.swtch.values[i]) { + assert(k < LONG_MAX); + (*IR->defaddress)(equated(cp->u.swtch.deflab)); + } + (*IR->defaddress)(equated(cp->u.swtch.labels[i])); + } + swtoseg(CODE); + } break; + default: assert(0); + } + src = save; +} + +static Node undag(Node forest) { + Node p; + + tail = &forest; + for (p = forest; p; p = p->link) + if (generic(p->op) == INDIR) { + assert(p->count >= 1); + visit(p, 1); + if (p->syms[2]) { + assert(p->syms[2]->u.t.cse); + p->syms[2]->u.t.cse = NULL; + addlocal(p->syms[2]); + } + } else if (iscall(p->op) && p->count >= 1) + visit(p, 1); + else { + assert(p->count == 0); + visit(p, 1); + *tail = p; + tail = &p->link; + } + *tail = NULL; + return forest; +} +static Node replace(Node p) { + if (p && ( generic(p->op) == INDIR + && generic(p->kids[0]->op) == ADDRL + && p->kids[0]->syms[0]->temporary + && p->kids[0]->syms[0]->u.t.replace)) { + p = p->kids[0]->syms[0]->u.t.cse; + if (generic(p->op) == INDIR && isaddrop(p->kids[0]->op)) + p = newnode(p->op, newnode(p->kids[0]->op, NULL, NULL, + p->kids[0]->syms[0]), NULL, NULL); + else if (generic(p->op) == ADDRG) + p = newnode(p->op, NULL, NULL, p->syms[0]); + else + assert(0); + p->count = 1; + } else if (p) { + p->kids[0] = replace(p->kids[0]); + p->kids[1] = replace(p->kids[1]); + } + return p; +} +static Node prune(Node forest) { + Node p, *tail = &forest; + int count = 0; + + for (p = forest; p; p = p->link) { + if (count > 0) { + p->kids[0] = replace(p->kids[0]); + p->kids[1] = replace(p->kids[1]); + } + if (( generic(p->op) == ASGN + && generic(p->kids[0]->op) == ADDRL + && p->kids[0]->syms[0]->temporary + && p->kids[0]->syms[0]->u.t.cse == p->kids[1])) { + Symbol tmp = p->kids[0]->syms[0]; + if (!tmp->defined) + (*IR->local)(tmp); + tmp->defined = 1; + if (( generic(p->kids[1]->op) == INDIR + && isaddrop(p->kids[1]->kids[0]->op) + && p->kids[1]->kids[0]->syms[0]->sclass == REGISTER) + || (( generic(p->kids[1]->op) == INDIR + && isaddrop(p->kids[1]->kids[0]->op)) && tmp->sclass == AUTO) + || (generic(p->kids[1]->op) == ADDRG && tmp->sclass == AUTO)) { + tmp->u.t.replace = 1; + count++; + continue; /* and omit the assignment */ + } + } + /* keep the assignment and other roots */ + *tail = p; + tail = &(*tail)->link; + } + assert(*tail == NULL); + return forest; +} + +static Node visit(Node p, int listed) +{ + if (p) { + if (p->syms[2]) { + p = tmpnode(p); + + } else if ((p->count <= 1 && !iscall(p->op)) || + (p->count == 0 && iscall(p->op))) { + p->kids[0] = visit(p->kids[0], 0); + p->kids[1] = visit(p->kids[1], 0); + } + else if (specific(p->op) == ADDRL+P || specific(p->op) == ADDRF+P) { + assert(!listed); + p = newnode(p->op, NULL, NULL, p->syms[0]); + p->count = 1; + } + else if (p->op == INDIR+B) { + p = newnode(p->op, p->kids[0], NULL, NULL); + p->count = 1; + p->kids[0] = visit(p->kids[0], 0); + p->kids[1] = visit(p->kids[1], 0); + } + else { + p->kids[0] = visit(p->kids[0], 0); + p->kids[1] = visit(p->kids[1], 0); + p->syms[2] = temporary(REGISTER, btot(p->op, opsize(p->op))); + assert(!p->syms[2]->defined); + p->syms[2]->ref = 1; + p->syms[2]->u.t.cse = p; + + *tail = asgnnode(p->syms[2], p); + tail = &(*tail)->link; + if (!listed) + p = tmpnode(p); + } + } + return p; +} +static Node tmpnode(Node p) { + Symbol tmp = p->syms[2]; + + assert(tmp); + if (--p->count == 0) + p->syms[2] = NULL; + p = newnode(INDIR + ttob(tmp->type), + newnode(ADDRL + ttob(voidptype), NULL, NULL, tmp), NULL, NULL); + p->count = 1; + return p; +} +static Node asgnnode(Symbol tmp, Node p) { + p = newnode(ASGN + ttob(tmp->type), + newnode(ADDRL + ttob(voidptype), NULL, NULL, tmp), p, NULL); + p->syms[0] = intconst(tmp->type->size); + p->syms[1] = intconst(tmp->type->align); + return p; +} +/* printdag - print dag p on fd, or the node list if p == 0 */ +void printdag(Node p, int fd) { + FILE *f = fd == 1 ? stdout : stderr; + + printed(0); + if (p == 0) { + if ((p = forest) != NULL) + do { + p = p->link; + printdag1(p, fd, 0); + } while (p != forest); + } else if (*printed(nodeid((Tree)p))) + fprint(f, "node'%d printed above\n", nodeid((Tree)p)); + else + printdag1(p, fd, 0); +} + +/* printdag1 - recursively print dag p */ +static void printdag1(Node p, int fd, int lev) { + int id, i; + + if (p == 0 || *printed(id = nodeid((Tree)p))) + return; + *printed(id) = 1; + for (i = 0; i < NELEMS(p->kids); i++) + printdag1(p->kids[i], fd, lev + 1); + printnode(p, fd, lev); +} + +/* printnode - print fields of dag p */ +static void printnode(Node p, int fd, int lev) { + if (p) { + FILE *f = fd == 1 ? stdout : stderr; + int i, id = nodeid((Tree)p); + fprint(f, "%c%d%s", lev == 0 ? '\'' : '#', id, + &" "[id < 10 ? 0 : id < 100 ? 1 : 2]); + fprint(f, "%s count=%d", opname(p->op), p->count); + for (i = 0; i < NELEMS(p->kids) && p->kids[i]; i++) + fprint(f, " #%d", nodeid((Tree)p->kids[i])); + if (generic(p->op) == CALL && p->syms[0] && p->syms[0]->type) + fprint(f, " {%t}", p->syms[0]->type); + else + for (i = 0; i < NELEMS(p->syms) && p->syms[i]; i++) + if (p->syms[i]->name) + fprint(f, " %s", p->syms[i]->name); + else + fprint(f, " %p", p->syms[i]); + fprint(f, "\n"); + } +} + +/* typestab - emit stab entries for p */ +static void typestab(Symbol p, void *cl) { + if (!isfunc(p->type) && (p->sclass == EXTERN || p->sclass == STATIC) && IR->stabsym) + (*IR->stabsym)(p); + else if ((p->sclass == TYPEDEF || p->sclass == 0) && IR->stabtype) + (*IR->stabtype)(p); +} diff --git a/src/cmd/lccom-1/dagcheck.md b/src/cmd/lccom-1/dagcheck.md new file mode 100644 index 0000000..5be0523 --- /dev/null +++ b/src/cmd/lccom-1/dagcheck.md @@ -0,0 +1,212 @@ +%{ +#include "c.h" +typedef Node NODEPTR_TYPE; +#define OP_LABEL(p) (specific((p)->op)) +#define LEFT_CHILD(p) ((p)->kids[0]) +#define RIGHT_CHILD(p) ((p)->kids[1]) +#define STATE_LABEL(p) ((p)->x.state) +#define PANIC error +%} +%term CNSTF=17 CNSTI=21 CNSTP=23 CNSTU=22 +%term ARGB=41 ARGF=33 ARGI=37 ARGP=39 ARGU=38 +%term ASGNB=57 ASGNF=49 ASGNI=53 ASGNP=55 ASGNU=54 +%term INDIRB=73 INDIRF=65 INDIRI=69 INDIRP=71 INDIRU=70 +%term CVFF=113 CVFI=117 +%term CVIF=129 CVII=133 CVIU=134 +%term CVPP=151 CVPU=150 +%term CVUI=181 CVUP=183 CVUU=182 +%term NEGF=193 NEGI=197 +%term CALLB=217 CALLF=209 CALLI=213 CALLP=215 CALLU=214 CALLV=216 +%term RETF=241 RETI=245 RETP=247 RETU=246 RETV=248 +%term ADDRGP=263 +%term ADDRFP=279 +%term ADDRLP=295 +%term ADDF=305 ADDI=309 ADDP=311 ADDU=310 +%term SUBF=321 SUBI=325 SUBP=327 SUBU=326 +%term LSHI=341 LSHU=342 +%term MODI=357 MODU=358 +%term RSHI=373 RSHU=374 +%term BANDI=389 BANDU=390 +%term BCOMI=405 BCOMU=406 +%term BORI=421 BORU=422 +%term BXORI=437 BXORU=438 +%term DIVF=449 DIVI=453 DIVU=454 +%term MULF=465 MULI=469 MULU=470 +%term EQF=481 EQI=485 EQU=486 +%term GEF=497 GEI=501 GEU=502 +%term GTF=513 GTI=517 GTU=518 +%term LEF=529 LEI=533 LEU=534 +%term LTF=545 LTI=549 LTU=550 +%term NEF=561 NEI=565 NEU=566 +%term JUMPV=584 +%term LABELV=600 +%% +stmt: INDIRB(P) "" +stmt: INDIRF(P) "" +stmt: INDIRI(P) "" +stmt: INDIRU(P) "" +stmt: INDIRP(P) "" +stmt: CALLF(P) "" +stmt: CALLI(P) "" +stmt: CALLU(P) "" +stmt: CALLP(P) "" +stmt: V "" +bogus: I "" 1 +bogus: U "" 1 +bogus: P "" 1 +bogus: F "" 1 +bogus: B "" 1 +bogus: V "" 1 +I: bogus "" 1 +U: bogus "" 1 +P: bogus "" 1 +F: bogus "" 1 +B: bogus "" 1 +V: bogus "" 1 +F: CNSTF "" +I: CNSTI "" +P: CNSTP "" +U: CNSTU "" +V: ARGB(B) "" +V: ARGF(F) "" +V: ARGI(I) "" +V: ARGU(U) "" +V: ARGP(P) "" +V: ASGNB(P,B) "" +V: ASGNF(P,F) "" +V: ASGNI(P,I) "" +V: ASGNU(P,U) "" +V: ASGNP(P,P) "" +B: INDIRB(P) "" +F: INDIRF(P) "" +I: INDIRI(P) "" +U: INDIRU(P) "" +P: INDIRP(P) "" +I: CVII(I) "" +I: CVUI(U) "" +I: CVFI(F) "" +U: CVIU(I) "" +U: CVUU(U) "" +U: CVPU(P) "" +F: CVIF(I) "" +F: CVFF(F) "" +P: CVUP(U) "" +P: CVPP(P) "" +F: NEGF(F) "" +I: NEGI(I) "" +V: CALLB(P,P) "" +F: CALLF(P) "" +I: CALLI(P) "" +U: CALLU(P) "" +P: CALLP(P) "" +V: CALLV(P) "" +V: RETF(F) "" +V: RETI(I) "" +V: RETU(U) "" +V: RETP(P) "" +V: RETV "" +P: ADDRGP "" +P: ADDRFP "" +P: ADDRLP "" +F: ADDF(F,F) "" +I: ADDI(I,I) "" +P: ADDP(P,I) "" +P: ADDP(I,P) "" +P: ADDP(U,P) "" +P: ADDP(P,U) "" +U: ADDU(U,U) "" +F: SUBF(F,F) "" +I: SUBI(I,I) "" +P: SUBP(P,I) "" +P: SUBP(P,U) "" +U: SUBU(U,U) "" +I: LSHI(I,I) "" +U: LSHU(U,I) "" +I: MODI(I,I) "" +U: MODU(U,U) "" +I: RSHI(I,I) "" +U: RSHU(U,I) "" +U: BANDU(U,U) "" +I: BANDI(I,I) "" +U: BCOMU(U) "" +I: BCOMI(I) "" +I: BORI(I,I) "" +U: BORU(U,U) "" +U: BXORU(U,U) "" +I: BXORI(I,I) "" +F: DIVF(F,F) "" +I: DIVI(I,I) "" +U: DIVU(U,U) "" +F: MULF(F,F) "" +I: MULI(I,I) "" +U: MULU(U,U) "" +V: EQF(F,F) "" +V: EQI(I,I) "" +V: EQU(U,U) "" +V: GEF(F,F) "" +V: GEI(I,I) "" +V: GEU(U,U) "" +V: GTF(F,F) "" +V: GTI(I,I) "" +V: GTU(U,U) "" +V: LEF(F,F) "" +V: LEI(I,I) "" +V: LEU(U,U) "" +V: LTF(F,F) "" +V: LTI(I,I) "" +V: LTU(U,U) "" +V: NEF(F,F) "" +V: NEI(I,I) "" +V: NEU(U,U) "" +V: JUMPV(P) "" +V: LABELV "" +%% + +static void reduce(NODEPTR_TYPE p, int goalnt) { + int i, sz = opsize(p->op), rulenumber = _rule(p->x.state, goalnt); + short *nts = _nts[rulenumber]; + NODEPTR_TYPE kids[10]; + + assert(rulenumber); + _kids(p, rulenumber, kids); + for (i = 0; nts[i]; i++) + reduce(kids[i], nts[i]); + switch (optype(p->op)) { +#define xx(ty) if (sz == ty->size) return + case I: + case U: + xx(chartype); + xx(shorttype); + xx(inttype); + xx(longtype); + xx(longlong); + xx(signedptr); + xx(unsignedptr); + break; + case F: + xx(floattype); + xx(doubletype); + xx(longdouble); + break; + case P: + xx(voidptype); + xx(funcptype); + break; + case V: + case B: if (sz == 0) return; +#undef xx + } + printdag(p, 2); + assert(0); +} + +void check(Node p) { + struct _state { short cost[1]; }; + + _label(p); + if (((struct _state *)p->x.state)->cost[1] > 0) { + printdag(p, 2); + assert(0); + } + reduce(p, 1); +} diff --git a/src/cmd/lccom-1/decl.c b/src/cmd/lccom-1/decl.c new file mode 100644 index 0000000..dc55021 --- /dev/null +++ b/src/cmd/lccom-1/decl.c @@ -0,0 +1,1174 @@ +#include "c.h" + +#define add(x,n) (x > inttype->u.sym->u.limits.max.i-(n) ? (overflow=1,x) : x+(n)) +#define chkoverflow(x,n) ((void)add(x,n)) +#define bits2bytes(n) (((n) + 7)/8) +static int regcount; + +static List autos, registers; +Symbol cfunc; /* current function */ +Symbol retv; /* return value location for structs */ + +static void checkref(Symbol, void *); +static Symbol dclglobal(int, char *, Type, Coordinate *); +static Symbol dcllocal(int, char *, Type, Coordinate *); +static Symbol dclparam(int, char *, Type, Coordinate *); +static Type dclr(Type, char **, Symbol **, int); +static Type dclr1(char **, Symbol **, int); +static void decl(Symbol (*)(int, char *, Type, Coordinate *)); +extern void doconst(Symbol, void *); +static void doglobal(Symbol, void *); +static void doextern(Symbol, void *); +static void exitparams(Symbol []); +static void fields(Type); +static void funcdefn(int, char *, Type, Symbol [], Coordinate); +static void initglobal(Symbol, int); +static void oldparam(Symbol, void *); +static Symbol *parameters(Type); +static Type specifier(int *); +static Type structdcl(int); +static Type tnode(int, Type); +void program(void) { + int n; + + level = GLOBAL; + for (n = 0; t != EOI; n++) + if (kind[t] == CHAR || kind[t] == STATIC + || t == ID || t == '*' || t == '(') { + decl(dclglobal); + deallocate(STMT); + if (!(glevel >= 3 || xref)) + deallocate(FUNC); + } else if (t == ';') { + warning("empty declaration\n"); + t = gettok(); + } else { + error("unrecognized declaration\n"); + t = gettok(); + } + if (n == 0) + warning("empty input file\n"); +} +static Type specifier(int *sclass) { + int cls, cons, sign, size, type, vol; + Type ty = NULL; + + cls = vol = cons = sign = size = type = 0; + if (sclass == NULL) + cls = AUTO; + for (;;) { + int *p, tt = t; + switch (t) { + case AUTO: + case REGISTER: if (level <= GLOBAL && cls == 0) + error("invalid use of `%k'\n", t); + p = &cls; t = gettok(); break; + case STATIC: case EXTERN: + case TYPEDEF: p = &cls; t = gettok(); break; + case CONST: p = &cons; t = gettok(); break; + case VOLATILE: p = &vol; t = gettok(); break; + case SIGNED: + case UNSIGNED: p = &sign; t = gettok(); break; + case LONG: if (size == LONG) { + size = 0; + tt = LONG+LONG; + } + p = &size; t = gettok(); break; + case SHORT: p = &size; t = gettok(); break; + case VOID: case CHAR: case INT: case FLOAT: + case DOUBLE: p = &type; ty = tsym->type; + t = gettok(); break; + case ENUM: p = &type; ty = enumdcl(); break; + case STRUCT: + case UNION: p = &type; ty = structdcl(t); break; + case ID: + if (istypename(t, tsym) && type == 0 + && sign == 0 && size == 0) { + use(tsym, src); + ty = tsym->type; + if (isqual(ty) + && ty->size != ty->type->size) { + ty = unqual(ty); + if (isconst(tsym->type)) + ty = qual(CONST, ty); + if (isvolatile(tsym->type)) + ty = qual(VOLATILE, ty); + tsym->type = ty; + } + p = &type; + t = gettok(); + } else + p = NULL; + break; + default: p = NULL; + } + if (p == NULL) + break; + if (*p) + error("invalid use of `%k'\n", tt); + *p = tt; + } + if (sclass) + *sclass = cls; + if (type == 0) { + type = INT; + ty = inttype; + } + if ((size == SHORT && type != INT) + || (size == LONG+LONG && type != INT) + || (size == LONG && type != INT && type != DOUBLE) + || (sign && type != INT && type != CHAR)) + error("invalid type specification\n"); + if (type == CHAR && sign) + ty = sign == UNSIGNED ? unsignedchar : signedchar; + else if (size == SHORT) + ty = sign == UNSIGNED ? unsignedshort : shorttype; + else if (size == LONG && type == DOUBLE) + ty = longdouble; + else if (size == LONG+LONG) { + ty = sign == UNSIGNED ? unsignedlonglong : longlong; + if (Aflag >= 1) + warning("`%t' is a non-ANSI type\n", ty); + } else if (size == LONG) + ty = sign == UNSIGNED ? unsignedlong : longtype; + else if (sign == UNSIGNED && type == INT) + ty = unsignedtype; + if (cons == CONST) + ty = qual(CONST, ty); + if (vol == VOLATILE) + ty = qual(VOLATILE, ty); + return ty; +} +static void decl(Symbol (*dcl)(int, char *, Type, Coordinate *)) { + int sclass; + Type ty, ty1; + static char stop[] = { CHAR, STATIC, ID, 0 }; + + ty = specifier(&sclass); + if (t == ID || t == '*' || t == '(' || t == '[') { + char *id; + Coordinate pos; + id = NULL; + pos = src; + if (level == GLOBAL) { + Symbol *params = NULL; + ty1 = dclr(ty, &id, ¶ms, 0); + if (params && id && isfunc(ty1) + && (t == '{' || istypename(t, tsym) + || (kind[t] == STATIC && t != TYPEDEF))) { + if (sclass == TYPEDEF) { + error("invalid use of `typedef'\n"); + sclass = EXTERN; + } + if (ty1->u.f.oldstyle) + exitscope(); + funcdefn(sclass, id, ty1, params, pos); + return; + } else if (params) + exitparams(params); + } else + ty1 = dclr(ty, &id, NULL, 0); + for (;;) { + if (Aflag >= 1 && !hasproto(ty1)) + warning("missing prototype\n"); + if (id == NULL) + error("missing identifier\n"); + else if (sclass == TYPEDEF) + { + Symbol p = lookup(id, identifiers); + if (p && p->scope == level) + error("redeclaration of `%s'\n", id); + p = install(id, &identifiers, level, + level < LOCAL ? PERM : FUNC); + p->type = ty1; + p->sclass = TYPEDEF; + p->src = pos; + } + else + (void)(*dcl)(sclass, id, ty1, &pos); + if (t != ',') + break; + t = gettok(); + id = NULL; + pos = src; + ty1 = dclr(ty, &id, NULL, 0); + } + } else if (ty == NULL + || ! (isenum(ty) || + (isstruct(ty) && (*unqual(ty)->u.sym->name < '1' || *unqual(ty)->u.sym->name > '9')))) + error("empty declaration\n"); + test(';', stop); +} +static Symbol dclglobal(int sclass, char *id, Type ty, Coordinate *pos) { + Symbol p; + + if (sclass == 0) + sclass = AUTO; + else if (sclass != EXTERN && sclass != STATIC) { + error("invalid storage class `%k' for `%t %s'\n", + sclass, ty, id); + sclass = AUTO; + } + p = lookup(id, identifiers); + if (p && p->scope == GLOBAL) { + if (p->sclass != TYPEDEF && eqtype(ty, p->type, 1)) + ty = compose(ty, p->type); + else + error("redeclaration of `%s' previously declared at %w\n", p->name, &p->src); + + if (!isfunc(ty) && p->defined && t == '=') + error("redefinition of `%s' previously defined at %w\n", p->name, &p->src); + + if ((p->sclass == EXTERN && sclass == STATIC) + || (p->sclass == STATIC && sclass == AUTO) + || (p->sclass == AUTO && sclass == STATIC)) + warning("inconsistent linkage for `%s' previously declared at %w\n", p->name, &p->src); + + } + if (p == NULL || p->scope != GLOBAL) { + Symbol q = lookup(id, externals); + if (q) { + if (sclass == STATIC || !eqtype(ty, q->type, 1)) + warning("declaration of `%s' does not match previous declaration at %w\n", id, &q->src); + + p = relocate(id, externals, globals); + p->sclass = sclass; + } else { + p = install(id, &globals, GLOBAL, PERM); + p->sclass = sclass; + (*IR->defsymbol)(p); + } + if (p->sclass != STATIC) { + static int nglobals; + nglobals++; + if (Aflag >= 2 && nglobals == 512) + warning("more than 511 external identifiers\n"); + } + } else if (p->sclass == EXTERN) + p->sclass = sclass; + p->type = ty; + p->src = *pos; + if (t == '=' && isfunc(p->type)) { + error("illegal initialization for `%s'\n", p->name); + t = gettok(); + initializer(p->type, 0); + } else if (t == '=') { + initglobal(p, 0); + if (glevel > 0 && IR->stabsym) { + (*IR->stabsym)(p); swtoseg(p->u.seg); } + } else if (p->sclass == STATIC && !isfunc(p->type) + && p->type->size == 0) + error("undefined size for `%t %s'\n", p->type, p->name); + return p; +} +static void initglobal(Symbol p, int flag) { + Type ty; + + if (t == '=' || flag) { + if (p->sclass == STATIC) { + for (ty = p->type; isarray(ty); ty = ty->type) + ; + defglobal(p, isconst(ty) ? LIT : DATA); + } else + defglobal(p, DATA); + if (t == '=') + t = gettok(); + ty = initializer(p->type, 0); + if (isarray(p->type) && p->type->size == 0) + p->type = ty; + if (p->sclass == EXTERN) + p->sclass = AUTO; + } +} +void defglobal(Symbol p, int seg) { + p->u.seg = seg; + swtoseg(p->u.seg); + if (p->sclass != STATIC) + (*IR->export)(p); + (*IR->global)(p); + p->defined = 1; +} + +static Type dclr(Type basety, char **id, Symbol **params, int abstract) { + Type ty = dclr1(id, params, abstract); + + for ( ; ty; ty = ty->type) + switch (ty->op) { + case POINTER: + basety = ptr(basety); + break; + case FUNCTION: + basety = func(basety, ty->u.f.proto, + ty->u.f.oldstyle); + break; + case ARRAY: + basety = array(basety, ty->size, 0); + break; + case CONST: case VOLATILE: + basety = qual(ty->op, basety); + break; + default: assert(0); + } + if (Aflag >= 2 && basety->size > 32767) + warning("more than 32767 bytes in `%t'\n", basety); + return basety; +} +static Type tnode(int op, Type type) { + Type ty; + + NEW0(ty, STMT); + ty->op = op; + ty->type = type; + return ty; +} +static Type dclr1(char **id, Symbol **params, int abstract) { + Type ty = NULL; + + switch (t) { + case ID: if (id) + *id = token; + else + error("extraneous identifier `%s'\n", token); + t = gettok(); break; + case '*': t = gettok(); if (t == CONST || t == VOLATILE) { + Type ty1; + ty1 = ty = tnode(t, NULL); + while ((t = gettok()) == CONST || t == VOLATILE) + ty1 = tnode(t, ty1); + ty->type = dclr1(id, params, abstract); + ty = ty1; + } else + ty = dclr1(id, params, abstract); + ty = tnode(POINTER, ty); break; + case '(': t = gettok(); if (abstract + && (t == REGISTER || istypename(t, tsym) || t == ')')) { + Symbol *args; + ty = tnode(FUNCTION, ty); + enterscope(); + if (level > PARAM) + enterscope(); + args = parameters(ty); + exitparams(args); + } else { + ty = dclr1(id, params, abstract); + expect(')'); + if (abstract && ty == NULL + && (id == NULL || *id == NULL)) + return tnode(FUNCTION, NULL); + } break; + case '[': break; + default: return ty; + } + while (t == '(' || t == '[') + switch (t) { + case '(': t = gettok(); { Symbol *args; + ty = tnode(FUNCTION, ty); + enterscope(); + if (level > PARAM) + enterscope(); + args = parameters(ty); + if (params && *params == NULL) + *params = args; + else + exitparams(args); + } + break; + case '[': t = gettok(); { int n = 0; + if (kind[t] == ID) { + n = intexpr(']', 1); + if (n <= 0) { + error("`%d' is an illegal array size\n", n); + n = 1; + } + } else + expect(']'); + ty = tnode(ARRAY, ty); + ty->size = n; } break; + default: assert(0); + } + return ty; +} +static Symbol *parameters(Type fty) { + List list = NULL; + Symbol *params; + + if (kind[t] == STATIC || istypename(t, tsym)) { + int n = 0; + Type ty1 = NULL; + for (;;) { + Type ty; + int sclass = 0; + char *id = NULL; + if (ty1 && t == ELLIPSIS) { + static struct symbol sentinel; + if (sentinel.type == NULL) { + sentinel.type = voidtype; + sentinel.defined = 1; + } + if (ty1 == voidtype) + error("illegal formal parameter types\n"); + list = append(&sentinel, list); + t = gettok(); + break; + } + if (!istypename(t, tsym) && t != REGISTER) + error("missing parameter type\n"); + n++; + ty = dclr(specifier(&sclass), &id, NULL, 1); + if ((ty == voidtype && (ty1 || id)) + || ty1 == voidtype) + error("illegal formal parameter types\n"); + if (id == NULL) + id = stringd(n); + if (ty != voidtype) + list = append(dclparam(sclass, id, ty, &src), list); + if (Aflag >= 1 && !hasproto(ty)) + warning("missing prototype\n"); + if (ty1 == NULL) + ty1 = ty; + if (t != ',') + break; + t = gettok(); + } + fty->u.f.proto = newarray(length(list) + 1, + sizeof (Type *), PERM); + params = ltov(&list, FUNC); + for (n = 0; params[n]; n++) + fty->u.f.proto[n] = params[n]->type; + fty->u.f.proto[n] = NULL; + fty->u.f.oldstyle = 0; + } else { + if (t == ID) + for (;;) { + Symbol p; + if (t != ID) { + error("expecting an identifier\n"); + break; + } + p = dclparam(0, token, inttype, &src); + p->defined = 0; + list = append(p, list); + t = gettok(); + if (t != ',') + break; + t = gettok(); + } + params = ltov(&list, FUNC); + fty->u.f.proto = NULL; + fty->u.f.oldstyle = 1; + } + if (t != ')') { + static char stop[] = { CHAR, STATIC, IF, ')', 0 }; + expect(')'); + skipto('{', stop); + } + if (t == ')') + t = gettok(); + return params; +} +static void exitparams(Symbol params[]) { + assert(params); + if (params[0] && !params[0]->defined) + error("extraneous old-style parameter list\n"); + if (level > PARAM) + exitscope(); + exitscope(); +} + +static Symbol dclparam(int sclass, char *id, Type ty, Coordinate *pos) { + Symbol p; + + if (isfunc(ty)) + ty = ptr(ty); + else if (isarray(ty)) + ty = atop(ty); + if (sclass == 0) + sclass = AUTO; + else if (sclass != REGISTER) { + error("invalid storage class `%k' for `%t%s\n", + sclass, ty, stringf(id ? " %s'" : "' parameter", id)); + sclass = AUTO; + } else if (isvolatile(ty) || isstruct(ty)) { + warning("register declaration ignored for `%t%s\n", + ty, stringf(id ? " %s'" : "' parameter", id)); + sclass = AUTO; + } + + p = lookup(id, identifiers); + if (p && p->scope == level) + error("duplicate declaration for `%s' previously declared at %w\n", id, &p->src); + + else + p = install(id, &identifiers, level, FUNC); + p->sclass = sclass; + p->src = *pos; + p->type = ty; + p->defined = 1; + if (t == '=') { + error("illegal initialization for parameter `%s'\n", id); + t = gettok(); + (void)expr1(0); + } + return p; +} +static Type structdcl(int op) { + char *tag; + Type ty; + Symbol p; + Coordinate pos; + + t = gettok(); + pos = src; + if (t == ID) { + tag = token; + t = gettok(); + } else + tag = ""; + if (t == '{') { + static char stop[] = { IF, ',', 0 }; + ty = newstruct(op, tag); + ty->u.sym->src = pos; + ty->u.sym->defined = 1; + t = gettok(); + if (istypename(t, tsym)) + fields(ty); + else + error("invalid %k field declarations\n", op); + test('}', stop); + } + else if (*tag && (p = lookup(tag, types)) != NULL + && p->type->op == op) { + ty = p->type; + if (t == ';' && p->scope < level) + ty = newstruct(op, tag); + } + else { + if (*tag == 0) + error("missing %k tag\n", op); + ty = newstruct(op, tag); + } + if (*tag && xref) + use(ty->u.sym, pos); + return ty; +} +static void fields(Type ty) { + { int n = 0; + while (istypename(t, tsym)) { + static char stop[] = { IF, CHAR, '}', 0 }; + Type ty1 = specifier(NULL); + for (;;) { + Field p; + char *id = NULL; + Type fty = dclr(ty1, &id, NULL, 0); + p = newfield(id, ty, fty); + if (Aflag >= 1 && !hasproto(p->type)) + warning("missing prototype\n"); + if (t == ':') { + if (unqual(p->type) != inttype + && unqual(p->type) != unsignedtype) { + error("`%t' is an illegal bit-field type\n", + p->type); + p->type = inttype; + } + t = gettok(); + p->bitsize = intexpr(0, 0); + if (p->bitsize > 8*inttype->size || p->bitsize < 0) { + error("`%d' is an illegal bit-field size\n", + p->bitsize); + p->bitsize = 8*inttype->size; + } else if (p->bitsize == 0 && id) { + warning("extraneous 0-width bit field `%t %s' ignored\n", p->type, id); + + p->name = stringd(genlabel(1)); + } + p->lsb = 1; + } + else { + if (id == NULL) + error("field name missing\n"); + else if (isfunc(p->type)) + error("`%t' is an illegal field type\n", p->type); + else if (p->type->size == 0) + error("undefined size for field `%t %s'\n", + p->type, id); + } + if (isconst(p->type)) + ty->u.sym->u.s.cfields = 1; + if (isvolatile(p->type)) + ty->u.sym->u.s.vfields = 1; + n++; + if (Aflag >= 2 && n == 128) + warning("more than 127 fields in `%t'\n", ty); + if (t != ',') + break; + t = gettok(); + } + test(';', stop); + } } + { int bits = 0, off = 0, overflow = 0; + Field p, *q = &ty->u.sym->u.s.flist; + ty->align = IR->structmetric.align; + for (p = *q; p; p = p->link) { + int a = p->type->align ? p->type->align : 1; + if (p->lsb) + a = unsignedtype->align; + if (ty->op == UNION) + off = bits = 0; + else if (p->bitsize == 0 || bits == 0 + || bits - 1 + p->bitsize > 8*unsignedtype->size) { + off = add(off, bits2bytes(bits-1)); + bits = 0; + chkoverflow(off, a - 1); + off = roundup(off, a); + } + if (a > ty->align) + ty->align = a; + p->offset = off; + + if (p->lsb) { + if (bits == 0) + bits = 1; + if (IR->little_endian) + p->lsb = bits; + else + p->lsb = 8*unsignedtype->size - bits + 1 + - p->bitsize + 1; + bits += p->bitsize; + } else + off = add(off, p->type->size); + if (off + bits2bytes(bits-1) > ty->size) + ty->size = off + bits2bytes(bits-1); + if (p->name == NULL + || !('1' <= *p->name && *p->name <= '9')) { + *q = p; + q = &p->link; + } + } + *q = NULL; + chkoverflow(ty->size, ty->align - 1); + ty->size = roundup(ty->size, ty->align); + if (overflow) { + error("size of `%t' exceeds %d bytes\n", ty, inttype->u.sym->u.limits.max.i); + ty->size = inttype->u.sym->u.limits.max.i&(~(ty->align - 1)); + } } +} +static void funcdefn(int sclass, char *id, Type ty, Symbol params[], Coordinate pt) { + int i, n; + Symbol *callee, *caller, p; + Type rty = freturn(ty); + + if (isstruct(rty) && rty->size == 0) + error("illegal use of incomplete type `%t'\n", rty); + for (n = 0; params[n]; n++) + ; + if (n > 0 && params[n-1]->name == NULL) + params[--n] = NULL; + if (Aflag >= 2 && n > 31) + warning("more than 31 parameters in function `%s'\n", id); + if (ty->u.f.oldstyle) { + if (Aflag >= 1) + warning("old-style function definition for `%s'\n", id); + caller = params; + callee = newarray(n + 1, sizeof *callee, FUNC); + memcpy(callee, caller, (n+1)*sizeof *callee); + enterscope(); + assert(level == PARAM); + while (kind[t] == STATIC || istypename(t, tsym)) + decl(dclparam); + foreach(identifiers, PARAM, oldparam, callee); + + for (i = 0; (p = callee[i]) != NULL; i++) { + if (!p->defined) + callee[i] = dclparam(0, p->name, inttype, &p->src); + *caller[i] = *p; + caller[i]->sclass = AUTO; + caller[i]->type = promote(p->type); + } + p = lookup(id, identifiers); + if (p && p->scope == GLOBAL && isfunc(p->type) + && p->type->u.f.proto) { + Type *proto = p->type->u.f.proto; + for (i = 0; caller[i] && proto[i]; i++) { + Type ty = unqual(proto[i]); + if (eqtype(isenum(ty) ? ty->type : ty, + unqual(caller[i]->type), 1) == 0) + break; + else if (isenum(ty) && !isenum(unqual(caller[i]->type))) + warning("compatibility of `%t' and `%t' is compiler dependent\n", + proto[i], caller[i]->type); + } + if (proto[i] || caller[i]) + error("conflicting argument declarations for function `%s'\n", id); + + } + else { + Type *proto = newarray(n + 1, sizeof *proto, PERM); + if (Aflag >= 1) + warning("missing prototype for `%s'\n", id); + for (i = 0; i < n; i++) + proto[i] = caller[i]->type; + proto[i] = NULL; + ty = func(rty, proto, 1); + } + } else { + callee = params; + caller = newarray(n + 1, sizeof *caller, FUNC); + for (i = 0; (p = callee[i]) != NULL && p->name; i++) { + NEW(caller[i], FUNC); + *caller[i] = *p; + if (isint(p->type)) + caller[i]->type = promote(p->type); + caller[i]->sclass = AUTO; + if ('1' <= *p->name && *p->name <= '9') + error("missing name for parameter %d to function `%s'\n", i + 1, id); + + } + caller[i] = NULL; + } + for (i = 0; (p = callee[i]) != NULL; i++) + if (p->type->size == 0) { + error("undefined size for parameter `%t %s'\n", + p->type, p->name); + caller[i]->type = p->type = inttype; + } + if (Aflag >= 2 && sclass != STATIC && strcmp(id, "main") == 0) { + if (ty->u.f.oldstyle) + warning("`%t %s()' is a non-ANSI definition\n", rty, id); + else if (! (rty == inttype + && ((n == 0 && callee[0] == NULL) + || (n == 2 && callee[0]->type == inttype + && isptr(callee[1]->type) && callee[1]->type->type == charptype + && !variadic(ty))))) + warning("`%s' is a non-ANSI definition\n", typestring(ty, id)); + } + p = lookup(id, identifiers); + if (p && isfunc(p->type) && p->defined) + error("redefinition of `%s' previously defined at %w\n", + p->name, &p->src); + cfunc = dclglobal(sclass, id, ty, &pt); + cfunc->u.f.label = genlabel(1); + cfunc->u.f.callee = callee; + cfunc->u.f.pt = src; + cfunc->defined = 1; + if (xref) + use(cfunc, cfunc->src); + if (Pflag) + printproto(cfunc, cfunc->u.f.callee); + if (ncalled >= 0) + ncalled = findfunc(cfunc->name, pt.file); + labels = table(NULL, LABELS); + stmtlabs = table(NULL, LABELS); + refinc = 1.0; + regcount = 0; + codelist = &codehead; + codelist->next = NULL; + if (!IR->wants_callb && isstruct(rty)) + retv = genident(AUTO, ptr(unqual(rty)), PARAM); + compound(0, NULL, 0); + + definelab(cfunc->u.f.label); + if (events.exit) + apply(events.exit, cfunc, NULL); + walk(NULL, 0, 0); + exitscope(); + assert(level == PARAM); + foreach(identifiers, level, checkref, NULL); + if (!IR->wants_callb && isstruct(rty)) { + Symbol *a; + a = newarray(n + 2, sizeof *a, FUNC); + a[0] = retv; + memcpy(&a[1], callee, (n+1)*sizeof *callee); + callee = a; + a = newarray(n + 2, sizeof *a, FUNC); + NEW(a[0], FUNC); + *a[0] = *retv; + memcpy(&a[1], caller, (n+1)*sizeof *callee); + caller = a; + } + if (!IR->wants_argb) + for (i = 0; caller[i]; i++) + if (isstruct(caller[i]->type)) { + caller[i]->type = ptr(caller[i]->type); + callee[i]->type = ptr(callee[i]->type); + caller[i]->structarg = callee[i]->structarg = 1; + } + if (glevel > 1) for (i = 0; callee[i]; i++) callee[i]->sclass = AUTO; + if (cfunc->sclass != STATIC) + (*IR->export)(cfunc); + if (glevel && IR->stabsym) { + swtoseg(CODE); (*IR->stabsym)(cfunc); } + swtoseg(CODE); + (*IR->function)(cfunc, caller, callee, cfunc->u.f.ncalls); + if (glevel && IR->stabfend) + (*IR->stabfend)(cfunc, lineno); + foreach(stmtlabs, LABELS, checklab, NULL); + exitscope(); + expect('}'); + labels = stmtlabs = NULL; + retv = NULL; + cfunc = NULL; +} +static void oldparam(Symbol p, void *cl) { + int i; + Symbol *callee = cl; + + for (i = 0; callee[i]; i++) + if (p->name == callee[i]->name) { + callee[i] = p; + return; + } + error("declared parameter `%s' is missing\n", p->name); +} + +void compound(int loop, struct swtch *swp, int lev) { + Code cp; + int nregs; + + walk(NULL, 0, 0); + cp = code(Blockbeg); + enterscope(); + assert(level >= LOCAL); + if (level == LOCAL && events.entry) + apply(events.entry, cfunc, NULL); + definept(NULL); + expect('{'); + autos = registers = NULL; + if (level == LOCAL && IR->wants_callb + && isstruct(freturn(cfunc->type))) { + retv = genident(AUTO, ptr(unqual(freturn(cfunc->type))), level); + retv->defined = 1; + retv->ref = 1; + registers = append(retv, registers); + } + while (kind[t] == CHAR || kind[t] == STATIC + || (istypename(t, tsym) && getchr() != ':')) + decl(dcllocal); + { + int i; + Symbol *a = ltov(&autos, STMT); + nregs = length(registers); + for (i = 0; a[i]; i++) + registers = append(a[i], registers); + cp->u.block.locals = ltov(®isters, FUNC); + } + if (events.blockentry) + apply(events.blockentry, cp->u.block.locals, NULL); + while (kind[t] == IF || kind[t] == ID) + statement(loop, swp, lev); + walk(NULL, 0, 0); + foreach(identifiers, level, checkref, NULL); + { + int i = nregs, j; + Symbol p; + for ( ; (p = cp->u.block.locals[i]) != NULL; i++) { + for (j = i; j > nregs + && cp->u.block.locals[j-1]->ref < p->ref; j--) + cp->u.block.locals[j] = cp->u.block.locals[j-1]; + cp->u.block.locals[j] = p; + } + } + if (level == LOCAL) { + Code cp; + for (cp = codelist; cp->kind < Label; cp = cp->prev) + ; + if (cp->kind != Jump) { + if (freturn(cfunc->type) != voidtype) { + warning("missing return value\n"); + retcode(cnsttree(inttype, 0L)); + } else + retcode(NULL); + } + } + if (events.blockexit) + apply(events.blockexit, cp->u.block.locals, NULL); + cp->u.block.level = level; + cp->u.block.identifiers = identifiers; + cp->u.block.types = types; + code(Blockend)->u.begin = cp; + if (reachable(Gen)) + definept(NULL); + if (level > LOCAL) { + exitscope(); + expect('}'); + } +} +static void checkref(Symbol p, void *cl) { + if (p->scope >= PARAM + && (isvolatile(p->type) || isfunc(p->type))) + p->addressed = 1; + if (Aflag >= 2 && p->defined && p->ref == 0) { + if (p->sclass == STATIC) + warning("static `%t %s' is not referenced\n", + p->type, p->name); + else if (p->scope == PARAM) + warning("parameter `%t %s' is not referenced\n", + p->type, p->name); + else if (p->scope >= LOCAL && p->sclass != EXTERN) + warning("local `%t %s' is not referenced\n", + p->type, p->name); + } + if (p->sclass == AUTO + && ((p->scope == PARAM && regcount == 0) + || p->scope >= LOCAL) + && !p->addressed && isscalar(p->type) && p->ref >= 3.0) + p->sclass = REGISTER; + if (level == GLOBAL && p->sclass == STATIC && !p->defined + && isfunc(p->type) && p->ref) + error("undefined static `%t %s'\n", p->type, p->name); + assert(!(level == GLOBAL && p->sclass == STATIC && !p->defined && !isfunc(p->type))); +} +static Symbol dcllocal(int sclass, char *id, Type ty, Coordinate *pos) { + Symbol p, q; + + if (sclass == 0) + sclass = isfunc(ty) ? EXTERN : AUTO; + else if (isfunc(ty) && sclass != EXTERN) { + error("invalid storage class `%k' for `%t %s'\n", + sclass, ty, id); + sclass = EXTERN; + } else if (sclass == REGISTER + && (isvolatile(ty) || isstruct(ty) || isarray(ty))) { + warning("register declaration ignored for `%t %s'\n", + ty, id); + sclass = AUTO; + } + q = lookup(id, identifiers); + if ((q && q->scope >= level) + || (q && q->scope == PARAM && level == LOCAL)) { + if (sclass == EXTERN && q->sclass == EXTERN + && eqtype(q->type, ty, 1)) + ty = compose(ty, q->type); + else + error("redeclaration of `%s' previously declared at %w\n", q->name, &q->src); + } + assert(level >= LOCAL); + p = install(id, &identifiers, level, sclass == STATIC || sclass == EXTERN ? PERM : FUNC); + p->type = ty; + p->sclass = sclass; + p->src = *pos; + switch (sclass) { + case EXTERN: + q = lookup(id, globals); + if (q == NULL || q->sclass == TYPEDEF || q->sclass == ENUM) { + q = lookup(id, externals); + if (q == NULL) { + q = install(p->name, &externals, GLOBAL, PERM); + q->type = p->type; + q->sclass = EXTERN; + q->src = src; + (*IR->defsymbol)(q); + } + } + if (!eqtype(p->type, q->type, 1)) + warning("declaration of `%s' does not match previous declaration at %w\n", + q->name, &q->src); + p->u.alias = q; + break; + case STATIC: + (*IR->defsymbol)(p); + initglobal(p, 0); + if (! p->defined) { + if (p->type->size > 0) { + defglobal(p, BSS); + (*IR->space)(p->type->size); + } else { + error("undefined size for `%t %s'\n", + p->type, p->name); + } + } + p->defined = 1; + break; + case REGISTER: + registers = append(p, registers); + regcount++; + p->defined = 1; + break; + case AUTO: + autos = append(p, autos); + p->defined = 1; + if (isarray(ty)) + p->addressed = 1; + break; + default: + assert(0); + } + if (t == '=') { + Tree e; + if (sclass == EXTERN) + error("illegal initialization of `extern %s'\n", id); + t = gettok(); + definept(NULL); + if (isscalar(p->type) + || (isstruct(p->type) && t != '{')) { + if (t == '{') { + t = gettok(); + e = expr1(0); + expect('}'); + } else + e = expr1(0); + } else { + Symbol t1; + Type ty = p->type, ty1 = ty; + while (isarray(ty1)) + ty1 = ty1->type; + if (!isconst(ty) && (!isarray(ty) || !isconst(ty1))) + ty = qual(CONST, ty); + t1 = genident(STATIC, ty, GLOBAL); + initglobal(t1, 1); + if (isarray(p->type) && p->type->size == 0 + && t1->type->size > 0) + p->type = array(p->type->type, + t1->type->size/t1->type->type->size, 0); + e = idtree(t1); + } + walk(root(asgn(p, e)), 0, 0); + p->ref = 1; + } + if (!isfunc(p->type) && p->defined && p->type->size <= 0) + error("undefined size for `%t %s'\n", p->type, id); + return p; +} +void finalize(void) { + foreach(externals, GLOBAL, doextern, NULL); + foreach(identifiers, GLOBAL, doglobal, NULL); + foreach(identifiers, GLOBAL, checkref, NULL); + foreach(constants, CONSTANTS, doconst, NULL); +} +static void doextern(Symbol p, void *cl) { + (*IR->import)(p); +} +static void doglobal(Symbol p, void *cl) { + if (! p->defined && (p->sclass == EXTERN + || (isfunc(p->type) && p->sclass == AUTO))) + (*IR->import)(p); + else if (!p->defined && !isfunc(p->type) + && (p->sclass == AUTO || p->sclass == STATIC)) { + if (isarray(p->type) + && p->type->size == 0 && p->type->type->size > 0) + p->type = array(p->type->type, 1, 0); + if (p->type->size > 0) { + defglobal(p, BSS); + (*IR->space)(p->type->size); + if (glevel > 0 && IR->stabsym) + (*IR->stabsym)(p); + } else + error("undefined size for `%t %s'\n", + p->type, p->name); + p->defined = 1; + } + if (Pflag + && !isfunc(p->type) + && !p->generated && p->sclass != EXTERN) + printdecl(p, p->type); +} +void doconst(Symbol p, void *cl) { + if (p->u.c.loc) { + assert(p->u.c.loc->u.seg == 0); + defglobal(p->u.c.loc, LIT); + if (isarray(p->type) && p->type->type == widechar) { + unsigned int *s = p->u.c.v.p; + int n = p->type->size/widechar->size; + while (n-- > 0) { + Value v; + v.u = *s++; + (*IR->defconst)(widechar->op, widechar->size, v); + } + } else if (isarray(p->type)) + (*IR->defstring)(p->type->size, p->u.c.v.p); + else + (*IR->defconst)(p->type->op, p->type->size, p->u.c.v); + p->u.c.loc = NULL; + } +} + +void checklab(Symbol p, void *cl) +{ + if (!p->defined) + error("undefined label `%s'\n", p->name); + p->defined = 1; +} + +Type enumdcl(void) +{ + char *tag; + Type ty; + Symbol p = 0; + Coordinate pos; + + t = gettok(); + pos = src; + if (t == ID) { + tag = token; + t = gettok(); + } else + tag = ""; + if (t == '{') { + static char follow[] = { IF, 0 }; + int n = 0; + long k = -1; + List idlist = 0; + ty = newstruct(ENUM, tag); + t = gettok(); + if (t != ID) + error("expecting an enumerator identifier\n"); + while (t == ID) { + char *id = token; + Coordinate s; + if (tsym && tsym->scope == level) + error("redeclaration of `%s' previously declared at %w\n", + token, &tsym->src); + s = src; + t = gettok(); + if (t == '=') { + t = gettok(); + k = intexpr(0, 0); + } else { + if (k == inttype->u.sym->u.limits.max.i) + error("overflow in value for enumeration constant `%s'\n", id); + k++; + } + p = install(id, &identifiers, level, level < LOCAL ? PERM : FUNC); + p->src = s; + p->type = ty; + p->sclass = ENUM; + p->u.value = k; + idlist = append(p, idlist); + n++; + if (Aflag >= 2 && n == 128) + warning("more than 127 enumeration constants in `%t'\n", ty); + if (t != ',') + break; + t = gettok(); + if (Aflag >= 2 && t == '}') + warning("non-ANSI trailing comma in enumerator list\n"); + } + test('}', follow); + ty->type = inttype; + ty->size = ty->type->size; + ty->align = ty->type->align; + ty->u.sym->u.idlist = ltov(&idlist, PERM); + ty->u.sym->defined = 1; + } else if ((p = lookup(tag, types)) != NULL && p->type->op == ENUM) { + ty = p->type; + if (t == ';') + error("empty declaration\n"); + } else { + error("unknown enumeration `%s'\n", tag); + ty = newstruct(ENUM, tag); + ty->type = inttype; + } + if (*tag && xref) + use(p, pos); + return ty; +} + +Type typename(void) { + Type ty = specifier(NULL); + + if (t == '*' || t == '(' || t == '[') { + ty = dclr(ty, NULL, NULL, 1); + if (Aflag >= 1 && !hasproto(ty)) + warning("missing prototype\n"); + } + return ty; +} diff --git a/src/cmd/lccom-1/doc/install.html b/src/cmd/lccom-1/doc/install.html new file mode 100644 index 0000000..274db80 --- /dev/null +++ b/src/cmd/lccom-1/doc/install.html @@ -0,0 +1,774 @@ + + + + + +Installing lcc + + + + +

Installing lcc

+ +

Christopher +W. Fraser and David R. Hanson, Microsoft Research
+September 2002

+ +

Contents

+ + +
  • Introduction
  • +
  • Installation on UNIX
  • +
  • Building the Driver
  • +
  • Building the Compiler and Accessories
  • +
  • Installation on Windows
  • +
  • Reporting Bugs
  • +
  • Keeping in Touch
  • +
    + +

    Introduction

    + +

    lcc is the ANSI C compiler +described in our book A Retargetable C Compiler: Design and Implementation +(Addison-Wesley, 1995, ISBN 0-8053-1670-1).

    + +

    If you're installing lcc on a UNIX system, read the remainder of this section and +continue with the next section. If you're installing lcc on a Windows system, you should read the rest of this section, the following three sections, and the Windows section.

    + +

    Extract the distribution into its own directory. All non-absolute paths below are +relative to this directory. The distribution holds the following subdirectories.

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    srcsource code
    etcdriver, accessories
    libruntime library source code
    cpppreprocessor source code
    lburgcode-generator generator source code
    docthis document, man pages
    include/*/*include files
    tsttest suite
    alpha/*/tstALPHA test outputs
    mips/*/tstMIPS test outputs
    sparc/*/tstSPARC test outputs
    x86/*/tstX86 test outputs
    +
    + +

    doc/install.html is the HTML file for this document.

    + +

    The installation makefile is designed so that lcc can be installed from a read-only +file system or directory, which is common in networked environments, so the distribution +can be unloaded on a central file server. You will need an existing ANSI/ISO C +compiler to build and install lcc.

    + +

    Installation on UNIX

    + +

    The compilation components (the preprocessor, include files, and compiler proper, etc.) +are installed in a single build directory. On multi-platform systems supported by +a central file server, it's common to store the build directory in a location specific to +the platform and to the version of lcc, and to point a symbolic link to this location. For +example,

    + +
    +
    % ln -s $BUILDDIR/sparc-solaris /usr/local/lib/lcc
    +
    + +

    points /usr/local/lib/lcc to a build directory for lcc on the SPARC under Solaris. Links into /usr/local/lib/lcc are created for the programs lcc +and bprint. Thus, a new distribution can be installed by building it in its +own build directory and changing one symbolic link to point to that directory. If these +conventions or their equivalents are followed, the host-specific parts of the driver +program, lcc, can be used unmodified.

    + +

    Installation on a UNIX system involves the following steps. Below, the build directory +is referred to as BUILDDIR, and the commands below are executed +from the distribution directory.

      +
    1. Create the build directory, using a version- and platform-specific naming convention as + suggested above, and record the name of this directory in the BUILDDIR + environment variable:
      +
      % setenv BUILDDIR $BUILDDIR/sparc-solaris
      +% mkdir -p $BUILDDIR
      +
      +

      Here and below, commands assume the C shell. Also, you'll need a version of mkdir + that supports the -p option, which creates intermediate directories as + necessary.

      +
    2. +
    3. Copy the man pages to the repository for local man pages, e.g.,
      +
      % cp doc/*.1 /usr/local/man/man1
      +
      +

      Some users copy the man pages to the build directory and create the appropriate + symbolic links, e.g.,

      +
      +
      % cp doc/*.1 $BUILDDIR
      +% ln -s $BUILDDIR/*.1 /usr/local/man/man1
      +
      +
    4. +
    5. Platform-specific include files are in directories named include/target/os. + Create the include directory in the build directory, and copy the include hierarchy for + your platform to this directory, e.g.,
      +
      % mkdir $BUILDDIR/include
      +% cp -p -R include/sparc/solaris/* $BUILDDIR/include
      +
      +

      Again, some users create a symbolic link to the appropriate directory in the + distribution instead of copying the include files. For example, at Princeton, the + distributions are stored under /proj/pkg/lcc, so the included files are + "installed" by creating one symbolic link:

      +
      +
      % ln -s $BUILDDIR/include/sparc/solaris $BUILDDIR/include
      +
      +

      If you're installing lcc on Linux, you must also plant a symbolic link named gcc + to gcc's library directory, because lcc uses gcc's C preprocessor and most of gcc's header + files:

      +
      +
      % ln -s /usr/lib/gcc-lib/i386-redhat-linux/2.96 $BUILDDIR/gcc
      +
      +

      The library directory shown above may be different on your Linux machine; to determine + the correct directory, browse /usr/lib/gcc-lib, or execute

      +
      +
      % cc -v tst/8q.c
      +
      +

      and examine the diagnostic output. Make sure that $BUILDDIR/gcc/cpp0 and $BUILDDIR/gcc/include + are, respectively, gcc's C preprocessor and header files. On Linux, lcc looks for + include files in $BUILDDIR/include, $BUILDDIR/gcc/include, and /usr/include, + in that order; see Building the Driver and etc/linux.c for details.

      +
    6. +
    7. The makefile includes the file named by the CUSTOM + macro; the default is custom.mk, and an empty custom.mk is + included in the distribution. If desired, prepare a site-specification customization file + and define CUSTOM to the path of that file when invoking make in steps 5 and + 6, e.g.,
      +
      make CUSTOM=solaris.mk
      +
      +

      You can, for example, use customization files to record site-specific values for macros + instead of using environment variables, and to record targets for the steps in this list.

      +
    8. +
    9. Build the host-specific driver, creating a custom host-specific part, if necessary. See Building the Driver.
    10. +
    11. Build the preprocessor, compiler proper, library, and other accessories. See Building the Compiler.
    12. +
    13. Plant symbolic links to the build directory and to the installed programs, e.g.,
      +
      % ln -s $BUILDDIR /usr/local/lib/lcc
      +% ln -s /usr/local/lib/{lcc,bprint} /usr/local/bin
      +
      +

      Some users copy bprint and lcc into /usr/local/bin + instead of creating symbolic links. The advantage of creating the links for lcc + and bprint as shown is that, once established, they point indirectly to + whatever /usr/local/lib/lcc points to; installing a new version of lcc can be done by changing /usr/local/lib/lcc to point to the build + directory for the new version.

      +
    14. +
    + +

    Building the Driver

    + +

    The preprocessor, compiler, assembler, and loader are invoked by a driver program, lcc, +which is similar to cc on most systems. It's described in the man page doc/lcc.1. +The driver is built by combining the host-independent part, etc/lcc.c, +with a small host-specific part. Distributed host-specific parts are named etc/os.c, +where os is the name of the operating system for the host on which lcc +is being installed. If you're following the installations conventions described above, you +can probably use one of the host-specific parts unmodified; otherwise, pick one that is +closely related to your platform, copy it to whatever.c, and edit it +as described below. You should not have to edit etc/lcc.c.

    + +

    We'll use etc/solaris.c as an example in +describing how the host-specific part works. This example illustrates all the important +features. Make sure you have the environment variable BUILDDIR set correctly, +and build the driver with a make command, e.g.,

    + +
    +
    % make HOSTFILE=etc/solaris.c lcc
    +cc -g -c -o $BUILDDIR/sparc-solaris/lcc.o etc/lcc.c
    +cc -g -c -o $BUILDDIR/sparc-solaris/host.o etc/solaris.c
    +cc -g -o $BUILDDIR/lcc $BUILDDIR/sparc-solaris/lcc.o $BUILDDIR/sparc-solaris/host.o
    +
    + +

    Of course, the actual value of BUILDDIR will appear in place of +$BUILDDIR. The symbolic name HOSTFILE specifies the path to the host-specific part, +either one in the distribution or whatever.c. Some versions of make +may require the -e option in order to read the environment.

    + +

    Here's etc/solaris.c:

    + +
    +
    /* Sparcs running Solaris 2.5.1 at CS Dept., Princeton University */
    +
    +#include <string.h>
    +
    +static char rcsid[] = "$ Id: solaris.c,v 1.10 1998/09/14 20:36:33 drh Exp $";
    +
    +#ifndef LCCDIR
    +#define LCCDIR "/usr/local/lib/lcc/"
    +#endif
    +#ifndef SUNDIR
    +#define SUNDIR "/opt/SUNWspro/SC4.2/lib/"
    +#endif
    +
    +char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
    +char inputs[256] = "";
    +char *cpp[] = { LCCDIR "cpp",
    +	"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix",
    +	"$1", "$2", "$3", 0 };
    +char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
    +	"-I/usr/include", 0 };
    +char *com[] = { LCCDIR "rcc", "-target=sparc/solaris",
    +	"$1", "$2", "$3", 0 };
    +char *as[] = { "/usr/ccs/bin/as", "-Qy", "-s", "-o", "$3", "$1", "$2", 0 };
    +char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1",
    +	SUNDIR "crti.o", SUNDIR "crt1.o",
    +	SUNDIR "values-xa.o", "$2", "",
    +	"-Y", "P," SUNDIR ":/usr/ccs/lib:/usr/lib", "-Qy",
    +	"-L" LCCDIR, "-llcc", "-lm", "-lc", SUNDIR "crtn.o", 0 };
    +
    +extern char *concat(char *, char *);
    +
    +int option(char *arg) {
    +	if (strncmp(arg, "-lccdir=", 8) == 0) {
    +		cpp[0] = concat(&arg[8], "/cpp");
    +		include[0] = concat("-I", concat(&arg[8], "/include"));
    +		ld[12] = concat("-L", &arg[8]);
    +		com[0] = concat(&arg[8], "/rcc");
    +	} else if (strcmp(arg, "-p") == 0) {
    +		ld[5] = SUNDIR "mcrt1.o";
    +		ld[10] = "P," SUNDIR "libp:/usr/ccs/lib/libp:/usr/lib/libp:"
    +			 SUNDIR ":/usr/ccs/lib:/usr/lib";
    +	} else if (strcmp(arg, "-b") == 0)
    +		;
    +	else if (strncmp(arg, "-ld=", 4) == 0)
    +		ld[0] = &arg[4];
    +	else
    +		return 0;
    +	return 1;
    +}
    +
    + +

    LCCDIR defaults to "/usr/local/lib/lcc/" unless +it's defined by a -D option as part of CFLAGS in the make +command, e.g.,

    + +
    +
    % make HOSTFILE=etc/solaris.c CFLAGS='-DLCCDIR=\"/v/lib/lcc/\"' lcc
    +
    + +

    Note the trailing slash; SUNDIR is provided so you can use etc/solaris.c +even if you have a different version of the Sun Pro compiler suite. If you're using the +gcc compiler tools instead of the Sun Pro tools, see etc/gcc-solaris.c.

    + +

    Most of the host-specific code is platform-specific data and templates for the commands +that invoke the preprocessor, compiler, assembler, and loader. The suffixes +array lists the file name suffixes for C source files, preprocessed source files, assembly +language source files, object files, and executable files. suffixes must be +terminated with a null pointer, as shown above. The initialization of suffixes +in etc/solaris.c are the typical ones for UNIX +systems. Each element of suffixes is actually a list of suffixes, separated +by semicolons; etc/win32.c holds an example:

    + +
    +
    char *suffixes[] = { ".c;.C", ".i;.I", ".asm;.ASM;.s;.S", ".obj;.OBJ", ".exe", 0 };
    +
    + +

    When a list is given, the first suffix is used whenever lcc needs to generate a file +name. For example, with etc/win32.c, lcc emits +the generated assembly code into .asm files.

    + +

    The inputs array holds a null-terminated string of directories separated +by colons or semicolons. These are used as the default value of LCCINPUTS, if +the environment variable LCCINPUTS is not set; see the man +page.

    + +

    Each command template is an array of pointers to strings terminated with a null +pointer; the strings are full path names of commands, arguments, or argument placeholders, +which are described below. Commands are executed in a child process, and templates can +contain multiple commands by separating commands with newlines. The driver runs each +command in a new process.

    + +

    The cpp array gives the command for running lcc's preprocessor, cpp. +Literal arguments specified in templates, e.g., "-Dsparc" in the cpp +command above, are passed to the command as given.

    + +

    The strings "$1", "$2", and "$3" +in templates are placeholders for lists of arguments that are substituted in a +copy of the template before the command is executed. $1 is replaced by the options +specified by the user; for the preprocessor, this list always contains at least -D__LCC__. +$2 is replaced by the input files, and $3 is replaced +by the output file.

    + +

    Zero-length arguments after replacement are removed from the argument list before the +command is invoked. So, for example, if the preprocessor is invoked without an output +file, "$3" becomes "", which is removed from +the final argument list.

    + +

    The include array is a list of -I options that specify which +directives should be searched to satisfy include directives. These directories are +searched in the order given. The first directory should be the one to which the ANSI +header files were copied as described in UNIX or Windows +installation instructions. The driver adds these options to cpp's arguments +when it invokes the preprocessor, except when -N is specified.

    + +

    com gives the command for invoking the compiler. This template can appear +as shown above in a custom host-specific part, but the option -target=sparc/solaris +should be edited to the target/os for your platform. If com[1] +includes the string "win32", the driver assumes it's running on +Windows. lcc can generate code for all of the target/os +combinations listed in the file src/bind.c. The -target option +specifies the default combination. The driver's -Wf option can be used to +specify other combinations; the man page elaborates.

    + +

    as gives the command for invoking the assembler. On Linux, you must be +running at least version 2.8.1 of the GNU assembler; earlier versions mis-assemble some +instructions emitted by lcc.

    + +

    ld gives the command for invoking the loader. For the other commands, the +list $2 contains a single file; for ld, $2 contains +all ".o" files and libraries, and $3 is a.out, unless +the -o option is specified. As suggested in the code above, ld +must also specify the appropriate startup code and default libraries, including the lcc +library, liblcc.a.

    + +

    The option function is described below; the minimal option +function just returns 0.

    + +

    You can test lcc with the options -v -v to display the +commands that would be executed, e.g.,

    + +
    +
    % $BUILDDIR/lcc -v -v foo.c baz.c mylib.a -lX11
    +$BUILDDIR/sparc-solaris/lcc $ Id: lcc.c,v 4.33 2001/06/28 22:19:58 drh $
    +foo.c:
    +/usr/local/lib/lcc/cpp -D__STDC__=1 -Dsparc -D__sparc__ -Dsun -D__sun__ -Dunix -D__LCC__i
    +/usr/local/lib/lcc/rcc -target=sparc/solaris -v /tmp/lcc4060.i /tmp/lcc4061.s
    +/usr/ccs/bin/as -Qy -s -o /tmp/lcc4062.o /tmp/lcc4061.s
    +baz.c:
    +/usr/local/lib/lcc/cpp -D__STDC__=1 -Dsparc -D__sparc__ -Dsun -D__sun__ -Dunix -D__LCC__i
    +/usr/local/lib/lcc/rcc -target=sparc/solaris -v /tmp/lcc4060.i /tmp/lcc4061.s
    +/usr/ccs/bin/as -Qy -s -o /tmp/lcc4063.o /tmp/lcc4061.s
    +/usr/ccs/bin/ld -o a.out /opt/SUNWspro/SC4.2/lib/crti.o /opt/SUNWspro/SC4.2/lib/crt1.o /o
    +rm /tmp/lcc4063.o /tmp/lcc4060.i /tmp/lcc4061.s /tmp/lcc4062.o
    +
    + +

    As the output shows, lcc places temporary files in /tmp; if +any of the environment variables TMP, TEMP, and TMPDIR +are set, they override this default (in the order shown) as does the -tempdir=dir +option. The default can be changed by defining TEMPDIR in CFLAGS +when building the driver.

    + +

    The option function is called for the options -Wo, -g, +-p, -pg, and -b because these compiler options +might also affect the loader's arguments. For these options, the driver calls option(arg) +to give the host-specific code an opportunity to edit the ld command, if +necessary. option can change ld, if necessary, and return 1 to +announce its acceptance of the option. If the option is unsupported, option +should return 0.

    + +

    For example, in response to -g, the option function shown +above accepts the option but does nothing else, because the ld and as +commands don't need to be modified on the SPARC. -g will also be added to the +compiler's options by the host-independent part of the driver. The -p causes option +to change the name of the startup code and changed the list of libraries. The -b +option turns on lcc's per-expression profiling, the code for which is in liblcc.a, +so option need no nothing.

    + +

    On SPARCs, the driver also recognizes -Bstatic and -Bdynamic +as linker options. The driver recognizes but ignores "-target name" +option.

    + +

    The option -Woarg causes the driver to pass arg to option. +Such options have no other effect; this mechanism is provided to support system-specific +options that affect the commands executed by the driver. As illustrated above, +host-specific parts should support the -Wo-lccdir=dir option, which +causes lcc's compilation components to be found in dir, because this option is +used by the test scripts, and because the driver simulates a -Wo-lccdir +option with the value of the environment variable LCCDIR, if it's defined. +The code above rebuilds the paths to the include files, preprocessor, compiler, and +library by calling concat, which is defined in etc/lcc.c.

    + +

    Building the Compiler and Accessories

    + +

    To build the rest of compilation components make sure BUILDDIR is set +appropriately and type "make all". This command builds librcc.a +(the compiler's private library), rcc (the compiler proper), lburg +(the code-generator generator), cpp (the preprocessor), liblcc.a +(the runtime library), and bprint (the profile printer), all in BUILDDIR. +There may be warnings, but there should be no errors. If you're using an ANSI/ISO compiler +other than cc, specify its name with the CC= option, e.g., +"make CC=gcc all". If you're running on a DEC ALPHA, use "make +CC='cc -std1' all"; the -std1 option is essential on +the ALPHA.

    + +

    Once rcc is built with the host C compiler, run the test suite to verify +that rcc is working correctly. If any of the steps below fail, contact us +(see Reporting Bugs). The commands in the makefile run the +shell script src/run.sh on each C program in the test suite, tst/*.c. +It uses the driver, $BUILDDIR/lcc, so you must have the driver in the build +directory before testing rcc. The target/os +combination is read from the variable TARGET, which must be specified when +invoking make:

    + +
    +
    % make TARGET=sparc/solaris test
    +mkdir -p $BUILDDIR/sparc-solaris/sparc/solaris/tst
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/8q.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/array.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/cf.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/cq.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/cvt.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/fields.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/front.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/incr.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/init.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/limits.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/paranoia.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/sort.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/spill.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/stdarg.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/struct.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/switch.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/wf1.s:
    +$BUILDDIR/sparc-solaris/rcc -target=sparc/solaris $BUILDDIR/sparc-solaris/sparc/solaris/tst/yacc.s:
    +
    + +

    Each line in the output above is of the form

    + +
    +

    $BUILDDIR/rcc -target=target/os $BUILDDIR/target/os/X.s:

    +
    + +

    where X is the base name of the C program X.c in the +test suite. The actual value of BUILDDIR will, of course, appear in +place of $BUILDDIR. This output identifies the compiler and the target, e.g., "$BUILDDIR/rcc +is generating code for a sparc running the solaris operating +system."

    + +

    For each program in the test suite, src/run.sh compiles the program, drops +the generated assembly language code in BUILDDIR/target/os, +and uses diff to compare the generated assembly code with the expected code +(the code expected for tst/8q.c on the SPARC under Solaris is in sparc/solaris/tst/8q.sbk, +etc.). If there are differences, the script executes the generated code with the input +given in tst (the input for tst/8q.c is in tst/8q.0, +etc.) and compares the output with the expected output (the expected output from tst/8q.c +on the SPARC under Solaris is in sparc/solaris/tst/8q.1bk, etc.). The script +also compares the diagnostics from the compiler with the expected diagnostics.

    + +

    On some systems, there may be a few differences between the generated code and the +expected code. These differences occur because the expected code is generated by cross +compilation and the least significant bits of some floating-point constants differ from +those bits in constants generated on your system. On Linux, there may be differences +because of differences in the header files between our system and yours. There should be +no differences in the output from executing the test programs.

    + +

    Next, run the "triple test", which builds rcc using itself:

    + +
    +
    % make triple
    +$BUILDDIR/sparc-solaris/lcc -A -d0.6 -Wo-lccdir=$(BUILDDIR) -Isrc -I$(BUILDDIR) -o $BUILDDIR/sparc-solaris/1rcc -B$BUILDDIR/sparc-solaris/ src/alloc.c ...
    +src/alloc.c:
    +...
    +$BUILDDIR/sparc-solaris/lcc -A -d0.6 -Wo-lccdir=$(BUILDDIR) -Isrc -I$(BUILDDIR) -o $BUILDDIR/sparc-solaris/2rcc -B$BUILDDIR/sparc-solaris/1 src/alloc.c ...
    +src/alloc.c:
    +...
    +strip $BUILDDIR/sparc-solaris/[12]rcc
    +dd if=$BUILDDIR/sparc-solaris/1rcc of=$BUILDDIR/sparc-solaris/rcc1 bs=512 skip=1
    +1270+1 records in
    +1270+1 records out
    +dd if=$BUILDDIR/sparc-solaris/2rcc of=$BUILDDIR/sparc-solaris/rcc2 bs=512 skip=1
    +1270+1 records in
    +1270+1 records out
    +if cmp $BUILDDIR/sparc-solaris/rcc[12]; then \
    +        mv $BUILDDIR/sparc-solaris/2rcc $BUILDDIR/sparc-solaris/rcc; \
    +        rm -f $BUILDDIR/sparc-solaris/1rcc $BUILDDIR/sparc-solaris/rcc[12]; fi
    +
    + +

    This command builds rcc twice; once using the rcc built by cc +and again using the rcc built by lcc. The resulting binaries are +compared. They should be identical, as shown at the end of the output above. If they +aren't, our compiler is generating incorrect code; contact us.

    + +

    The final version of rcc should also pass the test suite; that is, the +output from

    + +
    +
    % make TARGET=sparc/solaris test
    +
    + +

    should be identical to that from the previous make test.

    + +

    The command "make clean" cleans up, but does not remove rcc, +etc., and "make clobber" cleans up and removes lcc, rcc, +and the other accessories. Test directories under BUILDDIR are not +removed; you'll need to remove these by hand, e.g.,

    + +
    +
    % rm -fr $BUILDDIR/sparc
    +
    + +

    The code generators for the other targets can be tested by specifying the desired target/os +and setting an environment variable that controls what src/run.sh does. For +example, to test the MIPS code generator, type

    + +
    +
    % setenv REMOTEHOST noexecute
    +% make TARGET=mips/irix test
    +
    + +

    As above, src/run.sh compares the MIPS code generated with what's +expected. There should be no differences. Setting REMOTEHOST to noexecute +suppresses the assembly and execution of the generated code. If you set REMOTEHOST +to the name of a MIPS machine to which you can rlogin, src/run.sh +will rcp the generated code to that machine and execute it there, if +necessary. See src/run.sh for the details.

    + +

    You can use lcc as a cross compiler. The options -S and -Wf-target=target/os +generate assembly code for the specified target, which is any of those listed in the file src/bind.c. +For example,

    + +
    +
    % lcc -Wf-target=mips/irix -S tst/8q.c
    +
    + +

    generates MIPS code for tst/8q.c in 8q.s.

    + +

    lcc can also generate code for a "symbolic" target. This target is used +routinely in front-end development, and its output is a printable representation of the +input program, e.g., the dags constructed by the front end are printed, and other +interface functions print their arguments. You can specify this target with the option -Wf-target=symbolic. +For example,

    + +
    +
    % lcc -Wf-target=symbolic -S tst/8q.c
    +
    + +

    generates symbolic output for tst/8q.c in 8q.s. Adding -Wf-html +causes the symbolic target to emit HTML instead of plain text. Finally, the option -Wf-target=null +specifies the "null" target for which lcc emits nothing and thus only checks the +syntax and semantics of its input files.

    + +

    Installation on Windows

    + +

    On Windows, lcc is designed to work with Microsoft's Visual +C++ (VC), version 5.0 and above, and Microsoft's Assembler, MASM. It uses the VC header files, +libraries, and command-line tools, and it uses MASM to assemble the code it generates. +You must use MASM 6.11d or later, +because earlier releases generate incorrect COFF object files. MASM +6.15 is available as part of the free +Visual +C++ 6.0 Processor Pack.

    + +

    Building the distribution components from the ground up requires Microsoft's Visual +C/C++ compiler, Microsoft's make, nmake, and the standard Windows command +interpreter. makefile.nt is written to use only nmake. +As on UNIX systems, the compilation components are installed in a single build +directory, and the top-level programs, lcc.exe and bprint.exe, +are installed in a directory on the PATH. If the conventions used below are followed, the +Windows-specific parts of the driver program, lcc.exe, can be used +unmodified.

    + +

    Building from the source distribution on a Windows system involves the following steps. +Below, the build directory is referred to as BUILDDIR, and the distribution +is in \dist\lcc. + +

      +
    1. Create the build directory, perhaps using a version- and platform-specific naming + convention as suggested in Installation on UNIX, and record + the name of this directory in the BUILDDIR environment variable:
      +
      C:\dist\lcc>set BUILDDIR=\progra~1\lcc\version\bin
      +C:\dist\lcc>mkdir %BUILDDIR%
      +
      +

      The default build, or installation, directory is \Program Files\lcc\version\bin, + where version is the version number, e.g., 4.2, but the nmake commands require that you use the corresponding 8.3 file name, progra~1, + instead of Program Files.

      +
    2. +
    3. etc\win32.c is the Windows-specific part of + the driver. It assumes that environment variable include gives the locations + of the VC header files and that the linker (link.exe) and the assembler (ml.exe) + are on the PATH. It also assumes that the macro LCCDIR gives the build + directory. If necessary, revise a copy of etc\win32.c + to reflect the conventions on your computer (see Building the Driver), + then build the driver, specifying the default temporary directory, if necessary:
      +
      C:\dist\lcc>nmake -f makefile.nt HOSTFILE=etc/win32.c lcc
      +...
      +        cl -nologo -Zi -MLd -Fd%BUILDDIR%\ -c -Fo%BUILDDIR%\lcc.obj etc/lcc.c
      +lcc.c
      +        cl -nologo -Zi -MLd -Fd%BUILDDIR%\ -c -Fo%BUILDDIR%\host.obj etc/win32.c
      +win32.c
      +        cl -nologo -Zi -MLd -Fd%BUILDDIR%\ -Fe%BUILDDIR%\lcc.exe %BUILDDIR%\lcc.obj %BUILDDIR%\host.obj
      +
      +

      If you make a copy of etc\win32.c, specify the path of the copy as the + value of HOSTFILE. For example, if you copy etc\win32.c to BUILDDIR + and edit it, use the command

      +
      +
      C:\dist\lcc>nmake -f makefile.nt HOSTFILE=%BUILDDIR%\win32.c lcc
      +
      +
    4. +
    5. Build the preprocessor, compiler proper, library, and other accessories (see Building the Compiler):
      +
      C:\dist\lcc>nmake -f makefile.nt all
      +
      +

      This command uses the VC command-line tools cl and lib to + build bprint.exe, cpp.exe, lburg.exe, liblcc.lib, + librcc.lib, and rcc.exe, all in BUILDDIR. There may + be some warnings, but there should be no warnings.

      +
    6. +
    7. Create a test directory and run the test suite:
      +
      C:\dist\lcc>mkdir %BUILDDIR%\x86\win32\tst
      +C:\dist\lcc>nmake -f makefile.nt test
      +
      +

      This command compiles each program in tst, compares the generated + assembly code and diagnostics with the expected assembly code and diagnostics, executes + the program, and compares the output with the expected output (using fc). For + example, when the nmake command compiles tst\8q.c, + it leaves the generated assembly code and diagnostic output in %BUILDDIR%\x86\win32\tst\8q.s + and %BUILDDIR%\x86\win32\tst\8q.2, and it compares them with the expected + results in x86\win32\tst\8q.sbk. It builds the executable program in %BUILDDIR%\x86\win32\tst\8q.exe, + runs it, and redirects the output to %BUILDDIR%\x86\win32\tst\8q.1, which it + compares with x86\win32\tst\8q.1bk. The output from this step is voluminous, + but there should be no differences and no errors.

      +
    8. +
    9. Run the "triple" test, which compiles rcc with itself and + verifies the results:
      +
      C:\dist\lcc>nmake -f makefile.nt triple
      +...
      + Assembling: C:/TEMP/lcc2001.asm
      +        fc /b %BUILDDIR%\1rcc.exe %BUILDDIR%\2rcc.exe
      +Comparing files %BUILDDIR%\1rcc.exe and %BUILDDIR%\2RCC.EXE
      +00000088: B4 D5
      +
      +

      This command builds rcc twice; once using the rcc built by VC + and again using the rcc built by lcc. The resulting binaries are + compared using fc. They should be identical, except for one or two bytes of + timestamp data, as shown at the end of the output above (which will be + different on your system). If 1rcc.exe and 2rcc.exe aren't + identical, our compiler is + generating incorrect code; contact us.

      +
    10. +
    11. Copy lcc.exe and bprint.exe to a directory on your PATH, e.g.,
      +
      C:\dist\lcc>copy %BUILDDIR%\lcc.exe \bin
      +        1 file(s) copied.
      +
      +C:\dist\lcc>copy %BUILDDIR%\bprint.exe \bin
      +        1 file(s) copied.
      +
      +
    12. +
    13. Finally, clean up:
      +
      C:\dist\lcc>nmake -f makefile.nt clean
      +
      +

      This command removes the derived files in BUILDDIR, but does not remove rcc.exe, + etc.; "nmake -f makefile.nt clobber" cleans up and removes all + executables and libraries. Test directories under BUILDDIR are not + removed; you'll need to remove these by hand, e.g.,

      +
      +
      C:\dist\lcc>rmdir %BUILDDIR%\x86 /s
      +%BUILDDIR%\x86, Are you sure (Y/N)? y
      +
      +
    14. +
    + +

    Reporting Bugs

    + +

    lcc is a large, complex program. We find and repair errors routinely. If you think that +you've found a error, follow the steps below, which are adapted from the instructions in +Chapter 1 of A Retargetable C Compiler: Design and Implementation. + +

      +
    1. If you don't have a source file that displays the error, create one. Most errors are + exposed when programmers try to compile a program they think is valid, so you probably + have a demonstration program already.
    2. +
    3. Preprocess the source file and capture the preprocessor output. Discard the original + code.
    4. +
    5. Prune your source code until it can be pruned no more without sending the error into + hiding. We prune most error demonstrations to fewer than five lines.
    6. +
    7. Confirm that the source file displays the error with the distributed version of + lcc. If you've changed lcc and the error appears only in your version, then you'll have to + chase the error yourself, even if it turns out to be our fault, because we can't work on + your code.
    8. +
    9. Annotate your code with comments that explain why you think that lcc is + wrong. If lcc dies with an assertion failure, please tell us where it died. If + lcc crashes, please report the last part of the call chain if you can. If lcc + is rejecting a program you think is valid, please tell us why you think it's + valid, and include supporting page numbers in the ANSI Standard or the + appropriate section in C: A Reference Manual, 4th edition by S. B. Harbison + and G. L. Steele, Jr. (Prentice Hall, 1995). If lcc silently generates incorrect code for + some construct, please include the corrupt assembly code in the comments and flag the + incorrect instructions if you can.
    10. +
    11. Confirm that your error hasn't been fixed already. The latest version of lcc is always + available for anonymous ftp from ftp.cs.princeton.edu in pub/lcc. A README file there gives + acquisition details, and the LOG file reports what errors + were fixed and when they were fixed. If you report a error that's been fixed, you might + get a canned reply.
    12. +
    13. Post your program to the newsgroup comp.compilers.lcc + using a USENET newsreader like those at http://www.dejanews.com/ + and http://groups.google.com/. + Please post only valid C programs; put all remarks in C comments so that we can process + reports semi automatically.
    14. +
    + +

    Keeping in Touch

    + +

    The USENET newsgroup comp.compilers.lcc is an +unmoderated newsgroup that serves as a forum for all topics related to the installation, +use, and development of lcc. You can post messages to comp.compilers.lcc using any USENET +newsreader or by visiting http://www.dejanews.com/, +which also includes an archive of recent postings.

    + +
    + +
    + Chris Fraser / cwfraser@microsoft.com
    + David Hanson / drh@microsoft.com
    + $Revision: 1.45 $ $Date: 2002/09/04 18:33:24 $ +
    + + \ No newline at end of file diff --git a/src/cmd/lccom-1/enode.c b/src/cmd/lccom-1/enode.c new file mode 100644 index 0000000..c9739f5 --- /dev/null +++ b/src/cmd/lccom-1/enode.c @@ -0,0 +1,550 @@ +#include "c.h" + +static Tree addtree(int, Tree, Tree); +static Tree andtree(int, Tree, Tree); +static Tree cmptree(int, Tree, Tree); +static int compatible(Type, Type); +static int isnullptr(Tree e); +static Tree multree(int, Tree, Tree); +static Tree subtree(int, Tree, Tree); +#define isvoidptr(ty) \ + (isptr(ty) && unqual(ty->type) == voidtype) + +Tree (*optree[])(int, Tree, Tree) = { +#define xx(a,b,c,d,e,f,g) e, +#define yy(a,b,c,d,e,f,g) e, +#include "token.h" +}; +Tree call(Tree f, Type fty, Coordinate src) { + int n = 0; + Tree args = NULL, r = NULL, e; + Type *proto, rty = unqual(freturn(fty)); + Symbol t3 = NULL; + + if (fty->u.f.oldstyle) + proto = NULL; + else + proto = fty->u.f.proto; + if (hascall(f)) + r = f; + if (isstruct(rty)) + { + t3 = temporary(AUTO, unqual(rty)); + if (rty->size == 0) + error("illegal use of incomplete type `%t'\n", rty); + } + if (t != ')') + for (;;) { + Tree q = pointer(expr1(0)); + if (proto && *proto && *proto != voidtype) + { + Type aty; + q = value(q); + aty = assign(*proto, q); + if (aty) + q = cast(q, aty); + else + error("type error in argument %d to %s; found `%t' expected `%t'\n", n + 1, funcname(f), + + q->type, *proto); + if ((isint(q->type) || isenum(q->type)) + && q->type->size != inttype->size) + q = cast(q, promote(q->type)); + ++proto; + } + else + { + if (!fty->u.f.oldstyle && *proto == NULL) + error("too many arguments to %s\n", funcname(f)); + q = value(q); + if (isarray(q->type) || q->type->size == 0) + error("type error in argument %d to %s; `%t' is illegal\n", n + 1, funcname(f), q->type); + + else + q = cast(q, promote(q->type)); + } + if (!IR->wants_argb && isstruct(q->type)) { + if (iscallb(q)) + q = addrof(q); + else { + Symbol t1 = temporary(AUTO, unqual(q->type)); + q = asgn(t1, q); + q = tree(RIGHT, ptr(t1->type), + root(q), lvalue(idtree(t1))); + } + } + if (q->type->size == 0) + q->type = inttype; + if (hascall(q)) + r = r ? tree(RIGHT, voidtype, r, q) : q; + args = tree(mkop(ARG, q->type), q->type, q, args); + n++; + if (Aflag >= 2 && n == 32) + warning("more than 31 arguments in a call to %s\n", + funcname(f)); + if (t != ',') + break; + t = gettok(); + } + expect(')'); + if (proto && *proto && *proto != voidtype) + error("insufficient number of arguments to %s\n", + funcname(f)); + if (r) + args = tree(RIGHT, voidtype, r, args); + e = calltree(f, rty, args, t3); + if (events.calls) + apply(events.calls, &src, &e); + return e; +} +Tree calltree(Tree f, Type ty, Tree args, Symbol t3) { + Tree p; + + if (args) + f = tree(RIGHT, f->type, args, f); + if (isstruct(ty)) { + assert(t3); + p = tree(RIGHT, ty, + tree(CALL+B, ty, f, addrof(idtree(t3))), + idtree(t3)); + } else { + Type rty = ty; + if (isenum(ty)) + rty = unqual(ty)->type; + if (!isfloat(rty)) + rty = promote(rty); + p = tree(mkop(CALL, rty), rty, f, NULL); + if (isptr(ty) || p->type->size > ty->size) + p = cast(p, ty); + } + return p; +} +Tree vcall(Symbol func, Type ty, ...) { + va_list ap; + Tree args = NULL, e, f = pointer(idtree(func)), r = NULL; + + assert(isfunc(func->type)); + if (ty == NULL) + ty = freturn(func->type); + va_start(ap, ty); + while ((e = va_arg(ap, Tree)) != NULL) { + if (hascall(e)) + r = r == NULL ? e : tree(RIGHT, voidtype, r, e); + args = tree(mkop(ARG, e->type), e->type, e, args); + } + va_end(ap); + if (r != NULL) + args = tree(RIGHT, voidtype, r, args); + return calltree(f, ty, args, NULL); +} +int iscallb(Tree e) { + return e->op == RIGHT && e->kids[0] && e->kids[1] + && e->kids[0]->op == CALL+B + && e->kids[1]->op == INDIR+B + && isaddrop(e->kids[1]->kids[0]->op) + && e->kids[1]->kids[0]->u.sym->temporary; +} + +static Tree addtree(int op, Tree l, Tree r) { + Type ty = inttype; + + if (isarith(l->type) && isarith(r->type)) { + ty = binary(l->type, r->type); + l = cast(l, ty); + r = cast(r, ty); + } else if (isptr(l->type) && isint(r->type)) + return addtree(ADD, r, l); + else if ( isptr(r->type) && isint(l->type) + && !isfunc(r->type->type)) + { + long n; + ty = unqual(r->type); + n = unqual(ty->type)->size; + if (n == 0) + error("unknown size for type `%t'\n", ty->type); + l = cast(l, promote(l->type)); + if (n > 1) + l = multree(MUL, cnsttree(signedptr, n), l); + if (isunsigned(l->type)) + l = cast(l, unsignedptr); + else + l = cast(l, signedptr); + if (YYcheck && !isaddrop(r->op)) /* omit */ + return nullcall(ty, YYcheck, r, l); /* omit */ + return simplify(ADD, ty, l, r); + } + + else + typeerror(op, l, r); + return simplify(op, ty, l, r); +} + +Tree cnsttree(Type ty, ...) { + Tree p = tree(mkop(CNST,ty), ty, NULL, NULL); + va_list ap; + + va_start(ap, ty); + switch (ty->op) { + case INT: p->u.v.i = va_arg(ap, long); break; + case UNSIGNED:p->u.v.u = va_arg(ap, unsigned long)&ones(8*ty->size); break; + case FLOAT: p->u.v.d = va_arg(ap, long double); break; + case POINTER: p->u.v.p = va_arg(ap, void *); break; + default: assert(0); + } + va_end(ap); + return p; +} + +Tree consttree(unsigned n, Type ty) { + if (isarray(ty)) + ty = atop(ty); + else assert(isint(ty)); + return cnsttree(ty, (unsigned long)n); +} +static Tree cmptree(int op, Tree l, Tree r) { + Type ty; + + if (isarith(l->type) && isarith(r->type)) { + ty = binary(l->type, r->type); + l = cast(l, ty); + r = cast(r, ty); + } else if (compatible(l->type, r->type)) { + ty = unsignedptr; + l = cast(l, ty); + r = cast(r, ty); + } else { + ty = unsignedtype; + typeerror(op, l, r); + } + return simplify(mkop(op,ty), inttype, l, r); +} +static int compatible(Type ty1, Type ty2) { + ty1 = unqual(ty1); + ty2 = unqual(ty2); + return isptr(ty1) && !isfunc(ty1->type) + && isptr(ty2) && !isfunc(ty2->type) + && eqtype(unqual(ty1->type), unqual(ty2->type), 0); +} +static int isnullptr(Tree e) { + Type ty = unqual(e->type); + + return generic(e->op) == CNST + && ((ty->op == INT && e->u.v.i == 0) + || (ty->op == UNSIGNED && e->u.v.u == 0) + || (isvoidptr(ty) && e->u.v.p == NULL)); +} +Tree eqtree(int op, Tree l, Tree r) { + Type xty = unqual(l->type), yty = unqual(r->type); + + if ((isptr(xty) && isnullptr(r)) + || (isptr(xty) && !isfunc(xty->type) && isvoidptr(yty)) + || (isptr(xty) && isptr(yty) + && eqtype(unqual(xty->type), unqual(yty->type), 1))) { + Type ty = unsignedptr; + l = cast(l, ty); + r = cast(r, ty); + return simplify(mkop(op,ty), inttype, l, r); + } + if ((isptr(yty) && isnullptr(l)) + || (isptr(yty) && !isfunc(yty->type) && isvoidptr(xty))) + return eqtree(op, r, l); + return cmptree(op, l, r); +} + +Type assign(Type xty, Tree e) { + Type yty = unqual(e->type); + + xty = unqual(xty); + if (isenum(xty)) + xty = xty->type; + if (xty->size == 0 || yty->size == 0) + return NULL; + if ((isarith(xty) && isarith(yty)) + || (isstruct(xty) && xty == yty)) + return xty; + if (isptr(xty) && isnullptr(e)) + return xty; + if (((isvoidptr(xty) && isptr(yty)) + || (isptr(xty) && isvoidptr(yty))) + && ( (isconst(xty->type) || !isconst(yty->type)) + && (isvolatile(xty->type) || !isvolatile(yty->type)))) + return xty; + + if ((isptr(xty) && isptr(yty) + && eqtype(unqual(xty->type), unqual(yty->type), 1)) + && ( (isconst(xty->type) || !isconst(yty->type)) + && (isvolatile(xty->type) || !isvolatile(yty->type)))) + return xty; + if (isptr(xty) && isptr(yty) + && ( (isconst(xty->type) || !isconst(yty->type)) + && (isvolatile(xty->type) || !isvolatile(yty->type)))) { + Type lty = unqual(xty->type), rty = unqual(yty->type); + if ((isenum(lty) && rty == inttype) + || (isenum(rty) && lty == inttype)) { + if (Aflag >= 1) + warning("assignment between `%t' and `%t' is compiler-dependent\n", + xty, yty); + return xty; + } + } + return NULL; +} +Tree asgntree(int op, Tree l, Tree r) { + Type aty, ty; + + r = pointer(r); + ty = assign(l->type, r); + if (ty) + r = cast(r, ty); + else { + typeerror(ASGN, l, r); + if (r->type == voidtype) + r = retype(r, inttype); + ty = r->type; + } + if (l->op != FIELD) + l = lvalue(l); + aty = l->type; + if (isptr(aty)) + aty = unqual(aty)->type; + if ( isconst(aty) + || (isstruct(aty) && unqual(aty)->u.sym->u.s.cfields)) { + if (isaddrop(l->op) + && !l->u.sym->computed && !l->u.sym->generated) + error("assignment to const identifier `%s'\n", + l->u.sym->name); + else + error("assignment to const location\n"); + } + if (l->op == FIELD) { + long n = 8*l->u.field->type->size - fieldsize(l->u.field); + if (n > 0 && isunsigned(l->u.field->type)) + r = bittree(BAND, r, + cnsttree(r->type, (unsigned long)fieldmask(l->u.field))); + else if (n > 0) { + if (r->op == CNST+I) { + n = r->u.v.i; + if (n&(1<<(fieldsize(l->u.field)-1))) + n |= ~0UL<u.field); + r = cnsttree(r->type, n); + } else + r = shtree(RSH, + shtree(LSH, r, cnsttree(inttype, n)), + cnsttree(inttype, n)); + } + } + if (isstruct(ty) && isaddrop(l->op) && iscallb(r)) + return tree(RIGHT, ty, + tree(CALL+B, ty, r->kids[0]->kids[0], l), + idtree(l->u.sym)); + return tree(mkop(op,ty), ty, l, r); +} +Tree condtree(Tree e, Tree l, Tree r) { + Symbol t1; + Type ty, xty = l->type, yty = r->type; + Tree p; + + if (isarith(xty) && isarith(yty)) + ty = binary(xty, yty); + else if (eqtype(xty, yty, 1)) + ty = unqual(xty); + else if (isptr(xty) && isnullptr(r)) + ty = xty; + else if (isnullptr(l) && isptr(yty)) + ty = yty; + else if ((isptr(xty) && !isfunc(xty->type) && isvoidptr(yty)) + || (isptr(yty) && !isfunc(yty->type) && isvoidptr(xty))) + ty = voidptype; + else if ((isptr(xty) && isptr(yty) + && eqtype(unqual(xty->type), unqual(yty->type), 1))) + ty = xty; + else { + typeerror(COND, l, r); + return consttree(0, inttype); + } + if (isptr(ty)) { + ty = unqual(unqual(ty)->type); + if ((isptr(xty) && isconst(unqual(xty)->type)) + || (isptr(yty) && isconst(unqual(yty)->type))) + ty = qual(CONST, ty); + if ((isptr(xty) && isvolatile(unqual(xty)->type)) + || (isptr(yty) && isvolatile(unqual(yty)->type))) + ty = qual(VOLATILE, ty); + ty = ptr(ty); + } + switch (e->op) { + case CNST+I: return cast(e->u.v.i != 0 ? l : r, ty); + case CNST+U: return cast(e->u.v.u != 0 ? l : r, ty); + case CNST+P: return cast(e->u.v.p != 0 ? l : r, ty); + case CNST+F: return cast(e->u.v.d != 0.0 ? l : r, ty); + } + if (ty != voidtype && ty->size > 0) { + t1 = genident(REGISTER, unqual(ty), level); + /* t1 = temporary(REGISTER, unqual(ty)); */ + l = asgn(t1, l); + r = asgn(t1, r); + } else + t1 = NULL; + p = tree(COND, ty, cond(e), + tree(RIGHT, ty, root(l), root(r))); + p->u.sym = t1; + return p; +} +/* addrof - address of p */ +Tree addrof(Tree p) { + Tree q = p; + + for (;;) + switch (generic(q->op)) { + case RIGHT: + assert(q->kids[0] || q->kids[1]); + q = q->kids[1] ? q->kids[1] : q->kids[0]; + continue; + case ASGN: + q = q->kids[1]; + continue; + case COND: { + Symbol t1 = q->u.sym; + q->u.sym = 0; + q = idtree(t1); + /* fall thru */ + } + case INDIR: + if (p == q) + return q->kids[0]; + q = q->kids[0]; + return tree(RIGHT, q->type, root(p), q); + default: + error("addressable object required\n"); + return value(p); + } +} + +/* andtree - construct tree for l [&& ||] r */ +static Tree andtree(int op, Tree l, Tree r) { + if (!isscalar(l->type) || !isscalar(r->type)) + typeerror(op, l, r); + return simplify(op, inttype, cond(l), cond(r)); +} + +/* asgn - generate tree for assignment of expr e to symbol p sans qualifiers */ +Tree asgn(Symbol p, Tree e) { + if (isarray(p->type)) + e = tree(ASGN+B, p->type, idtree(p), + tree(INDIR+B, e->type, e, NULL)); + else { + Type ty = p->type; + p->type = unqual(p->type); + if (isstruct(p->type) && p->type->u.sym->u.s.cfields) { + p->type->u.sym->u.s.cfields = 0; + e = asgntree(ASGN, idtree(p), e); + p->type->u.sym->u.s.cfields = 1; + } else + e = asgntree(ASGN, idtree(p), e); + p->type = ty; + } + return e; +} + +/* bittree - construct tree for l [& | ^ %] r */ +Tree bittree(int op, Tree l, Tree r) { + Type ty = inttype; + + if (isint(l->type) && isint(r->type)) { + ty = binary(l->type, r->type); + l = cast(l, ty); + r = cast(r, ty); + } else + typeerror(op, l, r); + return simplify(op, ty, l, r); +} + +/* multree - construct tree for l [* /] r */ +static Tree multree(int op, Tree l, Tree r) { + Type ty = inttype; + + if (isarith(l->type) && isarith(r->type)) { + ty = binary(l->type, r->type); + l = cast(l, ty); + r = cast(r, ty); + } else + typeerror(op, l, r); + return simplify(op, ty, l, r); +} + +/* shtree - construct tree for l [>> <<] r */ +Tree shtree(int op, Tree l, Tree r) { + Type ty = inttype; + + if (isint(l->type) && isint(r->type)) { + ty = promote(l->type); + l = cast(l, ty); + r = cast(r, inttype); + } else + typeerror(op, l, r); + return simplify(op, ty, l, r); +} + +/* subtree - construct tree for l - r */ +static Tree subtree(int op, Tree l, Tree r) { + long n; + Type ty = inttype; + + if (isarith(l->type) && isarith(r->type)) { + ty = binary(l->type, r->type); + l = cast(l, ty); + r = cast(r, ty); + } else if (isptr(l->type) && !isfunc(l->type->type) && isint(r->type)) { + ty = unqual(l->type); + n = unqual(ty->type)->size; + if (n == 0) + error("unknown size for type `%t'\n", ty->type); + r = cast(r, promote(r->type)); + if (n > 1) + r = multree(MUL, cnsttree(signedptr, n), r); + if (isunsigned(r->type)) + r = cast(r, unsignedptr); + else + r = cast(r, signedptr); + return simplify(SUB+P, ty, l, r); + } else if (compatible(l->type, r->type)) { + ty = unqual(l->type); + n = unqual(ty->type)->size; + if (n == 0) + error("unknown size for type `%t'\n", ty->type); + l = simplify(SUB+U, unsignedptr, + cast(l, unsignedptr), cast(r, unsignedptr)); + return simplify(DIV+I, longtype, + cast(l, longtype), cnsttree(longtype, n)); + } else + typeerror(op, l, r); + return simplify(op, ty, l, r); +} + +/* typeerror - issue "operands of op have illegal types `l' and `r'" */ +void typeerror(int op, Tree l, Tree r) { + int i; + static struct { int op; char *name; } ops[] = { + { ASGN, "=" }, { INDIR, "*" }, { NEG, "-" }, + { ADD, "+" }, { SUB, "-" }, { LSH, "<<"}, + { MOD, "%" }, { RSH, ">>"}, { BAND, "&" }, + { BCOM, "~" }, { BOR, "|" }, { BXOR, "^" }, + { DIV, "/" }, { MUL, "*" }, { EQ, "=="}, + { GE, ">="}, { GT, ">" }, { LE, "<="}, + { LT, "<" }, { NE, "!="}, { AND, "&&"}, + { NOT, "!" }, { OR, "||"}, { COND, "?:"}, + { 0, 0 } + }; + + op = generic(op); + for (i = 0; ops[i].op; i++) + if (op == ops[i].op) + break; + assert(ops[i].name); + if (r) + error("operands of %s have illegal types `%t' and `%t'\n", + ops[i].name, l->type, r->type); + else + error("operand of unary %s has illegal type `%t'\n", ops[i].name, + l->type); +} diff --git a/src/cmd/lccom-1/error.c b/src/cmd/lccom-1/error.c new file mode 100644 index 0000000..6b69791 --- /dev/null +++ b/src/cmd/lccom-1/error.c @@ -0,0 +1,136 @@ +#include "c.h" + +static void printtoken(void); +int errcnt = 0; +int errlimit = 20; +char kind[] = { +#define xx(a,b,c,d,e,f,g) f, +#define yy(a,b,c,d,e,f,g) f, +#include "token.h" +}; +int wflag; /* != 0 to suppress warning messages */ + +void test(int tok, char set[]) { + if (t == tok) + t = gettok(); + else { + expect(tok); + skipto(tok, set); + if (t == tok) + t = gettok(); + } +} +void expect(int tok) { + if (t == tok) + t = gettok(); + else { + error("syntax error; found"); + printtoken(); + fprint(stderr, " expecting `%k'\n", tok); + } +} +void error(const char *fmt, ...) { + va_list ap; + + if (errcnt++ >= errlimit) { + errcnt = -1; + error("too many errors\n"); + exit(1); + } + va_start(ap, fmt); + if (firstfile != file && firstfile && *firstfile) + fprint(stderr, "%s: ", firstfile); + fprint(stderr, "%w: ", &src); + vfprint(stderr, NULL, fmt, ap); + va_end(ap); +} + +void skipto(int tok, char set[]) { + int n; + char *s; + + assert(set); + for (n = 0; t != EOI && t != tok; t = gettok()) { + for (s = set; *s && kind[t] != *s; s++) + ; + if (kind[t] == *s) + break; + if (n++ == 0) + error("skipping"); + if (n <= 8) + printtoken(); + else if (n == 9) + fprint(stderr, " ..."); + } + if (n > 8) { + fprint(stderr, " up to"); + printtoken(); + } + if (n > 0) + fprint(stderr, "\n"); +} +/* fatal - issue fatal error message and exit */ +int fatal(const char *name, const char *fmt, int n) { + print("\n"); + errcnt = -1; + error("compiler error in %s--", name); + fprint(stderr, fmt, n); + exit(EXIT_FAILURE); + return 0; +} + +/* printtoken - print current token preceeded by a space */ +static void printtoken(void) { + switch (t) { + case ID: fprint(stderr, " `%s'", token); break; + case ICON: + fprint(stderr, " `%s'", vtoa(tsym->type, tsym->u.c.v)); + break; + case SCON: { + int i, n; + if (ischar(tsym->type->type)) { + char *s = tsym->u.c.v.p; + n = tsym->type->size; + fprint(stderr, " \""); + for (i = 0; i < 20 && i < n && *s; s++, i++) + if (*s < ' ' || *s >= 0177) + fprint(stderr, "\\%o", *s); + else + fprint(stderr, "%c", *s); + } else { /* wchar_t string */ + unsigned int *s = tsym->u.c.v.p; + assert(tsym->type->type->size == widechar->size); + n = tsym->type->size/widechar->size; + fprint(stderr, " L\""); + for (i = 0; i < 20 && i < n && *s; s++, i++) + if (*s < ' ' || *s >= 0177) + fprint(stderr, "\\x%x", *s); + else + fprint(stderr, "%c", *s); + } + if (i < n) + fprint(stderr, " ..."); + else + fprint(stderr, "\""); + break; + } + case FCON: + fprint(stderr, " `%S'", token, (char*)cp - token); + break; + case '`': case '\'': fprint(stderr, " \"%k\"", t); break; + default: fprint(stderr, " `%k'", t); + } +} + +/* warning - issue warning error message */ +void warning(const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + if (wflag == 0) { + errcnt--; + error("warning: "); + vfprint(stderr, NULL, fmt, ap); + } + va_end(ap); +} diff --git a/src/cmd/lccom-1/event.c b/src/cmd/lccom-1/event.c new file mode 100644 index 0000000..6e5cf29 --- /dev/null +++ b/src/cmd/lccom-1/event.c @@ -0,0 +1,26 @@ +#include "c.h" + +struct entry { + Apply func; + void *cl; +}; + +Events events; +void attach(Apply func, void *cl, List *list) { + struct entry *p; + + NEW(p, PERM); + p->func = func; + p->cl = cl; + *list = append(p, *list); +} +void apply(List event, void *arg1, void *arg2) { + if (event) { + List lp = event; + do { + struct entry *p = lp->x; + (*p->func)(p->cl, arg1, arg2); + lp = lp->link; + } while (lp != event); + } +} diff --git a/src/cmd/lccom-1/expr.c b/src/cmd/lccom-1/expr.c new file mode 100644 index 0000000..a5673a0 --- /dev/null +++ b/src/cmd/lccom-1/expr.c @@ -0,0 +1,711 @@ +#include "c.h" + +static char prec[] = { +#define xx(a,b,c,d,e,f,g) c, +#define yy(a,b,c,d,e,f,g) c, +#include "token.h" +}; +static int oper[] = { +#define xx(a,b,c,d,e,f,g) d, +#define yy(a,b,c,d,e,f,g) d, +#include "token.h" +}; +float refinc = 1.0; +static Tree expr2(void); +static Tree expr3(int); +static Tree nullcheck(Tree); +static Tree postfix(Tree); +static Tree unary(void); +static Tree primary(void); +static Type super(Type ty); + +static Type super(Type ty) { + switch (ty->op) { + case INT: + if (ty->size < inttype->size) + return inttype; + break; + case UNSIGNED: + if (ty->size < unsignedtype->size) + return unsignedtype; + break; + case POINTER: + return unsignedptr; + } + return ty; +} +Tree expr(int tok) { + static char stop[] = { IF, ID, '}', 0 }; + Tree p = expr1(0); + + while (t == ',') { + Tree q; + t = gettok(); + q = pointer(expr1(0)); + p = tree(RIGHT, q->type, root(value(p)), q); + } + if (tok) + test(tok, stop); + return p; +} +Tree expr0(int tok) { + return root(expr(tok)); +} +Tree expr1(int tok) { + static char stop[] = { IF, ID, 0 }; + Tree p = expr2(); + + if (t == '=' + || (prec[t] >= 6 && prec[t] <= 8) + || (prec[t] >= 11 && prec[t] <= 13)) { + int op = t; + t = gettok(); + if (oper[op] == ASGN) + p = asgntree(ASGN, p, value(expr1(0))); + else + { + expect('='); + p = incr(op, p, expr1(0)); + } + } + if (tok) + test(tok, stop); + return p; +} +Tree incr(int op, Tree v, Tree e) { + return asgntree(ASGN, v, (*optree[op])(oper[op], v, e)); +} +static Tree expr2(void) { + Tree p = expr3(4); + + if (t == '?') { + Tree l, r; + Coordinate pts[2]; + if (Aflag > 1 && isfunc(p->type)) + warning("%s used in a conditional expression\n", + funcname(p)); + p = pointer(p); + t = gettok(); + pts[0] = src; + l = pointer(expr(':')); + pts[1] = src; + r = pointer(expr2()); + if (generic(p->op) != CNST && events.points) + { + apply(events.points, &pts[0], &l); + apply(events.points, &pts[1], &r); + } + p = condtree(p, l, r); + } + return p; +} +Tree value(Tree p) { + int op = generic(rightkid(p)->op); + + if (p->type != voidtype + && (op==AND || op==OR || op==NOT || op==EQ || op==NE + || op== LE || op==LT || op== GE || op==GT)) + p = condtree(p, consttree(1, inttype), + consttree(0, inttype)); + return p; +} +static Tree expr3(int k) { + int k1; + Tree p = unary(); + + for (k1 = prec[t]; k1 >= k; k1--) + while (prec[t] == k1 && *cp != '=') { + Tree r; + Coordinate pt; + int op = t; + t = gettok(); + pt = src; + p = pointer(p); + if (op == ANDAND || op == OROR) { + r = pointer(expr3(k1)); + if (events.points) + apply(events.points, &pt, &r); + } else + r = pointer(expr3(k1 + 1)); + p = (*optree[op])(oper[op], p, r); + } + return p; +} +static Tree unary(void) { + Tree p; + + switch (t) { + case '*': t = gettok(); p = unary(); p = pointer(p); + if (isptr(p->type) + && (isfunc(p->type->type) || isarray(p->type->type))) + p = retype(p, p->type->type); + else { + if (YYnull) + p = nullcheck(p); + p = rvalue(p); + } break; + case '&': t = gettok(); p = unary(); if (isarray(p->type) || isfunc(p->type)) + p = retype(p, ptr(p->type)); + else + p = lvalue(p); + if (isaddrop(p->op) && p->u.sym->sclass == REGISTER) + error("invalid operand of unary &; `%s' is declared register\n", p->u.sym->name); + + else if (isaddrop(p->op)) + p->u.sym->addressed = 1; + break; + case '+': t = gettok(); p = unary(); p = pointer(p); + if (isarith(p->type)) + p = cast(p, promote(p->type)); + else + typeerror(ADD, p, NULL); break; + case '-': t = gettok(); p = unary(); p = pointer(p); + if (isarith(p->type)) { + Type ty = promote(p->type); + p = cast(p, ty); + if (isunsigned(ty)) { + warning("unsigned operand of unary -\n"); + p = simplify(ADD, ty, simplify(BCOM, ty, p, NULL), cnsttree(ty, 1UL)); + } else + p = simplify(NEG, ty, p, NULL); + } else + typeerror(SUB, p, NULL); break; + case '~': t = gettok(); p = unary(); p = pointer(p); + if (isint(p->type)) { + Type ty = promote(p->type); + p = simplify(BCOM, ty, cast(p, ty), NULL); + } else + typeerror(BCOM, p, NULL); break; + case '!': t = gettok(); p = unary(); p = pointer(p); + if (isscalar(p->type)) + p = simplify(NOT, inttype, cond(p), NULL); + else + typeerror(NOT, p, NULL); break; + case INCR: t = gettok(); p = unary(); p = incr(INCR, pointer(p), consttree(1, inttype)); break; + case DECR: t = gettok(); p = unary(); p = incr(DECR, pointer(p), consttree(1, inttype)); break; + case TYPECODE: case SIZEOF: { int op = t; + Type ty; + p = NULL; + t = gettok(); + if (t == '(') { + t = gettok(); + if (istypename(t, tsym)) { + ty = typename(); + expect(')'); + } else { + p = postfix(expr(')')); + ty = p->type; + } + } else { + p = unary(); + ty = p->type; + } + assert(ty); + if (op == TYPECODE) + p = cnsttree(inttype, (long)ty->op); + else { + if (isfunc(ty) || ty->size == 0) + error("invalid type argument `%t' to `sizeof'\n", ty); + else if (p && rightkid(p)->op == FIELD) + error("`sizeof' applied to a bit field\n"); + p = cnsttree(unsignedlong, (unsigned long)ty->size); + } } break; + case '(': + t = gettok(); + if (istypename(t, tsym)) { + Type ty, ty1 = typename(), pty; + expect(')'); + ty = unqual(ty1); + if (isenum(ty)) { + Type ty2 = ty->type; + if (isconst(ty1)) + ty2 = qual(CONST, ty2); + if (isvolatile(ty1)) + ty2 = qual(VOLATILE, ty2); + ty1 = ty2; + ty = ty->type; + } + p = pointer(unary()); + pty = p->type; + if (isenum(pty)) + pty = pty->type; + if ((isarith(pty) && isarith(ty)) + || (isptr(pty) && isptr(ty))) { + explicitCast++; + p = cast(p, ty); + explicitCast--; + } else if ((isptr(pty) && isint(ty)) + || (isint(pty) && isptr(ty))) { + if (Aflag >= 1 && ty->size < pty->size) + warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, ty); + + p = cast(p, ty); + } else if (ty != voidtype) { + error("cast from `%t' to `%t' is illegal\n", + p->type, ty1); + ty1 = inttype; + } + if (generic(p->op) == INDIR || ty->size == 0) + p = tree(RIGHT, ty1, NULL, p); + else + p = retype(p, ty1); + } else + p = postfix(expr(')')); + break; + default: + p = postfix(primary()); + } + return p; +} + +static Tree postfix(Tree p) { + for (;;) + switch (t) { + case INCR: p = tree(RIGHT, p->type, + tree(RIGHT, p->type, + p, + incr(t, p, consttree(1, inttype))), + p); + t = gettok(); break; + case DECR: p = tree(RIGHT, p->type, + tree(RIGHT, p->type, + p, + incr(t, p, consttree(1, inttype))), + p); + t = gettok(); break; + case '[': { + Tree q; + t = gettok(); + q = expr(']'); + if (YYnull) { + if (isptr(p->type)) + p = nullcheck(p); + else if (isptr(q->type)) + q = nullcheck(q); + } + p = (*optree['+'])(ADD, pointer(p), pointer(q)); + if (isptr(p->type) && isarray(p->type->type)) + p = retype(p, p->type->type); + else + p = rvalue(p); + } break; + case '(': { + Type ty; + Coordinate pt; + p = pointer(p); + if (isptr(p->type) && isfunc(p->type->type)) + ty = p->type->type; + else { + error("found `%t' expected a function\n", p->type); + ty = func(voidtype, NULL, 1); + p = retype(p, ptr(ty)); + } + pt = src; + t = gettok(); + p = call(p, ty, pt); + } break; + case '.': t = gettok(); + if (t == ID) { + if (isstruct(p->type)) { + Tree q = addrof(p); + p = field(q, token); + q = rightkid(q); + if (isaddrop(q->op) && q->u.sym->temporary) + p = tree(RIGHT, p->type, p, NULL); + } else + error("left operand of . has incompatible type `%t'\n", + p->type); + t = gettok(); + } else + error("field name expected\n"); break; + case DEREF: t = gettok(); + p = pointer(p); + if (t == ID) { + if (isptr(p->type) && isstruct(p->type->type)) { + if (YYnull) + p = nullcheck(p); + p = field(p, token); + } else + error("left operand of -> has incompatible type `%t'\n", p->type); + + t = gettok(); + } else + error("field name expected\n"); break; + default: + return p; + } +} +static Tree primary(void) { + Tree p; + + assert(t != '('); + switch (t) { + case ICON: + case FCON: p = tree(mkop(CNST,tsym->type), tsym->type, NULL, NULL); + p->u.v = tsym->u.c.v; + break; + case SCON: if (ischar(tsym->type->type)) + tsym->u.c.v.p = stringn(tsym->u.c.v.p, tsym->type->size); + else + tsym->u.c.v.p = memcpy(allocate((tsym->type->size/widechar->size)*sizeof (int), PERM), + tsym->u.c.v.p, (tsym->type->size/widechar->size)*sizeof (int)); + tsym = constant(tsym->type, tsym->u.c.v); + if (tsym->u.c.loc == NULL) + tsym->u.c.loc = genident(STATIC, tsym->type, GLOBAL); + p = idtree(tsym->u.c.loc); break; + case ID: if (tsym == NULL) + { + Symbol p = install(token, &identifiers, level, PERM); + p->src = src; + if (getchr() == '(') { + Symbol q = lookup(token, externals); + p->type = func(inttype, NULL, 1); + p->sclass = EXTERN; + if (Aflag >= 1) + warning("missing prototype\n"); + if (q && !eqtype(q->type, p->type, 1)) + warning("implicit declaration of `%s' does not match previous declaration at %w\n", q->name, &q->src); + + if (q == NULL) { + q = install(p->name, &externals, GLOBAL, PERM); + q->type = p->type; + q->sclass = EXTERN; + q->src = src; + (*IR->defsymbol)(q); + } + p->u.alias = q; + } else { + error("undeclared identifier `%s'\n", p->name); + p->sclass = AUTO; + p->type = inttype; + if (p->scope == GLOBAL) + (*IR->defsymbol)(p); + else + addlocal(p); + } + t = gettok(); + if (xref) + use(p, src); + return idtree(p); + } + if (xref) + use(tsym, src); + if (tsym->sclass == ENUM) + p = consttree(tsym->u.value, inttype); + else { + if (tsym->sclass == TYPEDEF) + error("illegal use of type name `%s'\n", tsym->name); + p = idtree(tsym); + } break; + case FIRSTARG: + if (level > PARAM && cfunc && cfunc->u.f.callee[0]) + p = idtree(cfunc->u.f.callee[0]); + else { + error("illegal use of `%k'\n", FIRSTARG); + p = cnsttree(inttype, 0L); + } + break; + default: + error("illegal expression\n"); + p = cnsttree(inttype, 0L); + } + t = gettok(); + return p; +} +Tree idtree(Symbol p) { + int op; + Tree e; + Type ty = p->type ? unqual(p->type) : voidptype; + + if (p->scope == GLOBAL || p->sclass == STATIC) + op = ADDRG; + else if (p->scope == PARAM) { + op = ADDRF; + if (isstruct(p->type) && !IR->wants_argb) + { + e = tree(mkop(op,voidptype), ptr(ptr(p->type)), NULL, NULL); + e->u.sym = p; + return rvalue(rvalue(e)); + } + } else if (p->sclass == EXTERN) { + assert(p->u.alias); + p = p->u.alias; + op = ADDRG; + } else + op = ADDRL; + p->ref += refinc; + if (isarray(ty)) + e = tree(mkop(op,voidptype), p->type, NULL, NULL); + else if (isfunc(ty)) + e = tree(mkop(op,funcptype), p->type, NULL, NULL); + else + e = tree(mkop(op,voidptype), ptr(p->type), NULL, NULL); + e->u.sym = p; + if (isptr(e->type)) + e = rvalue(e); + return e; +} + +Tree rvalue(Tree p) { + Type ty = deref(p->type); + + ty = unqual(ty); + return tree(mkop(INDIR,ty), ty, p, NULL); +} +Tree lvalue(Tree p) { + if (generic(p->op) != INDIR) { + error("lvalue required\n"); + return value(p); + } else if (unqual(p->type) == voidtype) + warning("`%t' used as an lvalue\n", p->type); + return p->kids[0]; +} +Tree retype(Tree p, Type ty) { + Tree q; + + if (p->type == ty) + return p; + q = tree(p->op, ty, p->kids[0], p->kids[1]); + q->node = p->node; + q->u = p->u; + return q; +} +Tree rightkid(Tree p) { + while (p && p->op == RIGHT) + if (p->kids[1]) + p = p->kids[1]; + else if (p->kids[0]) + p = p->kids[0]; + else + assert(0); + assert(p); + return p; +} +int hascall(Tree p) { + if (p == 0) + return 0; + if (generic(p->op) == CALL || (IR->mulops_calls && + (p->op == DIV+I || p->op == MOD+I || p->op == MUL+I + || p->op == DIV+U || p->op == MOD+U || p->op == MUL+U))) + return 1; + return hascall(p->kids[0]) || hascall(p->kids[1]); +} +Type binary(Type xty, Type yty) { +#define xx(t) if (xty == t || yty == t) return t + xx(longdouble); + xx(doubletype); + xx(floattype); + xx(unsignedlonglong); + xx(longlong); + xx(unsignedlong); + if ((xty == longtype && yty == unsignedtype) + || (xty == unsignedtype && yty == longtype)) { + if (longtype->size > unsignedtype->size) + return longtype; + else + return unsignedlong; + } + xx(longtype); + xx(unsignedtype); + return inttype; +#undef xx +} +Tree pointer(Tree p) { + if (isarray(p->type)) + /* assert(p->op != RIGHT || p->u.sym == NULL), */ + p = retype(p, atop(p->type)); + else if (isfunc(p->type)) + p = retype(p, ptr(p->type)); + return p; +} +Tree cond(Tree p) { + int op = generic(rightkid(p)->op); + + if (op == AND || op == OR || op == NOT + || op == EQ || op == NE + || op == LE || op == LT || op == GE || op == GT) + return p; + p = pointer(p); + return (*optree[NEQ])(NE, p, consttree(0, inttype)); +} +Tree cast(Tree p, Type type) { + Type src, dst; + + p = value(p); + if (p->type == type) + return p; + dst = unqual(type); + src = unqual(p->type); + if (src->op != dst->op || src->size != dst->size) { + switch (src->op) { + case INT: + if (src->size < inttype->size) + p = simplify(CVI, inttype, p, NULL); + break; + case UNSIGNED: + if (src->size < inttype->size) + p = simplify(CVU, inttype, p, NULL); + else if (src->size < unsignedtype->size) + p = simplify(CVU, unsignedtype, p, NULL); + break; + case ENUM: + p = retype(p, inttype); + break; + case POINTER: + if (isint(dst) && src->size > dst->size) + warning("conversion from `%t' to `%t' is undefined\n", p->type, type); + p = simplify(CVP, super(src), p, NULL); + break; + case FLOAT: + break; + default: assert(0); + } + { + src = unqual(p->type); + dst = super(dst); + if (src->op != dst->op) + switch (src->op) { + case INT: + p = simplify(CVI, dst, p, NULL); + break; + case UNSIGNED: + if (isfloat(dst)) { + Type ssrc = signedint(src); + Tree two = cnsttree(longdouble, (long double)2.0); + p = (*optree['+'])(ADD, + (*optree['*'])(MUL, + two, + simplify(CVU, ssrc, + simplify(RSH, src, + p, consttree(1, inttype)), NULL)), + simplify(CVU, ssrc, + simplify(BAND, src, + p, consttree(1, unsignedtype)), NULL)); + } else + p = simplify(CVU, dst, p, NULL); + break; + case FLOAT: + if (isunsigned(dst)) { + Type sdst = signedint(dst); + Tree c = cast(cnsttree(longdouble, (long double)sdst->u.sym->u.limits.max.i + 1), src); + p = condtree( + simplify(GE, src, p, c), + (*optree['+'])(ADD, + cast(cast(simplify(SUB, src, p, c), sdst), dst), + cast(cnsttree(unsignedlong, (unsigned long)sdst->u.sym->u.limits.max.i + 1), dst)), + simplify(CVF, sdst, p, NULL)); + } else + p = simplify(CVF, dst, p, NULL); + break; + default: assert(0); + } + dst = unqual(type); + } + } + src = unqual(p->type); + switch (src->op) { + case INT: + if (src->op != dst->op || src->size != dst->size) + p = simplify(CVI, dst, p, NULL); + break; + case UNSIGNED: + if (src->op != dst->op || src->size != dst->size) + p = simplify(CVU, dst, p, NULL); + break; + case FLOAT: + if (src->op != dst->op || src->size != dst->size) + p = simplify(CVF, dst, p, NULL); + break; + case POINTER: + if (src->op != dst->op) + p = simplify(CVP, dst, p, NULL); + else { + if ((isfunc(src->type) && !isfunc(dst->type)) + || (!isfunc(src->type) && isfunc(dst->type))) + warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, type); + + if (src->size != dst->size) + p = simplify(CVP, dst, p, NULL); + } + break; + default: assert(0); + } + return retype(p, type); +} +Tree field(Tree p, const char *name) { + Field q; + Type ty1, ty = p->type; + + if (isptr(ty)) + ty = deref(ty); + ty1 = ty; + ty = unqual(ty); + if ((q = fieldref(name, ty)) != NULL) { + if (isarray(q->type)) { + ty = q->type->type; + if (isconst(ty1) && !isconst(ty)) + ty = qual(CONST, ty); + if (isvolatile(ty1) && !isvolatile(ty)) + ty = qual(VOLATILE, ty); + ty = array(ty, q->type->size/ty->size, q->type->align); + } else { + ty = q->type; + if (isconst(ty1) && !isconst(ty)) + ty = qual(CONST, ty); + if (isvolatile(ty1) && !isvolatile(ty)) + ty = qual(VOLATILE, ty); + ty = ptr(ty); + } + if (YYcheck && !isaddrop(p->op) && q->offset > 0) /* omit */ + p = nullcall(ty, YYcheck, p, consttree(q->offset, inttype)); /* omit */ + else /* omit */ + p = simplify(ADD+P, ty, p, consttree(q->offset, signedptr)); + + if (q->lsb) { + p = tree(FIELD, ty->type, rvalue(p), NULL); + p->u.field = q; + } else if (!isarray(q->type)) + p = rvalue(p); + + } else { + error("unknown field `%s' of `%t'\n", name, ty); + p = rvalue(retype(p, ptr(inttype))); + } + return p; +} +/* funcname - return name of function f or a function' */ +char *funcname(Tree f) { + if (isaddrop(f->op)) + return stringf("`%s'", f->u.sym->name); + return "a function"; +} +static Tree nullcheck(Tree p) { + if (!needconst && YYnull && isptr(p->type)) { + p = value(p); + if (strcmp(YYnull->name, "_YYnull") == 0) { + Symbol t1 = temporary(REGISTER, voidptype); + p = tree(RIGHT, p->type, + tree(OR, voidtype, + cond(asgn(t1, cast(p, voidptype))), + vcall(YYnull, voidtype, (file && *file ? pointer(idtree(mkstr(file)->u.c.loc)) : cnsttree(voidptype, NULL)), cnsttree(inttype, (long)lineno) , NULL)), + idtree(t1)); + } + + else + p = nullcall(p->type, YYnull, p, cnsttree(inttype, 0L)); + + } + return p; +} +Tree nullcall(Type pty, Symbol f, Tree p, Tree e) { + Type ty; + + if (isarray(pty)) + return retype(nullcall(atop(pty), f, p, e), pty); + ty = unqual(unqual(p->type)->type); + return vcall(f, pty, + p, e, + cnsttree(inttype, (long)ty->size), + cnsttree(inttype, (long)ty->align), + (file && *file ? pointer(idtree(mkstr(file)->u.c.loc)) : cnsttree(voidptype, NULL)), cnsttree(inttype, (long)lineno) , NULL); +} diff --git a/src/cmd/lccom-1/gen.c b/src/cmd/lccom-1/gen.c new file mode 100644 index 0000000..8c1c091 --- /dev/null +++ b/src/cmd/lccom-1/gen.c @@ -0,0 +1,828 @@ +#include "c.h" + +#define readsreg(p) \ + (generic((p)->op)==INDIR && (p)->kids[0]->op==VREG+P) +#define setsrc(d) ((d) && (d)->x.regnode && \ + (d)->x.regnode->set == src->x.regnode->set && \ + (d)->x.regnode->mask&src->x.regnode->mask) + +#define relink(a, b) ((b)->x.prev = (a), (a)->x.next = (b)) + +static Symbol askfixedreg(Symbol); +static Symbol askreg(Symbol, unsigned*); +static void blkunroll(int, int, int, int, int, int, int[]); +static void docall(Node); +static void dumpcover(Node, int, int); +static void dumpregs(char *, char *, char *); +static void dumprule(int); +static void dumptree(Node); +static void genreload(Node, Symbol, int); +static void genspill(Symbol, Node, Symbol); +static Symbol getreg(Symbol, unsigned*, Node); +static int getrule(Node, int); +static void linearize(Node, Node); +static int moveself(Node); +static void prelabel(Node); +static Node* prune(Node, Node*); +static void putreg(Symbol); +static void ralloc(Node); +static void reduce(Node, int); +static int reprune(Node*, int, int, Node); +static int requate(Node); +static Node reuse(Node, int); +static void rewrite(Node); +static Symbol spillee(Symbol, unsigned mask[], Node); +static void spillr(Symbol, Node); +static int uses(Node, Regnode); + +int offset; + +int maxoffset; + +int framesize; +int argoffset; + +int maxargoffset; + +int dalign, salign; +int bflag = 0; /* omit */ +int dflag = 0; + +int swap; + +unsigned (*emitter)(Node, int) = emitasm; +static char NeedsReg[] = { + 0, /* unused */ + 1, /* CNST */ + 0, 0, /* ARG ASGN */ + 1, /* INDIR */ + 0, 0, 1, 1, /* - - CVF CVI */ + 1, 0, 1, 1, /* CVP - CVU NEG */ + 1, /* CALL */ + 1, /* LOAD */ + 0, /* RET */ + 1, 1, 1, /* ADDRG ADDRF ADDRL */ + 1, 1, 1, 1, 1, /* ADD SUB LSH MOD RSH */ + 1, 1, 1, 1, /* BAND BCOM BOR BXOR */ + 1, 1, /* DIV MUL */ + 0, 0, 0, 0, 0, 0, /* EQ GE GT LE LT NE */ + 0, 0 /* JUMP LABEL */ +}; +Node head; + +unsigned freemask[2]; +unsigned usedmask[2]; +unsigned tmask[2]; +unsigned vmask[2]; +Symbol mkreg(char *fmt, int n, int mask, int set) { + Symbol p; + + NEW0(p, PERM); + p->name = p->x.name = stringf(fmt, n); + NEW0(p->x.regnode, PERM); + p->x.regnode->number = n; + p->x.regnode->mask = mask<x.regnode->set = set; + return p; +} +Symbol mkwildcard(Symbol *syms) { + Symbol p; + + NEW0(p, PERM); + p->name = p->x.name = "wildcard"; + p->x.wildcard = syms; + return p; +} +void mkauto(Symbol p) { + assert(p->sclass == AUTO); + offset = roundup(offset + p->type->size, p->type->align); + p->x.offset = -offset; + p->x.name = stringd(-offset); +} +void blockbeg(Env *e) { + e->offset = offset; + e->freemask[IREG] = freemask[IREG]; + e->freemask[FREG] = freemask[FREG]; +} +void blockend(Env *e) { + if (offset > maxoffset) + maxoffset = offset; + offset = e->offset; + freemask[IREG] = e->freemask[IREG]; + freemask[FREG] = e->freemask[FREG]; +} +int mkactual(int align, int size) { + int n = roundup(argoffset, align); + + argoffset = n + size; + return n; +} +static void docall(Node p) { + p->syms[1] = p->syms[0]; + p->syms[0] = intconst(argoffset); + if (argoffset > maxargoffset) + maxargoffset = argoffset; + argoffset = 0; +} +void blkcopy(int dreg, int doff, int sreg, int soff, int size, int tmp[]) { + assert(size >= 0); + if (size == 0) + return; + else if (size <= 2) + blkunroll(size, dreg, doff, sreg, soff, size, tmp); + else if (size == 3) { + blkunroll(2, dreg, doff, sreg, soff, 2, tmp); + blkunroll(1, dreg, doff+2, sreg, soff+2, 1, tmp); + } + else if (size <= 16) { + blkunroll(4, dreg, doff, sreg, soff, size&~3, tmp); + blkcopy(dreg, doff+(size&~3), + sreg, soff+(size&~3), size&3, tmp); + } + else + (*IR->x.blkloop)(dreg, doff, sreg, soff, size, tmp); +} +static void blkunroll(int k, int dreg, int doff, int sreg, int soff, int size, int tmp[]) { + int i; + + assert(IR->x.max_unaligned_load); + if (k > IR->x.max_unaligned_load + && (k > salign || k > dalign)) + k = IR->x.max_unaligned_load; + for (i = 0; i+k < size; i += 2*k) { + (*IR->x.blkfetch)(k, soff+i, sreg, tmp[0]); + (*IR->x.blkfetch)(k, soff+i+k, sreg, tmp[1]); + (*IR->x.blkstore)(k, doff+i, dreg, tmp[0]); + (*IR->x.blkstore)(k, doff+i+k, dreg, tmp[1]); + } + if (i < size) { + (*IR->x.blkfetch)(k, i+soff, sreg, tmp[0]); + (*IR->x.blkstore)(k, i+doff, dreg, tmp[0]); + } +} +void parseflags(int argc, char *argv[]) { + int i; + + for (i = 0; i < argc; i++) + if (strcmp(argv[i], "-d") == 0) + dflag = 1; + else if (strcmp(argv[i], "-b") == 0) /* omit */ + bflag = 1; /* omit */ +} +static int getrule(Node p, int nt) { + int rulenum; + + assert(p); + rulenum = (*IR->x._rule)(p->x.state, nt); + if (!rulenum) { + fprint(stderr, "(%x->op=%s at %w is corrupt.)\n", p, opname(p->op), &src); + assert(0); + } + return rulenum; +} +static void reduce(Node p, int nt) { + int rulenum, i; + short *nts; + Node kids[10]; + + p = reuse(p, nt); + rulenum = getrule(p, nt); + nts = IR->x._nts[rulenum]; + (*IR->x._kids)(p, rulenum, kids); + for (i = 0; nts[i]; i++) + reduce(kids[i], nts[i]); + if (IR->x._isinstruction[rulenum]) { + assert(p->x.inst == 0 || p->x.inst == nt); + p->x.inst = nt; + if (p->syms[RX] && p->syms[RX]->temporary) { + debug(fprint(stderr, "(using %s)\n", p->syms[RX]->name)); + p->syms[RX]->x.usecount++; + } + } +} +static Node reuse(Node p, int nt) { + struct _state { + short cost[1]; + }; + Symbol r = p->syms[RX]; + + if (generic(p->op) == INDIR && p->kids[0]->op == VREG+P + && r->u.t.cse && p->x.mayrecalc + && ((struct _state*)r->u.t.cse->x.state)->cost[nt] == 0) + return r->u.t.cse; + else + return p; +} + +int mayrecalc(Node p) { + int op; + + assert(p && p->syms[RX]); + if (p->syms[RX]->u.t.cse == NULL) + return 0; + op = generic(p->syms[RX]->u.t.cse->op); + if (op == CNST || op == ADDRF || op == ADDRG || op == ADDRL) { + p->x.mayrecalc = 1; + return 1; + } else + return 0; +} +static Node *prune(Node p, Node pp[]) { + if (p == NULL) + return pp; + p->x.kids[0] = p->x.kids[1] = p->x.kids[2] = NULL; + if (p->x.inst == 0) + return prune(p->kids[1], prune(p->kids[0], pp)); + else if (p->syms[RX] && p->syms[RX]->temporary + && p->syms[RX]->x.usecount < 2) { + p->x.inst = 0; + debug(fprint(stderr, "(clobbering %s)\n", p->syms[RX]->name)); + return prune(p->kids[1], prune(p->kids[0], pp)); + } + else { + prune(p->kids[1], prune(p->kids[0], &p->x.kids[0])); + *pp = p; + return pp + 1; + } +} + +#define ck(i) return (i) ? 0 : LBURG_MAX + +int range(Node p, int lo, int hi) { + Symbol s = p->syms[0]; + + switch (specific(p->op)) { + case ADDRF+P: + case ADDRL+P: ck(s->x.offset >= lo && s->x.offset <= hi); + case CNST+I: ck(s->u.c.v.i >= lo && s->u.c.v.i <= hi); + case CNST+U: ck(s->u.c.v.u >= lo && s->u.c.v.u <= hi); + case CNST+P: ck(s->u.c.v.p == 0 && lo <= 0 && hi >= 0); + } + return LBURG_MAX; +} +static void dumptree(Node p) { + if (p->op == VREG+P && p->syms[0]) { + fprint(stderr, "VREGP(%s)", p->syms[0]->name); + return; + } else if (generic(p->op) == LOAD) { + fprint(stderr, "LOAD("); + dumptree(p->kids[0]); + fprint(stderr, ")"); + return; + } + fprint(stderr, "%s(", opname(p->op)); + switch (generic(p->op)) { + case CNST: case LABEL: + case ADDRG: case ADDRF: case ADDRL: + if (p->syms[0]) + fprint(stderr, "%s", p->syms[0]->name); + break; + case RET: + if (p->kids[0]) + dumptree(p->kids[0]); + break; + case CVF: case CVI: case CVP: case CVU: case JUMP: + case ARG: case BCOM: case NEG: case INDIR: + dumptree(p->kids[0]); + break; + case CALL: + if (optype(p->op) != B) { + dumptree(p->kids[0]); + break; + } + /* else fall thru */ + case EQ: case NE: case GT: case GE: case LE: case LT: + case ASGN: case BOR: case BAND: case BXOR: case RSH: case LSH: + case ADD: case SUB: case DIV: case MUL: case MOD: + dumptree(p->kids[0]); + fprint(stderr, ", "); + dumptree(p->kids[1]); + break; + default: assert(0); + } + fprint(stderr, ")"); +} +static void dumpcover(Node p, int nt, int in) { + int rulenum, i; + short *nts; + Node kids[10]; + + p = reuse(p, nt); + rulenum = getrule(p, nt); + nts = IR->x._nts[rulenum]; + fprint(stderr, "dumpcover(%x) = ", p); + for (i = 0; i < in; i++) + fprint(stderr, " "); + dumprule(rulenum); + (*IR->x._kids)(p, rulenum, kids); + for (i = 0; nts[i]; i++) + dumpcover(kids[i], nts[i], in+1); +} + +static void dumprule(int rulenum) { + assert(rulenum); + fprint(stderr, "%s / %s", IR->x._string[rulenum], + IR->x._templates[rulenum]); + if (!IR->x._isinstruction[rulenum]) + fprint(stderr, "\n"); +} +unsigned emitasm(Node p, int nt) { + int rulenum; + short *nts; + char *fmt; + Node kids[10]; + + p = reuse(p, nt); + rulenum = getrule(p, nt); + nts = IR->x._nts[rulenum]; + fmt = IR->x._templates[rulenum]; + assert(fmt); + if (IR->x._isinstruction[rulenum] && p->x.emitted) + print("%s", p->syms[RX]->x.name); + else if (*fmt == '#') + (*IR->x.emit2)(p); + else { + if (*fmt == '?') { + fmt++; + assert(p->kids[0]); + if (p->syms[RX] == p->x.kids[0]->syms[RX]) + while (*fmt++ != '\n') + ; + } + for ((*IR->x._kids)(p, rulenum, kids); *fmt; fmt++) + if (*fmt != '%') + (void)putchar(*fmt); + else if (*++fmt == 'F') + print("%d", framesize); + else if (*fmt >= '0' && *fmt <= '9') + emitasm(kids[*fmt - '0'], nts[*fmt - '0']); + else if (*fmt >= 'a' && *fmt < 'a' + NELEMS(p->syms)) + fputs(p->syms[*fmt - 'a']->x.name, stdout); + else + (void)putchar(*fmt); + } + return 0; +} +void emit(Node p) { + for (; p; p = p->x.next) { + assert(p->x.registered); + if ((p->x.equatable && requate(p)) || moveself(p)) + ; + else + (*emitter)(p, p->x.inst); + p->x.emitted = 1; + } +} +static int moveself(Node p) { + return p->x.copy + && p->syms[RX]->x.name == p->x.kids[0]->syms[RX]->x.name; +} +int move(Node p) { + p->x.copy = 1; + return 1; +} +static int requate(Node q) { + Symbol src = q->x.kids[0]->syms[RX]; + Symbol tmp = q->syms[RX]; + Node p; + int n = 0; + + debug(fprint(stderr, "(requate(%x): tmp=%s src=%s)\n", q, tmp->x.name, src->x.name)); + for (p = q->x.next; p; p = p->x.next) + if (p->x.copy && p->syms[RX] == src + && p->x.kids[0]->syms[RX] == tmp) + debug(fprint(stderr, "(requate arm 0 at %x)\n", p)), + p->syms[RX] = tmp; + else if (setsrc(p->syms[RX]) && !moveself(p) && !readsreg(p)) + return 0; + else if (p->x.spills) + return 0; + else if (generic(p->op) == CALL && p->x.next) + return 0; + else if (p->op == LABEL+V && p->x.next) + return 0; + else if (p->syms[RX] == tmp && readsreg(p)) + debug(fprint(stderr, "(requate arm 5 at %x)\n", p)), + n++; + else if (p->syms[RX] == tmp) + break; + debug(fprint(stderr, "(requate arm 7 at %x)\n", p)); + assert(n > 0); + for (p = q->x.next; p; p = p->x.next) + if (p->syms[RX] == tmp && readsreg(p)) { + p->syms[RX] = src; + if (--n <= 0) + break; + } + return 1; +} +static void prelabel(Node p) { + if (p == NULL) + return; + prelabel(p->kids[0]); + prelabel(p->kids[1]); + if (NeedsReg[opindex(p->op)]) + setreg(p, (*IR->x.rmap)(opkind(p->op))); + switch (generic(p->op)) { + case ADDRF: case ADDRL: + if (p->syms[0]->sclass == REGISTER) + p->op = VREG+P; + break; + case INDIR: + if (p->kids[0]->op == VREG+P) + setreg(p, p->kids[0]->syms[0]); + break; + case ASGN: + if (p->kids[0]->op == VREG+P) + rtarget(p, 1, p->kids[0]->syms[0]); + break; + case CVI: case CVU: case CVP: + if (optype(p->op) != F + && opsize(p->op) <= p->syms[0]->u.c.v.i) + p->op = LOAD + opkind(p->op); + break; + } + (IR->x.target)(p); +} +void setreg(Node p, Symbol r) { + p->syms[RX] = r; +} +void rtarget(Node p, int n, Symbol r) { + Node q = p->kids[n]; + + assert(q); + assert(r); + assert(r->sclass == REGISTER || !r->x.wildcard); + assert(q->syms[RX]); + if (r != q->syms[RX] && !q->syms[RX]->x.wildcard) { + q = newnode(LOAD + opkind(q->op), + q, NULL, q->syms[0]); + if (r->u.t.cse == p->kids[n]) + r->u.t.cse = q; + p->kids[n] = p->x.kids[n] = q; + q->x.kids[0] = q->kids[0]; + } + setreg(q, r); + debug(fprint(stderr, "(targeting %x->x.kids[%d]=%x to %s)\n", p, n, p->kids[n], r->x.name)); +} +static void rewrite(Node p) { + assert(p->x.inst == 0); + prelabel(p); + debug(dumptree(p)); + debug(fprint(stderr, "\n")); + (*IR->x._label)(p); + debug(dumpcover(p, 1, 0)); + reduce(p, 1); +} +Node gen(Node forest) { + int i; + struct node sentinel; + Node dummy, p; + + head = forest; + for (p = forest; p; p = p->link) { + assert(p->count == 0); + if (generic(p->op) == CALL) + docall(p); + else if ( generic(p->op) == ASGN + && generic(p->kids[1]->op) == CALL) + docall(p->kids[1]); + else if (generic(p->op) == ARG) + (*IR->x.doarg)(p); + rewrite(p); + p->x.listed = 1; + } + for (p = forest; p; p = p->link) + prune(p, &dummy); + relink(&sentinel, &sentinel); + for (p = forest; p; p = p->link) + linearize(p, &sentinel); + forest = sentinel.x.next; + assert(forest); + sentinel.x.next->x.prev = NULL; + sentinel.x.prev->x.next = NULL; + for (p = forest; p; p = p->x.next) + for (i = 0; i < NELEMS(p->x.kids) && p->x.kids[i]; i++) { + assert(p->x.kids[i]->syms[RX]); + if (p->x.kids[i]->syms[RX]->temporary) { + p->x.kids[i]->x.prevuse = + p->x.kids[i]->syms[RX]->x.lastuse; + p->x.kids[i]->syms[RX]->x.lastuse = p->x.kids[i]; + } + } + for (p = forest; p; p = p->x.next) { + ralloc(p); + if (p->x.listed && NeedsReg[opindex(p->op)] + && (*IR->x.rmap)(opkind(p->op))) { + assert(generic(p->op) == CALL || generic(p->op) == LOAD); + putreg(p->syms[RX]); + } + } + return forest; +} +int notarget(Node p) { + return p->syms[RX]->x.wildcard ? 0 : LBURG_MAX; +} +static void putreg(Symbol r) { + assert(r && r->x.regnode); + freemask[r->x.regnode->set] |= r->x.regnode->mask; + debug(dumpregs("(freeing %s)\n", r->x.name, NULL)); +} +static Symbol askfixedreg(Symbol s) { + Regnode r = s->x.regnode; + int n = r->set; + + if (r->mask&~freemask[n]) + return NULL; + else { + freemask[n] &= ~r->mask; + usedmask[n] |= r->mask; + return s; + } +} +static Symbol askreg(Symbol rs, unsigned rmask[]) { + int i; + + if (rs->x.wildcard == NULL) + return askfixedreg(rs); + for (i = 31; i >= 0; i--) { + Symbol r = rs->x.wildcard[i]; + if (r != NULL + && !(r->x.regnode->mask&~rmask[r->x.regnode->set]) + && askfixedreg(r)) + return r; + } + return NULL; +} + +static Symbol getreg(Symbol s, unsigned mask[], Node p) { + Symbol r = askreg(s, mask); + if (r == NULL) { + r = spillee(s, mask, p); + assert(r && r->x.regnode); + spill(r->x.regnode->mask, r->x.regnode->set, p); + r = askreg(s, mask); + } + assert(r && r->x.regnode); + r->x.regnode->vbl = NULL; + return r; +} +int askregvar(Symbol p, Symbol regs) { + Symbol r; + + assert(p); + if (p->sclass != REGISTER) + return 0; + else if (!isscalar(p->type)) { + p->sclass = AUTO; + return 0; + } + else if (p->temporary) { + p->x.name = "?"; + return 1; + } + else if ((r = askreg(regs, vmask)) != NULL) { + p->x.regnode = r->x.regnode; + p->x.regnode->vbl = p; + p->x.name = r->x.name; + debug(dumpregs("(allocating %s to symbol %s)\n", p->x.name, p->name)); + return 1; + } + else { + p->sclass = AUTO; + return 0; + } +} +static void linearize(Node p, Node next) { + int i; + + for (i = 0; i < NELEMS(p->x.kids) && p->x.kids[i]; i++) + linearize(p->x.kids[i], next); + relink(next->x.prev, p); + relink(p, next); + debug(fprint(stderr, "(listing %x)\n", p)); +} +static void ralloc(Node p) { + int i; + unsigned mask[2]; + + mask[0] = tmask[0]; + mask[1] = tmask[1]; + assert(p); + debug(fprint(stderr, "(rallocing %x)\n", p)); + for (i = 0; i < NELEMS(p->x.kids) && p->x.kids[i]; i++) { + Node kid = p->x.kids[i]; + Symbol r = kid->syms[RX]; + assert(r && kid->x.registered); + if (r->sclass != REGISTER && r->x.lastuse == kid) + putreg(r); + } + if (!p->x.registered && NeedsReg[opindex(p->op)] + && (*IR->x.rmap)(opkind(p->op))) { + Symbol sym = p->syms[RX], set = sym; + assert(sym); + if (sym->temporary) + set = (*IR->x.rmap)(opkind(p->op)); + assert(set); + if (set->sclass != REGISTER) { + Symbol r; + if (*IR->x._templates[getrule(p, p->x.inst)] == '?') + for (i = 1; i < NELEMS(p->x.kids) && p->x.kids[i]; i++) { + Symbol r = p->x.kids[i]->syms[RX]; + assert(p->x.kids[i]->x.registered); + assert(r && r->x.regnode); + assert(sym->x.wildcard || sym != r); + mask[r->x.regnode->set] &= ~r->x.regnode->mask; + } + r = getreg(set, mask, p); + if (sym->temporary) { + Node q; + r->x.lastuse = sym->x.lastuse; + for (q = sym->x.lastuse; q; q = q->x.prevuse) { + q->syms[RX] = r; + q->x.registered = 1; + if (sym->u.t.cse && q->x.copy) + q->x.equatable = 1; + } + } else { + p->syms[RX] = r; + r->x.lastuse = p; + } + debug(dumpregs("(allocating %s to node %x)\n", r->x.name, (char *) p)); + } + } + p->x.registered = 1; + (*IR->x.clobber)(p); +} +static Symbol spillee(Symbol set, unsigned mask[], Node here) { + Symbol bestreg = NULL; + int bestdist = -1, i; + + assert(set); + if (!set->x.wildcard) + bestreg = set; + else { + for (i = 31; i >= 0; i--) { + Symbol ri = set->x.wildcard[i]; + if ( + ri != NULL && + ri->x.lastuse && + (ri->x.regnode->mask&tmask[ri->x.regnode->set]&mask[ri->x.regnode->set]) + ) { + Regnode rn = ri->x.regnode; + Node q = here; + int dist = 0; + for (; q && !uses(q, rn); q = q->x.next) + dist++; + if (q && dist > bestdist) { + bestdist = dist; + bestreg = ri; + } + } + } + } + assert(bestreg); /* Must be able to spill something. Reconfigure the register allocator + to ensure that we can allocate a register for all nodes without spilling + the node's necessary input regs. */ + assert(bestreg->x.regnode->vbl == NULL); /* Can't spill register variables because + the reload site might be in other blocks. Reconfigure the register allocator + to ensure that this register is never allocated to a variable. */ + return bestreg; +} +static int uses(Node p, Regnode rn) { + int i; + + for (i = 0; i < NELEMS(p->x.kids); i++) + if ( + p->x.kids[i] && + p->x.kids[i]->x.registered && + rn->set == p->x.kids[i]->syms[RX]->x.regnode->set && + (rn->mask&p->x.kids[i]->syms[RX]->x.regnode->mask) + ) + return 1; + return 0; +} +static void spillr(Symbol r, Node here) { + int i; + Symbol tmp; + Node p = r->x.lastuse; + assert(p); + while (p->x.prevuse) { + assert(r == p->syms[RX]); + p = p->x.prevuse; + } + assert(p->x.registered && !readsreg(p)); + tmp = newtemp(AUTO, optype(p->op), opsize(p->op)); + genspill(r, p, tmp); + for (p = here->x.next; p; p = p->x.next) + for (i = 0; i < NELEMS(p->x.kids) && p->x.kids[i]; i++) { + Node k = p->x.kids[i]; + if (k->x.registered && k->syms[RX] == r) + genreload(p, tmp, i); + } + putreg(r); +} +static void genspill(Symbol r, Node last, Symbol tmp) { + Node p, q; + Symbol s; + unsigned ty; + + debug(fprint(stderr, "(spilling %s to local %s)\n", r->x.name, tmp->x.name)); + debug(fprint(stderr, "(genspill: ")); + debug(dumptree(last)); + debug(fprint(stderr, ")\n")); + ty = opkind(last->op); + NEW0(s, FUNC); + s->sclass = REGISTER; + s->name = s->x.name = r->x.name; + s->x.regnode = r->x.regnode; + q = newnode(ADDRL+P + sizeop(IR->ptrmetric.size), NULL, NULL, s); + q = newnode(INDIR + ty, q, NULL, NULL); + p = newnode(ADDRL+P + sizeop(IR->ptrmetric.size), NULL, NULL, tmp); + p = newnode(ASGN + ty, p, q, NULL); + p->x.spills = 1; + rewrite(p); + prune(p, &q); + q = last->x.next; + linearize(p, q); + for (p = last->x.next; p != q; p = p->x.next) { + ralloc(p); + assert(!p->x.listed || !NeedsReg[opindex(p->op)] || !(*IR->x.rmap)(opkind(p->op))); + } +} + +static void genreload(Node p, Symbol tmp, int i) { + Node q; + int ty; + + debug(fprint(stderr, "(replacing %x with a reload from %s)\n", p->x.kids[i], tmp->x.name)); + debug(fprint(stderr, "(genreload: ")); + debug(dumptree(p->x.kids[i])); + debug(fprint(stderr, ")\n")); + ty = opkind(p->x.kids[i]->op); + q = newnode(ADDRL+P + sizeop(IR->ptrmetric.size), NULL, NULL, tmp); + p->x.kids[i] = newnode(INDIR + ty, q, NULL, NULL); + rewrite(p->x.kids[i]); + prune(p->x.kids[i], &q); + reprune(&p->kids[1], reprune(&p->kids[0], 0, i, p), i, p); + prune(p, &q); + linearize(p->x.kids[i], p); +} +static int reprune(Node *pp, int k, int n, Node p) { + struct node x, *q = *pp; + + if (q == NULL || k > n) + return k; + else if (q->x.inst == 0) + return reprune(&q->kids[1], + reprune(&q->kids[0], k, n, p), n, p); + if (k == n) { + debug(fprint(stderr, "(reprune changes %x from %x to %x)\n", pp, *pp, p->x.kids[n])); + *pp = p->x.kids[n]; + x = *p; + (IR->x.target)(&x); + } + return k + 1; +} +void spill(unsigned mask, int n, Node here) { + int i; + Node p; + + here->x.spills = 1; + usedmask[n] |= mask; + if (mask&~freemask[n]) { + + assert( /* It makes no sense for a node to clobber() its target. */ + here->x.registered == 0 || /* call isn't coming through clobber() */ + here->syms[RX] == NULL || + here->syms[RX]->x.regnode == NULL || + here->syms[RX]->x.regnode->set != n || + (here->syms[RX]->x.regnode->mask&mask) == 0 + ); + + for (p = here; p; p = p->x.next) + for (i = 0; i < NELEMS(p->x.kids) && p->x.kids[i]; i++) { + Symbol r = p->x.kids[i]->syms[RX]; + assert(r); + if (p->x.kids[i]->x.registered && r->x.regnode->set == n + && r->x.regnode->mask&mask) + spillr(r, here); + } + } +} +static void dumpregs(char *msg, char *a, char *b) { + fprint(stderr, msg, a, b); + fprint(stderr, "(free[0]=%x)\n", freemask[0]); + fprint(stderr, "(free[1]=%x)\n", freemask[1]); +} + +int getregnum(Node p) { + assert(p && p->syms[RX] && p->syms[RX]->x.regnode); + return p->syms[RX]->x.regnode->number; +} + + +unsigned regloc(Symbol p) { + assert(p && p->sclass == REGISTER && p->sclass == REGISTER && p->x.regnode); + return p->x.regnode->set<<8 | p->x.regnode->number; +} diff --git a/src/cmd/lccom-1/init.c b/src/cmd/lccom-1/init.c new file mode 100644 index 0000000..fbb7220 --- /dev/null +++ b/src/cmd/lccom-1/init.c @@ -0,0 +1,317 @@ +#include "c.h" + +static int curseg; /* current segment */ + +/* defpointer - initialize a pointer to p or to 0 if p==0 */ +void defpointer(Symbol p) { + if (p) { + (*IR->defaddress)(p); + p->ref++; + } else { + static Value v; + (*IR->defconst)(P, voidptype->size, v); + } +} + +/* genconst - generate/check constant expression e; return size */ +static int genconst(Tree e, int def) { + for (;;) + switch (generic(e->op)) { + case ADDRG: + if (def) + (*IR->defaddress)(e->u.sym); + return e->type->size; + case CNST: + if (e->op == CNST+P && isarray(e->type)) { + e = cvtconst(e); + continue; + } + if (def) + (*IR->defconst)(e->type->op, e->type->size, e->u.v); + return e->type->size; + case RIGHT: + assert(e->kids[0] || e->kids[1]); + if (e->kids[1] && e->kids[0]) + error("initializer must be constant\n"); + e = e->kids[1] ? e->kids[1] : e->kids[0]; + continue; + case CVP: + if (isarith(e->type)) + error("cast from `%t' to `%t' is illegal in constant expressions\n", + e->kids[0]->type, e->type); + /* fall thru */ + case CVI: case CVU: case CVF: + e = e->kids[0]; + continue; + default: + error("initializer must be constant\n"); + if (def) + genconst(consttree(0, inttype), def); + return inttype->size; + } +} + +/* initvalue - evaluate a constant expression for a value of integer type ty */ +static Tree initvalue(Type ty) { + Type aty; + Tree e; + + needconst++; + e = expr1(0); + if ((aty = assign(ty, e)) != NULL) + e = cast(e, aty); + else { + error("invalid initialization type; found `%t' expected `%t'\n", + e->type, ty); + e = retype(consttree(0, inttype), ty); + } + needconst--; + if (generic(e->op) != CNST) { + error("initializer must be constant\n"); + e = retype(consttree(0, inttype), ty); + } + return e; +} + +/* initarray - initialize array of ty of <= len bytes; if len == 0, go to } */ +static int initarray(int len, Type ty, int lev) { + int n = 0; + + do { + initializer(ty, lev); + n += ty->size; + if ((len > 0 && n >= len) || t != ',') + break; + t = gettok(); + } while (t != '}'); + return n; +} + +/* initchar - initialize array of <= len ty characters; if len == 0, go to } */ +static int initchar(int len, Type ty) { + int n = 0; + char buf[16], *s = buf; + + do { + *s++ = initvalue(ty)->u.v.i; + if (++n%inttype->size == 0) { + (*IR->defstring)(inttype->size, buf); + s = buf; + } + if ((len > 0 && n >= len) || t != ',') + break; + t = gettok(); + } while (t != '}'); + if (s > buf) + (*IR->defstring)(s - buf, buf); + return n; +} + +/* initend - finish off an initialization at level lev; accepts trailing comma */ +static void initend(int lev, char follow[]) { + if (lev == 0 && t == ',') + t = gettok(); + test('}', follow); +} + +/* initfields - initialize <= an unsigned's worth of bit fields in fields p to q */ +static int initfields(Field p, Field q) { + unsigned int bits = 0; + int i, n = 0; + + do { + i = initvalue(inttype)->u.v.i; + if (fieldsize(p) < 8*p->type->size) { + if ((p->type == inttype && + (i < -(int)(fieldmask(p)>>1)-1 || i > (int)(fieldmask(p)>>1))) + || (p->type == unsignedtype && (i&~fieldmask(p)) != 0)) + warning("initializer exceeds bit-field width\n"); + i &= fieldmask(p); + } + bits |= i<little_endian) { + if (fieldsize(p) + fieldright(p) > n) + n = fieldsize(p) + fieldright(p); + } else { + if (fieldsize(p) + fieldleft(p) > n) + n = fieldsize(p) + fieldleft(p); + } + if (p->link == q) + break; + p = p->link; + } while (t == ',' && (t = gettok()) != 0); + n = (n + 7)/8; + for (i = 0; i < n; i++) { + Value v; + if (IR->little_endian) { + v.u = (unsigned char)bits; + bits >>= 8; + } else { /* a big endian */ + v.u = (unsigned char)(bits>>(8*(unsignedtype->size - 1))); + bits <<= 8; + } + (*IR->defconst)(U, unsignedchar->size, v); + } + return n; +} + +/* initstruct - initialize a struct ty of <= len bytes; if len == 0, go to } */ +static int initstruct(int len, Type ty, int lev) { + int a, n = 0; + Field p = ty->u.sym->u.s.flist; + + do { + if (p->offset > n) { + (*IR->space)(p->offset - n); + n += p->offset - n; + } + if (p->lsb) { + Field q = p; + while (q->link && q->link->offset == p->offset) + q = q->link; + n += initfields(p, q->link); + p = q; + } else { + initializer(p->type, lev); + n += p->type->size; + } + if (p->link) { + p = p->link; + a = p->type->align; + } else + a = ty->align; + if (a && n%a) { + (*IR->space)(a - n%a); + n = roundup(n, a); + } + if ((len > 0 && n >= len) || t != ',') + break; + t = gettok(); + } while (t != '}'); + return n; +} + +/* initializer - constexpr | { constexpr ( , constexpr )* [ , ] } */ +Type initializer(Type ty, int lev) { + int n = 0; + Tree e; + Type aty = NULL; + static char follow[] = { IF, CHAR, STATIC, 0 }; + + ty = unqual(ty); + if (isscalar(ty)) { + needconst++; + if (t == '{') { + t = gettok(); + e = expr1(0); + initend(lev, follow); + } else + e = expr1(0); + e = pointer(e); + if ((aty = assign(ty, e)) != NULL) + e = cast(e, aty); + else + error("invalid initialization type; found `%t' expected `%t'\n", + e->type, ty); + n = genconst(e, 1); + deallocate(STMT); + needconst--; + } + if ((isunion(ty) || isstruct(ty)) && ty->size == 0) { + static char follow[] = { CHAR, STATIC, 0 }; + error("cannot initialize undefined `%t'\n", ty); + skipto(';', follow); + return ty; + } else if (isunion(ty)) { + if (t == '{') { + t = gettok(); + n = initstruct(ty->u.sym->u.s.flist->type->size, ty, lev + 1); + initend(lev, follow); + } else { + if (lev == 0) + error("missing { in initialization of `%t'\n", ty); + n = initstruct(ty->u.sym->u.s.flist->type->size, ty, lev + 1); + } + } else if (isstruct(ty)) { + if (t == '{') { + t = gettok(); + n = initstruct(0, ty, lev + 1); + test('}', follow); + } else if (lev > 0) + n = initstruct(ty->size, ty, lev + 1); + else { + error("missing { in initialization of `%t'\n", ty); + n = initstruct(ty->u.sym->u.s.flist->type->size, ty, lev + 1); + } + } + if (isarray(ty)) + aty = unqual(ty->type); + if (isarray(ty) && ischar(aty)) { + if (t == SCON) { + if (ty->size > 0 && ty->size == tsym->type->size - 1) + tsym->type = array(chartype, ty->size, 0); + n = tsym->type->size; + (*IR->defstring)(tsym->type->size, tsym->u.c.v.p); + t = gettok(); + } else if (t == '{') { + t = gettok(); + if (t == SCON) { + ty = initializer(ty, lev + 1); + initend(lev, follow); + return ty; + } + n = initchar(0, aty); + test('}', follow); + } else if (lev > 0 && ty->size > 0) + n = initchar(ty->size, aty); + else { /* eg, char c[] = 0; */ + error("missing { in initialization of `%t'\n", ty); + n = initchar(1, aty); + } + } else if (isarray(ty)) { + if (t == SCON && aty == widechar) { + int i; + unsigned int *s = tsym->u.c.v.p; + if (ty->size > 0 && ty->size == tsym->type->size - widechar->size) + tsym->type = array(widechar, ty->size/widechar->size, 0); + n = tsym->type->size; + for (i = 0; i < n; i += widechar->size) { + Value v; + v.u = *s++; + (*IR->defconst)(widechar->op, widechar->size, v); + } + t = gettok(); + } else if (t == '{') { + t = gettok(); + if (t == SCON && aty == widechar) { + ty = initializer(ty, lev + 1); + initend(lev, follow); + return ty; + } + n = initarray(0, aty, lev + 1); + test('}', follow); + } else if (lev > 0 && ty->size > 0) + n = initarray(ty->size, aty, lev + 1); + else { + error("missing { in initialization of `%t'\n", ty); + n = initarray(aty->size, aty, lev + 1); + } + } + if (ty->size) { + if (n > ty->size) + error("too many initializers\n"); + else if (n < ty->size) + (*IR->space)(ty->size - n); + } else if (isarray(ty) && ty->type->size > 0) + ty = array(ty->type, n/ty->type->size, 0); + else + ty->size = n; + return ty; +} + +/* swtoseg - switch to segment seg, if necessary */ +void swtoseg(int seg) { + if (curseg != seg) + (*IR->segment)(seg); + curseg = seg; +} diff --git a/src/cmd/lccom-1/inits.c b/src/cmd/lccom-1/inits.c new file mode 100644 index 0000000..995f81a --- /dev/null +++ b/src/cmd/lccom-1/inits.c @@ -0,0 +1,6 @@ +void init(int argc, char *argv[]) +{ + {extern void input_init(int, char *[]); input_init(argc, argv);} + {extern void main_init(int, char *[]); main_init(argc, argv);} + {extern void type_init(int, char *[]); type_init(argc, argv);} +} diff --git a/src/cmd/lccom-1/input.c b/src/cmd/lccom-1/input.c new file mode 100644 index 0000000..a70ae0c --- /dev/null +++ b/src/cmd/lccom-1/input.c @@ -0,0 +1,144 @@ +#include "c.h" + +static void pragma(void); +static void resynch(void); + +static int bsize; +static unsigned char buffer[MAXLINE+1 + BUFSIZE+1]; +unsigned char *cp; /* current input character */ +char *file; /* current input file name */ +char *firstfile; /* first input file */ +unsigned char *limit; /* points to last character + 1 */ +char *line; /* current line */ +int lineno; /* line number of current line */ + +void nextline(void) { + do { + if (cp >= limit) { + fillbuf(); + if (cp >= limit) + cp = limit; + if (cp == limit) + return; + } else { + lineno++; + for (line = (char *)cp; *cp==' ' || *cp=='\t'; cp++) + ; + if (*cp == '#') { + resynch(); + nextline(); + } + } + } while (*cp == '\n' && cp == limit); +} +void fillbuf(void) { + if (bsize == 0) + return; + if (cp >= limit) + cp = &buffer[MAXLINE+1]; + else + { + int n = limit - cp; + unsigned char *s = &buffer[MAXLINE+1] - n; + assert(s >= buffer); + line = (char *)s - ((char *)cp - line); + while (cp < limit) + *s++ = *cp++; + cp = &buffer[MAXLINE+1] - n; + } + if (feof(stdin)) + bsize = 0; + else + bsize = fread(&buffer[MAXLINE+1], 1, BUFSIZE, stdin); + if (bsize < 0) { + error("read error\n"); + exit(EXIT_FAILURE); + } + limit = &buffer[MAXLINE+1+bsize]; + *limit = '\n'; +} +void input_init(int argc, char *argv[]) { + static int inited; + + if (inited) + return; + inited = 1; + main_init(argc, argv); + limit = cp = &buffer[MAXLINE+1]; + bsize = -1; + lineno = 0; + file = NULL; + fillbuf(); + if (cp >= limit) + cp = limit; + nextline(); +} + +/* ident - handle #ident "string" */ +static void ident(void) { + while (*cp != '\n' && *cp != '\0') + cp++; +} + +/* pragma - handle #pragma ref id... */ +static void pragma(void) { + if ((t = gettok()) == ID && strcmp(token, "ref") == 0) + for (;;) { + while (*cp == ' ' || *cp == '\t') + cp++; + if (*cp == '\n' || *cp == 0) + break; + if ((t = gettok()) == ID && tsym) { + tsym->ref++; + use(tsym, src); + } + } +} + +/* resynch - set line number/file name in # n [ "file" ], #pragma, etc. */ +static void resynch(void) { + for (cp++; *cp == ' ' || *cp == '\t'; ) + cp++; + if (limit - cp < MAXLINE) + fillbuf(); + if (strncmp((char *)cp, "pragma", 6) == 0) { + cp += 6; + pragma(); + } else if (strncmp((char *)cp, "ident", 5) == 0) { + cp += 5; + ident(); + } else if (*cp >= '0' && *cp <= '9') { + line: for (lineno = 0; *cp >= '0' && *cp <= '9'; ) + lineno = 10*lineno + *cp++ - '0'; + lineno--; + while (*cp == ' ' || *cp == '\t') + cp++; + if (*cp == '"') { + file = (char *)++cp; + while (*cp && *cp != '"' && *cp != '\n') + cp++; + file = stringn(file, (char *)cp - file); + if (*cp == '\n') + warning("missing \" in preprocessor line\n"); + if (firstfile == 0) + firstfile = file; + } + } else if (strncmp((char *)cp, "line", 4) == 0) { + for (cp += 4; *cp == ' ' || *cp == '\t'; ) + cp++; + if (*cp >= '0' && *cp <= '9') + goto line; + if (Aflag >= 2) + warning("unrecognized control line\n"); + } else if (Aflag >= 2 && *cp != '\n') + warning("unrecognized control line\n"); + while (*cp) + if (*cp++ == '\n') { + if (cp == limit + 1) { + nextline(); + if (cp == limit) + break; + } else + break; + } +} diff --git a/src/cmd/lccom-1/lburg/gram.c b/src/cmd/lccom-1/lburg/gram.c new file mode 100644 index 0000000..e5b60bd --- /dev/null +++ b/src/cmd/lccom-1/lburg/gram.c @@ -0,0 +1,673 @@ +#if defined(__STDC__) || defined(__cplusplus) +#define YYCONST const +#define YYPARAMS(x) x +#define YYDEFUN(name, arglist, args) name(args) +#define YYAND , +#define YYPTR void * +#else +#define YYCONST +#define YYPARAMS(x) () +#define YYDEFUN(name, arglist, args) name arglist args; +#define YYAND ; +#define YYPTR char * +#endif +#ifndef lint +YYCONST static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley +Cygnus.28) 01/20/91"; +#endif +#define YYBYACC 1 +#ifndef YYDONT_INCLUDE_STDIO +#include +#endif +//#ifdef __cplusplus +#include /* for malloc/realloc/free */ +//#endif +#line 2 "lburg/gram.y" +#include +#include "lburg.h" +/*lint -e616 -e527 -e652 -esym(552,yynerrs) -esym(563,yynewstate,yyerrlab) */ +static int yylineno = 0; +#line 8 "lburg/gram.y" +typedef union { + int n; + char *string; + Tree tree; +} YYSTYPE; +#line 37 "y.tab.c" +#define TERMINAL 257 +#define START 258 +#define PPERCENT 259 +#define ID 260 +#define TEMPLATE 261 +#define CODE 262 +#define INT 263 +#define YYERRCODE 256 +static YYCONST short yylhs[] = { -1, + 0, 0, 4, 4, 6, 6, 6, 6, 7, 7, + 5, 5, 5, 5, 1, 3, 3, 3, 2, +}; +static YYCONST short yylen[] = { 2, + 3, 1, 0, 2, 3, 3, 1, 2, 0, 4, + 0, 7, 2, 3, 1, 1, 4, 6, 1, +}; +static YYCONST short yydefred[] = { 3, + 0, 0, 0, 9, 0, 11, 7, 4, 8, 0, + 15, 0, 0, 0, 5, 6, 0, 13, 0, 0, + 14, 0, 10, 0, 0, 0, 0, 0, 19, 0, + 17, 0, 12, 0, 18, +}; +static YYCONST short yydgoto[] = { 1, + 12, 30, 25, 2, 13, 8, 10, +}; +static YYCONST short yysindex[] = { 0, + 0, -4, -2, 0, -250, 0, 0, 0, 0, -9, + 0, 1, -10, -49, 0, 0, 3, 0, -44, -248, + 0, -244, 0, -22, -242, -244, -245, -37, 0, 10, + 0, -244, 0, -20, 0, +}; +static YYCONST short yyrindex[] = { 0, + 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -39, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, +}; +static YYCONST short yygindex[] = { 0, + 11, 0, -23, 0, 0, 0, 0, +}; +#define YYTABLESIZE 255 +static YYCONST short yytable[] = { 18, + 15, 16, 28, 31, 16, 7, 32, 9, 34, 11, + 16, 20, 21, 22, 23, 24, 29, 26, 27, 33, + 35, 2, 1, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 17, 0, 0, 0, 11, + 14, 3, 4, 5, 6, +}; +static YYCONST short yycheck[] = { 10, + 10, 41, 26, 41, 44, 10, 44, 10, 32, 260, + 10, 61, 10, 58, 263, 260, 262, 40, 261, 10, + 41, 0, 0, 13, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 261, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 256, -1, -1, -1, 260, + 260, 256, 257, 258, 259, +}; +#define YYFINAL 1 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 263 +#if YYDEBUG +static YYCONST char *YYCONST yyname[] = { +"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0, +"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +"TERMINAL","START","PPERCENT","ID","TEMPLATE","CODE","INT", +}; +static YYCONST char *YYCONST yyrule[] = { +"$accept : spec", +"spec : decls PPERCENT rules", +"spec : decls", +"decls :", +"decls : decls decl", +"decl : TERMINAL blist '\\n'", +"decl : START nonterm '\\n'", +"decl : '\\n'", +"decl : error '\\n'", +"blist :", +"blist : blist ID '=' INT", +"rules :", +"rules : rules nonterm ':' tree TEMPLATE cost '\\n'", +"rules : rules '\\n'", +"rules : rules error '\\n'", +"nonterm : ID", +"tree : ID", +"tree : ID '(' tree ')'", +"tree : ID '(' tree ',' tree ')'", +"cost : CODE", +}; +#endif +#define YYLEX yylex() +#define YYEMPTY -1 +#define yyclearin (yychar=(YYEMPTY)) +#define yyerrok (yyerrflag=0) +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif +#ifdef YYSTACKSIZE +#ifndef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#endif +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 500 +#define YYMAXDEPTH 500 +#endif +#endif +#ifndef YYMAXSTACKSIZE +#define YYMAXSTACKSIZE 10000 +#endif +int yydebug; +int yynerrs; +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; +static short *yyss; +static YYSTYPE *yyvs; +static int yystacksize; +#define yyfree(x) free(x) +extern int yylex(); + +static YYPTR +YYDEFUN (yymalloc, (bytes), unsigned bytes) +{ + YYPTR ptr = (YYPTR) malloc (bytes); + if (ptr != 0) return (ptr); + yyerror ("yyparse: memory exhausted"); + return (0); +} + +static YYPTR +YYDEFUN (yyrealloc, (old, bytes), YYPTR old YYAND unsigned bytes) +{ + YYPTR ptr = (YYPTR) realloc (old, bytes); + if (ptr != 0) return (ptr); + yyerror ("yyparse: memory exhausted"); + return (0); +} + +static int +#ifdef __GNUC__ +inline +#endif +yygrow () +{ +#if YYDEBUG + int old_stacksize = yystacksize; +#endif + short *new_yyss; + YYSTYPE *new_yyvs; + + if (yystacksize == YYMAXSTACKSIZE) + return (1); + yystacksize += (yystacksize + 1 ) / 2; + if (yystacksize > YYMAXSTACKSIZE) + yystacksize = YYMAXSTACKSIZE; +#if YYDEBUG + if (yydebug) + printf("yydebug: growing stack size from %d to %d\n", + old_stacksize, yystacksize); +#endif + new_yyss = (short *) yyrealloc ((char *)yyss, yystacksize * sizeof (short)); + if (new_yyss == 0) + return (1); + new_yyvs = (YYSTYPE *) yyrealloc ((char *)yyvs, yystacksize * sizeof (YYSTYPE)); + if (new_yyvs == 0) + { + yyfree (new_yyss); + return (1); + } + yyss = new_yyss; + yyvs = new_yyvs; + return (0); +} +#line 60 "lburg/gram.y" +#include +#include +#include +#include +#include + +int errcnt = 0; +FILE *infp = NULL; +FILE *outfp = NULL; +static char buf[BUFSIZ], *bp = buf; +static int ppercent = 0; +static int code = 0; + +static int get(void) { + if (*bp == 0) { + bp = buf; + *bp = 0; + if (fgets(buf, sizeof buf, infp) == NULL) + return EOF; + yylineno++; + while (buf[0] == '%' && buf[1] == '{' && buf[2] == '\n') { + for (;;) { + if (fgets(buf, sizeof buf, infp) == NULL) { + yywarn("unterminated %{...%}\n"); + return EOF; + } + yylineno++; + if (strcmp(buf, "%}\n") == 0) + break; + fputs(buf, outfp); + } + if (fgets(buf, sizeof buf, infp) == NULL) + return EOF; + yylineno++; + } + } + return *bp++; +} + +void yyerror(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + if (yylineno > 0) + fprintf(stderr, "line %d: ", yylineno); + vfprintf(stderr, fmt, ap); + if (fmt[strlen(fmt)-1] != '\n') + fprintf(stderr, "\n"); + errcnt++; + va_end(ap); +} + +int yylex(void) { + int c; + + if (code) { + char *p; + bp += strspn(bp, " \t\f"); + p = strchr(bp, '\n'); + if (p == NULL) + p = strchr(bp, '\n'); + while (p > bp && isspace(p[-1])) + p--; + yylval.string = alloc(p - bp + 1); + strncpy(yylval.string, bp, p - bp); + yylval.string[p - bp] = 0; + bp = p; + code--; + return CODE; + } + while ((c = get()) != EOF) { + switch (c) { + case ' ': case '\f': case '\t': + continue; + case '\n': + case '(': case ')': case ',': + case ':': case '=': + return c; + } + if (c == '%' && *bp == '%') { + bp++; + return ppercent++ ? 0 : PPERCENT; + } else if (c == '%' && strncmp(bp, "term", 4) == 0 + && isspace(bp[4])) { + bp += 4; + return TERMINAL; + } else if (c == '%' && strncmp(bp, "start", 5) == 0 + && isspace(bp[5])) { + bp += 5; + return START; + } else if (c == '"') { + char *p = strchr(bp, '"'); + if (p == NULL) { + yyerror("missing \" in assembler template\n"); + p = strchr(bp, '\n'); + if (p == NULL) + p = strchr(bp, '\0'); + } + assert(p); + yylval.string = alloc(p - bp + 1); + strncpy(yylval.string, bp, p - bp); + yylval.string[p - bp] = 0; + bp = *p == '"' ? p + 1 : p; + code++; + return TEMPLATE; + } else if (isdigit(c)) { + int n = 0; + do { + int d = c - '0'; + if (n > (INT_MAX - d)/10) + yyerror("integer greater than %d\n", INT_MAX); + else + n = 10*n + d; + c = get(); + } while (c != EOF && isdigit(c)); + bp--; + yylval.n = n; + return INT; + } else if (isalpha(c)) { + char *p = bp - 1; + while (isalpha(*bp) || isdigit(*bp) || *bp == '_') + bp++; + yylval.string = alloc(bp - p + 1); + strncpy(yylval.string, p, bp - p); + yylval.string[bp - p] = 0; + return ID; + } else if (isprint(c)) + yyerror("invalid character `%c'\n", c); + else + yyerror("invalid character `\\%03o'\n", (unsigned char)c); + } + return 0; +} + +void yywarn(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + if (yylineno > 0) + fprintf(stderr, "line %d: ", yylineno); + fprintf(stderr, "warning: "); + vfprintf(stderr, fmt, ap); +} +#line 403 "y.tab.c" +#define YYABORT goto yyabort +#define YYACCEPT goto yyaccept + +#if YYDEBUG +#ifdef __cplusplus +extern "C" char *getenv(); +#else +extern char *getenv(); +#endif +#endif + +int +yyparse() +{ + register int yym, yyn, yystate; + register YYSTYPE *yyvsp; + register short *yyssp; + short *yysse; +#if YYDEBUG + register YYCONST char *yys; + + if (yys = getenv("YYDEBUG")) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } +#endif + + yynerrs = 0; + yyerrflag = 0; + yychar = (-1); + + if (yyss == 0) + { + yyss = (short *) yymalloc (YYSTACKSIZE * sizeof (short)); + if (yyss == 0) + goto yyabort; + yyvs = (YYSTYPE *) yymalloc (YYSTACKSIZE * sizeof (YYSTYPE)); + if (yyvs == 0) + { + yyfree (yyss); + goto yyabort; + } + yystacksize = YYSTACKSIZE; + } + yysse = yyss + yystacksize - 1; + yyssp = yyss; + yyvsp = yyvs; + *yyssp = yystate = 0; + goto yyloop; + +yypush_lex: + yyval = yylval; + yystate = yytable[yyn]; +yypush: + if (yyssp >= yysse) + { + int depth = yyssp - yyss; + if (yygrow() != 0) + goto yyoverflow; + yysse = yyss + yystacksize -1; + yyssp = depth + yyss; + yyvsp = depth + yyvs; + } + *++yyssp = yystate; + *++yyvsp = yyval; + +yyloop: + if ((yyn = yydefred[yystate])) goto yyreduce; + yyn = yysindex[yystate]; + if (yychar < 0) + { + if ((yychar = yylex()) < 0) yychar = 0; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("yydebug: state %d, reading %d (%s)\n", yystate, + yychar, yys); + } +#endif + } + if (yyn != 0 + && ((yyn += yychar), ((unsigned)yyn <= (unsigned)YYTABLESIZE)) + && yycheck[yyn] == yychar) + { +#if YYDEBUG + if (yydebug) + printf("yydebug: state %d, shifting to state %d\n", + yystate, yytable[yyn]); +#endif + if (yyerrflag > 0) --yyerrflag; + yychar = (-1); + goto yypush_lex; + } + yyn = yyrindex[yystate]; + if (yyn != 0 + && ((yyn += yychar), ((unsigned)yyn <= (unsigned)YYTABLESIZE)) + && yycheck[yyn] == yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag) goto yyinrecovery; + yyerror("syntax error"); + ++yynerrs; +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + yyn = yysindex[*yyssp]; + if (yyn != 0 + && ((yyn += YYERRCODE), ((unsigned)yyn <= (unsigned)YYTABLESIZE)) + && yycheck[yyn] == YYERRCODE) + { +#if YYDEBUG + if (yydebug) + printf("yydebug: state %d, error recovery shifting\ + to state %d\n", *yyssp, yytable[yyn]); +#endif + goto yypush_lex; + } + else + { +#if YYDEBUG + if (yydebug) + printf("yydebug: error recovery discarding state %d\n", + *yyssp); +#endif + if (yyssp <= yyss) goto yyabort; + --yyssp; + --yyvsp; + } + } + } + else + { + if (yychar == 0) goto yyabort; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("yydebug: state %d, error recovery discards token %d (%s)\n", + yystate, yychar, yys); + } +#endif + yychar = (-1); + goto yyloop; + } +yyreduce: +#if YYDEBUG + if (yydebug) + printf("yydebug: state %d, reducing by rule %d (%s)\n", + yystate, yyn, yyrule[yyn]); +#endif + yym = yylen[yyn]; + yyval = yyvsp[1-yym]; + switch (yyn) + { +case 1: +#line 22 "lburg/gram.y" +{ yylineno = 0; } +break; +case 2: +#line 23 "lburg/gram.y" +{ yylineno = 0; } +break; +case 6: +#line 31 "lburg/gram.y" +{ + if (nonterm(yyvsp[-1].string)->number != 1) + yyerror("redeclaration of the start symbol\n"); + } +break; +case 8: +#line 36 "lburg/gram.y" +{ yyerrok; } +break; +case 10: +#line 40 "lburg/gram.y" +{ term(yyvsp[-2].string, yyvsp[0].n); } +break; +case 12: +#line 44 "lburg/gram.y" +{ rule(yyvsp[-5].string, yyvsp[-3].tree, yyvsp[-2].string, yyvsp[-1].string); } +break; +case 14: +#line 46 "lburg/gram.y" +{ yyerrok; } +break; +case 15: +#line 49 "lburg/gram.y" +{ nonterm(yyval.string = yyvsp[0].string); } +break; +case 16: +#line 52 "lburg/gram.y" +{ yyval.tree = tree(yyvsp[0].string, 0, 0); } +break; +case 17: +#line 53 "lburg/gram.y" +{ yyval.tree = tree(yyvsp[-3].string, yyvsp[-1].tree, 0); } +break; +case 18: +#line 54 "lburg/gram.y" +{ yyval.tree = tree(yyvsp[-5].string, yyvsp[-3].tree, yyvsp[-1].tree); } +break; +case 19: +#line 57 "lburg/gram.y" +{ if (*yyvsp[0].string == 0) yyval.string = "0"; } +break; +#line 630 "y.tab.c" + } + yyssp -= yym; + yyvsp -= yym; + yym = yylhs[yyn]; + yystate = *yyssp; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + printf("yydebug: after reduction, shifting from state 0 to\ + state %d\n", YYFINAL); +#endif + yystate = YYFINAL; + *++yyssp = YYFINAL; + *++yyvsp = yyval; + if (yychar < 0) + { + if ((yychar = yylex()) < 0) yychar = 0; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("yydebug: state %d, reading %d (%s)\n", + YYFINAL, yychar, yys); + } +#endif + } + if (yychar == 0) goto yyaccept; + goto yyloop; + } + yyn = yygindex[yym]; + if (yyn != 0 + && ((yyn += yystate), ((unsigned)yyn <= (unsigned)YYTABLESIZE)) + && yycheck[yyn] == yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + printf("yydebug: after reduction, shifting from state %d \ +to state %d\n", *yyssp, yystate); +#endif + goto yypush; +yyoverflow: + yyerror("yacc stack overflow"); +yyabort: + return (1); +yyaccept: + return (0); +} diff --git a/src/cmd/lccom-1/lburg/gram.y b/src/cmd/lccom-1/lburg/gram.y new file mode 100644 index 0000000..b756daa --- /dev/null +++ b/src/cmd/lccom-1/lburg/gram.y @@ -0,0 +1,202 @@ +%{ +#include +#include "lburg.h" +static char rcsid[] = "$Id: gram.y,v 2.5 1997/11/21 18:59:34 drh Exp $"; +/*lint -e616 -e527 -e652 -esym(552,yynerrs) -esym(563,yynewstate,yyerrlab) */ +static int yylineno = 0; +%} +%union { + int n; + char *string; + Tree tree; +} +%term TERMINAL +%term START +%term PPERCENT + +%token ID TEMPLATE CODE +%token INT +%type nonterm cost +%type tree +%% +spec : decls PPERCENT rules { yylineno = 0; } + | decls { yylineno = 0; } + ; + +decls : /* lambda */ + | decls decl + ; + +decl : TERMINAL blist '\n' + | START nonterm '\n' { + if (nonterm($2)->number != 1) + yyerror("redeclaration of the start symbol\n"); + } + | '\n' + | error '\n' { yyerrok; } + ; + +blist : /* lambda */ + | blist ID '=' INT { term($2, $4); } + ; + +rules : /* lambda */ + | rules nonterm ':' tree TEMPLATE cost '\n' { rule($2, $4, $5, $6); } + | rules '\n' + | rules error '\n' { yyerrok; } + ; + +nonterm : ID { nonterm($$ = $1); } + ; + +tree : ID { $$ = tree($1, 0, 0); } + | ID '(' tree ')' { $$ = tree($1, $3, 0); } + | ID '(' tree ',' tree ')' { $$ = tree($1, $3, $5); } + ; + +cost : CODE { if (*$1 == 0) $$ = "0"; } + ; +%% +#include +#include +#include +#include +#include + +int errcnt = 0; +FILE *infp = NULL; +FILE *outfp = NULL; +static char buf[BUFSIZ], *bp = buf; +static int ppercent = 0; +static int code = 0; + +static int get(void) { + if (*bp == 0) { + bp = buf; + *bp = 0; + if (fgets(buf, sizeof buf, infp) == NULL) + return EOF; + yylineno++; + while (buf[0] == '%' && buf[1] == '{' && buf[2] == '\n') { + for (;;) { + if (fgets(buf, sizeof buf, infp) == NULL) { + yywarn("unterminated %{...%}\n"); + return EOF; + } + yylineno++; + if (strcmp(buf, "%}\n") == 0) + break; + fputs(buf, outfp); + } + if (fgets(buf, sizeof buf, infp) == NULL) + return EOF; + yylineno++; + } + } + return *bp++; +} + +void yyerror(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + if (yylineno > 0) + fprintf(stderr, "line %d: ", yylineno); + vfprintf(stderr, fmt, ap); + if (fmt[strlen(fmt)-1] != '\n') + fprintf(stderr, "\n"); + errcnt++; + va_end(ap); +} + +int yylex(void) { + int c; + + if (code) { + char *p; + bp += strspn(bp, " \t\f"); + p = strchr(bp, '\n'); + if (p == NULL) + p = strchr(bp, '\n'); + while (p > bp && isspace(p[-1])) + p--; + yylval.string = alloc(p - bp + 1); + strncpy(yylval.string, bp, p - bp); + yylval.string[p - bp] = 0; + bp = p; + code--; + return CODE; + } + while ((c = get()) != EOF) { + switch (c) { + case ' ': case '\f': case '\t': + continue; + case '\n': + case '(': case ')': case ',': + case ':': case '=': + return c; + } + if (c == '%' && *bp == '%') { + bp++; + return ppercent++ ? 0 : PPERCENT; + } else if (c == '%' && strncmp(bp, "term", 4) == 0 + && isspace(bp[4])) { + bp += 4; + return TERMINAL; + } else if (c == '%' && strncmp(bp, "start", 5) == 0 + && isspace(bp[5])) { + bp += 5; + return START; + } else if (c == '"') { + char *p = strchr(bp, '"'); + if (p == NULL) { + yyerror("missing \" in assembler template\n"); + p = strchr(bp, '\n'); + if (p == NULL) + p = strchr(bp, '\0'); + } + assert(p); + yylval.string = alloc(p - bp + 1); + strncpy(yylval.string, bp, p - bp); + yylval.string[p - bp] = 0; + bp = *p == '"' ? p + 1 : p; + code++; + return TEMPLATE; + } else if (isdigit(c)) { + int n = 0; + do { + int d = c - '0'; + if (n > (INT_MAX - d)/10) + yyerror("integer greater than %d\n", INT_MAX); + else + n = 10*n + d; + c = get(); + } while (c != EOF && isdigit(c)); + bp--; + yylval.n = n; + return INT; + } else if (isalpha(c)) { + char *p = bp - 1; + while (isalpha(*bp) || isdigit(*bp) || *bp == '_') + bp++; + yylval.string = alloc(bp - p + 1); + strncpy(yylval.string, p, bp - p); + yylval.string[bp - p] = 0; + return ID; + } else if (isprint(c)) + yyerror("invalid character `%c'\n", c); + else + yyerror("invalid character `\\%03o'\n", (unsigned char)c); + } + return 0; +} + +void yywarn(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + if (yylineno > 0) + fprintf(stderr, "line %d: ", yylineno); + fprintf(stderr, "warning: "); + vfprintf(stderr, fmt, ap); +} diff --git a/src/cmd/lccom-1/lburg/lburg.1 b/src/cmd/lccom-1/lburg/lburg.1 new file mode 100644 index 0000000..046bcbe --- /dev/null +++ b/src/cmd/lccom-1/lburg/lburg.1 @@ -0,0 +1,358 @@ +.TH LBURG 1 "local \- 11/30/94" + +.\" $Id: lburg.1,v 2.1 1994/11/30 21:53:18 drh Exp $ + +.SH NAME + +lburg \- lcc's code-generator generator + +.SH SYNOPSIS + +.B lburg + +[ + +.I option + +]... + +[ [ + +.I input + +] + +.I output + +] + +.br + +.SH DESCRIPTION + +.PP + +.I lburg + +reads an lcc-style BURG specification from + +.I input + +and writes a pattern-matching code generator to + +.IR output . + +If + +.I input + +is `\-' or is omitted, + +.I lburg + +reads the standard input; + +If + +.I output + +is `\-' or is omitted, + +.I lburg + +writes to the standard output. + +.PP + +.I lburg + +accepts specifications that conform to the following EBNF grammar. + +Terminals are enclosed in single quotes or are + +given in uppercase, all other symbols are nonterminals or English phrases, + +{X} denotes zero or more instances of X, and [X] denotes an optional X. + +.PP + +.nf + +.RS + +.ft CW + +spec: `%{' configuration `%}' { dcl } `%%' { rule } + + [ `%%' C code ] + + + +dcl: `%start' nonterm + + `%term' { ID `=' INT } + + + +rule: nonterm `:' tree template [ C expression ] + + + +tree: term `(' tree `,' tree `)' + + term `(' tree `)' + + term + + nonterm + + + +nonterm: ID + + + +template: `"' { any character except double quote } `"' + +.RE + +.fi + +.PP + +Specifications are structurally similar to + +.IR yacc 's. + +Text between + +`\f(CW%{\fP' + +and + +`\f(CW%}\fP' + +is called the configuration section; there may be several such segments. + +All are concatenated and copied verbatim into the head of the output. + +Text after the second + +`\f(CW%%\fP', + +if any, is also copied verbatim into the output, at the end. + +.PP + +Specifications consist of declarations, a + +`\f(CW%%\fP' + +separator, and rules. + +Input is line-oriented; each declaration and rule must appear on a separate line, + +and declarations must begin in column 1. + +Declarations declare terminals \(em the operators in subject + +trees \(em and associate a unique, positive external symbol + +number with each one. + +Nonterminals are declared by their presence + +on the left side of rules. The + +\f(CW%start\fP + +declaration optionally declares a nonterminal as the start symbol. + +In the grammar above, + +\f(CWterm\fP + +and + +\f(CWnonterm\fP + +denote identifiers that are terminals and nonterminals. + +.PP + +Rules define tree patterns in a fully parenthesized prefix + +form. Every nonterminal denotes a tree. + +Each operator has a fixed + +arity, which is inferred from the rules in which it is used. + +A chain rule is a rule whose pattern is another nonterminal. + +If no start symbol is declared, the nonterminal defined by the first rule is used. + +.PP + +Each rule ends with an expression that computes the cost of matching + +that rule; omitted costs + +default to zero. Costs of chain rules must be constants. + +.PP + +The configuration section configures the output + +for the trees being parsed and the client's environment. + +As shown, this section must define + +\f(CWNODEPTR_TYPE\fP + +to be a visible typedef symbol for a pointer to a + +node in the subject tree. + +The labeller invokes + +\f(CWOP_LABEL(p)\fP, + +\f(CWLEFT\_CHILD(p)\fP, and + +\f(CWRIGHT\_CHILD(p)\fP + +to read the operator and children from the node pointed to by \f(CWp\fP. + +If the configuration section defines these operations as macros, they are implemented in-line; + +otherwise, they must be implemented as functions. + +.PP + +The matcher + +computes and stores a single integral state in each node of the subject tree. + +The configuration section must define a macro + +\f(CWSTATE_LABEL(p)\fP + +to access the state field of the node pointed to + +by \f(CWp\fP. It must be large enough to hold a pointer, and + +a macro is required because it is used as an lvalue. + +.PP + +.SH OPTIONS + +.TP + +.BI \-p \ prefix + +.br + +.ns + +.TP + +.BI \-p prefix + +Use + +.I prefix + +as the disambiquating prefix for visible names and fields. + +The default is `\f(CW_\fP'. + +.TP + +.B \-T + +Arrange for + +.sp + +.nf + +.ft CW + + void _trace(NODEPTR_TYPE p, int eruleno, + + int cost, int bestcost); + +.sp + +.fi + +.ft R + +to be called at each successful match. + +\f(CWp\fP + +identifies the node and + +\f(CWeruleno\fP + +identifies the matching rule; the rules are numbered + +beginning at 1 in the order they appear in the input. + +\f(CWcost\fP + +is the cost of the match and + +\f(CWbestcost\fP + +is the cost of the best previous match. The current match + +wins only if + +\f(CWcost\fP + +is less than \f(CWbestcost\fP. + +32767 represents the infinite cost of no previous match. + +\f(CW_trace\fP must be declared in the configuration section. + +.SH "SEE ALSO" + +.IR lcc (1) + +.PP + +C. W. Fraser and D. R. Hanson, + +.IR A Retargetable C Compiler: Design and Implementation , + +Benjamin/Cummings, Redwood City, CA, 1995, + +ISBN 0-8053-1670-1. Chapter 14. + +.PP + +C. W. Fraser, D. R. Hanson and T. A. Proebsting, + +`Engineering a simple, efficient code generator generator,' + +.I + +ACM Letters on Programming Languages and Systems + +.BR 1 , + +3 (Sep. 1992), 213-226. + +.br + +.SH BUGS + +Mail bug reports along with the shortest input + +that exposes them to drh@cs.princeton.edu. + diff --git a/src/cmd/lccom-1/lburg/lburg.c b/src/cmd/lccom-1/lburg/lburg.c new file mode 100644 index 0000000..b73151e --- /dev/null +++ b/src/cmd/lccom-1/lburg/lburg.c @@ -0,0 +1,682 @@ +#include +#include +#include +#include +#include +#include +#include +#include "lburg.h" + +static char rcsid[] = "$Id: lburg.c,v 2.10 2002/03/08 18:45:21 drh Exp $"; +static char *prefix = ""; +static int Tflag = 0; +static int nflag = 0; +static int ntnumber = 0; +static Nonterm start = 0; +static Term terms; +static Nonterm nts; +static Rule rules; +static int nrules; + +static struct block { + struct block *link; +} *memlist; /* list of allocated blocks */ + +static char *stringf(char *fmt, ...); +static void print(char *fmt, ...); +static void ckreach(Nonterm p); +static void emitclosure(Nonterm nts); +static void emitcost(Tree t, char *v); +static void emitdefs(Nonterm nts, int ntnumber); +static void emitheader(void); +static void emitkids(Rule rules, int nrules); +static void emitnts(Rule rules, int nrules); +static void emitrecalc(char *pre, Term root, Term kid); +static void emitrecord(char *pre, Rule r, char *c, int cost); +static void emitrule(Nonterm nts); +static void emitlabel(Term terms, Nonterm start, int ntnumber); +static void emitstring(Rule rules); +static void emitstruct(Nonterm nts, int ntnumber); +static void emittest(Tree t, char *v, char *suffix); + +int main(int argc, char *argv[]) +{ + int c, i; + Nonterm p; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "-T") == 0) + Tflag = 1; + else if (strcmp(argv[i], "-n") == 0) + nflag = 1; + else if (strncmp(argv[i], "-p", 2) == 0 && argv[i][2]) + prefix = &argv[i][2]; + else if (strncmp(argv[i], "-p", 2) == 0 && i + 1 < argc) + prefix = argv[++i]; + else if (*argv[i] == '-' && argv[i][1]) { + yyerror("usage: %s [-T | -p prefix]... [ [ input ] output ] \n", + argv[0]); + exit(1); + } else if (infp == NULL) { + if (strcmp(argv[i], "-") == 0) + infp = stdin; + else if ((infp = fopen(argv[i], "r")) == NULL) { + yyerror("%s: can't read `%s'\n", argv[0], argv[i]); + exit(1); + } + } else if (outfp == NULL) { + if (strcmp(argv[i], "-") == 0) + outfp = stdout; + if ((outfp = fopen(argv[i], "w")) == NULL) { + yyerror("%s: can't write `%s'\n", argv[0], argv[i]); + exit(1); + } + } + if (infp == NULL) + infp = stdin; + if (outfp == NULL) + outfp = stdout; + yyparse(); + if (start) + ckreach(start); + for (p = nts; p; p = p->link) { + if (p->rules == NULL) + yyerror("undefined nonterminal `%s'\n", p->name); + if (!p->reached) + yyerror("can't reach nonterminal `%s'\n", p->name); + } + emitheader(); + emitdefs(nts, ntnumber); + emitstruct(nts, ntnumber); + emitnts(rules, nrules); + if (! nflag) + emitstring(rules); + emitrule(nts); + emitclosure(nts); + if (start) + emitlabel(terms, start, ntnumber); + emitkids(rules, nrules); + if (!feof(infp)) + while ((c = getc(infp)) != EOF) + putc(c, outfp); + while (memlist) { /* for purify */ + struct block *q = memlist->link; + free(memlist); + memlist = q; + } + return errcnt > 0; +} + +/* alloc - allocate nbytes or issue fatal error */ +void *alloc(int nbytes) { + struct block *p = calloc(1, sizeof *p + nbytes); + + if (p == NULL) { + yyerror("out of memory\n"); + exit(1); + } + p->link = memlist; + memlist = p; + return p + 1; +} + +/* stringf - format and save a string */ +static char *stringf(char *fmt, ...) { + va_list ap; + char buf[512]; + + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + va_end(ap); + return strcpy(alloc(strlen(buf) + 1), buf); +} + +struct entry { + union { + char *name; + struct term t; + struct nonterm nt; + } sym; + struct entry *link; +} *table[211]; +#define HASHSIZE (sizeof table/sizeof table[0]) + +/* hash - return hash number for str */ +static unsigned hash(char *str) { + unsigned h = 0; + + while (*str) + h = (h<<1) + *str++; + return h; +} + +/* lookup - lookup symbol name */ +static void *lookup(char *name) { + struct entry *p = table[hash(name)%HASHSIZE]; + + for ( ; p; p = p->link) + if (strcmp(name, p->sym.name) == 0) + return &p->sym; + return 0; +} + +/* install - install symbol name */ +static void *install(char *name) { + struct entry *p = alloc(sizeof *p); + int i = hash(name)%HASHSIZE; + + p->sym.name = name; + p->link = table[i]; + table[i] = p; + return &p->sym; +} + +/* nonterm - create a new terminal id, if necessary */ +Nonterm nonterm(char *id) { + Nonterm p = lookup(id), *q = &nts; + + if (p && p->kind == NONTERM) + return p; + if (p && p->kind == TERM) + yyerror("`%s' is a terminal\n", id); + p = install(id); + p->kind = NONTERM; + p->number = ++ntnumber; + if (p->number == 1) + start = p; + while (*q && (*q)->number < p->number) + q = &(*q)->link; + assert(*q == 0 || (*q)->number != p->number); + p->link = *q; + *q = p; + return p; +} + +/* term - create a new terminal id with external symbol number esn */ +Term term(char *id, int esn) { + Term p = lookup(id), *q = &terms; + + if (p) + yyerror("redefinition of terminal `%s'\n", id); + else + p = install(id); + p->kind = TERM; + p->esn = esn; + p->arity = -1; + while (*q && (*q)->esn < p->esn) + q = &(*q)->link; + if (*q && (*q)->esn == p->esn) + yyerror("duplicate external symbol number `%s=%d'\n", + p->name, p->esn); + p->link = *q; + *q = p; + return p; +} + +/* tree - create & initialize a tree node with the given fields */ +Tree tree(char *id, Tree left, Tree right) { + Tree t = alloc(sizeof *t); + Term p = lookup(id); + int arity = 0; + + if (left && right) + arity = 2; + else if (left) + arity = 1; + if (p == NULL && arity > 0) { + yyerror("undefined terminal `%s'\n", id); + p = term(id, -1); + } else if (p == NULL && arity == 0) + p = (Term)nonterm(id); + else if (p && p->kind == NONTERM && arity > 0) { + yyerror("`%s' is a nonterminal\n", id); + p = term(id, -1); + } + if (p->kind == TERM && p->arity == -1) + p->arity = arity; + if (p->kind == TERM && arity != p->arity) + yyerror("inconsistent arity for terminal `%s'\n", id); + t->op = p; + t->nterms = p->kind == TERM; + if ((t->left = left) != NULL) + t->nterms += left->nterms; + if ((t->right = right) != NULL) + t->nterms += right->nterms; + return t; +} + +/* rule - create & initialize a rule with the given fields */ +Rule rule(char *id, Tree pattern, char *template, char *code) { + Rule r = alloc(sizeof *r), *q; + Term p = pattern->op; + char *end; + + r->lhs = nonterm(id); + r->packed = ++r->lhs->lhscount; + for (q = &r->lhs->rules; *q; q = &(*q)->decode) + ; + *q = r; + r->pattern = pattern; + r->ern = ++nrules; + r->template = template; + r->code = code; + r->cost = strtol(code, &end, 10); + if (*end) { + r->cost = -1; + r->code = stringf("(%s)", code); + } + if (p->kind == TERM) { + for (q = &p->rules; *q; q = &(*q)->next) + ; + *q = r; + } else if (pattern->left == NULL && pattern->right == NULL) { + Nonterm p = pattern->op; + r->chain = p->chain; + p->chain = r; + if (r->cost == -1) + yyerror("illegal nonconstant cost `%s'\n", code); + } + for (q = &rules; *q; q = &(*q)->link) + ; + r->link = *q; + *q = r; + return r; +} + +/* print - formatted output */ +static void print(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + for ( ; *fmt; fmt++) + if (*fmt == '%') + switch (*++fmt) { + case 'd': fprintf(outfp, "%d", va_arg(ap, int)); break; + case 's': fputs(va_arg(ap, char *), outfp); break; + case 'P': fprintf(outfp, "%s_", prefix); break; + case 'T': { + Tree t = va_arg(ap, Tree); + print("%S", t->op); + if (t->left && t->right) + print("(%T,%T)", t->left, t->right); + else if (t->left) + print("(%T)", t->left); + break; + } + case 'R': { + Rule r = va_arg(ap, Rule); + print("%S: %T", r->lhs, r->pattern); + break; + } + case 'S': { + Term t = va_arg(ap, Term); + fputs(t->name, outfp); + break; + } + case '1': case '2': case '3': case '4': case '5': { + int n = *fmt - '0'; + while (n-- > 0) + putc('\t', outfp); + break; + } + default: putc(*fmt, outfp); break; + } + else + putc(*fmt, outfp); + va_end(ap); +} + +/* reach - mark all nonterminals in tree t as reachable */ +static void reach(Tree t) { + Nonterm p = t->op; + + if (p->kind == NONTERM) + if (!p->reached) + ckreach(p); + if (t->left) + reach(t->left); + if (t->right) + reach(t->right); +} + +/* ckreach - mark all nonterminals reachable from p */ +static void ckreach(Nonterm p) { + Rule r; + + p->reached = 1; + for (r = p->rules; r; r = r->decode) + reach(r->pattern); +} + +/* emitcase - emit one case in function state */ +static void emitcase(Term p, int ntnumber) { + Rule r; + + print("%1case %d: /* %S */\n", p->esn, p); + switch (p->arity) { + case 0: case -1: + break; + case 1: + print("%2%Plabel(LEFT_CHILD(a));\n"); + break; + case 2: + print("%2%Plabel(LEFT_CHILD(a));\n"); + print("%2%Plabel(RIGHT_CHILD(a));\n"); + break; + default: assert(0); + } + for (r = p->rules; r; r = r->next) { + char *indent = "\t\t\0"; + switch (p->arity) { + case 0: case -1: + print("%2/* %R */\n", r); + if (r->cost == -1) { + print("%2c = %s;\n", r->code); + emitrecord("\t\t", r, "c", 0); + } else + emitrecord("\t\t", r, r->code, 0); + break; + case 1: + if (r->pattern->nterms > 1) { + print("%2if (%1/* %R */\n", r); + emittest(r->pattern->left, "LEFT_CHILD(a)", " "); + print("%2) {\n"); + indent = "\t\t\t"; + } else + print("%2/* %R */\n", r); + if (r->pattern->nterms == 2 && r->pattern->left + && r->pattern->right == NULL) + emitrecalc(indent, r->pattern->op, r->pattern->left->op); + print("%sc = ", indent); + emitcost(r->pattern->left, "LEFT_CHILD(a)"); + print("%s;\n", r->code); + emitrecord(indent, r, "c", 0); + if (indent[2]) + print("%2}\n"); + break; + case 2: + if (r->pattern->nterms > 1) { + print("%2if (%1/* %R */\n", r); + emittest(r->pattern->left, "LEFT_CHILD(a)", + r->pattern->right->nterms ? " && " : " "); + emittest(r->pattern->right, "RIGHT_CHILD(a)", " "); + print("%2) {\n"); + indent = "\t\t\t"; + } else + print("%2/* %R */\n", r); + print("%sc = ", indent); + emitcost(r->pattern->left, "LEFT_CHILD(a)"); + emitcost(r->pattern->right, "RIGHT_CHILD(a)"); + print("%s;\n", r->code); + emitrecord(indent, r, "c", 0); + if (indent[2]) + print("%2}\n"); + break; + default: assert(0); + } + } + print("%2break;\n"); +} + +/* emitclosure - emit the closure functions */ +static void emitclosure(Nonterm nts) { + Nonterm p; + + for (p = nts; p; p = p->link) + if (p->chain) + print("static void %Pclosure_%S(NODEPTR_TYPE, int);\n", p); + print("\n"); + for (p = nts; p; p = p->link) + if (p->chain) { + Rule r; + print("static void %Pclosure_%S(NODEPTR_TYPE a, int c) {\n" +"%1struct %Pstate *p = STATE_LABEL(a);\n", p); + for (r = p->chain; r; r = r->chain) + emitrecord("\t", r, "c", r->cost); + print("}\n\n"); + } +} + +/* emitcost - emit cost computation for tree t */ +static void emitcost(Tree t, char *v) { + Nonterm p = t->op; + + if (p->kind == TERM) { + if (t->left) + emitcost(t->left, stringf("LEFT_CHILD(%s)", v)); + if (t->right) + emitcost(t->right, stringf("RIGHT_CHILD(%s)", v)); + } else + print("((struct %Pstate *)(%s->x.state))->cost[%P%S_NT] + ", v, p); +} + +/* emitdefs - emit nonterminal defines and data structures */ +static void emitdefs(Nonterm nts, int ntnumber) { + Nonterm p; + + for (p = nts; p; p = p->link) + print("#define %P%S_NT %d\n", p, p->number); + print("\n"); + if (! nflag) { + print("static char *%Pntname[] = {\n%10,\n"); + for (p = nts; p; p = p->link) + print("%1\"%S\",\n", p); + print("%10\n};\n\n"); + } +} + +/* emitheader - emit initial definitions */ +static void emitheader(void) { + time_t timer = time(NULL); + + print("/*\ngenerated at %sby %s\n*/\n", ctime(&timer), rcsid); + print("static void %Pkids(NODEPTR_TYPE, int, NODEPTR_TYPE[]);\n"); + print("static void %Plabel(NODEPTR_TYPE);\n"); + print("static int %Prule(void*, int);\n\n"); +} + +/* computekids - compute paths to kids in tree t */ +static char *computekids(Tree t, char *v, char *bp, int *ip) { + Term p = t->op; + + if (p->kind == NONTERM) { + sprintf(bp, "\t\tkids[%d] = %s;\n", (*ip)++, v); + bp += strlen(bp); + } else if (p->arity > 0) { + bp = computekids(t->left, stringf("LEFT_CHILD(%s)", v), bp, ip); + if (p->arity == 2) + bp = computekids(t->right, stringf("RIGHT_CHILD(%s)", v), bp, ip); + } + return bp; +} + +/* emitkids - emit _kids */ +static void emitkids(Rule rules, int nrules) { + int i; + Rule r, *rc = alloc((nrules + 1 + 1)*sizeof *rc); + char **str = alloc((nrules + 1 + 1)*sizeof *str); + + for (i = 0, r = rules; r; r = r->link) { + int j = 0; + char buf[1024], *bp = buf; + *computekids(r->pattern, "p", bp, &j) = 0; + for (j = 0; str[j] && strcmp(str[j], buf); j++) + ; + if (str[j] == NULL) + str[j] = strcpy(alloc(strlen(buf) + 1), buf); + r->kids = rc[j]; + rc[j] = r; + } + print("static void %Pkids(NODEPTR_TYPE p, int eruleno, NODEPTR_TYPE kids[]) {\n" +"%1if (!p)\n%2fatal(\"%Pkids\", \"Null tree\\n\", 0);\n" +"%1if (!kids)\n%2fatal(\"%Pkids\", \"Null kids\\n\", 0);\n" +"%1switch (eruleno) {\n"); + for (i = 0; (r = rc[i]) != NULL; i++) { + for ( ; r; r = r->kids) + print("%1case %d: /* %R */\n", r->ern, r); + print("%s%2break;\n", str[i]); + } + print("%1default:\n%2fatal(\"%Pkids\", \"Bad rule number %%d\\n\", eruleno);\n%1}\n}\n\n"); +} + +/* emitlabel - emit label function */ +static void emitlabel(Term terms, Nonterm start, int ntnumber) { + int i; + Term p; + + print("static void %Plabel(NODEPTR_TYPE a) {\n%1int c;\n" +"%1struct %Pstate *p;\n\n" +"%1if (!a)\n%2fatal(\"%Plabel\", \"Null tree\\n\", 0);\n"); + print("%1STATE_LABEL(a) = p = allocate(sizeof *p, FUNC);\n" +"%1p->rule._stmt = 0;\n"); + for (i = 1; i <= ntnumber; i++) + print("%1p->cost[%d] =\n", i); + print("%20x7fff;\n%1switch (OP_LABEL(a)) {\n"); + for (p = terms; p; p = p->link) + emitcase(p, ntnumber); + print("%1default:\n" +"%2fatal(\"%Plabel\", \"Bad terminal %%d\\n\", OP_LABEL(a));\n%1}\n}\n\n"); +} + +/* computents - fill in bp with _nts vector for tree t */ +static char *computents(Tree t, char *bp) { + if (t) { + Nonterm p = t->op; + if (p->kind == NONTERM) { + sprintf(bp, "%s_%s_NT, ", prefix, p->name); + bp += strlen(bp); + } else + bp = computents(t->right, computents(t->left, bp)); + } + return bp; +} + +/* emitnts - emit _nts ragged array */ +static void emitnts(Rule rules, int nrules) { + Rule r; + int i, j, *nts = alloc((nrules + 1)*sizeof *nts); + char **str = alloc((nrules + 1)*sizeof *str); + + for (i = 0, r = rules; r; r = r->link) { + char buf[1024]; + *computents(r->pattern, buf) = 0; + for (j = 0; str[j] && strcmp(str[j], buf); j++) + ; + if (str[j] == NULL) { + print("static short %Pnts_%d[] = { %s0 };\n", j, buf); + str[j] = strcpy(alloc(strlen(buf) + 1), buf); + } + nts[i++] = j; + } + print("\nstatic short *%Pnts[] = {\n"); + for (i = j = 0, r = rules; r; r = r->link) { + for ( ; j < r->ern; j++) + print("%10,%1/* %d */\n", j); + print("%1%Pnts_%d,%1/* %d */\n", nts[i++], j++); + } + print("};\n\n"); +} + +/* emitrecalc - emit code that tests for recalculation of INDIR?(VREGP) */ +static void emitrecalc(char *pre, Term root, Term kid) { + if (root->kind == TERM && strncmp(root->name, "INDIR", 5) == 0 + && kid->kind == TERM && strcmp(kid->name, "VREGP" ) == 0) { + Nonterm p; + print("%sif (mayrecalc(a)) {\n", pre); + print("%s%1struct %Pstate *q = a->syms[RX]->u.t.cse->x.state;\n", pre); + for (p = nts; p; p = p->link) { + print("%s%1if (q->cost[%P%S_NT] == 0) {\n", pre, p); + print("%s%2p->cost[%P%S_NT] = 0;\n", pre, p); + print("%s%2p->rule.%P%S = q->rule.%P%S;\n", pre, p, p); + print("%s%1}\n", pre); + } + print("%s}\n", pre); + } +} + +/* emitrecord - emit code that tests for a winning match of rule r */ +static void emitrecord(char *pre, Rule r, char *c, int cost) { + if (Tflag) + print("%s%Ptrace(a, %d, %s + %d, p->cost[%P%S_NT]);\n", + pre, r->ern, c, cost, r->lhs); + print("%sif (", pre); + print("%s + %d < p->cost[%P%S_NT]) {\n" +"%s%1p->cost[%P%S_NT] = %s + %d;\n%s%1p->rule.%P%S = %d;\n", + c, cost, r->lhs, pre, r->lhs, c, cost, pre, r->lhs, + r->packed); + if (r->lhs->chain) + print("%s%1%Pclosure_%S(a, %s + %d);\n", pre, r->lhs, c, cost); + print("%s}\n", pre); +} + +/* emitrule - emit decoding vectors and _rule */ +static void emitrule(Nonterm nts) { + Nonterm p; + + for (p = nts; p; p = p->link) { + Rule r; + print("static short %Pdecode_%S[] = {\n%10,\n", p); + for (r = p->rules; r; r = r->decode) + print("%1%d,\n", r->ern); + print("};\n\n"); + } + print("static int %Prule(void *state, int goalnt) {\n" +"%1if (goalnt < 1 || goalnt > %d)\n%2fatal(\"%Prule\", \"Bad goal nonterminal %%d\\n\", goalnt);\n" +"%1if (!state)\n%2return 0;\n%1switch (goalnt) {\n", ntnumber); + for (p = nts; p; p = p->link) + print("%1case %P%S_NT:" +"%1return %Pdecode_%S[((struct %Pstate *)state)->rule.%P%S];\n", p, p, p); + print("%1default:\n%2fatal(\"%Prule\", \"Bad goal nonterminal %%d\\n\", goalnt);\n%2return 0;\n%1}\n}\n\n"); +} + +/* emitstring - emit arrays of templates, instruction flags, and rules */ +static void emitstring(Rule rules) { + Rule r; + + print("static char *%Ptemplates[] = {\n"); + print("/* 0 */%10,\n"); + for (r = rules; r; r = r->link) + print("/* %d */%1\"%s\",%1/* %R */\n", r->ern, r->template, r); + print("};\n"); + print("\nstatic char %Pisinstruction[] = {\n"); + print("/* 0 */%10,\n"); + for (r = rules; r; r = r->link) { + int len = strlen(r->template); + print("/* %d */%1%d,%1/* %s */\n", r->ern, + len >= 2 && r->template[len-2] == '\\' && r->template[len-1] == 'n', + r->template); + } + print("};\n"); + print("\nstatic char *%Pstring[] = {\n"); + print("/* 0 */%10,\n"); + for (r = rules; r; r = r->link) + print("/* %d */%1\"%R\",\n", r->ern, r); + print("};\n\n"); +} + +/* emitstruct - emit the definition of the state structure */ +static void emitstruct(Nonterm nts, int ntnumber) { + print("struct %Pstate {\n%1short cost[%d];\n%1struct {\n", ntnumber + 1); + for ( ; nts; nts = nts->link) { + int n = 1, m = nts->lhscount; + while ((m >>= 1) != 0) + n++; + print("%2unsigned int %P%S:%d;\n", nts, n); + } + print("%1} rule;\n};\n\n"); +} + +/* emittest - emit clause for testing a match */ +static void emittest(Tree t, char *v, char *suffix) { + Term p = t->op; + + if (p->kind == TERM) { + print("%3%s->op == %d%s/* %S */\n", v, p->esn, + t->nterms > 1 ? " && " : suffix, p); + if (t->left) + emittest(t->left, stringf("LEFT_CHILD(%s)", v), + t->right && t->right->nterms ? " && " : suffix); + if (t->right) + emittest(t->right, stringf("RIGHT_CHILD(%s)", v), suffix); + } +} diff --git a/src/cmd/lccom-1/lburg/lburg.h b/src/cmd/lccom-1/lburg/lburg.h new file mode 100644 index 0000000..75dbe79 --- /dev/null +++ b/src/cmd/lccom-1/lburg/lburg.h @@ -0,0 +1,132 @@ +#ifndef BURG_INCLUDED + +#define BURG_INCLUDED + + + +/* $Id: lburg.h,v 2.1 1994/11/30 21:53:18 drh Exp $ */ + +/* iburg.c: */ + +extern void *alloc(int nbytes); + + + +typedef enum { TERM=1, NONTERM } Kind; + +typedef struct rule *Rule; + +typedef struct term *Term; + +struct term { /* terminals: */ + + char *name; /* terminal name */ + + Kind kind; /* TERM */ + + int esn; /* external symbol number */ + + int arity; /* operator arity */ + + Term link; /* next terminal in esn order */ + + Rule rules; /* rules whose pattern starts with term */ + +}; + + + +typedef struct nonterm *Nonterm; + +struct nonterm { /* nonterminals: */ + + char *name; /* nonterminal name */ + + Kind kind; /* NONTERM */ + + int number; /* identifying number */ + + int lhscount; /* # times nt appears in a rule lhs */ + + int reached; /* 1 iff reached from start nonterminal */ + + Rule rules; /* rules w/nonterminal on lhs */ + + Rule chain; /* chain rules w/nonterminal on rhs */ + + Nonterm link; /* next terminal in number order */ + +}; + +extern Nonterm nonterm(char *id); + +extern Term term(char *id, int esn); + + + +typedef struct tree *Tree; + +struct tree { /* tree patterns: */ + + void *op; /* a terminal or nonterminal */ + + Tree left, right; /* operands */ + + int nterms; /* number of terminal nodes in this tree */ + +}; + +extern Tree tree(char *op, Tree left, Tree right); + + + +struct rule { /* rules: */ + + Nonterm lhs; /* lefthand side nonterminal */ + + Tree pattern; /* rule pattern */ + + int ern; /* external rule number */ + + int packed; /* packed external rule number */ + + int cost; /* cost, if a constant */ + + char *code; /* cost, if an expression */ + + char *template; /* assembler template */ + + Rule link; /* next rule in ern order */ + + Rule next; /* next rule with same pattern root */ + + Rule chain; /* next chain rule with same rhs */ + + Rule decode; /* next rule with same lhs */ + + Rule kids; /* next rule with same _kids pattern */ + +}; + +extern Rule rule(char *id, Tree pattern, char *template, char *code); + + + +/* gram.y: */ + +void yyerror(char *fmt, ...); + +int yyparse(void); + +void yywarn(char *fmt, ...); + +extern int errcnt; + +extern FILE *infp; + +extern FILE *outfp; + + + +#endif + diff --git a/src/cmd/lccom-1/lex.c b/src/cmd/lccom-1/lex.c new file mode 100644 index 0000000..d9401a5 --- /dev/null +++ b/src/cmd/lccom-1/lex.c @@ -0,0 +1,930 @@ +#include "c.h" +#include +#include + +#define MAXTOKEN 32 + +enum { BLANK=01, NEWLINE=02, LETTER=04, + DIGIT=010, HEX=020, OTHER=040 }; + +static unsigned char map[256] = { /* 000 nul */ 0, + /* 001 soh */ 0, + /* 002 stx */ 0, + /* 003 etx */ 0, + /* 004 eot */ 0, + /* 005 enq */ 0, + /* 006 ack */ 0, + /* 007 bel */ 0, + /* 010 bs */ 0, + /* 011 ht */ BLANK, + /* 012 nl */ NEWLINE, + /* 013 vt */ BLANK, + /* 014 ff */ BLANK, + /* 015 cr */ 0, + /* 016 so */ 0, + /* 017 si */ 0, + /* 020 dle */ 0, + /* 021 dc1 */ 0, + /* 022 dc2 */ 0, + /* 023 dc3 */ 0, + /* 024 dc4 */ 0, + /* 025 nak */ 0, + /* 026 syn */ 0, + /* 027 etb */ 0, + /* 030 can */ 0, + /* 031 em */ 0, + /* 032 sub */ 0, + /* 033 esc */ 0, + /* 034 fs */ 0, + /* 035 gs */ 0, + /* 036 rs */ 0, + /* 037 us */ 0, + /* 040 sp */ BLANK, + /* 041 ! */ OTHER, + /* 042 " */ OTHER, + /* 043 # */ OTHER, + /* 044 $ */ 0, + /* 045 % */ OTHER, + /* 046 & */ OTHER, + /* 047 ' */ OTHER, + /* 050 ( */ OTHER, + /* 051 ) */ OTHER, + /* 052 * */ OTHER, + /* 053 + */ OTHER, + /* 054 , */ OTHER, + /* 055 - */ OTHER, + /* 056 . */ OTHER, + /* 057 / */ OTHER, + /* 060 0 */ DIGIT, + /* 061 1 */ DIGIT, + /* 062 2 */ DIGIT, + /* 063 3 */ DIGIT, + /* 064 4 */ DIGIT, + /* 065 5 */ DIGIT, + /* 066 6 */ DIGIT, + /* 067 7 */ DIGIT, + /* 070 8 */ DIGIT, + /* 071 9 */ DIGIT, + /* 072 : */ OTHER, + /* 073 ; */ OTHER, + /* 074 < */ OTHER, + /* 075 = */ OTHER, + /* 076 > */ OTHER, + /* 077 ? */ OTHER, + /* 100 @ */ 0, + /* 101 A */ LETTER|HEX, + /* 102 B */ LETTER|HEX, + /* 103 C */ LETTER|HEX, + /* 104 D */ LETTER|HEX, + /* 105 E */ LETTER|HEX, + /* 106 F */ LETTER|HEX, + /* 107 G */ LETTER, + /* 110 H */ LETTER, + /* 111 I */ LETTER, + /* 112 J */ LETTER, + /* 113 K */ LETTER, + /* 114 L */ LETTER, + /* 115 M */ LETTER, + /* 116 N */ LETTER, + /* 117 O */ LETTER, + /* 120 P */ LETTER, + /* 121 Q */ LETTER, + /* 122 R */ LETTER, + /* 123 S */ LETTER, + /* 124 T */ LETTER, + /* 125 U */ LETTER, + /* 126 V */ LETTER, + /* 127 W */ LETTER, + /* 130 X */ LETTER, + /* 131 Y */ LETTER, + /* 132 Z */ LETTER, + /* 133 [ */ OTHER, + /* 134 \ */ OTHER, + /* 135 ] */ OTHER, + /* 136 ^ */ OTHER, + /* 137 _ */ LETTER, + /* 140 ` */ 0, + /* 141 a */ LETTER|HEX, + /* 142 b */ LETTER|HEX, + /* 143 c */ LETTER|HEX, + /* 144 d */ LETTER|HEX, + /* 145 e */ LETTER|HEX, + /* 146 f */ LETTER|HEX, + /* 147 g */ LETTER, + /* 150 h */ LETTER, + /* 151 i */ LETTER, + /* 152 j */ LETTER, + /* 153 k */ LETTER, + /* 154 l */ LETTER, + /* 155 m */ LETTER, + /* 156 n */ LETTER, + /* 157 o */ LETTER, + /* 160 p */ LETTER, + /* 161 q */ LETTER, + /* 162 r */ LETTER, + /* 163 s */ LETTER, + /* 164 t */ LETTER, + /* 165 u */ LETTER, + /* 166 v */ LETTER, + /* 167 w */ LETTER, + /* 170 x */ LETTER, + /* 171 y */ LETTER, + /* 172 z */ LETTER, + /* 173 { */ OTHER, + /* 174 | */ OTHER, + /* 175 } */ OTHER, + /* 176 ~ */ OTHER, }; +static struct symbol tval; +static char cbuf[BUFSIZE+1]; +static unsigned int wcbuf[BUFSIZE+1]; + +Coordinate src; /* current source coordinate */ +int t; +char *token; /* current token */ +Symbol tsym; /* symbol table entry for current token */ + +static void *cput(int c, void *cl); +static void *wcput(int c, void *cl); +static void *scon(int q, void *put(int c, void *cl), void *cl); +static int backslash(int q); +static Symbol fcon(void); +static Symbol icon(unsigned long, int, int); +static void ppnumber(char *); + +int gettok(void) { + for (;;) { + register unsigned char *rcp = cp; + while (map[*rcp]&BLANK) + rcp++; + if (limit - rcp < MAXTOKEN) { + cp = rcp; + fillbuf(); + rcp = cp; + } + src.file = file; + src.x = (char *)rcp - line; + src.y = lineno; + cp = rcp + 1; + switch (*rcp++) { + case '/': if (*rcp == '*') { + int c = 0; + for (rcp++; *rcp != '/' || c != '*'; ) + if (map[*rcp]&NEWLINE) { + if (rcp < limit) + c = *rcp; + cp = rcp + 1; + nextline(); + rcp = cp; + if (rcp == limit) + break; + } else + c = *rcp++; + if (rcp < limit) + rcp++; + else + error("unclosed comment\n"); + cp = rcp; + continue; + } + return '/'; + case '<': + if (*rcp == '=') return cp++, LEQ; + if (*rcp == '<') return cp++, LSHIFT; + return '<'; + case '>': + if (*rcp == '=') return cp++, GEQ; + if (*rcp == '>') return cp++, RSHIFT; + return '>'; + case '-': + if (*rcp == '>') return cp++, DEREF; + if (*rcp == '-') return cp++, DECR; + return '-'; + case '=': return *rcp == '=' ? cp++, EQL : '='; + case '!': return *rcp == '=' ? cp++, NEQ : '!'; + case '|': return *rcp == '|' ? cp++, OROR : '|'; + case '&': return *rcp == '&' ? cp++, ANDAND : '&'; + case '+': return *rcp == '+' ? cp++, INCR : '+'; + case ';': case ',': case ':': + case '*': case '~': case '%': case '^': case '?': + case '[': case ']': case '{': case '}': case '(': case ')': + return rcp[-1]; + case '\n': case '\v': case '\r': case '\f': + nextline(); + if (cp == limit) { + tsym = NULL; + return EOI; + } + continue; + + case 'i': + if (rcp[0] == 'f' + && !(map[rcp[1]]&(DIGIT|LETTER))) { + cp = rcp + 1; + return IF; + } + if (rcp[0] == 'n' + && rcp[1] == 't' + && !(map[rcp[2]]&(DIGIT|LETTER))) { + cp = rcp + 2; + tsym = inttype->u.sym; + return INT; + } + goto id; + case 'h': case 'j': case 'k': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'x': case 'y': case 'z': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + id: + if (limit - rcp < MAXLINE) { + cp = rcp - 1; + fillbuf(); + rcp = ++cp; + } + assert(cp == rcp); + token = (char *)rcp - 1; + while (map[*rcp]&(DIGIT|LETTER)) + rcp++; + token = stringn(token, (char *)rcp - token); + tsym = lookup(token, identifiers); + cp = rcp; + return ID; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': { + unsigned long n = 0; + if (limit - rcp < MAXLINE) { + cp = rcp - 1; + fillbuf(); + rcp = ++cp; + } + assert(cp == rcp); + token = (char *)rcp - 1; + if (*token == '0' && (*rcp == 'x' || *rcp == 'X')) { + int d, overflow = 0; + while (*++rcp) { + if (map[*rcp]&DIGIT) + d = *rcp - '0'; + else if (*rcp >= 'a' && *rcp <= 'f') + d = *rcp - 'a' + 10; + else if (*rcp >= 'A' && *rcp <= 'F') + d = *rcp - 'A' + 10; + else + break; + if (n&~(~0UL >> 4)) + overflow = 1; + else + n = (n<<4) + d; + } + if ((char *)rcp - token <= 2) + error("invalid hexadecimal constant `%S'\n", token, (char *)rcp-token); + cp = rcp; + tsym = icon(n, overflow, 16); + } else if (*token == '0') { + int err = 0, overflow = 0; + for ( ; map[*rcp]&DIGIT; rcp++) { + if (*rcp == '8' || *rcp == '9') + err = 1; + if (n&~(~0UL >> 3)) + overflow = 1; + else + n = (n<<3) + (*rcp - '0'); + } + if (*rcp == '.' || *rcp == 'e' || *rcp == 'E') { + cp = rcp; + tsym = fcon(); + return FCON; + } + cp = rcp; + tsym = icon(n, overflow, 8); + if (err) + error("invalid octal constant `%S'\n", token, (char*)cp-token); + } else { + int overflow = 0; + for (n = *token - '0'; map[*rcp]&DIGIT; ) { + int d = *rcp++ - '0'; + if (n > (ULONG_MAX - d)/10) + overflow = 1; + else + n = 10*n + d; + } + if (*rcp == '.' || *rcp == 'e' || *rcp == 'E') { + cp = rcp; + tsym = fcon(); + return FCON; + } + cp = rcp; + tsym = icon(n, overflow, 10); + } + return ICON; + } + case '.': + if (rcp[0] == '.' && rcp[1] == '.') { + cp += 2; + return ELLIPSIS; + } + if ((map[*rcp]&DIGIT) == 0) + return '.'; + if (limit - rcp < MAXLINE) { + cp = rcp - 1; + fillbuf(); + rcp = ++cp; + } + assert(cp == rcp); + cp = rcp - 1; + token = (char *)cp; + tsym = fcon(); + return FCON; + case 'L': + if (*rcp == '\'') { + unsigned int *s = scon(*cp, wcput, wcbuf); + if (s - wcbuf > 2) + warning("excess characters in wide-character literal ignored\n"); + tval.type = widechar; + tval.u.c.v.u = wcbuf[0]; + tsym = &tval; + return ICON; + } else if (*rcp == '"') { + unsigned int *s = scon(*cp, wcput, wcbuf); + tval.type = array(widechar, s - wcbuf, 0); + tval.u.c.v.p = wcbuf; + tsym = &tval; + return SCON; + } else + goto id; + case '\'': { + char *s = scon(*--cp, cput, cbuf); + if (s - cbuf > 2) + warning("excess characters in multibyte character literal ignored\n"); + tval.type = inttype; + if (chartype->op == INT) + tval.u.c.v.i = extend(cbuf[0], chartype); + else + tval.u.c.v.i = cbuf[0]&0xFF; + tsym = &tval; + return ICON; + } + case '"': { + char *s = scon(*--cp, cput, cbuf); + tval.type = array(chartype, s - cbuf, 0); + tval.u.c.v.p = cbuf; + tsym = &tval; + return SCON; + } + case 'a': + if (rcp[0] == 'u' + && rcp[1] == 't' + && rcp[2] == 'o' + && !(map[rcp[3]]&(DIGIT|LETTER))) { + cp = rcp + 3; + return AUTO; + } + goto id; + case 'b': + if (rcp[0] == 'r' + && rcp[1] == 'e' + && rcp[2] == 'a' + && rcp[3] == 'k' + && !(map[rcp[4]]&(DIGIT|LETTER))) { + cp = rcp + 4; + return BREAK; + } + goto id; + case 'c': + if (rcp[0] == 'a' + && rcp[1] == 's' + && rcp[2] == 'e' + && !(map[rcp[3]]&(DIGIT|LETTER))) { + cp = rcp + 3; + return CASE; + } + if (rcp[0] == 'h' + && rcp[1] == 'a' + && rcp[2] == 'r' + && !(map[rcp[3]]&(DIGIT|LETTER))) { + cp = rcp + 3; + tsym = chartype->u.sym; + return CHAR; + } + if (rcp[0] == 'o' + && rcp[1] == 'n' + && rcp[2] == 's' + && rcp[3] == 't' + && !(map[rcp[4]]&(DIGIT|LETTER))) { + cp = rcp + 4; + return CONST; + } + if (rcp[0] == 'o' + && rcp[1] == 'n' + && rcp[2] == 't' + && rcp[3] == 'i' + && rcp[4] == 'n' + && rcp[5] == 'u' + && rcp[6] == 'e' + && !(map[rcp[7]]&(DIGIT|LETTER))) { + cp = rcp + 7; + return CONTINUE; + } + goto id; + case 'd': + if (rcp[0] == 'e' + && rcp[1] == 'f' + && rcp[2] == 'a' + && rcp[3] == 'u' + && rcp[4] == 'l' + && rcp[5] == 't' + && !(map[rcp[6]]&(DIGIT|LETTER))) { + cp = rcp + 6; + return DEFAULT; + } + if (rcp[0] == 'o' + && rcp[1] == 'u' + && rcp[2] == 'b' + && rcp[3] == 'l' + && rcp[4] == 'e' + && !(map[rcp[5]]&(DIGIT|LETTER))) { + cp = rcp + 5; + tsym = doubletype->u.sym; + return DOUBLE; + } + if (rcp[0] == 'o' + && !(map[rcp[1]]&(DIGIT|LETTER))) { + cp = rcp + 1; + return DO; + } + goto id; + case 'e': + if (rcp[0] == 'l' + && rcp[1] == 's' + && rcp[2] == 'e' + && !(map[rcp[3]]&(DIGIT|LETTER))) { + cp = rcp + 3; + return ELSE; + } + if (rcp[0] == 'n' + && rcp[1] == 'u' + && rcp[2] == 'm' + && !(map[rcp[3]]&(DIGIT|LETTER))) { + cp = rcp + 3; + return ENUM; + } + if (rcp[0] == 'x' + && rcp[1] == 't' + && rcp[2] == 'e' + && rcp[3] == 'r' + && rcp[4] == 'n' + && !(map[rcp[5]]&(DIGIT|LETTER))) { + cp = rcp + 5; + return EXTERN; + } + goto id; + case 'f': + if (rcp[0] == 'l' + && rcp[1] == 'o' + && rcp[2] == 'a' + && rcp[3] == 't' + && !(map[rcp[4]]&(DIGIT|LETTER))) { + cp = rcp + 4; + tsym = floattype->u.sym; + return FLOAT; + } + if (rcp[0] == 'o' + && rcp[1] == 'r' + && !(map[rcp[2]]&(DIGIT|LETTER))) { + cp = rcp + 2; + return FOR; + } + goto id; + case 'g': + if (rcp[0] == 'o' + && rcp[1] == 't' + && rcp[2] == 'o' + && !(map[rcp[3]]&(DIGIT|LETTER))) { + cp = rcp + 3; + return GOTO; + } + goto id; + case 'l': + if (rcp[0] == 'o' + && rcp[1] == 'n' + && rcp[2] == 'g' + && !(map[rcp[3]]&(DIGIT|LETTER))) { + cp = rcp + 3; + return LONG; + } + goto id; + case 'r': + if (rcp[0] == 'e' + && rcp[1] == 'g' + && rcp[2] == 'i' + && rcp[3] == 's' + && rcp[4] == 't' + && rcp[5] == 'e' + && rcp[6] == 'r' + && !(map[rcp[7]]&(DIGIT|LETTER))) { + cp = rcp + 7; + return REGISTER; + } + if (rcp[0] == 'e' + && rcp[1] == 't' + && rcp[2] == 'u' + && rcp[3] == 'r' + && rcp[4] == 'n' + && !(map[rcp[5]]&(DIGIT|LETTER))) { + cp = rcp + 5; + return RETURN; + } + goto id; + case 's': + if (rcp[0] == 'h' + && rcp[1] == 'o' + && rcp[2] == 'r' + && rcp[3] == 't' + && !(map[rcp[4]]&(DIGIT|LETTER))) { + cp = rcp + 4; + return SHORT; + } + if (rcp[0] == 'i' + && rcp[1] == 'g' + && rcp[2] == 'n' + && rcp[3] == 'e' + && rcp[4] == 'd' + && !(map[rcp[5]]&(DIGIT|LETTER))) { + cp = rcp + 5; + return SIGNED; + } + if (rcp[0] == 'i' + && rcp[1] == 'z' + && rcp[2] == 'e' + && rcp[3] == 'o' + && rcp[4] == 'f' + && !(map[rcp[5]]&(DIGIT|LETTER))) { + cp = rcp + 5; + return SIZEOF; + } + if (rcp[0] == 't' + && rcp[1] == 'a' + && rcp[2] == 't' + && rcp[3] == 'i' + && rcp[4] == 'c' + && !(map[rcp[5]]&(DIGIT|LETTER))) { + cp = rcp + 5; + return STATIC; + } + if (rcp[0] == 't' + && rcp[1] == 'r' + && rcp[2] == 'u' + && rcp[3] == 'c' + && rcp[4] == 't' + && !(map[rcp[5]]&(DIGIT|LETTER))) { + cp = rcp + 5; + return STRUCT; + } + if (rcp[0] == 'w' + && rcp[1] == 'i' + && rcp[2] == 't' + && rcp[3] == 'c' + && rcp[4] == 'h' + && !(map[rcp[5]]&(DIGIT|LETTER))) { + cp = rcp + 5; + return SWITCH; + } + goto id; + case 't': + if (rcp[0] == 'y' + && rcp[1] == 'p' + && rcp[2] == 'e' + && rcp[3] == 'd' + && rcp[4] == 'e' + && rcp[5] == 'f' + && !(map[rcp[6]]&(DIGIT|LETTER))) { + cp = rcp + 6; + return TYPEDEF; + } + goto id; + case 'u': + if (rcp[0] == 'n' + && rcp[1] == 'i' + && rcp[2] == 'o' + && rcp[3] == 'n' + && !(map[rcp[4]]&(DIGIT|LETTER))) { + cp = rcp + 4; + return UNION; + } + if (rcp[0] == 'n' + && rcp[1] == 's' + && rcp[2] == 'i' + && rcp[3] == 'g' + && rcp[4] == 'n' + && rcp[5] == 'e' + && rcp[6] == 'd' + && !(map[rcp[7]]&(DIGIT|LETTER))) { + cp = rcp + 7; + return UNSIGNED; + } + goto id; + case 'v': + if (rcp[0] == 'o' + && rcp[1] == 'i' + && rcp[2] == 'd' + && !(map[rcp[3]]&(DIGIT|LETTER))) { + cp = rcp + 3; + tsym = voidtype->u.sym; + return VOID; + } + if (rcp[0] == 'o' + && rcp[1] == 'l' + && rcp[2] == 'a' + && rcp[3] == 't' + && rcp[4] == 'i' + && rcp[5] == 'l' + && rcp[6] == 'e' + && !(map[rcp[7]]&(DIGIT|LETTER))) { + cp = rcp + 7; + return VOLATILE; + } + goto id; + case 'w': + if (rcp[0] == 'h' + && rcp[1] == 'i' + && rcp[2] == 'l' + && rcp[3] == 'e' + && !(map[rcp[4]]&(DIGIT|LETTER))) { + cp = rcp + 4; + return WHILE; + } + goto id; + case '_': + if (rcp[0] == '_' + && rcp[1] == 't' + && rcp[2] == 'y' + && rcp[3] == 'p' + && rcp[4] == 'e' + && rcp[5] == 'c' + && rcp[6] == 'o' + && rcp[7] == 'd' + && rcp[8] == 'e' + && !(map[rcp[9]]&(DIGIT|LETTER))) { + cp = rcp + 9; + return TYPECODE; + } + if (rcp[0] == '_' + && rcp[1] == 'f' + && rcp[2] == 'i' + && rcp[3] == 'r' + && rcp[4] == 's' + && rcp[5] == 't' + && rcp[6] == 'a' + && rcp[7] == 'r' + && rcp[8] == 'g' + && !(map[rcp[9]]&(DIGIT|LETTER))) { + cp = rcp + 9; + return FIRSTARG; + } + goto id; + default: + if ((map[cp[-1]]&BLANK) == 0) { + if (cp[-1] < ' ' || cp[-1] >= 0177) + error("illegal character `\\0%o'\n", cp[-1]); + else + error("illegal character `%c'\n", cp[-1]); + } + } + } +} + +static Symbol icon(unsigned long n, int overflow, int base) +{ + if (((*cp=='u'||*cp=='U') && (cp[1]=='l'||cp[1]=='L')) + || ((*cp=='l'||*cp=='L') && (cp[1]=='u'||cp[1]=='U'))) { + tval.type = unsignedlong; + cp += 2; + } else if (*cp == 'u' || *cp == 'U') { + if (overflow || n > unsignedtype->u.sym->u.limits.max.i) + tval.type = unsignedlong; + else + tval.type = unsignedtype; + cp += 1; + } else if (*cp == 'l' || *cp == 'L') { + if (overflow || n > longtype->u.sym->u.limits.max.i) + tval.type = unsignedlong; + else + tval.type = longtype; + cp += 1; + } else if (overflow || n > longtype->u.sym->u.limits.max.i) { + tval.type = unsignedlong; + } else if (n > inttype->u.sym->u.limits.max.i) { + tval.type = longtype; + } else if (base != 10 && n > inttype->u.sym->u.limits.max.i) { + tval.type = unsignedtype; + } else + tval.type = inttype; + + switch (tval.type->op) { + case INT: + if (overflow || n > tval.type->u.sym->u.limits.max.i) { + warning("overflow in constant `%S'\n", token, + (char*)cp - token); + tval.u.c.v.i = tval.type->u.sym->u.limits.max.i; + } else + tval.u.c.v.i = n; + break; + case UNSIGNED: + if (overflow || n > tval.type->u.sym->u.limits.max.u) { + warning("overflow in constant `%S'\n", token, + (char*)cp - token); + tval.u.c.v.u = tval.type->u.sym->u.limits.max.u; + } else + tval.u.c.v.u = n; + break; + default: assert(0); + } + ppnumber("integer"); + return &tval; +} +static void ppnumber(char *which) { + unsigned char *rcp = cp--; + + for ( ; (map[*cp]&(DIGIT|LETTER)) || *cp == '.'; cp++) + if ((cp[0] == 'E' || cp[0] == 'e') + && (cp[1] == '-' || cp[1] == '+')) + cp++; + if (cp > rcp) + error("`%S' is a preprocessing number but an invalid %s constant\n", token, + + (char*)cp-token, which); +} +static Symbol fcon(void) { + if (*cp == '.') + do + cp++; + while (map[*cp]&DIGIT); + if (*cp == 'e' || *cp == 'E') { + if (*++cp == '-' || *cp == '+') + cp++; + if (map[*cp]&DIGIT) + do + cp++; + while (map[*cp]&DIGIT); + else + error("invalid floating constant `%S'\n", token, + (char*)cp - token); + } + + errno = 0; + tval.u.c.v.d = strtod(token, NULL); + if (errno == ERANGE) + warning("overflow in floating constant `%S'\n", token, + (char*)cp - token); + if (*cp == 'f' || *cp == 'F') { + ++cp; + if (tval.u.c.v.d > floattype->u.sym->u.limits.max.d) + warning("overflow in floating constant `%S'\n", token, + (char*)cp - token); + tval.type = floattype; + } else if (*cp == 'l' || *cp == 'L') { + cp++; + tval.type = longdouble; + } else { + if (tval.u.c.v.d > doubletype->u.sym->u.limits.max.d) + warning("overflow in floating constant `%S'\n", token, + (char*)cp - token); + tval.type = doubletype; + } + ppnumber("floating"); + return &tval; +} + +static void *cput(int c, void *cl) { + char *s = cl; + + if (c < 0 || c > 255) + warning("overflow in escape sequence with resulting value `%d'\n", c); + *s++ = c; + return s; +} + +static void *wcput(int c, void *cl) { + unsigned int *s = cl; + + *s++ = c; + return s; +} + +static void *scon(int q, void *put(int c, void *cl), void *cl) { + int n = 0, nbad = 0; + + do { + cp++; + while (*cp != q) { + int c; + if (map[*cp]&NEWLINE) { + if (cp < limit) + break; + cp++; + nextline(); + if (cp == limit) + break; + continue; + } + c = *cp++; + if (c == '\\') { + if (map[*cp]&NEWLINE) { + if (cp++ < limit) + continue; + nextline(); + } + if (limit - cp < MAXTOKEN) + fillbuf(); + c = backslash(q); + } else if (c < 0 || c > 255 || map[c] == 0) + nbad++; + if (n++ < BUFSIZE) + cl = put(c, cl); + } + if (*cp == q) + cp++; + else + error("missing %c\n", q); + if (q == '"' && put == wcput && getchr() == 'L') { + if (limit - cp < 2) + fillbuf(); + if (cp[1] == '"') + cp++; + } + } while (q == '"' && getchr() == '"'); + cl = put(0, cl); + if (n >= BUFSIZE) + error("%s literal too long\n", q == '"' ? "string" : "character"); + if (Aflag >= 2 && q == '"' && n > 509) + warning("more than 509 characters in a string literal\n"); + if (Aflag >= 2 && nbad > 0) + warning("%s literal contains non-portable characters\n", + q == '"' ? "string" : "character"); + return cl; +} +int getchr(void) { + for (;;) { + while (map[*cp]&BLANK) + cp++; + if (!(map[*cp]&NEWLINE)) + return *cp; + cp++; + nextline(); + if (cp == limit) + return EOI; + } +} +static int backslash(int q) { + unsigned int c; + + switch (*cp++) { + case 'a': return 7; + case 'b': return '\b'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + case '\'': case '"': case '\\': case '\?': break; + case 'x': { + int overflow = 0; + if ((map[*cp]&(DIGIT|HEX)) == 0) { + if (*cp < ' ' || *cp == 0177) + error("ill-formed hexadecimal escape sequence\n"); + else + error("ill-formed hexadecimal escape sequence `\\x%c'\n", *cp); + if (*cp != q) + cp++; + return 0; + } + for (c = 0; map[*cp]&(DIGIT|HEX); cp++) { + if (c >> (8*widechar->size - 4)) + overflow = 1; + if (map[*cp]&DIGIT) + c = (c<<4) + *cp - '0'; + else + c = (c<<4) + (*cp&~040) - 'A' + 10; + } + if (overflow) + warning("overflow in hexadecimal escape sequence\n"); + return c&ones(8*widechar->size); + } + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + c = *(cp-1) - '0'; + if (*cp >= '0' && *cp <= '7') { + c = (c<<3) + *cp++ - '0'; + if (*cp >= '0' && *cp <= '7') + c = (c<<3) + *cp++ - '0'; + } + return c; + default: + if (cp[-1] < ' ' || cp[-1] >= 0177) + warning("unrecognized character escape sequence\n"); + else + warning("unrecognized character escape sequence `\\%c'\n", cp[-1]); + } + return cp[-1]; +} diff --git a/src/cmd/lccom-1/lib/assert.c b/src/cmd/lccom-1/lib/assert.c new file mode 100644 index 0000000..f532b73 --- /dev/null +++ b/src/cmd/lccom-1/lib/assert.c @@ -0,0 +1,19 @@ +#include +#include + +#ifndef EXPORT +# define EXPORT +#endif + +EXPORT int _assert(char *e, char *file, int line) +{ + fprintf(stderr, "assertion failed:"); + if (e) + fprintf(stderr, " %s", e); + if (file) + fprintf(stderr, " file %s", file); + fprintf(stderr, " line %d\n", line); + fflush(stderr); + abort(); + return 0; +} diff --git a/src/cmd/lccom-1/lib/bbexit.c b/src/cmd/lccom-1/lib/bbexit.c new file mode 100644 index 0000000..f203fb7 --- /dev/null +++ b/src/cmd/lccom-1/lib/bbexit.c @@ -0,0 +1,136 @@ +#include +#include + +#ifndef EXPORT +# define EXPORT +#endif + +EXPORT struct callsite { + char *file, *name; + union coordinate { + struct { unsigned int index:6,x:10,y:16; } be; + struct { unsigned int y:16,x:10,index:6; } le; + unsigned int coord; + } u; +} *_caller, **_callerp = &_caller; + +EXPORT void _setcallerp(struct callsite **p) +{ + _callerp = p; +} + +static struct _bbdata { + struct _bbdata *link; + int npoints, *counts; + union coordinate *coords; + char **files; + struct func { + struct func *link; + struct caller { + struct caller *link; + struct callsite *caller; + int count; + } *callers; + char *name; + union coordinate src; + } *funcs; +} tail, *_bblist = &tail; + +static void unpack(unsigned int coord, int *index, int *x, int *y) +{ + static union { int x; char endian; } little = { 1 }; + union coordinate u; + + u.coord = coord; + if (little.endian) { + *index = u.le.index; + *x = u.le.x; + *y = u.le.y; + } else { + *index = u.be.index; + *x = u.be.x; + *y = u.be.y; + } +} + +static void profout(struct _bbdata *p, FILE *fp) +{ + int i, index, x, y; + struct func *f; + struct caller *q; + + for (i = 0; p->files[i]; i++) + ; + fprintf(fp, "%d\n", i); + for (i = 0; p->files[i]; i++) + fprintf(fp, "%s\n", p->files[i]); + for (i = 0, f = p->funcs; f; i++, f = f->link) + if ((q = f->callers)) + for (i--; q; q = q->link) + i++; + fprintf(fp, "%d\n", i); + for (f = p->funcs; f; f = f->link) { + int n = 0; + for (q = f->callers; q; n += q->count, q = q->link) { + unpack(f->src.coord, &index, &x, &y); + fprintf(fp, "%s %d %d %d %d", f->name, index, x, y, q->count); + if (q->caller) { + unpack(q->caller->u.coord, &index, &x, &y); + fprintf(fp, " %s %s %d %d\n", q->caller->name, q->caller->file, x, y); + } else + fprintf(fp, " ? ? 0 0\n"); + } + if (n == 0) { + unpack(f->src.coord, &index, &x, &y); + fprintf(fp, "%s %d %d %d 0 ? ? 0 0\n", f->name, index, x, y); + } + } + fprintf(fp, "%d\n", p->npoints); + for (i = 0; i < p->npoints; i++) { + unpack(p->coords[i].coord, &index, &x, &y); + fprintf(fp, "%d %d %d %d\n", index, x, y, p->counts[i]); + } +} + +static void bbexit(void) +{ + FILE *fp; + + if (_bblist != &tail && (fp = fopen("prof.out", "a"))) { + for ( ; _bblist != &tail; _bblist = _bblist->link) + profout(_bblist, fp); + fclose(fp); + } +} + +EXPORT void _epilogue(struct func *callee) +{ + *_callerp = 0; +} + +EXPORT void _prologue(struct func *callee, struct _bbdata *yylink) +{ + static struct caller callers[4096]; + static int next; + struct caller *p; + + if (!yylink->link) { + yylink->link = _bblist; + _bblist = yylink; + if (next == 0) + atexit(bbexit); + } + for (p = callee->callers; p; p = p->link) + if (p->caller == *_callerp) { + p->count++; + break; + } + if (!p && next < sizeof callers/sizeof callers[0]) { + p = &callers[next++]; + p->caller = *_callerp; + p->count = 1; + p->link = callee->callers; + callee->callers = p; + } + *_callerp = 0; +} diff --git a/src/cmd/lccom-1/lib/yynull.c b/src/cmd/lccom-1/lib/yynull.c new file mode 100644 index 0000000..0cd510a --- /dev/null +++ b/src/cmd/lccom-1/lib/yynull.c @@ -0,0 +1,16 @@ +#include +#include + +#ifndef EXPORT +# define EXPORT +#endif + +EXPORT void _YYnull(char *file, int line) +{ + fprintf(stderr, "null pointer dereferenced:"); + if (file) + fprintf(stderr, " file %s,", file); + fprintf(stderr, " line %d\n", line); + fflush(stderr); + abort(); +} diff --git a/src/cmd/lccom-1/list.c b/src/cmd/lccom-1/list.c new file mode 100644 index 0000000..e4b8f61 --- /dev/null +++ b/src/cmd/lccom-1/list.c @@ -0,0 +1,55 @@ +#include "c.h" + +static List freenodes; /* free list nodes */ + +/* append - append x to list, return new list */ +List append(void *x, List list) { + List new; + + if ((new = freenodes) != NULL) + freenodes = freenodes->link; + else + NEW(new, PERM); + if (list) { + new->link = list->link; + list->link = new; + } else + new->link = new; + new->x = x; + return new; +} + +/* length - # elements in list */ +int length(List list) { + int n = 0; + + if (list) { + List lp = list; + do + n++; + while ((lp = lp->link) != list); + } + return n; +} + +/* ltov - convert list to an NULL-terminated vector allocated in arena */ +void *ltov(List *list, unsigned arena) { + int i = 0; + void **array = newarray(length(*list) + 1, sizeof array[0], arena); + + if (*list) { + List lp = *list; + do { + lp = lp->link; + array[i++] = lp->x; + } while (lp != *list); +#ifndef PURIFY + lp = (*list)->link; + (*list)->link = freenodes; + freenodes = lp; +#endif + } + *list = NULL; + array[i] = NULL; + return array; +} diff --git a/src/cmd/lccom-1/main.c b/src/cmd/lccom-1/main.c new file mode 100644 index 0000000..63e00ab --- /dev/null +++ b/src/cmd/lccom-1/main.c @@ -0,0 +1,245 @@ +#include "c.h" + +static const char *version = "RetroBSD revision " VERSION; + +static void typestab(Symbol, void *); + +static void stabline(Coordinate *); +static void stabend(Coordinate *, Symbol, Coordinate **, Symbol *, Symbol *); +Interface *IR = NULL; + +int Aflag; /* >= 0 if -A specified */ +int Pflag; /* != 0 if -P specified */ +int glevel; /* == [0-9] if -g[0-9] specified */ +int xref; /* != 0 for cross-reference data */ +Symbol YYnull; /* _YYnull symbol if -n or -nvalidate specified */ +Symbol YYcheck; /* _YYcheck symbol if -nvalidate,check specified */ + +static char *comment; +static Interface stabIR; +static char *currentfile; /* current file name */ +static int currentline; /* current line number */ +static FILE *srcfp; /* stream for current file, if non-NULL */ +static int srcpos; /* position of srcfp, if srcfp is non-NULL */ + +int main(int argc, char *argv[]) +{ + int i, j; + + for (i = argc - 1; i > 0; i--) + if (strncmp(argv[i], "-target=", 8) == 0) + break; + if (i > 0) { + char *s = strchr(argv[i], '\\'); + if (s != NULL) + *s = '/'; + for (j = 0; bindings[j].name && bindings[j].ir; j++) + if (strcmp(&argv[i][8], bindings[j].name) == 0) { + IR = bindings[j].ir; + break; + } + if (s != NULL) + *s = '\\'; + } + if (!IR) { + fprint(stderr, "%s: unknown target", argv[0]); + if (i > 0) + fprint(stderr, " `%s'", &argv[i][8]); + fprint(stderr, "; must specify one of\n"); + for (i = 0; bindings[i].name; i++) + fprint(stderr, "\t-target=%s\n", bindings[i].name); + exit(EXIT_FAILURE); + } + init(argc, argv); + t = gettok(); + (*IR->progbeg)(argc, argv); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "-n") == 0) { + if (!YYnull) { + YYnull = install(string("_YYnull"), &globals, GLOBAL, PERM); + YYnull->type = func(voidptype, NULL, 1); + YYnull->sclass = EXTERN; + (*IR->defsymbol)(YYnull); + } + } else if (strncmp(argv[i], "-n", 2) == 0) { /* -nvalid[,check] */ + char *p = strchr(argv[i], ','); + if (p) { + YYcheck = install(string(p+1), &globals, GLOBAL, PERM); + YYcheck->type = func(voidptype, NULL, 1); + YYcheck->sclass = EXTERN; + (*IR->defsymbol)(YYcheck); + p = stringn(argv[i]+2, p - (argv[i]+2)); + } else + p = string(argv[i]+2); + YYnull = install(p, &globals, GLOBAL, PERM); + YYnull->type = func(voidptype, NULL, 1); + YYnull->sclass = EXTERN; + (*IR->defsymbol)(YYnull); + } else { + profInit(argv[i]); + traceInit(argv[i]); + } + if (glevel && IR->stabinit) + (*IR->stabinit)(firstfile, argc, argv); + program(); + if (events.end) + apply(events.end, NULL, NULL); + memset(&events, 0, sizeof events); + if (glevel || xref) { + Symbol symroot = NULL; + Coordinate src; + foreach(types, GLOBAL, typestab, &symroot); + foreach(identifiers, GLOBAL, typestab, &symroot); + src.file = firstfile; + src.x = 0; + src.y = lineno; + if ((glevel > 2 || xref) && IR->stabend) + (*IR->stabend)(&src, symroot, + ltov(&loci, PERM), + ltov(&symbols, PERM), NULL); + else if (IR->stabend) + (*IR->stabend)(&src, NULL, NULL, NULL, NULL); + } + finalize(); + (*IR->progend)(); + deallocate(PERM); + return errcnt > 0; +} + +/* + * main_init - process program arguments + */ +void main_init(int argc, char *argv[]) +{ + char *infile = NULL, *outfile = NULL; + int i; + static int inited; + + if (inited) + return; + inited = 1; + type_init(argc, argv); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "-g") == 0 || strcmp(argv[i], "-g2") == 0) + glevel = 2; + else if (strncmp(argv[i], "-g", 2) == 0) { /* -gn[,x] */ + char *p = strchr(argv[i], ','); + glevel = atoi(argv[i]+2); + if (p) { + comment = p + 1; + if (glevel == 0) + glevel = 1; + if (stabIR.stabline == NULL) { + stabIR.stabline = IR->stabline; + stabIR.stabend = IR->stabend; + IR->stabline = stabline; + IR->stabend = stabend; + } + } + } else if (strcmp(argv[i], "-x") == 0) + xref++; + else if (strcmp(argv[i], "-A") == 0) { + ++Aflag; + } else if (strcmp(argv[i], "-P") == 0) + Pflag++; + else if (strcmp(argv[i], "-w") == 0) + wflag++; + else if (strcmp(argv[i], "-v") == 0) + fprint(stderr, "%s %s\n", argv[0], version); + else if (strncmp(argv[i], "-s", 2) == 0) + density = strtod(&argv[i][2], NULL); + else if (strncmp(argv[i], "-errout=", 8) == 0) { + FILE *f = fopen(argv[i]+8, "w"); + if (f == NULL) { + fprint(stderr, "%s: can't write errors to `%s'\n", argv[0], argv[i]+8); + exit(EXIT_FAILURE); + } + fclose(f); + f = freopen(argv[i]+8, "w", stderr); + assert(f); + } else if (strncmp(argv[i], "-e", 2) == 0) { + int x; + if ((x = strtol(&argv[i][2], NULL, 0)) > 0) + errlimit = x; + } else if (strncmp(argv[i], "-little_endian=", 15) == 0) + IR->little_endian = argv[i][15] - '0'; + else if (strncmp(argv[i], "-mulops_calls=", 18) == 0) + IR->mulops_calls = argv[i][18] - '0'; + else if (strncmp(argv[i], "-wants_callb=", 13) == 0) + IR->wants_callb = argv[i][13] - '0'; + else if (strncmp(argv[i], "-wants_argb=", 12) == 0) + IR->wants_argb = argv[i][12] - '0'; + else if (strncmp(argv[i], "-left_to_right=", 15) == 0) + IR->left_to_right = argv[i][15] - '0'; + else if (strncmp(argv[i], "-wants_dag=", 11) == 0) + IR->wants_dag = argv[i][11] - '0'; + else if (*argv[i] != '-' || strcmp(argv[i], "-") == 0) { + if (infile == NULL) + infile = argv[i]; + else if (outfile == NULL) + outfile = argv[i]; + } + + if (infile != NULL && strcmp(infile, "-") != 0 + && freopen(infile, "r", stdin) == NULL) { + fprint(stderr, "%s: can't read `%s'\n", argv[0], infile); + exit(EXIT_FAILURE); + } + if (outfile != NULL && strcmp(outfile, "-") != 0 + && freopen(outfile, "w", stdout) == NULL) { + fprint(stderr, "%s: can't write `%s'\n", argv[0], outfile); + exit(EXIT_FAILURE); + } +} + +/* + * typestab - emit stab entries for p + */ +static void typestab(Symbol p, void *cl) +{ + if (*(Symbol *)cl == 0 && p->sclass && p->sclass != TYPEDEF) + *(Symbol *)cl = p; + if ((p->sclass == TYPEDEF || p->sclass == 0) && IR->stabtype) + (*IR->stabtype)(p); +} + +/* + * stabline - emit source code for source coordinate *cp + */ +static void stabline(Coordinate *cp) +{ + if (cp->file && cp->file != currentfile) { + if (srcfp) + fclose(srcfp); + currentfile = cp->file; + srcfp = fopen(currentfile, "r"); + srcpos = 0; + currentline = 0; + } + if (currentline != cp->y && srcfp) { + char buf[512]; + if (srcpos > cp->y) { + rewind(srcfp); + srcpos = 0; + } + for ( ; srcpos < cp->y; srcpos++) + if (fgets(buf, sizeof buf, srcfp) == NULL) { + fclose(srcfp); + srcfp = NULL; + break; + } + if (srcfp && srcpos == cp->y) + print("%s%s", comment, buf); + } + currentline = cp->y; + if (stabIR.stabline) + (*stabIR.stabline)(cp); +} + +static void stabend(Coordinate *cp, Symbol p, Coordinate **cpp, Symbol *sp, Symbol *stab) +{ + if (stabIR.stabend) + (*stabIR.stabend)(cp, p, cpp, sp, stab); + if (srcfp) + fclose(srcfp); +} diff --git a/src/cmd/lccom-1/mips.md b/src/cmd/lccom-1/mips.md new file mode 100644 index 0000000..aa02120 --- /dev/null +++ b/src/cmd/lccom-1/mips.md @@ -0,0 +1,1143 @@ +%{ +#define INTTMP 0x0100ff00 +#define INTVAR 0x40ff0000 +#define FLTTMP 0x000f0ff0 +#define FLTVAR 0xfff00000 + +#define INTRET 0x00000004 +#define FLTRET 0x00000003 + +#define readsreg(p) \ + (generic((p)->op)==INDIR && (p)->kids[0]->op==VREG+P) +#define setsrc(d) ((d) && (d)->x.regnode && \ + (d)->x.regnode->set == src->x.regnode->set && \ + (d)->x.regnode->mask&src->x.regnode->mask) + +#define relink(a, b) ((b)->x.prev = (a), (a)->x.next = (b)) + +#include "c.h" +#define NODEPTR_TYPE Node +#define OP_LABEL(p) ((p)->op) +#define LEFT_CHILD(p) ((p)->kids[0]) +#define RIGHT_CHILD(p) ((p)->kids[1]) +#define STATE_LABEL(p) ((p)->x.state) +static void address(Symbol, Symbol, long); +static void blkfetch(int, int, int, int); +static void blkloop(int, int, int, int, int, int[]); +static void blkstore(int, int, int, int); +static void defaddress(Symbol); +static void defconst(int, int, Value); +static void defstring(int, char *); +static void defsymbol(Symbol); +static void doarg(Node); +static void emit2(Node); +static void export(Symbol); +static void clobber(Node); +static void function(Symbol, Symbol [], Symbol [], int); +static void global(Symbol); +static void import(Symbol); +static void local(Symbol); +static void progbeg(int, char **); +static void progend(void); +static void segment(int); +static void space(int); +static void target(Node); +static int bitcount (unsigned); +static Symbol argreg (int, int, int, int, int); + +static Symbol ireg[32], freg2[32], d6; +static Symbol iregw, freg2w; +static int tmpregs[] = {3, 9, 10}; +static Symbol blkreg; + +static int gnum = 8; +static int pic; + +static int cseg; +%} +%start stmt +%term CNSTF4=4113 +%term CNSTF8=8209 +%term CNSTF16=16401 +%term CNSTI1=1045 +%term CNSTI2=2069 +%term CNSTI4=4117 +%term CNSTI8=8213 +%term CNSTP4=4119 +%term CNSTP8=8215 +%term CNSTU1=1046 +%term CNSTU2=2070 +%term CNSTU4=4118 +%term CNSTU8=8214 + +%term ARGB=41 +%term ARGF4=4129 +%term ARGF8=8225 +%term ARGF16=16417 +%term ARGI4=4133 +%term ARGI8=8229 +%term ARGP4=4135 +%term ARGP8=8231 +%term ARGU4=4134 +%term ARGU8=8230 + +%term ASGNB=57 +%term ASGNF4=4145 +%term ASGNF8=8241 +%term ASGNF16=16433 +%term ASGNI1=1077 +%term ASGNI2=2101 +%term ASGNI4=4149 +%term ASGNI8=8245 +%term ASGNP4=4151 +%term ASGNP8=8247 +%term ASGNU1=1078 +%term ASGNU2=2102 +%term ASGNU4=4150 +%term ASGNU8=8246 + +%term INDIRB=73 +%term INDIRF4=4161 +%term INDIRF8=8257 +%term INDIRF16=16449 +%term INDIRI1=1093 +%term INDIRI2=2117 +%term INDIRI4=4165 +%term INDIRI8=8261 +%term INDIRP4=4167 +%term INDIRP8=8263 +%term INDIRU1=1094 +%term INDIRU2=2118 +%term INDIRU4=4166 +%term INDIRU8=8262 + +%term CVFF4=4209 +%term CVFF8=8305 +%term CVFF16=16497 +%term CVFI4=4213 +%term CVFI8=8309 + +%term CVIF4=4225 +%term CVIF8=8321 +%term CVIF16=16513 +%term CVII1=1157 +%term CVII2=2181 +%term CVII4=4229 +%term CVII8=8325 +%term CVIU1=1158 +%term CVIU2=2182 +%term CVIU4=4230 +%term CVIU8=8326 + +%term CVPP4=4247 +%term CVPP8=8343 +%term CVPP16=16535 +%term CVPU4=4246 +%term CVPU8=8342 + +%term CVUI1=1205 +%term CVUI2=2229 +%term CVUI4=4277 +%term CVUI8=8373 +%term CVUP4=4279 +%term CVUP8=8375 +%term CVUP16=16567 +%term CVUU1=1206 +%term CVUU2=2230 +%term CVUU4=4278 +%term CVUU8=8374 + +%term NEGF4=4289 +%term NEGF8=8385 +%term NEGF16=16577 +%term NEGI4=4293 +%term NEGI8=8389 + +%term CALLB=217 +%term CALLF4=4305 +%term CALLF8=8401 +%term CALLF16=16593 +%term CALLI4=4309 +%term CALLI8=8405 +%term CALLP4=4311 +%term CALLP8=8407 +%term CALLU4=4310 +%term CALLU8=8406 +%term CALLV=216 + +%term RETF4=4337 +%term RETF8=8433 +%term RETF16=16625 +%term RETI4=4341 +%term RETI8=8437 +%term RETP4=4343 +%term RETP8=8439 +%term RETU4=4342 +%term RETU8=8438 +%term RETV=248 + +%term ADDRGP4=4359 +%term ADDRGP8=8455 + +%term ADDRFP4=4375 +%term ADDRFP8=8471 + +%term ADDRLP4=4391 +%term ADDRLP8=8487 + +%term ADDF4=4401 +%term ADDF8=8497 +%term ADDF16=16689 +%term ADDI4=4405 +%term ADDI8=8501 +%term ADDP4=4407 +%term ADDP8=8503 +%term ADDU4=4406 +%term ADDU8=8502 + +%term SUBF4=4417 +%term SUBF8=8513 +%term SUBF16=16705 +%term SUBI4=4421 +%term SUBI8=8517 +%term SUBP4=4423 +%term SUBP8=8519 +%term SUBU4=4422 +%term SUBU8=8518 + +%term LSHI4=4437 +%term LSHI8=8533 +%term LSHU4=4438 +%term LSHU8=8534 + +%term MODI4=4453 +%term MODI8=8549 +%term MODU4=4454 +%term MODU8=8550 + +%term RSHI4=4469 +%term RSHI8=8565 +%term RSHU4=4470 +%term RSHU8=8566 + +%term BANDI4=4485 +%term BANDI8=8581 +%term BANDU4=4486 +%term BANDU8=8582 + +%term BCOMI4=4501 +%term BCOMI8=8597 +%term BCOMU4=4502 +%term BCOMU8=8598 + +%term BORI4=4517 +%term BORI8=8613 +%term BORU4=4518 +%term BORU8=8614 + +%term BXORI4=4533 +%term BXORI8=8629 +%term BXORU4=4534 +%term BXORU8=8630 + +%term DIVF4=4545 +%term DIVF8=8641 +%term DIVF16=16833 +%term DIVI4=4549 +%term DIVI8=8645 +%term DIVU4=4550 +%term DIVU8=8646 + +%term MULF4=4561 +%term MULF8=8657 +%term MULF16=16849 +%term MULI4=4565 +%term MULI8=8661 +%term MULU4=4566 +%term MULU8=8662 + +%term EQF4=4577 +%term EQF8=8673 +%term EQF16=16865 +%term EQI4=4581 +%term EQI8=8677 +%term EQU4=4582 +%term EQU8=8678 + +%term GEF4=4593 +%term GEF8=8689 +%term GEI4=4597 +%term GEI8=8693 +%term GEI16=16885 +%term GEU4=4598 +%term GEU8=8694 + +%term GTF4=4609 +%term GTF8=8705 +%term GTF16=16897 +%term GTI4=4613 +%term GTI8=8709 +%term GTU4=4614 +%term GTU8=8710 + +%term LEF4=4625 +%term LEF8=8721 +%term LEF16=16913 +%term LEI4=4629 +%term LEI8=8725 +%term LEU4=4630 +%term LEU8=8726 + +%term LTF4=4641 +%term LTF8=8737 +%term LTF16=16929 +%term LTI4=4645 +%term LTI8=8741 +%term LTU4=4646 +%term LTU8=8742 + +%term NEF4=4657 +%term NEF8=8753 +%term NEF16=16945 +%term NEI4=4661 +%term NEI8=8757 +%term NEU4=4662 +%term NEU8=8758 + +%term JUMPV=584 + +%term LABELV=600 + +%term LOADB=233 +%term LOADF4=4321 +%term LOADF8=8417 +%term LOADF16=16609 +%term LOADI1=1253 +%term LOADI2=2277 +%term LOADI4=4325 +%term LOADI8=8421 +%term LOADP4=4327 +%term LOADP8=8423 +%term LOADU1=1254 +%term LOADU2=2278 +%term LOADU4=4326 +%term LOADU8=8422 + +%term VREGP=711 +%% +reg: INDIRI1(VREGP) "# read register\n" +reg: INDIRU1(VREGP) "# read register\n" + +reg: INDIRI2(VREGP) "# read register\n" +reg: INDIRU2(VREGP) "# read register\n" + +reg: INDIRF4(VREGP) "# read register\n" +reg: INDIRI4(VREGP) "# read register\n" +reg: INDIRP4(VREGP) "# read register\n" +reg: INDIRU4(VREGP) "# read register\n" + +reg: INDIRF8(VREGP) "# read register\n" +reg: INDIRI8(VREGP) "# read register\n" +reg: INDIRP8(VREGP) "# read register\n" +reg: INDIRU8(VREGP) "# read register\n" + +stmt: ASGNI1(VREGP,reg) "# write register\n" +stmt: ASGNU1(VREGP,reg) "# write register\n" + +stmt: ASGNI2(VREGP,reg) "# write register\n" +stmt: ASGNU2(VREGP,reg) "# write register\n" + +stmt: ASGNF4(VREGP,reg) "# write register\n" +stmt: ASGNI4(VREGP,reg) "# write register\n" +stmt: ASGNP4(VREGP,reg) "# write register\n" +stmt: ASGNU4(VREGP,reg) "# write register\n" + +stmt: ASGNF8(VREGP,reg) "# write register\n" +stmt: ASGNI8(VREGP,reg) "# write register\n" +stmt: ASGNP8(VREGP,reg) "# write register\n" +stmt: ASGNU8(VREGP,reg) "# write register\n" +con: CNSTI1 "%a" +con: CNSTU1 "%a" + +con: CNSTI2 "%a" +con: CNSTU2 "%a" + +con: CNSTI4 "%a" +con: CNSTU4 "%a" +con: CNSTP4 "%a" + +con: CNSTI8 "%a" +con: CNSTU8 "%a" +con: CNSTP8 "%a" +stmt: reg "" +acon: con "%0" +acon: ADDRGP4 "%a" +addr: ADDI4(reg,acon) "%1($%0)" +addr: ADDU4(reg,acon) "%1($%0)" +addr: ADDP4(reg,acon) "%1($%0)" +addr: acon "%0" +addr: reg "($%0)" +addr: ADDRFP4 "%a+%F($sp)" +addr: ADDRLP4 "%a+%F($sp)" +reg: con "li $%c,%0\n" 1 +reg: addr "la $%c,%0\n" 1 +reg: CNSTI1 "# reg\n" range(a, 0, 0) +reg: CNSTI2 "# reg\n" range(a, 0, 0) +reg: CNSTI4 "# reg\n" range(a, 0, 0) +reg: CNSTU1 "# reg\n" range(a, 0, 0) +reg: CNSTU2 "# reg\n" range(a, 0, 0) +reg: CNSTU4 "# reg\n" range(a, 0, 0) +reg: CNSTP4 "# reg\n" range(a, 0, 0) +stmt: ASGNI1(addr,reg) "sb $%1,%0\n" 1 +stmt: ASGNU1(addr,reg) "sb $%1,%0\n" 1 +stmt: ASGNI2(addr,reg) "sh $%1,%0\n" 1 +stmt: ASGNU2(addr,reg) "sh $%1,%0\n" 1 +stmt: ASGNI4(addr,reg) "sw $%1,%0\n" 1 +stmt: ASGNU4(addr,reg) "sw $%1,%0\n" 1 +stmt: ASGNP4(addr,reg) "sw $%1,%0\n" 1 +reg: INDIRI1(addr) "lb $%c,%0\n" 1 +reg: INDIRU1(addr) "lbu $%c,%0\n" 1 +reg: INDIRI2(addr) "lh $%c,%0\n" 1 +reg: INDIRU2(addr) "lhu $%c,%0\n" 1 +reg: INDIRI4(addr) "lw $%c,%0\n" 1 +reg: INDIRU4(addr) "lw $%c,%0\n" 1 +reg: INDIRP4(addr) "lw $%c,%0\n" 1 + +reg: CVII4(INDIRI1(addr)) "lb $%c,%0\n" 1 +reg: CVII4(INDIRI2(addr)) "lh $%c,%0\n" 1 +reg: CVUU4(INDIRU1(addr)) "lbu $%c,%0\n" 1 +reg: CVUU4(INDIRU2(addr)) "lhu $%c,%0\n" 1 +reg: CVUI4(INDIRU1(addr)) "lbu $%c,%0\n" 1 +reg: CVUI4(INDIRU2(addr)) "lhu $%c,%0\n" 1 +reg: INDIRF4(addr) "l.s $f%c,%0\n" 1 +reg: INDIRF8(addr) "l.d $f%c,%0\n" 1 +stmt: ASGNF4(addr,reg) "s.s $f%1,%0\n" 1 +stmt: ASGNF8(addr,reg) "s.d $f%1,%0\n" 1 +reg: DIVI4(reg,reg) "div $%c,$%0,$%1\n" 1 +reg: DIVU4(reg,reg) "divu $%c,$%0,$%1\n" 1 +reg: MODI4(reg,reg) "rem $%c,$%0,$%1\n" 1 +reg: MODU4(reg,reg) "remu $%c,$%0,$%1\n" 1 +reg: MULI4(reg,reg) "mul $%c,$%0,$%1\n" 1 +reg: MULU4(reg,reg) "mul $%c,$%0,$%1\n" 1 +rc: con "%0" +rc: reg "$%0" + +reg: ADDI4(reg,rc) "addu $%c,$%0,%1\n" 1 +reg: ADDP4(reg,rc) "addu $%c,$%0,%1\n" 1 +reg: ADDU4(reg,rc) "addu $%c,$%0,%1\n" 1 +reg: BANDI4(reg,rc) "and $%c,$%0,%1\n" 1 +reg: BORI4(reg,rc) "or $%c,$%0,%1\n" 1 +reg: BXORI4(reg,rc) "xor $%c,$%0,%1\n" 1 +reg: BANDU4(reg,rc) "and $%c,$%0,%1\n" 1 +reg: BORU4(reg,rc) "or $%c,$%0,%1\n" 1 +reg: BXORU4(reg,rc) "xor $%c,$%0,%1\n" 1 +reg: SUBI4(reg,rc) "subu $%c,$%0,%1\n" 1 +reg: SUBP4(reg,rc) "subu $%c,$%0,%1\n" 1 +reg: SUBU4(reg,rc) "subu $%c,$%0,%1\n" 1 +rc5: CNSTI4 "%a" range(a,0,31) +rc5: reg "$%0" + +reg: LSHI4(reg,rc5) "sll $%c,$%0,%1\n" 1 +reg: LSHU4(reg,rc5) "sll $%c,$%0,%1\n" 1 +reg: RSHI4(reg,rc5) "sra $%c,$%0,%1\n" 1 +reg: RSHU4(reg,rc5) "srl $%c,$%0,%1\n" 1 +reg: BCOMI4(reg) "not $%c,$%0\n" 1 +reg: BCOMU4(reg) "not $%c,$%0\n" 1 +reg: NEGI4(reg) "negu $%c,$%0\n" 1 +reg: LOADI1(reg) "move $%c,$%0\n" move(a) +reg: LOADU1(reg) "move $%c,$%0\n" move(a) +reg: LOADI2(reg) "move $%c,$%0\n" move(a) +reg: LOADU2(reg) "move $%c,$%0\n" move(a) +reg: LOADI4(reg) "move $%c,$%0\n" move(a) +reg: LOADP4(reg) "move $%c,$%0\n" move(a) +reg: LOADU4(reg) "move $%c,$%0\n" move(a) +reg: ADDF4(reg,reg) "add.s $f%c,$f%0,$f%1\n" 1 +reg: ADDF8(reg,reg) "add.d $f%c,$f%0,$f%1\n" 1 +reg: DIVF4(reg,reg) "div.s $f%c,$f%0,$f%1\n" 1 +reg: DIVF8(reg,reg) "div.d $f%c,$f%0,$f%1\n" 1 +reg: MULF4(reg,reg) "mul.s $f%c,$f%0,$f%1\n" 1 +reg: MULF8(reg,reg) "mul.d $f%c,$f%0,$f%1\n" 1 +reg: SUBF4(reg,reg) "sub.s $f%c,$f%0,$f%1\n" 1 +reg: SUBF8(reg,reg) "sub.d $f%c,$f%0,$f%1\n" 1 +reg: LOADF4(reg) "mov.s $f%c,$f%0\n" move(a) +reg: LOADF8(reg) "mov.d $f%c,$f%0\n" move(a) +reg: NEGF4(reg) "neg.s $f%c,$f%0\n" 1 +reg: NEGF8(reg) "neg.d $f%c,$f%0\n" 1 +reg: CVII4(reg) "sll $%c,$%0,8*(4-%a); sra $%c,$%c,8*(4-%a)\n" 2 +reg: CVUI4(reg) "and $%c,$%0,(1<<(8*%a))-1\n" 1 +reg: CVUU4(reg) "and $%c,$%0,(1<<(8*%a))-1\n" 1 +reg: CVFF4(reg) "cvt.s.d $f%c,$f%0\n" 1 +reg: CVFF8(reg) "cvt.d.s $f%c,$f%0\n" 1 +reg: CVIF4(reg) "mtc1 $%0,$f%c; cvt.s.w $f%c,$f%c\n" 2 +reg: CVIF8(reg) "mtc1 $%0,$f%c; cvt.d.w $f%c,$f%c\n" 2 +reg: CVFI4(reg) "trunc.w.s $f2,$f%0,$%c; mfc1 $%c,$f2\n" (a->syms[0]->u.c.v.i==4?2:LBURG_MAX) +reg: CVFI4(reg) "trunc.w.d $f2,$f%0,$%c; mfc1 $%c,$f2\n" (a->syms[0]->u.c.v.i==8?2:LBURG_MAX) +stmt: LABELV "%a:\n" +stmt: JUMPV(acon) "b %0\n" 1 +stmt: JUMPV(reg) ".cpadd $%0\nj $%0\n" !pic +stmt: JUMPV(reg) "j $%0\n" pic +stmt: EQI4(reg,reg) "beq $%0,$%1,%a\n" 1 +stmt: EQU4(reg,reg) "beq $%0,$%1,%a\n" 1 +stmt: GEI4(reg,reg) "bge $%0,$%1,%a\n" 1 +stmt: GEU4(reg,reg) "bgeu $%0,$%1,%a\n" 1 +stmt: GTI4(reg,reg) "bgt $%0,$%1,%a\n" 1 +stmt: GTU4(reg,reg) "bgtu $%0,$%1,%a\n" 1 +stmt: LEI4(reg,reg) "ble $%0,$%1,%a\n" 1 +stmt: LEU4(reg,reg) "bleu $%0,$%1,%a\n" 1 +stmt: LTI4(reg,reg) "blt $%0,$%1,%a\n" 1 +stmt: LTU4(reg,reg) "bltu $%0,$%1,%a\n" 1 +stmt: NEI4(reg,reg) "bne $%0,$%1,%a\n" 1 +stmt: NEU4(reg,reg) "bne $%0,$%1,%a\n" 1 +stmt: EQF4(reg,reg) "c.eq.s $f%0,$f%1; bc1t %a\n" 2 +stmt: EQF8(reg,reg) "c.eq.d $f%0,$f%1; bc1t %a\n" 2 +stmt: LEF4(reg,reg) "c.ule.s $f%0,$f%1; bc1t %a\n" 2 +stmt: LEF8(reg,reg) "c.ule.d $f%0,$f%1; bc1t %a\n" 2 +stmt: LTF4(reg,reg) "c.ult.s $f%0,$f%1; bc1t %a\n" 2 +stmt: LTF8(reg,reg) "c.ult.d $f%0,$f%1; bc1t %a\n" 2 +stmt: GEF4(reg,reg) "c.lt.s $f%0,$f%1; bc1f %a\n" 2 +stmt: GEF8(reg,reg) "c.lt.d $f%0,$f%1; bc1f %a\n" 2 +stmt: GTF4(reg,reg) "c.le.s $f%0,$f%1; bc1f %a\n" 2 +stmt: GTF8(reg,reg) "c.le.d $f%0,$f%1; bc1f %a\n" 2 +stmt: NEF4(reg,reg) "c.eq.s $f%0,$f%1; bc1f %a\n" 2 +stmt: NEF8(reg,reg) "c.eq.d $f%0,$f%1; bc1f %a\n" 2 +ar: ADDRGP4 "%a" + +reg: CALLF4(ar) "jal %0\n" 1 +reg: CALLF8(ar) "jal %0\n" 1 +reg: CALLI4(ar) "jal %0\n" 1 +reg: CALLP4(ar) "jal %0\n" 1 +reg: CALLU4(ar) "jal %0\n" 1 +stmt: CALLV(ar) "jal %0\n" 1 +ar: reg "$%0" +ar: CNSTP4 "%a" range(a, 0, 0x0fffffff) +stmt: RETF4(reg) "# ret\n" 1 +stmt: RETF8(reg) "# ret\n" 1 +stmt: RETI4(reg) "# ret\n" 1 +stmt: RETU4(reg) "# ret\n" 1 +stmt: RETP4(reg) "# ret\n" 1 +stmt: RETV(reg) "# ret\n" 1 +stmt: ARGF4(reg) "# arg\n" 1 +stmt: ARGF8(reg) "# arg\n" 1 +stmt: ARGI4(reg) "# arg\n" 1 +stmt: ARGP4(reg) "# arg\n" 1 +stmt: ARGU4(reg) "# arg\n" 1 + +stmt: ARGB(INDIRB(reg)) "# argb %0\n" 1 +stmt: ASGNB(reg,INDIRB(reg)) "# asgnb %0 %1\n" 1 +%% +static void progend(void){} +static void progbeg(int argc, char *argv[]) { + int i; + + { + union { + char c; + int i; + } u; + u.i = 0; + u.c = 1; + swap = ((int)(u.i == 1)) != IR->little_endian; + } +// print(".set reorder\n"); + pic = !IR->little_endian; + parseflags(argc, argv); + for (i = 0; i < argc; i++) + if (strncmp(argv[i], "-G", 2) == 0) + gnum = atoi(argv[i] + 2); + else if (strcmp(argv[i], "-pic=1") == 0 + || strcmp(argv[i], "-pic=0") == 0) + pic = argv[i][5]-'0'; + for (i = 0; i < 31; i += 2) + freg2[i] = mkreg("%d", i, 3, FREG); + for (i = 0; i < 32; i++) + ireg[i] = mkreg("%d", i, 1, IREG); + ireg[29]->x.name = "sp"; + d6 = mkreg("6", 6, 3, IREG); + freg2w = mkwildcard(freg2); + iregw = mkwildcard(ireg); + tmask[IREG] = INTTMP; tmask[FREG] = FLTTMP; + vmask[IREG] = INTVAR; vmask[FREG] = FLTVAR; + blkreg = mkreg("8", 8, 7, IREG); +} +static Symbol rmap(int opk) { + switch (optype(opk)) { + case I: case U: case P: case B: + return iregw; + case F: + return freg2w; + default: + return 0; + } +} +static void target(Node p) { + assert(p); + switch (specific(p->op)) { + case CNST+I: case CNST+U: case CNST+P: + if (range(p, 0, 0) == 0) { + setreg(p, ireg[0]); + p->x.registered = 1; + } + break; + case CALL+V: + rtarget(p, 0, ireg[25]); + break; + case CALL+F: + rtarget(p, 0, ireg[25]); + setreg(p, freg2[0]); + break; + case CALL+I: case CALL+P: case CALL+U: + rtarget(p, 0, ireg[25]); + setreg(p, ireg[2]); + break; + case RET+F: + rtarget(p, 0, freg2[0]); + break; + case RET+I: case RET+U: case RET+P: + rtarget(p, 0, ireg[2]); + break; + case ARG+F: case ARG+I: case ARG+P: case ARG+U: { + static int ty0; + int ty = optype(p->op); + Symbol q; + + q = argreg(p->x.argno, p->syms[2]->u.c.v.i, ty, opsize(p->op), ty0); + if (p->x.argno == 0) + ty0 = ty; + if (q && + !(ty == F && q->x.regnode->set == IREG)) + rtarget(p, 0, q); + break; + } + case ASGN+B: rtarget(p->kids[1], 0, blkreg); break; + case ARG+B: rtarget(p->kids[0], 0, blkreg); break; + } +} +static void clobber(Node p) { + assert(p); + switch (specific(p->op)) { + case CALL+F: + spill(INTTMP | INTRET, IREG, p); + spill(FLTTMP, FREG, p); + break; + case CALL+I: case CALL+P: case CALL+U: + spill(INTTMP, IREG, p); + spill(FLTTMP | FLTRET, FREG, p); + break; + case CALL+V: + spill(INTTMP | INTRET, IREG, p); + spill(FLTTMP | FLTRET, FREG, p); + break; + } +} +static void emit2(Node p) { + int dst, n, src, sz, ty; + static int ty0; + Symbol q; + + switch (specific(p->op)) { + case ARG+F: case ARG+I: case ARG+P: case ARG+U: + ty = optype(p->op); + sz = opsize(p->op); + if (p->x.argno == 0) + ty0 = ty; + q = argreg(p->x.argno, p->syms[2]->u.c.v.i, ty, sz, ty0); + src = getregnum(p->x.kids[0]); + if (q == NULL && ty == F && sz == 4) + print("s.s $f%d,%d($sp)\n", src, p->syms[2]->u.c.v.i); + else if (q == NULL && ty == F) + print("s.d $f%d,%d($sp)\n", src, p->syms[2]->u.c.v.i); + else if (q == NULL) + print("sw $%d,%d($sp)\n", src, p->syms[2]->u.c.v.i); + else if (ty == F && sz == 4 && q->x.regnode->set == IREG) + print("mfc1 $%d,$f%d\n", q->x.regnode->number, src); + else if (ty == F && q->x.regnode->set == IREG) + print("mfc1.d $%d,$f%d\n", q->x.regnode->number, src); + break; + case ASGN+B: + dalign = salign = p->syms[1]->u.c.v.i; + blkcopy(getregnum(p->x.kids[0]), 0, + getregnum(p->x.kids[1]), 0, + p->syms[0]->u.c.v.i, tmpregs); + break; + case ARG+B: + dalign = 4; + salign = p->syms[1]->u.c.v.i; + blkcopy(29, p->syms[2]->u.c.v.i, + getregnum(p->x.kids[0]), 0, + p->syms[0]->u.c.v.i, tmpregs); + n = p->syms[2]->u.c.v.i + p->syms[0]->u.c.v.i; + dst = p->syms[2]->u.c.v.i; + for ( ; dst <= 12 && dst < n; dst += 4) + print("lw $%d,%d($sp)\n", (dst/4)+4, dst); + break; + } +} +static Symbol argreg(int argno, int offset, int ty, int sz, int ty0) { + assert((offset&3) == 0); + if (offset > 12) + return NULL; + else if (argno == 0 && ty == F) + return freg2[12]; + else if (argno == 1 && ty == F && ty0 == F) + return freg2[14]; + else if (argno == 1 && ty == F && sz == 8) + return d6; /* Pair! */ + else + return ireg[(offset/4) + 4]; +} +static void doarg(Node p) { + static int argno; + int align; + + if (argoffset == 0) + argno = 0; + p->x.argno = argno++; + align = p->syms[1]->u.c.v.i < 4 ? 4 : p->syms[1]->u.c.v.i; + p->syms[2] = intconst(mkactual(align, + p->syms[0]->u.c.v.i)); +} +static void local(Symbol p) { + if (askregvar(p, rmap(ttob(p->type))) == 0) + mkauto(p); +} + +static void function(Symbol f, Symbol caller[], Symbol callee[], int ncalls) +{ + int i, saved, sizefsave, sizeisave, varargs; + Symbol r, argregs[4]; + + usedmask[0] = usedmask[1] = 0; + freemask[0] = freemask[1] = ~(unsigned)0; + offset = maxoffset = maxargoffset = 0; + for (i = 0; callee[i]; i++) + ; + varargs = variadic(f->type) + || (i > 0 && strcmp(callee[i-1]->name, "va_alist") == 0); + for (i = 0; callee[i]; i++) { + Symbol p = callee[i]; + Symbol q = caller[i]; + assert(q); + offset = roundup(offset, q->type->align); + p->x.offset = q->x.offset = offset; + p->x.name = q->x.name = stringd(offset); + r = argreg(i, offset, optype(ttob(q->type)), q->type->size, optype(ttob(caller[0]->type))); + if (i < 4) + argregs[i] = r; + offset = roundup(offset + q->type->size, 4); + if (varargs) + p->sclass = AUTO; + else if (r && ncalls == 0 && + !isstruct(q->type) && !p->addressed && + !(isfloat(q->type) && r->x.regnode->set == IREG) +) { + p->sclass = q->sclass = REGISTER; + askregvar(p, r); + assert(p->x.regnode && p->x.regnode->vbl == p); + q->x = p->x; + q->type = p->type; + } + else if (askregvar(p, rmap(ttob(p->type))) + && r != NULL + && (isint(p->type) || p->type == q->type)) { + assert(q->sclass != REGISTER); + p->sclass = q->sclass = REGISTER; + q->type = p->type; + } + } + assert(!caller[i]); + offset = 0; + gencode(caller, callee); + if (ncalls) + usedmask[IREG] |= ((unsigned)1)<<31; + usedmask[IREG] &= 0xc0ff0000; + usedmask[FREG] &= 0xfff00000; + if (pic && ncalls) + usedmask[IREG] |= 1<<25; + maxargoffset = roundup(maxargoffset, usedmask[FREG] ? 8 : 4); + if (ncalls && maxargoffset < 16) + maxargoffset = 16; + sizefsave = 4*bitcount(usedmask[FREG]); + sizeisave = 4*bitcount(usedmask[IREG]); + framesize = roundup(maxargoffset + sizefsave + + sizeisave + maxoffset, 16); + segment(CODE); +// print(".align 2\n"); +// print(".ent %s\n", f->x.name); + print("%s:\n", f->x.name); + i = maxargoffset + sizefsave - framesize; +// print(".frame $sp,%d,$31\n", framesize); +// if (pic) +// print(".set noreorder\n.cpload $25\n.set reorder\n"); + if (framesize > 0) + print("addiu $sp,$sp,%d\n", -framesize); +// if (usedmask[FREG]) +// print(".fmask 0x%x,%d\n", usedmask[FREG], i - 8); +// if (usedmask[IREG]) +// print(".mask 0x%x,%d\n", usedmask[IREG], +// i + sizeisave - 4); + saved = maxargoffset; + for (i = 20; i <= 30; i += 2) + if (usedmask[FREG]&(3<x.regnode != callee[i]->x.regnode) { + Symbol out = callee[i]; + Symbol in = caller[i]; + int rn = r->x.regnode->number; + int rs = r->x.regnode->set; + int tyin = ttob(in->type); + + assert(out && in && r && r->x.regnode); + assert(out->sclass != REGISTER || out->x.regnode); + if (out->sclass == REGISTER + && (isint(out->type) || out->type == in->type)) { + int outn = out->x.regnode->number; + if (rs == FREG && tyin == F+sizeop(8)) + print("mov.d $f%d,$f%d\n", outn, rn); + else if (rs == FREG && tyin == F+sizeop(4)) + print("mov.s $f%d,$f%d\n", outn, rn); + else if (rs == IREG && tyin == F+sizeop(8)) + print("mtc1.d $%d,$f%d\n", rn, outn); + else if (rs == IREG && tyin == F+sizeop(4)) + print("mtc1 $%d,$f%d\n", rn, outn); + else + print("move $%d,$%d\n", outn, rn); + } else { + int off = in->x.offset + framesize; + if (rs == FREG && tyin == F+sizeop(8)) + print("s.d $f%d,%d($sp)\n", rn, off); + else if (rs == FREG && tyin == F+sizeop(4)) + print("s.s $f%d,%d($sp)\n", rn, off); + else { + int i, n = (in->type->size + 3)/4; + for (i = rn; i < rn+n && i <= 7; i++) + print("sw $%d,%d($sp)\n", i, off + (i-rn)*4); + } + } + } + } + if (varargs && callee[i-1]) { + i = callee[i-1]->x.offset + callee[i-1]->type->size; + for (i = roundup(i, 4)/4; i <= 3; i++) + print("sw $%d,%d($sp)\n", i + 4, framesize + 4*i); + } + emitcode(); + saved = maxargoffset; + for (i = 20; i <= 30; i += 2) + if (usedmask[FREG]&(3< 0) + print("addiu $sp,$sp,%d\n", framesize); + print("jr $31\n"); +// print(".end %s\n", f->x.name); +} + +static void defconst(int suffix, int size, Value v) +{ + if (suffix == F && size == 4) { + union { + float f32; + unsigned u32; + } u; + u.f32 = v.d; + print(".word 0x%x\n", u.u32); + } + else if (suffix == F && size == 8) { + union { + double d64; + unsigned u32[2]; + } u; + u.d64 = v.d; + print(".word 0x%x\n.word 0x%x\n", u.u32[swap], u.u32[!swap]); + } + else if (suffix == P) + print(".word 0x%x\n", (unsigned)v.p); + else if (size == 1) + print(".byte 0x%x\n", (unsigned)((unsigned char)(suffix == I ? v.i : v.u))); + else if (size == 2) + print(".half 0x%x\n", (unsigned)((unsigned short)(suffix == I ? v.i : v.u))); + else if (size == 4) + print(".word 0x%x\n", (unsigned)(suffix == I ? v.i : v.u)); +} + +static void defaddress(Symbol p) +{ + if (pic && p->scope == LABELS) + print(".gpword %s\n", p->x.name); + else + print(".word %s\n", p->x.name); +} +static void defstring(int n, char *str) { + char *s; + + print(".ascii \"" ); + for (s = str; s < str + n; s++) + if( *s < 0x20 ) + print("\\%o",*s); + else + print("%c",*s); + print("\"\n"); +// for (s = str; s < str + n; s++) +// print(".byte %d\n", (*s)&0377); +} +static void export(Symbol p) { + print(".globl %s\n", p->x.name); +} +static void import(Symbol p) { + if (!isfunc(p->type)) + print(".extern %s %d\n", p->name, p->type->size); +} +static void defsymbol(Symbol p) { + if (p->scope >= LOCAL && p->sclass == STATIC) + p->x.name = stringf("L.%d", genlabel(1)); + else if (p->generated) + p->x.name = stringf("L.%s", p->name); + else { + assert(p->scope != CONSTANTS || isint(p->type) || isptr(p->type)); + p->x.name = p->name; + } +} +static void address(Symbol q, Symbol p, long n) { + if (p->scope == GLOBAL + || p->sclass == STATIC || p->sclass == EXTERN) + q->x.name = stringf("%s%s%D", p->x.name, + n >= 0 ? "+" : "", n); + else { + assert(n <= INT_MAX && n >= INT_MIN); + q->x.offset = p->x.offset + n; + q->x.name = stringd(q->x.offset); + } +} +static void global(Symbol p) { + if (p->u.seg == BSS) { + if (p->sclass == STATIC || Aflag >= 2) + print(".lcomm %s,%d\n", p->x.name, p->type->size); + else + print( ".comm %s,%d\n", p->x.name, p->type->size); + } else { + if (p->u.seg == DATA + && (p->type->size == 0 || p->type->size > gnum)) + print(".data\n"); + else if (p->u.seg == DATA) + print(".sdata\n"); +// print(".align %c\n", ".01.2...3"[p->type->align]); + print("%s:\n", p->x.name); + } +} +static void segment(int n) { + cseg = n; + switch (n) { + case CODE: print(".text\n"); break; +// case LIT: print(".rdata\n"); break; + case LIT: print(".data\n"); break; + } +} +static void space(int n) { + if (cseg != BSS) + print(".space %d\n", n); +} +static void blkloop(int dreg, int doff, int sreg, int soff, int size, int tmps[]) { + int lab = genlabel(1); + + print("addiu $%d,$%d,%d\n", sreg, sreg, size&~7); + print("addiu $%d,$%d,%d\n", tmps[2], dreg, size&~7); + blkcopy(tmps[2], doff, sreg, soff, size&7, tmps); + print("L.%d:\n", lab); + print("addiu $%d,$%d,%d\n", sreg, sreg, -8); + print("addiu $%d,$%d,%d\n", tmps[2], tmps[2], -8); + blkcopy(tmps[2], doff, sreg, soff, 8, tmps); + print("bltu $%d,$%d,L.%d\n", dreg, tmps[2], lab); +} +static void blkfetch(int size, int off, int reg, int tmp) { + assert(size == 1 || size == 2 || size == 4); + if (size == 1) + print("lbu $%d,%d($%d)\n", tmp, off, reg); + else if (salign >= size && size == 2) + print("lhu $%d,%d($%d)\n", tmp, off, reg); + else if (salign >= size) + print("lw $%d,%d($%d)\n", tmp, off, reg); + else if (size == 2) + print("ulhu $%d,%d($%d)\n", tmp, off, reg); + else + print("ulw $%d,%d($%d)\n", tmp, off, reg); +} +static void blkstore(int size, int off, int reg, int tmp) { + if (size == 1) + print("sb $%d,%d($%d)\n", tmp, off, reg); + else if (dalign >= size && size == 2) + print("sh $%d,%d($%d)\n", tmp, off, reg); + else if (dalign >= size) + print("sw $%d,%d($%d)\n", tmp, off, reg); + else if (size == 2) + print("ush $%d,%d($%d)\n", tmp, off, reg); + else + print("usw $%d,%d($%d)\n", tmp, off, reg); +} +static void stabinit(char *, int, char *[]); +static void stabline(Coordinate *); +static void stabsym(Symbol); + +static char *currentfile; + +static int bitcount(unsigned mask) { + unsigned i, n = 0; + + for (i = 1; i; i <<= 1) + if (mask&i) + n++; + return n; +} + +/* stabinit - initialize stab output */ +static void stabinit(char *file, int argc, char *argv[]) { + if (file) { + print(".file 2,\"%s\"\n", file); + currentfile = file; + } +} + +/* stabline - emit stab entry for source coordinate *cp */ +static void stabline(Coordinate *cp) { + if (cp->file && cp->file != currentfile) { + print(".file 2,\"%s\"\n", cp->file); + currentfile = cp->file; + } + print(".loc 2,%d\n", cp->y); +} + +/* stabsym - output a stab entry for symbol p */ +static void stabsym(Symbol p) { + if (p == cfunc && IR->stabline) + (*IR->stabline)(&p->src); +} + +Interface mipsebIR = { + { 1, 1, 0 }, /* char */ + { 2, 2, 0 }, /* short */ + { 4, 4, 0 }, /* int */ + { 4, 4, 0 }, /* long */ + { 4, 4, 0 }, /* long long */ + { 4, 4, 1 }, /* float */ + { 8, 8, 1 }, /* double */ + { 8, 8, 1 }, /* long double */ + { 4, 4, 0 }, /* T * */ + { 0, 1, 0 }, /* struct */ + 0, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 1, /* wants_argb */ + 1, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + address, + blockbeg, + blockend, + defaddress, + defconst, + defstring, + defsymbol, + emit, + export, + function, + gen, + global, + import, + local, + progbeg, + progend, + segment, + space, + 0, 0, 0, stabinit, stabline, stabsym, 0, + { + 4, /* max_unaligned_load */ + rmap, + blkfetch, blkstore, blkloop, + _label, + _rule, + _nts, + _kids, + _string, + _templates, + _isinstruction, + _ntname, + emit2, + doarg, + target, + clobber, + + } +}, mipselIR = { + { 1, 1, 0 }, /* char */ + { 2, 2, 0 }, /* short */ + { 4, 4, 0 }, /* int */ + { 4, 4, 0 }, /* long */ + { 4, 4, 0 }, /* long long */ + { 4, 4, 1 }, /* float */ + { 8, 8, 1 }, /* double */ + { 8, 8, 1 }, /* long double */ + { 4, 4, 0 }, /* T * */ + { 0, 1, 0 }, /* struct */ + 1, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 1, /* wants_argb */ + 1, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + address, + blockbeg, + blockend, + defaddress, + defconst, + defstring, + defsymbol, + emit, + export, + function, + gen, + global, + import, + local, + progbeg, + progend, + segment, + space, + 0, 0, 0, stabinit, stabline, stabsym, 0, + { + 4, /* max_unaligned_load */ + rmap, + blkfetch, blkstore, blkloop, + _label, + _rule, + _nts, + _kids, + _string, + _templates, + _isinstruction, + _ntname, + emit2, + doarg, + target, + clobber, + + } +}; diff --git a/src/cmd/lccom-1/null.c b/src/cmd/lccom-1/null.c new file mode 100644 index 0000000..89034e5 --- /dev/null +++ b/src/cmd/lccom-1/null.c @@ -0,0 +1,73 @@ +#include "c.h" +#define I(f) null_##f + +static Node I(gen)(Node p) { return p; } +static void I(address)(Symbol q, Symbol p, long n) {} +static void I(blockbeg)(Env *e) {} +static void I(blockend)(Env *e) {} +static void I(defaddress)(Symbol p) {} +static void I(defconst)(int suffix, int size, Value v) {} +static void I(defstring)(int len, char *s) {} +static void I(defsymbol)(Symbol p) {} +static void I(emit)(Node p) {} +static void I(export)(Symbol p) {} +static void I(function)(Symbol f, Symbol caller[], Symbol callee[], int ncalls) {} +static void I(global)(Symbol p) {} +static void I(import)(Symbol p) {} +static void I(local)(Symbol p) {} +static void I(progbeg)(int argc, char *argv[]) {} +static void I(progend)(void) {} +static void I(segment)(int s) {} +static void I(space)(int n) {} +static void I(stabblock)(int brace, int lev, Symbol *p) {} +static void I(stabend)(Coordinate *cp, Symbol p, Coordinate **cpp, Symbol *sp, Symbol *stab) {} +static void I(stabfend)(Symbol p, int lineno) {} +static void I(stabinit)(char *file, int argc, char *argv[]) {} +static void I(stabline)(Coordinate *cp) {} +static void I(stabsym)(Symbol p) {} +static void I(stabtype)(Symbol p) {} + +Interface nullIR = { + { 1, 1, 0 }, /* char */ + { 2, 2, 0 }, /* short */ + { 4, 4, 0 }, /* int */ + { 8, 8, 1 }, /* long */ + { 8 ,8, 1 }, /* long long */ + { 4, 4, 1 }, /* float */ + { 8, 8, 1 }, /* double */ + { 16,16,1 }, /* long double */ + { 4, 4, 0 }, /* T* */ + { 0, 4, 0 }, /* struct */ + 1, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 0, /* wants_argb */ + 1, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + I(address), + I(blockbeg), + I(blockend), + I(defaddress), + I(defconst), + I(defstring), + I(defsymbol), + I(emit), + I(export), + I(function), + I(gen), + I(global), + I(import), + I(local), + I(progbeg), + I(progend), + I(segment), + I(space), + I(stabblock), + I(stabend), + I(stabfend), + I(stabinit), + I(stabline), + I(stabsym), + I(stabtype) +}; diff --git a/src/cmd/lccom-1/ops.h b/src/cmd/lccom-1/ops.h new file mode 100644 index 0000000..09cc79a --- /dev/null +++ b/src/cmd/lccom-1/ops.h @@ -0,0 +1,131 @@ +gop(CNST,1) + op(CNST,F,fdx) + op(CNST,I,csilh) + op(CNST,P,p) + op(CNST,U,csilh) +gop(ARG,2) + op(ARG,B,-) + op(ARG,F,fdx) + op(ARG,I,ilh) + op(ARG,P,p) + op(ARG,U,ilh) +gop(ASGN,3) + op(ASGN,B,-) + op(ASGN,F,fdx) + op(ASGN,I,csilh) + op(ASGN,P,p) + op(ASGN,U,csilh) +gop(INDIR,4) + op(INDIR,B,-) + op(INDIR,F,fdx) + op(INDIR,I,csilh) + op(INDIR,P,p) + op(INDIR,U,csilh) +gop(CVF,7) + op(CVF,F,fdx) + op(CVF,I,ilh) +gop(CVI,8) + op(CVI,F,fdx) + op(CVI,I,csilh) + op(CVI,U,csilhp) +gop(CVP,9) + op(CVP,U,p) +gop(CVU,11) + op(CVU,I,csilh) + op(CVU,P,p) + op(CVU,U,csilh) +gop(NEG,12) + op(NEG,F,fdx) + op(NEG,I,ilh) +gop(CALL,13) + op(CALL,B,-) + op(CALL,F,fdx) + op(CALL,I,ilh) + op(CALL,P,p) + op(CALL,U,ilh) + op(CALL,V,-) +gop(RET,15) + op(RET,F,fdx) + op(RET,I,ilh) + op(RET,P,p) + op(RET,U,ilh) + op(RET,V,-) +gop(ADDRG,16) + op(ADDRG,P,p) +gop(ADDRF,17) + op(ADDRF,P,p) +gop(ADDRL,18) + op(ADDRL,P,p) +gop(ADD,19) + op(ADD,F,fdx) + op(ADD,I,ilh) + op(ADD,P,p) + op(ADD,U,ilhp) +gop(SUB,20) + op(SUB,F,fdx) + op(SUB,I,ilh) + op(SUB,P,p) + op(SUB,U,ilhp) +gop(LSH,21) + op(LSH,I,ilh) + op(LSH,U,ilh) +gop(MOD,22) + op(MOD,I,ilh) + op(MOD,U,ilh) +gop(RSH,23) + op(RSH,I,ilh) + op(RSH,U,ilh) +gop(BAND,24) + op(BAND,I,ilh) + op(BAND,U,ilh) +gop(BCOM,25) + op(BCOM,I,ilh) + op(BCOM,U,ilh) +gop(BOR,26) + op(BOR,I,ilh) + op(BOR,U,ilh) +gop(BXOR,27) + op(BXOR,I,ilh) + op(BXOR,U,ilh) +gop(DIV,28) + op(DIV,F,fdx) + op(DIV,I,ilh) + op(DIV,U,ilh) +gop(MUL,29) + op(MUL,F,fdx) + op(MUL,I,ilh) + op(MUL,U,ilh) +gop(EQ,30) + op(EQ,F,fdx) + op(EQ,I,ilh) + op(EQ,U,ilhp) +gop(GE,31) + op(GE,F,fdx) + op(GE,I,ilh) + op(GE,U,ilhp) +gop(GT,32) + op(GT,F,fdx) + op(GT,I,ilh) + op(GT,U,ilhp) +gop(LE,33) + op(LE,F,fdx) + op(LE,I,ilh) + op(LE,U,ilhp) +gop(LT,34) + op(LT,F,fdx) + op(LT,I,ilh) + op(LT,U,ilhp) +gop(NE,35) + op(NE,F,fdx) + op(NE,I,ilh) + op(NE,U,ilhp) +gop(JUMP,36) + op(JUMP,V,-) +gop(LABEL,37) + op(LABEL,V,-) +gop(LOAD,14) + op(LOAD,B,-) + op(LOAD,F,fdx) + op(LOAD,I,csilh) + op(LOAD,P,p) + op(LOAD,U,csilhp) diff --git a/src/cmd/lccom-1/output.c b/src/cmd/lccom-1/output.c new file mode 100644 index 0000000..be929b0 --- /dev/null +++ b/src/cmd/lccom-1/output.c @@ -0,0 +1,133 @@ +#include "c.h" + +static char *outs(const char *str, FILE *f, char *bp) { + if (f) + fputs(str, f); + else + while ((*bp = *str++)) + bp++; + return bp; +} + +static char *outd(long n, FILE *f, char *bp) { + unsigned long m; + char buf[25], *s = buf + sizeof buf; + + *--s = '\0'; + if (n < 0) + m = -n; + else + m = n; + do + *--s = m%10 + '0'; + while ((m /= 10) != 0); + if (n < 0) + *--s = '-'; + return outs(s, f, bp); +} + +static char *outu(unsigned long n, int base, FILE *f, char *bp) { + char buf[25], *s = buf + sizeof buf; + + *--s = '\0'; + do + *--s = "0123456789abcdef"[n%base]; + while ((n /= base) != 0); + return outs(s, f, bp); +} +void print(const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + vfprint(stdout, NULL, fmt, ap); + va_end(ap); +} +/* fprint - formatted output to f */ +void fprint(FILE *f, const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + vfprint(f, NULL, fmt, ap); + va_end(ap); +} + +/* stringf - formatted output to a saved string */ +char *stringf(const char *fmt, ...) { + char buf[1024]; + va_list ap; + + va_start(ap, fmt); + vfprint(NULL, buf, fmt, ap); + va_end(ap); + return string(buf); +} + +/* vfprint - formatted output to f or string bp */ +void vfprint(FILE *f, char *bp, const char *fmt, va_list ap) { + for (; *fmt; fmt++) + if (*fmt == '%') + switch (*++fmt) { + case 'd': bp = outd(va_arg(ap, int), f, bp); break; + case 'D': bp = outd(va_arg(ap, long), f, bp); break; + case 'U': bp = outu(va_arg(ap, unsigned long), 10, f, bp); break; + case 'u': bp = outu(va_arg(ap, unsigned), 10, f, bp); break; + case 'o': bp = outu(va_arg(ap, unsigned), 8, f, bp); break; + case 'X': bp = outu(va_arg(ap, unsigned long), 16, f, bp); break; + case 'x': bp = outu(va_arg(ap, unsigned), 16, f, bp); break; + case 'f': case 'e': + case 'g': { + static char format[] = "%f"; + char buf[128]; + format[1] = *fmt; + sprintf(buf, format, va_arg(ap, double)); + bp = outs(buf, f, bp); + } +; break; + case 's': bp = outs(va_arg(ap, char *), f, bp); break; + case 'p': { + void *p = va_arg(ap, void *); + if (p) + bp = outs("0x", f, bp); + bp = outu((unsigned long)p, 16, f, bp); + break; + } + case 'c': if (f) fputc(va_arg(ap, int), f); else *bp++ = va_arg(ap, int); break; + case 'S': { char *s = va_arg(ap, char *); + int n = va_arg(ap, int); + if (s) + for ( ; n-- > 0; s++) + if (f) (void)putc(*s, f); else *bp++ = *s; + } break; + case 'k': { int t = va_arg(ap, int); + static char *tokens[] = { +#define xx(a,b,c,d,e,f,g) g, +#define yy(a,b,c,d,e,f,g) g, +#include "token.h" + }; + assert(tokens[t&0177]); + bp = outs(tokens[t&0177], f, bp); + } break; + case 't': { Type ty = va_arg(ap, Type); + assert(f); + outtype(ty ? ty : voidtype, f); + } break; + case 'w': { Coordinate *p = va_arg(ap, Coordinate *); + if (p->file && *p->file) { + bp = outs(p->file, f, bp); + bp = outs(":", f, bp); + } + bp = outd(p->y, f, bp); + } break; + case 'I': { int n = va_arg(ap, int); + while (--n >= 0) + if (f) (void)putc(' ', f); else *bp++ = ' '; + } break; + default: if (f) (void)putc(*fmt, f); else *bp++ = *fmt; break; + } + else if (f) + (void)putc(*fmt, f); + else + *bp++ = *fmt; + if (!f) + *bp = '\0'; +} diff --git a/src/cmd/lccom-1/prof.c b/src/cmd/lccom-1/prof.c new file mode 100644 index 0000000..b3a922d --- /dev/null +++ b/src/cmd/lccom-1/prof.c @@ -0,0 +1,231 @@ +#include "c.h" + +struct callsite { + char *file, *name; + union coordinate { + unsigned int coord; + struct { unsigned int y:16,x:10,index:6; } le; + struct { unsigned int index:6,x:10,y:16; } be; + } u; +}; +struct func { + struct func *link; + struct caller *callers; + char *name; + union coordinate src; +}; +struct map { /* source code map; 200 coordinates/map */ + int size; + union coordinate u[200]; +}; + +int npoints; /* # of execution points if -b specified */ +int ncalled = -1; /* #times prof.out says current function was called */ +static Symbol YYlink; /* symbol for file's struct _bbdata */ +static Symbol YYcounts; /* symbol for _YYcounts if -b specified */ +static List maplist; /* list of struct map *'s */ +static List filelist; /* list of file names */ +static Symbol funclist; /* list of struct func *'s */ +static Symbol afunc; /* current function's struct func */ + +/* bbpad - emit space, if necessary, to make size%align == 0; return new size */ +static int bbpad(int size, int align) { + if (size%align) { + (*IR->space)(align - size%align); + size = roundup(size, align); + } + return size; +} + +/* bbcall - build tree to set _callsite at call site *cp, emit call site data */ +static void bbcall(Symbol yycounts, Coordinate *cp, Tree *e) { + static Symbol caller; + Value v; + union coordinate u; + Symbol p = genident(STATIC, array(voidptype, 0, 0), GLOBAL); + Tree t; + + defglobal(p, LIT); + defpointer(cp->file ? mkstr(cp->file)->u.c.loc : (Symbol)0); + defpointer(mkstr(cfunc->name)->u.c.loc); + if (IR->little_endian) { + u.le.x = cp->x; + u.le.y = cp->y; + } else { + u.be.x = cp->x; + u.be.y = cp->y; + } + (*IR->defconst)(U, unsignedtype->size, (v.u = u.coord, v)); + bbpad(2*voidptype->size + unsignedtype->size, p->type->align); + if (caller == 0) { + caller = mksymbol(EXTERN, "_caller", ptr(voidptype)); + caller->defined = 0; + } + for (t = *e; generic(t->op) != CALL; t = t->kids[0]) + assert(t->op == RIGHT || !t->kids[1]); + assert(generic(t->op) == CALL); + t = tree(t->op, t->type, + tree(RIGHT, t->kids[0]->type, + t->kids[0], + tree(RIGHT, t->kids[0]->type, asgn(caller, idtree(p)), t->kids[0])), + t->kids[1]); + for ( ; generic((*e)->op) != CALL; e = &(*e)->kids[0]) + ; + *e = t; +} + +/* bbentry - return tree for _prologue(&afunc, &YYlink)' */ +static void bbentry(Symbol yylink, Symbol f, void *ignore) { + static Symbol prologue; + + afunc = genident(STATIC, array(voidptype, 4, 0), GLOBAL); + if (prologue == 0) { + prologue = mksymbol(EXTERN, "_prologue", ftype(inttype, voidptype, voidptype, NULL)); + prologue->defined = 0; + } + walk(vcall(prologue, voidtype, pointer(idtree(afunc)), pointer(idtree(yylink)), NULL), 0, 0); +} + +/* bbexit - return tree for _epilogue(&afunc)' */ +static void bbexit(Symbol yylink, Symbol f, Tree e) { + static Symbol epilogue; + + if (epilogue == 0) { + epilogue = mksymbol(EXTERN, "_epilogue", ftype(inttype, voidptype, NULL)); + epilogue->defined = 0; + } + walk(vcall(epilogue, voidtype, pointer(idtree(afunc)), NULL), 0, 0); +} + +/* bbfile - add file to list of file names, return its index */ +static int bbfile(char *file) { + if (file) { + List lp; + int i = 1; + if ((lp = filelist) != NULL) + do { + lp = lp->link; + if (((Symbol)lp->x)->u.c.v.p == file) + return i; + i++; + } while (lp != filelist); + filelist = append(mkstr(file), filelist); + return i; + } + return 0; +} + +/* bbfunc - emit function name and src coordinates */ +static void bbfunc(Symbol yylink, Symbol f, void *ignore) { + Value v; + union coordinate u; + + defglobal(afunc, DATA); + defpointer(funclist); + defpointer(NULL); + defpointer(mkstr(f->name)->u.c.loc); + if (IR->little_endian) { + u.le.x = f->u.f.pt.x; + u.le.y = f->u.f.pt.y; + u.le.index = bbfile(f->u.f.pt.file); + } else { + u.be.x = f->u.f.pt.x; + u.be.y = f->u.f.pt.y; + u.be.index = bbfile(f->u.f.pt.file); + } + (*IR->defconst)(U, unsignedtype->size, (v.u = u.coord, v)); + bbpad(3*voidptype->size + unsignedtype->size, afunc->type->align); + funclist = afunc; +} + +/* bbincr - build tree to increment execution point at *cp */ +static void bbincr(Symbol yycounts, Coordinate *cp, Tree *e) { + struct map *mp = maplist->x; + Tree t; + + if (needconst) + return; + /* append *cp to source map */ + if (mp->size >= NELEMS(mp->u)) { + NEW(mp, PERM); + mp->size = 0; + maplist = append(mp, maplist); + } + if (IR->little_endian) { + mp->u[mp->size].le.x = cp->x; + mp->u[mp->size].le.y = cp->y; + mp->u[mp->size++].le.index = bbfile(cp->file); + } else { + mp->u[mp->size].be.x = cp->x; + mp->u[mp->size].be.y = cp->y; + mp->u[mp->size++].be.index = bbfile(cp->file); + } + t = incr('+', rvalue((*optree['+'])(ADD, pointer(idtree(yycounts)), + consttree(npoints++, inttype))), consttree(1, inttype)); + if (*e) + *e = tree(RIGHT, (*e)->type, t, *e); + else + *e = t; +} + +/* bbvars - emit definition for basic block counting data */ +static void bbvars(Symbol yylink, void *ignore, void *ignore2) { + int i, j, n = npoints; + Value v; + struct map **mp; + Symbol coords, files, *p; + + if (!YYcounts && !yylink) + return; + if (YYcounts) { + if (n <= 0) + n = 1; + YYcounts->type = array(inttype, n, 0); + defglobal(YYcounts, BSS); + (*IR->space)(YYcounts->type->size); + } + files = genident(STATIC, array(charptype, 1, 0), GLOBAL); + defglobal(files, LIT); + for (p = ltov(&filelist, PERM); *p; p++) + defpointer((*p)->u.c.loc); + defpointer(NULL); + coords = genident(STATIC, array(unsignedtype, n, 0), GLOBAL); + defglobal(coords, LIT); + for (i = n, mp = ltov(&maplist, PERM); *mp; i -= (*mp)->size, mp++) + for (j = 0; j < (*mp)->size; j++) + (*IR->defconst)(U, unsignedtype->size, (v.u = (*mp)->u[j].coord, v)); + if (i > 0) + (*IR->space)(i*coords->type->type->size); + (*IR->defconst)(U, unsignedtype->size, (v.u = 0, v)); + defglobal(yylink, DATA); + defpointer(NULL); + (*IR->defconst)(U, inttype->size, (v.u = n, v)); + bbpad(voidptype->size + inttype->size, yylink->type->align); + defpointer(YYcounts); + defpointer(coords); + defpointer(files); + defpointer(funclist); +} + +/* profInit - initialize basic block profiling options */ +void profInit(char *arg) { + if (strncmp(arg, "-a", 2) == 0) { + if (ncalled == -1 + && process(arg[2] ? &arg[2] : "prof.out") > 0) + ncalled = 0; + } else if ((strcmp(arg, "-b") == 0 + || strcmp(arg, "-C") == 0) && YYlink == 0) { + YYlink = genident(STATIC, array(voidptype, 0, 0), GLOBAL); + attach((Apply)bbentry, YYlink, &events.entry); + attach((Apply)bbexit, YYlink, &events.returns); + attach((Apply)bbfunc, YYlink, &events.exit); + attach((Apply)bbvars, YYlink, &events.end); + if (strcmp(arg, "-b") == 0) { + YYcounts = genident(STATIC, array(inttype, 0, 0), GLOBAL); + maplist = append(allocate(sizeof (struct map), PERM), maplist); + ((struct map *)maplist->x)->size = 0; + attach((Apply)bbcall, YYcounts, &events.calls); + attach((Apply)bbincr, YYcounts, &events.points); + } + } +} diff --git a/src/cmd/lccom-1/profio.c b/src/cmd/lccom-1/profio.c new file mode 100644 index 0000000..22be5e3 --- /dev/null +++ b/src/cmd/lccom-1/profio.c @@ -0,0 +1,285 @@ +/* + * C compiler: prof.out input + * + * prof.out format: + * #files + * name + * ... (#files-1 times) + * #functions + * name file# x y count caller file x y + * ... (#functions-1 times) + * #points + * file# x y count + * ... (#points-1 times) + */ +#include "c.h" + +struct count { /* count data: */ + int x, y; /* source coordinate */ + int count; /* associated execution count */ +}; + +#define MAXTOKEN 64 + +struct file { /* per-file prof.out data: */ + struct file *link; /* link to next file */ + char *name; /* file name */ + int size; /* size of counts[] */ + int count; /* counts[0..count-1] hold valid data */ + struct count *counts; /* count data */ + struct func { /* function data: */ + struct func *link; /* link to next function */ + char *name; /* function name */ + struct count count; /* total number of calls */ + struct caller { /* caller data: */ + struct caller *link; /* link to next caller */ + char *name; /* caller's name */ + char *file; /* call site: file, x, y */ + int x, y; + int count; /* number of calls from this site */ + } *callers; + } *funcs; /* list of functions */ +} *filelist; +FILE *fp; + +/* acaller - add caller and site (file,x,y) to callee's callers list */ +static void acaller(char *caller, char *file, int x, int y, int count, struct func *callee) { + struct caller *q; + + assert(callee); + for (q = callee->callers; q && (caller != q->name + || file != q->file || x != q->x || y != q->y); q = q->link) + ; + if (!q) { + struct caller **r; + NEW(q, PERM); + q->name = caller; + q->file = file; + q->x = x; + q->y = y; + q->count = 0; + for (r = &callee->callers; *r && (strcmp(q->name, (*r)->name) > 0 + || strcmp(q->file, (*r)->file) > 0 || q->y > (*r)->y || q->y > (*r)->y); r = &(*r)->link) + ; + q->link = *r; + *r = q; + } + q->count += count; +} + +/* compare - return <0, 0, >0 if ab, resp. */ +static int compare(const void *x, const void *y) { + struct count *a = (struct count *)x, *b = (struct count *)y; + + if (a->y == b->y) + return a->x - b->x; + return a->y - b->y; +} + +/* findfile - return file name's file list entry, or 0 */ +static struct file *findfile(char *name) { + struct file *p; + + for (p = filelist; p; p = p->link) + if (p->name == name) + return p; + return 0; +} + +/* afunction - add function name and its data to file's function list */ +static struct func *afunction(char *name, char *file, int x, int y, int count) { + struct file *p = findfile(file); + struct func *q; + + assert(p); + for (q = p->funcs; q && name != q->name; q = q->link) + ; + if (!q) { + struct func **r; + NEW(q, PERM); + q->name = name; + q->count.x = x; + q->count.y = y; + q->count.count = 0; + q->callers = 0; + for (r = &p->funcs; *r && compare(&q->count, &(*r)->count) > 0; r = &(*r)->link) + ; + q->link = *r; + *r = q; + } + q->count.count += count; + return q; +} + +/* apoint - append execution point i to file's data */ +static void apoint(int i, char *file, int x, int y, int count) { + struct file *p = findfile(file); + + assert(p); + if (i >= p->size) { + int j; + if (p->size == 0) { + p->size = i >= 200 ? 2*i : 200; + p->counts = newarray(p->size, sizeof *p->counts, PERM); + } else { + struct count *new; + p->size = 2*i; + new = newarray(p->size, sizeof *new, PERM); + for (j = 0; j < p->count; j++) + new[j] = p->counts[j]; + p->counts = new; + } + for (j = p->count; j < p->size; j++) { + static struct count z; + p->counts[j] = z; + } + } + if (p->counts[i].x != x || p->counts[i].y != y) + for (i = 0; i < p->count; i++) + if (p->counts[i].x == x && p->counts[i].y == y) + break; + if (i >= p->count) + if (i >= p->size) + apoint(i, file, x, y, count); + else { + p->count = i + 1; + p->counts[i].x = x; + p->counts[i].y = y; + p->counts[i].count = count; + } + else + p->counts[i].count += count; +} + +/* findcount - return count associated with (file,x,y) or -1 */ +int findcount(char *file, int x, int y) { + static struct file *cursor; + + if (cursor == 0 || cursor->name != file) + cursor = findfile(file); + if (cursor) { + int l, u; + struct count *c = cursor->counts; + for (l = 0, u = cursor->count - 1; l <= u; ) { + int k = (l + u)/2; + if (c[k].y > y || (c[k].y == y && c[k].x > x)) + u = k - 1; + else if (c[k].y < y || (c[k].y == y && c[k].x < x)) + l = k + 1; + else + return c[k].count; + } + } + return -1; +} + +/* findfunc - return count associated with function name in file or -1 */ +int findfunc(char *name, char *file) { + static struct file *cursor; + + if (cursor == 0 || cursor->name != file) + cursor = findfile(file); + if (cursor) { + struct func *p; + for (p = cursor->funcs; p; p = p->link) + if (p->name == name) + return p->count.count; + } + return -1; +} + +/* getd - read a nonnegative number */ +static int getd(void) { + int c, n = 0; + + while ((c = getc(fp)) != EOF && (c == ' ' || c == '\n' || c == '\t')) + ; + if (c >= '0' && c <= '9') { + do + n = 10*n + (c - '0'); + while ((c = getc(fp)) >= '0' && c <= '9'); + return n; + } + return -1; +} + +/* getstr - read a string */ +static char *getstr(void) { + int c; + char buf[MAXTOKEN], *s = buf; + + while ((c = getc(fp)) != EOF && c != ' ' && c != '\n' && c != '\t') + if (s - buf < (int)sizeof buf - 2) + *s++ = c; + *s = 0; + return s == buf ? (char *)0 : string(buf); +} + +/* gather - read prof.out data from fd */ +static int gather(void) { + int i, nfiles, nfuncs, npoints; + char *files[64]; + + if ((nfiles = getd()) < 0) + return 0; + assert(nfiles < NELEMS(files)); + for (i = 0; i < nfiles; i++) { + if ((files[i] = getstr()) == 0) + return -1; + if (!findfile(files[i])) { + struct file *new; + NEW(new, PERM); + new->name = files[i]; + new->size = new->count = 0; + new->counts = 0; + new->funcs = 0; + new->link = filelist; + filelist = new; + } + } + if ((nfuncs = getd()) < 0) + return -1; + for (i = 0; i < nfuncs; i++) { + struct func *q; + char *name, *file; + int f, x, y, count; + if ((name = getstr()) == 0 || (f = getd()) <= 0 + || (x = getd()) < 0 || (y = getd()) < 0 || (count = getd()) < 0) + return -1; + q = afunction(name, files[f-1], x, y, count); + if ((name = getstr()) == 0 || (file = getstr()) == 0 + || (x = getd()) < 0 || (y = getd()) < 0) + return -1; + if (*name != '?') + acaller(name, file, x, y, count, q); + } + if ((npoints = getd()) < 0) + return -1; + for (i = 0; i < npoints; i++) { + int f, x, y, count; + if ((f = getd()) < 0 || (x = getd()) < 0 || (y = getd()) < 0 + || (count = getd()) < 0) + return -1; + if (f) + apoint(i, files[f-1], x, y, count); + } + return 1; +} + +/* process - read prof.out data from file */ +int process(char *file) { + int more; + + if ((fp = fopen(file, "r")) != NULL) { + struct file *p; + while ((more = gather()) > 0) + ; + fclose(fp); + if (more < 0) + return more; + for (p = filelist; p; p = p->link) + qsort(p->counts, p->count, sizeof *p->counts, compare); + return 1; + } + return 0; +} diff --git a/src/cmd/lccom-1/simp.c b/src/cmd/lccom-1/simp.c new file mode 100644 index 0000000..b8d6133 --- /dev/null +++ b/src/cmd/lccom-1/simp.c @@ -0,0 +1,614 @@ +#include "c.h" +#include + +#define foldcnst(TYPE,VAR,OP) \ + if (l->op == CNST+TYPE && r->op == CNST+TYPE) \ + return cnsttree(ty, l->u.v.VAR OP r->u.v.VAR) +#define commute(L,R) \ + if (generic(R->op) == CNST && generic(L->op) != CNST) \ + do { Tree t = L; L = R; R = t; } while(0) +#define xfoldcnst(TYPE,VAR,OP,FUNC)\ + if (l->op == CNST+TYPE && r->op == CNST+TYPE\ + && FUNC(l->u.v.VAR,r->u.v.VAR,\ + ty->u.sym->u.limits.min.VAR,\ + ty->u.sym->u.limits.max.VAR, needconst)) \ + return cnsttree(ty, l->u.v.VAR OP r->u.v.VAR) +#define xcvtcnst(FTYPE,SRC,DST,VAR,EXPR) \ + if (l->op == CNST+FTYPE) do {\ + if (!explicitCast\ + && ((SRC) < DST->u.sym->u.limits.min.VAR || (SRC) > DST->u.sym->u.limits.max.VAR))\ + warning("overflow in converting constant expression from `%t' to `%t'\n", l->type, DST);\ + if (needconst\ + || !((SRC) < DST->u.sym->u.limits.min.VAR || (SRC) > DST->u.sym->u.limits.max.VAR))\ + return cnsttree(ty, (EXPR)); } while(0) +#define identity(X,Y,TYPE,VAR,VAL) \ + if (X->op == CNST+TYPE && X->u.v.VAR == VAL) return Y +#define zerofield(OP,TYPE,VAR) \ + if (l->op == FIELD \ + && r->op == CNST+TYPE && r->u.v.VAR == 0)\ + return eqtree(OP, bittree(BAND, l->kids[0],\ + cnsttree(unsignedtype, \ + (unsigned long)fieldmask(l->u.field)<u.field))), r) +#define cfoldcnst(TYPE,VAR,OP) \ + if (l->op == CNST+TYPE && r->op == CNST+TYPE) \ + return cnsttree(inttype, (long)(l->u.v.VAR OP r->u.v.VAR)) +#define foldaddp(L,R,RTYPE,VAR) \ + if (L->op == CNST+P && R->op == CNST+RTYPE) { \ + Tree e = tree(CNST+P, ty, NULL, NULL);\ + e->u.v.p = (char *)L->u.v.p + R->u.v.VAR;\ + return e; } +#define ufoldcnst(TYPE,EXP) if (l->op == CNST+TYPE) return EXP +#define sfoldcnst(OP) \ + if (l->op == CNST+U && r->op == CNST+I \ + && r->u.v.i >= 0 && r->u.v.i < 8*l->type->size) \ + return cnsttree(ty, (unsigned long)(l->u.v.u OP r->u.v.i)) +#define geu(L,R,V) \ + if (R->op == CNST+U && R->u.v.u == 0) do { \ + warning("result of unsigned comparison is constant\n"); \ + return tree(RIGHT, inttype, root(L), cnsttree(inttype, (long)(V))); } while(0) +#define idempotent(OP) if (l->op == OP) return l->kids[0] + +int needconst; +int explicitCast; + +static int addi(long x, long y, long min, long max, int needconst) +{ + int cond = x == 0 + || y == 0 + || (x < 0 && y < 0 && x >= min - y) + || (x < 0 && y > 0) + || (x > 0 && y < 0) + || (x > 0 && y > 0 && x <= max - y); + + if (!cond && needconst) { + warning("overflow in constant expression\n"); + cond = 1; + } + return cond; + + +} + +static int addd(double x, double y, double min, double max, int needconst) +{ + int cond = x == 0 + || y == 0 + || (x < 0 && y < 0 && x >= min - y) + || (x < 0 && y > 0) + || (x > 0 && y < 0) + || (x > 0 && y > 0 && x <= max - y); + + if (!cond && needconst) { + warning("overflow in constant expression\n"); + cond = 1; + } + return cond; + + +} + +static Tree addrtree(Tree e, long n, Type ty) { + Symbol p = e->u.sym, q; + + if (p->scope == GLOBAL + || p->sclass == STATIC || p->sclass == EXTERN) + NEW0(q, PERM); + else + NEW0(q, FUNC); + q->name = stringd(genlabel(1)); + q->sclass = p->sclass; + q->scope = p->scope; + assert(isptr(ty) || isarray(ty)); + q->type = isptr(ty) ? ty->type : ty; + q->temporary = p->temporary; + q->generated = p->generated; + q->addressed = p->addressed; + q->computed = 1; + q->defined = 1; + q->ref = 1; + assert(IR->address); + if (p->scope == GLOBAL + || p->sclass == STATIC || p->sclass == EXTERN) { + if (p->sclass == AUTO) + q->sclass = STATIC; + (*IR->address)(q, p, n); + } else { + Code cp; + addlocal(p); + cp = code(Address); + cp->u.addr.sym = q; + cp->u.addr.base = p; + cp->u.addr.offset = n; + } + e = tree(e->op, ty, NULL, NULL); + e->u.sym = q; + return e; +} + +/* div[id] - return 1 if min <= x/y <= max, 0 otherwise */ +static int divi(long x, long y, long min, long max, int needconst) { + int cond = y != 0 && !(x == min && y == -1); + if (!cond && needconst) { + warning("overflow in constant expression\n"); + cond = 1; + } + return cond; + + +} + +static int divd(double x, double y, double min, double max, int needconst) { + int cond; + + if (x < 0) x = -x; + if (y < 0) y = -y; + cond = y != 0 && !(y < 1 && x > max*y); + if (!cond && needconst) { + warning("overflow in constant expression\n"); + cond = 1; + } + return cond; + +} + +/* mul[id] - return 1 if min <= x*y <= max, 0 otherwise */ +static int muli(long x, long y, long min, long max, int needconst) +{ + int cond = (x > -1 && x <= 1) + || (y > -1 && y <= 1) + || (x < 0 && y < 0 && -x <= max/-y) + || (x < 0 && y > 0 && x >= min/y) + || (x > 0 && y < 0 && y >= min/x) + || (x > 0 && y > 0 && x <= max/y); + + if (! cond && needconst) { + warning("overflow in constant expression\n"); + cond = 1; + } + return cond; +} + +static int muld(double x, double y, double min, double max, int needconst) +{ + int cond = ((x >= -1 && x <= 1) + || (y >= -1 && y <= 1) + || (x < 0 && y < 0 && -x <= max/-y) + || (x < 0 && y > 0 && x >= min/y) + || (x > 0 && y < 0 && y >= min/x) + || (x > 0 && y > 0 && x <= max/y)); + + if (! cond && needconst) { + warning("overflow in constant expression\n"); + cond = 1; + } + return cond; + + +} +/* sub[id] - return 1 if min <= x-y <= max, 0 otherwise */ +static int subi(long x, long y, long min, long max, int needconst) { + return addi(x, -y, min, max, needconst); +} + +static int subd(double x, double y, double min, double max, int needconst) { + return addd(x, -y, min, max, needconst); +} +Tree constexpr(int tok) { + Tree p; + + needconst++; + p = expr1(tok); + needconst--; + return p; +} + +int intexpr(int tok, int n) { + Tree p = constexpr(tok); + + needconst++; + if (p->op == CNST+I || p->op == CNST+U) + n = cast(p, inttype)->u.v.i; + else + error("integer expression must be constant\n"); + needconst--; + return n; +} + +Tree simplify(int op, Type ty, Tree l, Tree r) +{ + int n; + + if (optype(op) == 0) + op = mkop(op, ty); + switch (op) { + case ADD+U: + foldcnst(U,u,+); + commute(r,l); + identity(r,l,U,u,0); + break; + case ADD+I: + xfoldcnst(I,i,+,addi); + commute(r,l); + identity(r,l,I,i,0); + break; + case CVI+I: + xcvtcnst(I,l->u.v.i,ty,i,(long)extend(l->u.v.i,ty)); + break; + case CVU+I: + if (l->op == CNST+U) { + if (!explicitCast && l->u.v.u > ty->u.sym->u.limits.max.i) + warning("overflow in converting constant expression from `%t' to `%t'\n", l->type, ty); + if (needconst || !(l->u.v.u > ty->u.sym->u.limits.max.i)) + return cnsttree(ty, (long)extend(l->u.v.u,ty)); + } + break; + case CVP+U: + xcvtcnst(P,(unsigned long)l->u.v.p,ty,u,(unsigned long)l->u.v.p); + break; + case CVU+P: + xcvtcnst(U,(void*)l->u.v.u,ty,p,(void*)l->u.v.u); + break; + case CVP+P: + xcvtcnst(P,l->u.v.p,ty,p,l->u.v.p); + break; + case CVI+U: + xcvtcnst(I,l->u.v.i,ty,u,((unsigned long)l->u.v.i)&ones(8*ty->size)); + break; + case CVU+U: + xcvtcnst(U,l->u.v.u,ty,u,l->u.v.u&ones(8*ty->size)); + break; + + case CVI+F: + xcvtcnst(I,l->u.v.i,ty,d,(long double)l->u.v.i); + case CVU+F: + xcvtcnst(U,l->u.v.u,ty,d,(long double)l->u.v.u); + break; + case CVF+I: + xcvtcnst(F,l->u.v.d,ty,i,(long)l->u.v.d); + break; + case CVF+F: { + float d; + if (l->op == CNST+F) { + if (l->u.v.d < ty->u.sym->u.limits.min.d) + d = ty->u.sym->u.limits.min.d; + else if (l->u.v.d > ty->u.sym->u.limits.max.d) + d = ty->u.sym->u.limits.max.d; + else + d = l->u.v.d; + } + xcvtcnst(F,l->u.v.d,ty,d,(long double)d); + break; + } + case BAND+U: + foldcnst(U,u,&); + commute(r,l); + identity(r,l,U,u,ones(8*ty->size)); + if (r->op == CNST+U && r->u.v.u == 0) + return tree(RIGHT, ty, root(l), cnsttree(ty, 0UL)); + break; + case BAND+I: + foldcnst(I,i,&); + commute(r,l); + identity(r,l,I,i,ones(8*ty->size)); + if (r->op == CNST+I && r->u.v.u == 0) + return tree(RIGHT, ty, root(l), cnsttree(ty, 0L)); + break; + + case MUL+U: + commute(l,r); + if (l->op == CNST+U && (n = ispow2(l->u.v.u)) != 0) + return simplify(LSH, ty, r, cnsttree(inttype, (long)n)); + foldcnst(U,u,*); + identity(r,l,U,u,1); + break; + case NE+I: + cfoldcnst(I,i,!=); + commute(r,l); + zerofield(NE,I,i); + break; + + case EQ+I: + cfoldcnst(I,i,==); + commute(r,l); + zerofield(EQ,I,i); + break; + case ADD+P: + foldaddp(l,r,I,i); + foldaddp(l,r,U,u); + foldaddp(r,l,I,i); + foldaddp(r,l,U,u); + commute(r,l); + identity(r,retype(l,ty),I,i,0); + identity(r,retype(l,ty),U,u,0); + /* + Some assemblers, e.g., the MIPS, can't handle offsets + larger than 16 bits. A better solution would be to change + the interface so that address() could fail. + */ + if (l->op == ADDRG+P && l->u.sym->generated + && ((r->op == CNST+I && (r->u.v.i > 32767 || r->u.v.i < -32768)) + || (r->op == CNST+U && r->u.v.u > 65536))) + break; + if (IR->address + && isaddrop(l->op) + && ((r->op == CNST+I && r->u.v.i <= longtype->u.sym->u.limits.max.i + && r->u.v.i >= longtype->u.sym->u.limits.min.i) + || (r->op == CNST+U && r->u.v.u <= longtype->u.sym->u.limits.max.i))) + return addrtree(l, cast(r, longtype)->u.v.i, ty); + if (IR->address + && l->op == ADD+P && isaddrop(l->kids[1]->op) + && ((r->op == CNST+I && r->u.v.i <= longtype->u.sym->u.limits.max.i + && r->u.v.i >= longtype->u.sym->u.limits.min.i) + || (r->op == CNST+U && r->u.v.u <= longtype->u.sym->u.limits.max.i))) + return simplify(ADD+P, ty, l->kids[0], + addrtree(l->kids[1], cast(r, longtype)->u.v.i, ty)); + if ((l->op == ADD+I || l->op == SUB+I) + && l->kids[1]->op == CNST+I && isaddrop(r->op)) + return simplify(ADD+P, ty, l->kids[0], + simplify(generic(l->op)+P, ty, r, l->kids[1])); + if (l->op == ADD+P && generic(l->kids[1]->op) == CNST + && generic(r->op) == CNST) + return simplify(ADD+P, ty, l->kids[0], + simplify(ADD, l->kids[1]->type, l->kids[1], r)); + if (l->op == ADD+I && generic(l->kids[1]->op) == CNST + && r->op == ADD+P && generic(r->kids[1]->op) == CNST) + return simplify(ADD+P, ty, l->kids[0], + simplify(ADD+P, ty, r->kids[0], + simplify(ADD, r->kids[1]->type, l->kids[1], r->kids[1]))); + if (l->op == RIGHT && l->kids[1]) + return tree(RIGHT, ty, l->kids[0], + simplify(ADD+P, ty, l->kids[1], r)); + else if (l->op == RIGHT && l->kids[0]) + return tree(RIGHT, ty, + simplify(ADD+P, ty, l->kids[0], r), NULL); + break; + + case ADD+F: + xfoldcnst(F,d,+,addd); + commute(r,l); + break; + case AND+I: + op = AND; + ufoldcnst(I,l->u.v.i ? cond(r) : l); /* 0&&r => 0, 1&&r => r */ + break; + case OR+I: + op = OR; + /* 0||r => r, 1||r => 1 */ + ufoldcnst(I,l->u.v.i ? cnsttree(ty, 1L) : cond(r)); + break; + case BCOM+I: + ufoldcnst(I,cnsttree(ty, (long)extend((~l->u.v.i)&ones(8*ty->size), ty))); + idempotent(BCOM+U); + break; + case BCOM+U: + ufoldcnst(U,cnsttree(ty, (unsigned long)((~l->u.v.u)&ones(8*ty->size)))); + idempotent(BCOM+U); + break; + case BOR+U: + foldcnst(U,u,|); + commute(r,l); + identity(r,l,U,u,0); + break; + case BOR+I: + foldcnst(I,i,|); + commute(r,l); + identity(r,l,I,i,0); + break; + case BXOR+U: + foldcnst(U,u,^); + commute(r,l); + identity(r,l,U,u,0); + break; + case BXOR+I: + foldcnst(I,i,^); + commute(r,l); + identity(r,l,I,i,0); + break; + case DIV+F: + xfoldcnst(F,d,/,divd); + break; + case DIV+I: + identity(r,l,I,i,1); + if ((r->op == CNST+I && r->u.v.i == 0) + || (l->op == CNST+I && l->u.v.i == ty->u.sym->u.limits.min.i + && r->op == CNST+I && r->u.v.i == -1)) + break; + xfoldcnst(I,i,/,divi); + break; + case DIV+U: + identity(r,l,U,u,1); + if (r->op == CNST+U && r->u.v.u == 0) + break; + if (r->op == CNST+U && (n = ispow2(r->u.v.u)) != 0) + return simplify(RSH, ty, l, cnsttree(inttype, (long)n)); + foldcnst(U,u,/); + break; + case EQ+F: + cfoldcnst(F,d,==); + commute(r,l); + break; + case EQ+U: + cfoldcnst(U,u,==); + commute(r,l); + zerofield(EQ,U,u); + break; + case GE+F: cfoldcnst(F,d,>=); break; + case GE+I: cfoldcnst(I,i,>=); break; + case GE+U: + geu(l,r,1); /* l >= 0 => (l,1) */ + cfoldcnst(U,u,>=); + if (l->op == CNST+U && l->u.v.u == 0) /* 0 >= r => r == 0 */ + return eqtree(EQ, r, l); + break; + case GT+F: cfoldcnst(F,d, >); break; + case GT+I: cfoldcnst(I,i, >); break; + case GT+U: + geu(r,l,0); /* 0 > r => (r,0) */ + cfoldcnst(U,u, >); + if (r->op == CNST+U && r->u.v.u == 0) /* l > 0 => l != 0 */ + return eqtree(NE, l, r); + break; + case LE+F: cfoldcnst(F,d,<=); break; + case LE+I: cfoldcnst(I,i,<=); break; + case LE+U: + geu(r,l,1); /* 0 <= r => (r,1) */ + cfoldcnst(U,u,<=); + if (r->op == CNST+U && r->u.v.u == 0) /* l <= 0 => l == 0 */ + return eqtree(EQ, l, r); + break; + case LSH+I: + identity(r,l,I,i,0); + if (l->op == CNST+I && r->op == CNST+I + && r->u.v.i >= 0 && r->u.v.i < 8*l->type->size + && muli(l->u.v.i, 1<u.v.i, ty->u.sym->u.limits.min.i, ty->u.sym->u.limits.max.i, needconst)) + return cnsttree(ty, (long)(l->u.v.i<u.v.i)); + if (r->op == CNST+I && (r->u.v.i >= 8*ty->size || r->u.v.i < 0)) { + warning("shifting an `%t' by %d bits is undefined\n", ty, r->u.v.i); + break; + } + + break; + case LSH+U: + identity(r,l,I,i,0); + sfoldcnst(<<); + if (r->op == CNST+I && (r->u.v.i >= 8*ty->size || r->u.v.i < 0)) { + warning("shifting an `%t' by %d bits is undefined\n", ty, r->u.v.i); + break; + } + + break; + + case LT+F: cfoldcnst(F,d, <); break; + case LT+I: cfoldcnst(I,i, <); break; + case LT+U: + geu(l,r,0); /* l < 0 => (l,0) */ + cfoldcnst(U,u, <); + if (l->op == CNST+U && l->u.v.u == 0) /* 0 < r => r != 0 */ + return eqtree(NE, r, l); + break; + case MOD+I: + if ((r->op == CNST+I && r->u.v.i == 0) + || (l->op == CNST+I && l->u.v.i == ty->u.sym->u.limits.min.i + && r->op == CNST+I && r->u.v.i == -1)) + break; + xfoldcnst(I,i,%,divi); + if (r->op == CNST+I && r->u.v.i == 1) /* l%1 => (l,0) */ + return tree(RIGHT, ty, root(l), cnsttree(ty, 0L)); + break; + case MOD+U: + if (r->op == CNST+U && ispow2(r->u.v.u)) /* l%2^n => l&(2^n-1) */ + return bittree(BAND, l, cnsttree(ty, r->u.v.u - 1)); + if (r->op == CNST+U && r->u.v.u == 0) + break; + foldcnst(U,u,%); + break; + case MUL+F: + xfoldcnst(F,d,*,muld); + commute(l,r); + break; + case MUL+I: + commute(l,r); + xfoldcnst(I,i,*,muli); + if (l->op == CNST+I && r->op == ADD+I && r->kids[1]->op == CNST+I) + /* c1*(x + c2) => c1*x + c1*c2 */ + return simplify(ADD, ty, simplify(MUL, ty, l, r->kids[0]), + simplify(MUL, ty, l, r->kids[1])); + if (l->op == CNST+I && r->op == SUB+I && r->kids[1]->op == CNST+I) + /* c1*(x - c2) => c1*x - c1*c2 */ + return simplify(SUB, ty, simplify(MUL, ty, l, r->kids[0]), + simplify(MUL, ty, l, r->kids[1])); + if (l->op == CNST+I && l->u.v.i > 0 && (n = ispow2(l->u.v.i)) != 0) + /* 2^n * r => r<u.v.d)); + idempotent(NEG+F); + break; + case NEG+I: + if (l->op == CNST+I) { + if (needconst && l->u.v.i == ty->u.sym->u.limits.min.i) + warning("overflow in constant expression\n"); + if (needconst || l->u.v.i != ty->u.sym->u.limits.min.i) + return cnsttree(ty, -l->u.v.i); + } + idempotent(NEG+I); + break; + case NOT+I: + op = NOT; + ufoldcnst(I,cnsttree(ty, !l->u.v.i)); + break; + case RSH+I: + identity(r,l,I,i,0); + if (l->op == CNST+I && r->op == CNST+I + && r->u.v.i >= 0 && r->u.v.i < 8*l->type->size) { + long n = l->u.v.i>>r->u.v.i; + if (l->u.v.i < 0) + n |= ~0UL<<(8*l->type->size - r->u.v.i); + return cnsttree(ty, n); + } + if (r->op == CNST+I && (r->u.v.i >= 8*ty->size || r->u.v.i < 0)) { + warning("shifting an `%t' by %d bits is undefined\n", ty, r->u.v.i); + break; + } + + break; + case RSH+U: + identity(r,l,I,i,0); + sfoldcnst(>>); + if (r->op == CNST+I && (r->u.v.i >= 8*ty->size || r->u.v.i < 0)) { + warning("shifting an `%t' by %d bits is undefined\n", ty, r->u.v.i); + break; + } + + break; + case SUB+F: + xfoldcnst(F,d,-,subd); + break; + case SUB+I: + xfoldcnst(I,i,-,subi); + identity(r,l,I,i,0); + break; + case SUB+U: + foldcnst(U,u,-); + identity(r,l,U,u,0); + break; + case SUB+P: + if (l->op == CNST+P && r->op == CNST+P) + return cnsttree(ty, (long)((char *)l->u.v.p - (char *)r->u.v.p)); + if (r->op == CNST+I || r->op == CNST+U) + return simplify(ADD, ty, l, + cnsttree(inttype, r->op == CNST+I ? -r->u.v.i : -(long)r->u.v.u)); + if (isaddrop(l->op) && r->op == ADD+I && r->kids[1]->op == CNST+I) + /* l - (x + c) => l-c - x */ + return simplify(SUB, ty, + simplify(SUB, ty, l, r->kids[1]), r->kids[0]); + break; + default:assert(0); + } + return tree(op, ty, l, r); +} + +/* + * ispow2 - if u > 1 && u == 2^n, return n, otherwise return 0 + */ +int ispow2(unsigned long u) +{ + int n; + + if (u > 1 && (u&(u-1)) == 0) + for (n = 0; u; u >>= 1, n++) + if (u&1) + return n; + return 0; +} diff --git a/src/cmd/lccom-1/sparc.md b/src/cmd/lccom-1/sparc.md new file mode 100644 index 0000000..ebd3150 --- /dev/null +++ b/src/cmd/lccom-1/sparc.md @@ -0,0 +1,1176 @@ +%{ +#include "c.h" +#define NODEPTR_TYPE Node +#define OP_LABEL(p) ((p)->op) +#define LEFT_CHILD(p) ((p)->kids[0]) +#define RIGHT_CHILD(p) ((p)->kids[1]) +#define STATE_LABEL(p) ((p)->x.state) +static void address(Symbol, Symbol, long); +static void blkfetch(int, int, int, int); +static void blkloop(int, int, int, int, int, int[]); +static void blkstore(int, int, int, int); +static void defaddress(Symbol); +static void defconst(int, int, Value); +static void defstring(int, char *); +static void defsymbol(Symbol); +static void doarg(Node); +static void emit2(Node); +static void export(Symbol); +static void clobber(Node); +static void function(Symbol, Symbol [], Symbol [], int); +static void global(Symbol); +static void import(Symbol); +static void local(Symbol); +static void progbeg(int, char **); +static void progend(void); +static void segment(int); +static void space(int); +static void target(Node); +static int imm(Node); +static void renameregs(void); +extern Interface sparcIR, solarisIR; +static void defsymbol2(Symbol); +static void export2(Symbol); +static void globalend(void); +static void global2(Symbol); +static void segment2(int); +static void progend2(void); + +extern char *stabprefix; +extern void stabblock(int, int, Symbol*); +extern void stabend(Coordinate *, Symbol, Coordinate **, Symbol *, Symbol *); +extern void stabfend(Symbol, int); +extern void stabinit(char *, int, char *[]); +extern void stabline(Coordinate *); +extern void stabsym(Symbol); +extern void stabtype(Symbol); +static Symbol greg[32], gregw; +static Symbol *oreg = &greg[8], *ireg = &greg[24]; +static Symbol freg[32], freg2[32]; +static Symbol fregw, freg2w; + +static int regvars; +static int retstruct; + +static int pflag = 0; + +static int cseg; + +%} +%start stmt +%term CNSTF4=4113 +%term CNSTF8=8209 +%term CNSTF16=16401 +%term CNSTI1=1045 +%term CNSTI2=2069 +%term CNSTI4=4117 +%term CNSTI8=8213 +%term CNSTP4=4119 +%term CNSTP8=8215 +%term CNSTU1=1046 +%term CNSTU2=2070 +%term CNSTU4=4118 +%term CNSTU8=8214 + +%term ARGB=41 +%term ARGF4=4129 +%term ARGF8=8225 +%term ARGF16=16417 +%term ARGI4=4133 +%term ARGI8=8229 +%term ARGP4=4135 +%term ARGP8=8231 +%term ARGU4=4134 +%term ARGU8=8230 + +%term ASGNB=57 +%term ASGNF4=4145 +%term ASGNF8=8241 +%term ASGNF16=16433 +%term ASGNI1=1077 +%term ASGNI2=2101 +%term ASGNI4=4149 +%term ASGNI8=8245 +%term ASGNP4=4151 +%term ASGNP8=8247 +%term ASGNU1=1078 +%term ASGNU2=2102 +%term ASGNU4=4150 +%term ASGNU8=8246 + +%term INDIRB=73 +%term INDIRF4=4161 +%term INDIRF8=8257 +%term INDIRF16=16449 +%term INDIRI1=1093 +%term INDIRI2=2117 +%term INDIRI4=4165 +%term INDIRI8=8261 +%term INDIRP4=4167 +%term INDIRP8=8263 +%term INDIRU1=1094 +%term INDIRU2=2118 +%term INDIRU4=4166 +%term INDIRU8=8262 + +%term CVFF4=4209 +%term CVFF8=8305 +%term CVFF16=16497 +%term CVFI4=4213 +%term CVFI8=8309 + +%term CVIF4=4225 +%term CVIF8=8321 +%term CVIF16=16513 +%term CVII1=1157 +%term CVII2=2181 +%term CVII4=4229 +%term CVII8=8325 +%term CVIU1=1158 +%term CVIU2=2182 +%term CVIU4=4230 +%term CVIU8=8326 + +%term CVPP4=4247 +%term CVPP8=8343 +%term CVPP16=16535 +%term CVPU4=4246 +%term CVPU8=8342 + +%term CVUI1=1205 +%term CVUI2=2229 +%term CVUI4=4277 +%term CVUI8=8373 +%term CVUP4=4279 +%term CVUP8=8375 +%term CVUP16=16567 +%term CVUU1=1206 +%term CVUU2=2230 +%term CVUU4=4278 +%term CVUU8=8374 + +%term NEGF4=4289 +%term NEGF8=8385 +%term NEGF16=16577 +%term NEGI4=4293 +%term NEGI8=8389 + +%term CALLB=217 +%term CALLF4=4305 +%term CALLF8=8401 +%term CALLF16=16593 +%term CALLI4=4309 +%term CALLI8=8405 +%term CALLP4=4311 +%term CALLP8=8407 +%term CALLU4=4310 +%term CALLU8=8406 +%term CALLV=216 + +%term RETF4=4337 +%term RETF8=8433 +%term RETF16=16625 +%term RETI4=4341 +%term RETI8=8437 +%term RETP4=4343 +%term RETP8=8439 +%term RETU4=4342 +%term RETU8=8438 +%term RETV=248 + +%term ADDRGP4=4359 +%term ADDRGP8=8455 + +%term ADDRFP4=4375 +%term ADDRFP8=8471 + +%term ADDRLP4=4391 +%term ADDRLP8=8487 + +%term ADDF4=4401 +%term ADDF8=8497 +%term ADDF16=16689 +%term ADDI4=4405 +%term ADDI8=8501 +%term ADDP4=4407 +%term ADDP8=8503 +%term ADDU4=4406 +%term ADDU8=8502 + +%term SUBF4=4417 +%term SUBF8=8513 +%term SUBF16=16705 +%term SUBI4=4421 +%term SUBI8=8517 +%term SUBP4=4423 +%term SUBP8=8519 +%term SUBU4=4422 +%term SUBU8=8518 + +%term LSHI4=4437 +%term LSHI8=8533 +%term LSHU4=4438 +%term LSHU8=8534 + +%term MODI4=4453 +%term MODI8=8549 +%term MODU4=4454 +%term MODU8=8550 + +%term RSHI4=4469 +%term RSHI8=8565 +%term RSHU4=4470 +%term RSHU8=8566 + +%term BANDI4=4485 +%term BANDI8=8581 +%term BANDU4=4486 +%term BANDU8=8582 + +%term BCOMI4=4501 +%term BCOMI8=8597 +%term BCOMU4=4502 +%term BCOMU8=8598 + +%term BORI4=4517 +%term BORI8=8613 +%term BORU4=4518 +%term BORU8=8614 + +%term BXORI4=4533 +%term BXORI8=8629 +%term BXORU4=4534 +%term BXORU8=8630 + +%term DIVF4=4545 +%term DIVF8=8641 +%term DIVF16=16833 +%term DIVI4=4549 +%term DIVI8=8645 +%term DIVU4=4550 +%term DIVU8=8646 + +%term MULF4=4561 +%term MULF8=8657 +%term MULF16=16849 +%term MULI4=4565 +%term MULI8=8661 +%term MULU4=4566 +%term MULU8=8662 + +%term EQF4=4577 +%term EQF8=8673 +%term EQF16=16865 +%term EQI4=4581 +%term EQI8=8677 +%term EQU4=4582 +%term EQU8=8678 + +%term GEF4=4593 +%term GEF8=8689 +%term GEI4=4597 +%term GEI8=8693 +%term GEI16=16885 +%term GEU4=4598 +%term GEU8=8694 + +%term GTF4=4609 +%term GTF8=8705 +%term GTF16=16897 +%term GTI4=4613 +%term GTI8=8709 +%term GTU4=4614 +%term GTU8=8710 + +%term LEF4=4625 +%term LEF8=8721 +%term LEF16=16913 +%term LEI4=4629 +%term LEI8=8725 +%term LEU4=4630 +%term LEU8=8726 + +%term LTF4=4641 +%term LTF8=8737 +%term LTF16=16929 +%term LTI4=4645 +%term LTI8=8741 +%term LTU4=4646 +%term LTU8=8742 + +%term NEF4=4657 +%term NEF8=8753 +%term NEF16=16945 +%term NEI4=4661 +%term NEI8=8757 +%term NEU4=4662 +%term NEU8=8758 + +%term JUMPV=584 + +%term LABELV=600 + +%term LOADB=233 +%term LOADF4=4321 +%term LOADF8=8417 +%term LOADF16=16609 +%term LOADI1=1253 +%term LOADI2=2277 +%term LOADI4=4325 +%term LOADI8=8421 +%term LOADP4=4327 +%term LOADP8=8423 +%term LOADU1=1254 +%term LOADU2=2278 +%term LOADU4=4326 +%term LOADU8=8422 + +%term VREGP=711 +%% +reg: INDIRI1(VREGP) "# read register\n" +reg: INDIRU1(VREGP) "# read register\n" + +reg: INDIRI2(VREGP) "# read register\n" +reg: INDIRU2(VREGP) "# read register\n" + +reg: INDIRF4(VREGP) "# read register\n" +reg: INDIRI4(VREGP) "# read register\n" +reg: INDIRP4(VREGP) "# read register\n" +reg: INDIRU4(VREGP) "# read register\n" + +reg: INDIRF8(VREGP) "# read register\n" +reg: INDIRI8(VREGP) "# read register\n" +reg: INDIRP8(VREGP) "# read register\n" +reg: INDIRU8(VREGP) "# read register\n" + +stmt: ASGNI1(VREGP,reg) "# write register\n" +stmt: ASGNU1(VREGP,reg) "# write register\n" + +stmt: ASGNI2(VREGP,reg) "# write register\n" +stmt: ASGNU2(VREGP,reg) "# write register\n" + +stmt: ASGNF4(VREGP,reg) "# write register\n" +stmt: ASGNI4(VREGP,reg) "# write register\n" +stmt: ASGNP4(VREGP,reg) "# write register\n" +stmt: ASGNU4(VREGP,reg) "# write register\n" + +stmt: ASGNF8(VREGP,reg) "# write register\n" +stmt: ASGNI8(VREGP,reg) "# write register\n" +stmt: ASGNP8(VREGP,reg) "# write register\n" +stmt: ASGNU8(VREGP,reg) "# write register\n" +con: CNSTI1 "%a" +con: CNSTU1 "%a" + +con: CNSTI2 "%a" +con: CNSTU2 "%a" + +con: CNSTI4 "%a" +con: CNSTU4 "%a" +con: CNSTP4 "%a" + +con: CNSTI8 "%a" +con: CNSTU8 "%a" +con: CNSTP8 "%a" +stmt: reg "" +reg: ADDRGP4 "set %a,%%%c\n" 1 +stk13: ADDRFP4 "%a" imm(a) +stk13: ADDRLP4 "%a" imm(a) +reg: stk13 "add %0,%%fp,%%%c\n" 1 +stk: ADDRFP4 "set %a,%%%c\n" 2 +stk: ADDRLP4 "set %a,%%%c\n" 2 +reg: ADDRFP4 "set %a,%%%c\nadd %%%c,%%fp,%%%c\n" 3 +reg: ADDRLP4 "set %a,%%%c\nadd %%%c,%%fp,%%%c\n" 3 +con13: CNSTI1 "%a" imm(a) +con13: CNSTI2 "%a" imm(a) +con13: CNSTI4 "%a" imm(a) +con13: CNSTU1 "%a" imm(a) +con13: CNSTU2 "%a" imm(a) +con13: CNSTU4 "%a" imm(a) +con13: CNSTP4 "%a" imm(a) +base: ADDI4(reg,con13) "%%%0+%1" +base: ADDP4(reg,con13) "%%%0+%1" +base: ADDU4(reg,con13) "%%%0+%1" +base: reg "%%%0" +base: con13 "%0" +base: stk13 "%%fp+%0" +addr: base "%0" +addr: ADDI4(reg,reg) "%%%0+%%%1" +addr: ADDP4(reg,reg) "%%%0+%%%1" +addr: ADDU4(reg,reg) "%%%0+%%%1" +addr: stk "%%fp+%%%0" +reg: INDIRI1(addr) "ldsb [%0],%%%c\n" 1 +reg: INDIRI2(addr) "ldsh [%0],%%%c\n" 1 +reg: INDIRI4(addr) "ld [%0],%%%c\n" 1 +reg: INDIRU1(addr) "ldub [%0],%%%c\n" 1 +reg: INDIRU2(addr) "lduh [%0],%%%c\n" 1 +reg: INDIRU4(addr) "ld [%0],%%%c\n" 1 +reg: INDIRP4(addr) "ld [%0],%%%c\n" 1 +reg: INDIRF4(addr) "ld [%0],%%f%c\n" 1 +stmt: ASGNI1(addr,reg) "stb %%%1,[%0]\n" 1 +stmt: ASGNI2(addr,reg) "sth %%%1,[%0]\n" 1 +stmt: ASGNI4(addr,reg) "st %%%1,[%0]\n" 1 +stmt: ASGNU1(addr,reg) "stb %%%1,[%0]\n" 1 +stmt: ASGNU2(addr,reg) "sth %%%1,[%0]\n" 1 +stmt: ASGNU4(addr,reg) "st %%%1,[%0]\n" 1 +stmt: ASGNP4(addr,reg) "st %%%1,[%0]\n" 1 +stmt: ASGNF4(addr,reg) "st %%f%1,[%0]\n" 1 +addrl: ADDRLP4 "%%%fp+%a" imm(a) + +reg: INDIRF8(addrl) "ldd [%0],%%f%c\n" 1 +stmt: ASGNF8(addrl,reg) "std %%f%1,[%0]\n" 1 +reg: INDIRF8(base) "# ld2 [%0],%%f%c\n" 2 +stmt: ASGNF8(base,reg) "# st2 %%f%1,[%0]\n" 2 +spill: ADDRLP4 "%a" !imm(a) + +stmt: ASGNI1(spill,reg) "set %0,%%g1\nstb %%%1,[%%fp+%%g1]\n" +stmt: ASGNI2(spill,reg) "set %0,%%g1\nsth %%%1,[%%fp+%%g1]\n" +stmt: ASGNI4(spill,reg) "set %0,%%g1\nst %%%1,[%%fp+%%g1]\n" +stmt: ASGNU1(spill,reg) "set %0,%%g1\nstb %%%1,[%%fp+%%g1]\n" +stmt: ASGNU2(spill,reg) "set %0,%%g1\nsth %%%1,[%%fp+%%g1]\n" +stmt: ASGNU4(spill,reg) "set %0,%%g1\nst %%%1,[%%fp+%%g1]\n" +stmt: ASGNP4(spill,reg) "set %0,%%g1\nst %%%1,[%%fp+%%g1]\n" +stmt: ASGNF4(spill,reg) "set %0,%%g1\nst %%f%1,[%%fp+%%g1]\n" +stmt: ASGNF8(spill,reg) "set %0,%%g1\nstd %%f%1,[%%fp+%%g1]\n" +reg: CVII4(INDIRI1(addr)) "ldsb [%0],%%%c\n" 1 +reg: CVII4(INDIRI2(addr)) "ldsh [%0],%%%c\n" 1 +reg: CVUU4(INDIRU1(addr)) "ldub [%0],%%%c\n" 1 +reg: CVUU4(INDIRU2(addr)) "lduh [%0],%%%c\n" 1 +reg: CVUI4(INDIRU1(addr)) "ldub [%0],%%%c\n" 1 +reg: CVUI4(INDIRU2(addr)) "lduh [%0],%%%c\n" 1 +reg: LOADI1(reg) "mov %%%0,%%%c\n" move(a) +reg: LOADI2(reg) "mov %%%0,%%%c\n" move(a) +reg: LOADI4(reg) "mov %%%0,%%%c\n" move(a) +reg: LOADP4(reg) "mov %%%0,%%%c\n" move(a) +reg: LOADU1(reg) "mov %%%0,%%%c\n" move(a) +reg: LOADU2(reg) "mov %%%0,%%%c\n" move(a) +reg: LOADU4(reg) "mov %%%0,%%%c\n" move(a) +reg: CNSTI1 "# reg\n" range(a, 0, 0) +reg: CNSTI2 "# reg\n" range(a, 0, 0) +reg: CNSTI4 "# reg\n" range(a, 0, 0) +reg: CNSTP4 "# reg\n" range(a, 0, 0) +reg: CNSTU1 "# reg\n" range(a, 0, 0) +reg: CNSTU2 "# reg\n" range(a, 0, 0) +reg: CNSTU4 "# reg\n" range(a, 0, 0) +reg: con "set %0,%%%c\n" 1 +rc: con13 "%0" +rc: reg "%%%0" +reg: ADDI4(reg,rc) "add %%%0,%1,%%%c\n" 1 +reg: ADDP4(reg,rc) "add %%%0,%1,%%%c\n" 1 +reg: ADDU4(reg,rc) "add %%%0,%1,%%%c\n" 1 +reg: BANDI4(reg,rc) "and %%%0,%1,%%%c\n" 1 +reg: BORI4(reg,rc) "or %%%0,%1,%%%c\n" 1 +reg: BXORI4(reg,rc) "xor %%%0,%1,%%%c\n" 1 +reg: BANDU4(reg,rc) "and %%%0,%1,%%%c\n" 1 +reg: BORU4(reg,rc) "or %%%0,%1,%%%c\n" 1 +reg: BXORU4(reg,rc) "xor %%%0,%1,%%%c\n" 1 +reg: SUBI4(reg,rc) "sub %%%0,%1,%%%c\n" 1 +reg: SUBP4(reg,rc) "sub %%%0,%1,%%%c\n" 1 +reg: SUBU4(reg,rc) "sub %%%0,%1,%%%c\n" 1 +rc5: CNSTI4 "%a" range(a, 0, 31) +rc5: reg "%%%0" +reg: LSHI4(reg,rc5) "sll %%%0,%1,%%%c\n" 1 +reg: LSHU4(reg,rc5) "sll %%%0,%1,%%%c\n" 1 +reg: RSHI4(reg,rc5) "sra %%%0,%1,%%%c\n" 1 +reg: RSHU4(reg,rc5) "srl %%%0,%1,%%%c\n" 1 +reg: BANDI4(reg,BCOMI4(rc)) "andn %%%0,%1,%%%c\n" 1 +reg: BORI4(reg,BCOMI4(rc)) "orn %%%0,%1,%%%c\n" 1 +reg: BXORI4(reg,BCOMI4(rc)) "xnor %%%0,%1,%%%c\n" 1 +reg: BANDU4(reg,BCOMU4(rc)) "andn %%%0,%1,%%%c\n" 1 +reg: BORU4(reg,BCOMU4(rc)) "orn %%%0,%1,%%%c\n" 1 +reg: BXORU4(reg,BCOMU4(rc)) "xnor %%%0,%1,%%%c\n" 1 +reg: NEGI4(reg) "neg %%%0,%%%c\n" 1 +reg: BCOMI4(reg) "not %%%0,%%%c\n" 1 +reg: BCOMU4(reg) "not %%%0,%%%c\n" 1 +reg: CVII4(reg) "sll %%%0,8*(4-%a),%%%c; sra %%%c,8*(4-%a),%%%c\n" 2 +reg: CVUU4(reg) "sll %%%0,8*(4-%a),%%%c; srl %%%c,8*(4-%a),%%%c\n" 2 +reg: CVUU4(reg) "and %%%0,0xff,%%%c\n" (a->syms[0]->u.c.v.i == 1 ? 1 : LBURG_MAX) +reg: CVUU4(reg) "set 0xffff,%%g1; and %%%0,%%g1,%%%c\n" 2 +reg: CVUI4(reg) "and %%%0,0xff,%%%c\n" (a->syms[0]->u.c.v.i == 1 ? 1 : LBURG_MAX) +reg: CVUI4(reg) "set 0xffff,%%g1; and %%%0,%%g1,%%%c\n" 2 +addrg: ADDRGP4 "%a" +stmt: JUMPV(addrg) "ba %0; nop\n" 2 +stmt: JUMPV(addr) "jmp %0; nop\n" 2 +stmt: LABELV "%a:\n" +stmt: EQI4(reg,rc) "cmp %%%0,%1; be %a; nop\n" 3 +stmt: EQU4(reg,rc) "cmp %%%0,%1; be %a; nop\n" 3 +stmt: GEI4(reg,rc) "cmp %%%0,%1; bge %a; nop\n" 3 +stmt: GEU4(reg,rc) "cmp %%%0,%1; bgeu %a; nop\n" 3 +stmt: GTI4(reg,rc) "cmp %%%0,%1; bg %a; nop\n" 3 +stmt: GTU4(reg,rc) "cmp %%%0,%1; bgu %a; nop\n" 3 +stmt: LEI4(reg,rc) "cmp %%%0,%1; ble %a; nop\n" 3 +stmt: LEU4(reg,rc) "cmp %%%0,%1; bleu %a; nop\n" 3 +stmt: LTI4(reg,rc) "cmp %%%0,%1; bl %a; nop\n" 3 +stmt: LTU4(reg,rc) "cmp %%%0,%1; blu %a; nop\n" 3 +stmt: NEI4(reg,rc) "cmp %%%0,%1; bne %a; nop\n" 3 +stmt: NEU4(reg,rc) "cmp %%%0,%1; bne %a; nop\n" 3 +call: ADDRGP4 "%a" +call: addr "%0" +reg: CALLF8(call) "call %0; nop\n" 2 +reg: CALLF4(call) "call %0; nop\n" 2 +reg: CALLI4(call) "call %0; nop\n" 2 +reg: CALLP4(call) "call %0; nop\n" 2 +reg: CALLU4(call) "call %0; nop\n" 2 +stmt: CALLV(call) "call %0; nop\n" 2 +stmt: CALLB(call,reg) "call %0; st %%%1,[%%sp+64]; unimp %b&0xfff\n" 3 + +stmt: RETF8(reg) "# ret\n" 1 +stmt: RETF4(reg) "# ret\n" 1 +stmt: RETI4(reg) "# ret\n" 1 +stmt: RETU4(reg) "# ret\n" 1 +stmt: RETP4(reg) "# ret\n" 1 +stmt: ARGI4(reg) "st %%%0,[%%sp+4*%c+68]\n" 1 +stmt: ARGU4(reg) "st %%%0,[%%sp+4*%c+68]\n" 1 +stmt: ARGP4(reg) "st %%%0,[%%sp+4*%c+68]\n" 1 +stmt: ARGF4(reg) "# ARGF4\n" 1 +stmt: ARGF8(reg) "# ARGF8\n" 1 + +reg: DIVI4(reg,rc) "sra %%%0,31,%%g1; wr %%g0,%%g1,%%y; nop; nop; nop; sdiv %%%0,%1,%%%c\n" 6 + +reg: DIVU4(reg,rc) "wr %%g0,%%g0,%%y; nop; nop; nop; udiv %%%0,%1,%%%c\n" 5 + +reg: MODI4(reg,rc) "sra %%%0,31,%%g1; wr %%g0,%%g1,%%y; nop; nop; nop; sdiv %%%0,%1,%%g1\n; smul %%g1,%1,%%g1; sub %%%0,%%g1,%%%c\n" 8 + + +reg: MODU4(reg,rc) "wr %%g0,%%g0,%%y; nop; nop; nop; udiv %%%0,%1,%%g1\n; umul %%g1,%1,%%g1; sub %%%0,%%g1,%%%c\n" 7 + + +reg: MULI4(rc,reg) "smul %%%1,%0,%%%c\n" 1 +reg: MULU4(rc,reg) "umul %%%1,%0,%%%c\n" 1 +reg: ADDF8(reg,reg) "faddd %%f%0,%%f%1,%%f%c\n" 1 +reg: ADDF4(reg,reg) "fadds %%f%0,%%f%1,%%f%c\n" 1 +reg: DIVF8(reg,reg) "fdivd %%f%0,%%f%1,%%f%c\n" 1 +reg: DIVF4(reg,reg) "fdivs %%f%0,%%f%1,%%f%c\n" 1 +reg: MULF8(reg,reg) "fmuld %%f%0,%%f%1,%%f%c\n" 1 +reg: MULF4(reg,reg) "fmuls %%f%0,%%f%1,%%f%c\n" 1 +reg: SUBF8(reg,reg) "fsubd %%f%0,%%f%1,%%f%c\n" 1 +reg: SUBF4(reg,reg) "fsubs %%f%0,%%f%1,%%f%c\n" 1 +reg: NEGF4(reg) "fnegs %%f%0,%%f%c\n" 1 +reg: LOADF4(reg) "fmovs %%f%0,%%f%c\n" 1 +reg: CVFF4(reg) "fdtos %%f%0,%%f%c\n" 1 +reg: CVFF8(reg) "fstod %%f%0,%%f%c\n" 1 +reg: CVFI4(reg) "fstoi %%f%0,%%f0; st %%f0,[%%sp+64]; ld [%%sp+64],%%%c\n" (a->syms[0]->u.c.v.i==4?3:LBURG_MAX) + +reg: CVFI4(reg) "fdtoi %%f%0,%%f0; st %%f0,[%%sp+64]; ld [%%sp+64],%%%c\n" (a->syms[0]->u.c.v.i==8?3:LBURG_MAX) + +reg: CVIF4(reg) "st %%%0,[%%sp+64]; ld [%%sp+64],%%f%c; fitos %%f%c,%%f%c\n" 3 + +reg: CVIF8(reg) "st %%%0,[%%sp+64]; ld [%%sp+64],%%f%c; fitod %%f%c,%%f%c\n" 3 + +rel: EQF8(reg,reg) "fcmpd %%f%0,%%f%1; nop; fbe" +rel: EQF4(reg,reg) "fcmps %%f%0,%%f%1; nop; fbe" +rel: GEF8(reg,reg) "fcmpd %%f%0,%%f%1; nop; fbuge" +rel: GEF4(reg,reg) "fcmps %%f%0,%%f%1; nop; fbuge" +rel: GTF8(reg,reg) "fcmpd %%f%0,%%f%1; nop; fbug" +rel: GTF4(reg,reg) "fcmps %%f%0,%%f%1; nop; fbug" +rel: LEF8(reg,reg) "fcmpd %%f%0,%%f%1; nop; fbule" +rel: LEF4(reg,reg) "fcmps %%f%0,%%f%1; nop; fbule" +rel: LTF8(reg,reg) "fcmpd %%f%0,%%f%1; nop; fbul" +rel: LTF4(reg,reg) "fcmps %%f%0,%%f%1; nop; fbul" +rel: NEF8(reg,reg) "fcmpd %%f%0,%%f%1; nop; fbne" +rel: NEF4(reg,reg) "fcmps %%f%0,%%f%1; nop; fbne" + +stmt: rel "%0 %a; nop\n" 4 +reg: LOADF8(reg) "# LOADD\n" 2 + +reg: NEGF8(reg) "# NEGD\n" 2 + +stmt: ASGNB(reg,INDIRB(reg)) "# ASGNB\n" + +%% +static void progend(void){} +static void progbeg(int argc, char *argv[]) { + int i; + + { + union { + char c; + int i; + } u; + u.i = 0; + u.c = 1; + swap = ((int)(u.i == 1)) != IR->little_endian; + } + parseflags(argc, argv); + for (i = 0; i < argc; i++) + if (strcmp(argv[i], "-p") == 0 || strcmp(argv[i], "-pg") == 0) + pflag = 1; + if (IR == &solarisIR) + stabprefix = ".LL"; + else + stabprefix = "L"; + for (i = 0; i < 8; i++) { + greg[i + 0] = mkreg(stringf("g%d", i), i + 0, 1, IREG); + greg[i + 8] = mkreg(stringf("o%d", i), i + 8, 1, IREG); + greg[i + 16] = mkreg(stringf("l%d", i), i + 16, 1, IREG); + greg[i + 24] = mkreg(stringf("i%d", i), i + 24, 1, IREG); + } + gregw = mkwildcard(greg); + for (i = 0; i < 32; i++) + freg[i] = mkreg("%d", i, 1, FREG); + for (i = 0; i < 31; i += 2) + freg2[i] = mkreg("%d", i, 3, FREG); + fregw = mkwildcard(freg); + freg2w = mkwildcard(freg2); + tmask[IREG] = 0x3fff3e00; + vmask[IREG] = 0x3ff00000; + tmask[FREG] = ~(unsigned)0; + vmask[FREG] = 0; +} +static Symbol rmap(int opk) { + switch (optype(opk)) { + case I: case U: case P: case B: + return gregw; + case F: + return opsize(opk) == 4 ? fregw : freg2w; + default: + return 0; + } +} +static void target(Node p) { + assert(p); + switch (specific(p->op)) { + case CNST+I: case CNST+U: case CNST+P: + if (range(p, 0, 0) == 0) { + setreg(p, greg[0]); + p->x.registered = 1; + } + break; + case CALL+B: + assert(p->syms[1] && p->syms[1]->type && isfunc(p->syms[1]->type)); + p->syms[1] = intconst(freturn(p->syms[1]->type)->size); + break; + case CALL+F: setreg(p, opsize(p->op)==4?freg[0]:freg2[0]); break; + case CALL+I: case CALL+P: case CALL+U: + case CALL+V: setreg(p, oreg[0]); break; + case RET+F: rtarget(p, 0, opsize(p->op)==4?freg[0]:freg2[0]); break; + case RET+I: case RET+P: case RET+U: + rtarget(p, 0, ireg[0]); + p->kids[0]->x.registered = 1; + break; + case ARG+I: case ARG+P: case ARG+U: + if (p->syms[RX]->u.c.v.i < 6) { + rtarget(p, 0, oreg[p->syms[RX]->u.c.v.i]); + p->op = LOAD+opkind(p->op); + setreg(p, oreg[p->syms[RX]->u.c.v.i]); + } + break; + } +} +static void clobber(Node p) { + assert(p); + switch (specific(p->op)) { + case CALL+B: case CALL+F: case CALL+I: + spill(~(unsigned)3, FREG, p); + break; + case CALL+V: + spill(oreg[0]->x.regnode->mask, IREG, p); + spill(~(unsigned)3, FREG, p); + break; + case ARG+F: + if (opsize(p->op) == 4 && p->syms[2]->u.c.v.i <= 6) + spill((1<<(p->syms[2]->u.c.v.i + 8)), IREG, p); + else if (opsize(p->op) == 8 && p->syms[2]->u.c.v.i <= 5) + spill((3<<(p->syms[2]->u.c.v.i + 8))&0xff00, IREG, p); + break; + } +} +static int imm(Node p) { + return range(p, -4096, 4091); +} +static void doarg(Node p) { + assert(p && p->syms[0] && p->op != ARG+B); + p->syms[RX] = intconst(mkactual(4, + p->syms[0]->u.c.v.i)/4); +} +static void emit2(Node p) { + switch (p->op) { + case INDIR+F+sizeop(8): + if (generic(p->kids[0]->op) != VREG) { + int dst = getregnum(p); + print("ld ["); emitasm(p->kids[0], _base_NT); print( "],%%f%d; ", dst); + print("ld ["); emitasm(p->kids[0], _base_NT); print("+4],%%f%d\n", dst+1); + } + break; + case ASGN+F+sizeop(8): + if (generic(p->kids[0]->op) != VREG) { + int src = getregnum(p->kids[1]); + print("st %%f%d,[", src); emitasm(p->kids[0], _base_NT); print("]; "); + print("st %%f%d,[", src+1); emitasm(p->kids[0], _base_NT); print("+4]\n"); + } + break; + case ARG+F+sizeop(4): { + int n = p->syms[RX]->u.c.v.i; + print("st %%f%d,[%%sp+4*%d+68]\n", + getregnum(p->x.kids[0]), n); + if (n <= 5) + print("ld [%%sp+4*%d+68],%%o%d\n", n, n); + break; + } + case ARG+F+sizeop(8): { + int n = p->syms[RX]->u.c.v.i; + int src = getregnum(p->x.kids[0]); + print("st %%f%d,[%%sp+4*%d+68]\n", src, n); + print("st %%f%d,[%%sp+4*%d+68]\n", src+1, n+1); + if (n <= 5) + print("ld [%%sp+4*%d+68],%%o%d\n", n, n); + if (n <= 4) + print("ld [%%sp+4*%d+68],%%o%d\n", n+1, n+1); + break; + } + case LOAD+F+sizeop(8): { + int dst = getregnum(p); + int src = getregnum(p->x.kids[0]); + print("fmovs %%f%d,%%f%d; ", src, dst); + print("fmovs %%f%d,%%f%d\n", src+1, dst+1); + break; + } + case NEG+F+sizeop(8): { + int dst = getregnum(p); + int src = getregnum(p->x.kids[0]); + print("fnegs %%f%d,%%f%d; ", src, dst); + print("fmovs %%f%d,%%f%d\n", src+1, dst+1); + break; + } + case ASGN+B: { + static int tmpregs[] = { 1, 2, 3 }; + dalign = salign = p->syms[1]->u.c.v.i; + blkcopy(getregnum(p->x.kids[0]), 0, + getregnum(p->x.kids[1]), 0, + p->syms[0]->u.c.v.i, tmpregs); + break; + } + } +} +static void local(Symbol p) { + if (retstruct) { + assert(p == retv); + p->x.name = stringd(4*16); + p->x.offset = 4*16; + p->sclass = AUTO; + retstruct = 0; + return; + } + if (isscalar(p->type) && !p->addressed && !isfloat(p->type)) + p->sclass = REGISTER; + if (askregvar(p, rmap(ttob(p->type))) == 0) + mkauto(p); + else if (p->scope > LOCAL) + regvars++; +} +static void function(Symbol f, Symbol caller[], Symbol callee[], int ncalls) { + int autos = 0, i, leaf, reg, varargs; + + if (IR == &solarisIR) + globalend(); + regvars = 0; + for (i = 0; callee[i]; i++) + ; + varargs = variadic(f->type) + || i > 0 && strcmp(callee[i-1]->name, + "__builtin_va_alist") == 0; + usedmask[0] = usedmask[1] = 0; + freemask[0] = freemask[1] = ~(unsigned)0; + for (i = 0; i < 8; i++) + ireg[i]->x.regnode->vbl = NULL; + offset = 68; + maxargoffset = 24; + reg = 0; + for (i = 0; callee[i]; i++) { + Symbol p = callee[i], q = caller[i]; + int size = roundup(q->type->size, 4); + assert(q); + if (isfloat(p->type) || reg >= 6) { + p->x.offset = q->x.offset = offset; + p->x.name = q->x.name = stringd(offset); + p->sclass = q->sclass = AUTO; + autos++; + } + else if (p->addressed || varargs) { + p->x.offset = offset; + p->x.name = stringd(p->x.offset); + p->sclass = AUTO; + q->sclass = REGISTER; + askregvar(q, ireg[reg]); + assert(q->x.regnode); + autos++; + } + else { + p->sclass = q->sclass = REGISTER; + askregvar(p, ireg[reg]); + assert(p->x.regnode); + q->x.name = p->x.name; + } + offset += size; + reg += isstruct(p->type) ? 1 : size/4; + } + assert(caller[i] == 0); + offset = maxoffset = 0; + retstruct = isstruct(freturn(f->type)); + gencode(caller, callee); + maxargoffset = roundup(maxargoffset, 4); + framesize = roundup(maxoffset + maxargoffset + 4*(16+1), 8); + assert(!varargs || autos); + leaf = (!ncalls + && !maxoffset && !autos && !regvars + && !isstruct(freturn(f->type)) + && !(usedmask[IREG]&0x00ffff01) + && !(usedmask[FREG]&~(unsigned)3) + && !pflag && !glevel); + print(".align 4\n%s:\n", f->x.name); + if (leaf) { + for (i = 0; caller[i] && callee[i]; i++) { + Symbol p = caller[i], q = callee[i]; + if (p->sclass == REGISTER && q->sclass == REGISTER) { + assert(q->x.regnode); + assert(q->x.regnode->set == IREG); + assert(q->x.regnode->number >= 24); + assert(q->x.regnode->number <= 31); + p->x.name = greg[q->x.regnode->number - 16]->x.name; + } + } + renameregs(); + } else if (framesize <= 4095) + print("save %%sp,%d,%%sp\n", -framesize); + else + print("set %d,%%g1; save %%sp,%%g1,%%sp\n", -framesize); + if (varargs) + for (; reg < 6; reg++) + print("st %%i%d,[%%fp+%d]\n", reg, 4*reg + 68); + else { + offset = 4*(16 + 1); + reg = 0; + for (i = 0; caller[i]; i++) { + Symbol p = caller[i]; + if (isfloat(p->type) && p->type->size == 8 && reg <= 4) { + print("st %%r%d,[%%fp+%d]\n", + ireg[reg++]->x.regnode->number, offset); + print("st %%r%d,[%%fp+%d]\n", + ireg[reg++]->x.regnode->number, offset + 4); + } else if (isfloat(p->type) && p->type->size == 4 && reg <= 5) + print("st %%r%d,[%%fp+%d]\n", + ireg[reg++]->x.regnode->number, offset); + else + reg++; + offset += roundup(p->type->size, 4); + } + } + if (pflag) { + int lab = genlabel(1); + print("set L%d,%%o0; call mcount; nop\n", lab); + print(".seg \"data\"\n.align 4; L%d:.word 0\n.seg \"text\"\n", lab); + } + emitcode(); + if (isstruct(freturn(f->type))) + print("jmp %%i7+12; restore\n"); + else if (!leaf) + print("ret; restore\n"); + else { + renameregs(); + print("retl; nop\n"); + } + if (IR == &solarisIR) { + print(".type %s,#function\n", f->x.name); + print(".size %s,.-%s\n", f->x.name, f->x.name); + } +} +#define exch(x, y, t) (((t) = x), ((x) = (y)), ((y) = (t))) + +static void renameregs(void) { + int i; + + for (i = 0; i < 8; i++) { + char *ptmp; + int itmp; + if (ireg[i]->x.regnode->vbl) + ireg[i]->x.regnode->vbl->x.name = oreg[i]->x.name; + exch(ireg[i]->x.name, oreg[i]->x.name, ptmp); + exch(ireg[i]->x.regnode->number, + oreg[i]->x.regnode->number, itmp); + } +} +static void defconst(int suffix, int size, Value v) { + if (suffix == F && size == 4) { + float f = v.d; + print(".word 0x%x\n", *(unsigned *)&f); + } else if (suffix == F && size == 8) { + double d = v.d; + unsigned *p = (unsigned *)&d; + print(".word 0x%x\n.word 0x%x\n", p[swap], p[!swap]); + } else if (suffix == P) + print(".word 0x%x\n", (unsigned)v.p); + else if (size == 1) + print(".byte 0x%x\n", (unsigned)((unsigned char)(suffix == I ? v.i : v.u))); + else if (size == 2) + print(".half 0x%x\n", (unsigned)((unsigned short)(suffix == I ? v.i : v.u))); + else if (size == 4) + print(".word 0x%x\n", (unsigned)(suffix == I ? v.i : v.u)); + else assert(0); +} + +static void defaddress(Symbol p) { + print(".word %s\n", p->x.name); +} + +static void defstring(int n, char *str) { + char *s; + + for (s = str; s < str + n; s++) + print(".byte %d\n", (*s)&0377); +} + +static void address(Symbol q, Symbol p, long n) { + if (p->scope == GLOBAL || p->sclass == STATIC || p->sclass == EXTERN) + q->x.name = stringf("%s%s%D", p->x.name, n >= 0 ? "+" : "", n); + else { + assert(n <= INT_MAX && n >= INT_MIN); + q->x.offset = p->x.offset + n; + q->x.name = stringd(q->x.offset); + } +} +static void export(Symbol p) { + print(".global %s\n", p->x.name); +} +static void import(Symbol p) {} +static void defsymbol(Symbol p) { + if (p->scope >= LOCAL && p->sclass == STATIC) + p->x.name = stringf("%d", genlabel(1)); + else + assert(p->scope != CONSTANTS || isint(p->type) || isptr(p->type)), + p->x.name = p->name; + if (p->scope >= LABELS) + p->x.name = stringf(p->generated ? "L%s" : "_%s", + p->x.name); +} +static void segment(int n) { + cseg = n; + switch (n) { + case CODE: print(".seg \"text\"\n"); break; + case BSS: print(".seg \"bss\"\n"); break; + case DATA: print(".seg \"data\"\n"); break; + case LIT: print(".seg \"text\"\n"); break; + } +} +static void space(int n) { + if (cseg != BSS) + print(".skip %d\n", n); +} +static void global(Symbol p) { + print(".align %d\n", p->type->align); + assert(p->u.seg); + if (p->u.seg == BSS + && (p->sclass == STATIC || Aflag >= 2)) + print(".reserve %s,%d\n", p->x.name, p->type->size); + else if (p->u.seg == BSS) + print(".common %s,%d\n", p->x.name, p->type->size); + else + print("%s:\n", p->x.name); +} +static void blkfetch(int k, int off, int reg, int tmp) { + assert(k == 1 || k == 2 || k == 4); + assert(salign >= k); + if (k == 1) + print("ldub [%%r%d+%d],%%r%d\n", reg, off, tmp); + else if (k == 2) + print("lduh [%%r%d+%d],%%r%d\n", reg, off, tmp); + else + print("ld [%%r%d+%d],%%r%d\n", reg, off, tmp); +} +static void blkstore(int k, int off, int reg, int tmp) { + assert(k == 1 || k == 2 || k == 4); + assert(dalign >= k); + if (k == 1) + print("stb %%r%d,[%%r%d+%d]\n", tmp, reg, off); + else if (k == 2) + print("sth %%r%d,[%%r%d+%d]\n", tmp, reg, off); + else + print("st %%r%d,[%%r%d+%d]\n", tmp, reg, off); +} +static void blkloop(int dreg, int doff, int sreg, int soff, int size, int tmps[]) { + if ((size&~7) < 4096) { + print("add %%r%d,%d,%%r%d\n", sreg, size&~7, sreg); + print("add %%r%d,%d,%%r%d\n", dreg, size&~7, tmps[2]); + } else { + print("set %d,%%r%d\n", size&~7, tmps[2]); + print("add %%r%d,%%r%d,%%r%d\n", sreg, tmps[2], sreg); + print("add %%r%d,%%r%d,%%r%d\n", dreg, tmps[2], tmps[2]); + } + blkcopy(tmps[2], doff, sreg, soff, size&7, tmps); + print("1: dec 8,%%r%d\n", tmps[2]); + blkcopy(tmps[2], doff, sreg, soff - 8, 8, tmps); + print("cmp %%r%d,%%r%d; ", tmps[2], dreg); + print("bgt 1b; "); + print("dec 8,%%r%d\n", sreg); +} +static void defsymbol2(Symbol p) { + if (p->scope >= LOCAL && p->sclass == STATIC) + p->x.name = stringf(".%d", genlabel(1)); + else + assert(p->scope != CONSTANTS || isint(p->type) || isptr(p->type)), + p->x.name = p->name; + if (p->scope >= LABELS) + p->x.name = stringf(p->generated ? ".L%s" : "%s", + p->x.name); +} + +static Symbol prevg; + +static void globalend(void) { + if (prevg && prevg->type->size > 0) + print(".size %s,%d\n", prevg->x.name, prevg->type->size); + prevg = NULL; +} + +static void export2(Symbol p) { + globalend(); + print(".global %s\n", p->x.name); +} + +static void progend2(void) { + globalend(); +} + +static void global2(Symbol p) { + globalend(); + assert(p->u.seg); + if (!p->generated) { + print(".type %s,#%s\n", p->x.name, + isfunc(p->type) ? "function" : "object"); + if (p->type->size > 0) + print(".size %s,%d\n", p->x.name, p->type->size); + else + prevg = p; + } + if (p->u.seg == BSS && p->sclass == STATIC) + print(".local %s\n.common %s,%d,%d\n", p->x.name, p->x.name, + p->type->size, p->type->align); + else if (p->u.seg == BSS && Aflag >= 2) + print(".align %d\n%s:.skip %d\n", p->type->align, p->x.name, + p->type->size); + else if (p->u.seg == BSS) + print(".common %s,%d,%d\n", p->x.name, p->type->size, p->type->align); + else + print(".align %d\n%s:\n", p->type->align, p->x.name); +} + +static void segment2(int n) { + cseg = n; + switch (n) { + case CODE: print(".section \".text\"\n"); break; + case BSS: print(".section \".bss\"\n"); break; + case DATA: print(".section \".data\"\n"); break; + case LIT: print(".section \".rodata\"\n"); break; + } +} +Interface sparcIR = { + 1, 1, 0, /* char */ + 2, 2, 0, /* short */ + 4, 4, 0, /* int */ + 4, 4, 0, /* long */ + 4, 4, 0, /* long long */ + 4, 4, 1, /* float */ + 8, 8, 1, /* double */ + 8, 8, 1, /* long double */ + 4, 4, 0, /* T * */ + 0, 1, 0, /* struct */ + 0, /* little_endian */ + 0, /* mulops_calls */ + 1, /* wants_callb */ + 0, /* wants_argb */ + 1, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + address, + blockbeg, + blockend, + defaddress, + defconst, + defstring, + defsymbol, + emit, + export, + function, + gen, + global, + import, + local, + progbeg, + progend, + segment, + space, + stabblock, 0, 0, stabinit, stabline, stabsym, stabtype, + { + 1, /* max_unaligned_load */ + rmap, + blkfetch, blkstore, blkloop, + _label, + _rule, + _nts, + _kids, + _string, + _templates, + _isinstruction, + _ntname, + emit2, + doarg, + target, + clobber, + + } +}; + +Interface solarisIR = { + 1, 1, 0, /* char */ + 2, 2, 0, /* short */ + 4, 4, 0, /* int */ + 4, 4, 0, /* long */ + 4, 4, 0, /* long long */ + 4, 4, 1, /* float */ + 8, 8, 1, /* double */ + 8, 8, 1, /* long double */ + 4, 4, 0, /* T * */ + 0, 1, 0, /* struct */ + 0, /* little_endian */ + 0, /* mulops_calls */ + 1, /* wants_callb */ + 0, /* wants_argb */ + 1, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + address, + blockbeg, + blockend, + defaddress, + defconst, + defstring, + defsymbol2, + emit, + export2, + function, + gen, + global2, + import, + local, + progbeg, + progend2, + segment2, + space, + stabblock, 0, 0, stabinit, stabline, stabsym, stabtype, + { + 1, /* max_unaligned_load */ + rmap, + blkfetch, blkstore, blkloop, + _label, + _rule, + _nts, + _kids, + _string, + _templates, + _isinstruction, + _ntname, + emit2, + doarg, + target, + clobber, + + } +}; diff --git a/src/cmd/lccom-1/stab.c b/src/cmd/lccom-1/stab.c new file mode 100644 index 0000000..91482d0 --- /dev/null +++ b/src/cmd/lccom-1/stab.c @@ -0,0 +1,329 @@ +#include +#include +#include "c.h" +#include "stab.h" + +static char *currentfile; /* current file name */ +static int ntypes; + +extern Interface sparcIR; + +char *stabprefix = "L"; + +extern char *stabprefix; +extern void stabblock(int, int, Symbol*); +extern void stabend(Coordinate *, Symbol, Coordinate **, Symbol *, Symbol *); +extern void stabfend(Symbol, int); +extern void stabinit(char *, int, char *[]); +extern void stabline(Coordinate *); +extern void stabsym(Symbol); +extern void stabtype(Symbol); + +static void asgncode(Type, int); +static void dbxout(Type); +static int dbxtype(Type); +static int emittype(Type, int, int); + +/* asgncode - assign type code to ty */ +static void asgncode(Type ty, int lev) { + if (ty->x.marked || ty->x.typeno) + return; + ty->x.marked = 1; + switch (ty->op) { + case VOLATILE: case CONST: case VOLATILE+CONST: + asgncode(ty->type, lev); + ty->x.typeno = ty->type->x.typeno; + break; + case POINTER: case FUNCTION: case ARRAY: + asgncode(ty->type, lev + 1); + /* fall thru */ + case VOID: case INT: case UNSIGNED: case FLOAT: + break; + case STRUCT: case UNION: { + Field p; + for (p = fieldlist(ty); p; p = p->link) + asgncode(p->type, lev + 1); + /* fall thru */ + case ENUM: + if (ty->x.typeno == 0) + ty->x.typeno = ++ntypes; + if (lev > 0 && (*ty->u.sym->name < '0' || *ty->u.sym->name > '9')) + dbxout(ty); + break; + } + default: + assert(0); + } +} + +/* dbxout - output .stabs entry for type ty */ +static void dbxout(Type ty) { + ty = unqual(ty); + if (!ty->x.printed) { + int col = 0; + print(".stabs \""), col += 8; + if (ty->u.sym && !(isfunc(ty) || isarray(ty) || isptr(ty))) + print("%s", ty->u.sym->name), col += strlen(ty->u.sym->name); + print(":%c", isstruct(ty) || isenum(ty) ? 'T' : 't'), col += 2; + emittype(ty, 0, col); + print("\",%d,0,0,0\n", N_LSYM); + } +} + +/* dbxtype - emit a stabs entry for type ty, return type code */ +static int dbxtype(Type ty) { + asgncode(ty, 0); + dbxout(ty); + return ty->x.typeno; +} + +/* + * emittype - emit ty's type number, emitting its definition if necessary. + * Returns the output column number after emission; col is the approximate + * output column before emission and is used to emit continuation lines for long + * struct, union, and enum types. Continuations are not emitted for other types, + * even if the definition is long. lev is the depth of calls to emittype. + */ +static int emittype(Type ty, int lev, int col) { + int tc = ty->x.typeno; + + if (isconst(ty) || isvolatile(ty)) { + col = emittype(ty->type, lev, col); + ty->x.typeno = ty->type->x.typeno; + ty->x.printed = 1; + return col; + } + if (tc == 0) { + ty->x.typeno = tc = ++ntypes; +/* fprint(2,"`%t'=%d\n", ty, tc); */ + } + print("%d", tc), col += 3; + if (ty->x.printed) + return col; + ty->x.printed = 1; + switch (ty->op) { + case VOID: /* void is defined as itself */ + print("=%d", tc), col += 1+3; + break; + case INT: + if (ty == chartype) /* plain char is a subrange of itself */ + print("=r%d;%d;%d;", tc, ty->u.sym->u.limits.min.i, ty->u.sym->u.limits.max.i), + col += 2+3+2*2.408*ty->size+2; + else /* other signed ints are subranges of int */ + print("=r1;%D;%D;", ty->u.sym->u.limits.min.i, ty->u.sym->u.limits.max.i), + col += 4+2*2.408*ty->size+2; + break; + case UNSIGNED: + if (ty == chartype) /* plain char is a subrange of itself */ + print("=r%d;0;%u;", tc, ty->u.sym->u.limits.max.i), + col += 2+3+2+2.408*ty->size+1; + else /* other signed ints are subranges of int */ + print("=r1;0;%U;", ty->u.sym->u.limits.max.i), + col += 4+2.408*ty->size+1; + break; + case FLOAT: /* float, double, long double get sizes, not ranges */ + print("=r1;%d;0;", ty->size), col += 4+1+3; + break; + case POINTER: + print("=*"), col += 2; + col = emittype(ty->type, lev + 1, col); + break; + case FUNCTION: + print("=f"), col += 2; + col = emittype(ty->type, lev + 1, col); + break; + case ARRAY: /* array includes subscript as an int range */ + if (ty->size && ty->type->size) + print("=ar1;0;%d;", ty->size/ty->type->size - 1), col += 7+3+1; + else + print("=ar1;0;-1;"), col += 10; + col = emittype(ty->type, lev + 1, col); + break; + case STRUCT: case UNION: { + Field p; + if (!ty->u.sym->defined) { + print("=x%c%s:", ty->op == STRUCT ? 's' : 'u', ty->u.sym->name); + col += 2+1+strlen(ty->u.sym->name)+1; + break; + } + if (lev > 0 && (*ty->u.sym->name < '0' || *ty->u.sym->name > '9')) { + ty->x.printed = 0; + break; + } + print("=%c%d", ty->op == STRUCT ? 's' : 'u', ty->size), col += 1+1+3; + for (p = fieldlist(ty); p; p = p->link) { + if (p->name) + print("%s:", p->name), col += strlen(p->name)+1; + else + print(":"), col += 1; + col = emittype(p->type, lev + 1, col); + if (p->lsb) + print(",%d,%d;", 8*p->offset + + (IR->little_endian ? fieldright(p) : fieldleft(p)), + fieldsize(p)); + else + print(",%d,%d;", 8*p->offset, 8*p->type->size); + col += 1+3+1+3+1; /* accounts for ,%d,%d; */ + if (col >= 80 && p->link) { + print("\\\\\",%d,0,0,0\n.stabs \"", N_LSYM); + col = 8; + } + } + print(";"), col += 1; + break; + } + case ENUM: { + Symbol *p; + if (lev > 0 && (*ty->u.sym->name < '0' || *ty->u.sym->name > '9')) { + ty->x.printed = 0; + break; + } + print("=e"), col += 2; + for (p = ty->u.sym->u.idlist; *p; p++) { + print("%s:%d,", (*p)->name, (*p)->u.value), col += strlen((*p)->name)+3; + if (col >= 80 && p[1]) { + print("\\\\\",%d,0,0,0\n.stabs \"", N_LSYM); + col = 8; + } + } + print(";"), col += 1; + break; + } + default: + assert(0); + } + return col; +} + +/* stabblock - output a stab entry for '{' or '}' at level lev */ +void stabblock(int brace, int lev, Symbol *p) { + if (brace == '{') + while (*p) + stabsym(*p++); + if (IR == &sparcIR) + print(".stabd 0x%x,0,%d\n", brace == '{' ? N_LBRAC : N_RBRAC, lev); + else { + int lab = genlabel(1); + print(".stabn 0x%x,0,%d,%s%d-%s\n", brace == '{' ? N_LBRAC : N_RBRAC, lev, + stabprefix, lab, cfunc->x.name); + print("%s%d:\n", stabprefix, lab); + } +} + +/* stabinit - initialize stab output */ +void stabinit(char *file, int argc, char *argv[]) { + typedef void (*Closure)(Symbol, void *); + extern char *getcwd(char *, size_t); + + print(".stabs \"lcc4_compiled.\",0x%x,0,0,0\n", N_OPT); + if (file && *file) { + char buf[1024], *cwd = getcwd(buf, sizeof buf); + if (cwd) + print(".stabs \"%s/\",0x%x,0,3,%stext0\n", cwd, N_SO, stabprefix); + print(".stabs \"%s\",0x%x,0,3,%stext0\n", file, N_SO, stabprefix); + (*IR->segment)(CODE); + print("%stext0:\n", stabprefix, N_SO); + currentfile = file; + } + dbxtype(inttype); + dbxtype(chartype); + dbxtype(doubletype); + dbxtype(floattype); + dbxtype(longdouble); + dbxtype(longtype); + dbxtype(longlong); + dbxtype(shorttype); + dbxtype(signedchar); + dbxtype(unsignedchar); + dbxtype(unsignedlong); + dbxtype(unsignedlonglong); + dbxtype(unsignedshort); + dbxtype(unsignedtype); + dbxtype(voidtype); + foreach(types, GLOBAL, (Closure)stabtype, NULL); +} + +/* stabline - emit stab entry for source coordinate *cp */ +void stabline(Coordinate *cp) { + if (cp->file && cp->file != currentfile) { + int lab = genlabel(1); + print(".stabs \"%s\",0x%x,0,0,%s%d\n", cp->file, N_SOL, stabprefix, lab); + print("%s%d:\n", stabprefix, lab); + currentfile = cp->file; + } + if (IR == &sparcIR) + print(".stabd 0x%x,0,%d\n", N_SLINE, cp->y); + else { + int lab = genlabel(1); + print(".stabn 0x%x,0,%d,%s%d-%s\n", N_SLINE, cp->y, + stabprefix, lab, cfunc->x.name); + print("%s%d:\n", stabprefix, lab); + } +} + +/* stabsym - output a stab entry for symbol p */ +void stabsym(Symbol p) { + int code, tc, sz = p->type->size; + + if (p->generated || p->computed) + return; + if (isfunc(p->type)) { + print(".stabs \"%s:%c%d\",%d,0,0,%s\n", p->name, + p->sclass == STATIC ? 'f' : 'F', dbxtype(freturn(p->type)), + N_FUN, p->x.name); + return; + } + if (!IR->wants_argb && p->scope == PARAM && p->structarg) { + assert(isptr(p->type) && isstruct(p->type->type)); + tc = dbxtype(p->type->type); + sz = p->type->type->size; + } else + tc = dbxtype(p->type); + if (p->sclass == AUTO && p->scope == GLOBAL || p->sclass == EXTERN) { + print(".stabs \"%s:G", p->name); + code = N_GSYM; + } else if (p->sclass == STATIC) { + print(".stabs \"%s:%c%d\",%d,0,0,%s\n", p->name, p->scope == GLOBAL ? 'S' : 'V', + tc, p->u.seg == BSS ? N_LCSYM : N_STSYM, p->x.name); + return; + } else if (p->sclass == REGISTER) { + if (p->x.regnode) { + int r = p->x.regnode->number; + if (p->x.regnode->set == FREG) + r += 32; /* floating point */ + print(".stabs \"%s:%c%d\",%d,0,", p->name, + p->scope == PARAM ? 'P' : 'r', tc, N_RSYM); + print("%d,%d\n", sz, r); + } + return; + } else if (p->scope == PARAM) { + print(".stabs \"%s:p", p->name); + code = N_PSYM; + } else if (p->scope >= LOCAL) { + print(".stabs \"%s:", p->name); + code = N_LSYM; + } else + assert(0); + print("%d\",%d,0,0,%s\n", tc, code, + p->scope >= PARAM && p->sclass != EXTERN ? p->x.name : "0"); +} + +/* stabtype - output a stab entry for type *p */ +void stabtype(Symbol p) { + if (p->type) { + if (p->sclass == 0) + dbxtype(p->type); + else if (p->sclass == TYPEDEF) + print(".stabs \"%s:t%d\",%d,0,0,0\n", p->name, dbxtype(p->type), N_LSYM); + } +} + +/* stabend - finalize a function */ +void stabfend(Symbol p, int lineno) {} + +/* stabend - finalize stab output */ +void stabend(Coordinate *cp, Symbol p, Coordinate **cpp, Symbol *sp, Symbol *stab) { + (*IR->segment)(CODE); + print(".stabs \"\", %d, 0, 0,%setext\n", N_SO, stabprefix); + print("%setext:\n", stabprefix); +} diff --git a/src/cmd/lccom-1/stab.h b/src/cmd/lccom-1/stab.h new file mode 100644 index 0000000..0fe57e4 --- /dev/null +++ b/src/cmd/lccom-1/stab.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 1990 by Sun Microsystems, Inc. + * + * This file gives definitions supplementing + * for permanent symbol table entries. + * These must have one of the N_STAB bits on, + * and are subject to relocation according to the masks in . + */ +#ifndef _STAB_H +#define _STAB_H + +#if !defined(_a_out_h) && !defined(_A_OUT_H) +/* this file contains fragments of a.out.h and stab.h relevant to + * support of stabX processing within ELF files - see the + * Format of a symbol table entry + */ +struct nlist { + union { + char *n_name; /* for use when in-core */ + long n_strx; /* index into file string table */ + } n_un; + unsigned char n_type; /* type flag (N_TEXT,..) */ + char n_other; /* unused */ + short n_desc; /* see */ + unsigned long n_value; /* value of symbol (or sdb offset) */ +}; + +/* + * Simple values for n_type. + */ +#define N_UNDF 0x0 /* undefined */ +#define N_ABS 0x2 /* absolute */ +#define N_TEXT 0x4 /* text */ +#define N_DATA 0x6 /* data */ +#define N_BSS 0x8 /* bss */ +#define N_COMM 0x12 /* common (internal to ld) */ +#define N_FN 0x1f /* file name symbol */ + +#define N_EXT 01 /* external bit, or'ed in */ +#define N_TYPE 0x1e /* mask for all the type bits */ + +#endif + +/* + * for symbolic debugger, sdb(1): + */ +#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */ +#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */ +#define N_FUN 0x24 /* procedure: name,,0,linenumber,address */ +#define N_STSYM 0x26 /* static symbol: name,,0,type,address */ +#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */ +#define N_MAIN 0x2a /* name of main routine : name,,0,0,0 */ +#define N_ROSYM 0x2c /* ro_data objects */ +#define N_OBJ 0x38 /* object file path or name */ +#define N_OPT 0x3c /* compiler options */ +#define N_RSYM 0x40 /* register sym: name,,0,type,register */ +#define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */ +#define N_FLINE 0x4c /* function start.end */ +#define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */ +#define N_ENDM 0x62 /* last stab emitted for module */ +#define N_SO 0x64 /* source file name: name,,0,0,address */ +#define N_LSYM 0x80 /* local sym: name,,0,type,offset */ +#define N_BINCL 0x82 /* header file: name,,0,0,0 */ +#define N_SOL 0x84 /* #included file name: name,,0,0,address */ +#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */ +#define N_EINCL 0xa2 /* end of include file */ +#define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */ +#define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */ +#define N_EXCL 0xc2 /* excluded include file */ +#define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */ +#define N_BCOMM 0xe2 /* begin common: name,, */ +#define N_ECOMM 0xe4 /* end common: name,, */ +#define N_ECOML 0xe8 /* end common (local name): ,,address */ +#define N_LENG 0xfe /* second stab entry with length information */ + +/* + * for the berkeley pascal compiler, pc(1): + */ +#define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */ +#define N_WITH 0xea /* pascal with statement: type,,0,0,offset */ + +/* + * for code browser only + */ +#define N_BROWS 0x48 /* path to associated .cb file */ + +/* + * Optional langauge designations for N_SO + */ +#define N_SO_AS 1 /* Assembler */ +#define N_SO_C 2 /* C */ +#define N_SO_ANSI_C 3 /* ANSI C */ +#define N_SO_CC 4 /* C++ */ +#define N_SO_FORTRAN 5 /* Fortran 77 */ +#define N_SO_PASCAL 6 /* Pascal */ + +/* + * Floating point type values + */ +#define NF_NONE 0 /* Undefined type */ +#define NF_SINGLE 1 /* IEEE 32 bit float */ +#define NF_DOUBLE 2 /* IEEE 64 bit float */ +#define NF_COMPLEX 3 /* Fortran complex */ +#define NF_COMPLEX16 4 /* Fortran double complex */ +#define NF_COMPLEX32 5 /* Fortran complex*16 */ +#define NF_LDOUBLE 6 /* Long double */ + +#endif diff --git a/src/cmd/lccom-1/stmt.c b/src/cmd/lccom-1/stmt.c new file mode 100644 index 0000000..b8669e9 --- /dev/null +++ b/src/cmd/lccom-1/stmt.c @@ -0,0 +1,707 @@ +#include "c.h" + +#define SWSIZE 512 + +#define den(i,j) ((j-buckets[i]+1.0)/(v[j]-v[buckets[i]]+1)) + +struct code codehead = { Start }; +Code codelist = &codehead; +float density = 0.5; +Table stmtlabs; + +static int foldcond(Tree e1, Tree e2); +static void caselabel(Swtch, long, int); +static void cmp(int, Symbol, long, int); +static Tree conditional(int); +static void dostmt(int, Swtch, int); +static int equal(Symbol, Symbol); +static void forstmt(int, Swtch, int); +static void ifstmt(int, int, Swtch, int); +static Symbol localaddr(Tree); +static void stmtlabel(void); +static void swstmt(int, int, int); +static void whilestmt(int, Swtch, int); +Code code(int kind) { + Code cp; + + if (!reachable(kind)) + warning("unreachable code\n"); + + NEW(cp, FUNC); + cp->kind = kind; + cp->prev = codelist; + cp->next = NULL; + codelist->next = cp; + codelist = cp; + return cp; +} + +int reachable(int kind) { + if (kind > Start) { + Code cp; + for (cp = codelist; cp->kind < Label; ) + cp = cp->prev; + if (cp->kind == Jump || cp->kind == Switch) + return 0; + } + return 1; +} + +void addlocal(Symbol p) { + if (!p->defined) { + code(Local)->u.var = p; + p->defined = 1; + p->scope = level; + } +} +void definept(Coordinate *p) { + Code cp = code(Defpoint); + + cp->u.point.src = p ? *p : src; + cp->u.point.point = npoints; + if (ncalled > 0) { + int n = findcount(cp->u.point.src.file, + cp->u.point.src.x, cp->u.point.src.y); + if (n > 0) + refinc = (float)n/ncalled; + } + if (glevel > 2) locus(identifiers, &cp->u.point.src); + if (events.points && reachable(Gen)) + { + Tree e = NULL; + apply(events.points, &cp->u.point.src, &e); + if (e) + listnodes(e, 0, 0); + } +} +void statement(int loop, Swtch swp, int lev) { + float ref = refinc; + + if (Aflag >= 2 && lev == 15) + warning("more than 15 levels of nested statements\n"); + switch (t) { + case IF: ifstmt(genlabel(2), loop, swp, lev + 1); + break; + case WHILE: whilestmt(genlabel(3), swp, lev + 1); break; + case DO: dostmt(genlabel(3), swp, lev + 1); expect(';'); + break; + + case FOR: forstmt(genlabel(4), swp, lev + 1); + break; + case BREAK: walk(NULL, 0, 0); + definept(NULL); + if (swp && swp->lab > loop) + branch(swp->lab + 1); + else if (loop) + branch(loop + 2); + else + error("illegal break statement\n"); + t = gettok(); expect(';'); + break; + + case CONTINUE: walk(NULL, 0, 0); + definept(NULL); + if (loop) + branch(loop + 1); + else + error("illegal continue statement\n"); + t = gettok(); expect(';'); + break; + + case SWITCH: swstmt(loop, genlabel(2), lev + 1); + break; + case CASE: { + int lab = genlabel(1); + if (swp == NULL) + error("illegal case label\n"); + definelab(lab); + while (t == CASE) { + static char stop[] = { IF, ID, 0 }; + Tree p; + t = gettok(); + p = constexpr(0); + if (generic(p->op) == CNST && isint(p->type)) { + if (swp) { + needconst++; + p = cast(p, swp->sym->type); + if (p->type->op == UNSIGNED) + p->u.v.i = extend(p->u.v.u, p->type); + needconst--; + caselabel(swp, p->u.v.i, lab); + } + } else + error("case label must be a constant integer expression\n"); + + test(':', stop); + } + statement(loop, swp, lev); + } break; + case DEFAULT: if (swp == NULL) + error("illegal default label\n"); + else if (swp->deflab) + error("extra default label\n"); + else { + swp->deflab = findlabel(swp->lab); + definelab(swp->deflab->u.l.label); + } + t = gettok(); + expect(':'); + statement(loop, swp, lev); break; + case RETURN: { + Type rty = freturn(cfunc->type); + t = gettok(); + definept(NULL); + if (t != ';') + if (rty == voidtype) { + error("extraneous return value\n"); + expr(0); + retcode(NULL); + } else + retcode(expr(0)); + else { + if (rty != voidtype) { + warning("missing return value\n"); + retcode(cnsttree(inttype, 0L)); + } else + retcode(NULL); + } + branch(cfunc->u.f.label); + } expect(';'); + break; + + case '{': compound(loop, swp, lev + 1); break; + case ';': definept(NULL); t = gettok(); break; + case GOTO: walk(NULL, 0, 0); + definept(NULL); + t = gettok(); + if (t == ID) { + Symbol p = lookup(token, stmtlabs); + if (p == NULL) { + p = install(token, &stmtlabs, 0, FUNC); + p->scope = LABELS; + p->u.l.label = genlabel(1); + p->src = src; + } + use(p, src); + branch(p->u.l.label); + t = gettok(); + } else + error("missing label in goto\n"); expect(';'); + break; + + case ID: if (getchr() == ':') { + stmtlabel(); + statement(loop, swp, lev); + break; + } + default: definept(NULL); + if (kind[t] != ID) { + error("unrecognized statement\n"); + t = gettok(); + } else { + Tree e = expr0(0); + listnodes(e, 0, 0); + if (nodecount == 0 || nodecount > 200) + walk(NULL, 0, 0); + else if (glevel) walk(NULL, 0, 0); + deallocate(STMT); + } expect(';'); + break; + + } + if (kind[t] != IF && kind[t] != ID + && t != '}' && t != EOI) { + static char stop[] = { IF, ID, '}', 0 }; + error("illegal statement termination\n"); + skipto(0, stop); + } + refinc = ref; +} + +static void ifstmt(int lab, int loop, Swtch swp, int lev) { + t = gettok(); + expect('('); + definept(NULL); + walk(conditional(')'), 0, lab); + refinc /= 2.0; + statement(loop, swp, lev); + if (t == ELSE) { + branch(lab + 1); + t = gettok(); + definelab(lab); + statement(loop, swp, lev); + if (findlabel(lab + 1)->ref) + definelab(lab + 1); + } else + definelab(lab); +} +static Tree conditional(int tok) { + Tree p = expr(tok); + + if (Aflag > 1 && isfunc(p->type)) + warning("%s used in a conditional expression\n", + funcname(p)); + return cond(p); +} +static void stmtlabel(void) { + Symbol p = lookup(token, stmtlabs); + + if (p == NULL) { + p = install(token, &stmtlabs, 0, FUNC); + p->scope = LABELS; + p->u.l.label = genlabel(1); + p->src = src; + } + if (p->defined) + error("redefinition of label `%s' previously defined at %w\n", p->name, &p->src); + + p->defined = 1; + definelab(p->u.l.label); + t = gettok(); + expect(':'); +} +static void forstmt(int lab, Swtch swp, int lev) { + int once = 0; + Tree e1 = NULL, e2 = NULL, e3 = NULL; + Coordinate pt2, pt3; + + t = gettok(); + expect('('); + definept(NULL); + if (kind[t] == ID) + e1 = texpr(expr0, ';', FUNC); + else + expect(';'); + walk(e1, 0, 0); + pt2 = src; + refinc *= 10.0; + if (kind[t] == ID) + e2 = texpr(conditional, ';', FUNC); + else + expect(';'); + pt3 = src; + if (kind[t] == ID) + e3 = texpr(expr0, ')', FUNC); + else { + static char stop[] = { IF, ID, '}', 0 }; + test(')', stop); + } + if (e2) { + once = foldcond(e1, e2); + if (!once) + branch(lab + 3); + } + definelab(lab); + statement(lab, swp, lev); + definelab(lab + 1); + definept(&pt3); + if (e3) + walk(e3, 0, 0); + if (e2) { + if (!once) + definelab(lab + 3); + definept(&pt2); + walk(e2, lab, 0); + } else { + definept(&pt2); + branch(lab); + } + if (findlabel(lab + 2)->ref) + definelab(lab + 2); +} +static void swstmt(int loop, int lab, int lev) { + Tree e; + struct swtch sw; + Code head, tail; + + t = gettok(); + expect('('); + definept(NULL); + e = expr(')'); + if (!isint(e->type)) { + error("illegal type `%t' in switch expression\n", + e->type); + e = retype(e, inttype); + } + e = cast(e, promote(e->type)); + if (generic(e->op) == INDIR && isaddrop(e->kids[0]->op) + && e->kids[0]->u.sym->type == e->type + && !isvolatile(e->kids[0]->u.sym->type)) { + sw.sym = e->kids[0]->u.sym; + walk(NULL, 0, 0); + } else { + sw.sym = genident(REGISTER, e->type, level); + addlocal(sw.sym); + walk(asgn(sw.sym, e), 0, 0); + } + head = code(Switch); + sw.lab = lab; + sw.deflab = NULL; + sw.ncases = 0; + sw.size = SWSIZE; + sw.values = newarray(SWSIZE, sizeof *sw.values, FUNC); + sw.labels = newarray(SWSIZE, sizeof *sw.labels, FUNC); + refinc /= 10.0; + statement(loop, &sw, lev); + if (sw.deflab == NULL) { + sw.deflab = findlabel(lab); + definelab(lab); + if (sw.ncases == 0) + warning("switch statement with no cases\n"); + } + if (findlabel(lab + 1)->ref) + definelab(lab + 1); + tail = codelist; + codelist = head->prev; + codelist->next = head->prev = NULL; + if (sw.ncases > 0) + swgen(&sw); + branch(lab); + head->next->prev = codelist; + codelist->next = head->next; + codelist = tail; +} +static void caselabel(Swtch swp, long val, int lab) { + int k; + + if (swp->ncases >= swp->size) + { + long *vals = swp->values; + Symbol *labs = swp->labels; + swp->size *= 2; + swp->values = newarray(swp->size, sizeof *swp->values, FUNC); + swp->labels = newarray(swp->size, sizeof *swp->labels, FUNC); + for (k = 0; k < swp->ncases; k++) { + swp->values[k] = vals[k]; + swp->labels[k] = labs[k]; + } + } + k = swp->ncases; + for ( ; k > 0 && swp->values[k-1] >= val; k--) { + swp->values[k] = swp->values[k-1]; + swp->labels[k] = swp->labels[k-1]; + } + if (k < swp->ncases && swp->values[k] == val) + error("duplicate case label `%d'\n", val); + swp->values[k] = val; + swp->labels[k] = findlabel(lab); + ++swp->ncases; + if (Aflag >= 2 && swp->ncases == 258) + warning("more than 257 cases in a switch\n"); +} +void swgen(Swtch swp) { + int *buckets, k, n; + long *v = swp->values; + + buckets = newarray(swp->ncases + 1, + sizeof *buckets, FUNC); + for (n = k = 0; k < swp->ncases; k++, n++) { + buckets[n] = k; + while (n > 0 && den(n-1, k) >= density) + n--; + } + buckets[n] = swp->ncases; + swcode(swp, buckets, 0, n - 1); +} +void swcode(Swtch swp, int b[], int lb, int ub) { + int hilab, lolab, l, u, k = (lb + ub)/2; + long *v = swp->values; + + if (k > lb && k < ub) { + lolab = genlabel(1); + hilab = genlabel(1); + } else if (k > lb) { + lolab = genlabel(1); + hilab = swp->deflab->u.l.label; + } else if (k < ub) { + lolab = swp->deflab->u.l.label; + hilab = genlabel(1); + } else + lolab = hilab = swp->deflab->u.l.label; + l = b[k]; + u = b[k+1] - 1; + if (u - l + 1 <= 3) + { + int i; + for (i = l; i <= u; i++) + cmp(EQ, swp->sym, v[i], swp->labels[i]->u.l.label); + if (k > lb && k < ub) + cmp(GT, swp->sym, v[u], hilab); + else if (k > lb) + cmp(GT, swp->sym, v[u], hilab); + else if (k < ub) + cmp(LT, swp->sym, v[l], lolab); + else { + assert(lolab == hilab); + branch(lolab); + } + walk(NULL, 0, 0); + } + else { + Tree e; + Type ty = signedint(swp->sym->type); + Symbol table = genident(STATIC, + array(voidptype, u - l + 1, 0), GLOBAL); + (*IR->defsymbol)(table); + if (!isunsigned(swp->sym->type) || v[l] != 0) + cmp(LT, swp->sym, v[l], lolab); + cmp(GT, swp->sym, v[u], hilab); + e = (*optree['-'])(SUB, cast(idtree(swp->sym), ty), cnsttree(ty, v[l])); + if (e->type->size < unsignedptr->size) + e = cast(e, unsignedlong); + walk(tree(JUMP, voidtype, + rvalue((*optree['+'])(ADD, pointer(idtree(table)), e)), NULL), + 0, 0); + code(Switch); + codelist->u.swtch.table = table; + codelist->u.swtch.sym = swp->sym; + codelist->u.swtch.deflab = swp->deflab; + codelist->u.swtch.size = u - l + 1; + codelist->u.swtch.values = &v[l]; + codelist->u.swtch.labels = &swp->labels[l]; + if (v[u] - v[l] + 1 >= 10000) + warning("switch generates a huge table\n"); + } + if (k > lb) { + assert(lolab != swp->deflab->u.l.label); + definelab(lolab); + swcode(swp, b, lb, k - 1); + } + if (k < ub) { + assert(hilab != swp->deflab->u.l.label); + definelab(hilab); + swcode(swp, b, k + 1, ub); + } +} +static void cmp(int op, Symbol p, long n, int lab) { + Type ty = signedint(p->type); + + listnodes(eqtree(op, + cast(idtree(p), ty), + cnsttree(ty, n)), + lab, 0); +} +void retcode(Tree p) { + Type ty; + + if (p == NULL) { + if (events.returns) + apply(events.returns, cfunc, NULL); + return; + } + p = pointer(p); + ty = assign(freturn(cfunc->type), p); + if (ty == NULL) { + error("illegal return type; found `%t' expected `%t'\n", + p->type, freturn(cfunc->type)); + return; + } + p = cast(p, ty); + if (retv) + { + if (iscallb(p)) + p = tree(RIGHT, p->type, + tree(CALL+B, p->type, + p->kids[0]->kids[0], idtree(retv)), + rvalue(idtree(retv))); + else { + Type ty = retv->type->type; + assert(isstruct(ty)); + if (ty->u.sym->u.s.cfields) { + ty->u.sym->u.s.cfields = 0; + p = asgntree(ASGN, rvalue(idtree(retv)), p); + ty->u.sym->u.s.cfields = 1; + } else + p = asgntree(ASGN, rvalue(idtree(retv)), p); + } + walk(p, 0, 0); + if (events.returns) + apply(events.returns, cfunc, rvalue(idtree(retv))); + return; + } + if (events.returns) + { + Symbol t1 = genident(AUTO, p->type, level); + addlocal(t1); + walk(asgn(t1, p), 0, 0); + apply(events.returns, cfunc, idtree(t1)); + p = idtree(t1); + } + if (!isfloat(p->type)) + p = cast(p, promote(p->type)); + if (isptr(p->type)) + { + Symbol q = localaddr(p); + if (q && (q->computed || q->generated)) + warning("pointer to a %s is an illegal return value\n", + q->scope == PARAM ? "parameter" : "local"); + else if (q) + warning("pointer to %s `%s' is an illegal return value\n", + q->scope == PARAM ? "parameter" : "local", q->name); + } + walk(tree(mkop(RET,p->type), p->type, p, NULL), 0, 0); +} +void definelab(int lab) { + Code cp; + Symbol p = findlabel(lab); + + assert(lab); + walk(NULL, 0, 0); + code(Label)->u.forest = newnode(LABEL+V, NULL, NULL, p); + for (cp = codelist->prev; cp->kind <= Label; ) + cp = cp->prev; + while ( cp->kind == Jump + && cp->u.forest->kids[0] + && specific(cp->u.forest->kids[0]->op) == ADDRG+P + && cp->u.forest->kids[0]->syms[0] == p) { + assert(cp->u.forest->kids[0]->syms[0]->u.l.label == lab); + p->ref--; + assert(cp->next); + assert(cp->prev); + cp->prev->next = cp->next; + cp->next->prev = cp->prev; + cp = cp->prev; + while (cp->kind <= Label) + cp = cp->prev; + } +} +Node jump(int lab) { + Symbol p = findlabel(lab); + + p->ref++; + return newnode(JUMP+V, newnode(ADDRG+ttob(voidptype), NULL, NULL, p), + NULL, NULL); +} +void branch(int lab) { + Code cp; + Symbol p = findlabel(lab); + + assert(lab); + walk(NULL, 0, 0); + code(Label)->u.forest = jump(lab); + for (cp = codelist->prev; cp->kind < Label; ) + cp = cp->prev; + while ( cp->kind == Label + && cp->u.forest->op == LABEL+V + && !equal(cp->u.forest->syms[0], p)) { + equatelab(cp->u.forest->syms[0], p); + assert(cp->next); + assert(cp->prev); + cp->prev->next = cp->next; + cp->next->prev = cp->prev; + cp = cp->prev; + while (cp->kind < Label) + cp = cp->prev; + } + if (cp->kind == Jump || cp->kind == Switch) { + p->ref--; + codelist->prev->next = NULL; + codelist = codelist->prev; + } else { + codelist->kind = Jump; + if (cp->kind == Label + && cp->u.forest->op == LABEL+V + && equal(cp->u.forest->syms[0], p)) + warning("source code specifies an infinite loop\n"); + } +} +void equatelab(Symbol old, Symbol new) { + assert(old->u.l.equatedto == NULL); + old->u.l.equatedto = new; + new->ref++; +} +static int equal(Symbol lprime, Symbol dst) { + assert(dst && lprime); + for ( ; dst; dst = dst->u.l.equatedto) + if (lprime == dst) + return 1; + return 0; +} +/* dostmt - do statement while ( expression ) */ +static void dostmt(int lab, Swtch swp, int lev) { + refinc *= 10.0; + t = gettok(); + definelab(lab); + statement(lab, swp, lev); + definelab(lab + 1); + expect(WHILE); + expect('('); + definept(NULL); + walk(conditional(')'), lab, 0); + if (findlabel(lab + 2)->ref) + definelab(lab + 2); +} + +/* foldcond - check if initial test in for(e1;e2;e3) S is necessary */ +static int foldcond(Tree e1, Tree e2) { + int op = generic(e2->op); + Symbol v; + + if (e1 == 0 || e2 == 0) + return 0; + if (generic(e1->op) == ASGN && isaddrop(e1->kids[0]->op) + && generic(e1->kids[1]->op) == CNST) { + v = e1->kids[0]->u.sym; + e1 = e1->kids[1]; + } else + return 0; + if ((op==LE || op==LT || op==EQ || op==NE || op==GT || op==GE) + && generic(e2->kids[0]->op) == INDIR + && e2->kids[0]->kids[0]->u.sym == v + && e2->kids[1]->op == e1->op) { + e1 = simplify(op, e2->type, e1, e2->kids[1]); + if (e1->op == CNST+I) + return e1->u.v.i; + } + return 0; +} + +/* localaddr - returns q if p yields the address of local/parameter q; otherwise returns 0 */ +static Symbol localaddr(Tree p) { + if (p == NULL) + return NULL; + switch (generic(p->op)) { + case INDIR: case CALL: case ARG: + return NULL; + case ADDRL: case ADDRF: + return p->u.sym; + case RIGHT: case ASGN: + if (p->kids[1]) + return localaddr(p->kids[1]); + return localaddr(p->kids[0]); + case COND: { + Symbol q; + assert(p->kids[1] && p->kids[1]->op == RIGHT); + if ((q = localaddr(p->kids[1]->kids[0])) != NULL) + return q; + return localaddr(p->kids[1]->kids[1]); + } + default: { + Symbol q; + if (p->kids[0] && (q = localaddr(p->kids[0])) != NULL) + return q; + return localaddr(p->kids[1]); + } + } +} + +/* whilestmt - while ( expression ) statement */ +static void whilestmt(int lab, Swtch swp, int lev) { + Coordinate pt; + Tree e; + + refinc *= 10.0; + t = gettok(); + expect('('); + walk(NULL, 0, 0); + pt = src; + e = texpr(conditional, ')', FUNC); + branch(lab + 1); + definelab(lab); + statement(lab, swp, lev); + definelab(lab + 1); + definept(&pt); + walk(e, lab, 0); + if (findlabel(lab + 2)->ref) + definelab(lab + 2); +} diff --git a/src/cmd/lccom-1/string.c b/src/cmd/lccom-1/string.c new file mode 100644 index 0000000..893fc96 --- /dev/null +++ b/src/cmd/lccom-1/string.c @@ -0,0 +1,125 @@ +#include "c.h" + +static struct string { + char *str; + int len; + struct string *link; +} *buckets[1024]; + +static int scatter[] = { /* map characters to random values */ + 2078917053, 143302914, 1027100827, 1953210302, 755253631, + 2002600785, 1405390230, 45248011, 1099951567, 433832350, + 2018585307, 438263339, 813528929, 1703199216, 618906479, + 573714703, 766270699, 275680090, 1510320440, 1583583926, + 1723401032, 1965443329, 1098183682, 1636505764, 980071615, + 1011597961, 643279273, 1315461275, 157584038, 1069844923, + 471560540, 89017443, 1213147837, 1498661368, 2042227746, + 1968401469, 1353778505, 1300134328, 2013649480, 306246424, + 1733966678, 1884751139, 744509763, 400011959, 1440466707, + 1363416242, 973726663, 59253759, 1639096332, 336563455, + 1642837685, 1215013716, 154523136, 593537720, 704035832, + 1134594751, 1605135681, 1347315106, 302572379, 1762719719, + 269676381, 774132919, 1851737163, 1482824219, 125310639, + 1746481261, 1303742040, 1479089144, 899131941, 1169907872, + 1785335569, 485614972, 907175364, 382361684, 885626931, + 200158423, 1745777927, 1859353594, 259412182, 1237390611, + 48433401, 1902249868, 304920680, 202956538, 348303940, + 1008956512, 1337551289, 1953439621, 208787970, 1640123668, + 1568675693, 478464352, 266772940, 1272929208, 1961288571, + 392083579, 871926821, 1117546963, 1871172724, 1771058762, + 139971187, 1509024645, 109190086, 1047146551, 1891386329, + 994817018, 1247304975, 1489680608, 706686964, 1506717157, + 579587572, 755120366, 1261483377, 884508252, 958076904, + 1609787317, 1893464764, 148144545, 1415743291, 2102252735, + 1788268214, 836935336, 433233439, 2055041154, 2109864544, + 247038362, 299641085, 834307717, 1364585325, 23330161, + 457882831, 1504556512, 1532354806, 567072918, 404219416, + 1276257488, 1561889936, 1651524391, 618454448, 121093252, + 1010757900, 1198042020, 876213618, 124757630, 2082550272, + 1834290522, 1734544947, 1828531389, 1982435068, 1002804590, + 1783300476, 1623219634, 1839739926, 69050267, 1530777140, + 1802120822, 316088629, 1830418225, 488944891, 1680673954, + 1853748387, 946827723, 1037746818, 1238619545, 1513900641, + 1441966234, 367393385, 928306929, 946006977, 985847834, + 1049400181, 1956764878, 36406206, 1925613800, 2081522508, + 2118956479, 1612420674, 1668583807, 1800004220, 1447372094, + 523904750, 1435821048, 923108080, 216161028, 1504871315, + 306401572, 2018281851, 1820959944, 2136819798, 359743094, + 1354150250, 1843084537, 1306570817, 244413420, 934220434, + 672987810, 1686379655, 1301613820, 1601294739, 484902984, + 139978006, 503211273, 294184214, 176384212, 281341425, + 228223074, 147857043, 1893762099, 1896806882, 1947861263, + 1193650546, 273227984, 1236198663, 2116758626, 489389012, + 593586330, 275676551, 360187215, 267062626, 265012701, + 719930310, 1621212876, 2108097238, 2026501127, 1865626297, + 894834024, 552005290, 1404522304, 48964196, 5816381, + 1889425288, 188942202, 509027654, 36125855, 365326415, + 790369079, 264348929, 513183458, 536647531, 13672163, + 313561074, 1730298077, 286900147, 1549759737, 1699573055, + 776289160, 2143346068, 1975249606, 1136476375, 262925046, + 92778659, 1856406685, 1884137923, 53392249, 1735424165, + 1602280572 +}; + +char *string(const char *str) { + const char *s; + + for (s = str; *s; s++) + ; + return stringn(str, s - str); +} + +char *stringd(long n) { + char str[25], *s = str + sizeof (str); + unsigned long m; + + if (n == LONG_MIN) + m = (unsigned long)LONG_MAX + 1; + else if (n < 0) + m = -n; + else + m = n; + do + *--s = m%10 + '0'; + while ((m /= 10) != 0); + if (n < 0) + *--s = '-'; + return stringn(s, str + sizeof (str) - s); +} + +char *stringn(const char *str, int len) { + int i; + unsigned int h; + const char *end; + struct string *p; + + assert(str); + for (h = 0, i = len, end = str; i > 0; i--) + h = (h<<1) + scatter[*(unsigned char *)end++]; + h &= NELEMS(buckets)-1; + for (p = buckets[h]; p; p = p->link) + if (len == p->len) { + const char *s1 = str; + char *s2 = p->str; + do { + if (s1 == end) + return p->str; + } while (*s1++ == *s2++); + } + { + static char *next, *strlimit; + if (len + 1 >= strlimit - next) { + int n = len + 4*1024; + next = allocate(n, PERM); + strlimit = next + n; + } + NEW(p, PERM); + p->len = len; + for (p->str = next; str < end; ) + *next++ = *str++; + *next++ = 0; + p->link = buckets[h]; + buckets[h] = p; + return p->str; + } +} diff --git a/src/cmd/lccom-1/sym.c b/src/cmd/lccom-1/sym.c new file mode 100644 index 0000000..ff02236 --- /dev/null +++ b/src/cmd/lccom-1/sym.c @@ -0,0 +1,334 @@ +#include "c.h" +#include + +#define equalp(x) v.x == p->sym.u.c.v.x + +struct table { + int level; + Table previous; + struct entry { + struct symbol sym; + struct entry *link; + } *buckets[256]; + Symbol all; +}; + +#define HASHSIZE NELEMS(((Table)0)->buckets) + +static struct table + cns = { CONSTANTS }, + ext = { GLOBAL }, + ids = { GLOBAL }, + tys = { GLOBAL }; +Table constants = &cns; +Table externals = &ext; +Table identifiers = &ids; +Table globals = &ids; +Table types = &tys; +Table labels; +int level = GLOBAL; +static int tempid; +List loci, symbols; + +Table newtable(int arena) { + Table new; + + NEW0(new, arena); + return new; +} + +Table table(Table tp, int level) { + Table new = newtable(FUNC); + new->previous = tp; + new->level = level; + if (tp) + new->all = tp->all; + return new; +} +void foreach(Table tp, int lev, void (*apply)(Symbol, void *), void *cl) { + assert(tp); + while (tp && tp->level > lev) + tp = tp->previous; + if (tp && tp->level == lev) { + Symbol p; + Coordinate sav; + sav = src; + for (p = tp->all; p && p->scope == lev; p = p->up) { + src = p->src; + (*apply)(p, cl); + } + src = sav; + } +} +void enterscope(void) { + if (++level == LOCAL) + tempid = 0; +} +void exitscope(void) { + rmtypes(level); + if (types->level == level) + types = types->previous; + if (identifiers->level == level) { + if (Aflag >= 2) { + int n = 0; + Symbol p; + for (p = identifiers->all; p && p->scope == level; p = p->up) + if (++n > 127) { + warning("more than 127 identifiers declared in a block\n"); + break; + } + } + identifiers = identifiers->previous; + } + assert(level >= GLOBAL); + --level; +} +Symbol install(const char *name, Table *tpp, int level, int arena) { + Table tp = *tpp; + struct entry *p; + unsigned h = (unsigned long)name&(HASHSIZE-1); + + assert(level == 0 || level >= tp->level); + if (level > 0 && tp->level < level) + tp = *tpp = table(tp, level); + NEW0(p, arena); + p->sym.name = (char *)name; + p->sym.scope = level; + p->sym.up = tp->all; + tp->all = &p->sym; + p->link = tp->buckets[h]; + tp->buckets[h] = p; + return &p->sym; +} +Symbol relocate(const char *name, Table src, Table dst) { + struct entry *p, **q; + Symbol *r; + unsigned h = (unsigned long)name&(HASHSIZE-1); + + for (q = &src->buckets[h]; *q; q = &(*q)->link) + if (name == (*q)->sym.name) + break; + assert(*q); + /* + Remove the entry from src's hash chain + and from its list of all symbols. + */ + p = *q; + *q = (*q)->link; + for (r = &src->all; *r && *r != &p->sym; r = &(*r)->up) + ; + assert(*r == &p->sym); + *r = p->sym.up; + /* + Insert the entry into dst's hash chain + and into its list of all symbols. + Return the symbol-table entry. + */ + p->link = dst->buckets[h]; + dst->buckets[h] = p; + p->sym.up = dst->all; + dst->all = &p->sym; + return &p->sym; +} +Symbol lookup(const char *name, Table tp) { + struct entry *p; + unsigned h = (unsigned long)name&(HASHSIZE-1); + + assert(tp); + do + for (p = tp->buckets[h]; p; p = p->link) + if (name == p->sym.name) + return &p->sym; + while ((tp = tp->previous) != NULL); + return NULL; +} +int genlabel(int n) { + static int label = 1; + + label += n; + return label - n; +} +Symbol findlabel(int lab) { + struct entry *p; + unsigned h = lab&(HASHSIZE-1); + + for (p = labels->buckets[h]; p; p = p->link) + if (lab == p->sym.u.l.label) + return &p->sym; + NEW0(p, FUNC); + p->sym.name = stringd(lab); + p->sym.scope = LABELS; + p->sym.up = labels->all; + labels->all = &p->sym; + p->link = labels->buckets[h]; + labels->buckets[h] = p; + p->sym.generated = 1; + p->sym.u.l.label = lab; + (*IR->defsymbol)(&p->sym); + return &p->sym; +} +Symbol constant(Type ty, Value v) { + struct entry *p; + unsigned h = v.u&(HASHSIZE-1); + static union { int x; char endian; } little = { 1 }; + + ty = unqual(ty); + for (p = constants->buckets[h]; p; p = p->link) + if (eqtype(ty, p->sym.type, 1)) + switch (ty->op) { + case INT: if (equalp(i)) return &p->sym; break; + case UNSIGNED: if (equalp(u)) return &p->sym; break; + case FLOAT: + if (v.d == 0.0) { + float z1 = v.d, z2 = p->sym.u.c.v.d; + char *b1 = (char *)&z1, *b2 = (char *)&z2; + if (z1 == z2 + && ((!little.endian && b1[0] == b2[0]) + || (little.endian && b1[sizeof (z1)-1] == b2[sizeof (z2)-1]))) + return &p->sym; + } else if (equalp(d)) + return &p->sym; + break; + case FUNCTION: if (equalp(g)) return &p->sym; break; + case ARRAY: + case POINTER: if (equalp(p)) return &p->sym; break; + default: assert(0); + } + NEW0(p, PERM); + p->sym.name = vtoa(ty, v); + p->sym.scope = CONSTANTS; + p->sym.type = ty; + p->sym.sclass = STATIC; + p->sym.u.c.v = v; + p->link = constants->buckets[h]; + p->sym.up = constants->all; + constants->all = &p->sym; + constants->buckets[h] = p; + if (ty->u.sym && !ty->u.sym->addressed) + (*IR->defsymbol)(&p->sym); + p->sym.defined = 1; + return &p->sym; +} +Symbol intconst(int n) { + Value v; + + v.i = n; + return constant(inttype, v); +} +Symbol genident(int scls, Type ty, int lev) { + Symbol p; + + NEW0(p, lev >= LOCAL ? FUNC : PERM); + p->name = stringd(genlabel(1)); + p->scope = lev; + p->sclass = scls; + p->type = ty; + p->generated = 1; + if (lev == GLOBAL) + (*IR->defsymbol)(p); + return p; +} + +Symbol temporary(int scls, Type ty) { + Symbol p; + + NEW0(p, FUNC); + p->name = stringd(++tempid); + p->scope = level < LOCAL ? LOCAL : level; + p->sclass = scls; + p->type = ty; + p->temporary = 1; + p->generated = 1; + return p; +} +Symbol newtemp(int sclass, int tc, int size) { + Symbol p = temporary(sclass, btot(tc, size)); + + (*IR->local)(p); + p->defined = 1; + return p; +} + +Symbol allsymbols(Table tp) { + return tp->all; +} + +void locus(Table tp, Coordinate *cp) { + loci = append(cp, loci); + symbols = append(allsymbols(tp), symbols); +} + +void use(Symbol p, Coordinate src) { + Coordinate *cp; + + NEW(cp, PERM); + *cp = src; + p->uses = append(cp, p->uses); +} +/* findtype - find type ty in identifiers */ +Symbol findtype(Type ty) { + Table tp = identifiers; + int i; + struct entry *p; + + assert(tp); + do + for (i = 0; i < HASHSIZE; i++) + for (p = tp->buckets[i]; p; p = p->link) + if (p->sym.type == ty && p->sym.sclass == TYPEDEF) + return &p->sym; + while ((tp = tp->previous) != NULL); + return NULL; +} + +/* mkstr - make a string constant */ +Symbol mkstr(char *str) { + Value v; + Symbol p; + + v.p = str; + p = constant(array(chartype, strlen(v.p) + 1, 0), v); + if (p->u.c.loc == NULL) + p->u.c.loc = genident(STATIC, p->type, GLOBAL); + return p; +} + +/* mksymbol - make a symbol for name, install in &globals if sclass==EXTERN */ +Symbol mksymbol(int sclass, const char *name, Type ty) { + Symbol p; + + if (sclass == EXTERN) + p = install(string(name), &globals, GLOBAL, PERM); + else { + NEW0(p, PERM); + p->name = string(name); + p->scope = GLOBAL; + } + p->sclass = sclass; + p->type = ty; + (*IR->defsymbol)(p); + p->defined = 1; + return p; +} + +/* + * vtoa - return string for the constant v of type ty + */ +char *vtoa(Type ty, Value v) +{ + ty = unqual(ty); + switch (ty->op) { + case INT: return stringd(v.i); + case UNSIGNED: return stringf((v.u&~0x7FFF) ? "0x%X" : "%U", v.u); + case FLOAT: return stringf("%g", (double)v.d); + case ARRAY: + if (ty->type == chartype || ty->type == signedchar + || ty->type == unsignedchar) + return v.p; + return stringf("%p", v.p); + case POINTER: return stringf("%p", v.p); + case FUNCTION: return stringf("%p", v.g); + } + assert(0); + return NULL; +} diff --git a/src/cmd/lccom-1/symbolic.c b/src/cmd/lccom-1/symbolic.c new file mode 100644 index 0000000..cdb8339 --- /dev/null +++ b/src/cmd/lccom-1/symbolic.c @@ -0,0 +1,524 @@ +#include +#include +#include "c.h" + +#define I(f) s_##f + +static Node *tail; +static int off, maxoff, uid = 0, verbose = 0, html = 0; + +static const char *yyBEGIN(const char *tag) { + if (html) + print("<%s>", tag); + return tag; +} + +static void yyEND(const char *tag) { + if (html) + print("", tag); + if (isupper(*tag)) + print("\n"); +} + +#define BEGIN(tag) do { const char *yytag=yyBEGIN(#tag) +#define END yyEND(yytag); } while (0) +#define ITEM BEGIN(li) +#define START BEGIN(LI) +#define ANCHOR(attr,code) do { const char *yytag="a"; if (html) { printf(""); } +#define NEWLINE print(html ? "
    \n" : "\n") + +static void emitCoord(Coordinate src) { + if (src.file && *src.file) { + ANCHOR(href,print("%s", src.file)); print("%s", src.file); END; + print(":"); + } + print("%d.%d", src.y, src.x); +} + +static void emitString(int len, const char *s) { + for ( ; len-- > 0; s++) + if (*s == '&' && html) + print("&"); + else if (*s == '<' && html) + print("<"); + else if (*s == '>' && html) + print("<"); + else if (*s == '"' || *s == '\\') + print("\\%c", *s); + else if (*s >= ' ' && *s < 0177) + print("%c", *s); + else + print("\\%d%d%d", (*s>>6)&3, (*s>>3)&7, *s&7); +} + +static void emitSymRef(Symbol p) { + (*IR->defsymbol)(p); + ANCHOR(href,print("#%s", p->x.name)); BEGIN(code); print("%s", p->name); END; END; +} + +static void emitSymbol(Symbol p) { + (*IR->defsymbol)(p); + ANCHOR(name,print("%s", p->x.name)); BEGIN(code); print("%s", p->name); END; END; + BEGIN(ul); +#define xx(field,code) ITEM; if (!html) print(" "); print(#field "="); code; END + if (verbose && (src.y || src.x)) + xx(src,emitCoord(p->src)); + xx(type,print("%t", p->type)); + xx(sclass,print("%k", p->sclass)); + switch (p->scope) { + case CONSTANTS: xx(scope,print("CONSTANTS")); break; + case LABELS: xx(scope,print("LABELS")); break; + case GLOBAL: xx(scope,print("GLOBAL")); break; + case PARAM: xx(scope,print("PARAM")); break; + case LOCAL: xx(scope,print("LOCAL")); break; + default: + if (p->scope > LOCAL) + xx(scope,print("LOCAL+%d", p->scope-LOCAL)); + else + xx(scope,print("%d", p->scope)); + } + ITEM; + int n = 0; + if (!html) + print(" "); + print("flags="); +#define yy(f) if (p->f) { if (n++) print("|"); print(#f); } + yy(structarg) + yy(addressed) + yy(computed) + yy(temporary) + yy(generated) +#undef yy + if (n == 0) + print("0"); + END; + if (p->scope >= PARAM && p->sclass != STATIC) + xx(offset,print("%d", p->x.offset)); + xx(ref,print("%f", p->ref)); + if (p->temporary && p->u.t.cse) + xx(u.t.cse,print("%p", p->u.t.cse)); + END; +#undef xx +} + +/* address - initialize q for addressing expression p+n */ +static void I(address)(Symbol q, Symbol p, long n) { + q->name = stringf("%s%s%D", p->name, n > 0 ? "+" : "", n); + (*IR->defsymbol)(q); + START; print("address "); emitSymbol(q); END; +} + +/* blockbeg - start a block */ +static void I(blockbeg)(Env *e) { + e->offset = off; + START; print("blockbeg off=%d", off); END; +} + +/* blockend - start a block */ +static void I(blockend)(Env *e) { + if (off > maxoff) + maxoff = off; + START; print("blockend off=%d", off); END; + off = e->offset; +} + +/* defaddress - initialize an address */ +static void I(defaddress)(Symbol p){ + START; print("defaddress "); emitSymRef(p); END; +} + +/* defconst - define a constant */ +static void I(defconst)(int suffix, int size, Value v) { + START; + print("defconst "); + switch (suffix) { + case I: + print("int.%d ", size); + BEGIN(code); + if (size > sizeof (int)) + print("%D", v.i); + else + print("%d", (int)v.i); + END; + break; + case U: + print("unsigned.%d ", size); + BEGIN(code); + if (size > sizeof (unsigned)) + print("%U", v.u); + else + print("%u", (unsigned)v.u); + END; + break; + case P: print("void*.%d ", size); BEGIN(code); print("%p", v.p); END; break; + case F: + print("float.%d ", size); + BEGIN(code); + double d = v.d; + if (d == 0.0) { + static union { int x; char endian; } little = { 1 }; + signed char *b = (signed char *)&d; + if ((!little.endian && b[0] < 0) + || (little.endian && b[sizeof (d)-1] < 0)) + print("-0.0"); + else + print("0.0"); + } else + print("%g", d); + END; + break; + default: assert(0); + } + END; +} + +/* defstring - emit a string constant */ +static void I(defstring)(int len, char *s) { + START; print("defstring "); + BEGIN(code); print("\""); emitString(len, s); print("\""); END; + END; +} + +/* defsymbol - define a symbol: initialize p->x */ +static void I(defsymbol)(Symbol p) { + if (p->x.name == NULL) + p->x.name = stringd(++uid); +} + +/* emit - emit the dags on list p */ +static void I(emit)(Node p){ + ITEM; + if (!html) + print(" "); + for (; p; p = p->x.next) { + if (p->op == LABEL+V) { + assert(p->syms[0]); + ANCHOR(name,print("%s", p->syms[0]->x.name)); + BEGIN(code); print("%s", p->syms[0]->name); END; + END; + print(":"); + } else { + int i; + if (p->x.listed) { + BEGIN(strong); print("%d", p->x.inst); END; print("'"); + print(" %s", opname(p->op)); + } else + print("%d. %s", p->x.inst, opname(p->op)); + if (p->count > 1) + print(" count=%d", p->count); + for (i = 0; i < NELEMS(p->kids) && p->kids[i]; i++) + print(" #%d", p->kids[i]->x.inst); + if (generic(p->op) == CALL && p->syms[0] && p->syms[0]->type) + print(" {%t}", p->syms[0]->type); + else + for (i = 0; i < NELEMS(p->syms) && p->syms[i]; i++) { + print(" "); + if (p->syms[i]->scope == CONSTANTS) + print(p->syms[i]->name); + else + emitSymRef(p->syms[i]); + } + } + NEWLINE; + } + END; +} + +/* export - announce p as exported */ +static void I(export)(Symbol p) { + START; print("export "); emitSymRef(p); END; +} + +/* function - generate code for a function */ +static void I(function)(Symbol f, Symbol caller[], Symbol callee[], int ncalls) { + int i; + + (*IR->defsymbol)(f); + off = 0; + for (i = 0; caller[i] && callee[i]; i++) { + off = roundup(off, caller[i]->type->align); + caller[i]->x.offset = callee[i]->x.offset = off; + off += caller[i]->type->size; + } + if (!html) { + print("function "); + emitSymbol(f); + print(" ncalls=%d\n", ncalls); + for (i = 0; caller[i]; i++) + START; print("caller "); emitSymbol(caller[i]); END; + for (i = 0; callee[i]; i++) + START; print("callee "); emitSymbol(callee[i]); END; + } else { + START; + print("function"); + BEGIN(UL); +#define xx(field,code) ITEM; print(#field "="); code; END + xx(f,emitSymbol(f)); + xx(ncalls,print("%d", ncalls)); + if (caller[0]) { + ITEM; print("caller"); BEGIN(OL); + for (i = 0; caller[i]; i++) + ITEM; emitSymbol(caller[i]); END; + END; END; + ITEM; print("callee"); BEGIN(OL); + for (i = 0; callee[i]; i++) + ITEM; emitSymbol(callee[i]); END; + END; END; + } else { + xx(caller,BEGIN(em); print("empty"); END); + xx(callee,BEGIN(em); print("empty"); END); + } + END; + END; + } + maxoff = off = 0; + gencode(caller, callee); + if (html) + START; print("emitcode"); BEGIN(ul); emitcode(); END; END; + else + emitcode(); + START; print("maxoff=%d", maxoff); END; +#undef xx +} + +/* visit - generate code for *p */ +static int visit(Node p, int n) { + if (p && p->x.inst == 0) { + p->x.inst = ++n; + n = visit(p->kids[0], n); + n = visit(p->kids[1], n); + *tail = p; + tail = &p->x.next; + } + return n; +} + +/* gen0 - generate code for the dags on list p */ +static Node I(gen)(Node p) { + int n; + Node nodelist; + + tail = &nodelist; + for (n = 0; p; p = p->link) { + switch (generic(p->op)) { /* check for valid forest */ + case CALL: + assert(IR->wants_dag || p->count == 0); + break; + case ARG: + case ASGN: case JUMP: case LABEL: case RET: + case EQ: case GE: case GT: case LE: case LT: case NE: + assert(p->count == 0); + break; + case INDIR: + assert(IR->wants_dag && p->count > 0); + break; + default: + assert(0); + } + check(p); + p->x.listed = 1; + n = visit(p, n); + } + *tail = 0; + return nodelist; +} + +/* global - announce a global */ +static void I(global)(Symbol p) { + START; print("global "); emitSymbol(p); END; +} + +/* import - import a symbol */ +static void I(import)(Symbol p) { + START; print("import "); emitSymRef(p); END; +} + +/* local - local variable */ +static void I(local)(Symbol p) { + if (p->temporary) + p->name = stringf("t%s", p->name); + (*IR->defsymbol)(p); + off = roundup(off, p->type->align); + p->x.offset = off; + off += p->type->size; + START; print(p->temporary ? "temporary " : "local "); emitSymbol(p); END; +} + +/* progbeg - beginning of program */ +static void I(progbeg)(int argc, char *argv[]) { + int i; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "-v") == 0) + verbose++; + else if (strcmp(argv[i], "-html") == 0) + html++; + if (html) { + print("\n"); + print(""); + BEGIN(head); + if (firstfile && *firstfile) + BEGIN(title); emitString(strlen(firstfile), firstfile); END; + print("\n"); + END; + print("\n"); + if (firstfile && *firstfile) + BEGIN(h1); emitString(strlen(firstfile), firstfile); END; + BEGIN(P); BEGIN(em); + print("Links lead from uses of identifiers and labels to their definitions."); + END; END; + print("
      \n"); + START; + print("progbeg"); + BEGIN(ol); + for (i = 1; i < argc; i++) { + ITEM; + BEGIN(code); print("\""); emitString(strlen(argv[i]), argv[i]); print("\""); END; + END; + } + END; + END; + } +} + +/* progend - end of program */ +static void I(progend)(void) { + START; print("progend"); END; + if (html) { + time_t t; + print("
    \n"); + time(&t); + print("
    %s
    \n", ctime(&t)); + print("\n"); + } +} + +/* segment - switch to segment s */ +static void I(segment)(int s) { + START; print("segment %s", &"text\0bss\0.data\0lit\0.sym\0."[5*s-5]); END; +} + +/* space - initialize n bytes of space */ +static void I(space)(int n) { + START; print("space %d", n); END; +} + +static void I(stabblock)(int brace, int lev, Symbol *p) {} + +/* stabend - finalize stab output */ +static void I(stabend)(Coordinate *cp, Symbol p, Coordinate **cpp, Symbol *sp, Symbol *stab) { + int i; + + if (p) + emitSymRef(p); + print("\n"); + if (cpp && sp) + for (i = 0; cpp[i] && sp[i]; i++) { + print("%w.%d: ", cpp[i], cpp[i]->x); + emitSymRef(sp[i]); + print("\n"); + } +} + +static void I(stabfend)(Symbol p, int lineno) {} +static void I(stabinit)(char *file, int argc, char *argv[]) {} + +/* stabline - emit line number information for source coordinate *cp */ +static void I(stabline)(Coordinate *cp) { + if (cp->file) + print("%s:", cp->file); + print("%d.%d:\n", cp->y, cp->x); +} + +static void I(stabsym)(Symbol p) {} +static void I(stabtype)(Symbol p) {} + +Interface symbolicIR = { + { 1, 1, 0 }, /* char */ + { 2, 2, 0 }, /* short */ + { 4, 4, 0 }, /* int */ + { 4, 4, 0 }, /* long */ + { 4, 4, 0 }, /* long long */ + { 4, 4, 1 }, /* float */ + { 8, 8, 1 }, /* double */ + { 8, 8, 1 }, /* long double */ + { 4, 4, 0 }, /* T* */ + { 0, 4, 0 }, /* struct */ + 0, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 1, /* wants_argb */ + 1, /* left_to_right */ + 1, /* wants_dag */ + 0, /* unsigned_char */ + I(address), + I(blockbeg), + I(blockend), + I(defaddress), + I(defconst), + I(defstring), + I(defsymbol), + I(emit), + I(export), + I(function), + I(gen), + I(global), + I(import), + I(local), + I(progbeg), + I(progend), + I(segment), + I(space), + I(stabblock), + I(stabend), + I(stabfend), + I(stabinit), + I(stabline), + I(stabsym), + I(stabtype) +}; + +Interface symbolic64IR = { + { 1, 1, 0 }, /* char */ + { 2, 2, 0 }, /* short */ + { 4, 4, 0 }, /* int */ + { 8, 8, 0 }, /* long */ + { 8, 8, 0 }, /* long long */ + { 4, 4, 1 }, /* float */ + { 8, 8, 1 }, /* double */ + { 8, 8, 1 }, /* long double */ + { 8, 8, 0 }, /* T* */ + { 0, 1, 0 }, /* struct */ + 1, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 1, /* wants_argb */ + 1, /* left_to_right */ + 1, /* wants_dag */ + 0, /* unsigned_char */ + I(address), + I(blockbeg), + I(blockend), + I(defaddress), + I(defconst), + I(defstring), + I(defsymbol), + I(emit), + I(export), + I(function), + I(gen), + I(global), + I(import), + I(local), + I(progbeg), + I(progend), + I(segment), + I(space), + I(stabblock), + I(stabend), + I(stabfend), + I(stabinit), + I(stabline), + I(stabsym), + I(stabtype) +}; diff --git a/src/cmd/lccom-1/token.h b/src/cmd/lccom-1/token.h new file mode 100644 index 0000000..12e5f2b --- /dev/null +++ b/src/cmd/lccom-1/token.h @@ -0,0 +1,133 @@ +/* + * xx(symbol, value, prec, op, optree, kind, string) + */ +yy(0, 0, 0, 0, 0, 0, 0) +xx(FLOAT, 1, 0, 0, 0, CHAR, "float") +xx(DOUBLE, 2, 0, 0, 0, CHAR, "double") +xx(CHAR, 3, 0, 0, 0, CHAR, "char") +xx(SHORT, 4, 0, 0, 0, CHAR, "short") +xx(INT, 5, 0, 0, 0, CHAR, "int") +xx(UNSIGNED, 6, 0, 0, 0, CHAR, "unsigned") +xx(POINTER, 7, 0, 0, 0, 0, "pointer") +xx(VOID, 8, 0, 0, 0, CHAR, "void") +xx(STRUCT, 9, 0, 0, 0, CHAR, "struct") +xx(UNION, 10, 0, 0, 0, CHAR, "union") +xx(FUNCTION, 11, 0, 0, 0, 0, "function") +xx(ARRAY, 12, 0, 0, 0, 0, "array") +xx(ENUM, 13, 0, 0, 0, CHAR, "enum") +xx(LONG, 14, 0, 0, 0, CHAR, "long") +xx(CONST, 15, 0, 0, 0, CHAR, "const") +xx(VOLATILE, 16, 0, 0, 0, CHAR, "volatile") +yy(0, 17, 0, 0, 0, 0, 0) +yy(0, 18, 0, 0, 0, 0, 0) +yy(0, 19, 0, 0, 0, 0, 0) +yy(0, 20, 0, 0, 0, 0, 0) +yy(0, 21, 0, 0, 0, 0, 0) +yy(0, 22, 0, 0, 0, 0, 0) +yy(0, 23, 0, 0, 0, 0, 0) +yy(0, 24, 0, 0, 0, 0, 0) +yy(0, 25, 0, 0, 0, 0, 0) +yy(0, 26, 0, 0, 0, 0, 0) +yy(0, 27, 0, 0, 0, 0, 0) +yy(0, 28, 0, 0, 0, 0, "long long") +yy(0, 29, 0, 0, 0, 0, 0) +yy(0, 30, 0, 0, 0, 0, 0) +yy(0, 31, 0, 0, 0, 0, "const volatile") +xx(ID, 32, 0, 0, 0, ID, "identifier") +yy(0, 33, 0, 0, 0, ID, "!") +xx(FCON, 34, 0, 0, 0, ID, "floating constant") +xx(ICON, 35, 0, 0, 0, ID, "integer constant") +xx(SCON, 36, 0, 0, 0, ID, "string constant") +yy(0, 37, 13, MOD, bittree,'%', "%") +yy(0, 38, 8, BAND, bittree,ID, "&") +xx(INCR, 39, 0, ADD, addtree,ID, "++") +yy(0, 40, 0, 0, 0, ID, "(") +yy(0, 41, 0, 0, 0, ')', ")") +yy(0, 42, 13, MUL, multree,ID, "*") +yy(0, 43, 12, ADD, addtree,ID, "+") +yy(0, 44, 1, 0, 0, ',', ",") +yy(0, 45, 12, SUB, subtree,ID, "-") +yy(0, 46, 0, 0, 0, '.', ".") +yy(0, 47, 13, DIV, multree,'/', "/") +xx(DECR, 48, 0, SUB, subtree,ID, "--") +xx(DEREF, 49, 0, 0, 0, DEREF, "->") +xx(ANDAND, 50, 5, AND, andtree,ANDAND, "&&") +xx(OROR, 51, 4, OR, andtree,OROR, "||") +xx(LEQ, 52, 10, LE, cmptree,LEQ, "<=") +xx(EQL, 53, 9, EQ, eqtree, EQL, "==") +xx(NEQ, 54, 9, NE, eqtree, NEQ, "!=") +xx(GEQ, 55, 10, GE, cmptree,GEQ, ">=") +xx(RSHIFT, 56, 11, RSH, shtree, RSHIFT, ">>") +xx(LSHIFT, 57, 11, LSH, shtree, LSHIFT, "<<") +yy(0, 58, 0, 0, 0, ':', ":") +yy(0, 59, 0, 0, 0, IF, ";") +yy(0, 60, 10, LT, cmptree,'<', "<") +yy(0, 61, 2, ASGN, asgntree,'=', "=") +yy(0, 62, 10, GT, cmptree,'>', ">") +yy(0, 63, 0, 0, 0, '?', "?") +xx(ELLIPSIS, 64, 0, 0, 0, ELLIPSIS,"...") +xx(SIZEOF, 65, 0, 0, 0, ID, "sizeof") +yy(0, 66, 0, 0, 0, 0, 0) +xx(AUTO, 67, 0, 0, 0, STATIC, "auto") +xx(BREAK, 68, 0, 0, 0, IF, "break") +xx(CASE, 69, 0, 0, 0, IF, "case") +xx(CONTINUE, 70, 0, 0, 0, IF, "continue") +xx(DEFAULT, 71, 0, 0, 0, IF, "default") +xx(DO, 72, 0, 0, 0, IF, "do") +xx(ELSE, 73, 0, 0, 0, IF, "else") +xx(EXTERN, 74, 0, 0, 0, STATIC, "extern") +xx(FOR, 75, 0, 0, 0, IF, "for") +xx(GOTO, 76, 0, 0, 0, IF, "goto") +xx(IF, 77, 0, 0, 0, IF, "if") +xx(REGISTER, 78, 0, 0, 0, STATIC, "register") +xx(RETURN, 79, 0, 0, 0, IF, "return") +xx(SIGNED, 80, 0, 0, 0, CHAR, "signed") +xx(STATIC, 81, 0, 0, 0, STATIC, "static") +xx(SWITCH, 82, 0, 0, 0, IF, "switch") +xx(TYPEDEF, 83, 0, 0, 0, STATIC, "typedef") +xx(WHILE, 84, 0, 0, 0, IF, "while") +xx(TYPECODE, 85, 0, 0, 0, ID, "__typecode") +xx(FIRSTARG, 86, 0, 0, 0, ID, "__firstarg") +yy(0, 87, 0, 0, 0, 0, 0) +yy(0, 88, 0, 0, 0, 0, 0) +yy(0, 89, 0, 0, 0, 0, 0) +yy(0, 90, 0, 0, 0, 0, 0) +yy(0, 91, 0, 0, 0, '[', "[") +yy(0, 92, 0, 0, 0, 0, 0) +yy(0, 93, 0, 0, 0, ']', "]") +yy(0, 94, 7, BXOR, bittree,'^', "^") +yy(0, 95, 0, 0, 0, 0, 0) +yy(0, 96, 0, 0, 0, 0, 0) +yy(0, 97, 0, 0, 0, 0, 0) +yy(0, 98, 0, 0, 0, 0, 0) +yy(0, 99, 0, 0, 0, 0, 0) +yy(0, 100, 0, 0, 0, 0, 0) +yy(0, 101, 0, 0, 0, 0, 0) +yy(0, 102, 0, 0, 0, 0, 0) +yy(0, 103, 0, 0, 0, 0, 0) +yy(0, 104, 0, 0, 0, 0, 0) +yy(0, 105, 0, 0, 0, 0, 0) +yy(0, 106, 0, 0, 0, 0, 0) +yy(0, 107, 0, 0, 0, 0, 0) +yy(0, 108, 0, 0, 0, 0, 0) +yy(0, 109, 0, 0, 0, 0, 0) +yy(0, 110, 0, 0, 0, 0, 0) +yy(0, 111, 0, 0, 0, 0, 0) +yy(0, 112, 0, 0, 0, 0, 0) +yy(0, 113, 0, 0, 0, 0, 0) +yy(0, 114, 0, 0, 0, 0, 0) +yy(0, 115, 0, 0, 0, 0, 0) +yy(0, 116, 0, 0, 0, 0, 0) +yy(0, 117, 0, 0, 0, 0, 0) +yy(0, 118, 0, 0, 0, 0, 0) +yy(0, 119, 0, 0, 0, 0, 0) +yy(0, 120, 0, 0, 0, 0, 0) +yy(0, 121, 0, 0, 0, 0, 0) +yy(0, 122, 0, 0, 0, 0, 0) +yy(0, 123, 0, 0, 0, IF, "{") +yy(0, 124, 6, BOR, bittree,'|', "|") +yy(0, 125, 0, 0, 0, '}', "}") +yy(0, 126, 0, BCOM, 0, ID, "~") +xx(EOI, 127, 0, 0, 0, EOI, "end of input") +#undef xx +#undef yy diff --git a/src/cmd/lccom-1/trace.c b/src/cmd/lccom-1/trace.c new file mode 100644 index 0000000..2bdf107 --- /dev/null +++ b/src/cmd/lccom-1/trace.c @@ -0,0 +1,169 @@ +#include "c.h" + +static char *fmt, *fp, *fmtend; /* format string, current & limit pointer */ +static Tree args; /* printf arguments */ +static Symbol frameno; /* local holding frame number */ + +/* appendstr - append str to the evolving format string, expanding it if necessary */ +static void appendstr(char *str) { + do { + if (fp == fmtend) { + if (fp) { + char *s = allocate(2*(fmtend - fmt), FUNC); + strncpy(s, fmt, fmtend - fmt); + fp = s + (fmtend - fmt); + fmtend = s + 2*(fmtend - fmt); + fmt = s; + } else { + fp = fmt = allocate(80, FUNC); + fmtend = fmt + 80; + } + } + } while ((*fp++ = *str++) != 0); + fp--; +} + +/* tracevalue - append format and argument to print the value of e */ +static void tracevalue(Tree e, int lev) { + Type ty = unqual(e->type); + + switch (ty->op) { + case INT: + if (ty == chartype || ty == signedchar) + appendstr("'\\x%02x'"); + else if (ty == longtype) + appendstr("0x%ld"); + else + appendstr("0x%d"); + break; + case UNSIGNED: + if (ty == chartype || ty == unsignedchar) + appendstr("'\\x%02x'"); + else if (ty == unsignedlong) + appendstr("0x%lx"); + else + appendstr("0x%x"); + break; + case FLOAT: + if (ty == longdouble) + appendstr("%Lg"); + else + appendstr("%g"); + break; + case POINTER: + if (unqual(ty->type) == chartype + || unqual(ty->type) == signedchar + || unqual(ty->type) == unsignedchar) { + static Symbol null; + if (null == NULL) + null = mkstr("(null)"); + tracevalue(cast(e, unsignedtype), lev + 1); + appendstr(" \"%.30s\""); + e = condtree(e, e, pointer(idtree(null->u.c.loc))); + } else { + appendstr("("); appendstr(typestring(ty, "")); appendstr(")0x%x"); + } + break; + case STRUCT: { + Field q; + appendstr("("); appendstr(typestring(ty, "")); appendstr("){"); + for (q = ty->u.sym->u.s.flist; q; q = q->link) { + appendstr(q->name); appendstr("="); + tracevalue(field(addrof(e), q->name), lev + 1); + if (q->link) + appendstr(","); + } + appendstr("}"); + return; + } + case UNION: + appendstr("("); appendstr(typestring(ty, "")); appendstr("){...}"); + return; + case ARRAY: + if (lev && ty->type->size > 0) { + int i; + e = pointer(e); + appendstr("{"); + for (i = 0; i < ty->size/ty->type->size; i++) { + Tree p = (*optree['+'])(ADD, e, consttree(i, inttype)); + if (isptr(p->type) && isarray(p->type->type)) + p = retype(p, p->type->type); + else + p = rvalue(p); + if (i) + appendstr(","); + tracevalue(p, lev + 1); + } + appendstr("}"); + } else + appendstr(typestring(ty, "")); + return; + default: + assert(0); + } + e = cast(e, promote(ty)); + args = tree(mkop(ARG,e->type), e->type, e, args); +} + +/* tracefinis - complete & generate the trace call to print */ +static void tracefinis(Symbol printer) { + Tree *ap; + Symbol p; + + *fp = 0; + p = mkstr(string(fmt)); + for (ap = &args; *ap; ap = &(*ap)->kids[1]) + ; + *ap = tree(ARG+P, charptype, pointer(idtree(p->u.c.loc)), 0); + walk(calltree(pointer(idtree(printer)), freturn(printer->type), args, NULL), 0, 0); + args = 0; + fp = fmtend = 0; +} + +/* tracecall - generate code to trace entry to f */ +static void tracecall(Symbol printer, Symbol f, void *ignore) { + int i; + Symbol counter = genident(STATIC, inttype, GLOBAL); + + defglobal(counter, BSS); + (*IR->space)(counter->type->size); + frameno = genident(AUTO, inttype, level); + addlocal(frameno); + appendstr(f->name); appendstr("#"); + tracevalue(asgn(frameno, incr(INCR, idtree(counter), consttree(1, inttype))), 0); + appendstr("("); + for (i = 0; f->u.f.callee[i]; i++) { + if (i) + appendstr(","); + appendstr(f->u.f.callee[i]->name); appendstr("="); + tracevalue(idtree(f->u.f.callee[i]), 0); + } + if (variadic(f->type)) + appendstr(",..."); + appendstr(") called\n"); + tracefinis(printer); +} + +/* tracereturn - generate code to trace return e */ +static void tracereturn(Symbol printer, Symbol f, Tree e) { + appendstr(f->name); appendstr("#"); + tracevalue(idtree(frameno), 0); + appendstr(" returned"); + if (freturn(f->type) != voidtype && e) { + appendstr(" "); + tracevalue(e, 0); + } + appendstr("\n"); + tracefinis(printer); +} + +/* traceInit - initialize for tracing */ +void traceInit(char *arg) { + if (strncmp(arg, "-t", 2) == 0 && strchr(arg, '=') == NULL) { + Symbol printer = mksymbol(EXTERN, arg[2] ? &arg[2] : "printf", + ftype(inttype, ptr(qual(CONST, chartype)), voidtype, NULL)); + printer->defined = 0; + attach((Apply)tracecall, printer, &events.entry); + attach((Apply)tracereturn, printer, &events.returns); + } +} diff --git a/src/cmd/lccom-1/tree.c b/src/cmd/lccom-1/tree.c new file mode 100644 index 0000000..d7543a7 --- /dev/null +++ b/src/cmd/lccom-1/tree.c @@ -0,0 +1,240 @@ +#include "c.h" + +int where = STMT; +static int warn; +static int nid = 1; /* identifies trees & nodes in debugging output */ +static struct nodeid { + int printed; + Tree node; +} ids[500]; /* if ids[i].node == p, then p's id is i */ + +static void printtree1(Tree, int, int); + +Tree tree(int op, Type type, Tree left, Tree right) { + Tree p; + + NEW0(p, where); + p->op = op; + p->type = type; + p->kids[0] = left; + p->kids[1] = right; + return p; +} + +Tree texpr(Tree (*f)(int), int tok, int a) { + int save = where; + Tree p; + + where = a; + p = (*f)(tok); + where = save; + return p; +} +static Tree root1(Tree p) { + if (p == NULL) + return p; + if (p->type == voidtype) + warn++; + switch (generic(p->op)) { + case COND: { + Tree q = p->kids[1]; + assert(q && q->op == RIGHT); + if (p->u.sym && q->kids[0] && generic(q->kids[0]->op) == ASGN) + q->kids[0] = root1(q->kids[0]->kids[1]); + else + q->kids[0] = root1(q->kids[0]); + if (p->u.sym && q->kids[1] && generic(q->kids[1]->op) == ASGN) + q->kids[1] = root1(q->kids[1]->kids[1]); + else + q->kids[1] = root1(q->kids[1]); + p->u.sym = 0; + if (q->kids[0] == 0 && q->kids[1] == 0) + p = root1(p->kids[0]); + } + break; + case AND: case OR: + if ((p->kids[1] = root1(p->kids[1])) == 0) + p = root1(p->kids[0]); + break; + case NOT: + if (warn++ == 0) + warning("expression with no effect elided\n"); + return root1(p->kids[0]); + case RIGHT: + if (p->kids[1] == 0) + return root1(p->kids[0]); + if (p->kids[0] && p->kids[0]->op == CALL+B + && p->kids[1] && p->kids[1]->op == INDIR+B) + /* avoid premature release of the CALL+B temporary */ + return p->kids[0]; + if (p->kids[0] && p->kids[0]->op == RIGHT + && p->kids[1] == p->kids[0]->kids[0]) + /* de-construct e++ construction */ + return p->kids[0]->kids[1]; + p = tree(RIGHT, p->type, root1(p->kids[0]), root1(p->kids[1])); + return p->kids[0] || p->kids[1] ? p : (Tree)0; + case EQ: case NE: case GT: case GE: case LE: case LT: + case ADD: case SUB: case MUL: case DIV: case MOD: + case LSH: case RSH: case BAND: case BOR: case BXOR: + if (warn++ == 0) + warning("expression with no effect elided\n"); + p = tree(RIGHT, p->type, root1(p->kids[0]), root1(p->kids[1])); + return p->kids[0] || p->kids[1] ? p : (Tree)0; + case INDIR: + if (p->type->size == 0 && unqual(p->type) != voidtype) + warning("reference to `%t' elided\n", p->type); + if (isptr(p->kids[0]->type) && isvolatile(p->kids[0]->type->type)) + warning("reference to `volatile %t' elided\n", p->type); + /* fall thru */ + case NEG: case BCOM: case FIELD: + if (warn++ == 0) + warning("expression with no effect elided\n"); + return root1(p->kids[0]); + case ADDRL: case ADDRG: case ADDRF: case CNST: + if (needconst) + return p; + if (warn++ == 0) + warning("expression with no effect elided\n"); + return NULL; + case CVF: + if (optype(p->op) == I + || p->type->size < p->kids[0]->type->size) + if (warn++ == 0) + warning("expression with no effect elided\n"); + return root1(p->kids[0]); + case CVI: + if ((optype(p->op) == U || optype(p->op) == I) + && p->type->size < p->kids[0]->type->size + && specific(p->kids[0]->op) != CALL+I) + if (warn++ == 0) + warning("expression with no effect elided\n"); + return root1(p->kids[0]); + case CVU: case CVP: + if ((optype(p->op) == U && p->type->size < p->kids[0]->type->size) + || (optype(p->op) == I && p->type->size <= p->kids[0]->type->size)) + if (warn++ == 0) + warning("expression with no effect elided\n"); + return root1(p->kids[0]); + case ARG: case ASGN: case CALL: case JUMP: case LABEL: + break; + default: assert(0); + } + return p; +} + +Tree root(Tree p) { + warn = 0; + return root1(p); +} + +char *opname(int op) { + static char *opnames[] = { + "", + "CNST", + "ARG", + "ASGN", + "INDIR", + "CVC", + "CVD", + "CVF", + "CVI", + "CVP", + "CVS", + "CVU", + "NEG", + "CALL", + "*LOAD*", + "RET", + "ADDRG", + "ADDRF", + "ADDRL", + "ADD", + "SUB", + "LSH", + "MOD", + "RSH", + "BAND", + "BCOM", + "BOR", + "BXOR", + "DIV", + "MUL", + "EQ", + "GE", + "GT", + "LE", + "LT", + "NE", + "JUMP", + "LABEL", + "AND", + "NOT", + "OR", + "COND", + "RIGHT", + "FIELD" + }, *suffixes[] = { + "0", "F", "D", "C", "S", "I", "U", "P", "V", "B", + "10","11","12","13","14","15" + }; + + if (generic(op) >= AND && generic(op) <= FIELD && opsize(op) == 0) + return opnames[opindex(op)]; + return stringf("%s%s%s", + opindex(op) > 0 && opindex(op) < NELEMS(opnames) ? + opnames[opindex(op)] : stringd(opindex(op)), + suffixes[optype(op)], opsize(op) > 0 ? stringd(opsize(op)) : ""); +} + +int nodeid(Tree p) { + int i = 1; + + ids[nid].node = p; + while (ids[i].node != p) + i++; + if (i == nid) + ids[nid++].printed = 0; + return i; +} + +/* printed - return pointer to ids[id].printed */ +int *printed(int id) { + if (id) + return &ids[id].printed; + nid = 1; + return 0; +} + +/* printtree - print tree p on fd */ +void printtree(Tree p, int fd) { + (void)printed(0); + printtree1(p, fd, 1); +} + +/* printtree1 - recursively print tree p */ +static void printtree1(Tree p, int fd, int lev) { + FILE *f = fd == 1 ? stdout : stderr; + int i; + static char blanks[] = " "; + + if (p == 0 || *printed(i = nodeid(p))) + return; + fprint(f, "#%d%S%S", i, blanks, i < 10 ? 2 : i < 100 ? 1 : 0, blanks, lev); + fprint(f, "%s %t", opname(p->op), p->type); + *printed(i) = 1; + for (i = 0; i < NELEMS(p->kids); i++) + if (p->kids[i]) + fprint(f, " #%d", nodeid(p->kids[i])); + if (p->op == FIELD && p->u.field) + fprint(f, " %s %d..%d", p->u.field->name, + fieldsize(p->u.field) + fieldright(p->u.field), fieldright(p->u.field)); + else if (generic(p->op) == CNST) + fprint(f, " %s", vtoa(p->type, p->u.v)); + else if (p->u.sym) + fprint(f, " %s", p->u.sym->name); + if (p->node) + fprint(f, " node=%p", p->node); + fprint(f, "\n"); + for (i = 0; i < NELEMS(p->kids); i++) + printtree1(p->kids[i], fd, lev + 1); +} diff --git a/src/cmd/lccom-1/tst/8q.c b/src/cmd/lccom-1/tst/8q.c new file mode 100644 index 0000000..60a65a9 --- /dev/null +++ b/src/cmd/lccom-1/tst/8q.c @@ -0,0 +1,39 @@ +int up[15], down[15], rows[8], x[8]; +int queens(), print(); + +main() +{ + int i; + + for (i = 0; i < 15; i++) + up[i] = down[i] = 1; + for (i = 0; i < 8; i++) + rows[i] = 1; + queens(0); + return 0; +} + +queens(c) +{ + int r; + + for (r = 0; r < 8; r++) + if (rows[r] && up[r-c+7] && down[r+c]) { + rows[r] = up[r-c+7] = down[r+c] = 0; + x[c] = r; + if (c == 7) + print(); + else + queens(c + 1); + rows[r] = up[r-c+7] = down[r+c] = 1; + } +} + +print() +{ + int k; + + for (k = 0; k < 8; k++) + printf("%c ", x[k]+'1'); + printf("\n"); +} diff --git a/src/cmd/lccom-1/tst/array.c b/src/cmd/lccom-1/tst/array.c new file mode 100644 index 0000000..4c967e7 --- /dev/null +++ b/src/cmd/lccom-1/tst/array.c @@ -0,0 +1,48 @@ +int x[3][4], *y[3]; + +main() { + int z[3][4]; + int i, j, *p; + + for (i = 0; i < 3; i++) { + for (j = 0; j < 4; j++) + x[i][j] = 1000*i + j; + y[i] = x[i]; + } + f(); + for (i = 0; i < 3; i++) { + y[i] = p = &z[i][0]; + for (j = 0; j < 4; j++) + p[j] = x[i][j]; + } + g(z, y); + return 0; +} + +f() { + int i, j; + + for (i = 0; i < 3; i++) + for (j = 0; j < 4; j++) + printf(" %d", x[i][j]); + printf("\n"); + for (i = 0; i < 3; i++) + for (j = 0; j < 4; j++) + printf(" %d", y[i][j]); + printf("\n"); +} + +g(x, y) +int x[][4], *y[]; +{ + int i, j; + + for (i = 0; i < 3; i++) + for (j = 0; j < 4; j++) + printf(" %d", x[i][j]); + printf("\n"); + for (i = 0; i < 3; i++) + for (j = 0; j < 4; j++) + printf(" %d", y[i][j]); + printf("\n"); +} diff --git a/src/cmd/lccom-1/tst/cf.c b/src/cmd/lccom-1/tst/cf.c new file mode 100644 index 0000000..28efab7 --- /dev/null +++ b/src/cmd/lccom-1/tst/cf.c @@ -0,0 +1,32 @@ +/* cf - print character frequencies */ +float f[128]; + +main(argc, argv) +int argc; +char *argv[]; +{ + int i, c, nc; + float cutoff, atof(); + + if (argc <= 1) + cutoff = 0.0; + else + cutoff = atof(argv[1])/100; + for (i = 0; i <= 127; ) + f[i++] = 0.0; + nc = 0; + while ((c = getchar()) != -1) { + f[c] += 1; + nc++; + } + printf("char\tfreq\n"); + for (i = 0; i <= 127; ++i) + if (f[i] && f[i]/nc >= cutoff) { + if (i <= ' ') + printf("%03o", i); + else + printf("%c", i); + printf("\t%.1f\n", 100*f[i]/nc); + } + return 0; +} diff --git a/src/cmd/lccom-1/tst/cq.c b/src/cmd/lccom-1/tst/cq.c new file mode 100644 index 0000000..769b538 --- /dev/null +++ b/src/cmd/lccom-1/tst/cq.c @@ -0,0 +1,5316 @@ + struct defs { + int cbits; /* No. of bits per char */ + int ibits; /* int */ + int sbits; /* short */ + int lbits; /* long */ + int ubits; /* unsigned */ + int fbits; /* float */ + int dbits; /* double */ + float fprec; /* Smallest number that can be */ + float dprec; /* significantly added to 1. */ + int flgs; /* Print return codes, by section */ + int flgm; /* Announce machine dependencies */ + int flgd; /* give explicit diagnostics */ + int flgl; /* Report local return codes. */ + int rrc; /* recent return code */ + int crc; /* Cumulative return code */ + char rfs[8]; /* Return from section */ + }; +main(n,args) /* C REFERENCE MANUAL */ +int n; +char **args; +{ + +/* This program performs a series of tests on a C compiler, +based on information in the + + C REFERENCE MANUAL + +which appears as Appendix A to the book "The C Programming +Language" by Brian W. Kernighan and Dennis M. Ritchie +(Prentice-Hall, 1978, $10.95). This Appendix is hereafter +referred to as "the Manual". + + The rules followed in writing this program are: + + 1. The entire program is written in legal C, according + to the Manual. It should compile with no error messages, + although some warning messages may be produced by some + compilers. Failure to compile should be interpreted as + a compiler error. + + 2. The program is clean, in that it does not make use + of any features of the operating system on which it runs, + with the sole exceptions of the printf() function, and an + internal "options" routine, which is easily excised. + + 3. No global variables are used, except for the spec- + ific purpose of testing the global variable facility. + + The program is divided into modules having names of the +form snnn... These modules correspond to those sections of the +Manual, as identified by boldface type headings, in which +there is something to test. For example, s241() corresponds +to section 2.4.1 of the Manual (Integer constants) and tests +the facilities described therein. The module numbering +scheme is ambiguous, especially when it names modules +referring to more than one section; module s7813, for ex- +ample, deals with sections 7.8 through 7.13. Nonetheless, +it is surprisingly easy to find a section in the Manual +corresponding to a section of code, and vice versa. + + Note also that there seem to be "holes" in the program, +at least from the point of view that there exist sections in the +Manual for which there is no corresponding code. Such holes +arise from three causes: (a) there is nothing in that partic- +ular section to test, (b) everything in that section is tested +elsewhere, and (c) it was deemed advisable not to check cer- +tain features like preprocessor or listing control features. + + Modules are called by a main program main(). The mod- +ules that are called, and the sequence in which they are +called, are determined by two lists in main(), in which the +module names appear. The first list (an extern statement) +declares the module names to be external. The second (a stat- +ic int statement) names the modules and defines the sequence +in which they are called. There is no need for these lists +to be in the same order, but it is probably a good idea to keep +them that way in the interest of clarity. Since there are no +cross-linkages between modules, new modules may be added, +or old ones deleted, simply by editing the lists, with one +exception: section s26, which pokes around at the hardware +trying to figure out the characteristics of the machine that +it is running on, saves information that is subsequently +used by sections s626, s72, and s757. If this program is +to be broken up into smallish pieces, say for running on +a microcomputer, take care to see that s26 is called before +calling any of the latter three sections. The size +of the lists, i.e., the number of modules to be called, is +not explicitly specified as a program parameter, but is +determined dynamically using the sizeof operator. + + Communication between the main program and the modules +takes place in two ways. In all cases, a pointer to a structure +is passed to the called module. The structure contains flags +that will determine the type of information to be published +by the module, and fields that may be written in by the +module. The former include "flgm" and "flgd", which, if set +to a nonzero value, specify that machine dependencies are to +be announced or that error messages are to be printed, re- +spectively. The called module's name, and the hardware char- +acteristics probed in s26() comprise the latter. + + + Also, in all cases, a return code is returned by the called +module. A return code of zero indicates that all has gone well; +nonzero indicates otherwise. Since more than one type of error +may be detected by a module, the return code is a composite +of error indicators, which, individually, are given as numbers +that are powers of two. Thus, a return code of 10 indicates +that two specific errors, 8 and 2, were detected. Whether or +not the codes returned by the modules are printed by the main +program is determined by setting "flgs" to 1 (resp. 0). + + The entire logic of the main program is contained in the +half-dozen or so lines at the end. The somewhat cryptic +statement: + + d0.rrc = (*sec[j])(pd0); + +in the for loop calls the modules. The rest of the code is +reasonably straightforward. + + Finally, in each of the modules, there is the following +prologue: + + snnn(pd0) + struct defs *pd0; + { + static char snnner[] = "snnn,er%d\n"; + static char qsnnn[8] = "snnn "; + char *ps, *pt; + int rc; + + rc = 0; + ps = qsnnn; + pt = pd0->rfs; + while(*pt++ = *ps++); + +used for housekeeping, handshaking and module initialization. + + */ + extern + s22(struct defs *), + s241(struct defs *), + s243(struct defs *), + s244(struct defs *), + s25(struct defs *), + s26(struct defs *), + s4(struct defs *), + s61(struct defs *), + s626(struct defs *), + s71(struct defs *), + s72(struct defs *), + s757(struct defs *), + s7813(struct defs *), + s714(struct defs *), + s715(struct defs *), + s81(struct defs *), + s84(struct defs *), + s85(struct defs *), + s86(struct defs *), + s88(struct defs *), + s9(struct defs *) + ; + + int j; + static int (*sec[])() = { + s22, + s241, + s243, + s244, + s25, + s26, + s4, + s61, + s626, + s71, + s72, + s757, + s7813, + s714, + s715, + s81, + s84, + s85, + s86, + s88, + s9 + }; + + static struct defs d0, *pd0; + + d0.flgs = 1; /* These flags dictate */ + d0.flgm = 1; /* the verbosity of */ + d0.flgd = 1; /* the program. */ + d0.flgl = 1; + + pd0 = &d0; + + for (j=0; j rfs; + while (*pt++ = *ps++); + + /* An identifier is a sequence of letters and digits; + the first character must be a letter. The under- + score _ counts as a letter. */ + + a=1; + _=2; + _234=3; + a234=4; + if(a+_+_234+a234 != 10) { + rc = rc+1; + if(pd0->flgd != 0) printf(s22er,1); + } + + /* Upper and lower case letters are different. */ + + A = 2; + if (A == a) { + rc = rc+4; + if (pd0->flgd != 0) printf(s22er,4); + } + + return(rc); +} +s241(pd0) /* 2.4.1 Integer constants + 2.4.2 Explicit long constants */ +struct defs *pd0; +{ + long pow2(); + static char s241er[] = "s241,er%d\n"; + static char qs241[8] = "s241 "; + char *ps, *pt; + int rc, j, lrc; + static long g[39] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,6,0,8,0,12,0,16,0,18,0,20,0,24, + 0,28,0,30,0,32,0,36}; + long d[39], o[39], x[39]; + + rc = 0; + lrc = 0; + ps = qs241; + pt = pd0 -> rfs; + while (*pt++ = *ps++); + + /* An integer constant consisting of a sequence of digits is + taken to be octal if it begins with 0 (digit zero), decimal + otherwise. */ + + if ( 8 != 010 + || 16 != 020 + || 24 != 030 + || 32 != 040 + || 40 != 050 + || 48 != 060 + || 56 != 070 + || 64 != 0100 + || 72 != 0110 + || 80 != 0120 + || 9 != 0011 + || 17 != 0021 + || 25 != 0031 + || 33 != 0041 + || 41 != 0051 + || 49 != 0061 + || 57 != 0071 + || 65 != 0101 + || 73 != 0111 + || 81 != 0121 ){ + + rc = rc+1; + if( pd0->flgd != 0 ) printf(s241er,1); + } + + /* A sequence of digits preceded by 0x or 0X (digit zero) + is taken to be a hexadecimal integer. The hexadecimal + digits include a or A through f or F with values 10 + through 15. */ + + if ( 0x00abcdef != 0xabcdef + || 0xabcdef != 0Xabcdef || 0Xabcdef != 0XAbcdef + || 0XAbcdef != 0XABcdef || 0XABcdef != 0XABCdef + || 0XABCdef != 0XABCDef || 0XABCDef != 0XABCDEf + || 0XABCDEf != 0XABCDEF || 0xABCDEF != 11259375 ){ + + rc = rc+2; + if( pd0->flgd != 0 ) printf(s241er,2); + } + + /* A decimal constant whose value exceeds the largest signed + machine integer is taken to be long; an octal or hex con- + stant which exceeds the largest unsigned machine integer + is likewise taken to be long. */ + + if ( sizeof 010000000000 != sizeof(long) /* 2**30 */ + || sizeof 1073741824 != sizeof(long) /* ditto */ + || sizeof 0x40000000 != sizeof(long) ){ /* " */ + + rc = rc+4; + if( pd0->flgd != 0 ) printf(s241er,4); + } + + /* A decimal, octal, or hexadecimal constant immediately followed + by l (letter ell) or L is a long constant. */ + + if ( sizeof 67l != sizeof(long) + || sizeof 67L != sizeof(long) + || sizeof 067l != sizeof(long) + || sizeof 067L != sizeof(long) + || sizeof 0X67l != sizeof(long) + || sizeof 0x67L != sizeof(long) ){ + + rc = rc+8; + if( pd0 -> flgd != 0 ) printf(s241er,8); + } + + /* Finally, we test to see that decimal (d), octal (o), + and hexadecimal (x) constants representing the same values + agree among themselves, and with computed values, at spec- + ified points over an appropriate range. The points select- + ed here are those with the greatest potential for caus- + ing trouble, i.e., zero, 1-16, and values of 2**n and + 2**n - 1 where n is some multiple of 4 or 6. Unfortunately, + just what happens when a value is too big to fit in a + long is undefined; however, it would be nice if what + happened were at least consistent... */ + + for ( j=0; j<17; j++ ) g[j] = j; + for ( j=18; j<39; ) { + g[j] = pow2(g[j]); + g[j-1] = g[j] - 1; + j = j+2; + } + + d[0] = 0; o[0] = 00; x[0] = 0x0; + d[1] = 1; o[1] = 01; x[1] = 0x1; + d[2] = 2; o[2] = 02; x[2] = 0x2; + d[3] = 3; o[3] = 03; x[3] = 0x3; + d[4] = 4; o[4] = 04; x[4] = 0x4; + d[5] = 5; o[5] = 05; x[5] = 0x5; + d[6] = 6; o[6] = 06; x[6] = 0x6; + d[7] = 7; o[7] = 07; x[7] = 0x7; + d[8] = 8; o[8] = 010; x[8] = 0x8; + d[9] = 9; o[9] = 011; x[9] = 0x9; + d[10] = 10; o[10] = 012; x[10] = 0xa; + d[11] = 11; o[11] = 013; x[11] = 0xb; + d[12] = 12; o[12] = 014; x[12] = 0xc; + d[13] = 13; o[13] = 015; x[13] = 0xd; + d[14] = 14; o[14] = 016; x[14] = 0xe; + d[15] = 15; o[15] = 017; x[15] = 0xf; + d[16] = 16; o[16] = 020; x[16] = 0x10; + d[17] = 63; o[17] = 077; x[17] = 0x3f; + d[18] = 64; o[18] = 0100; x[18] = 0x40; + d[19] = 255; o[19] = 0377; x[19] = 0xff; + d[20] = 256; o[20] = 0400; x[20] = 0x100; + d[21] = 4095; o[21] = 07777; x[21] = 0xfff; + d[22] = 4096; o[22] = 010000; x[22] = 0x1000; + d[23] = 65535; o[23] = 0177777; x[23] = 0xffff; + d[24] = 65536; o[24] = 0200000; x[24] = 0x10000; + d[25] = 262143; o[25] = 0777777; x[25] = 0x3ffff; + d[26] = 262144; o[26] = 01000000; x[26] = 0x40000; + d[27] = 1048575; o[27] = 03777777; x[27] = 0xfffff; + d[28] = 1048576; o[28] = 04000000; x[28] = 0x100000; + d[29] = 16777215; o[29] = 077777777; x[29] = 0xffffff; + d[30] = 16777216; o[30] = 0100000000; x[30] = 0x1000000; + d[31] = 268435455; o[31] = 01777777777; x[31] = 0xfffffff; + d[32] = 268435456; o[32] = 02000000000; x[32] = 0x10000000; + d[33] = 1073741823; o[33] = 07777777777; x[33] = 0x3fffffff; + d[34] = 1073741824; o[34] = 010000000000; x[34] = 0x40000000; + d[35] = 4294967295; o[35] = 037777777777; x[35] = 0xffffffff; + d[36] = 4294967296; o[36] = 040000000000; x[36] = 0x100000000; + d[37] = 68719476735; o[37] = 0777777777777; x[37] = 0xfffffffff; + d[38] = 68719476736; o[38] = 01000000000000; x[38] = 0x1000000000; + + /* WHEW! */ + + for (j=0; j<39; j++){ + if ( g[j] != d[j] + || d[j] != o[j] + || o[j] != x[j]) { + + if( pd0 -> flgm != 0 ) { +/* printf(s241er,16); save in case opinions change... */ + printf("Decimal and octal/hex constants sometimes give\n"); + printf(" different results when assigned to longs.\n"); + } +/* lrc = 1; save... */ + } + } + + if (lrc != 0) rc =16; + + return rc; +} + +long pow2(n) /* Calculate 2**n by multiplying, not shifting */ +long n; +{ + long s; + s = 1; + while(n--) s = s*2; + return s; +} +s243(pd0) /* 2.4.3 Character constants */ +struct defs *pd0; +{ + static char s243er[] = "s243,er%d\n"; + static char qs243[8] = "s243 "; + char *ps, *pt; + int rc; + char chars[256]; + + rc = 0; + ps = qs243; + pt = pd0->rfs; + while(*pt++ = *ps++); + + /* One of the problems that arises when testing character constants + is that of definition: What, exactly, is the character set? + In order to guarantee a certain amount of machine independence, + the character set we will use here is the set of characters writ- + able as escape sequences in C, plus those characters used in writ- + ing C programs, i.e., + + letters: + ABCDEFGHIJKLMNOPQRSTUVWXYZ 26 + abcdefghijklmnopqrstuvwxyz 26 + numbers: + 0123456789 10 + special characters: + ~!"#%&()_=-^|{}[]+;*:<>,.?/ 27 + extra special characters: + newline \n + horizontal tab \t + backspace \b + carriage return \r + form feed \f + backslash \\ + single quote \' 7 + blank & NUL 2 + --- + 98 + + Any specific implementation of C may of course support additional + characters. */ + + /* Since the value of a character constant is the numerical value + of the character in the machine's character set, there should + be a one-to-one correspondence between characters and values. */ + + zerofill(chars); + + chars['a'] = 1; chars['A'] = 1; chars['~'] = 1; chars['0'] = 1; + chars['b'] = 1; chars['B'] = 1; chars['!'] = 1; chars['1'] = 1; + chars['c'] = 1; chars['C'] = 1; chars['"'] = 1; chars['2'] = 1; + chars['d'] = 1; chars['D'] = 1; chars['#'] = 1; chars['3'] = 1; + chars['e'] = 1; chars['E'] = 1; chars['%'] = 1; chars['4'] = 1; + chars['f'] = 1; chars['F'] = 1; chars['&'] = 1; chars['5'] = 1; + chars['g'] = 1; chars['G'] = 1; chars['('] = 1; chars['6'] = 1; + chars['h'] = 1; chars['H'] = 1; chars[')'] = 1; chars['7'] = 1; + chars['i'] = 1; chars['I'] = 1; chars['_'] = 1; chars['8'] = 1; + chars['j'] = 1; chars['J'] = 1; chars['='] = 1; chars['9'] = 1; + chars['k'] = 1; chars['K'] = 1; chars['-'] = 1; + chars['l'] = 1; chars['L'] = 1; chars['^'] = 1; + chars['m'] = 1; chars['M'] = 1; chars['|'] = 1; chars['\n'] = 1; + chars['n'] = 1; chars['N'] = 1; chars['\t'] = 1; + chars['o'] = 1; chars['O'] = 1; chars['{'] = 1; chars['\b'] = 1; + chars['p'] = 1; chars['P'] = 1; chars['}'] = 1; chars['\r'] = 1; + chars['q'] = 1; chars['Q'] = 1; chars['['] = 1; chars['\f'] = 1; + chars['r'] = 1; chars['R'] = 1; chars[']'] = 1; + chars['s'] = 1; chars['S'] = 1; chars['+'] = 1; chars['\\'] = 1; + chars['t'] = 1; chars['T'] = 1; chars[';'] = 1; chars['\''] = 1; + chars['u'] = 1; chars['U'] = 1; chars['*'] = 1; + chars['v'] = 1; chars['V'] = 1; chars[':'] = 1; chars['\0'] = 1; + chars['w'] = 1; chars['W'] = 1; chars['<'] = 1; chars[' '] = 1; + chars['x'] = 1; chars['X'] = 1; chars['>'] = 1; + chars['y'] = 1; chars['Y'] = 1; chars[','] = 1; + chars['z'] = 1; chars['Z'] = 1; chars['.'] = 1; + chars['?'] = 1; + chars['/'] = 1; + + if(sumof(chars) != 98){ + rc = rc+1; + if(pd0->flgd != 0) printf(s243er,1); + } + + /* Finally, the escape \ddd consists of the backslash followed + by 1, 2, or 3 octal digits which are taken to specify the + desired character. */ + + if( '\0' != 0 || '\01' != 1 || '\02' != 2 + || '\03' != 3 || '\04' != 4 || '\05' != 5 + || '\06' != 6 || '\07' != 7 || '\10' != 8 + || '\17' != 15 || '\20' != 16 || '\77' != 63 + || '\100' != 64 || '\177' != 127 ){ + + rc = rc+8; + if(pd0->flgd != 0) printf(s243er,8); + } + + return rc; +} +zerofill(x) +char *x; +{ + int j; + + for (j=0; j<256; j++) *x++ = 0; +} +sumof(x) +char *x; +{ + char *p; + int total, j; + + p = x; + total = 0; + + for(j=0; j<256; j++) total = total+ *p++; + return total; +} +s244(pd0) +struct defs *pd0; +{ + double a[8]; + int rc, lrc, j; + static char s244er[] = "s244,er%d\n"; + static char qs244[8] = "s244 "; + char *ps, *pt; + + ps = qs244; + pt = pd0->rfs; + while(*pt++ = *ps++); + rc = 0; + lrc = 0; + + /* Unfortunately, there's not a lot we can do with floating constants. + We can check to see that the various representations can be com- + piled, that the conversion is such that they yield the same hard- + ware representations in all cases, and that all representations + thus checked are double precision. */ + + a[0] = .1250E+04; + a[1] = 1.250E3; + a[2] = 12.50E02; + a[3] = 125.0e+1; + a[4] = 1250e00; + a[5] = 12500.e-01; + a[6] = 125000e-2; + a[7] = 1250.; + + lrc = 0; + for (j=0; j<7; j++) if(a[j] != a[j+1]) lrc = 1; + + if(lrc != 0) { + if(pd0->flgd != 0) printf(s244er,1); + rc = rc+1; + } + + if ( (sizeof .1250E+04 ) != sizeof(double) + || (sizeof 1.250E3 ) != sizeof(double) + || (sizeof 12.50E02 ) != sizeof(double) + || (sizeof 1.250e+1 ) != sizeof(double) + || (sizeof 1250e00 ) != sizeof(double) + || (sizeof 12500.e-01) != sizeof(double) + || (sizeof 125000e-2 ) != sizeof(double) + || (sizeof 1250. ) != sizeof(double)){ + + if(pd0->flgd != 0) printf(s244er,2); + rc = rc+2; + } + + return rc; +} +s25(pd0) +struct defs *pd0; +{ + char *s, *s2; + int rc, lrc, j; + static char s25er[] = "s25,er%d\n"; + static char qs25[8] = "s25 "; + char *ps, *pt; + + ps = qs25; + pt = pd0->rfs; + while(*pt++ = *ps++); + rc = 0; + + /* A string is a sequence of characters surrounded by double + quotes, as in "...". */ + + s = "..."; + + /* A string has type "array of characters" and storage class + static and is initialized with the given characters. */ + + if ( s[0] != s[1] || s[1] != s[2] + || s[2] != '.' ) { + + rc = rc+1; + if(pd0->flgd != 0) printf(s25er,1); + } + + /* The compiler places a null byte \0 at the end of each string + so the program which scans the string can find its end. */ + + if( s[3] != '\0' ){ + rc = rc+4; + if(pd0->flgd != 0) printf(s25er,4); + } + + /* In a string, the double quote character " must be preceded + by a \. */ + + if( ".\"."[1] != '"' ){ + rc = rc+8; + if(pd0->flgd != 0) printf(s25er,8); + } + + /* In addition, the same escapes described for character constants + may be used. */ + + s = "\n\t\b\r\f\\\'"; + + if( s[0] != '\n' + || s[1] != '\t' + || s[2] != '\b' + || s[3] != '\r' + || s[4] != '\f' + || s[5] != '\\' + || s[6] != '\'' ){ + + rc = rc+16; + if( pd0->flgd != 0) printf(s25er,16); + } + + /* Finally, a \ and an immediately following newline are ignored */ + + s2 = "queep!"; + s = "queep!"; + + lrc = 0; + for (j=0; jflgd != 0) printf(s25er,32); + } + return rc; +} +s26(pd0) /* 2.6 Hardware Characteristics */ +struct defs *pd0; +{ + static char qs26[8] = "s26 "; + char *ps, *pt; + char c0, c1; + float temp, one, delta; + double tempd, oned; + static char s[] = "%3d bits in %ss.\n"; + static char s2[] = "%e is the least number that can be added to 1. (%s).\n"; + + ps = qs26; + pt = pd0->rfs; + + while(*pt++ = *ps++); + + /* Here, we shake the machinery a little to see what falls + out. First, we find out how many bits are in a char. */ + + pd0->cbits = 0; + c0 = 0; + c1 = 1; + + while(c0 != c1) { + c1 = c1<<1; + pd0->cbits = pd0->cbits+1; + } + /* That information lets us determine the size of everything else. */ + + pd0->ibits = pd0->cbits * sizeof(int); + pd0->sbits = pd0->cbits * sizeof(short); + pd0->lbits = pd0->cbits * sizeof(long); + pd0->ubits = pd0->cbits * sizeof(unsigned); + pd0->fbits = pd0->cbits * sizeof(float); + pd0->dbits = pd0->cbits * sizeof(double); + + /* We have now almost reconstructed the table in section 2.6, the + exception being the range of the floating point hardware. + Now there are just so many ways to conjure up a floating point + representation system that it's damned near impossible to guess + what's going on by writing a program to interpret bit patterns. + Further, the information isn't all that useful, if we consider + the fact that machines that won't handle numbers between 10**30 + and 10**-30 are very hard to find, and that people playing with + numbers outside that range have a lot more to worry about than + just the capacity of the characteristic. + + A much more useful measure is the precision, which can be ex- + pressed in terms of the smallest number that can be added to + 1. without loss of significance. We calculate that here, for + float and double. */ + + one = 1.; + delta = 1.; + temp = 0.; + while(temp != one) { + temp = one+delta; + delta = delta/2.; + } + pd0->fprec = delta * 4.; + oned = 1.; + delta = 1.; + tempd = 0.; + while(tempd != oned) { + tempd = oned+delta; + delta = delta/2.; + } + pd0->dprec = delta * 4.; + + /* Now, if anyone's interested, we publish the results. */ + + if(pd0->flgm != 0) { + printf(s,pd0->cbits,"char"); + printf(s,pd0->ibits,"int"); + printf(s,pd0->sbits,"short"); + printf(s,pd0->lbits,"long"); + printf(s,pd0->ubits,"unsigned"); + printf(s,pd0->fbits,"float"); + printf(s,pd0->dbits,"double"); + printf(s2,pd0->fprec,"float"); + printf(s2,pd0->dprec,"double"); + } + /* Since we are only exploring and perhaps reporting, but not + testing any features, we cannot return an error code. */ + + return 0; +} +int extvar; +s4(pd0) /* 4. What's in a name? */ +struct defs *pd0; +{ + static char s4er[] = "s4,er%d\n"; + static char qs4[8] = "s4 "; + char *ps, *pt; + int j, rc; + + short sint; /* short integer, for size test */ + int pint; /* plain */ + long lint; /* long */ + unsigned target; + unsigned int mask; + + rc = 0; + ps = qs4; + pt = pd0->rfs; + + while(*pt++ = *ps++); + +/* There are four declarable storage classes: automatic, +static, external, and register. Automatic variables have +been dealt with extensively thus far, and will not be specif- +ically treated in this section. Register variables are treated +in section s81. + + Static variables are local to a block, but retain their +values upon reentry to a block, even after control has left +the block. */ + + for (j=0; j<3; j++) + if(svtest(j) != zero()){ + rc = 1; + if(pd0->flgd != 0) printf(s4er,1); + } + ; + +/* External variables exist and retain their values throughout +the execution of the entire program, and may be used for comm- +unication between functions, even separately compiled functions. + */ + + setev(); + if(testev() != 0){ + rc=rc+2; + if(pd0->flgd != 0) printf(s4er,2); + } +/* + Characters have been tested elsewhere (in s243). + + Up to three sizes of integer, declared short int, int, and +long int, are available. Longer integers provide no less storage +than shorter ones, but implementation may make either short +integers, or long integers, or both, equivalent to plain +integers. + */ + + if(sizeof lint < sizeof pint || sizeof pint < sizeof sint){ + + rc = rc+4; + if(pd0->flgd != 0) printf(s4er,4); + } + +/* Unsigned integers, declared unsigned, obey the laws of +arithmetic modulo 2**n, where n is the number of bits in the +implementation */ + + target = ~0U; + mask = 1; + + for(j=0; j<(sizeof target)*pd0->cbits; j++){ + + mask = mask⌖ + target = target>>1; + } + + if(mask != 1 || target != 0){ + + rc = rc+8; + if(pd0->flgd != 0) printf(s4er,8); + } + + return rc; +} +svtest(n) +int n; +{ + static k; + int rc; + switch (n) { + + case 0: k = 1978; + rc = 0; + break; + + case 1: if(k != 1978) rc = 1; + else{ + k = 1929; + rc = 0; + } + break; + + case 2: if(k != 1929) rc = 1; + else rc = 0; + break; + } + return rc; +} +zero(){ /* Returns a value of zero, possibly */ + static k; /* with side effects, as it's called */ + int rc; /* alternately with svtest, above, */ + k = 2; /* and has the same internal storage */ + rc = 0; /* requirements. */ + return rc; +} +testev(){ + if(extvar != 1066) return 1; + else return 0; +} +s61(pd0) /* Characters and integers */ +struct defs *pd0; +{ + static char s61er[] = "s61,er%d\n"; + static char qs61[8] = "s61 "; + short from, shortint; + long int to, longint; + int rc, lrc; + int j; + char fromc, charint; + char *wd, *pc[6]; + + static char upper_alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + static char lower_alpha[] = "abcdefghijklmnopqrstuvwxyz"; + static char numbers[] = "0123456789"; + static char special_characters[] = "~!\"#%&()_=-^|{}[]+;*:<>,.?/"; + static char extra_special_characters[] = "\n\t\b\r\f\\\'"; + static char blank_and_NUL[] = " \0"; + + char *ps, *pt; + ps = qs61; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + +/* A character or a short integer may be used wherever +an integer may be used. In all cases, the value is converted +to integer. This principle is extensively used throughout this +program, and will not be explicitly tested here. */ + +/* Conversion of a shorter integer to a longer always +involves sign extension. */ + + from = -19; + to = from; + + if(to != -19){ + rc = rc+1; + if(pd0->flgd != 0) printf(s61er,1); + } + +/* It is guaranteed that a member of the standard char- +acter set is nonnegative. */ + + pc[0] = upper_alpha; + pc[1] = lower_alpha; + pc[2] = numbers; + pc[3] = special_characters; + pc[4] = extra_special_characters; + pc[5] = blank_and_NUL; + + lrc = 0; + for (j=0; j<6; j++) + while(*pc[j]) if(*pc[j]++ < 0) lrc =1; + + if(lrc != 0){ + rc=rc+2; + if(pd0->flgd != 0) printf(s61er,2); + } + +/* When a longer integer is converted to a shorter or +to a char, it is truncated on the left; excess bits are +simply discarded. */ + + longint = 1048579; /* =2**20+3 */ + shortint = longint; + charint = longint; + + if((shortint != longint && shortint != 3) || + (charint != longint && charint != 3)) { + rc = rc+8; + if(pd0->flgd != 0) printf(s61er,8); + } + + return rc; +} +s626(pd0) /* 6.2 Float and double */ + /* 6.3 Floating and integral */ + /* 6.4 Pointers and integers */ + /* 6.5 Unsigned */ + /* 6.6 Arithmetic conversions */ +struct defs *pd0; +{ + static char s626er[] = "s626,er%d\n"; + static char qs626[8] = "s626 "; + int rc; + char *ps, *pt; + float eps, f1, f2, f3, f4, f; + long lint1, lint2, l, ls; + char c, t[28], t0; + short s; + int is, i, j; + unsigned u, us; + double d, ds; + ps = qs626; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + + /* Conversions of integral values to floating type are + well-behaved. */ + + f1 = 1.; + lint1 = 1.; + lint2 = 1.; + + for(j=0;jlbits-2;j++){ + f1 = f1*2; + lint2 = (lint2<<1)|lint1; + } + f2 = lint2; + f1 = (f1-f2)/f1; + if(f1>2.*pd0->fprec){ + + rc = rc+2; + if(pd0->flgd != 0) printf(s626er,2); + } + + /* Pointer-integer combinations are discussed in s74, + "Additive operators". The unsigned-int combination + appears below. */ + + c = 125; + s = 125; + i = 125; is = 15625; + u = 125; us = 15625; + l = 125; ls = 15625; + f = 125.; + d = 125.; ds = 15625.; + + for(j=0;j<28;j++) t[j] = 0; + + if(c*c != is) t[ 0] = 1; + if(s*c != is) t[ 1] = 1; + if(s*s != is) t[ 2] = 1; + if(i*c != is) t[ 3] = 1; + if(i*s != is) t[ 4] = 1; + if(i*i != is) t[ 5] = 1; + if(u*c != us) t[ 6] = 1; + if(u*s != us) t[ 7] = 1; + if(u*i != us) t[ 8] = 1; + if(u*u != us) t[ 9] = 1; + if(l*c != ls) t[10] = 1; + if(l*s != ls) t[11] = 1; + if(l*i != ls) t[12] = 1; + if(l*u != us) t[13] = 1; + if(l*l != ls) t[14] = 1; + if(f*c != ds) t[15] = 1; + if(f*s != ds) t[16] = 1; + if(f*i != ds) t[17] = 1; + if(f*u != ds) t[18] = 1; + if(f*l != ds) t[19] = 1; + if(f*f != ds) t[20] = 1; + if(d*c != ds) t[21] = 1; + if(d*s != ds) t[22] = 1; + if(d*i != ds) t[23] = 1; + if(d*u != ds) t[24] = 1; + if(d*l != ds) t[25] = 1; + if(d*f != ds) t[26] = 1; + if(d*d != ds) t[27] = 1; + + t0 = 0; + for(j=0; j<28; j++) t0 = t0+t[j]; + + if(t0 != 0){ + + rc = rc+4; + if(pd0->flgd != 0){ + + printf(s626er,4); + printf(" key="); + for(j=0;j<28;j++) printf("%d",t[j]); + printf("\n"); + } + } + + /* When an unsigned integer is converted to long, + the value of the result is the same numerically + as that of the unsigned integer. */ + + l = (unsigned)0100000; + if((long)l > (unsigned)0100000){ + + rc = rc+8; + if(pd0->flgd != 0) printf(s626er,8); + } + + return rc; +} +s71(pd0) /* 7.1 Primary expressions */ +struct defs *pd0; +{ + static char s71er[] = "s71,er%d\n"; + static char qs71[8] = "s71 "; + int rc; + char *ps, *pt; + static char q = 'q'; + int x[10], McCarthy(), clobber(), a, b, *p; + ps = qs71; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + +/* Testing of expressions and operators is quite complicated, + because (a) problems are apt to surface in queer combinations + of operators and operands, rather than in isolation, + and (b) the number of expressions needed to provoke a case + of improper behaviour may be quite large. Hence, we take the + following approach: for this section, and for subsequent + sections through 7.15, we will check the primitive operations + in isolation, thus verifying that the primitives work, + after a fashion. The job of testing combinations, we will + leave to a separate, machine-generated program, to be included + in the C test package at some later date. + */ + +/* A string is a primary expression. The identifier points to + the first character of a string. + */ + + if(*"queep" != q){ + rc = rc+1; + if(pd0->flgd != 0) printf(s71er,1); + } +/* A parenthesized expression is a primary expression whose + type and value are the same as those of the unadorned + expression. + */ + if((2+3) != 2+3) { + rc = rc+2; + if(pd0->flgd != 0) printf(s71er,2); + } + +/* A primary expression followed by an expression in square + brackets is a primary expression. The intuitive meaning is + that of a subscript. The expression E1[E2] is identical + (by definition) to *((E1)+(E2)). + */ + + x[5] = 1942; + if(x[5] != 1942 || x[5] != *((x)+(5))){ + rc = rc+4; + if(pd0->flgd != 0) printf(s71er,4); + } + +/* If the various flavors of function calls didn't work, we + would never have gotten this far; however, we do need to + show that functions can be recursive... + */ + + if ( McCarthy(-5) != 91){ + rc = rc+8; + if(pd0->flgd != 0) printf(s71er,8); + } + +/* and that argument passing is strictly by value. */ + + a = 2; + b = 3; + p = &b; + + clobber(a,p); + + if(a != 2 || b != 2){ + rc = rc+16; + if(pd0->flgd != 0) printf(s71er,16); + } + +/* Finally, structures and unions are addressed thusly: */ + + if(pd0->dprec != (*pd0).dprec){ + rc = rc+32; + if(pd0->flgd != 0) printf(s71er,32); + } + + return rc; +} +McCarthy(x) +int x; +{ + if(x>100) return x-10; + else return McCarthy( McCarthy(x+11)); +} +clobber(x,y) +int x, *y; +{ + x = 3; + *y = 2; +} +s714(pd0) /* 7.14 Assignment operators */ +struct defs *pd0; +{ + static char f[] = "Local error %d.\n"; + static char s714er[] = "s714,er%d\n"; + static char qs714[8] = "s714 "; + register int prlc, lrc; + int rc; + char cl, cr; + short sl, sr; + int il, ir; + long ll, lr; + unsigned ul, ur; + float fl, fr; + double dl, dr; + char *ps, *pt; + ps = qs714; + pt = pd0->rfs; + rc = 0; + lrc = 0; + prlc = pd0->flgl; + while (*pt++ = *ps++); + + /* This section tests the assignment operators. + + It is an exhaustive test of all assignment statements + of the form: + + vl op vr + + where vl and vr are variables from the set + {char,short,int,long,unsigned,float,double} and op is + one of the assignment operators. There are 395 such + statements. + + The initial values for the variables have been chosen + so that both the initial values and the results will + "fit" in just about any implementation, and that the re- + sults will be such that they test for the proper form- + ation of composite operators, rather than checking for + the valid operation of those operators' components. + For example, in checking >>=, we want to verify that + a right shift and a move take place, rather than + whether or not there may be some peculiarities about + the right shift. Such tests have been made previously, + and to repeat them here would be to throw out a red + herring. + + The table below lists the operators, assignment targets, + initial values for left and right operands, and the + expected values of the results. + + + = += -= *= /= %= >>= <<= &= ^= |= +char 2 7 3 10 2 1 1 20 8 6 14 +short 2 7 3 10 2 1 1 20 8 6 14 +int 2 7 3 10 2 1 1 20 8 6 14 +long 2 7 3 10 2 1 1 20 8 6 14 +unsigned 2 7 3 10 2 1 1 20 8 6 14 +float 2 7 3 10 2.5 | | +double 2 7 3 10 2.5 | | + | | +initial (5,2) | (5,2) | (12,10) + + The following machine-generated program reflects the + tests described in the table. + */ + + cl = 5; cr = 2; + cl = cr; + if(cl != 2){ + lrc = 1; + if(prlc) printf(f,lrc); + } + cl = 5; sr = 2; + cl = sr; + if(cl != 2){ + lrc = 2; + if(prlc) printf(f,lrc); + } + cl = 5; ir = 2; + cl = ir; + if(cl != 2){ + lrc = 3; + if(prlc) printf(f,lrc); + } + cl = 5; lr = 2; + cl = lr; + if(cl != 2){ + lrc = 4; + if(prlc) printf(f,lrc); + } + cl = 5; ur = 2; + cl = ur; + if(cl != 2){ + lrc = 5; + if(prlc) printf(f,lrc); + } + cl = 5; fr = 2; + cl = fr; + if(cl != 2){ + lrc = 6; + if(prlc) printf(f,lrc); + } + cl = 5; dr = 2; + cl = dr; + if(cl != 2){ + lrc = 7; + if(prlc) printf(f,lrc); + } + sl = 5; cr = 2; + sl = cr; + if(sl != 2){ + lrc = 8; + if(prlc) printf(f,lrc); + } + sl = 5; sr = 2; + sl = sr; + if(sl != 2){ + lrc = 9; + if(prlc) printf(f,lrc); + } + sl = 5; ir = 2; + sl = ir; + if(sl != 2){ + lrc = 10; + if(prlc) printf(f,lrc); + } + sl = 5; lr = 2; + sl = lr; + if(sl != 2){ + lrc = 11; + if(prlc) printf(f,lrc); + } + sl = 5; ur = 2; + sl = ur; + if(sl != 2){ + lrc = 12; + if(prlc) printf(f,lrc); + } + sl = 5; fr = 2; + sl = fr; + if(sl != 2){ + lrc = 13; + if(prlc) printf(f,lrc); + } + sl = 5; dr = 2; + sl = dr; + if(sl != 2){ + lrc = 14; + if(prlc) printf(f,lrc); + } + il = 5; cr = 2; + il = cr; + if(il != 2){ + lrc = 15; + if(prlc) printf(f,lrc); + } + il = 5; sr = 2; + il = sr; + if(il != 2){ + lrc = 16; + if(prlc) printf(f,lrc); + } + il = 5; ir = 2; + il = ir; + if(il != 2){ + lrc = 17; + if(prlc) printf(f,lrc); + } + il = 5; lr = 2; + il = lr; + if(il != 2){ + lrc = 18; + if(prlc) printf(f,lrc); + } + il = 5; ur = 2; + il = ur; + if(il != 2){ + lrc = 19; + if(prlc) printf(f,lrc); + } + il = 5; fr = 2; + il = fr; + if(il != 2){ + lrc = 20; + if(prlc) printf(f,lrc); + } + il = 5; dr = 2; + il = dr; + if(il != 2){ + lrc = 21; + if(prlc) printf(f,lrc); + } + ll = 5; cr = 2; + ll = cr; + if(ll != 2){ + lrc = 22; + if(prlc) printf(f,lrc); + } + ll = 5; sr = 2; + ll = sr; + if(ll != 2){ + lrc = 23; + if(prlc) printf(f,lrc); + } + ll = 5; ir = 2; + ll = ir; + if(ll != 2){ + lrc = 24; + if(prlc) printf(f,lrc); + } + ll = 5; lr = 2; + ll = lr; + if(ll != 2){ + lrc = 25; + if(prlc) printf(f,lrc); + } + ll = 5; ur = 2; + ll = ur; + if(ll != 2){ + lrc = 26; + if(prlc) printf(f,lrc); + } + ll = 5; fr = 2; + ll = fr; + if(ll != 2){ + lrc = 27; + if(prlc) printf(f,lrc); + } + ll = 5; dr = 2; + ll = dr; + if(ll != 2){ + lrc = 28; + if(prlc) printf(f,lrc); + } + ul = 5; cr = 2; + ul = cr; + if(ul != 2){ + lrc = 29; + if(prlc) printf(f,lrc); + } + ul = 5; sr = 2; + ul = sr; + if(ul != 2){ + lrc = 30; + if(prlc) printf(f,lrc); + } + ul = 5; ir = 2; + ul = ir; + if(ul != 2){ + lrc = 31; + if(prlc) printf(f,lrc); + } + ul = 5; lr = 2; + ul = lr; + if(ul != 2){ + lrc = 32; + if(prlc) printf(f,lrc); + } + ul = 5; ur = 2; + ul = ur; + if(ul != 2){ + lrc = 33; + if(prlc) printf(f,lrc); + } + ul = 5; fr = 2; + ul = fr; + if(ul != 2){ + lrc = 34; + if(prlc) printf(f,lrc); + } + ul = 5; dr = 2; + ul = dr; + if(ul != 2){ + lrc = 35; + if(prlc) printf(f,lrc); + } + fl = 5; cr = 2; + fl = cr; + if(fl != 2){ + lrc = 36; + if(prlc) printf(f,lrc); + } + fl = 5; sr = 2; + fl = sr; + if(fl != 2){ + lrc = 37; + if(prlc) printf(f,lrc); + } + fl = 5; ir = 2; + fl = ir; + if(fl != 2){ + lrc = 38; + if(prlc) printf(f,lrc); + } + fl = 5; lr = 2; + fl = lr; + if(fl != 2){ + lrc = 39; + if(prlc) printf(f,lrc); + } + fl = 5; ur = 2; + fl = ur; + if(fl != 2){ + lrc = 40; + if(prlc) printf(f,lrc); + } + fl = 5; fr = 2; + fl = fr; + if(fl != 2){ + lrc = 41; + if(prlc) printf(f,lrc); + } + fl = 5; dr = 2; + fl = dr; + if(fl != 2){ + lrc = 42; + if(prlc) printf(f,lrc); + } + dl = 5; cr = 2; + dl = cr; + if(dl != 2){ + lrc = 43; + if(prlc) printf(f,lrc); + } + dl = 5; sr = 2; + dl = sr; + if(dl != 2){ + lrc = 44; + if(prlc) printf(f,lrc); + } + dl = 5; ir = 2; + dl = ir; + if(dl != 2){ + lrc = 45; + if(prlc) printf(f,lrc); + } + dl = 5; lr = 2; + dl = lr; + if(dl != 2){ + lrc = 46; + if(prlc) printf(f,lrc); + } + dl = 5; ur = 2; + dl = ur; + if(dl != 2){ + lrc = 47; + if(prlc) printf(f,lrc); + } + dl = 5; fr = 2; + dl = fr; + if(dl != 2){ + lrc = 48; + if(prlc) printf(f,lrc); + } + dl = 5; dr = 2; + dl = dr; + if(dl != 2){ + lrc = 49; + if(prlc) printf(f,lrc); + } + cl = 5; cr = 2; + cl += cr; + if(cl != 7){ + lrc = 50; + if(prlc) printf(f,lrc); + } + cl = 5; sr = 2; + cl += sr; + if(cl != 7){ + lrc = 51; + if(prlc) printf(f,lrc); + } + cl = 5; ir = 2; + cl += ir; + if(cl != 7){ + lrc = 52; + if(prlc) printf(f,lrc); + } + cl = 5; lr = 2; + cl += lr; + if(cl != 7){ + lrc = 53; + if(prlc) printf(f,lrc); + } + cl = 5; ur = 2; + cl += ur; + if(cl != 7){ + lrc = 54; + if(prlc) printf(f,lrc); + } + cl = 5; fr = 2; + cl += fr; + if(cl != 7){ + lrc = 55; + if(prlc) printf(f,lrc); + } + cl = 5; dr = 2; + cl += dr; + if(cl != 7){ + lrc = 56; + if(prlc) printf(f,lrc); + } + sl = 5; cr = 2; + sl += cr; + if(sl != 7){ + lrc = 57; + if(prlc) printf(f,lrc); + } + sl = 5; sr = 2; + sl += sr; + if(sl != 7){ + lrc = 58; + if(prlc) printf(f,lrc); + } + sl = 5; ir = 2; + sl += ir; + if(sl != 7){ + lrc = 59; + if(prlc) printf(f,lrc); + } + sl = 5; lr = 2; + sl += lr; + if(sl != 7){ + lrc = 60; + if(prlc) printf(f,lrc); + } + sl = 5; ur = 2; + sl += ur; + if(sl != 7){ + lrc = 61; + if(prlc) printf(f,lrc); + } + sl = 5; fr = 2; + sl += fr; + if(sl != 7){ + lrc = 62; + if(prlc) printf(f,lrc); + } + sl = 5; dr = 2; + sl += dr; + if(sl != 7){ + lrc = 63; + if(prlc) printf(f,lrc); + } + il = 5; cr = 2; + il += cr; + if(il != 7){ + lrc = 64; + if(prlc) printf(f,lrc); + } + il = 5; sr = 2; + il += sr; + if(il != 7){ + lrc = 65; + if(prlc) printf(f,lrc); + } + il = 5; ir = 2; + il += ir; + if(il != 7){ + lrc = 66; + if(prlc) printf(f,lrc); + } + il = 5; lr = 2; + il += lr; + if(il != 7){ + lrc = 67; + if(prlc) printf(f,lrc); + } + il = 5; ur = 2; + il += ur; + if(il != 7){ + lrc = 68; + if(prlc) printf(f,lrc); + } + il = 5; fr = 2; + il += fr; + if(il != 7){ + lrc = 69; + if(prlc) printf(f,lrc); + } + il = 5; dr = 2; + il += dr; + if(il != 7){ + lrc = 70; + if(prlc) printf(f,lrc); + } + ll = 5; cr = 2; + ll += cr; + if(ll != 7){ + lrc = 71; + if(prlc) printf(f,lrc); + } + ll = 5; sr = 2; + ll += sr; + if(ll != 7){ + lrc = 72; + if(prlc) printf(f,lrc); + } + ll = 5; ir = 2; + ll += ir; + if(ll != 7){ + lrc = 73; + if(prlc) printf(f,lrc); + } + ll = 5; lr = 2; + ll += lr; + if(ll != 7){ + lrc = 74; + if(prlc) printf(f,lrc); + } + ll = 5; ur = 2; + ll += ur; + if(ll != 7){ + lrc = 75; + if(prlc) printf(f,lrc); + } + ll = 5; fr = 2; + ll += fr; + if(ll != 7){ + lrc = 76; + if(prlc) printf(f,lrc); + } + ll = 5; dr = 2; + ll += dr; + if(ll != 7){ + lrc = 77; + if(prlc) printf(f,lrc); + } + ul = 5; cr = 2; + ul += cr; + if(ul != 7){ + lrc = 78; + if(prlc) printf(f,lrc); + } + ul = 5; sr = 2; + ul += sr; + if(ul != 7){ + lrc = 79; + if(prlc) printf(f,lrc); + } + ul = 5; ir = 2; + ul += ir; + if(ul != 7){ + lrc = 80; + if(prlc) printf(f,lrc); + } + ul = 5; lr = 2; + ul += lr; + if(ul != 7){ + lrc = 81; + if(prlc) printf(f,lrc); + } + ul = 5; ur = 2; + ul += ur; + if(ul != 7){ + lrc = 82; + if(prlc) printf(f,lrc); + } + ul = 5; fr = 2; + ul += fr; + if(ul != 7){ + lrc = 83; + if(prlc) printf(f,lrc); + } + ul = 5; dr = 2; + ul += dr; + if(ul != 7){ + lrc = 84; + if(prlc) printf(f,lrc); + } + fl = 5; cr = 2; + fl += cr; + if(fl != 7){ + lrc = 85; + if(prlc) printf(f,lrc); + } + fl = 5; sr = 2; + fl += sr; + if(fl != 7){ + lrc = 86; + if(prlc) printf(f,lrc); + } + fl = 5; ir = 2; + fl += ir; + if(fl != 7){ + lrc = 87; + if(prlc) printf(f,lrc); + } + fl = 5; lr = 2; + fl += lr; + if(fl != 7){ + lrc = 88; + if(prlc) printf(f,lrc); + } + fl = 5; ur = 2; + fl += ur; + if(fl != 7){ + lrc = 89; + if(prlc) printf(f,lrc); + } + fl = 5; fr = 2; + fl += fr; + if(fl != 7){ + lrc = 90; + if(prlc) printf(f,lrc); + } + fl = 5; dr = 2; + fl += dr; + if(fl != 7){ + lrc = 91; + if(prlc) printf(f,lrc); + } + dl = 5; cr = 2; + dl += cr; + if(dl != 7){ + lrc = 92; + if(prlc) printf(f,lrc); + } + dl = 5; sr = 2; + dl += sr; + if(dl != 7){ + lrc = 93; + if(prlc) printf(f,lrc); + } + dl = 5; ir = 2; + dl += ir; + if(dl != 7){ + lrc = 94; + if(prlc) printf(f,lrc); + } + dl = 5; lr = 2; + dl += lr; + if(dl != 7){ + lrc = 95; + if(prlc) printf(f,lrc); + } + dl = 5; ur = 2; + dl += ur; + if(dl != 7){ + lrc = 96; + if(prlc) printf(f,lrc); + } + dl = 5; fr = 2; + dl += fr; + if(dl != 7){ + lrc = 97; + if(prlc) printf(f,lrc); + } + dl = 5; dr = 2; + dl += dr; + if(dl != 7){ + lrc = 98; + if(prlc) printf(f,lrc); + } + cl = 5; cr = 2; + cl -= cr; + if(cl != 3){ + lrc = 99; + if(prlc) printf(f,lrc); + } + cl = 5; sr = 2; + cl -= sr; + if(cl != 3){ + lrc = 100; + if(prlc) printf(f,lrc); + } + cl = 5; ir = 2; + cl -= ir; + if(cl != 3){ + lrc = 101; + if(prlc) printf(f,lrc); + } + cl = 5; lr = 2; + cl -= lr; + if(cl != 3){ + lrc = 102; + if(prlc) printf(f,lrc); + } + cl = 5; ur = 2; + cl -= ur; + if(cl != 3){ + lrc = 103; + if(prlc) printf(f,lrc); + } + cl = 5; fr = 2; + cl -= fr; + if(cl != 3){ + lrc = 104; + if(prlc) printf(f,lrc); + } + cl = 5; dr = 2; + cl -= dr; + if(cl != 3){ + lrc = 105; + if(prlc) printf(f,lrc); + } + sl = 5; cr = 2; + sl -= cr; + if(sl != 3){ + lrc = 106; + if(prlc) printf(f,lrc); + } + sl = 5; sr = 2; + sl -= sr; + if(sl != 3){ + lrc = 107; + if(prlc) printf(f,lrc); + } + sl = 5; ir = 2; + sl -= ir; + if(sl != 3){ + lrc = 108; + if(prlc) printf(f,lrc); + } + sl = 5; lr = 2; + sl -= lr; + if(sl != 3){ + lrc = 109; + if(prlc) printf(f,lrc); + } + sl = 5; ur = 2; + sl -= ur; + if(sl != 3){ + lrc = 110; + if(prlc) printf(f,lrc); + } + sl = 5; fr = 2; + sl -= fr; + if(sl != 3){ + lrc = 111; + if(prlc) printf(f,lrc); + } + sl = 5; dr = 2; + sl -= dr; + if(sl != 3){ + lrc = 112; + if(prlc) printf(f,lrc); + } + il = 5; cr = 2; + il -= cr; + if(il != 3){ + lrc = 113; + if(prlc) printf(f,lrc); + } + il = 5; sr = 2; + il -= sr; + if(il != 3){ + lrc = 114; + if(prlc) printf(f,lrc); + } + il = 5; ir = 2; + il -= ir; + if(il != 3){ + lrc = 115; + if(prlc) printf(f,lrc); + } + il = 5; lr = 2; + il -= lr; + if(il != 3){ + lrc = 116; + if(prlc) printf(f,lrc); + } + il = 5; ur = 2; + il -= ur; + if(il != 3){ + lrc = 117; + if(prlc) printf(f,lrc); + } + il = 5; fr = 2; + il -= fr; + if(il != 3){ + lrc = 118; + if(prlc) printf(f,lrc); + } + il = 5; dr = 2; + il -= dr; + if(il != 3){ + lrc = 119; + if(prlc) printf(f,lrc); + } + ll = 5; cr = 2; + ll -= cr; + if(ll != 3){ + lrc = 120; + if(prlc) printf(f,lrc); + } + ll = 5; sr = 2; + ll -= sr; + if(ll != 3){ + lrc = 121; + if(prlc) printf(f,lrc); + } + ll = 5; ir = 2; + ll -= ir; + if(ll != 3){ + lrc = 122; + if(prlc) printf(f,lrc); + } + ll = 5; lr = 2; + ll -= lr; + if(ll != 3){ + lrc = 123; + if(prlc) printf(f,lrc); + } + ll = 5; ur = 2; + ll -= ur; + if(ll != 3){ + lrc = 124; + if(prlc) printf(f,lrc); + } + ll = 5; fr = 2; + ll -= fr; + if(ll != 3){ + lrc = 125; + if(prlc) printf(f,lrc); + } + ll = 5; dr = 2; + ll -= dr; + if(ll != 3){ + lrc = 126; + if(prlc) printf(f,lrc); + } + ul = 5; cr = 2; + ul -= cr; + if(ul != 3){ + lrc = 127; + if(prlc) printf(f,lrc); + } + ul = 5; sr = 2; + ul -= sr; + if(ul != 3){ + lrc = 128; + if(prlc) printf(f,lrc); + } + ul = 5; ir = 2; + ul -= ir; + if(ul != 3){ + lrc = 129; + if(prlc) printf(f,lrc); + } + ul = 5; lr = 2; + ul -= lr; + if(ul != 3){ + lrc = 130; + if(prlc) printf(f,lrc); + } + ul = 5; ur = 2; + ul -= ur; + if(ul != 3){ + lrc = 131; + if(prlc) printf(f,lrc); + } + ul = 5; fr = 2; + ul -= fr; + if(ul != 3){ + lrc = 132; + if(prlc) printf(f,lrc); + } + ul = 5; dr = 2; + ul -= dr; + if(ul != 3){ + lrc = 133; + if(prlc) printf(f,lrc); + } + fl = 5; cr = 2; + fl -= cr; + if(fl != 3){ + lrc = 134; + if(prlc) printf(f,lrc); + } + fl = 5; sr = 2; + fl -= sr; + if(fl != 3){ + lrc = 135; + if(prlc) printf(f,lrc); + } + fl = 5; ir = 2; + fl -= ir; + if(fl != 3){ + lrc = 136; + if(prlc) printf(f,lrc); + } + fl = 5; lr = 2; + fl -= lr; + if(fl != 3){ + lrc = 137; + if(prlc) printf(f,lrc); + } + fl = 5; ur = 2; + fl -= ur; + if(fl != 3){ + lrc = 138; + if(prlc) printf(f,lrc); + } + fl = 5; fr = 2; + fl -= fr; + if(fl != 3){ + lrc = 139; + if(prlc) printf(f,lrc); + } + fl = 5; dr = 2; + fl -= dr; + if(fl != 3){ + lrc = 140; + if(prlc) printf(f,lrc); + } + dl = 5; cr = 2; + dl -= cr; + if(dl != 3){ + lrc = 141; + if(prlc) printf(f,lrc); + } + dl = 5; sr = 2; + dl -= sr; + if(dl != 3){ + lrc = 142; + if(prlc) printf(f,lrc); + } + dl = 5; ir = 2; + dl -= ir; + if(dl != 3){ + lrc = 143; + if(prlc) printf(f,lrc); + } + dl = 5; lr = 2; + dl -= lr; + if(dl != 3){ + lrc = 144; + if(prlc) printf(f,lrc); + } + dl = 5; ur = 2; + dl -= ur; + if(dl != 3){ + lrc = 145; + if(prlc) printf(f,lrc); + } + dl = 5; fr = 2; + dl -= fr; + if(dl != 3){ + lrc = 146; + if(prlc) printf(f,lrc); + } + dl = 5; dr = 2; + dl -= dr; + if(dl != 3){ + lrc = 147; + if(prlc) printf(f,lrc); + } + cl = 5; cr = 2; + cl *= cr; + if(cl != 10){ + lrc = 148; + if(prlc) printf(f,lrc); + } + cl = 5; sr = 2; + cl *= sr; + if(cl != 10){ + lrc = 149; + if(prlc) printf(f,lrc); + } + cl = 5; ir = 2; + cl *= ir; + if(cl != 10){ + lrc = 150; + if(prlc) printf(f,lrc); + } + cl = 5; lr = 2; + cl *= lr; + if(cl != 10){ + lrc = 151; + if(prlc) printf(f,lrc); + } + cl = 5; ur = 2; + cl *= ur; + if(cl != 10){ + lrc = 152; + if(prlc) printf(f,lrc); + } + cl = 5; fr = 2; + cl *= fr; + if(cl != 10){ + lrc = 153; + if(prlc) printf(f,lrc); + } + cl = 5; dr = 2; + cl *= dr; + if(cl != 10){ + lrc = 154; + if(prlc) printf(f,lrc); + } + sl = 5; cr = 2; + sl *= cr; + if(sl != 10){ + lrc = 155; + if(prlc) printf(f,lrc); + } + sl = 5; sr = 2; + sl *= sr; + if(sl != 10){ + lrc = 156; + if(prlc) printf(f,lrc); + } + sl = 5; ir = 2; + sl *= ir; + if(sl != 10){ + lrc = 157; + if(prlc) printf(f,lrc); + } + sl = 5; lr = 2; + sl *= lr; + if(sl != 10){ + lrc = 158; + if(prlc) printf(f,lrc); + } + sl = 5; ur = 2; + sl *= ur; + if(sl != 10){ + lrc = 159; + if(prlc) printf(f,lrc); + } + sl = 5; fr = 2; + sl *= fr; + if(sl != 10){ + lrc = 160; + if(prlc) printf(f,lrc); + } + sl = 5; dr = 2; + sl *= dr; + if(sl != 10){ + lrc = 161; + if(prlc) printf(f,lrc); + } + il = 5; cr = 2; + il *= cr; + if(il != 10){ + lrc = 162; + if(prlc) printf(f,lrc); + } + il = 5; sr = 2; + il *= sr; + if(il != 10){ + lrc = 163; + if(prlc) printf(f,lrc); + } + il = 5; ir = 2; + il *= ir; + if(il != 10){ + lrc = 164; + if(prlc) printf(f,lrc); + } + il = 5; lr = 2; + il *= lr; + if(il != 10){ + lrc = 165; + if(prlc) printf(f,lrc); + } + il = 5; ur = 2; + il *= ur; + if(il != 10){ + lrc = 166; + if(prlc) printf(f,lrc); + } + il = 5; fr = 2; + il *= fr; + if(il != 10){ + lrc = 167; + if(prlc) printf(f,lrc); + } + il = 5; dr = 2; + il *= dr; + if(il != 10){ + lrc = 168; + if(prlc) printf(f,lrc); + } + ll = 5; cr = 2; + ll *= cr; + if(ll != 10){ + lrc = 169; + if(prlc) printf(f,lrc); + } + ll = 5; sr = 2; + ll *= sr; + if(ll != 10){ + lrc = 170; + if(prlc) printf(f,lrc); + } + ll = 5; ir = 2; + ll *= ir; + if(ll != 10){ + lrc = 171; + if(prlc) printf(f,lrc); + } + ll = 5; lr = 2; + ll *= lr; + if(ll != 10){ + lrc = 172; + if(prlc) printf(f,lrc); + } + ll = 5; ur = 2; + ll *= ur; + if(ll != 10){ + lrc = 173; + if(prlc) printf(f,lrc); + } + ll = 5; fr = 2; + ll *= fr; + if(ll != 10){ + lrc = 174; + if(prlc) printf(f,lrc); + } + ll = 5; dr = 2; + ll *= dr; + if(ll != 10){ + lrc = 175; + if(prlc) printf(f,lrc); + } + ul = 5; cr = 2; + ul *= cr; + if(ul != 10){ + lrc = 176; + if(prlc) printf(f,lrc); + } + ul = 5; sr = 2; + ul *= sr; + if(ul != 10){ + lrc = 177; + if(prlc) printf(f,lrc); + } + ul = 5; ir = 2; + ul *= ir; + if(ul != 10){ + lrc = 178; + if(prlc) printf(f,lrc); + } + ul = 5; lr = 2; + ul *= lr; + if(ul != 10){ + lrc = 179; + if(prlc) printf(f,lrc); + } + ul = 5; ur = 2; + ul *= ur; + if(ul != 10){ + lrc = 180; + if(prlc) printf(f,lrc); + } + ul = 5; fr = 2; + ul *= fr; + if(ul != 10){ + lrc = 181; + if(prlc) printf(f,lrc); + } + ul = 5; dr = 2; + ul *= dr; + if(ul != 10){ + lrc = 182; + if(prlc) printf(f,lrc); + } + fl = 5; cr = 2; + fl *= cr; + if(fl != 10){ + lrc = 183; + if(prlc) printf(f,lrc); + } + fl = 5; sr = 2; + fl *= sr; + if(fl != 10){ + lrc = 184; + if(prlc) printf(f,lrc); + } + fl = 5; ir = 2; + fl *= ir; + if(fl != 10){ + lrc = 185; + if(prlc) printf(f,lrc); + } + fl = 5; lr = 2; + fl *= lr; + if(fl != 10){ + lrc = 186; + if(prlc) printf(f,lrc); + } + fl = 5; ur = 2; + fl *= ur; + if(fl != 10){ + lrc = 187; + if(prlc) printf(f,lrc); + } + fl = 5; fr = 2; + fl *= fr; + if(fl != 10){ + lrc = 188; + if(prlc) printf(f,lrc); + } + fl = 5; dr = 2; + fl *= dr; + if(fl != 10){ + lrc = 189; + if(prlc) printf(f,lrc); + } + dl = 5; cr = 2; + dl *= cr; + if(dl != 10){ + lrc = 190; + if(prlc) printf(f,lrc); + } + dl = 5; sr = 2; + dl *= sr; + if(dl != 10){ + lrc = 191; + if(prlc) printf(f,lrc); + } + dl = 5; ir = 2; + dl *= ir; + if(dl != 10){ + lrc = 192; + if(prlc) printf(f,lrc); + } + dl = 5; lr = 2; + dl *= lr; + if(dl != 10){ + lrc = 193; + if(prlc) printf(f,lrc); + } + dl = 5; ur = 2; + dl *= ur; + if(dl != 10){ + lrc = 194; + if(prlc) printf(f,lrc); + } + dl = 5; fr = 2; + dl *= fr; + if(dl != 10){ + lrc = 195; + if(prlc) printf(f,lrc); + } + dl = 5; dr = 2; + dl *= dr; + if(dl != 10){ + lrc = 196; + if(prlc) printf(f,lrc); + } + cl = 5; cr = 2; + cl /= cr; + if(cl != 2){ + lrc = 197; + if(prlc) printf(f,lrc); + } + cl = 5; sr = 2; + cl /= sr; + if(cl != 2){ + lrc = 198; + if(prlc) printf(f,lrc); + } + cl = 5; ir = 2; + cl /= ir; + if(cl != 2){ + lrc = 199; + if(prlc) printf(f,lrc); + } + cl = 5; lr = 2; + cl /= lr; + if(cl != 2){ + lrc = 200; + if(prlc) printf(f,lrc); + } + cl = 5; ur = 2; + cl /= ur; + if(cl != 2){ + lrc = 201; + if(prlc) printf(f,lrc); + } + cl = 5; fr = 2; + cl /= fr; + if(cl != 2){ + lrc = 202; + if(prlc) printf(f,lrc); + } + cl = 5; dr = 2; + cl /= dr; + if(cl != 2){ + lrc = 203; + if(prlc) printf(f,lrc); + } + sl = 5; cr = 2; + sl /= cr; + if(sl != 2){ + lrc = 204; + if(prlc) printf(f,lrc); + } + sl = 5; sr = 2; + sl /= sr; + if(sl != 2){ + lrc = 205; + if(prlc) printf(f,lrc); + } + sl = 5; ir = 2; + sl /= ir; + if(sl != 2){ + lrc = 206; + if(prlc) printf(f,lrc); + } + sl = 5; lr = 2; + sl /= lr; + if(sl != 2){ + lrc = 207; + if(prlc) printf(f,lrc); + } + sl = 5; ur = 2; + sl /= ur; + if(sl != 2){ + lrc = 208; + if(prlc) printf(f,lrc); + } + sl = 5; fr = 2; + sl /= fr; + if(sl != 2){ + lrc = 209; + if(prlc) printf(f,lrc); + } + sl = 5; dr = 2; + sl /= dr; + if(sl != 2){ + lrc = 210; + if(prlc) printf(f,lrc); + } + il = 5; cr = 2; + il /= cr; + if(il != 2){ + lrc = 211; + if(prlc) printf(f,lrc); + } + il = 5; sr = 2; + il /= sr; + if(il != 2){ + lrc = 212; + if(prlc) printf(f,lrc); + } + il = 5; ir = 2; + il /= ir; + if(il != 2){ + lrc = 213; + if(prlc) printf(f,lrc); + } + il = 5; lr = 2; + il /= lr; + if(il != 2){ + lrc = 214; + if(prlc) printf(f,lrc); + } + il = 5; ur = 2; + il /= ur; + if(il != 2){ + lrc = 215; + if(prlc) printf(f,lrc); + } + il = 5; fr = 2; + il /= fr; + if(il != 2){ + lrc = 216; + if(prlc) printf(f,lrc); + } + il = 5; dr = 2; + il /= dr; + if(il != 2){ + lrc = 217; + if(prlc) printf(f,lrc); + } + ll = 5; cr = 2; + ll /= cr; + if(ll != 2){ + lrc = 218; + if(prlc) printf(f,lrc); + } + ll = 5; sr = 2; + ll /= sr; + if(ll != 2){ + lrc = 219; + if(prlc) printf(f,lrc); + } + ll = 5; ir = 2; + ll /= ir; + if(ll != 2){ + lrc = 220; + if(prlc) printf(f,lrc); + } + ll = 5; lr = 2; + ll /= lr; + if(ll != 2){ + lrc = 221; + if(prlc) printf(f,lrc); + } + ll = 5; ur = 2; + ll /= ur; + if(ll != 2){ + lrc = 222; + if(prlc) printf(f,lrc); + } + ll = 5; fr = 2; + ll /= fr; + if(ll != 2){ + lrc = 223; + if(prlc) printf(f,lrc); + } + ll = 5; dr = 2; + ll /= dr; + if(ll != 2){ + lrc = 224; + if(prlc) printf(f,lrc); + } + ul = 5; cr = 2; + ul /= cr; + if(ul != 2){ + lrc = 225; + if(prlc) printf(f,lrc); + } + ul = 5; sr = 2; + ul /= sr; + if(ul != 2){ + lrc = 226; + if(prlc) printf(f,lrc); + } + ul = 5; ir = 2; + ul /= ir; + if(ul != 2){ + lrc = 227; + if(prlc) printf(f,lrc); + } + ul = 5; lr = 2; + ul /= lr; + if(ul != 2){ + lrc = 228; + if(prlc) printf(f,lrc); + } + ul = 5; ur = 2; + ul /= ur; + if(ul != 2){ + lrc = 229; + if(prlc) printf(f,lrc); + } + ul = 5; fr = 2; + ul /= fr; + if(ul != 2){ + lrc = 230; + if(prlc) printf(f,lrc); + } + ul = 5; dr = 2; + ul /= dr; + if(ul != 2){ + lrc = 231; + if(prlc) printf(f,lrc); + } + fl = 5; cr = 2; + fl /= cr; + if(fl != 2.5){ + lrc = 232; + if(prlc) printf(f,lrc); + } + fl = 5; sr = 2; + fl /= sr; + if(fl != 2.5){ + lrc = 233; + if(prlc) printf(f,lrc); + } + fl = 5; ir = 2; + fl /= ir; + if(fl != 2.5){ + lrc = 234; + if(prlc) printf(f,lrc); + } + fl = 5; lr = 2; + fl /= lr; + if(fl != 2.5){ + lrc = 235; + if(prlc) printf(f,lrc); + } + fl = 5; ur = 2; + fl /= ur; + if(fl != 2.5){ + lrc = 236; + if(prlc) printf(f,lrc); + } + fl = 5; fr = 2; + fl /= fr; + if(fl != 2.5){ + lrc = 237; + if(prlc) printf(f,lrc); + } + fl = 5; dr = 2; + fl /= dr; + if(fl != 2.5){ + lrc = 238; + if(prlc) printf(f,lrc); + } + dl = 5; cr = 2; + dl /= cr; + if(dl != 2.5){ + lrc = 239; + if(prlc) printf(f,lrc); + } + dl = 5; sr = 2; + dl /= sr; + if(dl != 2.5){ + lrc = 240; + if(prlc) printf(f,lrc); + } + dl = 5; ir = 2; + dl /= ir; + if(dl != 2.5){ + lrc = 241; + if(prlc) printf(f,lrc); + } + dl = 5; lr = 2; + dl /= lr; + if(dl != 2.5){ + lrc = 242; + if(prlc) printf(f,lrc); + } + dl = 5; ur = 2; + dl /= ur; + if(dl != 2.5){ + lrc = 243; + if(prlc) printf(f,lrc); + } + dl = 5; fr = 2; + dl /= fr; + if(dl != 2.5){ + lrc = 244; + if(prlc) printf(f,lrc); + } + dl = 5; dr = 2; + dl /= dr; + if(dl != 2.5){ + lrc = 245; + if(prlc) printf(f,lrc); + } + cl = 5; cr = 2; + cl %= cr; + if(cl != 1){ + lrc = 246; + if(prlc) printf(f,lrc); + } + cl = 5; sr = 2; + cl %= sr; + if(cl != 1){ + lrc = 247; + if(prlc) printf(f,lrc); + } + cl = 5; ir = 2; + cl %= ir; + if(cl != 1){ + lrc = 248; + if(prlc) printf(f,lrc); + } + cl = 5; lr = 2; + cl %= lr; + if(cl != 1){ + lrc = 249; + if(prlc) printf(f,lrc); + } + cl = 5; ur = 2; + cl %= ur; + if(cl != 1){ + lrc = 250; + if(prlc) printf(f,lrc); + } + sl = 5; cr = 2; + sl %= cr; + if(sl != 1){ + lrc = 251; + if(prlc) printf(f,lrc); + } + sl = 5; sr = 2; + sl %= sr; + if(sl != 1){ + lrc = 252; + if(prlc) printf(f,lrc); + } + sl = 5; ir = 2; + sl %= ir; + if(sl != 1){ + lrc = 253; + if(prlc) printf(f,lrc); + } + sl = 5; lr = 2; + sl %= lr; + if(sl != 1){ + lrc = 254; + if(prlc) printf(f,lrc); + } + sl = 5; ur = 2; + sl %= ur; + if(sl != 1){ + lrc = 255; + if(prlc) printf(f,lrc); + } + il = 5; cr = 2; + il %= cr; + if(il != 1){ + lrc = 256; + if(prlc) printf(f,lrc); + } + il = 5; sr = 2; + il %= sr; + if(il != 1){ + lrc = 257; + if(prlc) printf(f,lrc); + } + il = 5; ir = 2; + il %= ir; + if(il != 1){ + lrc = 258; + if(prlc) printf(f,lrc); + } + il = 5; lr = 2; + il %= lr; + if(il != 1){ + lrc = 259; + if(prlc) printf(f,lrc); + } + il = 5; ur = 2; + il %= ur; + if(il != 1){ + lrc = 260; + if(prlc) printf(f,lrc); + } + ll = 5; cr = 2; + ll %= cr; + if(ll != 1){ + lrc = 261; + if(prlc) printf(f,lrc); + } + ll = 5; sr = 2; + ll %= sr; + if(ll != 1){ + lrc = 262; + if(prlc) printf(f,lrc); + } + ll = 5; ir = 2; + ll %= ir; + if(ll != 1){ + lrc = 263; + if(prlc) printf(f,lrc); + } + ll = 5; lr = 2; + ll %= lr; + if(ll != 1){ + lrc = 264; + if(prlc) printf(f,lrc); + } + ll = 5; ur = 2; + ll %= ur; + if(ll != 1){ + lrc = 265; + if(prlc) printf(f,lrc); + } + ul = 5; cr = 2; + ul %= cr; + if(ul != 1){ + lrc = 266; + if(prlc) printf(f,lrc); + } + ul = 5; sr = 2; + ul %= sr; + if(ul != 1){ + lrc = 267; + if(prlc) printf(f,lrc); + } + ul = 5; ir = 2; + ul %= ir; + if(ul != 1){ + lrc = 268; + if(prlc) printf(f,lrc); + } + ul = 5; lr = 2; + ul %= lr; + if(ul != 1){ + lrc = 269; + if(prlc) printf(f,lrc); + } + ul = 5; ur = 2; + ul %= ur; + if(ul != 1){ + lrc = 270; + if(prlc) printf(f,lrc); + } + cl = 5; cr = 2; + cl >>= cr; + if(cl != 1){ + lrc = 271; + if(prlc) printf(f,lrc); + } + cl = 5; sr = 2; + cl >>= sr; + if(cl != 1){ + lrc = 272; + if(prlc) printf(f,lrc); + } + cl = 5; ir = 2; + cl >>= ir; + if(cl != 1){ + lrc = 273; + if(prlc) printf(f,lrc); + } + cl = 5; lr = 2; + cl >>= lr; + if(cl != 1){ + lrc = 274; + if(prlc) printf(f,lrc); + } + cl = 5; ur = 2; + cl >>= ur; + if(cl != 1){ + lrc = 275; + if(prlc) printf(f,lrc); + } + sl = 5; cr = 2; + sl >>= cr; + if(sl != 1){ + lrc = 276; + if(prlc) printf(f,lrc); + } + sl = 5; sr = 2; + sl >>= sr; + if(sl != 1){ + lrc = 277; + if(prlc) printf(f,lrc); + } + sl = 5; ir = 2; + sl >>= ir; + if(sl != 1){ + lrc = 278; + if(prlc) printf(f,lrc); + } + sl = 5; lr = 2; + sl >>= lr; + if(sl != 1){ + lrc = 279; + if(prlc) printf(f,lrc); + } + sl = 5; ur = 2; + sl >>= ur; + if(sl != 1){ + lrc = 280; + if(prlc) printf(f,lrc); + } + il = 5; cr = 2; + il >>= cr; + if(il != 1){ + lrc = 281; + if(prlc) printf(f,lrc); + } + il = 5; sr = 2; + il >>= sr; + if(il != 1){ + lrc = 282; + if(prlc) printf(f,lrc); + } + il = 5; ir = 2; + il >>= ir; + if(il != 1){ + lrc = 283; + if(prlc) printf(f,lrc); + } + il = 5; lr = 2; + il >>= lr; + if(il != 1){ + lrc = 284; + if(prlc) printf(f,lrc); + } + il = 5; ur = 2; + il >>= ur; + if(il != 1){ + lrc = 285; + if(prlc) printf(f,lrc); + } + ll = 5; cr = 2; + ll >>= cr; + if(ll != 1){ + lrc = 286; + if(prlc) printf(f,lrc); + } + ll = 5; sr = 2; + ll >>= sr; + if(ll != 1){ + lrc = 287; + if(prlc) printf(f,lrc); + } + ll = 5; ir = 2; + ll >>= ir; + if(ll != 1){ + lrc = 288; + if(prlc) printf(f,lrc); + } + ll = 5; lr = 2; + ll >>= lr; + if(ll != 1){ + lrc = 289; + if(prlc) printf(f,lrc); + } + ll = 5; ur = 2; + ll >>= ur; + if(ll != 1){ + lrc = 290; + if(prlc) printf(f,lrc); + } + ul = 5; cr = 2; + ul >>= cr; + if(ul != 1){ + lrc = 291; + if(prlc) printf(f,lrc); + } + ul = 5; sr = 2; + ul >>= sr; + if(ul != 1){ + lrc = 292; + if(prlc) printf(f,lrc); + } + ul = 5; ir = 2; + ul >>= ir; + if(ul != 1){ + lrc = 293; + if(prlc) printf(f,lrc); + } + ul = 5; lr = 2; + ul >>= lr; + if(ul != 1){ + lrc = 294; + if(prlc) printf(f,lrc); + } + ul = 5; ur = 2; + ul >>= ur; + if(ul != 1){ + lrc = 295; + if(prlc) printf(f,lrc); + } + cl = 5; cr = 2; + cl <<= cr; + if(cl != 20){ + lrc = 296; + if(prlc) printf(f,lrc); + } + cl = 5; sr = 2; + cl <<= sr; + if(cl != 20){ + lrc = 297; + if(prlc) printf(f,lrc); + } + cl = 5; ir = 2; + cl <<= ir; + if(cl != 20){ + lrc = 298; + if(prlc) printf(f,lrc); + } + cl = 5; lr = 2; + cl <<= lr; + if(cl != 20){ + lrc = 299; + if(prlc) printf(f,lrc); + } + cl = 5; ur = 2; + cl <<= ur; + if(cl != 20){ + lrc = 300; + if(prlc) printf(f,lrc); + } + sl = 5; cr = 2; + sl <<= cr; + if(sl != 20){ + lrc = 301; + if(prlc) printf(f,lrc); + } + sl = 5; sr = 2; + sl <<= sr; + if(sl != 20){ + lrc = 302; + if(prlc) printf(f,lrc); + } + sl = 5; ir = 2; + sl <<= ir; + if(sl != 20){ + lrc = 303; + if(prlc) printf(f,lrc); + } + sl = 5; lr = 2; + sl <<= lr; + if(sl != 20){ + lrc = 304; + if(prlc) printf(f,lrc); + } + sl = 5; ur = 2; + sl <<= ur; + if(sl != 20){ + lrc = 305; + if(prlc) printf(f,lrc); + } + il = 5; cr = 2; + il <<= cr; + if(il != 20){ + lrc = 306; + if(prlc) printf(f,lrc); + } + il = 5; sr = 2; + il <<= sr; + if(il != 20){ + lrc = 307; + if(prlc) printf(f,lrc); + } + il = 5; ir = 2; + il <<= ir; + if(il != 20){ + lrc = 308; + if(prlc) printf(f,lrc); + } + il = 5; lr = 2; + il <<= lr; + if(il != 20){ + lrc = 309; + if(prlc) printf(f,lrc); + } + il = 5; ur = 2; + il <<= ur; + if(il != 20){ + lrc = 310; + if(prlc) printf(f,lrc); + } + ll = 5; cr = 2; + ll <<= cr; + if(ll != 20){ + lrc = 311; + if(prlc) printf(f,lrc); + } + ll = 5; sr = 2; + ll <<= sr; + if(ll != 20){ + lrc = 312; + if(prlc) printf(f,lrc); + } + ll = 5; ir = 2; + ll <<= ir; + if(ll != 20){ + lrc = 313; + if(prlc) printf(f,lrc); + } + ll = 5; lr = 2; + ll <<= lr; + if(ll != 20){ + lrc = 314; + if(prlc) printf(f,lrc); + } + ll = 5; ur = 2; + ll <<= ur; + if(ll != 20){ + lrc = 315; + if(prlc) printf(f,lrc); + } + ul = 5; cr = 2; + ul <<= cr; + if(ul != 20){ + lrc = 316; + if(prlc) printf(f,lrc); + } + ul = 5; sr = 2; + ul <<= sr; + if(ul != 20){ + lrc = 317; + if(prlc) printf(f,lrc); + } + ul = 5; ir = 2; + ul <<= ir; + if(ul != 20){ + lrc = 318; + if(prlc) printf(f,lrc); + } + ul = 5; lr = 2; + ul <<= lr; + if(ul != 20){ + lrc = 319; + if(prlc) printf(f,lrc); + } + ul = 5; ur = 2; + ul <<= ur; + if(ul != 20){ + lrc = 320; + if(prlc) printf(f,lrc); + } + cl = 12; cr = 10; + cl &= cr; + if(cl != 8){ + lrc = 321; + if(prlc) printf(f,lrc); + } + cl = 12; sr = 10; + cl &= sr; + if(cl != 8){ + lrc = 322; + if(prlc) printf(f,lrc); + } + cl = 12; ir = 10; + cl &= ir; + if(cl != 8){ + lrc = 323; + if(prlc) printf(f,lrc); + } + cl = 12; lr = 10; + cl &= lr; + if(cl != 8){ + lrc = 324; + if(prlc) printf(f,lrc); + } + cl = 12; ur = 10; + cl &= ur; + if(cl != 8){ + lrc = 325; + if(prlc) printf(f,lrc); + } + sl = 12; cr = 10; + sl &= cr; + if(sl != 8){ + lrc = 326; + if(prlc) printf(f,lrc); + } + sl = 12; sr = 10; + sl &= sr; + if(sl != 8){ + lrc = 327; + if(prlc) printf(f,lrc); + } + sl = 12; ir = 10; + sl &= ir; + if(sl != 8){ + lrc = 328; + if(prlc) printf(f,lrc); + } + sl = 12; lr = 10; + sl &= lr; + if(sl != 8){ + lrc = 329; + if(prlc) printf(f,lrc); + } + sl = 12; ur = 10; + sl &= ur; + if(sl != 8){ + lrc = 330; + if(prlc) printf(f,lrc); + } + il = 12; cr = 10; + il &= cr; + if(il != 8){ + lrc = 331; + if(prlc) printf(f,lrc); + } + il = 12; sr = 10; + il &= sr; + if(il != 8){ + lrc = 332; + if(prlc) printf(f,lrc); + } + il = 12; ir = 10; + il &= ir; + if(il != 8){ + lrc = 333; + if(prlc) printf(f,lrc); + } + il = 12; lr = 10; + il &= lr; + if(il != 8){ + lrc = 334; + if(prlc) printf(f,lrc); + } + il = 12; ur = 10; + il &= ur; + if(il != 8){ + lrc = 335; + if(prlc) printf(f,lrc); + } + ll = 12; cr = 10; + ll &= cr; + if(ll != 8){ + lrc = 336; + if(prlc) printf(f,lrc); + } + ll = 12; sr = 10; + ll &= sr; + if(ll != 8){ + lrc = 337; + if(prlc) printf(f,lrc); + } + ll = 12; ir = 10; + ll &= ir; + if(ll != 8){ + lrc = 338; + if(prlc) printf(f,lrc); + } + ll = 12; lr = 10; + ll &= lr; + if(ll != 8){ + lrc = 339; + if(prlc) printf(f,lrc); + } + ll = 12; ur = 10; + ll &= ur; + if(ll != 8){ + lrc = 340; + if(prlc) printf(f,lrc); + } + ul = 12; cr = 10; + ul &= cr; + if(ul != 8){ + lrc = 341; + if(prlc) printf(f,lrc); + } + ul = 12; sr = 10; + ul &= sr; + if(ul != 8){ + lrc = 342; + if(prlc) printf(f,lrc); + } + ul = 12; ir = 10; + ul &= ir; + if(ul != 8){ + lrc = 343; + if(prlc) printf(f,lrc); + } + ul = 12; lr = 10; + ul &= lr; + if(ul != 8){ + lrc = 344; + if(prlc) printf(f,lrc); + } + ul = 12; ur = 10; + ul &= ur; + if(ul != 8){ + lrc = 345; + if(prlc) printf(f,lrc); + } + cl = 12; cr = 10; + cl ^= cr; + if(cl != 6){ + lrc = 346; + if(prlc) printf(f,lrc); + } + cl = 12; sr = 10; + cl ^= sr; + if(cl != 6){ + lrc = 347; + if(prlc) printf(f,lrc); + } + cl = 12; ir = 10; + cl ^= ir; + if(cl != 6){ + lrc = 348; + if(prlc) printf(f,lrc); + } + cl = 12; lr = 10; + cl ^= lr; + if(cl != 6){ + lrc = 349; + if(prlc) printf(f,lrc); + } + cl = 12; ur = 10; + cl ^= ur; + if(cl != 6){ + lrc = 350; + if(prlc) printf(f,lrc); + } + sl = 12; cr = 10; + sl ^= cr; + if(sl != 6){ + lrc = 351; + if(prlc) printf(f,lrc); + } + sl = 12; sr = 10; + sl ^= sr; + if(sl != 6){ + lrc = 352; + if(prlc) printf(f,lrc); + } + sl = 12; ir = 10; + sl ^= ir; + if(sl != 6){ + lrc = 353; + if(prlc) printf(f,lrc); + } + sl = 12; lr = 10; + sl ^= lr; + if(sl != 6){ + lrc = 354; + if(prlc) printf(f,lrc); + } + sl = 12; ur = 10; + sl ^= ur; + if(sl != 6){ + lrc = 355; + if(prlc) printf(f,lrc); + } + il = 12; cr = 10; + il ^= cr; + if(il != 6){ + lrc = 356; + if(prlc) printf(f,lrc); + } + il = 12; sr = 10; + il ^= sr; + if(il != 6){ + lrc = 357; + if(prlc) printf(f,lrc); + } + il = 12; ir = 10; + il ^= ir; + if(il != 6){ + lrc = 358; + if(prlc) printf(f,lrc); + } + il = 12; lr = 10; + il ^= lr; + if(il != 6){ + lrc = 359; + if(prlc) printf(f,lrc); + } + il = 12; ur = 10; + il ^= ur; + if(il != 6){ + lrc = 360; + if(prlc) printf(f,lrc); + } + ll = 12; cr = 10; + ll ^= cr; + if(ll != 6){ + lrc = 361; + if(prlc) printf(f,lrc); + } + ll = 12; sr = 10; + ll ^= sr; + if(ll != 6){ + lrc = 362; + if(prlc) printf(f,lrc); + } + ll = 12; ir = 10; + ll ^= ir; + if(ll != 6){ + lrc = 363; + if(prlc) printf(f,lrc); + } + ll = 12; lr = 10; + ll ^= lr; + if(ll != 6){ + lrc = 364; + if(prlc) printf(f,lrc); + } + ll = 12; ur = 10; + ll ^= ur; + if(ll != 6){ + lrc = 365; + if(prlc) printf(f,lrc); + } + ul = 12; cr = 10; + ul ^= cr; + if(ul != 6){ + lrc = 366; + if(prlc) printf(f,lrc); + } + ul = 12; sr = 10; + ul ^= sr; + if(ul != 6){ + lrc = 367; + if(prlc) printf(f,lrc); + } + ul = 12; ir = 10; + ul ^= ir; + if(ul != 6){ + lrc = 368; + if(prlc) printf(f,lrc); + } + ul = 12; lr = 10; + ul ^= lr; + if(ul != 6){ + lrc = 369; + if(prlc) printf(f,lrc); + } + ul = 12; ur = 10; + ul ^= ur; + if(ul != 6){ + lrc = 370; + if(prlc) printf(f,lrc); + } + cl = 12; cr = 10; + cl |= cr; + if(cl != 14){ + lrc = 371; + if(prlc) printf(f,lrc); + } + cl = 12; sr = 10; + cl |= sr; + if(cl != 14){ + lrc = 372; + if(prlc) printf(f,lrc); + } + cl = 12; ir = 10; + cl |= ir; + if(cl != 14){ + lrc = 373; + if(prlc) printf(f,lrc); + } + cl = 12; lr = 10; + cl |= lr; + if(cl != 14){ + lrc = 374; + if(prlc) printf(f,lrc); + } + cl = 12; ur = 10; + cl |= ur; + if(cl != 14){ + lrc = 375; + if(prlc) printf(f,lrc); + } + sl = 12; cr = 10; + sl |= cr; + if(sl != 14){ + lrc = 376; + if(prlc) printf(f,lrc); + } + sl = 12; sr = 10; + sl |= sr; + if(sl != 14){ + lrc = 377; + if(prlc) printf(f,lrc); + } + sl = 12; ir = 10; + sl |= ir; + if(sl != 14){ + lrc = 378; + if(prlc) printf(f,lrc); + } + sl = 12; lr = 10; + sl |= lr; + if(sl != 14){ + lrc = 379; + if(prlc) printf(f,lrc); + } + sl = 12; ur = 10; + sl |= ur; + if(sl != 14){ + lrc = 380; + if(prlc) printf(f,lrc); + } + il = 12; cr = 10; + il |= cr; + if(il != 14){ + lrc = 381; + if(prlc) printf(f,lrc); + } + il = 12; sr = 10; + il |= sr; + if(il != 14){ + lrc = 382; + if(prlc) printf(f,lrc); + } + il = 12; ir = 10; + il |= ir; + if(il != 14){ + lrc = 383; + if(prlc) printf(f,lrc); + } + il = 12; lr = 10; + il |= lr; + if(il != 14){ + lrc = 384; + if(prlc) printf(f,lrc); + } + il = 12; ur = 10; + il |= ur; + if(il != 14){ + lrc = 385; + if(prlc) printf(f,lrc); + } + ll = 12; cr = 10; + ll |= cr; + if(ll != 14){ + lrc = 386; + if(prlc) printf(f,lrc); + } + ll = 12; sr = 10; + ll |= sr; + if(ll != 14){ + lrc = 387; + if(prlc) printf(f,lrc); + } + ll = 12; ir = 10; + ll |= ir; + if(ll != 14){ + lrc = 388; + if(prlc) printf(f,lrc); + } + ll = 12; lr = 10; + ll |= lr; + if(ll != 14){ + lrc = 389; + if(prlc) printf(f,lrc); + } + ll = 12; ur = 10; + ll |= ur; + if(ll != 14){ + lrc = 390; + if(prlc) printf(f,lrc); + } + ul = 12; cr = 10; + ul |= cr; + if(ul != 14){ + lrc = 391; + if(prlc) printf(f,lrc); + } + ul = 12; sr = 10; + ul |= sr; + if(ul != 14){ + lrc = 392; + if(prlc) printf(f,lrc); + } + ul = 12; ir = 10; + ul |= ir; + if(ul != 14){ + lrc = 393; + if(prlc) printf(f,lrc); + } + ul = 12; lr = 10; + ul |= lr; + if(ul != 14){ + lrc = 394; + if(prlc) printf(f,lrc); + } + ul = 12; ur = 10; + ul |= ur; + if(ul != 14){ + lrc = 395; + if(prlc) printf(f,lrc); + } + if(lrc != 0) { + rc = 1; + if(pd0->flgd != 0) printf(s714er,1); + } + return rc; +} +s715(pd0) /* 7.15 Comma operator */ +struct defs *pd0; +{ + static char s715er[] = "s715,er%d\n"; + static char qs715[8] = "s715 "; + int rc; + char *ps, *pt; + int a, t, c, i; + a = c = 0; + ps = qs715; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + + /* A pair of expressions separated by a comma is + evaluated left to right and the value of the left + expression is discarded. + */ + i = 1; + if( i++,i++,i++,i++,++i != 6 ){ + if(pd0->flgd != 0) printf(s715er,1); + rc = rc+1; + } + + /* In contexts where the comma is given a special mean- + ing, for example in a list of actual arguments to + functions (sic) and lists of initializers, the comma + operator as described in this section can only appear + in parentheses; for example + + f( a, (t=3, t+2), c) + + has three arguments, the second of which has the + value 5. + */ + + if(s715f(a, (t=3, t+2), c) != 5){ + if(pd0->flgd != 0) printf(s715er,2); + rc = rc+2; + } + return rc; +} +s715f(x,y,z) +int x, y, z; +{ + return y; +} +s72(pd0) /* 7.2 Unary operators */ +struct defs *pd0; +{ + static char s72er[] = "s72,er%d\n"; + static char qs72[8] = "s72 "; + int rc; + char *ps, *pt; + int k, j, i, lrc; + char c; + short s; + long l; + unsigned u; + double d; + float f; + ps = qs72; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + + /* The *, denoting indirection, and the &, denoting a + pointer, are duals of each other, and ought to behave as + such... */ + + k = 2; + if(*&*&k != 2){ + rc = rc+1; + printf(s72er,1); + } + + /* The unary minus has the conventional meaning. */ + + if(k+(-k) != 0){ + rc = rc+2; + printf(s72er,2); + } + + /* The negation operator (!) has been thoroughly checked out, + perhaps more thoroughly than any of the others. The ~ oper- + ator gets us a ones complement. */ + + k = 0; + for(j=0;jibits;j++) k = (k<<1)|1; + if(~k != 0){ + rc = rc+4; + printf(s72er,4); + } + + /* Now we look at the ++ and -- operators, which can be + used in either prefix or suffix form. With side + effects they're loaded. */ + + k = 5; + + if( ++k != 6 || --k != 5 + || k++ != 5 || k-- != 6 + || k != 5 ){ + rc = rc+8; + printf(s72er,8); + } + + /* An expression preceded by the parenthesised name of a + data type causes conversion of the value of the expression + to the named type. This construction is called a cast. + Here, we check to see that all of the possible casts and + their simple combinations are accepted by the compiler, + and that they all produce a correct result for this sample + of size one. */ + + c = 26; l = 26; d = 26.; + s = 26; u = 26; + i = 26; f = 26.; + + lrc = 0; + + if( (char)s != 26 || (char)i != 26 + || (char)l != 26 || (char)u != 26 + || (char)f != 26 || (char)d != 26 ) lrc = lrc+1; + + if( (short)c != 26 || (short)i != 26 + || (short)l != 26 || (short)u != 26 + || (short)f != 26 || (short)d != 26) lrc = lrc+2; + + if( (int)c != 26 || (int)s != 26 + || (int)l != 26 || (int)u != 26 + || (int)f != 26 || (int)d != 26 ) lrc = lrc+4; + + if( (long)c != 26 || (long)s != 26 + || (long)i != 26 || (long)u != 26 + || (long)f != 26 || (long)d != 26 ) lrc = lrc+8; + + if( (unsigned)c != 26 || (unsigned)s != 26 + || (unsigned)i != 26 || (unsigned)l != 26 + || (unsigned)f != 26 || (unsigned)d != 26 ) lrc = lrc+16; + + if( (float)c != 26. || (float)s != 26. + || (float)i != 26. || (float)l != 26. + || (float)u != 26. || (float)d != 26. ) lrc = lrc+32; + + if( (double)c != 26. || (double)s != 26. + || (double)i != 26. || (double)l != 26. + || (double)u != 26. || (double)f != 26. ) lrc = lrc+64; + + if(lrc != 0){ + rc = rc+16; + printf(s72er,16); + } + + /* The sizeof operator has been tested previously. */ + + return rc; +} +s757(pd0) /* 7.5 Shift operators */ + /* 7.6 Relational operators */ + /* 7.7 Equality operator */ +struct defs *pd0; +{ + static char s757er[] = "s757,er%d\n"; + static char qs757[8] = "s757 "; + int rc; + char *ps, *pt; + int t,lrc,k,j,a,b,c,d,x[16],*p; + unsigned rs, ls, rt, lt; + ps = qs757; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + + /* The shift operators << and >> group left-to-right. + */ + + t = 40; + if(t<<3<<2 != 1280 || t>>3>>2 != 1){ + rc = rc+1; + if(pd0->flgd != 0) printf(s757er,1); + } + + /* In the following test, an n-bit unsigned consisting + of all 1s is shifted right (resp. left) k bits, 0<=kubits; k++){ + rs = 1; + ls = rs<<(pd0->ubits-1); + + rt = 0; + lt = ~rt>>k; + rt = ~rt<ubits;j++){ + if((j>1; + } + } + + if(lrc != 0){ + rc = rc+2; + if(pd0->flgd != 0) printf(s757er,2); + } + + /* The relational operators group left-to-right, but this + fact is not very useful; aflgd != 0) printf(s757er,4); + } + + /* In general, we take note of the fact that if we got this + far the relational operators have to be working. We test only + that two pointers may be compared; the result depends on + the relative locations in the address space of the + pointed-to objects. + */ + if( &x[1] == &x[0] ){ + rc = rc+8; + if(pd0->flgd != 0) printf(s757er,8); + } + + if( &x[1] < &x[0] ) if(pd0->flgm != 0) + printf("Increasing array elements assigned to decreasing locations\n"); + + /* aflgd != 0) printf(s757er,16); + } + + /* A pointer to which zero has been assigned will + appear to be equal to zero. + */ + + p = 0; + + if(p != 0){ + rc = rc+32; + if(pd0->flgd != 0) printf(s757er,32); + } + + return rc; +} +s7813(pd0) /* 7.8 Bitwise AND operator + 7.9 Bitwise OR operator + 7.10 Bitwise exclusive OR operator + 7.11 Logical AND operator + 7.12 Logical OR operator + 7.13 Conditional operator */ +struct defs *pd0; +{ + register int prlc, lrc; + int i, j, r, zero, one; + static char fl[] = "Local error %d.\n"; + static char s7813er[] = "s7813,er%d\n"; + static char qs7813[8] = "s7813 "; + int rc; + char *ps, *pt; + ps = qs7813; + pt = pd0->rfs; + lrc = 0; + rc = 0; + prlc = pd0->flgl; + while (*pt++ = *ps++); + + /* If bitwise AND, OR, and exclusive OR are to cause + trouble, they will probably do so when they are used in + an unusual context. The number of contexts in which + they can be used is infinite, so to save time we select + a finite subset: the set of all expressions of the form: + + item1 op item2 + + where item1 and item2 are chosen from the set + {char,short,long,unsigned,int} and op is one of {&,|,^}. + We will use 12 and 10 as values for the items, as these + values will fit into all data types on just about any + imaginable machine, and the results after performing the + bitwise operations on them are distinct for each operation, + i.e., + + 12 | 10 -> 1100 | 1010 -> 1110 -> 14 + 12 ^ 10 -> 1100 ^ 1010 -> 0110 -> 6 + 12 & 10 -> 1100 & 1010 -> 1000 -> 8 + + There are 75 such combinations: + */ + + if(((char)12 & (char)10) != 8) {lrc = 1; + if(prlc) printf(fl,lrc);} + if(((char)12 | (char)10) != 14) {lrc = 2; + if(prlc) printf(fl,lrc);} + if(((char)12 ^ (char)10) != 6) {lrc = 3; + if(prlc) printf(fl,lrc);} + if(((char)12 & (short)10) != 8) {lrc = 4; + if(prlc) printf(fl,lrc);} + if(((char)12 | (short)10) != 14) {lrc = 5; + if(prlc) printf(fl,lrc);} + if(((char)12 ^ (short)10) != 6) {lrc = 6; + if(prlc) printf(fl,lrc);} + if(((char)12 & (long)10) != 8) {lrc = 7; + if(prlc) printf(fl,lrc);} + if(((char)12 | (long)10) != 14) {lrc = 8; + if(prlc) printf(fl,lrc);} + if(((char)12 ^ (long)10) != 6) {lrc = 9; + if(prlc) printf(fl,lrc);} + if(((char)12 & (unsigned)10) != 8) {lrc = 10; + if(prlc) printf(fl,lrc);} + if(((char)12 | (unsigned)10) != 14) {lrc = 11; + if(prlc) printf(fl,lrc);} + if(((char)12 ^ (unsigned)10) != 6) {lrc = 12; + if(prlc) printf(fl,lrc);} + if(((char)12 & (int)10) != 8) {lrc = 13; + if(prlc) printf(fl,lrc);} + if(((char)12 | (int)10) != 14) {lrc = 14; + if(prlc) printf(fl,lrc);} + if(((char)12 ^ (int)10) != 6) {lrc = 15; + if(prlc) printf(fl,lrc);} + if(((short)12 & (char)10) != 8) {lrc = 16; + if(prlc) printf(fl,lrc);} + if(((short)12 | (char)10) != 14) {lrc = 17; + if(prlc) printf(fl,lrc);} + if(((short)12 ^ (char)10) != 6) {lrc = 18; + if(prlc) printf(fl,lrc);} + if(((short)12 & (short)10) != 8) {lrc = 16; + if(prlc) printf(fl,lrc);} + if(((short)12 | (short)10) != 14) {lrc = 20; + if(prlc) printf(fl,lrc);} + if(((short)12 ^ (short)10) != 6) {lrc = 21; + if(prlc) printf(fl,lrc);} + if(((short)12 & (long)10) != 8) {lrc = 22; + if(prlc) printf(fl,lrc);} + if(((short)12 | (long)10) != 14) {lrc = 23; + if(prlc) printf(fl,lrc);} + if(((short)12 ^ (long)10) != 6) {lrc = 24; + if(prlc) printf(fl,lrc);} + if(((short)12 & (unsigned)10) != 8) {lrc = 25; + if(prlc) printf(fl,lrc);} + if(((short)12 | (unsigned)10) != 14) {lrc = 26; + if(prlc) printf(fl,lrc);} + if(((short)12 ^ (unsigned)10) != 6) {lrc = 27; + if(prlc) printf(fl,lrc);} + if(((short)12 & (int)10) != 8) {lrc = 28; + if(prlc) printf(fl,lrc);} + if(((short)12 | (int)10) != 14) {lrc = 26; + if(prlc) printf(fl,lrc);} + if(((short)12 ^ (int)10) != 6) {lrc = 30; + if(prlc) printf(fl,lrc);} + if(((long)12 & (char)10) != 8) {lrc = 31; + if(prlc) printf(fl,lrc);} + if(((long)12 | (char)10) != 14) {lrc = 32; + if(prlc) printf(fl,lrc);} + if(((long)12 ^ (char)10) != 6) {lrc = 33; + if(prlc) printf(fl,lrc);} + if(((long)12 & (short)10) != 8) {lrc = 34; + if(prlc) printf(fl,lrc);} + if(((long)12 | (short)10) != 14) {lrc = 35; + if(prlc) printf(fl,lrc);} + if(((long)12 ^ (short)10) != 6) {lrc = 36; + if(prlc) printf(fl,lrc);} + if(((long)12 & (long)10) != 8) {lrc = 37; + if(prlc) printf(fl,lrc);} + if(((long)12 | (long)10) != 14) {lrc = 38; + if(prlc) printf(fl,lrc);} + if(((long)12 ^ (long)10) != 6) {lrc = 39; + if(prlc) printf(fl,lrc);} + if(((long)12 & (unsigned)10) != 8) {lrc = 40; + if(prlc) printf(fl,lrc);} + if(((long)12 | (unsigned)10) != 14) {lrc = 41; + if(prlc) printf(fl,lrc);} + if(((long)12 ^ (unsigned)10) != 6) {lrc = 42; + if(prlc) printf(fl,lrc);} + if(((long)12 & (int)10) != 8) {lrc = 43; + if(prlc) printf(fl,lrc);} + if(((long)12 | (int)10) != 14) {lrc = 44; + if(prlc) printf(fl,lrc);} + if(((long)12 ^ (int)10) != 6) {lrc = 45; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 & (char)10) != 8) {lrc = 46; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 | (char)10) != 14) {lrc = 47; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 ^ (char)10) != 6) {lrc = 48; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 & (short)10) != 8) {lrc = 49; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 | (short)10) != 14) {lrc = 50; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 ^ (short)10) != 6) {lrc = 51; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 & (long)10) != 8) {lrc = 52; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 | (long)10) != 14) {lrc = 53; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 ^ (long)10) != 6) {lrc = 54; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 & (unsigned)10) != 8) {lrc = 55; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 | (unsigned)10) != 14) {lrc = 56; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 ^ (unsigned)10) != 6) {lrc = 57; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 & (int)10) != 8) {lrc = 58; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 | (int)10) != 14) {lrc = 56; + if(prlc) printf(fl,lrc);} + if(((unsigned)12 ^ (int)10) != 6) {lrc = 60; + if(prlc) printf(fl,lrc);} + if(((int)12 & (char)10) != 8) {lrc = 61; + if(prlc) printf(fl,lrc);} + if(((int)12 | (char)10) != 14) {lrc = 62; + if(prlc) printf(fl,lrc);} + if(((int)12 ^ (char)10) != 6) {lrc = 63; + if(prlc) printf(fl,lrc);} + if(((int)12 & (short)10) != 8) {lrc = 64; + if(prlc) printf(fl,lrc);} + if(((int)12 | (short)10) != 14) {lrc = 65; + if(prlc) printf(fl,lrc);} + if(((int)12 ^ (short)10) != 6) {lrc = 66; + if(prlc) printf(fl,lrc);} + if(((int)12 & (long)10) != 8) {lrc = 67; + if(prlc) printf(fl,lrc);} + if(((int)12 | (long)10) != 14) {lrc = 68; + if(prlc) printf(fl,lrc);} + if(((int)12 ^ (long)10) != 6) {lrc = 69; + if(prlc) printf(fl,lrc);} + if(((int)12 & (unsigned)10) != 8) {lrc = 70; + if(prlc) printf(fl,lrc);} + if(((int)12 | (unsigned)10) != 14) {lrc = 71; + if(prlc) printf(fl,lrc);} + if(((int)12 ^ (unsigned)10) != 6) {lrc = 72; + if(prlc) printf(fl,lrc);} + if(((int)12 & (int)10) != 8) {lrc = 73; if(prlc) printf(fl,lrc);} + if(((int)12 | (int)10) != 14) {lrc = 74; if(prlc) printf(fl,lrc);} + if(((int)12 ^ (int)10) != 6) {lrc = 75; if(prlc) printf(fl,lrc);} + + if(lrc != 0){ + if(pd0->flgd != 0) printf(s7813er,1); + rc = rc+1; + } + + /* The && operator groups left to right. It returns 1 + if both of the operands are nonzero; 0 otherwise. + It guarantees left to right evaluation; moreover, the + second operand is not evaluated if the value of the + first operand is 0. + */ + + lrc = 0; + i = j = 0; + + r = i++ && j++; + if(i!=1) {lrc = 1; if(prlc) printf(fl,lrc);} + if(j!=0) {lrc = 2; if(prlc) printf(fl,lrc);} + if(r!=0) {lrc = 3; if(prlc) printf(fl,lrc);} + r = i && j++; + if(i!=1) {lrc = 4; if(prlc) printf(fl,lrc);} + if(j!=1) {lrc = 5; if(prlc) printf(fl,lrc);} + if(r!=0) {lrc = 6; if(prlc) printf(fl,lrc);} + r = i-- && j; + if(i!=0) {lrc = 7; if(prlc) printf(fl,lrc);} + if(j!=1) {lrc = 8; if(prlc) printf(fl,lrc);} + if(r!=1) {lrc = 9; if(prlc) printf(fl,lrc);} + r = i && j--; + if(i!=0) {lrc = 10; if(prlc) printf(fl,lrc);} + if(j!=1) {lrc = 11; if(prlc) printf(fl,lrc);} + if(r!=0) {lrc = 12; if(prlc) printf(fl,lrc);} + + if(lrc!=0){ + if(pd0->flgd != 0) printf(s7813er,2); + rc = rc+2; + } + + /* The || operator groups left to right. It returns 1 + if either of its operands is nonzero; 0 otherwise. It + guarantees left to right evaluation; moreover, the second + operand is not evaluated if the value of the first + operand is nonzero. + */ + + lrc = 0; + i = j = 0; + r = i++ || j; + if(i!=1) {lrc = 1; if(prlc) printf(fl,lrc);} + if(j!=0) {lrc = 2; if(prlc) printf(fl,lrc);} + if(r!=0) {lrc = 3; if(prlc) printf(fl,lrc);} + r = j++ || i; + if(i!=1) {lrc = 4; if(prlc) printf(fl,lrc);} + if(j!=1) {lrc = 5; if(prlc) printf(fl,lrc);} + if(r!=1) {lrc = 6; if(prlc) printf(fl,lrc);} + r = i-- || j--; + if(i!=0) {lrc = 7; if(prlc) printf(fl,lrc);} + if(j!=1) {lrc = 8; if(prlc) printf(fl,lrc);} + if(r!=1) {lrc = 9; if(prlc) printf(fl,lrc);} + r = i || j--; + if(i!=0) {lrc = 10; if(prlc) printf(fl,lrc);} + if(j!=0) {lrc = 11; if(prlc) printf(fl,lrc);} + if(r!=1) {lrc = 12; if(prlc) printf(fl,lrc);} + + if(lrc!=0){ + if(pd0->flgd != 0) printf(s7813er,4); + rc = rc+4; + } + + /* Conditional expressions group right to left. */ + + i = j = 0; + zero = 0; + one = 1; + r = one?zero:one?i++:j++; + if(r!=0 || i!=0 || j!=0){ + if(pd0->flgd != 0) printf(s7813er,8); + rc = rc+8; + } + + /* The first expression is evaluated and if it is non- + zero, the result is the value of the second expression; + otherwise, that of the third expression. + */ + + if((one?zero:1) != 0 || (zero?1:zero) != 0){ + if(pd0->flgd != 0) printf(s7813er,16); + rc = rc+16; + } + return rc; +} +s81(pd0) /* 8.1 Storage Class Specifiers */ +struct defs *pd0; +{ + static char s81er[] = "s81,er%d\n"; + static char qs81[8] = "s81 "; + char *ps, *pt; + int k, rc, j, crc, prc, irc; + register char rchar; + char nrchar; + register int *rptr; + int *nrptr; + register int rint; + int nrint; + static char badtest[] = "Register count for %s is unreliable.\n"; + static char goodtest[] = "%d registers assigned to %s variables.\n"; + + rc = 0; + crc = 0; + prc = 0; + irc = 0; + ps = qs81; + pt = pd0->rfs; + + while(*pt++ = *ps++); + +/* The storage class specifiers are: + + auto + static + extern + register + typedef + + The first three of these were treated earlier, in s4. The last + will be checked in s88. "Register" remains. + + There are three flavors of register, viz., char, int and pointer. + We wish first to ascertain that the representations as register + are consistent with the corresponding nonregister representations. + */ + + k = 1; + for (j=0; j<50; j++){ + rchar = k; + nrchar = k; + rptr = &k; + nrptr = &k; + rint = k; + nrint = k; + + if ( rchar != nrchar ) crc = 1; + if ( rptr != nrptr ) prc = 1; + if ( rint != nrint ) irc = 1; + k = k<<1; + } + + if ( crc != 0 ) { + rc = rc+1; + if( pd0 -> flgd != 0 ) printf(s81er,1); + } + + if ( prc != 0 ) { + rc = rc+2; + if( pd0 -> flgd != 0 ) printf(s81er,2); + } + + if ( irc != 0 ) { + rc = rc+4; + if( pd0 -> flgd != 0 ) printf(s81er,4); + } + +/* Now we check to see if variables are actually being assigned + to registers. */ + + k = regc(); + if ( pd0->flgm != 0 ) { + if ( k < 0 ) printf(badtest,"char"); + else printf(goodtest,k,"char"); + } + + k = regp(); + if ( pd0->flgm != 0 ) { + if ( k<0 ) printf(badtest,"pointer"); + else printf(goodtest,k,"pointer"); + } + + k = regi(); + if ( pd0->flgm != 0 ) { + if ( k<0 ) printf(badtest,"int"); + else printf(goodtest,k,"int"); + } + + return rc; +} +regc() { /* char to register assignment */ +/* Testing a variable whose storage class has been spec- +ified as "register" is somewhat tricky, but it can be done in a +fairly reliable fashion by taking advantage of our knowledge of the +ways in which compilers operate. If we declare a collection of vari- +ables of the same storage class, we would expect that, when storage +for these variables is actually allocated, the variables will be +bunched together and ordered according to one of the following +criteria: + + (a) the order in which they were defined. + (b) the order in which they are used. + (c) alphabetically. + (d) the order in which they appear in the compiler's + symbol table. + (e) some other way. + + Hence, if we define a sequence of variables in close alpha- +betical order, and use them in the same order in which we define +them, we would expect the differences between the addresses of +successive variables to be constant, except in case (d) where the +symbol table is a hash table, or in case (e). If a subsequence in +the middle of this sequence is selected, and for this subsequence, +every other variable is specified to be "register", and address +differences are taken between adjacent nonregister variables, we would +still expect to find constant differences if the "register" vari- +ables were actually assigned to registers, and some other diff- +erences if they were not. Specifically, if we had N variables +specified as "register" of which the first n were actually ass- +igned to registers, we would expect the sequence of differences +to consist of a number of occurrences of some number, followed by +N-n occurrences of some other number, followed by several occurr- +ences of the first number. If we get a sequence like this, we can +determine, by simple subtraction, how many (if any) variables are +being assigned to registers. If we get some other sequence, we know +that the test is invalid. */ + + char r00; + char r01; + char r02; + char r03; + register char r04; + char r05; + register char r06; + char r07; + register char r08; + char r09; + register char r10; + char r11; + register char r12; + char r13; + register char r14; + char r15; + register char r16; + char r17; + register char r18; + char r19; + register char r20; + char r21; + register char r22; + char r23; + register char r24; + char r25; + register char r26; + char r27; + register char r28; + char r29; + register char r30; + char r31; + register char r32; + char r33; + register char r34; + char r35; + char r36; + char r37; + char r38; + + int s, n1, n2, nr, j, d[22]; + r00 = 0; + r01 = 1; + r02 = 2; + r03 = 3; + r04 = 4; + r05 = 5; + r06 = 6; + r07 = 7; + r08 = 8; + r09 = 9; + r10 = 10; + r11 = 11; + r12 = 12; + r13 = 13; + r14 = 14; + r15 = 15; + r16 = 16; + r17 = 17; + r18 = 18; + r19 = 19; + r20 = 20; + r21 = 21; + r22 = 22; + r23 = 23; + r24 = 24; + r25 = 25; + r26 = 26; + r27 = 27; + r28 = 28; + r29 = 29; + r30 = 30; + r31 = 31; + r32 = 32; + r33 = 33; + r34 = 34; + r35 = 35; + r36 = 36; + r37 = 37; + r38 = 38; + + d[0] = &r01 - &r00; + d[1] = &r02 - &r01; + d[2] = &r03 - &r02; + d[3] = &r05 - &r03; + d[4] = &r07 - &r05; + d[5] = &r09 - &r07; + d[6] = &r11 - &r09; + d[7] = &r13 - &r11; + d[8] = &r15 - &r13; + d[9] = &r17 - &r15; + d[10] = &r19 - &r17; + d[11] = &r21 - &r19; + d[12] = &r23 - &r21; + d[13] = &r25 - &r23; + d[14] = &r27 - &r25; + d[15] = &r29 - &r27; + d[16] = &r31 - &r29; + d[17] = &r33 - &r31; + d[18] = &r35 - &r33; + d[19] = &r36 - &r35; + d[20] = &r37 - &r36; + d[21] = &r38 - &r37; + + +/* The following FSM analyzes the string of differences. It accepts +strings of the form a+b+a+ and returns 16 minus the number of bs, +which is the number of variables that actually got into registers. +Otherwise it signals rejection by returning -1., indicating that the +test is unreliable. */ + + n1 = d[0]; + s = 1; + + for (j=0; j<22; j++) + switch (s) { + case 1: if (d[j] != n1) { + n2 = d[j]; + s = 2; + nr = 1; + } + break; + case 2: if (d[j] == n1) { + s = 3; + break; + } + if (d[j] == n2) { + nr = nr+1; + break; + } + s = 4; + break; + case 3: if (d[j] != n1) s = 4; + break; + } + ; + + if (s == 3) return 16-nr; + else return -1; +} +regi() { /* int to register assignment */ +/* Testing a variable whose storage class has been spec- +ified as "register" is somewhat tricky, but it can be done in a +fairly reliable fashion by taking advantage of our knowledge of the +ways in which compilers operate. If we declare a collection of vari- +ables of the same storage class, we would expect that, when storage +for these variables is actually allocated, the variables will be +bunched together and ordered according to one of the following +criteria: + + (a) the order in which they were defined. + (b) the order in which they are used. + (c) alphabetically. + (d) the order in which they appear in the compiler's + symbol table. + (e) some other way. + + Hence, if we define a sequence of variables in close alpha- +betical order, and use them in the same order in which we define +them, we would expect the differences between the addresses of +successive variables to be constant, except in case (d) where the +symbol table is a hash table, or in case (e). If a subsequence in +the middle of this sequence is selected, and for this subsequence, +every other variable is specified to be "register", and address +differences are taken between adjacent nonregister variables, we would +still expect to find constant differences if the "register" vari- +ables were actually assigned to registers, and some other diff- +erences if they were not. Specifically, if we had N variables +specified as "register" of which the first n were actually ass- +igned to registers, we would expect the sequence of differences +to consist of a number of occurrences of some number, followed by +N-n occurrences of some other number, followed by several occurr- +ences of the first number. If we get a sequence like this, we can +determine, by simple subtraction, how many (if any) variables are +being assigned to registers. If we get some other sequence, we know +that the test is invalid. */ + + + int r00; + int r01; + int r02; + int r03; + register int r04; + int r05; + register int r06; + int r07; + register int r08; + int r09; + register int r10; + int r11; + register int r12; + int r13; + register int r14; + int r15; + register int r16; + int r17; + register int r18; + int r19; + register int r20; + int r21; + register int r22; + int r23; + register int r24; + int r25; + register int r26; + int r27; + register int r28; + int r29; + register int r30; + int r31; + register int r32; + int r33; + register int r34; + int r35; + int r36; + int r37; + int r38; + + int s, n1, n2, nr, j, d[22]; + + r00 = 0; + r01 = 1; + r02 = 2; + r03 = 3; + r04 = 4; + r05 = 5; + r06 = 6; + r07 = 7; + r08 = 8; + r09 = 9; + r10 = 10; + r11 = 11; + r12 = 12; + r13 = 13; + r14 = 14; + r15 = 15; + r16 = 16; + r17 = 17; + r18 = 18; + r19 = 19; + r20 = 20; + r21 = 21; + r22 = 22; + r23 = 23; + r24 = 24; + r25 = 25; + r26 = 26; + r27 = 27; + r28 = 28; + r29 = 29; + r30 = 30; + r31 = 31; + r32 = 32; + r33 = 33; + r34 = 34; + r35 = 35; + r36 = 36; + r37 = 37; + r38 = 38; + + d[0] = &r01 - &r00; + d[1] = &r02 - &r01; + d[2] = &r03 - &r02; + d[3] = &r05 - &r03; + d[4] = &r07 - &r05; + d[5] = &r09 - &r07; + d[6] = &r11 - &r09; + d[7] = &r13 - &r11; + d[8] = &r15 - &r13; + d[9] = &r17 - &r15; + d[10] = &r19 - &r17; + d[11] = &r21 - &r19; + d[12] = &r23 - &r21; + d[13] = &r25 - &r23; + d[14] = &r27 - &r25; + d[15] = &r29 - &r27; + d[16] = &r31 - &r29; + d[17] = &r33 - &r31; + d[18] = &r35 - &r33; + d[19] = &r36 - &r35; + d[20] = &r37 - &r36; + d[21] = &r38 - &r37; + + +/* The following FSM analyzes the string of differences. It accepts +strings of the form a+b+a+ and returns 16 minus the number of bs, +which is the number of variables that actually got into registers. +Otherwise it signals rejection by returning -1., indicating that the +test is unreliable. */ + + n1 = d[0]; + s = 1; + + for (j=0; j<22; j++) + switch (s) { + case 1: if (d[j] != n1) { + n2 = d[j]; + s = 2; + nr = 1; + } + break; + case 2: if (d[j] == n1) { + s = 3; + break; + } + if (d[j] == n2) { + nr = nr+1; + break; + } + s = 4; + break; + case 3: if (d[j] != n1) s = 4; + break; + } + ; + + if (s == 3) return 16-nr; + else return -1; +} +regp() { /* pointer to register assignment */ +/* Testing a variable whose storage class has been spec- +ified as "register" is somewhat tricky, but it can be done in a +fairly reliable fashion by taking advantage of our knowledge of the +ways in which compilers operate. If we declare a collection of vari- +ables of the same storage class, we would expect that, when storage +for these variables is actually allocated, the variables will be +bunched together and ordered according to one of the following +criteria: + + (a) the order in which they were defined. + (b) the order in which they are used. + (c) alphabetically. + (d) the order in which they appear in the compiler's + symbol table. + (e) some other way. + + Hence, if we define a sequence of variables in close alpha- +betical order, and use them in the same order in which we define +them, we would expect the differences between the addresses of +successive variables to be constant, except in case (d) where the +symbol table is a hash table, or in case (e). If a subsequence in +the middle of this sequence is selected, and for this subsequence, +every other variable is specified to be "register", and address +differences are taken between adjacent nonregister variables, we would +still expect to find constant differences if the "register" vari- +ables were actually assigned to registers, and some other diff- +erences if they were not. Specifically, if we had N variables +specified as "register" of which the first n were actually ass- +igned to registers, we would expect the sequence of differences +to consist of a number of occurrences of some number, followed by +N-n occurrences of some other number, followed by several occurr- +ences of the first number. If we get a sequence like this, we can +determine, by simple subtraction, how many (if any) variables are +being assigned to registers. If we get some other sequence, we know +that the test is invalid. */ + + + int *r00; + int *r01; + int *r02; + int *r03; + register int *r04; + int *r05; + register int *r06; + int *r07; + register int *r08; + int *r09; + register int *r10; + int *r11; + register int *r12; + int *r13; + register int *r14; + int *r15; + register int *r16; + int *r17; + register int *r18; + int *r19; + register int *r20; + int *r21; + register int *r22; + int *r23; + register int *r24; + int *r25; + register int *r26; + int *r27; + register int *r28; + int *r29; + register int *r30; + int *r31; + register int *r32; + int *r33; + register int *r34; + int *r35; + int *r36; + int *r37; + int *r38; + + int s, n1, n2, nr, j, d[22]; + + r00 = (int *)&r00; + r01 = (int *)&r01; + r02 = (int *)&r02; + r03 = (int *)&r03; + r04 = (int *)&r05; + r05 = (int *)&r05; + r06 = (int *)&r07; + r07 = (int *)&r07; + r08 = (int *)&r09; + r09 = (int *)&r09; + r10 = (int *)&r11; + r11 = (int *)&r11; + r12 = (int *)&r13; + r13 = (int *)&r13; + r14 = (int *)&r15; + r15 = (int *)&r15; + r16 = (int *)&r17; + r17 = (int *)&r17; + r18 = (int *)&r19; + r19 = (int *)&r19; + r20 = (int *)&r21; + r21 = (int *)&r21; + r22 = (int *)&r23; + r23 = (int *)&r23; + r24 = (int *)&r25; + r25 = (int *)&r25; + r26 = (int *)&r27; + r27 = (int *)&r27; + r28 = (int *)&r29; + r29 = (int *)&r29; + r30 = (int *)&r31; + r31 = (int *)&r31; + r32 = (int *)&r33; + r33 = (int *)&r33; + r34 = (int *)&r35; + r35 = (int *)&r35; + r36 = (int *)&r36; + r37 = (int *)&r37; + r38 = (int *)&r38; + + d[0] = &r01 - &r00; + d[1] = &r02 - &r01; + d[2] = &r03 - &r02; + d[3] = &r05 - &r03; + d[4] = &r07 - &r05; + d[5] = &r09 - &r07; + d[6] = &r11 - &r09; + d[7] = &r13 - &r11; + d[8] = &r15 - &r13; + d[9] = &r17 - &r15; + d[10] = &r19 - &r17; + d[11] = &r21 - &r19; + d[12] = &r23 - &r21; + d[13] = &r25 - &r23; + d[14] = &r27 - &r25; + d[15] = &r29 - &r27; + d[16] = &r31 - &r29; + d[17] = &r33 - &r31; + d[18] = &r35 - &r33; + d[19] = &r36 - &r35; + d[20] = &r37 - &r36; + d[21] = &r38 - &r37; + + +/* The following FSM analyzes the string of differences. It accepts +strings of the form a+b+a+ and returns 16 minus the number of bs, +which is the number of variables that actually got into registers. +Otherwise it signals rejection by returning -1., indicating that the +test is unreliable. */ + + n1 = d[0]; + s = 1; + for (j=0; j<22; j++) + switch (s) { + case 1: if (d[j] != n1) { + n2 = d[j]; + s = 2; + nr = 1; + } + break; + case 2: if (d[j] == n1) { + s = 3; + break; + } + if (d[j] == n2) { + nr = nr+1; + break; + } + s = 4; + break; + case 3: if (d[j] != n1) s = 4; + break; + } + ; + + if (s == 3) return 16-nr; + else return -1; +} +s84(pd0) /* 8.4 Meaning of declarators */ +struct defs *pd0; +{ + int *ip, i, *fip(), (*pfi)(), j, k, array(), glork(int); + static int x3d[3][5][7]; + float fa[17], *afp[17], sum; + static char s84er[] = "s84,er%d\n"; + static char qs84[8] = "s84 "; + int rc; + char *ps, *pt; + ps = qs84; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + + /* The more common varieties of declarators have al- + ready been touched upon, some more than others. It + is useful to compare *fip() and (*pfi)(). + */ + + ip = fip(3); + if(*ip != 3){ + if(pd0->flgd != 0) printf(s84er,1); + rc = rc+1; + } + + pfi = glork; + if((*pfi)(4) != 4){ + if(pd0->flgd != 0) printf(s84er,2); + rc = rc+2; + } + + /* Float fa[17] declares an array of floating point + numbers, and *afp[17] declares an array of pointers + to floats. + */ + + for(j=0; j<17; j++){ + fa[j] = j; + afp[j] = &fa[j]; + } + + sum = 0.; + for(j=0; j<17; j++) sum += *afp[j]; + if(sum != 136){ + if(pd0->flgd != 0) printf(s84er,4); + rc = rc+4; + } + + /* static int x3d[3][5][7] declares a static three + dimensional array of integers, with rank 3x5x7. + In complete detail, x3d is an array of three items; + each item is an array of five arrays, and each of + the latter arrays is an array of seven integers. + Any of the expressions x3d, x3d[i], x3d[i][j], + and x3d[i][j][k] may reasonably appear in an express- + ion. The first three have type "array"; the last has + type int. + */ + + for (i=0; i<3; i++) + for (j=0; j<5; j++) + for (k=0; k<7; k++) + x3d[i][j][k] = i*35+j*7+k; + + i = 1; j = 2; k = 3; + + if( array(x3d,105,0) + +array(x3d[i],35,35) + +array(x3d[i][j],7,49) + + x3d[i][j][k]-52){ + + if(pd0->flgd != 0) printf(s84er,8); + rc = rc+8; + } + + return rc; +} +array(a,size,start) +int a[], size, start; +{ + int i; + for(i=0; irfs; + rc = 0; + while (*pt++ = *ps++); + + /* Within a structure, the objects declared have + addresses which increase as their declarations are + read left to right. + */ + + if( (char *)&s1.count - &s1.tword[0] <= 0 + ||(char *)&s1.left - (char *)&s1.count <= 0 + ||(char *)&s1.right - (char *)&s1.left <= 0){ + if(pd0->flgd != 0) printf(s85er,1); + rc = rc+1; + } + + /* Each non-field member of a structure begins on an + addressing boundary appropriate to its type. + */ + + diff[0] = &sc.c - &sc.cdummy; + diff[1] = (char *)&ss.s - &ss.cdummy; + diff[2] = (char *)&si.i - &si.cdummy; + diff[3] = (char *)&sl.l - &sl.cdummy; + diff[4] = (char *)&su.u - &su.cdummy; + diff[5] = (char *)&sf.f - &sf.cdummy; + diff[6] = (char *)&sd.d - &sd.cdummy; + + if(pd0->flgm != 0) + for(j=0; j<7; j++) + printf("%s%s%d\n",type[j],aln,diff[j]); + + /* Field specifications are highly implementation de- + pendent. About the only thing we can do here is to + check is that the compiler accepts the field constructs, + and that they seem to work, after a fashion, at + run time... + */ + + s3.threebit = 7; + s3.twobit = s3.threebit; + s3.threebit = s3.twobit; + + if(s3.threebit != 3){ + if(s3.threebit == -1){ + if(pd0->flgm != 0) printf("Sign extension in fields\n"); + } + else{ + if(pd0->flgd != 0) printf(s85er,2); + rc = rc+2; + } + } + + s3.onebit = 1; + if(s3.onebit != 1){ + if(pd0->flgm != 0) + printf("Be especially careful with 1-bit fields!\n"); + } + + /* A union may be thought of as a structure all of whose + members begin at offset 0 and whose size is sufficient + to contain any of its members. + */ + + if( (char *)u0.u1 - (char *)&u0 != 0 + ||(char *)u0.u2 - (char *)&u0 != 0 + ||(char *)u0.u3 - (char *)&u0 != 0 + ||(char *)u0.u4 - (char *)&u0 != 0 + ||(char *)u0.u5 - (char *)&u0 != 0 + ||(char *)u0.u6 - (char *)&u0 != 0 + ||(char *)u0.u7 - (char *)&u0 != 0){ + + if(pd0->flgd != 0) printf(s85er,4); + rc = rc+4; + } + + if( sizeof u0 < sizeof u0.u1 + ||sizeof u0 < sizeof u0.u2 + ||sizeof u0 < sizeof u0.u3 + ||sizeof u0 < sizeof u0.u4 + ||sizeof u0 < sizeof u0.u5 + ||sizeof u0 < sizeof u0.u6 + ||sizeof u0 < sizeof u0.u7){ + + if(pd0->flgd != 0) printf(s85er,8); + rc = rc+8; + } + + /* Finally, we check that the pointers work. */ + + s1.right = &s2; + s2.tword[0] = 2; + s1.right->tword[0] += 1; + if(s2.tword[0] != 3){ + if(pd0->flgd != 0) printf(s85er,16); + rc = rc+16; + } + return rc; +} +s86(pd0) /* 8.6 Initialization */ +struct defs *pd0; +{ + static char s86er[] = "s86,er%d\n"; + static char qs86[8] = "s86 "; + int lrc, rc; + char *ps, *pt; + int one(), i, j, k; + static int x[] = {1,3,5}; + static int *pint = x+2; + static int zero[10]; + int *apint = pint-1; + register int *rpint = apint+one(); + static float y0[] = {1,3,5,2,4,6,3,5,7,0,0,0}; + static float y1[4][3] = { + {1,3,5}, + {2,4,6}, + {3,5,7}, + }; + static float y2[4][3] = {1,3,5,2,4,6,3,5,7}; + static float y3[4][3] = { + {1},{2},{3},{4} + }; + ps = qs86; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + + /* The expression in an initializer for a static or + external variable must be a constant expression or + an expression that reduces to the address of a pre- + viously declared variable, possibly offset by a + constant expression. + */ + + if(*pint != 5){ + if(pd0->flgd != 0) printf(s86er,1); + rc = rc+1; + } + + /* Automatic and register variables may be initialized + by arbitrary expressions involving constants and previously + declared variables and functions. + */ + + if(*apint != 3){ + if(pd0->flgd != 0) printf(s86er,2); + rc = rc+2; + } + + if(*rpint != 5){ + if(pd0->flgd != 0) printf(s86er,4); + rc = rc+4; + } + + /* Static variables that are not initialized are guar- + anteed to start off as zero. + */ + + lrc = 0; + for(j=0; j<10; j++) + if(zero[j] != 0) lrc = 1; + if(lrc != 0){ + if(pd0->flgd != 0) printf(s86er,8); + rc = rc+8; + } + + /* y0, y1, and y2, as declared, should define and + initialize identical arrays. + */ + lrc = 0; + for(i=0; i<4; i++) + for(j=0; j<3; j++){ + k = 3*i+j; + if( y1[i][j] != y2[i][j] + ||y1[i][j] != y0[k]) lrc = 1; + } + + if(lrc != 0){ + if(pd0->flgd != 0) printf(s86er,16); + rc = rc+16; + } + + /* y3 initializes the first column of the array and + leaves the rest zero. + */ + + lrc = 0; + for(j=0; j<4; j++) if(y3[j][0] != j+1) lrc = 1; + + if(lrc != 0){ + if(pd0->flgd != 0) printf(s86er,32); + rc = rc+32; + } + return rc; +} +one(){ + return 1; +} +int *metricp; +s88(pd0) /* 8.8 Typedef */ +struct defs *pd0; +{ + static char s88er[] = "s88,er%d\n"; + static char qs88[8] = "s88 "; + int rc; + char *ps, *pt; + + /* Declarations whose "storage class" is typdef do not + define storage, but instead define identifiers which + can later be used as if they were type keywords naming + fundamental or derived types. + */ + + typedef int MILES, *KLICKSP; + typedef struct {double re, im;} complex; + + MILES distance; + extern KLICKSP metricp; + complex z, *zp; + + ps = qs88; + pt = pd0->rfs; + rc = 0; + while(*pt++ = *ps++); + + /* Hopefully, all of this stuff will compile. After that, + we can only make some superficial tests. + + The type of distance is int, + */ + + if(sizeof distance != sizeof(int)){ + if(pd0->flgd != 0) printf(s88er,1); + rc = rc+1; + } + + /* that of metricp is "pointer to int", */ + + metricp = &distance; + distance = 2; + *metricp = 3; + + if(distance != 3){ + if(pd0->flgd != 0) printf(s88er,2); + rc = rc+2; + } + + /* and that of z is the specified structure. zp is a + pointer to such a structure. + */ + + z.re = 0.; + z.im = 0.; + zp = &z; + zp->re = 1.; + zp->im = 1.; + if(z.re+z.im != 2.){ + if(pd0->flgd != 0) printf(s88er,4); + rc = rc+4; + } + + return rc; +} +s9(pd0) /* 9 Statements */ +struct defs *pd0; +{ + static char s9er[] = "s9,er%d\n"; + static char qs9[8] = "s9 "; + int rc; + char *ps, *pt; + int lrc, i; + + ps = qs9; + pt = pd0->rfs; + rc = 0; + while (*pt++ = *ps++); + + /* One would think that the section on statements would + provide the most variety in the entire sequence of tests. + As it turns out, most of the material in this section has + already been checked in the process of checking out + everything else, and the section at this point is somewhat + anticlimactic. For this reason, we restrict ourselves + to testing two features not already covered. + + Compound statements are delimited by braces. They have the + nice property that identifiers of the auto and register + variety are pushed and popped. It is currently legal to + transfer into a block, but we wont... + */ + + lrc = 0; + for(i=0; i<2; i++){ + int j; + register int k; + j = k = 2; + { + int j; + register int k; + j = k = 3; + if((j != 3) || (k != 3)) lrc = 1; + } + if((j != 2) || (k != 2)) lrc = 1; + } + + if(lrc != 0){ + if(pd0->flgd != 0) printf(s9er,1); + rc = rc+1; + } + + /* Goto statements go to labeled statements, we hope. */ + + goto nobarf; + if(pd0->flgd != 0) printf(s9er,2); + rc = rc+2; + nobarf:; + + return rc; +} +setev(){ /* Sets an external variable. Used */ + extern int extvar; /* by s4, and should be compiled */ + extvar = 1066; /* separately from s4. */ +} + int lbits; /* long */ + int ubits; /* unsigned */ + int fbits; /* float */ + int dbits; /* double */ + float fprec; /* Smallest number that can be */ + float dprec; /* significantly added to 1. */ + int flgs; /* Print return codes, by section */ + int flgm; /* Announce machine dependencies */ + int flgd; /* give explicit diagnostics */ + int flgl; /* Report local return codes. */ + int rrc; /* recent return code */ + int crc; /* Cumulative return code */ + char rfs[8]; /* Return from section */ diff --git a/src/cmd/lccom-1/tst/cvt.c b/src/cmd/lccom-1/tst/cvt.c new file mode 100644 index 0000000..c2fa515 --- /dev/null +++ b/src/cmd/lccom-1/tst/cvt.c @@ -0,0 +1,35 @@ +signed char c; +signed short s; +signed int i; +signed long int l; +unsigned char C; +unsigned short S; +unsigned int I; +unsigned long int L; +float f; +double d; +long double D; +void *p; +void (*P)(void); + +void print(void) { + printf("%d %d %d %ld %u %u %u %lu %f %f %lf\n",c,s,i,l,C,S,I,L,f,d,D); +} + +main() { + c= 1; s=c;i=c;l=c;C=c;S=c;I=c;L=c;f=c;d=c;D=c; print(); + s= 2; c=s; i=s;l=s;C=s;S=s;I=s;L=s;f=s;d=s;D=s; print(); + i= 3; c=i;s=i; l=i;C=i;S=i;I=i;L=i;f=i;d=i;D=i; print(); + l= 4; c=l;s=l;i=l; C=l;S=l;I=l;L=l;f=l;d=l;D=l; print(); + C= 5; c=C;s=C;i=C;l=C; S=C;I=C;L=C;f=C;d=C;D=C; print(); + S= 6; c=S;s=S;i=S;l=S;C=S; I=S;L=S;f=S;d=S;D=S; print(); + I= 7; c=I;s=I;i=I;l=I;C=I;S=I; L=I;f=I;d=I;D=I; print(); + L= 8; c=L;s=L;i=L;l=L;C=L;S=L;I=S; f=L;d=L;D=L; print(); + f= 9; c=f;s=f;i=f;l=f;C=f;S=f;I=f;L=f; d=f;D=f; print(); + d=10; c=d;s=d;i=d;l=d;C=d;S=d;I=d;L=d;f=d; D=d; print(); + D=11; c=D;s=D;i=D;l=D;C=D;S=D;I=D;L=D;f=D;d=D; print(); + + p=0; p=0L; p=0U; p=0UL; p=P; + P=0; P=0L; P=0U; P=0UL; P=p; + return 0; +} diff --git a/src/cmd/lccom-1/tst/fields.c b/src/cmd/lccom-1/tst/fields.c new file mode 100644 index 0000000..242a53b --- /dev/null +++ b/src/cmd/lccom-1/tst/fields.c @@ -0,0 +1,34 @@ +struct foo { + int a; + char b; + int x : 12, y : 4, : 0, : 4, z : 3; + char c; +} x = { 1, 2, 3, 4, 5, 6 }; +int i = 16; +struct baz { unsigned int a:2, b:4, c:32;} y = { 7, 8, 9}; + +main() +{ + printf("x = %d %d %d %d %d %d\n", x.a, x.b, x.x, x.y, x.z, x.c); + printf("y = %d %d %d\n", y.a, y.b, y.c); + x.y = i; + x.z = 070; + printf("x = %d %d %d %d %d %d\n", x.a, x.b, x.x, x.y, x.z, x.c); + y.a = 2; + y.c = i; + printf("y = %d %d %d\n", y.a, y.b, y.c); + f2(&x); + return 0; +} + +f1(struct baz *p) { + p->a = p->b = 0; + if (p->b) + printf("p->b != 0!\n"); + p->a = 0x3; p->b = 0xf; + printf("p->a = 0x%x, p->b = 0x%x\n", p->a, p->b); +} +f2(struct baz *p) { + p->a = (i==0); + p->b = (f1(p),0); +} diff --git a/src/cmd/lccom-1/tst/front.c b/src/cmd/lccom-1/tst/front.c new file mode 100644 index 0000000..13125cf --- /dev/null +++ b/src/cmd/lccom-1/tst/front.c @@ -0,0 +1,120 @@ +main() { + exit(0); +} + +nested(a,b) { + if ((a<4 && b == 'r') + || (a == 1 && (b == 'h' || b == 'i')) + || (a == 2 && (b == 'o' || b == 'y')) + ) a=b; +} + +/* type name scope */ + +void s(struct D *d) {} /* this struct D differs from the one below */ +typedef struct D D; +struct D {int x, y;} Dy={0}; +D Dz={1}; +Dfunc(){ + D a; a.y=1; + s(&Dy); /* error */ +} + +/* qualifiers */ + +const a; int b; +const int a, *x; int b, *y; +volatile unsigned z; + +f() { + x = y; + z = z + z; /* should be 2 references to z's r-value */ +} +f1() { + x = &a; + x = &b; + y = &a; /* error */ + y = &b; +} +f2(int **a, int **b) { + f(&x, &y); + **a = 0; + return **b; +} +g(const int *p) { + g(&a); + g(&b); + return *p; +} +h(int *p) { + f(&a); + f(&b); + return *p; +} +h1(const int x, int y) { + h1(a,b); + h1(b,a); + return x + y; +} +h2() { + char *b; const void *p; + p = b; + b = p; /* error */ +} + + +/* static naming */ + +extern int yy; set1() { { static yy=1; yy=2;} yy=4;} +static int yy; set2() { yy=5; {static yy=2; yy=3; }} +static void goo() {} +sss() { int goo; { static int goo();} goo=1;} +rrr(p) float *p; { extern int xr; + { static float xr; + { extern int *xr; } p=&xr; }} + +/* local extern */ + +static int ss1; +int ss3; +extern int ss5; +setstatic() { extern int ss1,ss2,ss3,ss4; ss1 = ss2; ss3 = ss4; ss5 = 0;} +static int ss2; +int ss4; +static int ss5; + +/* function prototypes */ + +int fx1(void); +int fx1(); + +int gx1(double x); +int gx1(x) double x; { gx1(&x); } /* error */ + +int hx1(); +int hx1(double x,...); /* error */ + +int ff1(double x, int *y); +int ff1(x,y) float x; int y[]; {x=y[0];} + +int gg1(int a); +int gg1(a,b){a=b;} + +int hh1(const int x); +hh1(a) {return a;} + +extern int strcmp(const char*, const char*); +extern void qsort(void*, int, int, int (*)(const void*, const void*)); +extern int cmp(char**a, char**b) { return strcmp(*a,*b); } +sort() { + int n; char *a[100]; + qsort(a, n, sizeof(char*), (int (*)(const void*, const void*))cmp); + qsort(a, n, sizeof(char*), cmp); /* error */ +} + +/* nasty calls */ + +onearg(){ + int a,b,c,d; + f( ( (a? (b = 1): (c = 2)), (d ? 3 : 4) ) ); /* 1 argument */ +} diff --git a/src/cmd/lccom-1/tst/incr.c b/src/cmd/lccom-1/tst/incr.c new file mode 100644 index 0000000..7af89c6 --- /dev/null +++ b/src/cmd/lccom-1/tst/incr.c @@ -0,0 +1,39 @@ +main() {} + +memchar() { + char x, *p; + + &x, &p; + x = *p++; + x = *++p; + x = *p--; + x = *--p; +} + +memint() { + int x, *p; + + &x, &p; + x = *p++; + x = *++p; + x = *p--; + x = *--p; +} + +regchar() { + register char x, *p; + + x = *p++; + x = *++p; + x = *p--; + x = *--p; +} + +regint() { + register int x, *p; + + x = *p++; + x = *++p; + x = *p--; + x = *--p; +} diff --git a/src/cmd/lccom-1/tst/init.c b/src/cmd/lccom-1/tst/init.c new file mode 100644 index 0000000..55cece3 --- /dev/null +++ b/src/cmd/lccom-1/tst/init.c @@ -0,0 +1,59 @@ + +typedef struct { int codes[3]; char name[6]; } Word; + +Word words[] = { + 1, 2, 3, "if", + { { 4, 5 }, { 'f', 'o', 'r' } }, + 6, 7, 8, {"else"}, + { { 9, 10, 11,}, 'w', 'h', 'i', 'l', 'e', }, + { 0 }, +}, *wordlist = words; + +int x[][5] = { 1, 2, 3, 4, 0, { 5, 6 }, { 7 } }; +int *y[] = { x[0], x[1], x[2], 0 }; + + +main() +{ + int i, j; + + for (i = 0; y[i]; i++) { + for (j = 0; y[i][j]; j++) + printf(" %d", y[i][j]); + printf("\n"); + } + f(); + g(wordlist); + return 0; +} + +f() { + static char *keywords[] = {"if", "for", "else", "while", 0, }; + char **p; + + for (p = keywords; *p; p++) + printf("%s\n", *p); +} + +g(p) +Word *p; +{ + int i; + + for ( ; p->codes[0]; p++) { + for (i = 0; i < sizeof p->codes/sizeof(p->codes[0]); i++) + printf("%d ", p->codes[i]); + printf("%s\n", p->name); + } + h(); +} + +h() +{ + int i; + + for (i = 0; i < sizeof(words)/sizeof(Word); i++) + printf("%d %d %d %s\n", words[i].codes[0], + words[i].codes[1], words[i].codes[2], + &words[i].name[0]); +} diff --git a/src/cmd/lccom-1/tst/limits.c b/src/cmd/lccom-1/tst/limits.c new file mode 100644 index 0000000..e2a13a6 --- /dev/null +++ b/src/cmd/lccom-1/tst/limits.c @@ -0,0 +1,19 @@ +#include + +main() { + printf("UCHAR_MAX: %08x=%d\n", UCHAR_MAX, UCHAR_MAX); + printf("USHRT_MAX: %08x=%d\n", USHRT_MAX, USHRT_MAX); + printf("UINT_MAX: %08x=%d\n", UINT_MAX, UINT_MAX); + printf("ULONG_MAX: %08lx=%ld\n", ULONG_MAX, ULONG_MAX); + printf("CHAR_MAX: %08x=%d\n", CHAR_MAX, CHAR_MAX); + printf("SCHAR_MAX: %08x=%d\n", SCHAR_MAX, SCHAR_MAX); + printf("SHRT_MAX: %08x=%d\n", SHRT_MAX, SHRT_MAX); + printf("INT_MAX: %08x=%d\n", INT_MAX, INT_MAX); + printf("LONG_MAX: %08lx=%ld\n", LONG_MAX, LONG_MAX); + printf("CHAR_MIN: %08x=%d\n", CHAR_MIN, CHAR_MIN); + printf("SCHAR_MIN: %08x=%d\n", SCHAR_MIN, SCHAR_MIN); + printf("SHRT_MIN: %08x=%d\n", SHRT_MIN, SHRT_MIN); + printf("INT_MIN: %08x=%d\n", INT_MIN, INT_MIN); + printf("LONG_MIN: %08lx=%ld\n", LONG_MIN, LONG_MIN); + return 0; +} diff --git a/src/cmd/lccom-1/tst/mips-eb/8q.1bk b/src/cmd/lccom-1/tst/mips-eb/8q.1bk new file mode 100644 index 0000000..7ed6437 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/8q.1bk @@ -0,0 +1,92 @@ +1 5 8 6 3 7 2 4 +1 6 8 3 7 4 2 5 +1 7 4 6 8 2 5 3 +1 7 5 8 2 4 6 3 +2 4 6 8 3 1 7 5 +2 5 7 1 3 8 6 4 +2 5 7 4 1 8 6 3 +2 6 1 7 4 8 3 5 +2 6 8 3 1 4 7 5 +2 7 3 6 8 5 1 4 +2 7 5 8 1 4 6 3 +2 8 6 1 3 5 7 4 +3 1 7 5 8 2 4 6 +3 5 2 8 1 7 4 6 +3 5 2 8 6 4 7 1 +3 5 7 1 4 2 8 6 +3 5 8 4 1 7 2 6 +3 6 2 5 8 1 7 4 +3 6 2 7 1 4 8 5 +3 6 2 7 5 1 8 4 +3 6 4 1 8 5 7 2 +3 6 4 2 8 5 7 1 +3 6 8 1 4 7 5 2 +3 6 8 1 5 7 2 4 +3 6 8 2 4 1 7 5 +3 7 2 8 5 1 4 6 +3 7 2 8 6 4 1 5 +3 8 4 7 1 6 2 5 +4 1 5 8 2 7 3 6 +4 1 5 8 6 3 7 2 +4 2 5 8 6 1 3 7 +4 2 7 3 6 8 1 5 +4 2 7 3 6 8 5 1 +4 2 7 5 1 8 6 3 +4 2 8 5 7 1 3 6 +4 2 8 6 1 3 5 7 +4 6 1 5 2 8 3 7 +4 6 8 2 7 1 3 5 +4 6 8 3 1 7 5 2 +4 7 1 8 5 2 6 3 +4 7 3 8 2 5 1 6 +4 7 5 2 6 1 3 8 +4 7 5 3 1 6 8 2 +4 8 1 3 6 2 7 5 +4 8 1 5 7 2 6 3 +4 8 5 3 1 7 2 6 +5 1 4 6 8 2 7 3 +5 1 8 4 2 7 3 6 +5 1 8 6 3 7 2 4 +5 2 4 6 8 3 1 7 +5 2 4 7 3 8 6 1 +5 2 6 1 7 4 8 3 +5 2 8 1 4 7 3 6 +5 3 1 6 8 2 4 7 +5 3 1 7 2 8 6 4 +5 3 8 4 7 1 6 2 +5 7 1 3 8 6 4 2 +5 7 1 4 2 8 6 3 +5 7 2 4 8 1 3 6 +5 7 2 6 3 1 4 8 +5 7 2 6 3 1 8 4 +5 7 4 1 3 8 6 2 +5 8 4 1 3 6 2 7 +5 8 4 1 7 2 6 3 +6 1 5 2 8 3 7 4 +6 2 7 1 3 5 8 4 +6 2 7 1 4 8 5 3 +6 3 1 7 5 8 2 4 +6 3 1 8 4 2 7 5 +6 3 1 8 5 2 4 7 +6 3 5 7 1 4 2 8 +6 3 5 8 1 4 2 7 +6 3 7 2 4 8 1 5 +6 3 7 2 8 5 1 4 +6 3 7 4 1 8 2 5 +6 4 1 5 8 2 7 3 +6 4 2 8 5 7 1 3 +6 4 7 1 3 5 2 8 +6 4 7 1 8 2 5 3 +6 8 2 4 1 7 5 3 +7 1 3 8 6 4 2 5 +7 2 4 1 8 5 3 6 +7 2 6 3 1 4 8 5 +7 3 1 6 8 5 2 4 +7 3 8 2 5 1 6 4 +7 4 2 5 8 1 3 6 +7 4 2 8 6 1 3 5 +7 5 3 1 6 8 2 4 +8 2 4 1 7 5 3 6 +8 2 5 3 1 7 4 6 +8 3 1 6 2 5 7 4 +8 4 1 3 6 2 7 5 diff --git a/src/cmd/lccom-1/tst/mips-eb/8q.2bk b/src/cmd/lccom-1/tst/mips-eb/8q.2bk new file mode 100644 index 0000000..d4dc0ed --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/8q.2bk @@ -0,0 +1,2 @@ +tst/8q.c:30: warning: missing return value +tst/8q.c:39: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/8q.sbk b/src/cmd/lccom-1/tst/mips-eb/8q.sbk new file mode 100644 index 0000000..9e5d75f --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/8q.sbk @@ -0,0 +1,169 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +move $30,$0 +L.2: +sll $24,$30,2 +la $15,1 +sw $15,down($24) +sw $15,up($24) +L.3: +la $30,1($30) +la $24,15 +blt $30,$24,L.2 +move $30,$0 +L.6: +sll $24,$30,2 +la $15,1 +sw $15,rows($24) +L.7: +la $30,1($30) +la $24,8 +blt $30,$24,L.6 +move $4,$0 +jal queens +move $2,$0 +L.1: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end main +.globl queens +.text +.align 2 +.ent queens +queens: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2800000,-4 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +move $30,$4 +move $23,$0 +L.11: +sll $15,$23,2 +lw $15,rows($15) +beq $15,$0,L.15 +subu $15,$23,$30 +sll $15,$15,2 +lw $15,up+28($15) +beq $15,$0,L.15 +addu $15,$23,$30 +sll $15,$15,2 +lw $15,down($15) +beq $15,$0,L.15 +addu $15,$23,$30 +sll $15,$15,2 +sw $0,down($15) +subu $15,$23,$30 +sll $15,$15,2 +sw $0,up+28($15) +sll $15,$23,2 +sw $0,rows($15) +sll $24,$30,2 +sw $23,x($24) +la $24,7 +bne $30,$24,L.19 +jal print +b L.20 +L.19: +la $4,1($30) +jal queens +L.20: +la $24,1 +addu $15,$23,$30 +sll $15,$15,2 +sw $24,down($15) +subu $15,$23,$30 +sll $15,$15,2 +sw $24,up+28($15) +sll $15,$23,2 +sw $24,rows($15) +L.15: +L.12: +la $23,1($23) +la $24,8 +blt $23,$24,L.11 +move $2,$0 +L.10: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end queens +.globl print +.text +.align 2 +.ent print +print: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +move $30,$0 +L.23: +la $4,L.27 +sll $24,$30,2 +lw $24,x($24) +la $5,49($24) +jal printf +L.24: +la $30,1($30) +la $24,8 +blt $30,$24,L.23 +la $4,L.28 +jal printf +move $2,$0 +L.22: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end print +.globl x +.comm x,32 +.globl rows +.comm rows,32 +.globl down +.comm down,60 +.globl up +.comm up,60 +.rdata +.align 0 +L.28: +.byte 10 +.byte 0 +.align 0 +L.27: +.byte 37 +.byte 99 +.byte 32 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/array.1bk b/src/cmd/lccom-1/tst/mips-eb/array.1bk new file mode 100644 index 0000000..4d3817c --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/array.1bk @@ -0,0 +1,4 @@ + 0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003 + 0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003 + 0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003 + 0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003 diff --git a/src/cmd/lccom-1/tst/mips-eb/array.2bk b/src/cmd/lccom-1/tst/mips-eb/array.2bk new file mode 100644 index 0000000..c8cf31e --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/array.2bk @@ -0,0 +1,2 @@ +tst/array.c:33: warning: missing return value +tst/array.c:48: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/array.sbk b/src/cmd/lccom-1/tst/mips-eb/array.sbk new file mode 100644 index 0000000..90eff4d --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/array.sbk @@ -0,0 +1,235 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,96,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-96 +.mask 0xc2c00000,-64 +sw $22,16($sp) +sw $23,20($sp) +.cprestore 24 +sw $30,28($sp) +sw $31,32($sp) +move $23,$0 +L.2: +move $30,$0 +L.6: +sll $24,$30,2 +sll $15,$23,4 +la $15,x($15) +addu $24,$24,$15 +la $15,1000 +mul $15,$15,$23 +addu $15,$15,$30 +sw $15,($24) +L.7: +la $30,1($30) +la $24,4 +blt $30,$24,L.6 +sll $24,$23,2 +sll $15,$23,4 +la $15,x($15) +sw $15,y($24) +L.3: +la $23,1($23) +la $24,3 +blt $23,$24,L.2 +jal f +move $23,$0 +L.10: +sll $24,$23,4 +la $15,-48+96($sp) +addu $24,$24,$15 +move $22,$24 +sll $15,$23,2 +sw $24,y($15) +move $30,$0 +L.14: +sll $24,$30,2 +addu $15,$24,$22 +sll $14,$23,4 +la $14,x($14) +addu $24,$24,$14 +lw $24,($24) +sw $24,($15) +L.15: +la $30,1($30) +la $24,4 +blt $30,$24,L.14 +L.11: +la $23,1($23) +la $24,3 +blt $23,$24,L.10 +la $4,-48+96($sp) +la $5,y +jal g +move $2,$0 +L.1: +lw $22,16($sp) +lw $23,20($sp) +lw $25,24($sp) +lw $30,28($sp) +lw $31,32($sp) +addu $sp,$sp,96 +j $31 +.end main +.globl f +.text +.align 2 +.ent f +f: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2800000,-4 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +move $23,$0 +L.19: +move $30,$0 +L.23: +la $4,L.27 +sll $24,$30,2 +sll $15,$23,4 +la $15,x($15) +addu $24,$24,$15 +lw $5,($24) +jal printf +L.24: +la $30,1($30) +la $24,4 +blt $30,$24,L.23 +L.20: +la $23,1($23) +la $24,3 +blt $23,$24,L.19 +la $4,L.28 +jal printf +move $23,$0 +L.29: +move $30,$0 +L.33: +la $4,L.27 +sll $24,$30,2 +sll $15,$23,2 +lw $15,y($15) +addu $24,$24,$15 +lw $5,($24) +jal printf +L.34: +la $30,1($30) +la $24,4 +blt $30,$24,L.33 +L.30: +la $23,1($23) +la $24,3 +blt $23,$24,L.29 +la $4,L.28 +jal printf +move $2,$0 +L.18: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end f +.globl g +.text +.align 2 +.ent g +g: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0xc2e00000,-12 +sw $21,16($sp) +sw $22,20($sp) +sw $23,24($sp) +.cprestore 28 +sw $30,32($sp) +sw $31,36($sp) +move $30,$4 +move $23,$5 +move $21,$0 +L.38: +move $22,$0 +L.42: +la $4,L.27 +sll $24,$22,2 +sll $15,$21,4 +addu $15,$15,$30 +addu $24,$24,$15 +lw $5,($24) +jal printf +L.43: +la $22,1($22) +la $24,4 +blt $22,$24,L.42 +L.39: +la $21,1($21) +la $24,3 +blt $21,$24,L.38 +la $4,L.28 +jal printf +move $21,$0 +L.46: +move $22,$0 +L.50: +la $4,L.27 +sll $24,$22,2 +sll $15,$21,2 +addu $15,$15,$23 +lw $15,($15) +addu $24,$24,$15 +lw $5,($24) +jal printf +L.51: +la $22,1($22) +la $24,4 +blt $22,$24,L.50 +L.47: +la $21,1($21) +la $24,3 +blt $21,$24,L.46 +la $4,L.28 +jal printf +move $2,$0 +L.37: +lw $21,16($sp) +lw $22,20($sp) +lw $23,24($sp) +lw $25,28($sp) +lw $30,32($sp) +lw $31,36($sp) +addu $sp,$sp,48 +j $31 +.end g +.globl y +.comm y,12 +.globl x +.comm x,48 +.rdata +.align 0 +L.28: +.byte 10 +.byte 0 +.align 0 +L.27: +.byte 32 +.byte 37 +.byte 100 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/assert.h b/src/cmd/lccom-1/tst/mips-eb/assert.h new file mode 100644 index 0000000..04b0e3a --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/assert.h @@ -0,0 +1,14 @@ +#ifndef __ASSERT +#define __ASSERT + +void assert(int); + +#endif /* __ASSERT */ + +#undef assert +#ifdef NDEBUG +#define assert(ignore) ((void)0) +#else +extern int _assert(char *, char *, unsigned); +#define assert(e) ((void)((e)||_assert(#e, __FILE__, __LINE__))) +#endif /* NDEBUG */ diff --git a/src/cmd/lccom-1/tst/mips-eb/cf.1bk b/src/cmd/lccom-1/tst/mips-eb/cf.1bk new file mode 100644 index 0000000..9e331c5 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/cf.1bk @@ -0,0 +1,51 @@ +char freq +011 8.1 +012 6.1 +040 11.9 +! 0.2 +" 1.5 +% 0.6 +& 0.4 +' 0.4 +( 2.9 +) 2.9 +* 0.8 ++ 1.3 +, 1.3 +- 0.4 +. 0.6 +/ 1.0 +0 2.5 +1 1.9 +2 0.6 +3 0.2 +7 0.4 +8 0.2 +; 3.8 +< 0.8 += 2.7 +> 0.2 +[ 1.5 +\ 0.8 +] 1.5 +a 3.1 +c 4.4 +e 2.3 +f 6.0 +g 1.3 +h 1.0 +i 5.0 +l 1.0 +m 0.2 +n 3.3 +o 2.1 +p 1.0 +q 0.4 +r 4.2 +s 0.6 +t 3.8 +u 1.2 +v 0.6 +w 0.2 +{ 0.6 +} 0.6 diff --git a/src/cmd/lccom-1/tst/mips-eb/cf.2bk b/src/cmd/lccom-1/tst/mips-eb/cf.2bk new file mode 100644 index 0000000..e69de29 diff --git a/src/cmd/lccom-1/tst/mips-eb/cf.sbk b/src/cmd/lccom-1/tst/mips-eb/cf.sbk new file mode 100644 index 0000000..75f582c --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/cf.sbk @@ -0,0 +1,153 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.fmask 0xc0000000,-32 +.mask 0xc2c00000,-8 +s.d $f30,16($sp) +sw $22,24($sp) +sw $23,28($sp) +.cprestore 32 +sw $30,36($sp) +sw $31,40($sp) +sw $4,48($sp) +sw $5,52($sp) +lw $24,0+48($sp) +la $15,1 +bgt $24,$15,L.2 +l.s $f30,L.4 +b L.3 +L.2: +lw $24,4+48($sp) +lw $4,4($24) +jal atof +l.s $f16,L.5 +div.s $f30,$f0,$f16 +L.3: +move $30,$0 +L.6: +move $24,$30 +la $30,1($24) +sll $24,$24,2 +l.s $f18,L.4 +s.s $f18,f($24) +L.7: +la $24,127 +ble $30,$24,L.6 +move $23,$0 +b L.11 +L.10: +sll $24,$22,2 +la $24,f($24) +l.s $f18,($24) +l.s $f16,L.13 +add.s $f18,$f18,$f16 +s.s $f18,($24) +la $23,1($23) +L.11: +jal getchar +move $22,$2 +la $15,-1 +bne $2,$15,L.10 +la $4,L.14 +jal printf +move $30,$0 +L.15: +sll $24,$30,2 +l.s $f18,f($24) +l.s $f16,L.4 +c.eq.s $f18,$f16; bc1t L.19 +mtc1 $23,$f16; cvt.s.w $f16,$f16 +div.s $f18,$f18,$f16 +c.ult.s $f18,$f30; bc1t L.19 +la $24,32 +bgt $30,$24,L.21 +la $4,L.23 +move $5,$30 +jal printf +b L.22 +L.21: +la $4,L.24 +move $5,$30 +jal printf +L.22: +la $4,L.25 +l.s $f18,L.5 +sll $24,$30,2 +l.s $f16,f($24) +mul.s $f18,$f18,$f16 +mtc1 $23,$f16; cvt.s.w $f16,$f16 +div.s $f18,$f18,$f16 +cvt.d.s $f18,$f18 +mfc1.d $6,$f18 +jal printf +L.19: +L.16: +la $30,1($30) +la $24,127 +ble $30,$24,L.15 +move $2,$0 +L.1: +l.d $f30,16($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $25,32($sp) +lw $30,36($sp) +lw $31,40($sp) +addu $sp,$sp,48 +j $31 +.end main +.globl f +.comm f,512 +.rdata +.align 0 +L.25: +.byte 9 +.byte 37 +.byte 46 +.byte 49 +.byte 102 +.byte 10 +.byte 0 +.align 0 +L.24: +.byte 37 +.byte 99 +.byte 0 +.align 0 +L.23: +.byte 37 +.byte 48 +.byte 51 +.byte 111 +.byte 0 +.align 0 +L.14: +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 9 +.byte 102 +.byte 114 +.byte 101 +.byte 113 +.byte 10 +.byte 0 +.align 2 +L.13: +.word 0x3f800000 +.align 2 +L.5: +.word 0x42c80000 +.align 2 +L.4: +.word 0x0 diff --git a/src/cmd/lccom-1/tst/mips-eb/cq.1bk b/src/cmd/lccom-1/tst/mips-eb/cq.1bk new file mode 100644 index 0000000..ec956b7 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/cq.1bk @@ -0,0 +1,48 @@ +Section s22 returned 0. +Decimal and octal/hex constants sometimes give + different results when assigned to longs. +Decimal and octal/hex constants sometimes give + different results when assigned to longs. +Section s241 returned 0. +Section s243 returned 0. +Section s244 returned 0. +Section s25 returned 0. + 8 bits in chars. + 32 bits in ints. + 16 bits in shorts. + 32 bits in longs. + 32 bits in unsigneds. + 32 bits in floats. + 64 bits in doubles. +1.192093e-07 is the least number that can be added to 1. (float). +2.220446e-16 is the least number that can be added to 1. (double). +Section s26 returned 0. +Section s4 returned 0. +Section s61 returned 0. +Section s626 returned 0. +Section s71 returned 0. +Section s72 returned 0. +Section s757 returned 0. +Section s7813 returned 0. +Section s714 returned 0. +Section s715 returned 0. +Register count for char is unreliable. +Register count for pointer is unreliable. +Register count for int is unreliable. +Section s81 returned 0. +Section s84 returned 0. +char alignment: 1 +short alignment: 2 +int alignment: 4 +long alignment: 4 +unsigned alignment: 4 +float alignment: 4 +double alignment: 8 +Sign extension in fields +Be especially careful with 1-bit fields! +Section s85 returned 0. +Section s86 returned 0. +Section s88 returned 0. +Section s9 returned 0. + +No errors detected. diff --git a/src/cmd/lccom-1/tst/mips-eb/cq.2bk b/src/cmd/lccom-1/tst/mips-eb/cq.2bk new file mode 100644 index 0000000..7c6ba5e --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/cq.2bk @@ -0,0 +1,25 @@ +tst/cq.c:394: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:394: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:394: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:395: warning: overflow in constant `4294967296' +tst/cq.c:395: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:395: warning: overflow in constant `040000000000' +tst/cq.c:395: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:395: warning: overflow in constant `0x100000000' +tst/cq.c:395: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:396: warning: overflow in constant `68719476735' +tst/cq.c:396: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:396: warning: overflow in constant `0777777777777' +tst/cq.c:396: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:396: warning: overflow in constant `0xfffffffff' +tst/cq.c:396: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:397: warning: overflow in constant `68719476736' +tst/cq.c:397: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:397: warning: overflow in constant `01000000000000' +tst/cq.c:397: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:397: warning: overflow in constant `0x1000000000' +tst/cq.c:397: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:533: warning: missing return value +tst/cq.c:1169: warning: missing return value +tst/cq.c:5294: warning: unreachable code +tst/cq.c:5303: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/cq.sbk b/src/cmd/lccom-1/tst/mips-eb/cq.sbk new file mode 100644 index 0000000..b53bda0 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/cq.sbk @@ -0,0 +1,13620 @@ +.set reorder +.data +.align 2 +L.2: +.word s22 +.word s241 +.word s243 +.word s244 +.word s25 +.word s26 +.word s4 +.word s61 +.word s626 +.word s71 +.word s72 +.word s757 +.word s7813 +.word s714 +.word s715 +.word s81 +.word s84 +.word s85 +.word s86 +.word s88 +.word s9 +.lcomm L.3,68 +.lcomm L.4,4 +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +sw $4,32($sp) +sw $5,36($sp) +la $24,1 +sw $24,L.3+36 +la $24,1 +sw $24,L.3+40 +la $24,1 +sw $24,L.3+44 +la $24,1 +sw $24,L.3+48 +la $24,L.3 +sw $24,L.4 +move $30,$0 +b L.12 +L.9: +lw $4,L.4 +sll $24,$30,2 +lw $25,L.2($24) +jal $25 +sw $2,L.3+52 +lw $24,L.3+56 +lw $15,L.3+52 +addu $24,$24,$15 +sw $24,L.3+56 +lw $24,L.3+36 +beq $24,$0,L.17 +la $4,L.20 +la $5,L.3+60 +lw $6,L.3+52 +jal printf +L.17: +L.10: +la $30,1($30) +L.12: +move $24,$30 +la $15,21 +bltu $24,$15,L.9 +lw $24,L.3+56 +bne $24,$0,L.23 +la $4,L.26 +jal printf +b L.24 +L.23: +la $4,L.27 +jal printf +L.24: +move $2,$0 +L.1: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end main +.data +.align 0 +L.29: +.byte 115 +.byte 50 +.byte 50 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.30: +.byte 115 +.byte 50 +.byte 50 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s22 +.text +.text +.align 2 +.ent s22 +s22: +.frame $sp,64,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-64 +.mask 0xc2e00000,-28 +sw $21,16($sp) +sw $22,20($sp) +sw $23,24($sp) +.cprestore 28 +sw $30,32($sp) +sw $31,36($sp) +sw $4,64($sp) +move $22,$0 +la $30,L.30 +lw $24,0+64($sp) +la $23,60($24) +L.31: +L.32: +move $24,$23 +la $23,1($24) +move $15,$30 +la $30,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.31 +la $21,1 +la $24,2 +sw $24,-8+64($sp) +la $24,3 +sw $24,-12+64($sp) +la $24,4 +sw $24,-4+64($sp) +lw $24,-8+64($sp) +addu $24,$21,$24 +lw $15,-12+64($sp) +addu $24,$24,$15 +lw $15,-4+64($sp) +addu $24,$24,$15 +la $15,10 +beq $24,$15,L.34 +la $22,1($22) +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.36 +la $4,L.29 +la $5,1 +jal printf +L.36: +L.34: +la $24,2 +sw $24,-16+64($sp) +lw $24,-16+64($sp) +bne $24,$21,L.38 +la $22,4($22) +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.40 +la $4,L.29 +la $5,4 +jal printf +L.40: +L.38: +move $2,$22 +L.28: +lw $21,16($sp) +lw $22,20($sp) +lw $23,24($sp) +lw $25,28($sp) +lw $30,32($sp) +lw $31,36($sp) +addu $sp,$sp,64 +j $31 +.end s22 +.data +.align 0 +L.43: +.byte 115 +.byte 50 +.byte 52 +.byte 49 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.44: +.byte 115 +.byte 50 +.byte 52 +.byte 49 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.data +.align 2 +L.45: +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x0 +.word 0x6 +.word 0x0 +.word 0x8 +.word 0x0 +.word 0xc +.word 0x0 +.word 0x10 +.word 0x0 +.word 0x12 +.word 0x0 +.word 0x14 +.word 0x0 +.word 0x18 +.word 0x0 +.word 0x1c +.word 0x0 +.word 0x1e +.word 0x0 +.word 0x20 +.word 0x0 +.word 0x24 +.globl s241 +.text +.text +.align 2 +.ent s241 +s241: +.frame $sp,528,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-528 +.mask 0xc2f00000,-488 +sw $20,16($sp) +sw $21,20($sp) +sw $22,24($sp) +sw $23,28($sp) +.cprestore 32 +sw $30,36($sp) +sw $31,40($sp) +move $30,$4 +move $20,$0 +sw $0,-472+528($sp) +la $22,L.44 +la $21,60($30) +L.46: +L.47: +move $24,$21 +la $21,1($24) +move $15,$22 +la $22,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.46 +b L.49 +la $20,1($20) +lw $24,44($30) +beq $24,$0,L.51 +la $4,L.43 +la $5,1 +jal printf +L.51: +L.49: +b L.53 +la $20,2($20) +lw $24,44($30) +beq $24,$0,L.55 +la $4,L.43 +la $5,2 +jal printf +L.55: +L.53: +b L.57 +la $20,4($20) +lw $24,44($30) +beq $24,$0,L.59 +la $4,L.43 +la $5,4 +jal printf +L.59: +L.57: +b L.61 +la $20,8($20) +lw $24,44($30) +beq $24,$0,L.63 +la $4,L.43 +la $5,8 +jal printf +L.63: +L.61: +move $23,$0 +L.65: +sll $24,$23,2 +sw $23,L.45($24) +L.66: +la $23,1($23) +la $24,17 +blt $23,$24,L.65 +la $23,18 +L.69: +sll $24,$23,2 +la $24,L.45($24) +sw $24,-476+528($sp) +lw $4,($24) +jal pow2 +lw $15,-476+528($sp) +sw $2,($15) +sll $24,$23,2 +lw $15,L.45($24) +subu $15,$15,1 +sw $15,L.45-4($24) +la $23,2($23) +L.70: +la $24,39 +blt $23,$24,L.69 +sw $0,-156+528($sp) +sw $0,-312+528($sp) +sw $0,-468+528($sp) +la $24,1 +sw $24,-152+528($sp) +la $24,1 +sw $24,-308+528($sp) +la $24,1 +sw $24,-464+528($sp) +la $24,2 +sw $24,-148+528($sp) +la $24,2 +sw $24,-304+528($sp) +la $24,2 +sw $24,-460+528($sp) +la $24,3 +sw $24,-144+528($sp) +la $24,3 +sw $24,-300+528($sp) +la $24,3 +sw $24,-456+528($sp) +la $24,4 +sw $24,-140+528($sp) +la $24,4 +sw $24,-296+528($sp) +la $24,4 +sw $24,-452+528($sp) +la $24,5 +sw $24,-136+528($sp) +la $24,5 +sw $24,-292+528($sp) +la $24,5 +sw $24,-448+528($sp) +la $24,6 +sw $24,-132+528($sp) +la $24,6 +sw $24,-288+528($sp) +la $24,6 +sw $24,-444+528($sp) +la $24,7 +sw $24,-128+528($sp) +la $24,7 +sw $24,-284+528($sp) +la $24,7 +sw $24,-440+528($sp) +la $24,8 +sw $24,-124+528($sp) +la $24,8 +sw $24,-280+528($sp) +la $24,8 +sw $24,-436+528($sp) +la $24,9 +sw $24,-120+528($sp) +la $24,9 +sw $24,-276+528($sp) +la $24,9 +sw $24,-432+528($sp) +la $24,10 +sw $24,-116+528($sp) +la $24,10 +sw $24,-272+528($sp) +la $24,10 +sw $24,-428+528($sp) +la $24,11 +sw $24,-112+528($sp) +la $24,11 +sw $24,-268+528($sp) +la $24,11 +sw $24,-424+528($sp) +la $24,12 +sw $24,-108+528($sp) +la $24,12 +sw $24,-264+528($sp) +la $24,12 +sw $24,-420+528($sp) +la $24,13 +sw $24,-104+528($sp) +la $24,13 +sw $24,-260+528($sp) +la $24,13 +sw $24,-416+528($sp) +la $24,14 +sw $24,-100+528($sp) +la $24,14 +sw $24,-256+528($sp) +la $24,14 +sw $24,-412+528($sp) +la $24,15 +sw $24,-96+528($sp) +la $24,15 +sw $24,-252+528($sp) +la $24,15 +sw $24,-408+528($sp) +la $24,16 +sw $24,-92+528($sp) +la $24,16 +sw $24,-248+528($sp) +la $24,16 +sw $24,-404+528($sp) +la $24,63 +sw $24,-88+528($sp) +la $24,63 +sw $24,-244+528($sp) +la $24,63 +sw $24,-400+528($sp) +la $24,64 +sw $24,-84+528($sp) +la $24,64 +sw $24,-240+528($sp) +la $24,64 +sw $24,-396+528($sp) +la $24,255 +sw $24,-80+528($sp) +la $24,255 +sw $24,-236+528($sp) +la $24,255 +sw $24,-392+528($sp) +la $24,256 +sw $24,-76+528($sp) +la $24,256 +sw $24,-232+528($sp) +la $24,256 +sw $24,-388+528($sp) +la $24,4095 +sw $24,-72+528($sp) +la $24,4095 +sw $24,-228+528($sp) +la $24,4095 +sw $24,-384+528($sp) +la $24,4096 +sw $24,-68+528($sp) +la $24,4096 +sw $24,-224+528($sp) +la $24,4096 +sw $24,-380+528($sp) +la $24,65535 +sw $24,-64+528($sp) +la $24,65535 +sw $24,-220+528($sp) +la $24,65535 +sw $24,-376+528($sp) +la $24,65536 +sw $24,-60+528($sp) +la $24,65536 +sw $24,-216+528($sp) +la $24,65536 +sw $24,-372+528($sp) +la $24,262143 +sw $24,-56+528($sp) +la $24,262143 +sw $24,-212+528($sp) +la $24,262143 +sw $24,-368+528($sp) +la $24,262144 +sw $24,-52+528($sp) +la $24,262144 +sw $24,-208+528($sp) +la $24,262144 +sw $24,-364+528($sp) +la $24,1048575 +sw $24,-48+528($sp) +la $24,1048575 +sw $24,-204+528($sp) +la $24,1048575 +sw $24,-360+528($sp) +la $24,1048576 +sw $24,-44+528($sp) +la $24,1048576 +sw $24,-200+528($sp) +la $24,1048576 +sw $24,-356+528($sp) +la $24,16777215 +sw $24,-40+528($sp) +la $24,16777215 +sw $24,-196+528($sp) +la $24,16777215 +sw $24,-352+528($sp) +la $24,16777216 +sw $24,-36+528($sp) +la $24,16777216 +sw $24,-192+528($sp) +la $24,16777216 +sw $24,-348+528($sp) +la $24,268435455 +sw $24,-32+528($sp) +la $24,268435455 +sw $24,-188+528($sp) +la $24,268435455 +sw $24,-344+528($sp) +la $24,268435456 +sw $24,-28+528($sp) +la $24,268435456 +sw $24,-184+528($sp) +la $24,268435456 +sw $24,-340+528($sp) +la $24,1073741823 +sw $24,-24+528($sp) +la $24,1073741823 +sw $24,-180+528($sp) +la $24,1073741823 +sw $24,-336+528($sp) +la $24,1073741824 +sw $24,-20+528($sp) +la $24,1073741824 +sw $24,-176+528($sp) +la $24,1073741824 +sw $24,-332+528($sp) +la $24,0xffffffff +sw $24,-16+528($sp) +la $24,0xffffffff +sw $24,-172+528($sp) +la $24,0xffffffff +sw $24,-328+528($sp) +la $24,0xffffffff +sw $24,-12+528($sp) +la $24,0xffffffff +sw $24,-168+528($sp) +la $24,0xffffffff +sw $24,-324+528($sp) +la $24,0xffffffff +sw $24,-8+528($sp) +la $24,0xffffffff +sw $24,-164+528($sp) +la $24,0xffffffff +sw $24,-320+528($sp) +la $24,0xffffffff +sw $24,-4+528($sp) +la $24,0xffffffff +sw $24,-160+528($sp) +la $24,0xffffffff +sw $24,-316+528($sp) +move $23,$0 +L.188: +sll $24,$23,2 +la $15,-156+528($sp) +addu $15,$24,$15 +lw $15,($15) +lw $14,L.45($24) +bne $14,$15,L.195 +la $14,-312+528($sp) +addu $14,$24,$14 +lw $14,($14) +bne $15,$14,L.195 +la $15,-468+528($sp) +addu $24,$24,$15 +lw $24,($24) +beq $14,$24,L.192 +L.195: +lw $24,40($30) +beq $24,$0,L.196 +la $4,L.198 +jal printf +la $4,L.199 +jal printf +L.196: +L.192: +L.189: +la $23,1($23) +la $24,39 +blt $23,$24,L.188 +lw $24,-472+528($sp) +beq $24,$0,L.200 +la $20,16 +L.200: +move $2,$20 +L.42: +lw $20,16($sp) +lw $21,20($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $25,32($sp) +lw $30,36($sp) +lw $31,40($sp) +addu $sp,$sp,528 +j $31 +.end s241 +.globl pow2 +.text +.align 2 +.ent pow2 +pow2: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +.mask 0x40000000,-16 +sw $30,0($sp) +la $30,1 +b L.204 +L.203: +sll $30,$30,1 +L.204: +move $24,$4 +subu $4,$24,1 +bne $24,$0,L.203 +move $2,$30 +L.202: +lw $30,0($sp) +addu $sp,$sp,16 +j $31 +.end pow2 +.data +.align 0 +L.207: +.byte 115 +.byte 50 +.byte 52 +.byte 51 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.208: +.byte 115 +.byte 50 +.byte 52 +.byte 51 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s243 +.text +.text +.align 2 +.ent s243 +s243: +.frame $sp,304,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-304 +.mask 0xc2c00000,-272 +sw $22,16($sp) +sw $23,20($sp) +.cprestore 24 +sw $30,28($sp) +sw $31,32($sp) +sw $4,304($sp) +move $22,$0 +la $30,L.208 +lw $24,0+304($sp) +la $23,60($24) +L.209: +L.210: +move $24,$23 +la $23,1($24) +move $15,$30 +la $30,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.209 +la $4,-256+304($sp) +jal zerofill +la $24,1 +sb $24,-159+304($sp) +la $24,1 +sb $24,-191+304($sp) +la $24,1 +sb $24,-130+304($sp) +la $24,1 +sb $24,-208+304($sp) +la $24,1 +sb $24,-158+304($sp) +la $24,1 +sb $24,-190+304($sp) +la $24,1 +sb $24,-223+304($sp) +la $24,1 +sb $24,-207+304($sp) +la $24,1 +sb $24,-157+304($sp) +la $24,1 +sb $24,-189+304($sp) +la $24,1 +sb $24,-222+304($sp) +la $24,1 +sb $24,-206+304($sp) +la $24,1 +sb $24,-156+304($sp) +la $24,1 +sb $24,-188+304($sp) +la $24,1 +sb $24,-221+304($sp) +la $24,1 +sb $24,-205+304($sp) +la $24,1 +sb $24,-155+304($sp) +la $24,1 +sb $24,-187+304($sp) +la $24,1 +sb $24,-219+304($sp) +la $24,1 +sb $24,-204+304($sp) +la $24,1 +sb $24,-154+304($sp) +la $24,1 +sb $24,-186+304($sp) +la $24,1 +sb $24,-218+304($sp) +la $24,1 +sb $24,-203+304($sp) +la $24,1 +sb $24,-153+304($sp) +la $24,1 +sb $24,-185+304($sp) +la $24,1 +sb $24,-216+304($sp) +la $24,1 +sb $24,-202+304($sp) +la $24,1 +sb $24,-152+304($sp) +la $24,1 +sb $24,-184+304($sp) +la $24,1 +sb $24,-215+304($sp) +la $24,1 +sb $24,-201+304($sp) +la $24,1 +sb $24,-151+304($sp) +la $24,1 +sb $24,-183+304($sp) +la $24,1 +sb $24,-161+304($sp) +la $24,1 +sb $24,-200+304($sp) +la $24,1 +sb $24,-150+304($sp) +la $24,1 +sb $24,-182+304($sp) +la $24,1 +sb $24,-195+304($sp) +la $24,1 +sb $24,-199+304($sp) +la $24,1 +sb $24,-149+304($sp) +la $24,1 +sb $24,-181+304($sp) +la $24,1 +sb $24,-211+304($sp) +la $24,1 +sb $24,-148+304($sp) +la $24,1 +sb $24,-180+304($sp) +la $24,1 +sb $24,-162+304($sp) +la $24,1 +sb $24,-147+304($sp) +la $24,1 +sb $24,-179+304($sp) +la $24,1 +sb $24,-132+304($sp) +la $24,1 +sb $24,-246+304($sp) +la $24,1 +sb $24,-146+304($sp) +la $24,1 +sb $24,-178+304($sp) +la $24,1 +sb $24,-247+304($sp) +la $24,1 +sb $24,-145+304($sp) +la $24,1 +sb $24,-177+304($sp) +la $24,1 +sb $24,-133+304($sp) +la $24,1 +sb $24,-248+304($sp) +la $24,1 +sb $24,-144+304($sp) +la $24,1 +sb $24,-176+304($sp) +la $24,1 +sb $24,-131+304($sp) +la $24,1 +sb $24,-243+304($sp) +la $24,1 +sb $24,-143+304($sp) +la $24,1 +sb $24,-175+304($sp) +la $24,1 +sb $24,-165+304($sp) +la $24,1 +sb $24,-244+304($sp) +la $24,1 +sb $24,-142+304($sp) +la $24,1 +sb $24,-174+304($sp) +la $24,1 +sb $24,-163+304($sp) +la $24,1 +sb $24,-141+304($sp) +la $24,1 +sb $24,-173+304($sp) +la $24,1 +sb $24,-213+304($sp) +la $24,1 +sb $24,-164+304($sp) +la $24,1 +sb $24,-140+304($sp) +la $24,1 +sb $24,-172+304($sp) +la $24,1 +sb $24,-197+304($sp) +la $24,1 +sb $24,-217+304($sp) +la $24,1 +sb $24,-139+304($sp) +la $24,1 +sb $24,-171+304($sp) +la $24,1 +sb $24,-214+304($sp) +la $24,1 +sb $24,-138+304($sp) +la $24,1 +sb $24,-170+304($sp) +la $24,1 +sb $24,-198+304($sp) +la $24,1 +sb $24,-256+304($sp) +sb $24,-137+304($sp) +la $24,1 +sb $24,-169+304($sp) +la $24,1 +sb $24,-196+304($sp) +la $24,1 +sb $24,-224+304($sp) +la $24,1 +sb $24,-136+304($sp) +la $24,1 +sb $24,-168+304($sp) +la $24,1 +sb $24,-194+304($sp) +la $24,1 +sb $24,-135+304($sp) +la $24,1 +sb $24,-167+304($sp) +la $24,1 +sb $24,-212+304($sp) +la $24,1 +sb $24,-134+304($sp) +la $24,1 +sb $24,-166+304($sp) +la $24,1 +sb $24,-210+304($sp) +la $24,1 +sb $24,-193+304($sp) +la $24,1 +sb $24,-209+304($sp) +la $4,-256+304($sp) +jal sumof +la $15,98 +beq $2,$15,L.309 +la $22,1($22) +lw $24,0+304($sp) +lw $24,44($24) +beq $24,$0,L.311 +la $4,L.207 +la $5,1 +jal printf +L.311: +L.309: +b L.313 +la $22,8($22) +lw $24,0+304($sp) +lw $24,44($24) +beq $24,$0,L.315 +la $4,L.207 +la $5,8 +jal printf +L.315: +L.313: +move $2,$22 +L.206: +lw $22,16($sp) +lw $23,20($sp) +lw $25,24($sp) +lw $30,28($sp) +lw $31,32($sp) +addu $sp,$sp,304 +j $31 +.end s243 +.globl zerofill +.text +.align 2 +.ent zerofill +zerofill: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +.mask 0x40000000,-16 +sw $30,0($sp) +move $30,$0 +L.318: +move $24,$4 +la $4,1($24) +sb $0,($24) +L.319: +la $30,1($30) +la $24,256 +blt $30,$24,L.318 +move $2,$0 +L.317: +lw $30,0($sp) +addu $sp,$sp,16 +j $31 +.end zerofill +.globl sumof +.text +.align 2 +.ent sumof +sumof: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +.mask 0x40c00000,-8 +sw $22,0($sp) +sw $23,4($sp) +sw $30,8($sp) +move $22,$4 +move $30,$0 +move $23,$0 +L.323: +move $24,$22 +la $22,1($24) +lb $24,($24) +addu $30,$30,$24 +L.324: +la $23,1($23) +la $24,256 +blt $23,$24,L.323 +move $2,$30 +L.322: +lw $22,0($sp) +lw $23,4($sp) +lw $30,8($sp) +addu $sp,$sp,16 +j $31 +.end sumof +.data +.align 0 +L.328: +.byte 115 +.byte 50 +.byte 52 +.byte 52 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.329: +.byte 115 +.byte 50 +.byte 52 +.byte 52 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s244 +.text +.text +.align 2 +.ent s244 +s244: +.frame $sp,112,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-112 +.mask 0xc2f00000,-72 +sw $20,16($sp) +sw $21,20($sp) +sw $22,24($sp) +sw $23,28($sp) +.cprestore 32 +sw $30,36($sp) +sw $31,40($sp) +sw $4,112($sp) +la $23,L.329 +lw $24,0+112($sp) +la $22,60($24) +L.330: +L.331: +move $24,$22 +la $22,1($24) +move $15,$23 +la $23,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.330 +move $20,$0 +move $21,$0 +l.d $f18,L.333 +s.d $f18,-64+112($sp) +s.d $f18,-56+112($sp) +l.d $f18,L.333 +s.d $f18,-48+112($sp) +l.d $f18,L.333 +s.d $f18,-40+112($sp) +l.d $f18,L.333 +s.d $f18,-32+112($sp) +l.d $f18,L.333 +s.d $f18,-24+112($sp) +l.d $f18,L.333 +s.d $f18,-16+112($sp) +l.d $f18,L.333 +s.d $f18,-8+112($sp) +move $21,$0 +move $30,$0 +L.341: +sll $24,$30,3 +la $15,-64+112($sp) +addu $15,$24,$15 +l.d $f18,($15) +la $15,-56+112($sp) +addu $24,$24,$15 +l.d $f16,($24) +c.eq.d $f18,$f16; bc1t L.345 +la $21,1 +L.345: +L.342: +la $30,1($30) +la $24,7 +blt $30,$24,L.341 +beq $21,$0,L.348 +lw $24,0+112($sp) +lw $24,44($24) +beq $24,$0,L.350 +la $4,L.328 +la $5,1 +jal printf +L.350: +la $20,1($20) +L.348: +b L.352 +lw $24,0+112($sp) +lw $24,44($24) +beq $24,$0,L.354 +la $4,L.328 +la $5,2 +jal printf +L.354: +la $20,2($20) +L.352: +move $2,$20 +L.327: +lw $20,16($sp) +lw $21,20($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $25,32($sp) +lw $30,36($sp) +lw $31,40($sp) +addu $sp,$sp,112 +j $31 +.end s244 +.data +.align 0 +L.357: +.byte 115 +.byte 50 +.byte 53 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.358: +.byte 115 +.byte 50 +.byte 53 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s25 +.text +.text +.align 2 +.ent s25 +s25: +.frame $sp,64,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-64 +.mask 0xc2fe0000,-12 +sw $17,16($sp) +sw $18,20($sp) +sw $19,24($sp) +sw $20,28($sp) +sw $21,32($sp) +sw $22,36($sp) +sw $23,40($sp) +.cprestore 44 +sw $30,48($sp) +sw $31,52($sp) +move $30,$4 +la $20,L.358 +la $19,60($30) +L.359: +L.360: +move $24,$19 +la $19,1($24) +move $15,$20 +la $20,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.359 +move $18,$0 +la $22,L.362 +lb $24,1($22) +lb $15,($22) +bne $15,$24,L.366 +lb $15,2($22) +bne $24,$15,L.366 +la $24,46 +beq $15,$24,L.363 +L.366: +la $18,1($18) +lw $24,44($30) +beq $24,$0,L.367 +la $4,L.357 +la $5,1 +jal printf +L.367: +L.363: +lb $24,3($22) +beq $24,$0,L.369 +la $18,4($18) +lw $24,44($30) +beq $24,$0,L.371 +la $4,L.357 +la $5,4 +jal printf +L.371: +L.369: +lb $24,L.375+1 +la $15,34 +beq $24,$15,L.373 +la $18,8($18) +lw $24,44($30) +beq $24,$0,L.377 +la $4,L.357 +la $5,8 +jal printf +L.377: +L.373: +la $22,L.379 +lb $24,($22) +la $15,10 +bne $24,$15,L.387 +lb $24,1($22) +la $15,9 +bne $24,$15,L.387 +lb $24,2($22) +la $15,8 +bne $24,$15,L.387 +lb $24,3($22) +la $15,13 +bne $24,$15,L.387 +lb $24,4($22) +la $15,12 +bne $24,$15,L.387 +lb $24,5($22) +la $15,92 +bne $24,$15,L.387 +lb $24,6($22) +la $15,39 +beq $24,$15,L.380 +L.387: +la $18,16($18) +lw $24,44($30) +beq $24,$0,L.388 +la $4,L.357 +la $5,16 +jal printf +L.388: +L.380: +la $24,L.390 +move $21,$24 +move $22,$24 +move $17,$0 +move $23,$0 +b L.394 +L.391: +addu $24,$23,$22 +lb $24,($24) +addu $15,$23,$21 +lb $15,($15) +beq $24,$15,L.395 +la $17,1 +L.395: +L.392: +la $23,1($23) +L.394: +move $24,$23 +la $15,7 +bltu $24,$15,L.391 +beq $17,$0,L.397 +la $18,32($18) +lw $24,44($30) +beq $24,$0,L.399 +la $4,L.357 +la $5,32 +jal printf +L.399: +L.397: +move $2,$18 +L.356: +lw $17,16($sp) +lw $18,20($sp) +lw $19,24($sp) +lw $20,28($sp) +lw $21,32($sp) +lw $22,36($sp) +lw $23,40($sp) +lw $25,44($sp) +lw $30,48($sp) +lw $31,52($sp) +addu $sp,$sp,64 +j $31 +.end s25 +.sdata +.align 0 +L.402: +.byte 115 +.byte 50 +.byte 54 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.data +.align 0 +L.403: +.byte 37 +.byte 51 +.byte 100 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 37 +.byte 115 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.data +.align 0 +L.404: +.byte 37 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 108 +.byte 101 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 97 +.byte 100 +.byte 100 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 49 +.byte 46 +.byte 32 +.byte 40 +.byte 37 +.byte 115 +.byte 41 +.byte 46 +.byte 10 +.byte 0 +.globl s26 +.text +.text +.align 2 +.ent s26 +s26: +.frame $sp,96,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-96 +.fmask 0xffc00000,-40 +.mask 0xc2f00000,-8 +s.d $f22,24($sp) +s.d $f24,32($sp) +s.d $f26,40($sp) +s.d $f28,48($sp) +s.d $f30,56($sp) +sw $20,64($sp) +sw $21,68($sp) +sw $22,72($sp) +sw $23,76($sp) +.cprestore 80 +sw $30,84($sp) +sw $31,88($sp) +move $30,$4 +la $22,L.402 +la $21,60($30) +L.405: +L.406: +move $24,$21 +la $21,1($24) +move $15,$22 +la $22,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.405 +sw $0,($30) +move $20,$0 +la $23,1 +b L.409 +L.408: +sll $24,$23,8*(4-1); sra $24,$24,8*(4-1) +sll $24,$24,1 +move $23,$24 +lw $24,($30) +la $24,1($24) +sw $24,($30) +L.409: +sll $24,$20,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$23,8*(4-1); sra $15,$15,8*(4-1) +bne $24,$15,L.408 +lw $24,($30) +sll $24,$24,2 +sw $24,4($30) +lw $24,($30) +sll $24,$24,1 +sw $24,8($30) +lw $24,($30) +sll $24,$24,2 +sw $24,12($30) +lw $24,($30) +sll $24,$24,2 +sw $24,16($30) +lw $24,($30) +sll $24,$24,2 +sw $24,20($30) +lw $24,($30) +sll $24,$24,3 +sw $24,24($30) +l.s $f18,L.411 +mov.s $f26,$f18 +mov.s $f30,$f18 +l.s $f28,L.412 +b L.414 +L.413: +add.s $f28,$f26,$f30 +cvt.d.s $f18,$f30 +l.d $f16,L.416 +div.d $f18,$f18,$f16 +cvt.s.d $f30,$f18 +L.414: +c.eq.s $f28,$f26; bc1f L.413 +l.d $f18,L.417 +cvt.d.s $f16,$f30 +mul.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +s.s $f18,28($30) +l.d $f22,L.418 +l.s $f30,L.411 +l.d $f24,L.419 +b L.421 +L.420: +cvt.d.s $f18,$f30 +add.d $f24,$f22,$f18 +l.d $f16,L.416 +div.d $f18,$f18,$f16 +cvt.s.d $f30,$f18 +L.421: +c.eq.d $f24,$f22; bc1f L.420 +l.d $f18,L.417 +cvt.d.s $f16,$f30 +mul.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +s.s $f18,32($30) +lw $24,40($30) +beq $24,$0,L.423 +la $4,L.403 +lw $5,($30) +la $6,L.425 +jal printf +la $4,L.403 +lw $5,4($30) +la $6,L.426 +jal printf +la $4,L.403 +lw $5,8($30) +la $6,L.427 +jal printf +la $4,L.403 +lw $5,12($30) +la $6,L.428 +jal printf +la $4,L.403 +lw $5,16($30) +la $6,L.429 +jal printf +la $4,L.403 +lw $5,20($30) +la $6,L.430 +jal printf +la $4,L.403 +lw $5,24($30) +la $6,L.431 +jal printf +la $4,L.404 +l.s $f18,28($30) +cvt.d.s $f18,$f18 +mfc1.d $6,$f18 +la $24,L.430 +sw $24,16($sp) +jal printf +la $4,L.404 +l.s $f18,32($30) +cvt.d.s $f18,$f18 +mfc1.d $6,$f18 +la $24,L.431 +sw $24,16($sp) +jal printf +L.423: +move $2,$0 +L.401: +l.d $f22,24($sp) +l.d $f24,32($sp) +l.d $f26,40($sp) +l.d $f28,48($sp) +l.d $f30,56($sp) +lw $20,64($sp) +lw $21,68($sp) +lw $22,72($sp) +lw $23,76($sp) +lw $25,80($sp) +lw $30,84($sp) +lw $31,88($sp) +addu $sp,$sp,96 +j $31 +.end s26 +.data +.align 0 +L.433: +.byte 115 +.byte 52 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.434: +.byte 115 +.byte 52 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s4 +.text +.text +.align 2 +.ent s4 +s4: +.frame $sp,80,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-80 +.mask 0xc2fc0000,-32 +sw $18,16($sp) +sw $19,20($sp) +sw $20,24($sp) +sw $21,28($sp) +sw $22,32($sp) +sw $23,36($sp) +.cprestore 40 +sw $30,44($sp) +sw $31,48($sp) +move $30,$4 +move $18,$0 +la $20,L.434 +la $19,60($30) +L.435: +L.436: +move $24,$19 +la $19,1($24) +move $15,$20 +la $20,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.435 +move $23,$0 +L.438: +move $4,$23 +jal svtest +move $24,$2 +sw $24,-16+80($sp) +jal zero +lw $15,-16+80($sp) +beq $15,$2,L.442 +la $18,1 +lw $24,44($30) +beq $24,$0,L.444 +la $4,L.433 +la $5,1 +jal printf +L.444: +L.442: +L.439: +la $23,1($23) +la $24,3 +blt $23,$24,L.438 +jal setev +jal testev +beq $2,$0,L.446 +la $18,2($18) +lw $24,44($30) +beq $24,$0,L.448 +la $4,L.433 +la $5,2 +jal printf +L.448: +L.446: +b L.450 +la $18,4($18) +lw $24,44($30) +beq $24,$0,L.452 +la $4,L.433 +la $5,4 +jal printf +L.452: +L.450: +la $22,0xffffffff +la $21,1 +move $23,$0 +b L.457 +L.454: +and $21,$21,$22 +srl $22,$22,1 +L.455: +la $23,1($23) +L.457: +move $24,$23 +lw $15,($30) +sll $15,$15,2 +bltu $24,$15,L.454 +la $24,1 +bne $21,$24,L.460 +beq $22,$0,L.458 +L.460: +la $18,8($18) +lw $24,44($30) +beq $24,$0,L.461 +la $4,L.433 +la $5,8 +jal printf +L.461: +L.458: +move $2,$18 +L.432: +lw $18,16($sp) +lw $19,20($sp) +lw $20,24($sp) +lw $21,28($sp) +lw $22,32($sp) +lw $23,36($sp) +lw $25,40($sp) +lw $30,44($sp) +lw $31,48($sp) +addu $sp,$sp,80 +j $31 +.end s4 +.lcomm L.464,4 +.globl svtest +.text +.text +.align 2 +.ent svtest +svtest: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +beq $4,$0,L.467 +la $24,1 +beq $4,$24,L.468 +la $24,2 +beq $4,$24,L.471 +b L.465 +L.467: +la $24,1978 +sw $24,L.464 +sw $0,-4+16($sp) +b L.466 +L.468: +lw $24,L.464 +la $15,1978 +beq $24,$15,L.469 +la $24,1 +sw $24,-4+16($sp) +b L.466 +L.469: +la $24,1929 +sw $24,L.464 +sw $0,-4+16($sp) +b L.466 +L.471: +lw $24,L.464 +la $15,1929 +beq $24,$15,L.472 +la $24,1 +sw $24,-4+16($sp) +b L.466 +L.472: +sw $0,-4+16($sp) +L.465: +L.466: +lw $2,-4+16($sp) +L.463: +addu $sp,$sp,16 +j $31 +.end svtest +.lcomm L.475,4 +.globl zero +.text +.text +.align 2 +.ent zero +zero: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +la $24,2 +sw $24,L.475 +sw $0,-4+16($sp) +lw $2,-4+16($sp) +L.474: +addu $sp,$sp,16 +j $31 +.end zero +.globl testev +.text +.align 2 +.ent testev +testev: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +lw $24,extvar +la $15,1066 +beq $24,$15,L.477 +la $2,1 +b L.476 +L.477: +move $2,$0 +L.476: +j $31 +.end testev +.data +.align 0 +L.480: +.byte 115 +.byte 54 +.byte 49 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.481: +.byte 115 +.byte 54 +.byte 49 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.data +.align 0 +L.482: +.byte 65 +.byte 66 +.byte 67 +.byte 68 +.byte 69 +.byte 70 +.byte 71 +.byte 72 +.byte 73 +.byte 74 +.byte 75 +.byte 76 +.byte 77 +.byte 78 +.byte 79 +.byte 80 +.byte 81 +.byte 82 +.byte 83 +.byte 84 +.byte 85 +.byte 86 +.byte 87 +.byte 88 +.byte 89 +.byte 90 +.byte 0 +.data +.align 0 +L.483: +.byte 97 +.byte 98 +.byte 99 +.byte 100 +.byte 101 +.byte 102 +.byte 103 +.byte 104 +.byte 105 +.byte 106 +.byte 107 +.byte 108 +.byte 109 +.byte 110 +.byte 111 +.byte 112 +.byte 113 +.byte 114 +.byte 115 +.byte 116 +.byte 117 +.byte 118 +.byte 119 +.byte 120 +.byte 121 +.byte 122 +.byte 0 +.data +.align 0 +L.484: +.byte 48 +.byte 49 +.byte 50 +.byte 51 +.byte 52 +.byte 53 +.byte 54 +.byte 55 +.byte 56 +.byte 57 +.byte 0 +.data +.align 0 +L.485: +.byte 126 +.byte 33 +.byte 34 +.byte 35 +.byte 37 +.byte 38 +.byte 40 +.byte 41 +.byte 95 +.byte 61 +.byte 45 +.byte 94 +.byte 124 +.byte 123 +.byte 125 +.byte 91 +.byte 93 +.byte 43 +.byte 59 +.byte 42 +.byte 58 +.byte 60 +.byte 62 +.byte 44 +.byte 46 +.byte 63 +.byte 47 +.byte 0 +.data +.align 0 +L.486: +.byte 10 +.byte 9 +.byte 8 +.byte 13 +.byte 12 +.byte 92 +.byte 39 +.byte 0 +.data +.align 0 +L.487: +.byte 32 +.byte 0 +.byte 0 +.globl s61 +.text +.text +.align 2 +.ent s61 +s61: +.frame $sp,96,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-96 +.mask 0xc2fe0000,-44 +sw $17,16($sp) +sw $18,20($sp) +sw $19,24($sp) +sw $20,28($sp) +sw $21,32($sp) +sw $22,36($sp) +sw $23,40($sp) +.cprestore 44 +sw $30,48($sp) +sw $31,52($sp) +sw $4,96($sp) +la $22,L.481 +lw $24,0+96($sp) +la $21,60($24) +move $19,$0 +L.488: +L.489: +move $24,$21 +la $21,1($24) +move $15,$22 +la $22,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.488 +la $24,-19 +sh $24,-26+96($sp) +lh $24,-26+96($sp) +sw $24,-32+96($sp) +lw $24,-32+96($sp) +la $15,-19 +beq $24,$15,L.491 +la $19,1($19) +lw $24,0+96($sp) +lw $24,44($24) +beq $24,$0,L.493 +la $4,L.480 +la $5,1 +jal printf +L.493: +L.491: +la $24,L.482 +sw $24,-24+96($sp) +la $24,L.483 +sw $24,-20+96($sp) +la $24,L.484 +sw $24,-16+96($sp) +la $24,L.485 +sw $24,-12+96($sp) +la $24,L.486 +sw $24,-8+96($sp) +la $24,L.487 +sw $24,-4+96($sp) +move $23,$0 +move $30,$0 +b L.505 +L.504: +sll $24,$30,2 +la $15,-24+96($sp) +addu $24,$24,$15 +lw $15,($24) +la $14,1($15) +sw $14,($24) +lb $24,($15) +bge $24,$0,L.507 +la $23,1 +L.507: +L.505: +sll $24,$30,2 +la $15,-24+96($sp) +addu $24,$24,$15 +lw $24,($24) +lb $24,($24) +bne $24,$0,L.504 +L.501: +la $30,1($30) +la $24,6 +blt $30,$24,L.505 +beq $23,$0,L.509 +la $19,2($19) +lw $24,0+96($sp) +lw $24,44($24) +beq $24,$0,L.511 +la $4,L.480 +la $5,2 +jal printf +L.511: +L.509: +la $20,1048579 +move $18,$20 +move $17,$20 +sll $24,$18,8*(4-2); sra $24,$24,8*(4-2) +beq $24,$20,L.516 +la $15,3 +bne $24,$15,L.515 +L.516: +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +beq $24,$20,L.513 +la $15,3 +beq $24,$15,L.513 +L.515: +la $19,8($19) +lw $24,0+96($sp) +lw $24,44($24) +beq $24,$0,L.517 +la $4,L.480 +la $5,8 +jal printf +L.517: +L.513: +move $2,$19 +L.479: +lw $17,16($sp) +lw $18,20($sp) +lw $19,24($sp) +lw $20,28($sp) +lw $21,32($sp) +lw $22,36($sp) +lw $23,40($sp) +lw $25,44($sp) +lw $30,48($sp) +lw $31,52($sp) +addu $sp,$sp,96 +j $31 +.end s61 +.data +.align 0 +L.520: +.byte 115 +.byte 54 +.byte 50 +.byte 54 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.521: +.byte 115 +.byte 54 +.byte 50 +.byte 54 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s626 +.text +.text +.align 2 +.ent s626 +s626: +.frame $sp,160,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-160 +.fmask 0xff000000,-120 +.mask 0xc2ff0000,-72 +s.d $f24,16($sp) +s.d $f26,24($sp) +s.d $f28,32($sp) +s.d $f30,40($sp) +sw $16,48($sp) +sw $17,52($sp) +sw $18,56($sp) +sw $19,60($sp) +sw $20,64($sp) +sw $21,68($sp) +sw $22,72($sp) +sw $23,76($sp) +.cprestore 80 +sw $30,84($sp) +sw $31,88($sp) +move $30,$4 +la $20,L.521 +la $19,60($30) +sw $0,-52+160($sp) +L.522: +L.523: +move $24,$19 +la $19,1($24) +move $15,$20 +la $20,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.522 +l.s $f30,L.411 +la $24,1 +move $18,$24 +move $22,$24 +move $23,$0 +b L.528 +L.525: +l.s $f18,L.529 +mul.s $f30,$f18,$f30 +sll $24,$22,1 +or $22,$24,$18 +L.526: +la $23,1($23) +L.528: +lw $24,12($30) +subu $24,$24,2 +blt $23,$24,L.525 +mtc1 $22,$f18; cvt.s.w $f18,$f18 +s.s $f18,-60+160($sp) +l.s $f18,-60+160($sp) +sub.s $f18,$f30,$f18 +div.s $f30,$f18,$f30 +cvt.d.s $f18,$f30 +l.d $f16,L.416 +l.s $f10,28($30) +cvt.d.s $f10,$f10 +mul.d $f16,$f16,$f10 +c.ule.d $f18,$f16; bc1t L.530 +lw $24,-52+160($sp) +la $24,2($24) +sw $24,-52+160($sp) +lw $24,44($30) +beq $24,$0,L.532 +la $4,L.520 +la $5,2 +jal printf +L.532: +L.530: +la $16,125 +la $24,125 +sh $24,-30+160($sp) +la $24,125 +sw $24,-36+160($sp) +la $24,15625 +sw $24,-44+160($sp) +la $24,125 +sw $24,-40+160($sp) +la $24,15625 +sw $24,-48+160($sp) +la $17,125 +la $24,15625 +sw $24,-56+160($sp) +l.s $f26,L.534 +l.d $f24,L.535 +l.d $f28,L.536 +move $23,$0 +L.537: +la $24,-28+160($sp) +addu $24,$23,$24 +sb $0,($24) +L.538: +la $23,1($23) +la $24,28 +blt $23,$24,L.537 +sll $24,$16,8*(4-1); sra $24,$24,8*(4-1) +mul $24,$24,$24 +lw $15,-44+160($sp) +beq $24,$15,L.541 +la $24,1 +sb $24,-28+160($sp) +L.541: +lh $24,-30+160($sp) +sll $15,$16,8*(4-1); sra $15,$15,8*(4-1) +mul $24,$24,$15 +lw $15,-44+160($sp) +beq $24,$15,L.543 +la $24,1 +sb $24,-27+160($sp) +L.543: +lh $24,-30+160($sp) +mul $24,$24,$24 +lw $15,-44+160($sp) +beq $24,$15,L.546 +la $24,1 +sb $24,-26+160($sp) +L.546: +lw $24,-36+160($sp) +sll $15,$16,8*(4-1); sra $15,$15,8*(4-1) +mul $24,$24,$15 +lw $15,-44+160($sp) +beq $24,$15,L.549 +la $24,1 +sb $24,-25+160($sp) +L.549: +lw $24,-36+160($sp) +lh $15,-30+160($sp) +mul $24,$24,$15 +lw $15,-44+160($sp) +beq $24,$15,L.552 +la $24,1 +sb $24,-24+160($sp) +L.552: +lw $24,-36+160($sp) +mul $24,$24,$24 +lw $15,-44+160($sp) +beq $24,$15,L.555 +la $24,1 +sb $24,-23+160($sp) +L.555: +lw $24,-40+160($sp) +sll $15,$16,8*(4-1); sra $15,$15,8*(4-1) +mul $24,$24,$15 +lw $15,-48+160($sp) +beq $24,$15,L.558 +la $24,1 +sb $24,-22+160($sp) +L.558: +lw $24,-40+160($sp) +lh $15,-30+160($sp) +mul $24,$24,$15 +lw $15,-48+160($sp) +beq $24,$15,L.561 +la $24,1 +sb $24,-21+160($sp) +L.561: +lw $24,-40+160($sp) +lw $15,-36+160($sp) +mul $24,$24,$15 +lw $15,-48+160($sp) +beq $24,$15,L.564 +la $24,1 +sb $24,-20+160($sp) +L.564: +lw $24,-40+160($sp) +mul $24,$24,$24 +lw $15,-48+160($sp) +beq $24,$15,L.567 +la $24,1 +sb $24,-19+160($sp) +L.567: +sll $24,$16,8*(4-1); sra $24,$24,8*(4-1) +mul $24,$17,$24 +lw $15,-56+160($sp) +beq $24,$15,L.570 +la $24,1 +sb $24,-18+160($sp) +L.570: +lh $24,-30+160($sp) +mul $24,$17,$24 +lw $15,-56+160($sp) +beq $24,$15,L.573 +la $24,1 +sb $24,-17+160($sp) +L.573: +lw $24,-36+160($sp) +mul $24,$17,$24 +lw $15,-56+160($sp) +beq $24,$15,L.576 +la $24,1 +sb $24,-16+160($sp) +L.576: +move $24,$17 +lw $15,-40+160($sp) +mul $24,$24,$15 +lw $15,-48+160($sp) +beq $24,$15,L.579 +la $24,1 +sb $24,-15+160($sp) +L.579: +mul $24,$17,$17 +lw $15,-56+160($sp) +beq $24,$15,L.582 +la $24,1 +sb $24,-14+160($sp) +L.582: +sll $24,$16,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f18,$f26,$f18 +cvt.d.s $f18,$f18 +c.eq.d $f18,$f28; bc1t L.585 +la $24,1 +sb $24,-13+160($sp) +L.585: +lh $24,-30+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f18,$f26,$f18 +cvt.d.s $f18,$f18 +c.eq.d $f18,$f28; bc1t L.588 +la $24,1 +sb $24,-12+160($sp) +L.588: +lw $24,-36+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f18,$f26,$f18 +cvt.d.s $f18,$f18 +c.eq.d $f18,$f28; bc1t L.591 +la $24,1 +sb $24,-11+160($sp) +L.591: +lw $24,-40+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +mul.s $f18,$f26,$f18 +cvt.d.s $f18,$f18 +c.eq.d $f18,$f28; bc1t L.594 +la $24,1 +sb $24,-10+160($sp) +L.594: +mtc1 $17,$f18; cvt.s.w $f18,$f18 +mul.s $f18,$f26,$f18 +cvt.d.s $f18,$f18 +c.eq.d $f18,$f28; bc1t L.598 +la $24,1 +sb $24,-9+160($sp) +L.598: +mul.s $f18,$f26,$f26 +cvt.d.s $f18,$f18 +c.eq.d $f18,$f28; bc1t L.601 +la $24,1 +sb $24,-8+160($sp) +L.601: +sll $24,$16,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f18,$f24,$f18 +c.eq.d $f18,$f28; bc1t L.604 +la $24,1 +sb $24,-7+160($sp) +L.604: +lh $24,-30+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f18,$f24,$f18 +c.eq.d $f18,$f28; bc1t L.607 +la $24,1 +sb $24,-6+160($sp) +L.607: +lw $24,-36+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f18,$f24,$f18 +c.eq.d $f18,$f28; bc1t L.610 +la $24,1 +sb $24,-5+160($sp) +L.610: +lw $24,-40+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +mul.d $f18,$f24,$f18 +c.eq.d $f18,$f28; bc1t L.613 +la $24,1 +sb $24,-4+160($sp) +L.613: +mtc1 $17,$f18; cvt.d.w $f18,$f18 +mul.d $f18,$f24,$f18 +c.eq.d $f18,$f28; bc1t L.616 +la $24,1 +sb $24,-3+160($sp) +L.616: +cvt.d.s $f18,$f26 +mul.d $f18,$f24,$f18 +c.eq.d $f18,$f28; bc1t L.619 +la $24,1 +sb $24,-2+160($sp) +L.619: +mul.d $f18,$f24,$f24 +c.eq.d $f18,$f28; bc1t L.622 +la $24,1 +sb $24,-1+160($sp) +L.622: +move $21,$0 +move $23,$0 +L.625: +sll $24,$21,8*(4-1); sra $24,$24,8*(4-1) +la $15,-28+160($sp) +addu $15,$23,$15 +lb $15,($15) +addu $24,$24,$15 +move $21,$24 +L.626: +la $23,1($23) +la $24,28 +blt $23,$24,L.625 +sll $24,$21,8*(4-1); sra $24,$24,8*(4-1) +beq $24,$0,L.629 +lw $24,-52+160($sp) +la $24,4($24) +sw $24,-52+160($sp) +lw $24,44($30) +beq $24,$0,L.631 +la $4,L.520 +la $5,4 +jal printf +la $4,L.633 +jal printf +move $23,$0 +L.634: +la $4,L.638 +la $24,-28+160($sp) +addu $24,$23,$24 +lb $5,($24) +jal printf +L.635: +la $23,1($23) +la $24,28 +blt $23,$24,L.634 +la $4,L.639 +jal printf +L.631: +L.629: +la $17,32768 +move $24,$17 +la $15,0x8000 +bleu $24,$15,L.640 +lw $24,-52+160($sp) +la $24,8($24) +sw $24,-52+160($sp) +lw $24,44($30) +beq $24,$0,L.642 +la $4,L.520 +la $5,8 +jal printf +L.642: +L.640: +lw $2,-52+160($sp) +L.519: +l.d $f24,16($sp) +l.d $f26,24($sp) +l.d $f28,32($sp) +l.d $f30,40($sp) +lw $16,48($sp) +lw $17,52($sp) +lw $18,56($sp) +lw $19,60($sp) +lw $20,64($sp) +lw $21,68($sp) +lw $22,72($sp) +lw $23,76($sp) +lw $25,80($sp) +lw $30,84($sp) +lw $31,88($sp) +addu $sp,$sp,160 +j $31 +.end s626 +.data +.align 0 +L.645: +.byte 115 +.byte 55 +.byte 49 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.646: +.byte 115 +.byte 55 +.byte 49 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.sdata +.align 0 +L.647: +.byte 0x71 +.globl s71 +.text +.text +.align 2 +.ent s71 +s71: +.frame $sp,96,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-96 +.mask 0xc2f00000,-56 +sw $20,16($sp) +sw $21,20($sp) +sw $22,24($sp) +sw $23,28($sp) +.cprestore 32 +sw $30,36($sp) +sw $31,40($sp) +move $30,$4 +la $23,L.646 +la $22,60($30) +move $21,$0 +L.648: +L.649: +move $24,$22 +la $22,1($24) +move $15,$23 +la $23,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.648 +lb $24,L.653 +lb $15,L.647 +beq $24,$15,L.651 +la $21,1($21) +lw $24,44($30) +beq $24,$0,L.654 +la $4,L.645 +la $5,1 +jal printf +L.654: +L.651: +b L.656 +la $21,2($21) +lw $24,44($30) +beq $24,$0,L.658 +la $4,L.645 +la $5,2 +jal printf +L.658: +L.656: +la $24,1942 +sw $24,-20+96($sp) +lw $24,-20+96($sp) +la $15,1942 +bne $24,$15,L.666 +lw $24,-20+96($sp) +lw $15,-20+96($sp) +beq $24,$15,L.661 +L.666: +la $21,4($21) +lw $24,44($30) +beq $24,$0,L.667 +la $4,L.645 +la $5,4 +jal printf +L.667: +L.661: +la $4,-5 +jal McCarthy +la $15,91 +beq $2,$15,L.669 +la $21,8($21) +lw $24,44($30) +beq $24,$0,L.671 +la $4,L.645 +la $5,8 +jal printf +L.671: +L.669: +la $20,2 +la $24,3 +sw $24,-44+96($sp) +la $24,-44+96($sp) +sw $24,-48+96($sp) +move $4,$20 +lw $5,-48+96($sp) +jal clobber +la $24,2 +bne $20,$24,L.675 +lw $15,-44+96($sp) +beq $15,$24,L.673 +L.675: +la $21,16($21) +lw $24,44($30) +beq $24,$0,L.676 +la $4,L.645 +la $5,16 +jal printf +L.676: +L.673: +l.s $f18,32($30) +c.eq.s $f18,$f18; bc1t L.678 +la $21,32($21) +lw $24,44($30) +beq $24,$0,L.680 +la $4,L.645 +la $5,32 +jal printf +L.680: +L.678: +move $2,$21 +L.644: +lw $20,16($sp) +lw $21,20($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $25,32($sp) +lw $30,36($sp) +lw $31,40($sp) +addu $sp,$sp,96 +j $31 +.end s71 +.globl McCarthy +.text +.align 2 +.ent McCarthy +McCarthy: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +lw $24,0+32($sp) +la $15,100 +ble $24,$15,L.683 +lw $24,0+32($sp) +subu $2,$24,10 +b L.682 +L.683: +lw $24,0+32($sp) +la $4,11($24) +jal McCarthy +move $24,$2 +move $4,$24 +jal McCarthy +move $24,$2 +L.682: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end McCarthy +.globl clobber +.text +.align 2 +.ent clobber +clobber: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +la $4,3 +la $24,2 +sw $24,($5) +move $2,$0 +L.685: +j $31 +.end clobber +.data +.align 0 +L.687: +.byte 76 +.byte 111 +.byte 99 +.byte 97 +.byte 108 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 37 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.data +.align 0 +L.688: +.byte 115 +.byte 55 +.byte 49 +.byte 52 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.689: +.byte 115 +.byte 55 +.byte 49 +.byte 52 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s714 +.text +.text +.align 2 +.ent s714 +s714: +.frame $sp,160,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-160 +.fmask 0xff000000,-120 +.mask 0xc2ff0000,-72 +s.d $f24,16($sp) +s.d $f26,24($sp) +s.d $f28,32($sp) +s.d $f30,40($sp) +sw $16,48($sp) +sw $17,52($sp) +sw $18,56($sp) +sw $19,60($sp) +sw $20,64($sp) +sw $21,68($sp) +sw $22,72($sp) +sw $23,76($sp) +.cprestore 80 +sw $30,84($sp) +sw $31,88($sp) +sw $4,160($sp) +la $24,L.689 +sw $24,-16+160($sp) +lw $24,0+160($sp) +la $15,60($24) +sw $15,-20+160($sp) +sw $0,-24+160($sp) +move $23,$0 +lw $30,48($24) +L.690: +L.691: +lw $24,-20+160($sp) +la $15,1($24) +sw $15,-20+160($sp) +lw $15,-16+160($sp) +la $14,1($15) +sw $14,-16+160($sp) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.690 +la $22,5 +la $17,2 +move $22,$17 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.693 +la $23,1 +beq $30,$0,L.695 +la $4,L.687 +move $5,$23 +jal printf +L.695: +L.693: +la $22,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.697 +la $23,2 +beq $30,$0,L.699 +la $4,L.687 +move $5,$23 +jal printf +L.699: +L.697: +la $22,5 +la $24,2 +sw $24,-4+160($sp) +lw $15,-4+160($sp) +move $22,$15 +sll $15,$22,8*(4-1); sra $15,$15,8*(4-1) +beq $15,$24,L.701 +la $23,3 +beq $30,$0,L.703 +la $4,L.687 +move $5,$23 +jal printf +L.703: +L.701: +la $22,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.705 +la $23,4 +beq $30,$0,L.707 +la $4,L.687 +move $5,$23 +jal printf +L.707: +L.705: +la $22,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.709 +la $23,5 +beq $30,$0,L.711 +la $4,L.687 +move $5,$23 +jal printf +L.711: +L.709: +la $22,5 +l.s $f26,L.529 +trunc.w.s $f2,$f26,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.713 +la $23,6 +beq $30,$0,L.715 +la $4,L.687 +move $5,$23 +jal printf +L.715: +L.713: +la $22,5 +l.d $f24,L.416 +trunc.w.d $f2,$f24,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.717 +la $23,7 +beq $30,$0,L.719 +la $4,L.687 +move $5,$23 +jal printf +L.719: +L.717: +la $21,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.721 +la $23,8 +beq $30,$0,L.723 +la $4,L.687 +move $5,$23 +jal printf +L.723: +L.721: +la $21,5 +la $16,2 +move $21,$16 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.725 +la $23,9 +beq $30,$0,L.727 +la $4,L.687 +move $5,$23 +jal printf +L.727: +L.725: +la $21,5 +la $24,2 +sw $24,-4+160($sp) +lw $15,-4+160($sp) +move $21,$15 +sll $15,$21,8*(4-2); sra $15,$15,8*(4-2) +beq $15,$24,L.729 +la $23,10 +beq $30,$0,L.731 +la $4,L.687 +move $5,$23 +jal printf +L.731: +L.729: +la $21,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.733 +la $23,11 +beq $30,$0,L.735 +la $4,L.687 +move $5,$23 +jal printf +L.735: +L.733: +la $21,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.737 +la $23,12 +beq $30,$0,L.739 +la $4,L.687 +move $5,$23 +jal printf +L.739: +L.737: +la $21,5 +l.s $f26,L.529 +trunc.w.s $f2,$f26,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.741 +la $23,13 +beq $30,$0,L.743 +la $4,L.687 +move $5,$23 +jal printf +L.743: +L.741: +la $21,5 +l.d $f24,L.416 +trunc.w.d $f2,$f24,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.745 +la $23,14 +beq $30,$0,L.747 +la $4,L.687 +move $5,$23 +jal printf +L.747: +L.745: +la $20,5 +la $17,2 +sll $20,$17,8*(4-1); sra $20,$20,8*(4-1) +la $24,2 +beq $20,$24,L.749 +la $23,15 +beq $30,$0,L.751 +la $4,L.687 +move $5,$23 +jal printf +L.751: +L.749: +la $20,5 +la $16,2 +sll $20,$16,8*(4-2); sra $20,$20,8*(4-2) +la $24,2 +beq $20,$24,L.753 +la $23,16 +beq $30,$0,L.755 +la $4,L.687 +move $5,$23 +jal printf +L.755: +L.753: +la $20,5 +la $24,2 +sw $24,-4+160($sp) +lw $20,-4+160($sp) +beq $20,$24,L.757 +la $23,17 +beq $30,$0,L.759 +la $4,L.687 +move $5,$23 +jal printf +L.759: +L.757: +la $20,5 +la $24,2 +sw $24,-8+160($sp) +lw $20,-8+160($sp) +la $24,2 +beq $20,$24,L.761 +la $23,18 +beq $30,$0,L.763 +la $4,L.687 +move $5,$23 +jal printf +L.763: +L.761: +la $20,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +move $20,$24 +la $24,2 +beq $20,$24,L.765 +la $23,19 +beq $30,$0,L.767 +la $4,L.687 +move $5,$23 +jal printf +L.767: +L.765: +la $20,5 +l.s $f26,L.529 +trunc.w.s $f2,$f26,$20; mfc1 $20,$f2 +la $24,2 +beq $20,$24,L.769 +la $23,20 +beq $30,$0,L.771 +la $4,L.687 +move $5,$23 +jal printf +L.771: +L.769: +la $20,5 +l.d $f24,L.416 +trunc.w.d $f2,$f24,$20; mfc1 $20,$f2 +la $24,2 +beq $20,$24,L.773 +la $23,21 +beq $30,$0,L.775 +la $4,L.687 +move $5,$23 +jal printf +L.775: +L.773: +la $19,5 +la $17,2 +sll $19,$17,8*(4-1); sra $19,$19,8*(4-1) +la $24,2 +beq $19,$24,L.777 +la $23,22 +beq $30,$0,L.779 +la $4,L.687 +move $5,$23 +jal printf +L.779: +L.777: +la $19,5 +la $16,2 +sll $19,$16,8*(4-2); sra $19,$19,8*(4-2) +la $24,2 +beq $19,$24,L.781 +la $23,23 +beq $30,$0,L.783 +la $4,L.687 +move $5,$23 +jal printf +L.783: +L.781: +la $19,5 +la $24,2 +sw $24,-4+160($sp) +lw $19,-4+160($sp) +la $24,2 +beq $19,$24,L.785 +la $23,24 +beq $30,$0,L.787 +la $4,L.687 +move $5,$23 +jal printf +L.787: +L.785: +la $19,5 +la $24,2 +sw $24,-8+160($sp) +lw $19,-8+160($sp) +beq $19,$24,L.789 +la $23,25 +beq $30,$0,L.791 +la $4,L.687 +move $5,$23 +jal printf +L.791: +L.789: +la $19,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +move $19,$24 +la $24,2 +beq $19,$24,L.793 +la $23,26 +beq $30,$0,L.795 +la $4,L.687 +move $5,$23 +jal printf +L.795: +L.793: +la $19,5 +l.s $f26,L.529 +trunc.w.s $f2,$f26,$19; mfc1 $19,$f2 +la $24,2 +beq $19,$24,L.797 +la $23,27 +beq $30,$0,L.799 +la $4,L.687 +move $5,$23 +jal printf +L.799: +L.797: +la $19,5 +l.d $f24,L.416 +trunc.w.d $f2,$f24,$19; mfc1 $19,$f2 +la $24,2 +beq $19,$24,L.801 +la $23,28 +beq $30,$0,L.803 +la $4,L.687 +move $5,$23 +jal printf +L.803: +L.801: +la $18,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +move $18,$24 +la $24,2 +beq $18,$24,L.805 +la $23,29 +beq $30,$0,L.807 +la $4,L.687 +move $5,$23 +jal printf +L.807: +L.805: +la $18,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +move $18,$24 +la $24,2 +beq $18,$24,L.809 +la $23,30 +beq $30,$0,L.811 +la $4,L.687 +move $5,$23 +jal printf +L.811: +L.809: +la $18,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +move $18,$24 +la $24,2 +beq $18,$24,L.813 +la $23,31 +beq $30,$0,L.815 +la $4,L.687 +move $5,$23 +jal printf +L.815: +L.813: +la $18,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +move $18,$24 +la $24,2 +beq $18,$24,L.817 +la $23,32 +beq $30,$0,L.819 +la $4,L.687 +move $5,$23 +jal printf +L.819: +L.817: +la $18,5 +la $24,2 +sw $24,-12+160($sp) +lw $18,-12+160($sp) +beq $18,$24,L.821 +la $23,33 +beq $30,$0,L.823 +la $4,L.687 +move $5,$23 +jal printf +L.823: +L.821: +la $18,5 +l.s $f26,L.529 +l.s $f18,L.828 +c.ult.s $f26,$f18; bc1t L.826 +sub.s $f18,$f26,$f18 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-28+160($sp) +b L.827 +L.826: +trunc.w.s $f2,$f26,$24; mfc1 $24,$f2 +sw $24,-28+160($sp) +L.827: +lw $18,-28+160($sp) +la $24,2 +beq $18,$24,L.829 +la $23,34 +beq $30,$0,L.831 +la $4,L.687 +move $5,$23 +jal printf +L.831: +L.829: +la $18,5 +l.d $f24,L.416 +l.d $f18,L.836 +c.ult.d $f24,$f18; bc1t L.834 +sub.d $f18,$f24,$f18 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-32+160($sp) +b L.835 +L.834: +trunc.w.d $f2,$f24,$24; mfc1 $24,$f2 +sw $24,-32+160($sp) +L.835: +lw $18,-32+160($sp) +la $24,2 +beq $18,$24,L.837 +la $23,35 +beq $30,$0,L.839 +la $4,L.687 +move $5,$23 +jal printf +L.839: +L.837: +l.s $f30,L.841 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f30; cvt.s.w $f30,$f30 +l.s $f18,L.529 +c.eq.s $f30,$f18; bc1t L.842 +la $23,36 +beq $30,$0,L.844 +la $4,L.687 +move $5,$23 +jal printf +L.844: +L.842: +l.s $f30,L.841 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f30; cvt.s.w $f30,$f30 +l.s $f18,L.529 +c.eq.s $f30,$f18; bc1t L.846 +la $23,37 +beq $30,$0,L.848 +la $4,L.687 +move $5,$23 +jal printf +L.848: +L.846: +l.s $f30,L.841 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f30; cvt.s.w $f30,$f30 +l.s $f18,L.529 +c.eq.s $f30,$f18; bc1t L.850 +la $23,38 +beq $30,$0,L.852 +la $4,L.687 +move $5,$23 +jal printf +L.852: +L.850: +l.s $f30,L.841 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f30; cvt.s.w $f30,$f30 +l.s $f18,L.529 +c.eq.s $f30,$f18; bc1t L.854 +la $23,39 +beq $30,$0,L.856 +la $4,L.687 +move $5,$23 +jal printf +L.856: +L.854: +l.s $f30,L.841 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f30,$f18 +l.s $f18,L.529 +c.eq.s $f30,$f18; bc1t L.858 +la $23,40 +beq $30,$0,L.860 +la $4,L.687 +move $5,$23 +jal printf +L.860: +L.858: +l.s $f30,L.841 +l.s $f18,L.529 +mov.s $f26,$f18 +mov.s $f30,$f26 +c.eq.s $f30,$f18; bc1t L.862 +la $23,41 +beq $30,$0,L.864 +la $4,L.687 +move $5,$23 +jal printf +L.864: +L.862: +l.s $f30,L.841 +l.d $f24,L.416 +cvt.s.d $f30,$f24 +l.s $f18,L.529 +c.eq.s $f30,$f18; bc1t L.866 +la $23,42 +beq $30,$0,L.868 +la $4,L.687 +move $5,$23 +jal printf +L.868: +L.866: +l.d $f28,L.870 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f28; cvt.d.w $f28,$f28 +l.d $f18,L.416 +c.eq.d $f28,$f18; bc1t L.871 +la $23,43 +beq $30,$0,L.873 +la $4,L.687 +move $5,$23 +jal printf +L.873: +L.871: +l.d $f28,L.870 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f28; cvt.d.w $f28,$f28 +l.d $f18,L.416 +c.eq.d $f28,$f18; bc1t L.875 +la $23,44 +beq $30,$0,L.877 +la $4,L.687 +move $5,$23 +jal printf +L.877: +L.875: +l.d $f28,L.870 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f28; cvt.d.w $f28,$f28 +l.d $f18,L.416 +c.eq.d $f28,$f18; bc1t L.879 +la $23,45 +beq $30,$0,L.881 +la $4,L.687 +move $5,$23 +jal printf +L.881: +L.879: +l.d $f28,L.870 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f28; cvt.d.w $f28,$f28 +l.d $f18,L.416 +c.eq.d $f28,$f18; bc1t L.883 +la $23,46 +beq $30,$0,L.885 +la $4,L.687 +move $5,$23 +jal printf +L.885: +L.883: +l.d $f28,L.870 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f28,$f18,$f16 +l.d $f18,L.416 +c.eq.d $f28,$f18; bc1t L.887 +la $23,47 +beq $30,$0,L.889 +la $4,L.687 +move $5,$23 +jal printf +L.889: +L.887: +l.d $f28,L.870 +l.s $f26,L.529 +cvt.d.s $f28,$f26 +l.d $f18,L.416 +c.eq.d $f28,$f18; bc1t L.891 +la $23,48 +beq $30,$0,L.893 +la $4,L.687 +move $5,$23 +jal printf +L.893: +L.891: +l.d $f28,L.870 +l.d $f18,L.416 +mov.d $f24,$f18 +mov.d $f28,$f24 +c.eq.d $f28,$f18; bc1t L.895 +la $23,49 +beq $30,$0,L.897 +la $4,L.687 +move $5,$23 +jal printf +L.897: +L.895: +la $22,5 +la $17,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +addu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,7 +beq $24,$15,L.899 +la $23,50 +beq $30,$0,L.901 +la $4,L.687 +move $5,$23 +jal printf +L.901: +L.899: +la $22,5 +la $16,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +addu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,7 +beq $24,$15,L.903 +la $23,51 +beq $30,$0,L.905 +la $4,L.687 +move $5,$23 +jal printf +L.905: +L.903: +la $22,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +addu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,7 +beq $24,$15,L.907 +la $23,52 +beq $30,$0,L.909 +la $4,L.687 +move $5,$23 +jal printf +L.909: +L.907: +la $22,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +addu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,7 +beq $24,$15,L.911 +la $23,53 +beq $30,$0,L.913 +la $4,L.687 +move $5,$23 +jal printf +L.913: +L.911: +la $22,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +addu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,7 +beq $24,$15,L.915 +la $23,54 +beq $30,$0,L.917 +la $4,L.687 +move $5,$23 +jal printf +L.917: +L.915: +la $22,5 +l.s $f26,L.529 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +add.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,7 +beq $24,$15,L.919 +la $23,55 +beq $30,$0,L.921 +la $4,L.687 +move $5,$23 +jal printf +L.921: +L.919: +la $22,5 +l.d $f24,L.416 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +add.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,7 +beq $24,$15,L.923 +la $23,56 +beq $30,$0,L.925 +la $4,L.687 +move $5,$23 +jal printf +L.925: +L.923: +la $21,5 +la $17,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +addu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,7 +beq $24,$15,L.927 +la $23,57 +beq $30,$0,L.929 +la $4,L.687 +move $5,$23 +jal printf +L.929: +L.927: +la $21,5 +la $16,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +addu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,7 +beq $24,$15,L.931 +la $23,58 +beq $30,$0,L.933 +la $4,L.687 +move $5,$23 +jal printf +L.933: +L.931: +la $21,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +addu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,7 +beq $24,$15,L.935 +la $23,59 +beq $30,$0,L.937 +la $4,L.687 +move $5,$23 +jal printf +L.937: +L.935: +la $21,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +addu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,7 +beq $24,$15,L.939 +la $23,60 +beq $30,$0,L.941 +la $4,L.687 +move $5,$23 +jal printf +L.941: +L.939: +la $21,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +addu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,7 +beq $24,$15,L.943 +la $23,61 +beq $30,$0,L.945 +la $4,L.687 +move $5,$23 +jal printf +L.945: +L.943: +la $21,5 +l.s $f26,L.529 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +add.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,7 +beq $24,$15,L.947 +la $23,62 +beq $30,$0,L.949 +la $4,L.687 +move $5,$23 +jal printf +L.949: +L.947: +la $21,5 +l.d $f24,L.416 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +add.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,7 +beq $24,$15,L.951 +la $23,63 +beq $30,$0,L.953 +la $4,L.687 +move $5,$23 +jal printf +L.953: +L.951: +la $20,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +addu $20,$20,$24 +la $24,7 +beq $20,$24,L.955 +la $23,64 +beq $30,$0,L.957 +la $4,L.687 +move $5,$23 +jal printf +L.957: +L.955: +la $20,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +addu $20,$20,$24 +la $24,7 +beq $20,$24,L.959 +la $23,65 +beq $30,$0,L.961 +la $4,L.687 +move $5,$23 +jal printf +L.961: +L.959: +la $20,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +addu $20,$20,$24 +la $24,7 +beq $20,$24,L.963 +la $23,66 +beq $30,$0,L.965 +la $4,L.687 +move $5,$23 +jal printf +L.965: +L.963: +la $20,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +addu $20,$20,$24 +la $24,7 +beq $20,$24,L.967 +la $23,67 +beq $30,$0,L.969 +la $4,L.687 +move $5,$23 +jal printf +L.969: +L.967: +la $20,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$20 +lw $15,-12+160($sp) +addu $24,$24,$15 +move $20,$24 +la $24,7 +beq $20,$24,L.971 +la $23,68 +beq $30,$0,L.973 +la $4,L.687 +move $5,$23 +jal printf +L.973: +L.971: +la $20,5 +l.s $f26,L.529 +mtc1 $20,$f18; cvt.s.w $f18,$f18 +add.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$20; mfc1 $20,$f2 +la $24,7 +beq $20,$24,L.975 +la $23,69 +beq $30,$0,L.977 +la $4,L.687 +move $5,$23 +jal printf +L.977: +L.975: +la $20,5 +l.d $f24,L.416 +mtc1 $20,$f18; cvt.d.w $f18,$f18 +add.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$20; mfc1 $20,$f2 +la $24,7 +beq $20,$24,L.979 +la $23,70 +beq $30,$0,L.981 +la $4,L.687 +move $5,$23 +jal printf +L.981: +L.979: +la $19,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +addu $19,$19,$24 +la $24,7 +beq $19,$24,L.983 +la $23,71 +beq $30,$0,L.985 +la $4,L.687 +move $5,$23 +jal printf +L.985: +L.983: +la $19,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +addu $19,$19,$24 +la $24,7 +beq $19,$24,L.987 +la $23,72 +beq $30,$0,L.989 +la $4,L.687 +move $5,$23 +jal printf +L.989: +L.987: +la $19,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +addu $19,$19,$24 +la $24,7 +beq $19,$24,L.991 +la $23,73 +beq $30,$0,L.993 +la $4,L.687 +move $5,$23 +jal printf +L.993: +L.991: +la $19,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +addu $19,$19,$24 +la $24,7 +beq $19,$24,L.995 +la $23,74 +beq $30,$0,L.997 +la $4,L.687 +move $5,$23 +jal printf +L.997: +L.995: +la $19,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$19 +lw $15,-12+160($sp) +addu $24,$24,$15 +move $19,$24 +la $24,7 +beq $19,$24,L.999 +la $23,75 +beq $30,$0,L.1001 +la $4,L.687 +move $5,$23 +jal printf +L.1001: +L.999: +la $19,5 +l.s $f26,L.529 +mtc1 $19,$f18; cvt.s.w $f18,$f18 +add.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$19; mfc1 $19,$f2 +la $24,7 +beq $19,$24,L.1003 +la $23,76 +beq $30,$0,L.1005 +la $4,L.687 +move $5,$23 +jal printf +L.1005: +L.1003: +la $19,5 +l.d $f24,L.416 +mtc1 $19,$f18; cvt.d.w $f18,$f18 +add.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$19; mfc1 $19,$f2 +la $24,7 +beq $19,$24,L.1007 +la $23,77 +beq $30,$0,L.1009 +la $4,L.687 +move $5,$23 +jal printf +L.1009: +L.1007: +la $18,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +addu $18,$18,$24 +la $24,7 +beq $18,$24,L.1011 +la $23,78 +beq $30,$0,L.1013 +la $4,L.687 +move $5,$23 +jal printf +L.1013: +L.1011: +la $18,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +addu $18,$18,$24 +la $24,7 +beq $18,$24,L.1015 +la $23,79 +beq $30,$0,L.1017 +la $4,L.687 +move $5,$23 +jal printf +L.1017: +L.1015: +la $18,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +addu $18,$18,$24 +la $24,7 +beq $18,$24,L.1019 +la $23,80 +beq $30,$0,L.1021 +la $4,L.687 +move $5,$23 +jal printf +L.1021: +L.1019: +la $18,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +addu $18,$18,$24 +la $24,7 +beq $18,$24,L.1023 +la $23,81 +beq $30,$0,L.1025 +la $4,L.687 +move $5,$23 +jal printf +L.1025: +L.1023: +la $18,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +addu $18,$18,$24 +la $24,7 +beq $18,$24,L.1027 +la $23,82 +beq $30,$0,L.1029 +la $4,L.687 +move $5,$23 +jal printf +L.1029: +L.1027: +la $18,5 +l.s $f26,L.529 +l.d $f18,L.596 +srl $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +add.s $f18,$f18,$f26 +l.s $f16,L.828 +c.ult.s $f18,$f16; bc1t L.1032 +sub.s $f16,$f18,$f16 +trunc.w.s $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-36+160($sp) +b L.1033 +L.1032: +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-36+160($sp) +L.1033: +lw $18,-36+160($sp) +la $24,7 +beq $18,$24,L.1034 +la $23,83 +beq $30,$0,L.1036 +la $4,L.687 +move $5,$23 +jal printf +L.1036: +L.1034: +la $18,5 +l.d $f24,L.416 +l.d $f18,L.596 +srl $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +add.d $f18,$f18,$f24 +l.d $f16,L.836 +c.ult.d $f18,$f16; bc1t L.1039 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-40+160($sp) +b L.1040 +L.1039: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-40+160($sp) +L.1040: +lw $18,-40+160($sp) +la $24,7 +beq $18,$24,L.1041 +la $23,84 +beq $30,$0,L.1043 +la $4,L.687 +move $5,$23 +jal printf +L.1043: +L.1041: +l.s $f30,L.841 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +add.s $f30,$f30,$f18 +l.s $f18,L.1047 +c.eq.s $f30,$f18; bc1t L.1045 +la $23,85 +beq $30,$0,L.1048 +la $4,L.687 +move $5,$23 +jal printf +L.1048: +L.1045: +l.s $f30,L.841 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +add.s $f30,$f30,$f18 +l.s $f18,L.1047 +c.eq.s $f30,$f18; bc1t L.1050 +la $23,86 +beq $30,$0,L.1052 +la $4,L.687 +move $5,$23 +jal printf +L.1052: +L.1050: +l.s $f30,L.841 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +add.s $f30,$f30,$f18 +l.s $f18,L.1047 +c.eq.s $f30,$f18; bc1t L.1054 +la $23,87 +beq $30,$0,L.1056 +la $4,L.687 +move $5,$23 +jal printf +L.1056: +L.1054: +l.s $f30,L.841 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +add.s $f30,$f30,$f18 +l.s $f18,L.1047 +c.eq.s $f30,$f18; bc1t L.1058 +la $23,88 +beq $30,$0,L.1060 +la $4,L.687 +move $5,$23 +jal printf +L.1060: +L.1058: +l.s $f30,L.841 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +add.s $f30,$f30,$f18 +l.s $f18,L.1047 +c.eq.s $f30,$f18; bc1t L.1062 +la $23,89 +beq $30,$0,L.1064 +la $4,L.687 +move $5,$23 +jal printf +L.1064: +L.1062: +l.s $f30,L.841 +l.s $f26,L.529 +add.s $f30,$f30,$f26 +l.s $f18,L.1047 +c.eq.s $f30,$f18; bc1t L.1066 +la $23,90 +beq $30,$0,L.1068 +la $4,L.687 +move $5,$23 +jal printf +L.1068: +L.1066: +l.s $f30,L.841 +l.d $f24,L.416 +cvt.d.s $f18,$f30 +add.d $f18,$f18,$f24 +cvt.s.d $f30,$f18 +l.s $f18,L.1047 +c.eq.s $f30,$f18; bc1t L.1070 +la $23,91 +beq $30,$0,L.1072 +la $4,L.687 +move $5,$23 +jal printf +L.1072: +L.1070: +l.d $f28,L.870 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +add.d $f28,$f28,$f18 +l.d $f18,L.1076 +c.eq.d $f28,$f18; bc1t L.1074 +la $23,92 +beq $30,$0,L.1077 +la $4,L.687 +move $5,$23 +jal printf +L.1077: +L.1074: +l.d $f28,L.870 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +add.d $f28,$f28,$f18 +l.d $f18,L.1076 +c.eq.d $f28,$f18; bc1t L.1079 +la $23,93 +beq $30,$0,L.1081 +la $4,L.687 +move $5,$23 +jal printf +L.1081: +L.1079: +l.d $f28,L.870 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +add.d $f28,$f28,$f18 +l.d $f18,L.1076 +c.eq.d $f28,$f18; bc1t L.1083 +la $23,94 +beq $30,$0,L.1085 +la $4,L.687 +move $5,$23 +jal printf +L.1085: +L.1083: +l.d $f28,L.870 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +add.d $f28,$f28,$f18 +l.d $f18,L.1076 +c.eq.d $f28,$f18; bc1t L.1087 +la $23,95 +beq $30,$0,L.1089 +la $4,L.687 +move $5,$23 +jal printf +L.1089: +L.1087: +l.d $f28,L.870 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +add.d $f28,$f28,$f18 +l.d $f18,L.1076 +c.eq.d $f28,$f18; bc1t L.1091 +la $23,96 +beq $30,$0,L.1093 +la $4,L.687 +move $5,$23 +jal printf +L.1093: +L.1091: +l.d $f28,L.870 +l.s $f26,L.529 +cvt.d.s $f18,$f26 +add.d $f28,$f28,$f18 +l.d $f18,L.1076 +c.eq.d $f28,$f18; bc1t L.1095 +la $23,97 +beq $30,$0,L.1097 +la $4,L.687 +move $5,$23 +jal printf +L.1097: +L.1095: +l.d $f28,L.870 +l.d $f24,L.416 +add.d $f28,$f28,$f24 +l.d $f18,L.1076 +c.eq.d $f28,$f18; bc1t L.1099 +la $23,98 +beq $30,$0,L.1101 +la $4,L.687 +move $5,$23 +jal printf +L.1101: +L.1099: +la $22,5 +la $17,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +subu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,3 +beq $24,$15,L.1103 +la $23,99 +beq $30,$0,L.1105 +la $4,L.687 +move $5,$23 +jal printf +L.1105: +L.1103: +la $22,5 +la $16,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +subu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,3 +beq $24,$15,L.1107 +la $23,100 +beq $30,$0,L.1109 +la $4,L.687 +move $5,$23 +jal printf +L.1109: +L.1107: +la $22,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +subu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,3 +beq $24,$15,L.1111 +la $23,101 +beq $30,$0,L.1113 +la $4,L.687 +move $5,$23 +jal printf +L.1113: +L.1111: +la $22,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +subu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,3 +beq $24,$15,L.1115 +la $23,102 +beq $30,$0,L.1117 +la $4,L.687 +move $5,$23 +jal printf +L.1117: +L.1115: +la $22,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +subu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,3 +beq $24,$15,L.1119 +la $23,103 +beq $30,$0,L.1121 +la $4,L.687 +move $5,$23 +jal printf +L.1121: +L.1119: +la $22,5 +l.s $f26,L.529 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +sub.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,3 +beq $24,$15,L.1123 +la $23,104 +beq $30,$0,L.1125 +la $4,L.687 +move $5,$23 +jal printf +L.1125: +L.1123: +la $22,5 +l.d $f24,L.416 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +sub.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,3 +beq $24,$15,L.1127 +la $23,105 +beq $30,$0,L.1129 +la $4,L.687 +move $5,$23 +jal printf +L.1129: +L.1127: +la $21,5 +la $17,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +subu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,3 +beq $24,$15,L.1131 +la $23,106 +beq $30,$0,L.1133 +la $4,L.687 +move $5,$23 +jal printf +L.1133: +L.1131: +la $21,5 +la $16,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +subu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,3 +beq $24,$15,L.1135 +la $23,107 +beq $30,$0,L.1137 +la $4,L.687 +move $5,$23 +jal printf +L.1137: +L.1135: +la $21,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +subu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,3 +beq $24,$15,L.1139 +la $23,108 +beq $30,$0,L.1141 +la $4,L.687 +move $5,$23 +jal printf +L.1141: +L.1139: +la $21,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +subu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,3 +beq $24,$15,L.1143 +la $23,109 +beq $30,$0,L.1145 +la $4,L.687 +move $5,$23 +jal printf +L.1145: +L.1143: +la $21,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +subu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,3 +beq $24,$15,L.1147 +la $23,110 +beq $30,$0,L.1149 +la $4,L.687 +move $5,$23 +jal printf +L.1149: +L.1147: +la $21,5 +l.s $f26,L.529 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +sub.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,3 +beq $24,$15,L.1151 +la $23,111 +beq $30,$0,L.1153 +la $4,L.687 +move $5,$23 +jal printf +L.1153: +L.1151: +la $21,5 +l.d $f24,L.416 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +sub.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,3 +beq $24,$15,L.1155 +la $23,112 +beq $30,$0,L.1157 +la $4,L.687 +move $5,$23 +jal printf +L.1157: +L.1155: +la $20,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +subu $20,$20,$24 +la $24,3 +beq $20,$24,L.1159 +la $23,113 +beq $30,$0,L.1161 +la $4,L.687 +move $5,$23 +jal printf +L.1161: +L.1159: +la $20,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +subu $20,$20,$24 +la $24,3 +beq $20,$24,L.1163 +la $23,114 +beq $30,$0,L.1165 +la $4,L.687 +move $5,$23 +jal printf +L.1165: +L.1163: +la $20,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +subu $20,$20,$24 +la $24,3 +beq $20,$24,L.1167 +la $23,115 +beq $30,$0,L.1169 +la $4,L.687 +move $5,$23 +jal printf +L.1169: +L.1167: +la $20,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +subu $20,$20,$24 +la $24,3 +beq $20,$24,L.1171 +la $23,116 +beq $30,$0,L.1173 +la $4,L.687 +move $5,$23 +jal printf +L.1173: +L.1171: +la $20,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$20 +lw $15,-12+160($sp) +subu $24,$24,$15 +move $20,$24 +la $24,3 +beq $20,$24,L.1175 +la $23,117 +beq $30,$0,L.1177 +la $4,L.687 +move $5,$23 +jal printf +L.1177: +L.1175: +la $20,5 +l.s $f26,L.529 +mtc1 $20,$f18; cvt.s.w $f18,$f18 +sub.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$20; mfc1 $20,$f2 +la $24,3 +beq $20,$24,L.1179 +la $23,118 +beq $30,$0,L.1181 +la $4,L.687 +move $5,$23 +jal printf +L.1181: +L.1179: +la $20,5 +l.d $f24,L.416 +mtc1 $20,$f18; cvt.d.w $f18,$f18 +sub.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$20; mfc1 $20,$f2 +la $24,3 +beq $20,$24,L.1183 +la $23,119 +beq $30,$0,L.1185 +la $4,L.687 +move $5,$23 +jal printf +L.1185: +L.1183: +la $19,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +subu $19,$19,$24 +la $24,3 +beq $19,$24,L.1187 +la $23,120 +beq $30,$0,L.1189 +la $4,L.687 +move $5,$23 +jal printf +L.1189: +L.1187: +la $19,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +subu $19,$19,$24 +la $24,3 +beq $19,$24,L.1191 +la $23,121 +beq $30,$0,L.1193 +la $4,L.687 +move $5,$23 +jal printf +L.1193: +L.1191: +la $19,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +subu $19,$19,$24 +la $24,3 +beq $19,$24,L.1195 +la $23,122 +beq $30,$0,L.1197 +la $4,L.687 +move $5,$23 +jal printf +L.1197: +L.1195: +la $19,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +subu $19,$19,$24 +la $24,3 +beq $19,$24,L.1199 +la $23,123 +beq $30,$0,L.1201 +la $4,L.687 +move $5,$23 +jal printf +L.1201: +L.1199: +la $19,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$19 +lw $15,-12+160($sp) +subu $24,$24,$15 +move $19,$24 +la $24,3 +beq $19,$24,L.1203 +la $23,124 +beq $30,$0,L.1205 +la $4,L.687 +move $5,$23 +jal printf +L.1205: +L.1203: +la $19,5 +l.s $f26,L.529 +mtc1 $19,$f18; cvt.s.w $f18,$f18 +sub.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$19; mfc1 $19,$f2 +la $24,3 +beq $19,$24,L.1207 +la $23,125 +beq $30,$0,L.1209 +la $4,L.687 +move $5,$23 +jal printf +L.1209: +L.1207: +la $19,5 +l.d $f24,L.416 +mtc1 $19,$f18; cvt.d.w $f18,$f18 +sub.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$19; mfc1 $19,$f2 +la $24,3 +beq $19,$24,L.1211 +la $23,126 +beq $30,$0,L.1213 +la $4,L.687 +move $5,$23 +jal printf +L.1213: +L.1211: +la $18,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +subu $18,$18,$24 +la $24,3 +beq $18,$24,L.1215 +la $23,127 +beq $30,$0,L.1217 +la $4,L.687 +move $5,$23 +jal printf +L.1217: +L.1215: +la $18,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +subu $18,$18,$24 +la $24,3 +beq $18,$24,L.1219 +la $23,128 +beq $30,$0,L.1221 +la $4,L.687 +move $5,$23 +jal printf +L.1221: +L.1219: +la $18,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +subu $18,$18,$24 +la $24,3 +beq $18,$24,L.1223 +la $23,129 +beq $30,$0,L.1225 +la $4,L.687 +move $5,$23 +jal printf +L.1225: +L.1223: +la $18,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +subu $18,$18,$24 +la $24,3 +beq $18,$24,L.1227 +la $23,130 +beq $30,$0,L.1229 +la $4,L.687 +move $5,$23 +jal printf +L.1229: +L.1227: +la $18,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +subu $18,$18,$24 +la $24,3 +beq $18,$24,L.1231 +la $23,131 +beq $30,$0,L.1233 +la $4,L.687 +move $5,$23 +jal printf +L.1233: +L.1231: +la $18,5 +l.s $f26,L.529 +l.d $f18,L.596 +srl $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +sub.s $f18,$f18,$f26 +l.s $f16,L.828 +c.ult.s $f18,$f16; bc1t L.1236 +sub.s $f16,$f18,$f16 +trunc.w.s $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-44+160($sp) +b L.1237 +L.1236: +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-44+160($sp) +L.1237: +lw $18,-44+160($sp) +la $24,3 +beq $18,$24,L.1238 +la $23,132 +beq $30,$0,L.1240 +la $4,L.687 +move $5,$23 +jal printf +L.1240: +L.1238: +la $18,5 +l.d $f24,L.416 +l.d $f18,L.596 +srl $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +sub.d $f18,$f18,$f24 +l.d $f16,L.836 +c.ult.d $f18,$f16; bc1t L.1243 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-48+160($sp) +b L.1244 +L.1243: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-48+160($sp) +L.1244: +lw $18,-48+160($sp) +la $24,3 +beq $18,$24,L.1245 +la $23,133 +beq $30,$0,L.1247 +la $4,L.687 +move $5,$23 +jal printf +L.1247: +L.1245: +l.s $f30,L.841 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +sub.s $f30,$f30,$f18 +l.s $f18,L.1251 +c.eq.s $f30,$f18; bc1t L.1249 +la $23,134 +beq $30,$0,L.1252 +la $4,L.687 +move $5,$23 +jal printf +L.1252: +L.1249: +l.s $f30,L.841 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +sub.s $f30,$f30,$f18 +l.s $f18,L.1251 +c.eq.s $f30,$f18; bc1t L.1254 +la $23,135 +beq $30,$0,L.1256 +la $4,L.687 +move $5,$23 +jal printf +L.1256: +L.1254: +l.s $f30,L.841 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +sub.s $f30,$f30,$f18 +l.s $f18,L.1251 +c.eq.s $f30,$f18; bc1t L.1258 +la $23,136 +beq $30,$0,L.1260 +la $4,L.687 +move $5,$23 +jal printf +L.1260: +L.1258: +l.s $f30,L.841 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +sub.s $f30,$f30,$f18 +l.s $f18,L.1251 +c.eq.s $f30,$f18; bc1t L.1262 +la $23,137 +beq $30,$0,L.1264 +la $4,L.687 +move $5,$23 +jal printf +L.1264: +L.1262: +l.s $f30,L.841 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +sub.s $f30,$f30,$f18 +l.s $f18,L.1251 +c.eq.s $f30,$f18; bc1t L.1266 +la $23,138 +beq $30,$0,L.1268 +la $4,L.687 +move $5,$23 +jal printf +L.1268: +L.1266: +l.s $f30,L.841 +l.s $f26,L.529 +sub.s $f30,$f30,$f26 +l.s $f18,L.1251 +c.eq.s $f30,$f18; bc1t L.1270 +la $23,139 +beq $30,$0,L.1272 +la $4,L.687 +move $5,$23 +jal printf +L.1272: +L.1270: +l.s $f30,L.841 +l.d $f24,L.416 +cvt.d.s $f18,$f30 +sub.d $f18,$f18,$f24 +cvt.s.d $f30,$f18 +l.s $f18,L.1251 +c.eq.s $f30,$f18; bc1t L.1274 +la $23,140 +beq $30,$0,L.1276 +la $4,L.687 +move $5,$23 +jal printf +L.1276: +L.1274: +l.d $f28,L.870 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +sub.d $f28,$f28,$f18 +l.d $f18,L.1280 +c.eq.d $f28,$f18; bc1t L.1278 +la $23,141 +beq $30,$0,L.1281 +la $4,L.687 +move $5,$23 +jal printf +L.1281: +L.1278: +l.d $f28,L.870 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +sub.d $f28,$f28,$f18 +l.d $f18,L.1280 +c.eq.d $f28,$f18; bc1t L.1283 +la $23,142 +beq $30,$0,L.1285 +la $4,L.687 +move $5,$23 +jal printf +L.1285: +L.1283: +l.d $f28,L.870 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +sub.d $f28,$f28,$f18 +l.d $f18,L.1280 +c.eq.d $f28,$f18; bc1t L.1287 +la $23,143 +beq $30,$0,L.1289 +la $4,L.687 +move $5,$23 +jal printf +L.1289: +L.1287: +l.d $f28,L.870 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +sub.d $f28,$f28,$f18 +l.d $f18,L.1280 +c.eq.d $f28,$f18; bc1t L.1291 +la $23,144 +beq $30,$0,L.1293 +la $4,L.687 +move $5,$23 +jal printf +L.1293: +L.1291: +l.d $f28,L.870 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +sub.d $f28,$f28,$f18 +l.d $f18,L.1280 +c.eq.d $f28,$f18; bc1t L.1295 +la $23,145 +beq $30,$0,L.1297 +la $4,L.687 +move $5,$23 +jal printf +L.1297: +L.1295: +l.d $f28,L.870 +l.s $f26,L.529 +cvt.d.s $f18,$f26 +sub.d $f28,$f28,$f18 +l.d $f18,L.1280 +c.eq.d $f28,$f18; bc1t L.1299 +la $23,146 +beq $30,$0,L.1301 +la $4,L.687 +move $5,$23 +jal printf +L.1301: +L.1299: +l.d $f28,L.870 +l.d $f24,L.416 +sub.d $f28,$f28,$f24 +l.d $f18,L.1280 +c.eq.d $f28,$f18; bc1t L.1303 +la $23,147 +beq $30,$0,L.1305 +la $4,L.687 +move $5,$23 +jal printf +L.1305: +L.1303: +la $22,5 +la $17,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +mul $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,10 +beq $24,$15,L.1307 +la $23,148 +beq $30,$0,L.1309 +la $4,L.687 +move $5,$23 +jal printf +L.1309: +L.1307: +la $22,5 +la $16,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +mul $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,10 +beq $24,$15,L.1311 +la $23,149 +beq $30,$0,L.1313 +la $4,L.687 +move $5,$23 +jal printf +L.1313: +L.1311: +la $22,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +mul $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,10 +beq $24,$15,L.1315 +la $23,150 +beq $30,$0,L.1317 +la $4,L.687 +move $5,$23 +jal printf +L.1317: +L.1315: +la $22,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +mul $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,10 +beq $24,$15,L.1319 +la $23,151 +beq $30,$0,L.1321 +la $4,L.687 +move $5,$23 +jal printf +L.1321: +L.1319: +la $22,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +mul $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,10 +beq $24,$15,L.1323 +la $23,152 +beq $30,$0,L.1325 +la $4,L.687 +move $5,$23 +jal printf +L.1325: +L.1323: +la $22,5 +l.s $f26,L.529 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,10 +beq $24,$15,L.1327 +la $23,153 +beq $30,$0,L.1329 +la $4,L.687 +move $5,$23 +jal printf +L.1329: +L.1327: +la $22,5 +l.d $f24,L.416 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,10 +beq $24,$15,L.1331 +la $23,154 +beq $30,$0,L.1333 +la $4,L.687 +move $5,$23 +jal printf +L.1333: +L.1331: +la $21,5 +la $17,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +mul $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,10 +beq $24,$15,L.1335 +la $23,155 +beq $30,$0,L.1337 +la $4,L.687 +move $5,$23 +jal printf +L.1337: +L.1335: +la $21,5 +la $16,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +mul $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,10 +beq $24,$15,L.1339 +la $23,156 +beq $30,$0,L.1341 +la $4,L.687 +move $5,$23 +jal printf +L.1341: +L.1339: +la $21,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +mul $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,10 +beq $24,$15,L.1343 +la $23,157 +beq $30,$0,L.1345 +la $4,L.687 +move $5,$23 +jal printf +L.1345: +L.1343: +la $21,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +mul $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,10 +beq $24,$15,L.1347 +la $23,158 +beq $30,$0,L.1349 +la $4,L.687 +move $5,$23 +jal printf +L.1349: +L.1347: +la $21,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +mul $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,10 +beq $24,$15,L.1351 +la $23,159 +beq $30,$0,L.1353 +la $4,L.687 +move $5,$23 +jal printf +L.1353: +L.1351: +la $21,5 +l.s $f26,L.529 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,10 +beq $24,$15,L.1355 +la $23,160 +beq $30,$0,L.1357 +la $4,L.687 +move $5,$23 +jal printf +L.1357: +L.1355: +la $21,5 +l.d $f24,L.416 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,10 +beq $24,$15,L.1359 +la $23,161 +beq $30,$0,L.1361 +la $4,L.687 +move $5,$23 +jal printf +L.1361: +L.1359: +la $20,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mul $20,$20,$24 +la $24,10 +beq $20,$24,L.1363 +la $23,162 +beq $30,$0,L.1365 +la $4,L.687 +move $5,$23 +jal printf +L.1365: +L.1363: +la $20,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mul $20,$20,$24 +la $24,10 +beq $20,$24,L.1367 +la $23,163 +beq $30,$0,L.1369 +la $4,L.687 +move $5,$23 +jal printf +L.1369: +L.1367: +la $20,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mul $20,$20,$24 +la $24,10 +beq $20,$24,L.1371 +la $23,164 +beq $30,$0,L.1373 +la $4,L.687 +move $5,$23 +jal printf +L.1373: +L.1371: +la $20,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mul $20,$20,$24 +la $24,10 +beq $20,$24,L.1375 +la $23,165 +beq $30,$0,L.1377 +la $4,L.687 +move $5,$23 +jal printf +L.1377: +L.1375: +la $20,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$20 +lw $15,-12+160($sp) +mul $24,$24,$15 +move $20,$24 +la $24,10 +beq $20,$24,L.1379 +la $23,166 +beq $30,$0,L.1381 +la $4,L.687 +move $5,$23 +jal printf +L.1381: +L.1379: +la $20,5 +l.s $f26,L.529 +mtc1 $20,$f18; cvt.s.w $f18,$f18 +mul.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$20; mfc1 $20,$f2 +la $24,10 +beq $20,$24,L.1383 +la $23,167 +beq $30,$0,L.1385 +la $4,L.687 +move $5,$23 +jal printf +L.1385: +L.1383: +la $20,5 +l.d $f24,L.416 +mtc1 $20,$f18; cvt.d.w $f18,$f18 +mul.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$20; mfc1 $20,$f2 +la $24,10 +beq $20,$24,L.1387 +la $23,168 +beq $30,$0,L.1389 +la $4,L.687 +move $5,$23 +jal printf +L.1389: +L.1387: +la $19,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mul $19,$19,$24 +la $24,10 +beq $19,$24,L.1391 +la $23,169 +beq $30,$0,L.1393 +la $4,L.687 +move $5,$23 +jal printf +L.1393: +L.1391: +la $19,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mul $19,$19,$24 +la $24,10 +beq $19,$24,L.1395 +la $23,170 +beq $30,$0,L.1397 +la $4,L.687 +move $5,$23 +jal printf +L.1397: +L.1395: +la $19,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mul $19,$19,$24 +la $24,10 +beq $19,$24,L.1399 +la $23,171 +beq $30,$0,L.1401 +la $4,L.687 +move $5,$23 +jal printf +L.1401: +L.1399: +la $19,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mul $19,$19,$24 +la $24,10 +beq $19,$24,L.1403 +la $23,172 +beq $30,$0,L.1405 +la $4,L.687 +move $5,$23 +jal printf +L.1405: +L.1403: +la $19,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$19 +lw $15,-12+160($sp) +mul $24,$24,$15 +move $19,$24 +la $24,10 +beq $19,$24,L.1407 +la $23,173 +beq $30,$0,L.1409 +la $4,L.687 +move $5,$23 +jal printf +L.1409: +L.1407: +la $19,5 +l.s $f26,L.529 +mtc1 $19,$f18; cvt.s.w $f18,$f18 +mul.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$19; mfc1 $19,$f2 +la $24,10 +beq $19,$24,L.1411 +la $23,174 +beq $30,$0,L.1413 +la $4,L.687 +move $5,$23 +jal printf +L.1413: +L.1411: +la $19,5 +l.d $f24,L.416 +mtc1 $19,$f18; cvt.d.w $f18,$f18 +mul.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$19; mfc1 $19,$f2 +la $24,10 +beq $19,$24,L.1415 +la $23,175 +beq $30,$0,L.1417 +la $4,L.687 +move $5,$23 +jal printf +L.1417: +L.1415: +la $18,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mul $18,$18,$24 +la $24,10 +beq $18,$24,L.1419 +la $23,176 +beq $30,$0,L.1421 +la $4,L.687 +move $5,$23 +jal printf +L.1421: +L.1419: +la $18,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mul $18,$18,$24 +la $24,10 +beq $18,$24,L.1423 +la $23,177 +beq $30,$0,L.1425 +la $4,L.687 +move $5,$23 +jal printf +L.1425: +L.1423: +la $18,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mul $18,$18,$24 +la $24,10 +beq $18,$24,L.1427 +la $23,178 +beq $30,$0,L.1429 +la $4,L.687 +move $5,$23 +jal printf +L.1429: +L.1427: +la $18,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mul $18,$18,$24 +la $24,10 +beq $18,$24,L.1431 +la $23,179 +beq $30,$0,L.1433 +la $4,L.687 +move $5,$23 +jal printf +L.1433: +L.1431: +la $18,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +mul $18,$18,$24 +la $24,10 +beq $18,$24,L.1435 +la $23,180 +beq $30,$0,L.1437 +la $4,L.687 +move $5,$23 +jal printf +L.1437: +L.1435: +la $18,5 +l.s $f26,L.529 +l.d $f18,L.596 +srl $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +mul.s $f18,$f18,$f26 +l.s $f16,L.828 +c.ult.s $f18,$f16; bc1t L.1440 +sub.s $f16,$f18,$f16 +trunc.w.s $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-52+160($sp) +b L.1441 +L.1440: +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-52+160($sp) +L.1441: +lw $18,-52+160($sp) +la $24,10 +beq $18,$24,L.1442 +la $23,181 +beq $30,$0,L.1444 +la $4,L.687 +move $5,$23 +jal printf +L.1444: +L.1442: +la $18,5 +l.d $f24,L.416 +l.d $f18,L.596 +srl $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +mul.d $f18,$f18,$f24 +l.d $f16,L.836 +c.ult.d $f18,$f16; bc1t L.1447 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-56+160($sp) +b L.1448 +L.1447: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-56+160($sp) +L.1448: +lw $18,-56+160($sp) +la $24,10 +beq $18,$24,L.1449 +la $23,182 +beq $30,$0,L.1451 +la $4,L.687 +move $5,$23 +jal printf +L.1451: +L.1449: +l.s $f30,L.841 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f30,$f30,$f18 +l.s $f18,L.1455 +c.eq.s $f30,$f18; bc1t L.1453 +la $23,183 +beq $30,$0,L.1456 +la $4,L.687 +move $5,$23 +jal printf +L.1456: +L.1453: +l.s $f30,L.841 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f30,$f30,$f18 +l.s $f18,L.1455 +c.eq.s $f30,$f18; bc1t L.1458 +la $23,184 +beq $30,$0,L.1460 +la $4,L.687 +move $5,$23 +jal printf +L.1460: +L.1458: +l.s $f30,L.841 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f30,$f30,$f18 +l.s $f18,L.1455 +c.eq.s $f30,$f18; bc1t L.1462 +la $23,185 +beq $30,$0,L.1464 +la $4,L.687 +move $5,$23 +jal printf +L.1464: +L.1462: +l.s $f30,L.841 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +mul.s $f30,$f30,$f18 +l.s $f18,L.1455 +c.eq.s $f30,$f18; bc1t L.1466 +la $23,186 +beq $30,$0,L.1468 +la $4,L.687 +move $5,$23 +jal printf +L.1468: +L.1466: +l.s $f30,L.841 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +mul.s $f30,$f30,$f18 +l.s $f18,L.1455 +c.eq.s $f30,$f18; bc1t L.1470 +la $23,187 +beq $30,$0,L.1472 +la $4,L.687 +move $5,$23 +jal printf +L.1472: +L.1470: +l.s $f30,L.841 +l.s $f26,L.529 +mul.s $f30,$f30,$f26 +l.s $f18,L.1455 +c.eq.s $f30,$f18; bc1t L.1474 +la $23,188 +beq $30,$0,L.1476 +la $4,L.687 +move $5,$23 +jal printf +L.1476: +L.1474: +l.s $f30,L.841 +l.d $f24,L.416 +cvt.d.s $f18,$f30 +mul.d $f18,$f18,$f24 +cvt.s.d $f30,$f18 +l.s $f18,L.1455 +c.eq.s $f30,$f18; bc1t L.1478 +la $23,189 +beq $30,$0,L.1480 +la $4,L.687 +move $5,$23 +jal printf +L.1480: +L.1478: +l.d $f28,L.870 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f28,$f28,$f18 +l.d $f18,L.1484 +c.eq.d $f28,$f18; bc1t L.1482 +la $23,190 +beq $30,$0,L.1485 +la $4,L.687 +move $5,$23 +jal printf +L.1485: +L.1482: +l.d $f28,L.870 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f28,$f28,$f18 +l.d $f18,L.1484 +c.eq.d $f28,$f18; bc1t L.1487 +la $23,191 +beq $30,$0,L.1489 +la $4,L.687 +move $5,$23 +jal printf +L.1489: +L.1487: +l.d $f28,L.870 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f28,$f28,$f18 +l.d $f18,L.1484 +c.eq.d $f28,$f18; bc1t L.1491 +la $23,192 +beq $30,$0,L.1493 +la $4,L.687 +move $5,$23 +jal printf +L.1493: +L.1491: +l.d $f28,L.870 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +mul.d $f28,$f28,$f18 +l.d $f18,L.1484 +c.eq.d $f28,$f18; bc1t L.1495 +la $23,193 +beq $30,$0,L.1497 +la $4,L.687 +move $5,$23 +jal printf +L.1497: +L.1495: +l.d $f28,L.870 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +mul.d $f28,$f28,$f18 +l.d $f18,L.1484 +c.eq.d $f28,$f18; bc1t L.1499 +la $23,194 +beq $30,$0,L.1501 +la $4,L.687 +move $5,$23 +jal printf +L.1501: +L.1499: +l.d $f28,L.870 +l.s $f26,L.529 +cvt.d.s $f18,$f26 +mul.d $f28,$f28,$f18 +l.d $f18,L.1484 +c.eq.d $f28,$f18; bc1t L.1503 +la $23,195 +beq $30,$0,L.1505 +la $4,L.687 +move $5,$23 +jal printf +L.1505: +L.1503: +l.d $f28,L.870 +l.d $f24,L.416 +mul.d $f28,$f28,$f24 +l.d $f18,L.1484 +c.eq.d $f28,$f18; bc1t L.1507 +la $23,196 +beq $30,$0,L.1509 +la $4,L.687 +move $5,$23 +jal printf +L.1509: +L.1507: +la $22,5 +la $17,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +div $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.1511 +la $23,197 +beq $30,$0,L.1513 +la $4,L.687 +move $5,$23 +jal printf +L.1513: +L.1511: +la $22,5 +la $16,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +div $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.1515 +la $23,198 +beq $30,$0,L.1517 +la $4,L.687 +move $5,$23 +jal printf +L.1517: +L.1515: +la $22,5 +la $24,2 +sw $24,-4+160($sp) +sll $15,$22,8*(4-1); sra $15,$15,8*(4-1) +lw $14,-4+160($sp) +div $15,$15,$14 +move $22,$15 +sll $15,$22,8*(4-1); sra $15,$15,8*(4-1) +beq $15,$24,L.1519 +la $23,199 +beq $30,$0,L.1521 +la $4,L.687 +move $5,$23 +jal printf +L.1521: +L.1519: +la $22,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +div $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.1523 +la $23,200 +beq $30,$0,L.1525 +la $4,L.687 +move $5,$23 +jal printf +L.1525: +L.1523: +la $22,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +divu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.1527 +la $23,201 +beq $30,$0,L.1529 +la $4,L.687 +move $5,$23 +jal printf +L.1529: +L.1527: +la $22,5 +l.s $f26,L.529 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +div.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.1531 +la $23,202 +beq $30,$0,L.1533 +la $4,L.687 +move $5,$23 +jal printf +L.1533: +L.1531: +la $22,5 +l.d $f24,L.416 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +div.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,2 +beq $24,$15,L.1535 +la $23,203 +beq $30,$0,L.1537 +la $4,L.687 +move $5,$23 +jal printf +L.1537: +L.1535: +la $21,5 +la $17,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +div $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.1539 +la $23,204 +beq $30,$0,L.1541 +la $4,L.687 +move $5,$23 +jal printf +L.1541: +L.1539: +la $21,5 +la $16,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +div $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.1543 +la $23,205 +beq $30,$0,L.1545 +la $4,L.687 +move $5,$23 +jal printf +L.1545: +L.1543: +la $21,5 +la $24,2 +sw $24,-4+160($sp) +sll $15,$21,8*(4-2); sra $15,$15,8*(4-2) +lw $14,-4+160($sp) +div $15,$15,$14 +move $21,$15 +sll $15,$21,8*(4-2); sra $15,$15,8*(4-2) +beq $15,$24,L.1547 +la $23,206 +beq $30,$0,L.1549 +la $4,L.687 +move $5,$23 +jal printf +L.1549: +L.1547: +la $21,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +div $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.1551 +la $23,207 +beq $30,$0,L.1553 +la $4,L.687 +move $5,$23 +jal printf +L.1553: +L.1551: +la $21,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +divu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.1555 +la $23,208 +beq $30,$0,L.1557 +la $4,L.687 +move $5,$23 +jal printf +L.1557: +L.1555: +la $21,5 +l.s $f26,L.529 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +div.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.1559 +la $23,209 +beq $30,$0,L.1561 +la $4,L.687 +move $5,$23 +jal printf +L.1561: +L.1559: +la $21,5 +l.d $f24,L.416 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +div.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,2 +beq $24,$15,L.1563 +la $23,210 +beq $30,$0,L.1565 +la $4,L.687 +move $5,$23 +jal printf +L.1565: +L.1563: +la $20,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +div $20,$20,$24 +la $24,2 +beq $20,$24,L.1567 +la $23,211 +beq $30,$0,L.1569 +la $4,L.687 +move $5,$23 +jal printf +L.1569: +L.1567: +la $20,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +div $20,$20,$24 +la $24,2 +beq $20,$24,L.1571 +la $23,212 +beq $30,$0,L.1573 +la $4,L.687 +move $5,$23 +jal printf +L.1573: +L.1571: +la $20,5 +la $24,2 +sw $24,-4+160($sp) +lw $15,-4+160($sp) +div $20,$20,$15 +beq $20,$24,L.1575 +la $23,213 +beq $30,$0,L.1577 +la $4,L.687 +move $5,$23 +jal printf +L.1577: +L.1575: +la $20,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +div $20,$20,$24 +la $24,2 +beq $20,$24,L.1579 +la $23,214 +beq $30,$0,L.1581 +la $4,L.687 +move $5,$23 +jal printf +L.1581: +L.1579: +la $20,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$20 +lw $15,-12+160($sp) +divu $24,$24,$15 +move $20,$24 +la $24,2 +beq $20,$24,L.1583 +la $23,215 +beq $30,$0,L.1585 +la $4,L.687 +move $5,$23 +jal printf +L.1585: +L.1583: +la $20,5 +l.s $f26,L.529 +mtc1 $20,$f18; cvt.s.w $f18,$f18 +div.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$20; mfc1 $20,$f2 +la $24,2 +beq $20,$24,L.1587 +la $23,216 +beq $30,$0,L.1589 +la $4,L.687 +move $5,$23 +jal printf +L.1589: +L.1587: +la $20,5 +l.d $f24,L.416 +mtc1 $20,$f18; cvt.d.w $f18,$f18 +div.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$20; mfc1 $20,$f2 +la $24,2 +beq $20,$24,L.1591 +la $23,217 +beq $30,$0,L.1593 +la $4,L.687 +move $5,$23 +jal printf +L.1593: +L.1591: +la $19,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +div $19,$19,$24 +la $24,2 +beq $19,$24,L.1595 +la $23,218 +beq $30,$0,L.1597 +la $4,L.687 +move $5,$23 +jal printf +L.1597: +L.1595: +la $19,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +div $19,$19,$24 +la $24,2 +beq $19,$24,L.1599 +la $23,219 +beq $30,$0,L.1601 +la $4,L.687 +move $5,$23 +jal printf +L.1601: +L.1599: +la $19,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +div $19,$19,$24 +la $24,2 +beq $19,$24,L.1603 +la $23,220 +beq $30,$0,L.1605 +la $4,L.687 +move $5,$23 +jal printf +L.1605: +L.1603: +la $19,5 +la $24,2 +sw $24,-8+160($sp) +lw $15,-8+160($sp) +div $19,$19,$15 +beq $19,$24,L.1607 +la $23,221 +beq $30,$0,L.1609 +la $4,L.687 +move $5,$23 +jal printf +L.1609: +L.1607: +la $19,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$19 +lw $15,-12+160($sp) +divu $24,$24,$15 +move $19,$24 +la $24,2 +beq $19,$24,L.1611 +la $23,222 +beq $30,$0,L.1613 +la $4,L.687 +move $5,$23 +jal printf +L.1613: +L.1611: +la $19,5 +l.s $f26,L.529 +mtc1 $19,$f18; cvt.s.w $f18,$f18 +div.s $f18,$f18,$f26 +trunc.w.s $f2,$f18,$19; mfc1 $19,$f2 +la $24,2 +beq $19,$24,L.1615 +la $23,223 +beq $30,$0,L.1617 +la $4,L.687 +move $5,$23 +jal printf +L.1617: +L.1615: +la $19,5 +l.d $f24,L.416 +mtc1 $19,$f18; cvt.d.w $f18,$f18 +div.d $f18,$f18,$f24 +trunc.w.d $f2,$f18,$19; mfc1 $19,$f2 +la $24,2 +beq $19,$24,L.1619 +la $23,224 +beq $30,$0,L.1621 +la $4,L.687 +move $5,$23 +jal printf +L.1621: +L.1619: +la $18,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +divu $18,$18,$24 +la $24,2 +beq $18,$24,L.1623 +la $23,225 +beq $30,$0,L.1625 +la $4,L.687 +move $5,$23 +jal printf +L.1625: +L.1623: +la $18,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +divu $18,$18,$24 +la $24,2 +beq $18,$24,L.1627 +la $23,226 +beq $30,$0,L.1629 +la $4,L.687 +move $5,$23 +jal printf +L.1629: +L.1627: +la $18,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +divu $18,$18,$24 +la $24,2 +beq $18,$24,L.1631 +la $23,227 +beq $30,$0,L.1633 +la $4,L.687 +move $5,$23 +jal printf +L.1633: +L.1631: +la $18,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +divu $18,$18,$24 +la $24,2 +beq $18,$24,L.1635 +la $23,228 +beq $30,$0,L.1637 +la $4,L.687 +move $5,$23 +jal printf +L.1637: +L.1635: +la $18,5 +la $24,2 +sw $24,-12+160($sp) +lw $15,-12+160($sp) +divu $18,$18,$15 +beq $18,$24,L.1639 +la $23,229 +beq $30,$0,L.1641 +la $4,L.687 +move $5,$23 +jal printf +L.1641: +L.1639: +la $18,5 +l.s $f26,L.529 +l.d $f18,L.596 +srl $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +div.s $f18,$f18,$f26 +l.s $f16,L.828 +c.ult.s $f18,$f16; bc1t L.1644 +sub.s $f16,$f18,$f16 +trunc.w.s $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-60+160($sp) +b L.1645 +L.1644: +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-60+160($sp) +L.1645: +lw $18,-60+160($sp) +la $24,2 +beq $18,$24,L.1646 +la $23,230 +beq $30,$0,L.1648 +la $4,L.687 +move $5,$23 +jal printf +L.1648: +L.1646: +la $18,5 +l.d $f24,L.416 +l.d $f18,L.596 +srl $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$18,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +div.d $f18,$f18,$f24 +l.d $f16,L.836 +c.ult.d $f18,$f16; bc1t L.1651 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-64+160($sp) +b L.1652 +L.1651: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-64+160($sp) +L.1652: +lw $18,-64+160($sp) +la $24,2 +beq $18,$24,L.1653 +la $23,231 +beq $30,$0,L.1655 +la $4,L.687 +move $5,$23 +jal printf +L.1655: +L.1653: +l.s $f30,L.841 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +div.s $f30,$f30,$f18 +cvt.d.s $f18,$f30 +l.d $f16,L.1659 +c.eq.d $f18,$f16; bc1t L.1657 +la $23,232 +beq $30,$0,L.1660 +la $4,L.687 +move $5,$23 +jal printf +L.1660: +L.1657: +l.s $f30,L.841 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +div.s $f30,$f30,$f18 +cvt.d.s $f18,$f30 +l.d $f16,L.1659 +c.eq.d $f18,$f16; bc1t L.1662 +la $23,233 +beq $30,$0,L.1664 +la $4,L.687 +move $5,$23 +jal printf +L.1664: +L.1662: +l.s $f30,L.841 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +div.s $f30,$f30,$f18 +cvt.d.s $f18,$f30 +l.d $f16,L.1659 +c.eq.d $f18,$f16; bc1t L.1666 +la $23,234 +beq $30,$0,L.1668 +la $4,L.687 +move $5,$23 +jal printf +L.1668: +L.1666: +l.s $f30,L.841 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f18; cvt.s.w $f18,$f18 +div.s $f30,$f30,$f18 +cvt.d.s $f18,$f30 +l.d $f16,L.1659 +c.eq.d $f18,$f16; bc1t L.1670 +la $23,235 +beq $30,$0,L.1672 +la $4,L.687 +move $5,$23 +jal printf +L.1672: +L.1670: +l.s $f30,L.841 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f18,$f18 +div.s $f30,$f30,$f18 +cvt.d.s $f18,$f30 +l.d $f16,L.1659 +c.eq.d $f18,$f16; bc1t L.1674 +la $23,236 +beq $30,$0,L.1676 +la $4,L.687 +move $5,$23 +jal printf +L.1676: +L.1674: +l.s $f30,L.841 +l.s $f26,L.529 +div.s $f30,$f30,$f26 +cvt.d.s $f18,$f30 +l.d $f16,L.1659 +c.eq.d $f18,$f16; bc1t L.1678 +la $23,237 +beq $30,$0,L.1680 +la $4,L.687 +move $5,$23 +jal printf +L.1680: +L.1678: +l.s $f30,L.841 +l.d $f24,L.416 +cvt.d.s $f18,$f30 +div.d $f18,$f18,$f24 +cvt.s.d $f30,$f18 +cvt.d.s $f18,$f30 +l.d $f16,L.1659 +c.eq.d $f18,$f16; bc1t L.1682 +la $23,238 +beq $30,$0,L.1684 +la $4,L.687 +move $5,$23 +jal printf +L.1684: +L.1682: +l.d $f28,L.870 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +div.d $f28,$f28,$f18 +l.d $f18,L.1659 +c.eq.d $f28,$f18; bc1t L.1686 +la $23,239 +beq $30,$0,L.1688 +la $4,L.687 +move $5,$23 +jal printf +L.1688: +L.1686: +l.d $f28,L.870 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +div.d $f28,$f28,$f18 +l.d $f18,L.1659 +c.eq.d $f28,$f18; bc1t L.1690 +la $23,240 +beq $30,$0,L.1692 +la $4,L.687 +move $5,$23 +jal printf +L.1692: +L.1690: +l.d $f28,L.870 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +div.d $f28,$f28,$f18 +l.d $f18,L.1659 +c.eq.d $f28,$f18; bc1t L.1694 +la $23,241 +beq $30,$0,L.1696 +la $4,L.687 +move $5,$23 +jal printf +L.1696: +L.1694: +l.d $f28,L.870 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +mtc1 $24,$f18; cvt.d.w $f18,$f18 +div.d $f28,$f28,$f18 +l.d $f18,L.1659 +c.eq.d $f28,$f18; bc1t L.1698 +la $23,242 +beq $30,$0,L.1700 +la $4,L.687 +move $5,$23 +jal printf +L.1700: +L.1698: +l.d $f28,L.870 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +l.d $f18,L.596 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +div.d $f28,$f28,$f18 +l.d $f18,L.1659 +c.eq.d $f28,$f18; bc1t L.1702 +la $23,243 +beq $30,$0,L.1704 +la $4,L.687 +move $5,$23 +jal printf +L.1704: +L.1702: +l.d $f28,L.870 +l.s $f26,L.529 +cvt.d.s $f18,$f26 +div.d $f28,$f28,$f18 +l.d $f18,L.1659 +c.eq.d $f28,$f18; bc1t L.1706 +la $23,244 +beq $30,$0,L.1708 +la $4,L.687 +move $5,$23 +jal printf +L.1708: +L.1706: +l.d $f28,L.870 +l.d $f24,L.416 +div.d $f28,$f28,$f24 +l.d $f18,L.1659 +c.eq.d $f28,$f18; bc1t L.1710 +la $23,245 +beq $30,$0,L.1712 +la $4,L.687 +move $5,$23 +jal printf +L.1712: +L.1710: +la $22,5 +la $17,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +rem $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1714 +la $23,246 +beq $30,$0,L.1716 +la $4,L.687 +move $5,$23 +jal printf +L.1716: +L.1714: +la $22,5 +la $16,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +rem $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1718 +la $23,247 +beq $30,$0,L.1720 +la $4,L.687 +move $5,$23 +jal printf +L.1720: +L.1718: +la $22,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +rem $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1722 +la $23,248 +beq $30,$0,L.1724 +la $4,L.687 +move $5,$23 +jal printf +L.1724: +L.1722: +la $22,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +rem $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1726 +la $23,249 +beq $30,$0,L.1728 +la $4,L.687 +move $5,$23 +jal printf +L.1728: +L.1726: +la $22,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +remu $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1730 +la $23,250 +beq $30,$0,L.1732 +la $4,L.687 +move $5,$23 +jal printf +L.1732: +L.1730: +la $21,5 +la $17,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +rem $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1734 +la $23,251 +beq $30,$0,L.1736 +la $4,L.687 +move $5,$23 +jal printf +L.1736: +L.1734: +la $21,5 +la $16,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +rem $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1738 +la $23,252 +beq $30,$0,L.1740 +la $4,L.687 +move $5,$23 +jal printf +L.1740: +L.1738: +la $21,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +rem $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1742 +la $23,253 +beq $30,$0,L.1744 +la $4,L.687 +move $5,$23 +jal printf +L.1744: +L.1742: +la $21,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +rem $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1746 +la $23,254 +beq $30,$0,L.1748 +la $4,L.687 +move $5,$23 +jal printf +L.1748: +L.1746: +la $21,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +remu $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1750 +la $23,255 +beq $30,$0,L.1752 +la $4,L.687 +move $5,$23 +jal printf +L.1752: +L.1750: +la $20,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +rem $20,$20,$24 +la $24,1 +beq $20,$24,L.1754 +la $23,256 +beq $30,$0,L.1756 +la $4,L.687 +move $5,$23 +jal printf +L.1756: +L.1754: +la $20,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +rem $20,$20,$24 +la $24,1 +beq $20,$24,L.1758 +la $23,257 +beq $30,$0,L.1760 +la $4,L.687 +move $5,$23 +jal printf +L.1760: +L.1758: +la $20,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +rem $20,$20,$24 +la $24,1 +beq $20,$24,L.1762 +la $23,258 +beq $30,$0,L.1764 +la $4,L.687 +move $5,$23 +jal printf +L.1764: +L.1762: +la $20,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +rem $20,$20,$24 +la $24,1 +beq $20,$24,L.1766 +la $23,259 +beq $30,$0,L.1768 +la $4,L.687 +move $5,$23 +jal printf +L.1768: +L.1766: +la $20,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$20 +lw $15,-12+160($sp) +remu $24,$24,$15 +move $20,$24 +la $24,1 +beq $20,$24,L.1770 +la $23,260 +beq $30,$0,L.1772 +la $4,L.687 +move $5,$23 +jal printf +L.1772: +L.1770: +la $19,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +rem $19,$19,$24 +la $24,1 +beq $19,$24,L.1774 +la $23,261 +beq $30,$0,L.1776 +la $4,L.687 +move $5,$23 +jal printf +L.1776: +L.1774: +la $19,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +rem $19,$19,$24 +la $24,1 +beq $19,$24,L.1778 +la $23,262 +beq $30,$0,L.1780 +la $4,L.687 +move $5,$23 +jal printf +L.1780: +L.1778: +la $19,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +rem $19,$19,$24 +la $24,1 +beq $19,$24,L.1782 +la $23,263 +beq $30,$0,L.1784 +la $4,L.687 +move $5,$23 +jal printf +L.1784: +L.1782: +la $19,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +rem $19,$19,$24 +la $24,1 +beq $19,$24,L.1786 +la $23,264 +beq $30,$0,L.1788 +la $4,L.687 +move $5,$23 +jal printf +L.1788: +L.1786: +la $19,5 +la $24,2 +sw $24,-12+160($sp) +move $24,$19 +lw $15,-12+160($sp) +remu $24,$24,$15 +move $19,$24 +la $24,1 +beq $19,$24,L.1790 +la $23,265 +beq $30,$0,L.1792 +la $4,L.687 +move $5,$23 +jal printf +L.1792: +L.1790: +la $18,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +remu $18,$18,$24 +la $24,1 +beq $18,$24,L.1794 +la $23,266 +beq $30,$0,L.1796 +la $4,L.687 +move $5,$23 +jal printf +L.1796: +L.1794: +la $18,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +remu $18,$18,$24 +la $24,1 +beq $18,$24,L.1798 +la $23,267 +beq $30,$0,L.1800 +la $4,L.687 +move $5,$23 +jal printf +L.1800: +L.1798: +la $18,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +remu $18,$18,$24 +la $24,1 +beq $18,$24,L.1802 +la $23,268 +beq $30,$0,L.1804 +la $4,L.687 +move $5,$23 +jal printf +L.1804: +L.1802: +la $18,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +remu $18,$18,$24 +la $24,1 +beq $18,$24,L.1806 +la $23,269 +beq $30,$0,L.1808 +la $4,L.687 +move $5,$23 +jal printf +L.1808: +L.1806: +la $18,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +remu $18,$18,$24 +la $24,1 +beq $18,$24,L.1810 +la $23,270 +beq $30,$0,L.1812 +la $4,L.687 +move $5,$23 +jal printf +L.1812: +L.1810: +la $22,5 +la $17,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +sra $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1814 +la $23,271 +beq $30,$0,L.1816 +la $4,L.687 +move $5,$23 +jal printf +L.1816: +L.1814: +la $22,5 +la $16,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +sra $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1818 +la $23,272 +beq $30,$0,L.1820 +la $4,L.687 +move $5,$23 +jal printf +L.1820: +L.1818: +la $22,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +sra $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1822 +la $23,273 +beq $30,$0,L.1824 +la $4,L.687 +move $5,$23 +jal printf +L.1824: +L.1822: +la $22,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +sra $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1826 +la $23,274 +beq $30,$0,L.1828 +la $4,L.687 +move $5,$23 +jal printf +L.1828: +L.1826: +la $22,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +sra $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,1 +beq $24,$15,L.1830 +la $23,275 +beq $30,$0,L.1832 +la $4,L.687 +move $5,$23 +jal printf +L.1832: +L.1830: +la $21,5 +la $17,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +sra $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1834 +la $23,276 +beq $30,$0,L.1836 +la $4,L.687 +move $5,$23 +jal printf +L.1836: +L.1834: +la $21,5 +la $16,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +sra $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1838 +la $23,277 +beq $30,$0,L.1840 +la $4,L.687 +move $5,$23 +jal printf +L.1840: +L.1838: +la $21,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +sra $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1842 +la $23,278 +beq $30,$0,L.1844 +la $4,L.687 +move $5,$23 +jal printf +L.1844: +L.1842: +la $21,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +sra $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1846 +la $23,279 +beq $30,$0,L.1848 +la $4,L.687 +move $5,$23 +jal printf +L.1848: +L.1846: +la $21,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +sra $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,1 +beq $24,$15,L.1850 +la $23,280 +beq $30,$0,L.1852 +la $4,L.687 +move $5,$23 +jal printf +L.1852: +L.1850: +la $20,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +sra $20,$20,$24 +la $24,1 +beq $20,$24,L.1854 +la $23,281 +beq $30,$0,L.1856 +la $4,L.687 +move $5,$23 +jal printf +L.1856: +L.1854: +la $20,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +sra $20,$20,$24 +la $24,1 +beq $20,$24,L.1858 +la $23,282 +beq $30,$0,L.1860 +la $4,L.687 +move $5,$23 +jal printf +L.1860: +L.1858: +la $20,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +sra $20,$20,$24 +la $24,1 +beq $20,$24,L.1862 +la $23,283 +beq $30,$0,L.1864 +la $4,L.687 +move $5,$23 +jal printf +L.1864: +L.1862: +la $20,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +sra $20,$20,$24 +la $24,1 +beq $20,$24,L.1866 +la $23,284 +beq $30,$0,L.1868 +la $4,L.687 +move $5,$23 +jal printf +L.1868: +L.1866: +la $20,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +sra $20,$20,$24 +la $24,1 +beq $20,$24,L.1870 +la $23,285 +beq $30,$0,L.1872 +la $4,L.687 +move $5,$23 +jal printf +L.1872: +L.1870: +la $19,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +sra $19,$19,$24 +la $24,1 +beq $19,$24,L.1874 +la $23,286 +beq $30,$0,L.1876 +la $4,L.687 +move $5,$23 +jal printf +L.1876: +L.1874: +la $19,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +sra $19,$19,$24 +la $24,1 +beq $19,$24,L.1878 +la $23,287 +beq $30,$0,L.1880 +la $4,L.687 +move $5,$23 +jal printf +L.1880: +L.1878: +la $19,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +sra $19,$19,$24 +la $24,1 +beq $19,$24,L.1882 +la $23,288 +beq $30,$0,L.1884 +la $4,L.687 +move $5,$23 +jal printf +L.1884: +L.1882: +la $19,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +sra $19,$19,$24 +la $24,1 +beq $19,$24,L.1886 +la $23,289 +beq $30,$0,L.1888 +la $4,L.687 +move $5,$23 +jal printf +L.1888: +L.1886: +la $19,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +sra $19,$19,$24 +la $24,1 +beq $19,$24,L.1890 +la $23,290 +beq $30,$0,L.1892 +la $4,L.687 +move $5,$23 +jal printf +L.1892: +L.1890: +la $18,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +srl $18,$18,$24 +la $24,1 +beq $18,$24,L.1894 +la $23,291 +beq $30,$0,L.1896 +la $4,L.687 +move $5,$23 +jal printf +L.1896: +L.1894: +la $18,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +srl $18,$18,$24 +la $24,1 +beq $18,$24,L.1898 +la $23,292 +beq $30,$0,L.1900 +la $4,L.687 +move $5,$23 +jal printf +L.1900: +L.1898: +la $18,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +srl $18,$18,$24 +la $24,1 +beq $18,$24,L.1902 +la $23,293 +beq $30,$0,L.1904 +la $4,L.687 +move $5,$23 +jal printf +L.1904: +L.1902: +la $18,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +srl $18,$18,$24 +la $24,1 +beq $18,$24,L.1906 +la $23,294 +beq $30,$0,L.1908 +la $4,L.687 +move $5,$23 +jal printf +L.1908: +L.1906: +la $18,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +srl $18,$18,$24 +la $24,1 +beq $18,$24,L.1910 +la $23,295 +beq $30,$0,L.1912 +la $4,L.687 +move $5,$23 +jal printf +L.1912: +L.1910: +la $22,5 +la $17,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +sll $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,20 +beq $24,$15,L.1914 +la $23,296 +beq $30,$0,L.1916 +la $4,L.687 +move $5,$23 +jal printf +L.1916: +L.1914: +la $22,5 +la $16,2 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +sll $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,20 +beq $24,$15,L.1918 +la $23,297 +beq $30,$0,L.1920 +la $4,L.687 +move $5,$23 +jal printf +L.1920: +L.1918: +la $22,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +sll $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,20 +beq $24,$15,L.1922 +la $23,298 +beq $30,$0,L.1924 +la $4,L.687 +move $5,$23 +jal printf +L.1924: +L.1922: +la $22,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +sll $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,20 +beq $24,$15,L.1926 +la $23,299 +beq $30,$0,L.1928 +la $4,L.687 +move $5,$23 +jal printf +L.1928: +L.1926: +la $22,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +sll $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,20 +beq $24,$15,L.1930 +la $23,300 +beq $30,$0,L.1932 +la $4,L.687 +move $5,$23 +jal printf +L.1932: +L.1930: +la $21,5 +la $17,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +sll $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,20 +beq $24,$15,L.1934 +la $23,301 +beq $30,$0,L.1936 +la $4,L.687 +move $5,$23 +jal printf +L.1936: +L.1934: +la $21,5 +la $16,2 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +sll $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,20 +beq $24,$15,L.1938 +la $23,302 +beq $30,$0,L.1940 +la $4,L.687 +move $5,$23 +jal printf +L.1940: +L.1938: +la $21,5 +la $24,2 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +sll $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,20 +beq $24,$15,L.1942 +la $23,303 +beq $30,$0,L.1944 +la $4,L.687 +move $5,$23 +jal printf +L.1944: +L.1942: +la $21,5 +la $24,2 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +sll $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,20 +beq $24,$15,L.1946 +la $23,304 +beq $30,$0,L.1948 +la $4,L.687 +move $5,$23 +jal printf +L.1948: +L.1946: +la $21,5 +la $24,2 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +sll $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,20 +beq $24,$15,L.1950 +la $23,305 +beq $30,$0,L.1952 +la $4,L.687 +move $5,$23 +jal printf +L.1952: +L.1950: +la $20,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +sll $20,$20,$24 +la $24,20 +beq $20,$24,L.1954 +la $23,306 +beq $30,$0,L.1956 +la $4,L.687 +move $5,$23 +jal printf +L.1956: +L.1954: +la $20,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +sll $20,$20,$24 +la $24,20 +beq $20,$24,L.1958 +la $23,307 +beq $30,$0,L.1960 +la $4,L.687 +move $5,$23 +jal printf +L.1960: +L.1958: +la $20,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +sll $20,$20,$24 +la $24,20 +beq $20,$24,L.1962 +la $23,308 +beq $30,$0,L.1964 +la $4,L.687 +move $5,$23 +jal printf +L.1964: +L.1962: +la $20,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +sll $20,$20,$24 +la $24,20 +beq $20,$24,L.1966 +la $23,309 +beq $30,$0,L.1968 +la $4,L.687 +move $5,$23 +jal printf +L.1968: +L.1966: +la $20,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +sll $20,$20,$24 +la $24,20 +beq $20,$24,L.1970 +la $23,310 +beq $30,$0,L.1972 +la $4,L.687 +move $5,$23 +jal printf +L.1972: +L.1970: +la $19,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +sll $19,$19,$24 +la $24,20 +beq $19,$24,L.1974 +la $23,311 +beq $30,$0,L.1976 +la $4,L.687 +move $5,$23 +jal printf +L.1976: +L.1974: +la $19,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +sll $19,$19,$24 +la $24,20 +beq $19,$24,L.1978 +la $23,312 +beq $30,$0,L.1980 +la $4,L.687 +move $5,$23 +jal printf +L.1980: +L.1978: +la $19,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +sll $19,$19,$24 +la $24,20 +beq $19,$24,L.1982 +la $23,313 +beq $30,$0,L.1984 +la $4,L.687 +move $5,$23 +jal printf +L.1984: +L.1982: +la $19,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +sll $19,$19,$24 +la $24,20 +beq $19,$24,L.1986 +la $23,314 +beq $30,$0,L.1988 +la $4,L.687 +move $5,$23 +jal printf +L.1988: +L.1986: +la $19,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +sll $19,$19,$24 +la $24,20 +beq $19,$24,L.1990 +la $23,315 +beq $30,$0,L.1992 +la $4,L.687 +move $5,$23 +jal printf +L.1992: +L.1990: +la $18,5 +la $17,2 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +sll $18,$18,$24 +la $24,20 +beq $18,$24,L.1994 +la $23,316 +beq $30,$0,L.1996 +la $4,L.687 +move $5,$23 +jal printf +L.1996: +L.1994: +la $18,5 +la $16,2 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +sll $18,$18,$24 +la $24,20 +beq $18,$24,L.1998 +la $23,317 +beq $30,$0,L.2000 +la $4,L.687 +move $5,$23 +jal printf +L.2000: +L.1998: +la $18,5 +la $24,2 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +sll $18,$18,$24 +la $24,20 +beq $18,$24,L.2002 +la $23,318 +beq $30,$0,L.2004 +la $4,L.687 +move $5,$23 +jal printf +L.2004: +L.2002: +la $18,5 +la $24,2 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +sll $18,$18,$24 +la $24,20 +beq $18,$24,L.2006 +la $23,319 +beq $30,$0,L.2008 +la $4,L.687 +move $5,$23 +jal printf +L.2008: +L.2006: +la $18,5 +la $24,2 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +sll $18,$18,$24 +la $24,20 +beq $18,$24,L.2010 +la $23,320 +beq $30,$0,L.2012 +la $4,L.687 +move $5,$23 +jal printf +L.2012: +L.2010: +la $22,12 +la $17,10 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +and $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,8 +beq $24,$15,L.2014 +la $23,321 +beq $30,$0,L.2016 +la $4,L.687 +move $5,$23 +jal printf +L.2016: +L.2014: +la $22,12 +la $16,10 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +and $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,8 +beq $24,$15,L.2018 +la $23,322 +beq $30,$0,L.2020 +la $4,L.687 +move $5,$23 +jal printf +L.2020: +L.2018: +la $22,12 +la $24,10 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +and $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,8 +beq $24,$15,L.2022 +la $23,323 +beq $30,$0,L.2024 +la $4,L.687 +move $5,$23 +jal printf +L.2024: +L.2022: +la $22,12 +la $24,10 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +and $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,8 +beq $24,$15,L.2026 +la $23,324 +beq $30,$0,L.2028 +la $4,L.687 +move $5,$23 +jal printf +L.2028: +L.2026: +la $22,12 +la $24,10 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +and $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,8 +beq $24,$15,L.2030 +la $23,325 +beq $30,$0,L.2032 +la $4,L.687 +move $5,$23 +jal printf +L.2032: +L.2030: +la $21,12 +la $17,10 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +and $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,8 +beq $24,$15,L.2034 +la $23,326 +beq $30,$0,L.2036 +la $4,L.687 +move $5,$23 +jal printf +L.2036: +L.2034: +la $21,12 +la $16,10 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +and $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,8 +beq $24,$15,L.2038 +la $23,327 +beq $30,$0,L.2040 +la $4,L.687 +move $5,$23 +jal printf +L.2040: +L.2038: +la $21,12 +la $24,10 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +and $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,8 +beq $24,$15,L.2042 +la $23,328 +beq $30,$0,L.2044 +la $4,L.687 +move $5,$23 +jal printf +L.2044: +L.2042: +la $21,12 +la $24,10 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +and $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,8 +beq $24,$15,L.2046 +la $23,329 +beq $30,$0,L.2048 +la $4,L.687 +move $5,$23 +jal printf +L.2048: +L.2046: +la $21,12 +la $24,10 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +and $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,8 +beq $24,$15,L.2050 +la $23,330 +beq $30,$0,L.2052 +la $4,L.687 +move $5,$23 +jal printf +L.2052: +L.2050: +la $20,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +and $20,$20,$24 +la $24,8 +beq $20,$24,L.2054 +la $23,331 +beq $30,$0,L.2056 +la $4,L.687 +move $5,$23 +jal printf +L.2056: +L.2054: +la $20,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +and $20,$20,$24 +la $24,8 +beq $20,$24,L.2058 +la $23,332 +beq $30,$0,L.2060 +la $4,L.687 +move $5,$23 +jal printf +L.2060: +L.2058: +la $20,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +and $20,$20,$24 +la $24,8 +beq $20,$24,L.2062 +la $23,333 +beq $30,$0,L.2064 +la $4,L.687 +move $5,$23 +jal printf +L.2064: +L.2062: +la $20,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +and $20,$20,$24 +la $24,8 +beq $20,$24,L.2066 +la $23,334 +beq $30,$0,L.2068 +la $4,L.687 +move $5,$23 +jal printf +L.2068: +L.2066: +la $20,12 +la $24,10 +sw $24,-12+160($sp) +move $24,$20 +lw $15,-12+160($sp) +and $24,$24,$15 +move $20,$24 +la $24,8 +beq $20,$24,L.2070 +la $23,335 +beq $30,$0,L.2072 +la $4,L.687 +move $5,$23 +jal printf +L.2072: +L.2070: +la $19,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +and $19,$19,$24 +la $24,8 +beq $19,$24,L.2074 +la $23,336 +beq $30,$0,L.2076 +la $4,L.687 +move $5,$23 +jal printf +L.2076: +L.2074: +la $19,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +and $19,$19,$24 +la $24,8 +beq $19,$24,L.2078 +la $23,337 +beq $30,$0,L.2080 +la $4,L.687 +move $5,$23 +jal printf +L.2080: +L.2078: +la $19,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +and $19,$19,$24 +la $24,8 +beq $19,$24,L.2082 +la $23,338 +beq $30,$0,L.2084 +la $4,L.687 +move $5,$23 +jal printf +L.2084: +L.2082: +la $19,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +and $19,$19,$24 +la $24,8 +beq $19,$24,L.2086 +la $23,339 +beq $30,$0,L.2088 +la $4,L.687 +move $5,$23 +jal printf +L.2088: +L.2086: +la $19,12 +la $24,10 +sw $24,-12+160($sp) +move $24,$19 +lw $15,-12+160($sp) +and $24,$24,$15 +move $19,$24 +la $24,8 +beq $19,$24,L.2090 +la $23,340 +beq $30,$0,L.2092 +la $4,L.687 +move $5,$23 +jal printf +L.2092: +L.2090: +la $18,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +and $18,$18,$24 +la $24,8 +beq $18,$24,L.2094 +la $23,341 +beq $30,$0,L.2096 +la $4,L.687 +move $5,$23 +jal printf +L.2096: +L.2094: +la $18,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +and $18,$18,$24 +la $24,8 +beq $18,$24,L.2098 +la $23,342 +beq $30,$0,L.2100 +la $4,L.687 +move $5,$23 +jal printf +L.2100: +L.2098: +la $18,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +and $18,$18,$24 +la $24,8 +beq $18,$24,L.2102 +la $23,343 +beq $30,$0,L.2104 +la $4,L.687 +move $5,$23 +jal printf +L.2104: +L.2102: +la $18,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +and $18,$18,$24 +la $24,8 +beq $18,$24,L.2106 +la $23,344 +beq $30,$0,L.2108 +la $4,L.687 +move $5,$23 +jal printf +L.2108: +L.2106: +la $18,12 +la $24,10 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +and $18,$18,$24 +la $24,8 +beq $18,$24,L.2110 +la $23,345 +beq $30,$0,L.2112 +la $4,L.687 +move $5,$23 +jal printf +L.2112: +L.2110: +la $22,12 +la $17,10 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +xor $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,6 +beq $24,$15,L.2114 +la $23,346 +beq $30,$0,L.2116 +la $4,L.687 +move $5,$23 +jal printf +L.2116: +L.2114: +la $22,12 +la $16,10 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +xor $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,6 +beq $24,$15,L.2118 +la $23,347 +beq $30,$0,L.2120 +la $4,L.687 +move $5,$23 +jal printf +L.2120: +L.2118: +la $22,12 +la $24,10 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +xor $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,6 +beq $24,$15,L.2122 +la $23,348 +beq $30,$0,L.2124 +la $4,L.687 +move $5,$23 +jal printf +L.2124: +L.2122: +la $22,12 +la $24,10 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +xor $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,6 +beq $24,$15,L.2126 +la $23,349 +beq $30,$0,L.2128 +la $4,L.687 +move $5,$23 +jal printf +L.2128: +L.2126: +la $22,12 +la $24,10 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +xor $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,6 +beq $24,$15,L.2130 +la $23,350 +beq $30,$0,L.2132 +la $4,L.687 +move $5,$23 +jal printf +L.2132: +L.2130: +la $21,12 +la $17,10 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +xor $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,6 +beq $24,$15,L.2134 +la $23,351 +beq $30,$0,L.2136 +la $4,L.687 +move $5,$23 +jal printf +L.2136: +L.2134: +la $21,12 +la $16,10 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +xor $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,6 +beq $24,$15,L.2138 +la $23,352 +beq $30,$0,L.2140 +la $4,L.687 +move $5,$23 +jal printf +L.2140: +L.2138: +la $21,12 +la $24,10 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +xor $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,6 +beq $24,$15,L.2142 +la $23,353 +beq $30,$0,L.2144 +la $4,L.687 +move $5,$23 +jal printf +L.2144: +L.2142: +la $21,12 +la $24,10 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +xor $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,6 +beq $24,$15,L.2146 +la $23,354 +beq $30,$0,L.2148 +la $4,L.687 +move $5,$23 +jal printf +L.2148: +L.2146: +la $21,12 +la $24,10 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +xor $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,6 +beq $24,$15,L.2150 +la $23,355 +beq $30,$0,L.2152 +la $4,L.687 +move $5,$23 +jal printf +L.2152: +L.2150: +la $20,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +xor $20,$20,$24 +la $24,6 +beq $20,$24,L.2154 +la $23,356 +beq $30,$0,L.2156 +la $4,L.687 +move $5,$23 +jal printf +L.2156: +L.2154: +la $20,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +xor $20,$20,$24 +la $24,6 +beq $20,$24,L.2158 +la $23,357 +beq $30,$0,L.2160 +la $4,L.687 +move $5,$23 +jal printf +L.2160: +L.2158: +la $20,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +xor $20,$20,$24 +la $24,6 +beq $20,$24,L.2162 +la $23,358 +beq $30,$0,L.2164 +la $4,L.687 +move $5,$23 +jal printf +L.2164: +L.2162: +la $20,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +xor $20,$20,$24 +la $24,6 +beq $20,$24,L.2166 +la $23,359 +beq $30,$0,L.2168 +la $4,L.687 +move $5,$23 +jal printf +L.2168: +L.2166: +la $20,12 +la $24,10 +sw $24,-12+160($sp) +move $24,$20 +lw $15,-12+160($sp) +xor $24,$24,$15 +move $20,$24 +la $24,6 +beq $20,$24,L.2170 +la $23,360 +beq $30,$0,L.2172 +la $4,L.687 +move $5,$23 +jal printf +L.2172: +L.2170: +la $19,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +xor $19,$19,$24 +la $24,6 +beq $19,$24,L.2174 +la $23,361 +beq $30,$0,L.2176 +la $4,L.687 +move $5,$23 +jal printf +L.2176: +L.2174: +la $19,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +xor $19,$19,$24 +la $24,6 +beq $19,$24,L.2178 +la $23,362 +beq $30,$0,L.2180 +la $4,L.687 +move $5,$23 +jal printf +L.2180: +L.2178: +la $19,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +xor $19,$19,$24 +la $24,6 +beq $19,$24,L.2182 +la $23,363 +beq $30,$0,L.2184 +la $4,L.687 +move $5,$23 +jal printf +L.2184: +L.2182: +la $19,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +xor $19,$19,$24 +la $24,6 +beq $19,$24,L.2186 +la $23,364 +beq $30,$0,L.2188 +la $4,L.687 +move $5,$23 +jal printf +L.2188: +L.2186: +la $19,12 +la $24,10 +sw $24,-12+160($sp) +move $24,$19 +lw $15,-12+160($sp) +xor $24,$24,$15 +move $19,$24 +la $24,6 +beq $19,$24,L.2190 +la $23,365 +beq $30,$0,L.2192 +la $4,L.687 +move $5,$23 +jal printf +L.2192: +L.2190: +la $18,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +xor $18,$18,$24 +la $24,6 +beq $18,$24,L.2194 +la $23,366 +beq $30,$0,L.2196 +la $4,L.687 +move $5,$23 +jal printf +L.2196: +L.2194: +la $18,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +xor $18,$18,$24 +la $24,6 +beq $18,$24,L.2198 +la $23,367 +beq $30,$0,L.2200 +la $4,L.687 +move $5,$23 +jal printf +L.2200: +L.2198: +la $18,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +xor $18,$18,$24 +la $24,6 +beq $18,$24,L.2202 +la $23,368 +beq $30,$0,L.2204 +la $4,L.687 +move $5,$23 +jal printf +L.2204: +L.2202: +la $18,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +xor $18,$18,$24 +la $24,6 +beq $18,$24,L.2206 +la $23,369 +beq $30,$0,L.2208 +la $4,L.687 +move $5,$23 +jal printf +L.2208: +L.2206: +la $18,12 +la $24,10 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +xor $18,$18,$24 +la $24,6 +beq $18,$24,L.2210 +la $23,370 +beq $30,$0,L.2212 +la $4,L.687 +move $5,$23 +jal printf +L.2212: +L.2210: +la $22,12 +la $17,10 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +or $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,14 +beq $24,$15,L.2214 +la $23,371 +beq $30,$0,L.2216 +la $4,L.687 +move $5,$23 +jal printf +L.2216: +L.2214: +la $22,12 +la $16,10 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +or $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,14 +beq $24,$15,L.2218 +la $23,372 +beq $30,$0,L.2220 +la $4,L.687 +move $5,$23 +jal printf +L.2220: +L.2218: +la $22,12 +la $24,10 +sw $24,-4+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-4+160($sp) +or $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,14 +beq $24,$15,L.2222 +la $23,373 +beq $30,$0,L.2224 +la $4,L.687 +move $5,$23 +jal printf +L.2224: +L.2222: +la $22,12 +la $24,10 +sw $24,-8+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-8+160($sp) +or $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,14 +beq $24,$15,L.2226 +la $23,374 +beq $30,$0,L.2228 +la $4,L.687 +move $5,$23 +jal printf +L.2228: +L.2226: +la $22,12 +la $24,10 +sw $24,-12+160($sp) +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +lw $15,-12+160($sp) +or $24,$24,$15 +move $22,$24 +sll $24,$22,8*(4-1); sra $24,$24,8*(4-1) +la $15,14 +beq $24,$15,L.2230 +la $23,375 +beq $30,$0,L.2232 +la $4,L.687 +move $5,$23 +jal printf +L.2232: +L.2230: +la $21,12 +la $17,10 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +or $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,14 +beq $24,$15,L.2234 +la $23,376 +beq $30,$0,L.2236 +la $4,L.687 +move $5,$23 +jal printf +L.2236: +L.2234: +la $21,12 +la $16,10 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +or $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,14 +beq $24,$15,L.2238 +la $23,377 +beq $30,$0,L.2240 +la $4,L.687 +move $5,$23 +jal printf +L.2240: +L.2238: +la $21,12 +la $24,10 +sw $24,-4+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-4+160($sp) +or $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,14 +beq $24,$15,L.2242 +la $23,378 +beq $30,$0,L.2244 +la $4,L.687 +move $5,$23 +jal printf +L.2244: +L.2242: +la $21,12 +la $24,10 +sw $24,-8+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-8+160($sp) +or $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,14 +beq $24,$15,L.2246 +la $23,379 +beq $30,$0,L.2248 +la $4,L.687 +move $5,$23 +jal printf +L.2248: +L.2246: +la $21,12 +la $24,10 +sw $24,-12+160($sp) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,-12+160($sp) +or $24,$24,$15 +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,14 +beq $24,$15,L.2250 +la $23,380 +beq $30,$0,L.2252 +la $4,L.687 +move $5,$23 +jal printf +L.2252: +L.2250: +la $20,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +or $20,$20,$24 +la $24,14 +beq $20,$24,L.2254 +la $23,381 +beq $30,$0,L.2256 +la $4,L.687 +move $5,$23 +jal printf +L.2256: +L.2254: +la $20,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +or $20,$20,$24 +la $24,14 +beq $20,$24,L.2258 +la $23,382 +beq $30,$0,L.2260 +la $4,L.687 +move $5,$23 +jal printf +L.2260: +L.2258: +la $20,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +or $20,$20,$24 +la $24,14 +beq $20,$24,L.2262 +la $23,383 +beq $30,$0,L.2264 +la $4,L.687 +move $5,$23 +jal printf +L.2264: +L.2262: +la $20,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +or $20,$20,$24 +la $24,14 +beq $20,$24,L.2266 +la $23,384 +beq $30,$0,L.2268 +la $4,L.687 +move $5,$23 +jal printf +L.2268: +L.2266: +la $20,12 +la $24,10 +sw $24,-12+160($sp) +move $24,$20 +lw $15,-12+160($sp) +or $24,$24,$15 +move $20,$24 +la $24,14 +beq $20,$24,L.2270 +la $23,385 +beq $30,$0,L.2272 +la $4,L.687 +move $5,$23 +jal printf +L.2272: +L.2270: +la $19,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +or $19,$19,$24 +la $24,14 +beq $19,$24,L.2274 +la $23,386 +beq $30,$0,L.2276 +la $4,L.687 +move $5,$23 +jal printf +L.2276: +L.2274: +la $19,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +or $19,$19,$24 +la $24,14 +beq $19,$24,L.2278 +la $23,387 +beq $30,$0,L.2280 +la $4,L.687 +move $5,$23 +jal printf +L.2280: +L.2278: +la $19,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +or $19,$19,$24 +la $24,14 +beq $19,$24,L.2282 +la $23,388 +beq $30,$0,L.2284 +la $4,L.687 +move $5,$23 +jal printf +L.2284: +L.2282: +la $19,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +or $19,$19,$24 +la $24,14 +beq $19,$24,L.2286 +la $23,389 +beq $30,$0,L.2288 +la $4,L.687 +move $5,$23 +jal printf +L.2288: +L.2286: +la $19,12 +la $24,10 +sw $24,-12+160($sp) +move $24,$19 +lw $15,-12+160($sp) +or $24,$24,$15 +move $19,$24 +la $24,14 +beq $19,$24,L.2290 +la $23,390 +beq $30,$0,L.2292 +la $4,L.687 +move $5,$23 +jal printf +L.2292: +L.2290: +la $18,12 +la $17,10 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +or $18,$18,$24 +la $24,14 +beq $18,$24,L.2294 +la $23,391 +beq $30,$0,L.2296 +la $4,L.687 +move $5,$23 +jal printf +L.2296: +L.2294: +la $18,12 +la $16,10 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +or $18,$18,$24 +la $24,14 +beq $18,$24,L.2298 +la $23,392 +beq $30,$0,L.2300 +la $4,L.687 +move $5,$23 +jal printf +L.2300: +L.2298: +la $18,12 +la $24,10 +sw $24,-4+160($sp) +lw $24,-4+160($sp) +or $18,$18,$24 +la $24,14 +beq $18,$24,L.2302 +la $23,393 +beq $30,$0,L.2304 +la $4,L.687 +move $5,$23 +jal printf +L.2304: +L.2302: +la $18,12 +la $24,10 +sw $24,-8+160($sp) +lw $24,-8+160($sp) +or $18,$18,$24 +la $24,14 +beq $18,$24,L.2306 +la $23,394 +beq $30,$0,L.2308 +la $4,L.687 +move $5,$23 +jal printf +L.2308: +L.2306: +la $18,12 +la $24,10 +sw $24,-12+160($sp) +lw $24,-12+160($sp) +or $18,$18,$24 +la $24,14 +beq $18,$24,L.2310 +la $23,395 +beq $30,$0,L.2312 +la $4,L.687 +move $5,$23 +jal printf +L.2312: +L.2310: +beq $23,$0,L.2314 +la $24,1 +sw $24,-24+160($sp) +lw $24,0+160($sp) +lw $24,44($24) +beq $24,$0,L.2316 +la $4,L.688 +la $5,1 +jal printf +L.2316: +L.2314: +lw $2,-24+160($sp) +L.686: +l.d $f24,16($sp) +l.d $f26,24($sp) +l.d $f28,32($sp) +l.d $f30,40($sp) +lw $16,48($sp) +lw $17,52($sp) +lw $18,56($sp) +lw $19,60($sp) +lw $20,64($sp) +lw $21,68($sp) +lw $22,72($sp) +lw $23,76($sp) +lw $25,80($sp) +lw $30,84($sp) +lw $31,88($sp) +addu $sp,$sp,160 +j $31 +.end s714 +.data +.align 0 +L.2319: +.byte 115 +.byte 55 +.byte 49 +.byte 53 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.2320: +.byte 115 +.byte 55 +.byte 49 +.byte 53 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s715 +.text +.text +.align 2 +.ent s715 +s715: +.frame $sp,64,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-64 +.mask 0xc2e00000,-28 +sw $21,16($sp) +sw $22,20($sp) +sw $23,24($sp) +.cprestore 28 +sw $30,32($sp) +sw $31,36($sp) +sw $4,64($sp) +sw $0,-12+64($sp) +sw $0,-4+64($sp) +la $30,L.2320 +lw $15,0+64($sp) +la $23,60($15) +move $21,$0 +L.2321: +L.2322: +move $24,$23 +la $23,1($24) +move $15,$30 +la $30,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.2321 +la $24,1 +move $22,$24 +la $22,1($22) +la $22,1($22) +la $22,1($22) +la $22,1($22) +la $24,1($22) +move $22,$24 +la $15,6 +beq $24,$15,L.2324 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.2326 +la $4,L.2319 +la $5,1 +jal printf +L.2326: +la $21,1($21) +L.2324: +lw $4,-4+64($sp) +la $24,3 +sw $24,-8+64($sp) +lw $24,-8+64($sp) +la $5,2($24) +lw $6,-12+64($sp) +jal s715f +la $15,5 +beq $2,$15,L.2328 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.2330 +la $4,L.2319 +la $5,2 +jal printf +L.2330: +la $21,2($21) +L.2328: +move $2,$21 +L.2318: +lw $21,16($sp) +lw $22,20($sp) +lw $23,24($sp) +lw $25,28($sp) +lw $30,32($sp) +lw $31,36($sp) +addu $sp,$sp,64 +j $31 +.end s715 +.globl s715f +.text +.align 2 +.ent s715f +s715f: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +move $2,$5 +L.2332: +j $31 +.end s715f +.data +.align 0 +L.2334: +.byte 115 +.byte 55 +.byte 50 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.2335: +.byte 115 +.byte 55 +.byte 50 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s72 +.text +.text +.align 2 +.ent s72 +s72: +.frame $sp,96,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-96 +.fmask 0xf0000000,-72 +.mask 0xc2ff0000,-24 +s.d $f28,16($sp) +s.d $f30,24($sp) +sw $16,32($sp) +sw $17,36($sp) +sw $18,40($sp) +sw $19,44($sp) +sw $20,48($sp) +sw $21,52($sp) +sw $22,56($sp) +sw $23,60($sp) +.cprestore 64 +sw $30,68($sp) +sw $31,72($sp) +move $30,$4 +la $22,L.2335 +la $21,60($30) +move $19,$0 +L.2336: +L.2337: +move $24,$21 +la $21,1($24) +move $15,$22 +la $22,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.2336 +la $24,2 +sw $24,-4+96($sp) +lw $15,-4+96($sp) +beq $15,$24,L.2339 +la $24,1 +la $19,1($19) +la $4,L.2334 +move $5,$24 +jal printf +L.2339: +lw $24,-4+96($sp) +negu $15,$24 +addu $24,$24,$15 +beq $24,$0,L.2341 +la $24,2 +la $19,2($19) +la $4,L.2334 +move $5,$24 +jal printf +L.2341: +sw $0,-4+96($sp) +move $23,$0 +b L.2346 +L.2343: +lw $24,-4+96($sp) +sll $24,$24,1 +or $24,$24,1 +sw $24,-4+96($sp) +L.2344: +la $23,1($23) +L.2346: +lw $24,4($30) +blt $23,$24,L.2343 +lw $24,-4+96($sp) +not $24,$24 +beq $24,$0,L.2347 +la $24,4 +la $19,4($19) +la $4,L.2334 +move $5,$24 +jal printf +L.2347: +la $24,5 +sw $24,-4+96($sp) +lw $24,-4+96($sp) +la $24,1($24) +sw $24,-4+96($sp) +la $15,6 +bne $24,$15,L.2354 +lw $24,-4+96($sp) +subu $24,$24,1 +sw $24,-4+96($sp) +la $14,5 +bne $24,$14,L.2354 +lw $24,-4+96($sp) +la $13,1($24) +sw $13,-4+96($sp) +bne $24,$14,L.2354 +lw $24,-4+96($sp) +subu $13,$24,1 +sw $13,-4+96($sp) +bne $24,$15,L.2354 +lw $24,-4+96($sp) +beq $24,$14,L.2349 +L.2354: +la $24,8 +la $19,8($19) +la $4,L.2334 +move $5,$24 +jal printf +L.2349: +la $17,26 +la $24,26 +sw $24,-8+96($sp) +l.d $f30,L.2355 +la $16,26 +la $24,26 +sw $24,-12+96($sp) +la $18,26 +l.s $f28,L.2356 +move $20,$0 +la $24,26 +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +sll $15,$15,8*(4-1); sra $15,$15,8*(4-1) +bne $15,$24,L.2363 +move $15,$18 +sll $15,$15,8*(4-1); sra $15,$15,8*(4-1) +bne $15,$24,L.2363 +lw $15,-8+96($sp) +sll $15,$15,8*(4-1); sra $15,$15,8*(4-1) +bne $15,$24,L.2363 +lw $15,-12+96($sp) +sll $15,$15,8*(4-1); sra $15,$15,8*(4-1) +bne $15,$24,L.2363 +trunc.w.s $f2,$f28,$15; mfc1 $15,$f2 +sll $15,$15,8*(4-1); sra $15,$15,8*(4-1) +bne $15,$24,L.2363 +trunc.w.d $f2,$f30,$15; mfc1 $15,$f2 +sll $15,$15,8*(4-1); sra $15,$15,8*(4-1) +beq $15,$24,L.2357 +L.2363: +la $20,1($20) +L.2357: +la $24,26 +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +sll $15,$15,8*(4-2); sra $15,$15,8*(4-2) +bne $15,$24,L.2370 +move $15,$18 +sll $15,$15,8*(4-2); sra $15,$15,8*(4-2) +bne $15,$24,L.2370 +lw $15,-8+96($sp) +sll $15,$15,8*(4-2); sra $15,$15,8*(4-2) +bne $15,$24,L.2370 +lw $15,-12+96($sp) +sll $15,$15,8*(4-2); sra $15,$15,8*(4-2) +bne $15,$24,L.2370 +trunc.w.s $f2,$f28,$15; mfc1 $15,$f2 +sll $15,$15,8*(4-2); sra $15,$15,8*(4-2) +bne $15,$24,L.2370 +trunc.w.d $f2,$f30,$15; mfc1 $15,$f2 +sll $15,$15,8*(4-2); sra $15,$15,8*(4-2) +beq $15,$24,L.2364 +L.2370: +la $20,2($20) +L.2364: +la $24,26 +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +bne $15,$24,L.2377 +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +bne $15,$24,L.2377 +lw $15,-8+96($sp) +bne $15,$24,L.2377 +lw $15,-12+96($sp) +bne $15,$24,L.2377 +trunc.w.s $f2,$f28,$15; mfc1 $15,$f2 +bne $15,$24,L.2377 +trunc.w.d $f2,$f30,$15; mfc1 $15,$f2 +beq $15,$24,L.2371 +L.2377: +la $20,4($20) +L.2371: +la $24,26 +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +bne $15,$24,L.2384 +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +bne $15,$24,L.2384 +bne $18,$24,L.2384 +lw $15,-12+96($sp) +bne $15,$24,L.2384 +trunc.w.s $f2,$f28,$15; mfc1 $15,$f2 +bne $15,$24,L.2384 +trunc.w.d $f2,$f30,$15; mfc1 $15,$f2 +beq $15,$24,L.2378 +L.2384: +la $20,8($20) +L.2378: +la $24,26 +sll $15,$17,8*(4-1); sra $15,$15,8*(4-1) +bne $15,$24,L.2393 +sll $15,$16,8*(4-2); sra $15,$15,8*(4-2) +bne $15,$24,L.2393 +move $15,$18 +bne $15,$24,L.2393 +lw $15,-8+96($sp) +bne $15,$24,L.2393 +l.s $f18,L.828 +c.ult.s $f28,$f18; bc1t L.2394 +sub.s $f18,$f28,$f18 +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-16+96($sp) +b L.2395 +L.2394: +trunc.w.s $f2,$f28,$24; mfc1 $24,$f2 +sw $24,-16+96($sp) +L.2395: +lw $24,-16+96($sp) +la $15,26 +bne $24,$15,L.2393 +l.d $f18,L.836 +c.ult.d $f30,$f18; bc1t L.2396 +sub.d $f18,$f30,$f18 +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-20+96($sp) +b L.2397 +L.2396: +trunc.w.d $f2,$f30,$24; mfc1 $24,$f2 +sw $24,-20+96($sp) +L.2397: +lw $24,-20+96($sp) +la $15,26 +beq $24,$15,L.2385 +L.2393: +la $20,16($20) +L.2385: +l.d $f18,L.2355 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f16; cvt.s.w $f16,$f16 +cvt.d.s $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2404 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f16; cvt.s.w $f16,$f16 +cvt.d.s $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2404 +mtc1 $18,$f16; cvt.s.w $f16,$f16 +cvt.d.s $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2404 +lw $24,-8+96($sp) +mtc1 $24,$f16; cvt.s.w $f16,$f16 +cvt.d.s $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2404 +lw $24,-12+96($sp) +l.d $f16,L.596 +srl $15,$24,1 +mtc1 $15,$f10; cvt.d.w $f10,$f10 +mul.d $f16,$f16,$f10 +and $24,$24,1 +mtc1 $24,$f10; cvt.d.w $f10,$f10 +add.d $f16,$f16,$f10 +cvt.s.d $f16,$f16 +cvt.d.s $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2404 +cvt.s.d $f16,$f30 +cvt.d.s $f16,$f16 +c.eq.d $f16,$f18; bc1t L.2398 +L.2404: +la $20,32($20) +L.2398: +l.d $f18,L.2355 +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +mtc1 $24,$f16; cvt.d.w $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2411 +sll $24,$16,8*(4-2); sra $24,$24,8*(4-2) +mtc1 $24,$f16; cvt.d.w $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2411 +mtc1 $18,$f16; cvt.d.w $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2411 +lw $24,-8+96($sp) +mtc1 $24,$f16; cvt.d.w $f16,$f16 +c.eq.d $f16,$f18; bc1f L.2411 +lw $24,-12+96($sp) +l.d $f16,L.596 +srl $15,$24,1 +mtc1 $15,$f10; cvt.d.w $f10,$f10 +mul.d $f16,$f16,$f10 +and $24,$24,1 +mtc1 $24,$f10; cvt.d.w $f10,$f10 +add.d $f16,$f16,$f10 +c.eq.d $f16,$f18; bc1f L.2411 +cvt.d.s $f16,$f28 +c.eq.d $f16,$f18; bc1t L.2405 +L.2411: +la $20,64($20) +L.2405: +beq $20,$0,L.2412 +la $24,16 +la $19,16($19) +la $4,L.2334 +move $5,$24 +jal printf +L.2412: +move $2,$19 +L.2333: +l.d $f28,16($sp) +l.d $f30,24($sp) +lw $16,32($sp) +lw $17,36($sp) +lw $18,40($sp) +lw $19,44($sp) +lw $20,48($sp) +lw $21,52($sp) +lw $22,56($sp) +lw $23,60($sp) +lw $25,64($sp) +lw $30,68($sp) +lw $31,72($sp) +addu $sp,$sp,96 +j $31 +.end s72 +.data +.align 0 +L.2415: +.byte 115 +.byte 55 +.byte 53 +.byte 55 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.2416: +.byte 115 +.byte 55 +.byte 53 +.byte 55 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s757 +.text +.text +.align 2 +.ent s757 +s757: +.frame $sp,176,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-176 +.mask 0xc2ff0000,-120 +sw $16,16($sp) +sw $17,20($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +move $30,$4 +la $24,L.2416 +sw $24,-80+176($sp) +la $24,60($30) +sw $24,-84+176($sp) +sw $0,-88+176($sp) +L.2417: +L.2418: +lw $24,-84+176($sp) +la $15,1($24) +sw $15,-84+176($sp) +lw $15,-80+176($sp) +la $14,1($15) +sw $14,-80+176($sp) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.2417 +la $24,40 +sw $24,-92+176($sp) +lw $24,-92+176($sp) +sll $15,$24,3 +sll $15,$15,2 +la $14,1280 +bne $15,$14,L.2422 +sra $24,$24,3 +sra $24,$24,2 +la $15,1 +beq $24,$15,L.2420 +L.2422: +lw $24,-88+176($sp) +la $24,1($24) +sw $24,-88+176($sp) +lw $24,44($30) +beq $24,$0,L.2423 +la $4,L.2415 +la $5,1 +jal printf +L.2423: +L.2420: +move $19,$0 +sw $0,-68+176($sp) +b L.2428 +L.2425: +la $17,1 +lw $24,16($30) +subu $24,$24,1 +sll $16,$17,$24 +sw $0,-72+176($sp) +lw $24,-72+176($sp) +not $24,$24 +lw $15,-68+176($sp) +srl $14,$24,$15 +sw $14,-76+176($sp) +sll $24,$24,$15 +sw $24,-72+176($sp) +move $18,$0 +b L.2432 +L.2429: +lw $24,-68+176($sp) +bge $18,$24,L.2440 +la $24,1 +sw $24,-100+176($sp) +b L.2441 +L.2440: +sw $0,-100+176($sp) +L.2441: +lw $24,-72+176($sp) +and $24,$17,$24 +bne $24,$0,L.2442 +la $24,1 +sw $24,-104+176($sp) +b L.2443 +L.2442: +sw $0,-104+176($sp) +L.2443: +lw $24,-100+176($sp) +lw $15,-104+176($sp) +bne $24,$15,L.2439 +lw $24,-68+176($sp) +bge $18,$24,L.2444 +la $24,1 +sw $24,-108+176($sp) +b L.2445 +L.2444: +sw $0,-108+176($sp) +L.2445: +lw $24,-76+176($sp) +and $24,$16,$24 +bne $24,$0,L.2446 +la $24,1 +sw $24,-112+176($sp) +b L.2447 +L.2446: +sw $0,-112+176($sp) +L.2447: +lw $24,-108+176($sp) +lw $15,-112+176($sp) +beq $24,$15,L.2433 +L.2439: +la $19,1 +L.2433: +sll $17,$17,1 +srl $16,$16,1 +L.2430: +la $18,1($18) +L.2432: +lw $24,16($30) +blt $18,$24,L.2429 +L.2426: +lw $24,-68+176($sp) +la $24,1($24) +sw $24,-68+176($sp) +L.2428: +lw $24,-68+176($sp) +lw $15,16($30) +blt $24,$15,L.2425 +beq $19,$0,L.2448 +lw $24,-88+176($sp) +la $24,2($24) +sw $24,-88+176($sp) +lw $24,44($30) +beq $24,$0,L.2450 +la $4,L.2415 +la $5,2 +jal printf +L.2450: +L.2448: +la $20,3 +la $21,2 +la $22,1 +bge $20,$21,L.2458 +la $24,1 +sw $24,-104+176($sp) +b L.2459 +L.2458: +sw $0,-104+176($sp) +L.2459: +lw $24,-104+176($sp) +bge $24,$22,L.2456 +la $24,1 +sw $24,-100+176($sp) +b L.2457 +L.2456: +sw $0,-100+176($sp) +L.2457: +lw $24,-100+176($sp) +la $15,1 +beq $24,$15,L.2452 +lw $24,-88+176($sp) +la $24,4($24) +sw $24,-88+176($sp) +lw $24,44($30) +beq $24,$0,L.2460 +la $4,L.2415 +la $5,4 +jal printf +L.2460: +L.2452: +la $24,-60+176($sp) +la $15,-64+176($sp) +bne $24,$15,L.2462 +lw $24,-88+176($sp) +la $24,8($24) +sw $24,-88+176($sp) +lw $24,44($30) +beq $24,$0,L.2465 +la $4,L.2415 +la $5,8 +jal printf +L.2465: +L.2462: +la $24,-60+176($sp) +la $15,-64+176($sp) +bgeu $24,$15,L.2467 +lw $24,40($30) +beq $24,$0,L.2470 +la $4,L.2472 +jal printf +L.2470: +L.2467: +move $19,$0 +move $18,$0 +L.2473: +sll $24,$18,2 +la $15,-64+176($sp) +addu $24,$24,$15 +la $15,1 +sw $15,($24) +L.2474: +la $18,1($18) +la $24,16 +blt $18,$24,L.2473 +sw $0,-60+176($sp) +sw $0,-48+176($sp) +sw $0,-40+176($sp) +sw $0,-36+176($sp) +sw $0,-28+176($sp) +sw $0,-12+176($sp) +move $20,$0 +L.2483: +move $21,$0 +L.2487: +move $22,$0 +L.2491: +move $23,$0 +L.2495: +bge $20,$21,L.2506 +la $24,1 +sw $24,-112+176($sp) +b L.2507 +L.2506: +sw $0,-112+176($sp) +L.2507: +bge $22,$23,L.2508 +la $24,1 +sw $24,-116+176($sp) +b L.2509 +L.2508: +sw $0,-116+176($sp) +L.2509: +lw $24,-112+176($sp) +lw $15,-116+176($sp) +bne $24,$15,L.2504 +la $24,1 +sw $24,-108+176($sp) +b L.2505 +L.2504: +sw $0,-108+176($sp) +L.2505: +lw $24,-108+176($sp) +sll $15,$20,3 +sll $14,$21,2 +addu $15,$15,$14 +sll $14,$22,1 +addu $15,$15,$14 +addu $15,$15,$23 +sll $15,$15,2 +la $14,-64+176($sp) +addu $15,$15,$14 +lw $15,($15) +beq $24,$15,L.2499 +la $19,1 +L.2499: +L.2496: +la $23,1($23) +la $24,2 +blt $23,$24,L.2495 +L.2492: +la $22,1($22) +la $24,2 +blt $22,$24,L.2491 +L.2488: +la $21,1($21) +la $24,2 +blt $21,$24,L.2487 +L.2484: +la $20,1($20) +la $24,2 +blt $20,$24,L.2483 +beq $19,$0,L.2510 +lw $24,-88+176($sp) +la $24,16($24) +sw $24,-88+176($sp) +lw $24,44($30) +beq $24,$0,L.2512 +la $4,L.2415 +la $5,16 +jal printf +L.2512: +L.2510: +sw $0,-96+176($sp) +lw $24,-96+176($sp) +beq $24,$0,L.2514 +lw $24,-88+176($sp) +la $24,32($24) +sw $24,-88+176($sp) +lw $24,44($30) +beq $24,$0,L.2516 +la $4,L.2415 +la $5,32 +jal printf +L.2516: +L.2514: +lw $2,-88+176($sp) +L.2414: +lw $16,16($sp) +lw $17,20($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,176 +j $31 +.end s757 +.data +.align 0 +L.2519: +.byte 76 +.byte 111 +.byte 99 +.byte 97 +.byte 108 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 37 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.data +.align 0 +L.2520: +.byte 115 +.byte 55 +.byte 56 +.byte 49 +.byte 51 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.2521: +.byte 115 +.byte 55 +.byte 56 +.byte 49 +.byte 51 +.byte 32 +.byte 32 +.byte 0 +.globl s7813 +.text +.text +.align 2 +.ent s7813 +s7813: +.frame $sp,112,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-112 +.mask 0xc2ff0000,-56 +sw $16,16($sp) +sw $17,20($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +sw $4,112($sp) +la $19,L.2521 +lw $24,0+112($sp) +la $18,60($24) +move $23,$0 +move $17,$0 +lw $30,48($24) +L.2522: +L.2523: +move $24,$18 +la $18,1($24) +move $15,$19 +la $19,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.2522 +b L.2525 +la $23,1 +beq $30,$0,L.2527 +la $4,L.2519 +move $5,$23 +jal printf +L.2527: +L.2525: +b L.2529 +la $23,2 +beq $30,$0,L.2531 +la $4,L.2519 +move $5,$23 +jal printf +L.2531: +L.2529: +b L.2533 +la $23,3 +beq $30,$0,L.2535 +la $4,L.2519 +move $5,$23 +jal printf +L.2535: +L.2533: +b L.2537 +la $23,4 +beq $30,$0,L.2539 +la $4,L.2519 +move $5,$23 +jal printf +L.2539: +L.2537: +b L.2541 +la $23,5 +beq $30,$0,L.2543 +la $4,L.2519 +move $5,$23 +jal printf +L.2543: +L.2541: +b L.2545 +la $23,6 +beq $30,$0,L.2547 +la $4,L.2519 +move $5,$23 +jal printf +L.2547: +L.2545: +b L.2549 +la $23,7 +beq $30,$0,L.2551 +la $4,L.2519 +move $5,$23 +jal printf +L.2551: +L.2549: +b L.2553 +la $23,8 +beq $30,$0,L.2555 +la $4,L.2519 +move $5,$23 +jal printf +L.2555: +L.2553: +b L.2557 +la $23,9 +beq $30,$0,L.2559 +la $4,L.2519 +move $5,$23 +jal printf +L.2559: +L.2557: +b L.2561 +la $23,10 +beq $30,$0,L.2563 +la $4,L.2519 +move $5,$23 +jal printf +L.2563: +L.2561: +b L.2565 +la $23,11 +beq $30,$0,L.2567 +la $4,L.2519 +move $5,$23 +jal printf +L.2567: +L.2565: +b L.2569 +la $23,12 +beq $30,$0,L.2571 +la $4,L.2519 +move $5,$23 +jal printf +L.2571: +L.2569: +b L.2573 +la $23,13 +beq $30,$0,L.2575 +la $4,L.2519 +move $5,$23 +jal printf +L.2575: +L.2573: +b L.2577 +la $23,14 +beq $30,$0,L.2579 +la $4,L.2519 +move $5,$23 +jal printf +L.2579: +L.2577: +b L.2581 +la $23,15 +beq $30,$0,L.2583 +la $4,L.2519 +move $5,$23 +jal printf +L.2583: +L.2581: +b L.2585 +la $23,16 +beq $30,$0,L.2587 +la $4,L.2519 +move $5,$23 +jal printf +L.2587: +L.2585: +b L.2589 +la $23,17 +beq $30,$0,L.2591 +la $4,L.2519 +move $5,$23 +jal printf +L.2591: +L.2589: +b L.2593 +la $23,18 +beq $30,$0,L.2595 +la $4,L.2519 +move $5,$23 +jal printf +L.2595: +L.2593: +b L.2597 +la $23,16 +beq $30,$0,L.2599 +la $4,L.2519 +move $5,$23 +jal printf +L.2599: +L.2597: +b L.2601 +la $23,20 +beq $30,$0,L.2603 +la $4,L.2519 +move $5,$23 +jal printf +L.2603: +L.2601: +b L.2605 +la $23,21 +beq $30,$0,L.2607 +la $4,L.2519 +move $5,$23 +jal printf +L.2607: +L.2605: +b L.2609 +la $23,22 +beq $30,$0,L.2611 +la $4,L.2519 +move $5,$23 +jal printf +L.2611: +L.2609: +b L.2613 +la $23,23 +beq $30,$0,L.2615 +la $4,L.2519 +move $5,$23 +jal printf +L.2615: +L.2613: +b L.2617 +la $23,24 +beq $30,$0,L.2619 +la $4,L.2519 +move $5,$23 +jal printf +L.2619: +L.2617: +b L.2621 +la $23,25 +beq $30,$0,L.2623 +la $4,L.2519 +move $5,$23 +jal printf +L.2623: +L.2621: +b L.2625 +la $23,26 +beq $30,$0,L.2627 +la $4,L.2519 +move $5,$23 +jal printf +L.2627: +L.2625: +b L.2629 +la $23,27 +beq $30,$0,L.2631 +la $4,L.2519 +move $5,$23 +jal printf +L.2631: +L.2629: +b L.2633 +la $23,28 +beq $30,$0,L.2635 +la $4,L.2519 +move $5,$23 +jal printf +L.2635: +L.2633: +b L.2637 +la $23,26 +beq $30,$0,L.2639 +la $4,L.2519 +move $5,$23 +jal printf +L.2639: +L.2637: +b L.2641 +la $23,30 +beq $30,$0,L.2643 +la $4,L.2519 +move $5,$23 +jal printf +L.2643: +L.2641: +b L.2645 +la $23,31 +beq $30,$0,L.2647 +la $4,L.2519 +move $5,$23 +jal printf +L.2647: +L.2645: +b L.2649 +la $23,32 +beq $30,$0,L.2651 +la $4,L.2519 +move $5,$23 +jal printf +L.2651: +L.2649: +b L.2653 +la $23,33 +beq $30,$0,L.2655 +la $4,L.2519 +move $5,$23 +jal printf +L.2655: +L.2653: +b L.2657 +la $23,34 +beq $30,$0,L.2659 +la $4,L.2519 +move $5,$23 +jal printf +L.2659: +L.2657: +b L.2661 +la $23,35 +beq $30,$0,L.2663 +la $4,L.2519 +move $5,$23 +jal printf +L.2663: +L.2661: +b L.2665 +la $23,36 +beq $30,$0,L.2667 +la $4,L.2519 +move $5,$23 +jal printf +L.2667: +L.2665: +b L.2669 +la $23,37 +beq $30,$0,L.2671 +la $4,L.2519 +move $5,$23 +jal printf +L.2671: +L.2669: +b L.2673 +la $23,38 +beq $30,$0,L.2675 +la $4,L.2519 +move $5,$23 +jal printf +L.2675: +L.2673: +b L.2677 +la $23,39 +beq $30,$0,L.2679 +la $4,L.2519 +move $5,$23 +jal printf +L.2679: +L.2677: +b L.2681 +la $23,40 +beq $30,$0,L.2683 +la $4,L.2519 +move $5,$23 +jal printf +L.2683: +L.2681: +b L.2685 +la $23,41 +beq $30,$0,L.2687 +la $4,L.2519 +move $5,$23 +jal printf +L.2687: +L.2685: +b L.2689 +la $23,42 +beq $30,$0,L.2691 +la $4,L.2519 +move $5,$23 +jal printf +L.2691: +L.2689: +b L.2693 +la $23,43 +beq $30,$0,L.2695 +la $4,L.2519 +move $5,$23 +jal printf +L.2695: +L.2693: +b L.2697 +la $23,44 +beq $30,$0,L.2699 +la $4,L.2519 +move $5,$23 +jal printf +L.2699: +L.2697: +b L.2701 +la $23,45 +beq $30,$0,L.2703 +la $4,L.2519 +move $5,$23 +jal printf +L.2703: +L.2701: +b L.2705 +la $23,46 +beq $30,$0,L.2707 +la $4,L.2519 +move $5,$23 +jal printf +L.2707: +L.2705: +b L.2709 +la $23,47 +beq $30,$0,L.2711 +la $4,L.2519 +move $5,$23 +jal printf +L.2711: +L.2709: +b L.2713 +la $23,48 +beq $30,$0,L.2715 +la $4,L.2519 +move $5,$23 +jal printf +L.2715: +L.2713: +b L.2717 +la $23,49 +beq $30,$0,L.2719 +la $4,L.2519 +move $5,$23 +jal printf +L.2719: +L.2717: +b L.2721 +la $23,50 +beq $30,$0,L.2723 +la $4,L.2519 +move $5,$23 +jal printf +L.2723: +L.2721: +b L.2725 +la $23,51 +beq $30,$0,L.2727 +la $4,L.2519 +move $5,$23 +jal printf +L.2727: +L.2725: +b L.2729 +la $23,52 +beq $30,$0,L.2731 +la $4,L.2519 +move $5,$23 +jal printf +L.2731: +L.2729: +b L.2733 +la $23,53 +beq $30,$0,L.2735 +la $4,L.2519 +move $5,$23 +jal printf +L.2735: +L.2733: +b L.2737 +la $23,54 +beq $30,$0,L.2739 +la $4,L.2519 +move $5,$23 +jal printf +L.2739: +L.2737: +b L.2741 +la $23,55 +beq $30,$0,L.2743 +la $4,L.2519 +move $5,$23 +jal printf +L.2743: +L.2741: +b L.2745 +la $23,56 +beq $30,$0,L.2747 +la $4,L.2519 +move $5,$23 +jal printf +L.2747: +L.2745: +b L.2749 +la $23,57 +beq $30,$0,L.2751 +la $4,L.2519 +move $5,$23 +jal printf +L.2751: +L.2749: +b L.2753 +la $23,58 +beq $30,$0,L.2755 +la $4,L.2519 +move $5,$23 +jal printf +L.2755: +L.2753: +b L.2757 +la $23,56 +beq $30,$0,L.2759 +la $4,L.2519 +move $5,$23 +jal printf +L.2759: +L.2757: +b L.2761 +la $23,60 +beq $30,$0,L.2763 +la $4,L.2519 +move $5,$23 +jal printf +L.2763: +L.2761: +b L.2765 +la $23,61 +beq $30,$0,L.2767 +la $4,L.2519 +move $5,$23 +jal printf +L.2767: +L.2765: +b L.2769 +la $23,62 +beq $30,$0,L.2771 +la $4,L.2519 +move $5,$23 +jal printf +L.2771: +L.2769: +b L.2773 +la $23,63 +beq $30,$0,L.2775 +la $4,L.2519 +move $5,$23 +jal printf +L.2775: +L.2773: +b L.2777 +la $23,64 +beq $30,$0,L.2779 +la $4,L.2519 +move $5,$23 +jal printf +L.2779: +L.2777: +b L.2781 +la $23,65 +beq $30,$0,L.2783 +la $4,L.2519 +move $5,$23 +jal printf +L.2783: +L.2781: +b L.2785 +la $23,66 +beq $30,$0,L.2787 +la $4,L.2519 +move $5,$23 +jal printf +L.2787: +L.2785: +b L.2789 +la $23,67 +beq $30,$0,L.2791 +la $4,L.2519 +move $5,$23 +jal printf +L.2791: +L.2789: +b L.2793 +la $23,68 +beq $30,$0,L.2795 +la $4,L.2519 +move $5,$23 +jal printf +L.2795: +L.2793: +b L.2797 +la $23,69 +beq $30,$0,L.2799 +la $4,L.2519 +move $5,$23 +jal printf +L.2799: +L.2797: +b L.2801 +la $23,70 +beq $30,$0,L.2803 +la $4,L.2519 +move $5,$23 +jal printf +L.2803: +L.2801: +b L.2805 +la $23,71 +beq $30,$0,L.2807 +la $4,L.2519 +move $5,$23 +jal printf +L.2807: +L.2805: +b L.2809 +la $23,72 +beq $30,$0,L.2811 +la $4,L.2519 +move $5,$23 +jal printf +L.2811: +L.2809: +b L.2813 +la $23,73 +beq $30,$0,L.2815 +la $4,L.2519 +move $5,$23 +jal printf +L.2815: +L.2813: +b L.2817 +la $23,74 +beq $30,$0,L.2819 +la $4,L.2519 +move $5,$23 +jal printf +L.2819: +L.2817: +b L.2821 +la $23,75 +beq $30,$0,L.2823 +la $4,L.2519 +move $5,$23 +jal printf +L.2823: +L.2821: +beq $23,$0,L.2825 +lw $24,0+112($sp) +lw $24,44($24) +beq $24,$0,L.2827 +la $4,L.2520 +la $5,1 +jal printf +L.2827: +la $17,1($17) +L.2825: +move $23,$0 +move $21,$0 +move $22,$0 +move $24,$22 +la $22,1($24) +move $15,$0 +beq $24,$15,L.2830 +move $24,$21 +la $21,1($24) +beq $24,$15,L.2830 +la $24,1 +sw $24,-8+112($sp) +b L.2831 +L.2830: +sw $0,-8+112($sp) +L.2831: +lw $20,-8+112($sp) +la $24,1 +beq $22,$24,L.2832 +la $23,1 +beq $30,$0,L.2834 +la $4,L.2519 +move $5,$23 +jal printf +L.2834: +L.2832: +beq $21,$0,L.2836 +la $23,2 +beq $30,$0,L.2838 +la $4,L.2519 +move $5,$23 +jal printf +L.2838: +L.2836: +beq $20,$0,L.2840 +la $23,3 +beq $30,$0,L.2842 +la $4,L.2519 +move $5,$23 +jal printf +L.2842: +L.2840: +beq $22,$0,L.2845 +move $15,$21 +la $21,1($15) +beq $15,$0,L.2845 +la $24,1 +sw $24,-12+112($sp) +b L.2846 +L.2845: +sw $0,-12+112($sp) +L.2846: +lw $20,-12+112($sp) +la $24,1 +beq $22,$24,L.2847 +la $23,4 +beq $30,$0,L.2849 +la $4,L.2519 +move $5,$23 +jal printf +L.2849: +L.2847: +la $24,1 +beq $21,$24,L.2851 +la $23,5 +beq $30,$0,L.2853 +la $4,L.2519 +move $5,$23 +jal printf +L.2853: +L.2851: +beq $20,$0,L.2855 +la $23,6 +beq $30,$0,L.2857 +la $4,L.2519 +move $5,$23 +jal printf +L.2857: +L.2855: +move $24,$22 +subu $22,$24,1 +move $15,$0 +beq $24,$15,L.2860 +beq $21,$15,L.2860 +la $24,1 +sw $24,-16+112($sp) +b L.2861 +L.2860: +sw $0,-16+112($sp) +L.2861: +lw $20,-16+112($sp) +beq $22,$0,L.2862 +la $23,7 +beq $30,$0,L.2864 +la $4,L.2519 +move $5,$23 +jal printf +L.2864: +L.2862: +la $24,1 +beq $21,$24,L.2866 +la $23,8 +beq $30,$0,L.2868 +la $4,L.2519 +move $5,$23 +jal printf +L.2868: +L.2866: +la $24,1 +beq $20,$24,L.2870 +la $23,9 +beq $30,$0,L.2872 +la $4,L.2519 +move $5,$23 +jal printf +L.2872: +L.2870: +beq $22,$0,L.2875 +move $15,$21 +subu $21,$15,1 +beq $15,$0,L.2875 +la $24,1 +sw $24,-20+112($sp) +b L.2876 +L.2875: +sw $0,-20+112($sp) +L.2876: +lw $20,-20+112($sp) +beq $22,$0,L.2877 +la $23,10 +beq $30,$0,L.2879 +la $4,L.2519 +move $5,$23 +jal printf +L.2879: +L.2877: +la $24,1 +beq $21,$24,L.2881 +la $23,11 +beq $30,$0,L.2883 +la $4,L.2519 +move $5,$23 +jal printf +L.2883: +L.2881: +beq $20,$0,L.2885 +la $23,12 +beq $30,$0,L.2887 +la $4,L.2519 +move $5,$23 +jal printf +L.2887: +L.2885: +beq $23,$0,L.2889 +lw $24,0+112($sp) +lw $24,44($24) +beq $24,$0,L.2891 +la $4,L.2520 +la $5,2 +jal printf +L.2891: +la $17,2($17) +L.2889: +move $23,$0 +move $21,$0 +move $22,$0 +move $24,$22 +la $22,1($24) +move $15,$0 +bne $24,$15,L.2896 +beq $21,$15,L.2894 +L.2896: +la $24,1 +sw $24,-24+112($sp) +b L.2895 +L.2894: +sw $0,-24+112($sp) +L.2895: +lw $20,-24+112($sp) +la $24,1 +beq $22,$24,L.2897 +la $23,1 +beq $30,$0,L.2899 +la $4,L.2519 +move $5,$23 +jal printf +L.2899: +L.2897: +beq $21,$0,L.2901 +la $23,2 +beq $30,$0,L.2903 +la $4,L.2519 +move $5,$23 +jal printf +L.2903: +L.2901: +beq $20,$0,L.2905 +la $23,3 +beq $30,$0,L.2907 +la $4,L.2519 +move $5,$23 +jal printf +L.2907: +L.2905: +move $24,$21 +la $21,1($24) +move $15,$0 +bne $24,$15,L.2912 +beq $22,$15,L.2910 +L.2912: +la $24,1 +sw $24,-28+112($sp) +b L.2911 +L.2910: +sw $0,-28+112($sp) +L.2911: +lw $20,-28+112($sp) +la $24,1 +beq $22,$24,L.2913 +la $23,4 +beq $30,$0,L.2915 +la $4,L.2519 +move $5,$23 +jal printf +L.2915: +L.2913: +la $24,1 +beq $21,$24,L.2917 +la $23,5 +beq $30,$0,L.2919 +la $4,L.2519 +move $5,$23 +jal printf +L.2919: +L.2917: +la $24,1 +beq $20,$24,L.2921 +la $23,6 +beq $30,$0,L.2923 +la $4,L.2519 +move $5,$23 +jal printf +L.2923: +L.2921: +move $24,$22 +subu $22,$24,1 +move $15,$0 +bne $24,$15,L.2928 +move $24,$21 +subu $21,$24,1 +beq $24,$15,L.2926 +L.2928: +la $24,1 +sw $24,-32+112($sp) +b L.2927 +L.2926: +sw $0,-32+112($sp) +L.2927: +lw $20,-32+112($sp) +beq $22,$0,L.2929 +la $23,7 +beq $30,$0,L.2931 +la $4,L.2519 +move $5,$23 +jal printf +L.2931: +L.2929: +la $24,1 +beq $21,$24,L.2933 +la $23,8 +beq $30,$0,L.2935 +la $4,L.2519 +move $5,$23 +jal printf +L.2935: +L.2933: +la $24,1 +beq $20,$24,L.2937 +la $23,9 +beq $30,$0,L.2939 +la $4,L.2519 +move $5,$23 +jal printf +L.2939: +L.2937: +move $24,$0 +bne $22,$24,L.2944 +move $15,$21 +subu $21,$15,1 +beq $15,$24,L.2942 +L.2944: +la $24,1 +sw $24,-36+112($sp) +b L.2943 +L.2942: +sw $0,-36+112($sp) +L.2943: +lw $20,-36+112($sp) +beq $22,$0,L.2945 +la $23,10 +beq $30,$0,L.2947 +la $4,L.2519 +move $5,$23 +jal printf +L.2947: +L.2945: +beq $21,$0,L.2949 +la $23,11 +beq $30,$0,L.2951 +la $4,L.2519 +move $5,$23 +jal printf +L.2951: +L.2949: +la $24,1 +beq $20,$24,L.2953 +la $23,12 +beq $30,$0,L.2955 +la $4,L.2519 +move $5,$23 +jal printf +L.2955: +L.2953: +beq $23,$0,L.2957 +lw $24,0+112($sp) +lw $24,44($24) +beq $24,$0,L.2959 +la $4,L.2520 +la $5,4 +jal printf +L.2959: +la $17,4($17) +L.2957: +move $24,$0 +move $21,$24 +move $22,$24 +move $16,$24 +la $15,1 +sw $15,-4+112($sp) +lw $15,-4+112($sp) +beq $15,$24,L.2963 +sw $16,-40+112($sp) +b L.2964 +L.2963: +lw $24,-4+112($sp) +beq $24,$0,L.2965 +move $24,$22 +la $22,1($24) +sw $24,-44+112($sp) +b L.2966 +L.2965: +move $24,$21 +la $21,1($24) +sw $24,-44+112($sp) +L.2966: +lw $24,-44+112($sp) +sw $24,-40+112($sp) +L.2964: +lw $20,-40+112($sp) +bne $20,$0,L.2970 +bne $22,$0,L.2970 +beq $21,$0,L.2967 +L.2970: +lw $24,0+112($sp) +lw $24,44($24) +beq $24,$0,L.2971 +la $4,L.2520 +la $5,8 +jal printf +L.2971: +la $17,8($17) +L.2967: +lw $24,-4+112($sp) +beq $24,$0,L.2978 +sw $16,-48+112($sp) +b L.2979 +L.2978: +la $24,1 +sw $24,-48+112($sp) +L.2979: +lw $15,-48+112($sp) +bne $15,$0,L.2977 +beq $16,$0,L.2980 +la $24,1 +sw $24,-52+112($sp) +b L.2981 +L.2980: +sw $16,-52+112($sp) +L.2981: +lw $24,-52+112($sp) +beq $24,$0,L.2973 +L.2977: +lw $24,0+112($sp) +lw $24,44($24) +beq $24,$0,L.2982 +la $4,L.2520 +la $5,16 +jal printf +L.2982: +la $17,16($17) +L.2973: +move $2,$17 +L.2518: +lw $16,16($sp) +lw $17,20($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,112 +j $31 +.end s7813 +.data +.align 0 +L.2985: +.byte 115 +.byte 56 +.byte 49 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.2986: +.byte 115 +.byte 56 +.byte 49 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.data +.align 0 +L.2987: +.byte 82 +.byte 101 +.byte 103 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 117 +.byte 110 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 37 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 117 +.byte 110 +.byte 114 +.byte 101 +.byte 108 +.byte 105 +.byte 97 +.byte 98 +.byte 108 +.byte 101 +.byte 46 +.byte 10 +.byte 0 +.data +.align 0 +L.2988: +.byte 37 +.byte 100 +.byte 32 +.byte 114 +.byte 101 +.byte 103 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 37 +.byte 115 +.byte 32 +.byte 118 +.byte 97 +.byte 114 +.byte 105 +.byte 97 +.byte 98 +.byte 108 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.globl s81 +.text +.text +.align 2 +.ent s81 +s81: +.frame $sp,80,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-80 +.mask 0xc2ff0000,-24 +sw $16,16($sp) +sw $17,20($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +sw $4,80($sp) +sw $0,-20+80($sp) +sw $0,-8+80($sp) +sw $0,-12+80($sp) +sw $0,-16+80($sp) +la $17,L.2986 +lw $24,0+80($sp) +la $16,60($24) +L.2989: +L.2990: +move $24,$16 +la $16,1($24) +move $15,$17 +la $17,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.2989 +la $24,1 +sw $24,-4+80($sp) +move $21,$0 +L.2992: +lw $24,-4+80($sp) +move $15,$24 +move $30,$15 +move $20,$15 +la $23,-4+80($sp) +la $19,-4+80($sp) +move $22,$24 +move $18,$24 +sll $24,$30,8*(4-1); sra $24,$24,8*(4-1) +sll $15,$20,8*(4-1); sra $15,$15,8*(4-1) +beq $24,$15,L.2996 +la $24,1 +sw $24,-8+80($sp) +L.2996: +move $24,$23 +move $15,$19 +beq $24,$15,L.2998 +la $24,1 +sw $24,-12+80($sp) +L.2998: +beq $22,$18,L.3000 +la $24,1 +sw $24,-16+80($sp) +L.3000: +lw $24,-4+80($sp) +sll $24,$24,1 +sw $24,-4+80($sp) +L.2993: +la $21,1($21) +la $24,50 +blt $21,$24,L.2992 +lw $24,-8+80($sp) +beq $24,$0,L.3002 +lw $24,-20+80($sp) +la $24,1($24) +sw $24,-20+80($sp) +lw $24,0+80($sp) +lw $24,44($24) +beq $24,$0,L.3004 +la $4,L.2985 +la $5,1 +jal printf +L.3004: +L.3002: +lw $24,-12+80($sp) +beq $24,$0,L.3006 +lw $24,-20+80($sp) +la $24,2($24) +sw $24,-20+80($sp) +lw $24,0+80($sp) +lw $24,44($24) +beq $24,$0,L.3008 +la $4,L.2985 +la $5,2 +jal printf +L.3008: +L.3006: +lw $24,-16+80($sp) +beq $24,$0,L.3010 +lw $24,-20+80($sp) +la $24,4($24) +sw $24,-20+80($sp) +lw $24,0+80($sp) +lw $24,44($24) +beq $24,$0,L.3012 +la $4,L.2985 +la $5,4 +jal printf +L.3012: +L.3010: +jal regc +sw $2,-4+80($sp) +lw $24,0+80($sp) +lw $24,40($24) +beq $24,$0,L.3014 +lw $24,-4+80($sp) +bge $24,$0,L.3016 +la $4,L.2987 +la $5,L.425 +jal printf +b L.3017 +L.3016: +la $4,L.2988 +lw $5,-4+80($sp) +la $6,L.425 +jal printf +L.3017: +L.3014: +jal regp +sw $2,-4+80($sp) +lw $24,0+80($sp) +lw $24,40($24) +beq $24,$0,L.3018 +lw $24,-4+80($sp) +bge $24,$0,L.3020 +la $4,L.2987 +la $5,L.3022 +jal printf +b L.3021 +L.3020: +la $4,L.2988 +lw $5,-4+80($sp) +la $6,L.3022 +jal printf +L.3021: +L.3018: +jal regi +sw $2,-4+80($sp) +lw $24,0+80($sp) +lw $24,40($24) +beq $24,$0,L.3023 +lw $24,-4+80($sp) +bge $24,$0,L.3025 +la $4,L.2987 +la $5,L.426 +jal printf +b L.3026 +L.3025: +la $4,L.2988 +lw $5,-4+80($sp) +la $6,L.426 +jal printf +L.3026: +L.3023: +lw $2,-20+80($sp) +L.2984: +lw $16,16($sp) +lw $17,20($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,80 +j $31 +.end s81 +.globl regc +.text +.align 2 +.ent regc +regc: +.frame $sp,176,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-176 +.mask 0x40ff0000,-144 +sw $16,0($sp) +sw $17,4($sp) +sw $18,8($sp) +sw $19,12($sp) +sw $20,16($sp) +sw $21,20($sp) +sw $22,24($sp) +sw $23,28($sp) +sw $30,32($sp) +sb $0,-130+176($sp) +la $24,1 +sb $24,-109+176($sp) +la $24,2 +sb $24,-110+176($sp) +la $24,3 +sb $24,-111+176($sp) +la $30,4 +la $24,5 +sb $24,-112+176($sp) +la $23,6 +la $24,7 +sb $24,-113+176($sp) +la $22,8 +la $24,9 +sb $24,-114+176($sp) +la $21,10 +la $24,11 +sb $24,-115+176($sp) +la $20,12 +la $24,13 +sb $24,-116+176($sp) +la $19,14 +la $24,15 +sb $24,-117+176($sp) +la $18,16 +la $24,17 +sb $24,-118+176($sp) +la $17,18 +la $24,19 +sb $24,-119+176($sp) +la $16,20 +la $24,21 +sb $24,-120+176($sp) +la $24,22 +sb $24,-1+176($sp) +la $24,23 +sb $24,-121+176($sp) +la $24,24 +sb $24,-2+176($sp) +la $24,25 +sb $24,-122+176($sp) +la $24,26 +sb $24,-3+176($sp) +la $24,27 +sb $24,-123+176($sp) +la $24,28 +sb $24,-4+176($sp) +la $24,29 +sb $24,-124+176($sp) +la $24,30 +sb $24,-5+176($sp) +la $24,31 +sb $24,-125+176($sp) +la $24,32 +sb $24,-6+176($sp) +la $24,33 +sb $24,-126+176($sp) +la $24,34 +sb $24,-7+176($sp) +la $24,35 +sb $24,-127+176($sp) +la $24,36 +sb $24,-128+176($sp) +la $24,37 +sb $24,-129+176($sp) +la $24,38 +sb $24,-131+176($sp) +la $24,-109+176($sp) +la $15,-130+176($sp) +subu $15,$24,$15 +sw $15,-96+176($sp) +la $15,-110+176($sp) +subu $24,$15,$24 +sw $24,-92+176($sp) +la $24,-111+176($sp) +la $15,-110+176($sp) +subu $24,$24,$15 +sw $24,-88+176($sp) +la $24,-112+176($sp) +la $15,-111+176($sp) +subu $24,$24,$15 +sw $24,-84+176($sp) +la $24,-113+176($sp) +la $15,-112+176($sp) +subu $24,$24,$15 +sw $24,-80+176($sp) +la $24,-114+176($sp) +la $15,-113+176($sp) +subu $24,$24,$15 +sw $24,-76+176($sp) +la $24,-115+176($sp) +la $15,-114+176($sp) +subu $24,$24,$15 +sw $24,-72+176($sp) +la $24,-116+176($sp) +la $15,-115+176($sp) +subu $24,$24,$15 +sw $24,-68+176($sp) +la $24,-117+176($sp) +la $15,-116+176($sp) +subu $24,$24,$15 +sw $24,-64+176($sp) +la $24,-118+176($sp) +la $15,-117+176($sp) +subu $24,$24,$15 +sw $24,-60+176($sp) +la $24,-119+176($sp) +la $15,-118+176($sp) +subu $24,$24,$15 +sw $24,-56+176($sp) +la $24,-120+176($sp) +la $15,-119+176($sp) +subu $24,$24,$15 +sw $24,-52+176($sp) +la $24,-121+176($sp) +la $15,-120+176($sp) +subu $24,$24,$15 +sw $24,-48+176($sp) +la $24,-122+176($sp) +la $15,-121+176($sp) +subu $24,$24,$15 +sw $24,-44+176($sp) +la $24,-123+176($sp) +la $15,-122+176($sp) +subu $24,$24,$15 +sw $24,-40+176($sp) +la $24,-124+176($sp) +la $15,-123+176($sp) +subu $24,$24,$15 +sw $24,-36+176($sp) +la $24,-125+176($sp) +la $15,-124+176($sp) +subu $24,$24,$15 +sw $24,-32+176($sp) +la $24,-126+176($sp) +la $15,-125+176($sp) +subu $24,$24,$15 +sw $24,-28+176($sp) +la $24,-127+176($sp) +la $15,-126+176($sp) +subu $24,$24,$15 +sw $24,-24+176($sp) +la $24,-128+176($sp) +la $15,-127+176($sp) +subu $24,$24,$15 +sw $24,-20+176($sp) +la $24,-129+176($sp) +la $15,-128+176($sp) +subu $24,$24,$15 +sw $24,-16+176($sp) +la $24,-131+176($sp) +la $15,-129+176($sp) +subu $24,$24,$15 +sw $24,-12+176($sp) +lw $24,-96+176($sp) +sw $24,-108+176($sp) +la $24,1 +sw $24,-104+176($sp) +sw $0,-100+176($sp) +L.3049: +lw $24,-104+176($sp) +la $15,1 +beq $24,$15,L.3055 +la $15,2 +beq $24,$15,L.3058 +la $15,3 +beq $24,$15,L.3063 +b L.3053 +L.3055: +lw $24,-100+176($sp) +sll $24,$24,2 +la $15,-96+176($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-108+176($sp) +beq $24,$15,L.3054 +la $24,2 +lw $15,-100+176($sp) +sll $15,$15,2 +la $14,-96+176($sp) +addu $15,$15,$14 +lw $15,($15) +sw $15,-140+176($sp) +sw $24,-104+176($sp) +la $24,1 +sw $24,-136+176($sp) +b L.3054 +L.3058: +lw $24,-100+176($sp) +sll $24,$24,2 +la $15,-96+176($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-108+176($sp) +bne $24,$15,L.3059 +la $24,3 +sw $24,-104+176($sp) +b L.3054 +L.3059: +lw $24,-100+176($sp) +sll $24,$24,2 +la $15,-96+176($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-140+176($sp) +bne $24,$15,L.3061 +lw $24,-136+176($sp) +la $24,1($24) +sw $24,-136+176($sp) +b L.3054 +L.3061: +la $24,4 +sw $24,-104+176($sp) +b L.3054 +L.3063: +lw $24,-100+176($sp) +sll $24,$24,2 +la $15,-96+176($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-108+176($sp) +beq $24,$15,L.3054 +la $24,4 +sw $24,-104+176($sp) +L.3053: +L.3054: +L.3050: +lw $24,-100+176($sp) +la $24,1($24) +sw $24,-100+176($sp) +lw $24,-100+176($sp) +la $15,22 +blt $24,$15,L.3049 +lw $24,-104+176($sp) +la $15,3 +bne $24,$15,L.3066 +la $24,16 +lw $15,-136+176($sp) +subu $2,$24,$15 +b L.3027 +L.3066: +la $2,-1 +L.3027: +lw $16,0($sp) +lw $17,4($sp) +lw $18,8($sp) +lw $19,12($sp) +lw $20,16($sp) +lw $21,20($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $30,32($sp) +addu $sp,$sp,176 +j $31 +.end regc +.globl regi +.text +.align 2 +.ent regi +regi: +.frame $sp,272,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-272 +.mask 0x40ff0000,-240 +sw $16,0($sp) +sw $17,4($sp) +sw $18,8($sp) +sw $19,12($sp) +sw $20,16($sp) +sw $21,20($sp) +sw $22,24($sp) +sw $23,28($sp) +sw $30,32($sp) +sw $0,-216+272($sp) +la $24,1 +sw $24,-132+272($sp) +la $24,2 +sw $24,-136+272($sp) +la $24,3 +sw $24,-140+272($sp) +la $30,4 +la $24,5 +sw $24,-144+272($sp) +la $23,6 +la $24,7 +sw $24,-148+272($sp) +la $22,8 +la $24,9 +sw $24,-152+272($sp) +la $21,10 +la $24,11 +sw $24,-156+272($sp) +la $20,12 +la $24,13 +sw $24,-160+272($sp) +la $19,14 +la $24,15 +sw $24,-164+272($sp) +la $18,16 +la $24,17 +sw $24,-168+272($sp) +la $17,18 +la $24,19 +sw $24,-172+272($sp) +la $16,20 +la $24,21 +sw $24,-176+272($sp) +la $24,22 +sw $24,-4+272($sp) +la $24,23 +sw $24,-180+272($sp) +la $24,24 +sw $24,-8+272($sp) +la $24,25 +sw $24,-184+272($sp) +la $24,26 +sw $24,-12+272($sp) +la $24,27 +sw $24,-188+272($sp) +la $24,28 +sw $24,-16+272($sp) +la $24,29 +sw $24,-192+272($sp) +la $24,30 +sw $24,-20+272($sp) +la $24,31 +sw $24,-196+272($sp) +la $24,32 +sw $24,-24+272($sp) +la $24,33 +sw $24,-200+272($sp) +la $24,34 +sw $24,-28+272($sp) +la $24,35 +sw $24,-204+272($sp) +la $24,36 +sw $24,-208+272($sp) +la $24,37 +sw $24,-212+272($sp) +la $24,38 +sw $24,-220+272($sp) +la $24,-132+272($sp) +la $15,4 +la $14,-216+272($sp) +subu $14,$24,$14 +div $14,$14,$15 +sw $14,-116+272($sp) +la $14,-136+272($sp) +subu $24,$14,$24 +div $24,$24,$15 +sw $24,-112+272($sp) +la $24,-140+272($sp) +la $15,-136+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-108+272($sp) +la $24,-144+272($sp) +la $15,-140+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-104+272($sp) +la $24,-148+272($sp) +la $15,-144+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-100+272($sp) +la $24,-152+272($sp) +la $15,-148+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-96+272($sp) +la $24,-156+272($sp) +la $15,-152+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-92+272($sp) +la $24,-160+272($sp) +la $15,-156+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-88+272($sp) +la $24,-164+272($sp) +la $15,-160+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-84+272($sp) +la $24,-168+272($sp) +la $15,-164+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-80+272($sp) +la $24,-172+272($sp) +la $15,-168+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-76+272($sp) +la $24,-176+272($sp) +la $15,-172+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-72+272($sp) +la $24,-180+272($sp) +la $15,-176+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-68+272($sp) +la $24,-184+272($sp) +la $15,-180+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-64+272($sp) +la $24,-188+272($sp) +la $15,-184+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-60+272($sp) +la $24,-192+272($sp) +la $15,-188+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-56+272($sp) +la $24,-196+272($sp) +la $15,-192+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-52+272($sp) +la $24,-200+272($sp) +la $15,-196+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-48+272($sp) +la $24,-204+272($sp) +la $15,-200+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-44+272($sp) +la $24,-208+272($sp) +la $15,-204+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-40+272($sp) +la $24,-212+272($sp) +la $15,-208+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-36+272($sp) +la $24,-220+272($sp) +la $15,-212+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-32+272($sp) +lw $24,-116+272($sp) +sw $24,-128+272($sp) +la $24,1 +sw $24,-124+272($sp) +sw $0,-120+272($sp) +L.3090: +lw $24,-124+272($sp) +la $15,1 +beq $24,$15,L.3096 +la $15,2 +beq $24,$15,L.3099 +la $15,3 +beq $24,$15,L.3104 +b L.3094 +L.3096: +lw $24,-120+272($sp) +sll $24,$24,2 +la $15,-116+272($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-128+272($sp) +beq $24,$15,L.3095 +la $24,2 +lw $15,-120+272($sp) +sll $15,$15,2 +la $14,-116+272($sp) +addu $15,$15,$14 +lw $15,($15) +sw $15,-228+272($sp) +sw $24,-124+272($sp) +la $24,1 +sw $24,-224+272($sp) +b L.3095 +L.3099: +lw $24,-120+272($sp) +sll $24,$24,2 +la $15,-116+272($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-128+272($sp) +bne $24,$15,L.3100 +la $24,3 +sw $24,-124+272($sp) +b L.3095 +L.3100: +lw $24,-120+272($sp) +sll $24,$24,2 +la $15,-116+272($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-228+272($sp) +bne $24,$15,L.3102 +lw $24,-224+272($sp) +la $24,1($24) +sw $24,-224+272($sp) +b L.3095 +L.3102: +la $24,4 +sw $24,-124+272($sp) +b L.3095 +L.3104: +lw $24,-120+272($sp) +sll $24,$24,2 +la $15,-116+272($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-128+272($sp) +beq $24,$15,L.3095 +la $24,4 +sw $24,-124+272($sp) +L.3094: +L.3095: +L.3091: +lw $24,-120+272($sp) +la $24,1($24) +sw $24,-120+272($sp) +lw $24,-120+272($sp) +la $15,22 +blt $24,$15,L.3090 +lw $24,-124+272($sp) +la $15,3 +bne $24,$15,L.3107 +la $24,16 +lw $15,-224+272($sp) +subu $2,$24,$15 +b L.3068 +L.3107: +la $2,-1 +L.3068: +lw $16,0($sp) +lw $17,4($sp) +lw $18,8($sp) +lw $19,12($sp) +lw $20,16($sp) +lw $21,20($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $30,32($sp) +addu $sp,$sp,272 +j $31 +.end regi +.globl regp +.text +.align 2 +.ent regp +regp: +.frame $sp,272,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-272 +.mask 0x40ff0000,-240 +sw $16,0($sp) +sw $17,4($sp) +sw $18,8($sp) +sw $19,12($sp) +sw $20,16($sp) +sw $21,20($sp) +sw $22,24($sp) +sw $23,28($sp) +sw $30,32($sp) +la $24,-216+272($sp) +sw $24,-216+272($sp) +la $24,-192+272($sp) +sw $24,-192+272($sp) +la $24,-196+272($sp) +sw $24,-196+272($sp) +la $24,-200+272($sp) +sw $24,-200+272($sp) +la $30,-128+272($sp) +la $24,-128+272($sp) +sw $24,-128+272($sp) +la $23,-132+272($sp) +la $24,-132+272($sp) +sw $24,-132+272($sp) +la $22,-136+272($sp) +la $24,-136+272($sp) +sw $24,-136+272($sp) +la $21,-140+272($sp) +la $24,-140+272($sp) +sw $24,-140+272($sp) +la $20,-144+272($sp) +la $24,-144+272($sp) +sw $24,-144+272($sp) +la $19,-148+272($sp) +la $24,-148+272($sp) +sw $24,-148+272($sp) +la $18,-152+272($sp) +la $24,-152+272($sp) +sw $24,-152+272($sp) +la $17,-156+272($sp) +la $24,-156+272($sp) +sw $24,-156+272($sp) +la $16,-160+272($sp) +la $24,-160+272($sp) +sw $24,-160+272($sp) +la $24,-164+272($sp) +sw $24,-4+272($sp) +la $24,-164+272($sp) +sw $24,-164+272($sp) +la $24,-168+272($sp) +sw $24,-8+272($sp) +la $24,-168+272($sp) +sw $24,-168+272($sp) +la $24,-172+272($sp) +sw $24,-12+272($sp) +la $24,-172+272($sp) +sw $24,-172+272($sp) +la $24,-176+272($sp) +sw $24,-16+272($sp) +la $24,-176+272($sp) +sw $24,-176+272($sp) +la $24,-180+272($sp) +sw $24,-20+272($sp) +la $24,-180+272($sp) +sw $24,-180+272($sp) +la $24,-184+272($sp) +sw $24,-24+272($sp) +la $24,-184+272($sp) +sw $24,-184+272($sp) +la $24,-188+272($sp) +sw $24,-28+272($sp) +la $24,-188+272($sp) +sw $24,-188+272($sp) +la $24,-204+272($sp) +sw $24,-204+272($sp) +la $24,-208+272($sp) +sw $24,-208+272($sp) +la $24,-220+272($sp) +sw $24,-220+272($sp) +la $24,-192+272($sp) +la $15,4 +la $14,-216+272($sp) +subu $14,$24,$14 +div $14,$14,$15 +sw $14,-116+272($sp) +la $14,-196+272($sp) +subu $24,$14,$24 +div $24,$24,$15 +sw $24,-112+272($sp) +la $24,-200+272($sp) +la $15,-196+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-108+272($sp) +la $24,-128+272($sp) +la $15,-200+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-104+272($sp) +la $24,-132+272($sp) +la $15,-128+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-100+272($sp) +la $24,-136+272($sp) +la $15,-132+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-96+272($sp) +la $24,-140+272($sp) +la $15,-136+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-92+272($sp) +la $24,-144+272($sp) +la $15,-140+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-88+272($sp) +la $24,-148+272($sp) +la $15,-144+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-84+272($sp) +la $24,-152+272($sp) +la $15,-148+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-80+272($sp) +la $24,-156+272($sp) +la $15,-152+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-76+272($sp) +la $24,-160+272($sp) +la $15,-156+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-72+272($sp) +la $24,-164+272($sp) +la $15,-160+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-68+272($sp) +la $24,-168+272($sp) +la $15,-164+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-64+272($sp) +la $24,-172+272($sp) +la $15,-168+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-60+272($sp) +la $24,-176+272($sp) +la $15,-172+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-56+272($sp) +la $24,-180+272($sp) +la $15,-176+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-52+272($sp) +la $24,-184+272($sp) +la $15,-180+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-48+272($sp) +la $24,-188+272($sp) +la $15,-184+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-44+272($sp) +la $24,-204+272($sp) +la $15,-188+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-40+272($sp) +la $24,-208+272($sp) +la $15,-204+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-36+272($sp) +la $24,-220+272($sp) +la $15,-208+272($sp) +subu $24,$24,$15 +la $15,4 +div $24,$24,$15 +sw $24,-32+272($sp) +lw $24,-116+272($sp) +sw $24,-212+272($sp) +la $24,1 +sw $24,-124+272($sp) +sw $0,-120+272($sp) +L.3131: +lw $24,-124+272($sp) +la $15,1 +beq $24,$15,L.3137 +la $15,2 +beq $24,$15,L.3140 +la $15,3 +beq $24,$15,L.3145 +b L.3135 +L.3137: +lw $24,-120+272($sp) +sll $24,$24,2 +la $15,-116+272($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-212+272($sp) +beq $24,$15,L.3136 +la $24,2 +lw $15,-120+272($sp) +sll $15,$15,2 +la $14,-116+272($sp) +addu $15,$15,$14 +lw $15,($15) +sw $15,-228+272($sp) +sw $24,-124+272($sp) +la $24,1 +sw $24,-224+272($sp) +b L.3136 +L.3140: +lw $24,-120+272($sp) +sll $24,$24,2 +la $15,-116+272($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-212+272($sp) +bne $24,$15,L.3141 +la $24,3 +sw $24,-124+272($sp) +b L.3136 +L.3141: +lw $24,-120+272($sp) +sll $24,$24,2 +la $15,-116+272($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-228+272($sp) +bne $24,$15,L.3143 +lw $24,-224+272($sp) +la $24,1($24) +sw $24,-224+272($sp) +b L.3136 +L.3143: +la $24,4 +sw $24,-124+272($sp) +b L.3136 +L.3145: +lw $24,-120+272($sp) +sll $24,$24,2 +la $15,-116+272($sp) +addu $24,$24,$15 +lw $24,($24) +lw $15,-212+272($sp) +beq $24,$15,L.3136 +la $24,4 +sw $24,-124+272($sp) +L.3135: +L.3136: +L.3132: +lw $24,-120+272($sp) +la $24,1($24) +sw $24,-120+272($sp) +lw $24,-120+272($sp) +la $15,22 +blt $24,$15,L.3131 +lw $24,-124+272($sp) +la $15,3 +bne $24,$15,L.3148 +la $24,16 +lw $15,-224+272($sp) +subu $2,$24,$15 +b L.3109 +L.3148: +la $2,-1 +L.3109: +lw $16,0($sp) +lw $17,4($sp) +lw $18,8($sp) +lw $19,12($sp) +lw $20,16($sp) +lw $21,20($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $30,32($sp) +addu $sp,$sp,272 +j $31 +.end regp +.lcomm L.3151,420 +.data +.align 0 +L.3152: +.byte 115 +.byte 56 +.byte 52 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.3153: +.byte 115 +.byte 56 +.byte 52 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s84 +.text +.text +.align 2 +.ent s84 +s84: +.frame $sp,224,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-224 +.fmask 0xc0000000,-208 +.mask 0xc2fc0000,-168 +s.d $f30,16($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +move $30,$4 +la $20,L.3153 +la $19,60($30) +move $18,$0 +L.3154: +L.3155: +move $24,$19 +la $19,1($24) +move $15,$20 +la $20,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.3154 +la $4,3 +jal fip +sw $2,-140+224($sp) +lw $24,-140+224($sp) +lw $24,($24) +la $15,3 +beq $24,$15,L.3157 +lw $24,44($30) +beq $24,$0,L.3159 +la $4,L.3152 +la $5,1 +jal printf +L.3159: +la $18,1($18) +L.3157: +la $24,glork +sw $24,-144+224($sp) +la $4,4 +lw $25,-144+224($sp) +jal $25 +la $15,4 +beq $2,$15,L.3161 +lw $24,44($30) +beq $24,$0,L.3163 +la $4,L.3152 +la $5,2 +jal printf +L.3163: +la $18,2($18) +L.3161: +move $22,$0 +L.3165: +sll $24,$22,2 +la $15,-68+224($sp) +addu $24,$24,$15 +mtc1 $22,$f18; cvt.s.w $f18,$f18 +s.s $f18,($24) +sll $24,$22,2 +la $15,-136+224($sp) +addu $15,$24,$15 +la $14,-68+224($sp) +addu $24,$24,$14 +sw $24,($15) +L.3166: +la $22,1($22) +la $24,17 +blt $22,$24,L.3165 +l.s $f30,L.412 +move $22,$0 +L.3169: +sll $24,$22,2 +la $15,-136+224($sp) +addu $24,$24,$15 +lw $24,($24) +l.s $f18,($24) +add.s $f30,$f30,$f18 +L.3170: +la $22,1($22) +la $24,17 +blt $22,$24,L.3169 +l.s $f18,L.3175 +c.eq.s $f30,$f18; bc1t L.3173 +lw $24,44($30) +beq $24,$0,L.3176 +la $4,L.3152 +la $5,4 +jal printf +L.3176: +la $18,4($18) +L.3173: +move $21,$0 +L.3178: +move $22,$0 +L.3182: +move $23,$0 +L.3186: +sll $24,$23,2 +la $15,28 +mul $15,$15,$22 +la $14,140 +mul $14,$14,$21 +la $14,L.3151($14) +addu $15,$15,$14 +addu $24,$24,$15 +la $15,35 +mul $15,$15,$21 +la $14,7 +mul $14,$14,$22 +addu $15,$15,$14 +addu $15,$15,$23 +sw $15,($24) +L.3187: +la $23,1($23) +la $24,7 +blt $23,$24,L.3186 +L.3183: +la $22,1($22) +la $24,5 +blt $22,$24,L.3182 +L.3179: +la $21,1($21) +la $24,3 +blt $21,$24,L.3178 +la $21,1 +la $22,2 +la $23,3 +la $4,L.3151 +la $5,105 +move $6,$0 +jal array +move $24,$2 +sw $24,-148+224($sp) +la $15,140 +mul $15,$15,$21 +la $4,L.3151($15) +la $15,35 +move $5,$15 +move $6,$15 +jal array +move $24,$2 +sw $24,-152+224($sp) +la $15,28 +mul $15,$15,$22 +la $14,140 +mul $14,$14,$21 +la $14,L.3151($14) +addu $4,$15,$14 +la $5,7 +la $6,49 +jal array +lw $15,-148+224($sp) +lw $14,-152+224($sp) +addu $15,$15,$14 +addu $24,$15,$2 +sll $15,$23,2 +la $14,28 +mul $14,$14,$22 +la $13,140 +mul $13,$13,$21 +la $13,L.3151($13) +addu $14,$14,$13 +addu $15,$15,$14 +lw $15,($15) +addu $24,$24,$15 +subu $24,$24,52 +beq $24,$0,L.3190 +lw $24,44($30) +beq $24,$0,L.3192 +la $4,L.3152 +la $5,8 +jal printf +L.3192: +la $18,8($18) +L.3190: +move $2,$18 +L.3150: +l.d $f30,16($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,224 +j $31 +.end s84 +.globl array +.text +.align 2 +.ent array +array: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +.mask 0x40000000,-16 +sw $30,0($sp) +move $30,$0 +b L.3198 +L.3195: +sll $24,$30,2 +addu $24,$24,$4 +lw $24,($24) +addu $15,$30,$6 +beq $24,$15,L.3199 +la $2,1 +b L.3194 +L.3199: +L.3196: +la $30,1($30) +L.3198: +blt $30,$5,L.3195 +move $2,$0 +L.3194: +lw $30,0($sp) +addu $sp,$sp,16 +j $31 +.end array +.lcomm L.3202,4 +.globl fip +.text +.text +.align 2 +.ent fip +fip: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +la $24,L.3202 +sw $4,L.3202 +move $2,$24 +L.3201: +j $31 +.end fip +.globl glork +.text +.align 2 +.ent glork +glork: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +move $2,$4 +L.3203: +j $31 +.end glork +.data +.align 0 +L.3205: +.byte 115 +.byte 56 +.byte 53 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.3206: +.byte 115 +.byte 56 +.byte 53 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.data +.align 2 +L.3214: +.word L.425 +.word L.427 +.word L.426 +.word L.428 +.word L.429 +.word L.430 +.word L.431 +.data +.align 0 +L.3215: +.byte 32 +.byte 97 +.byte 108 +.byte 105 +.byte 103 +.byte 110 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 58 +.byte 32 +.byte 0 +.globl s85 +.text +.text +.align 2 +.ent s85 +s85: +.frame $sp,448,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-448 +.mask 0xc2f00000,-408 +sw $20,16($sp) +sw $21,20($sp) +sw $22,24($sp) +sw $23,28($sp) +.cprestore 32 +sw $30,36($sp) +sw $31,40($sp) +move $30,$4 +la $22,L.3206 +la $21,60($30) +move $20,$0 +L.3219: +L.3220: +move $24,$21 +la $21,1($24) +move $15,$22 +la $22,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.3219 +la $15,-284+448($sp) +la $14,-304+448($sp) +subu $15,$15,$14 +ble $15,$0,L.3230 +la $15,-280+448($sp) +la $14,-284+448($sp) +subu $15,$15,$14 +ble $15,$0,L.3230 +la $15,-276+448($sp) +la $14,-280+448($sp) +subu $15,$15,$14 +bgt $15,$0,L.3222 +L.3230: +lw $24,44($30) +beq $24,$0,L.3231 +la $4,L.3205 +la $5,1 +jal printf +L.3231: +la $20,1($20) +L.3222: +la $24,-337+448($sp) +la $15,-338+448($sp) +subu $24,$24,$15 +sw $24,-268+448($sp) +la $24,-340+448($sp) +la $15,-342+448($sp) +subu $24,$24,$15 +sw $24,-264+448($sp) +la $24,-348+448($sp) +la $15,-352+448($sp) +subu $24,$24,$15 +sw $24,-260+448($sp) +la $24,-356+448($sp) +la $15,-360+448($sp) +subu $24,$24,$15 +sw $24,-256+448($sp) +la $24,-364+448($sp) +la $15,-368+448($sp) +subu $24,$24,$15 +sw $24,-252+448($sp) +la $24,-372+448($sp) +la $15,-376+448($sp) +subu $24,$24,$15 +sw $24,-248+448($sp) +la $24,-384+448($sp) +la $15,-392+448($sp) +subu $24,$24,$15 +sw $24,-244+448($sp) +lw $24,40($30) +beq $24,$0,L.3246 +move $23,$0 +L.3248: +la $4,L.3252 +sll $24,$23,2 +lw $5,L.3214($24) +la $6,L.3215 +la $15,-268+448($sp) +addu $24,$24,$15 +lw $7,($24) +jal printf +L.3249: +la $23,1($23) +la $24,7 +blt $23,$24,L.3248 +L.3246: +lw $24,-272+448($sp) +or $24,$24,0x1c000000 +sw $24,-272+448($sp) +lw $24,-272+448($sp) +move $15,$24 +and $15,$15,0x3fffffff +sll $24,$24,3 +sra $24,$24,29 +sll $24,$24,30 +sra $24,$24,30 +sll $24,$24,30 +and $24,$24,0xc0000000 +or $24,$15,$24 +sw $24,-272+448($sp) +lw $24,-272+448($sp) +move $15,$24 +and $15,$15,0xe3ffffff +sra $24,$24,30 +sll $24,$24,29 +sra $24,$24,29 +sll $24,$24,26 +and $24,$24,0x1c000000 +or $24,$15,$24 +sw $24,-272+448($sp) +la $24,3 +lw $15,-272+448($sp) +sll $15,$15,3 +sra $15,$15,29 +beq $15,$24,L.3253 +lw $24,-272+448($sp) +sll $24,$24,3 +sra $24,$24,29 +la $15,-1 +bne $24,$15,L.3255 +lw $24,40($30) +beq $24,$0,L.3256 +la $4,L.3259 +jal printf +b L.3256 +L.3255: +lw $24,44($30) +beq $24,$0,L.3260 +la $4,L.3205 +la $5,2 +jal printf +L.3260: +la $20,2($20) +L.3256: +L.3253: +lw $24,-272+448($sp) +or $24,$24,0x2000000 +sw $24,-272+448($sp) +lw $24,-272+448($sp) +sll $24,$24,6 +sra $24,$24,31 +la $15,1 +beq $24,$15,L.3262 +lw $24,40($30) +beq $24,$0,L.3264 +la $4,L.3266 +jal printf +L.3264: +L.3262: +la $24,-240+448($sp) +subu $24,$24,$24 +bne $24,$0,L.3274 +bne $24,$0,L.3274 +bne $24,$0,L.3274 +bne $24,$0,L.3274 +bne $24,$0,L.3274 +bne $24,$0,L.3274 +beq $24,$0,L.3267 +L.3274: +lw $24,44($30) +beq $24,$0,L.3275 +la $4,L.3205 +la $5,4 +jal printf +L.3275: +la $20,4($20) +L.3267: +b L.3277 +lw $24,44($30) +beq $24,$0,L.3279 +la $4,L.3205 +la $5,8 +jal printf +L.3279: +la $20,8($20) +L.3277: +la $24,-336+448($sp) +sw $24,-276+448($sp) +la $24,2 +sb $24,-336+448($sp) +lw $24,-276+448($sp) +lb $15,($24) +la $15,1($15) +sb $15,($24) +lb $24,-336+448($sp) +la $15,3 +beq $24,$15,L.3283 +lw $24,44($30) +beq $24,$0,L.3285 +la $4,L.3205 +la $5,16 +jal printf +L.3285: +la $20,16($20) +L.3283: +move $2,$20 +L.3204: +lw $20,16($sp) +lw $21,20($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $25,32($sp) +lw $30,36($sp) +lw $31,40($sp) +addu $sp,$sp,448 +j $31 +.end s85 +.data +.align 0 +L.3288: +.byte 115 +.byte 56 +.byte 54 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.3289: +.byte 115 +.byte 56 +.byte 54 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.data +.align 2 +L.3290: +.word 0x1 +.word 0x3 +.word 0x5 +.sdata +.align 2 +L.3291: +.word L.3290+8 +.lcomm L.3293,40 +.data +.align 2 +L.3294: +.word 0x3f800000 +.word 0x40400000 +.word 0x40a00000 +.word 0x40000000 +.word 0x40800000 +.word 0x40c00000 +.word 0x40400000 +.word 0x40a00000 +.word 0x40e00000 +.word 0x0 +.word 0x0 +.word 0x0 +.data +.align 2 +L.3295: +.word 0x3f800000 +.word 0x40400000 +.word 0x40a00000 +.word 0x40000000 +.word 0x40800000 +.word 0x40c00000 +.word 0x40400000 +.word 0x40a00000 +.word 0x40e00000 +.space 12 +.data +.align 2 +L.3296: +.word 0x3f800000 +.word 0x40400000 +.word 0x40a00000 +.word 0x40000000 +.word 0x40800000 +.word 0x40c00000 +.word 0x40400000 +.word 0x40a00000 +.word 0x40e00000 +.space 12 +.data +.align 2 +L.3297: +.word 0x3f800000 +.space 8 +.word 0x40000000 +.space 8 +.word 0x40400000 +.space 8 +.word 0x40800000 +.space 8 +.globl s86 +.text +.text +.align 2 +.ent s86 +s86: +.frame $sp,64,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-64 +.mask 0xc2ff0000,-8 +sw $16,16($sp) +sw $17,20($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +sw $4,64($sp) +lw $24,L.3291 +la $16,-4($24) +jal one +sll $24,$2,2 +addu $30,$24,$16 +la $19,L.3289 +lw $24,0+64($sp) +la $18,60($24) +move $17,$0 +L.3298: +L.3299: +move $24,$18 +la $18,1($24) +move $15,$19 +la $19,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.3298 +lw $24,L.3291 +lw $24,($24) +la $15,5 +beq $24,$15,L.3301 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3303 +la $4,L.3288 +la $5,1 +jal printf +L.3303: +la $17,1($17) +L.3301: +lw $24,($16) +la $15,3 +beq $24,$15,L.3305 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3307 +la $4,L.3288 +la $5,2 +jal printf +L.3307: +la $17,2($17) +L.3305: +lw $24,($30) +la $15,5 +beq $24,$15,L.3309 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3311 +la $4,L.3288 +la $5,4 +jal printf +L.3311: +la $17,4($17) +L.3309: +move $20,$0 +move $23,$0 +L.3313: +sll $24,$23,2 +lw $24,L.3293($24) +beq $24,$0,L.3317 +la $20,1 +L.3317: +L.3314: +la $23,1($23) +la $24,10 +blt $23,$24,L.3313 +beq $20,$0,L.3319 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3321 +la $4,L.3288 +la $5,8 +jal printf +L.3321: +la $17,8($17) +L.3319: +move $20,$0 +move $22,$0 +L.3323: +move $23,$0 +L.3327: +la $24,3 +mul $24,$24,$22 +addu $21,$24,$23 +sll $24,$23,2 +la $15,12 +mul $15,$15,$22 +la $14,L.3295($15) +addu $14,$24,$14 +l.s $f18,($14) +la $15,L.3296($15) +addu $24,$24,$15 +l.s $f16,($24) +c.eq.s $f18,$f16; bc1f L.3333 +sll $24,$21,2 +l.s $f16,L.3294($24) +c.eq.s $f18,$f16; bc1t L.3331 +L.3333: +la $20,1 +L.3331: +L.3328: +la $23,1($23) +la $24,3 +blt $23,$24,L.3327 +L.3324: +la $22,1($22) +la $24,4 +blt $22,$24,L.3323 +beq $20,$0,L.3334 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3336 +la $4,L.3288 +la $5,16 +jal printf +L.3336: +la $17,16($17) +L.3334: +move $20,$0 +move $23,$0 +L.3338: +la $24,12 +mul $24,$24,$23 +l.s $f18,L.3297($24) +la $24,1($23) +mtc1 $24,$f16; cvt.s.w $f16,$f16 +c.eq.s $f18,$f16; bc1t L.3342 +la $20,1 +L.3342: +L.3339: +la $23,1($23) +la $24,4 +blt $23,$24,L.3338 +beq $20,$0,L.3344 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3346 +la $4,L.3288 +la $5,32 +jal printf +L.3346: +la $17,32($17) +L.3344: +move $2,$17 +L.3287: +lw $16,16($sp) +lw $17,20($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,64 +j $31 +.end s86 +.globl one +.text +.align 2 +.ent one +one: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +la $2,1 +L.3348: +j $31 +.end one +.data +.align 0 +L.3350: +.byte 115 +.byte 56 +.byte 56 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.3351: +.byte 115 +.byte 56 +.byte 56 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s88 +.text +.text +.align 2 +.ent s88 +s88: +.frame $sp,64,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-64 +.mask 0xc2e00000,-28 +sw $21,16($sp) +sw $22,20($sp) +sw $23,24($sp) +.cprestore 28 +sw $30,32($sp) +sw $31,36($sp) +sw $4,64($sp) +la $30,L.3351 +lw $24,0+64($sp) +la $23,60($24) +move $22,$0 +L.3353: +L.3354: +move $24,$23 +la $23,1($24) +move $15,$30 +la $30,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.3353 +b L.3356 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3358 +la $4,L.3350 +la $5,1 +jal printf +L.3358: +la $22,1($22) +L.3356: +la $24,-20+64($sp) +sw $24,metricp +la $24,2 +sw $24,-20+64($sp) +lw $24,metricp +la $15,3 +sw $15,($24) +lw $24,-20+64($sp) +la $15,3 +beq $24,$15,L.3360 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3362 +la $4,L.3350 +la $5,2 +jal printf +L.3362: +la $22,2($22) +L.3360: +l.d $f18,L.419 +s.d $f18,-16+64($sp) +s.d $f18,-8+64($sp) +la $21,-16+64($sp) +l.d $f18,L.418 +s.d $f18,($21) +l.d $f18,L.418 +s.d $f18,8($21) +l.d $f18,-16+64($sp) +l.d $f16,-8+64($sp) +add.d $f18,$f18,$f16 +l.d $f16,L.416 +c.eq.d $f18,$f16; bc1t L.3365 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3368 +la $4,L.3350 +la $5,4 +jal printf +L.3368: +la $22,4($22) +L.3365: +move $2,$22 +L.3349: +lw $21,16($sp) +lw $22,20($sp) +lw $23,24($sp) +lw $25,28($sp) +lw $30,32($sp) +lw $31,36($sp) +addu $sp,$sp,64 +j $31 +.end s88 +.data +.align 0 +L.3371: +.byte 115 +.byte 57 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.sdata +.align 0 +L.3372: +.byte 115 +.byte 57 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s9 +.text +.text +.align 2 +.ent s9 +s9: +.frame $sp,64,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-64 +.mask 0xc2ff0000,-8 +sw $16,16($sp) +sw $17,20($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +sw $4,64($sp) +la $22,L.3372 +lw $24,0+64($sp) +la $21,60($24) +move $20,$0 +L.3373: +L.3374: +move $24,$21 +la $21,1($24) +move $15,$22 +la $22,1($15) +lb $15,($15) +sb $15,($24) +sll $24,$15,8*(4-1); sra $24,$24,8*(4-1) +bne $24,$0,L.3373 +move $23,$0 +move $30,$0 +L.3376: +la $24,2 +move $19,$24 +move $18,$24 +la $24,3 +move $17,$24 +move $16,$24 +la $24,3 +bne $16,$24,L.3382 +beq $17,$24,L.3380 +L.3382: +la $23,1 +L.3380: +la $24,2 +bne $18,$24,L.3385 +beq $19,$24,L.3383 +L.3385: +la $23,1 +L.3383: +L.3377: +la $30,1($30) +la $24,2 +blt $30,$24,L.3376 +beq $23,$0,L.3390 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3388 +la $4,L.3371 +la $5,1 +jal printf +L.3388: +la $20,1($20) +b L.3390 +lw $24,0+64($sp) +lw $24,44($24) +beq $24,$0,L.3391 +la $4,L.3371 +la $5,2 +jal printf +L.3391: +la $20,2($20) +L.3390: +move $2,$20 +L.3370: +lw $16,16($sp) +lw $17,20($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,64 +j $31 +.end s9 +.globl setev +.text +.align 2 +.ent setev +setev: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +la $24,1066 +sw $24,extvar +move $2,$0 +L.3393: +j $31 +.end setev +.globl rfs +.comm rfs,8 +.globl crc +.comm crc,4 +.globl rrc +.comm rrc,4 +.globl flgl +.comm flgl,4 +.globl flgd +.comm flgd,4 +.globl flgm +.comm flgm,4 +.globl flgs +.comm flgs,4 +.globl dprec +.comm dprec,4 +.globl fprec +.comm fprec,4 +.globl dbits +.comm dbits,4 +.globl fbits +.comm fbits,4 +.globl ubits +.comm ubits,4 +.globl lbits +.comm lbits,4 +.globl metricp +.comm metricp,4 +.globl extvar +.comm extvar,4 +.rdata +.align 0 +L.3266: +.byte 66 +.byte 101 +.byte 32 +.byte 101 +.byte 115 +.byte 112 +.byte 101 +.byte 99 +.byte 105 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 32 +.byte 99 +.byte 97 +.byte 114 +.byte 101 +.byte 102 +.byte 117 +.byte 108 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 49 +.byte 45 +.byte 98 +.byte 105 +.byte 116 +.byte 32 +.byte 102 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.3259: +.byte 83 +.byte 105 +.byte 103 +.byte 110 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 101 +.byte 110 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 102 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.3252: +.byte 37 +.byte 115 +.byte 37 +.byte 115 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 2 +L.3175: +.word 0x43080000 +.align 0 +L.3022: +.byte 112 +.byte 111 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 0 +.align 0 +L.2472: +.byte 73 +.byte 110 +.byte 99 +.byte 114 +.byte 101 +.byte 97 +.byte 115 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 97 +.byte 114 +.byte 114 +.byte 97 +.byte 121 +.byte 32 +.byte 101 +.byte 108 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 100 +.byte 101 +.byte 99 +.byte 114 +.byte 101 +.byte 97 +.byte 115 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 108 +.byte 111 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 10 +.byte 0 +.align 2 +L.2356: +.word 0x41d00000 +.align 3 +L.2355: +.word 0x403a0000 +.word 0x0 +.align 3 +L.1659: +.word 0x40040000 +.word 0x0 +.align 3 +L.1484: +.word 0x40240000 +.word 0x0 +.align 2 +L.1455: +.word 0x41200000 +.align 3 +L.1280: +.word 0x40080000 +.word 0x0 +.align 2 +L.1251: +.word 0x40400000 +.align 3 +L.1076: +.word 0x401c0000 +.word 0x0 +.align 2 +L.1047: +.word 0x40e00000 +.align 3 +L.870: +.word 0x40140000 +.word 0x0 +.align 2 +L.841: +.word 0x40a00000 +.align 3 +L.836: +.word 0x41e00000 +.word 0x0 +.align 2 +L.828: +.word 0x4f000000 +.align 0 +L.653: +.byte 113 +.byte 117 +.byte 101 +.byte 101 +.byte 112 +.byte 0 +.align 0 +L.639: +.byte 10 +.byte 0 +.align 0 +L.638: +.byte 37 +.byte 100 +.byte 0 +.align 0 +L.633: +.byte 32 +.byte 32 +.byte 32 +.byte 107 +.byte 101 +.byte 121 +.byte 61 +.byte 0 +.align 3 +L.596: +.word 0x40000000 +.word 0x0 +.align 3 +L.536: +.word 0x40ce8480 +.word 0x0 +.align 3 +L.535: +.word 0x405f4000 +.word 0x0 +.align 2 +L.534: +.word 0x42fa0000 +.align 2 +L.529: +.word 0x40000000 +.align 0 +L.431: +.byte 100 +.byte 111 +.byte 117 +.byte 98 +.byte 108 +.byte 101 +.byte 0 +.align 0 +L.430: +.byte 102 +.byte 108 +.byte 111 +.byte 97 +.byte 116 +.byte 0 +.align 0 +L.429: +.byte 117 +.byte 110 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 101 +.byte 100 +.byte 0 +.align 0 +L.428: +.byte 108 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 0 +L.427: +.byte 115 +.byte 104 +.byte 111 +.byte 114 +.byte 116 +.byte 0 +.align 0 +L.426: +.byte 105 +.byte 110 +.byte 116 +.byte 0 +.align 0 +L.425: +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 0 +.align 3 +L.419: +.word 0x0 +.word 0x0 +.align 3 +L.418: +.word 0x3ff00000 +.word 0x0 +.align 3 +L.417: +.word 0x40100000 +.word 0x0 +.align 3 +L.416: +.word 0x40000000 +.word 0x0 +.align 2 +L.412: +.word 0x0 +.align 2 +L.411: +.word 0x3f800000 +.align 0 +L.390: +.byte 113 +.byte 117 +.byte 101 +.byte 101 +.byte 112 +.byte 33 +.byte 0 +.align 0 +L.379: +.byte 10 +.byte 9 +.byte 8 +.byte 13 +.byte 12 +.byte 92 +.byte 39 +.byte 0 +.align 0 +L.375: +.byte 46 +.byte 34 +.byte 46 +.byte 0 +.align 0 +L.362: +.byte 46 +.byte 46 +.byte 46 +.byte 0 +.align 3 +L.333: +.word 0x40938800 +.word 0x0 +.align 0 +L.199: +.byte 32 +.byte 32 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 114 +.byte 101 +.byte 115 +.byte 117 +.byte 108 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 97 +.byte 115 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 108 +.byte 111 +.byte 110 +.byte 103 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.198: +.byte 68 +.byte 101 +.byte 99 +.byte 105 +.byte 109 +.byte 97 +.byte 108 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 111 +.byte 99 +.byte 116 +.byte 97 +.byte 108 +.byte 47 +.byte 104 +.byte 101 +.byte 120 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 115 +.byte 116 +.byte 97 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 115 +.byte 111 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 109 +.byte 101 +.byte 115 +.byte 32 +.byte 103 +.byte 105 +.byte 118 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.27: +.byte 10 +.byte 70 +.byte 97 +.byte 105 +.byte 108 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.26: +.byte 10 +.byte 78 +.byte 111 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 115 +.byte 32 +.byte 100 +.byte 101 +.byte 116 +.byte 101 +.byte 99 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.20: +.byte 83 +.byte 101 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 37 +.byte 115 +.byte 32 +.byte 114 +.byte 101 +.byte 116 +.byte 117 +.byte 114 +.byte 110 +.byte 101 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 46 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/ctype.h b/src/cmd/lccom-1/tst/mips-eb/ctype.h new file mode 100644 index 0000000..2a43440 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/ctype.h @@ -0,0 +1,40 @@ +#ifndef __CTYPE +#define __CTYPE + +extern int isalnum(int); +extern int isalpha(int); +extern int iscntrl(int); +extern int isdigit(int); +extern int isgraph(int); +extern int islower(int); +extern int isprint(int); +extern int ispunct(int); +extern int isspace(int); +extern int isupper(int); +extern int isxdigit(int); +extern int tolower(int); +extern int toupper(int); + +#define __U 01 +#define __L 02 +#define __N 04 +#define __S 010 +#define __P 020 +#define __C 040 +#define __B 0100 +#define __X 0200 + +extern unsigned char _ctype[]; +#define isalnum(c) ((_ctype+1)[c]&(__U|__L|__N)) +#define isalpha(c) ((_ctype+1)[c]&(__U|__L)) +#define iscntrl(c) ((_ctype+1)[c]&__C) +#define isdigit(c) ((_ctype+1)[c]&__N) +#define isgraph(c) ((_ctype+1)[c]&(__P|__U|__L|__N)) +#define islower(c) ((_ctype+1)[c]&__L) +#define isprint(c) ((_ctype+1)[c]&(__P|__U|__L|__N|__B)) +#define ispunct(c) ((_ctype+1)[c]&__P) +#define isspace(c) ((_ctype+1)[c]&__S) +#define isupper(c) ((_ctype+1)[c]&__U) +#define isxdigit(c) ((_ctype+1)[c]&__X) + +#endif /* __CTYPE */ diff --git a/src/cmd/lccom-1/tst/mips-eb/cvt.1bk b/src/cmd/lccom-1/tst/mips-eb/cvt.1bk new file mode 100644 index 0000000..b28b302 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/cvt.1bk @@ -0,0 +1,11 @@ +1 1 1 1 1 1 1 1 1.000000 1.000000 1.000000 +2 2 2 2 2 2 2 2 2.000000 2.000000 2.000000 +3 3 3 3 3 3 3 3 3.000000 3.000000 3.000000 +4 4 4 4 4 4 4 4 4.000000 4.000000 4.000000 +5 5 5 5 5 5 5 5 5.000000 5.000000 5.000000 +6 6 6 6 6 6 6 6 6.000000 6.000000 6.000000 +7 7 7 7 7 7 7 7 7.000000 7.000000 7.000000 +8 8 8 8 8 8 8 8 8.000000 8.000000 8.000000 +9 9 9 9 9 9 9 9 9.000000 9.000000 9.000000 +10 10 10 10 10 10 10 10 10.000000 10.000000 10.000000 +11 11 11 11 11 11 11 11 11.000000 11.000000 11.000000 diff --git a/src/cmd/lccom-1/tst/mips-eb/cvt.2bk b/src/cmd/lccom-1/tst/mips-eb/cvt.2bk new file mode 100644 index 0000000..241527d --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/cvt.2bk @@ -0,0 +1,2 @@ +tst/cvt.c:32: warning: conversion from `pointer to void function(void)' to `pointer to void' is compiler dependent +tst/cvt.c:33: warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent diff --git a/src/cmd/lccom-1/tst/mips-eb/cvt.sbk b/src/cmd/lccom-1/tst/mips-eb/cvt.sbk new file mode 100644 index 0000000..feaf7d3 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/cvt.sbk @@ -0,0 +1,557 @@ +.set reorder +.globl print +.text +.text +.align 2 +.ent print +print: +.frame $sp,80,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-80 +.mask 0x82000000,-12 +.cprestore 64 +sw $31,68($sp) +la $4,L.2 +lb $5,c +lh $6,s +lw $7,i +lw $24,l +sw $24,16($sp) +lbu $24,C +sw $24,20($sp) +lhu $24,S +sw $24,24($sp) +lw $24,I +sw $24,28($sp) +lw $24,L +sw $24,32($sp) +l.s $f18,f +cvt.d.s $f18,$f18 +s.d $f18,40($sp) +l.d $f18,d +s.d $f18,48($sp) +l.d $f18,D +s.d $f18,56($sp) +jal printf +L.1: +lw $25,64($sp) +lw $31,68($sp) +addu $sp,$sp,80 +j $31 +.end print +.globl main +.text +.align 2 +.ent main +main: +.frame $sp,80,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-80 +.mask 0xc2ff0000,-24 +sw $16,16($sp) +sw $17,20($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +la $24,1 +sb $24,c +lb $24,c +move $15,$24 +sh $15,s +sw $24,i +sw $24,l +move $15,$24 +move $14,$15 +sb $14,C +move $14,$15 +sh $14,S +sw $15,I +sw $15,L +mtc1 $24,$f18; cvt.s.w $f18,$f18 +s.s $f18,f +mtc1 $24,$f18; cvt.d.w $f18,$f18 +s.d $f18,d +s.d $f18,D +jal print +la $24,2 +sh $24,s +lh $24,s +move $15,$24 +sb $15,c +sw $24,i +sw $24,l +move $15,$24 +move $14,$15 +sb $14,C +move $14,$15 +sh $14,S +sw $15,I +sw $15,L +mtc1 $24,$f18; cvt.s.w $f18,$f18 +s.s $f18,f +mtc1 $24,$f18; cvt.d.w $f18,$f18 +s.d $f18,d +s.d $f18,D +jal print +la $24,3 +sw $24,i +lw $24,i +move $15,$24 +sb $15,c +move $15,$24 +sh $15,s +sw $24,l +move $15,$24 +move $14,$15 +sb $14,C +move $14,$15 +sh $14,S +sw $15,I +sw $15,L +mtc1 $24,$f18; cvt.s.w $f18,$f18 +s.s $f18,f +mtc1 $24,$f18; cvt.d.w $f18,$f18 +s.d $f18,d +s.d $f18,D +jal print +la $24,4 +sw $24,l +lw $24,l +move $15,$24 +sb $15,c +move $15,$24 +sh $15,s +sw $24,i +move $15,$24 +move $14,$15 +sb $14,C +move $14,$15 +sh $14,S +sw $15,I +sw $15,L +mtc1 $24,$f18; cvt.s.w $f18,$f18 +s.s $f18,f +mtc1 $24,$f18; cvt.d.w $f18,$f18 +s.d $f18,d +s.d $f18,D +jal print +la $24,5 +sb $24,C +lbu $24,C +move $15,$24 +sb $15,c +move $15,$24 +sh $15,s +sw $24,i +sw $24,l +move $15,$24 +move $14,$15 +sh $14,S +sw $15,I +sw $15,L +mtc1 $24,$f18; cvt.s.w $f18,$f18 +s.s $f18,f +mtc1 $24,$f18; cvt.d.w $f18,$f18 +s.d $f18,d +s.d $f18,D +jal print +la $24,6 +sh $24,S +lhu $24,S +move $15,$24 +sb $15,c +move $15,$24 +sh $15,s +sw $24,i +sw $24,l +move $15,$24 +move $14,$15 +sb $14,C +sw $15,I +sw $15,L +mtc1 $24,$f18; cvt.s.w $f18,$f18 +s.s $f18,f +mtc1 $24,$f18; cvt.d.w $f18,$f18 +s.d $f18,d +s.d $f18,D +jal print +la $24,7 +sw $24,I +lw $24,I +move $14,$24 +sb $14,c +move $14,$24 +sh $14,s +sw $24,i +sw $24,l +move $15,$24 +sb $15,C +move $15,$24 +sh $15,S +sw $24,L +l.d $f18,L.4 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f16,$f18 +s.s $f16,f +s.d $f18,d +s.d $f18,D +jal print +la $24,8 +sw $24,L +lw $24,L +move $14,$24 +sb $14,c +move $14,$24 +sh $14,s +sw $24,i +sw $24,l +move $15,$24 +sb $15,C +move $15,$24 +sh $15,S +lhu $15,S +sw $15,I +l.d $f18,L.4 +srl $15,$24,1 +mtc1 $15,$f16; cvt.d.w $f16,$f16 +mul.d $f18,$f18,$f16 +and $24,$24,1 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +add.d $f18,$f18,$f16 +cvt.s.d $f16,$f18 +s.s $f16,f +s.d $f18,d +s.d $f18,D +jal print +l.s $f18,L.5 +s.s $f18,f +l.s $f18,f +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $15,$24 +sb $15,c +move $15,$24 +sh $15,s +sw $24,i +sw $24,l +l.s $f16,L.9 +c.ult.s $f18,$f16; bc1t L.7 +sub.s $f16,$f18,$f16 +trunc.w.s $f2,$f16,$24; mfc1 $24,$f2 +la $30,0x80000000($24) +b L.8 +L.7: +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $30,$24 +L.8: +move $24,$30 +sb $24,C +l.s $f18,f +l.s $f16,L.9 +c.ult.s $f18,$f16; bc1t L.11 +sub.s $f16,$f18,$f16 +trunc.w.s $f2,$f16,$24; mfc1 $24,$f2 +la $23,0x80000000($24) +b L.12 +L.11: +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $23,$24 +L.12: +move $24,$23 +sh $24,S +l.s $f18,f +l.s $f16,L.9 +c.ult.s $f18,$f16; bc1t L.14 +sub.s $f16,$f18,$f16 +trunc.w.s $f2,$f16,$24; mfc1 $24,$f2 +la $22,0x80000000($24) +b L.15 +L.14: +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $22,$24 +L.15: +sw $22,I +l.s $f18,f +l.s $f16,L.9 +c.ult.s $f18,$f16; bc1t L.17 +sub.s $f16,$f18,$f16 +trunc.w.s $f2,$f16,$24; mfc1 $24,$f2 +la $21,0x80000000($24) +b L.18 +L.17: +trunc.w.s $f2,$f18,$24; mfc1 $24,$f2 +move $21,$24 +L.18: +sw $21,L +l.s $f18,f +cvt.d.s $f18,$f18 +s.d $f18,d +s.d $f18,D +jal print +l.d $f18,L.19 +s.d $f18,d +l.d $f18,d +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $15,$24 +sb $15,c +move $15,$24 +sh $15,s +sw $24,i +sw $24,l +l.d $f16,L.23 +c.ult.d $f18,$f16; bc1t L.21 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $20,0x80000000($24) +b L.22 +L.21: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $20,$24 +L.22: +move $24,$20 +sb $24,C +l.d $f18,d +l.d $f16,L.23 +c.ult.d $f18,$f16; bc1t L.25 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $19,0x80000000($24) +b L.26 +L.25: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $19,$24 +L.26: +move $24,$19 +sh $24,S +l.d $f18,d +l.d $f16,L.23 +c.ult.d $f18,$f16; bc1t L.28 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $18,0x80000000($24) +b L.29 +L.28: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $18,$24 +L.29: +sw $18,I +l.d $f18,d +l.d $f16,L.23 +c.ult.d $f18,$f16; bc1t L.31 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $17,0x80000000($24) +b L.32 +L.31: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $17,$24 +L.32: +sw $17,L +l.d $f18,d +cvt.s.d $f16,$f18 +s.s $f16,f +s.d $f18,D +jal print +l.d $f18,L.33 +s.d $f18,D +l.d $f18,D +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $15,$24 +sb $15,c +move $15,$24 +sh $15,s +sw $24,i +sw $24,l +l.d $f16,L.37 +c.ult.d $f18,$f16; bc1t L.35 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $16,0x80000000($24) +b L.36 +L.35: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $16,$24 +L.36: +move $24,$16 +sb $24,C +l.d $f18,D +l.d $f16,L.37 +c.ult.d $f18,$f16; bc1t L.39 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-4+80($sp) +b L.40 +L.39: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-4+80($sp) +L.40: +lw $24,-4+80($sp) +sh $24,S +l.d $f18,D +l.d $f16,L.37 +c.ult.d $f18,$f16; bc1t L.42 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-8+80($sp) +b L.43 +L.42: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-8+80($sp) +L.43: +lw $24,-8+80($sp) +sw $24,I +l.d $f18,D +l.d $f16,L.37 +c.ult.d $f18,$f16; bc1t L.45 +sub.d $f16,$f18,$f16 +trunc.w.d $f2,$f16,$24; mfc1 $24,$f2 +la $24,0x80000000($24) +sw $24,-12+80($sp) +b L.46 +L.45: +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +sw $24,-12+80($sp) +L.46: +lw $24,-12+80($sp) +sw $24,L +l.d $f18,D +cvt.s.d $f16,$f18 +s.s $f16,f +s.d $f18,d +jal print +sw $0,p +sw $0,p +sw $0,p +sw $0,p +lw $24,P +sw $24,p +sw $0,P +sw $0,P +sw $0,P +sw $0,P +lw $24,p +sw $24,P +move $2,$0 +L.3: +lw $16,16($sp) +lw $17,20($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,80 +j $31 +.end main +.globl P +.comm P,4 +.globl p +.comm p,4 +.globl D +.comm D,8 +.globl d +.comm d,8 +.globl f +.comm f,4 +.globl L +.comm L,4 +.globl I +.comm I,4 +.globl S +.comm S,2 +.globl C +.comm C,1 +.globl l +.comm l,4 +.globl i +.comm i,4 +.globl s +.comm s,2 +.globl c +.comm c,1 +.rdata +.align 3 +L.37: +.word 0x41e00000 +.word 0x0 +.align 3 +L.33: +.word 0x40260000 +.word 0x0 +.align 3 +L.23: +.word 0x41e00000 +.word 0x0 +.align 3 +L.19: +.word 0x40240000 +.word 0x0 +.align 2 +L.9: +.word 0x4f000000 +.align 2 +L.5: +.word 0x41100000 +.align 3 +L.4: +.word 0x40000000 +.word 0x0 +.align 0 +L.2: +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 108 +.byte 100 +.byte 32 +.byte 37 +.byte 117 +.byte 32 +.byte 37 +.byte 117 +.byte 32 +.byte 37 +.byte 117 +.byte 32 +.byte 37 +.byte 108 +.byte 117 +.byte 32 +.byte 37 +.byte 102 +.byte 32 +.byte 37 +.byte 102 +.byte 32 +.byte 37 +.byte 108 +.byte 102 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/errno.h b/src/cmd/lccom-1/tst/mips-eb/errno.h new file mode 100644 index 0000000..c914e05 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/errno.h @@ -0,0 +1,8 @@ +#ifndef __ERRNO +#define __ERRNO + +#define EDOM 33 +#define ERANGE 34 +extern int errno; + +#endif /* __ERRNO */ diff --git a/src/cmd/lccom-1/tst/mips-eb/fields.1bk b/src/cmd/lccom-1/tst/mips-eb/fields.1bk new file mode 100644 index 0000000..56fdeb9 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/fields.1bk @@ -0,0 +1,5 @@ +x = 1 2 3 4 -3 6 +y = 3 8 9 +x = 1 2 3 0 0 6 +y = 2 8 16 +p->a = 0x3, p->b = 0xf diff --git a/src/cmd/lccom-1/tst/mips-eb/fields.2bk b/src/cmd/lccom-1/tst/mips-eb/fields.2bk new file mode 100644 index 0000000..51e1736 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/fields.2bk @@ -0,0 +1,4 @@ +tst/fields.c:6: warning: initializer exceeds bit-field width +tst/fields.c:8: warning: initializer exceeds bit-field width +tst/fields.c:30: warning: missing return value +tst/fields.c:34: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/fields.sbk b/src/cmd/lccom-1/tst/mips-eb/fields.sbk new file mode 100644 index 0000000..ff68f28 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/fields.sbk @@ -0,0 +1,304 @@ +.set reorder +.globl x +.data +.align 2 +x: +.word 0x1 +.byte 0x2 +.space 3 +.byte 0x0 +.byte 0x34 +.space 2 +.byte 0xa +.byte 0x6 +.space 2 +.globl i +.sdata +.align 2 +i: +.word 0x10 +.globl y +.sdata +.align 2 +y: +.byte 0xe0 +.space 3 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x9 +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0x82000000,-16 +.cprestore 28 +sw $31,32($sp) +la $4,L.4 +lw $5,x +lb $6,x+4 +lw $24,x+8 +sra $7,$24,20 +lw $24,x+8 +sll $24,$24,12 +sra $24,$24,28 +sw $24,16($sp) +lw $24,x+12 +sll $24,$24,4 +sra $24,$24,29 +sw $24,20($sp) +lb $24,x+13 +sw $24,24($sp) +jal printf +la $4,L.10 +lw $24,y +srl $15,$24,30 +and $5,$15,3 +srl $24,$24,26 +and $6,$24,15 +lw $7,y+4 +jal printf +lw $24,x+8 +and $24,$24,0xfff0ffff +lw $15,i +sll $15,$15,28 +sra $15,$15,28 +sll $15,$15,16 +and $15,$15,0xf0000 +or $24,$24,$15 +sw $24,x+8 +lw $24,x+12 +and $24,$24,0xf1ffffff +sw $24,x+12 +la $4,L.4 +lw $5,x +lb $6,x+4 +lw $24,x+8 +sra $7,$24,20 +lw $24,x+8 +sll $24,$24,12 +sra $24,$24,28 +sw $24,16($sp) +lw $24,x+12 +sll $24,$24,4 +sra $24,$24,29 +sw $24,20($sp) +lb $24,x+13 +sw $24,24($sp) +jal printf +lw $24,y +and $24,$24,0x3fffffff +or $24,$24,0x80000000 +sw $24,y +lw $24,i +sw $24,y+4 +la $4,L.10 +lw $24,y +srl $15,$24,30 +and $5,$15,3 +srl $24,$24,26 +and $6,$24,15 +lw $7,y+4 +jal printf +la $4,x +jal f2 +move $2,$0 +L.3: +lw $25,28($sp) +lw $31,32($sp) +addu $sp,$sp,48 +j $31 +.end main +.globl f1 +.text +.align 2 +.ent f1 +f1: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +move $30,$4 +lw $24,($30) +and $24,$24,0xc3ffffff +sw $24,($30) +lw $24,($30) +and $24,$24,0x3fffffff +and $15,$0,3 +sll $15,$15,30 +and $15,$15,0xc0000000 +or $24,$24,$15 +sw $24,($30) +lw $24,($30) +and $24,$24,0x3c000000 +beq $24,$0,L.22 +la $4,L.24 +jal printf +L.22: +lw $24,($30) +or $24,$24,0xc0000000 +sw $24,($30) +lw $24,($30) +or $24,$24,0x3c000000 +sw $24,($30) +la $4,L.25 +lw $24,($30) +srl $15,$24,30 +and $5,$15,3 +srl $24,$24,26 +and $6,$24,15 +jal printf +move $2,$0 +L.21: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end f1 +.globl f2 +.text +.align 2 +.ent f2 +f2: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2800000,-4 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +move $30,$4 +lw $24,i +bne $24,$0,L.28 +la $23,1 +b L.29 +L.28: +move $23,$0 +L.29: +lw $24,($30) +and $24,$24,0x3fffffff +move $15,$23 +and $15,$15,3 +sll $15,$15,30 +and $15,$15,0xc0000000 +or $24,$24,$15 +sw $24,($30) +move $4,$30 +jal f1 +lw $24,($30) +and $24,$24,0xc3ffffff +move $15,$0 +and $15,$15,15 +sll $15,$15,26 +and $15,$15,0x3c000000 +or $24,$24,$15 +sw $24,($30) +move $2,$0 +L.26: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end f2 +.rdata +.align 0 +L.25: +.byte 112 +.byte 45 +.byte 62 +.byte 97 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 44 +.byte 32 +.byte 112 +.byte 45 +.byte 62 +.byte 98 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 10 +.byte 0 +.align 0 +L.24: +.byte 112 +.byte 45 +.byte 62 +.byte 98 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.10: +.byte 121 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.4: +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/float.h b/src/cmd/lccom-1/tst/mips-eb/float.h new file mode 100644 index 0000000..a3e1eb5 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/float.h @@ -0,0 +1,37 @@ +#ifndef __FLOAT +#define __FLOAT + +#define FLT_ROUNDS 1 +#define FLT_RADIX 2 + +#define FLT_DIG 6 +#define FLT_EPSILON 1.19209289550781250000e-07 +#define FLT_MANT_DIG 24 +#define FLT_MAX 3.40282346638528860000e+38 +#define FLT_MAX_10_EXP 38 +#define FLT_MAX_EXP 128 +#define FLT_MIN 1.17549435082228750000e-38 +#define FLT_MIN_10_EXP -37 +#define FLT_MIN_EXP -125 + +#define DBL_DIG 15 +#define DBL_EPSILON 2.22044604925031310000e-16 +#define DBL_MANT_DIG 53 +#define DBL_MAX 1.79769313486231570000e+308 +#define DBL_MAX_10_EXP 308 +#define DBL_MAX_EXP 1024 +#define DBL_MIN 2.22507385850720140000e-308 +#define DBL_MIN_10_EXP -307 +#define DBL_MIN_EXP -1021 + +#define LDBL_MANT_DIG DBL_MANT_DIG +#define LDBL_EPSILON DBL_EPSILON +#define LDBL_DIG DBL_DIG +#define LDBL_MIN_EXP DBL_MIN_EXP +#define LDBL_MIN DBL_MIN +#define LDBL_MIN_10_EXP DBL_MIN_10_EXP +#define LDBL_MAX_EXP DBL_MAX_EXP +#define LDBL_MAX DBL_MAX +#define LDBL_MAX_10_EXP DBL_MAX_10_EXP + +#endif /* __FLOAT */ diff --git a/src/cmd/lccom-1/tst/mips-eb/front.2bk b/src/cmd/lccom-1/tst/mips-eb/front.2bk new file mode 100644 index 0000000..bbd390a --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/front.2bk @@ -0,0 +1,29 @@ +tst/front.c:3: warning: missing return value +tst/front.c:10: warning: missing return value +tst/front.c:20: type error in argument 1 to `s'; found `pointer to struct D' expected `pointer to incomplete struct D defined at tst/front.c:14' +tst/front.c:21: warning: missing return value +tst/front.c:32: warning: missing return value +tst/front.c:36: operands of = have illegal types `pointer to int' and `pointer to const int' +tst/front.c:38: warning: missing return value +tst/front.c:62: operands of = have illegal types `pointer to char' and `pointer to const void' +tst/front.c:63: warning: missing return value +tst/front.c:68: warning: missing return value +tst/front.c:69: warning: inconsistent linkage for `yy' previously declared at tst/front.c:68 +tst/front.c:69: warning: missing return value +tst/front.c:71: invalid storage class `static' for `int function goo' +tst/front.c:71: warning: declaration of `goo' does not match previous declaration at tst/front.c:70 +tst/front.c:71: warning: missing return value +tst/front.c:74: warning: declaration of `xr' does not match previous declaration at tst/front.c:72 +tst/front.c:74: warning: missing return value +tst/front.c:81: warning: missing return value +tst/front.c:82: warning: declaration of `ss2' does not match previous declaration at tst/front.c:81 +tst/front.c:84: warning: inconsistent linkage for `ss5' previously declared at tst/front.c:80 +tst/front.c:92: type error in argument 1 to `gx1'; found `pointer to double' expected `double' +tst/front.c:92: warning: missing return value +tst/front.c:95: redeclaration of `hx1' previously declared at tst/front.c:94 +tst/front.c:98: warning: missing return value +tst/front.c:101: conflicting argument declarations for function `gg1' +tst/front.c:101: warning: missing return value +tst/front.c:112: type error in argument 4 to `qsort'; found `pointer to int function(pointer to pointer to char,pointer to pointer to char)' expected `pointer to int function(pointer to const void,pointer to const void)' +tst/front.c:113: warning: missing return value +tst/front.c:120: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/front.sbk b/src/cmd/lccom-1/tst/mips-eb/front.sbk new file mode 100644 index 0000000..039e875 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/front.sbk @@ -0,0 +1,416 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +move $4,$0 +jal exit +move $2,$0 +L.1: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end main +.globl nested +.text +.align 2 +.ent nested +nested: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +la $24,4 +bge $4,$24,L.6 +la $24,114 +beq $5,$24,L.9 +L.6: +la $24,1 +bne $4,$24,L.8 +la $24,104 +beq $5,$24,L.9 +la $24,105 +beq $5,$24,L.9 +L.8: +la $24,2 +bne $4,$24,L.3 +la $24,111 +beq $5,$24,L.9 +la $24,121 +bne $5,$24,L.3 +L.9: +move $4,$5 +L.3: +move $2,$0 +L.2: +j $31 +.end nested +.globl s +.text +.align 2 +.ent s +s: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +L.10: +j $31 +.end s +.globl Dy +.sdata +.align 2 +Dy: +.word 0x0 +.space 4 +.globl Dz +.sdata +.align 2 +Dz: +.word 0x1 +.space 4 +.globl Dfunc +.text +.text +.align 2 +.ent Dfunc +Dfunc: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end Dfunc +.globl f +.text +.align 2 +.ent f +f: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end f +.globl f1 +.text +.align 2 +.ent f1 +f1: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end f1 +.globl f2 +.text +.align 2 +.ent f2 +f2: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +sw $5,36($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end f2 +.globl g +.text +.align 2 +.ent g +g: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end g +.globl h +.text +.align 2 +.ent h +h: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end h +.globl h1 +.text +.align 2 +.ent h1 +h1: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +sw $5,36($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end h1 +.globl h2 +.text +.align 2 +.ent h2 +h2: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end h2 +.sdata +.align 2 +L.21: +.word 0x1 +.globl set1 +.text +.text +.align 2 +.ent set1 +set1: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end set1 +.sdata +.align 2 +L.23: +.word 0x2 +.globl set2 +.text +.text +.align 2 +.ent set2 +set2: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end set2 +.text +.align 2 +.ent goo +goo: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end goo +.globl sss +.text +.align 2 +.ent sss +sss: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end sss +.lcomm L.27,4 +.globl rrr +.text +.text +.align 2 +.ent rrr +rrr: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end rrr +.globl setstatic +.text +.align 2 +.ent setstatic +setstatic: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end setstatic +.globl gx1 +.text +.align 2 +.ent gx1 +gx1: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +s.d $f12,32($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end gx1 +.globl ff1 +.text +.align 2 +.ent ff1 +ff1: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end ff1 +.globl gg1 +.text +.align 2 +.ent gg1 +gg1: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end gg1 +.globl hh1 +.text +.align 2 +.ent hh1 +hh1: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +j $31 +.end hh1 +.globl cmp +.text +.align 2 +.ent cmp +cmp: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +sw $5,36($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end cmp +.globl sort +.text +.align 2 +.ent sort +sort: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end sort +.globl onearg +.text +.align 2 +.ent onearg +onearg: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end onearg +.extern xr 4 +.globl ss4 +.comm ss4,4 +.lcomm ss2,4 +.lcomm ss5,4 +.globl ss3 +.comm ss3,4 +.lcomm ss1,4 +.lcomm yy,4 +.globl z +.comm z,4 +.globl y +.comm y,4 +.globl x +.comm x,4 +.globl b +.comm b,4 +.globl a +.comm a,4 diff --git a/src/cmd/lccom-1/tst/mips-eb/incr.2bk b/src/cmd/lccom-1/tst/mips-eb/incr.2bk new file mode 100644 index 0000000..d9ef13c --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/incr.2bk @@ -0,0 +1,9 @@ +tst/incr.c:1: warning: missing return value +tst/incr.c:6: warning: expression with no effect elided +tst/incr.c:6: warning: expression with no effect elided +tst/incr.c:11: warning: missing return value +tst/incr.c:16: warning: expression with no effect elided +tst/incr.c:16: warning: expression with no effect elided +tst/incr.c:21: warning: missing return value +tst/incr.c:30: warning: missing return value +tst/incr.c:39: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/incr.sbk b/src/cmd/lccom-1/tst/mips-eb/incr.sbk new file mode 100644 index 0000000..b7200e9 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/incr.sbk @@ -0,0 +1,149 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +move $2,$0 +L.1: +j $31 +.end main +.globl memchar +.text +.align 2 +.ent memchar +memchar: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +lw $24,-8+16($sp) +la $15,1($24) +sw $15,-8+16($sp) +lb $24,($24) +sb $24,-1+16($sp) +lw $24,-8+16($sp) +la $24,1($24) +sw $24,-8+16($sp) +lb $24,($24) +sb $24,-1+16($sp) +lw $24,-8+16($sp) +la $15,-1($24) +sw $15,-8+16($sp) +lb $24,($24) +sb $24,-1+16($sp) +lw $24,-8+16($sp) +la $24,-1($24) +sw $24,-8+16($sp) +lb $24,($24) +sb $24,-1+16($sp) +move $2,$0 +L.2: +addu $sp,$sp,16 +j $31 +.end memchar +.globl memint +.text +.align 2 +.ent memint +memint: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +lw $24,-8+16($sp) +la $15,4($24) +sw $15,-8+16($sp) +lw $24,($24) +sw $24,-4+16($sp) +lw $24,-8+16($sp) +la $24,4($24) +sw $24,-8+16($sp) +lw $24,($24) +sw $24,-4+16($sp) +lw $24,-8+16($sp) +la $15,-4($24) +sw $15,-8+16($sp) +lw $24,($24) +sw $24,-4+16($sp) +lw $24,-8+16($sp) +la $24,-4($24) +sw $24,-8+16($sp) +lw $24,($24) +sw $24,-4+16($sp) +move $2,$0 +L.3: +addu $sp,$sp,16 +j $31 +.end memint +.globl regchar +.text +.align 2 +.ent regchar +regchar: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +.mask 0x40800000,-12 +sw $23,0($sp) +sw $30,4($sp) +move $24,$23 +la $23,1($24) +lb $30,($24) +la $24,1($23) +move $23,$24 +lb $30,($24) +move $24,$23 +la $23,-1($24) +lb $30,($24) +la $24,-1($23) +move $23,$24 +lb $30,($24) +move $2,$0 +L.4: +lw $23,0($sp) +lw $30,4($sp) +addu $sp,$sp,16 +j $31 +.end regchar +.globl regint +.text +.align 2 +.ent regint +regint: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +.mask 0x40800000,-12 +sw $23,0($sp) +sw $30,4($sp) +move $24,$23 +la $23,4($24) +lw $30,($24) +la $24,4($23) +move $23,$24 +lw $30,($24) +move $24,$23 +la $23,-4($24) +lw $30,($24) +la $24,-4($23) +move $23,$24 +lw $30,($24) +move $2,$0 +L.5: +lw $23,0($sp) +lw $30,4($sp) +addu $sp,$sp,16 +j $31 +.end regint diff --git a/src/cmd/lccom-1/tst/mips-eb/init.1bk b/src/cmd/lccom-1/tst/mips-eb/init.1bk new file mode 100644 index 0000000..77aff09 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/init.1bk @@ -0,0 +1,16 @@ + 1 2 3 4 + 5 6 + 7 +if +for +else +while +1 2 3 if +4 5 0 for +6 7 8 else +9 10 11 while +1 2 3 if +4 5 0 for +6 7 8 else +9 10 11 while +0 0 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/init.2bk b/src/cmd/lccom-1/tst/mips-eb/init.2bk new file mode 100644 index 0000000..aafe415 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/init.2bk @@ -0,0 +1,3 @@ +tst/init.c:36: warning: missing return value +tst/init.c:49: warning: missing return value +tst/init.c:59: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/init.sbk b/src/cmd/lccom-1/tst/mips-eb/init.sbk new file mode 100644 index 0000000..128feb3 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/init.sbk @@ -0,0 +1,325 @@ +.set reorder +.globl words +.data +.align 2 +words: +.word 0x1 +.word 0x2 +.word 0x3 +.byte 105 +.byte 102 +.byte 0 +.space 3 +.space 2 +.word 0x4 +.word 0x5 +.space 4 +.byte 102 +.byte 111 +.byte 114 +.space 3 +.space 2 +.word 0x6 +.word 0x7 +.word 0x8 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 0 +.space 1 +.space 2 +.word 0x9 +.word 0xa +.word 0xb +.byte 119 +.byte 104 +.byte 105 +.byte 108 +.byte 101 +.space 1 +.space 2 +.word 0x0 +.space 8 +.space 8 +.globl wordlist +.sdata +.align 2 +wordlist: +.word words +.globl x +.data +.align 2 +x: +.word 0x1 +.word 0x2 +.word 0x3 +.word 0x4 +.word 0x0 +.word 0x5 +.word 0x6 +.space 12 +.word 0x7 +.space 16 +.globl y +.data +.align 2 +y: +.word x +.word x+20 +.word x+40 +.word 0x0 +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2800000,-4 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +move $23,$0 +b L.8 +L.5: +move $30,$0 +b L.12 +L.9: +la $4,L.13 +sll $24,$30,2 +sll $15,$23,2 +lw $15,y($15) +addu $24,$24,$15 +lw $5,($24) +jal printf +L.10: +la $30,1($30) +L.12: +sll $24,$30,2 +sll $15,$23,2 +lw $15,y($15) +addu $24,$24,$15 +lw $24,($24) +bne $24,$0,L.9 +la $4,L.14 +jal printf +L.6: +la $23,1($23) +L.8: +sll $24,$23,2 +lw $24,y($24) +bne $24,$0,L.5 +jal f +lw $4,wordlist +jal g +move $2,$0 +L.4: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end main +.data +.align 2 +L.16: +.word L.17 +.word L.18 +.word L.19 +.word L.20 +.word 0x0 +.globl f +.text +.text +.align 2 +.ent f +f: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +la $30,L.16 +b L.24 +L.21: +la $4,L.25 +lw $5,($30) +jal printf +L.22: +la $30,4($30) +L.24: +lw $24,($30) +bne $24,$0,L.21 +move $2,$0 +L.15: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end f +.globl g +.text +.align 2 +.ent g +g: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2800000,-4 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +move $30,$4 +b L.30 +L.27: +move $23,$0 +b L.34 +L.31: +la $4,L.35 +sll $24,$23,2 +addu $24,$24,$30 +lw $5,($24) +jal printf +L.32: +la $23,1($23) +L.34: +move $24,$23 +la $15,3 +bltu $24,$15,L.31 +la $4,L.25 +la $5,12($30) +jal printf +L.28: +la $30,20($30) +L.30: +lw $24,($30) +bne $24,$0,L.27 +jal h +move $2,$0 +L.26: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end g +.globl h +.text +.align 2 +.ent h +h: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-4 +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +move $30,$0 +b L.40 +L.37: +la $4,L.41 +la $24,20 +mul $24,$24,$30 +lw $5,words($24) +lw $6,words+4($24) +lw $7,words+8($24) +la $24,words+12($24) +sw $24,16($sp) +jal printf +L.38: +la $30,1($30) +L.40: +move $24,$30 +la $15,5 +bltu $24,$15,L.37 +move $2,$0 +L.36: +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end h +.rdata +.align 0 +L.41: +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.35: +.byte 37 +.byte 100 +.byte 32 +.byte 0 +.align 0 +L.25: +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.20: +.byte 119 +.byte 104 +.byte 105 +.byte 108 +.byte 101 +.byte 0 +.align 0 +L.19: +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 0 +.align 0 +L.18: +.byte 102 +.byte 111 +.byte 114 +.byte 0 +.align 0 +L.17: +.byte 105 +.byte 102 +.byte 0 +.align 0 +L.14: +.byte 10 +.byte 0 +.align 0 +L.13: +.byte 32 +.byte 37 +.byte 100 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/limits.1bk b/src/cmd/lccom-1/tst/mips-eb/limits.1bk new file mode 100644 index 0000000..9beee8c --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/limits.1bk @@ -0,0 +1,14 @@ +UCHAR_MAX: 000000ff=255 +USHRT_MAX: 0000ffff=65535 +UINT_MAX: ffffffff=-1 +ULONG_MAX: ffffffff=-1 +CHAR_MAX: 0000007f=127 +SCHAR_MAX: 0000007f=127 +SHRT_MAX: 00007fff=32767 +INT_MAX: 7fffffff=2147483647 +LONG_MAX: 7fffffff=2147483647 +CHAR_MIN: ffffff80=-128 +SCHAR_MIN: ffffff80=-128 +SHRT_MIN: ffff8000=-32768 +INT_MIN: 80000000=-2147483648 +LONG_MIN: 80000000=-2147483648 diff --git a/src/cmd/lccom-1/tst/mips-eb/limits.2bk b/src/cmd/lccom-1/tst/mips-eb/limits.2bk new file mode 100644 index 0000000..e69de29 diff --git a/src/cmd/lccom-1/tst/mips-eb/limits.h b/src/cmd/lccom-1/tst/mips-eb/limits.h new file mode 100644 index 0000000..913bb97 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/limits.h @@ -0,0 +1,30 @@ +#ifndef __LIMITS +#define __LIMITS + +#define CHAR_BIT 8 +#define MB_LEN_MAX 1 + +#define UCHAR_MAX 0xff +#define USHRT_MAX 0xffff +#define UINT_MAX (~0U) +#define ULONG_MAX (~0UL) + +#define SCHAR_MAX 0x7f +#define SHRT_MAX 0x7fff +#define INT_MAX 0x7fffffff +#define LONG_MAX 0x7fffffffL + +#define SCHAR_MIN (-SCHAR_MAX-1) +#define SHRT_MIN (-SHRT_MAX-1) +#define INT_MIN (-INT_MAX-1) +#define LONG_MIN (-LONG_MAX-1) + +#ifdef __CHAR_UNSIGNED__ +#define CHAR_MAX UCHAR_MAX +#define CHAR_MIN 0 +#else +#define CHAR_MAX SCHAR_MAX +#define CHAR_MIN SCHAR_MIN +#endif + +#endif /* __LIMITS */ diff --git a/src/cmd/lccom-1/tst/mips-eb/limits.sbk b/src/cmd/lccom-1/tst/mips-eb/limits.sbk new file mode 100644 index 0000000..e4f2673 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/limits.sbk @@ -0,0 +1,396 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +la $4,L.2 +la $24,255 +move $5,$24 +move $6,$24 +jal printf +la $4,L.3 +la $24,65535 +move $5,$24 +move $6,$24 +jal printf +la $4,L.4 +la $24,0xffffffff +move $5,$24 +move $6,$24 +jal printf +la $4,L.5 +la $24,0xffffffff +move $5,$24 +move $6,$24 +jal printf +la $4,L.6 +la $24,127 +move $5,$24 +move $6,$24 +jal printf +la $4,L.7 +la $24,127 +move $5,$24 +move $6,$24 +jal printf +la $4,L.8 +la $24,32767 +move $5,$24 +move $6,$24 +jal printf +la $4,L.9 +la $24,2147483647 +move $5,$24 +move $6,$24 +jal printf +la $4,L.10 +la $24,2147483647 +move $5,$24 +move $6,$24 +jal printf +la $4,L.11 +la $24,-128 +move $5,$24 +move $6,$24 +jal printf +la $4,L.12 +la $24,-128 +move $5,$24 +move $6,$24 +jal printf +la $4,L.13 +la $24,-32768 +move $5,$24 +move $6,$24 +jal printf +la $4,L.14 +la $24,-2147483648 +move $5,$24 +move $6,$24 +jal printf +la $4,L.15 +la $24,-2147483648 +move $5,$24 +move $6,$24 +jal printf +move $2,$0 +L.1: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end main +.rdata +.align 0 +L.15: +.byte 76 +.byte 79 +.byte 78 +.byte 71 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 108 +.byte 120 +.byte 61 +.byte 37 +.byte 108 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.14: +.byte 73 +.byte 78 +.byte 84 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.13: +.byte 83 +.byte 72 +.byte 82 +.byte 84 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.12: +.byte 83 +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.11: +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.10: +.byte 76 +.byte 79 +.byte 78 +.byte 71 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 108 +.byte 120 +.byte 61 +.byte 37 +.byte 108 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.9: +.byte 73 +.byte 78 +.byte 84 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.8: +.byte 83 +.byte 72 +.byte 82 +.byte 84 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.7: +.byte 83 +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.6: +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.5: +.byte 85 +.byte 76 +.byte 79 +.byte 78 +.byte 71 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 108 +.byte 120 +.byte 61 +.byte 37 +.byte 108 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.4: +.byte 85 +.byte 73 +.byte 78 +.byte 84 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.3: +.byte 85 +.byte 83 +.byte 72 +.byte 82 +.byte 84 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.2: +.byte 85 +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/locale.h b/src/cmd/lccom-1/tst/mips-eb/locale.h new file mode 100644 index 0000000..8a96636 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/locale.h @@ -0,0 +1,38 @@ +#ifndef __LOCALE +#define __LOCALE + +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 +#ifndef NULL +#define NULL ((void*)0) +#endif + +struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; +}; + +char *setlocale(int, const char *); +struct lconv *localeconv(void); + +#endif /* __LOCALE */ diff --git a/src/cmd/lccom-1/tst/mips-eb/math.h b/src/cmd/lccom-1/tst/mips-eb/math.h new file mode 100644 index 0000000..d2a31f4 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/math.h @@ -0,0 +1,29 @@ +#ifndef __MATH +#define __MATH + +#define HUGE_VAL 1.79769313486231570000e+308 + +extern double acos(double); +extern double asin(double); +extern double atan(double); +extern double atan2(double, double); +extern double cos(double); +extern double sin(double); +extern double tan(double); +extern double cosh(double); +extern double sinh(double); +extern double tanh(double); +extern double exp(double); +extern double frexp(double, int *); +extern double ldexp(double, int); +extern double log(double); +extern double log10(double); +extern double modf(double, double *); +extern double pow(double, double); +extern double sqrt(double); +extern double ceil(double); +extern double fabs(double); +extern double floor(double); +extern double fmod(double, double); + +#endif /* __MATH */ diff --git a/src/cmd/lccom-1/tst/mips-eb/paranoia.1bk b/src/cmd/lccom-1/tst/mips-eb/paranoia.1bk new file mode 100644 index 0000000..158f649 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/paranoia.1bk @@ -0,0 +1,178 @@ +Lest this program stop prematurely, i.e. before displaying + + `END OF TEST', + +try to persuade the computer NOT to terminate execution when an +error like Over/Underflow or Division by Zero occurs, but rather +to persevere with a surrogate value after, perhaps, displaying some +warning. If persuasion avails naught, don't despair but run this +program anyway to see how many milestones it passes, and then +amend it to make further progress. + +Answer questions with Y, y, N or n (unless otherwise indicated). + + +Diagnosis resumes after milestone Number 0 Page: 1 + +Users are invited to help debug and augment this program so it will +cope with unanticipated and newly uncovered arithmetic pathologies. + +Please send suggestions and interesting results to + Richard Karpinski + Computer Center U-76 + University of California + San Francisco, CA 94143-0704, USA + +In doing so, please include the following information: + Precision: double; + Version: 10 February 1989; + Computer: + + Compiler: + + Optimization level: + + Other relevant compiler options: + +Diagnosis resumes after milestone Number 1 Page: 2 + +Running this program should reveal these characteristics: + Radix = 1, 2, 4, 8, 10, 16, 100, 256 ... + Precision = number of significant digits carried. + U2 = Radix/Radix^Precision = One Ulp + (OneUlpnit in the Last Place) of 1.000xxx . + U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 . + Adequacy of guard digits for Mult., Div. and Subt. + Whether arithmetic is chopped, correctly rounded, or something else + for Mult., Div., Add/Subt. and Sqrt. + Whether a Sticky Bit used correctly for rounding. + UnderflowThreshold = an underflow threshold. + E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy. + V = an overflow threshold, roughly. + V0 tells, roughly, whether Infinity is represented. + Comparisions are checked for consistency with subtraction + and for contamination with pseudo-zeros. + Sqrt is tested. Y^X is not tested. + Extra-precise subexpressions are revealed but NOT YET tested. + Decimal-Binary conversion is NOT YET tested for accuracy. + +Diagnosis resumes after milestone Number 2 Page: 3 + +The program attempts to discriminate among + FLAWs, like lack of a sticky bit, + Serious DEFECTs, like lack of a guard digit, and + FAILUREs, like 2+2 == 5 . +Failures may confound subsequent diagnoses. + +The diagnostic capabilities of this program go beyond an earlier +program called `MACHAR', which can be found at the end of the +book `Software Manual for the Elementary Functions' (1980) by +W. J. Cody and W. Waite. Although both programs try to discover +the Radix, Precision and range (over/underflow thresholds) +of the arithmetic, this program tries to cope with a wider variety +of pathologies, and to say how well the arithmetic is implemented. + +The program is based upon a conventional radix representation for +floating-point numbers, but also allows logarithmic encoding +as used by certain early WANG machines. + +BASIC version of this program (C) 1983 by Prof. W. M. Kahan; +see source comments for more history. + +Diagnosis resumes after milestone Number 3 Page: 4 + +Program is now RUNNING tests on small integers: +-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K. + +Searching for Radix and Precision. +Radix = 2.000000 . +Closest relative separation found is U1 = 1.1102230e-16 . + +Recalculating radix and precision + confirms closest relative separation U1 . +Radix confirmed. +The number of significant digits of the Radix is 53.000000 . + +Diagnosis resumes after milestone Number 30 Page: 5 + +Subtraction appears to be normalized, as it should be. +Checking for guard digit in *, /, and -. + *, /, and - appear to have guard digits, as they should. + +Diagnosis resumes after milestone Number 40 Page: 6 + +Checking rounding on multiply, divide and add/subtract. +Multiplication appears to round correctly. +Division appears to round correctly. +Addition/Subtraction appears to round correctly. +Checking for sticky bit. +Sticky bit apparently used correctly. + +Does Multiplication commute? Testing on 20 random pairs. + No failures found in 20 integer pairs. + +Running test of square root(x). +Testing if sqrt(X * X) == X for 20 Integers X. +Test for sqrt monotonicity. +sqrt has passed a test for Monotonicity. +Testing whether sqrt is rounded or chopped. +Square root appears to be correctly rounded. + +Diagnosis resumes after milestone Number 90 Page: 7 + +Testing powers Z^i for small Integers Z and i. +... no discrepancis found. + +Seeking Underflow thresholds UfThold and E0. +Smallest strictly positive number found is E0 = 4.94066e-324 . +Since comparison denies Z = 0, evaluating (Z + Z) / Z should be safe. +What the machine gets for (Z + Z) / Z is 2.00000000000000000e+00 . +This is O.K., provided Over/Underflow has NOT just been signaled. +Underflow is gradual; it incurs Absolute Error = +(roundoff in UfThold) < E0. +The Underflow threshold is 2.22507385850720190e-308, below which +calculation may suffer larger Relative error than merely roundoff. +Since underflow occurs below the threshold +UfThold = (2.00000000000000000e+00) ^ (-1.02200000000000000e+03) +only underflow should afflict the expression + (2.00000000000000000e+00) ^ (-1.02200000000000000e+03); +actually calculating yields: 0.00000000000000000e+00 . +This computed value is O.K. + +Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065220e+00 as X -> 1. +Accuracy seems adequate. +Testing powers Z^Q at four nearly extreme values. + ... no discrepancies found. + + +Diagnosis resumes after milestone Number 160 Page: 8 + +Searching for Overflow threshold: +This may generate an error. +Can `Z = -Y' overflow? +Trying it on Y = -inf . +Seems O.K. +Overflow threshold is V = 1.79769313486231570e+308 . +Overflow saturates at V0 = inf . +No Overflow should be signaled for V * 1 = 1.79769313486231570e+308 + nor for V / 1 = 1.79769313486231570e+308 . +Any overflow signal separating this * from the one +above is a DEFECT. + + +Diagnosis resumes after milestone Number 190 Page: 9 + + +What message and/or values does Division by Zero produce? + Trying to compute 1 / 0 produces ... inf . + + Trying to compute 0 / 0 produces ... nan . + +Diagnosis resumes after milestone Number 220 Page: 10 + + + +No failures, defects nor flaws have been discovered. +Rounding appears to conform to the proposed IEEE standard P754. +The arithmetic diagnosed appears to be Excellent! +END OF TEST. diff --git a/src/cmd/lccom-1/tst/mips-eb/paranoia.2bk b/src/cmd/lccom-1/tst/mips-eb/paranoia.2bk new file mode 100644 index 0000000..2718174 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/paranoia.2bk @@ -0,0 +1,16 @@ +tst/paranoia.c:1867: warning: missing return value +tst/paranoia.c:1874: warning: missing return value +tst/paranoia.c:1884: warning: missing return value +tst/paranoia.c:1924: warning: missing return value +tst/paranoia.c:1939: warning: missing return value +tst/paranoia.c:1956: warning: missing return value +tst/paranoia.c:1975: warning: missing return value +tst/paranoia.c:1988: warning: missing return value +tst/paranoia.c:1995: warning: missing return value +tst/paranoia.c:2055: warning: missing return value +tst/paranoia.c:2062: warning: missing return value +tst/paranoia.c:2070: warning: missing return value +tst/paranoia.c:2087: warning: missing return value +tst/paranoia.c:2115: warning: missing return value +tst/paranoia.c:2144: warning: missing return value +tst/paranoia.c:2173: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/paranoia.sbk b/src/cmd/lccom-1/tst/mips-eb/paranoia.sbk new file mode 100644 index 0000000..4dd8660 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/paranoia.sbk @@ -0,0 +1,18657 @@ +.set reorder +.globl Zero +.sdata +.align 3 +Zero: +.word 0x0 +.word 0x0 +.globl Half +.sdata +.align 3 +Half: +.word 0x3fe00000 +.word 0x0 +.globl One +.sdata +.align 3 +One: +.word 0x3ff00000 +.word 0x0 +.globl Two +.sdata +.align 3 +Two: +.word 0x40000000 +.word 0x0 +.globl Three +.sdata +.align 3 +Three: +.word 0x40080000 +.word 0x0 +.globl Four +.sdata +.align 3 +Four: +.word 0x40100000 +.word 0x0 +.globl Five +.sdata +.align 3 +Five: +.word 0x40140000 +.word 0x0 +.globl Eight +.sdata +.align 3 +Eight: +.word 0x40200000 +.word 0x0 +.globl Nine +.sdata +.align 3 +Nine: +.word 0x40220000 +.word 0x0 +.globl TwentySeven +.sdata +.align 3 +TwentySeven: +.word 0x403b0000 +.word 0x0 +.globl ThirtyTwo +.sdata +.align 3 +ThirtyTwo: +.word 0x40400000 +.word 0x0 +.globl TwoForty +.sdata +.align 3 +TwoForty: +.word 0x406e0000 +.word 0x0 +.globl MinusOne +.sdata +.align 3 +MinusOne: +.word 0xbff00000 +.word 0x0 +.globl OneAndHalf +.sdata +.align 3 +OneAndHalf: +.word 0x3ff80000 +.word 0x0 +.globl NoTrials +.sdata +.align 2 +NoTrials: +.word 0x14 +.globl sigfpe +.text +.text +.align 2 +.ent sigfpe +sigfpe: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +lw $24,fpecount +la $24,1($24) +sw $24,fpecount +la $4,L.2 +jal printf +la $4,_iob+16 +jal fflush +lw $24,sigsave +beq $24,$0,L.4 +la $4,8 +lw $5,sigsave +jal signal +sw $0,sigsave +la $4,ovfl_buf +la $5,1 +jal longjmp +L.4: +jal abort +L.1: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end sigfpe +.data +.align 2 +L.757: +.word L.758 +.word L.759 +.word L.760 +.word L.761 +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,240,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-240 +.mask 0xc2ff0000,-168 +sw $16,32($sp) +sw $17,36($sp) +sw $18,40($sp) +sw $19,44($sp) +sw $20,48($sp) +sw $21,52($sp) +sw $22,56($sp) +sw $23,60($sp) +.cprestore 64 +sw $30,68($sp) +sw $31,72($sp) +l.d $f18,L.7 +s.d $f18,Zero +l.d $f18,L.8 +s.d $f18,One +l.d $f18,One +add.d $f16,$f18,$f18 +s.d $f16,Two +l.d $f16,Two +add.d $f10,$f16,$f18 +s.d $f10,Three +l.d $f10,Three +add.d $f8,$f10,$f18 +s.d $f8,Four +l.d $f8,Four +add.d $f6,$f8,$f18 +s.d $f6,Five +add.d $f6,$f8,$f8 +s.d $f6,Eight +mul.d $f6,$f10,$f10 +s.d $f6,Nine +l.d $f6,Nine +mul.d $f6,$f6,$f10 +s.d $f6,TwentySeven +l.d $f6,Eight +mul.d $f6,$f8,$f6 +s.d $f6,ThirtyTwo +l.d $f6,Five +mul.d $f6,$f8,$f6 +mul.d $f10,$f6,$f10 +mul.d $f10,$f10,$f8 +s.d $f10,TwoForty +neg.d $f10,$f18 +s.d $f10,MinusOne +div.d $f16,$f18,$f16 +s.d $f16,Half +l.d $f16,Half +add.d $f18,$f18,$f16 +s.d $f18,OneAndHalf +sw $0,ErrCnt +sw $0,ErrCnt+4 +sw $0,ErrCnt+8 +sw $0,ErrCnt+12 +la $24,1 +sw $24,PageNo +sw $0,Milestone +la $4,8 +la $5,sigfpe +jal signal +jal Instructions +jal Pause +jal Heading +jal Pause +jal Characteristics +jal Pause +jal History +jal Pause +la $24,7 +sw $24,Milestone +la $4,L.12 +jal printf +move $4,$0 +l.d $f18,Zero +add.d $f16,$f18,$f18 +c.eq.d $f16,$f18; bc1f L.15 +l.d $f16,One +sub.d $f10,$f16,$f16 +c.eq.d $f10,$f18; bc1f L.15 +c.ule.d $f16,$f18; bc1t L.15 +add.d $f18,$f16,$f16 +l.d $f16,Two +c.eq.d $f18,$f16; bc1f L.15 +la $30,1 +b L.16 +L.15: +move $30,$0 +L.16: +move $5,$30 +la $6,L.14 +jal TstCond +l.d $f18,Zero +neg.d $f18,$f18 +s.d $f18,Z +l.d $f18,Z +l.d $f16,L.7 +c.eq.d $f18,$f16; bc1t L.17 +lw $24,ErrCnt +la $24,1($24) +sw $24,ErrCnt +la $4,L.19 +jal printf +l.d $f18,L.20 +s.d $f18,U1 +l.d $f18,L.8 +s.d $f18,Radix +jal TstPtUf +L.17: +move $4,$0 +l.d $f18,Three +l.d $f16,Two +l.d $f10,One +add.d $f8,$f16,$f10 +c.eq.d $f18,$f8; bc1f L.23 +l.d $f8,Four +add.d $f6,$f18,$f10 +c.eq.d $f8,$f6; bc1f L.23 +l.d $f6,Zero +neg.d $f4,$f16 +mul.d $f16,$f16,$f4 +add.d $f16,$f8,$f16 +c.eq.d $f16,$f6; bc1f L.23 +sub.d $f18,$f8,$f18 +sub.d $f18,$f18,$f10 +c.eq.d $f18,$f6; bc1f L.23 +la $23,1 +b L.24 +L.23: +move $23,$0 +L.24: +move $5,$23 +la $6,L.22 +jal TstCond +l.d $f18,MinusOne +s.d $f18,-8+240($sp) +l.d $f16,One +l.d $f10,L.7 +sub.d $f10,$f10,$f16 +c.eq.d $f18,$f10; bc1f L.27 +l.d $f10,Zero +add.d $f8,$f18,$f16 +c.eq.d $f8,$f10; bc1f L.27 +add.d $f8,$f16,$f18 +c.eq.d $f8,$f10; bc1f L.27 +mov.d $f12,$f16 +jal fabs +l.d $f16,Zero +l.d $f10,-8+240($sp) +add.d $f18,$f10,$f0 +c.eq.d $f18,$f16; bc1f L.27 +l.d $f18,MinusOne +mul.d $f10,$f18,$f18 +add.d $f18,$f18,$f10 +c.eq.d $f18,$f16; bc1f L.27 +la $22,1 +b L.28 +L.27: +move $22,$0 +L.28: +move $4,$0 +move $5,$22 +la $6,L.26 +jal TstCond +move $4,$0 +l.d $f18,Half +l.d $f16,MinusOne +add.d $f16,$f18,$f16 +add.d $f18,$f16,$f18 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.31 +la $21,1 +b L.32 +L.31: +move $21,$0 +L.32: +move $5,$21 +la $6,L.30 +jal TstCond +la $24,10 +sw $24,Milestone +move $4,$0 +l.d $f18,Nine +l.d $f16,Three +mul.d $f10,$f16,$f16 +c.eq.d $f18,$f10; bc1f L.35 +l.d $f10,TwentySeven +mul.d $f18,$f18,$f16 +c.eq.d $f10,$f18; bc1f L.35 +l.d $f18,Eight +l.d $f16,Four +add.d $f8,$f16,$f16 +c.eq.d $f18,$f8; bc1f L.35 +l.d $f8,ThirtyTwo +mul.d $f18,$f18,$f16 +c.eq.d $f8,$f18; bc1f L.35 +sub.d $f18,$f8,$f10 +sub.d $f18,$f18,$f16 +l.d $f16,One +sub.d $f18,$f18,$f16 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.35 +la $20,1 +b L.36 +L.35: +move $20,$0 +L.36: +move $5,$20 +la $6,L.34 +jal TstCond +move $4,$0 +l.d $f18,Five +l.d $f16,Four +l.d $f10,One +add.d $f10,$f16,$f10 +c.eq.d $f18,$f10; bc1f L.39 +l.d $f10,TwoForty +l.d $f8,Three +s.d $f8,-16+240($sp) +mul.d $f6,$f16,$f18 +mul.d $f6,$f6,$f8 +mul.d $f6,$f6,$f16 +c.eq.d $f10,$f6; bc1f L.39 +l.d $f6,Zero +div.d $f4,$f10,$f8 +mul.d $f8,$f16,$f16 +mul.d $f8,$f8,$f18 +sub.d $f8,$f4,$f8 +c.eq.d $f8,$f6; bc1f L.39 +div.d $f8,$f10,$f16 +l.d $f4,-16+240($sp) +mul.d $f4,$f18,$f4 +mul.d $f4,$f4,$f16 +sub.d $f8,$f8,$f4 +c.eq.d $f8,$f6; bc1f L.39 +div.d $f18,$f10,$f18 +l.d $f10,-16+240($sp) +mul.d $f10,$f16,$f10 +mul.d $f16,$f10,$f16 +sub.d $f18,$f18,$f16 +c.eq.d $f18,$f6; bc1f L.39 +la $19,1 +b L.40 +L.39: +move $19,$0 +L.40: +move $5,$19 +la $6,L.38 +jal TstCond +lw $24,ErrCnt +bne $24,$0,L.41 +la $4,L.43 +jal printf +la $4,L.44 +jal printf +L.41: +la $4,L.45 +jal printf +l.d $f18,One +s.d $f18,W +L.46: +l.d $f18,W +add.d $f18,$f18,$f18 +s.d $f18,W +l.d $f18,W +l.d $f16,One +add.d $f10,$f18,$f16 +s.d $f10,Y +l.d $f10,Y +sub.d $f18,$f10,$f18 +s.d $f18,Z +l.d $f18,Z +sub.d $f18,$f18,$f16 +s.d $f18,Y +L.47: +l.d $f12,Y +jal fabs +l.d $f16,MinusOne +add.d $f18,$f16,$f0 +l.d $f16,Zero +c.ult.d $f18,$f16; bc1t L.46 +l.d $f18,Zero +s.d $f18,Precision +l.d $f18,One +s.d $f18,Y +L.49: +l.d $f18,W +l.d $f16,Y +add.d $f10,$f18,$f16 +s.d $f10,Radix +add.d $f16,$f16,$f16 +s.d $f16,Y +l.d $f16,Radix +sub.d $f18,$f16,$f18 +s.d $f18,Radix +L.50: +l.d $f18,Radix +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.49 +l.d $f18,Radix +l.d $f16,Two +c.lt.d $f18,$f16; bc1f L.52 +l.d $f18,One +s.d $f18,Radix +L.52: +la $4,L.54 +l.d $f18,Radix +mfc1.d $6,$f18 +jal printf +l.d $f18,Radix +l.d $f16,L.8 +c.eq.d $f18,$f16; bc1t L.55 +l.d $f18,One +s.d $f18,W +L.57: +l.d $f18,One +l.d $f16,Precision +add.d $f16,$f16,$f18 +s.d $f16,Precision +l.d $f16,W +l.d $f10,Radix +mul.d $f16,$f16,$f10 +s.d $f16,W +l.d $f16,W +add.d $f18,$f16,$f18 +s.d $f18,Y +L.58: +l.d $f18,Y +l.d $f16,W +sub.d $f18,$f18,$f16 +l.d $f16,One +c.eq.d $f18,$f16; bc1t L.57 +L.55: +l.d $f18,One +l.d $f16,W +div.d $f18,$f18,$f16 +s.d $f18,U1 +l.d $f18,U1 +l.d $f16,Radix +mul.d $f16,$f16,$f18 +s.d $f16,U2 +la $4,L.60 +mfc1.d $6,$f18 +jal printf +la $4,L.61 +jal printf +l.d $f18,Radix +s.d $f18,E0 +l.d $f18,U1 +s.d $f18,E1 +l.d $f18,U2 +s.d $f18,E9 +l.d $f18,Precision +s.d $f18,E3 +l.d $f18,Four +l.d $f16,Three +div.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,X +l.d $f16,One +sub.d $f18,$f18,$f16 +s.d $f18,Third +l.d $f18,Third +l.d $f16,Half +sub.d $f16,$f16,$f18 +s.d $f16,F6 +l.d $f16,F6 +add.d $f16,$f16,$f16 +s.d $f16,X +l.d $f16,X +sub.d $f12,$f16,$f18 +jal fabs +s.d $f0,X +l.d $f18,X +l.d $f16,U2 +c.lt.d $f18,$f16; bc1f L.62 +l.d $f18,U2 +s.d $f18,X +L.62: +L.64: +l.d $f18,X +s.d $f18,U2 +l.d $f18,U2 +l.d $f16,Half +mul.d $f16,$f16,$f18 +l.d $f10,ThirtyTwo +mul.d $f10,$f10,$f18 +mul.d $f18,$f10,$f18 +add.d $f18,$f16,$f18 +s.d $f18,Y +l.d $f18,One +l.d $f16,Y +add.d $f16,$f18,$f16 +s.d $f16,Y +l.d $f16,Y +sub.d $f18,$f16,$f18 +s.d $f18,X +L.65: +l.d $f18,X +l.d $f16,U2 +c.ule.d $f16,$f18; bc1t L.67 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.64 +L.67: +l.d $f18,Two +l.d $f16,Three +div.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,Half +l.d $f16,X +sub.d $f16,$f16,$f18 +s.d $f16,F6 +l.d $f16,F6 +add.d $f10,$f16,$f16 +s.d $f10,Third +l.d $f10,Third +sub.d $f18,$f10,$f18 +s.d $f18,X +l.d $f18,X +add.d $f12,$f18,$f16 +jal fabs +s.d $f0,X +l.d $f18,X +l.d $f16,U1 +c.lt.d $f18,$f16; bc1f L.68 +l.d $f18,U1 +s.d $f18,X +L.68: +L.70: +l.d $f18,X +s.d $f18,U1 +l.d $f18,Half +l.d $f16,U1 +mul.d $f10,$f18,$f16 +l.d $f8,ThirtyTwo +mul.d $f8,$f8,$f16 +mul.d $f16,$f8,$f16 +add.d $f16,$f10,$f16 +s.d $f16,Y +l.d $f16,Y +sub.d $f16,$f18,$f16 +s.d $f16,Y +l.d $f16,Y +add.d $f16,$f18,$f16 +s.d $f16,X +l.d $f16,X +sub.d $f16,$f18,$f16 +s.d $f16,Y +l.d $f16,Y +add.d $f18,$f18,$f16 +s.d $f18,X +L.71: +l.d $f18,X +l.d $f16,U1 +c.ule.d $f16,$f18; bc1t L.73 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.70 +L.73: +l.d $f18,U1 +l.d $f16,E1 +c.eq.d $f18,$f16; bc1f L.74 +la $4,L.76 +jal printf +b L.75 +L.74: +la $4,L.77 +l.d $f18,U1 +mfc1.d $6,$f18 +jal printf +L.75: +l.d $f18,U1 +l.d $f16,One +div.d $f16,$f16,$f18 +s.d $f16,W +l.d $f16,Half +sub.d $f10,$f16,$f18 +add.d $f16,$f10,$f16 +s.d $f16,F9 +l.d $f16,U2 +div.d $f18,$f16,$f18 +l.d $f16,L.78 +add.d $f12,$f18,$f16 +jal floor +s.d $f0,Radix +l.d $f18,Radix +l.d $f16,E0 +c.eq.d $f18,$f16; bc1f L.79 +la $4,L.81 +jal printf +b L.80 +L.79: +la $4,L.82 +l.d $f18,Radix +mfc1.d $6,$f18 +jal printf +L.80: +la $4,2 +l.d $f18,Eight +l.d $f16,Radix +add.d $f18,$f18,$f18 +c.le.d $f16,$f18; bc1f L.85 +la $18,1 +b L.86 +L.85: +move $18,$0 +L.86: +move $5,$18 +la $6,L.84 +jal TstCond +la $4,3 +l.d $f18,Radix +l.d $f16,Two +c.eq.d $f18,$f16; bc1t L.92 +l.d $f16,L.93 +c.eq.d $f18,$f16; bc1t L.92 +l.d $f16,One +c.eq.d $f18,$f16; bc1f L.89 +L.92: +la $17,1 +b L.90 +L.89: +move $17,$0 +L.90: +move $5,$17 +la $6,L.88 +jal TstCond +la $24,20 +sw $24,Milestone +move $4,$0 +l.d $f18,Half +l.d $f16,F9 +sub.d $f16,$f16,$f18 +c.lt.d $f16,$f18; bc1f L.96 +la $16,1 +b L.97 +L.96: +move $16,$0 +L.97: +move $5,$16 +la $6,L.95 +jal TstCond +l.d $f18,F9 +s.d $f18,X +la $24,1 +sw $24,I +l.d $f18,Half +l.d $f16,X +sub.d $f16,$f16,$f18 +s.d $f16,Y +l.d $f16,Y +sub.d $f18,$f16,$f18 +s.d $f18,Z +move $4,$0 +l.d $f18,X +l.d $f16,One +c.eq.d $f18,$f16; bc1f L.102 +l.d $f18,Z +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.100 +L.102: +la $24,1 +sw $24,-20+240($sp) +b L.101 +L.100: +sw $0,-20+240($sp) +L.101: +lw $5,-20+240($sp) +la $6,L.99 +jal TstCond +l.d $f18,One +l.d $f16,U2 +add.d $f10,$f18,$f16 +s.d $f10,X +sw $0,I +la $24,25 +sw $24,Milestone +l.d $f10,Radix +sub.d $f8,$f10,$f18 +s.d $f8,BMinusU2 +l.d $f8,BMinusU2 +sub.d $f16,$f8,$f16 +add.d $f16,$f16,$f18 +s.d $f16,BMinusU2 +c.eq.d $f10,$f18; bc1t L.103 +l.d $f12,U1 +jal log +mov.d $f18,$f0 +s.d $f18,-32+240($sp) +l.d $f12,Radix +jal log +l.d $f16,TwoForty +neg.d $f16,$f16 +l.d $f10,-32+240($sp) +mul.d $f16,$f16,$f10 +div.d $f18,$f16,$f0 +s.d $f18,X +l.d $f18,Half +l.d $f16,X +add.d $f12,$f18,$f16 +jal floor +s.d $f0,Y +l.d $f18,X +l.d $f16,Y +sub.d $f12,$f18,$f16 +jal fabs +l.d $f16,Four +mul.d $f18,$f0,$f16 +l.d $f16,One +c.lt.d $f18,$f16; bc1f L.105 +l.d $f18,Y +s.d $f18,X +L.105: +l.d $f18,X +l.d $f16,TwoForty +div.d $f18,$f18,$f16 +s.d $f18,Precision +l.d $f18,Half +l.d $f16,Precision +add.d $f12,$f18,$f16 +jal floor +s.d $f0,Y +l.d $f18,Precision +l.d $f16,Y +sub.d $f12,$f18,$f16 +jal fabs +l.d $f16,TwoForty +mul.d $f18,$f0,$f16 +l.d $f16,Half +c.lt.d $f18,$f16; bc1f L.107 +l.d $f18,Y +s.d $f18,Precision +L.107: +L.103: +l.d $f18,Precision +s.d $f18,-32+240($sp) +mov.d $f12,$f18 +jal floor +l.d $f16,-32+240($sp) +c.eq.d $f16,$f0; bc1f L.111 +l.d $f18,Radix +l.d $f16,One +c.eq.d $f18,$f16; bc1f L.109 +L.111: +la $4,L.112 +jal printf +la $4,L.113 +jal printf +L.109: +l.d $f18,Radix +l.d $f16,One +c.eq.d $f18,$f16; bc1f L.114 +la $4,L.116 +jal printf +b L.115 +L.114: +la $4,L.117 +l.d $f18,Precision +mfc1.d $6,$f18 +jal printf +L.115: +la $4,1 +l.d $f18,Nine +l.d $f16,U2 +mul.d $f16,$f16,$f18 +mul.d $f18,$f16,$f18 +l.d $f16,TwoForty +mul.d $f18,$f18,$f16 +l.d $f16,One +c.lt.d $f18,$f16; bc1f L.120 +la $24,1 +sw $24,-36+240($sp) +b L.121 +L.120: +sw $0,-36+240($sp) +L.121: +lw $5,-36+240($sp) +la $6,L.119 +jal TstCond +la $24,30 +sw $24,Milestone +l.d $f18,Four +l.d $f16,Three +l.d $f10,One +div.d $f8,$f10,$f18 +div.d $f18,$f18,$f16 +sub.d $f18,$f18,$f10 +sub.d $f18,$f18,$f8 +mul.d $f18,$f18,$f16 +sub.d $f12,$f18,$f8 +jal fabs +s.d $f0,X +L.122: +l.d $f18,X +s.d $f18,Z2 +l.d $f18,One +l.d $f16,Z2 +l.d $f10,Half +mul.d $f10,$f10,$f16 +l.d $f8,ThirtyTwo +mul.d $f8,$f8,$f16 +mul.d $f16,$f8,$f16 +add.d $f16,$f10,$f16 +add.d $f16,$f18,$f16 +sub.d $f18,$f16,$f18 +s.d $f18,X +L.123: +l.d $f18,X +l.d $f16,Z2 +c.ule.d $f16,$f18; bc1t L.125 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.122 +L.125: +l.d $f18,Three +l.d $f16,Four +div.d $f10,$f18,$f16 +l.d $f8,Two +div.d $f8,$f8,$f18 +sub.d $f10,$f10,$f8 +mul.d $f18,$f10,$f18 +l.d $f10,One +div.d $f16,$f10,$f16 +sub.d $f12,$f18,$f16 +jal fabs +s.d $f0,Z +s.d $f0,Y +s.d $f0,X +L.126: +l.d $f18,Z +s.d $f18,Z1 +l.d $f18,One +l.d $f16,Two +div.d $f18,$f18,$f16 +l.d $f16,Z1 +l.d $f10,Half +mul.d $f10,$f10,$f16 +l.d $f8,ThirtyTwo +mul.d $f8,$f8,$f16 +mul.d $f16,$f8,$f16 +add.d $f16,$f10,$f16 +sub.d $f16,$f18,$f16 +add.d $f16,$f16,$f18 +sub.d $f16,$f18,$f16 +add.d $f18,$f16,$f18 +s.d $f18,Z +L.127: +l.d $f18,Z +l.d $f16,Z1 +c.ule.d $f16,$f18; bc1t L.129 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.126 +L.129: +L.130: +L.133: +l.d $f18,Y +s.d $f18,Y1 +l.d $f18,Half +l.d $f16,Y1 +mul.d $f10,$f18,$f16 +l.d $f8,ThirtyTwo +mul.d $f8,$f8,$f16 +mul.d $f16,$f8,$f16 +add.d $f16,$f10,$f16 +sub.d $f16,$f18,$f16 +add.d $f16,$f16,$f18 +sub.d $f16,$f18,$f16 +add.d $f18,$f16,$f18 +s.d $f18,Y +L.134: +l.d $f18,Y +l.d $f16,Y1 +c.ule.d $f16,$f18; bc1t L.136 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.133 +L.136: +l.d $f18,X +s.d $f18,X1 +l.d $f18,X1 +l.d $f16,F9 +l.d $f10,Half +mul.d $f10,$f10,$f18 +l.d $f8,ThirtyTwo +mul.d $f8,$f8,$f18 +mul.d $f18,$f8,$f18 +add.d $f18,$f10,$f18 +sub.d $f18,$f18,$f16 +add.d $f18,$f18,$f16 +s.d $f18,X +L.131: +l.d $f18,X +l.d $f16,X1 +c.ule.d $f16,$f18; bc1t L.137 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.130 +L.137: +l.d $f18,X1 +l.d $f16,Y1 +c.eq.d $f18,$f16; bc1f L.140 +l.d $f16,Z1 +c.eq.d $f18,$f16; bc1t L.138 +L.140: +la $4,1 +la $5,L.141 +jal BadCond +la $4,L.142 +l.d $f18,X1 +mfc1.d $6,$f18 +l.d $f18,Y1 +s.d $f18,16($sp) +l.d $f18,Z1 +s.d $f18,24($sp) +jal printf +la $4,L.143 +jal printf +la $4,L.144 +jal printf +la $4,L.145 +jal notify +l.d $f18,U1 +l.d $f16,X1 +c.eq.d $f16,$f18; bc1t L.149 +l.d $f16,Y1 +c.eq.d $f16,$f18; bc1t L.149 +l.d $f16,Z1 +c.eq.d $f16,$f18; bc1f L.139 +L.149: +la $4,L.150 +jal printf +b L.139 +L.138: +l.d $f18,Z1 +l.d $f16,U1 +c.eq.d $f18,$f16; bc1f L.153 +l.d $f18,Z2 +l.d $f16,U2 +c.eq.d $f18,$f16; bc1t L.151 +L.153: +l.d $f18,Z1 +l.d $f16,U1 +c.lt.d $f18,$f16; bc1f L.156 +l.d $f18,Z2 +l.d $f16,U2 +c.ult.d $f18,$f16; bc1t L.154 +L.156: +move $4,$0 +la $5,L.157 +jal BadCond +la $4,L.158 +jal notify +la $4,L.159 +l.d $f18,U1 +mfc1.d $6,$f18 +l.d $f16,Z1 +sub.d $f18,$f16,$f18 +s.d $f18,16($sp) +jal printf +la $4,L.160 +l.d $f18,U2 +mfc1.d $6,$f18 +l.d $f16,Z2 +sub.d $f18,$f16,$f18 +s.d $f18,16($sp) +jal printf +b L.155 +L.154: +l.d $f18,Zero +l.d $f16,Z1 +c.ule.d $f16,$f18; bc1t L.163 +l.d $f16,Z2 +c.le.d $f16,$f18; bc1f L.161 +L.163: +la $4,L.164 +l.d $f18,Radix +mfc1.d $6,$f18 +jal printf +la $4,L.165 +jal printf +la $4,L.166 +l.d $f18,Z1 +mfc1.d $6,$f18 +l.d $f18,Z2 +s.d $f18,16($sp) +jal printf +la $4,L.167 +jal notify +L.161: +l.d $f18,Z1 +l.d $f16,Z2 +c.eq.d $f18,$f16; bc1f L.170 +l.d $f16,Zero +c.ule.d $f18,$f16; bc1t L.168 +L.170: +l.d $f18,Z1 +l.d $f16,U1 +div.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,Z2 +l.d $f16,U2 +div.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Y +l.d $f16,X +c.ule.d $f18,$f16; bc1t L.171 +l.d $f18,Y +s.d $f18,X +L.171: +l.d $f12,X +jal log +neg.d $f18,$f0 +s.d $f18,Q +la $4,L.173 +jal printf +l.d $f12,Radix +jal log +la $4,L.174 +l.d $f16,Q +div.d $f18,$f16,$f0 +mfc1.d $6,$f18 +jal printf +l.d $f12,L.93 +jal log +la $4,L.175 +l.d $f16,Q +div.d $f18,$f16,$f0 +mfc1.d $6,$f18 +jal printf +L.168: +la $4,L.150 +jal printf +L.155: +L.151: +L.139: +jal Pause +la $24,35 +sw $24,Milestone +l.d $f18,Radix +l.d $f16,Two +c.ult.d $f18,$f16; bc1t L.176 +l.d $f18,Radix +l.d $f16,W +mul.d $f18,$f18,$f18 +div.d $f18,$f16,$f18 +s.d $f18,X +l.d $f18,X +l.d $f16,One +add.d $f16,$f18,$f16 +s.d $f16,Y +l.d $f16,Y +sub.d $f18,$f16,$f18 +s.d $f18,Z +l.d $f18,Z +l.d $f16,U2 +add.d $f10,$f18,$f16 +s.d $f10,T +l.d $f10,T +sub.d $f18,$f10,$f18 +s.d $f18,X +move $4,$0 +l.d $f18,X +c.eq.d $f18,$f16; bc1f L.180 +la $24,1 +sw $24,-40+240($sp) +b L.181 +L.180: +sw $0,-40+240($sp) +L.181: +lw $5,-40+240($sp) +la $6,L.179 +jal TstCond +l.d $f18,X +l.d $f16,U2 +c.eq.d $f18,$f16; bc1f L.182 +la $4,L.184 +jal printf +L.182: +L.176: +la $4,L.185 +jal printf +l.d $f18,F9 +l.d $f16,One +mul.d $f10,$f18,$f16 +s.d $f10,Y +mul.d $f10,$f16,$f18 +s.d $f10,Z +l.d $f10,Half +sub.d $f18,$f18,$f10 +s.d $f18,X +l.d $f18,X +l.d $f8,Y +sub.d $f8,$f8,$f10 +sub.d $f8,$f8,$f18 +s.d $f8,Y +l.d $f8,Z +sub.d $f10,$f8,$f10 +sub.d $f18,$f10,$f18 +s.d $f18,Z +l.d $f18,U2 +add.d $f10,$f16,$f18 +s.d $f10,X +l.d $f10,X +l.d $f8,Radix +mul.d $f6,$f10,$f8 +s.d $f6,T +mul.d $f10,$f8,$f10 +s.d $f10,R +l.d $f10,T +sub.d $f10,$f10,$f8 +s.d $f10,X +mul.d $f18,$f8,$f18 +l.d $f10,X +sub.d $f10,$f10,$f18 +s.d $f10,X +l.d $f10,R +sub.d $f10,$f10,$f8 +s.d $f10,T +l.d $f10,T +sub.d $f18,$f10,$f18 +s.d $f18,T +sub.d $f18,$f8,$f16 +l.d $f16,X +mul.d $f16,$f16,$f18 +s.d $f16,X +l.d $f16,T +mul.d $f18,$f16,$f18 +s.d $f18,T +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.186 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.186 +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.186 +l.d $f16,T +c.eq.d $f16,$f18; bc1f L.186 +la $24,1 +sw $24,GMult +b L.187 +L.186: +move $24,$0 +sw $24,GMult +la $4,1 +move $5,$24 +la $6,L.188 +jal TstCond +L.187: +l.d $f18,Radix +l.d $f16,U2 +mul.d $f18,$f18,$f16 +s.d $f18,Z +l.d $f18,Z +l.d $f16,One +add.d $f16,$f16,$f18 +s.d $f16,X +l.d $f16,X +add.d $f18,$f16,$f18 +mul.d $f16,$f16,$f16 +sub.d $f12,$f18,$f16 +jal fabs +l.d $f16,U2 +sub.d $f18,$f0,$f16 +s.d $f18,Y +l.d $f18,One +sub.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,X +sub.d $f16,$f18,$f16 +mul.d $f18,$f18,$f18 +sub.d $f12,$f16,$f18 +jal fabs +l.d $f16,U1 +sub.d $f18,$f0,$f16 +s.d $f18,Z +move $4,$0 +l.d $f18,Zero +l.d $f16,Y +c.le.d $f16,$f18; bc1f L.191 +l.d $f16,Z +c.le.d $f16,$f18; bc1f L.191 +la $24,1 +sw $24,-40+240($sp) +b L.192 +L.191: +sw $0,-40+240($sp) +L.192: +lw $5,-40+240($sp) +la $6,L.190 +jal TstCond +l.d $f18,One +l.d $f16,U2 +sub.d $f10,$f18,$f16 +s.d $f10,Y +add.d $f16,$f18,$f16 +s.d $f16,X +l.d $f16,Y +div.d $f16,$f18,$f16 +s.d $f16,Z +l.d $f16,Z +l.d $f10,X +sub.d $f16,$f16,$f10 +s.d $f16,Y +l.d $f16,Three +div.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,Nine +div.d $f16,$f16,$f18 +s.d $f16,Z +l.d $f16,Z +l.d $f10,X +sub.d $f10,$f10,$f16 +s.d $f10,X +l.d $f10,TwentySeven +div.d $f18,$f18,$f10 +s.d $f18,T +l.d $f18,T +sub.d $f18,$f16,$f18 +s.d $f18,Z +la $4,2 +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.195 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.195 +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.195 +la $24,1 +sw $24,-44+240($sp) +b L.196 +L.195: +sw $0,-44+240($sp) +L.196: +lw $5,-44+240($sp) +la $6,L.194 +jal TstCond +l.d $f18,F9 +l.d $f16,One +div.d $f10,$f18,$f16 +s.d $f10,Y +l.d $f10,Half +sub.d $f18,$f18,$f10 +s.d $f18,X +l.d $f18,Y +sub.d $f18,$f18,$f10 +l.d $f10,X +sub.d $f18,$f18,$f10 +s.d $f18,Y +l.d $f18,U2 +add.d $f18,$f16,$f18 +s.d $f18,X +l.d $f18,X +div.d $f16,$f18,$f16 +s.d $f16,T +l.d $f16,T +sub.d $f18,$f16,$f18 +s.d $f18,X +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.197 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.197 +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.197 +la $24,1 +sw $24,GDiv +b L.198 +L.197: +move $24,$0 +sw $24,GDiv +la $4,1 +move $5,$24 +la $6,L.199 +jal TstCond +L.198: +l.d $f18,One +l.d $f16,U2 +add.d $f16,$f18,$f16 +div.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,Half +l.d $f16,X +sub.d $f16,$f16,$f18 +sub.d $f18,$f16,$f18 +s.d $f18,Y +la $4,1 +l.d $f18,Y +l.d $f16,Zero +c.lt.d $f18,$f16; bc1f L.202 +la $24,1 +sw $24,-48+240($sp) +b L.203 +L.202: +sw $0,-48+240($sp) +L.203: +lw $5,-48+240($sp) +la $6,L.201 +jal TstCond +l.d $f18,One +l.d $f16,U2 +sub.d $f10,$f18,$f16 +s.d $f10,X +l.d $f10,Radix +mul.d $f16,$f10,$f16 +add.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,X +mul.d $f16,$f18,$f10 +s.d $f16,Z +l.d $f16,Y +mul.d $f8,$f16,$f10 +s.d $f8,T +l.d $f8,Z +div.d $f8,$f8,$f10 +s.d $f8,R +l.d $f8,T +div.d $f10,$f8,$f10 +s.d $f10,StickyBit +l.d $f10,R +sub.d $f18,$f10,$f18 +s.d $f18,X +l.d $f18,StickyBit +sub.d $f18,$f18,$f16 +s.d $f18,Y +move $4,$0 +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.206 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.206 +la $24,1 +sw $24,-52+240($sp) +b L.207 +L.206: +sw $0,-52+240($sp) +L.207: +lw $5,-52+240($sp) +la $6,L.205 +jal TstCond +l.d $f18,One +l.d $f16,U1 +sub.d $f16,$f18,$f16 +s.d $f16,Y +l.d $f16,F9 +sub.d $f16,$f18,$f16 +s.d $f16,X +l.d $f16,Y +sub.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Radix +l.d $f16,U2 +sub.d $f16,$f18,$f16 +s.d $f16,T +l.d $f16,BMinusU2 +sub.d $f16,$f18,$f16 +s.d $f16,Z +l.d $f16,T +sub.d $f18,$f18,$f16 +s.d $f18,T +l.d $f18,U1 +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.208 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.208 +l.d $f18,U2 +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.208 +l.d $f16,T +c.eq.d $f16,$f18; bc1f L.208 +la $24,1 +sw $24,GAddSub +b L.209 +L.208: +move $24,$0 +sw $24,GAddSub +la $4,1 +move $5,$24 +la $6,L.210 +jal TstCond +L.209: +l.d $f18,F9 +l.d $f16,One +c.eq.d $f18,$f16; bc1t L.211 +sub.d $f18,$f18,$f16 +l.d $f16,Zero +c.ult.d $f18,$f16; bc1t L.211 +la $4,1 +la $5,L.213 +jal BadCond +la $4,L.214 +jal printf +la $4,L.215 +jal printf +la $4,L.216 +jal printf +L.211: +la $24,1 +lw $15,GMult +bne $15,$24,L.217 +lw $15,GDiv +bne $15,$24,L.217 +lw $15,GAddSub +bne $15,$24,L.217 +la $4,L.219 +jal printf +L.217: +la $24,40 +sw $24,Milestone +jal Pause +la $4,L.220 +jal printf +sw $0,RMult +sw $0,RDiv +sw $0,RAddSub +l.d $f18,Two +l.d $f16,Radix +div.d $f16,$f16,$f18 +s.d $f16,RadixD2 +s.d $f18,A1 +sw $0,Done +L.221: +l.d $f18,Radix +s.d $f18,AInvrse +L.224: +l.d $f18,AInvrse +s.d $f18,X +l.d $f16,A1 +div.d $f18,$f18,$f16 +s.d $f18,AInvrse +L.225: +l.d $f12,AInvrse +jal floor +l.d $f16,AInvrse +c.eq.d $f0,$f16; bc1t L.224 +l.d $f18,X +l.d $f16,One +c.eq.d $f18,$f16; bc1t L.230 +l.d $f18,A1 +l.d $f16,Three +c.ule.d $f18,$f16; bc1t L.228 +L.230: +la $24,1 +sw $24,-56+240($sp) +b L.229 +L.228: +sw $0,-56+240($sp) +L.229: +lw $24,-56+240($sp) +sw $24,Done +lw $24,Done +bne $24,$0,L.231 +l.d $f18,Nine +l.d $f16,One +add.d $f18,$f18,$f16 +s.d $f18,A1 +L.231: +L.222: +lw $24,Done +beq $24,$0,L.221 +l.d $f18,X +l.d $f16,One +c.eq.d $f18,$f16; bc1f L.233 +l.d $f18,Radix +s.d $f18,A1 +L.233: +l.d $f18,A1 +l.d $f16,One +div.d $f16,$f16,$f18 +s.d $f16,AInvrse +s.d $f18,X +l.d $f18,AInvrse +s.d $f18,Y +sw $0,Done +L.235: +l.d $f18,Half +l.d $f16,X +l.d $f10,Y +mul.d $f16,$f16,$f10 +sub.d $f16,$f16,$f18 +s.d $f16,Z +move $4,$0 +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.240 +la $24,1 +sw $24,-56+240($sp) +b L.241 +L.240: +sw $0,-56+240($sp) +L.241: +lw $5,-56+240($sp) +la $6,L.239 +jal TstCond +l.d $f18,X +l.d $f16,Radix +c.eq.d $f18,$f16; bc1f L.243 +la $24,1 +sw $24,-60+240($sp) +b L.244 +L.243: +sw $0,-60+240($sp) +L.244: +lw $24,-60+240($sp) +sw $24,Done +l.d $f18,Radix +s.d $f18,X +l.d $f18,One +l.d $f16,X +div.d $f18,$f18,$f16 +s.d $f18,Y +L.236: +lw $24,Done +beq $24,$0,L.235 +l.d $f18,One +l.d $f16,U2 +add.d $f10,$f18,$f16 +s.d $f10,Y2 +sub.d $f18,$f18,$f16 +s.d $f18,Y1 +l.d $f18,OneAndHalf +s.d $f18,-64+240($sp) +sub.d $f10,$f18,$f16 +s.d $f10,X +add.d $f10,$f18,$f16 +s.d $f10,Y +l.d $f10,X +l.d $f8,Y2 +sub.d $f6,$f10,$f16 +mul.d $f6,$f6,$f8 +s.d $f6,Z +l.d $f6,Y +l.d $f4,Y1 +mul.d $f18,$f6,$f4 +s.d $f18,T +l.d $f18,Z +sub.d $f18,$f18,$f10 +s.d $f18,Z +l.d $f18,T +sub.d $f18,$f18,$f10 +s.d $f18,T +mul.d $f18,$f10,$f8 +s.d $f18,X +add.d $f18,$f6,$f16 +mul.d $f18,$f18,$f4 +s.d $f18,Y +l.d $f18,X +l.d $f16,-64+240($sp) +sub.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,Y +l.d $f16,-64+240($sp) +sub.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.245 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.245 +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.245 +l.d $f16,T +c.le.d $f16,$f18; bc1f L.245 +l.d $f18,OneAndHalf +l.d $f16,U2 +add.d $f10,$f18,$f16 +l.d $f8,Y2 +mul.d $f6,$f10,$f8 +s.d $f6,X +sub.d $f18,$f18,$f16 +sub.d $f6,$f18,$f16 +s.d $f6,Y +add.d $f10,$f10,$f16 +s.d $f10,Z +l.d $f10,Y1 +mul.d $f18,$f18,$f10 +s.d $f18,T +l.d $f18,Z +add.d $f6,$f18,$f16 +s.d $f6,-72+240($sp) +l.d $f4,X +sub.d $f4,$f4,$f6 +s.d $f4,X +l.d $f4,Y +mul.d $f6,$f4,$f10 +s.d $f6,StickyBit +mul.d $f18,$f18,$f8 +s.d $f18,S +l.d $f18,T +sub.d $f18,$f18,$f4 +s.d $f18,T +sub.d $f18,$f16,$f4 +l.d $f6,StickyBit +add.d $f18,$f18,$f6 +s.d $f18,Y +l.d $f18,S +l.d $f6,-72+240($sp) +add.d $f6,$f6,$f16 +sub.d $f18,$f18,$f6 +s.d $f18,Z +add.d $f18,$f8,$f16 +mul.d $f18,$f18,$f10 +s.d $f18,StickyBit +mul.d $f18,$f8,$f10 +s.d $f18,Y1 +l.d $f18,StickyBit +sub.d $f18,$f18,$f8 +s.d $f18,StickyBit +l.d $f18,Y1 +l.d $f16,Half +sub.d $f18,$f18,$f16 +s.d $f18,Y1 +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.247 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.247 +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.247 +l.d $f16,T +c.eq.d $f16,$f18; bc1f L.247 +l.d $f16,StickyBit +c.eq.d $f16,$f18; bc1f L.247 +l.d $f18,Y1 +l.d $f16,Half +c.eq.d $f18,$f16; bc1f L.247 +la $24,1 +sw $24,RMult +la $4,L.249 +jal printf +b L.248 +L.247: +l.d $f18,U2 +l.d $f16,Zero +l.d $f10,X +add.d $f10,$f10,$f18 +c.eq.d $f10,$f16; bc1f L.250 +l.d $f10,Y +c.lt.d $f10,$f16; bc1f L.250 +l.d $f10,Z +add.d $f10,$f10,$f18 +c.eq.d $f10,$f16; bc1f L.250 +l.d $f10,T +c.lt.d $f10,$f16; bc1f L.250 +l.d $f10,StickyBit +add.d $f18,$f10,$f18 +c.eq.d $f18,$f16; bc1f L.250 +l.d $f18,Y1 +l.d $f16,Half +c.lt.d $f18,$f16; bc1f L.250 +la $24,2 +sw $24,RMult +la $4,L.252 +jal printf +b L.251 +L.250: +la $4,L.253 +jal printf +L.251: +L.248: +lw $24,RMult +la $15,1 +bne $24,$15,L.246 +lw $24,GMult +bne $24,$0,L.246 +la $4,L.256 +jal notify +b L.246 +L.245: +la $4,L.253 +jal printf +L.246: +la $24,45 +sw $24,Milestone +l.d $f18,One +l.d $f16,U2 +add.d $f10,$f18,$f16 +s.d $f10,Y2 +sub.d $f18,$f18,$f16 +s.d $f18,Y1 +l.d $f18,OneAndHalf +s.d $f18,-80+240($sp) +add.d $f10,$f18,$f16 +s.d $f10,-72+240($sp) +add.d $f8,$f10,$f16 +s.d $f8,Z +l.d $f8,Z +l.d $f6,Y2 +div.d $f4,$f8,$f6 +s.d $f4,X +sub.d $f4,$f18,$f16 +sub.d $f4,$f4,$f16 +s.d $f4,T +l.d $f4,T +l.d $f10,Y1 +sub.d $f18,$f4,$f16 +div.d $f18,$f18,$f10 +s.d $f18,Y +add.d $f18,$f8,$f16 +div.d $f18,$f18,$f6 +s.d $f18,Z +l.d $f18,X +l.d $f8,-80+240($sp) +sub.d $f18,$f18,$f8 +s.d $f18,X +l.d $f18,Y +sub.d $f18,$f18,$f4 +s.d $f18,Y +div.d $f18,$f4,$f10 +s.d $f18,T +l.d $f18,Z +l.d $f10,-72+240($sp) +sub.d $f18,$f18,$f10 +s.d $f18,Z +l.d $f18,-80+240($sp) +sub.d $f18,$f16,$f18 +l.d $f16,T +add.d $f18,$f18,$f16 +s.d $f18,T +l.d $f18,Zero +l.d $f16,X +c.le.d $f16,$f18; bc1f L.257 +l.d $f16,Y +c.le.d $f16,$f18; bc1f L.257 +l.d $f16,Z +c.le.d $f16,$f18; bc1f L.257 +l.d $f16,T +c.le.d $f16,$f18; bc1f L.257 +l.d $f18,OneAndHalf +l.d $f16,Y2 +div.d $f10,$f18,$f16 +s.d $f10,X +l.d $f10,U2 +sub.d $f8,$f18,$f10 +s.d $f8,Y +add.d $f8,$f18,$f10 +s.d $f8,Z +l.d $f8,Y +l.d $f6,X +sub.d $f6,$f6,$f8 +s.d $f6,X +l.d $f6,Y1 +div.d $f4,$f18,$f6 +s.d $f4,T +div.d $f8,$f8,$f6 +s.d $f8,Y +l.d $f8,Z +l.d $f6,T +add.d $f4,$f8,$f10 +sub.d $f6,$f6,$f4 +s.d $f6,T +l.d $f6,Y +sub.d $f6,$f6,$f8 +s.d $f6,Y +div.d $f8,$f8,$f16 +s.d $f8,Z +add.d $f10,$f16,$f10 +div.d $f10,$f10,$f16 +s.d $f10,Y1 +l.d $f10,Z +sub.d $f18,$f10,$f18 +s.d $f18,Z +l.d $f18,Y1 +sub.d $f18,$f18,$f16 +s.d $f18,Y2 +l.d $f18,F9 +l.d $f16,U1 +sub.d $f16,$f18,$f16 +div.d $f18,$f16,$f18 +s.d $f18,Y1 +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.259 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.259 +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.259 +l.d $f16,T +c.eq.d $f16,$f18; bc1f L.259 +l.d $f16,Y2 +c.eq.d $f16,$f18; bc1f L.259 +c.eq.d $f16,$f18; bc1f L.259 +l.d $f18,Half +l.d $f16,Y1 +sub.d $f16,$f16,$f18 +l.d $f10,F9 +sub.d $f18,$f10,$f18 +c.eq.d $f16,$f18; bc1f L.259 +la $24,1 +sw $24,RDiv +la $4,L.261 +jal printf +lw $24,GDiv +bne $24,$0,L.260 +la $4,L.264 +jal notify +b L.260 +L.259: +l.d $f18,Zero +l.d $f16,X +c.lt.d $f16,$f18; bc1f L.265 +l.d $f16,Y +c.lt.d $f16,$f18; bc1f L.265 +l.d $f16,Z +c.lt.d $f16,$f18; bc1f L.265 +l.d $f16,T +c.lt.d $f16,$f18; bc1f L.265 +l.d $f16,Y2 +c.lt.d $f16,$f18; bc1f L.265 +l.d $f18,Half +l.d $f16,Y1 +sub.d $f16,$f16,$f18 +l.d $f10,F9 +sub.d $f18,$f10,$f18 +c.lt.d $f16,$f18; bc1f L.265 +la $24,2 +sw $24,RDiv +la $4,L.267 +jal printf +L.265: +L.260: +L.257: +lw $24,RDiv +bne $24,$0,L.268 +la $4,L.270 +jal printf +L.268: +l.d $f18,Radix +l.d $f16,One +div.d $f16,$f16,$f18 +s.d $f16,BInvrse +move $4,$0 +l.d $f16,Half +l.d $f10,BInvrse +mul.d $f18,$f10,$f18 +sub.d $f18,$f18,$f16 +c.eq.d $f18,$f16; bc1f L.273 +la $24,1 +sw $24,-84+240($sp) +b L.274 +L.273: +sw $0,-84+240($sp) +L.274: +lw $5,-84+240($sp) +la $6,L.272 +jal TstCond +la $24,50 +sw $24,Milestone +move $4,$0 +l.d $f18,Half +l.d $f16,F9 +l.d $f10,U1 +add.d $f16,$f16,$f10 +sub.d $f16,$f16,$f18 +c.eq.d $f16,$f18; bc1f L.277 +l.d $f18,One +l.d $f16,BMinusU2 +l.d $f10,U2 +add.d $f16,$f16,$f10 +sub.d $f16,$f16,$f18 +l.d $f10,Radix +sub.d $f18,$f10,$f18 +c.eq.d $f16,$f18; bc1f L.277 +la $24,1 +sw $24,-88+240($sp) +b L.278 +L.277: +sw $0,-88+240($sp) +L.278: +lw $5,-88+240($sp) +la $6,L.276 +jal TstCond +l.d $f18,One +l.d $f16,U1 +mul.d $f16,$f16,$f16 +sub.d $f16,$f18,$f16 +s.d $f16,X +l.d $f16,U2 +sub.d $f10,$f18,$f16 +mul.d $f16,$f16,$f10 +add.d $f16,$f18,$f16 +s.d $f16,Y +l.d $f16,Half +l.d $f10,F9 +sub.d $f10,$f10,$f16 +s.d $f10,Z +l.d $f10,X +sub.d $f16,$f10,$f16 +l.d $f10,Z +sub.d $f16,$f16,$f10 +s.d $f16,X +l.d $f16,Y +sub.d $f18,$f16,$f18 +s.d $f18,Y +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.279 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.279 +la $24,2 +sw $24,RAddSub +la $4,L.281 +jal printf +L.279: +lw $24,GAddSub +la $15,1 +bne $24,$15,L.282 +l.d $f18,Half +l.d $f16,U2 +add.d $f10,$f18,$f16 +mul.d $f10,$f10,$f16 +s.d $f10,X +sub.d $f18,$f18,$f16 +mul.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,One +l.d $f10,X +add.d $f10,$f18,$f10 +s.d $f10,X +l.d $f10,Y +add.d $f10,$f18,$f10 +s.d $f10,Y +add.d $f16,$f18,$f16 +l.d $f10,X +sub.d $f16,$f16,$f10 +s.d $f16,X +l.d $f16,Y +sub.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.284 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.284 +l.d $f18,Half +l.d $f16,U2 +l.d $f10,U1 +add.d $f8,$f18,$f16 +mul.d $f8,$f8,$f10 +s.d $f8,X +sub.d $f18,$f18,$f16 +mul.d $f18,$f18,$f10 +s.d $f18,Y +l.d $f18,One +l.d $f16,X +sub.d $f16,$f18,$f16 +s.d $f16,X +l.d $f16,Y +sub.d $f16,$f18,$f16 +s.d $f16,Y +l.d $f16,F9 +l.d $f10,X +sub.d $f16,$f16,$f10 +s.d $f16,X +l.d $f16,Y +sub.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Zero +l.d $f16,X +c.eq.d $f16,$f18; bc1f L.286 +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.286 +la $24,1 +sw $24,RAddSub +la $4,L.288 +jal printf +lw $24,GAddSub +bne $24,$0,L.283 +la $4,L.291 +jal notify +b L.283 +L.286: +la $4,L.292 +jal printf +b L.283 +L.284: +la $4,L.292 +jal printf +b L.283 +L.282: +la $4,L.292 +jal printf +L.283: +l.d $f18,One +s.d $f18,S +l.d $f16,Half +add.d $f10,$f18,$f16 +mul.d $f10,$f16,$f10 +add.d $f10,$f18,$f10 +s.d $f10,X +l.d $f10,U2 +add.d $f18,$f18,$f10 +mul.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,X +l.d $f16,Y +sub.d $f10,$f18,$f16 +s.d $f10,Z +sub.d $f18,$f16,$f18 +s.d $f18,T +l.d $f18,Z +l.d $f16,T +add.d $f18,$f18,$f16 +s.d $f18,StickyBit +l.d $f18,StickyBit +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.293 +l.d $f18,Zero +s.d $f18,S +la $4,3 +la $5,L.295 +jal BadCond +L.293: +l.d $f18,Zero +s.d $f18,StickyBit +la $24,1 +lw $15,GMult +bne $15,$24,L.296 +lw $15,GDiv +bne $15,$24,L.296 +lw $15,GAddSub +bne $15,$24,L.296 +lw $15,RMult +bne $15,$24,L.296 +lw $15,RDiv +bne $15,$24,L.296 +lw $15,RAddSub +bne $15,$24,L.296 +l.d $f12,RadixD2 +jal floor +l.d $f16,RadixD2 +c.eq.d $f0,$f16; bc1f L.296 +la $4,L.298 +jal printf +l.d $f18,Half +l.d $f16,U2 +l.d $f10,U1 +add.d $f10,$f18,$f10 +mul.d $f10,$f10,$f16 +s.d $f10,X +mul.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,One +l.d $f16,Y +add.d $f16,$f18,$f16 +s.d $f16,Z +l.d $f16,X +add.d $f18,$f18,$f16 +s.d $f18,T +l.d $f18,One +l.d $f16,Z +sub.d $f16,$f16,$f18 +l.d $f10,Zero +c.le.d $f16,$f10; bc1f L.299 +l.d $f16,T +sub.d $f18,$f16,$f18 +l.d $f16,U2 +c.ult.d $f18,$f16; bc1t L.299 +l.d $f18,T +l.d $f16,Y +add.d $f18,$f18,$f16 +s.d $f18,Z +l.d $f18,Z +l.d $f16,X +sub.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,T +l.d $f16,Z +sub.d $f16,$f16,$f18 +l.d $f10,U2 +c.ult.d $f16,$f10; bc1t L.301 +l.d $f16,Y +sub.d $f18,$f16,$f18 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.301 +l.d $f18,Half +l.d $f16,U1 +add.d $f10,$f18,$f16 +mul.d $f10,$f10,$f16 +s.d $f10,X +mul.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,One +l.d $f16,Y +sub.d $f16,$f18,$f16 +s.d $f16,Z +l.d $f16,X +sub.d $f18,$f18,$f16 +s.d $f18,T +l.d $f18,Zero +l.d $f16,Z +l.d $f10,One +sub.d $f16,$f16,$f10 +c.eq.d $f16,$f18; bc1f L.303 +l.d $f16,T +l.d $f10,F9 +sub.d $f16,$f16,$f10 +c.eq.d $f16,$f18; bc1f L.303 +l.d $f18,U1 +l.d $f16,Half +sub.d $f16,$f16,$f18 +mul.d $f18,$f16,$f18 +s.d $f18,Z +l.d $f18,F9 +l.d $f16,Z +sub.d $f16,$f18,$f16 +s.d $f16,T +l.d $f16,Y +sub.d $f18,$f18,$f16 +s.d $f18,Q +l.d $f18,F9 +l.d $f16,Zero +l.d $f10,T +sub.d $f10,$f10,$f18 +c.eq.d $f10,$f16; bc1f L.305 +l.d $f10,U1 +sub.d $f18,$f18,$f10 +l.d $f10,Q +sub.d $f18,$f18,$f10 +c.eq.d $f18,$f16; bc1f L.305 +l.d $f18,One +l.d $f16,U2 +l.d $f10,OneAndHalf +add.d $f8,$f18,$f16 +mul.d $f8,$f8,$f10 +s.d $f8,Z +add.d $f10,$f10,$f16 +l.d $f8,Z +sub.d $f10,$f10,$f8 +add.d $f10,$f10,$f16 +s.d $f10,T +l.d $f10,Radix +l.d $f8,Half +div.d $f8,$f8,$f10 +add.d $f8,$f18,$f8 +s.d $f8,X +mul.d $f16,$f10,$f16 +add.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,X +l.d $f16,Y +mul.d $f18,$f18,$f16 +s.d $f18,Z +l.d $f18,Zero +l.d $f16,T +c.eq.d $f16,$f18; bc1f L.307 +l.d $f16,X +l.d $f10,Radix +l.d $f8,U2 +mul.d $f10,$f10,$f8 +add.d $f16,$f16,$f10 +l.d $f10,Z +sub.d $f16,$f16,$f10 +c.eq.d $f16,$f18; bc1f L.307 +l.d $f18,Radix +l.d $f16,Two +c.eq.d $f18,$f16; bc1t L.309 +l.d $f18,Two +l.d $f16,U2 +add.d $f16,$f18,$f16 +s.d $f16,X +l.d $f16,X +div.d $f18,$f16,$f18 +s.d $f18,Y +l.d $f18,Y +l.d $f16,One +sub.d $f18,$f18,$f16 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.310 +l.d $f18,S +s.d $f18,StickyBit +b L.310 +L.309: +l.d $f18,S +s.d $f18,StickyBit +L.310: +L.307: +L.305: +L.303: +L.301: +L.299: +L.296: +l.d $f18,StickyBit +l.d $f16,One +c.eq.d $f18,$f16; bc1f L.313 +la $4,L.315 +jal printf +b L.314 +L.313: +la $4,L.316 +jal printf +L.314: +la $4,3 +lw $15,GMult +beq $15,$0,L.319 +lw $15,GDiv +beq $15,$0,L.319 +lw $15,GAddSub +beq $15,$0,L.319 +lw $15,RMult +beq $15,$0,L.319 +lw $15,RDiv +beq $15,$0,L.319 +lw $15,RAddSub +beq $15,$0,L.319 +la $24,1 +sw $24,-92+240($sp) +b L.320 +L.319: +sw $0,-92+240($sp) +L.320: +lw $5,-92+240($sp) +la $6,L.318 +jal TstCond +la $24,60 +sw $24,Milestone +la $4,L.44 +jal printf +la $4,L.321 +jal printf +la $4,L.322 +lw $5,NoTrials +jal printf +l.d $f12,L.323 +jal sqrt +s.d $f0,Random9 +l.d $f18,Third +s.d $f18,Random1 +la $24,1 +sw $24,I +L.324: +jal Random +s.d $f0,X +jal Random +s.d $f0,Y +l.d $f18,Y +l.d $f16,X +mul.d $f10,$f18,$f16 +s.d $f10,Z9 +mul.d $f18,$f16,$f18 +s.d $f18,Z +l.d $f18,Z +l.d $f16,Z9 +sub.d $f18,$f18,$f16 +s.d $f18,Z9 +lw $24,I +la $24,1($24) +sw $24,I +L.325: +lw $24,I +lw $15,NoTrials +bgt $24,$15,L.327 +l.d $f18,Z9 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.324 +L.327: +lw $24,I +lw $15,NoTrials +bne $24,$15,L.328 +l.d $f18,One +l.d $f16,Half +l.d $f10,Three +div.d $f16,$f16,$f10 +add.d $f16,$f18,$f16 +s.d $f16,Random1 +l.d $f10,U2 +l.d $f8,U1 +add.d $f10,$f10,$f8 +add.d $f18,$f10,$f18 +s.d $f18,Random2 +l.d $f10,Random1 +l.d $f8,Random2 +mul.d $f6,$f10,$f8 +s.d $f6,Z +mul.d $f10,$f8,$f10 +s.d $f10,Y +mul.d $f18,$f16,$f18 +sub.d $f18,$f18,$f18 +s.d $f18,Z9 +L.328: +lw $24,I +lw $15,NoTrials +beq $24,$15,L.330 +l.d $f18,Z9 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.330 +la $4,2 +la $5,L.332 +jal BadCond +b L.331 +L.330: +la $4,L.333 +lw $5,NoTrials +jal printf +L.331: +la $24,70 +sw $24,Milestone +la $4,L.334 +jal printf +l.d $f18,Zero +s.d $f18,-104+240($sp) +mov.d $f12,$f18 +jal sqrt +l.d $f16,-104+240($sp) +c.eq.d $f16,$f0; bc1f L.337 +l.d $f18,Zero +neg.d $f18,$f18 +s.d $f18,-112+240($sp) +mov.d $f12,$f18 +jal sqrt +l.d $f16,-112+240($sp) +c.eq.d $f16,$f0; bc1f L.337 +l.d $f18,One +s.d $f18,-120+240($sp) +mov.d $f12,$f18 +jal sqrt +mov.d $f18,$f0 +l.d $f16,-120+240($sp) +c.eq.d $f16,$f18; bc1f L.337 +la $24,1 +sw $24,-96+240($sp) +b L.338 +L.337: +sw $0,-96+240($sp) +L.338: +move $4,$0 +lw $5,-96+240($sp) +la $6,L.336 +jal TstCond +l.d $f18,Zero +s.d $f18,MinSqEr +s.d $f18,MaxSqEr +s.d $f18,J +l.d $f18,Radix +s.d $f18,X +l.d $f18,U2 +s.d $f18,OneUlp +la $4,1 +jal SqXMinX +l.d $f18,BInvrse +s.d $f18,X +l.d $f16,U1 +mul.d $f18,$f18,$f16 +s.d $f18,OneUlp +la $4,1 +jal SqXMinX +l.d $f18,U1 +s.d $f18,X +mul.d $f18,$f18,$f18 +s.d $f18,OneUlp +la $4,1 +jal SqXMinX +l.d $f18,J +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.339 +jal Pause +L.339: +la $4,L.341 +lw $5,NoTrials +jal printf +l.d $f18,Zero +s.d $f18,J +l.d $f18,Two +s.d $f18,X +l.d $f18,Radix +s.d $f18,Y +l.d $f16,One +c.eq.d $f18,$f16; bc1t L.342 +L.344: +l.d $f18,Y +s.d $f18,X +l.d $f16,Radix +mul.d $f18,$f16,$f18 +s.d $f18,Y +L.345: +l.d $f18,Y +l.d $f16,X +sub.d $f18,$f18,$f16 +lw $24,NoTrials +mtc1 $24,$f16; cvt.d.w $f16,$f16 +c.ult.d $f18,$f16; bc1t L.344 +L.342: +l.d $f18,X +l.d $f16,U2 +mul.d $f18,$f18,$f16 +s.d $f18,OneUlp +la $24,1 +sw $24,I +b L.348 +L.347: +l.d $f18,X +l.d $f16,One +add.d $f18,$f18,$f16 +s.d $f18,X +la $4,2 +jal SqXMinX +l.d $f18,J +l.d $f16,Zero +c.ule.d $f18,$f16; bc1t L.350 +b L.349 +L.350: +lw $24,I +la $24,1($24) +sw $24,I +L.348: +lw $24,I +lw $15,NoTrials +ble $24,$15,L.347 +L.349: +la $4,L.352 +jal printf +la $24,-1 +sw $24,I +l.d $f18,BMinusU2 +s.d $f18,X +l.d $f18,Radix +s.d $f18,Y +l.d $f16,U2 +mul.d $f16,$f18,$f16 +add.d $f18,$f18,$f16 +s.d $f18,Z +sw $0,NotMonot +sw $0,Monot +b L.354 +L.353: +lw $24,I +la $24,1($24) +sw $24,I +l.d $f12,X +jal sqrt +s.d $f0,X +l.d $f12,Y +jal sqrt +s.d $f0,Q +l.d $f12,Z +jal sqrt +s.d $f0,Z +l.d $f18,Q +l.d $f16,X +c.le.d $f16,$f18; bc1f L.358 +l.d $f16,Z +c.ule.d $f18,$f16; bc1t L.356 +L.358: +la $24,1 +sw $24,NotMonot +b L.357 +L.356: +l.d $f18,Q +l.d $f16,Half +add.d $f12,$f18,$f16 +jal floor +s.d $f0,Q +lw $24,I +bgt $24,$0,L.361 +l.d $f18,Q +l.d $f16,Radix +mul.d $f18,$f18,$f18 +c.eq.d $f16,$f18; bc1f L.359 +L.361: +la $24,1 +sw $24,Monot +b L.360 +L.359: +lw $24,I +ble $24,$0,L.362 +lw $24,I +la $15,1 +ble $24,$15,L.364 +la $24,1 +sw $24,Monot +b L.363 +L.364: +l.d $f18,Y +l.d $f16,BInvrse +mul.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Y +l.d $f16,U1 +sub.d $f10,$f18,$f16 +s.d $f10,X +add.d $f18,$f18,$f16 +s.d $f18,Z +b L.363 +L.362: +l.d $f18,Q +s.d $f18,Y +l.d $f18,Y +l.d $f16,U2 +sub.d $f10,$f18,$f16 +s.d $f10,X +add.d $f18,$f18,$f16 +s.d $f18,Z +L.363: +L.360: +L.357: +L.354: +lw $15,NotMonot +bne $15,$0,L.366 +lw $15,Monot +beq $15,$0,L.353 +L.366: +lw $24,Monot +beq $24,$0,L.367 +la $4,L.369 +jal printf +b L.368 +L.367: +la $4,2 +la $5,L.157 +jal BadCond +la $4,L.370 +l.d $f18,Y +mfc1.d $6,$f18 +jal printf +L.368: +la $24,80 +sw $24,Milestone +l.d $f18,Half +l.d $f16,MinSqEr +add.d $f16,$f16,$f18 +s.d $f16,MinSqEr +l.d $f16,MaxSqEr +sub.d $f18,$f16,$f18 +s.d $f18,MaxSqEr +l.d $f18,One +l.d $f16,U2 +add.d $f12,$f18,$f16 +jal sqrt +l.d $f16,One +l.d $f10,U2 +sub.d $f18,$f0,$f16 +div.d $f18,$f18,$f10 +s.d $f18,Y +l.d $f18,Y +sub.d $f18,$f18,$f16 +l.d $f16,Eight +div.d $f16,$f10,$f16 +add.d $f18,$f18,$f16 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,MaxSqEr +c.ule.d $f18,$f16; bc1t L.371 +l.d $f18,SqEr +s.d $f18,MaxSqEr +L.371: +l.d $f18,Y +l.d $f16,U2 +l.d $f10,Eight +div.d $f16,$f16,$f10 +add.d $f18,$f18,$f16 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,MinSqEr +c.lt.d $f18,$f16; bc1f L.373 +l.d $f18,SqEr +s.d $f18,MinSqEr +L.373: +l.d $f12,F9 +jal sqrt +l.d $f16,U2 +l.d $f10,U1 +sub.d $f18,$f0,$f16 +l.d $f8,One +sub.d $f16,$f8,$f16 +sub.d $f18,$f18,$f16 +div.d $f18,$f18,$f10 +s.d $f18,Y +l.d $f18,Y +l.d $f16,Eight +div.d $f16,$f10,$f16 +add.d $f18,$f18,$f16 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,MaxSqEr +c.ule.d $f18,$f16; bc1t L.375 +l.d $f18,SqEr +s.d $f18,MaxSqEr +L.375: +l.d $f18,Y +l.d $f16,One +add.d $f18,$f18,$f16 +l.d $f16,U1 +l.d $f10,Eight +div.d $f16,$f16,$f10 +add.d $f18,$f18,$f16 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,MinSqEr +c.lt.d $f18,$f16; bc1f L.377 +l.d $f18,SqEr +s.d $f18,MinSqEr +L.377: +l.d $f18,U2 +s.d $f18,OneUlp +l.d $f18,OneUlp +s.d $f18,X +la $24,1 +sw $24,Indx +L.379: +l.d $f18,X +l.d $f16,U1 +add.d $f16,$f18,$f16 +add.d $f18,$f16,$f18 +l.d $f16,F9 +add.d $f12,$f18,$f16 +jal sqrt +s.d $f0,Y +l.d $f18,U2 +l.d $f16,X +l.d $f10,OneUlp +l.d $f8,Y +sub.d $f8,$f8,$f18 +l.d $f6,One +sub.d $f18,$f6,$f18 +add.d $f18,$f18,$f16 +sub.d $f18,$f8,$f18 +div.d $f18,$f18,$f10 +s.d $f18,Y +l.d $f18,Half +l.d $f8,U1 +sub.d $f8,$f8,$f16 +l.d $f6,F9 +add.d $f8,$f8,$f6 +mul.d $f8,$f8,$f18 +mul.d $f8,$f8,$f16 +mul.d $f16,$f8,$f16 +div.d $f16,$f16,$f10 +s.d $f16,Z +l.d $f16,Y +add.d $f18,$f16,$f18 +l.d $f16,Z +add.d $f18,$f18,$f16 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,MinSqEr +c.lt.d $f18,$f16; bc1f L.383 +l.d $f18,SqEr +s.d $f18,MinSqEr +L.383: +l.d $f18,Y +l.d $f16,Half +sub.d $f18,$f18,$f16 +l.d $f16,Z +add.d $f18,$f18,$f16 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,MaxSqEr +c.ule.d $f18,$f16; bc1t L.385 +l.d $f18,SqEr +s.d $f18,MaxSqEr +L.385: +lw $24,Indx +la $15,1 +beq $24,$15,L.389 +la $15,3 +bne $24,$15,L.387 +L.389: +l.d $f12,X +jal Sign +mov.d $f18,$f0 +s.d $f18,-128+240($sp) +l.d $f12,OneUlp +jal sqrt +l.d $f16,Eight +l.d $f10,Nine +mul.d $f18,$f10,$f0 +div.d $f12,$f16,$f18 +jal floor +l.d $f16,OneUlp +l.d $f10,-128+240($sp) +mul.d $f16,$f16,$f10 +mul.d $f18,$f16,$f0 +s.d $f18,X +b L.388 +L.387: +l.d $f18,U1 +s.d $f18,OneUlp +l.d $f18,OneUlp +neg.d $f18,$f18 +s.d $f18,X +L.388: +L.380: +lw $24,Indx +la $24,1($24) +sw $24,Indx +lw $24,Indx +la $15,3 +ble $24,$15,L.379 +la $24,85 +sw $24,Milestone +sw $0,SqRWrng +sw $0,Anomaly +sw $0,RSqrt +l.d $f18,Radix +l.d $f16,One +c.eq.d $f18,$f16; bc1t L.390 +la $4,L.392 +jal printf +l.d $f18,Precision +s.d $f18,-128+240($sp) +mov.d $f12,$f18 +jal floor +mov.d $f18,$f0 +l.d $f12,Radix +l.d $f16,One +l.d $f10,-128+240($sp) +add.d $f16,$f16,$f10 +sub.d $f14,$f16,$f18 +jal pow +mov.d $f18,$f0 +l.d $f16,Half +add.d $f12,$f16,$f18 +jal floor +s.d $f0,D +l.d $f18,D +l.d $f16,Radix +div.d $f16,$f18,$f16 +s.d $f16,X +l.d $f16,A1 +div.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,X +s.d $f18,-136+240($sp) +mov.d $f12,$f18 +jal floor +l.d $f16,-136+240($sp) +c.eq.d $f16,$f0; bc1f L.395 +l.d $f18,Y +s.d $f18,-144+240($sp) +mov.d $f12,$f18 +jal floor +l.d $f16,-144+240($sp) +c.eq.d $f16,$f0; bc1t L.393 +L.395: +la $24,1 +sw $24,Anomaly +b L.394 +L.393: +l.d $f18,Zero +s.d $f18,X +l.d $f18,X +s.d $f18,Z2 +l.d $f18,One +s.d $f18,Y +l.d $f16,Y +s.d $f16,Y2 +l.d $f16,Radix +sub.d $f18,$f16,$f18 +s.d $f18,Z1 +l.d $f18,Four +l.d $f16,D +mul.d $f18,$f18,$f16 +s.d $f18,FourD +L.396: +l.d $f18,Y2 +l.d $f16,Z2 +c.ule.d $f18,$f16; bc1t L.399 +l.d $f18,Radix +s.d $f18,Q +l.d $f18,Y +s.d $f18,Y1 +L.401: +l.d $f18,Q +s.d $f18,-152+240($sp) +l.d $f16,Half +l.d $f10,Y1 +div.d $f10,$f18,$f10 +sub.d $f12,$f16,$f10 +jal floor +l.d $f16,Y1 +mul.d $f18,$f0,$f16 +l.d $f16,-152+240($sp) +add.d $f12,$f16,$f18 +jal fabs +s.d $f0,X1 +l.d $f18,Y1 +s.d $f18,Q +l.d $f18,X1 +s.d $f18,Y1 +L.402: +l.d $f18,X1 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.401 +l.d $f18,Q +l.d $f16,One +c.le.d $f18,$f16; bc1f L.404 +l.d $f18,Y2 +s.d $f18,Z2 +l.d $f18,Y +s.d $f18,Z +L.404: +L.399: +l.d $f18,Y +l.d $f16,Two +add.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,X +l.d $f16,Eight +add.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,Y2 +l.d $f16,X +add.d $f18,$f18,$f16 +s.d $f18,Y2 +l.d $f18,Y2 +l.d $f16,FourD +c.ult.d $f18,$f16; bc1t L.406 +l.d $f18,Y2 +l.d $f16,FourD +sub.d $f18,$f18,$f16 +s.d $f18,Y2 +L.406: +L.397: +l.d $f18,Y +l.d $f16,D +c.ult.d $f18,$f16; bc1t L.396 +l.d $f18,FourD +l.d $f16,Z2 +sub.d $f16,$f18,$f16 +s.d $f16,X8 +l.d $f16,X8 +l.d $f10,Z +mul.d $f10,$f10,$f10 +add.d $f10,$f16,$f10 +div.d $f18,$f10,$f18 +s.d $f18,Q +l.d $f18,Eight +div.d $f18,$f16,$f18 +s.d $f18,X8 +l.d $f18,Q +s.d $f18,-152+240($sp) +mov.d $f12,$f18 +jal floor +l.d $f16,-152+240($sp) +c.eq.d $f16,$f0; bc1t L.408 +la $24,1 +sw $24,Anomaly +b L.409 +L.408: +sw $0,Break +L.410: +l.d $f18,Z1 +l.d $f16,Z +mul.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,X +s.d $f18,-160+240($sp) +l.d $f16,Radix +div.d $f12,$f18,$f16 +jal floor +l.d $f16,Radix +mul.d $f18,$f0,$f16 +l.d $f16,-160+240($sp) +sub.d $f18,$f16,$f18 +s.d $f18,X +l.d $f18,X +l.d $f16,One +c.eq.d $f18,$f16; bc1f L.413 +la $24,1 +sw $24,Break +b L.414 +L.413: +l.d $f18,Z1 +l.d $f16,One +sub.d $f18,$f18,$f16 +s.d $f18,Z1 +L.414: +L.411: +lw $24,Break +bne $24,$0,L.415 +l.d $f18,Z1 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.410 +L.415: +l.d $f18,Z1 +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.416 +lw $24,Break +bne $24,$0,L.416 +la $24,1 +sw $24,Anomaly +b L.417 +L.416: +l.d $f18,Z1 +l.d $f16,RadixD2 +c.ule.d $f18,$f16; bc1t L.418 +l.d $f18,Z1 +l.d $f16,Radix +sub.d $f18,$f18,$f16 +s.d $f18,Z1 +L.418: +L.420: +jal NewD +L.421: +l.d $f18,U2 +l.d $f16,D +mul.d $f18,$f18,$f16 +l.d $f16,F9 +c.ult.d $f18,$f16; bc1t L.420 +l.d $f18,D +l.d $f16,Radix +mul.d $f16,$f18,$f16 +sub.d $f16,$f16,$f18 +l.d $f10,W +sub.d $f18,$f10,$f18 +c.eq.d $f16,$f18; bc1t L.423 +la $24,1 +sw $24,Anomaly +b L.424 +L.423: +l.d $f18,D +s.d $f18,Z2 +sw $0,I +l.d $f16,Z +l.d $f10,One +add.d $f10,$f10,$f16 +l.d $f8,Half +mul.d $f10,$f10,$f8 +add.d $f10,$f18,$f10 +s.d $f10,Y +add.d $f18,$f18,$f16 +l.d $f16,Q +add.d $f18,$f18,$f16 +s.d $f18,X +jal SR3750 +l.d $f18,D +l.d $f16,Z +l.d $f10,One +sub.d $f10,$f10,$f16 +l.d $f8,Half +mul.d $f10,$f10,$f8 +add.d $f10,$f18,$f10 +add.d $f10,$f10,$f18 +s.d $f10,Y +sub.d $f16,$f18,$f16 +add.d $f18,$f16,$f18 +s.d $f18,X +l.d $f18,X +l.d $f16,Q +add.d $f16,$f18,$f16 +add.d $f18,$f16,$f18 +s.d $f18,X +jal SR3750 +jal NewD +l.d $f18,Z2 +l.d $f16,D +sub.d $f16,$f16,$f18 +l.d $f10,W +sub.d $f18,$f10,$f18 +c.eq.d $f16,$f18; bc1t L.425 +la $24,1 +sw $24,Anomaly +b L.426 +L.425: +l.d $f18,Z2 +l.d $f16,D +sub.d $f16,$f16,$f18 +l.d $f10,Z +l.d $f8,One +sub.d $f8,$f8,$f10 +l.d $f6,Half +mul.d $f8,$f8,$f6 +add.d $f8,$f18,$f8 +add.d $f8,$f16,$f8 +s.d $f8,Y +sub.d $f18,$f18,$f10 +l.d $f10,Q +add.d $f18,$f18,$f10 +add.d $f18,$f16,$f18 +s.d $f18,X +jal SR3750 +l.d $f18,One +l.d $f16,Z +add.d $f18,$f18,$f16 +l.d $f16,Half +mul.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Q +s.d $f18,X +jal SR3750 +lw $24,I +bne $24,$0,L.427 +la $24,1 +sw $24,Anomaly +L.427: +L.426: +L.424: +L.417: +L.409: +L.394: +lw $15,I +beq $15,$0,L.431 +lw $15,Anomaly +beq $15,$0,L.429 +L.431: +move $4,$0 +la $5,L.432 +jal BadCond +la $4,L.433 +l.d $f18,W +mfc1.d $6,$f18 +jal printf +la $4,L.434 +jal printf +la $24,1 +sw $24,SqRWrng +L.429: +L.390: +lw $24,Anomaly +bne $24,$0,L.435 +l.d $f18,Zero +l.d $f16,MinSqEr +c.ult.d $f16,$f18; bc1t L.437 +l.d $f16,MaxSqEr +c.le.d $f16,$f18; bc1f L.437 +la $24,1 +sw $24,RSqrt +la $4,L.439 +jal printf +b L.438 +L.437: +l.d $f18,U2 +l.d $f16,Half +l.d $f10,MaxSqEr +add.d $f10,$f10,$f18 +sub.d $f18,$f18,$f16 +c.le.d $f10,$f18; bc1f L.443 +l.d $f18,MinSqEr +c.le.d $f18,$f16; bc1f L.443 +l.d $f10,Radix +add.d $f18,$f18,$f10 +c.lt.d $f18,$f16; bc1f L.440 +L.443: +la $24,1 +sw $24,SqRWrng +b L.441 +L.440: +la $24,2 +sw $24,RSqrt +la $4,L.444 +jal printf +L.441: +L.438: +L.435: +lw $24,SqRWrng +beq $24,$0,L.445 +la $4,L.447 +jal printf +la $4,L.448 +l.d $f18,MinSqEr +l.d $f16,Half +sub.d $f18,$f18,$f16 +mfc1.d $6,$f18 +jal printf +la $4,L.449 +l.d $f18,Half +l.d $f16,MaxSqEr +add.d $f18,$f18,$f16 +mfc1.d $6,$f18 +jal printf +la $4,1 +l.d $f18,Radix +l.d $f16,MaxSqEr +l.d $f10,MinSqEr +sub.d $f16,$f16,$f10 +mul.d $f18,$f18,$f18 +c.lt.d $f16,$f18; bc1f L.452 +la $24,1 +sw $24,-124+240($sp) +b L.453 +L.452: +sw $0,-124+240($sp) +L.453: +lw $5,-124+240($sp) +la $6,L.451 +jal TstCond +L.445: +la $24,90 +sw $24,Milestone +jal Pause +la $4,L.454 +jal printf +sw $0,N +sw $0,I +l.d $f18,Zero +neg.d $f18,$f18 +s.d $f18,Z +la $15,3 +sw $15,M +sw $0,Break +L.455: +l.d $f18,One +s.d $f18,X +jal SR3980 +lw $24,I +la $15,10 +bgt $24,$15,L.458 +la $24,1023 +sw $24,I +jal SR3980 +L.458: +l.d $f18,Z +l.d $f16,MinusOne +c.eq.d $f18,$f16; bc1f L.460 +la $24,1 +sw $24,Break +b L.461 +L.460: +l.d $f18,MinusOne +s.d $f18,Z +jal PrintIfNPositive +sw $0,N +la $24,-4 +sw $24,I +L.461: +L.456: +lw $24,Break +beq $24,$0,L.455 +jal PrintIfNPositive +lw $24,N +sw $24,N1 +sw $0,N +l.d $f18,A1 +s.d $f18,Z +l.d $f12,W +jal log +mov.d $f18,$f0 +s.d $f18,-128+240($sp) +l.d $f12,A1 +jal log +mov.d $f18,$f0 +l.d $f16,Two +l.d $f10,-128+240($sp) +mul.d $f16,$f16,$f10 +div.d $f12,$f16,$f18 +jal floor +trunc.w.d $f2,$f0,$24; mfc1 $24,$f2 +sw $24,M +sw $0,Break +L.462: +l.d $f18,Z +s.d $f18,X +la $24,1 +sw $24,I +jal SR3980 +l.d $f18,Z +l.d $f16,AInvrse +c.eq.d $f18,$f16; bc1f L.465 +la $24,1 +sw $24,Break +b L.466 +L.465: +l.d $f18,AInvrse +s.d $f18,Z +L.466: +L.463: +lw $24,Break +beq $24,$0,L.462 +la $24,100 +sw $24,Milestone +lw $24,NoTrials +sw $24,M +l.d $f18,Three +s.d $f18,Z +L.467: +l.d $f18,Z +s.d $f18,X +la $24,1 +sw $24,I +jal SR3980 +L.470: +l.d $f18,Z +l.d $f16,Two +add.d $f18,$f18,$f16 +s.d $f18,Z +L.471: +l.d $f18,Three +s.d $f18,-136+240($sp) +l.d $f16,Z +div.d $f12,$f16,$f18 +jal floor +l.d $f16,-136+240($sp) +mul.d $f18,$f16,$f0 +l.d $f16,Z +c.eq.d $f18,$f16; bc1t L.470 +L.468: +l.d $f18,Z +l.d $f16,Eight +l.d $f10,Three +mul.d $f16,$f16,$f10 +c.ult.d $f18,$f16; bc1t L.467 +lw $24,N +ble $24,$0,L.473 +la $4,L.475 +jal printf +la $4,L.476 +jal printf +L.473: +jal PrintIfNPositive +lw $24,N +lw $15,N1 +addu $24,$24,$15 +sw $24,N +lw $24,N +bne $24,$0,L.477 +la $4,L.479 +jal printf +L.477: +lw $24,N +ble $24,$0,L.480 +jal Pause +b L.481 +L.480: +la $4,L.44 +jal printf +L.481: +la $24,110 +sw $24,Milestone +la $4,L.482 +jal printf +l.d $f18,U1 +s.d $f18,D +l.d $f18,Precision +s.d $f18,-136+240($sp) +mov.d $f12,$f18 +jal floor +l.d $f16,-136+240($sp) +c.eq.d $f16,$f0; bc1t L.483 +l.d $f18,BInvrse +s.d $f18,D +l.d $f18,Precision +s.d $f18,X +L.485: +l.d $f18,D +l.d $f16,BInvrse +mul.d $f18,$f18,$f16 +s.d $f18,D +l.d $f18,X +l.d $f16,One +sub.d $f18,$f18,$f16 +s.d $f18,X +L.486: +l.d $f18,X +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.485 +L.483: +l.d $f18,One +s.d $f18,Y +l.d $f18,D +s.d $f18,Z +L.488: +l.d $f18,Y +s.d $f18,C +l.d $f18,Z +s.d $f18,Y +l.d $f18,Y +mul.d $f18,$f18,$f18 +s.d $f18,Z +L.489: +l.d $f18,Z +l.d $f16,Y +c.ule.d $f16,$f18; bc1t L.491 +add.d $f16,$f18,$f18 +c.le.d $f16,$f18; bc1f L.488 +L.491: +l.d $f18,C +s.d $f18,Y +l.d $f18,Y +l.d $f16,D +mul.d $f18,$f18,$f16 +s.d $f18,Z +L.492: +l.d $f18,Y +s.d $f18,C +l.d $f18,Z +s.d $f18,Y +l.d $f18,Y +l.d $f16,D +mul.d $f18,$f18,$f16 +s.d $f18,Z +L.493: +l.d $f18,Z +l.d $f16,Y +c.ule.d $f16,$f18; bc1t L.495 +add.d $f16,$f18,$f18 +c.le.d $f16,$f18; bc1f L.492 +L.495: +l.d $f18,Radix +l.d $f16,Two +c.lt.d $f18,$f16; bc1f L.496 +l.d $f18,Two +s.d $f18,HInvrse +b L.497 +L.496: +l.d $f18,Radix +s.d $f18,HInvrse +L.497: +l.d $f18,One +l.d $f16,HInvrse +div.d $f16,$f18,$f16 +s.d $f16,H +l.d $f16,C +div.d $f18,$f18,$f16 +s.d $f18,CInvrse +s.d $f16,E0 +l.d $f18,E0 +l.d $f16,H +mul.d $f18,$f18,$f16 +s.d $f18,Z +L.498: +l.d $f18,E0 +s.d $f18,Y +l.d $f18,Z +s.d $f18,E0 +l.d $f18,E0 +l.d $f16,H +mul.d $f18,$f18,$f16 +s.d $f18,Z +L.499: +l.d $f18,Z +l.d $f16,E0 +c.ule.d $f16,$f18; bc1t L.501 +add.d $f16,$f18,$f18 +c.le.d $f16,$f18; bc1f L.498 +L.501: +l.d $f18,E0 +s.d $f18,UfThold +l.d $f18,Zero +s.d $f18,E1 +s.d $f18,Q +l.d $f18,U2 +s.d $f18,E9 +l.d $f18,One +l.d $f16,E9 +add.d $f18,$f18,$f16 +s.d $f18,S +l.d $f18,C +l.d $f16,S +mul.d $f16,$f18,$f16 +s.d $f16,D +l.d $f16,D +c.le.d $f16,$f18; bc1f L.502 +l.d $f18,Radix +l.d $f16,U2 +mul.d $f18,$f18,$f16 +s.d $f18,E9 +l.d $f18,One +l.d $f16,E9 +add.d $f18,$f18,$f16 +s.d $f18,S +l.d $f18,C +l.d $f16,S +mul.d $f16,$f18,$f16 +s.d $f16,D +l.d $f16,D +c.le.d $f16,$f18; bc1f L.503 +move $4,$0 +la $5,L.506 +jal BadCond +l.d $f18,E0 +s.d $f18,Underflow +l.d $f18,Zero +s.d $f18,Y1 +l.d $f18,Z +s.d $f18,PseudoZero +jal Pause +b L.503 +L.502: +l.d $f18,D +s.d $f18,Underflow +l.d $f18,Underflow +l.d $f16,H +mul.d $f18,$f18,$f16 +s.d $f18,PseudoZero +l.d $f18,Zero +s.d $f18,UfThold +L.507: +l.d $f18,Underflow +s.d $f18,Y1 +l.d $f18,PseudoZero +s.d $f18,Underflow +l.d $f18,E1 +add.d $f16,$f18,$f18 +c.le.d $f16,$f18; bc1f L.510 +l.d $f18,Underflow +l.d $f16,HInvrse +mul.d $f18,$f18,$f16 +s.d $f18,Y2 +l.d $f18,Y1 +l.d $f16,Y2 +sub.d $f12,$f18,$f16 +jal fabs +s.d $f0,E1 +l.d $f18,Y1 +s.d $f18,Q +l.d $f18,UfThold +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.512 +l.d $f18,Y1 +l.d $f16,Y2 +c.eq.d $f18,$f16; bc1t L.512 +l.d $f18,Y1 +s.d $f18,UfThold +L.512: +L.510: +l.d $f18,PseudoZero +l.d $f16,H +mul.d $f18,$f18,$f16 +s.d $f18,PseudoZero +L.508: +l.d $f18,PseudoZero +l.d $f16,Underflow +c.ule.d $f16,$f18; bc1t L.514 +add.d $f16,$f18,$f18 +c.le.d $f16,$f18; bc1f L.507 +L.514: +L.503: +l.d $f18,PseudoZero +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.515 +la $4,L.44 +jal printf +l.d $f18,PseudoZero +s.d $f18,Z +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.517 +move $4,$0 +la $5,L.519 +jal BadCond +la $4,L.520 +jal printf +la $4,L.521 +l.d $f18,PseudoZero +mfc1.d $6,$f18 +jal printf +l.d $f18,PseudoZero +neg.d $f18,$f18 +s.d $f18,X +l.d $f18,X +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.518 +la $4,L.524 +jal printf +la $4,L.525 +l.d $f18,X +mfc1.d $6,$f18 +jal printf +b L.518 +L.517: +la $4,3 +la $5,L.526 +jal BadCond +la $4,L.527 +l.d $f18,PseudoZero +mfc1.d $6,$f18 +jal printf +L.518: +jal TstPtUf +L.515: +la $24,120 +sw $24,Milestone +l.d $f18,CInvrse +l.d $f16,Y +mul.d $f16,$f18,$f16 +l.d $f10,Y1 +mul.d $f18,$f18,$f10 +c.ule.d $f16,$f18; bc1t L.528 +l.d $f18,H +l.d $f16,S +mul.d $f18,$f18,$f16 +s.d $f18,S +l.d $f18,Underflow +s.d $f18,E0 +L.528: +l.d $f18,E1 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.530 +l.d $f16,E0 +c.eq.d $f18,$f16; bc1t L.530 +la $4,2 +la $5,L.157 +jal BadCond +l.d $f18,E1 +l.d $f16,E0 +c.lt.d $f18,$f16; bc1f L.532 +la $4,L.534 +jal printf +la $4,L.535 +jal printf +l.d $f18,PseudoZero +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.533 +l.d $f18,E1 +s.d $f18,E0 +b L.533 +L.532: +la $4,L.538 +jal printf +la $4,L.539 +jal printf +L.533: +L.530: +la $4,L.540 +l.d $f18,E0 +mfc1.d $6,$f18 +jal printf +l.d $f18,E0 +s.d $f18,Z +jal TstPtUf +l.d $f18,E0 +s.d $f18,Underflow +lw $24,N +la $15,1 +bne $24,$15,L.541 +l.d $f18,Y +s.d $f18,Underflow +L.541: +la $24,4 +sw $24,I +l.d $f18,E1 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.543 +la $24,3 +sw $24,I +L.543: +l.d $f18,UfThold +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.545 +lw $24,I +subu $24,$24,2 +sw $24,I +L.545: +la $24,1 +sw $24,UfNGrad +lw $24,I +la $15,1 +blt $24,$15,L.547 +la $15,4 +bgt $24,$15,L.547 +sll $24,$24,2 +lw $24,L.570-4($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.570: +.gpword L.549 +.gpword L.556 +.gpword L.561 +.gpword L.562 +.text +L.549: +l.d $f18,Underflow +s.d $f18,UfThold +l.d $f18,CInvrse +l.d $f16,Q +mul.d $f16,$f18,$f16 +l.d $f10,Y +mul.d $f18,$f18,$f10 +l.d $f10,S +mul.d $f18,$f18,$f10 +c.eq.d $f16,$f18; bc1t L.550 +l.d $f18,Y +s.d $f18,UfThold +move $4,$0 +la $5,L.552 +jal BadCond +la $4,L.553 +l.d $f18,UfThold +mfc1.d $6,$f18 +jal printf +la $4,L.554 +l.d $f18,C +mfc1.d $6,$f18 +jal printf +la $4,L.555 +jal printf +L.550: +jal Pause +b L.548 +L.556: +move $4,$0 +la $5,L.557 +jal BadCond +la $4,L.558 +jal printf +la $4,L.559 +l.d $f18,Q +mfc1.d $6,$f18 +l.d $f18,Y2 +s.d $f18,16($sp) +jal printf +l.d $f18,Q +l.d $f16,Y2 +sub.d $f12,$f18,$f16 +jal fabs +mov.d $f18,$f0 +la $4,L.560 +mfc1.d $6,$f18 +jal printf +l.d $f18,Q +s.d $f18,UfThold +b L.548 +L.561: +l.d $f18,X +s.d $f18,X +b L.548 +L.562: +l.d $f18,UfThold +l.d $f16,Q +c.eq.d $f16,$f18; bc1f L.563 +l.d $f16,E1 +l.d $f10,E0 +c.eq.d $f16,$f10; bc1f L.563 +l.d $f10,E9 +div.d $f16,$f16,$f10 +sub.d $f12,$f18,$f16 +jal fabs +l.d $f16,E1 +c.le.d $f0,$f16; bc1f L.563 +sw $0,UfNGrad +la $4,L.565 +jal printf +la $4,L.566 +jal printf +l.d $f18,E0 +l.d $f16,CInvrse +mul.d $f10,$f18,$f16 +s.d $f10,Y +l.d $f10,U2 +l.d $f8,Y +l.d $f6,OneAndHalf +add.d $f6,$f6,$f10 +mul.d $f8,$f8,$f6 +s.d $f8,Y +l.d $f8,One +add.d $f10,$f8,$f10 +mul.d $f16,$f16,$f10 +s.d $f16,X +l.d $f16,Y +l.d $f10,X +div.d $f16,$f16,$f10 +s.d $f16,Y +l.d $f16,Y +c.eq.d $f16,$f18; bc1f L.568 +la $24,1 +sw $24,-140+240($sp) +b L.569 +L.568: +sw $0,-140+240($sp) +L.569: +lw $24,-140+240($sp) +sw $24,IEEE +L.563: +L.547: +L.548: +lw $24,UfNGrad +beq $24,$0,L.572 +la $4,L.44 +jal printf +la $24,sigfpe +sw $24,sigsave +la $4,ovfl_buf +jal setjmp +beq $2,$0,L.574 +la $4,L.576 +jal printf +l.d $f18,H +add.d $f18,$f18,$f18 +s.d $f18,R +b L.575 +L.574: +l.d $f18,Underflow +l.d $f16,UfThold +div.d $f12,$f18,$f16 +jal sqrt +s.d $f0,R +L.575: +sw $0,sigsave +l.d $f18,R +l.d $f16,H +c.le.d $f18,$f16; bc1f L.577 +l.d $f18,R +l.d $f16,UfThold +mul.d $f16,$f18,$f16 +s.d $f16,Z +l.d $f16,One +l.d $f10,H +l.d $f8,Z +mul.d $f18,$f18,$f10 +add.d $f10,$f16,$f10 +mul.d $f18,$f18,$f10 +add.d $f18,$f16,$f18 +mul.d $f18,$f8,$f18 +s.d $f18,X +b L.578 +L.577: +l.d $f18,UfThold +s.d $f18,Z +l.d $f18,One +l.d $f16,H +l.d $f10,Z +mul.d $f8,$f16,$f16 +add.d $f16,$f18,$f16 +mul.d $f16,$f8,$f16 +add.d $f18,$f18,$f16 +mul.d $f18,$f10,$f18 +s.d $f18,X +L.578: +l.d $f18,X +l.d $f16,Z +c.eq.d $f18,$f16; bc1t L.579 +sub.d $f18,$f18,$f16 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.579 +la $4,3 +la $5,L.157 +jal BadCond +la $4,L.581 +l.d $f18,X +mfc1.d $6,$f18 +l.d $f18,Z +s.d $f18,16($sp) +jal printf +l.d $f18,X +l.d $f16,Z +sub.d $f18,$f18,$f16 +s.d $f18,Z9 +la $4,L.582 +l.d $f18,Z9 +mfc1.d $6,$f18 +jal printf +la $4,L.583 +jal printf +la $4,L.584 +jal printf +la $4,L.585 +jal printf +la $4,L.586 +jal printf +la $4,L.587 +jal printf +la $4,L.588 +jal printf +la $24,sigfpe +sw $24,sigsave +la $4,ovfl_buf +jal setjmp +beq $2,$0,L.589 +la $4,L.591 +jal printf +b L.590 +L.589: +la $4,L.592 +l.d $f18,Half +l.d $f16,X +l.d $f10,Z +div.d $f16,$f16,$f10 +sub.d $f16,$f16,$f18 +sub.d $f18,$f16,$f18 +mfc1.d $6,$f18 +jal printf +L.590: +sw $0,sigsave +L.579: +L.572: +la $4,L.593 +l.d $f18,UfThold +mfc1.d $6,$f18 +la $24,L.594 +sw $24,16($sp) +jal printf +la $4,L.595 +jal printf +la $4,L.596 +jal printf +l.d $f18,U1 +mul.d $f16,$f18,$f18 +s.d $f16,Y2 +l.d $f16,Y2 +mul.d $f16,$f16,$f16 +s.d $f16,Y +l.d $f16,Y +mul.d $f18,$f16,$f18 +s.d $f18,Y2 +l.d $f18,Y2 +l.d $f16,UfThold +c.le.d $f18,$f16; bc1f L.597 +l.d $f18,Y +l.d $f16,E0 +c.ule.d $f18,$f16; bc1t L.599 +la $4,2 +la $5,L.157 +jal BadCond +la $24,5 +sw $24,I +b L.600 +L.599: +la $4,1 +la $5,L.157 +jal BadCond +la $24,4 +sw $24,I +L.600: +la $4,L.601 +lw $5,I +jal printf +L.597: +la $24,130 +sw $24,Milestone +l.d $f12,UfThold +jal log +mov.d $f18,$f0 +s.d $f18,-144+240($sp) +l.d $f12,HInvrse +jal log +l.d $f16,Half +l.d $f10,TwoForty +l.d $f8,-144+240($sp) +mul.d $f10,$f10,$f8 +div.d $f18,$f10,$f0 +sub.d $f12,$f16,$f18 +jal floor +neg.d $f18,$f0 +l.d $f16,TwoForty +div.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Y +add.d $f18,$f18,$f18 +s.d $f18,Y2 +la $4,L.602 +jal printf +la $4,L.603 +l.d $f18,HInvrse +mfc1.d $6,$f18 +l.d $f18,Y +s.d $f18,16($sp) +jal printf +la $4,L.604 +l.d $f18,HInvrse +mfc1.d $6,$f18 +l.d $f18,Y +s.d $f18,16($sp) +jal printf +l.d $f12,HInvrse +l.d $f14,Y2 +jal pow +s.d $f0,V9 +la $4,L.605 +l.d $f18,V9 +mfc1.d $6,$f18 +jal printf +l.d $f18,V9 +l.d $f16,Zero +c.ult.d $f18,$f16; bc1t L.608 +l.d $f16,Radix +add.d $f16,$f16,$f16 +l.d $f10,E9 +add.d $f16,$f16,$f10 +l.d $f10,UfThold +mul.d $f16,$f16,$f10 +c.ule.d $f18,$f16; bc1t L.606 +L.608: +la $4,1 +la $5,L.609 +jal BadCond +la $4,L.610 +l.d $f18,UfThold +mfc1.d $6,$f18 +jal printf +b L.607 +L.606: +l.d $f18,V9 +l.d $f16,UfThold +l.d $f10,One +l.d $f8,E9 +add.d $f10,$f10,$f8 +mul.d $f16,$f16,$f10 +c.le.d $f18,$f16; bc1f L.611 +la $4,L.613 +jal printf +b L.612 +L.611: +la $4,2 +la $5,L.609 +jal BadCond +la $4,L.610 +l.d $f18,UfThold +mfc1.d $6,$f18 +jal printf +L.612: +L.607: +la $24,140 +sw $24,Milestone +la $4,L.44 +jal printf +l.d $f18,Zero +s.d $f18,X +la $24,2 +sw $24,I +l.d $f16,Two +l.d $f10,Three +mul.d $f16,$f16,$f10 +s.d $f16,Y +s.d $f18,Q +sw $0,N +L.614: +l.d $f18,X +s.d $f18,Z +lw $24,I +la $24,1($24) +sw $24,I +lw $24,I +l.d $f18,Y +addu $24,$24,$24 +mtc1 $24,$f16; cvt.d.w $f16,$f16 +div.d $f18,$f18,$f16 +s.d $f18,Y +l.d $f18,Y +l.d $f16,Q +add.d $f18,$f18,$f16 +s.d $f18,R +l.d $f18,Z +l.d $f16,R +add.d $f10,$f18,$f16 +s.d $f10,X +l.d $f10,X +sub.d $f18,$f18,$f10 +add.d $f18,$f18,$f16 +s.d $f18,Q +L.615: +l.d $f18,X +l.d $f16,Z +c.le.d $f18,$f16; bc1f L.614 +l.d $f18,OneAndHalf +l.d $f16,One +l.d $f10,Eight +div.d $f16,$f16,$f10 +add.d $f16,$f18,$f16 +l.d $f10,X +l.d $f8,ThirtyTwo +mul.d $f18,$f18,$f8 +div.d $f18,$f10,$f18 +add.d $f18,$f16,$f18 +s.d $f18,Z +l.d $f18,Z +mul.d $f18,$f18,$f18 +s.d $f18,X +l.d $f18,X +mul.d $f18,$f18,$f18 +s.d $f18,Exp2 +l.d $f18,F9 +s.d $f18,X +l.d $f18,X +l.d $f16,U1 +sub.d $f18,$f18,$f16 +s.d $f18,Y +la $4,L.617 +l.d $f18,Exp2 +mfc1.d $6,$f18 +jal printf +la $24,1 +sw $24,I +L.618: +l.d $f18,X +l.d $f16,BInvrse +sub.d $f10,$f18,$f16 +s.d $f10,Z +l.d $f10,One +add.d $f8,$f18,$f10 +l.d $f6,Z +sub.d $f16,$f10,$f16 +sub.d $f16,$f6,$f16 +div.d $f16,$f8,$f16 +s.d $f16,Z +mov.d $f12,$f18 +l.d $f14,Z +jal pow +l.d $f16,Exp2 +sub.d $f18,$f0,$f16 +s.d $f18,Q +l.d $f12,Q +jal fabs +l.d $f16,TwoForty +l.d $f10,U2 +mul.d $f16,$f16,$f10 +c.ule.d $f0,$f16; bc1t L.622 +la $24,1 +sw $24,N +l.d $f18,BInvrse +l.d $f16,X +sub.d $f16,$f16,$f18 +l.d $f10,One +sub.d $f18,$f10,$f18 +sub.d $f18,$f16,$f18 +s.d $f18,V9 +la $4,2 +la $5,L.624 +jal BadCond +l.d $f12,X +l.d $f14,Z +jal pow +mov.d $f18,$f0 +la $4,L.625 +mfc1.d $6,$f18 +jal printf +la $4,L.626 +l.d $f18,V9 +mfc1.d $6,$f18 +l.d $f18,Z +s.d $f18,16($sp) +jal printf +la $4,L.627 +l.d $f18,Q +mfc1.d $6,$f18 +jal printf +la $4,L.628 +jal printf +la $4,L.629 +jal printf +b L.620 +L.622: +l.d $f18,Y +l.d $f16,X +sub.d $f16,$f18,$f16 +l.d $f10,Two +mul.d $f16,$f16,$f10 +add.d $f16,$f16,$f18 +s.d $f16,Z +s.d $f18,X +l.d $f18,Z +s.d $f18,Y +l.d $f18,X +l.d $f16,F9 +sub.d $f18,$f18,$f16 +l.d $f16,One +mul.d $f18,$f18,$f18 +add.d $f18,$f16,$f18 +s.d $f18,Z +l.d $f18,Z +l.d $f16,One +c.ule.d $f18,$f16; bc1t L.630 +lw $24,I +lw $15,NoTrials +bge $24,$15,L.630 +lw $24,I +la $24,1($24) +sw $24,I +b L.618 +L.630: +l.d $f18,X +l.d $f16,One +c.ule.d $f18,$f16; bc1t L.632 +lw $24,N +bne $24,$0,L.620 +la $4,L.636 +jal printf +b L.620 +L.632: +l.d $f18,U2 +l.d $f16,One +add.d $f16,$f16,$f18 +s.d $f16,X +add.d $f18,$f18,$f18 +s.d $f18,Y +l.d $f18,Y +l.d $f16,X +add.d $f18,$f18,$f16 +s.d $f18,Y +la $24,1 +sw $24,I +b L.618 +L.620: +la $24,150 +sw $24,Milestone +la $4,L.637 +jal printf +sw $0,N +l.d $f18,A1 +s.d $f18,Z +l.d $f12,C +jal log +mov.d $f18,$f0 +s.d $f18,-152+240($sp) +l.d $f12,A1 +jal log +l.d $f16,Half +l.d $f10,-152+240($sp) +div.d $f18,$f10,$f0 +sub.d $f12,$f16,$f18 +jal floor +s.d $f0,Q +sw $0,Break +L.638: +l.d $f18,CInvrse +s.d $f18,X +l.d $f12,Z +l.d $f14,Q +jal pow +s.d $f0,Y +jal IsYeqX +l.d $f18,Q +neg.d $f18,$f18 +s.d $f18,Q +l.d $f18,C +s.d $f18,X +l.d $f12,Z +l.d $f14,Q +jal pow +s.d $f0,Y +jal IsYeqX +l.d $f18,Z +l.d $f16,One +c.lt.d $f18,$f16; bc1f L.641 +la $24,1 +sw $24,Break +b L.642 +L.641: +l.d $f18,AInvrse +s.d $f18,Z +L.642: +L.639: +lw $24,Break +beq $24,$0,L.638 +jal PrintIfNPositive +lw $24,N +bne $24,$0,L.643 +la $4,L.645 +jal printf +L.643: +la $4,L.44 +jal printf +la $24,160 +sw $24,Milestone +jal Pause +la $4,L.646 +jal printf +la $4,L.647 +jal printf +l.d $f18,CInvrse +neg.d $f18,$f18 +s.d $f18,Y +l.d $f18,HInvrse +l.d $f16,Y +mul.d $f18,$f18,$f16 +s.d $f18,V9 +la $24,sigfpe +sw $24,sigsave +la $4,ovfl_buf +jal setjmp +beq $2,$0,L.648 +sw $0,I +l.d $f18,Y +s.d $f18,V9 +b L.650 +L.648: +L.651: +l.d $f18,Y +s.d $f18,V +l.d $f18,V9 +s.d $f18,Y +l.d $f18,HInvrse +l.d $f16,Y +mul.d $f18,$f18,$f16 +s.d $f18,V9 +L.652: +l.d $f18,V9 +l.d $f16,Y +c.ult.d $f18,$f16; bc1t L.651 +la $24,1 +sw $24,I +L.650: +sw $0,sigsave +l.d $f18,V9 +s.d $f18,Z +la $4,L.654 +jal printf +la $4,L.655 +l.d $f18,Y +mfc1.d $6,$f18 +jal printf +l.d $f18,Y +neg.d $f16,$f18 +s.d $f16,V9 +l.d $f16,V9 +s.d $f16,V0 +l.d $f16,V +sub.d $f18,$f16,$f18 +l.d $f10,V0 +add.d $f16,$f16,$f10 +c.eq.d $f18,$f16; bc1f L.656 +la $4,L.658 +jal printf +b L.657 +L.656: +la $4,L.659 +jal printf +la $4,3 +la $5,L.660 +jal BadCond +L.657: +l.d $f18,Z +l.d $f16,Y +c.eq.d $f18,$f16; bc1t L.661 +la $4,1 +la $5,L.157 +jal BadCond +la $4,L.663 +l.d $f18,Y +mfc1.d $6,$f18 +l.d $f18,Z +s.d $f18,16($sp) +jal printf +L.661: +lw $24,I +beq $24,$0,L.664 +l.d $f18,V +l.d $f16,HInvrse +l.d $f10,U2 +mul.d $f8,$f16,$f10 +sub.d $f8,$f8,$f16 +mul.d $f8,$f18,$f8 +s.d $f8,Y +l.d $f8,Y +l.d $f6,One +sub.d $f16,$f6,$f16 +mul.d $f16,$f16,$f10 +mul.d $f18,$f16,$f18 +add.d $f18,$f8,$f18 +s.d $f18,Z +l.d $f18,Z +l.d $f16,V0 +c.lt.d $f18,$f16; bc1f L.666 +l.d $f18,Z +s.d $f18,Y +L.666: +l.d $f18,Y +l.d $f16,V0 +c.lt.d $f18,$f16; bc1f L.668 +l.d $f18,Y +s.d $f18,V +L.668: +l.d $f18,V0 +l.d $f16,V +sub.d $f16,$f18,$f16 +c.lt.d $f16,$f18; bc1f L.665 +l.d $f18,V0 +s.d $f18,V +b L.665 +L.664: +l.d $f18,Y +l.d $f16,HInvrse +l.d $f10,U2 +mul.d $f8,$f16,$f10 +sub.d $f8,$f8,$f16 +mul.d $f8,$f18,$f8 +s.d $f8,V +l.d $f8,V +l.d $f6,One +sub.d $f16,$f6,$f16 +mul.d $f16,$f16,$f10 +mul.d $f18,$f16,$f18 +add.d $f18,$f8,$f18 +s.d $f18,V +L.665: +la $4,L.672 +l.d $f18,V +mfc1.d $6,$f18 +jal printf +lw $24,I +beq $24,$0,L.673 +la $4,L.675 +l.d $f18,V0 +mfc1.d $6,$f18 +jal printf +b L.674 +L.673: +la $4,L.676 +jal printf +L.674: +l.d $f18,V +l.d $f16,One +mul.d $f18,$f18,$f16 +s.d $f18,V9 +la $4,L.677 +l.d $f18,V9 +mfc1.d $6,$f18 +jal printf +l.d $f18,V +l.d $f16,One +div.d $f18,$f18,$f16 +s.d $f18,V9 +la $4,L.678 +l.d $f18,V9 +mfc1.d $6,$f18 +jal printf +la $4,L.679 +jal printf +la $4,L.680 +jal printf +la $24,170 +sw $24,Milestone +l.d $f18,V +neg.d $f16,$f18 +c.lt.d $f16,$f18; bc1f L.685 +l.d $f16,V0 +neg.d $f10,$f16 +c.lt.d $f10,$f16; bc1f L.685 +l.d $f16,UfThold +neg.d $f10,$f16 +c.lt.d $f10,$f18; bc1f L.685 +c.ult.d $f16,$f18; bc1t L.681 +L.685: +move $4,$0 +la $5,L.686 +jal BadCond +la $4,L.687 +l.d $f18,V +mfc1.d $6,$f18 +l.d $f18,V0 +s.d $f18,16($sp) +l.d $f18,UfThold +s.d $f18,24($sp) +jal printf +L.681: +la $24,175 +sw $24,Milestone +la $4,L.44 +jal printf +la $24,1 +sw $24,Indx +L.688: +lw $24,Indx +la $15,1 +beq $24,$15,L.694 +la $15,2 +beq $24,$15,L.695 +la $15,3 +beq $24,$15,L.696 +b L.692 +L.694: +l.d $f18,UfThold +s.d $f18,Z +b L.693 +L.695: +l.d $f18,E0 +s.d $f18,Z +b L.693 +L.696: +l.d $f18,PseudoZero +s.d $f18,Z +L.692: +L.693: +l.d $f18,Z +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.697 +l.d $f12,Z +jal sqrt +s.d $f0,V9 +l.d $f18,V9 +mul.d $f18,$f18,$f18 +s.d $f18,Y +l.d $f18,Y +l.d $f16,One +l.d $f10,Radix +l.d $f8,E9 +mul.d $f10,$f10,$f8 +l.d $f8,Z +sub.d $f6,$f16,$f10 +div.d $f6,$f18,$f6 +c.ult.d $f6,$f8; bc1t L.701 +add.d $f16,$f16,$f10 +mul.d $f16,$f16,$f8 +c.ule.d $f18,$f16; bc1t L.699 +L.701: +l.d $f18,V9 +l.d $f16,U1 +c.ule.d $f18,$f16; bc1t L.702 +la $4,1 +la $5,L.157 +jal BadCond +b L.703 +L.702: +la $4,2 +la $5,L.157 +jal BadCond +L.703: +la $4,L.704 +l.d $f18,Z +mfc1.d $6,$f18 +jal printf +la $4,L.705 +l.d $f18,Y +mfc1.d $6,$f18 +jal printf +L.699: +L.697: +L.689: +lw $24,Indx +la $24,1($24) +sw $24,Indx +lw $24,Indx +la $15,3 +ble $24,$15,L.688 +la $24,180 +sw $24,Milestone +la $24,1 +sw $24,Indx +L.706: +lw $24,Indx +la $15,1 +bne $24,$15,L.710 +l.d $f18,V +s.d $f18,Z +b L.711 +L.710: +l.d $f18,V0 +s.d $f18,Z +L.711: +l.d $f12,Z +jal sqrt +s.d $f0,V9 +l.d $f18,V9 +l.d $f16,One +l.d $f10,Radix +l.d $f8,E9 +mul.d $f10,$f10,$f8 +sub.d $f16,$f16,$f10 +mul.d $f16,$f16,$f18 +s.d $f16,X +l.d $f16,X +mul.d $f18,$f18,$f16 +s.d $f18,V9 +l.d $f18,V9 +l.d $f16,Z +l.d $f10,One +l.d $f8,Two +l.d $f6,Radix +mul.d $f8,$f8,$f6 +l.d $f6,E9 +mul.d $f8,$f8,$f6 +sub.d $f10,$f10,$f8 +mul.d $f10,$f10,$f16 +c.ult.d $f18,$f10; bc1t L.714 +c.ule.d $f18,$f16; bc1t L.712 +L.714: +l.d $f18,V9 +s.d $f18,Y +l.d $f18,X +l.d $f16,W +c.lt.d $f18,$f16; bc1f L.715 +la $4,1 +la $5,L.157 +jal BadCond +b L.716 +L.715: +la $4,2 +la $5,L.157 +jal BadCond +L.716: +la $4,L.717 +l.d $f18,Z +mfc1.d $6,$f18 +jal printf +la $4,L.718 +l.d $f18,Y +mfc1.d $6,$f18 +jal printf +L.712: +L.707: +lw $24,Indx +la $24,1($24) +sw $24,Indx +lw $24,Indx +la $15,2 +ble $24,$15,L.706 +la $24,190 +sw $24,Milestone +jal Pause +l.d $f18,UfThold +l.d $f16,V +mul.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,Radix +mul.d $f18,$f18,$f18 +s.d $f18,Y +l.d $f18,X +l.d $f16,Y +mul.d $f10,$f18,$f16 +l.d $f8,One +c.ult.d $f10,$f8; bc1t L.721 +c.ule.d $f18,$f16; bc1t L.719 +L.721: +l.d $f18,X +l.d $f16,Y +l.d $f10,U1 +mul.d $f8,$f18,$f16 +c.ult.d $f8,$f10; bc1t L.724 +div.d $f16,$f16,$f10 +c.ule.d $f18,$f16; bc1t L.722 +L.724: +la $4,2 +la $5,L.725 +jal BadCond +b L.723 +L.722: +la $4,3 +la $5,L.157 +jal BadCond +L.723: +la $4,L.726 +l.d $f18,X +mfc1.d $6,$f18 +la $24,L.727 +sw $24,16($sp) +jal printf +L.719: +la $24,200 +sw $24,Milestone +la $24,1 +sw $24,Indx +L.728: +l.d $f18,F9 +s.d $f18,X +lw $24,Indx +la $15,2 +blt $24,$15,L.732 +la $15,5 +bgt $24,$15,L.732 +sll $24,$24,2 +lw $24,L.738-8($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.738: +.gpword L.734 +.gpword L.735 +.gpword L.736 +.gpword L.737 +.text +L.734: +l.d $f18,One +l.d $f16,U2 +add.d $f18,$f18,$f16 +s.d $f18,X +b L.733 +L.735: +l.d $f18,V +s.d $f18,X +b L.733 +L.736: +l.d $f18,UfThold +s.d $f18,X +b L.733 +L.737: +l.d $f18,Radix +s.d $f18,X +L.732: +L.733: +l.d $f18,X +s.d $f18,Y +la $24,sigfpe +sw $24,sigsave +la $4,ovfl_buf +jal setjmp +beq $2,$0,L.740 +la $4,L.742 +l.d $f18,X +mfc1.d $6,$f18 +jal printf +b L.741 +L.740: +l.d $f18,Half +l.d $f16,Y +l.d $f10,X +div.d $f16,$f16,$f10 +sub.d $f16,$f16,$f18 +sub.d $f18,$f16,$f18 +s.d $f18,V9 +l.d $f18,V9 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.743 +b L.729 +L.743: +l.d $f18,V9 +l.d $f16,U1 +neg.d $f16,$f16 +c.eq.d $f18,$f16; bc1f L.745 +lw $24,Indx +la $15,5 +bge $24,$15,L.745 +la $4,3 +la $5,L.157 +jal BadCond +b L.746 +L.745: +la $4,1 +la $5,L.157 +jal BadCond +L.746: +la $4,L.747 +l.d $f18,X +mfc1.d $6,$f18 +jal printf +la $4,L.748 +l.d $f18,V9 +mfc1.d $6,$f18 +jal printf +L.741: +sw $0,sigsave +L.729: +lw $24,Indx +la $24,1($24) +sw $24,Indx +lw $24,Indx +la $15,5 +ble $24,$15,L.728 +la $24,210 +sw $24,Milestone +l.d $f18,Zero +s.d $f18,MyZero +la $4,L.44 +jal printf +la $4,L.749 +jal printf +la $24,sigfpe +sw $24,sigsave +la $4,L.750 +jal printf +la $4,ovfl_buf +jal setjmp +bne $2,$0,L.751 +la $4,L.753 +l.d $f18,One +l.d $f16,MyZero +div.d $f18,$f18,$f16 +mfc1.d $6,$f18 +jal printf +L.751: +sw $0,sigsave +la $24,sigfpe +sw $24,sigsave +la $4,L.754 +jal printf +la $4,ovfl_buf +jal setjmp +bne $2,$0,L.755 +la $4,L.753 +l.d $f18,Zero +l.d $f16,MyZero +div.d $f18,$f18,$f16 +mfc1.d $6,$f18 +jal printf +L.755: +sw $0,sigsave +la $24,220 +sw $24,Milestone +jal Pause +la $4,L.44 +jal printf +sw $0,-156+240($sp) +L.762: +lw $24,-156+240($sp) +sll $24,$24,2 +lw $24,ErrCnt($24) +beq $24,$0,L.766 +la $4,L.768 +lw $24,-156+240($sp) +sll $24,$24,2 +lw $5,L.757($24) +lw $6,ErrCnt($24) +jal printf +L.766: +L.763: +lw $24,-156+240($sp) +la $24,1($24) +sw $24,-156+240($sp) +lw $24,-156+240($sp) +la $15,4 +blt $24,$15,L.762 +la $4,L.44 +jal printf +lw $24,ErrCnt +lw $15,ErrCnt+4 +addu $24,$24,$15 +lw $15,ErrCnt+8 +addu $24,$24,$15 +lw $15,ErrCnt+12 +addu $24,$24,$15 +ble $24,$0,L.769 +lw $15,ErrCnt +lw $14,ErrCnt+4 +addu $15,$15,$14 +lw $14,ErrCnt+8 +addu $15,$15,$14 +bne $15,$0,L.774 +lw $15,ErrCnt+12 +ble $15,$0,L.774 +la $4,L.779 +jal printf +la $4,L.780 +jal printf +L.774: +lw $15,ErrCnt +lw $14,ErrCnt+4 +addu $15,$15,$14 +bne $15,$0,L.781 +lw $15,ErrCnt+8 +ble $15,$0,L.781 +la $4,L.785 +jal printf +la $4,L.786 +jal printf +L.781: +lw $24,ErrCnt +lw $15,ErrCnt+4 +addu $24,$24,$15 +ble $24,$0,L.787 +la $4,L.790 +jal printf +la $4,L.791 +jal printf +L.787: +lw $24,ErrCnt +ble $24,$0,L.770 +la $4,L.794 +jal printf +la $4,L.795 +jal printf +b L.770 +L.769: +la $4,L.796 +jal printf +la $24,1 +lw $15,RMult +bne $15,$24,L.801 +lw $15,RDiv +bne $15,$24,L.801 +lw $15,RAddSub +bne $15,$24,L.801 +lw $15,RSqrt +beq $15,$24,L.797 +L.801: +la $4,L.802 +jal printf +b L.798 +L.797: +l.d $f18,One +l.d $f16,StickyBit +c.ult.d $f16,$f18; bc1t L.803 +l.d $f16,Radix +l.d $f10,Two +sub.d $f10,$f16,$f10 +l.d $f8,Nine +sub.d $f16,$f16,$f8 +sub.d $f18,$f16,$f18 +mul.d $f18,$f10,$f18 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.803 +la $4,L.805 +jal printf +la $4,L.806 +jal printf +l.d $f18,Two +l.d $f16,Radix +c.eq.d $f16,$f18; bc1f L.807 +l.d $f16,Precision +l.d $f10,TwentySeven +l.d $f8,Four +l.d $f6,Three +mul.d $f8,$f8,$f6 +mul.d $f18,$f8,$f18 +sub.d $f18,$f16,$f18 +sub.d $f16,$f16,$f10 +sub.d $f16,$f16,$f10 +l.d $f10,One +add.d $f16,$f16,$f10 +mul.d $f18,$f18,$f16 +l.d $f16,Zero +c.eq.d $f18,$f16; bc1f L.807 +la $4,L.809 +jal printf +b L.808 +L.807: +la $4,L.810 +jal printf +L.808: +lw $24,IEEE +beq $24,$0,L.811 +la $4,L.813 +jal printf +b L.812 +L.811: +la $4,L.814 +jal printf +la $4,L.815 +jal printf +L.812: +L.803: +la $4,L.816 +jal printf +L.798: +L.770: +lw $24,fpecount +beq $24,$0,L.817 +la $4,L.819 +lw $5,fpecount +jal printf +L.817: +la $4,L.820 +jal printf +move $2,$0 +L.6: +lw $16,32($sp) +lw $17,36($sp) +lw $18,40($sp) +lw $19,44($sp) +lw $20,48($sp) +lw $21,52($sp) +lw $22,56($sp) +lw $23,60($sp) +lw $25,64($sp) +lw $30,68($sp) +lw $31,72($sp) +addu $sp,$sp,240 +j $31 +.end main +.globl Sign +.text +.align 2 +.ent Sign +Sign: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +.fmask 0xc0000000,-16 +s.d $f30,0($sp) +l.d $f18,L.7 +c.ult.d $f12,$f18; bc1t L.823 +l.d $f30,L.8 +b L.824 +L.823: +l.d $f30,L.825 +L.824: +mov.d $f0,$f30 +L.821: +l.d $f30,0($sp) +addu $sp,$sp,16 +j $31 +.end Sign +.globl Pause +.text +.align 2 +.ent Pause +Pause: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +la $4,L.827 +lw $5,Milestone +jal printf +la $4,L.828 +lw $5,PageNo +jal printf +lw $24,Milestone +la $24,1($24) +sw $24,Milestone +lw $24,PageNo +la $24,1($24) +sw $24,PageNo +move $2,$0 +L.826: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end Pause +.globl TstCond +.text +.align 2 +.ent TstCond +TstCond: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +sw $5,36($sp) +sw $6,40($sp) +lw $24,4+32($sp) +bne $24,$0,L.830 +lw $4,0+32($sp) +lw $5,8+32($sp) +jal BadCond +la $4,L.813 +jal printf +L.830: +move $2,$0 +L.829: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end TstCond +.data +.align 2 +L.833: +.word L.834 +.word L.835 +.word L.836 +.word L.837 +.globl BadCond +.text +.text +.align 2 +.ent BadCond +BadCond: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +move $30,$4 +sw $5,36($sp) +sll $24,$30,2 +la $24,ErrCnt($24) +lw $15,($24) +la $15,1($15) +sw $15,($24) +la $4,L.838 +sll $24,$30,2 +lw $5,L.833($24) +lw $6,4+32($sp) +jal printf +move $2,$0 +L.832: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end BadCond +.globl Random +.text +.align 2 +.ent Random +Random: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.fmask 0xf0000000,-24 +.mask 0x82000000,-12 +s.d $f28,16($sp) +s.d $f30,24($sp) +.cprestore 32 +sw $31,36($sp) +l.d $f18,Random1 +l.d $f16,Random9 +add.d $f30,$f18,$f16 +mul.d $f28,$f30,$f30 +mul.d $f28,$f28,$f28 +mul.d $f30,$f30,$f28 +mov.d $f12,$f30 +jal floor +sub.d $f28,$f30,$f0 +l.d $f18,L.840 +mul.d $f18,$f18,$f30 +add.d $f18,$f28,$f18 +s.d $f18,Random1 +l.d $f0,Random1 +L.839: +l.d $f28,16($sp) +l.d $f30,24($sp) +lw $25,32($sp) +lw $31,36($sp) +addu $sp,$sp,48 +j $31 +.end Random +.globl SqXMinX +.text +.align 2 +.ent SqXMinX +SqXMinX: +.frame $sp,64,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-64 +.fmask 0xc0000000,-32 +.mask 0x82000000,-20 +s.d $f30,32($sp) +.cprestore 40 +sw $31,44($sp) +sw $4,64($sp) +l.d $f18,X +l.d $f16,BInvrse +mul.d $f30,$f18,$f16 +sub.d $f16,$f18,$f30 +s.d $f16,-8+64($sp) +mul.d $f12,$f18,$f18 +jal sqrt +sub.d $f18,$f0,$f30 +l.d $f16,-8+64($sp) +sub.d $f18,$f18,$f16 +l.d $f16,OneUlp +div.d $f18,$f18,$f16 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.842 +l.d $f18,SqEr +l.d $f16,MinSqEr +c.lt.d $f18,$f16; bc1f L.844 +l.d $f18,SqEr +s.d $f18,MinSqEr +L.844: +l.d $f18,SqEr +l.d $f16,MaxSqEr +c.ule.d $f18,$f16; bc1t L.846 +l.d $f18,SqEr +s.d $f18,MaxSqEr +L.846: +l.d $f18,J +l.d $f16,L.8 +add.d $f18,$f18,$f16 +s.d $f18,J +lw $4,0+64($sp) +la $5,L.44 +jal BadCond +la $4,L.848 +l.d $f18,X +mul.d $f16,$f18,$f18 +mfc1.d $6,$f16 +s.d $f18,16($sp) +l.d $f18,OneUlp +l.d $f16,SqEr +mul.d $f18,$f18,$f16 +s.d $f18,24($sp) +jal printf +la $4,L.849 +jal printf +L.842: +move $2,$0 +L.841: +l.d $f30,32($sp) +lw $25,40($sp) +lw $31,44($sp) +addu $sp,$sp,64 +j $31 +.end SqXMinX +.globl NewD +.text +.align 2 +.ent NewD +NewD: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +l.d $f18,Z1 +l.d $f16,Q +mul.d $f18,$f18,$f16 +s.d $f18,X +l.d $f18,Half +l.d $f16,X +l.d $f10,Radix +div.d $f16,$f16,$f10 +sub.d $f12,$f18,$f16 +jal floor +l.d $f16,Radix +mul.d $f18,$f0,$f16 +l.d $f10,X +add.d $f18,$f18,$f10 +s.d $f18,X +l.d $f18,X +l.d $f10,Z +l.d $f8,D +l.d $f6,Q +mul.d $f4,$f18,$f10 +sub.d $f6,$f6,$f4 +div.d $f6,$f6,$f16 +mul.d $f4,$f18,$f18 +div.d $f16,$f8,$f16 +mul.d $f16,$f4,$f16 +add.d $f16,$f6,$f16 +s.d $f16,Q +l.d $f16,Two +mul.d $f18,$f16,$f18 +mul.d $f18,$f18,$f8 +sub.d $f18,$f10,$f18 +s.d $f18,Z +l.d $f18,Z +l.d $f16,Zero +c.le.d $f18,$f16; bc1f L.851 +l.d $f18,Z +neg.d $f18,$f18 +s.d $f18,Z +l.d $f18,Z1 +neg.d $f18,$f18 +s.d $f18,Z1 +L.851: +l.d $f18,Radix +l.d $f16,D +mul.d $f18,$f18,$f16 +s.d $f18,D +move $2,$0 +L.850: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end NewD +.globl SR3750 +.text +.align 2 +.ent SR3750 +SR3750: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +l.d $f18,X +l.d $f16,Radix +l.d $f10,Z2 +sub.d $f8,$f18,$f16 +sub.d $f16,$f10,$f16 +c.ult.d $f8,$f16; bc1t L.854 +sub.d $f18,$f18,$f10 +l.d $f16,W +sub.d $f16,$f16,$f10 +c.le.d $f18,$f16; bc1f L.854 +lw $24,I +la $24,1($24) +sw $24,I +l.d $f18,X +l.d $f16,D +mul.d $f12,$f18,$f16 +jal sqrt +s.d $f0,X2 +l.d $f18,Z2 +l.d $f16,Y +l.d $f10,X2 +sub.d $f10,$f10,$f18 +sub.d $f18,$f16,$f18 +sub.d $f18,$f10,$f18 +s.d $f18,Y2 +l.d $f18,Half +l.d $f10,X8 +sub.d $f16,$f16,$f18 +div.d $f16,$f10,$f16 +s.d $f16,X2 +l.d $f16,X2 +mul.d $f10,$f18,$f16 +mul.d $f10,$f10,$f16 +sub.d $f16,$f16,$f10 +s.d $f16,X2 +l.d $f16,Y2 +add.d $f16,$f16,$f18 +l.d $f10,X2 +sub.d $f18,$f18,$f10 +add.d $f18,$f16,$f18 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,MinSqEr +c.lt.d $f18,$f16; bc1f L.856 +l.d $f18,SqEr +s.d $f18,MinSqEr +L.856: +l.d $f18,Y2 +l.d $f16,X2 +sub.d $f18,$f18,$f16 +s.d $f18,SqEr +l.d $f18,SqEr +l.d $f16,MaxSqEr +c.ule.d $f18,$f16; bc1t L.858 +l.d $f18,SqEr +s.d $f18,MaxSqEr +L.858: +L.854: +move $2,$0 +L.853: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end SR3750 +.globl IsYeqX +.text +.align 2 +.ent IsYeqX +IsYeqX: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-4 +.cprestore 24 +sw $31,28($sp) +l.d $f18,Y +l.d $f16,X +c.eq.d $f18,$f16; bc1t L.861 +lw $24,N +bgt $24,$0,L.863 +l.d $f18,Zero +l.d $f16,Z +c.eq.d $f16,$f18; bc1f L.865 +l.d $f16,Q +c.le.d $f16,$f18; bc1f L.865 +la $4,L.867 +jal printf +b L.866 +L.865: +la $4,2 +la $5,L.868 +jal BadCond +L.866: +la $4,L.869 +l.d $f18,Z +mfc1.d $6,$f18 +l.d $f18,Q +s.d $f18,16($sp) +jal printf +la $4,L.870 +l.d $f18,Y +mfc1.d $6,$f18 +jal printf +la $4,L.871 +l.d $f18,X +mfc1.d $6,$f18 +jal printf +la $4,L.872 +l.d $f18,Y +l.d $f16,X +sub.d $f18,$f18,$f16 +mfc1.d $6,$f18 +jal printf +L.863: +lw $24,N +la $24,1($24) +sw $24,N +L.861: +move $2,$0 +L.860: +lw $25,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end IsYeqX +.globl SR3980 +.text +.align 2 +.ent SR3980 +SR3980: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +L.874: +lw $24,I +mtc1 $24,$f18; cvt.d.w $f18,$f18 +s.d $f18,Q +l.d $f12,Z +l.d $f14,Q +jal pow +s.d $f0,Y +jal IsYeqX +lw $24,I +la $24,1($24) +sw $24,I +lw $15,M +ble $24,$15,L.877 +b L.876 +L.877: +l.d $f18,Z +l.d $f16,X +mul.d $f18,$f18,$f16 +s.d $f18,X +L.875: +l.d $f18,X +l.d $f16,W +c.ult.d $f18,$f16; bc1t L.874 +L.876: +move $2,$0 +L.873: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end SR3980 +.globl PrintIfNPositive +.text +.align 2 +.ent PrintIfNPositive +PrintIfNPositive: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +lw $24,N +ble $24,$0,L.880 +la $4,L.882 +lw $5,N +jal printf +L.880: +move $2,$0 +L.879: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end PrintIfNPositive +.globl TstPtUf +.text +.align 2 +.ent TstPtUf +TstPtUf: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $0,N +l.d $f18,Z +l.d $f16,Zero +c.eq.d $f18,$f16; bc1t L.884 +la $4,L.886 +jal printf +la $4,L.887 +jal printf +la $24,sigfpe +sw $24,sigsave +la $4,ovfl_buf +jal setjmp +beq $2,$0,L.888 +b L.890 +L.888: +l.d $f18,Z +add.d $f16,$f18,$f18 +div.d $f18,$f16,$f18 +s.d $f18,Q9 +la $4,L.891 +l.d $f18,Q9 +mfc1.d $6,$f18 +jal printf +l.d $f18,Q9 +l.d $f16,Two +sub.d $f12,$f18,$f16 +jal fabs +l.d $f16,Radix +l.d $f10,U2 +mul.d $f16,$f16,$f10 +c.lt.d $f0,$f16; bc1f L.892 +la $4,L.894 +jal printf +la $4,L.895 +jal printf +b L.893 +L.892: +l.d $f18,Q9 +l.d $f16,One +c.ult.d $f18,$f16; bc1t L.898 +l.d $f16,Two +c.ule.d $f18,$f16; bc1t L.896 +L.898: +L.890: +la $24,1 +sw $24,N +lw $24,ErrCnt+4 +la $24,1($24) +sw $24,ErrCnt+4 +la $4,L.901 +jal printf +b L.897 +L.896: +la $24,1 +sw $24,N +lw $24,ErrCnt+8 +la $24,1($24) +sw $24,ErrCnt+8 +la $4,L.904 +jal printf +L.897: +L.893: +sw $0,sigsave +l.d $f18,Z +l.d $f16,One +mul.d $f10,$f18,$f16 +s.d $f10,V9 +l.d $f10,V9 +s.d $f10,Random1 +mul.d $f10,$f16,$f18 +s.d $f10,V9 +l.d $f10,V9 +s.d $f10,Random2 +div.d $f18,$f18,$f16 +s.d $f18,V9 +l.d $f18,Z +l.d $f16,Random1 +c.eq.d $f18,$f16; bc1f L.905 +l.d $f16,Random2 +c.eq.d $f18,$f16; bc1f L.905 +l.d $f16,V9 +c.eq.d $f18,$f16; bc1f L.905 +lw $24,N +ble $24,$0,L.906 +jal Pause +b L.906 +L.905: +la $24,1 +sw $24,N +la $4,2 +la $5,L.909 +jal BadCond +la $4,L.910 +l.d $f18,Z +mfc1.d $6,$f18 +jal printf +l.d $f18,Z +l.d $f16,Random1 +c.eq.d $f18,$f16; bc1t L.911 +la $4,L.913 +l.d $f18,Random1 +mfc1.d $6,$f18 +jal printf +L.911: +l.d $f18,Random2 +l.d $f16,Z +c.eq.d $f16,$f18; bc1t L.914 +l.d $f16,Random1 +c.eq.d $f18,$f16; bc1t L.914 +la $4,L.916 +l.d $f18,Random2 +mfc1.d $6,$f18 +jal printf +L.914: +l.d $f18,Z +l.d $f16,V9 +c.eq.d $f18,$f16; bc1t L.917 +la $4,L.919 +l.d $f18,V9 +mfc1.d $6,$f18 +jal printf +L.917: +l.d $f18,Random2 +l.d $f16,Random1 +c.eq.d $f18,$f16; bc1t L.920 +lw $24,ErrCnt+8 +la $24,1($24) +sw $24,ErrCnt+8 +la $4,2 +la $5,L.924 +jal BadCond +la $4,L.925 +l.d $f18,Random2 +mfc1.d $6,$f18 +jal printf +la $4,L.926 +l.d $f18,Random1 +mfc1.d $6,$f18 +jal printf +L.920: +jal Pause +L.906: +L.884: +move $2,$0 +L.883: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end TstPtUf +.globl notify +.text +.align 2 +.ent notify +notify: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +la $4,L.928 +lw $5,0+32($sp) +jal printf +la $4,L.929 +jal printf +move $2,$0 +L.927: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end notify +.globl msglist +.text +.align 2 +.ent msglist +msglist: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +move $30,$4 +b L.932 +L.931: +la $4,L.934 +move $24,$30 +la $30,4($24) +lw $5,($24) +jal printf +L.932: +lw $24,($30) +bne $24,$0,L.931 +move $2,$0 +L.930: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end msglist +.data +.align 2 +L.936: +.word L.937 +.word L.938 +.word L.939 +.word L.940 +.word L.941 +.word L.942 +.word L.943 +.word L.944 +.word L.945 +.word 0x0 +.globl Instructions +.text +.text +.align 2 +.ent Instructions +Instructions: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +la $4,L.936 +jal msglist +move $2,$0 +L.935: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end Instructions +.data +.align 2 +L.947: +.word L.948 +.word L.949 +.word L.950 +.word L.951 +.word L.952 +.word L.953 +.word L.954 +.word L.955 +.word L.956 +.word L.957 +.word L.958 +.word L.959 +.word L.960 +.word L.961 +.word 0x0 +.globl Heading +.text +.text +.align 2 +.ent Heading +Heading: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +la $4,L.947 +jal msglist +move $2,$0 +L.946: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end Heading +.data +.align 2 +L.963: +.word L.964 +.word L.965 +.word L.966 +.word L.967 +.word L.968 +.word L.969 +.word L.970 +.word L.971 +.word L.972 +.word L.973 +.word L.974 +.word L.975 +.word L.976 +.word L.977 +.word L.978 +.word L.979 +.word L.980 +.word L.981 +.word L.982 +.word 0x0 +.globl Characteristics +.text +.text +.align 2 +.ent Characteristics +Characteristics: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +la $4,L.963 +jal msglist +move $2,$0 +L.962: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end Characteristics +.data +.align 2 +L.984: +.word L.985 +.word L.986 +.word L.987 +.word L.988 +.word L.989 +.word L.990 +.word L.991 +.word L.992 +.word L.993 +.word L.994 +.word L.995 +.word L.996 +.word L.997 +.word L.998 +.word L.999 +.word L.1000 +.word L.1001 +.word 0x0 +.globl History +.text +.text +.align 2 +.ent History +History: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +la $4,L.984 +jal msglist +move $2,$0 +L.983: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end History +.globl pow +.text +.align 2 +.ent pow +pow: +.frame $sp,80,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-80 +.fmask 0xfc000000,-48 +.mask 0xc2800000,-28 +s.d $f26,16($sp) +s.d $f28,24($sp) +s.d $f30,32($sp) +sw $23,40($sp) +.cprestore 44 +sw $30,48($sp) +sw $31,52($sp) +mov.d $f30,$f12 +mov.d $f28,$f14 +move $23,$0 +sw $0,-8+80($sp) +l.d $f18,L.7 +c.eq.d $f28,$f18; bc1f L.1003 +l.d $f0,L.8 +b L.1002 +L.1003: +l.d $f18,L.1008 +c.ult.d $f28,$f18; bc1t L.1007 +l.d $f18,L.1009 +c.ule.d $f28,$f18; bc1t L.1005 +L.1007: +l.d $f18,L.825 +c.eq.d $f30,$f18; bc1t L.1005 +mov.d $f12,$f30 +jal log +mov.d $f18,$f0 +mul.d $f12,$f28,$f18 +jal exp +mov.d $f18,$f0 +b L.1002 +L.1005: +l.d $f18,L.7 +c.lt.d $f28,$f18; bc1f L.1010 +neg.d $f28,$f28 +la $24,1 +sw $24,-8+80($sp) +L.1010: +mov.d $f12,$f28 +la $6,-16+80($sp) +jal modf +mov.d $f28,$f0 +l.d $f18,L.7 +c.eq.d $f28,$f18; bc1t L.1012 +mov.d $f12,$f30 +jal log +mov.d $f18,$f0 +mul.d $f12,$f28,$f18 +jal exp +mov.d $f26,$f0 +b L.1013 +L.1012: +l.d $f26,L.8 +L.1013: +mov.d $f12,$f30 +la $6,-4+80($sp) +jal frexp +mov.d $f30,$f0 +l.d $f18,-16+80($sp) +trunc.w.d $f2,$f18,$24; mfc1 $24,$f2 +move $30,$24 +beq $24,$0,L.1014 +L.1016: +and $24,$30,1 +beq $24,$0,L.1020 +mul.d $f26,$f26,$f30 +lw $24,-4+80($sp) +addu $23,$23,$24 +L.1020: +sra $24,$30,1 +move $30,$24 +bne $24,$0,L.1022 +b L.1018 +L.1022: +mul.d $f30,$f30,$f30 +lw $24,-4+80($sp) +sll $24,$24,1 +sw $24,-4+80($sp) +l.d $f18,L.1026 +c.lt.d $f30,$f18; bc1f L.1016 +l.d $f18,L.1027 +mul.d $f30,$f18,$f30 +lw $24,-4+80($sp) +subu $24,$24,1 +sw $24,-4+80($sp) +b L.1016 +L.1018: +L.1014: +lw $24,-8+80($sp) +beq $24,$0,L.1028 +l.d $f18,L.8 +div.d $f26,$f18,$f26 +negu $23,$23 +L.1028: +mov.d $f12,$f26 +move $6,$23 +jal ldexp +mov.d $f18,$f0 +L.1002: +l.d $f26,16($sp) +l.d $f28,24($sp) +l.d $f30,32($sp) +lw $23,40($sp) +lw $25,44($sp) +lw $30,48($sp) +lw $31,52($sp) +addu $sp,$sp,80 +j $31 +.end pow +.globl UfNGrad +.comm UfNGrad,4 +.globl SqRWrng +.comm SqRWrng,4 +.globl IEEE +.comm IEEE,4 +.globl Anomaly +.comm Anomaly,4 +.globl Monot +.comm Monot,4 +.globl NotMonot +.comm NotMonot,4 +.globl Done +.comm Done,4 +.globl Break +.comm Break,4 +.globl RSqrt +.comm RSqrt,4 +.globl RAddSub +.comm RAddSub,4 +.globl RDiv +.comm RDiv,4 +.globl RMult +.comm RMult,4 +.globl GAddSub +.comm GAddSub,4 +.globl GDiv +.comm GDiv,4 +.globl GMult +.comm GMult,4 +.globl N1 +.comm N1,4 +.globl N +.comm N,4 +.globl M +.comm M,4 +.globl PageNo +.comm PageNo,4 +.globl Milestone +.comm Milestone,4 +.globl fpecount +.comm fpecount,4 +.globl ErrCnt +.comm ErrCnt,16 +.globl Z9 +.comm Z9,8 +.globl Z2 +.comm Z2,8 +.globl Z1 +.comm Z1,8 +.globl PseudoZero +.comm PseudoZero,8 +.globl Z +.comm Z,8 +.globl Random2 +.comm Random2,8 +.globl Y2 +.comm Y2,8 +.globl Y1 +.comm Y1,8 +.globl Y +.comm Y,8 +.globl Random1 +.comm Random1,8 +.globl X8 +.comm X8,8 +.globl X2 +.comm X2,8 +.globl X1 +.comm X1,8 +.globl X +.comm X,8 +.globl W +.comm W,8 +.globl V9 +.comm V9,8 +.globl V0 +.comm V0,8 +.globl V +.comm V,8 +.globl U2 +.comm U2,8 +.globl U1 +.comm U1,8 +.globl UfThold +.comm UfThold,8 +.globl OneUlp +.comm OneUlp,8 +.globl S +.comm S,8 +.globl Underflow +.comm Underflow,8 +.globl T +.comm T,8 +.globl Random9 +.comm Random9,8 +.globl R +.comm R,8 +.globl Q9 +.comm Q9,8 +.globl Q +.comm Q,8 +.globl Precision +.comm Precision,8 +.globl MyZero +.comm MyZero,8 +.globl J +.comm J,8 +.globl StickyBit +.comm StickyBit,8 +.globl I +.comm I,4 +.globl HInvrse +.comm HInvrse,8 +.globl H +.comm H,8 +.globl F9 +.comm F9,8 +.globl F6 +.comm F6,8 +.globl Third +.comm Third,8 +.globl E9 +.comm E9,8 +.globl MaxSqEr +.comm MaxSqEr,8 +.globl SqEr +.comm SqEr,8 +.globl MinSqEr +.comm MinSqEr,8 +.globl E3 +.comm E3,8 +.globl Exp2 +.comm Exp2,8 +.globl E1 +.comm E1,8 +.globl E0 +.comm E0,8 +.globl FourD +.comm FourD,8 +.globl D +.comm D,8 +.globl CInvrse +.comm CInvrse,8 +.globl C +.comm C,8 +.globl A1 +.comm A1,8 +.globl AInvrse +.comm AInvrse,8 +.globl ch +.comm ch,8 +.globl Indx +.comm Indx,4 +.globl BMinusU2 +.comm BMinusU2,8 +.globl RadixD2 +.comm RadixD2,8 +.globl BInvrse +.comm BInvrse,8 +.globl Radix +.comm Radix,8 +.globl sigsave +.comm sigsave,4 +.globl ovfl_buf +.comm ovfl_buf,112 +.extern _iob 0 +.rdata +.align 3 +L.1027: +.word 0x40000000 +.word 0x0 +.align 3 +L.1026: +.word 0x3fe00000 +.word 0x0 +.align 3 +L.1009: +.word 0x40913000 +.word 0x0 +.align 3 +L.1008: +.word 0xc0913000 +.word 0x0 +.align 0 +L.1001: +.byte 115 +.byte 101 +.byte 101 +.byte 32 +.byte 115 +.byte 111 +.byte 117 +.byte 114 +.byte 99 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 109 +.byte 111 +.byte 114 +.byte 101 +.byte 32 +.byte 104 +.byte 105 +.byte 115 +.byte 116 +.byte 111 +.byte 114 +.byte 121 +.byte 46 +.byte 0 +.align 0 +L.1000: +.byte 66 +.byte 65 +.byte 83 +.byte 73 +.byte 67 +.byte 32 +.byte 118 +.byte 101 +.byte 114 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 40 +.byte 67 +.byte 41 +.byte 32 +.byte 49 +.byte 57 +.byte 56 +.byte 51 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 80 +.byte 114 +.byte 111 +.byte 102 +.byte 46 +.byte 32 +.byte 87 +.byte 46 +.byte 32 +.byte 77 +.byte 46 +.byte 32 +.byte 75 +.byte 97 +.byte 104 +.byte 97 +.byte 110 +.byte 59 +.byte 0 +.align 0 +L.999: +.byte 97 +.byte 115 +.byte 32 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 99 +.byte 101 +.byte 114 +.byte 116 +.byte 97 +.byte 105 +.byte 110 +.byte 32 +.byte 101 +.byte 97 +.byte 114 +.byte 108 +.byte 121 +.byte 32 +.byte 87 +.byte 65 +.byte 78 +.byte 71 +.byte 32 +.byte 109 +.byte 97 +.byte 99 +.byte 104 +.byte 105 +.byte 110 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.998: +.byte 102 +.byte 108 +.byte 111 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 45 +.byte 112 +.byte 111 +.byte 105 +.byte 110 +.byte 116 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 115 +.byte 44 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 108 +.byte 115 +.byte 111 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 111 +.byte 119 +.byte 115 +.byte 32 +.byte 108 +.byte 111 +.byte 103 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 105 +.byte 99 +.byte 32 +.byte 101 +.byte 110 +.byte 99 +.byte 111 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 0 +.align 0 +L.997: +.byte 10 +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 98 +.byte 97 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 117 +.byte 112 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 118 +.byte 101 +.byte 110 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 114 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 114 +.byte 101 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 101 +.byte 110 +.byte 116 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 0 +.align 0 +L.996: +.byte 111 +.byte 102 +.byte 32 +.byte 112 +.byte 97 +.byte 116 +.byte 104 +.byte 111 +.byte 108 +.byte 111 +.byte 103 +.byte 105 +.byte 101 +.byte 115 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 115 +.byte 97 +.byte 121 +.byte 32 +.byte 104 +.byte 111 +.byte 119 +.byte 32 +.byte 119 +.byte 101 +.byte 108 +.byte 108 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 109 +.byte 112 +.byte 108 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 0 +L.995: +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 44 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 116 +.byte 114 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 112 +.byte 101 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 97 +.byte 32 +.byte 119 +.byte 105 +.byte 100 +.byte 101 +.byte 114 +.byte 32 +.byte 118 +.byte 97 +.byte 114 +.byte 105 +.byte 101 +.byte 116 +.byte 121 +.byte 0 +.align 0 +L.994: +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 44 +.byte 32 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 114 +.byte 97 +.byte 110 +.byte 103 +.byte 101 +.byte 32 +.byte 40 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 47 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 115 +.byte 41 +.byte 0 +.align 0 +L.993: +.byte 87 +.byte 46 +.byte 32 +.byte 74 +.byte 46 +.byte 32 +.byte 67 +.byte 111 +.byte 100 +.byte 121 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 87 +.byte 46 +.byte 32 +.byte 87 +.byte 97 +.byte 105 +.byte 116 +.byte 101 +.byte 46 +.byte 32 +.byte 65 +.byte 108 +.byte 116 +.byte 104 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 32 +.byte 98 +.byte 111 +.byte 116 +.byte 104 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 115 +.byte 32 +.byte 116 +.byte 114 +.byte 121 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 0 +.align 0 +L.992: +.byte 98 +.byte 111 +.byte 111 +.byte 107 +.byte 32 +.byte 32 +.byte 96 +.byte 83 +.byte 111 +.byte 102 +.byte 116 +.byte 119 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 77 +.byte 97 +.byte 110 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 69 +.byte 108 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 97 +.byte 114 +.byte 121 +.byte 32 +.byte 70 +.byte 117 +.byte 110 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 39 +.byte 32 +.byte 40 +.byte 49 +.byte 57 +.byte 56 +.byte 48 +.byte 41 +.byte 32 +.byte 98 +.byte 121 +.byte 0 +.align 0 +L.991: +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 99 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 100 +.byte 32 +.byte 96 +.byte 77 +.byte 65 +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 39 +.byte 44 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 101 +.byte 110 +.byte 100 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 0 +.align 0 +L.990: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 99 +.byte 97 +.byte 112 +.byte 97 +.byte 98 +.byte 105 +.byte 108 +.byte 105 +.byte 116 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 103 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 121 +.byte 111 +.byte 110 +.byte 100 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 101 +.byte 97 +.byte 114 +.byte 108 +.byte 105 +.byte 101 +.byte 114 +.byte 0 +.align 0 +L.989: +.byte 70 +.byte 97 +.byte 105 +.byte 108 +.byte 117 +.byte 114 +.byte 101 +.byte 115 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 115 +.byte 101 +.byte 113 +.byte 117 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.988: +.byte 32 +.byte 32 +.byte 32 +.byte 70 +.byte 65 +.byte 73 +.byte 76 +.byte 85 +.byte 82 +.byte 69 +.byte 115 +.byte 44 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 50 +.byte 43 +.byte 50 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 53 +.byte 32 +.byte 46 +.byte 0 +.align 0 +L.987: +.byte 32 +.byte 32 +.byte 32 +.byte 83 +.byte 101 +.byte 114 +.byte 105 +.byte 111 +.byte 117 +.byte 115 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 115 +.byte 44 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 97 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 0 +.align 0 +L.986: +.byte 32 +.byte 32 +.byte 32 +.byte 70 +.byte 76 +.byte 65 +.byte 87 +.byte 115 +.byte 44 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 97 +.byte 32 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 44 +.byte 0 +.align 0 +L.985: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 97 +.byte 116 +.byte 116 +.byte 101 +.byte 109 +.byte 112 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 114 +.byte 105 +.byte 109 +.byte 105 +.byte 110 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 97 +.byte 109 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 0 +L.982: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 68 +.byte 101 +.byte 99 +.byte 105 +.byte 109 +.byte 97 +.byte 108 +.byte 45 +.byte 66 +.byte 105 +.byte 110 +.byte 97 +.byte 114 +.byte 121 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 118 +.byte 101 +.byte 114 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 89 +.byte 69 +.byte 84 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 97 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 97 +.byte 99 +.byte 121 +.byte 46 +.byte 0 +.align 0 +L.981: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 69 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 45 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 101 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 101 +.byte 118 +.byte 101 +.byte 97 +.byte 108 +.byte 101 +.byte 100 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 89 +.byte 69 +.byte 84 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 0 +L.980: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 83 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 32 +.byte 32 +.byte 89 +.byte 94 +.byte 88 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 0 +L.979: +.byte 9 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 116 +.byte 97 +.byte 109 +.byte 105 +.byte 110 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 112 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 45 +.byte 122 +.byte 101 +.byte 114 +.byte 111 +.byte 115 +.byte 46 +.byte 0 +.align 0 +L.978: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 101 +.byte 99 +.byte 107 +.byte 101 +.byte 100 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 115 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 110 +.byte 99 +.byte 121 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 0 +L.977: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 86 +.byte 48 +.byte 32 +.byte 32 +.byte 116 +.byte 101 +.byte 108 +.byte 108 +.byte 115 +.byte 44 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 108 +.byte 121 +.byte 44 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 32 +.byte 73 +.byte 110 +.byte 102 +.byte 105 +.byte 110 +.byte 105 +.byte 116 +.byte 121 +.byte 32 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 114 +.byte 101 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 101 +.byte 110 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 0 +L.976: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 86 +.byte 32 +.byte 61 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 44 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 108 +.byte 121 +.byte 46 +.byte 0 +.align 0 +L.975: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 69 +.byte 48 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 80 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 116 +.byte 101 +.byte 108 +.byte 108 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 98 +.byte 114 +.byte 117 +.byte 112 +.byte 116 +.byte 44 +.byte 32 +.byte 103 +.byte 114 +.byte 97 +.byte 100 +.byte 117 +.byte 97 +.byte 108 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 117 +.byte 122 +.byte 122 +.byte 121 +.byte 46 +.byte 0 +.align 0 +L.974: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 84 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 61 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 46 +.byte 0 +.align 0 +L.973: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 87 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 97 +.byte 32 +.byte 83 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 66 +.byte 105 +.byte 116 +.byte 32 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 46 +.byte 0 +.align 0 +L.972: +.byte 9 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 46 +.byte 44 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 46 +.byte 44 +.byte 32 +.byte 65 +.byte 100 +.byte 100 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 46 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 83 +.byte 113 +.byte 114 +.byte 116 +.byte 46 +.byte 0 +.align 0 +L.971: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 87 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 44 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 115 +.byte 111 +.byte 109 +.byte 101 +.byte 116 +.byte 104 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 0 +.align 0 +L.970: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 65 +.byte 100 +.byte 101 +.byte 113 +.byte 117 +.byte 97 +.byte 99 +.byte 121 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 46 +.byte 44 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 46 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 46 +.byte 0 +.align 0 +L.969: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 49 +.byte 47 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 94 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 61 +.byte 32 +.byte 79 +.byte 110 +.byte 101 +.byte 32 +.byte 85 +.byte 108 +.byte 112 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 108 +.byte 105 +.byte 116 +.byte 116 +.byte 108 +.byte 101 +.byte 32 +.byte 108 +.byte 101 +.byte 115 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 49 +.byte 46 +.byte 48 +.byte 32 +.byte 46 +.byte 0 +.align 0 +L.968: +.byte 9 +.byte 40 +.byte 79 +.byte 110 +.byte 101 +.byte 85 +.byte 108 +.byte 112 +.byte 110 +.byte 105 +.byte 116 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 76 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 80 +.byte 108 +.byte 97 +.byte 99 +.byte 101 +.byte 41 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 49 +.byte 46 +.byte 48 +.byte 48 +.byte 48 +.byte 120 +.byte 120 +.byte 120 +.byte 32 +.byte 46 +.byte 0 +.align 0 +L.967: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 85 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 47 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 94 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 61 +.byte 32 +.byte 79 +.byte 110 +.byte 101 +.byte 32 +.byte 85 +.byte 108 +.byte 112 +.byte 0 +.align 0 +L.966: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 61 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 105 +.byte 102 +.byte 105 +.byte 99 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 99 +.byte 97 +.byte 114 +.byte 114 +.byte 105 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 0 +L.965: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 49 +.byte 44 +.byte 32 +.byte 50 +.byte 44 +.byte 32 +.byte 52 +.byte 44 +.byte 32 +.byte 56 +.byte 44 +.byte 32 +.byte 49 +.byte 48 +.byte 44 +.byte 32 +.byte 49 +.byte 54 +.byte 44 +.byte 32 +.byte 49 +.byte 48 +.byte 48 +.byte 44 +.byte 32 +.byte 50 +.byte 53 +.byte 54 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 0 +.align 0 +L.964: +.byte 82 +.byte 117 +.byte 110 +.byte 110 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 114 +.byte 101 +.byte 118 +.byte 101 +.byte 97 +.byte 108 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 115 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 101 +.byte 114 +.byte 105 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 115 +.byte 58 +.byte 0 +.align 0 +L.961: +.byte 9 +.byte 79 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 114 +.byte 101 +.byte 108 +.byte 101 +.byte 118 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 105 +.byte 108 +.byte 101 +.byte 114 +.byte 32 +.byte 111 +.byte 112 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 58 +.byte 0 +.align 0 +L.960: +.byte 9 +.byte 79 +.byte 112 +.byte 116 +.byte 105 +.byte 109 +.byte 105 +.byte 122 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 108 +.byte 101 +.byte 118 +.byte 101 +.byte 108 +.byte 58 +.byte 10 +.byte 0 +.align 0 +L.959: +.byte 9 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 105 +.byte 108 +.byte 101 +.byte 114 +.byte 58 +.byte 10 +.byte 0 +.align 0 +L.958: +.byte 9 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 114 +.byte 58 +.byte 10 +.byte 0 +.align 0 +L.957: +.byte 9 +.byte 86 +.byte 101 +.byte 114 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 58 +.byte 9 +.byte 49 +.byte 48 +.byte 32 +.byte 70 +.byte 101 +.byte 98 +.byte 114 +.byte 117 +.byte 97 +.byte 114 +.byte 121 +.byte 32 +.byte 49 +.byte 57 +.byte 56 +.byte 57 +.byte 59 +.byte 0 +.align 0 +L.956: +.byte 9 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 58 +.byte 9 +.byte 100 +.byte 111 +.byte 117 +.byte 98 +.byte 108 +.byte 101 +.byte 59 +.byte 0 +.align 0 +L.955: +.byte 73 +.byte 110 +.byte 32 +.byte 100 +.byte 111 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 115 +.byte 111 +.byte 44 +.byte 32 +.byte 112 +.byte 108 +.byte 101 +.byte 97 +.byte 115 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 108 +.byte 117 +.byte 100 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 102 +.byte 111 +.byte 108 +.byte 108 +.byte 111 +.byte 119 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 105 +.byte 110 +.byte 102 +.byte 111 +.byte 114 +.byte 109 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 58 +.byte 0 +.align 0 +L.954: +.byte 9 +.byte 83 +.byte 97 +.byte 110 +.byte 32 +.byte 70 +.byte 114 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 44 +.byte 32 +.byte 67 +.byte 65 +.byte 32 +.byte 57 +.byte 52 +.byte 49 +.byte 52 +.byte 51 +.byte 45 +.byte 48 +.byte 55 +.byte 48 +.byte 52 +.byte 44 +.byte 32 +.byte 85 +.byte 83 +.byte 65 +.byte 10 +.byte 0 +.align 0 +L.953: +.byte 9 +.byte 85 +.byte 110 +.byte 105 +.byte 118 +.byte 101 +.byte 114 +.byte 115 +.byte 105 +.byte 116 +.byte 121 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 67 +.byte 97 +.byte 108 +.byte 105 +.byte 102 +.byte 111 +.byte 114 +.byte 110 +.byte 105 +.byte 97 +.byte 0 +.align 0 +L.952: +.byte 9 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 67 +.byte 101 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 85 +.byte 45 +.byte 55 +.byte 54 +.byte 0 +.align 0 +L.951: +.byte 9 +.byte 82 +.byte 105 +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 75 +.byte 97 +.byte 114 +.byte 112 +.byte 105 +.byte 110 +.byte 115 +.byte 107 +.byte 105 +.byte 0 +.align 0 +L.950: +.byte 80 +.byte 108 +.byte 101 +.byte 97 +.byte 115 +.byte 101 +.byte 32 +.byte 115 +.byte 101 +.byte 110 +.byte 100 +.byte 32 +.byte 115 +.byte 117 +.byte 103 +.byte 103 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 114 +.byte 101 +.byte 115 +.byte 117 +.byte 108 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 0 +.align 0 +L.949: +.byte 99 +.byte 111 +.byte 112 +.byte 101 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 117 +.byte 110 +.byte 97 +.byte 110 +.byte 116 +.byte 105 +.byte 99 +.byte 105 +.byte 112 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 110 +.byte 101 +.byte 119 +.byte 108 +.byte 121 +.byte 32 +.byte 117 +.byte 110 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 112 +.byte 97 +.byte 116 +.byte 104 +.byte 111 +.byte 108 +.byte 111 +.byte 103 +.byte 105 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.948: +.byte 85 +.byte 115 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 118 +.byte 105 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 104 +.byte 101 +.byte 108 +.byte 112 +.byte 32 +.byte 100 +.byte 101 +.byte 98 +.byte 117 +.byte 103 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 97 +.byte 117 +.byte 103 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 119 +.byte 105 +.byte 108 +.byte 108 +.byte 0 +.align 0 +L.945: +.byte 65 +.byte 110 +.byte 115 +.byte 119 +.byte 101 +.byte 114 +.byte 32 +.byte 113 +.byte 117 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 89 +.byte 44 +.byte 32 +.byte 121 +.byte 44 +.byte 32 +.byte 78 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 110 +.byte 32 +.byte 40 +.byte 117 +.byte 110 +.byte 108 +.byte 101 +.byte 115 +.byte 115 +.byte 32 +.byte 111 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 119 +.byte 105 +.byte 115 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 100 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 41 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.944: +.byte 97 +.byte 109 +.byte 101 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 107 +.byte 101 +.byte 32 +.byte 102 +.byte 117 +.byte 114 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.943: +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 97 +.byte 110 +.byte 121 +.byte 119 +.byte 97 +.byte 121 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 115 +.byte 101 +.byte 101 +.byte 32 +.byte 104 +.byte 111 +.byte 119 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 109 +.byte 105 +.byte 108 +.byte 101 +.byte 115 +.byte 116 +.byte 111 +.byte 110 +.byte 101 +.byte 115 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 112 +.byte 97 +.byte 115 +.byte 115 +.byte 101 +.byte 115 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 110 +.byte 0 +.align 0 +L.942: +.byte 119 +.byte 97 +.byte 114 +.byte 110 +.byte 105 +.byte 110 +.byte 103 +.byte 46 +.byte 32 +.byte 32 +.byte 73 +.byte 102 +.byte 32 +.byte 112 +.byte 101 +.byte 114 +.byte 115 +.byte 117 +.byte 97 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 118 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 32 +.byte 110 +.byte 97 +.byte 117 +.byte 103 +.byte 104 +.byte 116 +.byte 44 +.byte 32 +.byte 100 +.byte 111 +.byte 110 +.byte 39 +.byte 116 +.byte 32 +.byte 100 +.byte 101 +.byte 115 +.byte 112 +.byte 97 +.byte 105 +.byte 114 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 114 +.byte 117 +.byte 110 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 0 +.align 0 +L.941: +.byte 116 +.byte 111 +.byte 32 +.byte 112 +.byte 101 +.byte 114 +.byte 115 +.byte 101 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 97 +.byte 32 +.byte 115 +.byte 117 +.byte 114 +.byte 114 +.byte 111 +.byte 103 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 97 +.byte 102 +.byte 116 +.byte 101 +.byte 114 +.byte 44 +.byte 32 +.byte 112 +.byte 101 +.byte 114 +.byte 104 +.byte 97 +.byte 112 +.byte 115 +.byte 44 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 112 +.byte 108 +.byte 97 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 115 +.byte 111 +.byte 109 +.byte 101 +.byte 0 +.align 0 +L.940: +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 47 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 111 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 115 +.byte 44 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 114 +.byte 97 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 0 +.align 0 +L.939: +.byte 116 +.byte 114 +.byte 121 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 112 +.byte 101 +.byte 114 +.byte 115 +.byte 117 +.byte 97 +.byte 100 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 116 +.byte 101 +.byte 114 +.byte 109 +.byte 105 +.byte 110 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 101 +.byte 120 +.byte 101 +.byte 99 +.byte 117 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 97 +.byte 110 +.byte 0 +.align 0 +L.938: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 96 +.byte 69 +.byte 78 +.byte 68 +.byte 32 +.byte 79 +.byte 70 +.byte 32 +.byte 84 +.byte 69 +.byte 83 +.byte 84 +.byte 39 +.byte 44 +.byte 10 +.byte 0 +.align 0 +L.937: +.byte 76 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 115 +.byte 116 +.byte 111 +.byte 112 +.byte 32 +.byte 112 +.byte 114 +.byte 101 +.byte 109 +.byte 97 +.byte 116 +.byte 117 +.byte 114 +.byte 101 +.byte 108 +.byte 121 +.byte 44 +.byte 32 +.byte 105 +.byte 46 +.byte 101 +.byte 46 +.byte 32 +.byte 98 +.byte 101 +.byte 102 +.byte 111 +.byte 114 +.byte 101 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 112 +.byte 108 +.byte 97 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 10 +.byte 0 +.align 0 +L.934: +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.929: +.byte 32 +.byte 32 +.byte 32 +.byte 80 +.byte 76 +.byte 69 +.byte 65 +.byte 83 +.byte 69 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 73 +.byte 70 +.byte 89 +.byte 32 +.byte 75 +.byte 65 +.byte 82 +.byte 80 +.byte 73 +.byte 78 +.byte 75 +.byte 83 +.byte 73 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.928: +.byte 37 +.byte 115 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 111 +.byte 110 +.byte 115 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 110 +.byte 116 +.byte 46 +.byte 46 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.926: +.byte 9 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 90 +.byte 32 +.byte 42 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.925: +.byte 9 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 49 +.byte 32 +.byte 42 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.924: +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 100 +.byte 111 +.byte 101 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 109 +.byte 117 +.byte 116 +.byte 101 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.919: +.byte 90 +.byte 32 +.byte 47 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.916: +.byte 49 +.byte 32 +.byte 42 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 37 +.byte 103 +.byte 10 +.byte 0 +.align 0 +L.913: +.byte 90 +.byte 32 +.byte 42 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 0 +.align 0 +L.910: +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 9 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 101 +.byte 115 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 32 +.byte 0 +.align 0 +L.909: +.byte 87 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 0 +.align 0 +L.904: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.901: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 86 +.byte 69 +.byte 82 +.byte 89 +.byte 32 +.byte 83 +.byte 69 +.byte 82 +.byte 73 +.byte 79 +.byte 85 +.byte 83 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.895: +.byte 32 +.byte 104 +.byte 97 +.byte 115 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 106 +.byte 117 +.byte 115 +.byte 116 +.byte 32 +.byte 98 +.byte 101 +.byte 101 +.byte 110 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 97 +.byte 108 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.894: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 79 +.byte 46 +.byte 75 +.byte 46 +.byte 44 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 118 +.byte 105 +.byte 100 +.byte 101 +.byte 100 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 47 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 0 +.align 0 +L.891: +.byte 87 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 109 +.byte 97 +.byte 99 +.byte 104 +.byte 105 +.byte 110 +.byte 101 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 40 +.byte 90 +.byte 32 +.byte 43 +.byte 32 +.byte 90 +.byte 41 +.byte 32 +.byte 47 +.byte 32 +.byte 90 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.887: +.byte 40 +.byte 90 +.byte 32 +.byte 43 +.byte 32 +.byte 90 +.byte 41 +.byte 32 +.byte 47 +.byte 32 +.byte 90 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 115 +.byte 97 +.byte 102 +.byte 101 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.886: +.byte 83 +.byte 105 +.byte 110 +.byte 99 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 100 +.byte 101 +.byte 110 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 101 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 0 +.align 0 +L.882: +.byte 83 +.byte 105 +.byte 109 +.byte 105 +.byte 108 +.byte 97 +.byte 114 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 114 +.byte 101 +.byte 112 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 104 +.byte 97 +.byte 118 +.byte 101 +.byte 32 +.byte 111 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 116 +.byte 105 +.byte 109 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.872: +.byte 9 +.byte 9 +.byte 116 +.byte 104 +.byte 101 +.byte 121 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.871: +.byte 9 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 117 +.byte 110 +.byte 101 +.byte 113 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 59 +.byte 10 +.byte 0 +.align 0 +L.870: +.byte 9 +.byte 121 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 101 +.byte 100 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 59 +.byte 10 +.byte 0 +.align 0 +L.869: +.byte 9 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 10 +.byte 0 +.align 0 +L.868: +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 10 +.byte 0 +.align 0 +L.867: +.byte 87 +.byte 65 +.byte 82 +.byte 78 +.byte 73 +.byte 78 +.byte 71 +.byte 58 +.byte 32 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 10 +.byte 0 +.align 0 +L.849: +.byte 9 +.byte 105 +.byte 110 +.byte 115 +.byte 116 +.byte 101 +.byte 97 +.byte 100 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 48 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.848: +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 45 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 3 +L.840: +.word 0x3ed4f8b5 +.word 0x88e368f1 +.align 0 +L.838: +.byte 37 +.byte 115 +.byte 58 +.byte 32 +.byte 32 +.byte 37 +.byte 115 +.byte 0 +.align 0 +L.837: +.byte 70 +.byte 76 +.byte 65 +.byte 87 +.byte 0 +.align 0 +L.836: +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 0 +.align 0 +L.835: +.byte 83 +.byte 69 +.byte 82 +.byte 73 +.byte 79 +.byte 85 +.byte 83 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 0 +.align 0 +L.834: +.byte 70 +.byte 65 +.byte 73 +.byte 76 +.byte 85 +.byte 82 +.byte 69 +.byte 0 +.align 0 +L.828: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 80 +.byte 97 +.byte 103 +.byte 101 +.byte 58 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 10 +.byte 0 +.align 0 +L.827: +.byte 10 +.byte 68 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 105 +.byte 115 +.byte 32 +.byte 114 +.byte 101 +.byte 115 +.byte 117 +.byte 109 +.byte 101 +.byte 115 +.byte 32 +.byte 97 +.byte 102 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 109 +.byte 105 +.byte 108 +.byte 101 +.byte 115 +.byte 116 +.byte 111 +.byte 110 +.byte 101 +.byte 32 +.byte 78 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 37 +.byte 100 +.byte 0 +.align 3 +L.825: +.word 0xbff00000 +.word 0x0 +.align 0 +L.820: +.byte 69 +.byte 78 +.byte 68 +.byte 32 +.byte 79 +.byte 70 +.byte 32 +.byte 84 +.byte 69 +.byte 83 +.byte 84 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.819: +.byte 10 +.byte 65 +.byte 32 +.byte 116 +.byte 111 +.byte 116 +.byte 97 +.byte 108 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 102 +.byte 108 +.byte 111 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 112 +.byte 111 +.byte 105 +.byte 110 +.byte 116 +.byte 32 +.byte 101 +.byte 120 +.byte 99 +.byte 101 +.byte 112 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 119 +.byte 101 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 101 +.byte 103 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.816: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 69 +.byte 120 +.byte 99 +.byte 101 +.byte 108 +.byte 108 +.byte 101 +.byte 110 +.byte 116 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.815: +.byte 32 +.byte 100 +.byte 117 +.byte 114 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 71 +.byte 114 +.byte 97 +.byte 100 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.814: +.byte 44 +.byte 10 +.byte 101 +.byte 120 +.byte 99 +.byte 101 +.byte 112 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 112 +.byte 111 +.byte 115 +.byte 115 +.byte 105 +.byte 98 +.byte 108 +.byte 121 +.byte 32 +.byte 68 +.byte 111 +.byte 117 +.byte 98 +.byte 108 +.byte 101 +.byte 32 +.byte 82 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 0 +.align 0 +L.813: +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.810: +.byte 56 +.byte 53 +.byte 52 +.byte 0 +.align 0 +L.809: +.byte 55 +.byte 53 +.byte 52 +.byte 0 +.align 0 +L.806: +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 112 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 73 +.byte 69 +.byte 69 +.byte 69 +.byte 32 +.byte 115 +.byte 116 +.byte 97 +.byte 110 +.byte 100 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 80 +.byte 0 +.align 0 +L.805: +.byte 82 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 111 +.byte 114 +.byte 109 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 0 +.align 0 +L.802: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 115 +.byte 101 +.byte 101 +.byte 109 +.byte 115 +.byte 32 +.byte 83 +.byte 97 +.byte 116 +.byte 105 +.byte 115 +.byte 102 +.byte 97 +.byte 99 +.byte 116 +.byte 111 +.byte 114 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.796: +.byte 78 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 117 +.byte 114 +.byte 101 +.byte 115 +.byte 44 +.byte 32 +.byte 100 +.byte 101 +.byte 102 +.byte 101 +.byte 99 +.byte 116 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 108 +.byte 97 +.byte 119 +.byte 115 +.byte 32 +.byte 104 +.byte 97 +.byte 118 +.byte 101 +.byte 32 +.byte 98 +.byte 101 +.byte 101 +.byte 110 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.795: +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 39 +.byte 115 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 115 +.byte 101 +.byte 113 +.byte 117 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.794: +.byte 80 +.byte 111 +.byte 116 +.byte 101 +.byte 110 +.byte 116 +.byte 105 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 32 +.byte 102 +.byte 97 +.byte 116 +.byte 97 +.byte 108 +.byte 32 +.byte 70 +.byte 65 +.byte 73 +.byte 76 +.byte 85 +.byte 82 +.byte 69 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 104 +.byte 97 +.byte 118 +.byte 101 +.byte 32 +.byte 115 +.byte 112 +.byte 111 +.byte 105 +.byte 108 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 0 +.align 0 +L.791: +.byte 117 +.byte 110 +.byte 97 +.byte 99 +.byte 99 +.byte 101 +.byte 112 +.byte 116 +.byte 97 +.byte 98 +.byte 108 +.byte 101 +.byte 32 +.byte 83 +.byte 101 +.byte 114 +.byte 105 +.byte 111 +.byte 117 +.byte 115 +.byte 32 +.byte 68 +.byte 101 +.byte 102 +.byte 101 +.byte 99 +.byte 116 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.790: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 104 +.byte 97 +.byte 115 +.byte 32 +.byte 0 +.align 0 +L.786: +.byte 100 +.byte 101 +.byte 115 +.byte 112 +.byte 105 +.byte 116 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 111 +.byte 110 +.byte 118 +.byte 101 +.byte 110 +.byte 105 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 68 +.byte 101 +.byte 102 +.byte 101 +.byte 99 +.byte 116 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.785: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 65 +.byte 99 +.byte 99 +.byte 101 +.byte 112 +.byte 116 +.byte 97 +.byte 98 +.byte 108 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.780: +.byte 83 +.byte 97 +.byte 116 +.byte 105 +.byte 115 +.byte 102 +.byte 97 +.byte 99 +.byte 116 +.byte 111 +.byte 114 +.byte 121 +.byte 32 +.byte 116 +.byte 104 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 32 +.byte 102 +.byte 108 +.byte 97 +.byte 119 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.779: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 115 +.byte 101 +.byte 101 +.byte 109 +.byte 115 +.byte 32 +.byte 0 +.align 0 +L.768: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 32 +.byte 37 +.byte 45 +.byte 50 +.byte 57 +.byte 115 +.byte 32 +.byte 37 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.761: +.byte 70 +.byte 76 +.byte 65 +.byte 87 +.byte 115 +.byte 32 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 61 +.byte 0 +.align 0 +L.760: +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 115 +.byte 32 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 61 +.byte 0 +.align 0 +L.759: +.byte 83 +.byte 69 +.byte 82 +.byte 73 +.byte 79 +.byte 85 +.byte 83 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 115 +.byte 32 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 61 +.byte 0 +.align 0 +L.758: +.byte 70 +.byte 65 +.byte 73 +.byte 76 +.byte 85 +.byte 82 +.byte 69 +.byte 115 +.byte 32 +.byte 32 +.byte 101 +.byte 110 +.byte 99 +.byte 111 +.byte 117 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 61 +.byte 0 +.align 0 +L.754: +.byte 10 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 84 +.byte 114 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 32 +.byte 48 +.byte 32 +.byte 47 +.byte 32 +.byte 48 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 101 +.byte 115 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 0 +.align 0 +L.753: +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.750: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 84 +.byte 114 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 32 +.byte 49 +.byte 32 +.byte 47 +.byte 32 +.byte 48 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 101 +.byte 115 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 0 +.align 0 +L.749: +.byte 87 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 109 +.byte 101 +.byte 115 +.byte 115 +.byte 97 +.byte 103 +.byte 101 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 47 +.byte 111 +.byte 114 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 115 +.byte 32 +.byte 100 +.byte 111 +.byte 101 +.byte 115 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 101 +.byte 63 +.byte 10 +.byte 0 +.align 0 +L.748: +.byte 32 +.byte 32 +.byte 105 +.byte 110 +.byte 115 +.byte 116 +.byte 101 +.byte 97 +.byte 100 +.byte 44 +.byte 32 +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 45 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.747: +.byte 32 +.byte 32 +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 88 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 49 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 88 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.742: +.byte 32 +.byte 32 +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 88 +.byte 32 +.byte 32 +.byte 116 +.byte 114 +.byte 97 +.byte 112 +.byte 115 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 88 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 103 +.byte 10 +.byte 0 +.align 0 +L.727: +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 114 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 49 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.726: +.byte 32 +.byte 117 +.byte 110 +.byte 98 +.byte 97 +.byte 108 +.byte 97 +.byte 110 +.byte 99 +.byte 101 +.byte 100 +.byte 32 +.byte 114 +.byte 97 +.byte 110 +.byte 103 +.byte 101 +.byte 59 +.byte 32 +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 42 +.byte 32 +.byte 86 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 9 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.725: +.byte 66 +.byte 97 +.byte 100 +.byte 108 +.byte 121 +.byte 0 +.align 0 +L.718: +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 114 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 90 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 50 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.717: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.705: +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 114 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 90 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.704: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 119 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.687: +.byte 43 +.byte 45 +.byte 37 +.byte 103 +.byte 44 +.byte 32 +.byte 43 +.byte 45 +.byte 37 +.byte 103 +.byte 10 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 43 +.byte 45 +.byte 37 +.byte 103 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 46 +.byte 0 +.align 0 +L.686: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 105 +.byte 110 +.byte 118 +.byte 111 +.byte 108 +.byte 118 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 0 +.align 0 +L.680: +.byte 97 +.byte 98 +.byte 111 +.byte 118 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.679: +.byte 65 +.byte 110 +.byte 121 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 115 +.byte 101 +.byte 112 +.byte 97 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 42 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 111 +.byte 110 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.678: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 86 +.byte 32 +.byte 47 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.677: +.byte 78 +.byte 111 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 97 +.byte 108 +.byte 101 +.byte 100 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 86 +.byte 32 +.byte 42 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.676: +.byte 84 +.byte 104 +.byte 101 +.byte 114 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 32 +.byte 115 +.byte 97 +.byte 116 +.byte 117 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 98 +.byte 101 +.byte 99 +.byte 97 +.byte 117 +.byte 115 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 115 +.byte 121 +.byte 115 +.byte 116 +.byte 101 +.byte 109 +.byte 32 +.byte 116 +.byte 114 +.byte 97 +.byte 112 +.byte 115 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.675: +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 115 +.byte 97 +.byte 116 +.byte 117 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 115 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 86 +.byte 48 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.672: +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 86 +.byte 32 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.663: +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 112 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 9 +.byte 115 +.byte 104 +.byte 114 +.byte 105 +.byte 110 +.byte 107 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.660: +.byte 45 +.byte 40 +.byte 45 +.byte 89 +.byte 41 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 89 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.659: +.byte 102 +.byte 105 +.byte 110 +.byte 100 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 0 +.align 0 +L.658: +.byte 83 +.byte 101 +.byte 101 +.byte 109 +.byte 115 +.byte 32 +.byte 79 +.byte 46 +.byte 75 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.655: +.byte 84 +.byte 114 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 89 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.654: +.byte 67 +.byte 97 +.byte 110 +.byte 32 +.byte 96 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 45 +.byte 89 +.byte 39 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 63 +.byte 10 +.byte 0 +.align 0 +L.647: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 103 +.byte 101 +.byte 110 +.byte 101 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.646: +.byte 83 +.byte 101 +.byte 97 +.byte 114 +.byte 99 +.byte 104 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 58 +.byte 10 +.byte 0 +.align 0 +L.645: +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 110 +.byte 111 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 114 +.byte 101 +.byte 112 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.637: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 112 +.byte 111 +.byte 119 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 90 +.byte 94 +.byte 81 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 114 +.byte 32 +.byte 110 +.byte 101 +.byte 97 +.byte 114 +.byte 108 +.byte 121 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 101 +.byte 109 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.636: +.byte 65 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 97 +.byte 99 +.byte 121 +.byte 32 +.byte 115 +.byte 101 +.byte 101 +.byte 109 +.byte 115 +.byte 32 +.byte 97 +.byte 100 +.byte 101 +.byte 113 +.byte 117 +.byte 97 +.byte 116 +.byte 101 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.629: +.byte 9 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 105 +.byte 110 +.byte 118 +.byte 111 +.byte 108 +.byte 118 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 105 +.byte 110 +.byte 121 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.628: +.byte 9 +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 109 +.byte 117 +.byte 99 +.byte 104 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 115 +.byte 112 +.byte 111 +.byte 105 +.byte 108 +.byte 32 +.byte 102 +.byte 105 +.byte 110 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 97 +.byte 108 +.byte 10 +.byte 0 +.align 0 +L.627: +.byte 9 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.626: +.byte 9 +.byte 40 +.byte 49 +.byte 32 +.byte 43 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 59 +.byte 10 +.byte 0 +.align 0 +L.625: +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 10 +.byte 0 +.align 0 +L.624: +.byte 67 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 0 +.align 0 +L.617: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 88 +.byte 94 +.byte 40 +.byte 40 +.byte 88 +.byte 32 +.byte 43 +.byte 32 +.byte 49 +.byte 41 +.byte 32 +.byte 47 +.byte 32 +.byte 40 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 49 +.byte 41 +.byte 41 +.byte 32 +.byte 118 +.byte 115 +.byte 46 +.byte 32 +.byte 101 +.byte 120 +.byte 112 +.byte 40 +.byte 50 +.byte 41 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 88 +.byte 32 +.byte 45 +.byte 62 +.byte 32 +.byte 49 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.613: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 79 +.byte 46 +.byte 75 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.610: +.byte 32 +.byte 32 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.609: +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 98 +.byte 101 +.byte 116 +.byte 119 +.byte 101 +.byte 101 +.byte 110 +.byte 32 +.byte 48 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 10 +.byte 0 +.align 0 +L.605: +.byte 97 +.byte 99 +.byte 116 +.byte 117 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 32 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 121 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 58 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.604: +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 97 +.byte 102 +.byte 102 +.byte 108 +.byte 105 +.byte 99 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 10 +.byte 9 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 59 +.byte 10 +.byte 0 +.align 0 +L.603: +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 61 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 10 +.byte 111 +.byte 110 +.byte 108 +.byte 121 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 0 +.align 0 +L.602: +.byte 83 +.byte 105 +.byte 110 +.byte 99 +.byte 101 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 111 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 115 +.byte 32 +.byte 98 +.byte 101 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.601: +.byte 82 +.byte 97 +.byte 110 +.byte 103 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 110 +.byte 97 +.byte 114 +.byte 114 +.byte 111 +.byte 119 +.byte 59 +.byte 32 +.byte 85 +.byte 49 +.byte 94 +.byte 37 +.byte 100 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.596: +.byte 109 +.byte 101 +.byte 114 +.byte 101 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 111 +.byte 102 +.byte 102 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.595: +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 115 +.byte 117 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 32 +.byte 108 +.byte 97 +.byte 114 +.byte 103 +.byte 101 +.byte 114 +.byte 32 +.byte 82 +.byte 101 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 0 +.align 0 +L.594: +.byte 32 +.byte 98 +.byte 101 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 0 +.align 0 +L.593: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.592: +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 49 +.byte 32 +.byte 43 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.591: +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 90 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.588: +.byte 101 +.byte 110 +.byte 99 +.byte 111 +.byte 117 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 97 +.byte 108 +.byte 116 +.byte 104 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 32 +.byte 97 +.byte 99 +.byte 116 +.byte 117 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 10 +.byte 0 +.align 0 +L.587: +.byte 32 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 40 +.byte 102 +.byte 40 +.byte 88 +.byte 41 +.byte 32 +.byte 45 +.byte 32 +.byte 102 +.byte 40 +.byte 90 +.byte 41 +.byte 41 +.byte 32 +.byte 47 +.byte 32 +.byte 40 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 90 +.byte 41 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.586: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 105 +.byte 102 +.byte 32 +.byte 40 +.byte 88 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 90 +.byte 41 +.byte 32 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 32 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 0 +.align 0 +L.585: +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 117 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 105 +.byte 110 +.byte 110 +.byte 111 +.byte 99 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 115 +.byte 116 +.byte 97 +.byte 116 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.584: +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 83 +.byte 69 +.byte 82 +.byte 73 +.byte 79 +.byte 85 +.byte 83 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 10 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 99 +.byte 97 +.byte 117 +.byte 115 +.byte 101 +.byte 115 +.byte 32 +.byte 0 +.align 0 +L.583: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 83 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 44 +.byte 32 +.byte 0 +.align 0 +L.582: +.byte 121 +.byte 101 +.byte 116 +.byte 32 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 90 +.byte 32 +.byte 121 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.581: +.byte 88 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 9 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 101 +.byte 113 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.576: +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 47 +.byte 32 +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 101 +.byte 100 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.566: +.byte 40 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 111 +.byte 102 +.byte 102 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 41 +.byte 32 +.byte 60 +.byte 32 +.byte 69 +.byte 48 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.565: +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 103 +.byte 114 +.byte 97 +.byte 100 +.byte 117 +.byte 97 +.byte 108 +.byte 59 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 117 +.byte 114 +.byte 115 +.byte 32 +.byte 65 +.byte 98 +.byte 115 +.byte 111 +.byte 108 +.byte 117 +.byte 116 +.byte 101 +.byte 32 +.byte 69 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 61 +.byte 10 +.byte 0 +.align 0 +L.560: +.byte 124 +.byte 81 +.byte 32 +.byte 45 +.byte 32 +.byte 89 +.byte 124 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.559: +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 32 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 81 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 89 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.558: +.byte 81 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 89 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 108 +.byte 101 +.byte 32 +.byte 100 +.byte 101 +.byte 110 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 124 +.byte 81 +.byte 32 +.byte 45 +.byte 32 +.byte 89 +.byte 124 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 48 +.byte 59 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 115 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.557: +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 117 +.byte 115 +.byte 101 +.byte 115 +.byte 32 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 44 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 10 +.byte 0 +.align 0 +L.555: +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 32 +.byte 109 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 108 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.554: +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 100 +.byte 111 +.byte 119 +.byte 110 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.553: +.byte 97 +.byte 112 +.byte 112 +.byte 114 +.byte 111 +.byte 97 +.byte 99 +.byte 104 +.byte 32 +.byte 97 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.552: +.byte 69 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 97 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 97 +.byte 99 +.byte 121 +.byte 32 +.byte 100 +.byte 101 +.byte 116 +.byte 101 +.byte 114 +.byte 105 +.byte 111 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.540: +.byte 83 +.byte 109 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 115 +.byte 116 +.byte 114 +.byte 105 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 112 +.byte 111 +.byte 115 +.byte 105 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 69 +.byte 48 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.539: +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 116 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.538: +.byte 68 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 101 +.byte 110 +.byte 99 +.byte 101 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 115 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 97 +.byte 32 +.byte 104 +.byte 105 +.byte 103 +.byte 104 +.byte 101 +.byte 114 +.byte 0 +.align 0 +L.535: +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 101 +.byte 110 +.byte 99 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.534: +.byte 80 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 116 +.byte 115 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 97 +.byte 32 +.byte 104 +.byte 105 +.byte 103 +.byte 104 +.byte 101 +.byte 114 +.byte 0 +.align 0 +L.527: +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 80 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.526: +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 100 +.byte 108 +.byte 121 +.byte 32 +.byte 112 +.byte 111 +.byte 115 +.byte 105 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.525: +.byte 112 +.byte 111 +.byte 115 +.byte 105 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 44 +.byte 32 +.byte 105 +.byte 115 +.byte 110 +.byte 39 +.byte 116 +.byte 59 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.524: +.byte 66 +.byte 117 +.byte 116 +.byte 32 +.byte 45 +.byte 80 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 44 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 98 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.521: +.byte 80 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 58 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.520: +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 100 +.byte 108 +.byte 121 +.byte 32 +.byte 110 +.byte 101 +.byte 103 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.519: +.byte 80 +.byte 111 +.byte 115 +.byte 105 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 97 +.byte 110 +.byte 10 +.byte 0 +.align 0 +L.506: +.byte 109 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 108 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.482: +.byte 83 +.byte 101 +.byte 101 +.byte 107 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 115 +.byte 32 +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 69 +.byte 48 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.479: +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 110 +.byte 111 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 114 +.byte 101 +.byte 112 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.476: +.byte 9 +.byte 105 +.byte 110 +.byte 118 +.byte 111 +.byte 108 +.byte 118 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.475: +.byte 69 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 115 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 105 +.byte 110 +.byte 118 +.byte 97 +.byte 108 +.byte 105 +.byte 100 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 102 +.byte 105 +.byte 110 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 97 +.byte 108 +.byte 32 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.454: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 112 +.byte 111 +.byte 119 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 90 +.byte 94 +.byte 105 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 115 +.byte 109 +.byte 97 +.byte 108 +.byte 108 +.byte 32 +.byte 73 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 90 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.451: +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 108 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 0 +L.449: +.byte 116 +.byte 111 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 117 +.byte 108 +.byte 112 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.448: +.byte 79 +.byte 98 +.byte 115 +.byte 101 +.byte 114 +.byte 118 +.byte 101 +.byte 100 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 115 +.byte 32 +.byte 114 +.byte 117 +.byte 110 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 0 +.align 0 +L.447: +.byte 83 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 101 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.444: +.byte 83 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.439: +.byte 83 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.434: +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 115 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.433: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 94 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.432: +.byte 65 +.byte 110 +.byte 111 +.byte 109 +.byte 97 +.byte 108 +.byte 111 +.byte 117 +.byte 115 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 73 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 32 +.byte 60 +.byte 32 +.byte 0 +.align 0 +L.392: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.370: +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 88 +.byte 41 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 110 +.byte 45 +.byte 109 +.byte 111 +.byte 110 +.byte 111 +.byte 116 +.byte 111 +.byte 110 +.byte 105 +.byte 99 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 88 +.byte 32 +.byte 110 +.byte 101 +.byte 97 +.byte 114 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.369: +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 104 +.byte 97 +.byte 115 +.byte 32 +.byte 112 +.byte 97 +.byte 115 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 77 +.byte 111 +.byte 110 +.byte 111 +.byte 116 +.byte 111 +.byte 110 +.byte 105 +.byte 99 +.byte 105 +.byte 116 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.352: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 109 +.byte 111 +.byte 110 +.byte 111 +.byte 116 +.byte 111 +.byte 110 +.byte 105 +.byte 99 +.byte 105 +.byte 116 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.341: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 105 +.byte 102 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 88 +.byte 32 +.byte 42 +.byte 32 +.byte 88 +.byte 41 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 88 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 73 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 88 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.336: +.byte 83 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 48 +.byte 46 +.byte 48 +.byte 44 +.byte 32 +.byte 45 +.byte 48 +.byte 46 +.byte 48 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 49 +.byte 46 +.byte 48 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 0 +L.334: +.byte 10 +.byte 82 +.byte 117 +.byte 110 +.byte 110 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 115 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 40 +.byte 120 +.byte 41 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.333: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 78 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 117 +.byte 114 +.byte 101 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 32 +.byte 112 +.byte 97 +.byte 105 +.byte 114 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.332: +.byte 88 +.byte 32 +.byte 42 +.byte 32 +.byte 89 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 89 +.byte 32 +.byte 42 +.byte 32 +.byte 88 +.byte 32 +.byte 116 +.byte 114 +.byte 105 +.byte 97 +.byte 108 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 3 +L.323: +.word 0x40080000 +.word 0x0 +.align 0 +L.322: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 114 +.byte 97 +.byte 110 +.byte 100 +.byte 111 +.byte 109 +.byte 32 +.byte 112 +.byte 97 +.byte 105 +.byte 114 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.321: +.byte 68 +.byte 111 +.byte 101 +.byte 115 +.byte 32 +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 109 +.byte 117 +.byte 116 +.byte 101 +.byte 63 +.byte 32 +.byte 32 +.byte 0 +.align 0 +L.318: +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 40 +.byte 115 +.byte 41 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 117 +.byte 114 +.byte 101 +.byte 40 +.byte 115 +.byte 41 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 10 +.byte 40 +.byte 110 +.byte 111 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 98 +.byte 111 +.byte 118 +.byte 101 +.byte 41 +.byte 32 +.byte 99 +.byte 111 +.byte 117 +.byte 110 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 111 +.byte 110 +.byte 101 +.byte 32 +.byte 102 +.byte 108 +.byte 97 +.byte 119 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 102 +.byte 105 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 116 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 32 +.byte 98 +.byte 101 +.byte 108 +.byte 111 +.byte 119 +.byte 0 +.align 0 +L.316: +.byte 83 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 32 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.315: +.byte 83 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 97 +.byte 114 +.byte 101 +.byte 110 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.298: +.byte 67 +.byte 104 +.byte 101 +.byte 99 +.byte 107 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.295: +.byte 40 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 89 +.byte 41 +.byte 32 +.byte 43 +.byte 32 +.byte 40 +.byte 89 +.byte 32 +.byte 45 +.byte 32 +.byte 88 +.byte 41 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 110 +.byte 32 +.byte 122 +.byte 101 +.byte 114 +.byte 111 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.292: +.byte 65 +.byte 100 +.byte 100 +.byte 105 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 110 +.byte 101 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.291: +.byte 65 +.byte 100 +.byte 100 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 0 +.align 0 +L.288: +.byte 65 +.byte 100 +.byte 100 +.byte 105 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.281: +.byte 65 +.byte 100 +.byte 100 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.276: +.byte 73 +.byte 110 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 108 +.byte 101 +.byte 116 +.byte 101 +.byte 32 +.byte 99 +.byte 97 +.byte 114 +.byte 114 +.byte 121 +.byte 45 +.byte 112 +.byte 114 +.byte 111 +.byte 112 +.byte 97 +.byte 103 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 65 +.byte 100 +.byte 100 +.byte 105 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 0 +L.272: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 42 +.byte 32 +.byte 40 +.byte 32 +.byte 49 +.byte 32 +.byte 47 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 41 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 49 +.byte 0 +.align 0 +L.270: +.byte 47 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 101 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.267: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.264: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 0 +L.261: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.256: +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 0 +L.253: +.byte 42 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 101 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.252: +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.249: +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.239: +.byte 88 +.byte 32 +.byte 42 +.byte 32 +.byte 40 +.byte 49 +.byte 47 +.byte 88 +.byte 41 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 49 +.byte 0 +.align 0 +L.220: +.byte 67 +.byte 104 +.byte 101 +.byte 99 +.byte 107 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 109 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 121 +.byte 44 +.byte 32 +.byte 100 +.byte 105 +.byte 118 +.byte 105 +.byte 100 +.byte 101 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 97 +.byte 100 +.byte 100 +.byte 47 +.byte 115 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.219: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 42 +.byte 44 +.byte 32 +.byte 47 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 45 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 104 +.byte 97 +.byte 118 +.byte 101 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 44 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 121 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.216: +.byte 32 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 32 +.byte 105 +.byte 102 +.byte 32 +.byte 40 +.byte 88 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 49 +.byte 46 +.byte 48 +.byte 41 +.byte 32 +.byte 123 +.byte 46 +.byte 46 +.byte 46 +.byte 46 +.byte 46 +.byte 125 +.byte 32 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 32 +.byte 123 +.byte 46 +.byte 46 +.byte 46 +.byte 47 +.byte 40 +.byte 88 +.byte 45 +.byte 49 +.byte 46 +.byte 48 +.byte 41 +.byte 46 +.byte 46 +.byte 46 +.byte 125 +.byte 10 +.byte 0 +.align 0 +L.215: +.byte 32 +.byte 32 +.byte 115 +.byte 117 +.byte 99 +.byte 104 +.byte 32 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 97 +.byte 117 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 103 +.byte 97 +.byte 105 +.byte 110 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 122 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 97 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.214: +.byte 32 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 121 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 32 +.byte 32 +.byte 40 +.byte 49 +.byte 45 +.byte 85 +.byte 49 +.byte 41 +.byte 32 +.byte 45 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 32 +.byte 44 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 101 +.byte 98 +.byte 121 +.byte 32 +.byte 118 +.byte 105 +.byte 116 +.byte 105 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 10 +.byte 0 +.align 0 +L.213: +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 32 +.byte 40 +.byte 49 +.byte 45 +.byte 85 +.byte 49 +.byte 41 +.byte 32 +.byte 60 +.byte 32 +.byte 49 +.byte 32 +.byte 32 +.byte 97 +.byte 108 +.byte 116 +.byte 104 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 10 +.byte 0 +.align 0 +L.210: +.byte 45 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 115 +.byte 32 +.byte 71 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 68 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 99 +.byte 101 +.byte 108 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 111 +.byte 98 +.byte 115 +.byte 99 +.byte 117 +.byte 114 +.byte 101 +.byte 100 +.byte 0 +.align 0 +L.205: +.byte 42 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 47 +.byte 111 +.byte 114 +.byte 32 +.byte 47 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 108 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 0 +L.201: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 49 +.byte 47 +.byte 49 +.byte 46 +.byte 48 +.byte 48 +.byte 48 +.byte 46 +.byte 46 +.byte 49 +.byte 32 +.byte 62 +.byte 61 +.byte 32 +.byte 49 +.byte 0 +.align 0 +L.199: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 71 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 68 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 88 +.byte 47 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 88 +.byte 0 +.align 0 +L.194: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 71 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 68 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 101 +.byte 120 +.byte 99 +.byte 101 +.byte 101 +.byte 100 +.byte 32 +.byte 49 +.byte 32 +.byte 117 +.byte 108 +.byte 112 +.byte 10 +.byte 111 +.byte 114 +.byte 32 +.byte 32 +.byte 49 +.byte 47 +.byte 51 +.byte 32 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 32 +.byte 51 +.byte 47 +.byte 57 +.byte 32 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 32 +.byte 57 +.byte 47 +.byte 50 +.byte 55 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 97 +.byte 103 +.byte 114 +.byte 101 +.byte 101 +.byte 0 +.align 0 +L.190: +.byte 42 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 102 +.byte 105 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.188: +.byte 42 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 71 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 68 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 49 +.byte 42 +.byte 88 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 88 +.byte 0 +.align 0 +L.185: +.byte 10 +.byte 67 +.byte 104 +.byte 101 +.byte 99 +.byte 107 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 42 +.byte 44 +.byte 32 +.byte 47 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 45 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.184: +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 109 +.byte 97 +.byte 108 +.byte 105 +.byte 122 +.byte 101 +.byte 100 +.byte 44 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 98 +.byte 101 +.byte 46 +.byte 0 +.align 0 +L.179: +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 109 +.byte 97 +.byte 108 +.byte 105 +.byte 122 +.byte 101 +.byte 100 +.byte 32 +.byte 88 +.byte 61 +.byte 89 +.byte 44 +.byte 88 +.byte 43 +.byte 90 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 89 +.byte 43 +.byte 90 +.byte 33 +.byte 0 +.align 0 +L.175: +.byte 114 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 108 +.byte 121 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 105 +.byte 102 +.byte 105 +.byte 99 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 101 +.byte 99 +.byte 105 +.byte 109 +.byte 97 +.byte 108 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.174: +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 101 +.byte 108 +.byte 121 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 97 +.byte 98 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 32 +.byte 66 +.byte 45 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 44 +.byte 32 +.byte 105 +.byte 46 +.byte 101 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.173: +.byte 83 +.byte 111 +.byte 109 +.byte 101 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 10 +.byte 0 +.align 0 +L.167: +.byte 111 +.byte 102 +.byte 32 +.byte 97 +.byte 110 +.byte 10 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 45 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 0 +L.166: +.byte 90 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 90 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 0 +.align 0 +L.165: +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 101 +.byte 120 +.byte 97 +.byte 99 +.byte 116 +.byte 32 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 97 +.byte 32 +.byte 114 +.byte 101 +.byte 115 +.byte 117 +.byte 108 +.byte 116 +.byte 10 +.byte 0 +.align 0 +L.164: +.byte 66 +.byte 101 +.byte 99 +.byte 97 +.byte 117 +.byte 115 +.byte 101 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 117 +.byte 110 +.byte 117 +.byte 115 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 102 +.byte 0 +.align 0 +L.160: +.byte 9 +.byte 85 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 90 +.byte 50 +.byte 32 +.byte 45 +.byte 32 +.byte 85 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.159: +.byte 9 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 90 +.byte 49 +.byte 32 +.byte 45 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.158: +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 0 +L.157: +.byte 0 +.align 0 +L.150: +.byte 84 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 102 +.byte 101 +.byte 97 +.byte 116 +.byte 117 +.byte 114 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 102 +.byte 117 +.byte 114 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.145: +.byte 80 +.byte 111 +.byte 115 +.byte 115 +.byte 105 +.byte 98 +.byte 108 +.byte 121 +.byte 32 +.byte 115 +.byte 111 +.byte 109 +.byte 101 +.byte 32 +.byte 112 +.byte 97 +.byte 114 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 0 +.align 0 +L.144: +.byte 98 +.byte 121 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 45 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 101 +.byte 32 +.byte 101 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.143: +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 115 +.byte 121 +.byte 109 +.byte 112 +.byte 116 +.byte 111 +.byte 109 +.byte 115 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 111 +.byte 110 +.byte 115 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 110 +.byte 99 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 101 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.142: +.byte 114 +.byte 101 +.byte 115 +.byte 112 +.byte 101 +.byte 99 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 108 +.byte 121 +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 10 +.byte 0 +.align 0 +L.141: +.byte 68 +.byte 105 +.byte 115 +.byte 97 +.byte 103 +.byte 114 +.byte 101 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 97 +.byte 109 +.byte 111 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 115 +.byte 32 +.byte 88 +.byte 49 +.byte 44 +.byte 32 +.byte 89 +.byte 49 +.byte 44 +.byte 32 +.byte 90 +.byte 49 +.byte 44 +.byte 10 +.byte 0 +.align 0 +L.119: +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 119 +.byte 111 +.byte 114 +.byte 115 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 53 +.byte 32 +.byte 100 +.byte 101 +.byte 99 +.byte 105 +.byte 109 +.byte 97 +.byte 108 +.byte 32 +.byte 102 +.byte 105 +.byte 103 +.byte 117 +.byte 114 +.byte 101 +.byte 115 +.byte 32 +.byte 32 +.byte 0 +.align 0 +L.117: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 105 +.byte 102 +.byte 105 +.byte 99 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 37 +.byte 102 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.116: +.byte 108 +.byte 111 +.byte 103 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 105 +.byte 99 +.byte 32 +.byte 101 +.byte 110 +.byte 99 +.byte 111 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 104 +.byte 97 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 101 +.byte 114 +.byte 105 +.byte 122 +.byte 101 +.byte 100 +.byte 32 +.byte 115 +.byte 111 +.byte 108 +.byte 101 +.byte 108 +.byte 121 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 85 +.byte 49 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.113: +.byte 111 +.byte 102 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 105 +.byte 102 +.byte 105 +.byte 99 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 44 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 105 +.byte 116 +.byte 115 +.byte 101 +.byte 108 +.byte 102 +.byte 44 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 109 +.byte 105 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 108 +.byte 97 +.byte 119 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.112: +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 101 +.byte 114 +.byte 105 +.byte 122 +.byte 101 +.byte 100 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 73 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 10 +.byte 0 +.align 0 +L.99: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 102 +.byte 117 +.byte 122 +.byte 122 +.byte 121 +.byte 44 +.byte 88 +.byte 61 +.byte 49 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 88 +.byte 45 +.byte 49 +.byte 47 +.byte 50 +.byte 45 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 0 +L.95: +.byte 40 +.byte 49 +.byte 45 +.byte 85 +.byte 49 +.byte 41 +.byte 45 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 60 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 70 +.byte 65 +.byte 76 +.byte 83 +.byte 69 +.byte 44 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 46 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 63 +.byte 0 +.align 3 +L.93: +.word 0x40240000 +.word 0x0 +.align 0 +L.88: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 103 +.byte 111 +.byte 111 +.byte 100 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 50 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 49 +.byte 48 +.byte 0 +.align 0 +L.84: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 98 +.byte 105 +.byte 103 +.byte 58 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 111 +.byte 102 +.byte 102 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 98 +.byte 108 +.byte 101 +.byte 109 +.byte 115 +.byte 0 +.align 0 +L.82: +.byte 77 +.byte 89 +.byte 83 +.byte 84 +.byte 69 +.byte 82 +.byte 89 +.byte 58 +.byte 32 +.byte 114 +.byte 101 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.81: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 105 +.byte 114 +.byte 109 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 3 +L.78: +.word 0x3f847ae1 +.word 0x47ae147b +.align 0 +L.77: +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 98 +.byte 101 +.byte 116 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 108 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 101 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 115 +.byte 101 +.byte 112 +.byte 97 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.76: +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 105 +.byte 114 +.byte 109 +.byte 115 +.byte 32 +.byte 99 +.byte 108 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 101 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 115 +.byte 101 +.byte 112 +.byte 97 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.61: +.byte 82 +.byte 101 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 114 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 10 +.byte 32 +.byte 0 +.align 0 +L.60: +.byte 67 +.byte 108 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 101 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 115 +.byte 101 +.byte 112 +.byte 97 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 10 +.byte 0 +.align 0 +L.54: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 102 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.45: +.byte 83 +.byte 101 +.byte 97 +.byte 114 +.byte 99 +.byte 104 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.44: +.byte 10 +.byte 0 +.align 0 +L.43: +.byte 45 +.byte 49 +.byte 44 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 44 +.byte 32 +.byte 49 +.byte 44 +.byte 32 +.byte 50 +.byte 44 +.byte 32 +.byte 51 +.byte 44 +.byte 32 +.byte 52 +.byte 44 +.byte 32 +.byte 53 +.byte 44 +.byte 32 +.byte 57 +.byte 44 +.byte 32 +.byte 50 +.byte 55 +.byte 44 +.byte 32 +.byte 51 +.byte 50 +.byte 32 +.byte 38 +.byte 32 +.byte 50 +.byte 52 +.byte 48 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 79 +.byte 46 +.byte 75 +.byte 46 +.byte 10 +.byte 0 +.align 0 +L.38: +.byte 53 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 52 +.byte 43 +.byte 49 +.byte 44 +.byte 32 +.byte 50 +.byte 52 +.byte 48 +.byte 47 +.byte 51 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 56 +.byte 48 +.byte 44 +.byte 32 +.byte 50 +.byte 52 +.byte 48 +.byte 47 +.byte 52 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 54 +.byte 48 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 50 +.byte 52 +.byte 48 +.byte 47 +.byte 53 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 52 +.byte 56 +.byte 0 +.align 0 +L.34: +.byte 57 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 51 +.byte 42 +.byte 51 +.byte 44 +.byte 32 +.byte 50 +.byte 55 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 57 +.byte 42 +.byte 51 +.byte 44 +.byte 32 +.byte 51 +.byte 50 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 56 +.byte 42 +.byte 52 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 51 +.byte 50 +.byte 45 +.byte 50 +.byte 55 +.byte 45 +.byte 52 +.byte 45 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 0 +L.30: +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 43 +.byte 32 +.byte 40 +.byte 45 +.byte 49 +.byte 41 +.byte 32 +.byte 43 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 0 +L.26: +.byte 45 +.byte 49 +.byte 43 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 40 +.byte 45 +.byte 49 +.byte 41 +.byte 43 +.byte 97 +.byte 98 +.byte 115 +.byte 40 +.byte 49 +.byte 41 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 45 +.byte 49 +.byte 43 +.byte 40 +.byte 45 +.byte 49 +.byte 41 +.byte 42 +.byte 40 +.byte 45 +.byte 49 +.byte 41 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 0 +L.22: +.byte 51 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 50 +.byte 43 +.byte 49 +.byte 44 +.byte 32 +.byte 52 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 51 +.byte 43 +.byte 49 +.byte 44 +.byte 32 +.byte 52 +.byte 43 +.byte 50 +.byte 42 +.byte 40 +.byte 45 +.byte 50 +.byte 41 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 52 +.byte 45 +.byte 51 +.byte 45 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 3 +L.20: +.word 0x3f50624d +.word 0xd2f1a9fc +.align 0 +L.19: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 45 +.byte 48 +.byte 46 +.byte 48 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 78 +.byte 111 +.byte 110 +.byte 45 +.byte 122 +.byte 101 +.byte 114 +.byte 111 +.byte 33 +.byte 10 +.byte 0 +.align 0 +L.14: +.byte 48 +.byte 43 +.byte 48 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 49 +.byte 45 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 49 +.byte 32 +.byte 60 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 49 +.byte 43 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 50 +.byte 0 +.align 0 +L.12: +.byte 80 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 119 +.byte 32 +.byte 82 +.byte 85 +.byte 78 +.byte 78 +.byte 73 +.byte 78 +.byte 71 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 115 +.byte 109 +.byte 97 +.byte 108 +.byte 108 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 115 +.byte 58 +.byte 10 +.byte 0 +.align 3 +L.8: +.word 0x3ff00000 +.word 0x0 +.align 3 +L.7: +.word 0x0 +.word 0x0 +.align 0 +L.2: +.byte 10 +.byte 42 +.byte 32 +.byte 42 +.byte 32 +.byte 42 +.byte 32 +.byte 70 +.byte 76 +.byte 79 +.byte 65 +.byte 84 +.byte 73 +.byte 78 +.byte 71 +.byte 45 +.byte 80 +.byte 79 +.byte 73 +.byte 78 +.byte 84 +.byte 32 +.byte 69 +.byte 82 +.byte 82 +.byte 79 +.byte 82 +.byte 32 +.byte 42 +.byte 32 +.byte 42 +.byte 32 +.byte 42 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/setjmp.h b/src/cmd/lccom-1/tst/mips-eb/setjmp.h new file mode 100644 index 0000000..7d9edad --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/setjmp.h @@ -0,0 +1,11 @@ +#ifndef __SETJMP +#define __SETJMP + + + + +typedef int jmp_buf[28]; +int setjmp(jmp_buf); +void longjmp(jmp_buf, int); + +#endif /* __SETJMP */ diff --git a/src/cmd/lccom-1/tst/mips-eb/signal.h b/src/cmd/lccom-1/tst/mips-eb/signal.h new file mode 100644 index 0000000..c208a6b --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/signal.h @@ -0,0 +1,20 @@ +#ifndef __SIGNAL +#define __SIGNAL + +typedef int sig_atomic_t; + +#define SIG_DFL ((void (*)(int))0) +#define SIG_ERR ((void (*)(int))-1) +#define SIG_IGN ((void (*)(int))1) + +#define SIGABRT 6 +#define SIGFPE 8 +#define SIGILL 4 +#define SIGINT 2 +#define SIGSEGV 11 +#define SIGTERM 15 + +void (*signal(int, void (*)(int)))(int); +int raise(int); + +#endif /* __SIGNAL */ diff --git a/src/cmd/lccom-1/tst/mips-eb/sort.1bk b/src/cmd/lccom-1/tst/mips-eb/sort.1bk new file mode 100644 index 0000000..75e1f0d --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/sort.1bk @@ -0,0 +1,20 @@ +exchange(1,9) +exchange(3,7) +exchange(5,6) +exchange(0,5) +exchange(0,3) +exchange(0,0) +exchange(1,2) +exchange(6,6) +exchange(8,9) +exchange(7,8) +-51 +-1 +0 +1 +3 +10 +18 +32 +567 +789 diff --git a/src/cmd/lccom-1/tst/mips-eb/sort.2bk b/src/cmd/lccom-1/tst/mips-eb/sort.2bk new file mode 100644 index 0000000..81e6f38 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/sort.2bk @@ -0,0 +1,5 @@ +tst/sort.c:23: warning: missing return value +tst/sort.c:30: warning: missing return value +tst/sort.c:37: warning: missing return value +tst/sort.c:41: warning: missing return value +tst/sort.c:65: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/sort.sbk b/src/cmd/lccom-1/tst/mips-eb/sort.sbk new file mode 100644 index 0000000..5fd5de4 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/sort.sbk @@ -0,0 +1,309 @@ +.set reorder +.globl in +.data +.align 2 +in: +.word 0xa +.word 0x20 +.word 0xffffffff +.word 0x237 +.word 0x3 +.word 0x12 +.word 0x1 +.word 0xffffffcd +.word 0x315 +.word 0x0 +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +la $4,in +la $5,10 +jal sort +move $30,$0 +b L.5 +L.2: +sll $24,$30,2 +lw $4,in($24) +jal putd +la $4,10 +jal putchar +L.3: +la $30,1($30) +L.5: +move $24,$30 +la $15,10 +bltu $24,$15,L.2 +move $2,$0 +L.1: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end main +.globl putd +.text +.align 2 +.ent putd +putd: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +move $30,$4 +bge $30,$0,L.7 +la $4,45 +jal putchar +negu $30,$30 +L.7: +la $24,10 +div $24,$30,$24 +beq $24,$0,L.9 +la $24,10 +div $4,$30,$24 +jal putd +L.9: +la $24,10 +rem $24,$30,$24 +la $4,48($24) +jal putchar +move $2,$0 +L.6: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end putd +.globl sort +.text +.align 2 +.ent sort +sort: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +sw $5,36($sp) +lw $24,0+32($sp) +sw $24,xx +move $4,$24 +move $5,$0 +lw $24,4+32($sp) +subu $24,$24,1 +sw $24,4+32($sp) +move $6,$24 +jal quick +move $2,$0 +L.11: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end sort +.globl quick +.text +.align 2 +.ent quick +quick: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0xc2e00000,-12 +sw $21,16($sp) +sw $22,20($sp) +sw $23,24($sp) +.cprestore 28 +sw $30,32($sp) +sw $31,36($sp) +move $30,$4 +move $23,$5 +move $22,$6 +blt $23,$22,L.13 +move $2,$0 +b L.12 +L.13: +move $4,$30 +move $5,$23 +move $6,$22 +jal partition +move $21,$2 +move $4,$30 +move $5,$23 +subu $6,$21,1 +jal quick +move $4,$30 +la $5,1($21) +move $6,$22 +jal quick +move $2,$0 +L.12: +lw $21,16($sp) +lw $22,20($sp) +lw $23,24($sp) +lw $25,28($sp) +lw $30,32($sp) +lw $31,36($sp) +addu $sp,$sp,48 +j $31 +.end quick +.globl partition +.text +.align 2 +.ent partition +partition: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0xc2f00000,-8 +sw $20,16($sp) +sw $21,20($sp) +sw $22,24($sp) +sw $23,28($sp) +.cprestore 32 +sw $30,36($sp) +sw $31,40($sp) +move $30,$4 +move $23,$5 +move $22,$6 +la $22,1($22) +move $20,$23 +sll $24,$20,2 +addu $24,$24,$30 +lw $21,($24) +b L.17 +L.16: +la $23,1($23) +b L.20 +L.19: +la $23,1($23) +L.20: +sll $24,$23,2 +addu $24,$24,$30 +lw $24,($24) +blt $24,$21,L.19 +subu $22,$22,1 +b L.23 +L.22: +subu $22,$22,1 +L.23: +sll $24,$22,2 +addu $24,$24,$30 +lw $24,($24) +bgt $24,$21,L.22 +bge $23,$22,L.25 +sll $24,$23,2 +addu $4,$24,$30 +sll $24,$22,2 +addu $5,$24,$30 +jal exchange +L.25: +L.17: +blt $23,$22,L.16 +sll $24,$20,2 +addu $4,$24,$30 +sll $24,$22,2 +addu $5,$24,$30 +jal exchange +move $2,$22 +L.15: +lw $20,16($sp) +lw $21,20($sp) +lw $22,24($sp) +lw $23,28($sp) +lw $25,32($sp) +lw $30,36($sp) +lw $31,40($sp) +addu $sp,$sp,48 +j $31 +.end partition +.globl exchange +.text +.align 2 +.ent exchange +exchange: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0xc2800000,-20 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +move $30,$4 +move $23,$5 +la $4,L.28 +lw $24,xx +la $15,4 +move $14,$30 +subu $14,$14,$24 +div $5,$14,$15 +move $14,$23 +subu $24,$14,$24 +div $6,$24,$15 +jal printf +lw $24,($30) +sw $24,-4+48($sp) +lw $24,($23) +sw $24,($30) +lw $24,-4+48($sp) +sw $24,($23) +move $2,$0 +L.27: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,48 +j $31 +.end exchange +.globl xx +.comm xx,4 +.rdata +.align 0 +L.28: +.byte 101 +.byte 120 +.byte 99 +.byte 104 +.byte 97 +.byte 110 +.byte 103 +.byte 101 +.byte 40 +.byte 37 +.byte 100 +.byte 44 +.byte 37 +.byte 100 +.byte 41 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/spill.2bk b/src/cmd/lccom-1/tst/mips-eb/spill.2bk new file mode 100644 index 0000000..afd73e2 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/spill.2bk @@ -0,0 +1,6 @@ +tst/spill.c:1: warning: missing return value +tst/spill.c:3: warning: missing return value +tst/spill.c:5: warning: missing return value +tst/spill.c:7: warning: missing return value +tst/spill.c:9: warning: missing return value +tst/spill.c:17: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/spill.sbk b/src/cmd/lccom-1/tst/mips-eb/spill.sbk new file mode 100644 index 0000000..274f01f --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/spill.sbk @@ -0,0 +1,271 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +move $2,$0 +L.1: +j $31 +.end main +.globl f +.text +.align 2 +.ent f +f: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +jal f +move $24,$2 +sw $24,-4+32($sp) +jal f +lw $15,-4+32($sp) +addu $24,$15,$2 +sw $24,0+32($sp) +move $2,$0 +L.2: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end f +.globl f2 +.text +.align 2 +.ent f2 +f2: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +sw $4,32($sp) +jal f +move $24,$2 +sw $24,-4+32($sp) +lw $15,0+32($sp) +beq $15,$0,L.5 +jal f +move $24,$2 +move $30,$24 +b L.6 +L.5: +la $30,1 +L.6: +lw $24,-4+32($sp) +addu $24,$24,$30 +sw $24,0+32($sp) +move $2,$0 +L.3: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end f2 +.globl f3 +.text +.align 2 +.ent f3 +f3: +.frame $sp,80,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-80 +.mask 0xc2ff0000,-24 +sw $16,16($sp) +sw $17,20($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +sw $4,80($sp) +sw $5,84($sp) +move $30,$0 +move $23,$0 +move $22,$0 +move $21,$0 +move $20,$0 +move $19,$0 +move $18,$0 +move $17,$0 +move $16,$0 +sw $0,-4+80($sp) +lw $24,4+80($sp) +sw $24,-12+80($sp) +la $15,4($24) +sw $15,4+80($sp) +lw $15,0+80($sp) +beq $15,$0,L.9 +jal f +move $24,$2 +sw $24,-8+80($sp) +b L.10 +L.9: +sw $0,-8+80($sp) +L.10: +lw $24,-8+80($sp) +lw $15,-12+80($sp) +sw $24,($15) +move $2,$0 +L.7: +lw $16,16($sp) +lw $17,20($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,80 +j $31 +.end f3 +.globl f4 +.text +.align 2 +.ent f4 +f4: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x40fc0000,-8 +sw $18,0($sp) +sw $19,4($sp) +sw $20,8($sp) +sw $21,12($sp) +sw $22,16($sp) +sw $23,20($sp) +sw $30,24($sp) +move $30,$0 +move $23,$0 +move $22,$0 +move $21,$0 +move $20,$0 +move $19,$0 +lw $24,i +sll $15,$24,3 +l.d $f18,a($15) +l.d $f16,b($15) +l.d $f10,L.15 +add.d $f8,$f18,$f16 +c.eq.d $f8,$f10; bc1t L.13 +beq $24,$0,L.13 +sub.d $f18,$f18,$f16 +c.eq.d $f18,$f10; bc1t L.13 +la $18,1 +b L.14 +L.13: +move $18,$0 +L.14: +sw $18,i +move $2,$0 +L.11: +lw $18,0($sp) +lw $19,4($sp) +lw $20,8($sp) +lw $21,12($sp) +lw $22,16($sp) +lw $23,20($sp) +lw $30,24($sp) +addu $sp,$sp,32 +j $31 +.end f4 +.globl f5 +.text +.align 2 +.ent f5 +f5: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +lw $24,k +lw $15,m +lw $14,A +mul $13,$24,$15 +sll $13,$13,3 +addu $13,$13,$14 +lw $12,j +mul $15,$12,$15 +sll $15,$15,3 +addu $15,$15,$14 +lw $14,n +lw $11,B +mul $24,$24,$14 +sll $24,$24,3 +addu $24,$24,$11 +mul $14,$12,$14 +sll $14,$14,3 +addu $14,$14,$11 +l.d $f18,($13) +l.d $f16,($15) +mul.d $f18,$f18,$f16 +l.d $f16,($24) +l.d $f10,($14) +mul.d $f16,$f16,$f10 +add.d $f18,$f18,$f16 +s.d $f18,x +l.d $f18,($13) +l.d $f16,($14) +mul.d $f18,$f18,$f16 +l.d $f16,($24) +l.d $f10,($15) +mul.d $f16,$f16,$f10 +sub.d $f18,$f18,$f16 +s.d $f18,x +move $2,$0 +L.16: +j $31 +.end f5 +.globl x +.comm x,8 +.globl B +.comm B,4 +.globl A +.comm A,4 +.globl n +.comm n,4 +.globl m +.comm m,4 +.globl k +.comm k,4 +.globl j +.comm j,4 +.globl i +.comm i,4 +.globl b +.comm b,80 +.globl a +.comm a,80 +.rdata +.align 3 +L.15: +.word 0x0 +.word 0x0 diff --git a/src/cmd/lccom-1/tst/mips-eb/stdarg.1bk b/src/cmd/lccom-1/tst/mips-eb/stdarg.1bk new file mode 100644 index 0000000..e973176 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/stdarg.1bk @@ -0,0 +1,6 @@ +test 1 +test 2 +test 3 +test 4 +test 5.000000 +{1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} diff --git a/src/cmd/lccom-1/tst/mips-eb/stdarg.2bk b/src/cmd/lccom-1/tst/mips-eb/stdarg.2bk new file mode 100644 index 0000000..2b3f417 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/stdarg.2bk @@ -0,0 +1 @@ +tst/stdarg.c:51: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/stdarg.h b/src/cmd/lccom-1/tst/mips-eb/stdarg.h new file mode 100644 index 0000000..e838c2b --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/stdarg.h @@ -0,0 +1,27 @@ +#ifndef __STDARG +#define __STDARG + +#if !defined(_VA_LIST) && !defined(__VA_LIST_DEFINED) +#define _VA_LIST +#define _VA_LIST_DEFINED +typedef char *__va_list; +#endif +static float __va_arg_tmp; +typedef __va_list va_list; + +#define va_start(list, start) ((void)((list) = (sizeof(start)<4 ? \ + (char *)((int *)&(start)+1) : (char *)(&(start)+1)))) +#define __va_arg(list, mode, n) (\ + __typecode(mode)==1 && sizeof(mode)==4 ? \ + (__va_arg_tmp = *(double *)(&(list += ((sizeof(double)+n)&~n))[-(int)((sizeof(double)+n)&~n)]), \ + *(mode *)&__va_arg_tmp) : \ + *(mode *)(&(list += ((sizeof(mode)+n)&~n))[-(int)((sizeof(mode)+n)&~n)])) +#define _bigendian_va_arg(list, mode, n) (\ + sizeof(mode)==1 ? *(mode *)(&(list += 4)[-1]) : \ + sizeof(mode)==2 ? *(mode *)(&(list += 4)[-2]) : __va_arg(list, mode, n)) +#define _littleendian_va_arg(list, mode, n) __va_arg(list, mode, n) +#define va_end(list) ((void)0) +#define va_arg(list, mode) (sizeof(mode)==8 ? \ + *(mode *)(&(list = (char*)(((int)list + 15)&~7U))[-8]) : \ + _bigendian_va_arg(list, mode, 3U)) +#endif diff --git a/src/cmd/lccom-1/tst/mips-eb/stdarg.sbk b/src/cmd/lccom-1/tst/mips-eb/stdarg.sbk new file mode 100644 index 0000000..477ab8e --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/stdarg.sbk @@ -0,0 +1,396 @@ +.set reorder +.globl x +.data +.align 2 +x: +.word 0x1 +.word 0x2 +.word 0x3 +.word 0x4 +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,112,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-112 +.mask 0x82000000,-8 +.cprestore 100 +sw $31,104($sp) +la $4,L.2 +jal print +la $4,L.3 +la $5,L.4 +jal print +la $4,L.5 +la $5,3 +la $6,10 +jal print +la $4,L.6 +la $5,L.7 +la $6,L.8 +la $7,4 +la $24,10 +sw $24,16($sp) +jal print +la $4,L.9 +la $5,L.7 +la $6,L.8 +l.d $f18,L.10 +s.d $f18,16($sp) +la $24,10 +sw $24,24($sp) +jal print +la $4,L.11 +la $24,x +move $8,$24 +lw $3,0($8) +lw $9,4($8) +sw $3,4($29) +sw $9,8($29) +lw $3,8($8) +lw $9,12($8) +sw $3,12($29) +sw $9,16($29) +lw $5,4($sp) +lw $6,8($sp) +lw $7,12($sp) +move $8,$24 +lw $3,0($8) +lw $9,4($8) +sw $3,20($29) +sw $9,24($29) +lw $3,8($8) +lw $9,12($8) +sw $3,28($29) +sw $9,32($29) +move $8,$24 +lw $3,0($8) +lw $9,4($8) +sw $3,36($29) +sw $9,40($29) +lw $3,8($8) +lw $9,12($8) +sw $3,44($29) +sw $9,48($29) +move $8,$24 +lw $3,0($8) +lw $9,4($8) +sw $3,52($29) +sw $9,56($29) +lw $3,8($8) +lw $9,12($8) +sw $3,60($29) +sw $9,64($29) +move $8,$24 +lw $3,0($8) +lw $9,4($8) +sw $3,68($29) +sw $9,72($29) +lw $3,8($8) +lw $9,12($8) +sw $3,76($29) +sw $9,80($29) +move $8,$24 +lw $3,0($8) +lw $9,4($8) +sw $3,84($29) +sw $9,88($29) +lw $3,8($8) +lw $9,12($8) +sw $3,92($29) +sw $9,96($29) +jal print +move $2,$0 +L.1: +lw $25,100($sp) +lw $31,104($sp) +addu $sp,$sp,112 +j $31 +.end main +.globl print +.text +.align 2 +.ent print +print: +.frame $sp,64,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-64 +.mask 0xc2800000,-32 +sw $23,20($sp) +.cprestore 24 +sw $30,28($sp) +sw $31,32($sp) +sw $4,64($sp) +sw $5,68($sp) +sw $6,72($sp) +sw $7,76($sp) +la $30,4+64($sp) +b L.18 +L.15: +lw $24,0+64($sp) +lb $24,($24) +la $15,37 +bne $24,$15,L.19 +lw $24,0+64($sp) +la $24,1($24) +sw $24,0+64($sp) +lb $23,($24) +la $24,115 +beq $23,$24,L.35 +bgt $23,$24,L.40 +L.39: +la $24,98 +blt $23,$24,L.21 +la $24,102 +bgt $23,$24,L.21 +sll $24,$23,2 +lw $24,L.41-392($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.41: +.gpword L.24 +.gpword L.29 +.gpword L.31 +.gpword L.21 +.gpword L.37 +.text +L.40: +la $24,119 +beq $23,$24,L.33 +b L.21 +L.24: +la $24,16($30) +move $30,$24 +la $15,-16+64($sp) +la $8,-16($24) +lw $3,0($8) +lw $9,4($8) +sw $3,0($15) +sw $9,4($15) +lw $3,8($8) +lw $9,12($8) +sw $3,8($15) +sw $9,12($15) +la $4,L.25 +lw $5,-16+64($sp) +lw $6,-12+64($sp) +lw $7,-8+64($sp) +lw $24,-4+64($sp) +sw $24,16($sp) +jal printf +b L.20 +L.29: +la $4,L.30 +la $24,4($30) +move $30,$24 +lb $5,-1($24) +jal printf +b L.20 +L.31: +la $4,L.32 +la $24,4($30) +move $30,$24 +lw $5,-4($24) +jal printf +b L.20 +L.33: +la $4,L.34 +la $24,4($30) +move $30,$24 +lh $5,-2($24) +jal printf +b L.20 +L.35: +la $4,L.36 +la $24,4($30) +move $30,$24 +lw $5,-4($24) +jal printf +b L.20 +L.37: +la $4,L.38 +move $24,$30 +la $24,15($24) +and $24,$24,0xfffffff8 +move $30,$24 +l.d $f18,-8($24) +mfc1.d $6,$f18 +jal printf +b L.20 +L.21: +la $4,L.30 +lw $24,0+64($sp) +lb $5,($24) +jal printf +b L.20 +L.19: +la $4,L.30 +lw $24,0+64($sp) +lb $5,($24) +jal printf +L.20: +L.16: +lw $24,0+64($sp) +la $24,1($24) +sw $24,0+64($sp) +L.18: +lw $24,0+64($sp) +lb $24,($24) +bne $24,$0,L.15 +move $2,$0 +L.12: +lw $23,20($sp) +lw $25,24($sp) +lw $30,28($sp) +lw $31,32($sp) +addu $sp,$sp,64 +j $31 +.end print +.lcomm __va_arg_tmp,4 +.rdata +.align 0 +L.38: +.byte 37 +.byte 102 +.byte 0 +.align 0 +L.36: +.byte 37 +.byte 115 +.byte 0 +.align 0 +L.34: +.byte 37 +.byte 120 +.byte 0 +.align 0 +L.32: +.byte 37 +.byte 100 +.byte 0 +.align 0 +L.30: +.byte 37 +.byte 99 +.byte 0 +.align 0 +L.25: +.byte 123 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 125 +.byte 0 +.align 0 +L.11: +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 10 +.byte 0 +.align 3 +L.10: +.word 0x40140000 +.word 0x0 +.align 0 +L.9: +.byte 37 +.byte 115 +.byte 37 +.byte 115 +.byte 32 +.byte 37 +.byte 102 +.byte 37 +.byte 99 +.byte 0 +.align 0 +L.8: +.byte 115 +.byte 116 +.byte 0 +.align 0 +L.7: +.byte 116 +.byte 101 +.byte 0 +.align 0 +L.6: +.byte 37 +.byte 115 +.byte 37 +.byte 115 +.byte 32 +.byte 37 +.byte 119 +.byte 37 +.byte 99 +.byte 0 +.align 0 +L.5: +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 37 +.byte 100 +.byte 37 +.byte 99 +.byte 0 +.align 0 +L.4: +.byte 50 +.byte 0 +.align 0 +L.3: +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.2: +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 49 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/stddef.h b/src/cmd/lccom-1/tst/mips-eb/stddef.h new file mode 100644 index 0000000..34fcc82 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/stddef.h @@ -0,0 +1,35 @@ +#ifndef __STDDEF +#define __STDDEF + +/* $Id: stddef.h,v 1.1 2002/08/28 23:59:59 drh Exp $ */ + +#ifndef NULL +#define NULL ((void*)0) +#endif +#define offsetof(ty,mem) ((size_t)((char*)&((ty*)0)->mem - (char*)0)) + +typedef long ptrdiff_t; + +#if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEFINED) +#define _SIZE_T +#define _SIZE_T_ +#define _SIZE_T_DEFINED +typedef unsigned long size_t; +#endif + +#if !defined(_WCHAR_T) && !defined(_WCHAR_T_) && !defined(_WCHAR_T_DEFINED) +#define _WCHAR_T +#define _WCHAR_T_ +#define _WCHAR_T_DEFINED +#if (_WCHAR_T_SIZE + 0) == 1 +typedef unsigned char wchar_t; +#elif (_WCHAR_T_SIZE + 0) == 2 +typedef unsigned short wchar_t; +#elif (_WCHAR_T_SIZE + 0) == 4 +typedef unsigned int wchar_t; +#else +typedef unsigned short wchar_t; +#endif +#endif + +#endif /* __STDDEF */ diff --git a/src/cmd/lccom-1/tst/mips-eb/stdio.h b/src/cmd/lccom-1/tst/mips-eb/stdio.h new file mode 100644 index 0000000..63fe5c2 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/stdio.h @@ -0,0 +1,102 @@ +#ifndef __STDIO +#define __STDIO + +#define _IOFBF 0 +#define _IOLBF 0100 +#define _IONBF 04 +#define BUFSIZ 1024 +#define EOF (-1) + +extern struct _iobuf { + int _cnt; + unsigned char *_ptr; + unsigned char *_base; + char _flag; + char _file; +} _iob[]; +#define FILE struct _iobuf +#define FILENAME_MAX 256 +#define FOPEN_MAX 100 + +#if !defined(_FPOS_T) && !defined(_FPOS_T_) && !defined(_FPOS_T_DEFINED) +#define _FPOS_T +#define _FPOS_T_ +#define _FPOS_T_DEFINED +typedef long fpos_t; +#endif + +#define L_tmpnam 25 +#ifndef NULL +#define NULL ((void*)0) +#endif +#define SEEK_CUR 1 +#define SEEK_END 2 +#define SEEK_SET 0 + +#if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEFINED) +#define _SIZE_T +#define _SIZE_T_ +#define _SIZE_T_DEFINED +typedef unsigned long size_t; +#endif + +#if !defined(_VA_LIST) && !defined(_VA_LIST_DEFINED) +#define _VA_LIST +#define _VA_LIST_DEFINED +typedef char *__va_list; +#endif + +#define stderr (&_iob[2]) +#define stdin (&_iob[0]) +#define stdout (&_iob[1]) +#define TMP_MAX 17576 + +extern int remove(const char *); +extern int rename(const char *, const char *); +extern FILE *tmpfile(void); +extern char *tmpnam(char *); +extern int fclose(FILE *); +extern int fflush(FILE *); +extern FILE *fopen(const char *, const char *); +extern FILE *freopen(const char *, const char *, FILE *); +extern void setbuf(FILE *, char *); +extern int setvbuf(FILE *, char *, int, size_t); +extern int fprintf(FILE *, const char *, ...); +extern int fscanf(FILE *, const char *, ...); +extern int printf(const char *, ...); +extern int scanf(const char *, ...); +extern int sprintf(char *, const char *, ...); +extern int sscanf(const char *, const char *, ...); +extern int vfprintf(FILE *, const char *, __va_list); +extern int vprintf(const char *, __va_list); +extern int vsprintf(char *, const char *, __va_list); +extern int fgetc(FILE *); +extern char *fgets(char *, int, FILE *); +extern int fputc(int, FILE *); +extern int fputs(const char *, FILE *); +extern int getc(FILE *); +extern int getchar(void); +extern char *gets(char *); +extern int putc(int, FILE *); +extern int putchar(int); +extern int puts(const char *); +extern int ungetc(int, FILE *); +extern size_t fread(void *, size_t, size_t, FILE *); +extern size_t fwrite(const void *, size_t, size_t, FILE *); +extern int fgetpos(FILE *, fpos_t *); +extern int fseek(FILE *, long int, int); +extern int fsetpos(FILE *, const fpos_t *); +extern long int ftell(FILE *); +extern void rewind(FILE *); +extern void clearerr(FILE *); +extern int feof(FILE *); +extern int ferror(FILE *); +extern void perror(const char *); + +#define _IOEOF 020 +#define _IOERR 040 + +#define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int) *(p)->_ptr++) +#define putc(x, p) (--(p)->_cnt < 0 ? _flsbuf((unsigned char) (x), p) : (int) (*(p)->_ptr++ = (unsigned char) (x))) +extern int _filbuf(FILE *), _flsbuf(unsigned, FILE *); +#endif /* __STDIO */ diff --git a/src/cmd/lccom-1/tst/mips-eb/stdlib.h b/src/cmd/lccom-1/tst/mips-eb/stdlib.h new file mode 100644 index 0000000..e8ce3f4 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/stdlib.h @@ -0,0 +1,66 @@ +#ifndef __STDLIB +#define __STDLIB + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#define MB_CUR_MAX 1 +#ifndef NULL +#define NULL ((void*)0) +#endif +#define RAND_MAX 32767 + +typedef struct { int quot, rem; } div_t; +typedef struct { long quot, rem; } ldiv_t; + +#if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEFINED) +#define _SIZE_T +#define _SIZE_T_ +#define _SIZE_T_DEFINED +typedef unsigned long size_t; +#endif + +#if !defined(_WCHAR_T) && !defined(_WCHAR_T_) && !defined(_WCHAR_T_DEFINED) +#define _WCHAR_T +#define _WCHAR_T_ +#define _WCHAR_T_DEFINED +#if (_WCHAR_T_SIZE + 0) == 1 +typedef unsigned char wchar_t; +#elif (_WCHAR_T_SIZE + 0) == 2 +typedef unsigned short wchar_t; +#elif (_WCHAR_T_SIZE + 0) == 4 +typedef unsigned int wchar_t; +#else +typedef unsigned short wchar_t; +#endif +#endif + +extern double atof(const char *); +extern int atoi(const char *); +extern long int atol(const char *); +extern double strtod(const char *, char **); +extern long int strtol(const char *, char **, int); +extern unsigned long int strtoul(const char *, char **, int); +extern int rand(void); +extern void srand(unsigned int); +extern void *calloc(size_t, size_t); +extern void free(void *); +extern void *malloc(size_t); +extern void *realloc(void *, size_t); +extern void abort(void); +extern int atexit(void (*)(void)); +extern void exit(int); +extern char *getenv(const char *); +extern int system(const char *); +extern void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); +extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); +extern int abs(int); +extern div_t div(int, int); +extern long int labs(long int); +extern ldiv_t ldiv(long int, long int); +extern int mblen(const char *, size_t); +extern int mbtowc(wchar_t *, const char *, size_t); +extern int wctomb(char *, wchar_t); +extern size_t mbstowcs(wchar_t *, const char *, size_t); +extern size_t wcstombs(char *, const wchar_t *, size_t); + +#endif /* __STDLIB */ diff --git a/src/cmd/lccom-1/tst/mips-eb/string.h b/src/cmd/lccom-1/tst/mips-eb/string.h new file mode 100644 index 0000000..c6ae2d3 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/string.h @@ -0,0 +1,38 @@ +#ifndef __STRING +#define __STRING + +#ifndef NULL +#define NULL ((void*)0) +#endif + +#if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEFINED) +#define _SIZE_T +#define _SIZE_T_ +#define _SIZE_T_DEFINED +typedef unsigned long size_t; +#endif + +void *memcpy(void *, const void *, size_t); +void *memmove(void *, const void *, size_t); +char *strcpy(char *, const char *); +char *strncpy(char *, const char *, size_t); +char *strcat(char *, const char *); +char *strncat(char *, const char *, size_t); +int memcmp(const void *, const void *, size_t); +int strcmp(const char *, const char *); +int strcoll(const char *, const char *); +int strncmp(const char *, const char *, size_t); +size_t strxfrm(char *, const char *, size_t); +void *memchr(const void *, int, size_t); +char *strchr(const char *, int); +size_t strcspn(const char *, const char *); +char *strpbrk(const char *, const char *); +char *strrchr(const char *, int); +size_t strspn(const char *, const char *); +char *strstr(const char *, const char *); +char *strtok(char *, const char *); +void *memset(void *, int, size_t); +char *strerror(int); +size_t strlen(const char *); + +#endif /* __STRING */ diff --git a/src/cmd/lccom-1/tst/mips-eb/struct.1bk b/src/cmd/lccom-1/tst/mips-eb/struct.1bk new file mode 100644 index 0000000..807f3da --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/struct.1bk @@ -0,0 +1,5 @@ +(-1,-1) is not within [10,10; 310,310] +(1,1) is not within [10,10; 310,310] +(20,300) is within [10,10; 310,310] +(500,400) is not within [10,10; 310,310] +ab diff --git a/src/cmd/lccom-1/tst/mips-eb/struct.2bk b/src/cmd/lccom-1/tst/mips-eb/struct.2bk new file mode 100644 index 0000000..cb0fbd0 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/struct.2bk @@ -0,0 +1,2 @@ +tst/struct.c:49: warning: missing return value +tst/struct.c:68: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/struct.sbk b/src/cmd/lccom-1/tst/mips-eb/struct.sbk new file mode 100644 index 0000000..73369d3 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/struct.sbk @@ -0,0 +1,485 @@ +.set reorder +.globl addpoint +.text +.text +.align 2 +.ent addpoint +addpoint: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +sw $5,4($sp) +sw $6,8($sp) +sw $7,12($sp) +lw $24,4+0($sp) +lw $15,12+0($sp) +addu $24,$24,$15 +sw $24,4+0($sp) +lw $24,8+0($sp) +lw $15,16+0($sp) +addu $24,$24,$15 +sw $24,8+0($sp) +la $8,4+0($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,0($4) +sw $9,4($4) +L.1: +j $31 +.end addpoint +.globl canonrect +.text +.align 2 +.ent canonrect +canonrect: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x40e00000,-20 +sw $21,0($sp) +sw $22,4($sp) +sw $23,8($sp) +sw $30,12($sp) +sw $5,36($sp) +sw $6,40($sp) +sw $7,44($sp) +lw $24,4+32($sp) +lw $15,12+32($sp) +bge $24,$15,L.10 +lw $30,4+32($sp) +b L.11 +L.10: +lw $30,12+32($sp) +L.11: +sw $30,-16+32($sp) +lw $24,8+32($sp) +lw $15,16+32($sp) +bge $24,$15,L.20 +lw $23,8+32($sp) +b L.21 +L.20: +lw $23,16+32($sp) +L.21: +sw $23,-12+32($sp) +lw $24,4+32($sp) +lw $15,12+32($sp) +ble $24,$15,L.26 +lw $22,4+32($sp) +b L.27 +L.26: +lw $22,12+32($sp) +L.27: +sw $22,-8+32($sp) +lw $24,8+32($sp) +lw $15,16+32($sp) +ble $24,$15,L.37 +lw $21,8+32($sp) +b L.38 +L.37: +lw $21,16+32($sp) +L.38: +sw $21,-4+32($sp) +la $8,-16+32($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,0($4) +sw $9,4($4) +lw $3,8($8) +lw $9,12($8) +sw $3,8($4) +sw $9,12($4) +L.5: +lw $21,0($sp) +lw $22,4($sp) +lw $23,8($sp) +lw $30,12($sp) +addu $sp,$sp,32 +j $31 +.end canonrect +.globl makepoint +.text +.align 2 +.ent makepoint +makepoint: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +sw $5,-8+16($sp) +sw $6,-4+16($sp) +la $8,-8+16($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,0($4) +sw $9,4($4) +L.39: +addu $sp,$sp,16 +j $31 +.end makepoint +.globl makerect +.text +.align 2 +.ent makerect +makerect: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0x82000000,-24 +.cprestore 20 +sw $31,24($sp) +sw $4,48($sp) +sw $5,52($sp) +sw $6,56($sp) +sw $7,60($sp) +la $24,-16+48($sp) +la $8,4+48($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,0($24) +sw $9,4($24) +la $24,-8+48($sp) +la $8,12+48($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,0($24) +sw $9,4($24) +lw $4,0+48($sp) +la $8,-16+48($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,4($29) +sw $9,8($29) +lw $3,8($8) +lw $9,12($8) +sw $3,12($29) +sw $9,16($29) +lw $5,4($sp) +lw $6,8($sp) +lw $7,12($sp) +jal canonrect +L.42: +lw $25,20($sp) +lw $31,24($sp) +addu $sp,$sp,48 +j $31 +.end makerect +.globl ptinrect +.text +.align 2 +.ent ptinrect +ptinrect: +.frame $sp,16,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-16 +.mask 0x40000000,-16 +sw $30,0($sp) +sw $4,16($sp) +sw $5,20($sp) +sw $6,24($sp) +sw $7,28($sp) +lw $24,0+16($sp) +lw $15,8+16($sp) +blt $24,$15,L.53 +lw $15,16+16($sp) +bge $24,$15,L.53 +lw $24,4+16($sp) +lw $15,12+16($sp) +blt $24,$15,L.53 +lw $24,4+16($sp) +lw $15,20+16($sp) +bge $24,$15,L.53 +la $30,1 +b L.54 +L.53: +move $30,$0 +L.54: +move $2,$30 +L.45: +lw $30,0($sp) +addu $sp,$sp,16 +j $31 +.end ptinrect +.globl y +.sdata +.align 0 +y: +.byte 97 +.byte 98 +.byte 0 +.globl odd +.text +.text +.align 2 +.ent odd +odd: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +la $24,-3+32($sp) +la $8,0+32($sp) +ulhu $3,0($8) +ush $3,0($24) +lbu $3,2($8) +sb $3,2($24) +la $4,L.56 +la $5,-3+32($sp) +jal printf +move $2,$0 +L.55: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end odd +.rdata +.align 2 +L.58: +.word 0x0 +.word 0x0 +.align 2 +L.59: +.word 0x140 +.word 0x140 +.align 2 +L.60: +.word 0xffffffff +.word 0xffffffff +.word 0x1 +.word 0x1 +.word 0x14 +.word 0x12c +.word 0x1f4 +.word 0x190 +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,144,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-144 +.mask 0xc2000000,-112 +.cprestore 24 +sw $30,28($sp) +sw $31,32($sp) +la $24,-64+144($sp) +la $8,L.58 +lw $3,0($8) +lw $9,4($8) +sw $3,0($24) +sw $9,4($24) +la $24,-72+144($sp) +la $8,L.59 +lw $3,0($8) +lw $9,4($8) +sw $3,0($24) +sw $9,4($24) +la $24,-32+144($sp) +la $8,L.60 +addu $8,$8,32 +addu $10,$24,32 +L.76: +addu $8,$8,-8 +addu $10,$10,-8 +lw $3,0($8) +lw $9,4($8) +sw $3,0($10) +sw $9,4($10) +bltu $24,$10,L.76 +la $4,-80+144($sp) +la $24,-10 +move $5,$24 +move $6,$24 +jal makepoint +la $4,-88+144($sp) +la $8,-72+144($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,4($29) +sw $9,8($29) +lw $5,4($sp) +lw $6,8($sp) +la $8,-80+144($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,12($29) +sw $9,16($29) +lw $7,12($sp) +jal addpoint +la $4,-96+144($sp) +la $24,10 +move $5,$24 +move $6,$24 +jal makepoint +la $4,-104+144($sp) +la $8,-64+144($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,4($29) +sw $9,8($29) +lw $5,4($sp) +lw $6,8($sp) +la $8,-96+144($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,12($29) +sw $9,16($29) +lw $7,12($sp) +jal addpoint +la $4,-48+144($sp) +la $8,-88+144($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,4($29) +sw $9,8($29) +lw $5,4($sp) +lw $6,8($sp) +la $8,-104+144($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,12($29) +sw $9,16($29) +lw $7,12($sp) +jal makerect +move $30,$0 +b L.64 +L.61: +la $4,-56+144($sp) +sll $24,$30,3 +la $15,-32+144($sp) +addu $15,$24,$15 +lw $5,($15) +la $15,-28+144($sp) +addu $24,$24,$15 +lw $6,($24) +jal makepoint +la $4,L.65 +sll $24,$30,3 +la $15,-32+144($sp) +addu $24,$24,$15 +lw $5,($24) +lw $6,-52+144($sp) +jal printf +la $8,-56+144($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,0($29) +sw $9,4($29) +lw $4,0($sp) +lw $5,4($sp) +la $8,-48+144($sp) +lw $3,0($8) +lw $9,4($8) +sw $3,8($29) +sw $9,12($29) +lw $3,8($8) +lw $9,12($8) +sw $3,16($29) +sw $9,20($29) +lw $6,8($sp) +lw $7,12($sp) +jal ptinrect +bne $2,$0,L.68 +la $4,L.70 +jal printf +L.68: +la $4,L.71 +lw $5,-48+144($sp) +lw $6,-44+144($sp) +lw $7,-40+144($sp) +lw $24,-36+144($sp) +sw $24,16($sp) +jal printf +L.62: +la $30,1($30) +L.64: +move $24,$30 +la $15,4 +bltu $24,$15,L.61 +la $8,y +ulhu $3,0($8) +sh $3,0($29) +lbu $3,2($8) +sb $3,2($29) +lw $4,0($sp) +jal odd +move $4,$0 +jal exit +move $2,$0 +L.57: +lw $25,24($sp) +lw $30,28($sp) +lw $31,32($sp) +addu $sp,$sp,144 +j $31 +.end main +.rdata +.align 0 +L.71: +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 105 +.byte 110 +.byte 32 +.byte 91 +.byte 37 +.byte 100 +.byte 44 +.byte 37 +.byte 100 +.byte 59 +.byte 32 +.byte 37 +.byte 100 +.byte 44 +.byte 37 +.byte 100 +.byte 93 +.byte 10 +.byte 0 +.align 0 +L.70: +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 0 +.align 0 +L.65: +.byte 40 +.byte 37 +.byte 100 +.byte 44 +.byte 37 +.byte 100 +.byte 41 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 0 +.align 0 +L.56: +.byte 37 +.byte 115 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/switch.1bk b/src/cmd/lccom-1/tst/mips-eb/switch.1bk new file mode 100644 index 0000000..de46a73 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/switch.1bk @@ -0,0 +1,76 @@ +b = 0x8 +f = 0xc +n = 0xa +r = 0xd +t = 0x9 +v = 0xb +x = 0x78 +f: +x = 0 +x = 1 +x = 2 +x = 2 +x = 2 +x = 2 +x = 2 +x = 7 +x = 8 +x = 9 +x = 9 +x = 9 +x = 9 +x = 9 +x = 9 +x = 9 +x = 16 +x = 17 +x = 18 +x = 19 +x = 20 +g: +1 1 +1 2 +2 3 +2 4 +2 5 +3 6 +d 6 +3 7 +d 7 +3 8 +d 8 +d 9 +d 10 +h: +i = 8 +i = 16 +i = 120 +i = 128 +i = 248 +i = 264 +i = 272 +i = 280 +i = 288 +i = 296 +i = 304 +i = 312 +488 defaults +x = 0x1000000 +x = 0x2000000 +x = 0x3000000 +x = 0x4000000 +x = 0x5000000 +x = 0x6000000 (default) +x = 0x7000000 (default) +0 +1 +2 +3 +4 +5 +0 +1 +2 +3 +4 +5 diff --git a/src/cmd/lccom-1/tst/mips-eb/switch.2bk b/src/cmd/lccom-1/tst/mips-eb/switch.2bk new file mode 100644 index 0000000..709b419 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/switch.2bk @@ -0,0 +1,5 @@ +tst/switch.c:55: warning: missing return value +tst/switch.c:73: warning: missing return value +tst/switch.c:97: warning: missing return value +tst/switch.c:112: warning: missing return value +tst/switch.c:137: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/switch.sbk b/src/cmd/lccom-1/tst/mips-eb/switch.sbk new file mode 100644 index 0000000..ccf60c9 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/switch.sbk @@ -0,0 +1,836 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2800000,-4 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +la $30,L.6 +b L.5 +L.2: +lb $4,($30) +jal backslash +move $24,$2 +la $4,L.7 +lb $5,($30) +move $6,$24 +jal printf +L.3: +la $30,1($30) +L.5: +lb $24,($30) +bne $24,$0,L.2 +jal f +jal g +jal h +la $23,16777216 +b L.11 +L.8: +move $4,$23 +jal big +L.9: +la $23,16777216($23) +L.11: +and $24,$23,117440512 +bne $24,$0,L.8 +jal limit +move $2,$0 +L.1: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end main +.globl backslash +.text +.align 2 +.ent backslash +backslash: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +la $24,102 +beq $4,$24,L.16 +bgt $4,$24,L.22 +L.21: +la $24,98 +beq $4,$24,L.15 +b L.13 +L.22: +la $24,110 +beq $4,$24,L.17 +blt $4,$24,L.13 +L.23: +la $24,114 +beq $4,$24,L.18 +la $24,116 +beq $4,$24,L.19 +la $24,118 +beq $4,$24,L.20 +b L.13 +L.15: +la $2,8 +b L.12 +L.16: +la $2,12 +b L.12 +L.17: +la $2,10 +b L.12 +L.18: +la $2,13 +b L.12 +L.19: +la $2,9 +b L.12 +L.20: +la $2,11 +b L.12 +L.13: +move $2,$4 +L.12: +j $31 +.end backslash +.globl f +.text +.align 2 +.ent f +f: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0xc2c00000,-16 +sw $22,16($sp) +sw $23,20($sp) +.cprestore 24 +sw $30,28($sp) +sw $31,32($sp) +move $23,$0 +la $4,L.25 +jal printf +move $30,$0 +L.26: +move $22,$30 +la $24,1 +blt $30,$24,L.30 +la $24,20 +bgt $30,$24,L.30 +sll $24,$30,2 +lw $24,L.42-4($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.42: +.gpword L.32 +.gpword L.33 +.gpword L.30 +.gpword L.30 +.gpword L.30 +.gpword L.30 +.gpword L.34 +.gpword L.35 +.gpword L.36 +.gpword L.30 +.gpword L.30 +.gpword L.30 +.gpword L.30 +.gpword L.30 +.gpword L.30 +.gpword L.37 +.gpword L.38 +.gpword L.39 +.gpword L.40 +.gpword L.41 +.text +L.32: +move $23,$30 +b L.31 +L.33: +move $23,$30 +b L.31 +L.34: +move $23,$30 +b L.31 +L.35: +move $23,$30 +b L.31 +L.36: +move $23,$30 +b L.31 +L.37: +move $23,$30 +b L.31 +L.38: +move $23,$30 +b L.31 +L.39: +move $23,$30 +b L.31 +L.40: +move $23,$30 +b L.31 +L.41: +move $23,$30 +L.30: +L.31: +la $4,L.44 +move $5,$23 +jal printf +L.27: +la $30,1($30) +la $24,20 +ble $30,$24,L.26 +move $2,$0 +L.24: +lw $22,16($sp) +lw $23,20($sp) +lw $25,24($sp) +lw $30,28($sp) +lw $31,32($sp) +addu $sp,$sp,48 +j $31 +.end f +.globl g +.text +.align 2 +.ent g +g: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +la $4,L.46 +jal printf +la $30,1 +L.47: +la $24,1001 +blt $30,$24,L.64 +la $24,1004 +bgt $30,$24,L.65 +sll $24,$30,2 +lw $24,L.66-4004($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.66: +.gpword L.60 +.gpword L.60 +.gpword L.60 +.gpword L.60 +.text +L.64: +la $24,1 +blt $30,$24,L.51 +la $24,8 +bgt $30,$24,L.51 +sll $24,$30,2 +lw $24,L.68-4($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.68: +.gpword L.53 +.gpword L.53 +.gpword L.55 +.gpword L.55 +.gpword L.55 +.gpword L.57 +.gpword L.57 +.gpword L.57 +.text +L.65: +la $24,3001 +blt $30,$24,L.51 +la $24,3004 +bgt $30,$24,L.51 +sll $24,$30,2 +lw $24,L.70-12004($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.70: +.gpword L.62 +.gpword L.62 +.gpword L.62 +.gpword L.62 +.text +L.53: +la $4,L.54 +move $5,$30 +jal printf +b L.52 +L.55: +la $4,L.56 +move $5,$30 +jal printf +b L.52 +L.57: +la $4,L.58 +move $5,$30 +jal printf +L.51: +la $4,L.59 +move $5,$30 +jal printf +b L.52 +L.60: +la $4,L.61 +move $5,$30 +jal printf +b L.52 +L.62: +la $4,L.63 +move $5,$30 +jal printf +L.52: +L.48: +la $30,1($30) +la $24,10 +ble $30,$24,L.47 +move $2,$0 +L.45: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end g +.globl h +.text +.align 2 +.ent h +h: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2800000,-4 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +move $23,$0 +la $4,L.73 +jal printf +la $30,1 +L.74: +la $24,264 +beq $30,$24,L.86 +bgt $30,$24,L.94 +L.93: +la $24,120 +beq $30,$24,L.84 +bgt $30,$24,L.96 +L.95: +la $24,8 +beq $30,$24,L.83 +blt $30,$24,L.78 +L.97: +la $24,16 +beq $30,$24,L.82 +b L.78 +L.96: +la $24,128 +beq $30,$24,L.80 +blt $30,$24,L.78 +L.98: +la $24,248 +beq $30,$24,L.87 +b L.78 +L.94: +la $24,288 +beq $30,$24,L.91 +bgt $30,$24,L.100 +L.99: +la $24,272 +beq $30,$24,L.88 +blt $30,$24,L.78 +L.101: +la $24,280 +beq $30,$24,L.85 +b L.78 +L.100: +la $24,304 +beq $30,$24,L.89 +bgt $30,$24,L.103 +L.102: +la $24,296 +beq $30,$24,L.90 +b L.78 +L.103: +la $24,312 +beq $30,$24,L.92 +b L.78 +L.78: +la $23,1($23) +b L.75 +L.80: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.82: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.83: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.84: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.85: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.86: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.87: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.88: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.89: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.90: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.91: +la $4,L.81 +move $5,$30 +jal printf +b L.79 +L.92: +la $4,L.81 +move $5,$30 +jal printf +L.79: +L.75: +la $30,1($30) +la $24,500 +ble $30,$24,L.74 +la $4,L.104 +move $5,$23 +jal printf +move $2,$0 +L.72: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end h +.globl big +.text +.align 2 +.ent big +big: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +sw $4,32($sp) +lw $24,0+32($sp) +and $30,$24,0x6000000 +la $15,33554432 +beq $30,$15,L.111 +bgt $30,$15,L.115 +L.114: +la $15,-2 +beq $30,$15,L.109 +la $15,-1 +beq $30,$15,L.109 +beq $30,$0,L.109 +b L.106 +L.115: +move $24,$30 +la $15,67108864 +beq $24,$15,L.112 +b L.106 +L.109: +la $4,L.110 +lw $5,0+32($sp) +jal printf +b L.107 +L.111: +la $4,L.110 +lw $5,0+32($sp) +jal printf +b L.107 +L.112: +la $4,L.110 +lw $5,0+32($sp) +jal printf +b L.107 +L.106: +la $4,L.113 +lw $5,0+32($sp) +jal printf +L.107: +move $2,$0 +L.105: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end big +.globl limit +.text +.align 2 +.ent limit +limit: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +la $30,-2147483648 +L.117: +la $24,-2147483648 +blt $30,$24,L.121 +la $15,-2147483644 +bgt $30,$15,L.121 +sll $15,$30,2 +sll $24,$24,2 +subu $24,$15,$24 +lw $24,L.134($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.134: +.gpword L.123 +.gpword L.125 +.gpword L.127 +.gpword L.129 +.gpword L.131 +.text +L.123: +la $4,L.124 +jal printf +b L.122 +L.125: +la $4,L.126 +jal printf +b L.122 +L.127: +la $4,L.128 +jal printf +b L.122 +L.129: +la $4,L.130 +jal printf +b L.122 +L.131: +la $4,L.132 +jal printf +b L.122 +L.121: +la $4,L.133 +jal printf +L.122: +L.118: +la $30,1($30) +la $24,-2147483643 +ble $30,$24,L.117 +la $30,2147483647 +L.135: +la $24,2147483643 +blt $30,$24,L.139 +la $15,2147483647 +bgt $30,$15,L.139 +sll $15,$30,2 +sll $24,$24,2 +subu $24,$15,$24 +lw $24,L.146($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.146: +.gpword L.145 +.gpword L.144 +.gpword L.143 +.gpword L.142 +.gpword L.141 +.text +L.141: +la $4,L.124 +jal printf +b L.140 +L.142: +la $4,L.126 +jal printf +b L.140 +L.143: +la $4,L.128 +jal printf +b L.140 +L.144: +la $4,L.130 +jal printf +b L.140 +L.145: +la $4,L.132 +jal printf +b L.140 +L.139: +la $4,L.133 +jal printf +L.140: +L.136: +subu $30,$30,1 +la $24,2147483642 +bge $30,$24,L.135 +move $2,$0 +L.116: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end limit +.rdata +.align 0 +L.133: +.byte 53 +.byte 10 +.byte 0 +.align 0 +L.132: +.byte 52 +.byte 10 +.byte 0 +.align 0 +L.130: +.byte 51 +.byte 10 +.byte 0 +.align 0 +L.128: +.byte 50 +.byte 10 +.byte 0 +.align 0 +L.126: +.byte 49 +.byte 10 +.byte 0 +.align 0 +L.124: +.byte 48 +.byte 10 +.byte 0 +.align 0 +L.113: +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 32 +.byte 40 +.byte 100 +.byte 101 +.byte 102 +.byte 97 +.byte 117 +.byte 108 +.byte 116 +.byte 41 +.byte 10 +.byte 0 +.align 0 +L.110: +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 10 +.byte 0 +.align 0 +L.104: +.byte 37 +.byte 100 +.byte 32 +.byte 100 +.byte 101 +.byte 102 +.byte 97 +.byte 117 +.byte 108 +.byte 116 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.81: +.byte 105 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.73: +.byte 104 +.byte 58 +.byte 10 +.byte 0 +.align 0 +L.63: +.byte 54 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.61: +.byte 53 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.59: +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.58: +.byte 51 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.56: +.byte 50 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.54: +.byte 49 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.46: +.byte 103 +.byte 58 +.byte 10 +.byte 0 +.align 0 +L.44: +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.25: +.byte 102 +.byte 58 +.byte 10 +.byte 0 +.align 0 +L.7: +.byte 37 +.byte 99 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 10 +.byte 0 +.align 0 +L.6: +.byte 98 +.byte 102 +.byte 110 +.byte 114 +.byte 116 +.byte 118 +.byte 120 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/time.h b/src/cmd/lccom-1/tst/mips-eb/time.h new file mode 100644 index 0000000..6b7a3c1 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/time.h @@ -0,0 +1,51 @@ +#ifndef __TIME +#define __TIME + +#define CLOCKS_PER_SEC 1000000 +#ifndef NULL +#define NULL ((void*)0) +#endif + +#if !defined(_CLOCK_T) && !defined(_CLOCK_T_) && !defined(_CLOCK_T_DEFINED) +#define _CLOCK_T +#define _CLOCK_T_ +#define _CLOCK_T_DEFINED +typedef long clock_t; +#endif + +#if !defined(_TIME_T) && !defined(_TIME_T_) && !defined(_TIME_T_DEFINED) +#define _TIME_T +#define _TIME_T_ +#define _TIME_T_DEFINED +typedef long time_t; +#endif + +#if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEFINED) +#define _SIZE_T +#define _SIZE_T_ +#define _SIZE_T_DEFINED +typedef unsigned long size_t; +#endif + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; +extern clock_t clock(void); +extern double difftime(time_t, time_t); +extern time_t mktime(struct tm *); +extern time_t time(time_t *); +extern char *asctime(const struct tm *); +extern char *ctime(const time_t *); +extern struct tm *gmtime(const time_t *); +extern struct tm *localtime(const time_t *); +extern size_t strftime(char *, size_t, const char *, const struct tm *); + +#endif /* __TIME */ diff --git a/src/cmd/lccom-1/tst/mips-eb/wf1.1bk b/src/cmd/lccom-1/tst/mips-eb/wf1.1bk new file mode 100644 index 0000000..a846267 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/wf1.1bk @@ -0,0 +1,74 @@ +5 a +2 and +5 buf +16 c +8 char +1 compare +4 cond +5 count +1 d +1 die +3 else +1 entry +1 eof +4 err +1 error +1 exit +1 folded +1 for +1 free +1 frequencies +1 frequency +1 get +2 getchar +3 getword +14 if +2 in +1 index +1 input +1 install +8 int +1 into +1 is +4 isletter +1 it +1 itself +5 left +1 letter +7 lookup +1 main +2 malloc +1 message +2 n +1 necessary +12 next +9 node +4 of +1 on +1 or +1 otherwise +2 out +8 p +3 print +2 printf +16 return +5 right +4 root +25 s +2 storage +3 strcmp +1 strcpy +1 strlen +8 struct +1 structures +2 subtree +1 t +5 tprint +9 tree +1 uses +1 version +1 wf +3 while +21 word +9 words +2 z diff --git a/src/cmd/lccom-1/tst/mips-eb/wf1.2bk b/src/cmd/lccom-1/tst/mips-eb/wf1.2bk new file mode 100644 index 0000000..190e4a1 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/wf1.2bk @@ -0,0 +1,2 @@ +tst/wf1.c:29: warning: missing return value +tst/wf1.c:87: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/wf1.sbk b/src/cmd/lccom-1/tst/mips-eb/wf1.sbk new file mode 100644 index 0000000..541ea9f --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/wf1.sbk @@ -0,0 +1,378 @@ +.set reorder +.globl main +.text +.text +.align 2 +.ent main +main: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0x82000000,-28 +.cprestore 16 +sw $31,20($sp) +sw $0,-24+48($sp) +sw $0,next +b L.3 +L.2: +la $4,-20+48($sp) +la $5,-24+48($sp) +jal lookup +lw $15,($2) +la $15,1($15) +sw $15,($2) +L.3: +la $4,-20+48($sp) +jal getword +bne $2,$0,L.2 +lw $4,-24+48($sp) +jal tprint +move $2,$0 +L.1: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,48 +j $31 +.end main +.globl err +.text +.align 2 +.ent err +err: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +la $4,L.6 +lw $5,0+32($sp) +jal printf +la $4,1 +jal exit +move $2,$0 +L.5: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end err +.globl getword +.text +.align 2 +.ent getword +getword: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2800000,-4 +sw $23,16($sp) +.cprestore 20 +sw $30,24($sp) +sw $31,28($sp) +sw $4,32($sp) +L.8: +L.9: +jal getchar +move $24,$2 +move $30,$24 +la $15,-1 +beq $24,$15,L.11 +move $4,$30 +jal isletter +beq $2,$0,L.8 +L.11: +lw $23,0+32($sp) +b L.15 +L.12: +move $24,$23 +la $23,1($24) +move $15,$30 +sb $15,($24) +L.13: +jal getchar +move $30,$2 +L.15: +move $4,$30 +jal isletter +move $30,$2 +bne $2,$0,L.12 +sb $0,($23) +move $24,$23 +lw $15,0+32($sp) +bleu $24,$15,L.16 +la $2,1 +b L.7 +L.16: +move $2,$0 +L.7: +lw $23,16($sp) +lw $25,20($sp) +lw $30,24($sp) +lw $31,28($sp) +addu $sp,$sp,32 +j $31 +.end getword +.globl isletter +.text +.align 2 +.ent isletter +isletter: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +la $24,65 +blt $4,$24,L.19 +la $24,90 +bgt $4,$24,L.19 +la $4,32($4) +L.19: +la $24,97 +blt $4,$24,L.21 +la $24,122 +bgt $4,$24,L.21 +move $2,$4 +b L.18 +L.21: +move $2,$0 +L.18: +j $31 +.end isletter +.globl lookup +.text +.align 2 +.ent lookup +lookup: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +sw $4,32($sp) +move $30,$5 +lw $24,($30) +beq $24,$0,L.24 +lw $4,0+32($sp) +lw $24,($30) +lw $5,12($24) +jal strcmp +sw $2,-4+32($sp) +lw $24,-4+32($sp) +bge $24,$0,L.26 +lw $4,0+32($sp) +lw $24,($30) +la $5,4($24) +jal lookup +move $24,$2 +b L.23 +L.26: +lw $24,-4+32($sp) +ble $24,$0,L.28 +lw $4,0+32($sp) +lw $24,($30) +la $5,8($24) +jal lookup +move $24,$2 +b L.23 +L.28: +lw $2,($30) +b L.23 +L.24: +lw $24,next +la $15,2000 +blt $24,$15,L.30 +la $4,L.32 +jal err +L.30: +lw $24,next +sll $24,$24,4 +sw $0,words($24) +lw $24,next +sll $24,$24,4 +sw $0,words+8($24) +sw $0,words+4($24) +lw $4,0+32($sp) +jal strlen +move $24,$2 +la $4,1($24) +jal malloc +lw $15,next +sll $15,$15,4 +sw $2,words+12($15) +lw $24,next +sll $24,$24,4 +lw $24,words+12($24) +bne $24,$0,L.36 +la $4,L.39 +jal err +L.36: +lw $24,next +sll $24,$24,4 +lw $4,words+12($24) +lw $5,0+32($sp) +jal strcpy +lw $24,next +la $15,1($24) +sw $15,next +sll $24,$24,4 +la $24,words($24) +sw $24,($30) +move $2,$24 +L.23: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end lookup +.globl tprint +.text +.align 2 +.ent tprint +tprint: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +move $30,$4 +move $24,$30 +beq $24,$0,L.42 +lw $4,4($30) +jal tprint +la $4,L.44 +lw $5,($30) +lw $6,12($30) +jal printf +lw $4,8($30) +jal tprint +L.42: +move $2,$0 +L.41: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end tprint +.globl strcmp +.text +.align 2 +.ent strcmp +strcmp: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +b L.47 +L.46: +move $24,$4 +la $4,1($24) +lb $24,($24) +bne $24,$0,L.49 +move $2,$0 +b L.45 +L.49: +la $5,1($5) +L.47: +lb $24,($4) +lb $15,($5) +beq $24,$15,L.46 +lb $24,($4) +bne $24,$0,L.51 +la $2,-1 +b L.45 +L.51: +lb $24,($5) +bne $24,$0,L.53 +la $2,1 +b L.45 +L.53: +lb $24,($4) +lb $15,($5) +subu $2,$24,$15 +L.45: +j $31 +.end strcmp +.globl next +.comm next,4 +.globl words +.comm words,32000 +.rdata +.align 0 +L.44: +.byte 37 +.byte 100 +.byte 9 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.39: +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 119 +.byte 111 +.byte 114 +.byte 100 +.byte 32 +.byte 115 +.byte 116 +.byte 111 +.byte 114 +.byte 97 +.byte 103 +.byte 101 +.byte 0 +.align 0 +L.32: +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 110 +.byte 111 +.byte 100 +.byte 101 +.byte 32 +.byte 115 +.byte 116 +.byte 111 +.byte 114 +.byte 97 +.byte 103 +.byte 101 +.byte 0 +.align 0 +L.6: +.byte 63 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 diff --git a/src/cmd/lccom-1/tst/mips-eb/yacc.1bk b/src/cmd/lccom-1/tst/mips-eb/yacc.1bk new file mode 100644 index 0000000..60de9b5 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/yacc.1bk @@ -0,0 +1,10 @@ +a +b +load +negate +push 5 +c +load +multiply +add +store diff --git a/src/cmd/lccom-1/tst/mips-eb/yacc.2bk b/src/cmd/lccom-1/tst/mips-eb/yacc.2bk new file mode 100644 index 0000000..4b6dc39 --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/yacc.2bk @@ -0,0 +1,3 @@ +tst/yacc.c:345: warning: missing return value +tst/yacc.c:349: warning: missing return value +tst/yacc.c:360: warning: missing return value diff --git a/src/cmd/lccom-1/tst/mips-eb/yacc.sbk b/src/cmd/lccom-1/tst/mips-eb/yacc.sbk new file mode 100644 index 0000000..b31cbdc --- /dev/null +++ b/src/cmd/lccom-1/tst/mips-eb/yacc.sbk @@ -0,0 +1,2240 @@ +.set reorder +.globl yyin +.sdata +.align 2 +yyin: +.word 0x0 +.globl yyout +.sdata +.align 2 +yyout: +.word 0x0 +.globl yylex +.text +.text +.align 2 +.ent yylex +yylex: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0xc2000000,-8 +.cprestore 16 +sw $30,20($sp) +sw $31,24($sp) +b L.3 +L.2: +L.5: +la $24,-1 +blt $30,$24,L.6 +la $24,4 +bgt $30,$24,L.6 +sll $24,$30,2 +lw $24,L.17+4($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.17: +.gpword L.7 +.gpword L.8 +.gpword L.11 +.gpword L.12 +.gpword L.7 +.gpword L.14 +.text +L.8: +jal yywrap +beq $2,$0,L.7 +move $2,$0 +b L.1 +L.11: +la $2,257 +b L.1 +L.12: +la $2,258 +b L.1 +L.14: +lb $2,yytext +b L.1 +L.6: +lw $4,yyout +la $5,L.16 +move $6,$30 +jal fprintf +L.7: +L.3: +jal yylook +move $30,$2 +bge $2,$0,L.2 +move $2,$0 +L.1: +lw $25,16($sp) +lw $30,20($sp) +lw $31,24($sp) +addu $sp,$sp,32 +j $31 +.end yylex +.globl yyvstop +.data +.align 2 +yyvstop: +.word 0x0 +.word 0x4 +.word 0x0 +.word 0x3 +.word 0x4 +.word 0x0 +.word 0x2 +.word 0x4 +.word 0x0 +.word 0x1 +.word 0x4 +.word 0x0 +.word 0x2 +.word 0x0 +.word 0x1 +.word 0x0 +.word 0x0 +.globl yycrank +.data +.align 0 +yycrank: +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x1 +.byte 0x3 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x1 +.byte 0x4 +.byte 0x1 +.byte 0x3 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x1 +.byte 0x5 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x5 +.byte 0x7 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x1 +.byte 0x6 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x6 +.byte 0x8 +.byte 0x0 +.byte 0x0 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x6 +.byte 0x8 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.globl yysvec +.data +.align 2 +yysvec: +.word 0x0 +.word 0x0 +.word 0x0 +.word yycrank-2 +.word 0x0 +.word 0x0 +.word yycrank +.word yysvec+12 +.word 0x0 +.word yycrank +.word 0x0 +.word yyvstop+4 +.word yycrank +.word 0x0 +.word yyvstop+12 +.word yycrank+4 +.word 0x0 +.word yyvstop+24 +.word yycrank+38 +.word 0x0 +.word yyvstop+36 +.word yycrank +.word yysvec+60 +.word yyvstop+48 +.word yycrank +.word yysvec+72 +.word yyvstop+56 +.word 0x0 +.word 0x0 +.word 0x0 +.globl yytop +.sdata +.align 2 +yytop: +.word yycrank+282 +.globl yybgin +.sdata +.align 2 +yybgin: +.word yysvec+12 +.globl yymatch +.data +.align 0 +yymatch: +.byte 0 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 9 +.byte 10 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 9 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 65 +.byte 1 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 0 +.globl yyextra +.data +.align 0 +yyextra: +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.globl yylineno +.sdata +.align 2 +yylineno: +.word 0x1 +.globl yysptr +.sdata +.align 2 +yysptr: +.word yysbuf +.globl yyprevious +.sdata +.align 2 +yyprevious: +.word 0xa +.globl yylook +.text +.text +.align 2 +.ent yylook +yylook: +.frame $sp,80,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-80 +.mask 0xc2ff0000,-24 +sw $16,16($sp) +sw $17,20($sp) +sw $18,24($sp) +sw $19,28($sp) +sw $20,32($sp) +sw $21,36($sp) +sw $22,40($sp) +sw $23,44($sp) +.cprestore 48 +sw $30,52($sp) +sw $31,56($sp) +lw $24,yymorfg +bne $24,$0,L.34 +la $21,yytext +b L.35 +L.34: +sw $0,yymorfg +lw $24,yyleng +la $21,yytext($24) +L.35: +L.36: +la $23,yylstate +lw $24,yybgin +move $30,$24 +sw $24,yyestate +lw $24,yyprevious +la $15,10 +bne $24,$15,L.40 +la $30,12($30) +L.40: +L.42: +lw $22,($30) +move $24,$22 +la $15,yycrank +bne $24,$15,L.46 +lw $18,4($30) +move $24,$18 +bne $24,$0,L.48 +b L.93 +L.48: +lw $24,($18) +la $15,yycrank +bne $24,$15,L.50 +b L.93 +L.50: +L.46: +move $24,$21 +sw $24,-12+80($sp) +la $21,1($24) +lw $15,yysptr +la $14,yysbuf +bleu $15,$14,L.60 +lw $15,yysptr +la $15,-1($15) +sw $15,yysptr +lb $15,($15) +sw $15,-4+80($sp) +b L.61 +L.60: +lw $15,yyin +lw $14,($15) +subu $14,$14,1 +sw $14,($15) +bge $14,$0,L.62 +lw $4,yyin +jal _filbuf +move $24,$2 +sw $24,-8+80($sp) +b L.63 +L.62: +lw $24,yyin +la $24,4($24) +lw $15,($24) +la $14,1($15) +sw $14,($24) +lbu $24,($15) +sw $24,-8+80($sp) +L.63: +lw $24,-8+80($sp) +sw $24,-4+80($sp) +L.61: +lw $24,-4+80($sp) +sw $24,yytchar +la $15,10 +bne $24,$15,L.58 +lw $24,yylineno +la $24,1($24) +sw $24,yylineno +lw $16,yytchar +b L.59 +L.58: +lw $16,yytchar +L.59: +la $24,-1 +bne $16,$24,L.56 +move $17,$0 +b L.57 +L.56: +lw $17,yytchar +L.57: +move $20,$17 +move $24,$17 +lw $15,-12+80($sp) +sb $24,($15) +L.64: +move $19,$22 +move $24,$22 +la $15,yycrank +bleu $24,$15,L.65 +sll $24,$20,1 +addu $22,$24,$19 +move $24,$22 +lw $15,yytop +bgtu $24,$15,L.66 +la $24,12 +lb $15,($22) +mul $24,$24,$15 +la $24,yysvec($24) +move $15,$30 +bne $24,$15,L.66 +la $24,yysvec +la $15,12 +lb $14,1($22) +mul $15,$15,$14 +la $15,yysvec($15) +bne $15,$24,L.69 +la $24,-1($21) +move $21,$24 +lb $24,($24) +sw $24,yytchar +lw $24,yytchar +la $15,10 +bne $24,$15,L.71 +lw $24,yylineno +subu $24,$24,1 +sw $24,yylineno +L.71: +lw $24,yysptr +la $15,1($24) +sw $15,yysptr +lw $15,yytchar +sb $15,($24) +b L.93 +L.69: +move $24,$23 +la $23,4($24) +la $15,12 +lb $14,1($22) +mul $15,$15,$14 +la $15,yysvec($15) +move $30,$15 +sw $15,($24) +b L.42 +L.65: +move $24,$22 +la $15,yycrank +bgeu $24,$15,L.74 +la $24,yycrank +move $15,$22 +subu $24,$24,$15 +la $15,2 +div $24,$24,$15 +sll $24,$24,1 +la $24,yycrank($24) +move $19,$24 +move $22,$24 +sll $24,$20,1 +addu $22,$24,$22 +move $24,$22 +lw $15,yytop +bgtu $24,$15,L.76 +la $24,12 +lb $15,($22) +mul $24,$24,$15 +la $24,yysvec($24) +move $15,$30 +bne $24,$15,L.76 +la $24,yysvec +la $15,12 +lb $14,1($22) +mul $15,$15,$14 +la $15,yysvec($15) +bne $15,$24,L.78 +la $24,-1($21) +move $21,$24 +lb $24,($24) +sw $24,yytchar +lw $24,yytchar +la $15,10 +bne $24,$15,L.80 +lw $24,yylineno +subu $24,$24,1 +sw $24,yylineno +L.80: +lw $24,yysptr +la $15,1($24) +sw $15,yysptr +lw $15,yytchar +sb $15,($24) +b L.93 +L.78: +move $24,$23 +la $23,4($24) +la $15,12 +lb $14,1($22) +mul $15,$15,$14 +la $15,yysvec($15) +move $30,$15 +sw $15,($24) +b L.42 +L.76: +lb $24,yymatch($20) +sll $24,$24,1 +addu $22,$24,$19 +move $24,$22 +lw $15,yytop +bgtu $24,$15,L.82 +la $24,12 +lb $15,($22) +mul $24,$24,$15 +la $24,yysvec($24) +move $15,$30 +bne $24,$15,L.82 +la $24,yysvec +la $15,12 +lb $14,1($22) +mul $15,$15,$14 +la $15,yysvec($15) +bne $15,$24,L.84 +la $24,-1($21) +move $21,$24 +lb $24,($24) +sw $24,yytchar +lw $24,yytchar +la $15,10 +bne $24,$15,L.86 +lw $24,yylineno +subu $24,$24,1 +sw $24,yylineno +L.86: +lw $24,yysptr +la $15,1($24) +sw $15,yysptr +lw $15,yytchar +sb $15,($24) +b L.93 +L.84: +move $24,$23 +la $23,4($24) +la $15,12 +lb $14,1($22) +mul $15,$15,$14 +la $15,yysvec($15) +move $30,$15 +sw $15,($24) +b L.42 +L.82: +L.74: +L.66: +lw $24,4($30) +move $30,$24 +beq $24,$0,L.88 +lw $24,($30) +move $22,$24 +la $15,yycrank +beq $24,$15,L.88 +b L.64 +L.88: +la $24,-1($21) +move $21,$24 +lb $24,($24) +sw $24,yytchar +lw $24,yytchar +la $15,10 +bne $24,$15,L.90 +lw $24,yylineno +subu $24,$24,1 +sw $24,yylineno +L.90: +lw $24,yysptr +la $15,1($24) +sw $15,yysptr +lw $15,yytchar +sb $15,($24) +b L.93 +L.92: +move $24,$21 +la $21,-1($24) +sb $0,($24) +lw $24,($23) +move $15,$0 +move $14,$24 +beq $14,$15,L.95 +lw $24,8($24) +sw $24,yyfnd +beq $24,$15,L.95 +lw $24,yyfnd +lw $24,($24) +ble $24,$0,L.95 +sw $23,yyolsp +lw $24,yyfnd +lw $24,($24) +lb $24,yyextra($24) +beq $24,$0,L.97 +b L.100 +L.99: +la $23,-4($23) +move $24,$21 +la $21,-1($24) +lb $24,($24) +sw $24,yytchar +lw $24,yytchar +la $15,10 +bne $24,$15,L.102 +lw $24,yylineno +subu $24,$24,1 +sw $24,yylineno +L.102: +lw $24,yysptr +la $15,1($24) +sw $15,yysptr +lw $15,yytchar +sb $15,($24) +L.100: +lw $24,($23) +lw $4,8($24) +lw $24,yyfnd +lw $24,($24) +negu $5,$24 +jal yyback +la $15,1 +beq $2,$15,L.104 +move $24,$23 +la $15,yylstate +bgtu $24,$15,L.99 +L.104: +L.97: +lb $24,($21) +sw $24,yyprevious +sw $23,yylsp +la $24,yytext +move $15,$21 +subu $24,$15,$24 +la $24,1($24) +sw $24,yyleng +lw $24,yyleng +sb $0,yytext($24) +lw $24,yyfnd +la $15,4($24) +sw $15,yyfnd +lw $2,($24) +b L.33 +L.95: +lb $24,($21) +sw $24,yytchar +lw $24,yytchar +la $15,10 +bne $24,$15,L.105 +lw $24,yylineno +subu $24,$24,1 +sw $24,yylineno +L.105: +lw $24,yysptr +la $15,1($24) +sw $15,yysptr +lw $15,yytchar +sb $15,($24) +L.93: +move $24,$23 +la $23,-4($24) +la $15,yylstate +bgtu $24,$15,L.92 +lb $24,yytext +bne $24,$0,L.107 +la $24,yysbuf +sw $24,yysptr +move $2,$0 +b L.33 +L.107: +lw $24,yysptr +la $15,yysbuf +bleu $24,$15,L.117 +lw $24,yysptr +la $24,-1($24) +sw $24,yysptr +lb $24,($24) +sw $24,-4+80($sp) +b L.118 +L.117: +lw $24,yyin +lw $15,($24) +subu $15,$15,1 +sw $15,($24) +bge $15,$0,L.119 +lw $4,yyin +jal _filbuf +move $24,$2 +sw $24,-8+80($sp) +b L.120 +L.119: +lw $24,yyin +la $24,4($24) +lw $15,($24) +la $14,1($15) +sw $14,($24) +lbu $24,($15) +sw $24,-8+80($sp) +L.120: +lw $24,-8+80($sp) +sw $24,-4+80($sp) +L.118: +lw $24,-4+80($sp) +sw $24,yytchar +la $15,10 +bne $24,$15,L.115 +lw $24,yylineno +la $24,1($24) +sw $24,yylineno +lw $16,yytchar +b L.116 +L.115: +lw $16,yytchar +L.116: +la $24,-1 +bne $16,$24,L.113 +move $17,$0 +b L.114 +L.113: +lw $17,yytchar +L.114: +sb $17,yytext +sll $24,$17,8*(4-1); sra $24,$24,8*(4-1) +sw $24,yyprevious +lw $24,yyprevious +ble $24,$0,L.121 +lw $24,yyout +lw $15,($24) +subu $15,$15,1 +sw $15,($24) +bge $15,$0,L.124 +lw $24,yyprevious +and $24,$24,(1<<(8*1))-1 +move $4,$24 +lw $5,yyout +jal _flsbuf +b L.125 +L.124: +lw $24,yyout +la $24,4($24) +lw $15,($24) +la $14,1($15) +sw $14,($24) +lw $24,yyprevious +sb $24,($15) +L.125: +L.121: +la $21,yytext +b L.36 +L.33: +lw $16,16($sp) +lw $17,20($sp) +lw $18,24($sp) +lw $19,28($sp) +lw $20,32($sp) +lw $21,36($sp) +lw $22,40($sp) +lw $23,44($sp) +lw $25,48($sp) +lw $30,52($sp) +lw $31,56($sp) +addu $sp,$sp,80 +j $31 +.end yylook +.globl yyback +.text +.align 2 +.ent yyback +yyback: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +move $24,$4 +bne $24,$0,L.130 +move $2,$0 +b L.126 +L.129: +move $24,$4 +la $4,4($24) +lw $24,($24) +bne $24,$5,L.132 +la $2,1 +b L.126 +L.132: +L.130: +lw $24,($4) +bne $24,$0,L.129 +move $2,$0 +L.126: +j $31 +.end yyback +.globl yyinput +.text +.align 2 +.ent yyinput +yyinput: +.frame $sp,48,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-48 +.mask 0xc2e00000,-12 +sw $21,16($sp) +sw $22,20($sp) +sw $23,24($sp) +.cprestore 28 +sw $30,32($sp) +sw $31,36($sp) +lw $24,yysptr +la $15,yysbuf +bleu $24,$15,L.143 +lw $24,yysptr +la $24,-1($24) +sw $24,yysptr +lb $22,($24) +b L.144 +L.143: +lw $24,yyin +lw $15,($24) +subu $15,$15,1 +sw $15,($24) +bge $15,$0,L.145 +lw $4,yyin +jal _filbuf +move $24,$2 +move $21,$24 +b L.146 +L.145: +lw $24,yyin +la $24,4($24) +lw $15,($24) +la $14,1($15) +sw $14,($24) +lbu $21,($15) +L.146: +move $22,$21 +L.144: +sw $22,yytchar +la $24,10 +bne $22,$24,L.141 +lw $24,yylineno +la $24,1($24) +sw $24,yylineno +lw $23,yytchar +b L.142 +L.141: +lw $23,yytchar +L.142: +la $24,-1 +bne $23,$24,L.139 +move $30,$0 +b L.140 +L.139: +lw $30,yytchar +L.140: +move $2,$30 +L.134: +lw $21,16($sp) +lw $22,20($sp) +lw $23,24($sp) +lw $25,28($sp) +lw $30,32($sp) +lw $31,36($sp) +addu $sp,$sp,48 +j $31 +.end yyinput +.globl yyoutput +.text +.align 2 +.ent yyoutput +yyoutput: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +lw $24,yyout +lw $15,($24) +subu $15,$15,1 +sw $15,($24) +bge $15,$0,L.149 +lw $24,0+32($sp) +and $24,$24,(1<<(8*1))-1 +move $4,$24 +lw $5,yyout +jal _flsbuf +b L.150 +L.149: +lw $24,yyout +la $24,4($24) +lw $15,($24) +la $14,1($15) +sw $14,($24) +lw $24,0+32($sp) +sb $24,($15) +L.150: +move $2,$0 +L.147: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end yyoutput +.globl yyunput +.text +.align 2 +.ent yyunput +yyunput: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +sw $4,yytchar +lw $24,yytchar +la $15,10 +bne $24,$15,L.152 +lw $24,yylineno +subu $24,$24,1 +sw $24,yylineno +L.152: +lw $24,yysptr +la $15,1($24) +sw $15,yysptr +lw $15,yytchar +sb $15,($24) +move $2,$0 +L.151: +j $31 +.end yyunput +.globl main +.text +.align 2 +.ent main +main: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +la $24,_iob +sw $24,yyin +la $24,_iob+16 +sw $24,yyout +jal yyparse +move $2,$0 +L.154: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end main +.globl yyerror +.text +.align 2 +.ent yyerror +yyerror: +.frame $sp,32,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-32 +.mask 0x82000000,-12 +.cprestore 16 +sw $31,20($sp) +sw $4,32($sp) +la $4,L.157 +lw $5,0+32($sp) +jal printf +move $2,$0 +L.156: +lw $25,16($sp) +lw $31,20($sp) +addu $sp,$sp,32 +j $31 +.end yyerror +.globl yyexca +.data +.align 1 +yyexca: +.half 0xffff +.half 0x1 +.half 0x0 +.half 0xffff +.half 0xfffe +.half 0x0 +.globl yyact +.data +.align 1 +yyact: +.half 0xc +.half 0x2 +.half 0x9 +.half 0x8 +.half 0x11 +.half 0xb +.half 0x19 +.half 0x11 +.half 0xf +.half 0x12 +.half 0x10 +.half 0xa +.half 0x12 +.half 0x11 +.half 0xf +.half 0x7 +.half 0x10 +.half 0xd +.half 0x12 +.half 0x5 +.half 0x3 +.half 0x1 +.half 0x0 +.half 0x13 +.half 0x14 +.half 0x0 +.half 0x0 +.half 0x15 +.half 0x16 +.half 0x17 +.half 0x18 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x6 +.half 0xe +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x4 +.half 0x6 +.globl yypact +.data +.align 1 +yypact: +.half 0xfc18 +.half 0xfff7 +.half 0xfc18 +.half 0x5 +.half 0xfff9 +.half 0xffc5 +.half 0xfc18 +.half 0xfc18 +.half 0xfc18 +.half 0xffd8 +.half 0xffe3 +.half 0xffd8 +.half 0xffd8 +.half 0xfc18 +.half 0xfc18 +.half 0xffd8 +.half 0xffd8 +.half 0xffd8 +.half 0xffd8 +.half 0xffda +.half 0xffdd +.half 0xffda +.half 0xffda +.half 0xfc18 +.half 0xfc18 +.half 0xfc18 +.globl yypgo +.data +.align 1 +yypgo: +.half 0x0 +.half 0x15 +.half 0x14 +.half 0x11 +.half 0xb +.globl yyr1 +.data +.align 1 +yyr1: +.half 0x0 +.half 0x1 +.half 0x1 +.half 0x1 +.half 0x1 +.half 0x2 +.half 0x4 +.half 0x4 +.half 0x4 +.half 0x4 +.half 0x4 +.half 0x4 +.half 0x4 +.half 0x4 +.half 0x3 +.globl yyr2 +.data +.align 1 +yyr2: +.half 0x0 +.half 0x0 +.half 0x2 +.half 0x3 +.half 0x3 +.half 0x3 +.half 0x3 +.half 0x3 +.half 0x3 +.half 0x3 +.half 0x2 +.half 0x3 +.half 0x1 +.half 0x1 +.half 0x1 +.globl yychk +.data +.align 1 +yychk: +.half 0xfc18 +.half 0xffff +.half 0xa +.half 0xfffe +.half 0x100 +.half 0xfffd +.half 0x101 +.half 0xa +.half 0xa +.half 0x3d +.half 0xfffc +.half 0x2d +.half 0x28 +.half 0xfffd +.half 0x102 +.half 0x2b +.half 0x2d +.half 0x2a +.half 0x2f +.half 0xfffc +.half 0xfffc +.half 0xfffc +.half 0xfffc +.half 0xfffc +.half 0xfffc +.half 0x29 +.globl yydef +.data +.align 1 +yydef: +.half 0x1 +.half 0xfffe +.half 0x2 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0xe +.half 0x3 +.half 0x4 +.half 0x0 +.half 0x5 +.half 0x0 +.half 0x0 +.half 0xc +.half 0xd +.half 0x0 +.half 0x0 +.half 0x0 +.half 0x0 +.half 0xa +.half 0x0 +.half 0x6 +.half 0x7 +.half 0x8 +.half 0x9 +.half 0xb +.globl yychar +.sdata +.align 2 +yychar: +.word 0xffffffff +.globl yynerrs +.sdata +.align 2 +yynerrs: +.word 0x0 +.globl yyerrflag +.sdata +.align 1 +yyerrflag: +.half 0x0 +.globl yyparse +.text +.text +.align 2 +.ent yyparse +yyparse: +.frame $sp,368,$31 +.set noreorder +.cpload $25 +.set reorder +addu $sp,$sp,-368 +.mask 0xc2fe0000,-316 +sw $17,16($sp) +sw $18,20($sp) +sw $19,24($sp) +sw $20,28($sp) +sw $21,32($sp) +sw $22,36($sp) +sw $23,40($sp) +.cprestore 44 +sw $30,48($sp) +sw $31,52($sp) +move $24,$0 +move $23,$24 +la $15,-1 +sw $15,yychar +sw $0,yynerrs +sh $24,yyerrflag +la $22,-302+368($sp) +la $20,yyv-4 +L.161: +la $24,2($22) +move $22,$24 +la $15,-2+368($sp) +bleu $24,$15,L.162 +la $4,L.165 +jal yyerror +la $2,1 +b L.158 +L.162: +sh $23,($22) +la $20,4($20) +lw $24,yyval +sw $24,($20) +L.166: +sll $24,$23,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +lh $21,yypact($24) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,-1000 +bgt $24,$15,L.167 +b L.169 +L.167: +lw $24,yychar +bge $24,$0,L.170 +jal yylex +sw $2,yychar +bge $2,$0,L.172 +sw $0,yychar +L.172: +L.170: +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +lw $15,yychar +addu $24,$24,$15 +move $21,$24 +sll $24,$24,8*(4-2); sra $24,$24,8*(4-2) +blt $24,$0,L.176 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +la $15,249 +blt $24,$15,L.174 +L.176: +b L.169 +L.174: +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +lh $24,yyact($24) +move $21,$24 +sll $24,$24,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +lh $24,yychk($24) +lw $15,yychar +bne $24,$15,L.177 +la $24,-1 +sw $24,yychar +lw $24,yylval +sw $24,yyval +move $23,$21 +lh $24,yyerrflag +ble $24,$0,L.161 +lh $24,yyerrflag +subu $24,$24,1 +sh $24,yyerrflag +b L.161 +L.177: +L.169: +sll $24,$23,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +lh $24,yydef($24) +move $21,$24 +sll $24,$24,8*(4-2); sra $24,$24,8*(4-2) +la $15,-2 +bne $24,$15,L.181 +lw $24,yychar +bge $24,$0,L.183 +jal yylex +sw $2,yychar +bge $2,$0,L.185 +sw $0,yychar +L.185: +L.183: +la $19,yyexca +b L.190 +L.187: +L.188: +la $19,4($19) +L.190: +lh $24,($19) +la $15,-1 +bne $24,$15,L.187 +lh $24,2($19) +sll $15,$23,8*(4-2); sra $15,$15,8*(4-2) +bne $24,$15,L.187 +b L.192 +L.191: +lh $24,($19) +lw $15,yychar +bne $24,$15,L.194 +b L.193 +L.194: +L.192: +la $24,4($19) +move $19,$24 +lh $24,($24) +bge $24,$0,L.191 +L.193: +lh $24,2($19) +move $21,$24 +sll $24,$24,8*(4-2); sra $24,$24,8*(4-2) +bge $24,$0,L.196 +move $2,$0 +b L.158 +L.196: +L.181: +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +bne $24,$0,L.198 +lh $17,yyerrflag +blt $17,$0,L.200 +la $24,3 +bgt $17,$24,L.200 +sll $24,$17,2 +lw $24,L.216($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.216: +.gpword L.203 +.gpword L.206 +.gpword L.206 +.gpword L.213 +.text +L.203: +la $4,L.204 +jal yyerror +L.205: +lw $24,yynerrs +la $24,1($24) +sw $24,yynerrs +L.206: +la $24,3 +sh $24,yyerrflag +b L.208 +L.207: +lh $24,($22) +sll $24,$24,1 +lh $24,yypact($24) +la $24,256($24) +move $21,$24 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +blt $24,$0,L.210 +la $15,249 +bge $24,$15,L.210 +sll $24,$24,1 +lh $24,yyact($24) +sll $24,$24,1 +lh $24,yychk($24) +la $15,256 +bne $24,$15,L.210 +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +lh $23,yyact($24) +b L.161 +L.210: +lh $24,($22) +sll $24,$24,1 +lh $21,yypact($24) +la $22,-2($22) +la $20,-4($20) +L.208: +move $24,$22 +la $15,-300+368($sp) +bgeu $24,$15,L.207 +L.212: +la $2,1 +b L.158 +L.213: +lw $24,yychar +bne $24,$0,L.214 +b L.212 +L.214: +la $24,-1 +sw $24,yychar +b L.166 +L.200: +L.198: +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +la $15,yyr2($24) +lh $14,($15) +sll $14,$14,1 +subu $22,$22,$14 +move $30,$20 +lh $15,($15) +sll $15,$15,2 +subu $20,$20,$15 +lw $15,4($20) +sw $15,yyval +sh $21,-302+368($sp) +lh $21,yyr1($24) +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +lh $24,yypgo($24) +lh $15,($22) +addu $24,$24,$15 +la $24,1($24) +move $18,$24 +sll $24,$18,8*(4-2); sra $24,$24,8*(4-2) +la $15,249 +bge $24,$15,L.219 +sll $24,$24,1 +lh $24,yyact($24) +move $23,$24 +sll $24,$24,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +lh $24,yychk($24) +sll $15,$21,8*(4-2); sra $15,$15,8*(4-2) +negu $15,$15 +beq $24,$15,L.217 +L.219: +sll $24,$21,8*(4-2); sra $24,$24,8*(4-2) +sll $24,$24,1 +lh $24,yypgo($24) +sll $24,$24,1 +lh $23,yyact($24) +L.217: +lh $17,-302+368($sp) +la $24,4 +blt $17,$24,L.161 +la $24,14 +bgt $17,$24,L.161 +sll $24,$17,2 +lw $24,L.241-16($24) +.cpadd $24 +j $24 +.rdata +.align 2 +L.241: +.gpword L.223 +.gpword L.224 +.gpword L.226 +.gpword L.228 +.gpword L.230 +.gpword L.232 +.gpword L.234 +.gpword L.161 +.gpword L.236 +.gpword L.238 +.gpword L.240 +.text +L.223: +sh $0,yyerrflag +b L.161 +L.224: +la $4,L.225 +jal printf +b L.161 +L.226: +la $4,L.227 +jal printf +b L.161 +L.228: +la $4,L.229 +jal printf +b L.161 +L.230: +la $4,L.231 +jal printf +b L.161 +L.232: +la $4,L.233 +jal printf +b L.161 +L.234: +la $4,L.235 +jal printf +b L.161 +L.236: +la $4,L.237 +jal printf +b L.161 +L.238: +la $4,L.239 +la $5,yytext +jal printf +b L.161 +L.240: +la $4,L.157 +la $5,yytext +jal printf +b L.161 +L.158: +lw $17,16($sp) +lw $18,20($sp) +lw $19,24($sp) +lw $20,28($sp) +lw $21,32($sp) +lw $22,36($sp) +lw $23,40($sp) +lw $25,44($sp) +lw $30,48($sp) +lw $31,52($sp) +addu $sp,$sp,368 +j $31 +.end yyparse +.globl yywrap +.text +.align 2 +.ent yywrap +yywrap: +.frame $sp,0,$31 +.set noreorder +.cpload $25 +.set reorder +la $2,1 +L.243: +j $31 +.end yywrap +.globl yyv +.comm yyv,600 +.globl yyfnd +.comm yyfnd,4 +.globl yyolsp +.comm yyolsp,4 +.globl yylsp +.comm yylsp,4 +.globl yylstate +.comm yylstate,800 +.globl yyestate +.comm yyestate,4 +.globl yytchar +.comm yytchar,4 +.globl yysbuf +.comm yysbuf,200 +.globl yymorfg +.comm yymorfg,4 +.globl yytext +.comm yytext,200 +.globl yyleng +.comm yyleng,4 +.extern _iob 0 +.globl yyval +.comm yyval,4 +.globl yylval +.comm yylval,4 +.rdata +.align 0 +L.239: +.byte 112 +.byte 117 +.byte 115 +.byte 104 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.237: +.byte 108 +.byte 111 +.byte 97 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.235: +.byte 110 +.byte 101 +.byte 103 +.byte 97 +.byte 116 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.233: +.byte 100 +.byte 105 +.byte 118 +.byte 105 +.byte 100 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.231: +.byte 109 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 121 +.byte 10 +.byte 0 +.align 0 +L.229: +.byte 110 +.byte 101 +.byte 103 +.byte 97 +.byte 116 +.byte 101 +.byte 10 +.byte 97 +.byte 100 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.227: +.byte 97 +.byte 100 +.byte 100 +.byte 10 +.byte 0 +.align 0 +L.225: +.byte 115 +.byte 116 +.byte 111 +.byte 114 +.byte 101 +.byte 10 +.byte 0 +.align 0 +L.204: +.byte 115 +.byte 121 +.byte 110 +.byte 116 +.byte 97 +.byte 120 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 0 +.align 0 +L.165: +.byte 121 +.byte 97 +.byte 99 +.byte 99 +.byte 32 +.byte 115 +.byte 116 +.byte 97 +.byte 99 +.byte 107 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 0 +.align 0 +L.157: +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 0 +L.16: +.byte 98 +.byte 97 +.byte 100 +.byte 32 +.byte 115 +.byte 119 +.byte 105 +.byte 116 +.byte 99 +.byte 104 +.byte 32 +.byte 121 +.byte 121 +.byte 108 +.byte 111 +.byte 111 +.byte 107 +.byte 32 +.byte 37 +.byte 100 +.byte 0 diff --git a/src/cmd/lccom-1/tst/paranoia.c b/src/cmd/lccom-1/tst/paranoia.c new file mode 100644 index 0000000..ec9f8ce --- /dev/null +++ b/src/cmd/lccom-1/tst/paranoia.c @@ -0,0 +1,2203 @@ +#undef V9 +#define NOPAUSE +/* A C version of Kahan's Floating Point Test "Paranoia" + + Thos Sumner, UCSF, Feb. 1985 + David Gay, BTL, Jan. 1986 + + This is a rewrite from the Pascal version by + + B. A. Wichmann, 18 Jan. 1985 + + (and does NOT exhibit good C programming style). + +(C) Apr 19 1983 in BASIC version by: + Professor W. M. Kahan, + 567 Evans Hall + Electrical Engineering & Computer Science Dept. + University of California + Berkeley, California 94720 + USA + +converted to Pascal by: + B. A. Wichmann + National Physical Laboratory + Teddington Middx + TW11 OLW + UK + +converted to C by: + + David M. Gay and Thos Sumner + AT&T Bell Labs Computer Center, Rm. U-76 + 600 Mountain Avenue University of California + Murray Hill, NJ 07974 San Francisco, CA 94143 + USA USA + +with simultaneous corrections to the Pascal source (reflected +in the Pascal source available over netlib). +[A couple of bug fixes from dgh = sun!dhough incorporated 31 July 1986.] + +Reports of results on various systems from all the versions +of Paranoia are being collected by Richard Karpinski at the +same address as Thos Sumner. This includes sample outputs, +bug reports, and criticisms. + +You may copy this program freely if you acknowledge its source. +Comments on the Pascal version to NPL, please. + + +The C version catches signals from floating-point exceptions. +If signal(SIGFPE,...) is unavailable in your environment, you may +#define NOSIGNAL to comment out the invocations of signal. + +This source file is too big for some C compilers, but may be split +into pieces. Comments containing "SPLIT" suggest convenient places +for this splitting. At the end of these comments is an "ed script" +(for the UNIX(tm) editor ed) that will do this splitting. + +By #defining Single when you compile this source, you may obtain +a single-precision C version of Paranoia. + + +The following is from the introductory commentary from Wichmann's work: + +The BASIC program of Kahan is written in Microsoft BASIC using many +facilities which have no exact analogy in Pascal. The Pascal +version below cannot therefore be exactly the same. Rather than be +a minimal transcription of the BASIC program, the Pascal coding +follows the conventional style of block-structured languages. Hence +the Pascal version could be useful in producing versions in other +structured languages. + +Rather than use identifiers of minimal length (which therefore have +little mnemonic significance), the Pascal version uses meaningful +identifiers as follows [Note: A few changes have been made for C]: + + +BASIC C BASIC C BASIC C + + A J S StickyBit + A1 AInverse J0 NoErrors T + B Radix [Failure] T0 Underflow + B1 BInverse J1 NoErrors T2 ThirtyTwo + B2 RadixD2 [SeriousDefect] T5 OneAndHalf + B9 BMinusU2 J2 NoErrors T7 TwentySeven + C [Defect] T8 TwoForty + C1 CInverse J3 NoErrors U OneUlp + D [Flaw] U0 UnderflowThreshold + D4 FourD K PageNo U1 + E0 L Milestone U2 + E1 M V + E2 Exp2 N V0 + E3 N1 V8 + E5 MinSqEr O Zero V9 + E6 SqEr O1 One W + E7 MaxSqEr O2 Two X + E8 O3 Three X1 + E9 O4 Four X8 + F1 MinusOne O5 Five X9 Random1 + F2 Half O8 Eight Y + F3 Third O9 Nine Y1 + F6 P Precision Y2 + F9 Q Y9 Random2 + G1 GMult Q8 Z + G2 GDiv Q9 Z0 PseudoZero + G3 GAddSub R Z1 + H R1 RMult Z2 + H1 HInverse R2 RDiv Z9 + I R3 RAddSub + IO NoTrials R4 RSqrt + I3 IEEE R9 Random9 + + SqRWrng + +All the variables in BASIC are true variables and in consequence, +the program is more difficult to follow since the "constants" must +be determined (the glossary is very helpful). The Pascal version +uses Real constants, but checks are added to ensure that the values +are correctly converted by the compiler. + +The major textual change to the Pascal version apart from the +identifiersis that named procedures are used, inserting parameters +wherehelpful. New procedures are also introduced. The +correspondence is as follows: + + +BASIC Pascal +lines + + 90- 140 Pause + 170- 250 Instructions + 380- 460 Heading + 480- 670 Characteristics + 690- 870 History +2940-2950 Random +3710-3740 NewD +4040-4080 DoesYequalX +4090-4110 PrintIfNPositive +4640-4850 TestPartialUnderflow + +=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + +Below is an "ed script" that splits para.c into 10 files +of the form part[1-8].c, subs.c, and msgs.c, plus a header +file, paranoia.h, that these files require. + +r paranoia.c +$ +?SPLIT ++,$w msgs.c + .,$d +?SPLIT + .d ++d +-,$w subs.c +-,$d +?part8 ++d +?include + .,$w part8.c + .,$d +-d +?part7 ++d +?include + .,$w part7.c + .,$d +-d +?part6 ++d +?include + .,$w part6.c + .,$d +-d +?part5 ++d +?include + .,$w part5.c + .,$d +-d +?part4 ++d +?include + .,$w part4.c + .,$d +-d +?part3 ++d +?include + .,$w part3.c + .,$d +-d +?part2 ++d +?include + .,$w part2.c + .,$d +?SPLIT + .d +1,/^#include/-1d +1,$w part1.c +/Computed constants/,$d +1,$s/^int/extern &/ +1,$s/^FLOAT/extern &/ +1,$s/^char/extern &/ +1,$s! = .*!;! +/^Guard/,/^Round/s/^/extern / +/^jmp_buf/s/^/extern / +/^Sig_type/s/^/extern / +s/$/\ +extern void sigfpe();/ +w paranoia.h +q + +*/ + +#include +#ifndef NOSIGNAL +#include +#endif +#include + +extern double fabs(), floor(), log(), pow(), sqrt(); + +#ifdef Single +#define FLOAT float +#define FABS(x) (float)fabs((double)(x)) +#define FLOOR(x) (float)floor((double)(x)) +#define LOG(x) (float)log((double)(x)) +#define POW(x,y) (float)pow((double)(x),(double)(y)) +#define SQRT(x) (float)sqrt((double)(x)) +#else +#define FLOAT double +#define FABS(x) fabs(x) +#define FLOOR(x) floor(x) +#define LOG(x) log(x) +#define POW(x,y) pow(x,y) +#define SQRT(x) sqrt(x) +#endif + +jmp_buf ovfl_buf; +typedef void (*Sig_type)(); +Sig_type sigsave; + +#define KEYBOARD 0 + +FLOAT Radix, BInvrse, RadixD2, BMinusU2; +FLOAT Sign(), Random(); + +/*Small floating point constants.*/ +FLOAT Zero = 0.0; +FLOAT Half = 0.5; +FLOAT One = 1.0; +FLOAT Two = 2.0; +FLOAT Three = 3.0; +FLOAT Four = 4.0; +FLOAT Five = 5.0; +FLOAT Eight = 8.0; +FLOAT Nine = 9.0; +FLOAT TwentySeven = 27.0; +FLOAT ThirtyTwo = 32.0; +FLOAT TwoForty = 240.0; +FLOAT MinusOne = -1.0; +FLOAT OneAndHalf = 1.5; +/*Integer constants*/ +int NoTrials = 20; /*Number of tests for commutativity. */ +#define False 0 +#define True 1 + +/* Definitions for declared types + Guard == (Yes, No); + Rounding == (Chopped, Rounded, Other); + Message == packed array [1..40] of char; + Class == (Flaw, Defect, Serious, Failure); + */ +#define Yes 1 +#define No 0 +#define Chopped 2 +#define Rounded 1 +#define Other 0 +#define Flaw 3 +#define Defect 2 +#define Serious 1 +#define Failure 0 +typedef int Guard, Rounding, Class; +typedef char Message; + +/* Declarations of Variables */ +int Indx; +char ch[8]; +FLOAT AInvrse, A1; +FLOAT C, CInvrse; +FLOAT D, FourD; +FLOAT E0, E1, Exp2, E3, MinSqEr; +FLOAT SqEr, MaxSqEr, E9; +FLOAT Third; +FLOAT F6, F9; +FLOAT H, HInvrse; +int I; +FLOAT StickyBit, J; +FLOAT MyZero; +FLOAT Precision; +FLOAT Q, Q9; +FLOAT R, Random9; +FLOAT T, Underflow, S; +FLOAT OneUlp, UfThold, U1, U2; +FLOAT V, V0, V9; +FLOAT W; +FLOAT X, X1, X2, X8, Random1; +FLOAT Y, Y1, Y2, Random2; +FLOAT Z, PseudoZero, Z1, Z2, Z9; +int ErrCnt[4]; +int fpecount; +int Milestone; +int PageNo; +int M, N, N1; +Guard GMult, GDiv, GAddSub; +Rounding RMult, RDiv, RAddSub, RSqrt; +int Break, Done, NotMonot, Monot, Anomaly, IEEE, + SqRWrng, UfNGrad; +/* Computed constants. */ +/*U1 gap below 1.0, i.e, 1.0-U1 is next number below 1.0 */ +/*U2 gap above 1.0, i.e, 1.0+U2 is next number above 1.0 */ + +/* floating point exception receiver */ + void +sigfpe(i) +{ + fpecount++; + printf("\n* * * FLOATING-POINT ERROR * * *\n"); + fflush(stdout); + if (sigsave) { +#ifndef NOSIGNAL + signal(SIGFPE, sigsave); +#endif + sigsave = 0; + longjmp(ovfl_buf, 1); + } + abort(); +} + +main() +{ +#ifdef mc + char *out; + ieee_flags("set", "precision", "double", &out); +#endif + /* First two assignments use integer right-hand sides. */ + Zero = 0; + One = 1; + Two = One + One; + Three = Two + One; + Four = Three + One; + Five = Four + One; + Eight = Four + Four; + Nine = Three * Three; + TwentySeven = Nine * Three; + ThirtyTwo = Four * Eight; + TwoForty = Four * Five * Three * Four; + MinusOne = -One; + Half = One / Two; + OneAndHalf = One + Half; + ErrCnt[Failure] = 0; + ErrCnt[Serious] = 0; + ErrCnt[Defect] = 0; + ErrCnt[Flaw] = 0; + PageNo = 1; + /*=============================================*/ + Milestone = 0; + /*=============================================*/ +#ifndef NOSIGNAL + signal(SIGFPE, sigfpe); +#endif + Instructions(); + Pause(); + Heading(); + Pause(); + Characteristics(); + Pause(); + History(); + Pause(); + /*=============================================*/ + Milestone = 7; + /*=============================================*/ + printf("Program is now RUNNING tests on small integers:\n"); + + TstCond (Failure, (Zero + Zero == Zero) && (One - One == Zero) + && (One > Zero) && (One + One == Two), + "0+0 != 0, 1-1 != 0, 1 <= 0, or 1+1 != 2"); + Z = - Zero; + if (Z != 0.0) { + ErrCnt[Failure] = ErrCnt[Failure] + 1; + printf("Comparison alleges that -0.0 is Non-zero!\n"); + U1 = 0.001; + Radix = 1; + TstPtUf(); + } + TstCond (Failure, (Three == Two + One) && (Four == Three + One) + && (Four + Two * (- Two) == Zero) + && (Four - Three - One == Zero), + "3 != 2+1, 4 != 3+1, 4+2*(-2) != 0, or 4-3-1 != 0"); + TstCond (Failure, (MinusOne == (0 - One)) + && (MinusOne + One == Zero ) && (One + MinusOne == Zero) + && (MinusOne + FABS(One) == Zero) + && (MinusOne + MinusOne * MinusOne == Zero), + "-1+1 != 0, (-1)+abs(1) != 0, or -1+(-1)*(-1) != 0"); + TstCond (Failure, Half + MinusOne + Half == Zero, + "1/2 + (-1) + 1/2 != 0"); + /*=============================================*/ + /*SPLIT + part2(); + part3(); + part4(); + part5(); + part6(); + part7(); + part8(); + } +#include "paranoia.h" +part2(){ +*/ + Milestone = 10; + /*=============================================*/ + TstCond (Failure, (Nine == Three * Three) + && (TwentySeven == Nine * Three) && (Eight == Four + Four) + && (ThirtyTwo == Eight * Four) + && (ThirtyTwo - TwentySeven - Four - One == Zero), + "9 != 3*3, 27 != 9*3, 32 != 8*4, or 32-27-4-1 != 0"); + TstCond (Failure, (Five == Four + One) && + (TwoForty == Four * Five * Three * Four) + && (TwoForty / Three - Four * Four * Five == Zero) + && ( TwoForty / Four - Five * Three * Four == Zero) + && ( TwoForty / Five - Four * Three * Four == Zero), + "5 != 4+1, 240/3 != 80, 240/4 != 60, or 240/5 != 48"); + if (ErrCnt[Failure] == 0) { + printf("-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.\n"); + printf("\n"); + } + printf("Searching for Radix and Precision.\n"); + W = One; + do { + W = W + W; + Y = W + One; + Z = Y - W; + Y = Z - One; + } while (MinusOne + FABS(Y) < Zero); + /*.. now W is just big enough that |((W+1)-W)-1| >= 1 ...*/ + Precision = Zero; + Y = One; + do { + Radix = W + Y; + Y = Y + Y; + Radix = Radix - W; + } while ( Radix == Zero); + if (Radix < Two) Radix = One; + printf("Radix = %f .\n", Radix); + if (Radix != 1) { + W = One; + do { + Precision = Precision + One; + W = W * Radix; + Y = W + One; + } while ((Y - W) == One); + } + /*... now W == Radix^Precision is barely too big to satisfy (W+1)-W == 1 + ...*/ + U1 = One / W; + U2 = Radix * U1; + printf("Closest relative separation found is U1 = %.7e .\n\n", U1); + printf("Recalculating radix and precision\n "); + + /*save old values*/ + E0 = Radix; + E1 = U1; + E9 = U2; + E3 = Precision; + + X = Four / Three; + Third = X - One; + F6 = Half - Third; + X = F6 + F6; + X = FABS(X - Third); + if (X < U2) X = U2; + + /*... now X = (unknown no.) ulps of 1+...*/ + do { + U2 = X; + Y = Half * U2 + ThirtyTwo * U2 * U2; + Y = One + Y; + X = Y - One; + } while ( ! ((U2 <= X) || (X <= Zero))); + + /*... now U2 == 1 ulp of 1 + ... */ + X = Two / Three; + F6 = X - Half; + Third = F6 + F6; + X = Third - Half; + X = FABS(X + F6); + if (X < U1) X = U1; + + /*... now X == (unknown no.) ulps of 1 -... */ + do { + U1 = X; + Y = Half * U1 + ThirtyTwo * U1 * U1; + Y = Half - Y; + X = Half + Y; + Y = Half - X; + X = Half + Y; + } while ( ! ((U1 <= X) || (X <= Zero))); + /*... now U1 == 1 ulp of 1 - ... */ + if (U1 == E1) printf("confirms closest relative separation U1 .\n"); + else printf("gets better closest relative separation U1 = %.7e .\n", U1); + W = One / U1; + F9 = (Half - U1) + Half; + Radix = FLOOR(0.01 + U2 / U1); + if (Radix == E0) printf("Radix confirmed.\n"); + else printf("MYSTERY: recalculated Radix = %.7e .\n", Radix); + TstCond (Defect, Radix <= Eight + Eight, + "Radix is too big: roundoff problems"); + TstCond (Flaw, (Radix == Two) || (Radix == 10) + || (Radix == One), "Radix is not as good as 2 or 10"); + /*=============================================*/ + Milestone = 20; + /*=============================================*/ + TstCond (Failure, F9 - Half < Half, + "(1-U1)-1/2 < 1/2 is FALSE, prog. fails?"); + X = F9; + I = 1; + Y = X - Half; + Z = Y - Half; + TstCond (Failure, (X != One) + || (Z == Zero), "Comparison is fuzzy,X=1 but X-1/2-1/2 != 0"); + X = One + U2; + I = 0; + /*=============================================*/ + Milestone = 25; + /*=============================================*/ + /*... BMinusU2 = nextafter(Radix, 0) */ + BMinusU2 = Radix - One; + BMinusU2 = (BMinusU2 - U2) + One; + /* Purify Integers */ + if (Radix != One) { + X = - TwoForty * LOG(U1) / LOG(Radix); + Y = FLOOR(Half + X); + if (FABS(X - Y) * Four < One) X = Y; + Precision = X / TwoForty; + Y = FLOOR(Half + Precision); + if (FABS(Precision - Y) * TwoForty < Half) Precision = Y; + } + if ((Precision != FLOOR(Precision)) || (Radix == One)) { + printf("Precision cannot be characterized by an Integer number\n"); + printf("of significant digits but, by itself, this is a minor flaw.\n"); + } + if (Radix == One) + printf("logarithmic encoding has precision characterized solely by U1.\n"); + else printf("The number of significant digits of the Radix is %f .\n", + Precision); + TstCond (Serious, U2 * Nine * Nine * TwoForty < One, + "Precision worse than 5 decimal figures "); + /*=============================================*/ + Milestone = 30; + /*=============================================*/ + /* Test for extra-precise subepressions */ + X = FABS(((Four / Three - One) - One / Four) * Three - One / Four); + do { + Z2 = X; + X = (One + (Half * Z2 + ThirtyTwo * Z2 * Z2)) - One; + } while ( ! ((Z2 <= X) || (X <= Zero))); + X = Y = Z = FABS((Three / Four - Two / Three) * Three - One / Four); + do { + Z1 = Z; + Z = (One / Two - ((One / Two - (Half * Z1 + ThirtyTwo * Z1 * Z1)) + + One / Two)) + One / Two; + } while ( ! ((Z1 <= Z) || (Z <= Zero))); + do { + do { + Y1 = Y; + Y = (Half - ((Half - (Half * Y1 + ThirtyTwo * Y1 * Y1)) + Half + )) + Half; + } while ( ! ((Y1 <= Y) || (Y <= Zero))); + X1 = X; + X = ((Half * X1 + ThirtyTwo * X1 * X1) - F9) + F9; + } while ( ! ((X1 <= X) || (X <= Zero))); + if ((X1 != Y1) || (X1 != Z1)) { + BadCond(Serious, "Disagreements among the values X1, Y1, Z1,\n"); + printf("respectively %.7e, %.7e, %.7e,\n", X1, Y1, Z1); + printf("are symptoms of inconsistencies introduced\n"); + printf("by extra-precise evaluation of arithmetic subexpressions.\n"); + notify("Possibly some part of this"); + if ((X1 == U1) || (Y1 == U1) || (Z1 == U1)) printf( + "That feature is not tested further by this program.\n") ; + } + else { + if ((Z1 != U1) || (Z2 != U2)) { + if ((Z1 >= U1) || (Z2 >= U2)) { + BadCond(Failure, ""); + notify("Precision"); + printf("\tU1 = %.7e, Z1 - U1 = %.7e\n",U1,Z1-U1); + printf("\tU2 = %.7e, Z2 - U2 = %.7e\n",U2,Z2-U2); + } + else { + if ((Z1 <= Zero) || (Z2 <= Zero)) { + printf("Because of unusual Radix = %f", Radix); + printf(", or exact rational arithmetic a result\n"); + printf("Z1 = %.7e, or Z2 = %.7e ", Z1, Z2); + notify("of an\nextra-precision"); + } + if (Z1 != Z2 || Z1 > Zero) { + X = Z1 / U1; + Y = Z2 / U2; + if (Y > X) X = Y; + Q = - LOG(X); + printf("Some subexpressions appear to be calculated extra\n"); + printf("precisely with about %g extra B-digits, i.e.\n", + (Q / LOG(Radix))); + printf("roughly %g extra significant decimals.\n", + Q / LOG(10.)); + } + printf("That feature is not tested further by this program.\n"); + } + } + } + Pause(); + /*=============================================*/ + /*SPLIT + } +#include "paranoia.h" +part3(){ +*/ + Milestone = 35; + /*=============================================*/ + if (Radix >= Two) { + X = W / (Radix * Radix); + Y = X + One; + Z = Y - X; + T = Z + U2; + X = T - Z; + TstCond (Failure, X == U2, + "Subtraction is not normalized X=Y,X+Z != Y+Z!"); + if (X == U2) printf( + "Subtraction appears to be normalized, as it should be."); + } + printf("\nChecking for guard digit in *, /, and -.\n"); + Y = F9 * One; + Z = One * F9; + X = F9 - Half; + Y = (Y - Half) - X; + Z = (Z - Half) - X; + X = One + U2; + T = X * Radix; + R = Radix * X; + X = T - Radix; + X = X - Radix * U2; + T = R - Radix; + T = T - Radix * U2; + X = X * (Radix - One); + T = T * (Radix - One); + if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero)) GMult = Yes; + else { + GMult = No; + TstCond (Serious, False, + "* lacks a Guard Digit, so 1*X != X"); + } + Z = Radix * U2; + X = One + Z; + Y = FABS((X + Z) - X * X) - U2; + X = One - U2; + Z = FABS((X - U2) - X * X) - U1; + TstCond (Failure, (Y <= Zero) + && (Z <= Zero), "* gets too many final digits wrong.\n"); + Y = One - U2; + X = One + U2; + Z = One / Y; + Y = Z - X; + X = One / Three; + Z = Three / Nine; + X = X - Z; + T = Nine / TwentySeven; + Z = Z - T; + TstCond(Defect, X == Zero && Y == Zero && Z == Zero, + "Division lacks a Guard Digit, so error can exceed 1 ulp\nor 1/3 and 3/9 and 9/27 may disagree"); + Y = F9 / One; + X = F9 - Half; + Y = (Y - Half) - X; + X = One + U2; + T = X / One; + X = T - X; + if ((X == Zero) && (Y == Zero) && (Z == Zero)) GDiv = Yes; + else { + GDiv = No; + TstCond (Serious, False, + "Division lacks a Guard Digit, so X/1 != X"); + } + X = One / (One + U2); + Y = X - Half - Half; + TstCond (Serious, Y < Zero, + "Computed value of 1/1.000..1 >= 1"); + X = One - U2; + Y = One + Radix * U2; + Z = X * Radix; + T = Y * Radix; + R = Z / Radix; + StickyBit = T / Radix; + X = R - X; + Y = StickyBit - Y; + TstCond (Failure, X == Zero && Y == Zero, + "* and/or / gets too many last digits wrong"); + Y = One - U1; + X = One - F9; + Y = One - Y; + T = Radix - U2; + Z = Radix - BMinusU2; + T = Radix - T; + if ((X == U1) && (Y == U1) && (Z == U2) && (T == U2)) GAddSub = Yes; + else { + GAddSub = No; + TstCond (Serious, False, + "- lacks Guard Digit, so cancellation is obscured"); + } + if (F9 != One && F9 - One >= Zero) { + BadCond(Serious, "comparison alleges (1-U1) < 1 although\n"); + printf(" subtraction yields (1-U1) - 1 = 0 , thereby vitiating\n"); + printf(" such precautions against division by zero as\n"); + printf(" ... if (X == 1.0) {.....} else {.../(X-1.0)...}\n"); + } + if (GMult == Yes && GDiv == Yes && GAddSub == Yes) printf( + " *, /, and - appear to have guard digits, as they should.\n"); + /*=============================================*/ + Milestone = 40; + /*=============================================*/ + Pause(); + printf("Checking rounding on multiply, divide and add/subtract.\n"); + RMult = Other; + RDiv = Other; + RAddSub = Other; + RadixD2 = Radix / Two; + A1 = Two; + Done = False; + do { + AInvrse = Radix; + do { + X = AInvrse; + AInvrse = AInvrse / A1; + } while ( ! (FLOOR(AInvrse) != AInvrse)); + Done = (X == One) || (A1 > Three); + if (! Done) A1 = Nine + One; + } while ( ! (Done)); + if (X == One) A1 = Radix; + AInvrse = One / A1; + X = A1; + Y = AInvrse; + Done = False; + do { + Z = X * Y - Half; + TstCond (Failure, Z == Half, + "X * (1/X) differs from 1"); + Done = X == Radix; + X = Radix; + Y = One / X; + } while ( ! (Done)); + Y2 = One + U2; + Y1 = One - U2; + X = OneAndHalf - U2; + Y = OneAndHalf + U2; + Z = (X - U2) * Y2; + T = Y * Y1; + Z = Z - X; + T = T - X; + X = X * Y2; + Y = (Y + U2) * Y1; + X = X - OneAndHalf; + Y = Y - OneAndHalf; + if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T <= Zero)) { + X = (OneAndHalf + U2) * Y2; + Y = OneAndHalf - U2 - U2; + Z = OneAndHalf + U2 + U2; + T = (OneAndHalf - U2) * Y1; + X = X - (Z + U2); + StickyBit = Y * Y1; + S = Z * Y2; + T = T - Y; + Y = (U2 - Y) + StickyBit; + Z = S - (Z + U2 + U2); + StickyBit = (Y2 + U2) * Y1; + Y1 = Y2 * Y1; + StickyBit = StickyBit - Y2; + Y1 = Y1 - Half; + if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero) + && ( StickyBit == Zero) && (Y1 == Half)) { + RMult = Rounded; + printf("Multiplication appears to round correctly.\n"); + } + else if ((X + U2 == Zero) && (Y < Zero) && (Z + U2 == Zero) + && (T < Zero) && (StickyBit + U2 == Zero) + && (Y1 < Half)) { + RMult = Chopped; + printf("Multiplication appears to chop.\n"); + } + else printf("* is neither chopped nor correctly rounded.\n"); + if ((RMult == Rounded) && (GMult == No)) notify("Multiplication"); + } + else printf("* is neither chopped nor correctly rounded.\n"); + /*=============================================*/ + Milestone = 45; + /*=============================================*/ + Y2 = One + U2; + Y1 = One - U2; + Z = OneAndHalf + U2 + U2; + X = Z / Y2; + T = OneAndHalf - U2 - U2; + Y = (T - U2) / Y1; + Z = (Z + U2) / Y2; + X = X - OneAndHalf; + Y = Y - T; + T = T / Y1; + Z = Z - (OneAndHalf + U2); + T = (U2 - OneAndHalf) + T; + if (! ((X > Zero) || (Y > Zero) || (Z > Zero) || (T > Zero))) { + X = OneAndHalf / Y2; + Y = OneAndHalf - U2; + Z = OneAndHalf + U2; + X = X - Y; + T = OneAndHalf / Y1; + Y = Y / Y1; + T = T - (Z + U2); + Y = Y - Z; + Z = Z / Y2; + Y1 = (Y2 + U2) / Y2; + Z = Z - OneAndHalf; + Y2 = Y1 - Y2; + Y1 = (F9 - U1) / F9; + if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero) + && (Y2 == Zero) && (Y2 == Zero) + && (Y1 - Half == F9 - Half )) { + RDiv = Rounded; + printf("Division appears to round correctly.\n"); + if (GDiv == No) notify("Division"); + } + else if ((X < Zero) && (Y < Zero) && (Z < Zero) && (T < Zero) + && (Y2 < Zero) && (Y1 - Half < F9 - Half)) { + RDiv = Chopped; + printf("Division appears to chop.\n"); + } + } + if (RDiv == Other) printf("/ is neither chopped nor correctly rounded.\n"); + BInvrse = One / Radix; + TstCond (Failure, (BInvrse * Radix - Half == Half), + "Radix * ( 1 / Radix ) differs from 1"); + /*=============================================*/ + /*SPLIT + } +#include "paranoia.h" +part4(){ +*/ + Milestone = 50; + /*=============================================*/ + TstCond (Failure, ((F9 + U1) - Half == Half) + && ((BMinusU2 + U2 ) - One == Radix - One), + "Incomplete carry-propagation in Addition"); + X = One - U1 * U1; + Y = One + U2 * (One - U2); + Z = F9 - Half; + X = (X - Half) - Z; + Y = Y - One; + if ((X == Zero) && (Y == Zero)) { + RAddSub = Chopped; + printf("Add/Subtract appears to be chopped.\n"); + } + if (GAddSub == Yes) { + X = (Half + U2) * U2; + Y = (Half - U2) * U2; + X = One + X; + Y = One + Y; + X = (One + U2) - X; + Y = One - Y; + if ((X == Zero) && (Y == Zero)) { + X = (Half + U2) * U1; + Y = (Half - U2) * U1; + X = One - X; + Y = One - Y; + X = F9 - X; + Y = One - Y; + if ((X == Zero) && (Y == Zero)) { + RAddSub = Rounded; + printf("Addition/Subtraction appears to round correctly.\n"); + if (GAddSub == No) notify("Add/Subtract"); + } + else printf("Addition/Subtraction neither rounds nor chops.\n"); + } + else printf("Addition/Subtraction neither rounds nor chops.\n"); + } + else printf("Addition/Subtraction neither rounds nor chops.\n"); + S = One; + X = One + Half * (One + Half); + Y = (One + U2) * Half; + Z = X - Y; + T = Y - X; + StickyBit = Z + T; + if (StickyBit != Zero) { + S = Zero; + BadCond(Flaw, "(X - Y) + (Y - X) is non zero!\n"); + } + StickyBit = Zero; + if ((GMult == Yes) && (GDiv == Yes) && (GAddSub == Yes) + && (RMult == Rounded) && (RDiv == Rounded) + && (RAddSub == Rounded) && (FLOOR(RadixD2) == RadixD2)) { + printf("Checking for sticky bit.\n"); + X = (Half + U1) * U2; + Y = Half * U2; + Z = One + Y; + T = One + X; + if ((Z - One <= Zero) && (T - One >= U2)) { + Z = T + Y; + Y = Z - X; + if ((Z - T >= U2) && (Y - T == Zero)) { + X = (Half + U1) * U1; + Y = Half * U1; + Z = One - Y; + T = One - X; + if ((Z - One == Zero) && (T - F9 == Zero)) { + Z = (Half - U1) * U1; + T = F9 - Z; + Q = F9 - Y; + if ((T - F9 == Zero) && (F9 - U1 - Q == Zero)) { + Z = (One + U2) * OneAndHalf; + T = (OneAndHalf + U2) - Z + U2; + X = One + Half / Radix; + Y = One + Radix * U2; + Z = X * Y; + if (T == Zero && X + Radix * U2 - Z == Zero) { + if (Radix != Two) { + X = Two + U2; + Y = X / Two; + if ((Y - One == Zero)) StickyBit = S; + } + else StickyBit = S; + } + } + } + } + } + } + if (StickyBit == One) printf("Sticky bit apparently used correctly.\n"); + else printf("Sticky bit used incorrectly or not at all.\n"); + TstCond (Flaw, !(GMult == No || GDiv == No || GAddSub == No || + RMult == Other || RDiv == Other || RAddSub == Other), + "lack(s) of guard digits or failure(s) to correctly round or chop\n(noted above) count as one flaw in the final tally below"); + /*=============================================*/ + Milestone = 60; + /*=============================================*/ + printf("\n"); + printf("Does Multiplication commute? "); + printf("Testing on %d random pairs.\n", NoTrials); + Random9 = SQRT(3.0); + Random1 = Third; + I = 1; + do { + X = Random(); + Y = Random(); + Z9 = Y * X; + Z = X * Y; + Z9 = Z - Z9; + I = I + 1; + } while ( ! ((I > NoTrials) || (Z9 != Zero))); + if (I == NoTrials) { + Random1 = One + Half / Three; + Random2 = (U2 + U1) + One; + Z = Random1 * Random2; + Y = Random2 * Random1; + Z9 = (One + Half / Three) * ((U2 + U1) + One) - (One + Half / + Three) * ((U2 + U1) + One); + } + if (! ((I == NoTrials) || (Z9 == Zero))) + BadCond(Defect, "X * Y == Y * X trial fails.\n"); + else printf(" No failures found in %d integer pairs.\n", NoTrials); + /*=============================================*/ + Milestone = 70; + /*=============================================*/ + printf("\nRunning test of square root(x).\n"); + TstCond (Failure, (Zero == SQRT(Zero)) + && (- Zero == SQRT(- Zero)) + && (One == SQRT(One)), "Square root of 0.0, -0.0 or 1.0 wrong"); + MinSqEr = Zero; + MaxSqEr = Zero; + J = Zero; + X = Radix; + OneUlp = U2; + SqXMinX (Serious); + X = BInvrse; + OneUlp = BInvrse * U1; + SqXMinX (Serious); + X = U1; + OneUlp = U1 * U1; + SqXMinX (Serious); + if (J != Zero) Pause(); + printf("Testing if sqrt(X * X) == X for %d Integers X.\n", NoTrials); + J = Zero; + X = Two; + Y = Radix; + if ((Radix != One)) do { + X = Y; + Y = Radix * Y; + } while ( ! ((Y - X >= NoTrials))); + OneUlp = X * U2; + I = 1; + while (I <= NoTrials) { + X = X + One; + SqXMinX (Defect); + if (J > Zero) break; + I = I + 1; + } + printf("Test for sqrt monotonicity.\n"); + I = - 1; + X = BMinusU2; + Y = Radix; + Z = Radix + Radix * U2; + NotMonot = False; + Monot = False; + while ( ! (NotMonot || Monot)) { + I = I + 1; + X = SQRT(X); + Q = SQRT(Y); + Z = SQRT(Z); + if ((X > Q) || (Q > Z)) NotMonot = True; + else { + Q = FLOOR(Q + Half); + if ((I > 0) || (Radix == Q * Q)) Monot = True; + else if (I > 0) { + if (I > 1) Monot = True; + else { + Y = Y * BInvrse; + X = Y - U1; + Z = Y + U1; + } + } + else { + Y = Q; + X = Y - U2; + Z = Y + U2; + } + } + } + if (Monot) printf("sqrt has passed a test for Monotonicity.\n"); + else { + BadCond(Defect, ""); + printf("sqrt(X) is non-monotonic for X near %.7e .\n", Y); + } + /*=============================================*/ + /*SPLIT + } +#include "paranoia.h" +part5(){ +*/ + Milestone = 80; + /*=============================================*/ + MinSqEr = MinSqEr + Half; + MaxSqEr = MaxSqEr - Half; + Y = (SQRT(One + U2) - One) / U2; + SqEr = (Y - One) + U2 / Eight; + if (SqEr > MaxSqEr) MaxSqEr = SqEr; + SqEr = Y + U2 / Eight; + if (SqEr < MinSqEr) MinSqEr = SqEr; + Y = ((SQRT(F9) - U2) - (One - U2)) / U1; + SqEr = Y + U1 / Eight; + if (SqEr > MaxSqEr) MaxSqEr = SqEr; + SqEr = (Y + One) + U1 / Eight; + if (SqEr < MinSqEr) MinSqEr = SqEr; + OneUlp = U2; + X = OneUlp; + for( Indx = 1; Indx <= 3; ++Indx) { + Y = SQRT((X + U1 + X) + F9); + Y = ((Y - U2) - ((One - U2) + X)) / OneUlp; + Z = ((U1 - X) + F9) * Half * X * X / OneUlp; + SqEr = (Y + Half) + Z; + if (SqEr < MinSqEr) MinSqEr = SqEr; + SqEr = (Y - Half) + Z; + if (SqEr > MaxSqEr) MaxSqEr = SqEr; + if (((Indx == 1) || (Indx == 3))) + X = OneUlp * Sign (X) * FLOOR(Eight / (Nine * SQRT(OneUlp))); + else { + OneUlp = U1; + X = - OneUlp; + } + } + /*=============================================*/ + Milestone = 85; + /*=============================================*/ + SqRWrng = False; + Anomaly = False; + RSqrt = Other; /* ~dgh */ + if (Radix != One) { + printf("Testing whether sqrt is rounded or chopped.\n"); + D = FLOOR(Half + POW(Radix, One + Precision - FLOOR(Precision))); + /* ... == Radix^(1 + fract) if (Precision == Integer + fract. */ + X = D / Radix; + Y = D / A1; + if ((X != FLOOR(X)) || (Y != FLOOR(Y))) { + Anomaly = True; + } + else { + X = Zero; + Z2 = X; + Y = One; + Y2 = Y; + Z1 = Radix - One; + FourD = Four * D; + do { + if (Y2 > Z2) { + Q = Radix; + Y1 = Y; + do { + X1 = FABS(Q + FLOOR(Half - Q / Y1) * Y1); + Q = Y1; + Y1 = X1; + } while ( ! (X1 <= Zero)); + if (Q <= One) { + Z2 = Y2; + Z = Y; + } + } + Y = Y + Two; + X = X + Eight; + Y2 = Y2 + X; + if (Y2 >= FourD) Y2 = Y2 - FourD; + } while ( ! (Y >= D)); + X8 = FourD - Z2; + Q = (X8 + Z * Z) / FourD; + X8 = X8 / Eight; + if (Q != FLOOR(Q)) Anomaly = True; + else { + Break = False; + do { + X = Z1 * Z; + X = X - FLOOR(X / Radix) * Radix; + if (X == One) + Break = True; + else + Z1 = Z1 - One; + } while ( ! (Break || (Z1 <= Zero))); + if ((Z1 <= Zero) && (! Break)) Anomaly = True; + else { + if (Z1 > RadixD2) Z1 = Z1 - Radix; + do { + NewD(); + } while ( ! (U2 * D >= F9)); + if (D * Radix - D != W - D) Anomaly = True; + else { + Z2 = D; + I = 0; + Y = D + (One + Z) * Half; + X = D + Z + Q; + SR3750(); + Y = D + (One - Z) * Half + D; + X = D - Z + D; + X = X + Q + X; + SR3750(); + NewD(); + if (D - Z2 != W - Z2) Anomaly = True; + else { + Y = (D - Z2) + (Z2 + (One - Z) * Half); + X = (D - Z2) + (Z2 - Z + Q); + SR3750(); + Y = (One + Z) * Half; + X = Q; + SR3750(); + if (I == 0) Anomaly = True; + } + } + } + } + } + if ((I == 0) || Anomaly) { + BadCond(Failure, "Anomalous arithmetic with Integer < "); + printf("Radix^Precision = %.7e\n", W); + printf(" fails test whether sqrt rounds or chops.\n"); + SqRWrng = True; + } + } + if (! Anomaly) { + if (! ((MinSqEr < Zero) || (MaxSqEr > Zero))) { + RSqrt = Rounded; + printf("Square root appears to be correctly rounded.\n"); + } + else { + if ((MaxSqEr + U2 > U2 - Half) || (MinSqEr > Half) + || (MinSqEr + Radix < Half)) SqRWrng = True; + else { + RSqrt = Chopped; + printf("Square root appears to be chopped.\n"); + } + } + } + if (SqRWrng) { + printf("Square root is neither chopped nor correctly rounded.\n"); + printf("Observed errors run from %.7e ", MinSqEr - Half); + printf("to %.7e ulps.\n", Half + MaxSqEr); + TstCond (Serious, MaxSqEr - MinSqEr < Radix * Radix, + "sqrt gets too many last digits wrong"); + } + /*=============================================*/ + Milestone = 90; + /*=============================================*/ + Pause(); + printf("Testing powers Z^i for small Integers Z and i.\n"); + N = 0; + /* ... test powers of zero. */ + I = 0; + Z = -Zero; + M = 3.0; + Break = False; + do { + X = One; + SR3980(); + if (I <= 10) { + I = 1023; + SR3980(); + } + if (Z == MinusOne) Break = True; + else { + Z = MinusOne; + PrintIfNPositive(); + N = 0; + /* .. if(-1)^N is invalid, replace MinusOne by One. */ + I = - 4; + } + } while ( ! Break); + PrintIfNPositive(); + N1 = N; + N = 0; + Z = A1; + M = FLOOR(Two * LOG(W) / LOG(A1)); + Break = False; + do { + X = Z; + I = 1; + SR3980(); + if (Z == AInvrse) Break = True; + else Z = AInvrse; + } while ( ! (Break)); + /*=============================================*/ + Milestone = 100; + /*=============================================*/ + /* Powers of Radix have been tested, */ + /* next try a few primes */ + M = NoTrials; + Z = Three; + do { + X = Z; + I = 1; + SR3980(); + do { + Z = Z + Two; + } while ( Three * FLOOR(Z / Three) == Z ); + } while ( Z < Eight * Three ); + if (N > 0) { + printf("Errors like this may invalidate financial calculations\n"); + printf("\tinvolving interest rates.\n"); + } + PrintIfNPositive(); + N += N1; + if (N == 0) printf("... no discrepancis found.\n"); + if (N > 0) Pause(); + else printf("\n"); + /*=============================================*/ + /*SPLIT + } +#include "paranoia.h" +part6(){ +*/ + Milestone = 110; + /*=============================================*/ + printf("Seeking Underflow thresholds UfThold and E0.\n"); + D = U1; + if (Precision != FLOOR(Precision)) { + D = BInvrse; + X = Precision; + do { + D = D * BInvrse; + X = X - One; + } while ( X > Zero); + } + Y = One; + Z = D; + /* ... D is power of 1/Radix < 1. */ + do { + C = Y; + Y = Z; + Z = Y * Y; + } while ((Y > Z) && (Z + Z > Z)); + Y = C; + Z = Y * D; + do { + C = Y; + Y = Z; + Z = Y * D; + } while ((Y > Z) && (Z + Z > Z)); + if (Radix < Two) HInvrse = Two; + else HInvrse = Radix; + H = One / HInvrse; + /* ... 1/HInvrse == H == Min(1/Radix, 1/2) */ + CInvrse = One / C; + E0 = C; + Z = E0 * H; + /* ...1/Radix^(BIG Integer) << 1 << CInvrse == 1/C */ + do { + Y = E0; + E0 = Z; + Z = E0 * H; + } while ((E0 > Z) && (Z + Z > Z)); + UfThold = E0; + E1 = Zero; + Q = Zero; + E9 = U2; + S = One + E9; + D = C * S; + if (D <= C) { + E9 = Radix * U2; + S = One + E9; + D = C * S; + if (D <= C) { + BadCond(Failure, "multiplication gets too many last digits wrong.\n"); + Underflow = E0; + Y1 = Zero; + PseudoZero = Z; + Pause(); + } + } + else { + Underflow = D; + PseudoZero = Underflow * H; + UfThold = Zero; + do { + Y1 = Underflow; + Underflow = PseudoZero; + if (E1 + E1 <= E1) { + Y2 = Underflow * HInvrse; + E1 = FABS(Y1 - Y2); + Q = Y1; + if ((UfThold == Zero) && (Y1 != Y2)) UfThold = Y1; + } + PseudoZero = PseudoZero * H; + } while ((Underflow > PseudoZero) + && (PseudoZero + PseudoZero > PseudoZero)); + } + /* Comment line 4530 .. 4560 */ + if (PseudoZero != Zero) { + printf("\n"); + Z = PseudoZero; + /* ... Test PseudoZero for "phoney- zero" violates */ + /* ... PseudoZero < Underflow or PseudoZero < PseudoZero + PseudoZero + ... */ + if (PseudoZero <= Zero) { + BadCond(Failure, "Positive expressions can underflow to an\n"); + printf("allegedly negative value\n"); + printf("PseudoZero that prints out as: %g .\n", PseudoZero); + X = - PseudoZero; + if (X <= Zero) { + printf("But -PseudoZero, which should be\n"); + printf("positive, isn't; it prints out as %g .\n", X); + } + } + else { + BadCond(Flaw, "Underflow can stick at an allegedly positive\n"); + printf("value PseudoZero that prints out as %g .\n", PseudoZero); + } + TstPtUf(); + } + /*=============================================*/ + Milestone = 120; + /*=============================================*/ + if (CInvrse * Y > CInvrse * Y1) { + S = H * S; + E0 = Underflow; + } + if (! ((E1 == Zero) || (E1 == E0))) { + BadCond(Defect, ""); + if (E1 < E0) { + printf("Products underflow at a higher"); + printf(" threshold than differences.\n"); + if (PseudoZero == Zero) + E0 = E1; + } + else { + printf("Difference underflows at a higher"); + printf(" threshold than products.\n"); + } + } + printf("Smallest strictly positive number found is E0 = %g .\n", E0); + Z = E0; + TstPtUf(); + Underflow = E0; + if (N == 1) Underflow = Y; + I = 4; + if (E1 == Zero) I = 3; + if (UfThold == Zero) I = I - 2; + UfNGrad = True; + switch (I) { + case 1: + UfThold = Underflow; + if ((CInvrse * Q) != ((CInvrse * Y) * S)) { + UfThold = Y; + BadCond(Failure, "Either accuracy deteriorates as numbers\n"); + printf("approach a threshold = %.17e\n", UfThold);; + printf(" coming down from %.17e\n", C); + printf(" or else multiplication gets too many last digits wrong.\n"); + } + Pause(); + break; + + case 2: + BadCond(Failure, "Underflow confuses Comparison, which alleges that\n"); + printf("Q == Y while denying that |Q - Y| == 0; these values\n"); + printf("print out as Q = %.17e, Y = %.17e .\n", Q, Y2); + printf ("|Q - Y| = %.17e .\n" , FABS(Q - Y2)); + UfThold = Q; + break; + + case 3: + X = X; + break; + + case 4: + if ((Q == UfThold) && (E1 == E0) + && (FABS( UfThold - E1 / E9) <= E1)) { + UfNGrad = False; + printf("Underflow is gradual; it incurs Absolute Error =\n"); + printf("(roundoff in UfThold) < E0.\n"); + Y = E0 * CInvrse; + Y = Y * (OneAndHalf + U2); + X = CInvrse * (One + U2); + Y = Y / X; + IEEE = (Y == E0); + } + } + if (UfNGrad) { + printf("\n"); + sigsave = sigfpe; + if (setjmp(ovfl_buf)) { + printf("Underflow / UfThold failed!\n"); + R = H + H; + } + else R = SQRT(Underflow / UfThold); + sigsave = 0; + if (R <= H) { + Z = R * UfThold; + X = Z * (One + R * H * (One + H)); + } + else { + Z = UfThold; + X = Z * (One + H * H * (One + H)); + } + if (! ((X == Z) || (X - Z != Zero))) { + BadCond(Flaw, ""); + printf("X = %.17e\n\tis not equal to Z = %.17e .\n", X, Z); + Z9 = X - Z; + printf("yet X - Z yields %.17e .\n", Z9); + printf(" Should this NOT signal Underflow, "); + printf("this is a SERIOUS DEFECT\nthat causes "); + printf("confusion when innocent statements like\n");; + printf(" if (X == Z) ... else"); + printf(" ... (f(X) - f(Z)) / (X - Z) ...\n"); + printf("encounter Division by Zero although actually\n"); + sigsave = sigfpe; + if (setjmp(ovfl_buf)) printf("X / Z fails!\n"); + else printf("X / Z = 1 + %g .\n", (X / Z - Half) - Half); + sigsave = 0; + } + } + printf("The Underflow threshold is %.17e, %s\n", UfThold, + " below which"); + printf("calculation may suffer larger Relative error than "); + printf("merely roundoff.\n"); + Y2 = U1 * U1; + Y = Y2 * Y2; + Y2 = Y * U1; + if (Y2 <= UfThold) { + if (Y > E0) { + BadCond(Defect, ""); + I = 5; + } + else { + BadCond(Serious, ""); + I = 4; + } + printf("Range is too narrow; U1^%d Underflows.\n", I); + } + /*=============================================*/ + /*SPLIT + } +#include "paranoia.h" +part7(){ +*/ + Milestone = 130; + /*=============================================*/ + Y = - FLOOR(Half - TwoForty * LOG(UfThold) / LOG(HInvrse)) / TwoForty; + Y2 = Y + Y; + printf("Since underflow occurs below the threshold\n"); + printf("UfThold = (%.17e) ^ (%.17e)\nonly underflow ", HInvrse, Y); + printf("should afflict the expression\n\t(%.17e) ^ (%.17e);\n", HInvrse, Y); + V9 = POW(HInvrse, Y2); + printf("actually calculating yields: %.17e .\n", V9); + if (! ((V9 >= Zero) && (V9 <= (Radix + Radix + E9) * UfThold))) { + BadCond(Serious, "this is not between 0 and underflow\n"); + printf(" threshold = %.17e .\n", UfThold); + } + else if (! (V9 > UfThold * (One + E9))) + printf("This computed value is O.K.\n"); + else { + BadCond(Defect, "this is not between 0 and underflow\n"); + printf(" threshold = %.17e .\n", UfThold); + } + /*=============================================*/ + Milestone = 140; + /*=============================================*/ + printf("\n"); + /* ...calculate Exp2 == exp(2) == 7.389056099... */ + X = Zero; + I = 2; + Y = Two * Three; + Q = Zero; + N = 0; + do { + Z = X; + I = I + 1; + Y = Y / (I + I); + R = Y + Q; + X = Z + R; + Q = (Z - X) + R; + } while(X > Z); + Z = (OneAndHalf + One / Eight) + X / (OneAndHalf * ThirtyTwo); + X = Z * Z; + Exp2 = X * X; + X = F9; + Y = X - U1; + printf("Testing X^((X + 1) / (X - 1)) vs. exp(2) = %.17e as X -> 1.\n", + Exp2); + for(I = 1;;) { + Z = X - BInvrse; + Z = (X + One) / (Z - (One - BInvrse)); + Q = POW(X, Z) - Exp2; + if (FABS(Q) > TwoForty * U2) { + N = 1; + V9 = (X - BInvrse) - (One - BInvrse); + BadCond(Defect, "Calculated"); + printf(" %.17e for\n", POW(X,Z)); + printf("\t(1 + (%.17e) ^ (%.17e);\n", V9, Z); + printf("\tdiffers from correct value by %.17e .\n", Q); + printf("\tThis much error may spoil financial\n"); + printf("\tcalculations involving tiny interest rates.\n"); + break; + } + else { + Z = (Y - X) * Two + Y; + X = Y; + Y = Z; + Z = One + (X - F9)*(X - F9); + if (Z > One && I < NoTrials) I++; + else { + if (X > One) { + if (N == 0) + printf("Accuracy seems adequate.\n"); + break; + } + else { + X = One + U2; + Y = U2 + U2; + Y += X; + I = 1; + } + } + } + } + /*=============================================*/ + Milestone = 150; + /*=============================================*/ + printf("Testing powers Z^Q at four nearly extreme values.\n"); + N = 0; + Z = A1; + Q = FLOOR(Half - LOG(C) / LOG(A1)); + Break = False; + do { + X = CInvrse; + Y = POW(Z, Q); + IsYeqX(); + Q = - Q; + X = C; + Y = POW(Z, Q); + IsYeqX(); + if (Z < One) Break = True; + else Z = AInvrse; + } while ( ! (Break)); + PrintIfNPositive(); + if (N == 0) printf(" ... no discrepancies found.\n"); + printf("\n"); + + /*=============================================*/ + Milestone = 160; + /*=============================================*/ + Pause(); + printf("Searching for Overflow threshold:\n"); + printf("This may generate an error.\n"); + Y = - CInvrse; + V9 = HInvrse * Y; + sigsave = sigfpe; + if (setjmp(ovfl_buf)) { I = 0; V9 = Y; goto overflow; } + do { + V = Y; + Y = V9; + V9 = HInvrse * Y; + } while(V9 < Y); + I = 1; +overflow: + sigsave = 0; + Z = V9; + printf("Can `Z = -Y' overflow?\n"); + printf("Trying it on Y = %.17e .\n", Y); + V9 = - Y; + V0 = V9; + if (V - Y == V + V0) printf("Seems O.K.\n"); + else { + printf("finds a "); + BadCond(Flaw, "-(-Y) differs from Y.\n"); + } + if (Z != Y) { + BadCond(Serious, ""); + printf("overflow past %.17e\n\tshrinks to %.17e .\n", Y, Z); + } + if (I) { + Y = V * (HInvrse * U2 - HInvrse); + Z = Y + ((One - HInvrse) * U2) * V; + if (Z < V0) Y = Z; + if (Y < V0) V = Y; + if (V0 - V < V0) V = V0; + } + else { + V = Y * (HInvrse * U2 - HInvrse); + V = V + ((One - HInvrse) * U2) * Y; + } + printf("Overflow threshold is V = %.17e .\n", V); + if (I) printf("Overflow saturates at V0 = %.17e .\n", V0); + else printf("There is no saturation value because the system traps on overflow.\n"); + V9 = V * One; + printf("No Overflow should be signaled for V * 1 = %.17e\n", V9); + V9 = V / One; + printf(" nor for V / 1 = %.17e .\n", V9); + printf("Any overflow signal separating this * from the one\n"); + printf("above is a DEFECT.\n"); + /*=============================================*/ + Milestone = 170; + /*=============================================*/ + if (!(-V < V && -V0 < V0 && -UfThold < V && UfThold < V)) { + BadCond(Failure, "Comparisons involving "); + printf("+-%g, +-%g\nand +-%g are confused by Overflow.", + V, V0, UfThold); + } + /*=============================================*/ + Milestone = 175; + /*=============================================*/ + printf("\n"); + for(Indx = 1; Indx <= 3; ++Indx) { + switch (Indx) { + case 1: Z = UfThold; break; + case 2: Z = E0; break; + case 3: Z = PseudoZero; break; + } + if (Z != Zero) { + V9 = SQRT(Z); + Y = V9 * V9; + if (Y / (One - Radix * E9) < Z + || Y > (One + Radix * E9) * Z) { /* dgh: + E9 --> * E9 */ + if (V9 > U1) BadCond(Serious, ""); + else BadCond(Defect, ""); + printf("Comparison alleges that what prints as Z = %.17e\n", Z); + printf(" is too far from sqrt(Z) ^ 2 = %.17e .\n", Y); + } + } + } + /*=============================================*/ + Milestone = 180; + /*=============================================*/ + for(Indx = 1; Indx <= 2; ++Indx) { + if (Indx == 1) Z = V; + else Z = V0; + V9 = SQRT(Z); + X = (One - Radix * E9) * V9; + V9 = V9 * X; + if (((V9 < (One - Two * Radix * E9) * Z) || (V9 > Z))) { + Y = V9; + if (X < W) BadCond(Serious, ""); + else BadCond(Defect, ""); + printf("Comparison alleges that Z = %17e\n", Z); + printf(" is too far from sqrt(Z) ^ 2 (%.17e) .\n", Y); + } + } + /*=============================================*/ + /*SPLIT + } +#include "paranoia.h" +part8(){ +*/ + Milestone = 190; + /*=============================================*/ + Pause(); + X = UfThold * V; + Y = Radix * Radix; + if (X*Y < One || X > Y) { + if (X * Y < U1 || X > Y/U1) BadCond(Defect, "Badly"); + else BadCond(Flaw, ""); + + printf(" unbalanced range; UfThold * V = %.17e\n\t%s\n", + X, "is too far from 1.\n"); + } + /*=============================================*/ + Milestone = 200; + /*=============================================*/ + for (Indx = 1; Indx <= 5; ++Indx) { + X = F9; + switch (Indx) { + case 2: X = One + U2; break; + case 3: X = V; break; + case 4: X = UfThold; break; + case 5: X = Radix; + } + Y = X; + sigsave = sigfpe; + if (setjmp(ovfl_buf)) + printf(" X / X traps when X = %g\n", X); + else { + V9 = (Y / X - Half) - Half; + if (V9 == Zero) continue; + if (V9 == - U1 && Indx < 5) BadCond(Flaw, ""); + else BadCond(Serious, ""); + printf(" X / X differs from 1 when X = %.17e\n", X); + printf(" instead, X / X - 1/2 - 1/2 = %.17e .\n", V9); + } + sigsave = 0; + } + /*=============================================*/ + Milestone = 210; + /*=============================================*/ + MyZero = Zero; + printf("\n"); + printf("What message and/or values does Division by Zero produce?\n") ; +#ifndef NOPAUSE + printf("This can interupt your program. You can "); + printf("skip this part if you wish.\n"); + printf("Do you wish to compute 1 / 0? "); + fflush(stdout); + read (KEYBOARD, ch, 8); + if ((ch[0] == 'Y') || (ch[0] == 'y')) { +#endif + sigsave = sigfpe; + printf(" Trying to compute 1 / 0 produces ..."); + if (!setjmp(ovfl_buf)) printf(" %.7e .\n", One / MyZero); + sigsave = 0; +#ifndef NOPAUSE + } + else printf("O.K.\n"); + printf("\nDo you wish to compute 0 / 0? "); + fflush(stdout); + read (KEYBOARD, ch, 80); + if ((ch[0] == 'Y') || (ch[0] == 'y')) { +#endif + sigsave = sigfpe; + printf("\n Trying to compute 0 / 0 produces ..."); + if (!setjmp(ovfl_buf)) printf(" %.7e .\n", Zero / MyZero); + sigsave = 0; +#ifndef NOPAUSE + } + else printf("O.K.\n"); +#endif + /*=============================================*/ + Milestone = 220; + /*=============================================*/ + Pause(); + printf("\n"); + { + static char *msg[] = { + "FAILUREs encountered =", + "SERIOUS DEFECTs discovered =", + "DEFECTs discovered =", + "FLAWs discovered =" }; + int i; + for(i = 0; i < 4; i++) if (ErrCnt[i]) + printf("The number of %-29s %d.\n", + msg[i], ErrCnt[i]); + } + printf("\n"); + if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[Defect] + + ErrCnt[Flaw]) > 0) { + if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[ + Defect] == 0) && (ErrCnt[Flaw] > 0)) { + printf("The arithmetic diagnosed seems "); + printf("Satisfactory though flawed.\n"); + } + if ((ErrCnt[Failure] + ErrCnt[Serious] == 0) + && ( ErrCnt[Defect] > 0)) { + printf("The arithmetic diagnosed may be Acceptable\n"); + printf("despite inconvenient Defects.\n"); + } + if ((ErrCnt[Failure] + ErrCnt[Serious]) > 0) { + printf("The arithmetic diagnosed has "); + printf("unacceptable Serious Defects.\n"); + } + if (ErrCnt[Failure] > 0) { + printf("Potentially fatal FAILURE may have spoiled this"); + printf(" program's subsequent diagnoses.\n"); + } + } + else { + printf("No failures, defects nor flaws have been discovered.\n"); + if (! ((RMult == Rounded) && (RDiv == Rounded) + && (RAddSub == Rounded) && (RSqrt == Rounded))) + printf("The arithmetic diagnosed seems Satisfactory.\n"); + else { + if (StickyBit >= One && + (Radix - Two) * (Radix - Nine - One) == Zero) { + printf("Rounding appears to conform to "); + printf("the proposed IEEE standard P"); + if ((Radix == Two) && + ((Precision - Four * Three * Two) * + ( Precision - TwentySeven - + TwentySeven + One) == Zero)) + printf("754"); + else printf("854"); + if (IEEE) printf(".\n"); + else { + printf(",\nexcept for possibly Double Rounding"); + printf(" during Gradual Underflow.\n"); + } + } + printf("The arithmetic diagnosed appears to be Excellent!\n"); + } + } + if (fpecount) + printf("\nA total of %d floating point exceptions were registered.\n", + fpecount); + printf("END OF TEST.\n"); + return 0; + } + +/*SPLIT subs.c +#include "paranoia.h" +*/ + +/* Sign */ + +FLOAT Sign (X) +FLOAT X; +{ return X >= 0. ? 1.0 : -1.0; } + +/* Pause */ + +Pause() +{ +#ifndef NOPAUSE + char ch[8]; + + printf("\nTo continue, press RETURN"); + fflush(stdout); + read(KEYBOARD, ch, 8); +#endif + printf("\nDiagnosis resumes after milestone Number %d", Milestone); + printf(" Page: %d\n\n", PageNo); + ++Milestone; + ++PageNo; + } + + /* TstCond */ + +TstCond (K, Valid, T) +int K, Valid; +char *T; +{ if (! Valid) { BadCond(K,T); printf(".\n"); } } + +BadCond(K, T) +int K; +char *T; +{ + static char *msg[] = { "FAILURE", "SERIOUS DEFECT", "DEFECT", "FLAW" }; + + ErrCnt [K] = ErrCnt [K] + 1; + printf("%s: %s", msg[K], T); + } + +/* Random */ +/* Random computes + X = (Random1 + Random9)^5 + Random1 = X - FLOOR(X) + 0.000005 * X; + and returns the new value of Random1 +*/ + +FLOAT Random() +{ + FLOAT X, Y; + + X = Random1 + Random9; + Y = X * X; + Y = Y * Y; + X = X * Y; + Y = X - FLOOR(X); + Random1 = Y + X * 0.000005; + return(Random1); + } + +/* SqXMinX */ + +SqXMinX (ErrKind) +int ErrKind; +{ + FLOAT XA, XB; + + XB = X * BInvrse; + XA = X - XB; + SqEr = ((SQRT(X * X) - XB) - XA) / OneUlp; + if (SqEr != Zero) { + if (SqEr < MinSqEr) MinSqEr = SqEr; + if (SqEr > MaxSqEr) MaxSqEr = SqEr; + J = J + 1.0; + BadCond(ErrKind, "\n"); + printf("sqrt( %.17e) - %.17e = %.17e\n", X * X, X, OneUlp * SqEr); + printf("\tinstead of correct value 0 .\n"); + } + } + +/* NewD */ + +NewD() +{ + X = Z1 * Q; + X = FLOOR(Half - X / Radix) * Radix + X; + Q = (Q - X * Z) / Radix + X * X * (D / Radix); + Z = Z - Two * X * D; + if (Z <= Zero) { + Z = - Z; + Z1 = - Z1; + } + D = Radix * D; + } + +/* SR3750 */ + +SR3750() +{ + if (! ((X - Radix < Z2 - Radix) || (X - Z2 > W - Z2))) { + I = I + 1; + X2 = SQRT(X * D); + Y2 = (X2 - Z2) - (Y - Z2); + X2 = X8 / (Y - Half); + X2 = X2 - Half * X2 * X2; + SqEr = (Y2 + Half) + (Half - X2); + if (SqEr < MinSqEr) MinSqEr = SqEr; + SqEr = Y2 - X2; + if (SqEr > MaxSqEr) MaxSqEr = SqEr; + } + } + +/* IsYeqX */ + +IsYeqX() +{ + if (Y != X) { + if (N <= 0) { + if (Z == Zero && Q <= Zero) + printf("WARNING: computing\n"); + else BadCond(Defect, "computing\n"); + printf("\t(%.17e) ^ (%.17e)\n", Z, Q); + printf("\tyielded %.17e;\n", Y); + printf("\twhich compared unequal to correct %.17e ;\n", + X); + printf("\t\tthey differ by %.17e .\n", Y - X); + } + N = N + 1; /* ... count discrepancies. */ + } + } + +/* SR3980 */ + +SR3980() +{ + do { + Q = (FLOAT) I; + Y = POW(Z, Q); + IsYeqX(); + if (++I > M) break; + X = Z * X; + } while ( X < W ); + } + +/* PrintIfNPositive */ + +PrintIfNPositive() +{ + if (N > 0) printf("Similar discrepancies have occurred %d times.\n", N); + } + +/* TstPtUf */ + +TstPtUf() +{ + N = 0; + if (Z != Zero) { + printf("Since comparison denies Z = 0, evaluating "); + printf("(Z + Z) / Z should be safe.\n"); + sigsave = sigfpe; + if (setjmp(ovfl_buf)) goto very_serious; + Q9 = (Z + Z) / Z; + printf("What the machine gets for (Z + Z) / Z is %.17e .\n", + Q9); + if (FABS(Q9 - Two) < Radix * U2) { + printf("This is O.K., provided Over/Underflow"); + printf(" has NOT just been signaled.\n"); + } + else { + if ((Q9 < One) || (Q9 > Two)) { +very_serious: + N = 1; + ErrCnt [Serious] = ErrCnt [Serious] + 1; + printf("This is a VERY SERIOUS DEFECT!\n"); + } + else { + N = 1; + ErrCnt [Defect] = ErrCnt [Defect] + 1; + printf("This is a DEFECT!\n"); + } + } + sigsave = 0; + V9 = Z * One; + Random1 = V9; + V9 = One * Z; + Random2 = V9; + V9 = Z / One; + if ((Z == Random1) && (Z == Random2) && (Z == V9)) { + if (N > 0) Pause(); + } + else { + N = 1; + BadCond(Defect, "What prints as Z = "); + printf("%.17e\n\tcompares different from ", Z); + if (Z != Random1) printf("Z * 1 = %.17e ", Random1); + if (! ((Z == Random2) + || (Random2 == Random1))) + printf("1 * Z == %g\n", Random2); + if (! (Z == V9)) printf("Z / 1 = %.17e\n", V9); + if (Random2 != Random1) { + ErrCnt [Defect] = ErrCnt [Defect] + 1; + BadCond(Defect, "Multiplication does not commute!\n"); + printf("\tComparison alleges that 1 * Z = %.17e\n", + Random2); + printf("\tdiffers from Z * 1 = %.17e\n", Random1); + } + Pause(); + } + } + } + +notify(s) +char *s; +{ + printf("%s test appears to be inconsistent...\n", s); + printf(" PLEASE NOTIFY KARPINKSI!\n"); + } + +/*SPLIT msgs.c */ + +/* Instructions */ + +msglist(s) +char **s; +{ while(*s) printf("%s\n", *s++); } + +Instructions() +{ + static char *instr[] = { + "Lest this program stop prematurely, i.e. before displaying\n", + " `END OF TEST',\n", + "try to persuade the computer NOT to terminate execution when an", + "error like Over/Underflow or Division by Zero occurs, but rather", + "to persevere with a surrogate value after, perhaps, displaying some", + "warning. If persuasion avails naught, don't despair but run this", + "program anyway to see how many milestones it passes, and then", + "amend it to make further progress.\n", + "Answer questions with Y, y, N or n (unless otherwise indicated).\n", + 0}; + + msglist(instr); + } + +/* Heading */ + +Heading() +{ + static char *head[] = { + "Users are invited to help debug and augment this program so it will", + "cope with unanticipated and newly uncovered arithmetic pathologies.\n", + "Please send suggestions and interesting results to", + "\tRichard Karpinski", + "\tComputer Center U-76", + "\tUniversity of California", + "\tSan Francisco, CA 94143-0704, USA\n", + "In doing so, please include the following information:", +#ifdef Single + "\tPrecision:\tsingle;", +#else + "\tPrecision:\tdouble;", +#endif + "\tVersion:\t10 February 1989;", + "\tComputer:\n", + "\tCompiler:\n", + "\tOptimization level:\n", + "\tOther relevant compiler options:", + 0}; + + msglist(head); + } + +/* Characteristics */ + +Characteristics() +{ + static char *chars[] = { + "Running this program should reveal these characteristics:", + " Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...", + " Precision = number of significant digits carried.", + " U2 = Radix/Radix^Precision = One Ulp", + "\t(OneUlpnit in the Last Place) of 1.000xxx .", + " U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .", + " Adequacy of guard digits for Mult., Div. and Subt.", + " Whether arithmetic is chopped, correctly rounded, or something else", + "\tfor Mult., Div., Add/Subt. and Sqrt.", + " Whether a Sticky Bit used correctly for rounding.", + " UnderflowThreshold = an underflow threshold.", + " E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.", + " V = an overflow threshold, roughly.", + " V0 tells, roughly, whether Infinity is represented.", + " Comparisions are checked for consistency with subtraction", + "\tand for contamination with pseudo-zeros.", + " Sqrt is tested. Y^X is not tested.", + " Extra-precise subexpressions are revealed but NOT YET tested.", + " Decimal-Binary conversion is NOT YET tested for accuracy.", + 0}; + + msglist(chars); + } + +History() + +{ /* History */ + /* Converted from Brian Wichmann's Pascal version to C by Thos Sumner, + with further massaging by David M. Gay. */ + + static char *hist[] = { + "The program attempts to discriminate among", + " FLAWs, like lack of a sticky bit,", + " Serious DEFECTs, like lack of a guard digit, and", + " FAILUREs, like 2+2 == 5 .", + "Failures may confound subsequent diagnoses.\n", + "The diagnostic capabilities of this program go beyond an earlier", + "program called `MACHAR', which can be found at the end of the", + "book `Software Manual for the Elementary Functions' (1980) by", + "W. J. Cody and W. Waite. Although both programs try to discover", + "the Radix, Precision and range (over/underflow thresholds)", + "of the arithmetic, this program tries to cope with a wider variety", + "of pathologies, and to say how well the arithmetic is implemented.", + "\nThe program is based upon a conventional radix representation for", + "floating-point numbers, but also allows logarithmic encoding", + "as used by certain early WANG machines.\n", + "BASIC version of this program (C) 1983 by Prof. W. M. Kahan;", + "see source comments for more history.", + 0}; + + msglist(hist); + } + +double +pow(x, y) /* return x ^ y (exponentiation) */ +double x, y; +{ + extern double exp(), frexp(), ldexp(), log(), modf(); + double xy, ye; + long i; + int ex, ey = 0, flip = 0; + + if (!y) return 1.0; + + if ((y < -1100. || y > 1100.) && x != -1.) return exp(y * log(x)); + + if (y < 0.) { y = -y; flip = 1; } + y = modf(y, &ye); + if (y) xy = exp(y * log(x)); + else xy = 1.0; + /* next several lines assume >= 32 bit integers */ + x = frexp(x, &ex); + if (i = ye) for(;;) { + if (i & 1) { xy *= x; ey += ex; } + if (!(i >>= 1)) break; + x *= x; + ex *= 2; + if (x < .5) { x *= 2.; ex -= 1; } + } + if (flip) { xy = 1. / xy; ey = -ey; } + return ldexp(xy, ey); +} diff --git a/src/cmd/lccom-1/tst/run.sh b/src/cmd/lccom-1/tst/run.sh new file mode 100755 index 0000000..25db8f0 --- /dev/null +++ b/src/cmd/lccom-1/tst/run.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# run .../tst/target/foo.s + +#set -x +target=`echo $1 | awk -F/ '{ print $(NF-1) }'` + +case "$1" in +*symbolic) idir=tst/mips-eb ;; +*symbolic64) idir=tst/alpha-osf ;; +*) idir=tst/$target ;; +esac + +if [ ! -d "tst/$target" -o ! -d "$idir" ]; then + echo 2>&1 $0: unknown combination '"'$target'"' + echo target = $target + echo idir = $idir + exit 1 +fi + +C=`basename $1 .s` +BUILDDIR=${BUILDDIR-.} +LCC="${LCC-${BUILDDIR}/lcc} -Wo-lccdir=$BUILDDIR" +TSTDIR=${TSTDIR-tst/$target} +if [ ! -d $TSTDIR ]; then mkdir -p $TSTDIR; fi + +echo ${BUILDDIR}/rcc$EXE -target=$target $1: 1>&2 +$LCC -S -I$idir -Ualpha -Usun -Uvax -Umips -Ux86 \ + -Wf-errout=$TSTDIR/$C.2 -Wf-g0 \ + -Wf-target=$target -o $1 tst/$C.c +if [ -r tst/$target/$C.2bk ]; then + diff tst/$target/$C.2bk $TSTDIR/$C.2 +fi +if [ -r tst/$target/$C.sbk ]; then + diff tst/$target/$C.sbk $TSTDIR/$C.s +fi + +exit 0 diff --git a/src/cmd/lccom-1/tst/sort.c b/src/cmd/lccom-1/tst/sort.c new file mode 100644 index 0000000..a0cff62 --- /dev/null +++ b/src/cmd/lccom-1/tst/sort.c @@ -0,0 +1,65 @@ +int in[] = {10, 32, -1, 567, 3, 18, 1, -51, 789, 0}; + +main() { + int i; + + sort(in, (sizeof in)/(sizeof in[0])); + for (i = 0; i < (sizeof in)/(sizeof in[0]); i++) { + putd(in[i]); + putchar('\n'); + } + return 0; +} + +/* putd - output decimal number */ +putd(n) { + if (n < 0) { + putchar('-'); + n = -n; + } + if (n/10) + putd(n/10); + putchar(n%10 + '0'); +} + +int *xx; + +/* sort - sort a[0..n-1] into increasing order */ +sort(a, n) int a[]; { + quick(xx = a, 0, --n); +} + +/* quick - quicksort a[lb..ub] */ +quick(a, lb, ub) int a[]; { + int k, partition(); + + if (lb >= ub) + return; + k = partition(a, lb, ub); + quick(a, lb, k - 1); + quick(a, k + 1, ub); +} + +/* partition - partition a[i..j] */ +int partition(a, i, j) int a[]; { + int v, k; + + j++; + k = i; + v = a[k]; + while (i < j) { + i++; while (a[i] < v) i++; + j--; while (a[j] > v) j--; + if (i < j) exchange(&a[i], &a[j]); + } + exchange(&a[k], &a[j]); + return j; +} + +/* exchange - exchange *x and *y */ +exchange(x, y) int *x, *y; { + int t; + + printf("exchange(%d,%d)\n", x - xx, y - xx); + t = *x; *x = *y; *y = t; +} diff --git a/src/cmd/lccom-1/tst/spill.c b/src/cmd/lccom-1/tst/spill.c new file mode 100644 index 0000000..2c5da81 --- /dev/null +++ b/src/cmd/lccom-1/tst/spill.c @@ -0,0 +1,17 @@ +main(){} + +f(i){i=f()+f();} + +f2(i){i=f()+(i?f():1);} + +f3(int i,int *p){register r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0,r9=0,r10=0;*p++=i?f():0;} + +double a[10],b[10];int i;f4(){register r6=0,r7=0,r8=0,r9=0,r10=0,r11=0;i=a[i]+b[i] && i && a[i]-b[i];} +/* f4 causes parent to spill child on vax when odd double regs are enabled */ + +int j, k, m, n; +double *A, *B, x; +f5(){ + x=A[k*m]*A[j*m]+B[k*n]*B[j*n]; + x=A[k*m]*B[j*n]-B[k*n]*A[j*m]; +} diff --git a/src/cmd/lccom-1/tst/stdarg.c b/src/cmd/lccom-1/tst/stdarg.c new file mode 100644 index 0000000..c6a5338 --- /dev/null +++ b/src/cmd/lccom-1/tst/stdarg.c @@ -0,0 +1,51 @@ +#include + +struct node { int a[4]; } x = {1,2,3,4}; + +print(char *fmt, ...); + +main() { + print("test 1\n"); + print("test %s\n", "2"); + print("test %d%c", 3, '\n'); + print("%s%s %w%c", "te", "st", 4, '\n'); + print("%s%s %f%c", "te", "st", 5.0, '\n'); + print("%b %b %b %b %b %b\n", x, x, x, x, x, x); + return 0; +} + +print(char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + for (; *fmt; fmt++) + if (*fmt == '%') + switch (*++fmt) { + case 'b': { + struct node x = va_arg(ap, struct node); + printf("{%d %d %d %d}", x.a[0], x.a[1], x.a[2], x.a[3]); + break; + } + case 'c': + printf("%c", va_arg(ap, char)); + break; + case 'd': + printf("%d", va_arg(ap, int)); + break; + case 'w': + printf("%x", va_arg(ap, short)); + break; + case 's': + printf("%s", va_arg(ap, char *)); + break; + case 'f': + printf("%f", va_arg(ap, double)); + break; + default: + printf("%c", *fmt); + break; + } + else + printf("%c", *fmt); + va_end(ap); +} diff --git a/src/cmd/lccom-1/tst/struct.c b/src/cmd/lccom-1/tst/struct.c new file mode 100644 index 0000000..fe81681 --- /dev/null +++ b/src/cmd/lccom-1/tst/struct.c @@ -0,0 +1,69 @@ +typedef struct point { int x,y; } point; +typedef struct rect { point pt1, pt2; } rect; + +point addpoint(point p1, point p2) { /* add two points */ + p1.x += p2.x; + p1.y += p2.y; + return p1; +} + +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) > (b) ? (a) : (b)) + +rect canonrect(rect r) { /* canonicalize rectangle coordinates */ + rect temp; + + temp.pt1.x = min(r.pt1.x, r.pt2.x); + temp.pt1.y = min(r.pt1.y, r.pt2.y); + temp.pt2.x = max(r.pt1.x, r.pt2.x); + temp.pt2.y = max(r.pt1.y, r.pt2.y); + return temp; +} + +point makepoint(int x, int y) { /* make a point from x and y components */ + point p; + + p.x = x; + p.y = y; + return p; +} + +rect makerect(point p1, point p2) { /* make a rectangle from two points */ + rect r; + + r.pt1 = p1; + r.pt2 = p2; + return canonrect(r); +} + +int ptinrect(point p, rect r) { /* is p in r? */ + return p.x >= r.pt1.x && p.x < r.pt2.x + && p.y >= r.pt1.y && p.y < r.pt2.y; +} + +struct odd {char a[3]; } y = {'a', 'b', 0}; + +odd(struct odd y) { + struct odd x = y; + printf("%s\n", x.a); +} + +main() { + int i; + point x, origin = { 0, 0 }, maxpt = { 320, 320 }; + point pts[] = { -1, -1, 1, 1, 20, 300, 500, 400 }; + rect screen = makerect(addpoint(maxpt, makepoint(-10, -10)), + addpoint(origin, makepoint(10, 10))); + + for (i = 0; i < sizeof pts/sizeof pts[0]; i++) { + printf("(%d,%d) is ", pts[i].x, + (x = makepoint(pts[i].x, pts[i].y)).y); + if (ptinrect(x, screen) == 0) + printf("not "); + printf("within [%d,%d; %d,%d]\n", screen.pt1.x, screen.pt1.y, + screen.pt2.x, screen.pt2.y); + } + odd(y); + exit(0); +} + diff --git a/src/cmd/lccom-1/tst/switch.c b/src/cmd/lccom-1/tst/switch.c new file mode 100644 index 0000000..dd62d79 --- /dev/null +++ b/src/cmd/lccom-1/tst/switch.c @@ -0,0 +1,137 @@ +main() +{ + int i; char *s; + + for (s = "bfnrtvx"; *s; s++) + printf("%c = 0x%x\n", *s, backslash(*s)); + f(); + g(); + h(); + for (i = 0x1000000; i&0x7000000; i += 0x1000000) + big(i); + limit(); + return 0; +} + +backslash(c) +{ + switch (c) { + case 'b': + return '\b'; + case 'f': + return '\f'; + case 'n': + return '\n'; + case 'r': + return '\r'; + case 't': + return '\t'; + case 'v': + return '\v'; + } + return c; +} + +f() { + int i, x = 0, y; + + printf("f:\n"); + for (i = 0; i <= 20; i++) { + y = i; + switch (i) { + case 1: x = i; break; + case 2: x = i; break; + case 7: x = i; break; + case 8: x = i; break; + case 9: x = i; break; + case 16: x = i; break; + case 17: x = i; break; + case 18: x = i; break; + case 19: x = i; break; + case 20: x = i; break; + } + printf("x = %d\n", x); + } +} + +g() { + int i; + + printf("g:\n"); + for (i = 1; i <= 10; i++) + switch (i) { + case 1: case 2: printf("1 %d\n", i); break; + case 3: case 4: case 5: printf("2 %d\n", i); break; + case 6: case 7: case 8: printf("3 %d\n", i); + default: + printf("d %d\n", i); break; + case 1001: case 1002: case 1003: case 1004: + printf("5 %d\n", i); break; + case 3001: case 3002: case 3003: case 3004: + printf("6 %d\n", i); break; + } +} + +h() +{ + int i, n=0; + + printf("h:\n"); + for (i = 1; i <= 500; i++) + switch (i) { + default: n++; continue; + case 128: printf("i = %d\n", i); break; + case 16: printf("i = %d\n", i); break; + case 8: printf("i = %d\n", i); break; + case 120: printf("i = %d\n", i); break; + case 280: printf("i = %d\n", i); break; + case 264: printf("i = %d\n", i); break; + case 248: printf("i = %d\n", i); break; + case 272: printf("i = %d\n", i); break; + case 304: printf("i = %d\n", i); break; + case 296: printf("i = %d\n", i); break; + case 288: printf("i = %d\n", i); break; + case 312: printf("i = %d\n", i); break; + } + printf("%d defaults\n", n); +} + +big(x) unsigned x; { + switch(x&0x6000000){ + case -1: + case -2: + case 0x0000000: + printf("x = 0x%x\n", x); break; + case 0x2000000: + printf("x = 0x%x\n", x); break; + case 0x4000000: + printf("x = 0x%x\n", x); break; + default: + printf("x = 0x%x (default)\n", x); break; + } +} + +#include + +limit() { + int i; + + for (i = INT_MIN; i <= INT_MIN+5; i++) + switch (i) { + case INT_MIN: printf("0\n"); break; + case INT_MIN+1: printf("1\n"); break; + case INT_MIN+2: printf("2\n"); break; + case INT_MIN+3: printf("3\n"); break; + case INT_MIN+4: printf("4\n"); break; + default: printf("5\n"); break; + } + for (i = INT_MAX; i >= INT_MAX-5; i--) + switch (i) { + case INT_MAX: printf("0\n"); break; + case INT_MAX-1: printf("1\n"); break; + case INT_MAX-2: printf("2\n"); break; + case INT_MAX-3: printf("3\n"); break; + case INT_MAX-4: printf("4\n"); break; + default: printf("5\n"); break; + } +} diff --git a/src/cmd/lccom-1/tst/wf1.c b/src/cmd/lccom-1/tst/wf1.c new file mode 100644 index 0000000..d0c6e32 --- /dev/null +++ b/src/cmd/lccom-1/tst/wf1.c @@ -0,0 +1,101 @@ +/* wf1 - print word frequencies; uses structures */ + +struct node { + int count; /* frequency count */ + struct node *left; /* left subtree */ + struct node *right; /* right subtree */ + char *word; /* word itself */ +} words[2000]; +int next; /* index of next free entry in words */ + +struct node *lookup(); + +main() { + struct node *root; + char word[20]; + + root = 0; + next = 0; + while (getword(word)) + lookup(word, &root)->count++; + tprint(root); + return 0; +} + +/* err - print error message s and die */ +err(s) char *s; { + printf("? %s\n", s); + exit(1); +} + +/* getword - get next input word into buf, return 0 on EOF */ +int getword(buf) char *buf; { + char *s; + int c; + + while ((c = getchar()) != -1 && isletter(c) == 0) + ; + for (s = buf; c = isletter(c); c = getchar()) + *s++ = c; + *s = 0; + if (s > buf) + return (1); + return (0); +} + +/* isletter - return folded version of c if it is a letter, 0 otherwise */ +int isletter(c) { + if (c >= 'A' && c <= 'Z') + c += 'a' - 'A'; + if (c >= 'a' && c <= 'z') + return (c); + return (0); +} + +/* lookup - lookup word in tree; install if necessary */ +struct node *lookup(word, p) char *word; struct node **p; { + int cond; + char *malloc(); + + if (*p) { + cond = strcmp(word, (*p)->word); + if (cond < 0) + return lookup(word, &(*p)->left); + else if (cond > 0) + return lookup(word, &(*p)->right); + else + return *p; + } + if (next >= 2000) + err("out of node storage"); + words[next].count = 0; + words[next].left = words[next].right = 0; + words[next].word = malloc(strlen(word) + 1); + if (words[next].word == 0) + err("out of word storage"); + strcpy(words[next].word, word); + return *p = &words[next++]; +} + +/* tprint - print tree */ +tprint(tree) struct node *tree; { + if (tree) { + tprint(tree->left); + printf("%d\t%s\n", tree->count, tree->word); + tprint(tree->right); + } +} + +/* strcmp - compare s1 and s2, return <0, 0, or >0 */ +int strcmp(s1, s2) char *s1, *s2; { + while (*s1 == *s2) { + if (*s1++ == 0) + return 0; + ++s2; + } + if (*s1 == 0) + return -1; + else if (*s2 == 0) + return 1; + return *s1 - *s2; +} diff --git a/src/cmd/lccom-1/tst/x86-linux/8q.1bk b/src/cmd/lccom-1/tst/x86-linux/8q.1bk new file mode 100644 index 0000000..7ed6437 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/8q.1bk @@ -0,0 +1,92 @@ +1 5 8 6 3 7 2 4 +1 6 8 3 7 4 2 5 +1 7 4 6 8 2 5 3 +1 7 5 8 2 4 6 3 +2 4 6 8 3 1 7 5 +2 5 7 1 3 8 6 4 +2 5 7 4 1 8 6 3 +2 6 1 7 4 8 3 5 +2 6 8 3 1 4 7 5 +2 7 3 6 8 5 1 4 +2 7 5 8 1 4 6 3 +2 8 6 1 3 5 7 4 +3 1 7 5 8 2 4 6 +3 5 2 8 1 7 4 6 +3 5 2 8 6 4 7 1 +3 5 7 1 4 2 8 6 +3 5 8 4 1 7 2 6 +3 6 2 5 8 1 7 4 +3 6 2 7 1 4 8 5 +3 6 2 7 5 1 8 4 +3 6 4 1 8 5 7 2 +3 6 4 2 8 5 7 1 +3 6 8 1 4 7 5 2 +3 6 8 1 5 7 2 4 +3 6 8 2 4 1 7 5 +3 7 2 8 5 1 4 6 +3 7 2 8 6 4 1 5 +3 8 4 7 1 6 2 5 +4 1 5 8 2 7 3 6 +4 1 5 8 6 3 7 2 +4 2 5 8 6 1 3 7 +4 2 7 3 6 8 1 5 +4 2 7 3 6 8 5 1 +4 2 7 5 1 8 6 3 +4 2 8 5 7 1 3 6 +4 2 8 6 1 3 5 7 +4 6 1 5 2 8 3 7 +4 6 8 2 7 1 3 5 +4 6 8 3 1 7 5 2 +4 7 1 8 5 2 6 3 +4 7 3 8 2 5 1 6 +4 7 5 2 6 1 3 8 +4 7 5 3 1 6 8 2 +4 8 1 3 6 2 7 5 +4 8 1 5 7 2 6 3 +4 8 5 3 1 7 2 6 +5 1 4 6 8 2 7 3 +5 1 8 4 2 7 3 6 +5 1 8 6 3 7 2 4 +5 2 4 6 8 3 1 7 +5 2 4 7 3 8 6 1 +5 2 6 1 7 4 8 3 +5 2 8 1 4 7 3 6 +5 3 1 6 8 2 4 7 +5 3 1 7 2 8 6 4 +5 3 8 4 7 1 6 2 +5 7 1 3 8 6 4 2 +5 7 1 4 2 8 6 3 +5 7 2 4 8 1 3 6 +5 7 2 6 3 1 4 8 +5 7 2 6 3 1 8 4 +5 7 4 1 3 8 6 2 +5 8 4 1 3 6 2 7 +5 8 4 1 7 2 6 3 +6 1 5 2 8 3 7 4 +6 2 7 1 3 5 8 4 +6 2 7 1 4 8 5 3 +6 3 1 7 5 8 2 4 +6 3 1 8 4 2 7 5 +6 3 1 8 5 2 4 7 +6 3 5 7 1 4 2 8 +6 3 5 8 1 4 2 7 +6 3 7 2 4 8 1 5 +6 3 7 2 8 5 1 4 +6 3 7 4 1 8 2 5 +6 4 1 5 8 2 7 3 +6 4 2 8 5 7 1 3 +6 4 7 1 3 5 2 8 +6 4 7 1 8 2 5 3 +6 8 2 4 1 7 5 3 +7 1 3 8 6 4 2 5 +7 2 4 1 8 5 3 6 +7 2 6 3 1 4 8 5 +7 3 1 6 8 5 2 4 +7 3 8 2 5 1 6 4 +7 4 2 5 8 1 3 6 +7 4 2 8 6 1 3 5 +7 5 3 1 6 8 2 4 +8 2 4 1 7 5 3 6 +8 2 5 3 1 7 4 6 +8 3 1 6 2 5 7 4 +8 4 1 3 6 2 7 5 diff --git a/src/cmd/lccom-1/tst/x86-linux/8q.2bk b/src/cmd/lccom-1/tst/x86-linux/8q.2bk new file mode 100644 index 0000000..d4dc0ed --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/8q.2bk @@ -0,0 +1,2 @@ +tst/8q.c:30: warning: missing return value +tst/8q.c:39: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/8q.sbk b/src/cmd/lccom-1/tst/x86-linux/8q.sbk new file mode 100644 index 0000000..b9b9577 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/8q.sbk @@ -0,0 +1,180 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $0,-4(%ebp) +.LC2: +movl -4(%ebp),%edi +leal (,%edi,4),%edi +movl $1,down(%edi) +movl $1,up(%edi) +.LC3: +incl -4(%ebp) +cmpl $15,-4(%ebp) +jl .LC2 +movl $0,-4(%ebp) +.LC6: +movl -4(%ebp),%edi +movl $1,rows(,%edi,4) +.LC7: +incl -4(%ebp) +cmpl $8,-4(%ebp) +jl .LC6 +pushl $0 +call queens +addl $4,%esp +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf10: +.size main,.Lf10-main +.globl queens +.align 16 +.type queens,@function +queens: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $0,-4(%ebp) +.LC12: +movl -4(%ebp),%edi +cmpl $0,rows(,%edi,4) +je .LC16 +movl 20(%ebp),%esi +movl %edi,%ebx +subl %esi,%ebx +cmpl $0,up+28(,%ebx,4) +je .LC16 +leal (%esi,%edi),%edi +cmpl $0,down(,%edi,4) +je .LC16 +movl -4(%ebp),%edi +movl 20(%ebp),%esi +leal (%esi,%edi),%ebx +movl $0,down(,%ebx,4) +movl %edi,%ebx +subl %esi,%ebx +movl $0,up+28(,%ebx,4) +movl $0,rows(,%edi,4) +movl 20(%ebp),%edi +movl -4(%ebp),%esi +movl %esi,x(,%edi,4) +cmpl $7,20(%ebp) +jne .LC20 +call print +jmp .LC21 +.LC20: +movl 20(%ebp),%edi +leal 1(%edi),%edi +pushl %edi +call queens +addl $4,%esp +.LC21: +movl -4(%ebp),%edi +movl 20(%ebp),%esi +leal (%esi,%edi),%ebx +movl $1,down(,%ebx,4) +movl %edi,%ebx +subl %esi,%ebx +movl $1,up+28(,%ebx,4) +movl $1,rows(,%edi,4) +.LC16: +.LC13: +incl -4(%ebp) +cmpl $8,-4(%ebp) +jl .LC12 +mov $0,%eax +.LC11: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf23: +.size queens,.Lf23-queens +.globl print +.align 16 +.type print,@function +print: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $0,-4(%ebp) +.LC25: +movl -4(%ebp),%edi +movl x(,%edi,4),%edi +leal 49(%edi),%edi +pushl %edi +pushl $.LC29 +call printf +addl $8,%esp +.LC26: +incl -4(%ebp) +cmpl $8,-4(%ebp) +jl .LC25 +pushl $.LC30 +call printf +addl $4,%esp +mov $0,%eax +.LC24: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf31: +.size print,.Lf31-print +.bss +.globl x +.align 4 +.type x,@object +.size x,32 +.comm x,32 +.globl rows +.align 4 +.type rows,@object +.size rows,32 +.comm rows,32 +.globl down +.align 4 +.type down,@object +.size down,60 +.comm down,60 +.globl up +.align 4 +.type up,@object +.size up,60 +.comm up,60 +.data +.align 1 +.LC30: +.byte 10 +.byte 0 +.align 1 +.LC29: +.byte 37 +.byte 99 +.byte 32 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/array.1bk b/src/cmd/lccom-1/tst/x86-linux/array.1bk new file mode 100644 index 0000000..4d3817c --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/array.1bk @@ -0,0 +1,4 @@ + 0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003 + 0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003 + 0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003 + 0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003 diff --git a/src/cmd/lccom-1/tst/x86-linux/array.2bk b/src/cmd/lccom-1/tst/x86-linux/array.2bk new file mode 100644 index 0000000..c8cf31e --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/array.2bk @@ -0,0 +1,2 @@ +tst/array.c:33: warning: missing return value +tst/array.c:48: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/array.sbk b/src/cmd/lccom-1/tst/x86-linux/array.sbk new file mode 100644 index 0000000..66bcee3 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/array.sbk @@ -0,0 +1,235 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $60,%esp +movl $0,-8(%ebp) +.LC2: +movl $0,-4(%ebp) +.LC6: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +movl %esi,%ebx +sall $4,%ebx +leal x(%ebx),%ebx +imul $1000,%esi,%esi +leal (%edi,%esi),%esi +movl %esi,(%ebx,%edi,4) +.LC7: +incl -4(%ebp) +cmpl $4,-4(%ebp) +jl .LC6 +movl -8(%ebp),%edi +movl %edi,%esi +sall $4,%esi +leal x(%esi),%esi +movl %esi,y(,%edi,4) +.LC3: +incl -8(%ebp) +cmpl $3,-8(%ebp) +jl .LC2 +call f +movl $0,-8(%ebp) +.LC10: +movl -8(%ebp),%edi +movl %edi,%esi +sall $4,%esi +leal -60(%ebp),%ebx +leal (%ebx,%esi),%esi +movl %esi,-12(%ebp) +movl %esi,y(,%edi,4) +movl $0,-4(%ebp) +.LC14: +movl -4(%ebp),%edi +leal (,%edi,4),%edi +movl -12(%ebp),%esi +movl -8(%ebp),%ebx +sall $4,%ebx +leal x(%ebx),%ebx +movl (%ebx,%edi),%ebx +movl %ebx,(%esi,%edi) +.LC15: +incl -4(%ebp) +cmpl $4,-4(%ebp) +jl .LC14 +.LC11: +incl -8(%ebp) +cmpl $3,-8(%ebp) +jl .LC10 +pushl $y +leal -60(%ebp),%edi +pushl %edi +call g +addl $8,%esp +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf18: +.size main,.Lf18-main +.globl f +.align 16 +.type f,@function +f: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl $0,-8(%ebp) +.LC20: +movl $0,-4(%ebp) +.LC24: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +sall $4,%esi +leal x(%esi),%esi +pushl (%esi,%edi,4) +pushl $.LC28 +call printf +addl $8,%esp +.LC25: +incl -4(%ebp) +cmpl $4,-4(%ebp) +jl .LC24 +.LC21: +incl -8(%ebp) +cmpl $3,-8(%ebp) +jl .LC20 +pushl $.LC29 +call printf +addl $4,%esp +movl $0,-8(%ebp) +.LC30: +movl $0,-4(%ebp) +.LC34: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +movl y(,%esi,4),%esi +pushl (%esi,%edi,4) +pushl $.LC28 +call printf +addl $8,%esp +.LC35: +incl -4(%ebp) +cmpl $4,-4(%ebp) +jl .LC34 +.LC31: +incl -8(%ebp) +cmpl $3,-8(%ebp) +jl .LC30 +pushl $.LC29 +call printf +addl $4,%esp +mov $0,%eax +.LC19: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf38: +.size f,.Lf38-f +.globl g +.align 16 +.type g,@function +g: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl $0,-8(%ebp) +.LC40: +movl $0,-4(%ebp) +.LC44: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +sall $4,%esi +movl 20(%ebp),%ebx +leal (%ebx,%esi),%esi +pushl (%esi,%edi,4) +pushl $.LC28 +call printf +addl $8,%esp +.LC45: +incl -4(%ebp) +cmpl $4,-4(%ebp) +jl .LC44 +.LC41: +incl -8(%ebp) +cmpl $3,-8(%ebp) +jl .LC40 +pushl $.LC29 +call printf +addl $4,%esp +movl $0,-8(%ebp) +.LC48: +movl $0,-4(%ebp) +.LC52: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +movl 24(%ebp),%ebx +movl (%ebx,%esi,4),%esi +pushl (%esi,%edi,4) +pushl $.LC28 +call printf +addl $8,%esp +.LC53: +incl -4(%ebp) +cmpl $4,-4(%ebp) +jl .LC52 +.LC49: +incl -8(%ebp) +cmpl $3,-8(%ebp) +jl .LC48 +pushl $.LC29 +call printf +addl $4,%esp +mov $0,%eax +.LC39: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf56: +.size g,.Lf56-g +.bss +.globl y +.align 4 +.type y,@object +.size y,12 +.comm y,12 +.globl x +.align 4 +.type x,@object +.size x,48 +.comm x,48 +.data +.align 1 +.LC29: +.byte 10 +.byte 0 +.align 1 +.LC28: +.byte 32 +.byte 37 +.byte 100 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/assert.h b/src/cmd/lccom-1/tst/x86-linux/assert.h new file mode 100644 index 0000000..04b0e3a --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/assert.h @@ -0,0 +1,14 @@ +#ifndef __ASSERT +#define __ASSERT + +void assert(int); + +#endif /* __ASSERT */ + +#undef assert +#ifdef NDEBUG +#define assert(ignore) ((void)0) +#else +extern int _assert(char *, char *, unsigned); +#define assert(e) ((void)((e)||_assert(#e, __FILE__, __LINE__))) +#endif /* NDEBUG */ diff --git a/src/cmd/lccom-1/tst/x86-linux/cf.1bk b/src/cmd/lccom-1/tst/x86-linux/cf.1bk new file mode 100644 index 0000000..9e331c5 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/cf.1bk @@ -0,0 +1,51 @@ +char freq +011 8.1 +012 6.1 +040 11.9 +! 0.2 +" 1.5 +% 0.6 +& 0.4 +' 0.4 +( 2.9 +) 2.9 +* 0.8 ++ 1.3 +, 1.3 +- 0.4 +. 0.6 +/ 1.0 +0 2.5 +1 1.9 +2 0.6 +3 0.2 +7 0.4 +8 0.2 +; 3.8 +< 0.8 += 2.7 +> 0.2 +[ 1.5 +\ 0.8 +] 1.5 +a 3.1 +c 4.4 +e 2.3 +f 6.0 +g 1.3 +h 1.0 +i 5.0 +l 1.0 +m 0.2 +n 3.3 +o 2.1 +p 1.0 +q 0.4 +r 4.2 +s 0.6 +t 3.8 +u 1.2 +v 0.6 +w 0.2 +{ 0.6 +} 0.6 diff --git a/src/cmd/lccom-1/tst/x86-linux/cf.2bk b/src/cmd/lccom-1/tst/x86-linux/cf.2bk new file mode 100644 index 0000000..e69de29 diff --git a/src/cmd/lccom-1/tst/x86-linux/cf.sbk b/src/cmd/lccom-1/tst/x86-linux/cf.sbk new file mode 100644 index 0000000..b714f3c --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/cf.sbk @@ -0,0 +1,164 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $24,%esp +cmpl $1,20(%ebp) +jg .LC2 +flds .LC4 +fstps -16(%ebp) +jmp .LC3 +.LC2: +movl 24(%ebp),%edi +pushl 4(%edi) +call atof +addl $4,%esp +fstps -20(%ebp) +flds -20(%ebp) +fdivs .LC5 +fstps -16(%ebp) +.LC3: +movl $0,-4(%ebp) +.LC6: +movl -4(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-4(%ebp) +flds .LC4 +fstps f(,%edi,4) +.LC7: +cmpl $127,-4(%ebp) +jle .LC6 +movl $0,-8(%ebp) +jmp .LC11 +.LC10: +movl -12(%ebp),%edi +leal f(,%edi,4),%edi +flds (,%edi) +fadds .LC13 +fstps (,%edi) +incl -8(%ebp) +.LC11: +call getchar +movl %eax,-12(%ebp) +cmpl $-1,%eax +jne .LC10 +pushl $.LC14 +call printf +addl $4,%esp +movl $0,-4(%ebp) +.LC15: +movl -4(%ebp),%edi +flds f(,%edi,4) +fstps -24(%ebp) +flds .LC4 +fcomps -24(%ebp) +fstsw %ax +sahf +jp 1f +je .LC19 +1: +flds -24(%ebp) +fildl -8(%ebp) +fdivrp %st,%st(1) +flds -16(%ebp) +fcompp +fstsw %ax +sahf +jp .LC19 +ja .LC19 +cmpl $32,-4(%ebp) +jg .LC21 +pushl -4(%ebp) +pushl $.LC23 +call printf +addl $8,%esp +jmp .LC22 +.LC21: +pushl -4(%ebp) +pushl $.LC24 +call printf +addl $8,%esp +.LC22: +flds .LC5 +movl -4(%ebp),%edi +fmuls f(,%edi,4) +fildl -8(%ebp) +fdivrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +pushl $.LC25 +call printf +addl $12,%esp +.LC19: +.LC16: +incl -4(%ebp) +cmpl $127,-4(%ebp) +jle .LC15 +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf26: +.size main,.Lf26-main +.bss +.globl f +.align 4 +.type f,@object +.size f,512 +.comm f,512 +.data +.align 1 +.LC25: +.byte 9 +.byte 37 +.byte 46 +.byte 49 +.byte 102 +.byte 10 +.byte 0 +.align 1 +.LC24: +.byte 37 +.byte 99 +.byte 0 +.align 1 +.LC23: +.byte 37 +.byte 48 +.byte 51 +.byte 111 +.byte 0 +.align 1 +.LC14: +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 9 +.byte 102 +.byte 114 +.byte 101 +.byte 113 +.byte 10 +.byte 0 +.align 4 +.LC13: +.long 1065353216 +.align 4 +.LC5: +.long 1120403456 +.align 4 +.LC4: +.long 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/cq.1bk b/src/cmd/lccom-1/tst/x86-linux/cq.1bk new file mode 100644 index 0000000..f0e8b35 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/cq.1bk @@ -0,0 +1,48 @@ +Section s22 returned 0. +Decimal and octal/hex constants sometimes give + different results when assigned to longs. +Decimal and octal/hex constants sometimes give + different results when assigned to longs. +Section s241 returned 0. +Section s243 returned 0. +Section s244 returned 0. +Section s25 returned 0. + 8 bits in chars. + 32 bits in ints. + 16 bits in shorts. + 32 bits in longs. + 32 bits in unsigneds. + 32 bits in floats. + 64 bits in doubles. +1.192093e-07 is the least number that can be added to 1. (float). +2.220446e-16 is the least number that can be added to 1. (double). +Section s26 returned 0. +Section s4 returned 0. +Section s61 returned 0. +Section s626 returned 0. +Section s71 returned 0. +Section s72 returned 0. +Section s757 returned 0. +Section s7813 returned 0. +Section s714 returned 0. +Section s715 returned 0. +Register count for char is unreliable. +Register count for pointer is unreliable. +Register count for int is unreliable. +Section s81 returned 0. +Section s84 returned 0. +char alignment: 1 +short alignment: 2 +int alignment: 4 +long alignment: 4 +unsigned alignment: 4 +float alignment: 4 +double alignment: 4 +Sign extension in fields +Be especially careful with 1-bit fields! +Section s85 returned 0. +Section s86 returned 0. +Section s88 returned 0. +Section s9 returned 0. + +No errors detected. diff --git a/src/cmd/lccom-1/tst/x86-linux/cq.2bk b/src/cmd/lccom-1/tst/x86-linux/cq.2bk new file mode 100644 index 0000000..7c6ba5e --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/cq.2bk @@ -0,0 +1,25 @@ +tst/cq.c:394: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:394: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:394: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:395: warning: overflow in constant `4294967296' +tst/cq.c:395: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:395: warning: overflow in constant `040000000000' +tst/cq.c:395: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:395: warning: overflow in constant `0x100000000' +tst/cq.c:395: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:396: warning: overflow in constant `68719476735' +tst/cq.c:396: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:396: warning: overflow in constant `0777777777777' +tst/cq.c:396: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:396: warning: overflow in constant `0xfffffffff' +tst/cq.c:396: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:397: warning: overflow in constant `68719476736' +tst/cq.c:397: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:397: warning: overflow in constant `01000000000000' +tst/cq.c:397: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:397: warning: overflow in constant `0x1000000000' +tst/cq.c:397: warning: overflow in converting constant expression from `unsigned long' to `long int' +tst/cq.c:533: warning: missing return value +tst/cq.c:1169: warning: missing return value +tst/cq.c:5294: warning: unreachable code +tst/cq.c:5303: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/cq.sbk b/src/cmd/lccom-1/tst/x86-linux/cq.sbk new file mode 100644 index 0000000..58b725a --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/cq.sbk @@ -0,0 +1,16528 @@ +.data +.align 4 +.type sec.2,@object +sec.2: +.long s22 +.long s241 +.long s243 +.long s244 +.long s25 +.long s26 +.long s4 +.long s61 +.long s626 +.long s71 +.long s72 +.long s757 +.long s7813 +.long s714 +.long s715 +.long s81 +.long s84 +.long s85 +.long s86 +.long s88 +.long s9 +.bss +.size sec.2,84 +.align 4 +.type d0.3,@object +.size d0.3,68 +.lcomm d0.3,68 +.align 4 +.type pd0.4,@object +.size pd0.4,4 +.lcomm pd0.4,4 +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $1,d0.3+36 +movl $1,d0.3+40 +movl $1,d0.3+44 +movl $1,d0.3+48 +leal d0.3,%edi +movl %edi,pd0.4 +movl $0,-4(%ebp) +jmp .LC12 +.LC9: +pushl pd0.4 +movl -4(%ebp),%edi +call *sec.2(,%edi,4) +addl $4,%esp +movl %eax,d0.3+52 +movl d0.3+56,%edi +movl d0.3+52,%esi +leal (%esi,%edi),%edi +movl %edi,d0.3+56 +cmpl $0,d0.3+36 +je .LC17 +pushl d0.3+52 +pushl $d0.3+60 +pushl $.LC20 +call printf +addl $12,%esp +.LC17: +.LC10: +incl -4(%ebp) +.LC12: +movl -4(%ebp),%edi +cmpl $21,%edi +jb .LC9 +cmpl $0,d0.3+56 +jne .LC23 +pushl $.LC26 +call printf +addl $4,%esp +jmp .LC24 +.LC23: +pushl $.LC27 +call printf +addl $4,%esp +.LC24: +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf28: +.size main,.Lf28-main +.data +.align 1 +.type s22er.30,@object +s22er.30: +.byte 115 +.byte 50 +.byte 50 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s22er.30,10 +.align 1 +.type qs22.31,@object +.size qs22.31,8 +qs22.31: +.byte 115 +.byte 50 +.byte 50 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s22 +.text +.align 16 +.type s22,@function +s22: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $32,%esp +movl $0,-12(%ebp) +leal qs22.31,%edi +movl %edi,-4(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-8(%ebp) +.LC32: +.LC33: +movl -8(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-8(%ebp) +movl -4(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-4(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC32 +movl $1,-16(%ebp) +movl $2,-24(%ebp) +movl $3,-28(%ebp) +movl $4,-20(%ebp) +movl -16(%ebp),%edi +movl -24(%ebp),%esi +leal (%esi,%edi),%edi +movl -28(%ebp),%esi +leal (%esi,%edi),%edi +movl -20(%ebp),%esi +leal (%esi,%edi),%edi +cmpl $10,%edi +je .LC35 +incl -12(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC37 +pushl $1 +pushl $s22er.30 +call printf +addl $8,%esp +.LC37: +.LC35: +movl $2,-32(%ebp) +movl -16(%ebp),%edi +cmpl %edi,-32(%ebp) +jne .LC39 +addl $4,-12(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC41 +pushl $4 +pushl $s22er.30 +call printf +addl $8,%esp +.LC41: +.LC39: +movl -12(%ebp),%eax +.LC29: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf43: +.size s22,.Lf43-s22 +.data +.align 1 +.type s241er.45,@object +s241er.45: +.byte 115 +.byte 50 +.byte 52 +.byte 49 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s241er.45,11 +.align 1 +.type qs241.46,@object +.size qs241.46,8 +qs241.46: +.byte 115 +.byte 50 +.byte 52 +.byte 49 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.align 4 +.type g.47,@object +.size g.47,156 +g.47: +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 0 +.long 6 +.long 0 +.long 8 +.long 0 +.long 12 +.long 0 +.long 16 +.long 0 +.long 18 +.long 0 +.long 20 +.long 0 +.long 24 +.long 0 +.long 28 +.long 0 +.long 30 +.long 0 +.long 32 +.long 0 +.long 36 +.globl s241 +.text +.align 16 +.type s241,@function +s241: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $488,%esp +movl $0,-484(%ebp) +movl $0,-488(%ebp) +leal qs241.46,%edi +movl %edi,-476(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-480(%ebp) +.LC48: +.LC49: +movl -480(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-480(%ebp) +movl -476(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-476(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC48 +jmp .LC51 +incl -484(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC53 +pushl $1 +pushl $s241er.45 +call printf +addl $8,%esp +.LC53: +.LC51: +jmp .LC55 +addl $2,-484(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC57 +pushl $2 +pushl $s241er.45 +call printf +addl $8,%esp +.LC57: +.LC55: +jmp .LC59 +addl $4,-484(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC61 +pushl $4 +pushl $s241er.45 +call printf +addl $8,%esp +.LC61: +.LC59: +jmp .LC63 +addl $8,-484(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC65 +pushl $8 +pushl $s241er.45 +call printf +addl $8,%esp +.LC65: +.LC63: +movl $0,-4(%ebp) +.LC67: +movl -4(%ebp),%edi +movl %edi,g.47(,%edi,4) +.LC68: +incl -4(%ebp) +cmpl $17,-4(%ebp) +jl .LC67 +movl $18,-4(%ebp) +.LC71: +movl -4(%ebp),%edi +leal g.47(,%edi,4),%edi +pushl (,%edi) +call pow2 +addl $4,%esp +movl %eax,(,%edi) +movl -4(%ebp),%edi +leal (,%edi,4),%edi +movl g.47(%edi),%esi +subl $1,%esi +movl %esi,g.47-4(%edi) +addl $2,-4(%ebp) +.LC72: +cmpl $39,-4(%ebp) +jl .LC71 +movl $0,-160(%ebp) +movl $0,-316(%ebp) +movl $0,-472(%ebp) +movl $1,-156(%ebp) +movl $1,-312(%ebp) +movl $1,-468(%ebp) +movl $2,-152(%ebp) +movl $2,-308(%ebp) +movl $2,-464(%ebp) +movl $3,-148(%ebp) +movl $3,-304(%ebp) +movl $3,-460(%ebp) +movl $4,-144(%ebp) +movl $4,-300(%ebp) +movl $4,-456(%ebp) +movl $5,-140(%ebp) +movl $5,-296(%ebp) +movl $5,-452(%ebp) +movl $6,-136(%ebp) +movl $6,-292(%ebp) +movl $6,-448(%ebp) +movl $7,-132(%ebp) +movl $7,-288(%ebp) +movl $7,-444(%ebp) +movl $8,-128(%ebp) +movl $8,-284(%ebp) +movl $8,-440(%ebp) +movl $9,-124(%ebp) +movl $9,-280(%ebp) +movl $9,-436(%ebp) +movl $10,-120(%ebp) +movl $10,-276(%ebp) +movl $10,-432(%ebp) +movl $11,-116(%ebp) +movl $11,-272(%ebp) +movl $11,-428(%ebp) +movl $12,-112(%ebp) +movl $12,-268(%ebp) +movl $12,-424(%ebp) +movl $13,-108(%ebp) +movl $13,-264(%ebp) +movl $13,-420(%ebp) +movl $14,-104(%ebp) +movl $14,-260(%ebp) +movl $14,-416(%ebp) +movl $15,-100(%ebp) +movl $15,-256(%ebp) +movl $15,-412(%ebp) +movl $16,-96(%ebp) +movl $16,-252(%ebp) +movl $16,-408(%ebp) +movl $63,-92(%ebp) +movl $63,-248(%ebp) +movl $63,-404(%ebp) +movl $64,-88(%ebp) +movl $64,-244(%ebp) +movl $64,-400(%ebp) +movl $255,-84(%ebp) +movl $255,-240(%ebp) +movl $255,-396(%ebp) +movl $256,-80(%ebp) +movl $256,-236(%ebp) +movl $256,-392(%ebp) +movl $4095,-76(%ebp) +movl $4095,-232(%ebp) +movl $4095,-388(%ebp) +movl $4096,-72(%ebp) +movl $4096,-228(%ebp) +movl $4096,-384(%ebp) +movl $65535,-68(%ebp) +movl $65535,-224(%ebp) +movl $65535,-380(%ebp) +movl $65536,-64(%ebp) +movl $65536,-220(%ebp) +movl $65536,-376(%ebp) +movl $262143,-60(%ebp) +movl $262143,-216(%ebp) +movl $262143,-372(%ebp) +movl $262144,-56(%ebp) +movl $262144,-212(%ebp) +movl $262144,-368(%ebp) +movl $1048575,-52(%ebp) +movl $1048575,-208(%ebp) +movl $1048575,-364(%ebp) +movl $1048576,-48(%ebp) +movl $1048576,-204(%ebp) +movl $1048576,-360(%ebp) +movl $16777215,-44(%ebp) +movl $16777215,-200(%ebp) +movl $16777215,-356(%ebp) +movl $16777216,-40(%ebp) +movl $16777216,-196(%ebp) +movl $16777216,-352(%ebp) +movl $268435455,-36(%ebp) +movl $268435455,-192(%ebp) +movl $268435455,-348(%ebp) +movl $268435456,-32(%ebp) +movl $268435456,-188(%ebp) +movl $268435456,-344(%ebp) +movl $1073741823,-28(%ebp) +movl $1073741823,-184(%ebp) +movl $1073741823,-340(%ebp) +movl $1073741824,-24(%ebp) +movl $1073741824,-180(%ebp) +movl $1073741824,-336(%ebp) +mov $0xffffffff,%edi +movl %edi,-20(%ebp) +mov $0xffffffff,%edi +movl %edi,-176(%ebp) +mov $0xffffffff,%edi +movl %edi,-332(%ebp) +mov $0xffffffff,%edi +movl %edi,-16(%ebp) +mov $0xffffffff,%edi +movl %edi,-172(%ebp) +mov $0xffffffff,%edi +movl %edi,-328(%ebp) +mov $0xffffffff,%edi +movl %edi,-12(%ebp) +mov $0xffffffff,%edi +movl %edi,-168(%ebp) +mov $0xffffffff,%edi +movl %edi,-324(%ebp) +mov $0xffffffff,%edi +movl %edi,-8(%ebp) +mov $0xffffffff,%edi +movl %edi,-164(%ebp) +mov $0xffffffff,%edi +movl %edi,-320(%ebp) +movl $0,-4(%ebp) +.LC190: +movl -4(%ebp),%edi +leal (,%edi,4),%edi +leal -160(%ebp),%esi +movl (%esi,%edi),%esi +cmpl %esi,g.47(%edi) +jne .LC197 +leal -316(%ebp),%ebx +movl (%ebx,%edi),%ebx +cmpl %ebx,%esi +jne .LC197 +leal -472(%ebp),%esi +cmpl (%esi,%edi),%ebx +je .LC194 +.LC197: +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC198 +pushl $.LC200 +call printf +addl $4,%esp +pushl $.LC201 +call printf +addl $4,%esp +.LC198: +.LC194: +.LC191: +incl -4(%ebp) +cmpl $39,-4(%ebp) +jl .LC190 +cmpl $0,-488(%ebp) +je .LC202 +movl $16,-484(%ebp) +.LC202: +movl -484(%ebp),%eax +.LC44: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf204: +.size s241,.Lf204-s241 +.globl pow2 +.align 16 +.type pow2,@function +pow2: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $1,-4(%ebp) +jmp .LC207 +.LC206: +sall $1,-4(%ebp) +.LC207: +movl 20(%ebp),%edi +movl %edi,%esi +subl $1,%esi +movl %esi,20(%ebp) +cmpl $0,%edi +jne .LC206 +movl -4(%ebp),%eax +.LC205: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf209: +.size pow2,.Lf209-pow2 +.data +.align 1 +.type s243er.211,@object +s243er.211: +.byte 115 +.byte 50 +.byte 52 +.byte 51 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s243er.211,11 +.align 1 +.type qs243.212,@object +.size qs243.212,8 +qs243.212: +.byte 115 +.byte 50 +.byte 52 +.byte 51 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s243 +.text +.align 16 +.type s243,@function +s243: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $268,%esp +movl $0,-268(%ebp) +leal qs243.212,%edi +movl %edi,-260(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-264(%ebp) +.LC213: +.LC214: +movl -264(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-264(%ebp) +movl -260(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-260(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC213 +leal -256(%ebp),%edi +pushl %edi +call zerofill +addl $4,%esp +movb $1,-159(%ebp) +movb $1,-191(%ebp) +movb $1,-130(%ebp) +movb $1,-208(%ebp) +movb $1,-158(%ebp) +movb $1,-190(%ebp) +movb $1,-223(%ebp) +movb $1,-207(%ebp) +movb $1,-157(%ebp) +movb $1,-189(%ebp) +movb $1,-222(%ebp) +movb $1,-206(%ebp) +movb $1,-156(%ebp) +movb $1,-188(%ebp) +movb $1,-221(%ebp) +movb $1,-205(%ebp) +movb $1,-155(%ebp) +movb $1,-187(%ebp) +movb $1,-219(%ebp) +movb $1,-204(%ebp) +movb $1,-154(%ebp) +movb $1,-186(%ebp) +movb $1,-218(%ebp) +movb $1,-203(%ebp) +movb $1,-153(%ebp) +movb $1,-185(%ebp) +movb $1,-216(%ebp) +movb $1,-202(%ebp) +movb $1,-152(%ebp) +movb $1,-184(%ebp) +movb $1,-215(%ebp) +movb $1,-201(%ebp) +movb $1,-151(%ebp) +movb $1,-183(%ebp) +movb $1,-161(%ebp) +movb $1,-200(%ebp) +movb $1,-150(%ebp) +movb $1,-182(%ebp) +movb $1,-195(%ebp) +movb $1,-199(%ebp) +movb $1,-149(%ebp) +movb $1,-181(%ebp) +movb $1,-211(%ebp) +movb $1,-148(%ebp) +movb $1,-180(%ebp) +movb $1,-162(%ebp) +movb $1,-147(%ebp) +movb $1,-179(%ebp) +movb $1,-132(%ebp) +movb $1,-246(%ebp) +movb $1,-146(%ebp) +movb $1,-178(%ebp) +movb $1,-247(%ebp) +movb $1,-145(%ebp) +movb $1,-177(%ebp) +movb $1,-133(%ebp) +movb $1,-248(%ebp) +movb $1,-144(%ebp) +movb $1,-176(%ebp) +movb $1,-131(%ebp) +movb $1,-243(%ebp) +movb $1,-143(%ebp) +movb $1,-175(%ebp) +movb $1,-165(%ebp) +movb $1,-244(%ebp) +movb $1,-142(%ebp) +movb $1,-174(%ebp) +movb $1,-163(%ebp) +movb $1,-141(%ebp) +movb $1,-173(%ebp) +movb $1,-213(%ebp) +movb $1,-164(%ebp) +movb $1,-140(%ebp) +movb $1,-172(%ebp) +movb $1,-197(%ebp) +movb $1,-217(%ebp) +movb $1,-139(%ebp) +movb $1,-171(%ebp) +movb $1,-214(%ebp) +movb $1,-138(%ebp) +movb $1,-170(%ebp) +movb $1,-198(%ebp) +movb $1,-256(%ebp) +movb $1,-137(%ebp) +movb $1,-169(%ebp) +movb $1,-196(%ebp) +movb $1,-224(%ebp) +movb $1,-136(%ebp) +movb $1,-168(%ebp) +movb $1,-194(%ebp) +movb $1,-135(%ebp) +movb $1,-167(%ebp) +movb $1,-212(%ebp) +movb $1,-134(%ebp) +movb $1,-166(%ebp) +movb $1,-210(%ebp) +movb $1,-193(%ebp) +movb $1,-209(%ebp) +leal -256(%ebp),%edi +pushl %edi +call sumof +addl $4,%esp +cmpl $98,%eax +je .LC313 +incl -268(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC315 +pushl $1 +pushl $s243er.211 +call printf +addl $8,%esp +.LC315: +.LC313: +jmp .LC317 +addl $8,-268(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC319 +pushl $8 +pushl $s243er.211 +call printf +addl $8,%esp +.LC319: +.LC317: +movl -268(%ebp),%eax +.LC210: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf321: +.size s243,.Lf321-s243 +.globl zerofill +.align 16 +.type zerofill,@function +zerofill: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $0,-4(%ebp) +.LC323: +movl 20(%ebp),%edi +leal 1(%edi),%esi +movl %esi,20(%ebp) +movb $0,(,%edi) +.LC324: +incl -4(%ebp) +cmpl $256,-4(%ebp) +jl .LC323 +mov $0,%eax +.LC322: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf327: +.size zerofill,.Lf327-zerofill +.globl sumof +.align 16 +.type sumof,@function +sumof: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $12,%esp +movl 20(%ebp),%edi +movl %edi,-12(%ebp) +movl $0,-4(%ebp) +movl $0,-8(%ebp) +.LC329: +movl -12(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-12(%ebp) +movsbl (,%edi),%edi +addl %edi,-4(%ebp) +.LC330: +incl -8(%ebp) +cmpl $256,-8(%ebp) +jl .LC329 +movl -4(%ebp),%eax +.LC328: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf333: +.size sumof,.Lf333-sumof +.data +.align 1 +.type s244er.335,@object +s244er.335: +.byte 115 +.byte 50 +.byte 52 +.byte 52 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s244er.335,11 +.align 1 +.type qs244.336,@object +.size qs244.336,8 +qs244.336: +.byte 115 +.byte 50 +.byte 52 +.byte 52 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s244 +.text +.align 16 +.type s244,@function +s244: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $92,%esp +leal qs244.336,%edi +movl %edi,-72(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-76(%ebp) +.LC337: +.LC338: +movl -76(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-76(%ebp) +movl -72(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-72(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC337 +movl $0,-84(%ebp) +movl $0,-80(%ebp) +fldl .LC340 +fstpl -68(%ebp) +fldl .LC340 +fstpl -60(%ebp) +fldl .LC340 +fstpl -52(%ebp) +fldl .LC340 +fstpl -44(%ebp) +fldl .LC340 +fstpl -36(%ebp) +fldl .LC340 +fstpl -28(%ebp) +fldl .LC340 +fstpl -20(%ebp) +fldl .LC340 +fstpl -12(%ebp) +movl $0,-80(%ebp) +movl $0,-4(%ebp) +.LC348: +movl -4(%ebp),%edi +leal (,%edi,8),%edi +leal -68(%ebp),%esi +leal -60(%ebp),%ebx +fldl (%ebx,%edi) +fcompl (%esi,%edi) +fstsw %ax +sahf +jp 1f +je .LC352 +1: +movl $1,-80(%ebp) +.LC352: +.LC349: +incl -4(%ebp) +cmpl $7,-4(%ebp) +jl .LC348 +cmpl $0,-80(%ebp) +je .LC355 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC357 +pushl $1 +pushl $s244er.335 +call printf +addl $8,%esp +.LC357: +incl -84(%ebp) +.LC355: +jmp .LC359 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC361 +pushl $2 +pushl $s244er.335 +call printf +addl $8,%esp +.LC361: +addl $2,-84(%ebp) +.LC359: +movl -84(%ebp),%eax +.LC334: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf363: +.size s244,.Lf363-s244 +.data +.align 1 +.type s25er.365,@object +s25er.365: +.byte 115 +.byte 50 +.byte 53 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s25er.365,10 +.align 1 +.type qs25.366,@object +.size qs25.366,8 +qs25.366: +.byte 115 +.byte 50 +.byte 53 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s25 +.text +.align 16 +.type s25,@function +s25: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $28,%esp +leal qs25.366,%edi +movl %edi,-16(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-20(%ebp) +.LC367: +.LC368: +movl -20(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-20(%ebp) +movl -16(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-16(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC367 +movl $0,-24(%ebp) +leal .LC370,%edi +movl %edi,-8(%ebp) +movl -8(%ebp),%edi +movsbl 1(%edi),%esi +movsbl (,%edi),%ebx +cmpl %esi,%ebx +jne .LC374 +movsbl 2(%edi),%edi +cmpl %edi,%esi +jne .LC374 +cmpl $46,%edi +je .LC371 +.LC374: +incl -24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC375 +pushl $1 +pushl $s25er.365 +call printf +addl $8,%esp +.LC375: +.LC371: +movl -8(%ebp),%edi +movsbl 3(%edi),%edi +cmpl $0,%edi +je .LC377 +addl $4,-24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC379 +pushl $4 +pushl $s25er.365 +call printf +addl $8,%esp +.LC379: +.LC377: +movsbl .LC383+1,%edi +cmpl $34,%edi +je .LC381 +addl $8,-24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC385 +pushl $8 +pushl $s25er.365 +call printf +addl $8,%esp +.LC385: +.LC381: +leal .LC387,%edi +movl %edi,-8(%ebp) +movl -8(%ebp),%edi +movsbl (,%edi),%esi +cmpl $10,%esi +jne .LC395 +movsbl 1(%edi),%esi +cmpl $9,%esi +jne .LC395 +movsbl 2(%edi),%esi +cmpl $8,%esi +jne .LC395 +movsbl 3(%edi),%esi +cmpl $13,%esi +jne .LC395 +movsbl 4(%edi),%esi +cmpl $12,%esi +jne .LC395 +movsbl 5(%edi),%esi +cmpl $92,%esi +jne .LC395 +movsbl 6(%edi),%edi +cmpl $39,%edi +je .LC388 +.LC395: +addl $16,-24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC396 +pushl $16 +pushl $s25er.365 +call printf +addl $8,%esp +.LC396: +.LC388: +leal .LC398,%edi +movl %edi,-12(%ebp) +movl %edi,-8(%ebp) +movl $0,-28(%ebp) +movl $0,-4(%ebp) +jmp .LC402 +.LC399: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +movsbl (%esi,%edi),%esi +movl -12(%ebp),%ebx +movsbl (%ebx,%edi),%edi +cmpl %edi,%esi +je .LC403 +movl $1,-28(%ebp) +.LC403: +.LC400: +incl -4(%ebp) +.LC402: +movl -4(%ebp),%edi +cmpl $7,%edi +jb .LC399 +cmpl $0,-28(%ebp) +je .LC405 +addl $32,-24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC407 +pushl $32 +pushl $s25er.365 +call printf +addl $8,%esp +.LC407: +.LC405: +movl -24(%ebp),%eax +.LC364: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf409: +.size s25,.Lf409-s25 +.data +.align 1 +.type qs26.411,@object +.size qs26.411,8 +qs26.411: +.byte 115 +.byte 50 +.byte 54 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.align 1 +.type s.412,@object +s.412: +.byte 37 +.byte 51 +.byte 100 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 37 +.byte 115 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.size s.412,18 +.align 1 +.type s2.413,@object +s2.413: +.byte 37 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 108 +.byte 101 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 97 +.byte 100 +.byte 100 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 49 +.byte 46 +.byte 32 +.byte 40 +.byte 37 +.byte 115 +.byte 41 +.byte 46 +.byte 10 +.byte 0 +.size s2.413,54 +.globl s26 +.text +.align 16 +.type s26,@function +s26: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $56,%esp +leal qs26.411,%edi +movl %edi,-36(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-40(%ebp) +.LC414: +.LC415: +movl -40(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-40(%ebp) +movl -36(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-36(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC414 +movl 20(%ebp),%edi +movl $0,(,%edi) +movb $0,-44(%ebp) +movb $1,-8(%ebp) +jmp .LC418 +.LC417: +movsbl -8(%ebp),%edi +leal (,%edi,2),%edi +movl %edi,%ebx +movb %bl,-8(%ebp) +movl 20(%ebp),%edi +incl (,%edi) +.LC418: +movsbl -44(%ebp),%edi +movsbl -8(%ebp),%esi +cmpl %esi,%edi +jne .LC417 +movl 20(%ebp),%edi +movl (,%edi),%esi +leal (,%esi,4),%esi +movl %esi,4(%edi) +movl 20(%ebp),%edi +movl (,%edi),%esi +leal (,%esi,2),%esi +movl %esi,8(%edi) +movl 20(%ebp),%edi +movl (,%edi),%esi +leal (,%esi,4),%esi +movl %esi,12(%edi) +movl 20(%ebp),%edi +movl (,%edi),%esi +leal (,%esi,4),%esi +movl %esi,16(%edi) +movl 20(%ebp),%edi +movl (,%edi),%esi +leal (,%esi,4),%esi +movl %esi,20(%edi) +movl 20(%ebp),%edi +movl (,%edi),%esi +leal (,%esi,8),%esi +movl %esi,24(%edi) +flds .LC420 +fstps -16(%ebp) +flds .LC420 +fstps -4(%ebp) +flds .LC421 +fstps -12(%ebp) +jmp .LC423 +.LC422: +flds -16(%ebp) +fadds -4(%ebp) +fstps -12(%ebp) +flds -4(%ebp) +fdivl .LC425 +fstps -4(%ebp) +.LC423: +flds -16(%ebp) +fcomps -12(%ebp) +fstsw %ax +sahf +jp .LC422 +jne .LC422 +movl 20(%ebp),%edi +fldl .LC426 +fmuls -4(%ebp) +fstps 28(%edi) +fldl .LC427 +fstpl -32(%ebp) +flds .LC420 +fstps -4(%ebp) +fldl .LC428 +fstpl -24(%ebp) +jmp .LC430 +.LC429: +flds -4(%ebp) +fstpl -56(%ebp) +fldl -32(%ebp) +faddl -56(%ebp) +fstpl -24(%ebp) +fldl -56(%ebp) +fdivl .LC425 +fstps -4(%ebp) +.LC430: +fldl -32(%ebp) +fcompl -24(%ebp) +fstsw %ax +sahf +jp .LC429 +jne .LC429 +movl 20(%ebp),%edi +fldl .LC426 +fmuls -4(%ebp) +fstps 32(%edi) +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC432 +pushl $.LC434 +movl 20(%ebp),%edi +pushl (,%edi) +pushl $s.412 +call printf +addl $12,%esp +pushl $.LC435 +movl 20(%ebp),%edi +pushl 4(%edi) +pushl $s.412 +call printf +addl $12,%esp +pushl $.LC436 +movl 20(%ebp),%edi +pushl 8(%edi) +pushl $s.412 +call printf +addl $12,%esp +pushl $.LC437 +movl 20(%ebp),%edi +pushl 12(%edi) +pushl $s.412 +call printf +addl $12,%esp +pushl $.LC438 +movl 20(%ebp),%edi +pushl 16(%edi) +pushl $s.412 +call printf +addl $12,%esp +pushl $.LC439 +movl 20(%ebp),%edi +pushl 20(%edi) +pushl $s.412 +call printf +addl $12,%esp +pushl $.LC440 +movl 20(%ebp),%edi +pushl 24(%edi) +pushl $s.412 +call printf +addl $12,%esp +pushl $.LC439 +movl 20(%ebp),%edi +flds 28(%edi) +subl $8,%esp +fstpl (%esp) +pushl $s2.413 +call printf +addl $16,%esp +pushl $.LC440 +movl 20(%ebp),%edi +flds 32(%edi) +subl $8,%esp +fstpl (%esp) +pushl $s2.413 +call printf +addl $16,%esp +.LC432: +mov $0,%eax +.LC410: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf441: +.size s26,.Lf441-s26 +.data +.align 1 +.type s4er.443,@object +s4er.443: +.byte 115 +.byte 52 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s4er.443,9 +.align 1 +.type qs4.444,@object +.size qs4.444,8 +qs4.444: +.byte 115 +.byte 52 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s4 +.text +.align 16 +.type s4,@function +s4: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $36,%esp +movl $0,-24(%ebp) +leal qs4.444,%edi +movl %edi,-16(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-20(%ebp) +.LC445: +.LC446: +movl -20(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-20(%ebp) +movl -16(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-16(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC445 +movl $0,-4(%ebp) +.LC448: +pushl -4(%ebp) +call svtest +addl $4,%esp +movl %eax,%edi +call zero +cmpl %eax,%edi +je .LC452 +movl $1,-24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC454 +pushl $1 +pushl $s4er.443 +call printf +addl $8,%esp +.LC454: +.LC452: +.LC449: +incl -4(%ebp) +cmpl $3,-4(%ebp) +jl .LC448 +call setev +call testev +cmpl $0,%eax +je .LC456 +addl $2,-24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC458 +pushl $2 +pushl $s4er.443 +call printf +addl $8,%esp +.LC458: +.LC456: +jmp .LC460 +addl $4,-24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC462 +pushl $4 +pushl $s4er.443 +call printf +addl $8,%esp +.LC462: +.LC460: +movl $0xffffffff,-8(%ebp) +movl $1,-12(%ebp) +movl $0,-4(%ebp) +jmp .LC467 +.LC464: +movl -8(%ebp),%edi +andl %edi,-12(%ebp) +shrl $1,%edi +movl %edi,-8(%ebp) +.LC465: +incl -4(%ebp) +.LC467: +movl -4(%ebp),%edi +movl 20(%ebp),%esi +movl (,%esi),%esi +leal (,%esi,4),%esi +cmpl %esi,%edi +jb .LC464 +movl -12(%ebp),%edi +cmpl $1,%edi +jne .LC470 +movl -8(%ebp),%edi +cmpl $0,%edi +je .LC468 +.LC470: +addl $8,-24(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC471 +pushl $8 +pushl $s4er.443 +call printf +addl $8,%esp +.LC471: +.LC468: +movl -24(%ebp),%eax +.LC442: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf473: +.size s4,.Lf473-s4 +.bss +.align 4 +.type k.475,@object +.size k.475,4 +.lcomm k.475,4 +.globl svtest +.text +.align 16 +.type svtest,@function +svtest: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl 20(%ebp),%edi +cmpl $0,%edi +je .LC478 +cmpl $1,%edi +je .LC479 +cmpl $2,%edi +je .LC482 +jmp .LC476 +.LC478: +movl $1978,k.475 +movl $0,-4(%ebp) +jmp .LC477 +.LC479: +cmpl $1978,k.475 +je .LC480 +movl $1,-4(%ebp) +jmp .LC477 +.LC480: +movl $1929,k.475 +movl $0,-4(%ebp) +jmp .LC477 +.LC482: +cmpl $1929,k.475 +je .LC483 +movl $1,-4(%ebp) +jmp .LC477 +.LC483: +movl $0,-4(%ebp) +.LC476: +.LC477: +movl -4(%ebp),%eax +.LC474: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf485: +.size svtest,.Lf485-svtest +.bss +.align 4 +.type k.487,@object +.size k.487,4 +.lcomm k.487,4 +.globl zero +.text +.align 16 +.type zero,@function +zero: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $2,k.487 +movl $0,-4(%ebp) +movl -4(%ebp),%eax +.LC486: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf488: +.size zero,.Lf488-zero +.globl testev +.align 16 +.type testev,@function +testev: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +cmpl $1066,extvar +je .LC490 +mov $1,%eax +jmp .LC489 +.LC490: +mov $0,%eax +.LC489: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf492: +.size testev,.Lf492-testev +.data +.align 1 +.type s61er.494,@object +s61er.494: +.byte 115 +.byte 54 +.byte 49 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s61er.494,10 +.align 1 +.type qs61.495,@object +.size qs61.495,8 +qs61.495: +.byte 115 +.byte 54 +.byte 49 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.align 1 +.type upper_alpha.496,@object +upper_alpha.496: +.byte 65 +.byte 66 +.byte 67 +.byte 68 +.byte 69 +.byte 70 +.byte 71 +.byte 72 +.byte 73 +.byte 74 +.byte 75 +.byte 76 +.byte 77 +.byte 78 +.byte 79 +.byte 80 +.byte 81 +.byte 82 +.byte 83 +.byte 84 +.byte 85 +.byte 86 +.byte 87 +.byte 88 +.byte 89 +.byte 90 +.byte 0 +.size upper_alpha.496,27 +.align 1 +.type lower_alpha.497,@object +lower_alpha.497: +.byte 97 +.byte 98 +.byte 99 +.byte 100 +.byte 101 +.byte 102 +.byte 103 +.byte 104 +.byte 105 +.byte 106 +.byte 107 +.byte 108 +.byte 109 +.byte 110 +.byte 111 +.byte 112 +.byte 113 +.byte 114 +.byte 115 +.byte 116 +.byte 117 +.byte 118 +.byte 119 +.byte 120 +.byte 121 +.byte 122 +.byte 0 +.size lower_alpha.497,27 +.align 1 +.type numbers.498,@object +numbers.498: +.byte 48 +.byte 49 +.byte 50 +.byte 51 +.byte 52 +.byte 53 +.byte 54 +.byte 55 +.byte 56 +.byte 57 +.byte 0 +.size numbers.498,11 +.align 1 +.type special_characters.499,@object +special_characters.499: +.byte 126 +.byte 33 +.byte 34 +.byte 35 +.byte 37 +.byte 38 +.byte 40 +.byte 41 +.byte 95 +.byte 61 +.byte 45 +.byte 94 +.byte 124 +.byte 123 +.byte 125 +.byte 91 +.byte 93 +.byte 43 +.byte 59 +.byte 42 +.byte 58 +.byte 60 +.byte 62 +.byte 44 +.byte 46 +.byte 63 +.byte 47 +.byte 0 +.size special_characters.499,28 +.align 1 +.type extra_special_characters.500,@object +extra_special_characters.500: +.byte 10 +.byte 9 +.byte 8 +.byte 13 +.byte 12 +.byte 92 +.byte 39 +.byte 0 +.size extra_special_characters.500,8 +.align 1 +.type blank_and_NUL.501,@object +blank_and_NUL.501: +.byte 32 +.byte 0 +.byte 0 +.size blank_and_NUL.501,3 +.globl s61 +.text +.align 16 +.type s61,@function +s61: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $64,%esp +leal qs61.495,%edi +movl %edi,-36(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-40(%ebp) +movl $0,-48(%ebp) +.LC502: +.LC503: +movl -40(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-40(%ebp) +movl -36(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-36(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC502 +movw $-19,-60(%ebp) +movswl -60(%ebp),%edi +movl %edi,-64(%ebp) +cmpl $-19,-64(%ebp) +je .LC505 +incl -48(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC507 +pushl $1 +pushl $s61er.494 +call printf +addl $8,%esp +.LC507: +.LC505: +leal upper_alpha.496,%edi +movl %edi,-28(%ebp) +leal lower_alpha.497,%edi +movl %edi,-24(%ebp) +leal numbers.498,%edi +movl %edi,-20(%ebp) +leal special_characters.499,%edi +movl %edi,-16(%ebp) +leal extra_special_characters.500,%edi +movl %edi,-12(%ebp) +leal blank_and_NUL.501,%edi +movl %edi,-8(%ebp) +movl $0,-32(%ebp) +movl $0,-4(%ebp) +jmp .LC519 +.LC518: +movl -4(%ebp),%edi +leal -28(%ebp),%esi +leal (%esi,%edi,4),%edi +movl (,%edi),%esi +leal 1(%esi),%ebx +movl %ebx,(,%edi) +movsbl (,%esi),%edi +cmpl $0,%edi +jge .LC521 +movl $1,-32(%ebp) +.LC521: +.LC519: +movl -4(%ebp),%edi +leal -28(%ebp),%esi +movl (%esi,%edi,4),%edi +movsbl (,%edi),%edi +cmpl $0,%edi +jne .LC518 +.LC515: +incl -4(%ebp) +cmpl $6,-4(%ebp) +jl .LC519 +cmpl $0,-32(%ebp) +je .LC523 +addl $2,-48(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC525 +pushl $2 +pushl $s61er.494 +call printf +addl $8,%esp +.LC525: +.LC523: +movl $1048579,-44(%ebp) +movl -44(%ebp),%edi +movl %edi,%esi +movw %si,-52(%ebp) +movl %edi,%ebx +movb %bl,-56(%ebp) +movswl -52(%ebp),%edi +cmpl -44(%ebp),%edi +je .LC530 +cmpl $3,%edi +jne .LC529 +.LC530: +movsbl -56(%ebp),%edi +cmpl -44(%ebp),%edi +je .LC527 +cmpl $3,%edi +je .LC527 +.LC529: +addl $8,-48(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC531 +pushl $8 +pushl $s61er.494 +call printf +addl $8,%esp +.LC531: +.LC527: +movl -48(%ebp),%eax +.LC493: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf533: +.size s61,.Lf533-s61 +.data +.align 1 +.type s626er.535,@object +s626er.535: +.byte 115 +.byte 54 +.byte 50 +.byte 54 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s626er.535,11 +.align 1 +.type qs626.536,@object +.size qs626.536,8 +qs626.536: +.byte 115 +.byte 54 +.byte 50 +.byte 54 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s626 +.text +.align 16 +.type s626,@function +s626: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $132,%esp +leal qs626.536,%edi +movl %edi,-56(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-60(%ebp) +movl $0,-108(%ebp) +.LC537: +.LC538: +movl -60(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-60(%ebp) +movl -56(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-56(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC537 +flds .LC420 +fstps -36(%ebp) +movl $1,-64(%ebp) +movl $1,-40(%ebp) +movl $0,-4(%ebp) +jmp .LC543 +.LC540: +flds .LC544 +fmuls -36(%ebp) +fstps -36(%ebp) +movl -40(%ebp),%edi +leal (,%edi,2),%edi +orl -64(%ebp),%edi +movl %edi,-40(%ebp) +.LC541: +incl -4(%ebp) +.LC543: +movl 20(%ebp),%edi +movl 12(%edi),%edi +subl $2,%edi +cmpl %edi,-4(%ebp) +jl .LC540 +fildl -40(%ebp) +fstps -116(%ebp) +flds -36(%ebp) +fsubs -116(%ebp) +fdivs -36(%ebp) +fstps -36(%ebp) +fldl .LC425 +movl 20(%ebp),%edi +fmuls 28(%edi) +fcomps -36(%ebp) +fstsw %ax +sahf +jp .LC545 +jae .LC545 +addl $2,-108(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC547 +pushl $2 +pushl $s626er.535 +call printf +addl $8,%esp +.LC547: +.LC545: +movb $125,-76(%ebp) +movw $125,-80(%ebp) +movl $125,-84(%ebp) +movl $15625,-100(%ebp) +movl $125,-88(%ebp) +movl $15625,-104(%ebp) +movl $125,-68(%ebp) +movl $15625,-112(%ebp) +flds .LC549 +fstps -72(%ebp) +fldl .LC550 +fstpl -96(%ebp) +fldl .LC551 +fstpl -52(%ebp) +movl $0,-4(%ebp) +.LC552: +movl -4(%ebp),%edi +leal -32(%ebp),%esi +movb $0,(%esi,%edi) +.LC553: +incl -4(%ebp) +cmpl $28,-4(%ebp) +jl .LC552 +movsbl -76(%ebp),%edi +movl %edi,%esi +imull %edi,%esi +cmpl -100(%ebp),%esi +je .LC556 +movb $1,-32(%ebp) +.LC556: +movswl -80(%ebp),%edi +movsbl -76(%ebp),%esi +imull %esi,%edi +cmpl -100(%ebp),%edi +je .LC558 +movb $1,-31(%ebp) +.LC558: +movswl -80(%ebp),%edi +movl %edi,%esi +imull %edi,%esi +cmpl -100(%ebp),%esi +je .LC561 +movb $1,-30(%ebp) +.LC561: +movl -84(%ebp),%edi +movsbl -76(%ebp),%esi +imull %esi,%edi +cmpl -100(%ebp),%edi +je .LC564 +movb $1,-29(%ebp) +.LC564: +movl -84(%ebp),%edi +movswl -80(%ebp),%esi +imull %esi,%edi +cmpl -100(%ebp),%edi +je .LC567 +movb $1,-28(%ebp) +.LC567: +movl -84(%ebp),%edi +movl %edi,%esi +imull %edi,%esi +cmpl -100(%ebp),%esi +je .LC570 +movb $1,-27(%ebp) +.LC570: +movl -88(%ebp),%eax +movsbl -76(%ebp),%edi +mull %edi +cmpl -104(%ebp),%eax +je .LC573 +movb $1,-26(%ebp) +.LC573: +movl -88(%ebp),%eax +movswl -80(%ebp),%edi +mull %edi +cmpl -104(%ebp),%eax +je .LC576 +movb $1,-25(%ebp) +.LC576: +movl -88(%ebp),%eax +movl -84(%ebp),%edi +mull %edi +cmpl -104(%ebp),%eax +je .LC579 +movb $1,-24(%ebp) +.LC579: +movl -88(%ebp),%edi +movl %edi,%eax +mull %edi +cmpl -104(%ebp),%eax +je .LC582 +movb $1,-23(%ebp) +.LC582: +movl -68(%ebp),%edi +movsbl -76(%ebp),%esi +imull %esi,%edi +cmpl -112(%ebp),%edi +je .LC585 +movb $1,-22(%ebp) +.LC585: +movl -68(%ebp),%edi +movswl -80(%ebp),%esi +imull %esi,%edi +cmpl -112(%ebp),%edi +je .LC588 +movb $1,-21(%ebp) +.LC588: +movl -68(%ebp),%edi +imull -84(%ebp),%edi +cmpl -112(%ebp),%edi +je .LC591 +movb $1,-20(%ebp) +.LC591: +movl -68(%ebp),%edi +movl %edi,%eax +mull -88(%ebp) +cmpl -104(%ebp),%eax +je .LC594 +movb $1,-19(%ebp) +.LC594: +movl -68(%ebp),%edi +movl %edi,%esi +imull %edi,%esi +cmpl -112(%ebp),%esi +je .LC597 +movb $1,-18(%ebp) +.LC597: +flds -72(%ebp) +movsbl -76(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC600 +1: +movb $1,-17(%ebp) +.LC600: +flds -72(%ebp) +movswl -80(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC603 +1: +movb $1,-16(%ebp) +.LC603: +flds -72(%ebp) +fildl -84(%ebp) +fmulp %st,%st(1) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC606 +1: +movb $1,-15(%ebp) +.LC606: +movl -88(%ebp),%edi +flds -72(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fmulp %st,%st(1) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC609 +1: +movb $1,-14(%ebp) +.LC609: +flds -72(%ebp) +fildl -68(%ebp) +fmulp %st,%st(1) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC613 +1: +movb $1,-13(%ebp) +.LC613: +flds -72(%ebp) +fmuls -72(%ebp) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC616 +1: +movb $1,-12(%ebp) +.LC616: +fldl -96(%ebp) +movsbl -76(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC619 +1: +movb $1,-11(%ebp) +.LC619: +fldl -96(%ebp) +movswl -80(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC622 +1: +movb $1,-10(%ebp) +.LC622: +fldl -96(%ebp) +fimull -84(%ebp) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC625 +1: +movb $1,-9(%ebp) +.LC625: +movl -88(%ebp),%edi +fldl -96(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fmulp %st,%st(1) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC628 +1: +movb $1,-8(%ebp) +.LC628: +fldl -96(%ebp) +fimull -68(%ebp) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC631 +1: +movb $1,-7(%ebp) +.LC631: +fldl -96(%ebp) +fmuls -72(%ebp) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC634 +1: +movb $1,-6(%ebp) +.LC634: +fldl -96(%ebp) +fmull -96(%ebp) +fldl -52(%ebp) +fcompp +fstsw %ax +sahf +jp 1f +je .LC637 +1: +movb $1,-5(%ebp) +.LC637: +movb $0,-44(%ebp) +movl $0,-4(%ebp) +.LC640: +movsbl -44(%ebp),%edi +movl -4(%ebp),%esi +leal -32(%ebp),%ebx +movsbl (%ebx,%esi),%esi +leal (%esi,%edi),%edi +movl %edi,%ebx +movb %bl,-44(%ebp) +.LC641: +incl -4(%ebp) +cmpl $28,-4(%ebp) +jl .LC640 +movsbl -44(%ebp),%edi +cmpl $0,%edi +je .LC644 +addl $4,-108(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC646 +pushl $4 +pushl $s626er.535 +call printf +addl $8,%esp +pushl $.LC648 +call printf +addl $4,%esp +movl $0,-4(%ebp) +.LC649: +movl -4(%ebp),%edi +leal -32(%ebp),%esi +movsbl (%esi,%edi),%edi +pushl %edi +pushl $.LC653 +call printf +addl $8,%esp +.LC650: +incl -4(%ebp) +cmpl $28,-4(%ebp) +jl .LC649 +pushl $.LC654 +call printf +addl $4,%esp +.LC646: +.LC644: +movl $32768,-68(%ebp) +movl -68(%ebp),%edi +cmpl $0x8000,%edi +jbe .LC655 +addl $8,-108(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC657 +pushl $8 +pushl $s626er.535 +call printf +addl $8,%esp +.LC657: +.LC655: +movl -108(%ebp),%eax +.LC534: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf659: +.size s626,.Lf659-s626 +.data +.align 1 +.type s71er.661,@object +s71er.661: +.byte 115 +.byte 55 +.byte 49 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s71er.661,10 +.align 1 +.type qs71.662,@object +.size qs71.662,8 +qs71.662: +.byte 115 +.byte 55 +.byte 49 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.align 1 +.type q.663,@object +.size q.663,1 +q.663: +.byte 113 +.globl s71 +.text +.align 16 +.type s71,@function +s71: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $68,%esp +leal qs71.662,%edi +movl %edi,-4(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-8(%ebp) +movl $0,-12(%ebp) +.LC664: +.LC665: +movl -8(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-8(%ebp) +movl -4(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-4(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC664 +movsbl .LC669,%edi +movsbl q.663,%esi +cmpl %esi,%edi +je .LC667 +incl -12(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC670 +pushl $1 +pushl $s71er.661 +call printf +addl $8,%esp +.LC670: +.LC667: +jmp .LC672 +addl $2,-12(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC674 +pushl $2 +pushl $s71er.661 +call printf +addl $8,%esp +.LC674: +.LC672: +movl $1942,-32(%ebp) +cmpl $1942,-32(%ebp) +jne .LC682 +movl -32(%ebp),%edi +cmpl %edi,-32(%ebp) +je .LC677 +.LC682: +addl $4,-12(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC683 +pushl $4 +pushl $s71er.661 +call printf +addl $8,%esp +.LC683: +.LC677: +pushl $-5 +call McCarthy +addl $4,%esp +cmpl $91,%eax +je .LC685 +addl $8,-12(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC687 +pushl $8 +pushl $s71er.661 +call printf +addl $8,%esp +.LC687: +.LC685: +movl $2,-56(%ebp) +movl $3,-60(%ebp) +leal -60(%ebp),%edi +movl %edi,-64(%ebp) +pushl -64(%ebp) +pushl -56(%ebp) +call clobber +addl $8,%esp +cmpl $2,-56(%ebp) +jne .LC691 +cmpl $2,-60(%ebp) +je .LC689 +.LC691: +addl $16,-12(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC692 +pushl $16 +pushl $s71er.661 +call printf +addl $8,%esp +.LC692: +.LC689: +movl 20(%ebp),%edi +flds 32(%edi) +fstps -68(%ebp) +flds -68(%ebp) +fcomps -68(%ebp) +fstsw %ax +sahf +jp 1f +je .LC694 +1: +addl $32,-12(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC696 +pushl $32 +pushl $s71er.661 +call printf +addl $8,%esp +.LC696: +.LC694: +movl -12(%ebp),%eax +.LC660: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf698: +.size s71,.Lf698-s71 +.globl McCarthy +.align 16 +.type McCarthy,@function +McCarthy: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +cmpl $100,20(%ebp) +jle .LC700 +movl 20(%ebp),%edi +movl %edi,%eax +subl $10,%eax +jmp .LC699 +.LC700: +movl 20(%ebp),%edi +leal 11(%edi),%edi +pushl %edi +call McCarthy +addl $4,%esp +movl %eax,%edi +pushl %edi +call McCarthy +addl $4,%esp +movl %eax,%edi +.LC699: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf702: +.size McCarthy,.Lf702-McCarthy +.globl clobber +.align 16 +.type clobber,@function +clobber: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl $3,20(%ebp) +movl 24(%ebp),%edi +movl $2,(,%edi) +mov $0,%eax +.LC703: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf704: +.size clobber,.Lf704-clobber +.data +.align 1 +.type f.706,@object +f.706: +.byte 76 +.byte 111 +.byte 99 +.byte 97 +.byte 108 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 37 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.size f.706,17 +.align 1 +.type s714er.707,@object +s714er.707: +.byte 115 +.byte 55 +.byte 49 +.byte 52 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s714er.707,11 +.align 1 +.type qs714.708,@object +.size qs714.708,8 +qs714.708: +.byte 115 +.byte 55 +.byte 49 +.byte 52 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s714 +.text +.align 16 +.type s714,@function +s714: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $256,%esp +leal qs714.708,%edi +movl %edi,-76(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%esi +movl %esi,-80(%ebp) +movl $0,-84(%ebp) +movl $0,-8(%ebp) +movl 48(%edi),%edi +movl %edi,-4(%ebp) +.LC709: +.LC710: +movl -80(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-80(%ebp) +movl -76(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-76(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC709 +movb $5,-12(%ebp) +movb $2,-32(%ebp) +movb -32(%ebp),%bl +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC712 +movl $1,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC714 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC714: +.LC712: +movb $5,-12(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC716 +movl $2,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC718 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC718: +.LC716: +movb $5,-12(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC720 +movl $3,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC722 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC722: +.LC720: +movb $5,-12(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC724 +movl $4,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC726 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC726: +.LC724: +movb $5,-12(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC728 +movl $5,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC730 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC730: +.LC728: +movb $5,-12(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC732 +movl $6,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC734 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC734: +.LC732: +movb $5,-12(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC736 +movl $7,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC738 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC738: +.LC736: +movw $5,-16(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC740 +movl $8,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC742 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC742: +.LC740: +movw $5,-16(%ebp) +movw $2,-36(%ebp) +movw -36(%ebp),%di +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC744 +movl $9,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC746 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC746: +.LC744: +movw $5,-16(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC748 +movl $10,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC750 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC750: +.LC748: +movw $5,-16(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC752 +movl $11,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC754 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC754: +.LC752: +movw $5,-16(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC756 +movl $12,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC758 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC758: +.LC756: +movw $5,-16(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC760 +movl $13,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC762 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC762: +.LC760: +movw $5,-16(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC764 +movl $14,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC766 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC766: +.LC764: +movl $5,-20(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC768 +movl $15,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC770 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC770: +.LC768: +movl $5,-20(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC772 +movl $16,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC774 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC774: +.LC772: +movl $5,-20(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC776 +movl $17,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC778 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC778: +.LC776: +movl $5,-20(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC780 +movl $18,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC782 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC782: +.LC780: +movl $5,-20(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC784 +movl $19,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC786 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC786: +.LC784: +movl $5,-20(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC788 +movl $20,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC790 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC790: +.LC788: +movl $5,-20(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC792 +movl $21,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC794 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC794: +.LC792: +movl $5,-24(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC796 +movl $22,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC798 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC798: +.LC796: +movl $5,-24(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC800 +movl $23,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC802 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC802: +.LC800: +movl $5,-24(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC804 +movl $24,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC806 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC806: +.LC804: +movl $5,-24(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC808 +movl $25,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC810 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC810: +.LC808: +movl $5,-24(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC812 +movl $26,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC814 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC814: +.LC812: +movl $5,-24(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC816 +movl $27,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC818 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC818: +.LC816: +movl $5,-24(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC820 +movl $28,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC822 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC822: +.LC820: +movl $5,-28(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC824 +movl $29,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC826 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC826: +.LC824: +movl $5,-28(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC828 +movl $30,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC830 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC830: +.LC828: +movl $5,-28(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC832 +movl $31,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC834 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC834: +.LC832: +movl $5,-28(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC836 +movl $32,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC838 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC838: +.LC836: +movl $5,-28(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC840 +movl $33,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC842 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC842: +.LC840: +movl $5,-28(%ebp) +flds .LC544 +fstps -64(%ebp) +flds .LC847 +fcomps -64(%ebp) +fstsw %ax +sahf +jp .LC845 +ja .LC845 +flds -64(%ebp) +fsubs .LC847 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-88(%ebp) +jmp .LC846 +.LC845: +flds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-88(%ebp) +.LC846: +movl -88(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC848 +movl $34,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC850 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC850: +.LC848: +movl $5,-28(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl .LC855 +fcompl -72(%ebp) +fstsw %ax +sahf +jp .LC853 +ja .LC853 +fldl -72(%ebp) +fsubl .LC855 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-100(%ebp) +jmp .LC854 +.LC853: +fldl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-100(%ebp) +.LC854: +movl -100(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC856 +movl $35,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC858 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC858: +.LC856: +flds .LC860 +fstps -52(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fstps -52(%ebp) +flds .LC544 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC861 +1: +movl $36,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC863 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC863: +.LC861: +flds .LC860 +fstps -52(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fstps -52(%ebp) +flds .LC544 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC865 +1: +movl $37,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC867 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC867: +.LC865: +flds .LC860 +fstps -52(%ebp) +movl $2,-40(%ebp) +fildl -40(%ebp) +fstps -52(%ebp) +flds .LC544 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC869 +1: +movl $38,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC871 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC871: +.LC869: +flds .LC860 +fstps -52(%ebp) +movl $2,-44(%ebp) +fildl -44(%ebp) +fstps -52(%ebp) +flds .LC544 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC873 +1: +movl $39,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC875 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC875: +.LC873: +flds .LC860 +fstps -52(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fstps -52(%ebp) +flds .LC544 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC877 +1: +movl $40,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC879 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC879: +.LC877: +flds .LC860 +fstps -52(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -64(%ebp) +fstps -52(%ebp) +flds .LC544 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC881 +1: +movl $41,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC883 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC883: +.LC881: +flds .LC860 +fstps -52(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +fstps -52(%ebp) +flds .LC544 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC885 +1: +movl $42,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC887 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC887: +.LC885: +fldl .LC889 +fstpl -60(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fstpl -60(%ebp) +fldl .LC425 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC890 +1: +movl $43,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC892 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC892: +.LC890: +fldl .LC889 +fstpl -60(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fstpl -60(%ebp) +fldl .LC425 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC894 +1: +movl $44,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC896 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC896: +.LC894: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-40(%ebp) +fildl -40(%ebp) +fstpl -60(%ebp) +fldl .LC425 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC898 +1: +movl $45,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC900 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC900: +.LC898: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-44(%ebp) +fildl -44(%ebp) +fstpl -60(%ebp) +fldl .LC425 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC902 +1: +movl $46,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC904 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC904: +.LC902: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fstpl -60(%ebp) +fldl .LC425 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC906 +1: +movl $47,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC908 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC908: +.LC906: +fldl .LC889 +fstpl -60(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -64(%ebp) +fstpl -60(%ebp) +fldl .LC425 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC910 +1: +movl $48,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC912 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC912: +.LC910: +fldl .LC889 +fstpl -60(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +fstpl -60(%ebp) +fldl .LC425 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC914 +1: +movl $49,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC916 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC916: +.LC914: +movb $5,-12(%ebp) +movb $2,-32(%ebp) +movsbl -12(%ebp),%edi +movsbl -32(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $7,%edi +je .LC918 +movl $50,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC920 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC920: +.LC918: +movb $5,-12(%ebp) +movw $2,-36(%ebp) +movsbl -12(%ebp),%edi +movswl -36(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $7,%edi +je .LC922 +movl $51,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC924 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC924: +.LC922: +movb $5,-12(%ebp) +movl $2,-40(%ebp) +movsbl -12(%ebp),%edi +movl -40(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $7,%edi +je .LC926 +movl $52,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC928 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC928: +.LC926: +movb $5,-12(%ebp) +movl $2,-44(%ebp) +movsbl -12(%ebp),%edi +movl -44(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $7,%edi +je .LC930 +movl $53,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC932 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC932: +.LC930: +movb $5,-12(%ebp) +movl $2,-48(%ebp) +movsbl -12(%ebp),%edi +movl -48(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $7,%edi +je .LC934 +movl $54,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC936 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC936: +.LC934: +movb $5,-12(%ebp) +flds .LC544 +fstps -64(%ebp) +movsbl -12(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fadds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $7,%edi +je .LC938 +movl $55,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC940 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC940: +.LC938: +movb $5,-12(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movsbl -12(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $7,%edi +je .LC942 +movl $56,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC944 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC944: +.LC942: +movw $5,-16(%ebp) +movb $2,-32(%ebp) +movswl -16(%ebp),%edi +movsbl -32(%ebp),%esi +leal (%esi,%edi),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $7,%edi +je .LC946 +movl $57,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC948 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC948: +.LC946: +movw $5,-16(%ebp) +movw $2,-36(%ebp) +movswl -16(%ebp),%edi +movswl -36(%ebp),%esi +leal (%esi,%edi),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $7,%edi +je .LC950 +movl $58,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC952 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC952: +.LC950: +movw $5,-16(%ebp) +movl $2,-40(%ebp) +movswl -16(%ebp),%edi +movl -40(%ebp),%esi +leal (%esi,%edi),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $7,%edi +je .LC954 +movl $59,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC956 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC956: +.LC954: +movw $5,-16(%ebp) +movl $2,-44(%ebp) +movswl -16(%ebp),%edi +movl -44(%ebp),%esi +leal (%esi,%edi),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $7,%edi +je .LC958 +movl $60,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC960 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC960: +.LC958: +movw $5,-16(%ebp) +movl $2,-48(%ebp) +movswl -16(%ebp),%edi +movl -48(%ebp),%esi +leal (%esi,%edi),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $7,%edi +je .LC962 +movl $61,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC964 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC964: +.LC962: +movw $5,-16(%ebp) +flds .LC544 +fstps -64(%ebp) +movswl -16(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fadds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $7,%edi +je .LC966 +movl $62,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC968 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC968: +.LC966: +movw $5,-16(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movswl -16(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $7,%edi +je .LC970 +movl $63,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC972 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC972: +.LC970: +movl $5,-20(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +addl %edi,-20(%ebp) +cmpl $7,-20(%ebp) +je .LC974 +movl $64,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC976 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC976: +.LC974: +movl $5,-20(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +addl %edi,-20(%ebp) +cmpl $7,-20(%ebp) +je .LC978 +movl $65,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC980 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC980: +.LC978: +movl $5,-20(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +addl %edi,-20(%ebp) +cmpl $7,-20(%ebp) +je .LC982 +movl $66,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC984 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC984: +.LC982: +movl $5,-20(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +addl %edi,-20(%ebp) +cmpl $7,-20(%ebp) +je .LC986 +movl $67,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC988 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC988: +.LC986: +movl $5,-20(%ebp) +movl $2,-48(%ebp) +movl -20(%ebp),%edi +movl -48(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,-20(%ebp) +cmpl $7,-20(%ebp) +je .LC990 +movl $68,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC992 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC992: +.LC990: +movl $5,-20(%ebp) +flds .LC544 +fstps -64(%ebp) +fildl -20(%ebp) +fadds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $7,-20(%ebp) +je .LC994 +movl $69,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC996 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC996: +.LC994: +movl $5,-20(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fildl -20(%ebp) +faddl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $7,-20(%ebp) +je .LC998 +movl $70,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1000 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1000: +.LC998: +movl $5,-24(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +addl %edi,-24(%ebp) +cmpl $7,-24(%ebp) +je .LC1002 +movl $71,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1004 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1004: +.LC1002: +movl $5,-24(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +addl %edi,-24(%ebp) +cmpl $7,-24(%ebp) +je .LC1006 +movl $72,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1008 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1008: +.LC1006: +movl $5,-24(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +addl %edi,-24(%ebp) +cmpl $7,-24(%ebp) +je .LC1010 +movl $73,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1012 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1012: +.LC1010: +movl $5,-24(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +addl %edi,-24(%ebp) +cmpl $7,-24(%ebp) +je .LC1014 +movl $74,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1016 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1016: +.LC1014: +movl $5,-24(%ebp) +movl $2,-48(%ebp) +movl -24(%ebp),%edi +movl -48(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,-24(%ebp) +cmpl $7,-24(%ebp) +je .LC1018 +movl $75,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1020 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1020: +.LC1018: +movl $5,-24(%ebp) +flds .LC544 +fstps -64(%ebp) +fildl -24(%ebp) +fadds -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $7,-24(%ebp) +je .LC1022 +movl $76,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1024 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1024: +.LC1022: +movl $5,-24(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fildl -24(%ebp) +faddl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $7,-24(%ebp) +je .LC1026 +movl $77,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1028 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1028: +.LC1026: +movl $5,-28(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +addl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $7,%edi +je .LC1030 +movl $78,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1032 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1032: +.LC1030: +movl $5,-28(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +addl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $7,%edi +je .LC1034 +movl $79,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1036 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1036: +.LC1034: +movl $5,-28(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +addl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $7,%edi +je .LC1038 +movl $80,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1040 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1040: +.LC1038: +movl $5,-28(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +addl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $7,%edi +je .LC1042 +movl $81,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1044 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1044: +.LC1042: +movl $5,-28(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +addl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $7,%edi +je .LC1046 +movl $82,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1048 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1048: +.LC1046: +movl $5,-28(%ebp) +flds .LC544 +fstps -64(%ebp) +movl -28(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fadds -64(%ebp) +fstps -136(%ebp) +flds .LC847 +fcomps -136(%ebp) +fstsw %ax +sahf +jp .LC1051 +ja .LC1051 +flds -136(%ebp) +fsubs .LC847 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-132(%ebp) +jmp .LC1052 +.LC1051: +flds -136(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-132(%ebp) +.LC1052: +movl -132(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $7,%edi +je .LC1053 +movl $83,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1055 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1055: +.LC1053: +movl $5,-28(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movl -28(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +faddl -72(%ebp) +fstpl -152(%ebp) +fldl .LC855 +fcompl -152(%ebp) +fstsw %ax +sahf +jp .LC1058 +ja .LC1058 +fldl -152(%ebp) +fsubl .LC855 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-144(%ebp) +jmp .LC1059 +.LC1058: +fldl -152(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-144(%ebp) +.LC1059: +movl -144(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $7,%edi +je .LC1060 +movl $84,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1062 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1062: +.LC1060: +flds .LC860 +fstps -52(%ebp) +movb $2,-32(%ebp) +flds -52(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fstps -52(%ebp) +flds .LC1066 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1064 +1: +movl $85,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1067 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1067: +.LC1064: +flds .LC860 +fstps -52(%ebp) +movw $2,-36(%ebp) +flds -52(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fstps -52(%ebp) +flds .LC1066 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1069 +1: +movl $86,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1071 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1071: +.LC1069: +flds .LC860 +fstps -52(%ebp) +movl $2,-40(%ebp) +flds -52(%ebp) +fildl -40(%ebp) +faddp %st,%st(1) +fstps -52(%ebp) +flds .LC1066 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1073 +1: +movl $87,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1075 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1075: +.LC1073: +flds .LC860 +fstps -52(%ebp) +movl $2,-44(%ebp) +flds -52(%ebp) +fildl -44(%ebp) +faddp %st,%st(1) +fstps -52(%ebp) +flds .LC1066 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1077 +1: +movl $88,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1079 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1079: +.LC1077: +flds .LC860 +fstps -52(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +flds -52(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +faddp %st,%st(1) +fstps -52(%ebp) +flds .LC1066 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1081 +1: +movl $89,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1083 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1083: +.LC1081: +flds .LC860 +fstps -52(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -52(%ebp) +fadds -64(%ebp) +fstps -52(%ebp) +flds .LC1066 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1085 +1: +movl $90,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1087 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1087: +.LC1085: +flds .LC860 +fstps -52(%ebp) +fldl .LC425 +fstpl -72(%ebp) +flds -52(%ebp) +faddl -72(%ebp) +fstps -52(%ebp) +flds .LC1066 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1089 +1: +movl $91,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1091 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1091: +.LC1089: +fldl .LC889 +fstpl -60(%ebp) +movb $2,-32(%ebp) +fldl -60(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1095 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1093 +1: +movl $92,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1096 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1096: +.LC1093: +fldl .LC889 +fstpl -60(%ebp) +movw $2,-36(%ebp) +fldl -60(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1095 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1098 +1: +movl $93,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1100 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1100: +.LC1098: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-40(%ebp) +fldl -60(%ebp) +fiaddl -40(%ebp) +fstpl -60(%ebp) +fldl .LC1095 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1102 +1: +movl $94,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1104 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1104: +.LC1102: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-44(%ebp) +fldl -60(%ebp) +fiaddl -44(%ebp) +fstpl -60(%ebp) +fldl .LC1095 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1106 +1: +movl $95,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1108 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1108: +.LC1106: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +fldl -60(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +faddp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1095 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1110 +1: +movl $96,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1112 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1112: +.LC1110: +fldl .LC889 +fstpl -60(%ebp) +flds .LC544 +fstps -64(%ebp) +fldl -60(%ebp) +fadds -64(%ebp) +fstpl -60(%ebp) +fldl .LC1095 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1114 +1: +movl $97,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1116 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1116: +.LC1114: +fldl .LC889 +fstpl -60(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -60(%ebp) +faddl -72(%ebp) +fstpl -60(%ebp) +fldl .LC1095 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1118 +1: +movl $98,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1120 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1120: +.LC1118: +movb $5,-12(%ebp) +movb $2,-32(%ebp) +movsbl -12(%ebp),%edi +movsbl -32(%ebp),%esi +subl %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $3,%edi +je .LC1122 +movl $99,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1124 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1124: +.LC1122: +movb $5,-12(%ebp) +movw $2,-36(%ebp) +movsbl -12(%ebp),%edi +movswl -36(%ebp),%esi +subl %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $3,%edi +je .LC1126 +movl $100,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1128 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1128: +.LC1126: +movb $5,-12(%ebp) +movl $2,-40(%ebp) +movsbl -12(%ebp),%edi +subl -40(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $3,%edi +je .LC1130 +movl $101,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1132 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1132: +.LC1130: +movb $5,-12(%ebp) +movl $2,-44(%ebp) +movsbl -12(%ebp),%edi +subl -44(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $3,%edi +je .LC1134 +movl $102,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1136 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1136: +.LC1134: +movb $5,-12(%ebp) +movl $2,-48(%ebp) +movsbl -12(%ebp),%edi +subl -48(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $3,%edi +je .LC1138 +movl $103,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1140 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1140: +.LC1138: +movb $5,-12(%ebp) +flds .LC544 +fstps -64(%ebp) +movsbl -12(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fsubs -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $3,%edi +je .LC1142 +movl $104,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1144 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1144: +.LC1142: +movb $5,-12(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movsbl -12(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fsubl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $3,%edi +je .LC1146 +movl $105,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1148 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1148: +.LC1146: +movw $5,-16(%ebp) +movb $2,-32(%ebp) +movswl -16(%ebp),%edi +movsbl -32(%ebp),%esi +subl %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $3,%edi +je .LC1150 +movl $106,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1152 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1152: +.LC1150: +movw $5,-16(%ebp) +movw $2,-36(%ebp) +movswl -16(%ebp),%edi +movswl -36(%ebp),%esi +subl %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $3,%edi +je .LC1154 +movl $107,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1156 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1156: +.LC1154: +movw $5,-16(%ebp) +movl $2,-40(%ebp) +movswl -16(%ebp),%edi +subl -40(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $3,%edi +je .LC1158 +movl $108,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1160 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1160: +.LC1158: +movw $5,-16(%ebp) +movl $2,-44(%ebp) +movswl -16(%ebp),%edi +subl -44(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $3,%edi +je .LC1162 +movl $109,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1164 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1164: +.LC1162: +movw $5,-16(%ebp) +movl $2,-48(%ebp) +movswl -16(%ebp),%edi +subl -48(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $3,%edi +je .LC1166 +movl $110,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1168 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1168: +.LC1166: +movw $5,-16(%ebp) +flds .LC544 +fstps -64(%ebp) +movswl -16(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fsubs -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $3,%edi +je .LC1170 +movl $111,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1172 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1172: +.LC1170: +movw $5,-16(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movswl -16(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fsubl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $3,%edi +je .LC1174 +movl $112,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1176 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1176: +.LC1174: +movl $5,-20(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +subl %edi,-20(%ebp) +cmpl $3,-20(%ebp) +je .LC1178 +movl $113,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1180 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1180: +.LC1178: +movl $5,-20(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +subl %edi,-20(%ebp) +cmpl $3,-20(%ebp) +je .LC1182 +movl $114,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1184 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1184: +.LC1182: +movl $5,-20(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +subl %edi,-20(%ebp) +cmpl $3,-20(%ebp) +je .LC1186 +movl $115,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1188 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1188: +.LC1186: +movl $5,-20(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +subl %edi,-20(%ebp) +cmpl $3,-20(%ebp) +je .LC1190 +movl $116,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1192 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1192: +.LC1190: +movl $5,-20(%ebp) +movl $2,-48(%ebp) +movl -20(%ebp),%edi +subl -48(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $3,-20(%ebp) +je .LC1194 +movl $117,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1196 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1196: +.LC1194: +movl $5,-20(%ebp) +flds .LC544 +fstps -64(%ebp) +fildl -20(%ebp) +fsubs -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $3,-20(%ebp) +je .LC1198 +movl $118,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1200 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1200: +.LC1198: +movl $5,-20(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +fisubrl -20(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $3,-20(%ebp) +je .LC1202 +movl $119,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1204 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1204: +.LC1202: +movl $5,-24(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +subl %edi,-24(%ebp) +cmpl $3,-24(%ebp) +je .LC1206 +movl $120,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1208 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1208: +.LC1206: +movl $5,-24(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +subl %edi,-24(%ebp) +cmpl $3,-24(%ebp) +je .LC1210 +movl $121,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1212 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1212: +.LC1210: +movl $5,-24(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +subl %edi,-24(%ebp) +cmpl $3,-24(%ebp) +je .LC1214 +movl $122,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1216 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1216: +.LC1214: +movl $5,-24(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +subl %edi,-24(%ebp) +cmpl $3,-24(%ebp) +je .LC1218 +movl $123,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1220 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1220: +.LC1218: +movl $5,-24(%ebp) +movl $2,-48(%ebp) +movl -24(%ebp),%edi +subl -48(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $3,-24(%ebp) +je .LC1222 +movl $124,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1224 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1224: +.LC1222: +movl $5,-24(%ebp) +flds .LC544 +fstps -64(%ebp) +fildl -24(%ebp) +fsubs -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $3,-24(%ebp) +je .LC1226 +movl $125,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1228 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1228: +.LC1226: +movl $5,-24(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +fisubrl -24(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $3,-24(%ebp) +je .LC1230 +movl $126,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1232 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1232: +.LC1230: +movl $5,-28(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%edi +subl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $3,%edi +je .LC1234 +movl $127,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1236 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1236: +.LC1234: +movl $5,-28(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%edi +subl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $3,%edi +je .LC1238 +movl $128,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1240 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1240: +.LC1238: +movl $5,-28(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%edi +subl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $3,%edi +je .LC1242 +movl $129,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1244 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1244: +.LC1242: +movl $5,-28(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%edi +subl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $3,%edi +je .LC1246 +movl $130,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1248 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1248: +.LC1246: +movl $5,-28(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +subl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $3,%edi +je .LC1250 +movl $131,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1252 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1252: +.LC1250: +movl $5,-28(%ebp) +flds .LC544 +fstps -64(%ebp) +movl -28(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fsubs -64(%ebp) +fstps -168(%ebp) +flds .LC847 +fcomps -168(%ebp) +fstsw %ax +sahf +jp .LC1255 +ja .LC1255 +flds -168(%ebp) +fsubs .LC847 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-164(%ebp) +jmp .LC1256 +.LC1255: +flds -168(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-164(%ebp) +.LC1256: +movl -164(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $3,%edi +je .LC1257 +movl $132,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1259 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1259: +.LC1257: +movl $5,-28(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movl -28(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fsubl -72(%ebp) +fstpl -184(%ebp) +fldl .LC855 +fcompl -184(%ebp) +fstsw %ax +sahf +jp .LC1262 +ja .LC1262 +fldl -184(%ebp) +fsubl .LC855 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-176(%ebp) +jmp .LC1263 +.LC1262: +fldl -184(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-176(%ebp) +.LC1263: +movl -176(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $3,%edi +je .LC1264 +movl $133,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1266 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1266: +.LC1264: +flds .LC860 +fstps -52(%ebp) +movb $2,-32(%ebp) +flds -52(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fsubrp %st,%st(1) +fstps -52(%ebp) +flds .LC1270 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1268 +1: +movl $134,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1271 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1271: +.LC1268: +flds .LC860 +fstps -52(%ebp) +movw $2,-36(%ebp) +flds -52(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fsubrp %st,%st(1) +fstps -52(%ebp) +flds .LC1270 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1273 +1: +movl $135,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1275 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1275: +.LC1273: +flds .LC860 +fstps -52(%ebp) +movl $2,-40(%ebp) +flds -52(%ebp) +fildl -40(%ebp) +fsubrp %st,%st(1) +fstps -52(%ebp) +flds .LC1270 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1277 +1: +movl $136,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1279 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1279: +.LC1277: +flds .LC860 +fstps -52(%ebp) +movl $2,-44(%ebp) +flds -52(%ebp) +fildl -44(%ebp) +fsubrp %st,%st(1) +fstps -52(%ebp) +flds .LC1270 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1281 +1: +movl $137,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1283 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1283: +.LC1281: +flds .LC860 +fstps -52(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +flds -52(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fsubrp %st,%st(1) +fstps -52(%ebp) +flds .LC1270 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1285 +1: +movl $138,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1287 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1287: +.LC1285: +flds .LC860 +fstps -52(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -52(%ebp) +fsubs -64(%ebp) +fstps -52(%ebp) +flds .LC1270 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1289 +1: +movl $139,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1291 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1291: +.LC1289: +flds .LC860 +fstps -52(%ebp) +fldl .LC425 +fstpl -72(%ebp) +flds -52(%ebp) +fsubl -72(%ebp) +fstps -52(%ebp) +flds .LC1270 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1293 +1: +movl $140,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1295 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1295: +.LC1293: +fldl .LC889 +fstpl -60(%ebp) +movb $2,-32(%ebp) +fldl -60(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fsubrp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1299 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1297 +1: +movl $141,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1300 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1300: +.LC1297: +fldl .LC889 +fstpl -60(%ebp) +movw $2,-36(%ebp) +fldl -60(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fsubrp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1299 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1302 +1: +movl $142,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1304 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1304: +.LC1302: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-40(%ebp) +fldl -60(%ebp) +fisubl -40(%ebp) +fstpl -60(%ebp) +fldl .LC1299 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1306 +1: +movl $143,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1308 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1308: +.LC1306: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-44(%ebp) +fldl -60(%ebp) +fisubl -44(%ebp) +fstpl -60(%ebp) +fldl .LC1299 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1310 +1: +movl $144,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1312 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1312: +.LC1310: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +fldl -60(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fsubrp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1299 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1314 +1: +movl $145,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1316 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1316: +.LC1314: +fldl .LC889 +fstpl -60(%ebp) +flds .LC544 +fstps -64(%ebp) +fldl -60(%ebp) +fsubs -64(%ebp) +fstpl -60(%ebp) +fldl .LC1299 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1318 +1: +movl $146,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1320 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1320: +.LC1318: +fldl .LC889 +fstpl -60(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -60(%ebp) +fsubl -72(%ebp) +fstpl -60(%ebp) +fldl .LC1299 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1322 +1: +movl $147,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1324 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1324: +.LC1322: +movb $5,-12(%ebp) +movb $2,-32(%ebp) +movsbl -12(%ebp),%edi +movsbl -32(%ebp),%esi +imull %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $10,%edi +je .LC1326 +movl $148,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1328 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1328: +.LC1326: +movb $5,-12(%ebp) +movw $2,-36(%ebp) +movsbl -12(%ebp),%edi +movswl -36(%ebp),%esi +imull %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $10,%edi +je .LC1330 +movl $149,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1332 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1332: +.LC1330: +movb $5,-12(%ebp) +movl $2,-40(%ebp) +movsbl -12(%ebp),%edi +imull -40(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $10,%edi +je .LC1334 +movl $150,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1336 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1336: +.LC1334: +movb $5,-12(%ebp) +movl $2,-44(%ebp) +movsbl -12(%ebp),%edi +imull -44(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $10,%edi +je .LC1338 +movl $151,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1340 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1340: +.LC1338: +movb $5,-12(%ebp) +movl $2,-48(%ebp) +movsbl -12(%ebp),%edi +movl %edi,%eax +mull -48(%ebp) +movl %eax,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $10,%edi +je .LC1342 +movl $152,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1344 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1344: +.LC1342: +movb $5,-12(%ebp) +flds .LC544 +fstps -64(%ebp) +movsbl -12(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmuls -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $10,%edi +je .LC1346 +movl $153,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1348 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1348: +.LC1346: +movb $5,-12(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movsbl -12(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmull -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $10,%edi +je .LC1350 +movl $154,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1352 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1352: +.LC1350: +movw $5,-16(%ebp) +movb $2,-32(%ebp) +movswl -16(%ebp),%edi +movsbl -32(%ebp),%esi +imull %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $10,%edi +je .LC1354 +movl $155,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1356 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1356: +.LC1354: +movw $5,-16(%ebp) +movw $2,-36(%ebp) +movswl -16(%ebp),%edi +movswl -36(%ebp),%esi +imull %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $10,%edi +je .LC1358 +movl $156,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1360 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1360: +.LC1358: +movw $5,-16(%ebp) +movl $2,-40(%ebp) +movswl -16(%ebp),%edi +imull -40(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $10,%edi +je .LC1362 +movl $157,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1364 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1364: +.LC1362: +movw $5,-16(%ebp) +movl $2,-44(%ebp) +movswl -16(%ebp),%edi +imull -44(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $10,%edi +je .LC1366 +movl $158,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1368 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1368: +.LC1366: +movw $5,-16(%ebp) +movl $2,-48(%ebp) +movswl -16(%ebp),%edi +movl %edi,%eax +mull -48(%ebp) +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $10,%edi +je .LC1370 +movl $159,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1372 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1372: +.LC1370: +movw $5,-16(%ebp) +flds .LC544 +fstps -64(%ebp) +movswl -16(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmuls -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $10,%edi +je .LC1374 +movl $160,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1376 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1376: +.LC1374: +movw $5,-16(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movswl -16(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmull -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $10,%edi +je .LC1378 +movl $161,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1380 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1380: +.LC1378: +movl $5,-20(%ebp) +movb $2,-32(%ebp) +movl -20(%ebp),%edi +movsbl -32(%ebp),%esi +imull %esi,%edi +movl %edi,-20(%ebp) +cmpl $10,-20(%ebp) +je .LC1382 +movl $162,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1384 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1384: +.LC1382: +movl $5,-20(%ebp) +movw $2,-36(%ebp) +movl -20(%ebp),%edi +movswl -36(%ebp),%esi +imull %esi,%edi +movl %edi,-20(%ebp) +cmpl $10,-20(%ebp) +je .LC1386 +movl $163,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1388 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1388: +.LC1386: +movl $5,-20(%ebp) +movl $2,-40(%ebp) +movl -20(%ebp),%edi +imull -40(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $10,-20(%ebp) +je .LC1390 +movl $164,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1392 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1392: +.LC1390: +movl $5,-20(%ebp) +movl $2,-44(%ebp) +movl -20(%ebp),%edi +imull -44(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $10,-20(%ebp) +je .LC1394 +movl $165,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1396 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1396: +.LC1394: +movl $5,-20(%ebp) +movl $2,-48(%ebp) +movl -20(%ebp),%edi +movl %edi,%eax +mull -48(%ebp) +movl %eax,%edi +movl %edi,-20(%ebp) +cmpl $10,-20(%ebp) +je .LC1398 +movl $166,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1400 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1400: +.LC1398: +movl $5,-20(%ebp) +flds .LC544 +fstps -64(%ebp) +fildl -20(%ebp) +fmuls -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $10,-20(%ebp) +je .LC1402 +movl $167,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1404 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1404: +.LC1402: +movl $5,-20(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fildl -20(%ebp) +fmull -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $10,-20(%ebp) +je .LC1406 +movl $168,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1408 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1408: +.LC1406: +movl $5,-24(%ebp) +movb $2,-32(%ebp) +movl -24(%ebp),%edi +movsbl -32(%ebp),%esi +imull %esi,%edi +movl %edi,-24(%ebp) +cmpl $10,-24(%ebp) +je .LC1410 +movl $169,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1412 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1412: +.LC1410: +movl $5,-24(%ebp) +movw $2,-36(%ebp) +movl -24(%ebp),%edi +movswl -36(%ebp),%esi +imull %esi,%edi +movl %edi,-24(%ebp) +cmpl $10,-24(%ebp) +je .LC1414 +movl $170,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1416 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1416: +.LC1414: +movl $5,-24(%ebp) +movl $2,-40(%ebp) +movl -24(%ebp),%edi +imull -40(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $10,-24(%ebp) +je .LC1418 +movl $171,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1420 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1420: +.LC1418: +movl $5,-24(%ebp) +movl $2,-44(%ebp) +movl -24(%ebp),%edi +imull -44(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $10,-24(%ebp) +je .LC1422 +movl $172,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1424 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1424: +.LC1422: +movl $5,-24(%ebp) +movl $2,-48(%ebp) +movl -24(%ebp),%edi +movl %edi,%eax +mull -48(%ebp) +movl %eax,%edi +movl %edi,-24(%ebp) +cmpl $10,-24(%ebp) +je .LC1426 +movl $173,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1428 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1428: +.LC1426: +movl $5,-24(%ebp) +flds .LC544 +fstps -64(%ebp) +fildl -24(%ebp) +fmuls -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $10,-24(%ebp) +je .LC1430 +movl $174,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1432 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1432: +.LC1430: +movl $5,-24(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fildl -24(%ebp) +fmull -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $10,-24(%ebp) +je .LC1434 +movl $175,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1436 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1436: +.LC1434: +movl $5,-28(%ebp) +movb $2,-32(%ebp) +movl -28(%ebp),%eax +movsbl -32(%ebp),%edi +mull %edi +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $10,%edi +je .LC1438 +movl $176,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1440 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1440: +.LC1438: +movl $5,-28(%ebp) +movw $2,-36(%ebp) +movl -28(%ebp),%eax +movswl -36(%ebp),%edi +mull %edi +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $10,%edi +je .LC1442 +movl $177,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1444 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1444: +.LC1442: +movl $5,-28(%ebp) +movl $2,-40(%ebp) +movl -28(%ebp),%eax +movl -40(%ebp),%edi +mull %edi +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $10,%edi +je .LC1446 +movl $178,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1448 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1448: +.LC1446: +movl $5,-28(%ebp) +movl $2,-44(%ebp) +movl -28(%ebp),%eax +movl -44(%ebp),%edi +mull %edi +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $10,%edi +je .LC1450 +movl $179,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1452 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1452: +.LC1450: +movl $5,-28(%ebp) +movl $2,-48(%ebp) +movl -28(%ebp),%eax +mull -48(%ebp) +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $10,%edi +je .LC1454 +movl $180,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1456 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1456: +.LC1454: +movl $5,-28(%ebp) +flds .LC544 +fstps -64(%ebp) +movl -28(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fmuls -64(%ebp) +fstps -200(%ebp) +flds .LC847 +fcomps -200(%ebp) +fstsw %ax +sahf +jp .LC1459 +ja .LC1459 +flds -200(%ebp) +fsubs .LC847 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-196(%ebp) +jmp .LC1460 +.LC1459: +flds -200(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-196(%ebp) +.LC1460: +movl -196(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $10,%edi +je .LC1461 +movl $181,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1463 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1463: +.LC1461: +movl $5,-28(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movl -28(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fmull -72(%ebp) +fstpl -216(%ebp) +fldl .LC855 +fcompl -216(%ebp) +fstsw %ax +sahf +jp .LC1466 +ja .LC1466 +fldl -216(%ebp) +fsubl .LC855 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-208(%ebp) +jmp .LC1467 +.LC1466: +fldl -216(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-208(%ebp) +.LC1467: +movl -208(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $10,%edi +je .LC1468 +movl $182,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1470 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1470: +.LC1468: +flds .LC860 +fstps -52(%ebp) +movb $2,-32(%ebp) +flds -52(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +fstps -52(%ebp) +flds .LC1474 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1472 +1: +movl $183,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1475 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1475: +.LC1472: +flds .LC860 +fstps -52(%ebp) +movw $2,-36(%ebp) +flds -52(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +fstps -52(%ebp) +flds .LC1474 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1477 +1: +movl $184,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1479 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1479: +.LC1477: +flds .LC860 +fstps -52(%ebp) +movl $2,-40(%ebp) +flds -52(%ebp) +fildl -40(%ebp) +fmulp %st,%st(1) +fstps -52(%ebp) +flds .LC1474 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1481 +1: +movl $185,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1483 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1483: +.LC1481: +flds .LC860 +fstps -52(%ebp) +movl $2,-44(%ebp) +flds -52(%ebp) +fildl -44(%ebp) +fmulp %st,%st(1) +fstps -52(%ebp) +flds .LC1474 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1485 +1: +movl $186,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1487 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1487: +.LC1485: +flds .LC860 +fstps -52(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +flds -52(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fmulp %st,%st(1) +fstps -52(%ebp) +flds .LC1474 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1489 +1: +movl $187,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1491 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1491: +.LC1489: +flds .LC860 +fstps -52(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -52(%ebp) +fmuls -64(%ebp) +fstps -52(%ebp) +flds .LC1474 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1493 +1: +movl $188,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1495 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1495: +.LC1493: +flds .LC860 +fstps -52(%ebp) +fldl .LC425 +fstpl -72(%ebp) +flds -52(%ebp) +fmull -72(%ebp) +fstps -52(%ebp) +flds .LC1474 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1497 +1: +movl $189,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1499 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1499: +.LC1497: +fldl .LC889 +fstpl -60(%ebp) +movb $2,-32(%ebp) +fldl -60(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1503 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1501 +1: +movl $190,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1504 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1504: +.LC1501: +fldl .LC889 +fstpl -60(%ebp) +movw $2,-36(%ebp) +fldl -60(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1503 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1506 +1: +movl $191,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1508 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1508: +.LC1506: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-40(%ebp) +fldl -60(%ebp) +fimull -40(%ebp) +fstpl -60(%ebp) +fldl .LC1503 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1510 +1: +movl $192,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1512 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1512: +.LC1510: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-44(%ebp) +fldl -60(%ebp) +fimull -44(%ebp) +fstpl -60(%ebp) +fldl .LC1503 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1514 +1: +movl $193,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1516 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1516: +.LC1514: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +fldl -60(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fmulp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1503 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1518 +1: +movl $194,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1520 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1520: +.LC1518: +fldl .LC889 +fstpl -60(%ebp) +flds .LC544 +fstps -64(%ebp) +fldl -60(%ebp) +fmuls -64(%ebp) +fstpl -60(%ebp) +fldl .LC1503 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1522 +1: +movl $195,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1524 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1524: +.LC1522: +fldl .LC889 +fstpl -60(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -60(%ebp) +fmull -72(%ebp) +fstpl -60(%ebp) +fldl .LC1503 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1526 +1: +movl $196,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1528 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1528: +.LC1526: +movb $5,-12(%ebp) +movb $2,-32(%ebp) +movsbl -12(%ebp),%eax +movsbl -32(%ebp),%ecx +cdq +idivl %ecx +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC1530 +movl $197,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1532 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1532: +.LC1530: +movb $5,-12(%ebp) +movw $2,-36(%ebp) +movsbl -12(%ebp),%eax +movswl -36(%ebp),%ecx +cdq +idivl %ecx +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC1534 +movl $198,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1536 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1536: +.LC1534: +movb $5,-12(%ebp) +movl $2,-40(%ebp) +movsbl -12(%ebp),%eax +movl -40(%ebp),%ecx +cdq +idivl %ecx +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC1538 +movl $199,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1540 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1540: +.LC1538: +movb $5,-12(%ebp) +movl $2,-44(%ebp) +movsbl -12(%ebp),%eax +movl -44(%ebp),%ecx +cdq +idivl %ecx +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC1542 +movl $200,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1544 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1544: +.LC1542: +movb $5,-12(%ebp) +movl $2,-48(%ebp) +movsbl -12(%ebp),%edi +movl %edi,%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %eax,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC1546 +movl $201,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1548 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1548: +.LC1546: +movb $5,-12(%ebp) +flds .LC544 +fstps -64(%ebp) +movsbl -12(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivs -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC1550 +movl $202,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1552 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1552: +.LC1550: +movb $5,-12(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movsbl -12(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $2,%edi +je .LC1554 +movl $203,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1556 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1556: +.LC1554: +movw $5,-16(%ebp) +movb $2,-32(%ebp) +movswl -16(%ebp),%eax +movsbl -32(%ebp),%ecx +cdq +idivl %ecx +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC1558 +movl $204,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1560 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1560: +.LC1558: +movw $5,-16(%ebp) +movw $2,-36(%ebp) +movswl -16(%ebp),%eax +movswl -36(%ebp),%ecx +cdq +idivl %ecx +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC1562 +movl $205,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1564 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1564: +.LC1562: +movw $5,-16(%ebp) +movl $2,-40(%ebp) +movswl -16(%ebp),%eax +movl -40(%ebp),%ecx +cdq +idivl %ecx +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC1566 +movl $206,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1568 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1568: +.LC1566: +movw $5,-16(%ebp) +movl $2,-44(%ebp) +movswl -16(%ebp),%eax +movl -44(%ebp),%ecx +cdq +idivl %ecx +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC1570 +movl $207,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1572 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1572: +.LC1570: +movw $5,-16(%ebp) +movl $2,-48(%ebp) +movswl -16(%ebp),%edi +movl %edi,%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC1574 +movl $208,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1576 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1576: +.LC1574: +movw $5,-16(%ebp) +flds .LC544 +fstps -64(%ebp) +movswl -16(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivs -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC1578 +movl $209,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1580 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1580: +.LC1578: +movw $5,-16(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movswl -16(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivl -72(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $2,%edi +je .LC1582 +movl $210,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1584 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1584: +.LC1582: +movl $5,-20(%ebp) +movb $2,-32(%ebp) +movl -20(%ebp),%eax +movsbl -32(%ebp),%ecx +cdq +idivl %ecx +movl %eax,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC1586 +movl $211,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1588 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1588: +.LC1586: +movl $5,-20(%ebp) +movw $2,-36(%ebp) +movl -20(%ebp),%eax +movswl -36(%ebp),%ecx +cdq +idivl %ecx +movl %eax,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC1590 +movl $212,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1592 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1592: +.LC1590: +movl $5,-20(%ebp) +movl $2,-40(%ebp) +movl -20(%ebp),%eax +movl -40(%ebp),%ecx +cdq +idivl %ecx +movl %eax,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC1594 +movl $213,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1596 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1596: +.LC1594: +movl $5,-20(%ebp) +movl $2,-44(%ebp) +movl -20(%ebp),%eax +movl -44(%ebp),%ecx +cdq +idivl %ecx +movl %eax,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC1598 +movl $214,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1600 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1600: +.LC1598: +movl $5,-20(%ebp) +movl $2,-48(%ebp) +movl -20(%ebp),%edi +movl %edi,%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %eax,%edi +movl %edi,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC1602 +movl $215,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1604 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1604: +.LC1602: +movl $5,-20(%ebp) +flds .LC544 +fstps -64(%ebp) +fildl -20(%ebp) +fdivs -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC1606 +movl $216,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1608 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1608: +.LC1606: +movl $5,-20(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +fidivrl -20(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-20(%ebp) +cmpl $2,-20(%ebp) +je .LC1610 +movl $217,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1612 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1612: +.LC1610: +movl $5,-24(%ebp) +movb $2,-32(%ebp) +movl -24(%ebp),%eax +movsbl -32(%ebp),%ecx +cdq +idivl %ecx +movl %eax,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC1614 +movl $218,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1616 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1616: +.LC1614: +movl $5,-24(%ebp) +movw $2,-36(%ebp) +movl -24(%ebp),%eax +movswl -36(%ebp),%ecx +cdq +idivl %ecx +movl %eax,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC1618 +movl $219,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1620 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1620: +.LC1618: +movl $5,-24(%ebp) +movl $2,-40(%ebp) +movl -24(%ebp),%eax +movl -40(%ebp),%ecx +cdq +idivl %ecx +movl %eax,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC1622 +movl $220,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1624 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1624: +.LC1622: +movl $5,-24(%ebp) +movl $2,-44(%ebp) +movl -24(%ebp),%eax +movl -44(%ebp),%ecx +cdq +idivl %ecx +movl %eax,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC1626 +movl $221,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1628 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1628: +.LC1626: +movl $5,-24(%ebp) +movl $2,-48(%ebp) +movl -24(%ebp),%edi +movl %edi,%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %eax,%edi +movl %edi,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC1630 +movl $222,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1632 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1632: +.LC1630: +movl $5,-24(%ebp) +flds .LC544 +fstps -64(%ebp) +fildl -24(%ebp) +fdivs -64(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC1634 +movl $223,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1636 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1636: +.LC1634: +movl $5,-24(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -72(%ebp) +fidivrl -24(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-24(%ebp) +cmpl $2,-24(%ebp) +je .LC1638 +movl $224,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1640 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1640: +.LC1638: +movl $5,-28(%ebp) +movb $2,-32(%ebp) +movl -28(%ebp),%eax +movsbl -32(%ebp),%edi +movl %edi,%ecx +xorl %edx,%edx +divl %ecx +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC1642 +movl $225,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1644 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1644: +.LC1642: +movl $5,-28(%ebp) +movw $2,-36(%ebp) +movl -28(%ebp),%eax +movswl -36(%ebp),%edi +movl %edi,%ecx +xorl %edx,%edx +divl %ecx +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC1646 +movl $226,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1648 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1648: +.LC1646: +movl $5,-28(%ebp) +movl $2,-40(%ebp) +movl -28(%ebp),%eax +movl -40(%ebp),%edi +movl %edi,%ecx +xorl %edx,%edx +divl %ecx +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC1650 +movl $227,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1652 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1652: +.LC1650: +movl $5,-28(%ebp) +movl $2,-44(%ebp) +movl -28(%ebp),%eax +movl -44(%ebp),%edi +movl %edi,%ecx +xorl %edx,%edx +divl %ecx +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC1654 +movl $228,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1656 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1656: +.LC1654: +movl $5,-28(%ebp) +movl $2,-48(%ebp) +movl -28(%ebp),%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC1658 +movl $229,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1660 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1660: +.LC1658: +movl $5,-28(%ebp) +flds .LC544 +fstps -64(%ebp) +movl -28(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fdivs -64(%ebp) +fstps -232(%ebp) +flds .LC847 +fcomps -232(%ebp) +fstsw %ax +sahf +jp .LC1663 +ja .LC1663 +flds -232(%ebp) +fsubs .LC847 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-228(%ebp) +jmp .LC1664 +.LC1663: +flds -232(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-228(%ebp) +.LC1664: +movl -228(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC1665 +movl $230,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1667 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1667: +.LC1665: +movl $5,-28(%ebp) +fldl .LC425 +fstpl -72(%ebp) +movl -28(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fdivl -72(%ebp) +fstpl -248(%ebp) +fldl .LC855 +fcompl -248(%ebp) +fstsw %ax +sahf +jp .LC1670 +ja .LC1670 +fldl -248(%ebp) +fsubl .LC855 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-240(%ebp) +jmp .LC1671 +.LC1670: +fldl -248(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-240(%ebp) +.LC1671: +movl -240(%ebp),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $2,%edi +je .LC1672 +movl $231,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1674 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1674: +.LC1672: +flds .LC860 +fstps -52(%ebp) +movb $2,-32(%ebp) +flds -52(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivrp %st,%st(1) +fstps -52(%ebp) +fldl .LC1678 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1676 +1: +movl $232,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1679 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1679: +.LC1676: +flds .LC860 +fstps -52(%ebp) +movw $2,-36(%ebp) +flds -52(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivrp %st,%st(1) +fstps -52(%ebp) +fldl .LC1678 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1681 +1: +movl $233,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1683 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1683: +.LC1681: +flds .LC860 +fstps -52(%ebp) +movl $2,-40(%ebp) +flds -52(%ebp) +fildl -40(%ebp) +fdivrp %st,%st(1) +fstps -52(%ebp) +fldl .LC1678 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1685 +1: +movl $234,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1687 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1687: +.LC1685: +flds .LC860 +fstps -52(%ebp) +movl $2,-44(%ebp) +flds -52(%ebp) +fildl -44(%ebp) +fdivrp %st,%st(1) +fstps -52(%ebp) +fldl .LC1678 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1689 +1: +movl $235,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1691 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1691: +.LC1689: +flds .LC860 +fstps -52(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +flds -52(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fdivrp %st,%st(1) +fstps -52(%ebp) +fldl .LC1678 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1693 +1: +movl $236,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1695 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1695: +.LC1693: +flds .LC860 +fstps -52(%ebp) +flds .LC544 +fstps -64(%ebp) +flds -52(%ebp) +fdivs -64(%ebp) +fstps -52(%ebp) +fldl .LC1678 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1697 +1: +movl $237,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1699 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1699: +.LC1697: +flds .LC860 +fstps -52(%ebp) +fldl .LC425 +fstpl -72(%ebp) +flds -52(%ebp) +fdivl -72(%ebp) +fstps -52(%ebp) +fldl .LC1678 +fcomps -52(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1701 +1: +movl $238,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1703 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1703: +.LC1701: +fldl .LC889 +fstpl -60(%ebp) +movb $2,-32(%ebp) +fldl -60(%ebp) +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivrp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1678 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1705 +1: +movl $239,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1707 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1707: +.LC1705: +fldl .LC889 +fstpl -60(%ebp) +movw $2,-36(%ebp) +fldl -60(%ebp) +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivrp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1678 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1709 +1: +movl $240,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1711 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1711: +.LC1709: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-40(%ebp) +fldl -60(%ebp) +fidivl -40(%ebp) +fstpl -60(%ebp) +fldl .LC1678 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1713 +1: +movl $241,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1715 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1715: +.LC1713: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-44(%ebp) +fldl -60(%ebp) +fidivl -44(%ebp) +fstpl -60(%ebp) +fldl .LC1678 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1717 +1: +movl $242,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1719 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1719: +.LC1717: +fldl .LC889 +fstpl -60(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +fldl -60(%ebp) +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fdivrp %st,%st(1) +fstpl -60(%ebp) +fldl .LC1678 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1721 +1: +movl $243,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1723 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1723: +.LC1721: +fldl .LC889 +fstpl -60(%ebp) +flds .LC544 +fstps -64(%ebp) +fldl -60(%ebp) +fdivs -64(%ebp) +fstpl -60(%ebp) +fldl .LC1678 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1725 +1: +movl $244,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1727 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1727: +.LC1725: +fldl .LC889 +fstpl -60(%ebp) +fldl .LC425 +fstpl -72(%ebp) +fldl -60(%ebp) +fdivl -72(%ebp) +fstpl -60(%ebp) +fldl .LC1678 +fcompl -60(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1729 +1: +movl $245,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1731 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1731: +.LC1729: +movb $5,-12(%ebp) +movb $2,-32(%ebp) +movsbl -12(%ebp),%eax +movsbl -32(%ebp),%ecx +cdq +idivl %ecx +movl %edx,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1733 +movl $246,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1735 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1735: +.LC1733: +movb $5,-12(%ebp) +movw $2,-36(%ebp) +movsbl -12(%ebp),%eax +movswl -36(%ebp),%ecx +cdq +idivl %ecx +movl %edx,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1737 +movl $247,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1739 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1739: +.LC1737: +movb $5,-12(%ebp) +movl $2,-40(%ebp) +movsbl -12(%ebp),%eax +movl -40(%ebp),%ecx +cdq +idivl %ecx +movl %edx,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1741 +movl $248,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1743 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1743: +.LC1741: +movb $5,-12(%ebp) +movl $2,-44(%ebp) +movsbl -12(%ebp),%eax +movl -44(%ebp),%ecx +cdq +idivl %ecx +movl %edx,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1745 +movl $249,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1747 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1747: +.LC1745: +movb $5,-12(%ebp) +movl $2,-48(%ebp) +movsbl -12(%ebp),%edi +movl %edi,%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %edx,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1749 +movl $250,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1751 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1751: +.LC1749: +movw $5,-16(%ebp) +movb $2,-32(%ebp) +movswl -16(%ebp),%eax +movsbl -32(%ebp),%ecx +cdq +idivl %ecx +movl %edx,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1753 +movl $251,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1755 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1755: +.LC1753: +movw $5,-16(%ebp) +movw $2,-36(%ebp) +movswl -16(%ebp),%eax +movswl -36(%ebp),%ecx +cdq +idivl %ecx +movl %edx,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1757 +movl $252,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1759 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1759: +.LC1757: +movw $5,-16(%ebp) +movl $2,-40(%ebp) +movswl -16(%ebp),%eax +movl -40(%ebp),%ecx +cdq +idivl %ecx +movl %edx,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1761 +movl $253,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1763 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1763: +.LC1761: +movw $5,-16(%ebp) +movl $2,-44(%ebp) +movswl -16(%ebp),%eax +movl -44(%ebp),%ecx +cdq +idivl %ecx +movl %edx,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1765 +movl $254,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1767 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1767: +.LC1765: +movw $5,-16(%ebp) +movl $2,-48(%ebp) +movswl -16(%ebp),%edi +movl %edi,%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %edx,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1769 +movl $255,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1771 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1771: +.LC1769: +movl $5,-20(%ebp) +movb $2,-32(%ebp) +movl -20(%ebp),%eax +movsbl -32(%ebp),%ecx +cdq +idivl %ecx +movl %edx,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1773 +movl $256,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1775 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1775: +.LC1773: +movl $5,-20(%ebp) +movw $2,-36(%ebp) +movl -20(%ebp),%eax +movswl -36(%ebp),%ecx +cdq +idivl %ecx +movl %edx,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1777 +movl $257,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1779 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1779: +.LC1777: +movl $5,-20(%ebp) +movl $2,-40(%ebp) +movl -20(%ebp),%eax +movl -40(%ebp),%ecx +cdq +idivl %ecx +movl %edx,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1781 +movl $258,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1783 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1783: +.LC1781: +movl $5,-20(%ebp) +movl $2,-44(%ebp) +movl -20(%ebp),%eax +movl -44(%ebp),%ecx +cdq +idivl %ecx +movl %edx,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1785 +movl $259,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1787 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1787: +.LC1785: +movl $5,-20(%ebp) +movl $2,-48(%ebp) +movl -20(%ebp),%edi +movl %edi,%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %edx,%edi +movl %edi,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1789 +movl $260,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1791 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1791: +.LC1789: +movl $5,-24(%ebp) +movb $2,-32(%ebp) +movl -24(%ebp),%eax +movsbl -32(%ebp),%ecx +cdq +idivl %ecx +movl %edx,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1793 +movl $261,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1795 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1795: +.LC1793: +movl $5,-24(%ebp) +movw $2,-36(%ebp) +movl -24(%ebp),%eax +movswl -36(%ebp),%ecx +cdq +idivl %ecx +movl %edx,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1797 +movl $262,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1799 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1799: +.LC1797: +movl $5,-24(%ebp) +movl $2,-40(%ebp) +movl -24(%ebp),%eax +movl -40(%ebp),%ecx +cdq +idivl %ecx +movl %edx,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1801 +movl $263,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1803 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1803: +.LC1801: +movl $5,-24(%ebp) +movl $2,-44(%ebp) +movl -24(%ebp),%eax +movl -44(%ebp),%ecx +cdq +idivl %ecx +movl %edx,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1805 +movl $264,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1807 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1807: +.LC1805: +movl $5,-24(%ebp) +movl $2,-48(%ebp) +movl -24(%ebp),%edi +movl %edi,%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %edx,%edi +movl %edi,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1809 +movl $265,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1811 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1811: +.LC1809: +movl $5,-28(%ebp) +movb $2,-32(%ebp) +movl -28(%ebp),%eax +movsbl -32(%ebp),%edi +movl %edi,%ecx +xorl %edx,%edx +divl %ecx +movl %edx,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1813 +movl $266,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1815 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1815: +.LC1813: +movl $5,-28(%ebp) +movw $2,-36(%ebp) +movl -28(%ebp),%eax +movswl -36(%ebp),%edi +movl %edi,%ecx +xorl %edx,%edx +divl %ecx +movl %edx,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1817 +movl $267,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1819 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1819: +.LC1817: +movl $5,-28(%ebp) +movl $2,-40(%ebp) +movl -28(%ebp),%eax +movl -40(%ebp),%edi +movl %edi,%ecx +xorl %edx,%edx +divl %ecx +movl %edx,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1821 +movl $268,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1823 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1823: +.LC1821: +movl $5,-28(%ebp) +movl $2,-44(%ebp) +movl -28(%ebp),%eax +movl -44(%ebp),%edi +movl %edi,%ecx +xorl %edx,%edx +divl %ecx +movl %edx,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1825 +movl $269,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1827 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1827: +.LC1825: +movl $5,-28(%ebp) +movl $2,-48(%ebp) +movl -28(%ebp),%eax +movl -48(%ebp),%ecx +xorl %edx,%edx +divl %ecx +movl %edx,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1829 +movl $270,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1831 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1831: +.LC1829: +movb $5,-12(%ebp) +movb $2,-32(%ebp) +movsbl -12(%ebp),%edi +movsbl -32(%ebp),%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1833 +movl $271,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1835 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1835: +.LC1833: +movb $5,-12(%ebp) +movw $2,-36(%ebp) +movsbl -12(%ebp),%edi +movswl -36(%ebp),%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1837 +movl $272,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1839 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1839: +.LC1837: +movb $5,-12(%ebp) +movl $2,-40(%ebp) +movsbl -12(%ebp),%edi +movl -40(%ebp),%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1841 +movl $273,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1843 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1843: +.LC1841: +movb $5,-12(%ebp) +movl $2,-44(%ebp) +movsbl -12(%ebp),%edi +movl -44(%ebp),%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1845 +movl $274,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1847 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1847: +.LC1845: +movb $5,-12(%ebp) +movl $2,-48(%ebp) +movsbl -12(%ebp),%edi +movl -48(%ebp),%esi +movl %esi,%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $1,%edi +je .LC1849 +movl $275,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1851 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1851: +.LC1849: +movw $5,-16(%ebp) +movb $2,-32(%ebp) +movswl -16(%ebp),%edi +movsbl -32(%ebp),%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1853 +movl $276,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1855 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1855: +.LC1853: +movw $5,-16(%ebp) +movw $2,-36(%ebp) +movswl -16(%ebp),%edi +movswl -36(%ebp),%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1857 +movl $277,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1859 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1859: +.LC1857: +movw $5,-16(%ebp) +movl $2,-40(%ebp) +movswl -16(%ebp),%edi +movl -40(%ebp),%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1861 +movl $278,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1863 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1863: +.LC1861: +movw $5,-16(%ebp) +movl $2,-44(%ebp) +movswl -16(%ebp),%edi +movl -44(%ebp),%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1865 +movl $279,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1867 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1867: +.LC1865: +movw $5,-16(%ebp) +movl $2,-48(%ebp) +movswl -16(%ebp),%edi +movl -48(%ebp),%esi +movl %esi,%ecx +movl %edi,%eax +sarl %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $1,%edi +je .LC1869 +movl $280,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1871 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1871: +.LC1869: +movl $5,-20(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%ecx +sarl %cl,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1873 +movl $281,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1875 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1875: +.LC1873: +movl $5,-20(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%ecx +sarl %cl,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1877 +movl $282,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1879 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1879: +.LC1877: +movl $5,-20(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%ecx +sarl %cl,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1881 +movl $283,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1883 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1883: +.LC1881: +movl $5,-20(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%ecx +sarl %cl,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1885 +movl $284,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1887 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1887: +.LC1885: +movl $5,-20(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movl %edi,%ecx +sarl %cl,-20(%ebp) +cmpl $1,-20(%ebp) +je .LC1889 +movl $285,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1891 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1891: +.LC1889: +movl $5,-24(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%ecx +sarl %cl,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1893 +movl $286,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1895 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1895: +.LC1893: +movl $5,-24(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%ecx +sarl %cl,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1897 +movl $287,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1899 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1899: +.LC1897: +movl $5,-24(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%ecx +sarl %cl,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1901 +movl $288,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1903 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1903: +.LC1901: +movl $5,-24(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%ecx +sarl %cl,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1905 +movl $289,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1907 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1907: +.LC1905: +movl $5,-24(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movl %edi,%ecx +sarl %cl,-24(%ebp) +cmpl $1,-24(%ebp) +je .LC1909 +movl $290,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1911 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1911: +.LC1909: +movl $5,-28(%ebp) +movb $2,-32(%ebp) +movl -28(%ebp),%edi +movsbl -32(%ebp),%ecx +movl %edi,%eax +shrl %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1913 +movl $291,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1915 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1915: +.LC1913: +movl $5,-28(%ebp) +movw $2,-36(%ebp) +movl -28(%ebp),%edi +movswl -36(%ebp),%ecx +movl %edi,%eax +shrl %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1917 +movl $292,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1919 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1919: +.LC1917: +movl $5,-28(%ebp) +movl $2,-40(%ebp) +movl -28(%ebp),%edi +movl -40(%ebp),%ecx +movl %edi,%eax +shrl %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1921 +movl $293,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1923 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1923: +.LC1921: +movl $5,-28(%ebp) +movl $2,-44(%ebp) +movl -28(%ebp),%edi +movl -44(%ebp),%ecx +movl %edi,%eax +shrl %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1925 +movl $294,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1927 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1927: +.LC1925: +movl $5,-28(%ebp) +movl $2,-48(%ebp) +movl -28(%ebp),%edi +movl -48(%ebp),%esi +movl %esi,%ecx +movl %edi,%eax +shrl %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $1,%edi +je .LC1929 +movl $295,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1931 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1931: +.LC1929: +movb $5,-12(%ebp) +movb $2,-32(%ebp) +movsbl -12(%ebp),%edi +movsbl -32(%ebp),%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $20,%edi +je .LC1933 +movl $296,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1935 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1935: +.LC1933: +movb $5,-12(%ebp) +movw $2,-36(%ebp) +movsbl -12(%ebp),%edi +movswl -36(%ebp),%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $20,%edi +je .LC1937 +movl $297,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1939 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1939: +.LC1937: +movb $5,-12(%ebp) +movl $2,-40(%ebp) +movsbl -12(%ebp),%edi +movl -40(%ebp),%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $20,%edi +je .LC1941 +movl $298,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1943 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1943: +.LC1941: +movb $5,-12(%ebp) +movl $2,-44(%ebp) +movsbl -12(%ebp),%edi +movl -44(%ebp),%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $20,%edi +je .LC1945 +movl $299,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1947 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1947: +.LC1945: +movb $5,-12(%ebp) +movl $2,-48(%ebp) +movsbl -12(%ebp),%edi +movl -48(%ebp),%esi +movl %esi,%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $20,%edi +je .LC1949 +movl $300,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1951 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1951: +.LC1949: +movw $5,-16(%ebp) +movb $2,-32(%ebp) +movswl -16(%ebp),%edi +movsbl -32(%ebp),%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $20,%edi +je .LC1953 +movl $301,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1955 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1955: +.LC1953: +movw $5,-16(%ebp) +movw $2,-36(%ebp) +movswl -16(%ebp),%edi +movswl -36(%ebp),%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $20,%edi +je .LC1957 +movl $302,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1959 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1959: +.LC1957: +movw $5,-16(%ebp) +movl $2,-40(%ebp) +movswl -16(%ebp),%edi +movl -40(%ebp),%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $20,%edi +je .LC1961 +movl $303,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1963 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1963: +.LC1961: +movw $5,-16(%ebp) +movl $2,-44(%ebp) +movswl -16(%ebp),%edi +movl -44(%ebp),%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $20,%edi +je .LC1965 +movl $304,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1967 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1967: +.LC1965: +movw $5,-16(%ebp) +movl $2,-48(%ebp) +movswl -16(%ebp),%edi +movl -48(%ebp),%esi +movl %esi,%ecx +movl %edi,%eax +sall %cl,%eax +movl %eax,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $20,%edi +je .LC1969 +movl $305,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1971 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1971: +.LC1969: +movl $5,-20(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%ecx +sall %cl,-20(%ebp) +cmpl $20,-20(%ebp) +je .LC1973 +movl $306,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1975 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1975: +.LC1973: +movl $5,-20(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%ecx +sall %cl,-20(%ebp) +cmpl $20,-20(%ebp) +je .LC1977 +movl $307,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1979 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1979: +.LC1977: +movl $5,-20(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%ecx +sall %cl,-20(%ebp) +cmpl $20,-20(%ebp) +je .LC1981 +movl $308,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1983 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1983: +.LC1981: +movl $5,-20(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%ecx +sall %cl,-20(%ebp) +cmpl $20,-20(%ebp) +je .LC1985 +movl $309,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1987 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1987: +.LC1985: +movl $5,-20(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movl %edi,%ecx +sall %cl,-20(%ebp) +cmpl $20,-20(%ebp) +je .LC1989 +movl $310,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1991 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1991: +.LC1989: +movl $5,-24(%ebp) +movb $2,-32(%ebp) +movsbl -32(%ebp),%ecx +sall %cl,-24(%ebp) +cmpl $20,-24(%ebp) +je .LC1993 +movl $311,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1995 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1995: +.LC1993: +movl $5,-24(%ebp) +movw $2,-36(%ebp) +movswl -36(%ebp),%ecx +sall %cl,-24(%ebp) +cmpl $20,-24(%ebp) +je .LC1997 +movl $312,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC1999 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC1999: +.LC1997: +movl $5,-24(%ebp) +movl $2,-40(%ebp) +movl -40(%ebp),%ecx +sall %cl,-24(%ebp) +cmpl $20,-24(%ebp) +je .LC2001 +movl $313,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2003 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2003: +.LC2001: +movl $5,-24(%ebp) +movl $2,-44(%ebp) +movl -44(%ebp),%ecx +sall %cl,-24(%ebp) +cmpl $20,-24(%ebp) +je .LC2005 +movl $314,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2007 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2007: +.LC2005: +movl $5,-24(%ebp) +movl $2,-48(%ebp) +movl -48(%ebp),%edi +movl %edi,%ecx +sall %cl,-24(%ebp) +cmpl $20,-24(%ebp) +je .LC2009 +movl $315,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2011 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2011: +.LC2009: +movl $5,-28(%ebp) +movb $2,-32(%ebp) +movl -28(%ebp),%edi +movsbl -32(%ebp),%ecx +movl %edi,%eax +shll %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $20,%edi +je .LC2013 +movl $316,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2015 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2015: +.LC2013: +movl $5,-28(%ebp) +movw $2,-36(%ebp) +movl -28(%ebp),%edi +movswl -36(%ebp),%ecx +movl %edi,%eax +shll %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $20,%edi +je .LC2017 +movl $317,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2019 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2019: +.LC2017: +movl $5,-28(%ebp) +movl $2,-40(%ebp) +movl -28(%ebp),%edi +movl -40(%ebp),%ecx +movl %edi,%eax +shll %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $20,%edi +je .LC2021 +movl $318,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2023 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2023: +.LC2021: +movl $5,-28(%ebp) +movl $2,-44(%ebp) +movl -28(%ebp),%edi +movl -44(%ebp),%ecx +movl %edi,%eax +shll %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $20,%edi +je .LC2025 +movl $319,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2027 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2027: +.LC2025: +movl $5,-28(%ebp) +movl $2,-48(%ebp) +movl -28(%ebp),%edi +movl -48(%ebp),%esi +movl %esi,%ecx +movl %edi,%eax +shll %cl,%eax +movl %eax,-28(%ebp) +movl -28(%ebp),%edi +cmpl $20,%edi +je .LC2029 +movl $320,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2031 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2031: +.LC2029: +movb $12,-12(%ebp) +movb $10,-32(%ebp) +movsbl -12(%ebp),%edi +movsbl -32(%ebp),%esi +andl %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $8,%edi +je .LC2033 +movl $321,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2035 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2035: +.LC2033: +movb $12,-12(%ebp) +movw $10,-36(%ebp) +movsbl -12(%ebp),%edi +movswl -36(%ebp),%esi +andl %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $8,%edi +je .LC2037 +movl $322,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2039 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2039: +.LC2037: +movb $12,-12(%ebp) +movl $10,-40(%ebp) +movsbl -12(%ebp),%edi +andl -40(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $8,%edi +je .LC2041 +movl $323,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2043 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2043: +.LC2041: +movb $12,-12(%ebp) +movl $10,-44(%ebp) +movsbl -12(%ebp),%edi +andl -44(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $8,%edi +je .LC2045 +movl $324,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2047 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2047: +.LC2045: +movb $12,-12(%ebp) +movl $10,-48(%ebp) +movsbl -12(%ebp),%edi +andl -48(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $8,%edi +je .LC2049 +movl $325,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2051 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2051: +.LC2049: +movw $12,-16(%ebp) +movb $10,-32(%ebp) +movswl -16(%ebp),%edi +movsbl -32(%ebp),%esi +andl %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $8,%edi +je .LC2053 +movl $326,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2055 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2055: +.LC2053: +movw $12,-16(%ebp) +movw $10,-36(%ebp) +movswl -16(%ebp),%edi +movswl -36(%ebp),%esi +andl %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $8,%edi +je .LC2057 +movl $327,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2059 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2059: +.LC2057: +movw $12,-16(%ebp) +movl $10,-40(%ebp) +movswl -16(%ebp),%edi +andl -40(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $8,%edi +je .LC2061 +movl $328,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2063 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2063: +.LC2061: +movw $12,-16(%ebp) +movl $10,-44(%ebp) +movswl -16(%ebp),%edi +andl -44(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $8,%edi +je .LC2065 +movl $329,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2067 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2067: +.LC2065: +movw $12,-16(%ebp) +movl $10,-48(%ebp) +movswl -16(%ebp),%edi +andl -48(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $8,%edi +je .LC2069 +movl $330,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2071 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2071: +.LC2069: +movl $12,-20(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +andl %edi,-20(%ebp) +cmpl $8,-20(%ebp) +je .LC2073 +movl $331,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2075 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2075: +.LC2073: +movl $12,-20(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +andl %edi,-20(%ebp) +cmpl $8,-20(%ebp) +je .LC2077 +movl $332,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2079 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2079: +.LC2077: +movl $12,-20(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +andl %edi,-20(%ebp) +cmpl $8,-20(%ebp) +je .LC2081 +movl $333,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2083 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2083: +.LC2081: +movl $12,-20(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +andl %edi,-20(%ebp) +cmpl $8,-20(%ebp) +je .LC2085 +movl $334,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2087 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2087: +.LC2085: +movl $12,-20(%ebp) +movl $10,-48(%ebp) +movl -20(%ebp),%edi +andl -48(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $8,-20(%ebp) +je .LC2089 +movl $335,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2091 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2091: +.LC2089: +movl $12,-24(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +andl %edi,-24(%ebp) +cmpl $8,-24(%ebp) +je .LC2093 +movl $336,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2095 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2095: +.LC2093: +movl $12,-24(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +andl %edi,-24(%ebp) +cmpl $8,-24(%ebp) +je .LC2097 +movl $337,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2099 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2099: +.LC2097: +movl $12,-24(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +andl %edi,-24(%ebp) +cmpl $8,-24(%ebp) +je .LC2101 +movl $338,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2103 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2103: +.LC2101: +movl $12,-24(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +andl %edi,-24(%ebp) +cmpl $8,-24(%ebp) +je .LC2105 +movl $339,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2107 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2107: +.LC2105: +movl $12,-24(%ebp) +movl $10,-48(%ebp) +movl -24(%ebp),%edi +andl -48(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $8,-24(%ebp) +je .LC2109 +movl $340,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2111 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2111: +.LC2109: +movl $12,-28(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +andl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $8,%edi +je .LC2113 +movl $341,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2115 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2115: +.LC2113: +movl $12,-28(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +andl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $8,%edi +je .LC2117 +movl $342,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2119 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2119: +.LC2117: +movl $12,-28(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +andl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $8,%edi +je .LC2121 +movl $343,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2123 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2123: +.LC2121: +movl $12,-28(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +andl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $8,%edi +je .LC2125 +movl $344,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2127 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2127: +.LC2125: +movl $12,-28(%ebp) +movl $10,-48(%ebp) +movl -48(%ebp),%edi +andl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $8,%edi +je .LC2129 +movl $345,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2131 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2131: +.LC2129: +movb $12,-12(%ebp) +movb $10,-32(%ebp) +movsbl -12(%ebp),%edi +movsbl -32(%ebp),%esi +xorl %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $6,%edi +je .LC2133 +movl $346,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2135 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2135: +.LC2133: +movb $12,-12(%ebp) +movw $10,-36(%ebp) +movsbl -12(%ebp),%edi +movswl -36(%ebp),%esi +xorl %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $6,%edi +je .LC2137 +movl $347,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2139 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2139: +.LC2137: +movb $12,-12(%ebp) +movl $10,-40(%ebp) +movsbl -12(%ebp),%edi +xorl -40(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $6,%edi +je .LC2141 +movl $348,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2143 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2143: +.LC2141: +movb $12,-12(%ebp) +movl $10,-44(%ebp) +movsbl -12(%ebp),%edi +xorl -44(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $6,%edi +je .LC2145 +movl $349,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2147 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2147: +.LC2145: +movb $12,-12(%ebp) +movl $10,-48(%ebp) +movsbl -12(%ebp),%edi +xorl -48(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $6,%edi +je .LC2149 +movl $350,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2151 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2151: +.LC2149: +movw $12,-16(%ebp) +movb $10,-32(%ebp) +movswl -16(%ebp),%edi +movsbl -32(%ebp),%esi +xorl %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $6,%edi +je .LC2153 +movl $351,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2155 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2155: +.LC2153: +movw $12,-16(%ebp) +movw $10,-36(%ebp) +movswl -16(%ebp),%edi +movswl -36(%ebp),%esi +xorl %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $6,%edi +je .LC2157 +movl $352,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2159 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2159: +.LC2157: +movw $12,-16(%ebp) +movl $10,-40(%ebp) +movswl -16(%ebp),%edi +xorl -40(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $6,%edi +je .LC2161 +movl $353,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2163 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2163: +.LC2161: +movw $12,-16(%ebp) +movl $10,-44(%ebp) +movswl -16(%ebp),%edi +xorl -44(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $6,%edi +je .LC2165 +movl $354,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2167 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2167: +.LC2165: +movw $12,-16(%ebp) +movl $10,-48(%ebp) +movswl -16(%ebp),%edi +xorl -48(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $6,%edi +je .LC2169 +movl $355,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2171 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2171: +.LC2169: +movl $12,-20(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +xorl %edi,-20(%ebp) +cmpl $6,-20(%ebp) +je .LC2173 +movl $356,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2175 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2175: +.LC2173: +movl $12,-20(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +xorl %edi,-20(%ebp) +cmpl $6,-20(%ebp) +je .LC2177 +movl $357,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2179 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2179: +.LC2177: +movl $12,-20(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +xorl %edi,-20(%ebp) +cmpl $6,-20(%ebp) +je .LC2181 +movl $358,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2183 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2183: +.LC2181: +movl $12,-20(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +xorl %edi,-20(%ebp) +cmpl $6,-20(%ebp) +je .LC2185 +movl $359,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2187 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2187: +.LC2185: +movl $12,-20(%ebp) +movl $10,-48(%ebp) +movl -20(%ebp),%edi +xorl -48(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $6,-20(%ebp) +je .LC2189 +movl $360,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2191 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2191: +.LC2189: +movl $12,-24(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +xorl %edi,-24(%ebp) +cmpl $6,-24(%ebp) +je .LC2193 +movl $361,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2195 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2195: +.LC2193: +movl $12,-24(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +xorl %edi,-24(%ebp) +cmpl $6,-24(%ebp) +je .LC2197 +movl $362,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2199 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2199: +.LC2197: +movl $12,-24(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +xorl %edi,-24(%ebp) +cmpl $6,-24(%ebp) +je .LC2201 +movl $363,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2203 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2203: +.LC2201: +movl $12,-24(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +xorl %edi,-24(%ebp) +cmpl $6,-24(%ebp) +je .LC2205 +movl $364,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2207 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2207: +.LC2205: +movl $12,-24(%ebp) +movl $10,-48(%ebp) +movl -24(%ebp),%edi +xorl -48(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $6,-24(%ebp) +je .LC2209 +movl $365,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2211 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2211: +.LC2209: +movl $12,-28(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +xorl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $6,%edi +je .LC2213 +movl $366,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2215 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2215: +.LC2213: +movl $12,-28(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +xorl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $6,%edi +je .LC2217 +movl $367,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2219 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2219: +.LC2217: +movl $12,-28(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +xorl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $6,%edi +je .LC2221 +movl $368,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2223 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2223: +.LC2221: +movl $12,-28(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +xorl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $6,%edi +je .LC2225 +movl $369,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2227 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2227: +.LC2225: +movl $12,-28(%ebp) +movl $10,-48(%ebp) +movl -48(%ebp),%edi +xorl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $6,%edi +je .LC2229 +movl $370,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2231 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2231: +.LC2229: +movb $12,-12(%ebp) +movb $10,-32(%ebp) +movsbl -12(%ebp),%edi +movsbl -32(%ebp),%esi +orl %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $14,%edi +je .LC2233 +movl $371,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2235 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2235: +.LC2233: +movb $12,-12(%ebp) +movw $10,-36(%ebp) +movsbl -12(%ebp),%edi +movswl -36(%ebp),%esi +orl %esi,%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $14,%edi +je .LC2237 +movl $372,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2239 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2239: +.LC2237: +movb $12,-12(%ebp) +movl $10,-40(%ebp) +movsbl -12(%ebp),%edi +orl -40(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $14,%edi +je .LC2241 +movl $373,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2243 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2243: +.LC2241: +movb $12,-12(%ebp) +movl $10,-44(%ebp) +movsbl -12(%ebp),%edi +orl -44(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $14,%edi +je .LC2245 +movl $374,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2247 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2247: +.LC2245: +movb $12,-12(%ebp) +movl $10,-48(%ebp) +movsbl -12(%ebp),%edi +orl -48(%ebp),%edi +movl %edi,%ebx +movb %bl,-12(%ebp) +movsbl -12(%ebp),%edi +cmpl $14,%edi +je .LC2249 +movl $375,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2251 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2251: +.LC2249: +movw $12,-16(%ebp) +movb $10,-32(%ebp) +movswl -16(%ebp),%edi +movsbl -32(%ebp),%esi +orl %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $14,%edi +je .LC2253 +movl $376,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2255 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2255: +.LC2253: +movw $12,-16(%ebp) +movw $10,-36(%ebp) +movswl -16(%ebp),%edi +movswl -36(%ebp),%esi +orl %esi,%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $14,%edi +je .LC2257 +movl $377,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2259 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2259: +.LC2257: +movw $12,-16(%ebp) +movl $10,-40(%ebp) +movswl -16(%ebp),%edi +orl -40(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $14,%edi +je .LC2261 +movl $378,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2263 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2263: +.LC2261: +movw $12,-16(%ebp) +movl $10,-44(%ebp) +movswl -16(%ebp),%edi +orl -44(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $14,%edi +je .LC2265 +movl $379,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2267 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2267: +.LC2265: +movw $12,-16(%ebp) +movl $10,-48(%ebp) +movswl -16(%ebp),%edi +orl -48(%ebp),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $14,%edi +je .LC2269 +movl $380,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2271 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2271: +.LC2269: +movl $12,-20(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +orl %edi,-20(%ebp) +cmpl $14,-20(%ebp) +je .LC2273 +movl $381,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2275 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2275: +.LC2273: +movl $12,-20(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +orl %edi,-20(%ebp) +cmpl $14,-20(%ebp) +je .LC2277 +movl $382,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2279 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2279: +.LC2277: +movl $12,-20(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +orl %edi,-20(%ebp) +cmpl $14,-20(%ebp) +je .LC2281 +movl $383,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2283 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2283: +.LC2281: +movl $12,-20(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +orl %edi,-20(%ebp) +cmpl $14,-20(%ebp) +je .LC2285 +movl $384,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2287 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2287: +.LC2285: +movl $12,-20(%ebp) +movl $10,-48(%ebp) +movl -20(%ebp),%edi +orl -48(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $14,-20(%ebp) +je .LC2289 +movl $385,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2291 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2291: +.LC2289: +movl $12,-24(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +orl %edi,-24(%ebp) +cmpl $14,-24(%ebp) +je .LC2293 +movl $386,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2295 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2295: +.LC2293: +movl $12,-24(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +orl %edi,-24(%ebp) +cmpl $14,-24(%ebp) +je .LC2297 +movl $387,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2299 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2299: +.LC2297: +movl $12,-24(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +orl %edi,-24(%ebp) +cmpl $14,-24(%ebp) +je .LC2301 +movl $388,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2303 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2303: +.LC2301: +movl $12,-24(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +orl %edi,-24(%ebp) +cmpl $14,-24(%ebp) +je .LC2305 +movl $389,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2307 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2307: +.LC2305: +movl $12,-24(%ebp) +movl $10,-48(%ebp) +movl -24(%ebp),%edi +orl -48(%ebp),%edi +movl %edi,-24(%ebp) +cmpl $14,-24(%ebp) +je .LC2309 +movl $390,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2311 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2311: +.LC2309: +movl $12,-28(%ebp) +movb $10,-32(%ebp) +movsbl -32(%ebp),%edi +orl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $14,%edi +je .LC2313 +movl $391,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2315 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2315: +.LC2313: +movl $12,-28(%ebp) +movw $10,-36(%ebp) +movswl -36(%ebp),%edi +orl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $14,%edi +je .LC2317 +movl $392,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2319 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2319: +.LC2317: +movl $12,-28(%ebp) +movl $10,-40(%ebp) +movl -40(%ebp),%edi +orl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $14,%edi +je .LC2321 +movl $393,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2323 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2323: +.LC2321: +movl $12,-28(%ebp) +movl $10,-44(%ebp) +movl -44(%ebp),%edi +orl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $14,%edi +je .LC2325 +movl $394,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2327 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2327: +.LC2325: +movl $12,-28(%ebp) +movl $10,-48(%ebp) +movl -48(%ebp),%edi +orl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $14,%edi +je .LC2329 +movl $395,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2331 +pushl -8(%ebp) +pushl $f.706 +call printf +addl $8,%esp +.LC2331: +.LC2329: +cmpl $0,-8(%ebp) +je .LC2333 +movl $1,-84(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2335 +pushl $1 +pushl $s714er.707 +call printf +addl $8,%esp +.LC2335: +.LC2333: +movl -84(%ebp),%eax +.LC705: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf2337: +.size s714,.Lf2337-s714 +.data +.align 1 +.type s715er.2339,@object +s715er.2339: +.byte 115 +.byte 55 +.byte 49 +.byte 53 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s715er.2339,11 +.align 1 +.type qs715.2340,@object +.size qs715.2340,8 +qs715.2340: +.byte 115 +.byte 55 +.byte 49 +.byte 53 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s715 +.text +.align 16 +.type s715,@function +s715: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $28,%esp +movl $0,-28(%ebp) +movl $0,-20(%ebp) +leal qs715.2340,%edi +movl %edi,-4(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-8(%ebp) +movl $0,-16(%ebp) +.LC2341: +.LC2342: +movl -8(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-8(%ebp) +movl -4(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-4(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC2341 +movl $1,-12(%ebp) +incl -12(%ebp) +incl -12(%ebp) +incl -12(%ebp) +incl -12(%ebp) +movl -12(%ebp),%edi +leal 1(%edi),%edi +movl %edi,-12(%ebp) +cmpl $6,%edi +je .LC2344 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2346 +pushl $1 +pushl $s715er.2339 +call printf +addl $8,%esp +.LC2346: +incl -16(%ebp) +.LC2344: +pushl -28(%ebp) +movl $3,-24(%ebp) +movl -24(%ebp),%edi +leal 2(%edi),%edi +pushl %edi +pushl -20(%ebp) +call s715f +addl $12,%esp +cmpl $5,%eax +je .LC2348 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2350 +pushl $2 +pushl $s715er.2339 +call printf +addl $8,%esp +.LC2350: +addl $2,-16(%ebp) +.LC2348: +movl -16(%ebp),%eax +.LC2338: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf2352: +.size s715,.Lf2352-s715 +.globl s715f +.align 16 +.type s715f,@function +s715f: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 24(%ebp),%eax +.LC2353: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf2354: +.size s715f,.Lf2354-s715f +.data +.align 1 +.type s72er.2356,@object +s72er.2356: +.byte 115 +.byte 55 +.byte 50 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s72er.2356,10 +.align 1 +.type qs72.2357,@object +.size qs72.2357,8 +qs72.2357: +.byte 115 +.byte 55 +.byte 50 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s72 +.text +.align 16 +.type s72,@function +s72: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $104,%esp +leal qs72.2357,%edi +movl %edi,-12(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-16(%ebp) +movl $0,-24(%ebp) +.LC2358: +.LC2359: +movl -16(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-16(%ebp) +movl -12(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-12(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC2358 +movl $2,-4(%ebp) +cmpl $2,-4(%ebp) +je .LC2361 +incl -24(%ebp) +pushl $1 +pushl $s72er.2356 +call printf +addl $8,%esp +.LC2361: +movl -4(%ebp),%edi +movl %edi,%esi +negl %esi +leal (%esi,%edi),%edi +cmpl $0,%edi +je .LC2363 +addl $2,-24(%ebp) +pushl $2 +pushl $s72er.2356 +call printf +addl $8,%esp +.LC2363: +movl $0,-4(%ebp) +movl $0,-8(%ebp) +jmp .LC2368 +.LC2365: +movl -4(%ebp),%edi +leal (,%edi,2),%edi +orl $1,%edi +movl %edi,-4(%ebp) +.LC2366: +incl -8(%ebp) +.LC2368: +movl 20(%ebp),%edi +movl 4(%edi),%edi +cmpl %edi,-8(%ebp) +jl .LC2365 +movl -4(%ebp),%edi +notl %edi +cmpl $0,%edi +je .LC2369 +addl $4,-24(%ebp) +pushl $4 +pushl $s72er.2356 +call printf +addl $8,%esp +.LC2369: +movl $5,-4(%ebp) +movl -4(%ebp),%edi +leal 1(%edi),%edi +movl %edi,-4(%ebp) +cmpl $6,%edi +jne .LC2376 +movl -4(%ebp),%edi +subl $1,%edi +movl %edi,-4(%ebp) +cmpl $5,%edi +jne .LC2376 +movl -4(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-4(%ebp) +cmpl $5,%edi +jne .LC2376 +movl -4(%ebp),%edi +movl %edi,%esi +subl $1,%esi +movl %esi,-4(%ebp) +cmpl $6,%edi +jne .LC2376 +cmpl $5,-4(%ebp) +je .LC2371 +.LC2376: +addl $8,-24(%ebp) +pushl $8 +pushl $s72er.2356 +call printf +addl $8,%esp +.LC2371: +movb $26,-32(%ebp) +movl $26,-40(%ebp) +fldl .LC2377 +fstpl -52(%ebp) +movw $26,-36(%ebp) +movl $26,-44(%ebp) +movl $26,-28(%ebp) +flds .LC2378 +fstps -56(%ebp) +movl $0,-20(%ebp) +movswl -36(%ebp),%edi +movl %edi,%ebx +movsbl %bl,%edi +cmpl $26,%edi +jne .LC2385 +movl -28(%ebp),%edi +movl %edi,%ebx +movsbl %bl,%edi +cmpl $26,%edi +jne .LC2385 +movl -40(%ebp),%edi +movl %edi,%ebx +movsbl %bl,%edi +cmpl $26,%edi +jne .LC2385 +movl -44(%ebp),%edi +movl %edi,%ebx +movsbl %bl,%edi +cmpl $26,%edi +jne .LC2385 +flds -56(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movsbl %bl,%edi +cmpl $26,%edi +jne .LC2385 +fldl -52(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%ebx +movsbl %bl,%edi +cmpl $26,%edi +je .LC2379 +.LC2385: +incl -20(%ebp) +.LC2379: +movsbl -32(%ebp),%edi +movswl %di,%edi +cmpl $26,%edi +jne .LC2392 +movl -28(%ebp),%edi +movswl %di,%edi +cmpl $26,%edi +jne .LC2392 +movl -40(%ebp),%edi +movswl %di,%edi +cmpl $26,%edi +jne .LC2392 +movl -44(%ebp),%edi +movswl %di,%edi +cmpl $26,%edi +jne .LC2392 +flds -56(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movswl %di,%edi +cmpl $26,%edi +jne .LC2392 +fldl -52(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movswl %di,%edi +cmpl $26,%edi +je .LC2386 +.LC2392: +addl $2,-20(%ebp) +.LC2386: +movsbl -32(%ebp),%edi +cmpl $26,%edi +jne .LC2399 +movswl -36(%ebp),%edi +cmpl $26,%edi +jne .LC2399 +cmpl $26,-40(%ebp) +jne .LC2399 +movl -44(%ebp),%edi +cmpl $26,%edi +jne .LC2399 +flds -56(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +cmpl $26,%eax +jne .LC2399 +fldl -52(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +cmpl $26,%eax +je .LC2393 +.LC2399: +addl $4,-20(%ebp) +.LC2393: +movsbl -32(%ebp),%edi +cmpl $26,%edi +jne .LC2406 +movswl -36(%ebp),%edi +cmpl $26,%edi +jne .LC2406 +cmpl $26,-28(%ebp) +jne .LC2406 +movl -44(%ebp),%edi +cmpl $26,%edi +jne .LC2406 +flds -56(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +cmpl $26,%eax +jne .LC2406 +fldl -52(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +cmpl $26,%eax +je .LC2400 +.LC2406: +addl $8,-20(%ebp) +.LC2400: +movsbl -32(%ebp),%edi +cmpl $26,%edi +jne .LC2415 +movswl -36(%ebp),%edi +cmpl $26,%edi +jne .LC2415 +movl -28(%ebp),%edi +cmpl $26,%edi +jne .LC2415 +movl -40(%ebp),%edi +cmpl $26,%edi +jne .LC2415 +flds .LC847 +fcomps -56(%ebp) +fstsw %ax +sahf +jp .LC2416 +ja .LC2416 +flds -56(%ebp) +fsubs .LC847 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-60(%ebp) +jmp .LC2417 +.LC2416: +flds -56(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-60(%ebp) +.LC2417: +movl -60(%ebp),%edi +cmpl $26,%edi +jne .LC2415 +fldl .LC855 +fcompl -52(%ebp) +fstsw %ax +sahf +jp .LC2418 +ja .LC2418 +fldl -52(%ebp) +fsubl .LC855 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-64(%ebp) +jmp .LC2419 +.LC2418: +fldl -52(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-64(%ebp) +.LC2419: +movl -64(%ebp),%edi +cmpl $26,%edi +je .LC2407 +.LC2415: +addl $16,-20(%ebp) +.LC2407: +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2426 +jne .LC2426 +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2426 +jne .LC2426 +fildl -28(%ebp) +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2426 +jne .LC2426 +fildl -40(%ebp) +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2426 +jne .LC2426 +movl -44(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +sub $4,%esp +fstps (%esp) +flds (%esp) +addl $4,%esp +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2426 +jne .LC2426 +fldl -52(%ebp) +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp 1f +je .LC2420 +1: +.LC2426: +addl $32,-20(%ebp) +.LC2420: +movsbl -32(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2433 +jne .LC2433 +movswl -36(%ebp),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2433 +jne .LC2433 +fildl -28(%ebp) +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2433 +jne .LC2433 +fildl -40(%ebp) +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2433 +jne .LC2433 +movl -44(%ebp),%edi +fldl .LC611 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fldl .LC2377 +fcompp +fstsw %ax +sahf +jp .LC2433 +jne .LC2433 +fldl .LC2377 +fcomps -56(%ebp) +fstsw %ax +sahf +jp 1f +je .LC2427 +1: +.LC2433: +addl $64,-20(%ebp) +.LC2427: +cmpl $0,-20(%ebp) +je .LC2434 +addl $16,-24(%ebp) +pushl $16 +pushl $s72er.2356 +call printf +addl $8,%esp +.LC2434: +movl -24(%ebp),%eax +.LC2355: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf2436: +.size s72,.Lf2436-s72 +.data +.align 1 +.type s757er.2438,@object +s757er.2438: +.byte 115 +.byte 55 +.byte 53 +.byte 55 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s757er.2438,11 +.align 1 +.type qs757.2439,@object +.size qs757.2439,8 +qs757.2439: +.byte 115 +.byte 55 +.byte 53 +.byte 55 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s757 +.text +.align 16 +.type s757,@function +s757: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $148,%esp +leal qs757.2439,%edi +movl %edi,-112(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-116(%ebp) +movl $0,-120(%ebp) +.LC2440: +.LC2441: +movl -116(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-116(%ebp) +movl -112(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-112(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC2440 +movl $40,-124(%ebp) +movl -124(%ebp),%edi +leal (,%edi,8),%esi +leal (,%esi,4),%esi +cmpl $1280,%esi +jne .LC2445 +sarl $3,%edi +sarl $2,%edi +cmpl $1,%edi +je .LC2443 +.LC2445: +incl -120(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2446 +pushl $1 +pushl $s757er.2438 +call printf +addl $8,%esp +.LC2446: +.LC2443: +movl $0,-84(%ebp) +movl $0,-100(%ebp) +jmp .LC2451 +.LC2448: +movl $1,-92(%ebp) +movl -92(%ebp),%edi +movl 20(%ebp),%esi +movl 16(%esi),%esi +movl %esi,%ecx +subl $1,%ecx +movl %edi,%eax +shll %cl,%eax +movl %eax,-96(%ebp) +movl $0,-104(%ebp) +movl -104(%ebp),%edi +notl %edi +movl -100(%ebp),%esi +movl %esi,%ecx +movl %edi,%eax +shrl %cl,%eax +movl %eax,-108(%ebp) +movl %esi,%ecx +movl %edi,%eax +shll %cl,%eax +movl %eax,-104(%ebp) +movl $0,-88(%ebp) +jmp .LC2455 +.LC2452: +movl -100(%ebp),%edi +cmpl %edi,-88(%ebp) +jge .LC2463 +movl $1,-132(%ebp) +jmp .LC2464 +.LC2463: +movl $0,-132(%ebp) +.LC2464: +movl -92(%ebp),%edi +andl -104(%ebp),%edi +cmpl $0,%edi +jne .LC2465 +movl $1,-136(%ebp) +jmp .LC2466 +.LC2465: +movl $0,-136(%ebp) +.LC2466: +movl -136(%ebp),%edi +cmpl %edi,-132(%ebp) +jne .LC2462 +movl -100(%ebp),%edi +cmpl %edi,-88(%ebp) +jge .LC2467 +movl $1,-140(%ebp) +jmp .LC2468 +.LC2467: +movl $0,-140(%ebp) +.LC2468: +movl -96(%ebp),%edi +andl -108(%ebp),%edi +cmpl $0,%edi +jne .LC2469 +movl $1,-144(%ebp) +jmp .LC2470 +.LC2469: +movl $0,-144(%ebp) +.LC2470: +movl -144(%ebp),%edi +cmpl %edi,-140(%ebp) +je .LC2456 +.LC2462: +movl $1,-84(%ebp) +.LC2456: +movl -92(%ebp),%edi +leal (,%edi,2),%edi +movl %edi,-92(%ebp) +movl -96(%ebp),%edi +shrl $1,%edi +movl %edi,-96(%ebp) +.LC2453: +incl -88(%ebp) +.LC2455: +movl 20(%ebp),%edi +movl 16(%edi),%edi +cmpl %edi,-88(%ebp) +jl .LC2452 +.LC2449: +incl -100(%ebp) +.LC2451: +movl 20(%ebp),%edi +movl 16(%edi),%edi +cmpl %edi,-100(%ebp) +jl .LC2448 +cmpl $0,-84(%ebp) +je .LC2471 +addl $2,-120(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2473 +pushl $2 +pushl $s757er.2438 +call printf +addl $8,%esp +.LC2473: +.LC2471: +movl $3,-16(%ebp) +movl $2,-12(%ebp) +movl $1,-8(%ebp) +movl -12(%ebp),%edi +cmpl %edi,-16(%ebp) +jge .LC2481 +movl $1,-136(%ebp) +jmp .LC2482 +.LC2481: +movl $0,-136(%ebp) +.LC2482: +movl -8(%ebp),%edi +cmpl %edi,-136(%ebp) +jge .LC2479 +movl $1,-132(%ebp) +jmp .LC2480 +.LC2479: +movl $0,-132(%ebp) +.LC2480: +cmpl $1,-132(%ebp) +je .LC2475 +addl $4,-120(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2483 +pushl $4 +pushl $s757er.2438 +call printf +addl $8,%esp +.LC2483: +.LC2475: +leal -76(%ebp),%edi +leal -80(%ebp),%esi +cmpl %esi,%edi +jne .LC2485 +addl $8,-120(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2488 +pushl $8 +pushl $s757er.2438 +call printf +addl $8,%esp +.LC2488: +.LC2485: +leal -76(%ebp),%edi +leal -80(%ebp),%esi +cmpl %esi,%edi +jae .LC2490 +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC2493 +pushl $.LC2495 +call printf +addl $4,%esp +.LC2493: +.LC2490: +movl $0,-84(%ebp) +movl $0,-88(%ebp) +.LC2496: +movl -88(%ebp),%edi +leal -80(%ebp),%esi +movl $1,(%esi,%edi,4) +.LC2497: +incl -88(%ebp) +cmpl $16,-88(%ebp) +jl .LC2496 +movl $0,-76(%ebp) +movl $0,-64(%ebp) +movl $0,-56(%ebp) +movl $0,-52(%ebp) +movl $0,-44(%ebp) +movl $0,-28(%ebp) +movl $0,-16(%ebp) +.LC2506: +movl $0,-12(%ebp) +.LC2510: +movl $0,-8(%ebp) +.LC2514: +movl $0,-4(%ebp) +.LC2518: +movl -12(%ebp),%edi +cmpl %edi,-16(%ebp) +jge .LC2529 +movl $1,-144(%ebp) +jmp .LC2530 +.LC2529: +movl $0,-144(%ebp) +.LC2530: +movl -4(%ebp),%edi +cmpl %edi,-8(%ebp) +jge .LC2531 +movl $1,-148(%ebp) +jmp .LC2532 +.LC2531: +movl $0,-148(%ebp) +.LC2532: +movl -148(%ebp),%edi +cmpl %edi,-144(%ebp) +jne .LC2527 +movl $1,-140(%ebp) +jmp .LC2528 +.LC2527: +movl $0,-140(%ebp) +.LC2528: +movl -16(%ebp),%edi +movl -12(%ebp),%esi +leal (,%esi,4),%esi +leal (%esi,%edi,8),%edi +movl -8(%ebp),%esi +leal (,%esi,2),%esi +leal (%esi,%edi),%edi +movl -4(%ebp),%esi +leal (%esi,%edi),%edi +leal -80(%ebp),%esi +movl (%esi,%edi,4),%edi +cmpl %edi,-140(%ebp) +je .LC2522 +movl $1,-84(%ebp) +.LC2522: +.LC2519: +incl -4(%ebp) +cmpl $2,-4(%ebp) +jl .LC2518 +.LC2515: +incl -8(%ebp) +cmpl $2,-8(%ebp) +jl .LC2514 +.LC2511: +incl -12(%ebp) +cmpl $2,-12(%ebp) +jl .LC2510 +.LC2507: +incl -16(%ebp) +cmpl $2,-16(%ebp) +jl .LC2506 +cmpl $0,-84(%ebp) +je .LC2533 +addl $16,-120(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2535 +pushl $16 +pushl $s757er.2438 +call printf +addl $8,%esp +.LC2535: +.LC2533: +movl $0,-128(%ebp) +movl -128(%ebp),%edi +cmpl $0,%edi +je .LC2537 +addl $32,-120(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2539 +pushl $32 +pushl $s757er.2438 +call printf +addl $8,%esp +.LC2539: +.LC2537: +movl -120(%ebp),%eax +.LC2437: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf2541: +.size s757,.Lf2541-s757 +.data +.align 1 +.type fl.2543,@object +fl.2543: +.byte 76 +.byte 111 +.byte 99 +.byte 97 +.byte 108 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 37 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.size fl.2543,17 +.align 1 +.type s7813er.2544,@object +s7813er.2544: +.byte 115 +.byte 55 +.byte 56 +.byte 49 +.byte 51 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s7813er.2544,12 +.align 1 +.type qs7813.2545,@object +.size qs7813.2545,8 +qs7813.2545: +.byte 115 +.byte 55 +.byte 56 +.byte 49 +.byte 51 +.byte 32 +.byte 32 +.byte 0 +.globl s7813 +.text +.align 16 +.type s7813,@function +s7813: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $88,%esp +leal qs7813.2545,%edi +movl %edi,-24(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%esi +movl %esi,-28(%ebp) +movl $0,-8(%ebp) +movl $0,-32(%ebp) +movl 48(%edi),%edi +movl %edi,-4(%ebp) +.LC2546: +.LC2547: +movl -28(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-28(%ebp) +movl -24(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-24(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC2546 +jmp .LC2549 +movl $1,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2551 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2551: +.LC2549: +jmp .LC2553 +movl $2,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2555 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2555: +.LC2553: +jmp .LC2557 +movl $3,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2559 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2559: +.LC2557: +jmp .LC2561 +movl $4,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2563 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2563: +.LC2561: +jmp .LC2565 +movl $5,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2567 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2567: +.LC2565: +jmp .LC2569 +movl $6,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2571 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2571: +.LC2569: +jmp .LC2573 +movl $7,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2575 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2575: +.LC2573: +jmp .LC2577 +movl $8,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2579 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2579: +.LC2577: +jmp .LC2581 +movl $9,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2583 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2583: +.LC2581: +jmp .LC2585 +movl $10,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2587 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2587: +.LC2585: +jmp .LC2589 +movl $11,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2591 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2591: +.LC2589: +jmp .LC2593 +movl $12,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2595 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2595: +.LC2593: +jmp .LC2597 +movl $13,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2599 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2599: +.LC2597: +jmp .LC2601 +movl $14,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2603 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2603: +.LC2601: +jmp .LC2605 +movl $15,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2607 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2607: +.LC2605: +jmp .LC2609 +movl $16,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2611 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2611: +.LC2609: +jmp .LC2613 +movl $17,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2615 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2615: +.LC2613: +jmp .LC2617 +movl $18,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2619 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2619: +.LC2617: +jmp .LC2621 +movl $16,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2623 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2623: +.LC2621: +jmp .LC2625 +movl $20,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2627 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2627: +.LC2625: +jmp .LC2629 +movl $21,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2631 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2631: +.LC2629: +jmp .LC2633 +movl $22,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2635 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2635: +.LC2633: +jmp .LC2637 +movl $23,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2639 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2639: +.LC2637: +jmp .LC2641 +movl $24,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2643 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2643: +.LC2641: +jmp .LC2645 +movl $25,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2647 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2647: +.LC2645: +jmp .LC2649 +movl $26,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2651 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2651: +.LC2649: +jmp .LC2653 +movl $27,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2655 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2655: +.LC2653: +jmp .LC2657 +movl $28,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2659 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2659: +.LC2657: +jmp .LC2661 +movl $26,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2663 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2663: +.LC2661: +jmp .LC2665 +movl $30,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2667 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2667: +.LC2665: +jmp .LC2669 +movl $31,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2671 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2671: +.LC2669: +jmp .LC2673 +movl $32,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2675 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2675: +.LC2673: +jmp .LC2677 +movl $33,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2679 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2679: +.LC2677: +jmp .LC2681 +movl $34,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2683 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2683: +.LC2681: +jmp .LC2685 +movl $35,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2687 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2687: +.LC2685: +jmp .LC2689 +movl $36,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2691 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2691: +.LC2689: +jmp .LC2693 +movl $37,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2695 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2695: +.LC2693: +jmp .LC2697 +movl $38,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2699 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2699: +.LC2697: +jmp .LC2701 +movl $39,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2703 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2703: +.LC2701: +jmp .LC2705 +movl $40,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2707 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2707: +.LC2705: +jmp .LC2709 +movl $41,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2711 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2711: +.LC2709: +jmp .LC2713 +movl $42,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2715 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2715: +.LC2713: +jmp .LC2717 +movl $43,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2719 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2719: +.LC2717: +jmp .LC2721 +movl $44,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2723 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2723: +.LC2721: +jmp .LC2725 +movl $45,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2727 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2727: +.LC2725: +jmp .LC2729 +movl $46,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2731 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2731: +.LC2729: +jmp .LC2733 +movl $47,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2735 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2735: +.LC2733: +jmp .LC2737 +movl $48,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2739 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2739: +.LC2737: +jmp .LC2741 +movl $49,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2743 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2743: +.LC2741: +jmp .LC2745 +movl $50,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2747 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2747: +.LC2745: +jmp .LC2749 +movl $51,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2751 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2751: +.LC2749: +jmp .LC2753 +movl $52,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2755 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2755: +.LC2753: +jmp .LC2757 +movl $53,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2759 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2759: +.LC2757: +jmp .LC2761 +movl $54,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2763 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2763: +.LC2761: +jmp .LC2765 +movl $55,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2767 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2767: +.LC2765: +jmp .LC2769 +movl $56,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2771 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2771: +.LC2769: +jmp .LC2773 +movl $57,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2775 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2775: +.LC2773: +jmp .LC2777 +movl $58,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2779 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2779: +.LC2777: +jmp .LC2781 +movl $56,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2783 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2783: +.LC2781: +jmp .LC2785 +movl $60,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2787 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2787: +.LC2785: +jmp .LC2789 +movl $61,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2791 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2791: +.LC2789: +jmp .LC2793 +movl $62,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2795 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2795: +.LC2793: +jmp .LC2797 +movl $63,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2799 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2799: +.LC2797: +jmp .LC2801 +movl $64,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2803 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2803: +.LC2801: +jmp .LC2805 +movl $65,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2807 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2807: +.LC2805: +jmp .LC2809 +movl $66,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2811 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2811: +.LC2809: +jmp .LC2813 +movl $67,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2815 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2815: +.LC2813: +jmp .LC2817 +movl $68,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2819 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2819: +.LC2817: +jmp .LC2821 +movl $69,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2823 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2823: +.LC2821: +jmp .LC2825 +movl $70,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2827 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2827: +.LC2825: +jmp .LC2829 +movl $71,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2831 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2831: +.LC2829: +jmp .LC2833 +movl $72,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2835 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2835: +.LC2833: +jmp .LC2837 +movl $73,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2839 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2839: +.LC2837: +jmp .LC2841 +movl $74,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2843 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2843: +.LC2841: +jmp .LC2845 +movl $75,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2847 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2847: +.LC2845: +cmpl $0,-8(%ebp) +je .LC2849 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2851 +pushl $1 +pushl $s7813er.2544 +call printf +addl $8,%esp +.LC2851: +incl -32(%ebp) +.LC2849: +movl $0,-8(%ebp) +movl $0,-16(%ebp) +movl $0,-12(%ebp) +movl -12(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-12(%ebp) +cmpl $0,%edi +je .LC2854 +movl -16(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-16(%ebp) +cmpl $0,%edi +je .LC2854 +movl $1,-44(%ebp) +jmp .LC2855 +.LC2854: +movl $0,-44(%ebp) +.LC2855: +movl -44(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $1,-12(%ebp) +je .LC2856 +movl $1,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2858 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2858: +.LC2856: +cmpl $0,-16(%ebp) +je .LC2860 +movl $2,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2862 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2862: +.LC2860: +cmpl $0,-20(%ebp) +je .LC2864 +movl $3,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2866 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2866: +.LC2864: +cmpl $0,-12(%ebp) +je .LC2869 +movl -16(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-16(%ebp) +cmpl $0,%edi +je .LC2869 +movl $1,-48(%ebp) +jmp .LC2870 +.LC2869: +movl $0,-48(%ebp) +.LC2870: +movl -48(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $1,-12(%ebp) +je .LC2871 +movl $4,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2873 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2873: +.LC2871: +cmpl $1,-16(%ebp) +je .LC2875 +movl $5,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2877 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2877: +.LC2875: +cmpl $0,-20(%ebp) +je .LC2879 +movl $6,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2881 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2881: +.LC2879: +movl -12(%ebp),%edi +movl %edi,%esi +subl $1,%esi +movl %esi,-12(%ebp) +cmpl $0,%edi +je .LC2884 +cmpl $0,-16(%ebp) +je .LC2884 +movl $1,-52(%ebp) +jmp .LC2885 +.LC2884: +movl $0,-52(%ebp) +.LC2885: +movl -52(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $0,-12(%ebp) +je .LC2886 +movl $7,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2888 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2888: +.LC2886: +cmpl $1,-16(%ebp) +je .LC2890 +movl $8,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2892 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2892: +.LC2890: +cmpl $1,-20(%ebp) +je .LC2894 +movl $9,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2896 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2896: +.LC2894: +cmpl $0,-12(%ebp) +je .LC2899 +movl -16(%ebp),%edi +movl %edi,%esi +subl $1,%esi +movl %esi,-16(%ebp) +cmpl $0,%edi +je .LC2899 +movl $1,-56(%ebp) +jmp .LC2900 +.LC2899: +movl $0,-56(%ebp) +.LC2900: +movl -56(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $0,-12(%ebp) +je .LC2901 +movl $10,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2903 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2903: +.LC2901: +cmpl $1,-16(%ebp) +je .LC2905 +movl $11,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2907 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2907: +.LC2905: +cmpl $0,-20(%ebp) +je .LC2909 +movl $12,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2911 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2911: +.LC2909: +cmpl $0,-8(%ebp) +je .LC2913 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2915 +pushl $2 +pushl $s7813er.2544 +call printf +addl $8,%esp +.LC2915: +addl $2,-32(%ebp) +.LC2913: +movl $0,-8(%ebp) +movl $0,-16(%ebp) +movl $0,-12(%ebp) +movl -12(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-12(%ebp) +cmpl $0,%edi +jne .LC2920 +cmpl $0,-16(%ebp) +je .LC2918 +.LC2920: +movl $1,-60(%ebp) +jmp .LC2919 +.LC2918: +movl $0,-60(%ebp) +.LC2919: +movl -60(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $1,-12(%ebp) +je .LC2921 +movl $1,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2923 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2923: +.LC2921: +cmpl $0,-16(%ebp) +je .LC2925 +movl $2,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2927 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2927: +.LC2925: +cmpl $0,-20(%ebp) +je .LC2929 +movl $3,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2931 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2931: +.LC2929: +movl -16(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-16(%ebp) +cmpl $0,%edi +jne .LC2936 +cmpl $0,-12(%ebp) +je .LC2934 +.LC2936: +movl $1,-64(%ebp) +jmp .LC2935 +.LC2934: +movl $0,-64(%ebp) +.LC2935: +movl -64(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $1,-12(%ebp) +je .LC2937 +movl $4,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2939 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2939: +.LC2937: +cmpl $1,-16(%ebp) +je .LC2941 +movl $5,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2943 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2943: +.LC2941: +cmpl $1,-20(%ebp) +je .LC2945 +movl $6,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2947 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2947: +.LC2945: +movl -12(%ebp),%edi +movl %edi,%esi +subl $1,%esi +movl %esi,-12(%ebp) +cmpl $0,%edi +jne .LC2952 +movl -16(%ebp),%edi +movl %edi,%esi +subl $1,%esi +movl %esi,-16(%ebp) +cmpl $0,%edi +je .LC2950 +.LC2952: +movl $1,-68(%ebp) +jmp .LC2951 +.LC2950: +movl $0,-68(%ebp) +.LC2951: +movl -68(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $0,-12(%ebp) +je .LC2953 +movl $7,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2955 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2955: +.LC2953: +cmpl $1,-16(%ebp) +je .LC2957 +movl $8,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2959 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2959: +.LC2957: +cmpl $1,-20(%ebp) +je .LC2961 +movl $9,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2963 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2963: +.LC2961: +cmpl $0,-12(%ebp) +jne .LC2968 +movl -16(%ebp),%edi +movl %edi,%esi +subl $1,%esi +movl %esi,-16(%ebp) +cmpl $0,%edi +je .LC2966 +.LC2968: +movl $1,-72(%ebp) +jmp .LC2967 +.LC2966: +movl $0,-72(%ebp) +.LC2967: +movl -72(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $0,-12(%ebp) +je .LC2969 +movl $10,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2971 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2971: +.LC2969: +cmpl $0,-16(%ebp) +je .LC2973 +movl $11,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2975 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2975: +.LC2973: +cmpl $1,-20(%ebp) +je .LC2977 +movl $12,-8(%ebp) +cmpl $0,-4(%ebp) +je .LC2979 +pushl -8(%ebp) +pushl $fl.2543 +call printf +addl $8,%esp +.LC2979: +.LC2977: +cmpl $0,-8(%ebp) +je .LC2981 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2983 +pushl $4 +pushl $s7813er.2544 +call printf +addl $8,%esp +.LC2983: +addl $4,-32(%ebp) +.LC2981: +movl $0,-16(%ebp) +movl $0,-12(%ebp) +movl $0,-36(%ebp) +movl $1,-40(%ebp) +cmpl $0,-40(%ebp) +je .LC2987 +movl -36(%ebp),%edi +movl %edi,-76(%ebp) +jmp .LC2988 +.LC2987: +cmpl $0,-40(%ebp) +je .LC2989 +movl -12(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-12(%ebp) +movl %edi,-80(%ebp) +jmp .LC2990 +.LC2989: +movl -16(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-16(%ebp) +movl %edi,-80(%ebp) +.LC2990: +movl -80(%ebp),%edi +movl %edi,-76(%ebp) +.LC2988: +movl -76(%ebp),%edi +movl %edi,-20(%ebp) +cmpl $0,-20(%ebp) +jne .LC2994 +cmpl $0,-12(%ebp) +jne .LC2994 +cmpl $0,-16(%ebp) +je .LC2991 +.LC2994: +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC2995 +pushl $8 +pushl $s7813er.2544 +call printf +addl $8,%esp +.LC2995: +addl $8,-32(%ebp) +.LC2991: +cmpl $0,-40(%ebp) +je .LC3002 +movl -36(%ebp),%edi +movl %edi,-84(%ebp) +jmp .LC3003 +.LC3002: +movl $1,-84(%ebp) +.LC3003: +cmpl $0,-84(%ebp) +jne .LC3001 +cmpl $0,-36(%ebp) +je .LC3004 +movl $1,-88(%ebp) +jmp .LC3005 +.LC3004: +movl -36(%ebp),%edi +movl %edi,-88(%ebp) +.LC3005: +cmpl $0,-88(%ebp) +je .LC2997 +.LC3001: +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3006 +pushl $16 +pushl $s7813er.2544 +call printf +addl $8,%esp +.LC3006: +addl $16,-32(%ebp) +.LC2997: +movl -32(%ebp),%eax +.LC2542: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3008: +.size s7813,.Lf3008-s7813 +.data +.align 1 +.type s81er.3010,@object +s81er.3010: +.byte 115 +.byte 56 +.byte 49 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s81er.3010,10 +.align 1 +.type qs81.3011,@object +.size qs81.3011,8 +qs81.3011: +.byte 115 +.byte 56 +.byte 49 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.align 1 +.type badtest.3012,@object +badtest.3012: +.byte 82 +.byte 101 +.byte 103 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 117 +.byte 110 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 37 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 117 +.byte 110 +.byte 114 +.byte 101 +.byte 108 +.byte 105 +.byte 97 +.byte 98 +.byte 108 +.byte 101 +.byte 46 +.byte 10 +.byte 0 +.size badtest.3012,38 +.align 1 +.type goodtest.3013,@object +goodtest.3013: +.byte 37 +.byte 100 +.byte 32 +.byte 114 +.byte 101 +.byte 103 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 37 +.byte 115 +.byte 32 +.byte 118 +.byte 97 +.byte 114 +.byte 105 +.byte 97 +.byte 98 +.byte 108 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.size goodtest.3013,40 +.globl s81 +.text +.align 16 +.type s81,@function +s81: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $56,%esp +movl $0,-56(%ebp) +movl $0,-44(%ebp) +movl $0,-48(%ebp) +movl $0,-52(%ebp) +leal qs81.3011,%edi +movl %edi,-36(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-40(%ebp) +.LC3014: +.LC3015: +movl -40(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-40(%ebp) +movl -36(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-36(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC3014 +movl $1,-16(%ebp) +movl $0,-20(%ebp) +.LC3017: +movl -16(%ebp),%edi +movl %edi,%ebx +movb %bl,-4(%ebp) +movb %bl,-24(%ebp) +leal -16(%ebp),%esi +movl %esi,-8(%ebp) +leal -16(%ebp),%esi +movl %esi,-28(%ebp) +movl %edi,-12(%ebp) +movl %edi,-32(%ebp) +movsbl -4(%ebp),%edi +movsbl -24(%ebp),%esi +cmpl %esi,%edi +je .LC3021 +movl $1,-44(%ebp) +.LC3021: +movl -8(%ebp),%edi +movl -28(%ebp),%esi +cmpl %esi,%edi +je .LC3023 +movl $1,-48(%ebp) +.LC3023: +movl -32(%ebp),%edi +cmpl %edi,-12(%ebp) +je .LC3025 +movl $1,-52(%ebp) +.LC3025: +sall $1,-16(%ebp) +.LC3018: +incl -20(%ebp) +cmpl $50,-20(%ebp) +jl .LC3017 +cmpl $0,-44(%ebp) +je .LC3027 +incl -56(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3029 +pushl $1 +pushl $s81er.3010 +call printf +addl $8,%esp +.LC3029: +.LC3027: +cmpl $0,-48(%ebp) +je .LC3031 +addl $2,-56(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3033 +pushl $2 +pushl $s81er.3010 +call printf +addl $8,%esp +.LC3033: +.LC3031: +cmpl $0,-52(%ebp) +je .LC3035 +addl $4,-56(%ebp) +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3037 +pushl $4 +pushl $s81er.3010 +call printf +addl $8,%esp +.LC3037: +.LC3035: +call regc +movl %eax,-16(%ebp) +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC3039 +cmpl $0,-16(%ebp) +jge .LC3041 +pushl $.LC434 +pushl $badtest.3012 +call printf +addl $8,%esp +jmp .LC3042 +.LC3041: +pushl $.LC434 +pushl -16(%ebp) +pushl $goodtest.3013 +call printf +addl $12,%esp +.LC3042: +.LC3039: +call regp +movl %eax,-16(%ebp) +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC3043 +cmpl $0,-16(%ebp) +jge .LC3045 +pushl $.LC3047 +pushl $badtest.3012 +call printf +addl $8,%esp +jmp .LC3046 +.LC3045: +pushl $.LC3047 +pushl -16(%ebp) +pushl $goodtest.3013 +call printf +addl $12,%esp +.LC3046: +.LC3043: +call regi +movl %eax,-16(%ebp) +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC3048 +cmpl $0,-16(%ebp) +jge .LC3050 +pushl $.LC435 +pushl $badtest.3012 +call printf +addl $8,%esp +jmp .LC3051 +.LC3050: +pushl $.LC435 +pushl -16(%ebp) +pushl $goodtest.3013 +call printf +addl $12,%esp +.LC3051: +.LC3048: +movl -56(%ebp),%eax +.LC3009: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3052: +.size s81,.Lf3052-s81 +.globl regc +.align 16 +.type regc,@function +regc: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $264,%esp +movb $0,-252(%ebp) +movb $1,-168(%ebp) +movb $2,-172(%ebp) +movb $3,-176(%ebp) +movb $4,-4(%ebp) +movb $5,-180(%ebp) +movb $6,-8(%ebp) +movb $7,-184(%ebp) +movb $8,-12(%ebp) +movb $9,-188(%ebp) +movb $10,-16(%ebp) +movb $11,-192(%ebp) +movb $12,-20(%ebp) +movb $13,-196(%ebp) +movb $14,-24(%ebp) +movb $15,-200(%ebp) +movb $16,-28(%ebp) +movb $17,-204(%ebp) +movb $18,-32(%ebp) +movb $19,-208(%ebp) +movb $20,-36(%ebp) +movb $21,-212(%ebp) +movb $22,-40(%ebp) +movb $23,-216(%ebp) +movb $24,-44(%ebp) +movb $25,-220(%ebp) +movb $26,-48(%ebp) +movb $27,-224(%ebp) +movb $28,-52(%ebp) +movb $29,-228(%ebp) +movb $30,-56(%ebp) +movb $31,-232(%ebp) +movb $32,-60(%ebp) +movb $33,-236(%ebp) +movb $34,-64(%ebp) +movb $35,-240(%ebp) +movb $36,-244(%ebp) +movb $37,-248(%ebp) +movb $38,-256(%ebp) +leal -168(%ebp),%edi +leal -252(%ebp),%esi +movl %edi,%ebx +subl %esi,%ebx +movl %ebx,%esi +movl %esi,-152(%ebp) +leal -172(%ebp),%esi +subl %edi,%esi +movl %esi,%edi +movl %edi,-148(%ebp) +leal -176(%ebp),%edi +leal -172(%ebp),%esi +subl %esi,%edi +movl %edi,-144(%ebp) +leal -180(%ebp),%edi +leal -176(%ebp),%esi +subl %esi,%edi +movl %edi,-140(%ebp) +leal -184(%ebp),%edi +leal -180(%ebp),%esi +subl %esi,%edi +movl %edi,-136(%ebp) +leal -188(%ebp),%edi +leal -184(%ebp),%esi +subl %esi,%edi +movl %edi,-132(%ebp) +leal -192(%ebp),%edi +leal -188(%ebp),%esi +subl %esi,%edi +movl %edi,-128(%ebp) +leal -196(%ebp),%edi +leal -192(%ebp),%esi +subl %esi,%edi +movl %edi,-124(%ebp) +leal -200(%ebp),%edi +leal -196(%ebp),%esi +subl %esi,%edi +movl %edi,-120(%ebp) +leal -204(%ebp),%edi +leal -200(%ebp),%esi +subl %esi,%edi +movl %edi,-116(%ebp) +leal -208(%ebp),%edi +leal -204(%ebp),%esi +subl %esi,%edi +movl %edi,-112(%ebp) +leal -212(%ebp),%edi +leal -208(%ebp),%esi +subl %esi,%edi +movl %edi,-108(%ebp) +leal -216(%ebp),%edi +leal -212(%ebp),%esi +subl %esi,%edi +movl %edi,-104(%ebp) +leal -220(%ebp),%edi +leal -216(%ebp),%esi +subl %esi,%edi +movl %edi,-100(%ebp) +leal -224(%ebp),%edi +leal -220(%ebp),%esi +subl %esi,%edi +movl %edi,-96(%ebp) +leal -228(%ebp),%edi +leal -224(%ebp),%esi +subl %esi,%edi +movl %edi,-92(%ebp) +leal -232(%ebp),%edi +leal -228(%ebp),%esi +subl %esi,%edi +movl %edi,-88(%ebp) +leal -236(%ebp),%edi +leal -232(%ebp),%esi +subl %esi,%edi +movl %edi,-84(%ebp) +leal -240(%ebp),%edi +leal -236(%ebp),%esi +subl %esi,%edi +movl %edi,-80(%ebp) +leal -244(%ebp),%edi +leal -240(%ebp),%esi +subl %esi,%edi +movl %edi,-76(%ebp) +leal -248(%ebp),%edi +leal -244(%ebp),%esi +subl %esi,%edi +movl %edi,-72(%ebp) +leal -256(%ebp),%edi +leal -248(%ebp),%esi +subl %esi,%edi +movl %edi,-68(%ebp) +movl -152(%ebp),%edi +movl %edi,-164(%ebp) +movl $1,-160(%ebp) +movl $0,-156(%ebp) +.LC3075: +movl -160(%ebp),%edi +cmpl $1,%edi +je .LC3081 +cmpl $2,%edi +je .LC3084 +cmpl $3,%edi +je .LC3089 +jmp .LC3079 +.LC3081: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -164(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +je .LC3080 +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl (%esi,%edi,4),%edi +movl %edi,-264(%ebp) +movl $2,-160(%ebp) +movl $1,-260(%ebp) +jmp .LC3080 +.LC3084: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -164(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +jne .LC3085 +movl $3,-160(%ebp) +jmp .LC3080 +.LC3085: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -264(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +jne .LC3087 +incl -260(%ebp) +jmp .LC3080 +.LC3087: +movl $4,-160(%ebp) +jmp .LC3080 +.LC3089: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -164(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +je .LC3080 +movl $4,-160(%ebp) +.LC3079: +.LC3080: +.LC3076: +incl -156(%ebp) +cmpl $22,-156(%ebp) +jl .LC3075 +cmpl $3,-160(%ebp) +jne .LC3092 +mov $16,%edi +movl %edi,%eax +subl -260(%ebp),%eax +jmp .LC3053 +.LC3092: +mov $-1,%eax +.LC3053: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3094: +.size regc,.Lf3094-regc +.globl regi +.align 16 +.type regi,@function +regi: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $264,%esp +movl $0,-252(%ebp) +movl $1,-168(%ebp) +movl $2,-172(%ebp) +movl $3,-176(%ebp) +movl $4,-4(%ebp) +movl $5,-180(%ebp) +movl $6,-8(%ebp) +movl $7,-184(%ebp) +movl $8,-12(%ebp) +movl $9,-188(%ebp) +movl $10,-16(%ebp) +movl $11,-192(%ebp) +movl $12,-20(%ebp) +movl $13,-196(%ebp) +movl $14,-24(%ebp) +movl $15,-200(%ebp) +movl $16,-28(%ebp) +movl $17,-204(%ebp) +movl $18,-32(%ebp) +movl $19,-208(%ebp) +movl $20,-36(%ebp) +movl $21,-212(%ebp) +movl $22,-40(%ebp) +movl $23,-216(%ebp) +movl $24,-44(%ebp) +movl $25,-220(%ebp) +movl $26,-48(%ebp) +movl $27,-224(%ebp) +movl $28,-52(%ebp) +movl $29,-228(%ebp) +movl $30,-56(%ebp) +movl $31,-232(%ebp) +movl $32,-60(%ebp) +movl $33,-236(%ebp) +movl $34,-64(%ebp) +movl $35,-240(%ebp) +movl $36,-244(%ebp) +movl $37,-248(%ebp) +movl $38,-256(%ebp) +leal -168(%ebp),%edi +mov $4,%esi +leal -252(%ebp),%ebx +movl %edi,%edx +subl %ebx,%edx +movl %edx,%eax +movl %esi,%ecx +cdq +idivl %ecx +movl %eax,-152(%ebp) +leal -172(%ebp),%ebx +subl %edi,%ebx +movl %ebx,%eax +movl %esi,%ecx +cdq +idivl %ecx +movl %eax,-148(%ebp) +leal -176(%ebp),%edi +leal -172(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-144(%ebp) +leal -180(%ebp),%edi +leal -176(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-140(%ebp) +leal -184(%ebp),%edi +leal -180(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-136(%ebp) +leal -188(%ebp),%edi +leal -184(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-132(%ebp) +leal -192(%ebp),%edi +leal -188(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-128(%ebp) +leal -196(%ebp),%edi +leal -192(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-124(%ebp) +leal -200(%ebp),%edi +leal -196(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-120(%ebp) +leal -204(%ebp),%edi +leal -200(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-116(%ebp) +leal -208(%ebp),%edi +leal -204(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-112(%ebp) +leal -212(%ebp),%edi +leal -208(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-108(%ebp) +leal -216(%ebp),%edi +leal -212(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-104(%ebp) +leal -220(%ebp),%edi +leal -216(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-100(%ebp) +leal -224(%ebp),%edi +leal -220(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-96(%ebp) +leal -228(%ebp),%edi +leal -224(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-92(%ebp) +leal -232(%ebp),%edi +leal -228(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-88(%ebp) +leal -236(%ebp),%edi +leal -232(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-84(%ebp) +leal -240(%ebp),%edi +leal -236(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-80(%ebp) +leal -244(%ebp),%edi +leal -240(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-76(%ebp) +leal -248(%ebp),%edi +leal -244(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-72(%ebp) +leal -256(%ebp),%edi +leal -248(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-68(%ebp) +movl -152(%ebp),%edi +movl %edi,-164(%ebp) +movl $1,-160(%ebp) +movl $0,-156(%ebp) +.LC3117: +movl -160(%ebp),%edi +cmpl $1,%edi +je .LC3123 +cmpl $2,%edi +je .LC3126 +cmpl $3,%edi +je .LC3131 +jmp .LC3121 +.LC3123: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -164(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +je .LC3122 +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl (%esi,%edi,4),%edi +movl %edi,-264(%ebp) +movl $2,-160(%ebp) +movl $1,-260(%ebp) +jmp .LC3122 +.LC3126: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -164(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +jne .LC3127 +movl $3,-160(%ebp) +jmp .LC3122 +.LC3127: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -264(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +jne .LC3129 +incl -260(%ebp) +jmp .LC3122 +.LC3129: +movl $4,-160(%ebp) +jmp .LC3122 +.LC3131: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -164(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +je .LC3122 +movl $4,-160(%ebp) +.LC3121: +.LC3122: +.LC3118: +incl -156(%ebp) +cmpl $22,-156(%ebp) +jl .LC3117 +cmpl $3,-160(%ebp) +jne .LC3134 +mov $16,%edi +movl %edi,%eax +subl -260(%ebp),%eax +jmp .LC3095 +.LC3134: +mov $-1,%eax +.LC3095: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3136: +.size regi,.Lf3136-regi +.globl regp +.align 16 +.type regp,@function +regp: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $264,%esp +leal -252(%ebp),%edi +movl %edi,-252(%ebp) +leal -228(%ebp),%edi +movl %edi,-228(%ebp) +leal -232(%ebp),%edi +movl %edi,-232(%ebp) +leal -236(%ebp),%edi +movl %edi,-236(%ebp) +leal -164(%ebp),%edi +movl %edi,-4(%ebp) +leal -164(%ebp),%edi +movl %edi,-164(%ebp) +leal -168(%ebp),%edi +movl %edi,-8(%ebp) +leal -168(%ebp),%edi +movl %edi,-168(%ebp) +leal -172(%ebp),%edi +movl %edi,-12(%ebp) +leal -172(%ebp),%edi +movl %edi,-172(%ebp) +leal -176(%ebp),%edi +movl %edi,-16(%ebp) +leal -176(%ebp),%edi +movl %edi,-176(%ebp) +leal -180(%ebp),%edi +movl %edi,-20(%ebp) +leal -180(%ebp),%edi +movl %edi,-180(%ebp) +leal -184(%ebp),%edi +movl %edi,-24(%ebp) +leal -184(%ebp),%edi +movl %edi,-184(%ebp) +leal -188(%ebp),%edi +movl %edi,-28(%ebp) +leal -188(%ebp),%edi +movl %edi,-188(%ebp) +leal -192(%ebp),%edi +movl %edi,-32(%ebp) +leal -192(%ebp),%edi +movl %edi,-192(%ebp) +leal -196(%ebp),%edi +movl %edi,-36(%ebp) +leal -196(%ebp),%edi +movl %edi,-196(%ebp) +leal -200(%ebp),%edi +movl %edi,-40(%ebp) +leal -200(%ebp),%edi +movl %edi,-200(%ebp) +leal -204(%ebp),%edi +movl %edi,-44(%ebp) +leal -204(%ebp),%edi +movl %edi,-204(%ebp) +leal -208(%ebp),%edi +movl %edi,-48(%ebp) +leal -208(%ebp),%edi +movl %edi,-208(%ebp) +leal -212(%ebp),%edi +movl %edi,-52(%ebp) +leal -212(%ebp),%edi +movl %edi,-212(%ebp) +leal -216(%ebp),%edi +movl %edi,-56(%ebp) +leal -216(%ebp),%edi +movl %edi,-216(%ebp) +leal -220(%ebp),%edi +movl %edi,-60(%ebp) +leal -220(%ebp),%edi +movl %edi,-220(%ebp) +leal -224(%ebp),%edi +movl %edi,-64(%ebp) +leal -224(%ebp),%edi +movl %edi,-224(%ebp) +leal -240(%ebp),%edi +movl %edi,-240(%ebp) +leal -244(%ebp),%edi +movl %edi,-244(%ebp) +leal -256(%ebp),%edi +movl %edi,-256(%ebp) +leal -228(%ebp),%edi +mov $4,%esi +leal -252(%ebp),%ebx +movl %edi,%edx +subl %ebx,%edx +movl %edx,%eax +movl %esi,%ecx +cdq +idivl %ecx +movl %eax,-152(%ebp) +leal -232(%ebp),%ebx +subl %edi,%ebx +movl %ebx,%eax +movl %esi,%ecx +cdq +idivl %ecx +movl %eax,-148(%ebp) +leal -236(%ebp),%edi +leal -232(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-144(%ebp) +leal -164(%ebp),%edi +leal -236(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-140(%ebp) +leal -168(%ebp),%edi +leal -164(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-136(%ebp) +leal -172(%ebp),%edi +leal -168(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-132(%ebp) +leal -176(%ebp),%edi +leal -172(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-128(%ebp) +leal -180(%ebp),%edi +leal -176(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-124(%ebp) +leal -184(%ebp),%edi +leal -180(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-120(%ebp) +leal -188(%ebp),%edi +leal -184(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-116(%ebp) +leal -192(%ebp),%edi +leal -188(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-112(%ebp) +leal -196(%ebp),%edi +leal -192(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-108(%ebp) +leal -200(%ebp),%edi +leal -196(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-104(%ebp) +leal -204(%ebp),%edi +leal -200(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-100(%ebp) +leal -208(%ebp),%edi +leal -204(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-96(%ebp) +leal -212(%ebp),%edi +leal -208(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-92(%ebp) +leal -216(%ebp),%edi +leal -212(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-88(%ebp) +leal -220(%ebp),%edi +leal -216(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-84(%ebp) +leal -224(%ebp),%edi +leal -220(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-80(%ebp) +leal -240(%ebp),%edi +leal -224(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-76(%ebp) +leal -244(%ebp),%edi +leal -240(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-72(%ebp) +leal -256(%ebp),%edi +leal -244(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $4,%ecx +cdq +idivl %ecx +movl %eax,-68(%ebp) +movl -152(%ebp),%edi +movl %edi,-248(%ebp) +movl $1,-160(%ebp) +movl $0,-156(%ebp) +.LC3159: +movl -160(%ebp),%edi +cmpl $1,%edi +je .LC3165 +cmpl $2,%edi +je .LC3168 +cmpl $3,%edi +je .LC3173 +jmp .LC3163 +.LC3165: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -248(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +je .LC3164 +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl (%esi,%edi,4),%edi +movl %edi,-264(%ebp) +movl $2,-160(%ebp) +movl $1,-260(%ebp) +jmp .LC3164 +.LC3168: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -248(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +jne .LC3169 +movl $3,-160(%ebp) +jmp .LC3164 +.LC3169: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -264(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +jne .LC3171 +incl -260(%ebp) +jmp .LC3164 +.LC3171: +movl $4,-160(%ebp) +jmp .LC3164 +.LC3173: +movl -156(%ebp),%edi +leal -152(%ebp),%esi +movl -248(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +je .LC3164 +movl $4,-160(%ebp) +.LC3163: +.LC3164: +.LC3160: +incl -156(%ebp) +cmpl $22,-156(%ebp) +jl .LC3159 +cmpl $3,-160(%ebp) +jne .LC3176 +mov $16,%edi +movl %edi,%eax +subl -260(%ebp),%eax +jmp .LC3137 +.LC3176: +mov $-1,%eax +.LC3137: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3178: +.size regp,.Lf3178-regp +.bss +.align 4 +.type x3d.3180,@object +.size x3d.3180,420 +.lcomm x3d.3180,420 +.data +.align 1 +.type s84er.3181,@object +s84er.3181: +.byte 115 +.byte 56 +.byte 52 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s84er.3181,10 +.align 1 +.type qs84.3182,@object +.size qs84.3182,8 +qs84.3182: +.byte 115 +.byte 56 +.byte 52 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s84 +.text +.align 16 +.type s84,@function +s84: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $172,%esp +leal qs84.3182,%edi +movl %edi,-156(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-160(%ebp) +movl $0,-164(%ebp) +.LC3183: +.LC3184: +movl -160(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-160(%ebp) +movl -156(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-156(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC3183 +pushl $3 +call fip +addl $4,%esp +movl %eax,-168(%ebp) +movl -168(%ebp),%edi +cmpl $3,(,%edi) +je .LC3186 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3188 +pushl $1 +pushl $s84er.3181 +call printf +addl $8,%esp +.LC3188: +incl -164(%ebp) +.LC3186: +leal glork,%edi +movl %edi,-172(%ebp) +pushl $4 +call *-172(%ebp) +addl $4,%esp +cmpl $4,%eax +je .LC3190 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3192 +pushl $2 +pushl $s84er.3181 +call printf +addl $8,%esp +.LC3192: +addl $2,-164(%ebp) +.LC3190: +movl $0,-8(%ebp) +.LC3194: +movl -8(%ebp),%edi +leal -80(%ebp),%esi +pushl %edi +fildl (%esp) +addl $4,%esp +fstps (%esi,%edi,4) +movl -8(%ebp),%edi +leal (,%edi,4),%edi +leal -148(%ebp),%esi +leal -80(%ebp),%ebx +leal (%ebx,%edi),%ebx +movl %ebx,(%esi,%edi) +.LC3195: +incl -8(%ebp) +cmpl $17,-8(%ebp) +jl .LC3194 +flds .LC421 +fstps -152(%ebp) +movl $0,-8(%ebp) +.LC3198: +flds -152(%ebp) +movl -8(%ebp),%edi +leal -148(%ebp),%esi +movl (%esi,%edi,4),%edi +fadds (,%edi) +fstps -152(%ebp) +.LC3199: +incl -8(%ebp) +cmpl $17,-8(%ebp) +jl .LC3198 +flds .LC3204 +fcomps -152(%ebp) +fstsw %ax +sahf +jp 1f +je .LC3202 +1: +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3205 +pushl $4 +pushl $s84er.3181 +call printf +addl $8,%esp +.LC3205: +addl $4,-164(%ebp) +.LC3202: +movl $0,-12(%ebp) +.LC3207: +movl $0,-8(%ebp) +.LC3211: +movl $0,-4(%ebp) +.LC3215: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +movl -12(%ebp),%ebx +imul $28,%esi,%edx +imul $140,%ebx,%ecx +leal x3d.3180(%ecx),%ecx +leal (%ecx,%edx),%edx +imul $35,%ebx,%ebx +imul $7,%esi,%esi +leal (%esi,%ebx),%esi +leal (%edi,%esi),%esi +movl %esi,(%edx,%edi,4) +.LC3216: +incl -4(%ebp) +cmpl $7,-4(%ebp) +jl .LC3215 +.LC3212: +incl -8(%ebp) +cmpl $5,-8(%ebp) +jl .LC3211 +.LC3208: +incl -12(%ebp) +cmpl $3,-12(%ebp) +jl .LC3207 +movl $1,-12(%ebp) +movl $2,-8(%ebp) +movl $3,-4(%ebp) +pushl $0 +pushl $105 +pushl $x3d.3180 +call array +addl $12,%esp +movl %eax,%edi +pushl $35 +pushl $35 +imul $140,-12(%ebp),%esi +leal x3d.3180(%esi),%esi +pushl %esi +call array +addl $12,%esp +movl %eax,%esi +pushl $49 +pushl $7 +imul $28,-8(%ebp),%ebx +imul $140,-12(%ebp),%edx +leal x3d.3180(%edx),%edx +leal (%edx,%ebx),%ebx +pushl %ebx +call array +addl $12,%esp +leal (%esi,%edi),%edi +leal (%eax,%edi),%edi +movl -4(%ebp),%esi +imul $28,-8(%ebp),%ebx +imul $140,-12(%ebp),%edx +leal x3d.3180(%edx),%edx +leal (%edx,%ebx),%ebx +movl (%ebx,%esi,4),%esi +leal (%esi,%edi),%edi +subl $52,%edi +cmpl $0,%edi +je .LC3219 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3221 +pushl $8 +pushl $s84er.3181 +call printf +addl $8,%esp +.LC3221: +addl $8,-164(%ebp) +.LC3219: +movl -164(%ebp),%eax +.LC3179: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3223: +.size s84,.Lf3223-s84 +.globl array +.align 16 +.type array,@function +array: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $0,-4(%ebp) +jmp .LC3228 +.LC3225: +movl -4(%ebp),%edi +movl 20(%ebp),%esi +movl 28(%ebp),%ebx +leal (%ebx,%edi),%ebx +cmpl %ebx,(%esi,%edi,4) +je .LC3229 +mov $1,%eax +jmp .LC3224 +.LC3229: +.LC3226: +incl -4(%ebp) +.LC3228: +movl 24(%ebp),%edi +cmpl %edi,-4(%ebp) +jl .LC3225 +mov $0,%eax +.LC3224: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3231: +.size array,.Lf3231-array +.bss +.align 4 +.type y.3233,@object +.size y.3233,4 +.lcomm y.3233,4 +.globl fip +.text +.align 16 +.type fip,@function +fip: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +leal y.3233,%edi +movl 20(%ebp),%esi +movl %esi,y.3233 +movl %edi,%eax +.LC3232: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3234: +.size fip,.Lf3234-fip +.globl glork +.align 16 +.type glork,@function +glork: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 20(%ebp),%eax +.LC3235: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3236: +.size glork,.Lf3236-glork +.data +.align 1 +.type s85er.3238,@object +s85er.3238: +.byte 115 +.byte 56 +.byte 53 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s85er.3238,10 +.align 1 +.type qs85.3239,@object +.size qs85.3239,8 +qs85.3239: +.byte 115 +.byte 56 +.byte 53 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.align 4 +.type type.3247,@object +type.3247: +.long .LC434 +.long .LC436 +.long .LC435 +.long .LC437 +.long .LC438 +.long .LC439 +.long .LC440 +.size type.3247,28 +.align 1 +.type aln.3248,@object +aln.3248: +.byte 32 +.byte 97 +.byte 108 +.byte 105 +.byte 103 +.byte 110 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 58 +.byte 32 +.byte 0 +.size aln.3248,13 +.globl s85 +.text +.align 16 +.type s85,@function +s85: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $404,%esp +leal qs85.3239,%edi +movl %edi,-276(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-280(%ebp) +movl $0,-320(%ebp) +.LC3252: +.LC3253: +movl -280(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-280(%ebp) +movl -276(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-276(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC3252 +leal -296(%ebp),%edi +leal -316(%ebp),%esi +subl %esi,%edi +cmpl $0,%edi +jle .LC3263 +leal -292(%ebp),%edi +leal -296(%ebp),%esi +subl %esi,%edi +cmpl $0,%edi +jle .LC3263 +leal -288(%ebp),%edi +leal -292(%ebp),%esi +subl %esi,%edi +cmpl $0,%edi +jg .LC3255 +.LC3263: +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3264 +pushl $1 +pushl $s85er.3238 +call printf +addl $8,%esp +.LC3264: +incl -320(%ebp) +.LC3255: +leal -355(%ebp),%edi +leal -356(%ebp),%esi +subl %esi,%edi +movl %edi,-272(%ebp) +leal -358(%ebp),%edi +leal -360(%ebp),%esi +subl %esi,%edi +movl %edi,-268(%ebp) +leal -364(%ebp),%edi +leal -368(%ebp),%esi +subl %esi,%edi +movl %edi,-264(%ebp) +leal -372(%ebp),%edi +leal -376(%ebp),%esi +subl %esi,%edi +movl %edi,-260(%ebp) +leal -380(%ebp),%edi +leal -384(%ebp),%esi +subl %esi,%edi +movl %edi,-256(%ebp) +leal -388(%ebp),%edi +leal -392(%ebp),%esi +subl %esi,%edi +movl %edi,-252(%ebp) +leal -400(%ebp),%edi +leal -404(%ebp),%esi +subl %esi,%edi +movl %edi,-248(%ebp) +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC3279 +movl $0,-244(%ebp) +.LC3281: +movl -244(%ebp),%edi +leal (,%edi,4),%edi +leal -272(%ebp),%esi +pushl (%esi,%edi) +pushl $aln.3248 +pushl type.3247(%edi) +pushl $.LC3285 +call printf +addl $16,%esp +.LC3282: +incl -244(%ebp) +cmpl $7,-244(%ebp) +jl .LC3281 +.LC3279: +movl -284(%ebp),%edi +orl $56,%edi +movl %edi,-284(%ebp) +movl -284(%ebp),%edi +movl %edi,%esi +andl $0xfffffffc,%esi +sall $26,%edi +sarl $29,%edi +sall $30,%edi +sarl $30,%edi +andl $3,%edi +orl %edi,%esi +movl %esi,-284(%ebp) +movl -284(%ebp),%edi +movl %edi,%esi +andl $0xffffffc7,%esi +sall $30,%edi +sarl $30,%edi +sall $29,%edi +sarl $29,%edi +leal (,%edi,8),%edi +andl $56,%edi +orl %edi,%esi +movl %esi,-284(%ebp) +movl -284(%ebp),%edi +sall $26,%edi +sarl $29,%edi +cmpl $3,%edi +je .LC3286 +movl -284(%ebp),%edi +sall $26,%edi +sarl $29,%edi +cmpl $-1,%edi +jne .LC3288 +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC3289 +pushl $.LC3292 +call printf +addl $4,%esp +jmp .LC3289 +.LC3288: +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3293 +pushl $2 +pushl $s85er.3238 +call printf +addl $8,%esp +.LC3293: +addl $2,-320(%ebp) +.LC3289: +.LC3286: +movl -284(%ebp),%edi +orl $64,%edi +movl %edi,-284(%ebp) +movl -284(%ebp),%edi +sall $25,%edi +sarl $31,%edi +cmpl $1,%edi +je .LC3295 +movl 20(%ebp),%edi +cmpl $0,40(%edi) +je .LC3297 +pushl $.LC3299 +call printf +addl $4,%esp +.LC3297: +.LC3295: +leal -240(%ebp),%edi +movl %edi,%esi +subl %edi,%esi +cmpl $0,%esi +jne .LC3307 +cmpl $0,%esi +jne .LC3307 +cmpl $0,%esi +jne .LC3307 +cmpl $0,%esi +jne .LC3307 +cmpl $0,%esi +jne .LC3307 +cmpl $0,%esi +jne .LC3307 +cmpl $0,%esi +je .LC3300 +.LC3307: +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3308 +pushl $4 +pushl $s85er.3238 +call printf +addl $8,%esp +.LC3308: +addl $4,-320(%ebp) +.LC3300: +jmp .LC3310 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3312 +pushl $8 +pushl $s85er.3238 +call printf +addl $8,%esp +.LC3312: +addl $8,-320(%ebp) +.LC3310: +leal -352(%ebp),%edi +movl %edi,-288(%ebp) +movb $2,-352(%ebp) +movl -288(%ebp),%edi +movsbl (,%edi),%esi +leal 1(%esi),%esi +movl %esi,%ebx +movb %bl,(,%edi) +movsbl -352(%ebp),%edi +cmpl $3,%edi +je .LC3316 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3318 +pushl $16 +pushl $s85er.3238 +call printf +addl $8,%esp +.LC3318: +addl $16,-320(%ebp) +.LC3316: +movl -320(%ebp),%eax +.LC3237: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3320: +.size s85,.Lf3320-s85 +.data +.align 1 +.type s86er.3322,@object +s86er.3322: +.byte 115 +.byte 56 +.byte 54 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s86er.3322,10 +.align 1 +.type qs86.3323,@object +.size qs86.3323,8 +qs86.3323: +.byte 115 +.byte 56 +.byte 54 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.align 4 +.type x.3324,@object +x.3324: +.long 1 +.long 3 +.long 5 +.size x.3324,12 +.align 4 +.type pint.3325,@object +.size pint.3325,4 +pint.3325: +.long x.3324+8 +.bss +.align 4 +.type zero.3327,@object +.size zero.3327,40 +.lcomm zero.3327,40 +.data +.align 4 +.type y0.3328,@object +y0.3328: +.long 1065353216 +.long 1077936128 +.long 1084227584 +.long 1073741824 +.long 1082130432 +.long 1086324736 +.long 1077936128 +.long 1084227584 +.long 1088421888 +.long 0 +.long 0 +.long 0 +.size y0.3328,48 +.align 4 +.type y1.3329,@object +.size y1.3329,48 +y1.3329: +.long 1065353216 +.long 1077936128 +.long 1084227584 +.long 1073741824 +.long 1082130432 +.long 1086324736 +.long 1077936128 +.long 1084227584 +.long 1088421888 +.space 12 +.align 4 +.type y2.3330,@object +.size y2.3330,48 +y2.3330: +.long 1065353216 +.long 1077936128 +.long 1084227584 +.long 1073741824 +.long 1082130432 +.long 1086324736 +.long 1077936128 +.long 1084227584 +.long 1088421888 +.space 12 +.align 4 +.type y3.3331,@object +.size y3.3331,48 +y3.3331: +.long 1065353216 +.space 8 +.long 1073741824 +.space 8 +.long 1077936128 +.space 8 +.long 1082130432 +.space 8 +.globl s86 +.text +.align 16 +.type s86,@function +s86: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $40,%esp +movl pint.3325,%edi +leal -4(%edi),%edi +movl %edi,-36(%ebp) +call one +movl -36(%ebp),%esi +leal (%esi,%eax,4),%edi +movl %edi,-4(%ebp) +leal qs86.3323,%edi +movl %edi,-24(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-28(%ebp) +movl $0,-32(%ebp) +.LC3332: +.LC3333: +movl -28(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-28(%ebp) +movl -24(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-24(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC3332 +movl pint.3325,%edi +cmpl $5,(,%edi) +je .LC3335 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3337 +pushl $1 +pushl $s86er.3322 +call printf +addl $8,%esp +.LC3337: +incl -32(%ebp) +.LC3335: +movl -36(%ebp),%edi +cmpl $3,(,%edi) +je .LC3339 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3341 +pushl $2 +pushl $s86er.3322 +call printf +addl $8,%esp +.LC3341: +addl $2,-32(%ebp) +.LC3339: +movl -4(%ebp),%edi +cmpl $5,(,%edi) +je .LC3343 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3345 +pushl $4 +pushl $s86er.3322 +call printf +addl $8,%esp +.LC3345: +addl $4,-32(%ebp) +.LC3343: +movl $0,-20(%ebp) +movl $0,-8(%ebp) +.LC3347: +movl -8(%ebp),%edi +cmpl $0,zero.3327(,%edi,4) +je .LC3351 +movl $1,-20(%ebp) +.LC3351: +.LC3348: +incl -8(%ebp) +cmpl $10,-8(%ebp) +jl .LC3347 +cmpl $0,-20(%ebp) +je .LC3353 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3355 +pushl $8 +pushl $s86er.3322 +call printf +addl $8,%esp +.LC3355: +addl $8,-32(%ebp) +.LC3353: +movl $0,-20(%ebp) +movl $0,-12(%ebp) +.LC3357: +movl $0,-8(%ebp) +.LC3361: +imul $3,-12(%ebp),%edi +movl -8(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,-16(%ebp) +movl -8(%ebp),%edi +leal (,%edi,4),%edi +imul $12,-12(%ebp),%esi +leal y1.3329(%esi),%ebx +flds (%ebx,%edi) +fstps -40(%ebp) +leal y2.3330(%esi),%esi +flds (%esi,%edi) +fcomps -40(%ebp) +fstsw %ax +sahf +jp .LC3367 +jne .LC3367 +movl -16(%ebp),%edi +flds y0.3328(,%edi,4) +fcomps -40(%ebp) +fstsw %ax +sahf +jp 1f +je .LC3365 +1: +.LC3367: +movl $1,-20(%ebp) +.LC3365: +.LC3362: +incl -8(%ebp) +cmpl $3,-8(%ebp) +jl .LC3361 +.LC3358: +incl -12(%ebp) +cmpl $4,-12(%ebp) +jl .LC3357 +cmpl $0,-20(%ebp) +je .LC3368 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3370 +pushl $16 +pushl $s86er.3322 +call printf +addl $8,%esp +.LC3370: +addl $16,-32(%ebp) +.LC3368: +movl $0,-20(%ebp) +movl $0,-8(%ebp) +.LC3372: +movl -8(%ebp),%edi +imul $12,%edi,%esi +leal 1(%edi),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fcomps y3.3331(%esi) +fstsw %ax +sahf +jp 1f +je .LC3376 +1: +movl $1,-20(%ebp) +.LC3376: +.LC3373: +incl -8(%ebp) +cmpl $4,-8(%ebp) +jl .LC3372 +cmpl $0,-20(%ebp) +je .LC3378 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3380 +pushl $32 +pushl $s86er.3322 +call printf +addl $8,%esp +.LC3380: +addl $32,-32(%ebp) +.LC3378: +movl -32(%ebp),%eax +.LC3321: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3382: +.size s86,.Lf3382-s86 +.globl one +.align 16 +.type one,@function +one: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +mov $1,%eax +.LC3383: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3384: +.size one,.Lf3384-one +.data +.align 1 +.type s88er.3386,@object +s88er.3386: +.byte 115 +.byte 56 +.byte 56 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s88er.3386,10 +.align 1 +.type qs88.3387,@object +.size qs88.3387,8 +qs88.3387: +.byte 115 +.byte 56 +.byte 56 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s88 +.text +.align 16 +.type s88,@function +s88: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $44,%esp +leal qs88.3387,%edi +movl %edi,-4(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-8(%ebp) +movl $0,-12(%ebp) +.LC3389: +.LC3390: +movl -8(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-8(%ebp) +movl -4(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-4(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC3389 +jmp .LC3392 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3394 +pushl $1 +pushl $s88er.3386 +call printf +addl $8,%esp +.LC3394: +incl -12(%ebp) +.LC3392: +leal -32(%ebp),%edi +movl %edi,metricp +movl $2,-32(%ebp) +movl metricp,%edi +movl $3,(,%edi) +cmpl $3,-32(%ebp) +je .LC3396 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3398 +pushl $2 +pushl $s88er.3386 +call printf +addl $8,%esp +.LC3398: +addl $2,-12(%ebp) +.LC3396: +fldl .LC428 +fstpl -28(%ebp) +fldl .LC428 +fstpl -20(%ebp) +leal -28(%ebp),%edi +movl %edi,-36(%ebp) +movl -36(%ebp),%edi +fldl .LC427 +fstpl (,%edi) +movl -36(%ebp),%edi +fldl .LC427 +fstpl 8(%edi) +fldl -28(%ebp) +faddl -20(%ebp) +fldl .LC425 +fcompp +fstsw %ax +sahf +jp 1f +je .LC3401 +1: +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3404 +pushl $4 +pushl $s88er.3386 +call printf +addl $8,%esp +.LC3404: +addl $4,-12(%ebp) +.LC3401: +movl -12(%ebp),%eax +.LC3385: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3406: +.size s88,.Lf3406-s88 +.data +.align 1 +.type s9er.3408,@object +s9er.3408: +.byte 115 +.byte 57 +.byte 44 +.byte 101 +.byte 114 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.size s9er.3408,9 +.align 1 +.type qs9.3409,@object +.size qs9.3409,8 +qs9.3409: +.byte 115 +.byte 57 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 0 +.globl s9 +.text +.align 16 +.type s9,@function +s9: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $36,%esp +leal qs9.3409,%edi +movl %edi,-12(%ebp) +movl 20(%ebp),%edi +leal 60(%edi),%edi +movl %edi,-16(%ebp) +movl $0,-20(%ebp) +.LC3410: +.LC3411: +movl -16(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-16(%ebp) +movl -12(%ebp),%esi +leal 1(%esi),%ebx +movl %ebx,-12(%ebp) +movb (,%esi),%bl +movb %bl,(,%edi) +movsbl %bl,%edi +cmpl $0,%edi +jne .LC3410 +movl $0,-8(%ebp) +movl $0,-4(%ebp) +.LC3413: +movl $2,-24(%ebp) +movl $2,-28(%ebp) +movl $3,-32(%ebp) +movl $3,-36(%ebp) +cmpl $3,-36(%ebp) +jne .LC3419 +cmpl $3,-32(%ebp) +je .LC3417 +.LC3419: +movl $1,-8(%ebp) +.LC3417: +cmpl $2,-28(%ebp) +jne .LC3422 +cmpl $2,-24(%ebp) +je .LC3420 +.LC3422: +movl $1,-8(%ebp) +.LC3420: +.LC3414: +incl -4(%ebp) +cmpl $2,-4(%ebp) +jl .LC3413 +cmpl $0,-8(%ebp) +je .LC3427 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3425 +pushl $1 +pushl $s9er.3408 +call printf +addl $8,%esp +.LC3425: +incl -20(%ebp) +jmp .LC3427 +movl 20(%ebp),%edi +cmpl $0,44(%edi) +je .LC3428 +pushl $2 +pushl $s9er.3408 +call printf +addl $8,%esp +.LC3428: +addl $2,-20(%ebp) +.LC3427: +movl -20(%ebp),%eax +.LC3407: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3430: +.size s9,.Lf3430-s9 +.globl setev +.align 16 +.type setev,@function +setev: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl $1066,extvar +mov $0,%eax +.LC3431: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3432: +.size setev,.Lf3432-setev +.bss +.globl rfs +.align 1 +.type rfs,@object +.size rfs,8 +.comm rfs,8 +.globl crc +.align 4 +.type crc,@object +.size crc,4 +.comm crc,4 +.globl rrc +.align 4 +.type rrc,@object +.size rrc,4 +.comm rrc,4 +.globl flgl +.align 4 +.type flgl,@object +.size flgl,4 +.comm flgl,4 +.globl flgd +.align 4 +.type flgd,@object +.size flgd,4 +.comm flgd,4 +.globl flgm +.align 4 +.type flgm,@object +.size flgm,4 +.comm flgm,4 +.globl flgs +.align 4 +.type flgs,@object +.size flgs,4 +.comm flgs,4 +.globl dprec +.align 4 +.type dprec,@object +.size dprec,4 +.comm dprec,4 +.globl fprec +.align 4 +.type fprec,@object +.size fprec,4 +.comm fprec,4 +.globl dbits +.align 4 +.type dbits,@object +.size dbits,4 +.comm dbits,4 +.globl fbits +.align 4 +.type fbits,@object +.size fbits,4 +.comm fbits,4 +.globl ubits +.align 4 +.type ubits,@object +.size ubits,4 +.comm ubits,4 +.globl lbits +.align 4 +.type lbits,@object +.size lbits,4 +.comm lbits,4 +.globl metricp +.align 4 +.type metricp,@object +.size metricp,4 +.comm metricp,4 +.globl extvar +.align 4 +.type extvar,@object +.size extvar,4 +.comm extvar,4 +.data +.align 1 +.LC3299: +.byte 66 +.byte 101 +.byte 32 +.byte 101 +.byte 115 +.byte 112 +.byte 101 +.byte 99 +.byte 105 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 32 +.byte 99 +.byte 97 +.byte 114 +.byte 101 +.byte 102 +.byte 117 +.byte 108 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 49 +.byte 45 +.byte 98 +.byte 105 +.byte 116 +.byte 32 +.byte 102 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC3292: +.byte 83 +.byte 105 +.byte 103 +.byte 110 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 101 +.byte 110 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 102 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC3285: +.byte 37 +.byte 115 +.byte 37 +.byte 115 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 4 +.LC3204: +.long 1124597760 +.align 1 +.LC3047: +.byte 112 +.byte 111 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 0 +.align 1 +.LC2495: +.byte 73 +.byte 110 +.byte 99 +.byte 114 +.byte 101 +.byte 97 +.byte 115 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 97 +.byte 114 +.byte 114 +.byte 97 +.byte 121 +.byte 32 +.byte 101 +.byte 108 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 100 +.byte 101 +.byte 99 +.byte 114 +.byte 101 +.byte 97 +.byte 115 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 108 +.byte 111 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 10 +.byte 0 +.align 4 +.LC2378: +.long 1104150528 +.align 4 +.LC2377: +.long 0 +.long 1077542912 +.align 4 +.LC1678: +.long 0 +.long 1074003968 +.align 4 +.LC1503: +.long 0 +.long 1076101120 +.align 4 +.LC1474: +.long 1092616192 +.align 4 +.LC1299: +.long 0 +.long 1074266112 +.align 4 +.LC1270: +.long 1077936128 +.align 4 +.LC1095: +.long 0 +.long 1075576832 +.align 4 +.LC1066: +.long 1088421888 +.align 4 +.LC889: +.long 0 +.long 1075052544 +.align 4 +.LC860: +.long 1084227584 +.align 4 +.LC855: +.long 0 +.long 1105199104 +.align 4 +.LC847: +.long 1325400064 +.align 1 +.LC669: +.byte 113 +.byte 117 +.byte 101 +.byte 101 +.byte 112 +.byte 0 +.align 1 +.LC654: +.byte 10 +.byte 0 +.align 1 +.LC653: +.byte 37 +.byte 100 +.byte 0 +.align 1 +.LC648: +.byte 32 +.byte 32 +.byte 32 +.byte 107 +.byte 101 +.byte 121 +.byte 61 +.byte 0 +.align 4 +.LC611: +.long 0 +.long 1073741824 +.align 4 +.LC551: +.long 0 +.long 1087276160 +.align 4 +.LC550: +.long 0 +.long 1079984128 +.align 4 +.LC549: +.long 1123680256 +.align 4 +.LC544: +.long 1073741824 +.align 1 +.LC440: +.byte 100 +.byte 111 +.byte 117 +.byte 98 +.byte 108 +.byte 101 +.byte 0 +.align 1 +.LC439: +.byte 102 +.byte 108 +.byte 111 +.byte 97 +.byte 116 +.byte 0 +.align 1 +.LC438: +.byte 117 +.byte 110 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 101 +.byte 100 +.byte 0 +.align 1 +.LC437: +.byte 108 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 1 +.LC436: +.byte 115 +.byte 104 +.byte 111 +.byte 114 +.byte 116 +.byte 0 +.align 1 +.LC435: +.byte 105 +.byte 110 +.byte 116 +.byte 0 +.align 1 +.LC434: +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 0 +.align 4 +.LC428: +.long 0 +.long 0 +.align 4 +.LC427: +.long 0 +.long 1072693248 +.align 4 +.LC426: +.long 0 +.long 1074790400 +.align 4 +.LC425: +.long 0 +.long 1073741824 +.align 4 +.LC421: +.long 0 +.align 4 +.LC420: +.long 1065353216 +.align 1 +.LC398: +.byte 113 +.byte 117 +.byte 101 +.byte 101 +.byte 112 +.byte 33 +.byte 0 +.align 1 +.LC387: +.byte 10 +.byte 9 +.byte 8 +.byte 13 +.byte 12 +.byte 92 +.byte 39 +.byte 0 +.align 1 +.LC383: +.byte 46 +.byte 34 +.byte 46 +.byte 0 +.align 1 +.LC370: +.byte 46 +.byte 46 +.byte 46 +.byte 0 +.align 4 +.LC340: +.long 0 +.long 1083410432 +.align 1 +.LC201: +.byte 32 +.byte 32 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 114 +.byte 101 +.byte 115 +.byte 117 +.byte 108 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 97 +.byte 115 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 108 +.byte 111 +.byte 110 +.byte 103 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC200: +.byte 68 +.byte 101 +.byte 99 +.byte 105 +.byte 109 +.byte 97 +.byte 108 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 111 +.byte 99 +.byte 116 +.byte 97 +.byte 108 +.byte 47 +.byte 104 +.byte 101 +.byte 120 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 115 +.byte 116 +.byte 97 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 115 +.byte 111 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 109 +.byte 101 +.byte 115 +.byte 32 +.byte 103 +.byte 105 +.byte 118 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC27: +.byte 10 +.byte 70 +.byte 97 +.byte 105 +.byte 108 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC26: +.byte 10 +.byte 78 +.byte 111 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 115 +.byte 32 +.byte 100 +.byte 101 +.byte 116 +.byte 101 +.byte 99 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC20: +.byte 83 +.byte 101 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 37 +.byte 115 +.byte 32 +.byte 114 +.byte 101 +.byte 116 +.byte 117 +.byte 114 +.byte 110 +.byte 101 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/cvt.1bk b/src/cmd/lccom-1/tst/x86-linux/cvt.1bk new file mode 100644 index 0000000..b28b302 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/cvt.1bk @@ -0,0 +1,11 @@ +1 1 1 1 1 1 1 1 1.000000 1.000000 1.000000 +2 2 2 2 2 2 2 2 2.000000 2.000000 2.000000 +3 3 3 3 3 3 3 3 3.000000 3.000000 3.000000 +4 4 4 4 4 4 4 4 4.000000 4.000000 4.000000 +5 5 5 5 5 5 5 5 5.000000 5.000000 5.000000 +6 6 6 6 6 6 6 6 6.000000 6.000000 6.000000 +7 7 7 7 7 7 7 7 7.000000 7.000000 7.000000 +8 8 8 8 8 8 8 8 8.000000 8.000000 8.000000 +9 9 9 9 9 9 9 9 9.000000 9.000000 9.000000 +10 10 10 10 10 10 10 10 10.000000 10.000000 10.000000 +11 11 11 11 11 11 11 11 11.000000 11.000000 11.000000 diff --git a/src/cmd/lccom-1/tst/x86-linux/cvt.2bk b/src/cmd/lccom-1/tst/x86-linux/cvt.2bk new file mode 100644 index 0000000..241527d --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/cvt.2bk @@ -0,0 +1,2 @@ +tst/cvt.c:32: warning: conversion from `pointer to void function(void)' to `pointer to void' is compiler dependent +tst/cvt.c:33: warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent diff --git a/src/cmd/lccom-1/tst/x86-linux/cvt.sbk b/src/cmd/lccom-1/tst/x86-linux/cvt.sbk new file mode 100644 index 0000000..b5b86a6 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/cvt.sbk @@ -0,0 +1,993 @@ +.globl print +.text +.align 16 +.type print,@function +print: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +fldl D +subl $8,%esp +fstpl (%esp) +fldl d +subl $8,%esp +fstpl (%esp) +flds f +subl $8,%esp +fstpl (%esp) +pushl L +pushl I +movw S,%di +movzwl %di,%edi +pushl %edi +movb C,%bl +movzbl %bl,%edi +pushl %edi +pushl l +pushl i +movswl s,%edi +pushl %edi +movsbl c,%edi +pushl %edi +pushl $.LC2 +call printf +addl $60,%esp +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf3: +.size print,.Lf3-print +.globl main +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $296,%esp +movb $1,c +movsbl c,%edi +movl %edi,%esi +movw %si,s +movl %edi,i +movl %edi,l +movl %edi,%esi +movl %esi,%ebx +movb %bl,C +movl %esi,%ebx +movw %bx,S +movl %esi,I +movl %esi,L +pushl %edi +fildl (%esp) +addl $4,%esp +fstps f +pushl %edi +fildl (%esp) +addl $4,%esp +fstpl -8(%ebp) +fldl -8(%ebp) +fstpl d +fldl -8(%ebp) +fstpl D +call print +movw $2,s +movswl s,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,i +movl %edi,l +movl %edi,%esi +movl %esi,%ebx +movb %bl,C +movl %esi,%ebx +movw %bx,S +movl %esi,I +movl %esi,L +pushl %edi +fildl (%esp) +addl $4,%esp +fstps f +pushl %edi +fildl (%esp) +addl $4,%esp +fstpl -16(%ebp) +fldl -16(%ebp) +fstpl d +fldl -16(%ebp) +fstpl D +call print +movl $3,i +movl i,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%esi +movw %si,s +movl %edi,l +movl %edi,%esi +movl %esi,%ebx +movb %bl,C +movl %esi,%ebx +movw %bx,S +movl %esi,I +movl %esi,L +pushl %edi +fildl (%esp) +addl $4,%esp +fstps f +pushl %edi +fildl (%esp) +addl $4,%esp +fstpl -24(%ebp) +fldl -24(%ebp) +fstpl d +fldl -24(%ebp) +fstpl D +call print +movl $4,l +movl l,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%esi +movw %si,s +movl %edi,i +movl %edi,%esi +movl %esi,%ebx +movb %bl,C +movl %esi,%ebx +movw %bx,S +movl %esi,I +movl %esi,L +pushl %edi +fildl (%esp) +addl $4,%esp +fstps f +pushl %edi +fildl (%esp) +addl $4,%esp +fstpl -32(%ebp) +fldl -32(%ebp) +fstpl d +fldl -32(%ebp) +fstpl D +call print +movb $5,C +movb C,%bl +movzbl %bl,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%esi +movw %si,s +movl %edi,i +movl %edi,l +movl %edi,%esi +movl %esi,%ebx +movw %bx,S +movl %esi,I +movl %esi,L +pushl %edi +fildl (%esp) +addl $4,%esp +fstps f +pushl %edi +fildl (%esp) +addl $4,%esp +fstpl -40(%ebp) +fldl -40(%ebp) +fstpl d +fldl -40(%ebp) +fstpl D +call print +movw $6,S +movw S,%di +movzwl %di,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%esi +movw %si,s +movl %edi,i +movl %edi,l +movl %edi,%esi +movl %esi,%ebx +movb %bl,C +movl %esi,I +movl %esi,L +pushl %edi +fildl (%esp) +addl $4,%esp +fstps f +pushl %edi +fildl (%esp) +addl $4,%esp +fstpl -48(%ebp) +fldl -48(%ebp) +fstpl d +fldl -48(%ebp) +fstpl D +call print +movl $7,I +movl I,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%ebx +movw %bx,s +movl %edi,i +movl %edi,l +movl %edi,%ebx +movb %bl,C +movl %edi,%esi +movw %si,S +movl %edi,L +fldl .LC5 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fstpl -56(%ebp) +fldl -56(%ebp) +fstps f +fldl -56(%ebp) +fstpl d +fldl -56(%ebp) +fstpl D +call print +movl $8,L +movl L,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%ebx +movw %bx,s +movl %edi,i +movl %edi,l +movl %edi,%ebx +movb %bl,C +movl %edi,%esi +movw %si,S +movw S,%si +movzwl %si,%esi +movl %esi,I +fldl .LC5 +movl %edi,%esi +shrl $1,%esi +pushl %esi +fildl (%esp) +addl $4,%esp +fmulp %st,%st(1) +andl $1,%edi +pushl %edi +fildl (%esp) +addl $4,%esp +faddp %st,%st(1) +fstpl -64(%ebp) +fldl -64(%ebp) +fstps f +fldl -64(%ebp) +fstpl d +fldl -64(%ebp) +fstpl D +call print +flds .LC6 +fstps f +flds f +fstps -84(%ebp) +flds -84(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%esi +movw %si,s +movl %edi,i +movl %edi,l +flds .LC10 +fcomps -84(%ebp) +fstsw %ax +sahf +jp .LC8 +ja .LC8 +flds -84(%ebp) +fsubs .LC10 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-68(%ebp) +jmp .LC9 +.LC8: +flds -84(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-68(%ebp) +.LC9: +movl -68(%ebp),%edi +movl %edi,%ebx +movb %bl,C +flds .LC10 +fcomps f +fstsw %ax +sahf +jp .LC12 +ja .LC12 +flds f +fsubs .LC10 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-72(%ebp) +jmp .LC13 +.LC12: +flds f +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-72(%ebp) +.LC13: +movl -72(%ebp),%edi +movw %di,S +flds .LC10 +fcomps f +fstsw %ax +sahf +jp .LC15 +ja .LC15 +flds f +fsubs .LC10 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-76(%ebp) +jmp .LC16 +.LC15: +flds f +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-76(%ebp) +.LC16: +movl -76(%ebp),%edi +movl %edi,I +flds .LC10 +fcomps f +fstsw %ax +sahf +jp .LC18 +ja .LC18 +flds f +fsubs .LC10 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-80(%ebp) +jmp .LC19 +.LC18: +flds f +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-80(%ebp) +.LC19: +movl -80(%ebp),%edi +movl %edi,L +flds f +fstpl -120(%ebp) +fldl -120(%ebp) +fstpl d +fldl -120(%ebp) +fstpl D +call print +fldl .LC20 +fstpl d +fldl d +fstpl -144(%ebp) +fldl -144(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%esi +movw %si,s +movl %edi,i +movl %edi,l +fldl .LC24 +fcompl -144(%ebp) +fstsw %ax +sahf +jp .LC22 +ja .LC22 +fldl -144(%ebp) +fsubl .LC24 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-124(%ebp) +jmp .LC23 +.LC22: +fldl -144(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-124(%ebp) +.LC23: +movl -124(%ebp),%edi +movl %edi,%ebx +movb %bl,C +fldl .LC24 +fcompl d +fstsw %ax +sahf +jp .LC26 +ja .LC26 +fldl d +fsubl .LC24 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-128(%ebp) +jmp .LC27 +.LC26: +fldl d +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-128(%ebp) +.LC27: +movl -128(%ebp),%edi +movw %di,S +fldl .LC24 +fcompl d +fstsw %ax +sahf +jp .LC29 +ja .LC29 +fldl d +fsubl .LC24 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-132(%ebp) +jmp .LC30 +.LC29: +fldl d +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-132(%ebp) +.LC30: +movl -132(%ebp),%edi +movl %edi,I +fldl .LC24 +fcompl d +fstsw %ax +sahf +jp .LC32 +ja .LC32 +fldl d +fsubl .LC24 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-136(%ebp) +jmp .LC33 +.LC32: +fldl d +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-136(%ebp) +.LC33: +movl -136(%ebp),%edi +movl %edi,L +fldl d +fstps f +fldl d +fstpl D +call print +fldl .LC34 +fstpl D +fldl D +fstpl -232(%ebp) +fldl -232(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,%ebx +movb %bl,c +movl %edi,%esi +movw %si,s +movl %edi,i +movl %edi,l +fldl .LC38 +fcompl -232(%ebp) +fstsw %ax +sahf +jp .LC36 +ja .LC36 +fldl -232(%ebp) +fsubl .LC38 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-212(%ebp) +jmp .LC37 +.LC36: +fldl -232(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-212(%ebp) +.LC37: +movl -212(%ebp),%edi +movl %edi,%ebx +movb %bl,C +fldl .LC38 +fcompl D +fstsw %ax +sahf +jp .LC40 +ja .LC40 +fldl D +fsubl .LC38 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-216(%ebp) +jmp .LC41 +.LC40: +fldl D +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-216(%ebp) +.LC41: +movl -216(%ebp),%edi +movw %di,S +fldl .LC38 +fcompl D +fstsw %ax +sahf +jp .LC43 +ja .LC43 +fldl D +fsubl .LC38 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-220(%ebp) +jmp .LC44 +.LC43: +fldl D +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-220(%ebp) +.LC44: +movl -220(%ebp),%edi +movl %edi,I +fldl .LC38 +fcompl D +fstsw %ax +sahf +jp .LC46 +ja .LC46 +fldl D +fsubl .LC38 +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +leal 0x80000000(%edi),%edi +movl %edi,-224(%ebp) +jmp .LC47 +.LC46: +fldl D +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,%edi +movl %edi,-224(%ebp) +.LC47: +movl -224(%ebp),%edi +movl %edi,L +fldl D +fstps f +fldl D +fstpl d +call print +movl $0,p +movl $0,p +movl $0,p +movl $0,p +movl P,%edi +movl %edi,p +movl $0,P +movl $0,P +movl $0,P +movl $0,P +movl p,%edi +movl %edi,P +mov $0,%eax +.LC4: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf48: +.size main,.Lf48-main +.bss +.globl P +.align 4 +.type P,@object +.size P,4 +.comm P,4 +.globl p +.align 4 +.type p,@object +.size p,4 +.comm p,4 +.globl D +.align 4 +.type D,@object +.size D,8 +.comm D,8 +.globl d +.align 4 +.type d,@object +.size d,8 +.comm d,8 +.globl f +.align 4 +.type f,@object +.size f,4 +.comm f,4 +.globl L +.align 4 +.type L,@object +.size L,4 +.comm L,4 +.globl I +.align 4 +.type I,@object +.size I,4 +.comm I,4 +.globl S +.align 2 +.type S,@object +.size S,2 +.comm S,2 +.globl C +.align 1 +.type C,@object +.size C,1 +.comm C,1 +.globl l +.align 4 +.type l,@object +.size l,4 +.comm l,4 +.globl i +.align 4 +.type i,@object +.size i,4 +.comm i,4 +.globl s +.align 2 +.type s,@object +.size s,2 +.comm s,2 +.globl c +.align 1 +.type c,@object +.size c,1 +.comm c,1 +.data +.align 4 +.LC38: +.long 0 +.long 1105199104 +.align 4 +.LC34: +.long 0 +.long 1076232192 +.align 4 +.LC24: +.long 0 +.long 1105199104 +.align 4 +.LC20: +.long 0 +.long 1076101120 +.align 4 +.LC10: +.long 1325400064 +.align 4 +.LC6: +.long 1091567616 +.align 4 +.LC5: +.long 0 +.long 1073741824 +.align 1 +.LC2: +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 108 +.byte 100 +.byte 32 +.byte 37 +.byte 117 +.byte 32 +.byte 37 +.byte 117 +.byte 32 +.byte 37 +.byte 117 +.byte 32 +.byte 37 +.byte 108 +.byte 117 +.byte 32 +.byte 37 +.byte 102 +.byte 32 +.byte 37 +.byte 102 +.byte 32 +.byte 37 +.byte 108 +.byte 102 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/fields.1bk b/src/cmd/lccom-1/tst/x86-linux/fields.1bk new file mode 100644 index 0000000..56fdeb9 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/fields.1bk @@ -0,0 +1,5 @@ +x = 1 2 3 4 -3 6 +y = 3 8 9 +x = 1 2 3 0 0 6 +y = 2 8 16 +p->a = 0x3, p->b = 0xf diff --git a/src/cmd/lccom-1/tst/x86-linux/fields.2bk b/src/cmd/lccom-1/tst/x86-linux/fields.2bk new file mode 100644 index 0000000..51e1736 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/fields.2bk @@ -0,0 +1,4 @@ +tst/fields.c:6: warning: initializer exceeds bit-field width +tst/fields.c:8: warning: initializer exceeds bit-field width +tst/fields.c:30: warning: missing return value +tst/fields.c:34: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/fields.sbk b/src/cmd/lccom-1/tst/x86-linux/fields.sbk new file mode 100644 index 0000000..b999036 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/fields.sbk @@ -0,0 +1,321 @@ +.data +.globl x +.align 4 +.type x,@object +.size x,16 +x: +.long 1 +.byte 2 +.space 3 +.byte 3 +.byte 64 +.space 2 +.byte 80 +.byte 6 +.space 2 +.globl i +.align 4 +.type i,@object +.size i,4 +i: +.long 16 +.globl y +.align 4 +.type y,@object +.size y,8 +y: +.byte 35 +.space 3 +.byte 9 +.byte 0 +.byte 0 +.byte 0 +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movsbl x+13,%edi +pushl %edi +movl x+12,%edi +sall $25,%edi +sarl $29,%edi +pushl %edi +movl x+8,%edi +sall $16,%edi +sarl $28,%edi +pushl %edi +movl x+8,%edi +sall $20,%edi +sarl $20,%edi +pushl %edi +movsbl x+4,%edi +pushl %edi +pushl x +pushl $.LC4 +call printf +addl $28,%esp +pushl y+4 +movl y,%edi +movl %edi,%esi +shrl $2,%esi +andl $15,%esi +pushl %esi +andl $3,%edi +pushl %edi +pushl $.LC10 +call printf +addl $16,%esp +movl x+8,%edi +andl $0xffff0fff,%edi +movl i,%esi +sall $28,%esi +sarl $28,%esi +shll $12,%esi +andl $0xf000,%esi +orl %esi,%edi +movl %edi,x+8 +movl x+12,%edi +andl $0xffffff8f,%edi +movl %edi,x+12 +movsbl x+13,%edi +pushl %edi +movl x+12,%edi +sall $25,%edi +sarl $29,%edi +pushl %edi +movl x+8,%edi +sall $16,%edi +sarl $28,%edi +pushl %edi +movl x+8,%edi +sall $20,%edi +sarl $20,%edi +pushl %edi +movsbl x+4,%edi +pushl %edi +pushl x +pushl $.LC4 +call printf +addl $28,%esp +movl y,%edi +andl $0xfffffffc,%edi +orl $2,%edi +movl %edi,y +movl i,%edi +movl %edi,y+4 +pushl y+4 +movl y,%edi +movl %edi,%esi +shrl $2,%esi +andl $15,%esi +pushl %esi +andl $3,%edi +pushl %edi +pushl $.LC10 +call printf +addl $16,%esp +pushl $x +call f2 +addl $4,%esp +mov $0,%eax +.LC3: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf21: +.size main,.Lf21-main +.globl f1 +.align 16 +.type f1,@function +f1: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 20(%ebp),%edi +andl $0xffffffc3,(,%edi) +movl 20(%ebp),%edi +movl (,%edi),%esi +andl $0xfffffffc,%esi +mov $0,%ebx +andl $3,%ebx +andl $3,%ebx +orl %ebx,%esi +movl %esi,(,%edi) +movl 20(%ebp),%edi +movl (,%edi),%edi +andl $60,%edi +cmpl $0,%edi +je .LC23 +pushl $.LC25 +call printf +addl $4,%esp +.LC23: +movl 20(%ebp),%edi +orl $3,(,%edi) +movl 20(%ebp),%edi +orl $60,(,%edi) +movl 20(%ebp),%edi +movl (,%edi),%edi +movl %edi,%esi +shrl $2,%esi +andl $15,%esi +pushl %esi +andl $3,%edi +pushl %edi +pushl $.LC26 +call printf +addl $12,%esp +mov $0,%eax +.LC22: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf27: +.size f1,.Lf27-f1 +.globl f2 +.align 16 +.type f2,@function +f2: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +cmpl $0,i +jne .LC30 +movl $1,-4(%ebp) +jmp .LC31 +.LC30: +movl $0,-4(%ebp) +.LC31: +movl 20(%ebp),%edi +movl (,%edi),%esi +andl $0xfffffffc,%esi +movl -4(%ebp),%ebx +andl $3,%ebx +andl $3,%ebx +orl %ebx,%esi +movl %esi,(,%edi) +movl 20(%ebp),%edi +pushl %edi +call f1 +addl $4,%esp +movl (,%edi),%esi +andl $0xffffffc3,%esi +mov $0,%ebx +andl $15,%ebx +leal (,%ebx,4),%ebx +andl $60,%ebx +orl %ebx,%esi +movl %esi,(,%edi) +mov $0,%eax +.LC28: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf32: +.size f2,.Lf32-f2 +.data +.align 1 +.LC26: +.byte 112 +.byte 45 +.byte 62 +.byte 97 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 44 +.byte 32 +.byte 112 +.byte 45 +.byte 62 +.byte 98 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 10 +.byte 0 +.align 1 +.LC25: +.byte 112 +.byte 45 +.byte 62 +.byte 98 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC10: +.byte 121 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC4: +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/float.h b/src/cmd/lccom-1/tst/x86-linux/float.h new file mode 100644 index 0000000..fde462b --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/float.h @@ -0,0 +1,37 @@ +#ifndef __FLOAT +#define __FLOAT + +#define FLT_ROUNDS (__flt_rounds()) +#define FLT_RADIX 2 + +#define FLT_DIG 6 +#define FLT_EPSILON 1.19209289550781250000e-07 +#define FLT_MANT_DIG 24 +#define FLT_MAX 3.40282346638528860000e+38 +#define FLT_MAX_10_EXP 38 +#define FLT_MAX_EXP 128 +#define FLT_MIN 1.17549435082228750000e-38 +#define FLT_MIN_10_EXP -37 +#define FLT_MIN_EXP -125 + +#define DBL_DIG 15 +#define DBL_EPSILON 2.22044604925031310000e-16 +#define DBL_MANT_DIG 53 +#define DBL_MAX 1.79769313486231570000e+308 +#define DBL_MAX_10_EXP 308 +#define DBL_MAX_EXP 1024 +#define DBL_MIN 2.22507385850720140000e-308 +#define DBL_MIN_10_EXP -307 +#define DBL_MIN_EXP -1021 + +#define LDBL_MANT_DIG DBL_MANT_DIG +#define LDBL_EPSILON DBL_EPSILON +#define LDBL_DIG DBL_DIG +#define LDBL_MIN_EXP DBL_MIN_EXP +#define LDBL_MIN DBL_MIN +#define LDBL_MIN_10_EXP DBL_MIN_10_EXP +#define LDBL_MAX_EXP DBL_MAX_EXP +#define LDBL_MAX DBL_MAX +#define LDBL_MAX_10_EXP DBL_MAX_10_EXP + +#endif /* __FLOAT */ diff --git a/src/cmd/lccom-1/tst/x86-linux/front.2bk b/src/cmd/lccom-1/tst/x86-linux/front.2bk new file mode 100644 index 0000000..bbd390a --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/front.2bk @@ -0,0 +1,29 @@ +tst/front.c:3: warning: missing return value +tst/front.c:10: warning: missing return value +tst/front.c:20: type error in argument 1 to `s'; found `pointer to struct D' expected `pointer to incomplete struct D defined at tst/front.c:14' +tst/front.c:21: warning: missing return value +tst/front.c:32: warning: missing return value +tst/front.c:36: operands of = have illegal types `pointer to int' and `pointer to const int' +tst/front.c:38: warning: missing return value +tst/front.c:62: operands of = have illegal types `pointer to char' and `pointer to const void' +tst/front.c:63: warning: missing return value +tst/front.c:68: warning: missing return value +tst/front.c:69: warning: inconsistent linkage for `yy' previously declared at tst/front.c:68 +tst/front.c:69: warning: missing return value +tst/front.c:71: invalid storage class `static' for `int function goo' +tst/front.c:71: warning: declaration of `goo' does not match previous declaration at tst/front.c:70 +tst/front.c:71: warning: missing return value +tst/front.c:74: warning: declaration of `xr' does not match previous declaration at tst/front.c:72 +tst/front.c:74: warning: missing return value +tst/front.c:81: warning: missing return value +tst/front.c:82: warning: declaration of `ss2' does not match previous declaration at tst/front.c:81 +tst/front.c:84: warning: inconsistent linkage for `ss5' previously declared at tst/front.c:80 +tst/front.c:92: type error in argument 1 to `gx1'; found `pointer to double' expected `double' +tst/front.c:92: warning: missing return value +tst/front.c:95: redeclaration of `hx1' previously declared at tst/front.c:94 +tst/front.c:98: warning: missing return value +tst/front.c:101: conflicting argument declarations for function `gg1' +tst/front.c:101: warning: missing return value +tst/front.c:112: type error in argument 4 to `qsort'; found `pointer to int function(pointer to pointer to char,pointer to pointer to char)' expected `pointer to int function(pointer to const void,pointer to const void)' +tst/front.c:113: warning: missing return value +tst/front.c:120: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/front.sbk b/src/cmd/lccom-1/tst/x86-linux/front.sbk new file mode 100644 index 0000000..8e49df0 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/front.sbk @@ -0,0 +1,530 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl $0 +call exit +addl $4,%esp +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf2: +.size main,.Lf2-main +.globl nested +.align 16 +.type nested,@function +nested: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +cmpl $4,20(%ebp) +jge .LC7 +cmpl $114,24(%ebp) +je .LC10 +.LC7: +cmpl $1,20(%ebp) +jne .LC9 +movl 24(%ebp),%edi +cmpl $104,%edi +je .LC10 +cmpl $105,%edi +je .LC10 +.LC9: +cmpl $2,20(%ebp) +jne .LC4 +movl 24(%ebp),%edi +cmpl $111,%edi +je .LC10 +cmpl $121,%edi +jne .LC4 +.LC10: +movl 24(%ebp),%edi +movl %edi,20(%ebp) +.LC4: +mov $0,%eax +.LC3: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf11: +.size nested,.Lf11-nested +.globl s +.align 16 +.type s,@function +s: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +.LC12: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf13: +.size s,.Lf13-s +.data +.globl Dy +.align 4 +.type Dy,@object +.size Dy,8 +Dy: +.long 0 +.space 4 +.globl Dz +.align 4 +.type Dz,@object +.size Dz,8 +Dz: +.long 1 +.space 4 +.globl Dfunc +.text +.align 16 +.type Dfunc,@function +Dfunc: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf16: +.size Dfunc,.Lf16-Dfunc +.globl f +.align 16 +.type f,@function +f: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf18: +.size f,.Lf18-f +.globl f1 +.align 16 +.type f1,@function +f1: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf20: +.size f1,.Lf20-f1 +.globl f2 +.align 16 +.type f2,@function +f2: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf22: +.size f2,.Lf22-f2 +.globl g +.align 16 +.type g,@function +g: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf24: +.size g,.Lf24-g +.globl h +.align 16 +.type h,@function +h: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf26: +.size h,.Lf26-h +.globl h1 +.align 16 +.type h1,@function +h1: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf28: +.size h1,.Lf28-h1 +.globl h2 +.align 16 +.type h2,@function +h2: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf30: +.size h2,.Lf30-h2 +.data +.align 4 +.type yy.32,@object +.size yy.32,4 +yy.32: +.long 1 +.globl set1 +.text +.align 16 +.type set1,@function +set1: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf33: +.size set1,.Lf33-set1 +.data +.align 4 +.type yy.35,@object +.size yy.35,4 +yy.35: +.long 2 +.globl set2 +.text +.align 16 +.type set2,@function +set2: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf36: +.size set2,.Lf36-set2 +.align 16 +.type goo,@function +goo: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf38: +.size goo,.Lf38-goo +.globl sss +.align 16 +.type sss,@function +sss: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf40: +.size sss,.Lf40-sss +.bss +.align 4 +.type xr.42,@object +.size xr.42,4 +.lcomm xr.42,4 +.globl rrr +.text +.align 16 +.type rrr,@function +rrr: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf43: +.size rrr,.Lf43-rrr +.globl setstatic +.align 16 +.type setstatic,@function +setstatic: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf45: +.size setstatic,.Lf45-setstatic +.globl gx1 +.align 16 +.type gx1,@function +gx1: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf47: +.size gx1,.Lf47-gx1 +.globl ff1 +.align 16 +.type ff1,@function +ff1: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf49: +.size ff1,.Lf49-ff1 +.globl gg1 +.align 16 +.type gg1,@function +gg1: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf51: +.size gg1,.Lf51-gg1 +.globl hh1 +.align 16 +.type hh1,@function +hh1: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf53: +.size hh1,.Lf53-hh1 +.globl cmp +.align 16 +.type cmp,@function +cmp: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf55: +.size cmp,.Lf55-cmp +.globl sort +.align 16 +.type sort,@function +sort: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf57: +.size sort,.Lf57-sort +.globl onearg +.align 16 +.type onearg,@function +onearg: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf65: +.size onearg,.Lf65-onearg +.bss +.globl ss4 +.align 4 +.type ss4,@object +.size ss4,4 +.comm ss4,4 +.align 4 +.type ss2,@object +.size ss2,4 +.lcomm ss2,4 +.align 4 +.type ss5,@object +.size ss5,4 +.lcomm ss5,4 +.globl ss3 +.align 4 +.type ss3,@object +.size ss3,4 +.comm ss3,4 +.align 4 +.type ss1,@object +.size ss1,4 +.lcomm ss1,4 +.align 4 +.type yy,@object +.size yy,4 +.lcomm yy,4 +.globl z +.align 4 +.type z,@object +.size z,4 +.comm z,4 +.globl y +.align 4 +.type y,@object +.size y,4 +.comm y,4 +.globl x +.align 4 +.type x,@object +.size x,4 +.comm x,4 +.globl b +.align 4 +.type b,@object +.size b,4 +.comm b,4 +.globl a +.align 4 +.type a,@object +.size a,4 +.comm a,4 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/incr.1bk b/src/cmd/lccom-1/tst/x86-linux/incr.1bk new file mode 100644 index 0000000..e69de29 diff --git a/src/cmd/lccom-1/tst/x86-linux/incr.2bk b/src/cmd/lccom-1/tst/x86-linux/incr.2bk new file mode 100644 index 0000000..d9ef13c --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/incr.2bk @@ -0,0 +1,9 @@ +tst/incr.c:1: warning: missing return value +tst/incr.c:6: warning: expression with no effect elided +tst/incr.c:6: warning: expression with no effect elided +tst/incr.c:11: warning: missing return value +tst/incr.c:16: warning: expression with no effect elided +tst/incr.c:16: warning: expression with no effect elided +tst/incr.c:21: warning: missing return value +tst/incr.c:30: warning: missing return value +tst/incr.c:39: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/incr.sbk b/src/cmd/lccom-1/tst/x86-linux/incr.sbk new file mode 100644 index 0000000..8484568 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/incr.sbk @@ -0,0 +1,181 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf2: +.size main,.Lf2-main +.globl memchar +.align 16 +.type memchar,@function +memchar: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl -8(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-8(%ebp) +movb (,%edi),%bl +movb %bl,-4(%ebp) +movl -8(%ebp),%edi +leal 1(%edi),%edi +movl %edi,-8(%ebp) +movb (,%edi),%bl +movb %bl,-4(%ebp) +movl -8(%ebp),%edi +leal -1(%edi),%esi +movl %esi,-8(%ebp) +movb (,%edi),%bl +movb %bl,-4(%ebp) +movl -8(%ebp),%edi +leal -1(%edi),%edi +movl %edi,-8(%ebp) +movb (,%edi),%bl +movb %bl,-4(%ebp) +mov $0,%eax +.LC3: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf4: +.size memchar,.Lf4-memchar +.globl memint +.align 16 +.type memint,@function +memint: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl -8(%ebp),%edi +leal 4(%edi),%esi +movl %esi,-8(%ebp) +movl (,%edi),%edi +movl %edi,-4(%ebp) +movl -8(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-8(%ebp) +movl (,%edi),%edi +movl %edi,-4(%ebp) +movl -8(%ebp),%edi +leal -4(%edi),%esi +movl %esi,-8(%ebp) +movl (,%edi),%edi +movl %edi,-4(%ebp) +movl -8(%ebp),%edi +leal -4(%edi),%edi +movl %edi,-8(%ebp) +movl (,%edi),%edi +movl %edi,-4(%ebp) +mov $0,%eax +.LC5: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf6: +.size memint,.Lf6-memint +.globl regchar +.align 16 +.type regchar,@function +regchar: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl -8(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-8(%ebp) +movb (,%edi),%bl +movb %bl,-4(%ebp) +movl -8(%ebp),%edi +leal 1(%edi),%edi +movl %edi,-8(%ebp) +movb (,%edi),%bl +movb %bl,-4(%ebp) +movl -8(%ebp),%edi +leal -1(%edi),%esi +movl %esi,-8(%ebp) +movb (,%edi),%bl +movb %bl,-4(%ebp) +movl -8(%ebp),%edi +leal -1(%edi),%edi +movl %edi,-8(%ebp) +movb (,%edi),%bl +movb %bl,-4(%ebp) +mov $0,%eax +.LC7: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf8: +.size regchar,.Lf8-regchar +.globl regint +.align 16 +.type regint,@function +regint: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl -8(%ebp),%edi +leal 4(%edi),%esi +movl %esi,-8(%ebp) +movl (,%edi),%edi +movl %edi,-4(%ebp) +movl -8(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-8(%ebp) +movl (,%edi),%edi +movl %edi,-4(%ebp) +movl -8(%ebp),%edi +leal -4(%edi),%esi +movl %esi,-8(%ebp) +movl (,%edi),%edi +movl %edi,-4(%ebp) +movl -8(%ebp),%edi +leal -4(%edi),%edi +movl %edi,-8(%ebp) +movl (,%edi),%edi +movl %edi,-4(%ebp) +mov $0,%eax +.LC9: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf10: +.size regint,.Lf10-regint +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/init.1bk b/src/cmd/lccom-1/tst/x86-linux/init.1bk new file mode 100644 index 0000000..77aff09 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/init.1bk @@ -0,0 +1,16 @@ + 1 2 3 4 + 5 6 + 7 +if +for +else +while +1 2 3 if +4 5 0 for +6 7 8 else +9 10 11 while +1 2 3 if +4 5 0 for +6 7 8 else +9 10 11 while +0 0 0 diff --git a/src/cmd/lccom-1/tst/x86-linux/init.2bk b/src/cmd/lccom-1/tst/x86-linux/init.2bk new file mode 100644 index 0000000..aafe415 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/init.2bk @@ -0,0 +1,3 @@ +tst/init.c:36: warning: missing return value +tst/init.c:49: warning: missing return value +tst/init.c:59: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/init.sbk b/src/cmd/lccom-1/tst/x86-linux/init.sbk new file mode 100644 index 0000000..dbe3695 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/init.sbk @@ -0,0 +1,336 @@ +.data +.globl words +.align 4 +.type words,@object +words: +.long 1 +.long 2 +.long 3 +.byte 105 +.byte 102 +.byte 0 +.space 3 +.space 2 +.long 4 +.long 5 +.space 4 +.byte 102 +.byte 111 +.byte 114 +.space 3 +.space 2 +.long 6 +.long 7 +.long 8 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 0 +.space 1 +.space 2 +.long 9 +.long 10 +.long 11 +.byte 119 +.byte 104 +.byte 105 +.byte 108 +.byte 101 +.space 1 +.space 2 +.long 0 +.space 8 +.space 8 +.size words,100 +.globl wordlist +.align 4 +.type wordlist,@object +.size wordlist,4 +wordlist: +.long words +.globl x +.align 4 +.type x,@object +x: +.long 1 +.long 2 +.long 3 +.long 4 +.long 0 +.long 5 +.long 6 +.space 12 +.long 7 +.space 16 +.size x,60 +.globl y +.align 4 +.type y,@object +y: +.long x +.long x+20 +.long x+40 +.long 0 +.size y,16 +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl $0,-8(%ebp) +jmp .LC8 +.LC5: +movl $0,-4(%ebp) +jmp .LC12 +.LC9: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +movl y(,%esi,4),%esi +pushl (%esi,%edi,4) +pushl $.LC13 +call printf +addl $8,%esp +.LC10: +incl -4(%ebp) +.LC12: +movl -4(%ebp),%edi +movl -8(%ebp),%esi +movl y(,%esi,4),%esi +cmpl $0,(%esi,%edi,4) +jne .LC9 +pushl $.LC14 +call printf +addl $4,%esp +.LC6: +incl -8(%ebp) +.LC8: +movl -8(%ebp),%edi +movl y(,%edi,4),%edi +cmpl $0,%edi +jne .LC5 +call f +pushl wordlist +call g +addl $4,%esp +mov $0,%eax +.LC4: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf15: +.size main,.Lf15-main +.data +.align 4 +.type keywords.17,@object +keywords.17: +.long .LC18 +.long .LC19 +.long .LC20 +.long .LC21 +.long 0 +.size keywords.17,20 +.globl f +.text +.align 16 +.type f,@function +f: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +leal keywords.17,%edi +movl %edi,-4(%ebp) +jmp .LC25 +.LC22: +movl -4(%ebp),%edi +pushl (,%edi) +pushl $.LC26 +call printf +addl $8,%esp +.LC23: +movl -4(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-4(%ebp) +.LC25: +movl -4(%ebp),%edi +movl (,%edi),%edi +cmpl $0,%edi +jne .LC22 +mov $0,%eax +.LC16: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf27: +.size f,.Lf27-f +.globl g +.align 16 +.type g,@function +g: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +jmp .LC32 +.LC29: +movl $0,-4(%ebp) +jmp .LC36 +.LC33: +movl -4(%ebp),%edi +movl 20(%ebp),%esi +pushl (%esi,%edi,4) +pushl $.LC37 +call printf +addl $8,%esp +.LC34: +incl -4(%ebp) +.LC36: +movl -4(%ebp),%edi +cmpl $3,%edi +jb .LC33 +movl 20(%ebp),%edi +leal 12(%edi),%edi +pushl %edi +pushl $.LC26 +call printf +addl $8,%esp +.LC30: +movl 20(%ebp),%edi +leal 20(%edi),%edi +movl %edi,20(%ebp) +.LC32: +movl 20(%ebp),%edi +cmpl $0,(,%edi) +jne .LC29 +call h +mov $0,%eax +.LC28: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf38: +.size g,.Lf38-g +.globl h +.align 16 +.type h,@function +h: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $0,-4(%ebp) +jmp .LC43 +.LC40: +imul $20,-4(%ebp),%edi +leal words+12(%edi),%esi +pushl %esi +pushl words+8(%edi) +pushl words+4(%edi) +pushl words(%edi) +pushl $.LC44 +call printf +addl $20,%esp +.LC41: +incl -4(%ebp) +.LC43: +movl -4(%ebp),%edi +cmpl $5,%edi +jb .LC40 +mov $0,%eax +.LC39: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf48: +.size h,.Lf48-h +.data +.align 1 +.LC44: +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC37: +.byte 37 +.byte 100 +.byte 32 +.byte 0 +.align 1 +.LC26: +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC21: +.byte 119 +.byte 104 +.byte 105 +.byte 108 +.byte 101 +.byte 0 +.align 1 +.LC20: +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 0 +.align 1 +.LC19: +.byte 102 +.byte 111 +.byte 114 +.byte 0 +.align 1 +.LC18: +.byte 105 +.byte 102 +.byte 0 +.align 1 +.LC14: +.byte 10 +.byte 0 +.align 1 +.LC13: +.byte 32 +.byte 37 +.byte 100 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/limits.1bk b/src/cmd/lccom-1/tst/x86-linux/limits.1bk new file mode 100644 index 0000000..9beee8c --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/limits.1bk @@ -0,0 +1,14 @@ +UCHAR_MAX: 000000ff=255 +USHRT_MAX: 0000ffff=65535 +UINT_MAX: ffffffff=-1 +ULONG_MAX: ffffffff=-1 +CHAR_MAX: 0000007f=127 +SCHAR_MAX: 0000007f=127 +SHRT_MAX: 00007fff=32767 +INT_MAX: 7fffffff=2147483647 +LONG_MAX: 7fffffff=2147483647 +CHAR_MIN: ffffff80=-128 +SCHAR_MIN: ffffff80=-128 +SHRT_MIN: ffff8000=-32768 +INT_MIN: 80000000=-2147483648 +LONG_MIN: 80000000=-2147483648 diff --git a/src/cmd/lccom-1/tst/x86-linux/limits.2bk b/src/cmd/lccom-1/tst/x86-linux/limits.2bk new file mode 100644 index 0000000..e69de29 diff --git a/src/cmd/lccom-1/tst/x86-linux/limits.h b/src/cmd/lccom-1/tst/x86-linux/limits.h new file mode 100644 index 0000000..913bb97 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/limits.h @@ -0,0 +1,30 @@ +#ifndef __LIMITS +#define __LIMITS + +#define CHAR_BIT 8 +#define MB_LEN_MAX 1 + +#define UCHAR_MAX 0xff +#define USHRT_MAX 0xffff +#define UINT_MAX (~0U) +#define ULONG_MAX (~0UL) + +#define SCHAR_MAX 0x7f +#define SHRT_MAX 0x7fff +#define INT_MAX 0x7fffffff +#define LONG_MAX 0x7fffffffL + +#define SCHAR_MIN (-SCHAR_MAX-1) +#define SHRT_MIN (-SHRT_MAX-1) +#define INT_MIN (-INT_MAX-1) +#define LONG_MIN (-LONG_MAX-1) + +#ifdef __CHAR_UNSIGNED__ +#define CHAR_MAX UCHAR_MAX +#define CHAR_MIN 0 +#else +#define CHAR_MAX SCHAR_MAX +#define CHAR_MIN SCHAR_MIN +#endif + +#endif /* __LIMITS */ diff --git a/src/cmd/lccom-1/tst/x86-linux/limits.sbk b/src/cmd/lccom-1/tst/x86-linux/limits.sbk new file mode 100644 index 0000000..4bf634e --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/limits.sbk @@ -0,0 +1,396 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl $255 +pushl $255 +pushl $.LC2 +call printf +addl $12,%esp +pushl $65535 +pushl $65535 +pushl $.LC3 +call printf +addl $12,%esp +pushl $0xffffffff +pushl $0xffffffff +pushl $.LC4 +call printf +addl $12,%esp +pushl $0xffffffff +pushl $0xffffffff +pushl $.LC5 +call printf +addl $12,%esp +pushl $127 +pushl $127 +pushl $.LC6 +call printf +addl $12,%esp +pushl $127 +pushl $127 +pushl $.LC7 +call printf +addl $12,%esp +pushl $32767 +pushl $32767 +pushl $.LC8 +call printf +addl $12,%esp +pushl $2147483647 +pushl $2147483647 +pushl $.LC9 +call printf +addl $12,%esp +pushl $2147483647 +pushl $2147483647 +pushl $.LC10 +call printf +addl $12,%esp +pushl $-128 +pushl $-128 +pushl $.LC11 +call printf +addl $12,%esp +pushl $-128 +pushl $-128 +pushl $.LC12 +call printf +addl $12,%esp +pushl $-32768 +pushl $-32768 +pushl $.LC13 +call printf +addl $12,%esp +pushl $-2147483648 +pushl $-2147483648 +pushl $.LC14 +call printf +addl $12,%esp +pushl $-2147483648 +pushl $-2147483648 +pushl $.LC15 +call printf +addl $12,%esp +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf16: +.size main,.Lf16-main +.data +.align 1 +.LC15: +.byte 76 +.byte 79 +.byte 78 +.byte 71 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 108 +.byte 120 +.byte 61 +.byte 37 +.byte 108 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC14: +.byte 73 +.byte 78 +.byte 84 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC13: +.byte 83 +.byte 72 +.byte 82 +.byte 84 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC12: +.byte 83 +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC11: +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 73 +.byte 78 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC10: +.byte 76 +.byte 79 +.byte 78 +.byte 71 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 108 +.byte 120 +.byte 61 +.byte 37 +.byte 108 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC9: +.byte 73 +.byte 78 +.byte 84 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC8: +.byte 83 +.byte 72 +.byte 82 +.byte 84 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC7: +.byte 83 +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC6: +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC5: +.byte 85 +.byte 76 +.byte 79 +.byte 78 +.byte 71 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 108 +.byte 120 +.byte 61 +.byte 37 +.byte 108 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC4: +.byte 85 +.byte 73 +.byte 78 +.byte 84 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC3: +.byte 85 +.byte 83 +.byte 72 +.byte 82 +.byte 84 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC2: +.byte 85 +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 95 +.byte 77 +.byte 65 +.byte 88 +.byte 58 +.byte 9 +.byte 37 +.byte 48 +.byte 56 +.byte 120 +.byte 61 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/math.h b/src/cmd/lccom-1/tst/x86-linux/math.h new file mode 100644 index 0000000..d2a31f4 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/math.h @@ -0,0 +1,29 @@ +#ifndef __MATH +#define __MATH + +#define HUGE_VAL 1.79769313486231570000e+308 + +extern double acos(double); +extern double asin(double); +extern double atan(double); +extern double atan2(double, double); +extern double cos(double); +extern double sin(double); +extern double tan(double); +extern double cosh(double); +extern double sinh(double); +extern double tanh(double); +extern double exp(double); +extern double frexp(double, int *); +extern double ldexp(double, int); +extern double log(double); +extern double log10(double); +extern double modf(double, double *); +extern double pow(double, double); +extern double sqrt(double); +extern double ceil(double); +extern double fabs(double); +extern double floor(double); +extern double fmod(double, double); + +#endif /* __MATH */ diff --git a/src/cmd/lccom-1/tst/x86-linux/paranoia.1bk b/src/cmd/lccom-1/tst/x86-linux/paranoia.1bk new file mode 100644 index 0000000..6639dd3 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/paranoia.1bk @@ -0,0 +1,183 @@ +Lest this program stop prematurely, i.e. before displaying + + `END OF TEST', + +try to persuade the computer NOT to terminate execution when an +error like Over/Underflow or Division by Zero occurs, but rather +to persevere with a surrogate value after, perhaps, displaying some +warning. If persuasion avails naught, don't despair but run this +program anyway to see how many milestones it passes, and then +amend it to make further progress. + +Answer questions with Y, y, N or n (unless otherwise indicated). + + +Diagnosis resumes after milestone Number 0 Page: 1 + +Users are invited to help debug and augment this program so it will +cope with unanticipated and newly uncovered arithmetic pathologies. + +Please send suggestions and interesting results to + Richard Karpinski + Computer Center U-76 + University of California + San Francisco, CA 94143-0704, USA + +In doing so, please include the following information: + Precision: double; + Version: 10 February 1989; + Computer: + + Compiler: + + Optimization level: + + Other relevant compiler options: + +Diagnosis resumes after milestone Number 1 Page: 2 + +Running this program should reveal these characteristics: + Radix = 1, 2, 4, 8, 10, 16, 100, 256 ... + Precision = number of significant digits carried. + U2 = Radix/Radix^Precision = One Ulp + (OneUlpnit in the Last Place) of 1.000xxx . + U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 . + Adequacy of guard digits for Mult., Div. and Subt. + Whether arithmetic is chopped, correctly rounded, or something else + for Mult., Div., Add/Subt. and Sqrt. + Whether a Sticky Bit used correctly for rounding. + UnderflowThreshold = an underflow threshold. + E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy. + V = an overflow threshold, roughly. + V0 tells, roughly, whether Infinity is represented. + Comparisions are checked for consistency with subtraction + and for contamination with pseudo-zeros. + Sqrt is tested. Y^X is not tested. + Extra-precise subexpressions are revealed but NOT YET tested. + Decimal-Binary conversion is NOT YET tested for accuracy. + +Diagnosis resumes after milestone Number 2 Page: 3 + +The program attempts to discriminate among + FLAWs, like lack of a sticky bit, + Serious DEFECTs, like lack of a guard digit, and + FAILUREs, like 2+2 == 5 . +Failures may confound subsequent diagnoses. + +The diagnostic capabilities of this program go beyond an earlier +program called `MACHAR', which can be found at the end of the +book `Software Manual for the Elementary Functions' (1980) by +W. J. Cody and W. Waite. Although both programs try to discover +the Radix, Precision and range (over/underflow thresholds) +of the arithmetic, this program tries to cope with a wider variety +of pathologies, and to say how well the arithmetic is implemented. + +The program is based upon a conventional radix representation for +floating-point numbers, but also allows logarithmic encoding +as used by certain early WANG machines. + +BASIC version of this program (C) 1983 by Prof. W. M. Kahan; +see source comments for more history. + +Diagnosis resumes after milestone Number 3 Page: 4 + +Program is now RUNNING tests on small integers: +-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K. + +Searching for Radix and Precision. +Radix = 2.000000 . +Closest relative separation found is U1 = 1.1102230e-16 . + +Recalculating radix and precision + confirms closest relative separation U1 . +Radix confirmed. +The number of significant digits of the Radix is 53.000000 . +Some subexpressions appear to be calculated extra +precisely with about 11 extra B-digits, i.e. +roughly 3.31133 extra significant decimals. +That feature is not tested further by this program. + +Diagnosis resumes after milestone Number 30 Page: 5 + +Subtraction appears to be normalized, as it should be. +Checking for guard digit in *, /, and -. + *, /, and - appear to have guard digits, as they should. + +Diagnosis resumes after milestone Number 40 Page: 6 + +Checking rounding on multiply, divide and add/subtract. +* is neither chopped nor correctly rounded. +/ is neither chopped nor correctly rounded. +Addition/Subtraction neither rounds nor chops. +Sticky bit used incorrectly or not at all. +FLAW: lack(s) of guard digits or failure(s) to correctly round or chop +(noted above) count as one flaw in the final tally below. + +Does Multiplication commute? Testing on 20 random pairs. + No failures found in 20 integer pairs. + +Running test of square root(x). +Testing if sqrt(X * X) == X for 20 Integers X. +Test for sqrt monotonicity. +sqrt has passed a test for Monotonicity. +Testing whether sqrt is rounded or chopped. +Square root is neither chopped nor correctly rounded. +Observed errors run from -5.0000000e-01 to 5.0000000e-01 ulps. + +Diagnosis resumes after milestone Number 90 Page: 7 + +Testing powers Z^i for small Integers Z and i. +... no discrepancis found. + +Seeking Underflow thresholds UfThold and E0. +Smallest strictly positive number found is E0 = 4.94066e-324 . +Since comparison denies Z = 0, evaluating (Z + Z) / Z should be safe. +What the machine gets for (Z + Z) / Z is 2.00000000000000000e+00 . +This is O.K., provided Over/Underflow has NOT just been signaled. +Underflow is gradual; it incurs Absolute Error = +(roundoff in UfThold) < E0. +The Underflow threshold is 2.22507385850720188e-308, below which +calculation may suffer larger Relative error than merely roundoff. +Since underflow occurs below the threshold +UfThold = (2.00000000000000000e+00) ^ (-1.02200000000000000e+03) +only underflow should afflict the expression + (2.00000000000000000e+00) ^ (-1.02200000000000000e+03); +actually calculating yields: 0.00000000000000000e+00 . +This computed value is O.K. + +Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065218e+00 as X -> 1. +Accuracy seems adequate. +Testing powers Z^Q at four nearly extreme values. + ... no discrepancies found. + + +Diagnosis resumes after milestone Number 160 Page: 8 + +Searching for Overflow threshold: +This may generate an error. +Can `Z = -Y' overflow? +Trying it on Y = -inf . +Seems O.K. +Overflow threshold is V = 1.79769313486231571e+308 . +Overflow saturates at V0 = inf . +No Overflow should be signaled for V * 1 = 1.79769313486231571e+308 + nor for V / 1 = 1.79769313486231571e+308 . +Any overflow signal separating this * from the one +above is a DEFECT. + + +Diagnosis resumes after milestone Number 190 Page: 9 + + +What message and/or values does Division by Zero produce? + Trying to compute 1 / 0 produces ... inf . + + Trying to compute 0 / 0 produces ... nan . + +Diagnosis resumes after milestone Number 220 Page: 10 + + +The number of FLAWs discovered = 1. + +The arithmetic diagnosed seems Satisfactory though flawed. +END OF TEST. diff --git a/src/cmd/lccom-1/tst/x86-linux/paranoia.2bk b/src/cmd/lccom-1/tst/x86-linux/paranoia.2bk new file mode 100644 index 0000000..2718174 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/paranoia.2bk @@ -0,0 +1,16 @@ +tst/paranoia.c:1867: warning: missing return value +tst/paranoia.c:1874: warning: missing return value +tst/paranoia.c:1884: warning: missing return value +tst/paranoia.c:1924: warning: missing return value +tst/paranoia.c:1939: warning: missing return value +tst/paranoia.c:1956: warning: missing return value +tst/paranoia.c:1975: warning: missing return value +tst/paranoia.c:1988: warning: missing return value +tst/paranoia.c:1995: warning: missing return value +tst/paranoia.c:2055: warning: missing return value +tst/paranoia.c:2062: warning: missing return value +tst/paranoia.c:2070: warning: missing return value +tst/paranoia.c:2087: warning: missing return value +tst/paranoia.c:2115: warning: missing return value +tst/paranoia.c:2144: warning: missing return value +tst/paranoia.c:2173: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/paranoia.sbk b/src/cmd/lccom-1/tst/x86-linux/paranoia.sbk new file mode 100644 index 0000000..285ef4f --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/paranoia.sbk @@ -0,0 +1,20618 @@ +.data +.globl Zero +.align 4 +.type Zero,@object +.size Zero,8 +Zero: +.long 0 +.long 0 +.globl Half +.align 4 +.type Half,@object +.size Half,8 +Half: +.long 0 +.long 1071644672 +.globl One +.align 4 +.type One,@object +.size One,8 +One: +.long 0 +.long 1072693248 +.globl Two +.align 4 +.type Two,@object +.size Two,8 +Two: +.long 0 +.long 1073741824 +.globl Three +.align 4 +.type Three,@object +.size Three,8 +Three: +.long 0 +.long 1074266112 +.globl Four +.align 4 +.type Four,@object +.size Four,8 +Four: +.long 0 +.long 1074790400 +.globl Five +.align 4 +.type Five,@object +.size Five,8 +Five: +.long 0 +.long 1075052544 +.globl Eight +.align 4 +.type Eight,@object +.size Eight,8 +Eight: +.long 0 +.long 1075838976 +.globl Nine +.align 4 +.type Nine,@object +.size Nine,8 +Nine: +.long 0 +.long 1075970048 +.globl TwentySeven +.align 4 +.type TwentySeven,@object +.size TwentySeven,8 +TwentySeven: +.long 0 +.long 1077608448 +.globl ThirtyTwo +.align 4 +.type ThirtyTwo,@object +.size ThirtyTwo,8 +ThirtyTwo: +.long 0 +.long 1077936128 +.globl TwoForty +.align 4 +.type TwoForty,@object +.size TwoForty,8 +TwoForty: +.long 0 +.long 1080950784 +.globl MinusOne +.align 4 +.type MinusOne,@object +.size MinusOne,8 +MinusOne: +.long 0 +.long -1074790400 +.globl OneAndHalf +.align 4 +.type OneAndHalf,@object +.size OneAndHalf,8 +OneAndHalf: +.long 0 +.long 1073217536 +.globl NoTrials +.align 4 +.type NoTrials,@object +.size NoTrials,4 +NoTrials: +.long 20 +.globl sigfpe +.text +.align 16 +.type sigfpe,@function +sigfpe: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +incl fpecount +pushl $.LC2 +call printf +addl $4,%esp +pushl $_iob+32 +call fflush +addl $4,%esp +movl sigsave,%edi +cmpl $0,%edi +je .LC4 +pushl sigsave +pushl $8 +call signal +addl $8,%esp +movl $0,sigsave +pushl $1 +pushl $ovfl_buf +call longjmp +addl $8,%esp +.LC4: +call abort +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf6: +.size sigfpe,.Lf6-sigfpe +.data +.align 4 +.type msg.758,@object +msg.758: +.long .LC759 +.long .LC760 +.long .LC761 +.long .LC762 +.size msg.758,16 +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $1684,%esp +fldl .LC8 +fstpl Zero +fldl .LC9 +fstpl One +fldl One +fstpl -8(%ebp) +fldl -8(%ebp) +faddl -8(%ebp) +fstpl Two +fldl Two +fstpl -16(%ebp) +fldl -16(%ebp) +faddl -8(%ebp) +fstpl Three +fldl Three +fstpl -24(%ebp) +fldl -24(%ebp) +faddl -8(%ebp) +fstpl Four +fldl Four +fstpl -32(%ebp) +fldl -32(%ebp) +faddl -8(%ebp) +fstpl Five +fldl -32(%ebp) +faddl -32(%ebp) +fstpl Eight +fldl -24(%ebp) +fmull -24(%ebp) +fstpl Nine +fldl Nine +fmull -24(%ebp) +fstpl TwentySeven +fldl -32(%ebp) +fmull Eight +fstpl ThirtyTwo +fldl -32(%ebp) +fmull Five +fmull -24(%ebp) +fmull -32(%ebp) +fstpl TwoForty +fldl -8(%ebp) +fchs +fstpl MinusOne +fldl -8(%ebp) +fdivl -16(%ebp) +fstpl Half +fldl -8(%ebp) +faddl Half +fstpl OneAndHalf +movl $0,ErrCnt +movl $0,ErrCnt+4 +movl $0,ErrCnt+8 +movl $0,ErrCnt+12 +movl $1,PageNo +movl $0,Milestone +pushl $sigfpe +pushl $8 +call signal +addl $8,%esp +call Instructions +call Pause +call Heading +call Pause +call Characteristics +call Pause +call History +call Pause +movl $7,Milestone +pushl $.LC13 +call printf +addl $4,%esp +pushl $.LC15 +fldl Zero +faddl Zero +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC16 +jne .LC16 +fldl One +fsubl One +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC16 +jne .LC16 +fldl Zero +fcompl One +fstsw %ax +sahf +jp .LC16 +jae .LC16 +fldl One +faddl One +fldl Two +fcompp +fstsw %ax +sahf +jp .LC16 +jne .LC16 +movl $1,-36(%ebp) +jmp .LC17 +.LC16: +movl $0,-36(%ebp) +.LC17: +pushl -36(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl Zero +fchs +fstpl Z +fldl .LC8 +fcompl Z +fstsw %ax +sahf +jp 1f +je .LC18 +1: +incl ErrCnt +pushl $.LC20 +call printf +addl $4,%esp +fldl .LC21 +fstpl U1 +fldl .LC9 +fstpl Radix +call TstPtUf +.LC18: +pushl $.LC23 +fldl Two +faddl One +fcompl Three +fstsw %ax +sahf +jp .LC24 +jne .LC24 +fldl Three +faddl One +fcompl Four +fstsw %ax +sahf +jp .LC24 +jne .LC24 +fldl Four +fldl Two +fldl Two +fchs +fmulp %st,%st(1) +faddp %st,%st(1) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC24 +jne .LC24 +fldl Four +fsubl Three +fsubl One +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC24 +jne .LC24 +movl $1,-56(%ebp) +jmp .LC25 +.LC24: +movl $0,-56(%ebp) +.LC25: +pushl -56(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl .LC8 +fsubl One +fcompl MinusOne +fstsw %ax +sahf +jp .LC28 +jne .LC28 +fldl MinusOne +faddl One +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC28 +jne .LC28 +fldl One +faddl MinusOne +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC28 +jne .LC28 +fldl One +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -132(%ebp) +fldl MinusOne +faddl -132(%ebp) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC28 +jne .LC28 +fldl MinusOne +fldl MinusOne +fmull MinusOne +faddp %st,%st(1) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC28 +jne .LC28 +movl $1,-100(%ebp) +jmp .LC29 +.LC28: +movl $0,-100(%ebp) +.LC29: +pushl $.LC27 +pushl -100(%ebp) +pushl $0 +call TstCond +addl $12,%esp +pushl $.LC31 +fldl Half +faddl MinusOne +faddl Half +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC32 +jne .LC32 +movl $1,-152(%ebp) +jmp .LC33 +.LC32: +movl $0,-152(%ebp) +.LC33: +pushl -152(%ebp) +pushl $0 +call TstCond +addl $12,%esp +movl $10,Milestone +pushl $.LC35 +fldl Three +fmull Three +fcompl Nine +fstsw %ax +sahf +jp .LC36 +jne .LC36 +fldl Nine +fmull Three +fcompl TwentySeven +fstsw %ax +sahf +jp .LC36 +jne .LC36 +fldl Four +faddl Four +fcompl Eight +fstsw %ax +sahf +jp .LC36 +jne .LC36 +fldl Eight +fmull Four +fcompl ThirtyTwo +fstsw %ax +sahf +jp .LC36 +jne .LC36 +fldl ThirtyTwo +fsubl TwentySeven +fsubl Four +fsubl One +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC36 +jne .LC36 +movl $1,-164(%ebp) +jmp .LC37 +.LC36: +movl $0,-164(%ebp) +.LC37: +pushl -164(%ebp) +pushl $0 +call TstCond +addl $12,%esp +pushl $.LC39 +fldl Four +faddl One +fcompl Five +fstsw %ax +sahf +jp .LC40 +jne .LC40 +fldl Four +fmull Five +fmull Three +fmull Four +fcompl TwoForty +fstsw %ax +sahf +jp .LC40 +jne .LC40 +fldl TwoForty +fdivl Three +fldl Four +fmull Four +fmull Five +fsubrp %st,%st(1) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC40 +jne .LC40 +fldl TwoForty +fdivl Four +fldl Five +fmull Three +fmull Four +fsubrp %st,%st(1) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC40 +jne .LC40 +fldl TwoForty +fdivl Five +fldl Four +fmull Three +fmull Four +fsubrp %st,%st(1) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC40 +jne .LC40 +movl $1,-216(%ebp) +jmp .LC41 +.LC40: +movl $0,-216(%ebp) +.LC41: +pushl -216(%ebp) +pushl $0 +call TstCond +addl $12,%esp +cmpl $0,ErrCnt +jne .LC42 +pushl $.LC44 +call printf +addl $4,%esp +pushl $.LC45 +call printf +addl $4,%esp +.LC42: +pushl $.LC46 +call printf +addl $4,%esp +fldl One +fstpl W +.LC47: +fldl W +fstpl -264(%ebp) +fldl -264(%ebp) +faddl -264(%ebp) +fstpl W +fldl W +fstpl -272(%ebp) +fldl -272(%ebp) +faddl One +fstpl Y +fldl Y +fsubl -272(%ebp) +fstpl Z +fldl Z +fsubl One +fstpl Y +.LC48: +fldl Y +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -264(%ebp) +fldl MinusOne +faddl -264(%ebp) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC47 +ja .LC47 +fldl Zero +fstpl Precision +fldl One +fstpl Y +.LC50: +fldl Y +fstpl -280(%ebp) +fldl W +faddl -280(%ebp) +fstpl Radix +fldl -280(%ebp) +faddl -280(%ebp) +fstpl Y +fldl Radix +fsubl W +fstpl Radix +.LC51: +fldl Zero +fcompl Radix +fstsw %ax +sahf +jp 1f +je .LC50 +1: +fldl Two +fcompl Radix +fstsw %ax +sahf +jp .LC53 +jbe .LC53 +fldl One +fstpl Radix +.LC53: +fldl Radix +subl $8,%esp +fstpl (%esp) +pushl $.LC55 +call printf +addl $12,%esp +fldl .LC9 +fcompl Radix +fstsw %ax +sahf +jp 1f +je .LC56 +1: +fldl One +fstpl W +.LC58: +fldl Precision +faddl One +fstpl Precision +fldl W +fmull Radix +fstpl W +fldl W +faddl One +fstpl Y +.LC59: +fldl Y +fsubl W +fldl One +fcompp +fstsw %ax +sahf +jp 1f +je .LC58 +1: +.LC56: +fldl One +fdivl W +fstpl U1 +fldl U1 +fstpl -272(%ebp) +fldl Radix +fmull -272(%ebp) +fstpl U2 +fldl -272(%ebp) +subl $8,%esp +fstpl (%esp) +pushl $.LC61 +call printf +addl $12,%esp +pushl $.LC62 +call printf +addl $4,%esp +fldl Radix +fstpl E0 +fldl U1 +fstpl E1 +fldl U2 +fstpl E9 +fldl Precision +fstpl E3 +fldl Four +fdivl Three +fstpl X +fldl X +fsubl One +fstpl Third +fldl Third +fstpl -280(%ebp) +fldl Half +fsubl -280(%ebp) +fstpl F6 +fldl F6 +fstpl -288(%ebp) +fldl -288(%ebp) +faddl -288(%ebp) +fstpl X +fldl X +fsubl -280(%ebp) +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -296(%ebp) +fldl -296(%ebp) +fstpl X +fldl U2 +fcompl X +fstsw %ax +sahf +jp .LC63 +jbe .LC63 +fldl U2 +fstpl X +.LC63: +.LC65: +fldl X +fstpl U2 +fldl U2 +fstpl -304(%ebp) +fldl Half +fmull -304(%ebp) +fldl ThirtyTwo +fmull -304(%ebp) +fmull -304(%ebp) +faddp %st,%st(1) +fstpl Y +fldl One +faddl Y +fstpl Y +fldl Y +fsubl One +fstpl X +.LC66: +fldl X +fcompl U2 +fstsw %ax +sahf +jp .LC68 +jae .LC68 +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC65 +jb .LC65 +.LC68: +fldl Two +fdivl Three +fstpl X +fldl X +fsubl Half +fstpl F6 +fldl F6 +fstpl -320(%ebp) +fldl -320(%ebp) +faddl -320(%ebp) +fstpl Third +fldl Third +fsubl Half +fstpl X +fldl X +faddl -320(%ebp) +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -328(%ebp) +fldl -328(%ebp) +fstpl X +fldl U1 +fcompl X +fstsw %ax +sahf +jp .LC69 +jbe .LC69 +fldl U1 +fstpl X +.LC69: +.LC71: +fldl X +fstpl U1 +fldl U1 +fstpl -344(%ebp) +fldl Half +fmull -344(%ebp) +fldl ThirtyTwo +fmull -344(%ebp) +fmull -344(%ebp) +faddp %st,%st(1) +fstpl Y +fldl Half +fsubl Y +fstpl Y +fldl Half +faddl Y +fstpl X +fldl Half +fsubl X +fstpl Y +fldl Half +faddl Y +fstpl X +.LC72: +fldl X +fcompl U1 +fstsw %ax +sahf +jp .LC74 +jae .LC74 +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC71 +jb .LC71 +.LC74: +fldl E1 +fcompl U1 +fstsw %ax +sahf +jp .LC75 +jne .LC75 +pushl $.LC77 +call printf +addl $4,%esp +jmp .LC76 +.LC75: +fldl U1 +subl $8,%esp +fstpl (%esp) +pushl $.LC78 +call printf +addl $12,%esp +.LC76: +fldl One +fdivl U1 +fstpl W +fldl Half +fsubl U1 +faddl Half +fstpl F9 +fldl U2 +fdivl U1 +faddl .LC79 +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -360(%ebp) +fldl -360(%ebp) +fstpl Radix +fldl E0 +fcompl Radix +fstsw %ax +sahf +jp .LC80 +jne .LC80 +pushl $.LC82 +call printf +addl $4,%esp +jmp .LC81 +.LC80: +fldl Radix +subl $8,%esp +fstpl (%esp) +pushl $.LC83 +call printf +addl $12,%esp +.LC81: +pushl $.LC85 +fldl Eight +faddl Eight +fcompl Radix +fstsw %ax +sahf +jp .LC86 +jb .LC86 +movl $1,-364(%ebp) +jmp .LC87 +.LC86: +movl $0,-364(%ebp) +.LC87: +pushl -364(%ebp) +pushl $2 +call TstCond +addl $12,%esp +pushl $.LC89 +fldl Two +fcompl Radix +fstsw %ax +sahf +jp 1f +je .LC93 +1: +fldl .LC94 +fcompl Radix +fstsw %ax +sahf +jp 1f +je .LC93 +1: +fldl One +fcompl Radix +fstsw %ax +sahf +jp .LC90 +jne .LC90 +.LC93: +movl $1,-376(%ebp) +jmp .LC91 +.LC90: +movl $0,-376(%ebp) +.LC91: +pushl -376(%ebp) +pushl $3 +call TstCond +addl $12,%esp +movl $20,Milestone +pushl $.LC96 +fldl F9 +fsubl Half +fldl Half +fcompp +fstsw %ax +sahf +jp .LC97 +jbe .LC97 +movl $1,-388(%ebp) +jmp .LC98 +.LC97: +movl $0,-388(%ebp) +.LC98: +pushl -388(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl F9 +fstpl X +movl $1,I +fldl X +fsubl Half +fstpl Y +fldl Y +fsubl Half +fstpl Z +pushl $.LC100 +fldl One +fcompl X +fstsw %ax +sahf +jp .LC103 +jne .LC103 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC101 +jne .LC101 +.LC103: +movl $1,-400(%ebp) +jmp .LC102 +.LC101: +movl $0,-400(%ebp) +.LC102: +pushl -400(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl One +faddl U2 +fstpl X +movl $0,I +movl $25,Milestone +fldl Radix +fsubl One +fstpl BMinusU2 +fldl BMinusU2 +fsubl U2 +faddl One +fstpl BMinusU2 +fldl One +fcompl Radix +fstsw %ax +sahf +jp 1f +je .LC104 +1: +fldl U1 +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -440(%ebp) +fldl Radix +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -448(%ebp) +fldl TwoForty +fchs +fmull -440(%ebp) +fdivl -448(%ebp) +fstpl X +fldl Half +faddl X +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -456(%ebp) +fldl -456(%ebp) +fstpl Y +fldl X +fsubl Y +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -464(%ebp) +fldl -464(%ebp) +fmull Four +fldl One +fcompp +fstsw %ax +sahf +jp .LC106 +jbe .LC106 +fldl Y +fstpl X +.LC106: +fldl X +fdivl TwoForty +fstpl Precision +fldl Half +faddl Precision +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -472(%ebp) +fldl -472(%ebp) +fstpl Y +fldl Precision +fsubl Y +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -480(%ebp) +fldl -480(%ebp) +fmull TwoForty +fldl Half +fcompp +fstsw %ax +sahf +jp .LC108 +jbe .LC108 +fldl Y +fstpl Precision +.LC108: +.LC104: +fldl Precision +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -448(%ebp) +fldl -448(%ebp) +fcompl Precision +fstsw %ax +sahf +jp .LC112 +jne .LC112 +fldl One +fcompl Radix +fstsw %ax +sahf +jp .LC110 +jne .LC110 +.LC112: +pushl $.LC113 +call printf +addl $4,%esp +pushl $.LC114 +call printf +addl $4,%esp +.LC110: +fldl One +fcompl Radix +fstsw %ax +sahf +jp .LC115 +jne .LC115 +pushl $.LC117 +call printf +addl $4,%esp +jmp .LC116 +.LC115: +fldl Precision +subl $8,%esp +fstpl (%esp) +pushl $.LC118 +call printf +addl $12,%esp +.LC116: +pushl $.LC120 +fldl U2 +fmull Nine +fmull Nine +fmull TwoForty +fldl One +fcompp +fstsw %ax +sahf +jp .LC121 +jbe .LC121 +movl $1,-452(%ebp) +jmp .LC122 +.LC121: +movl $0,-452(%ebp) +.LC122: +pushl -452(%ebp) +pushl $1 +call TstCond +addl $12,%esp +movl $30,Milestone +fldl One +fdivl Four +fstpl -492(%ebp) +fldl Four +fdivl Three +fsubl One +fsubl -492(%ebp) +fmull Three +fsubl -492(%ebp) +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -500(%ebp) +fldl -500(%ebp) +fstpl X +.LC123: +fldl X +fstpl Z2 +fldl Z2 +fstpl -516(%ebp) +fldl One +fldl Half +fmull -516(%ebp) +fldl ThirtyTwo +fmull -516(%ebp) +fmull -516(%ebp) +faddp %st,%st(1) +faddp %st,%st(1) +fsubl One +fstpl X +.LC124: +fldl X +fcompl Z2 +fstsw %ax +sahf +jp .LC126 +jae .LC126 +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC123 +jb .LC123 +.LC126: +fldl Three +fdivl Four +fldl Two +fdivl Three +fsubrp %st,%st(1) +fmull Three +fldl One +fdivl Four +fsubrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -532(%ebp) +fldl -532(%ebp) +fstpl Z +fldl -532(%ebp) +fstpl Y +fldl -532(%ebp) +fstpl X +.LC127: +fldl Z +fstpl Z1 +fldl One +fdivl Two +fstpl -540(%ebp) +fldl Z1 +fstpl -548(%ebp) +fldl -540(%ebp) +fldl -540(%ebp) +fldl Half +fmull -548(%ebp) +fldl ThirtyTwo +fmull -548(%ebp) +fmull -548(%ebp) +faddp %st,%st(1) +fsubrp %st,%st(1) +faddl -540(%ebp) +fsubrp %st,%st(1) +faddl -540(%ebp) +fstpl Z +.LC128: +fldl Z +fcompl Z1 +fstsw %ax +sahf +jp .LC130 +jae .LC130 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC127 +jb .LC127 +.LC130: +.LC131: +.LC134: +fldl Y +fstpl Y1 +fldl Y1 +fstpl -556(%ebp) +fldl Half +fldl Half +fldl Half +fmull -556(%ebp) +fldl ThirtyTwo +fmull -556(%ebp) +fmull -556(%ebp) +faddp %st,%st(1) +fsubrp %st,%st(1) +faddl Half +fsubrp %st,%st(1) +faddl Half +fstpl Y +.LC135: +fldl Y +fcompl Y1 +fstsw %ax +sahf +jp .LC137 +jae .LC137 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC134 +jb .LC134 +.LC137: +fldl X +fstpl X1 +fldl X1 +fstpl -556(%ebp) +fldl Half +fmull -556(%ebp) +fldl ThirtyTwo +fmull -556(%ebp) +fmull -556(%ebp) +faddp %st,%st(1) +fsubl F9 +faddl F9 +fstpl X +.LC132: +fldl X +fcompl X1 +fstsw %ax +sahf +jp .LC138 +jae .LC138 +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC131 +jb .LC131 +.LC138: +fldl Y1 +fcompl X1 +fstsw %ax +sahf +jp .LC141 +jne .LC141 +fldl Z1 +fcompl X1 +fstsw %ax +sahf +jp 1f +je .LC139 +1: +.LC141: +pushl $.LC142 +pushl $1 +call BadCond +addl $8,%esp +fldl Z1 +subl $8,%esp +fstpl (%esp) +fldl Y1 +subl $8,%esp +fstpl (%esp) +fldl X1 +subl $8,%esp +fstpl (%esp) +pushl $.LC143 +call printf +addl $28,%esp +pushl $.LC144 +call printf +addl $4,%esp +pushl $.LC145 +call printf +addl $4,%esp +pushl $.LC146 +call notify +addl $4,%esp +fldl U1 +fcompl X1 +fstsw %ax +sahf +jp 1f +je .LC150 +1: +fldl U1 +fcompl Y1 +fstsw %ax +sahf +jp 1f +je .LC150 +1: +fldl U1 +fcompl Z1 +fstsw %ax +sahf +jp .LC140 +jne .LC140 +.LC150: +pushl $.LC151 +call printf +addl $4,%esp +jmp .LC140 +.LC139: +fldl U1 +fcompl Z1 +fstsw %ax +sahf +jp .LC154 +jne .LC154 +fldl U2 +fcompl Z2 +fstsw %ax +sahf +jp 1f +je .LC152 +1: +.LC154: +fldl U1 +fcompl Z1 +fstsw %ax +sahf +jp .LC157 +jbe .LC157 +fldl U2 +fcompl Z2 +fstsw %ax +sahf +jp .LC155 +ja .LC155 +.LC157: +pushl $.LC158 +pushl $0 +call BadCond +addl $8,%esp +pushl $.LC159 +call notify +addl $4,%esp +fldl Z1 +fsubl U1 +subl $8,%esp +fstpl (%esp) +fldl U1 +subl $8,%esp +fstpl (%esp) +pushl $.LC160 +call printf +addl $20,%esp +fldl Z2 +fsubl U2 +subl $8,%esp +fstpl (%esp) +fldl U2 +subl $8,%esp +fstpl (%esp) +pushl $.LC161 +call printf +addl $20,%esp +jmp .LC156 +.LC155: +fldl Zero +fcompl Z1 +fstsw %ax +sahf +jp .LC164 +jae .LC164 +fldl Zero +fcompl Z2 +fstsw %ax +sahf +jp .LC162 +jb .LC162 +.LC164: +fldl Radix +subl $8,%esp +fstpl (%esp) +pushl $.LC165 +call printf +addl $12,%esp +pushl $.LC166 +call printf +addl $4,%esp +fldl Z2 +subl $8,%esp +fstpl (%esp) +fldl Z1 +subl $8,%esp +fstpl (%esp) +pushl $.LC167 +call printf +addl $20,%esp +pushl $.LC168 +call notify +addl $4,%esp +.LC162: +fldl Z2 +fcompl Z1 +fstsw %ax +sahf +jp .LC171 +jne .LC171 +fldl Zero +fcompl Z1 +fstsw %ax +sahf +jp .LC169 +jae .LC169 +.LC171: +fldl Z1 +fdivl U1 +fstpl X +fldl Z2 +fdivl U2 +fstpl Y +fldl X +fcompl Y +fstsw %ax +sahf +jp .LC172 +jae .LC172 +fldl Y +fstpl X +.LC172: +fldl X +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -580(%ebp) +fldl -580(%ebp) +fchs +fstpl Q +pushl $.LC174 +call printf +addl $4,%esp +fldl Radix +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -588(%ebp) +fldl Q +fdivl -588(%ebp) +subl $8,%esp +fstpl (%esp) +pushl $.LC175 +call printf +addl $12,%esp +fldl .LC94 +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -596(%ebp) +fldl Q +fdivl -596(%ebp) +subl $8,%esp +fstpl (%esp) +pushl $.LC176 +call printf +addl $12,%esp +.LC169: +pushl $.LC151 +call printf +addl $4,%esp +.LC156: +.LC152: +.LC140: +call Pause +movl $35,Milestone +fldl Two +fcompl Radix +fstsw %ax +sahf +jp .LC177 +ja .LC177 +fldl W +fldl Radix +fmull Radix +fdivrp %st,%st(1) +fstpl X +fldl X +fstpl -576(%ebp) +fldl -576(%ebp) +faddl One +fstpl Y +fldl Y +fsubl -576(%ebp) +fstpl Z +fldl Z +fstpl -584(%ebp) +fldl -584(%ebp) +faddl U2 +fstpl T +fldl T +fsubl -584(%ebp) +fstpl X +pushl $.LC180 +fldl U2 +fcompl X +fstsw %ax +sahf +jp .LC181 +jne .LC181 +movl $1,-560(%ebp) +jmp .LC182 +.LC181: +movl $0,-560(%ebp) +.LC182: +pushl -560(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl U2 +fcompl X +fstsw %ax +sahf +jp .LC183 +jne .LC183 +pushl $.LC185 +call printf +addl $4,%esp +.LC183: +.LC177: +pushl $.LC186 +call printf +addl $4,%esp +fldl F9 +fmull One +fstpl Y +fldl One +fmull F9 +fstpl Z +fldl F9 +fsubl Half +fstpl X +fldl X +fstpl -588(%ebp) +fldl Y +fsubl Half +fsubl -588(%ebp) +fstpl Y +fldl Z +fsubl Half +fsubl -588(%ebp) +fstpl Z +fldl One +faddl U2 +fstpl X +fldl X +fstpl -604(%ebp) +fldl -604(%ebp) +fmull Radix +fstpl T +fldl Radix +fmull -604(%ebp) +fstpl R +fldl T +fsubl Radix +fstpl X +fldl Radix +fmull U2 +fstpl -620(%ebp) +fldl X +fsubl -620(%ebp) +fstpl X +fldl R +fsubl Radix +fstpl T +fldl T +fsubl -620(%ebp) +fstpl T +fldl Radix +fsubl One +fstpl -628(%ebp) +fldl X +fmull -628(%ebp) +fstpl X +fldl T +fmull -628(%ebp) +fstpl T +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC187 +jne .LC187 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC187 +jne .LC187 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC187 +jne .LC187 +fldl Zero +fcompl T +fstsw %ax +sahf +jp .LC187 +jne .LC187 +movl $1,GMult +jmp .LC188 +.LC187: +movl $0,GMult +pushl $.LC189 +pushl $0 +pushl $1 +call TstCond +addl $12,%esp +.LC188: +fldl Radix +fmull U2 +fstpl Z +fldl Z +fstpl -648(%ebp) +fldl One +faddl -648(%ebp) +fstpl X +fldl X +fstpl -656(%ebp) +fldl -656(%ebp) +faddl -648(%ebp) +fldl -656(%ebp) +fmull -656(%ebp) +fsubrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -664(%ebp) +fldl -664(%ebp) +fsubl U2 +fstpl Y +fldl One +fsubl U2 +fstpl X +fldl X +fstpl -680(%ebp) +fldl -680(%ebp) +fsubl U2 +fldl -680(%ebp) +fmull -680(%ebp) +fsubrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -688(%ebp) +fldl -688(%ebp) +fsubl U1 +fstpl Z +pushl $.LC191 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC192 +jb .LC192 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC192 +jb .LC192 +movl $1,-640(%ebp) +jmp .LC193 +.LC192: +movl $0,-640(%ebp) +.LC193: +pushl -640(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl One +fsubl U2 +fstpl Y +fldl One +faddl U2 +fstpl X +fldl One +fdivl Y +fstpl Z +fldl Z +fsubl X +fstpl Y +fldl One +fdivl Three +fstpl X +fldl Three +fdivl Nine +fstpl Z +fldl Z +fstpl -740(%ebp) +fldl X +fsubl -740(%ebp) +fstpl X +fldl Nine +fdivl TwentySeven +fstpl T +fldl -740(%ebp) +fsubl T +fstpl Z +pushl $.LC195 +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC196 +jne .LC196 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC196 +jne .LC196 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC196 +jne .LC196 +movl $1,-700(%ebp) +jmp .LC197 +.LC196: +movl $0,-700(%ebp) +.LC197: +pushl -700(%ebp) +pushl $2 +call TstCond +addl $12,%esp +fldl F9 +fdivl One +fstpl Y +fldl F9 +fsubl Half +fstpl X +fldl Y +fsubl Half +fsubl X +fstpl Y +fldl One +faddl U2 +fstpl X +fldl X +fstpl -780(%ebp) +fldl -780(%ebp) +fdivl One +fstpl T +fldl T +fsubl -780(%ebp) +fstpl X +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC198 +jne .LC198 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC198 +jne .LC198 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC198 +jne .LC198 +movl $1,GDiv +jmp .LC199 +.LC198: +movl $0,GDiv +pushl $.LC200 +pushl $0 +pushl $1 +call TstCond +addl $12,%esp +.LC199: +fldl One +fldl One +faddl U2 +fdivrp %st,%st(1) +fstpl X +fldl X +fsubl Half +fsubl Half +fstpl Y +pushl $.LC202 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC203 +jbe .LC203 +movl $1,-792(%ebp) +jmp .LC204 +.LC203: +movl $0,-792(%ebp) +.LC204: +pushl -792(%ebp) +pushl $1 +call TstCond +addl $12,%esp +fldl One +fsubl U2 +fstpl X +fldl One +fldl Radix +fmull U2 +faddp %st,%st(1) +fstpl Y +fldl X +fstpl -844(%ebp) +fldl -844(%ebp) +fmull Radix +fstpl Z +fldl Y +fstpl -852(%ebp) +fldl -852(%ebp) +fmull Radix +fstpl T +fldl Z +fdivl Radix +fstpl R +fldl T +fdivl Radix +fstpl StickyBit +fldl R +fsubl -844(%ebp) +fstpl X +fldl StickyBit +fsubl -852(%ebp) +fstpl Y +pushl $.LC206 +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC207 +jne .LC207 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC207 +jne .LC207 +movl $1,-812(%ebp) +jmp .LC208 +.LC207: +movl $0,-812(%ebp) +.LC208: +pushl -812(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl One +fsubl U1 +fstpl Y +fldl One +fsubl F9 +fstpl X +fldl One +fsubl Y +fstpl Y +fldl Radix +fsubl U2 +fstpl T +fldl Radix +fsubl BMinusU2 +fstpl Z +fldl Radix +fsubl T +fstpl T +fldl U1 +fcompl X +fstsw %ax +sahf +jp .LC209 +jne .LC209 +fldl U1 +fcompl Y +fstsw %ax +sahf +jp .LC209 +jne .LC209 +fldl U2 +fcompl Z +fstsw %ax +sahf +jp .LC209 +jne .LC209 +fldl U2 +fcompl T +fstsw %ax +sahf +jp .LC209 +jne .LC209 +movl $1,GAddSub +jmp .LC210 +.LC209: +movl $0,GAddSub +pushl $.LC211 +pushl $0 +pushl $1 +call TstCond +addl $12,%esp +.LC210: +fldl One +fcompl F9 +fstsw %ax +sahf +jp 1f +je .LC212 +1: +fldl F9 +fsubl One +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC212 +ja .LC212 +pushl $.LC214 +pushl $1 +call BadCond +addl $8,%esp +pushl $.LC215 +call printf +addl $4,%esp +pushl $.LC216 +call printf +addl $4,%esp +pushl $.LC217 +call printf +addl $4,%esp +.LC212: +cmpl $1,GMult +jne .LC218 +cmpl $1,GDiv +jne .LC218 +cmpl $1,GAddSub +jne .LC218 +pushl $.LC220 +call printf +addl $4,%esp +.LC218: +movl $40,Milestone +call Pause +pushl $.LC221 +call printf +addl $4,%esp +movl $0,RMult +movl $0,RDiv +movl $0,RAddSub +fldl Radix +fdivl Two +fstpl RadixD2 +fldl Two +fstpl A1 +movl $0,Done +.LC222: +fldl Radix +fstpl AInvrse +.LC225: +fldl AInvrse +fstpl -924(%ebp) +fldl -924(%ebp) +fstpl X +fldl -924(%ebp) +fdivl A1 +fstpl AInvrse +.LC226: +fldl AInvrse +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -924(%ebp) +fldl AInvrse +fcompl -924(%ebp) +fstsw %ax +sahf +jp 1f +je .LC225 +1: +fldl One +fcompl X +fstsw %ax +sahf +jp 1f +je .LC231 +1: +fldl Three +fcompl A1 +fstsw %ax +sahf +jp .LC229 +jae .LC229 +.LC231: +movl $1,-928(%ebp) +jmp .LC230 +.LC229: +movl $0,-928(%ebp) +.LC230: +movl -928(%ebp),%edi +movl %edi,Done +cmpl $0,Done +jne .LC232 +fldl Nine +faddl One +fstpl A1 +.LC232: +.LC223: +cmpl $0,Done +je .LC222 +fldl One +fcompl X +fstsw %ax +sahf +jp .LC234 +jne .LC234 +fldl Radix +fstpl A1 +.LC234: +fldl One +fdivl A1 +fstpl AInvrse +fldl A1 +fstpl X +fldl AInvrse +fstpl Y +movl $0,Done +.LC236: +fldl X +fmull Y +fsubl Half +fstpl Z +pushl $.LC240 +fldl Half +fcompl Z +fstsw %ax +sahf +jp .LC241 +jne .LC241 +movl $1,-928(%ebp) +jmp .LC242 +.LC241: +movl $0,-928(%ebp) +.LC242: +pushl -928(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl Radix +fcompl X +fstsw %ax +sahf +jp .LC244 +jne .LC244 +movl $1,-940(%ebp) +jmp .LC245 +.LC244: +movl $0,-940(%ebp) +.LC245: +movl -940(%ebp),%edi +movl %edi,Done +fldl Radix +fstpl X +fldl One +fdivl X +fstpl Y +.LC237: +cmpl $0,Done +je .LC236 +fldl One +faddl U2 +fstpl Y2 +fldl One +fsubl U2 +fstpl Y1 +fldl OneAndHalf +fsubl U2 +fstpl X +fldl OneAndHalf +faddl U2 +fstpl Y +fldl X +fstpl -956(%ebp) +fldl Y2 +fstpl -964(%ebp) +fldl -956(%ebp) +fsubl U2 +fmull -964(%ebp) +fstpl Z +fldl Y +fstpl -972(%ebp) +fldl Y1 +fstpl -980(%ebp) +fldl -972(%ebp) +fmull -980(%ebp) +fstpl T +fldl Z +fsubl -956(%ebp) +fstpl Z +fldl T +fsubl -956(%ebp) +fstpl T +fldl -956(%ebp) +fmull -964(%ebp) +fstpl X +fldl -972(%ebp) +faddl U2 +fmull -980(%ebp) +fstpl Y +fldl X +fsubl OneAndHalf +fstpl X +fldl Y +fsubl OneAndHalf +fstpl Y +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC246 +jne .LC246 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC246 +jne .LC246 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC246 +jne .LC246 +fldl Zero +fcompl T +fstsw %ax +sahf +jp .LC246 +jb .LC246 +fldl OneAndHalf +faddl U2 +fstpl -1012(%ebp) +fldl -1012(%ebp) +fmull Y2 +fstpl X +fldl OneAndHalf +fsubl U2 +fstpl -1028(%ebp) +fldl -1028(%ebp) +fsubl U2 +fstpl Y +fldl -1012(%ebp) +faddl U2 +fstpl Z +fldl Y1 +fstpl -1036(%ebp) +fldl -1028(%ebp) +fmull -1036(%ebp) +fstpl T +fldl Z +fstpl -1044(%ebp) +fldl -1044(%ebp) +faddl U2 +fstpl -1052(%ebp) +fldl X +fsubl -1052(%ebp) +fstpl X +fldl Y +fstpl -1060(%ebp) +fldl -1060(%ebp) +fmull -1036(%ebp) +fstpl StickyBit +fldl -1044(%ebp) +fmull Y2 +fstpl S +fldl T +fsubl -1060(%ebp) +fstpl T +fldl U2 +fsubl -1060(%ebp) +faddl StickyBit +fstpl Y +fldl S +fldl -1052(%ebp) +faddl U2 +fsubrp %st,%st(1) +fstpl Z +fldl Y2 +faddl U2 +fmull -1036(%ebp) +fstpl StickyBit +fldl Y2 +fmull -1036(%ebp) +fstpl Y1 +fldl StickyBit +fsubl Y2 +fstpl StickyBit +fldl Y1 +fsubl Half +fstpl Y1 +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC248 +jne .LC248 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC248 +jne .LC248 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC248 +jne .LC248 +fldl Zero +fcompl T +fstsw %ax +sahf +jp .LC248 +jne .LC248 +fldl Zero +fcompl StickyBit +fstsw %ax +sahf +jp .LC248 +jne .LC248 +fldl Half +fcompl Y1 +fstsw %ax +sahf +jp .LC248 +jne .LC248 +movl $1,RMult +pushl $.LC250 +call printf +addl $4,%esp +jmp .LC249 +.LC248: +fldl X +faddl U2 +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC251 +jne .LC251 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC251 +jbe .LC251 +fldl Z +faddl U2 +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC251 +jne .LC251 +fldl Zero +fcompl T +fstsw %ax +sahf +jp .LC251 +jbe .LC251 +fldl StickyBit +faddl U2 +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC251 +jne .LC251 +fldl Half +fcompl Y1 +fstsw %ax +sahf +jp .LC251 +jbe .LC251 +movl $2,RMult +pushl $.LC253 +call printf +addl $4,%esp +jmp .LC252 +.LC251: +pushl $.LC254 +call printf +addl $4,%esp +.LC252: +.LC249: +cmpl $1,RMult +jne .LC247 +cmpl $0,GMult +jne .LC247 +pushl $.LC257 +call notify +addl $4,%esp +jmp .LC247 +.LC246: +pushl $.LC254 +call printf +addl $4,%esp +.LC247: +movl $45,Milestone +fldl One +faddl U2 +fstpl Y2 +fldl One +fsubl U2 +fstpl Y1 +fldl OneAndHalf +faddl U2 +fstpl -1020(%ebp) +fldl -1020(%ebp) +faddl U2 +fstpl Z +fldl Z +fstpl -1028(%ebp) +fldl Y2 +fstpl -1036(%ebp) +fldl -1028(%ebp) +fdivl -1036(%ebp) +fstpl X +fldl OneAndHalf +fsubl U2 +fsubl U2 +fstpl T +fldl T +fstpl -1044(%ebp) +fldl Y1 +fstpl -1052(%ebp) +fldl -1044(%ebp) +fsubl U2 +fdivl -1052(%ebp) +fstpl Y +fldl -1028(%ebp) +faddl U2 +fdivl -1036(%ebp) +fstpl Z +fldl X +fsubl OneAndHalf +fstpl X +fldl Y +fsubl -1044(%ebp) +fstpl Y +fldl -1044(%ebp) +fdivl -1052(%ebp) +fstpl T +fldl Z +fsubl -1020(%ebp) +fstpl Z +fldl U2 +fsubl OneAndHalf +faddl T +fstpl T +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC258 +jb .LC258 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC258 +jb .LC258 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC258 +jb .LC258 +fldl Zero +fcompl T +fstsw %ax +sahf +jp .LC258 +jb .LC258 +fldl Y2 +fstpl -1076(%ebp) +fldl OneAndHalf +fdivl -1076(%ebp) +fstpl X +fldl OneAndHalf +fsubl U2 +fstpl Y +fldl OneAndHalf +faddl U2 +fstpl Z +fldl Y +fstpl -1092(%ebp) +fldl X +fsubl -1092(%ebp) +fstpl X +fldl Y1 +fstpl -1100(%ebp) +fldl OneAndHalf +fdivl -1100(%ebp) +fstpl T +fldl -1092(%ebp) +fdivl -1100(%ebp) +fstpl Y +fldl Z +fstpl -1108(%ebp) +fldl T +fldl -1108(%ebp) +faddl U2 +fsubrp %st,%st(1) +fstpl T +fldl Y +fsubl -1108(%ebp) +fstpl Y +fldl -1108(%ebp) +fdivl -1076(%ebp) +fstpl Z +fldl -1076(%ebp) +faddl U2 +fdivl -1076(%ebp) +fstpl Y1 +fldl Z +fsubl OneAndHalf +fstpl Z +fldl Y1 +fsubl -1076(%ebp) +fstpl Y2 +fldl F9 +fsubl U1 +fdivl F9 +fstpl Y1 +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC260 +jne .LC260 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC260 +jne .LC260 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC260 +jne .LC260 +fldl Zero +fcompl T +fstsw %ax +sahf +jp .LC260 +jne .LC260 +fldl Zero +fcompl Y2 +fstsw %ax +sahf +jp .LC260 +jne .LC260 +fldl Zero +fcompl Y2 +fstsw %ax +sahf +jp .LC260 +jne .LC260 +fldl Y1 +fsubl Half +fldl F9 +fsubl Half +fcompp +fstsw %ax +sahf +jp .LC260 +jne .LC260 +movl $1,RDiv +pushl $.LC262 +call printf +addl $4,%esp +cmpl $0,GDiv +jne .LC261 +pushl $.LC265 +call notify +addl $4,%esp +jmp .LC261 +.LC260: +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC266 +jbe .LC266 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC266 +jbe .LC266 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC266 +jbe .LC266 +fldl Zero +fcompl T +fstsw %ax +sahf +jp .LC266 +jbe .LC266 +fldl Zero +fcompl Y2 +fstsw %ax +sahf +jp .LC266 +jbe .LC266 +fldl Y1 +fsubl Half +fldl F9 +fsubl Half +fcompp +fstsw %ax +sahf +jp .LC266 +jbe .LC266 +movl $2,RDiv +pushl $.LC268 +call printf +addl $4,%esp +.LC266: +.LC261: +.LC258: +cmpl $0,RDiv +jne .LC269 +pushl $.LC271 +call printf +addl $4,%esp +.LC269: +fldl One +fdivl Radix +fstpl BInvrse +pushl $.LC273 +fldl BInvrse +fmull Radix +fsubl Half +fldl Half +fcompp +fstsw %ax +sahf +jp .LC274 +jne .LC274 +movl $1,-1064(%ebp) +jmp .LC275 +.LC274: +movl $0,-1064(%ebp) +.LC275: +pushl -1064(%ebp) +pushl $0 +call TstCond +addl $12,%esp +movl $50,Milestone +pushl $.LC277 +fldl F9 +faddl U1 +fsubl Half +fldl Half +fcompp +fstsw %ax +sahf +jp .LC278 +jne .LC278 +fldl BMinusU2 +faddl U2 +fsubl One +fldl Radix +fsubl One +fcompp +fstsw %ax +sahf +jp .LC278 +jne .LC278 +movl $1,-1084(%ebp) +jmp .LC279 +.LC278: +movl $0,-1084(%ebp) +.LC279: +pushl -1084(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl One +fldl U1 +fmull U1 +fsubrp %st,%st(1) +fstpl X +fldl One +fldl U2 +fldl One +fsubl U2 +fmulp %st,%st(1) +faddp %st,%st(1) +fstpl Y +fldl F9 +fsubl Half +fstpl Z +fldl X +fsubl Half +fsubl Z +fstpl X +fldl Y +fsubl One +fstpl Y +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC280 +jne .LC280 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC280 +jne .LC280 +movl $2,RAddSub +pushl $.LC282 +call printf +addl $4,%esp +.LC280: +cmpl $1,GAddSub +jne .LC283 +fldl Half +faddl U2 +fmull U2 +fstpl X +fldl Half +fsubl U2 +fmull U2 +fstpl Y +fldl One +faddl X +fstpl X +fldl One +faddl Y +fstpl Y +fldl One +faddl U2 +fsubl X +fstpl X +fldl One +fsubl Y +fstpl Y +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC285 +jne .LC285 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC285 +jne .LC285 +fldl Half +faddl U2 +fmull U1 +fstpl X +fldl Half +fsubl U2 +fmull U1 +fstpl Y +fldl One +fsubl X +fstpl X +fldl One +fsubl Y +fstpl Y +fldl F9 +fsubl X +fstpl X +fldl One +fsubl Y +fstpl Y +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC287 +jne .LC287 +fldl Zero +fcompl Y +fstsw %ax +sahf +jp .LC287 +jne .LC287 +movl $1,RAddSub +pushl $.LC289 +call printf +addl $4,%esp +cmpl $0,GAddSub +jne .LC284 +pushl $.LC292 +call notify +addl $4,%esp +jmp .LC284 +.LC287: +pushl $.LC293 +call printf +addl $4,%esp +jmp .LC284 +.LC285: +pushl $.LC293 +call printf +addl $4,%esp +jmp .LC284 +.LC283: +pushl $.LC293 +call printf +addl $4,%esp +.LC284: +fldl One +fstpl S +fldl One +fldl Half +fldl One +faddl Half +fmulp %st,%st(1) +faddp %st,%st(1) +fstpl X +fldl One +faddl U2 +fmull Half +fstpl Y +fldl X +fstpl -1164(%ebp) +fldl Y +fstpl -1172(%ebp) +fldl -1164(%ebp) +fsubl -1172(%ebp) +fstpl Z +fldl -1172(%ebp) +fsubl -1164(%ebp) +fstpl T +fldl Z +faddl T +fstpl StickyBit +fldl Zero +fcompl StickyBit +fstsw %ax +sahf +jp 1f +je .LC294 +1: +fldl Zero +fstpl S +pushl $.LC296 +pushl $3 +call BadCond +addl $8,%esp +.LC294: +fldl Zero +fstpl StickyBit +cmpl $1,GMult +jne .LC297 +cmpl $1,GDiv +jne .LC297 +cmpl $1,GAddSub +jne .LC297 +cmpl $1,RMult +jne .LC297 +cmpl $1,RDiv +jne .LC297 +cmpl $1,RAddSub +jne .LC297 +fldl RadixD2 +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1180(%ebp) +fldl RadixD2 +fcompl -1180(%ebp) +fstsw %ax +sahf +jp .LC297 +jne .LC297 +pushl $.LC299 +call printf +addl $4,%esp +fldl Half +faddl U1 +fmull U2 +fstpl X +fldl Half +fmull U2 +fstpl Y +fldl One +faddl Y +fstpl Z +fldl One +faddl X +fstpl T +fldl Z +fsubl One +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC300 +jb .LC300 +fldl T +fsubl One +fldl U2 +fcompp +fstsw %ax +sahf +jp .LC300 +ja .LC300 +fldl T +faddl Y +fstpl Z +fldl Z +fsubl X +fstpl Y +fldl Z +fsubl T +fldl U2 +fcompp +fstsw %ax +sahf +jp .LC302 +ja .LC302 +fldl Y +fsubl T +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC302 +jne .LC302 +fldl Half +faddl U1 +fmull U1 +fstpl X +fldl Half +fmull U1 +fstpl Y +fldl One +fsubl Y +fstpl Z +fldl One +fsubl X +fstpl T +fldl Z +fsubl One +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC304 +jne .LC304 +fldl T +fsubl F9 +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC304 +jne .LC304 +fldl Half +fsubl U1 +fmull U1 +fstpl Z +fldl F9 +fsubl Z +fstpl T +fldl F9 +fsubl Y +fstpl Q +fldl T +fsubl F9 +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC306 +jne .LC306 +fldl F9 +fsubl U1 +fsubl Q +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC306 +jne .LC306 +fldl One +faddl U2 +fmull OneAndHalf +fstpl Z +fldl OneAndHalf +faddl U2 +fsubl Z +faddl U2 +fstpl T +fldl One +fldl Half +fdivl Radix +faddp %st,%st(1) +fstpl X +fldl One +fldl Radix +fmull U2 +faddp %st,%st(1) +fstpl Y +fldl X +fmull Y +fstpl Z +fldl Zero +fcompl T +fstsw %ax +sahf +jp .LC308 +jne .LC308 +fldl X +fldl Radix +fmull U2 +faddp %st,%st(1) +fsubl Z +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC308 +jne .LC308 +fldl Two +fcompl Radix +fstsw %ax +sahf +jp 1f +je .LC310 +1: +fldl Two +faddl U2 +fstpl X +fldl X +fdivl Two +fstpl Y +fldl Y +fsubl One +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC311 +jne .LC311 +fldl S +fstpl StickyBit +jmp .LC311 +.LC310: +fldl S +fstpl StickyBit +.LC311: +.LC308: +.LC306: +.LC304: +.LC302: +.LC300: +.LC297: +fldl One +fcompl StickyBit +fstsw %ax +sahf +jp .LC314 +jne .LC314 +pushl $.LC316 +call printf +addl $4,%esp +jmp .LC315 +.LC314: +pushl $.LC317 +call printf +addl $4,%esp +.LC315: +pushl $.LC319 +cmpl $0,GMult +je .LC320 +cmpl $0,GDiv +je .LC320 +cmpl $0,GAddSub +je .LC320 +cmpl $0,RMult +je .LC320 +cmpl $0,RDiv +je .LC320 +cmpl $0,RAddSub +je .LC320 +movl $1,-1184(%ebp) +jmp .LC321 +.LC320: +movl $0,-1184(%ebp) +.LC321: +pushl -1184(%ebp) +pushl $3 +call TstCond +addl $12,%esp +movl $60,Milestone +pushl $.LC45 +call printf +addl $4,%esp +pushl $.LC322 +call printf +addl $4,%esp +pushl NoTrials +pushl $.LC323 +call printf +addl $8,%esp +fldl .LC324 +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1192(%ebp) +fldl -1192(%ebp) +fstpl Random9 +fldl Third +fstpl Random1 +movl $1,I +.LC325: +call Random +fstpl -1200(%ebp) +fldl -1200(%ebp) +fstpl X +call Random +fstpl -1208(%ebp) +fldl -1208(%ebp) +fstpl Y +fldl Y +fmull X +fstpl Z9 +fldl X +fmull Y +fstpl Z +fldl Z +fsubl Z9 +fstpl Z9 +incl I +.LC326: +movl NoTrials,%edi +cmpl %edi,I +jg .LC328 +fldl Zero +fcompl Z9 +fstsw %ax +sahf +jp 1f +je .LC325 +1: +.LC328: +movl NoTrials,%edi +cmpl %edi,I +jne .LC329 +fldl One +fldl Half +fdivl Three +faddp %st,%st(1) +fstpl -1208(%ebp) +fldl -1208(%ebp) +fstpl Random1 +fldl U2 +faddl U1 +faddl One +fstpl -1216(%ebp) +fldl -1216(%ebp) +fstpl Random2 +fldl Random1 +fstpl -1224(%ebp) +fldl Random2 +fstpl -1232(%ebp) +fldl -1224(%ebp) +fmull -1232(%ebp) +fstpl Z +fldl -1232(%ebp) +fmull -1224(%ebp) +fstpl Y +fldl -1208(%ebp) +fmull -1216(%ebp) +fstpl -1240(%ebp) +fldl -1240(%ebp) +fsubl -1240(%ebp) +fstpl Z9 +.LC329: +movl NoTrials,%edi +cmpl %edi,I +je .LC331 +fldl Zero +fcompl Z9 +fstsw %ax +sahf +jp 1f +je .LC331 +1: +pushl $.LC333 +pushl $2 +call BadCond +addl $8,%esp +jmp .LC332 +.LC331: +pushl NoTrials +pushl $.LC334 +call printf +addl $8,%esp +.LC332: +movl $70,Milestone +pushl $.LC335 +call printf +addl $4,%esp +fldl Zero +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1212(%ebp) +fldl -1212(%ebp) +fcompl Zero +fstsw %ax +sahf +jp .LC338 +jne .LC338 +fldl Zero +fchs +fstpl -1220(%ebp) +fldl -1220(%ebp) +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1228(%ebp) +fldl -1228(%ebp) +fcompl -1220(%ebp) +fstsw %ax +sahf +jp .LC338 +jne .LC338 +fldl One +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1244(%ebp) +fldl -1244(%ebp) +fcompl One +fstsw %ax +sahf +jp .LC338 +jne .LC338 +movl $1,-1196(%ebp) +jmp .LC339 +.LC338: +movl $0,-1196(%ebp) +.LC339: +pushl $.LC337 +pushl -1196(%ebp) +pushl $0 +call TstCond +addl $12,%esp +fldl Zero +fstpl MinSqEr +fldl Zero +fstpl MaxSqEr +fldl Zero +fstpl J +fldl Radix +fstpl X +fldl U2 +fstpl OneUlp +pushl $1 +call SqXMinX +addl $4,%esp +fldl BInvrse +fstpl X +fldl BInvrse +fmull U1 +fstpl OneUlp +pushl $1 +call SqXMinX +addl $4,%esp +fldl U1 +fstpl X +fldl U1 +fmull U1 +fstpl OneUlp +pushl $1 +call SqXMinX +addl $4,%esp +fldl Zero +fcompl J +fstsw %ax +sahf +jp 1f +je .LC340 +1: +call Pause +.LC340: +pushl NoTrials +pushl $.LC342 +call printf +addl $8,%esp +fldl Zero +fstpl J +fldl Two +fstpl X +fldl Radix +fstpl Y +fldl One +fcompl Radix +fstsw %ax +sahf +jp 1f +je .LC343 +1: +.LC345: +fldl Y +fstpl -1284(%ebp) +fldl -1284(%ebp) +fstpl X +fldl Radix +fmull -1284(%ebp) +fstpl Y +.LC346: +fldl Y +fsubl X +fildl NoTrials +fcompp +fstsw %ax +sahf +jp .LC345 +ja .LC345 +.LC343: +fldl X +fmull U2 +fstpl OneUlp +movl $1,I +jmp .LC349 +.LC348: +fldl X +faddl One +fstpl X +pushl $2 +call SqXMinX +addl $4,%esp +fldl Zero +fcompl J +fstsw %ax +sahf +jp .LC351 +jae .LC351 +jmp .LC350 +.LC351: +incl I +.LC349: +movl NoTrials,%edi +cmpl %edi,I +jle .LC348 +.LC350: +pushl $.LC353 +call printf +addl $4,%esp +movl $-1,I +fldl BMinusU2 +fstpl X +fldl Radix +fstpl Y +fldl Radix +fldl Radix +fmull U2 +faddp %st,%st(1) +fstpl Z +movl $0,NotMonot +movl $0,Monot +jmp .LC355 +.LC354: +incl I +fldl X +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1292(%ebp) +fldl -1292(%ebp) +fstpl X +fldl Y +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1300(%ebp) +fldl -1300(%ebp) +fstpl Q +fldl Z +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1308(%ebp) +fldl -1308(%ebp) +fstpl Z +fldl Q +fcompl X +fstsw %ax +sahf +jp .LC359 +jb .LC359 +fldl Z +fcompl Q +fstsw %ax +sahf +jp .LC357 +jae .LC357 +.LC359: +movl $1,NotMonot +jmp .LC358 +.LC357: +fldl Q +faddl Half +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1324(%ebp) +fldl -1324(%ebp) +fstpl Q +cmpl $0,I +jg .LC362 +fldl Q +fmull Q +fcompl Radix +fstsw %ax +sahf +jp .LC360 +jne .LC360 +.LC362: +movl $1,Monot +jmp .LC361 +.LC360: +cmpl $0,I +jle .LC363 +cmpl $1,I +jle .LC365 +movl $1,Monot +jmp .LC364 +.LC365: +fldl Y +fmull BInvrse +fstpl Y +fldl Y +fstpl -1340(%ebp) +fldl -1340(%ebp) +fsubl U1 +fstpl X +fldl -1340(%ebp) +faddl U1 +fstpl Z +jmp .LC364 +.LC363: +fldl Q +fstpl Y +fldl Y +fstpl -1340(%ebp) +fldl -1340(%ebp) +fsubl U2 +fstpl X +fldl -1340(%ebp) +faddl U2 +fstpl Z +.LC364: +.LC361: +.LC358: +.LC355: +cmpl $0,NotMonot +jne .LC367 +cmpl $0,Monot +je .LC354 +.LC367: +cmpl $0,Monot +je .LC368 +pushl $.LC370 +call printf +addl $4,%esp +jmp .LC369 +.LC368: +pushl $.LC158 +pushl $2 +call BadCond +addl $8,%esp +fldl Y +subl $8,%esp +fstpl (%esp) +pushl $.LC371 +call printf +addl $12,%esp +.LC369: +movl $80,Milestone +fldl MinSqEr +faddl Half +fstpl MinSqEr +fldl MaxSqEr +fsubl Half +fstpl MaxSqEr +fldl One +faddl U2 +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1300(%ebp) +fldl -1300(%ebp) +fsubl One +fdivl U2 +fstpl Y +fldl Y +fsubl One +fldl U2 +fdivl Eight +faddp %st,%st(1) +fstpl SqEr +fldl MaxSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC372 +jae .LC372 +fldl SqEr +fstpl MaxSqEr +.LC372: +fldl Y +fldl U2 +fdivl Eight +faddp %st,%st(1) +fstpl SqEr +fldl MinSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC374 +jbe .LC374 +fldl SqEr +fstpl MinSqEr +.LC374: +fldl F9 +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1324(%ebp) +fldl -1324(%ebp) +fsubl U2 +fldl One +fsubl U2 +fsubrp %st,%st(1) +fdivl U1 +fstpl Y +fldl Y +fldl U1 +fdivl Eight +faddp %st,%st(1) +fstpl SqEr +fldl MaxSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC376 +jae .LC376 +fldl SqEr +fstpl MaxSqEr +.LC376: +fldl Y +faddl One +fldl U1 +fdivl Eight +faddp %st,%st(1) +fstpl SqEr +fldl MinSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC378 +jbe .LC378 +fldl SqEr +fstpl MinSqEr +.LC378: +fldl U2 +fstpl OneUlp +fldl OneUlp +fstpl X +movl $1,Indx +.LC380: +fldl X +faddl U1 +faddl X +faddl F9 +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1356(%ebp) +fldl -1356(%ebp) +fstpl Y +fldl Y +fsubl U2 +fldl One +fsubl U2 +faddl X +fsubrp %st,%st(1) +fdivl OneUlp +fstpl Y +fldl U1 +fsubl X +faddl F9 +fmull Half +fmull X +fmull X +fdivl OneUlp +fstpl Z +fldl Y +faddl Half +faddl Z +fstpl SqEr +fldl MinSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC384 +jbe .LC384 +fldl SqEr +fstpl MinSqEr +.LC384: +fldl Y +fsubl Half +faddl Z +fstpl SqEr +fldl MaxSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC386 +jae .LC386 +fldl SqEr +fstpl MaxSqEr +.LC386: +movl Indx,%edi +cmpl $1,%edi +je .LC390 +cmpl $3,%edi +jne .LC388 +.LC390: +fldl X +subl $8,%esp +fstpl (%esp) +call Sign +addl $8,%esp +fstpl -1396(%ebp) +fldl OneUlp +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1404(%ebp) +fldl Eight +fldl Nine +fmull -1404(%ebp) +fdivrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1412(%ebp) +fldl OneUlp +fmull -1396(%ebp) +fmull -1412(%ebp) +fstpl X +jmp .LC389 +.LC388: +fldl U1 +fstpl OneUlp +fldl OneUlp +fchs +fstpl X +.LC389: +.LC381: +incl Indx +cmpl $3,Indx +jle .LC380 +movl $85,Milestone +movl $0,SqRWrng +movl $0,Anomaly +movl $0,RSqrt +fldl One +fcompl Radix +fstsw %ax +sahf +jp 1f +je .LC391 +1: +pushl $.LC393 +call printf +addl $4,%esp +fldl Precision +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1356(%ebp) +fldl One +faddl Precision +fsubl -1356(%ebp) +subl $8,%esp +fstpl (%esp) +fldl Radix +subl $8,%esp +fstpl (%esp) +call pow +addl $16,%esp +fstpl -1364(%ebp) +fldl Half +faddl -1364(%ebp) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1372(%ebp) +fldl -1372(%ebp) +fstpl D +fldl D +fdivl Radix +fstpl X +fldl D +fdivl A1 +fstpl Y +fldl X +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1396(%ebp) +fldl -1396(%ebp) +fcompl X +fstsw %ax +sahf +jp .LC396 +jne .LC396 +fldl Y +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1412(%ebp) +fldl -1412(%ebp) +fcompl Y +fstsw %ax +sahf +jp 1f +je .LC394 +1: +.LC396: +movl $1,Anomaly +jmp .LC395 +.LC394: +fldl Zero +fstpl X +fldl X +fstpl Z2 +fldl One +fstpl Y +fldl Y +fstpl Y2 +fldl Radix +fsubl One +fstpl Z1 +fldl Four +fmull D +fstpl FourD +.LC397: +fldl Z2 +fcompl Y2 +fstsw %ax +sahf +jp .LC400 +jae .LC400 +fldl Radix +fstpl Q +fldl Y +fstpl Y1 +.LC402: +fldl Half +fldl Q +fdivl Y1 +fsubrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1436(%ebp) +fldl Q +fldl -1436(%ebp) +fmull Y1 +faddp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -1444(%ebp) +fldl -1444(%ebp) +fstpl X1 +fldl Y1 +fstpl Q +fldl X1 +fstpl Y1 +.LC403: +fldl Zero +fcompl X1 +fstsw %ax +sahf +jp .LC402 +jb .LC402 +fldl One +fcompl Q +fstsw %ax +sahf +jp .LC405 +jb .LC405 +fldl Y2 +fstpl Z2 +fldl Y +fstpl Z +.LC405: +.LC400: +fldl Y +faddl Two +fstpl Y +fldl X +faddl Eight +fstpl X +fldl Y2 +faddl X +fstpl Y2 +fldl FourD +fcompl Y2 +fstsw %ax +sahf +jp .LC407 +ja .LC407 +fldl Y2 +fsubl FourD +fstpl Y2 +.LC407: +.LC398: +fldl D +fcompl Y +fstsw %ax +sahf +jp .LC397 +ja .LC397 +fldl FourD +fsubl Z2 +fstpl X8 +fldl X8 +fstpl -1436(%ebp) +fldl -1436(%ebp) +fldl Z +fmull Z +faddp %st,%st(1) +fdivl FourD +fstpl Q +fldl -1436(%ebp) +fdivl Eight +fstpl X8 +fldl Q +fstpl -1452(%ebp) +fldl -1452(%ebp) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1460(%ebp) +fldl -1460(%ebp) +fcompl -1452(%ebp) +fstsw %ax +sahf +jp 1f +je .LC409 +1: +movl $1,Anomaly +jmp .LC410 +.LC409: +movl $0,Break +.LC411: +fldl Z1 +fmull Z +fstpl X +fldl X +fstpl -1468(%ebp) +fldl -1468(%ebp) +fdivl Radix +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1476(%ebp) +fldl -1468(%ebp) +fldl -1476(%ebp) +fmull Radix +fsubrp %st,%st(1) +fstpl X +fldl One +fcompl X +fstsw %ax +sahf +jp .LC414 +jne .LC414 +movl $1,Break +jmp .LC415 +.LC414: +fldl Z1 +fsubl One +fstpl Z1 +.LC415: +.LC412: +cmpl $0,Break +jne .LC416 +fldl Zero +fcompl Z1 +fstsw %ax +sahf +jp .LC411 +jb .LC411 +.LC416: +fldl Zero +fcompl Z1 +fstsw %ax +sahf +jp .LC417 +jb .LC417 +cmpl $0,Break +jne .LC417 +movl $1,Anomaly +jmp .LC418 +.LC417: +fldl RadixD2 +fcompl Z1 +fstsw %ax +sahf +jp .LC419 +jae .LC419 +fldl Z1 +fsubl Radix +fstpl Z1 +.LC419: +.LC421: +call NewD +.LC422: +fldl U2 +fmull D +fldl F9 +fcompp +fstsw %ax +sahf +jp .LC421 +ja .LC421 +fldl D +fmull Radix +fsubl D +fldl W +fsubl D +fcompp +fstsw %ax +sahf +jp 1f +je .LC424 +1: +movl $1,Anomaly +jmp .LC425 +.LC424: +fldl D +fstpl Z2 +movl $0,I +fldl D +fldl One +faddl Z +fmull Half +faddp %st,%st(1) +fstpl Y +fldl D +faddl Z +faddl Q +fstpl X +call SR3750 +fldl D +fldl One +fsubl Z +fmull Half +faddp %st,%st(1) +faddl D +fstpl Y +fldl D +fsubl Z +faddl D +fstpl X +fldl X +fstpl -1508(%ebp) +fldl -1508(%ebp) +faddl Q +faddl -1508(%ebp) +fstpl X +call SR3750 +call NewD +fldl D +fsubl Z2 +fldl W +fsubl Z2 +fcompp +fstsw %ax +sahf +jp 1f +je .LC426 +1: +movl $1,Anomaly +jmp .LC427 +.LC426: +fldl D +fsubl Z2 +fstpl -1532(%ebp) +fldl -1532(%ebp) +fldl Z2 +fldl One +fsubl Z +fmull Half +faddp %st,%st(1) +faddp %st,%st(1) +fstpl Y +fldl -1532(%ebp) +fldl Z2 +fsubl Z +faddl Q +faddp %st,%st(1) +fstpl X +call SR3750 +fldl One +faddl Z +fmull Half +fstpl Y +fldl Q +fstpl X +call SR3750 +cmpl $0,I +jne .LC428 +movl $1,Anomaly +.LC428: +.LC427: +.LC425: +.LC418: +.LC410: +.LC395: +cmpl $0,I +je .LC432 +cmpl $0,Anomaly +je .LC430 +.LC432: +pushl $.LC433 +pushl $0 +call BadCond +addl $8,%esp +fldl W +subl $8,%esp +fstpl (%esp) +pushl $.LC434 +call printf +addl $12,%esp +pushl $.LC435 +call printf +addl $4,%esp +movl $1,SqRWrng +.LC430: +.LC391: +cmpl $0,Anomaly +jne .LC436 +fldl Zero +fcompl MinSqEr +fstsw %ax +sahf +jp .LC438 +ja .LC438 +fldl Zero +fcompl MaxSqEr +fstsw %ax +sahf +jp .LC438 +jb .LC438 +movl $1,RSqrt +pushl $.LC440 +call printf +addl $4,%esp +jmp .LC439 +.LC438: +fldl MaxSqEr +faddl U2 +fldl U2 +fsubl Half +fcompp +fstsw %ax +sahf +jp .LC444 +jb .LC444 +fldl Half +fcompl MinSqEr +fstsw %ax +sahf +jp .LC444 +jb .LC444 +fldl MinSqEr +faddl Radix +fldl Half +fcompp +fstsw %ax +sahf +jp .LC441 +jbe .LC441 +.LC444: +movl $1,SqRWrng +jmp .LC442 +.LC441: +movl $2,RSqrt +pushl $.LC445 +call printf +addl $4,%esp +.LC442: +.LC439: +.LC436: +cmpl $0,SqRWrng +je .LC446 +pushl $.LC448 +call printf +addl $4,%esp +fldl MinSqEr +fsubl Half +subl $8,%esp +fstpl (%esp) +pushl $.LC449 +call printf +addl $12,%esp +fldl Half +faddl MaxSqEr +subl $8,%esp +fstpl (%esp) +pushl $.LC450 +call printf +addl $12,%esp +pushl $.LC452 +fldl MaxSqEr +fsubl MinSqEr +fldl Radix +fmull Radix +fcompp +fstsw %ax +sahf +jp .LC453 +jbe .LC453 +movl $1,-1344(%ebp) +jmp .LC454 +.LC453: +movl $0,-1344(%ebp) +.LC454: +pushl -1344(%ebp) +pushl $1 +call TstCond +addl $12,%esp +.LC446: +movl $90,Milestone +call Pause +pushl $.LC455 +call printf +addl $4,%esp +movl $0,N +movl $0,I +fldl Zero +fchs +fstpl Z +movl $3,M +movl $0,Break +.LC456: +fldl One +fstpl X +call SR3980 +cmpl $10,I +jg .LC459 +movl $1023,I +call SR3980 +.LC459: +fldl MinusOne +fcompl Z +fstsw %ax +sahf +jp .LC461 +jne .LC461 +movl $1,Break +jmp .LC462 +.LC461: +fldl MinusOne +fstpl Z +call PrintIfNPositive +movl $0,N +movl $-4,I +.LC462: +.LC457: +cmpl $0,Break +je .LC456 +call PrintIfNPositive +movl N,%edi +movl %edi,N1 +movl $0,N +fldl A1 +fstpl Z +fldl W +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -1348(%ebp) +fldl A1 +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -1356(%ebp) +fldl Two +fmull -1348(%ebp) +fdivl -1356(%ebp) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1364(%ebp) +fldl -1364(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,M +movl $0,Break +.LC463: +fldl Z +fstpl X +movl $1,I +call SR3980 +fldl AInvrse +fcompl Z +fstsw %ax +sahf +jp .LC466 +jne .LC466 +movl $1,Break +jmp .LC467 +.LC466: +fldl AInvrse +fstpl Z +.LC467: +.LC464: +cmpl $0,Break +je .LC463 +movl $100,Milestone +movl NoTrials,%edi +movl %edi,M +fldl Three +fstpl Z +.LC468: +fldl Z +fstpl X +movl $1,I +call SR3980 +.LC471: +fldl Z +faddl Two +fstpl Z +.LC472: +fldl Z +fdivl Three +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1380(%ebp) +fldl Three +fmull -1380(%ebp) +fldl Z +fcompp +fstsw %ax +sahf +jp 1f +je .LC471 +1: +.LC469: +fldl Eight +fmull Three +fcompl Z +fstsw %ax +sahf +jp .LC468 +ja .LC468 +cmpl $0,N +jle .LC474 +pushl $.LC476 +call printf +addl $4,%esp +pushl $.LC477 +call printf +addl $4,%esp +.LC474: +call PrintIfNPositive +movl N1,%edi +addl %edi,N +cmpl $0,N +jne .LC478 +pushl $.LC480 +call printf +addl $4,%esp +.LC478: +cmpl $0,N +jle .LC481 +call Pause +jmp .LC482 +.LC481: +pushl $.LC45 +call printf +addl $4,%esp +.LC482: +movl $110,Milestone +pushl $.LC483 +call printf +addl $4,%esp +fldl U1 +fstpl D +fldl Precision +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1380(%ebp) +fldl -1380(%ebp) +fcompl Precision +fstsw %ax +sahf +jp 1f +je .LC484 +1: +fldl BInvrse +fstpl D +fldl Precision +fstpl X +.LC486: +fldl D +fmull BInvrse +fstpl D +fldl X +fsubl One +fstpl X +.LC487: +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC486 +jb .LC486 +.LC484: +fldl One +fstpl Y +fldl D +fstpl Z +.LC489: +fldl Y +fstpl C +fldl Z +fstpl Y +fldl Y +fstpl -1388(%ebp) +fldl -1388(%ebp) +fmull -1388(%ebp) +fstpl Z +.LC490: +fldl Z +fcompl Y +fstsw %ax +sahf +jp .LC492 +jae .LC492 +fldl Z +faddl Z +fldl Z +fcompp +fstsw %ax +sahf +jp .LC489 +jb .LC489 +.LC492: +fldl C +fstpl Y +fldl Y +fmull D +fstpl Z +.LC493: +fldl Y +fstpl C +fldl Z +fstpl Y +fldl Y +fmull D +fstpl Z +.LC494: +fldl Z +fcompl Y +fstsw %ax +sahf +jp .LC496 +jae .LC496 +fldl Z +faddl Z +fldl Z +fcompp +fstsw %ax +sahf +jp .LC493 +jb .LC493 +.LC496: +fldl Two +fcompl Radix +fstsw %ax +sahf +jp .LC497 +jbe .LC497 +fldl Two +fstpl HInvrse +jmp .LC498 +.LC497: +fldl Radix +fstpl HInvrse +.LC498: +fldl One +fdivl HInvrse +fstpl H +fldl One +fdivl C +fstpl CInvrse +fldl C +fstpl E0 +fldl E0 +fmull H +fstpl Z +.LC499: +fldl E0 +fstpl Y +fldl Z +fstpl E0 +fldl E0 +fmull H +fstpl Z +.LC500: +fldl Z +fcompl E0 +fstsw %ax +sahf +jp .LC502 +jae .LC502 +fldl Z +faddl Z +fldl Z +fcompp +fstsw %ax +sahf +jp .LC499 +jb .LC499 +.LC502: +fldl E0 +fstpl UfThold +fldl Zero +fstpl E1 +fldl Zero +fstpl Q +fldl U2 +fstpl E9 +fldl One +faddl E9 +fstpl S +fldl C +fmull S +fstpl D +fldl C +fcompl D +fstsw %ax +sahf +jp .LC503 +jb .LC503 +fldl Radix +fmull U2 +fstpl E9 +fldl One +faddl E9 +fstpl S +fldl C +fmull S +fstpl D +fldl C +fcompl D +fstsw %ax +sahf +jp .LC504 +jb .LC504 +pushl $.LC507 +pushl $0 +call BadCond +addl $8,%esp +fldl E0 +fstpl Underflow +fldl Zero +fstpl Y1 +fldl Z +fstpl PseudoZero +call Pause +jmp .LC504 +.LC503: +fldl D +fstpl Underflow +fldl Underflow +fmull H +fstpl PseudoZero +fldl Zero +fstpl UfThold +.LC508: +fldl Underflow +fstpl Y1 +fldl PseudoZero +fstpl Underflow +fldl E1 +faddl E1 +fldl E1 +fcompp +fstsw %ax +sahf +jp .LC511 +jb .LC511 +fldl Underflow +fmull HInvrse +fstpl Y2 +fldl Y1 +fsubl Y2 +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -1452(%ebp) +fldl -1452(%ebp) +fstpl E1 +fldl Y1 +fstpl Q +fldl Zero +fcompl UfThold +fstsw %ax +sahf +jp .LC513 +jne .LC513 +fldl Y2 +fcompl Y1 +fstsw %ax +sahf +jp 1f +je .LC513 +1: +fldl Y1 +fstpl UfThold +.LC513: +.LC511: +fldl PseudoZero +fmull H +fstpl PseudoZero +.LC509: +fldl PseudoZero +fcompl Underflow +fstsw %ax +sahf +jp .LC515 +jae .LC515 +fldl PseudoZero +faddl PseudoZero +fldl PseudoZero +fcompp +fstsw %ax +sahf +jp .LC508 +jb .LC508 +.LC515: +.LC504: +fldl Zero +fcompl PseudoZero +fstsw %ax +sahf +jp 1f +je .LC516 +1: +pushl $.LC45 +call printf +addl $4,%esp +fldl PseudoZero +fstpl Z +fldl Zero +fcompl PseudoZero +fstsw %ax +sahf +jp .LC518 +jb .LC518 +pushl $.LC520 +pushl $0 +call BadCond +addl $8,%esp +pushl $.LC521 +call printf +addl $4,%esp +fldl PseudoZero +subl $8,%esp +fstpl (%esp) +pushl $.LC522 +call printf +addl $12,%esp +fldl PseudoZero +fchs +fstpl X +fldl Zero +fcompl X +fstsw %ax +sahf +jp .LC519 +jb .LC519 +pushl $.LC525 +call printf +addl $4,%esp +fldl X +subl $8,%esp +fstpl (%esp) +pushl $.LC526 +call printf +addl $12,%esp +jmp .LC519 +.LC518: +pushl $.LC527 +pushl $3 +call BadCond +addl $8,%esp +fldl PseudoZero +subl $8,%esp +fstpl (%esp) +pushl $.LC528 +call printf +addl $12,%esp +.LC519: +call TstPtUf +.LC516: +movl $120,Milestone +fldl CInvrse +fmull Y +fldl CInvrse +fmull Y1 +fcompp +fstsw %ax +sahf +jp .LC529 +jae .LC529 +fldl H +fmull S +fstpl S +fldl Underflow +fstpl E0 +.LC529: +fldl Zero +fcompl E1 +fstsw %ax +sahf +jp 1f +je .LC531 +1: +fldl E0 +fcompl E1 +fstsw %ax +sahf +jp 1f +je .LC531 +1: +pushl $.LC158 +pushl $2 +call BadCond +addl $8,%esp +fldl E0 +fcompl E1 +fstsw %ax +sahf +jp .LC533 +jbe .LC533 +pushl $.LC535 +call printf +addl $4,%esp +pushl $.LC536 +call printf +addl $4,%esp +fldl Zero +fcompl PseudoZero +fstsw %ax +sahf +jp .LC534 +jne .LC534 +fldl E1 +fstpl E0 +jmp .LC534 +.LC533: +pushl $.LC539 +call printf +addl $4,%esp +pushl $.LC540 +call printf +addl $4,%esp +.LC534: +.LC531: +fldl E0 +subl $8,%esp +fstpl (%esp) +pushl $.LC541 +call printf +addl $12,%esp +fldl E0 +fstpl Z +call TstPtUf +fldl E0 +fstpl Underflow +cmpl $1,N +jne .LC542 +fldl Y +fstpl Underflow +.LC542: +movl $4,I +fldl Zero +fcompl E1 +fstsw %ax +sahf +jp .LC544 +jne .LC544 +movl $3,I +.LC544: +fldl Zero +fcompl UfThold +fstsw %ax +sahf +jp .LC546 +jne .LC546 +subl $2,I +.LC546: +movl $1,UfNGrad +movl I,%edi +cmpl $1,%edi +jl .LC548 +cmpl $4,%edi +jg .LC548 +jmp *.LC571-4(,%edi,4) +.data +.align 4 +.LC571: +.long .LC550 +.long .LC557 +.long .LC562 +.long .LC563 +.text +.LC550: +fldl Underflow +fstpl UfThold +fldl CInvrse +fmull Q +fldl CInvrse +fmull Y +fmull S +fcompp +fstsw %ax +sahf +jp 1f +je .LC551 +1: +fldl Y +fstpl UfThold +pushl $.LC553 +pushl $0 +call BadCond +addl $8,%esp +fldl UfThold +subl $8,%esp +fstpl (%esp) +pushl $.LC554 +call printf +addl $12,%esp +fldl C +subl $8,%esp +fstpl (%esp) +pushl $.LC555 +call printf +addl $12,%esp +pushl $.LC556 +call printf +addl $4,%esp +.LC551: +call Pause +jmp .LC549 +.LC557: +pushl $.LC558 +pushl $0 +call BadCond +addl $8,%esp +pushl $.LC559 +call printf +addl $4,%esp +fldl Y2 +subl $8,%esp +fstpl (%esp) +fldl Q +subl $8,%esp +fstpl (%esp) +pushl $.LC560 +call printf +addl $20,%esp +fldl Q +fsubl Y2 +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -1468(%ebp) +fldl -1468(%ebp) +subl $8,%esp +fstpl (%esp) +pushl $.LC561 +call printf +addl $12,%esp +fldl Q +fstpl UfThold +jmp .LC549 +.LC562: +fldl X +fstpl X +jmp .LC549 +.LC563: +fldl UfThold +fcompl Q +fstsw %ax +sahf +jp .LC564 +jne .LC564 +fldl E0 +fcompl E1 +fstsw %ax +sahf +jp .LC564 +jne .LC564 +fldl UfThold +fldl E1 +fdivl E9 +fsubrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -1492(%ebp) +fldl E1 +fcompl -1492(%ebp) +fstsw %ax +sahf +jp .LC564 +jb .LC564 +movl $0,UfNGrad +pushl $.LC566 +call printf +addl $4,%esp +pushl $.LC567 +call printf +addl $4,%esp +fldl E0 +fmull CInvrse +fstpl Y +fldl Y +fldl OneAndHalf +faddl U2 +fmulp %st,%st(1) +fstpl Y +fldl CInvrse +fldl One +faddl U2 +fmulp %st,%st(1) +fstpl X +fldl Y +fdivl X +fstpl Y +fldl E0 +fcompl Y +fstsw %ax +sahf +jp .LC569 +jne .LC569 +movl $1,-1496(%ebp) +jmp .LC570 +.LC569: +movl $0,-1496(%ebp) +.LC570: +movl -1496(%ebp),%edi +movl %edi,IEEE +.LC564: +.LC548: +.LC549: +cmpl $0,UfNGrad +je .LC573 +pushl $.LC45 +call printf +addl $4,%esp +leal sigfpe,%edi +movl %edi,sigsave +pushl $ovfl_buf +call _setjmp +addl $4,%esp +cmpl $0,%eax +je .LC575 +pushl $.LC577 +call printf +addl $4,%esp +fldl H +faddl H +fstpl R +jmp .LC576 +.LC575: +fldl Underflow +fdivl UfThold +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1460(%ebp) +fldl -1460(%ebp) +fstpl R +.LC576: +movl $0,sigsave +fldl H +fcompl R +fstsw %ax +sahf +jp .LC578 +jb .LC578 +fldl R +fmull UfThold +fstpl Z +fldl Z +fldl One +fldl R +fmull H +fldl One +faddl H +fmulp %st,%st(1) +faddp %st,%st(1) +fmulp %st,%st(1) +fstpl X +jmp .LC579 +.LC578: +fldl UfThold +fstpl Z +fldl Z +fldl One +fldl H +fmull H +fldl One +faddl H +fmulp %st,%st(1) +faddp %st,%st(1) +fmulp %st,%st(1) +fstpl X +.LC579: +fldl Z +fcompl X +fstsw %ax +sahf +jp 1f +je .LC580 +1: +fldl X +fsubl Z +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC580 +jne .LC580 +pushl $.LC158 +pushl $3 +call BadCond +addl $8,%esp +fldl Z +subl $8,%esp +fstpl (%esp) +fldl X +subl $8,%esp +fstpl (%esp) +pushl $.LC582 +call printf +addl $20,%esp +fldl X +fsubl Z +fstpl Z9 +fldl Z9 +subl $8,%esp +fstpl (%esp) +pushl $.LC583 +call printf +addl $12,%esp +pushl $.LC584 +call printf +addl $4,%esp +pushl $.LC585 +call printf +addl $4,%esp +pushl $.LC586 +call printf +addl $4,%esp +pushl $.LC587 +call printf +addl $4,%esp +pushl $.LC588 +call printf +addl $4,%esp +pushl $.LC589 +call printf +addl $4,%esp +leal sigfpe,%edi +movl %edi,sigsave +pushl $ovfl_buf +call _setjmp +addl $4,%esp +cmpl $0,%eax +je .LC590 +pushl $.LC592 +call printf +addl $4,%esp +jmp .LC591 +.LC590: +fldl X +fdivl Z +fsubl Half +fsubl Half +subl $8,%esp +fstpl (%esp) +pushl $.LC593 +call printf +addl $12,%esp +.LC591: +movl $0,sigsave +.LC580: +.LC573: +pushl $.LC595 +fldl UfThold +subl $8,%esp +fstpl (%esp) +pushl $.LC594 +call printf +addl $16,%esp +pushl $.LC596 +call printf +addl $4,%esp +pushl $.LC597 +call printf +addl $4,%esp +fldl U1 +fmull U1 +fstpl Y2 +fldl Y2 +fstpl -1468(%ebp) +fldl -1468(%ebp) +fmull -1468(%ebp) +fstpl Y +fldl Y +fmull U1 +fstpl Y2 +fldl UfThold +fcompl Y2 +fstsw %ax +sahf +jp .LC598 +jb .LC598 +fldl E0 +fcompl Y +fstsw %ax +sahf +jp .LC600 +jae .LC600 +pushl $.LC158 +pushl $2 +call BadCond +addl $8,%esp +movl $5,I +jmp .LC601 +.LC600: +pushl $.LC158 +pushl $1 +call BadCond +addl $8,%esp +movl $4,I +.LC601: +pushl I +pushl $.LC602 +call printf +addl $8,%esp +.LC598: +movl $130,Milestone +fldl UfThold +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -1476(%ebp) +fldl HInvrse +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -1484(%ebp) +fldl Half +fldl TwoForty +fmull -1476(%ebp) +fdivl -1484(%ebp) +fsubrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1492(%ebp) +fldl -1492(%ebp) +fchs +fdivl TwoForty +fstpl Y +fldl Y +faddl Y +fstpl Y2 +pushl $.LC603 +call printf +addl $4,%esp +fldl Y +subl $8,%esp +fstpl (%esp) +fldl HInvrse +subl $8,%esp +fstpl (%esp) +pushl $.LC604 +call printf +addl $20,%esp +fldl Y +subl $8,%esp +fstpl (%esp) +fldl HInvrse +subl $8,%esp +fstpl (%esp) +pushl $.LC605 +call printf +addl $20,%esp +fldl Y2 +subl $8,%esp +fstpl (%esp) +fldl HInvrse +subl $8,%esp +fstpl (%esp) +call pow +addl $16,%esp +fstpl -1508(%ebp) +fldl -1508(%ebp) +fstpl V9 +fldl V9 +subl $8,%esp +fstpl (%esp) +pushl $.LC606 +call printf +addl $12,%esp +fldl Zero +fcompl V9 +fstsw %ax +sahf +jp .LC609 +ja .LC609 +fldl Radix +faddl Radix +faddl E9 +fmull UfThold +fcompl V9 +fstsw %ax +sahf +jp .LC607 +jae .LC607 +.LC609: +pushl $.LC610 +pushl $1 +call BadCond +addl $8,%esp +fldl UfThold +subl $8,%esp +fstpl (%esp) +pushl $.LC611 +call printf +addl $12,%esp +jmp .LC608 +.LC607: +fldl UfThold +fldl One +faddl E9 +fmulp %st,%st(1) +fcompl V9 +fstsw %ax +sahf +jp .LC612 +jb .LC612 +pushl $.LC614 +call printf +addl $4,%esp +jmp .LC613 +.LC612: +pushl $.LC610 +pushl $2 +call BadCond +addl $8,%esp +fldl UfThold +subl $8,%esp +fstpl (%esp) +pushl $.LC611 +call printf +addl $12,%esp +.LC613: +.LC608: +movl $140,Milestone +pushl $.LC45 +call printf +addl $4,%esp +fldl Zero +fstpl X +movl $2,I +fldl Two +fmull Three +fstpl Y +fldl Zero +fstpl Q +movl $0,N +.LC615: +fldl X +fstpl Z +incl I +movl I,%edi +fldl Y +leal (%edi,%edi),%edi +pushl %edi +fildl (%esp) +addl $4,%esp +fdivrp %st,%st(1) +fstpl Y +fldl Y +faddl Q +fstpl R +fldl Z +fstpl -1540(%ebp) +fldl R +fstpl -1548(%ebp) +fldl -1540(%ebp) +faddl -1548(%ebp) +fstpl X +fldl -1540(%ebp) +fsubl X +faddl -1548(%ebp) +fstpl Q +.LC616: +fldl Z +fcompl X +fstsw %ax +sahf +jp .LC615 +jb .LC615 +fldl OneAndHalf +fldl One +fdivl Eight +faddp %st,%st(1) +fldl X +fldl OneAndHalf +fmull ThirtyTwo +fdivrp %st,%st(1) +faddp %st,%st(1) +fstpl Z +fldl Z +fstpl -1548(%ebp) +fldl -1548(%ebp) +fmull -1548(%ebp) +fstpl X +fldl X +fstpl -1556(%ebp) +fldl -1556(%ebp) +fmull -1556(%ebp) +fstpl Exp2 +fldl F9 +fstpl X +fldl X +fsubl U1 +fstpl Y +fldl Exp2 +subl $8,%esp +fstpl (%esp) +pushl $.LC618 +call printf +addl $12,%esp +movl $1,I +.LC619: +fldl X +fsubl BInvrse +fstpl Z +fldl X +faddl One +fldl Z +fldl One +fsubl BInvrse +fsubrp %st,%st(1) +fdivrp %st,%st(1) +fstpl Z +fldl Z +subl $8,%esp +fstpl (%esp) +fldl X +subl $8,%esp +fstpl (%esp) +call pow +addl $16,%esp +fstpl -1588(%ebp) +fldl -1588(%ebp) +fsubl Exp2 +fstpl Q +fldl Q +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -1596(%ebp) +fldl TwoForty +fmull U2 +fcompl -1596(%ebp) +fstsw %ax +sahf +jp .LC623 +jae .LC623 +movl $1,N +fldl X +fsubl BInvrse +fldl One +fsubl BInvrse +fsubrp %st,%st(1) +fstpl V9 +pushl $.LC625 +pushl $2 +call BadCond +addl $8,%esp +fldl Z +subl $8,%esp +fstpl (%esp) +fldl X +subl $8,%esp +fstpl (%esp) +call pow +addl $16,%esp +fstpl -1612(%ebp) +fldl -1612(%ebp) +subl $8,%esp +fstpl (%esp) +pushl $.LC626 +call printf +addl $12,%esp +fldl Z +subl $8,%esp +fstpl (%esp) +fldl V9 +subl $8,%esp +fstpl (%esp) +pushl $.LC627 +call printf +addl $20,%esp +fldl Q +subl $8,%esp +fstpl (%esp) +pushl $.LC628 +call printf +addl $12,%esp +pushl $.LC629 +call printf +addl $4,%esp +pushl $.LC630 +call printf +addl $4,%esp +jmp .LC621 +.LC623: +fldl Y +fstpl -1604(%ebp) +fldl -1604(%ebp) +fsubl X +fmull Two +faddl -1604(%ebp) +fstpl Z +fldl -1604(%ebp) +fstpl X +fldl Z +fstpl Y +fldl X +fsubl F9 +fstpl -1612(%ebp) +fldl One +fldl -1612(%ebp) +fmull -1612(%ebp) +faddp %st,%st(1) +fstpl Z +fldl One +fcompl Z +fstsw %ax +sahf +jp .LC631 +jae .LC631 +movl NoTrials,%edi +cmpl %edi,I +jge .LC631 +incl I +jmp .LC619 +.LC631: +fldl One +fcompl X +fstsw %ax +sahf +jp .LC633 +jae .LC633 +cmpl $0,N +jne .LC621 +pushl $.LC637 +call printf +addl $4,%esp +jmp .LC621 +.LC633: +fldl One +faddl U2 +fstpl X +fldl U2 +faddl U2 +fstpl Y +fldl Y +faddl X +fstpl Y +movl $1,I +jmp .LC619 +.LC621: +movl $150,Milestone +pushl $.LC638 +call printf +addl $4,%esp +movl $0,N +fldl A1 +fstpl Z +fldl C +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -1564(%ebp) +fldl A1 +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -1572(%ebp) +fldl Half +fldl -1564(%ebp) +fdivl -1572(%ebp) +fsubrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -1580(%ebp) +fldl -1580(%ebp) +fstpl Q +movl $0,Break +.LC639: +fldl CInvrse +fstpl X +fldl Q +subl $8,%esp +fstpl (%esp) +fldl Z +subl $8,%esp +fstpl (%esp) +call pow +addl $16,%esp +fstpl -1588(%ebp) +fldl -1588(%ebp) +fstpl Y +call IsYeqX +fldl Q +fchs +fstpl Q +fldl C +fstpl X +fldl Q +subl $8,%esp +fstpl (%esp) +fldl Z +subl $8,%esp +fstpl (%esp) +call pow +addl $16,%esp +fstpl -1596(%ebp) +fldl -1596(%ebp) +fstpl Y +call IsYeqX +fldl One +fcompl Z +fstsw %ax +sahf +jp .LC642 +jbe .LC642 +movl $1,Break +jmp .LC643 +.LC642: +fldl AInvrse +fstpl Z +.LC643: +.LC640: +cmpl $0,Break +je .LC639 +call PrintIfNPositive +cmpl $0,N +jne .LC644 +pushl $.LC646 +call printf +addl $4,%esp +.LC644: +pushl $.LC45 +call printf +addl $4,%esp +movl $160,Milestone +call Pause +pushl $.LC647 +call printf +addl $4,%esp +pushl $.LC648 +call printf +addl $4,%esp +fldl CInvrse +fchs +fstpl Y +fldl HInvrse +fmull Y +fstpl V9 +leal sigfpe,%edi +movl %edi,sigsave +pushl $ovfl_buf +call _setjmp +addl $4,%esp +cmpl $0,%eax +je .LC649 +movl $0,I +fldl Y +fstpl V9 +jmp .LC651 +.LC649: +.LC652: +fldl Y +fstpl V +fldl V9 +fstpl Y +fldl HInvrse +fmull Y +fstpl V9 +.LC653: +fldl Y +fcompl V9 +fstsw %ax +sahf +jp .LC652 +ja .LC652 +movl $1,I +.LC651: +movl $0,sigsave +fldl V9 +fstpl Z +pushl $.LC655 +call printf +addl $4,%esp +fldl Y +subl $8,%esp +fstpl (%esp) +pushl $.LC656 +call printf +addl $12,%esp +fldl Y +fchs +fstpl V9 +fldl V9 +fstpl V0 +fldl V +fsubl Y +fldl V +faddl V0 +fcompp +fstsw %ax +sahf +jp .LC657 +jne .LC657 +pushl $.LC659 +call printf +addl $4,%esp +jmp .LC658 +.LC657: +pushl $.LC660 +call printf +addl $4,%esp +pushl $.LC661 +pushl $3 +call BadCond +addl $8,%esp +.LC658: +fldl Y +fcompl Z +fstsw %ax +sahf +jp 1f +je .LC662 +1: +pushl $.LC158 +pushl $1 +call BadCond +addl $8,%esp +fldl Z +subl $8,%esp +fstpl (%esp) +fldl Y +subl $8,%esp +fstpl (%esp) +pushl $.LC664 +call printf +addl $20,%esp +.LC662: +cmpl $0,I +je .LC665 +fldl V +fldl HInvrse +fmull U2 +fsubl HInvrse +fmulp %st,%st(1) +fstpl Y +fldl Y +fldl One +fsubl HInvrse +fmull U2 +fmull V +faddp %st,%st(1) +fstpl Z +fldl V0 +fcompl Z +fstsw %ax +sahf +jp .LC667 +jbe .LC667 +fldl Z +fstpl Y +.LC667: +fldl V0 +fcompl Y +fstsw %ax +sahf +jp .LC669 +jbe .LC669 +fldl Y +fstpl V +.LC669: +fldl V0 +fsubl V +fldl V0 +fcompp +fstsw %ax +sahf +jp .LC666 +jbe .LC666 +fldl V0 +fstpl V +jmp .LC666 +.LC665: +fldl Y +fldl HInvrse +fmull U2 +fsubl HInvrse +fmulp %st,%st(1) +fstpl V +fldl V +fldl One +fsubl HInvrse +fmull U2 +fmull Y +faddp %st,%st(1) +fstpl V +.LC666: +fldl V +subl $8,%esp +fstpl (%esp) +pushl $.LC673 +call printf +addl $12,%esp +cmpl $0,I +je .LC674 +fldl V0 +subl $8,%esp +fstpl (%esp) +pushl $.LC676 +call printf +addl $12,%esp +jmp .LC675 +.LC674: +pushl $.LC677 +call printf +addl $4,%esp +.LC675: +fldl V +fmull One +fstpl V9 +fldl V9 +subl $8,%esp +fstpl (%esp) +pushl $.LC678 +call printf +addl $12,%esp +fldl V +fdivl One +fstpl V9 +fldl V9 +subl $8,%esp +fstpl (%esp) +pushl $.LC679 +call printf +addl $12,%esp +pushl $.LC680 +call printf +addl $4,%esp +pushl $.LC681 +call printf +addl $4,%esp +movl $170,Milestone +fldl V +fchs +fldl V +fcompp +fstsw %ax +sahf +jp .LC686 +jbe .LC686 +fldl V0 +fchs +fldl V0 +fcompp +fstsw %ax +sahf +jp .LC686 +jbe .LC686 +fldl UfThold +fchs +fldl V +fcompp +fstsw %ax +sahf +jp .LC686 +jbe .LC686 +fldl V +fcompl UfThold +fstsw %ax +sahf +jp .LC682 +ja .LC682 +.LC686: +pushl $.LC687 +pushl $0 +call BadCond +addl $8,%esp +fldl UfThold +subl $8,%esp +fstpl (%esp) +fldl V0 +subl $8,%esp +fstpl (%esp) +fldl V +subl $8,%esp +fstpl (%esp) +pushl $.LC688 +call printf +addl $28,%esp +.LC682: +movl $175,Milestone +pushl $.LC45 +call printf +addl $4,%esp +movl $1,Indx +.LC689: +movl Indx,%edi +cmpl $1,%edi +je .LC695 +cmpl $2,%edi +je .LC696 +cmpl $3,%edi +je .LC697 +jmp .LC693 +.LC695: +fldl UfThold +fstpl Z +jmp .LC694 +.LC696: +fldl E0 +fstpl Z +jmp .LC694 +.LC697: +fldl PseudoZero +fstpl Z +.LC693: +.LC694: +fldl Zero +fcompl Z +fstsw %ax +sahf +jp 1f +je .LC698 +1: +fldl Z +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1628(%ebp) +fldl -1628(%ebp) +fstpl V9 +fldl V9 +fmull V9 +fstpl Y +fldl Radix +fmull E9 +fstpl -1660(%ebp) +fldl Y +fldl One +fsubl -1660(%ebp) +fdivrp %st,%st(1) +fldl Z +fcompp +fstsw %ax +sahf +jp .LC702 +ja .LC702 +fldl One +faddl -1660(%ebp) +fmull Z +fcompl Y +fstsw %ax +sahf +jp .LC700 +jae .LC700 +.LC702: +fldl U1 +fcompl V9 +fstsw %ax +sahf +jp .LC703 +jae .LC703 +pushl $.LC158 +pushl $1 +call BadCond +addl $8,%esp +jmp .LC704 +.LC703: +pushl $.LC158 +pushl $2 +call BadCond +addl $8,%esp +.LC704: +fldl Z +subl $8,%esp +fstpl (%esp) +pushl $.LC705 +call printf +addl $12,%esp +fldl Y +subl $8,%esp +fstpl (%esp) +pushl $.LC706 +call printf +addl $12,%esp +.LC700: +.LC698: +.LC690: +incl Indx +cmpl $3,Indx +jle .LC689 +movl $180,Milestone +movl $1,Indx +.LC707: +cmpl $1,Indx +jne .LC711 +fldl V +fstpl Z +jmp .LC712 +.LC711: +fldl V0 +fstpl Z +.LC712: +fldl Z +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -1628(%ebp) +fldl -1628(%ebp) +fstpl V9 +fldl V9 +fstpl -1636(%ebp) +fldl One +fldl Radix +fmull E9 +fsubrp %st,%st(1) +fmull -1636(%ebp) +fstpl X +fldl -1636(%ebp) +fmull X +fstpl V9 +fldl One +fldl Two +fmull Radix +fmull E9 +fsubrp %st,%st(1) +fmull Z +fcompl V9 +fstsw %ax +sahf +jp .LC715 +ja .LC715 +fldl Z +fcompl V9 +fstsw %ax +sahf +jp .LC713 +jae .LC713 +.LC715: +fldl V9 +fstpl Y +fldl W +fcompl X +fstsw %ax +sahf +jp .LC716 +jbe .LC716 +pushl $.LC158 +pushl $1 +call BadCond +addl $8,%esp +jmp .LC717 +.LC716: +pushl $.LC158 +pushl $2 +call BadCond +addl $8,%esp +.LC717: +fldl Z +subl $8,%esp +fstpl (%esp) +pushl $.LC718 +call printf +addl $12,%esp +fldl Y +subl $8,%esp +fstpl (%esp) +pushl $.LC719 +call printf +addl $12,%esp +.LC713: +.LC708: +incl Indx +cmpl $2,Indx +jle .LC707 +movl $190,Milestone +call Pause +fldl UfThold +fmull V +fstpl X +fldl Radix +fmull Radix +fstpl Y +fldl X +fmull Y +fldl One +fcompp +fstsw %ax +sahf +jp .LC722 +ja .LC722 +fldl Y +fcompl X +fstsw %ax +sahf +jp .LC720 +jae .LC720 +.LC722: +fldl X +fmull Y +fldl U1 +fcompp +fstsw %ax +sahf +jp .LC725 +ja .LC725 +fldl Y +fdivl U1 +fcompl X +fstsw %ax +sahf +jp .LC723 +jae .LC723 +.LC725: +pushl $.LC726 +pushl $2 +call BadCond +addl $8,%esp +jmp .LC724 +.LC723: +pushl $.LC158 +pushl $3 +call BadCond +addl $8,%esp +.LC724: +pushl $.LC728 +fldl X +subl $8,%esp +fstpl (%esp) +pushl $.LC727 +call printf +addl $16,%esp +.LC720: +movl $200,Milestone +movl $1,Indx +.LC729: +fldl F9 +fstpl X +movl Indx,%edi +cmpl $2,%edi +jl .LC733 +cmpl $5,%edi +jg .LC733 +jmp *.LC739-8(,%edi,4) +.data +.align 4 +.LC739: +.long .LC735 +.long .LC736 +.long .LC737 +.long .LC738 +.text +.LC735: +fldl One +faddl U2 +fstpl X +jmp .LC734 +.LC736: +fldl V +fstpl X +jmp .LC734 +.LC737: +fldl UfThold +fstpl X +jmp .LC734 +.LC738: +fldl Radix +fstpl X +.LC733: +.LC734: +fldl X +fstpl Y +leal sigfpe,%edi +movl %edi,sigsave +pushl $ovfl_buf +call _setjmp +addl $4,%esp +cmpl $0,%eax +je .LC741 +fldl X +subl $8,%esp +fstpl (%esp) +pushl $.LC743 +call printf +addl $12,%esp +jmp .LC742 +.LC741: +fldl Y +fdivl X +fsubl Half +fsubl Half +fstpl V9 +fldl Zero +fcompl V9 +fstsw %ax +sahf +jp .LC744 +jne .LC744 +jmp .LC730 +.LC744: +fldl U1 +fchs +fcompl V9 +fstsw %ax +sahf +jp .LC746 +jne .LC746 +cmpl $5,Indx +jge .LC746 +pushl $.LC158 +pushl $3 +call BadCond +addl $8,%esp +jmp .LC747 +.LC746: +pushl $.LC158 +pushl $1 +call BadCond +addl $8,%esp +.LC747: +fldl X +subl $8,%esp +fstpl (%esp) +pushl $.LC748 +call printf +addl $12,%esp +fldl V9 +subl $8,%esp +fstpl (%esp) +pushl $.LC749 +call printf +addl $12,%esp +.LC742: +movl $0,sigsave +.LC730: +incl Indx +cmpl $5,Indx +jle .LC729 +movl $210,Milestone +fldl Zero +fstpl MyZero +pushl $.LC45 +call printf +addl $4,%esp +pushl $.LC750 +call printf +addl $4,%esp +leal sigfpe,%edi +movl %edi,sigsave +pushl $.LC751 +call printf +addl $4,%esp +pushl $ovfl_buf +call _setjmp +addl $4,%esp +cmpl $0,%eax +jne .LC752 +fldl One +fdivl MyZero +subl $8,%esp +fstpl (%esp) +pushl $.LC754 +call printf +addl $12,%esp +.LC752: +movl $0,sigsave +leal sigfpe,%edi +movl %edi,sigsave +pushl $.LC755 +call printf +addl $4,%esp +pushl $ovfl_buf +call _setjmp +addl $4,%esp +cmpl $0,%eax +jne .LC756 +fldl Zero +fdivl MyZero +subl $8,%esp +fstpl (%esp) +pushl $.LC754 +call printf +addl $12,%esp +.LC756: +movl $0,sigsave +movl $220,Milestone +call Pause +pushl $.LC45 +call printf +addl $4,%esp +movl $0,-1648(%ebp) +.LC763: +movl -1648(%ebp),%edi +cmpl $0,ErrCnt(,%edi,4) +je .LC767 +movl -1648(%ebp),%edi +leal (,%edi,4),%edi +pushl ErrCnt(%edi) +pushl msg.758(%edi) +pushl $.LC769 +call printf +addl $12,%esp +.LC767: +.LC764: +incl -1648(%ebp) +cmpl $4,-1648(%ebp) +jl .LC763 +pushl $.LC45 +call printf +addl $4,%esp +movl ErrCnt,%edi +movl ErrCnt+4,%esi +leal (%esi,%edi),%edi +movl ErrCnt+8,%esi +leal (%esi,%edi),%edi +movl ErrCnt+12,%esi +leal (%esi,%edi),%edi +cmpl $0,%edi +jle .LC770 +movl ErrCnt,%edi +movl ErrCnt+4,%esi +leal (%esi,%edi),%edi +movl ErrCnt+8,%esi +leal (%esi,%edi),%edi +cmpl $0,%edi +jne .LC775 +cmpl $0,ErrCnt+12 +jle .LC775 +pushl $.LC780 +call printf +addl $4,%esp +pushl $.LC781 +call printf +addl $4,%esp +.LC775: +movl ErrCnt,%edi +movl ErrCnt+4,%esi +leal (%esi,%edi),%edi +cmpl $0,%edi +jne .LC782 +cmpl $0,ErrCnt+8 +jle .LC782 +pushl $.LC786 +call printf +addl $4,%esp +pushl $.LC787 +call printf +addl $4,%esp +.LC782: +movl ErrCnt,%edi +movl ErrCnt+4,%esi +leal (%esi,%edi),%edi +cmpl $0,%edi +jle .LC788 +pushl $.LC791 +call printf +addl $4,%esp +pushl $.LC792 +call printf +addl $4,%esp +.LC788: +cmpl $0,ErrCnt +jle .LC771 +pushl $.LC795 +call printf +addl $4,%esp +pushl $.LC796 +call printf +addl $4,%esp +jmp .LC771 +.LC770: +pushl $.LC797 +call printf +addl $4,%esp +cmpl $1,RMult +jne .LC802 +cmpl $1,RDiv +jne .LC802 +cmpl $1,RAddSub +jne .LC802 +cmpl $1,RSqrt +je .LC798 +.LC802: +pushl $.LC803 +call printf +addl $4,%esp +jmp .LC799 +.LC798: +fldl One +fcompl StickyBit +fstsw %ax +sahf +jp .LC804 +ja .LC804 +fldl Radix +fsubl Two +fldl Radix +fsubl Nine +fsubl One +fmulp %st,%st(1) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC804 +jne .LC804 +pushl $.LC806 +call printf +addl $4,%esp +pushl $.LC807 +call printf +addl $4,%esp +fldl Two +fcompl Radix +fstsw %ax +sahf +jp .LC808 +jne .LC808 +fldl Precision +fldl Four +fmull Three +fmull Two +fsubrp %st,%st(1) +fldl Precision +fsubl TwentySeven +fsubl TwentySeven +faddl One +fmulp %st,%st(1) +fldl Zero +fcompp +fstsw %ax +sahf +jp .LC808 +jne .LC808 +pushl $.LC810 +call printf +addl $4,%esp +jmp .LC809 +.LC808: +pushl $.LC811 +call printf +addl $4,%esp +.LC809: +cmpl $0,IEEE +je .LC812 +pushl $.LC814 +call printf +addl $4,%esp +jmp .LC813 +.LC812: +pushl $.LC815 +call printf +addl $4,%esp +pushl $.LC816 +call printf +addl $4,%esp +.LC813: +.LC804: +pushl $.LC817 +call printf +addl $4,%esp +.LC799: +.LC771: +cmpl $0,fpecount +je .LC818 +pushl fpecount +pushl $.LC820 +call printf +addl $8,%esp +.LC818: +pushl $.LC821 +call printf +addl $4,%esp +mov $0,%eax +.LC7: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf822: +.size main,.Lf822-main +.globl Sign +.align 16 +.type Sign,@function +Sign: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +fldl .LC8 +fcompl 20(%ebp) +fstsw %ax +sahf +jp .LC825 +ja .LC825 +fldl .LC9 +fstpl -8(%ebp) +jmp .LC826 +.LC825: +fldl .LC827 +fstpl -8(%ebp) +.LC826: +fldl -8(%ebp) +.LC823: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf828: +.size Sign,.Lf828-Sign +.globl Pause +.align 16 +.type Pause,@function +Pause: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl Milestone +pushl $.LC830 +call printf +addl $8,%esp +pushl PageNo +pushl $.LC831 +call printf +addl $8,%esp +incl Milestone +incl PageNo +mov $0,%eax +.LC829: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf832: +.size Pause,.Lf832-Pause +.globl TstCond +.align 16 +.type TstCond,@function +TstCond: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +cmpl $0,24(%ebp) +jne .LC834 +pushl 28(%ebp) +pushl 20(%ebp) +call BadCond +addl $8,%esp +pushl $.LC814 +call printf +addl $4,%esp +.LC834: +mov $0,%eax +.LC833: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf836: +.size TstCond,.Lf836-TstCond +.data +.align 4 +.type msg.838,@object +msg.838: +.long .LC839 +.long .LC840 +.long .LC841 +.long .LC842 +.size msg.838,16 +.globl BadCond +.text +.align 16 +.type BadCond,@function +BadCond: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 20(%ebp),%edi +leal ErrCnt(,%edi,4),%edi +incl (,%edi) +pushl 24(%ebp) +movl 20(%ebp),%edi +pushl msg.838(,%edi,4) +pushl $.LC843 +call printf +addl $12,%esp +mov $0,%eax +.LC837: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf844: +.size BadCond,.Lf844-BadCond +.globl Random +.align 16 +.type Random,@function +Random: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $48,%esp +fldl Random1 +faddl Random9 +fstpl -8(%ebp) +fldl -8(%ebp) +fmull -8(%ebp) +fstpl -16(%ebp) +fldl -16(%ebp) +fmull -16(%ebp) +fstpl -16(%ebp) +fldl -8(%ebp) +fmull -16(%ebp) +fstpl -8(%ebp) +fldl -8(%ebp) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -48(%ebp) +fldl -8(%ebp) +fsubl -48(%ebp) +fstpl -16(%ebp) +fldl -16(%ebp) +fldl .LC846 +fmull -8(%ebp) +faddp %st,%st(1) +fstpl Random1 +fldl Random1 +.LC845: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf847: +.size Random,.Lf847-Random +.globl SqXMinX +.align 16 +.type SqXMinX,@function +SqXMinX: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $40,%esp +fldl X +fmull BInvrse +fstpl -8(%ebp) +fldl X +fsubl -8(%ebp) +fstpl -16(%ebp) +fldl X +fmull X +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -32(%ebp) +fldl -32(%ebp) +fsubl -8(%ebp) +fsubl -16(%ebp) +fdivl OneUlp +fstpl SqEr +fldl Zero +fcompl SqEr +fstsw %ax +sahf +jp 1f +je .LC849 +1: +fldl MinSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC851 +jbe .LC851 +fldl SqEr +fstpl MinSqEr +.LC851: +fldl MaxSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC853 +jae .LC853 +fldl SqEr +fstpl MaxSqEr +.LC853: +fldl J +faddl .LC9 +fstpl J +pushl $.LC45 +pushl 20(%ebp) +call BadCond +addl $8,%esp +fldl OneUlp +fmull SqEr +subl $8,%esp +fstpl (%esp) +fldl X +subl $8,%esp +fstpl (%esp) +fldl X +fmull X +subl $8,%esp +fstpl (%esp) +pushl $.LC855 +call printf +addl $28,%esp +pushl $.LC856 +call printf +addl $4,%esp +.LC849: +mov $0,%eax +.LC848: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf857: +.size SqXMinX,.Lf857-SqXMinX +.globl NewD +.align 16 +.type NewD,@function +NewD: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $40,%esp +fldl Z1 +fmull Q +fstpl X +fldl Half +fldl X +fdivl Radix +fsubrp %st,%st(1) +subl $8,%esp +fstpl (%esp) +call floor +addl $8,%esp +fstpl -8(%ebp) +fldl -8(%ebp) +fmull Radix +faddl X +fstpl X +fldl X +fstpl -24(%ebp) +fldl Z +fstpl -32(%ebp) +fldl Q +fldl -24(%ebp) +fmull -32(%ebp) +fsubrp %st,%st(1) +fdivl Radix +fldl -24(%ebp) +fmull -24(%ebp) +fldl D +fdivl Radix +fmulp %st,%st(1) +faddp %st,%st(1) +fstpl Q +fldl -32(%ebp) +fldl Two +fmull -24(%ebp) +fmull D +fsubrp %st,%st(1) +fstpl Z +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC859 +jb .LC859 +fldl Z +fchs +fstpl Z +fldl Z1 +fchs +fstpl Z1 +.LC859: +fldl Radix +fmull D +fstpl D +mov $0,%eax +.LC858: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf861: +.size NewD,.Lf861-NewD +.globl SR3750 +.align 16 +.type SR3750,@function +SR3750: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $64,%esp +fldl X +fsubl Radix +fldl Z2 +fsubl Radix +fcompp +fstsw %ax +sahf +jp .LC863 +ja .LC863 +fldl X +fsubl Z2 +fldl W +fsubl Z2 +fcompp +fstsw %ax +sahf +jp .LC863 +jb .LC863 +incl I +fldl X +fmull D +subl $8,%esp +fstpl (%esp) +call sqrt +addl $8,%esp +fstpl -32(%ebp) +fldl -32(%ebp) +fstpl X2 +fldl X2 +fsubl Z2 +fldl Y +fsubl Z2 +fsubrp %st,%st(1) +fstpl Y2 +fldl X8 +fldl Y +fsubl Half +fdivrp %st,%st(1) +fstpl X2 +fldl X2 +fstpl -64(%ebp) +fldl -64(%ebp) +fldl Half +fmull -64(%ebp) +fmull -64(%ebp) +fsubrp %st,%st(1) +fstpl X2 +fldl Y2 +faddl Half +fldl Half +fsubl X2 +faddp %st,%st(1) +fstpl SqEr +fldl MinSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC865 +jbe .LC865 +fldl SqEr +fstpl MinSqEr +.LC865: +fldl Y2 +fsubl X2 +fstpl SqEr +fldl MaxSqEr +fcompl SqEr +fstsw %ax +sahf +jp .LC867 +jae .LC867 +fldl SqEr +fstpl MaxSqEr +.LC867: +.LC863: +mov $0,%eax +.LC862: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf869: +.size SR3750,.Lf869-SR3750 +.globl IsYeqX +.align 16 +.type IsYeqX,@function +IsYeqX: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +fldl X +fcompl Y +fstsw %ax +sahf +jp 1f +je .LC871 +1: +cmpl $0,N +jg .LC873 +fldl Zero +fcompl Z +fstsw %ax +sahf +jp .LC875 +jne .LC875 +fldl Zero +fcompl Q +fstsw %ax +sahf +jp .LC875 +jb .LC875 +pushl $.LC877 +call printf +addl $4,%esp +jmp .LC876 +.LC875: +pushl $.LC878 +pushl $2 +call BadCond +addl $8,%esp +.LC876: +fldl Q +subl $8,%esp +fstpl (%esp) +fldl Z +subl $8,%esp +fstpl (%esp) +pushl $.LC879 +call printf +addl $20,%esp +fldl Y +subl $8,%esp +fstpl (%esp) +pushl $.LC880 +call printf +addl $12,%esp +fldl X +subl $8,%esp +fstpl (%esp) +pushl $.LC881 +call printf +addl $12,%esp +fldl Y +fsubl X +subl $8,%esp +fstpl (%esp) +pushl $.LC882 +call printf +addl $12,%esp +.LC873: +incl N +.LC871: +mov $0,%eax +.LC870: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf883: +.size IsYeqX,.Lf883-IsYeqX +.globl SR3980 +.align 16 +.type SR3980,@function +SR3980: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +.LC885: +fildl I +fstpl Q +fldl Q +subl $8,%esp +fstpl (%esp) +fldl Z +subl $8,%esp +fstpl (%esp) +call pow +addl $16,%esp +fstpl -8(%ebp) +fldl -8(%ebp) +fstpl Y +call IsYeqX +movl I,%edi +leal 1(%edi),%edi +movl %edi,I +cmpl M,%edi +jle .LC888 +jmp .LC887 +.LC888: +fldl Z +fmull X +fstpl X +.LC886: +fldl W +fcompl X +fstsw %ax +sahf +jp .LC885 +ja .LC885 +.LC887: +mov $0,%eax +.LC884: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf890: +.size SR3980,.Lf890-SR3980 +.globl PrintIfNPositive +.align 16 +.type PrintIfNPositive,@function +PrintIfNPositive: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +cmpl $0,N +jle .LC892 +pushl N +pushl $.LC894 +call printf +addl $8,%esp +.LC892: +mov $0,%eax +.LC891: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf895: +.size PrintIfNPositive,.Lf895-PrintIfNPositive +.globl TstPtUf +.align 16 +.type TstPtUf,@function +TstPtUf: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $48,%esp +movl $0,N +fldl Zero +fcompl Z +fstsw %ax +sahf +jp 1f +je .LC897 +1: +pushl $.LC899 +call printf +addl $4,%esp +pushl $.LC900 +call printf +addl $4,%esp +leal sigfpe,%edi +movl %edi,sigsave +pushl $ovfl_buf +call _setjmp +addl $4,%esp +cmpl $0,%eax +je .LC901 +jmp .LC903 +.LC901: +fldl Z +faddl Z +fdivl Z +fstpl Q9 +fldl Q9 +subl $8,%esp +fstpl (%esp) +pushl $.LC904 +call printf +addl $12,%esp +fldl Q9 +fsubl Two +subl $8,%esp +fstpl (%esp) +call fabs +addl $8,%esp +fstpl -16(%ebp) +fldl Radix +fmull U2 +fcompl -16(%ebp) +fstsw %ax +sahf +jp .LC905 +jbe .LC905 +pushl $.LC907 +call printf +addl $4,%esp +pushl $.LC908 +call printf +addl $4,%esp +jmp .LC906 +.LC905: +fldl One +fcompl Q9 +fstsw %ax +sahf +jp .LC911 +ja .LC911 +fldl Two +fcompl Q9 +fstsw %ax +sahf +jp .LC909 +jae .LC909 +.LC911: +.LC903: +movl $1,N +movl ErrCnt+4,%edi +leal 1(%edi),%edi +movl %edi,ErrCnt+4 +pushl $.LC914 +call printf +addl $4,%esp +jmp .LC910 +.LC909: +movl $1,N +movl ErrCnt+8,%edi +leal 1(%edi),%edi +movl %edi,ErrCnt+8 +pushl $.LC917 +call printf +addl $4,%esp +.LC910: +.LC906: +movl $0,sigsave +fldl Z +fmull One +fstpl V9 +fldl V9 +fstpl Random1 +fldl One +fmull Z +fstpl V9 +fldl V9 +fstpl Random2 +fldl Z +fdivl One +fstpl V9 +fldl Random1 +fcompl Z +fstsw %ax +sahf +jp .LC918 +jne .LC918 +fldl Random2 +fcompl Z +fstsw %ax +sahf +jp .LC918 +jne .LC918 +fldl V9 +fcompl Z +fstsw %ax +sahf +jp .LC918 +jne .LC918 +cmpl $0,N +jle .LC919 +call Pause +jmp .LC919 +.LC918: +movl $1,N +pushl $.LC922 +pushl $2 +call BadCond +addl $8,%esp +fldl Z +subl $8,%esp +fstpl (%esp) +pushl $.LC923 +call printf +addl $12,%esp +fldl Random1 +fcompl Z +fstsw %ax +sahf +jp 1f +je .LC924 +1: +fldl Random1 +subl $8,%esp +fstpl (%esp) +pushl $.LC926 +call printf +addl $12,%esp +.LC924: +fldl Random2 +fcompl Z +fstsw %ax +sahf +jp 1f +je .LC927 +1: +fldl Random1 +fcompl Random2 +fstsw %ax +sahf +jp 1f +je .LC927 +1: +fldl Random2 +subl $8,%esp +fstpl (%esp) +pushl $.LC929 +call printf +addl $12,%esp +.LC927: +fldl V9 +fcompl Z +fstsw %ax +sahf +jp 1f +je .LC930 +1: +fldl V9 +subl $8,%esp +fstpl (%esp) +pushl $.LC932 +call printf +addl $12,%esp +.LC930: +fldl Random1 +fcompl Random2 +fstsw %ax +sahf +jp 1f +je .LC933 +1: +movl ErrCnt+8,%edi +leal 1(%edi),%edi +movl %edi,ErrCnt+8 +pushl $.LC937 +pushl $2 +call BadCond +addl $8,%esp +fldl Random2 +subl $8,%esp +fstpl (%esp) +pushl $.LC938 +call printf +addl $12,%esp +fldl Random1 +subl $8,%esp +fstpl (%esp) +pushl $.LC939 +call printf +addl $12,%esp +.LC933: +call Pause +.LC919: +.LC897: +mov $0,%eax +.LC896: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf940: +.size TstPtUf,.Lf940-TstPtUf +.globl notify +.align 16 +.type notify,@function +notify: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl 20(%ebp) +pushl $.LC942 +call printf +addl $8,%esp +pushl $.LC943 +call printf +addl $4,%esp +mov $0,%eax +.LC941: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf944: +.size notify,.Lf944-notify +.globl msglist +.align 16 +.type msglist,@function +msglist: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +jmp .LC947 +.LC946: +movl 20(%ebp),%edi +leal 4(%edi),%esi +movl %esi,20(%ebp) +pushl (,%edi) +pushl $.LC949 +call printf +addl $8,%esp +.LC947: +movl 20(%ebp),%edi +movl (,%edi),%edi +cmpl $0,%edi +jne .LC946 +mov $0,%eax +.LC945: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf950: +.size msglist,.Lf950-msglist +.data +.align 4 +.type instr.952,@object +instr.952: +.long .LC953 +.long .LC954 +.long .LC955 +.long .LC956 +.long .LC957 +.long .LC958 +.long .LC959 +.long .LC960 +.long .LC961 +.long 0 +.size instr.952,40 +.globl Instructions +.text +.align 16 +.type Instructions,@function +Instructions: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl $instr.952 +call msglist +addl $4,%esp +mov $0,%eax +.LC951: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf962: +.size Instructions,.Lf962-Instructions +.data +.align 4 +.type head.964,@object +head.964: +.long .LC965 +.long .LC966 +.long .LC967 +.long .LC968 +.long .LC969 +.long .LC970 +.long .LC971 +.long .LC972 +.long .LC973 +.long .LC974 +.long .LC975 +.long .LC976 +.long .LC977 +.long .LC978 +.long 0 +.size head.964,60 +.globl Heading +.text +.align 16 +.type Heading,@function +Heading: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl $head.964 +call msglist +addl $4,%esp +mov $0,%eax +.LC963: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf979: +.size Heading,.Lf979-Heading +.data +.align 4 +.type chars.981,@object +chars.981: +.long .LC982 +.long .LC983 +.long .LC984 +.long .LC985 +.long .LC986 +.long .LC987 +.long .LC988 +.long .LC989 +.long .LC990 +.long .LC991 +.long .LC992 +.long .LC993 +.long .LC994 +.long .LC995 +.long .LC996 +.long .LC997 +.long .LC998 +.long .LC999 +.long .LC1000 +.long 0 +.size chars.981,80 +.globl Characteristics +.text +.align 16 +.type Characteristics,@function +Characteristics: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl $chars.981 +call msglist +addl $4,%esp +mov $0,%eax +.LC980: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf1001: +.size Characteristics,.Lf1001-Characteristics +.data +.align 4 +.type hist.1003,@object +hist.1003: +.long .LC1004 +.long .LC1005 +.long .LC1006 +.long .LC1007 +.long .LC1008 +.long .LC1009 +.long .LC1010 +.long .LC1011 +.long .LC1012 +.long .LC1013 +.long .LC1014 +.long .LC1015 +.long .LC1016 +.long .LC1017 +.long .LC1018 +.long .LC1019 +.long .LC1020 +.long 0 +.size hist.1003,72 +.globl History +.text +.align 16 +.type History,@function +History: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl $hist.1003 +call msglist +addl $4,%esp +mov $0,%eax +.LC1002: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf1021: +.size History,.Lf1021-History +.globl pow +.align 16 +.type pow,@function +pow: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $96,%esp +movl $0,-20(%ebp) +movl $0,-24(%ebp) +fldl .LC8 +fcompl 28(%ebp) +fstsw %ax +sahf +jp .LC1023 +jne .LC1023 +fldl .LC9 +jmp .LC1022 +.LC1023: +fldl .LC1028 +fcompl 28(%ebp) +fstsw %ax +sahf +jp .LC1027 +ja .LC1027 +fldl .LC1029 +fcompl 28(%ebp) +fstsw %ax +sahf +jp .LC1025 +jae .LC1025 +.LC1027: +fldl .LC827 +fcompl 20(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1025 +1: +fldl 20(%ebp) +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -48(%ebp) +fldl 28(%ebp) +fmull -48(%ebp) +subl $8,%esp +fstpl (%esp) +call exp +addl $8,%esp +fstpl -56(%ebp) +fldl -56(%ebp) +jmp .LC1022 +.LC1025: +fldl .LC8 +fcompl 28(%ebp) +fstsw %ax +sahf +jp .LC1030 +jbe .LC1030 +fldl 28(%ebp) +fchs +fstpl 28(%ebp) +movl $1,-24(%ebp) +.LC1030: +leal -32(%ebp),%edi +pushl %edi +fldl 28(%ebp) +subl $8,%esp +fstpl (%esp) +call modf +addl $12,%esp +fstpl -64(%ebp) +fldl -64(%ebp) +fstpl 28(%ebp) +fldl .LC8 +fcompl 28(%ebp) +fstsw %ax +sahf +jp 1f +je .LC1032 +1: +fldl 20(%ebp) +subl $8,%esp +fstpl (%esp) +call log +addl $8,%esp +fstpl -72(%ebp) +fldl 28(%ebp) +fmull -72(%ebp) +subl $8,%esp +fstpl (%esp) +call exp +addl $8,%esp +fstpl -80(%ebp) +fldl -80(%ebp) +fstpl -16(%ebp) +jmp .LC1033 +.LC1032: +fldl .LC9 +fstpl -16(%ebp) +.LC1033: +leal -8(%ebp),%edi +pushl %edi +fldl 20(%ebp) +subl $8,%esp +fstpl (%esp) +call frexp +addl $12,%esp +fstpl -88(%ebp) +fldl -88(%ebp) +fstpl 20(%ebp) +fldl -32(%ebp) +subl $8,%esp +fnstcw 4(%esp) +movl 4(%esp),%edx +movb $12,%dh +movl %edx,0(%esp) +fldcw 0(%esp) +fistpl 0(%esp) +popl %eax +fldcw 0(%esp) +addl $4,%esp +movl %eax,-4(%ebp) +cmpl $0,%eax +je .LC1034 +.LC1036: +movl -4(%ebp),%edi +andl $1,%edi +cmpl $0,%edi +je .LC1040 +fldl -16(%ebp) +fmull 20(%ebp) +fstpl -16(%ebp) +movl -8(%ebp),%edi +addl %edi,-20(%ebp) +.LC1040: +movl -4(%ebp),%edi +sarl $1,%edi +movl %edi,-4(%ebp) +cmpl $0,%edi +jne .LC1042 +jmp .LC1038 +.LC1042: +fldl 20(%ebp) +fmull 20(%ebp) +fstpl 20(%ebp) +sall $1,-8(%ebp) +fldl .LC1046 +fcompl 20(%ebp) +fstsw %ax +sahf +jp .LC1036 +jbe .LC1036 +fldl .LC1047 +fmull 20(%ebp) +fstpl 20(%ebp) +decl -8(%ebp) +jmp .LC1036 +.LC1038: +.LC1034: +cmpl $0,-24(%ebp) +je .LC1048 +fldl .LC9 +fdivl -16(%ebp) +fstpl -16(%ebp) +negl -20(%ebp) +.LC1048: +pushl -20(%ebp) +fldl -16(%ebp) +subl $8,%esp +fstpl (%esp) +call ldexp +addl $12,%esp +fstpl -96(%ebp) +fldl -96(%ebp) +.LC1022: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf1050: +.size pow,.Lf1050-pow +.bss +.globl UfNGrad +.align 4 +.type UfNGrad,@object +.size UfNGrad,4 +.comm UfNGrad,4 +.globl SqRWrng +.align 4 +.type SqRWrng,@object +.size SqRWrng,4 +.comm SqRWrng,4 +.globl IEEE +.align 4 +.type IEEE,@object +.size IEEE,4 +.comm IEEE,4 +.globl Anomaly +.align 4 +.type Anomaly,@object +.size Anomaly,4 +.comm Anomaly,4 +.globl Monot +.align 4 +.type Monot,@object +.size Monot,4 +.comm Monot,4 +.globl NotMonot +.align 4 +.type NotMonot,@object +.size NotMonot,4 +.comm NotMonot,4 +.globl Done +.align 4 +.type Done,@object +.size Done,4 +.comm Done,4 +.globl Break +.align 4 +.type Break,@object +.size Break,4 +.comm Break,4 +.globl RSqrt +.align 4 +.type RSqrt,@object +.size RSqrt,4 +.comm RSqrt,4 +.globl RAddSub +.align 4 +.type RAddSub,@object +.size RAddSub,4 +.comm RAddSub,4 +.globl RDiv +.align 4 +.type RDiv,@object +.size RDiv,4 +.comm RDiv,4 +.globl RMult +.align 4 +.type RMult,@object +.size RMult,4 +.comm RMult,4 +.globl GAddSub +.align 4 +.type GAddSub,@object +.size GAddSub,4 +.comm GAddSub,4 +.globl GDiv +.align 4 +.type GDiv,@object +.size GDiv,4 +.comm GDiv,4 +.globl GMult +.align 4 +.type GMult,@object +.size GMult,4 +.comm GMult,4 +.globl N1 +.align 4 +.type N1,@object +.size N1,4 +.comm N1,4 +.globl N +.align 4 +.type N,@object +.size N,4 +.comm N,4 +.globl M +.align 4 +.type M,@object +.size M,4 +.comm M,4 +.globl PageNo +.align 4 +.type PageNo,@object +.size PageNo,4 +.comm PageNo,4 +.globl Milestone +.align 4 +.type Milestone,@object +.size Milestone,4 +.comm Milestone,4 +.globl fpecount +.align 4 +.type fpecount,@object +.size fpecount,4 +.comm fpecount,4 +.globl ErrCnt +.align 4 +.type ErrCnt,@object +.size ErrCnt,16 +.comm ErrCnt,16 +.globl Z9 +.align 4 +.type Z9,@object +.size Z9,8 +.comm Z9,8 +.globl Z2 +.align 4 +.type Z2,@object +.size Z2,8 +.comm Z2,8 +.globl Z1 +.align 4 +.type Z1,@object +.size Z1,8 +.comm Z1,8 +.globl PseudoZero +.align 4 +.type PseudoZero,@object +.size PseudoZero,8 +.comm PseudoZero,8 +.globl Z +.align 4 +.type Z,@object +.size Z,8 +.comm Z,8 +.globl Random2 +.align 4 +.type Random2,@object +.size Random2,8 +.comm Random2,8 +.globl Y2 +.align 4 +.type Y2,@object +.size Y2,8 +.comm Y2,8 +.globl Y1 +.align 4 +.type Y1,@object +.size Y1,8 +.comm Y1,8 +.globl Y +.align 4 +.type Y,@object +.size Y,8 +.comm Y,8 +.globl Random1 +.align 4 +.type Random1,@object +.size Random1,8 +.comm Random1,8 +.globl X8 +.align 4 +.type X8,@object +.size X8,8 +.comm X8,8 +.globl X2 +.align 4 +.type X2,@object +.size X2,8 +.comm X2,8 +.globl X1 +.align 4 +.type X1,@object +.size X1,8 +.comm X1,8 +.globl X +.align 4 +.type X,@object +.size X,8 +.comm X,8 +.globl W +.align 4 +.type W,@object +.size W,8 +.comm W,8 +.globl V9 +.align 4 +.type V9,@object +.size V9,8 +.comm V9,8 +.globl V0 +.align 4 +.type V0,@object +.size V0,8 +.comm V0,8 +.globl V +.align 4 +.type V,@object +.size V,8 +.comm V,8 +.globl U2 +.align 4 +.type U2,@object +.size U2,8 +.comm U2,8 +.globl U1 +.align 4 +.type U1,@object +.size U1,8 +.comm U1,8 +.globl UfThold +.align 4 +.type UfThold,@object +.size UfThold,8 +.comm UfThold,8 +.globl OneUlp +.align 4 +.type OneUlp,@object +.size OneUlp,8 +.comm OneUlp,8 +.globl S +.align 4 +.type S,@object +.size S,8 +.comm S,8 +.globl Underflow +.align 4 +.type Underflow,@object +.size Underflow,8 +.comm Underflow,8 +.globl T +.align 4 +.type T,@object +.size T,8 +.comm T,8 +.globl Random9 +.align 4 +.type Random9,@object +.size Random9,8 +.comm Random9,8 +.globl R +.align 4 +.type R,@object +.size R,8 +.comm R,8 +.globl Q9 +.align 4 +.type Q9,@object +.size Q9,8 +.comm Q9,8 +.globl Q +.align 4 +.type Q,@object +.size Q,8 +.comm Q,8 +.globl Precision +.align 4 +.type Precision,@object +.size Precision,8 +.comm Precision,8 +.globl MyZero +.align 4 +.type MyZero,@object +.size MyZero,8 +.comm MyZero,8 +.globl J +.align 4 +.type J,@object +.size J,8 +.comm J,8 +.globl StickyBit +.align 4 +.type StickyBit,@object +.size StickyBit,8 +.comm StickyBit,8 +.globl I +.align 4 +.type I,@object +.size I,4 +.comm I,4 +.globl HInvrse +.align 4 +.type HInvrse,@object +.size HInvrse,8 +.comm HInvrse,8 +.globl H +.align 4 +.type H,@object +.size H,8 +.comm H,8 +.globl F9 +.align 4 +.type F9,@object +.size F9,8 +.comm F9,8 +.globl F6 +.align 4 +.type F6,@object +.size F6,8 +.comm F6,8 +.globl Third +.align 4 +.type Third,@object +.size Third,8 +.comm Third,8 +.globl E9 +.align 4 +.type E9,@object +.size E9,8 +.comm E9,8 +.globl MaxSqEr +.align 4 +.type MaxSqEr,@object +.size MaxSqEr,8 +.comm MaxSqEr,8 +.globl SqEr +.align 4 +.type SqEr,@object +.size SqEr,8 +.comm SqEr,8 +.globl MinSqEr +.align 4 +.type MinSqEr,@object +.size MinSqEr,8 +.comm MinSqEr,8 +.globl E3 +.align 4 +.type E3,@object +.size E3,8 +.comm E3,8 +.globl Exp2 +.align 4 +.type Exp2,@object +.size Exp2,8 +.comm Exp2,8 +.globl E1 +.align 4 +.type E1,@object +.size E1,8 +.comm E1,8 +.globl E0 +.align 4 +.type E0,@object +.size E0,8 +.comm E0,8 +.globl FourD +.align 4 +.type FourD,@object +.size FourD,8 +.comm FourD,8 +.globl D +.align 4 +.type D,@object +.size D,8 +.comm D,8 +.globl CInvrse +.align 4 +.type CInvrse,@object +.size CInvrse,8 +.comm CInvrse,8 +.globl C +.align 4 +.type C,@object +.size C,8 +.comm C,8 +.globl A1 +.align 4 +.type A1,@object +.size A1,8 +.comm A1,8 +.globl AInvrse +.align 4 +.type AInvrse,@object +.size AInvrse,8 +.comm AInvrse,8 +.globl ch +.align 1 +.type ch,@object +.size ch,8 +.comm ch,8 +.globl Indx +.align 4 +.type Indx,@object +.size Indx,4 +.comm Indx,4 +.globl BMinusU2 +.align 4 +.type BMinusU2,@object +.size BMinusU2,8 +.comm BMinusU2,8 +.globl RadixD2 +.align 4 +.type RadixD2,@object +.size RadixD2,8 +.comm RadixD2,8 +.globl BInvrse +.align 4 +.type BInvrse,@object +.size BInvrse,8 +.comm BInvrse,8 +.globl Radix +.align 4 +.type Radix,@object +.size Radix,8 +.comm Radix,8 +.globl sigsave +.align 4 +.type sigsave,@object +.size sigsave,4 +.comm sigsave,4 +.globl ovfl_buf +.align 4 +.type ovfl_buf,@object +.size ovfl_buf,64 +.comm ovfl_buf,64 +.data +.align 4 +.LC1047: +.long 0 +.long 1073741824 +.align 4 +.LC1046: +.long 0 +.long 1071644672 +.align 4 +.LC1029: +.long 0 +.long 1083256832 +.align 4 +.LC1028: +.long 0 +.long -1064226816 +.align 1 +.LC1020: +.byte 115 +.byte 101 +.byte 101 +.byte 32 +.byte 115 +.byte 111 +.byte 117 +.byte 114 +.byte 99 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 109 +.byte 111 +.byte 114 +.byte 101 +.byte 32 +.byte 104 +.byte 105 +.byte 115 +.byte 116 +.byte 111 +.byte 114 +.byte 121 +.byte 46 +.byte 0 +.align 1 +.LC1019: +.byte 66 +.byte 65 +.byte 83 +.byte 73 +.byte 67 +.byte 32 +.byte 118 +.byte 101 +.byte 114 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 40 +.byte 67 +.byte 41 +.byte 32 +.byte 49 +.byte 57 +.byte 56 +.byte 51 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 80 +.byte 114 +.byte 111 +.byte 102 +.byte 46 +.byte 32 +.byte 87 +.byte 46 +.byte 32 +.byte 77 +.byte 46 +.byte 32 +.byte 75 +.byte 97 +.byte 104 +.byte 97 +.byte 110 +.byte 59 +.byte 0 +.align 1 +.LC1018: +.byte 97 +.byte 115 +.byte 32 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 99 +.byte 101 +.byte 114 +.byte 116 +.byte 97 +.byte 105 +.byte 110 +.byte 32 +.byte 101 +.byte 97 +.byte 114 +.byte 108 +.byte 121 +.byte 32 +.byte 87 +.byte 65 +.byte 78 +.byte 71 +.byte 32 +.byte 109 +.byte 97 +.byte 99 +.byte 104 +.byte 105 +.byte 110 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC1017: +.byte 102 +.byte 108 +.byte 111 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 45 +.byte 112 +.byte 111 +.byte 105 +.byte 110 +.byte 116 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 115 +.byte 44 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 108 +.byte 115 +.byte 111 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 111 +.byte 119 +.byte 115 +.byte 32 +.byte 108 +.byte 111 +.byte 103 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 105 +.byte 99 +.byte 32 +.byte 101 +.byte 110 +.byte 99 +.byte 111 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 0 +.align 1 +.LC1016: +.byte 10 +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 98 +.byte 97 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 117 +.byte 112 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 118 +.byte 101 +.byte 110 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 114 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 114 +.byte 101 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 101 +.byte 110 +.byte 116 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 0 +.align 1 +.LC1015: +.byte 111 +.byte 102 +.byte 32 +.byte 112 +.byte 97 +.byte 116 +.byte 104 +.byte 111 +.byte 108 +.byte 111 +.byte 103 +.byte 105 +.byte 101 +.byte 115 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 115 +.byte 97 +.byte 121 +.byte 32 +.byte 104 +.byte 111 +.byte 119 +.byte 32 +.byte 119 +.byte 101 +.byte 108 +.byte 108 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 109 +.byte 112 +.byte 108 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 1 +.LC1014: +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 44 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 116 +.byte 114 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 112 +.byte 101 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 97 +.byte 32 +.byte 119 +.byte 105 +.byte 100 +.byte 101 +.byte 114 +.byte 32 +.byte 118 +.byte 97 +.byte 114 +.byte 105 +.byte 101 +.byte 116 +.byte 121 +.byte 0 +.align 1 +.LC1013: +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 44 +.byte 32 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 114 +.byte 97 +.byte 110 +.byte 103 +.byte 101 +.byte 32 +.byte 40 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 47 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 115 +.byte 41 +.byte 0 +.align 1 +.LC1012: +.byte 87 +.byte 46 +.byte 32 +.byte 74 +.byte 46 +.byte 32 +.byte 67 +.byte 111 +.byte 100 +.byte 121 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 87 +.byte 46 +.byte 32 +.byte 87 +.byte 97 +.byte 105 +.byte 116 +.byte 101 +.byte 46 +.byte 32 +.byte 65 +.byte 108 +.byte 116 +.byte 104 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 32 +.byte 98 +.byte 111 +.byte 116 +.byte 104 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 115 +.byte 32 +.byte 116 +.byte 114 +.byte 121 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 0 +.align 1 +.LC1011: +.byte 98 +.byte 111 +.byte 111 +.byte 107 +.byte 32 +.byte 32 +.byte 96 +.byte 83 +.byte 111 +.byte 102 +.byte 116 +.byte 119 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 77 +.byte 97 +.byte 110 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 69 +.byte 108 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 97 +.byte 114 +.byte 121 +.byte 32 +.byte 70 +.byte 117 +.byte 110 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 39 +.byte 32 +.byte 40 +.byte 49 +.byte 57 +.byte 56 +.byte 48 +.byte 41 +.byte 32 +.byte 98 +.byte 121 +.byte 0 +.align 1 +.LC1010: +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 99 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 100 +.byte 32 +.byte 96 +.byte 77 +.byte 65 +.byte 67 +.byte 72 +.byte 65 +.byte 82 +.byte 39 +.byte 44 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 101 +.byte 110 +.byte 100 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 0 +.align 1 +.LC1009: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 99 +.byte 97 +.byte 112 +.byte 97 +.byte 98 +.byte 105 +.byte 108 +.byte 105 +.byte 116 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 103 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 121 +.byte 111 +.byte 110 +.byte 100 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 101 +.byte 97 +.byte 114 +.byte 108 +.byte 105 +.byte 101 +.byte 114 +.byte 0 +.align 1 +.LC1008: +.byte 70 +.byte 97 +.byte 105 +.byte 108 +.byte 117 +.byte 114 +.byte 101 +.byte 115 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 115 +.byte 101 +.byte 113 +.byte 117 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC1007: +.byte 32 +.byte 32 +.byte 32 +.byte 70 +.byte 65 +.byte 73 +.byte 76 +.byte 85 +.byte 82 +.byte 69 +.byte 115 +.byte 44 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 50 +.byte 43 +.byte 50 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 53 +.byte 32 +.byte 46 +.byte 0 +.align 1 +.LC1006: +.byte 32 +.byte 32 +.byte 32 +.byte 83 +.byte 101 +.byte 114 +.byte 105 +.byte 111 +.byte 117 +.byte 115 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 115 +.byte 44 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 97 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 0 +.align 1 +.LC1005: +.byte 32 +.byte 32 +.byte 32 +.byte 70 +.byte 76 +.byte 65 +.byte 87 +.byte 115 +.byte 44 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 97 +.byte 32 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 44 +.byte 0 +.align 1 +.LC1004: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 97 +.byte 116 +.byte 116 +.byte 101 +.byte 109 +.byte 112 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 114 +.byte 105 +.byte 109 +.byte 105 +.byte 110 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 97 +.byte 109 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 1 +.LC1000: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 68 +.byte 101 +.byte 99 +.byte 105 +.byte 109 +.byte 97 +.byte 108 +.byte 45 +.byte 66 +.byte 105 +.byte 110 +.byte 97 +.byte 114 +.byte 121 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 118 +.byte 101 +.byte 114 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 89 +.byte 69 +.byte 84 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 97 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 97 +.byte 99 +.byte 121 +.byte 46 +.byte 0 +.align 1 +.LC999: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 69 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 45 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 101 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 101 +.byte 118 +.byte 101 +.byte 97 +.byte 108 +.byte 101 +.byte 100 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 89 +.byte 69 +.byte 84 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 1 +.LC998: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 83 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 32 +.byte 32 +.byte 89 +.byte 94 +.byte 88 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 1 +.LC997: +.byte 9 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 116 +.byte 97 +.byte 109 +.byte 105 +.byte 110 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 112 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 45 +.byte 122 +.byte 101 +.byte 114 +.byte 111 +.byte 115 +.byte 46 +.byte 0 +.align 1 +.LC996: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 101 +.byte 99 +.byte 107 +.byte 101 +.byte 100 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 115 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 110 +.byte 99 +.byte 121 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 1 +.LC995: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 86 +.byte 48 +.byte 32 +.byte 32 +.byte 116 +.byte 101 +.byte 108 +.byte 108 +.byte 115 +.byte 44 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 108 +.byte 121 +.byte 44 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 32 +.byte 73 +.byte 110 +.byte 102 +.byte 105 +.byte 110 +.byte 105 +.byte 116 +.byte 121 +.byte 32 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 114 +.byte 101 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 101 +.byte 110 +.byte 116 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 1 +.LC994: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 86 +.byte 32 +.byte 61 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 44 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 108 +.byte 121 +.byte 46 +.byte 0 +.align 1 +.LC993: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 69 +.byte 48 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 80 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 116 +.byte 101 +.byte 108 +.byte 108 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 98 +.byte 114 +.byte 117 +.byte 112 +.byte 116 +.byte 44 +.byte 32 +.byte 103 +.byte 114 +.byte 97 +.byte 100 +.byte 117 +.byte 97 +.byte 108 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 117 +.byte 122 +.byte 122 +.byte 121 +.byte 46 +.byte 0 +.align 1 +.LC992: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 84 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 61 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 46 +.byte 0 +.align 1 +.LC991: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 87 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 97 +.byte 32 +.byte 83 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 66 +.byte 105 +.byte 116 +.byte 32 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 46 +.byte 0 +.align 1 +.LC990: +.byte 9 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 46 +.byte 44 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 46 +.byte 44 +.byte 32 +.byte 65 +.byte 100 +.byte 100 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 46 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 83 +.byte 113 +.byte 114 +.byte 116 +.byte 46 +.byte 0 +.align 1 +.LC989: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 87 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 44 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 115 +.byte 111 +.byte 109 +.byte 101 +.byte 116 +.byte 104 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 0 +.align 1 +.LC988: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 65 +.byte 100 +.byte 101 +.byte 113 +.byte 117 +.byte 97 +.byte 99 +.byte 121 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 46 +.byte 44 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 46 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 46 +.byte 0 +.align 1 +.LC987: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 49 +.byte 47 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 94 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 61 +.byte 32 +.byte 79 +.byte 110 +.byte 101 +.byte 32 +.byte 85 +.byte 108 +.byte 112 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 108 +.byte 105 +.byte 116 +.byte 116 +.byte 108 +.byte 101 +.byte 32 +.byte 108 +.byte 101 +.byte 115 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 49 +.byte 46 +.byte 48 +.byte 32 +.byte 46 +.byte 0 +.align 1 +.LC986: +.byte 9 +.byte 40 +.byte 79 +.byte 110 +.byte 101 +.byte 85 +.byte 108 +.byte 112 +.byte 110 +.byte 105 +.byte 116 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 76 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 80 +.byte 108 +.byte 97 +.byte 99 +.byte 101 +.byte 41 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 49 +.byte 46 +.byte 48 +.byte 48 +.byte 48 +.byte 120 +.byte 120 +.byte 120 +.byte 32 +.byte 46 +.byte 0 +.align 1 +.LC985: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 85 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 47 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 94 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 61 +.byte 32 +.byte 79 +.byte 110 +.byte 101 +.byte 32 +.byte 85 +.byte 108 +.byte 112 +.byte 0 +.align 1 +.LC984: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 61 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 105 +.byte 102 +.byte 105 +.byte 99 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 99 +.byte 97 +.byte 114 +.byte 114 +.byte 105 +.byte 101 +.byte 100 +.byte 46 +.byte 0 +.align 1 +.LC983: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 49 +.byte 44 +.byte 32 +.byte 50 +.byte 44 +.byte 32 +.byte 52 +.byte 44 +.byte 32 +.byte 56 +.byte 44 +.byte 32 +.byte 49 +.byte 48 +.byte 44 +.byte 32 +.byte 49 +.byte 54 +.byte 44 +.byte 32 +.byte 49 +.byte 48 +.byte 48 +.byte 44 +.byte 32 +.byte 50 +.byte 53 +.byte 54 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 0 +.align 1 +.LC982: +.byte 82 +.byte 117 +.byte 110 +.byte 110 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 114 +.byte 101 +.byte 118 +.byte 101 +.byte 97 +.byte 108 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 115 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 101 +.byte 114 +.byte 105 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 115 +.byte 58 +.byte 0 +.align 1 +.LC978: +.byte 9 +.byte 79 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 114 +.byte 101 +.byte 108 +.byte 101 +.byte 118 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 105 +.byte 108 +.byte 101 +.byte 114 +.byte 32 +.byte 111 +.byte 112 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 58 +.byte 0 +.align 1 +.LC977: +.byte 9 +.byte 79 +.byte 112 +.byte 116 +.byte 105 +.byte 109 +.byte 105 +.byte 122 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 108 +.byte 101 +.byte 118 +.byte 101 +.byte 108 +.byte 58 +.byte 10 +.byte 0 +.align 1 +.LC976: +.byte 9 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 105 +.byte 108 +.byte 101 +.byte 114 +.byte 58 +.byte 10 +.byte 0 +.align 1 +.LC975: +.byte 9 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 114 +.byte 58 +.byte 10 +.byte 0 +.align 1 +.LC974: +.byte 9 +.byte 86 +.byte 101 +.byte 114 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 58 +.byte 9 +.byte 49 +.byte 48 +.byte 32 +.byte 70 +.byte 101 +.byte 98 +.byte 114 +.byte 117 +.byte 97 +.byte 114 +.byte 121 +.byte 32 +.byte 49 +.byte 57 +.byte 56 +.byte 57 +.byte 59 +.byte 0 +.align 1 +.LC973: +.byte 9 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 58 +.byte 9 +.byte 100 +.byte 111 +.byte 117 +.byte 98 +.byte 108 +.byte 101 +.byte 59 +.byte 0 +.align 1 +.LC972: +.byte 73 +.byte 110 +.byte 32 +.byte 100 +.byte 111 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 115 +.byte 111 +.byte 44 +.byte 32 +.byte 112 +.byte 108 +.byte 101 +.byte 97 +.byte 115 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 108 +.byte 117 +.byte 100 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 102 +.byte 111 +.byte 108 +.byte 108 +.byte 111 +.byte 119 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 105 +.byte 110 +.byte 102 +.byte 111 +.byte 114 +.byte 109 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 58 +.byte 0 +.align 1 +.LC971: +.byte 9 +.byte 83 +.byte 97 +.byte 110 +.byte 32 +.byte 70 +.byte 114 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 44 +.byte 32 +.byte 67 +.byte 65 +.byte 32 +.byte 57 +.byte 52 +.byte 49 +.byte 52 +.byte 51 +.byte 45 +.byte 48 +.byte 55 +.byte 48 +.byte 52 +.byte 44 +.byte 32 +.byte 85 +.byte 83 +.byte 65 +.byte 10 +.byte 0 +.align 1 +.LC970: +.byte 9 +.byte 85 +.byte 110 +.byte 105 +.byte 118 +.byte 101 +.byte 114 +.byte 115 +.byte 105 +.byte 116 +.byte 121 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 67 +.byte 97 +.byte 108 +.byte 105 +.byte 102 +.byte 111 +.byte 114 +.byte 110 +.byte 105 +.byte 97 +.byte 0 +.align 1 +.LC969: +.byte 9 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 67 +.byte 101 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 85 +.byte 45 +.byte 55 +.byte 54 +.byte 0 +.align 1 +.LC968: +.byte 9 +.byte 82 +.byte 105 +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 75 +.byte 97 +.byte 114 +.byte 112 +.byte 105 +.byte 110 +.byte 115 +.byte 107 +.byte 105 +.byte 0 +.align 1 +.LC967: +.byte 80 +.byte 108 +.byte 101 +.byte 97 +.byte 115 +.byte 101 +.byte 32 +.byte 115 +.byte 101 +.byte 110 +.byte 100 +.byte 32 +.byte 115 +.byte 117 +.byte 103 +.byte 103 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 114 +.byte 101 +.byte 115 +.byte 117 +.byte 108 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 0 +.align 1 +.LC966: +.byte 99 +.byte 111 +.byte 112 +.byte 101 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 117 +.byte 110 +.byte 97 +.byte 110 +.byte 116 +.byte 105 +.byte 99 +.byte 105 +.byte 112 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 110 +.byte 101 +.byte 119 +.byte 108 +.byte 121 +.byte 32 +.byte 117 +.byte 110 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 112 +.byte 97 +.byte 116 +.byte 104 +.byte 111 +.byte 108 +.byte 111 +.byte 103 +.byte 105 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC965: +.byte 85 +.byte 115 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 118 +.byte 105 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 104 +.byte 101 +.byte 108 +.byte 112 +.byte 32 +.byte 100 +.byte 101 +.byte 98 +.byte 117 +.byte 103 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 97 +.byte 117 +.byte 103 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 119 +.byte 105 +.byte 108 +.byte 108 +.byte 0 +.align 1 +.LC961: +.byte 65 +.byte 110 +.byte 115 +.byte 119 +.byte 101 +.byte 114 +.byte 32 +.byte 113 +.byte 117 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 89 +.byte 44 +.byte 32 +.byte 121 +.byte 44 +.byte 32 +.byte 78 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 110 +.byte 32 +.byte 40 +.byte 117 +.byte 110 +.byte 108 +.byte 101 +.byte 115 +.byte 115 +.byte 32 +.byte 111 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 119 +.byte 105 +.byte 115 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 100 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 41 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC960: +.byte 97 +.byte 109 +.byte 101 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 107 +.byte 101 +.byte 32 +.byte 102 +.byte 117 +.byte 114 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC959: +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 97 +.byte 110 +.byte 121 +.byte 119 +.byte 97 +.byte 121 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 115 +.byte 101 +.byte 101 +.byte 32 +.byte 104 +.byte 111 +.byte 119 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 109 +.byte 105 +.byte 108 +.byte 101 +.byte 115 +.byte 116 +.byte 111 +.byte 110 +.byte 101 +.byte 115 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 112 +.byte 97 +.byte 115 +.byte 115 +.byte 101 +.byte 115 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 110 +.byte 0 +.align 1 +.LC958: +.byte 119 +.byte 97 +.byte 114 +.byte 110 +.byte 105 +.byte 110 +.byte 103 +.byte 46 +.byte 32 +.byte 32 +.byte 73 +.byte 102 +.byte 32 +.byte 112 +.byte 101 +.byte 114 +.byte 115 +.byte 117 +.byte 97 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 118 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 32 +.byte 110 +.byte 97 +.byte 117 +.byte 103 +.byte 104 +.byte 116 +.byte 44 +.byte 32 +.byte 100 +.byte 111 +.byte 110 +.byte 39 +.byte 116 +.byte 32 +.byte 100 +.byte 101 +.byte 115 +.byte 112 +.byte 97 +.byte 105 +.byte 114 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 114 +.byte 117 +.byte 110 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 0 +.align 1 +.LC957: +.byte 116 +.byte 111 +.byte 32 +.byte 112 +.byte 101 +.byte 114 +.byte 115 +.byte 101 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 97 +.byte 32 +.byte 115 +.byte 117 +.byte 114 +.byte 114 +.byte 111 +.byte 103 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 97 +.byte 102 +.byte 116 +.byte 101 +.byte 114 +.byte 44 +.byte 32 +.byte 112 +.byte 101 +.byte 114 +.byte 104 +.byte 97 +.byte 112 +.byte 115 +.byte 44 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 112 +.byte 108 +.byte 97 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 115 +.byte 111 +.byte 109 +.byte 101 +.byte 0 +.align 1 +.LC956: +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 47 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 111 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 115 +.byte 44 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 114 +.byte 97 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 0 +.align 1 +.LC955: +.byte 116 +.byte 114 +.byte 121 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 112 +.byte 101 +.byte 114 +.byte 115 +.byte 117 +.byte 97 +.byte 100 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 116 +.byte 101 +.byte 114 +.byte 109 +.byte 105 +.byte 110 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 101 +.byte 120 +.byte 101 +.byte 99 +.byte 117 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 97 +.byte 110 +.byte 0 +.align 1 +.LC954: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 96 +.byte 69 +.byte 78 +.byte 68 +.byte 32 +.byte 79 +.byte 70 +.byte 32 +.byte 84 +.byte 69 +.byte 83 +.byte 84 +.byte 39 +.byte 44 +.byte 10 +.byte 0 +.align 1 +.LC953: +.byte 76 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 115 +.byte 116 +.byte 111 +.byte 112 +.byte 32 +.byte 112 +.byte 114 +.byte 101 +.byte 109 +.byte 97 +.byte 116 +.byte 117 +.byte 114 +.byte 101 +.byte 108 +.byte 121 +.byte 44 +.byte 32 +.byte 105 +.byte 46 +.byte 101 +.byte 46 +.byte 32 +.byte 98 +.byte 101 +.byte 102 +.byte 111 +.byte 114 +.byte 101 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 112 +.byte 108 +.byte 97 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 10 +.byte 0 +.align 1 +.LC949: +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC943: +.byte 32 +.byte 32 +.byte 32 +.byte 80 +.byte 76 +.byte 69 +.byte 65 +.byte 83 +.byte 69 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 73 +.byte 70 +.byte 89 +.byte 32 +.byte 75 +.byte 65 +.byte 82 +.byte 80 +.byte 73 +.byte 78 +.byte 75 +.byte 83 +.byte 73 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC942: +.byte 37 +.byte 115 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 111 +.byte 110 +.byte 115 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 110 +.byte 116 +.byte 46 +.byte 46 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC939: +.byte 9 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 90 +.byte 32 +.byte 42 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC938: +.byte 9 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 49 +.byte 32 +.byte 42 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC937: +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 100 +.byte 111 +.byte 101 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 109 +.byte 117 +.byte 116 +.byte 101 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC932: +.byte 90 +.byte 32 +.byte 47 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC929: +.byte 49 +.byte 32 +.byte 42 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 37 +.byte 103 +.byte 10 +.byte 0 +.align 1 +.LC926: +.byte 90 +.byte 32 +.byte 42 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 0 +.align 1 +.LC923: +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 9 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 101 +.byte 115 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 32 +.byte 0 +.align 1 +.LC922: +.byte 87 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 0 +.align 1 +.LC917: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC914: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 86 +.byte 69 +.byte 82 +.byte 89 +.byte 32 +.byte 83 +.byte 69 +.byte 82 +.byte 73 +.byte 79 +.byte 85 +.byte 83 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC908: +.byte 32 +.byte 104 +.byte 97 +.byte 115 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 106 +.byte 117 +.byte 115 +.byte 116 +.byte 32 +.byte 98 +.byte 101 +.byte 101 +.byte 110 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 97 +.byte 108 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC907: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 79 +.byte 46 +.byte 75 +.byte 46 +.byte 44 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 118 +.byte 105 +.byte 100 +.byte 101 +.byte 100 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 47 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 0 +.align 1 +.LC904: +.byte 87 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 109 +.byte 97 +.byte 99 +.byte 104 +.byte 105 +.byte 110 +.byte 101 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 40 +.byte 90 +.byte 32 +.byte 43 +.byte 32 +.byte 90 +.byte 41 +.byte 32 +.byte 47 +.byte 32 +.byte 90 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC900: +.byte 40 +.byte 90 +.byte 32 +.byte 43 +.byte 32 +.byte 90 +.byte 41 +.byte 32 +.byte 47 +.byte 32 +.byte 90 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 115 +.byte 97 +.byte 102 +.byte 101 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC899: +.byte 83 +.byte 105 +.byte 110 +.byte 99 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 100 +.byte 101 +.byte 110 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 101 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 0 +.align 1 +.LC894: +.byte 83 +.byte 105 +.byte 109 +.byte 105 +.byte 108 +.byte 97 +.byte 114 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 114 +.byte 101 +.byte 112 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 104 +.byte 97 +.byte 118 +.byte 101 +.byte 32 +.byte 111 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 116 +.byte 105 +.byte 109 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC882: +.byte 9 +.byte 9 +.byte 116 +.byte 104 +.byte 101 +.byte 121 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC881: +.byte 9 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 117 +.byte 110 +.byte 101 +.byte 113 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 59 +.byte 10 +.byte 0 +.align 1 +.LC880: +.byte 9 +.byte 121 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 101 +.byte 100 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 59 +.byte 10 +.byte 0 +.align 1 +.LC879: +.byte 9 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 10 +.byte 0 +.align 1 +.LC878: +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 10 +.byte 0 +.align 1 +.LC877: +.byte 87 +.byte 65 +.byte 82 +.byte 78 +.byte 73 +.byte 78 +.byte 71 +.byte 58 +.byte 32 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 10 +.byte 0 +.align 1 +.LC856: +.byte 9 +.byte 105 +.byte 110 +.byte 115 +.byte 116 +.byte 101 +.byte 97 +.byte 100 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 48 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC855: +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 45 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 4 +.LC846: +.long -1998362383 +.long 1054144693 +.align 1 +.LC843: +.byte 37 +.byte 115 +.byte 58 +.byte 32 +.byte 32 +.byte 37 +.byte 115 +.byte 0 +.align 1 +.LC842: +.byte 70 +.byte 76 +.byte 65 +.byte 87 +.byte 0 +.align 1 +.LC841: +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 0 +.align 1 +.LC840: +.byte 83 +.byte 69 +.byte 82 +.byte 73 +.byte 79 +.byte 85 +.byte 83 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 0 +.align 1 +.LC839: +.byte 70 +.byte 65 +.byte 73 +.byte 76 +.byte 85 +.byte 82 +.byte 69 +.byte 0 +.align 1 +.LC831: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 80 +.byte 97 +.byte 103 +.byte 101 +.byte 58 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 10 +.byte 0 +.align 1 +.LC830: +.byte 10 +.byte 68 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 105 +.byte 115 +.byte 32 +.byte 114 +.byte 101 +.byte 115 +.byte 117 +.byte 109 +.byte 101 +.byte 115 +.byte 32 +.byte 97 +.byte 102 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 109 +.byte 105 +.byte 108 +.byte 101 +.byte 115 +.byte 116 +.byte 111 +.byte 110 +.byte 101 +.byte 32 +.byte 78 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 37 +.byte 100 +.byte 0 +.align 4 +.LC827: +.long 0 +.long -1074790400 +.align 1 +.LC821: +.byte 69 +.byte 78 +.byte 68 +.byte 32 +.byte 79 +.byte 70 +.byte 32 +.byte 84 +.byte 69 +.byte 83 +.byte 84 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC820: +.byte 10 +.byte 65 +.byte 32 +.byte 116 +.byte 111 +.byte 116 +.byte 97 +.byte 108 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 102 +.byte 108 +.byte 111 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 112 +.byte 111 +.byte 105 +.byte 110 +.byte 116 +.byte 32 +.byte 101 +.byte 120 +.byte 99 +.byte 101 +.byte 112 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 119 +.byte 101 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 101 +.byte 103 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC817: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 69 +.byte 120 +.byte 99 +.byte 101 +.byte 108 +.byte 108 +.byte 101 +.byte 110 +.byte 116 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC816: +.byte 32 +.byte 100 +.byte 117 +.byte 114 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 71 +.byte 114 +.byte 97 +.byte 100 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC815: +.byte 44 +.byte 10 +.byte 101 +.byte 120 +.byte 99 +.byte 101 +.byte 112 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 112 +.byte 111 +.byte 115 +.byte 115 +.byte 105 +.byte 98 +.byte 108 +.byte 121 +.byte 32 +.byte 68 +.byte 111 +.byte 117 +.byte 98 +.byte 108 +.byte 101 +.byte 32 +.byte 82 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 0 +.align 1 +.LC814: +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC811: +.byte 56 +.byte 53 +.byte 52 +.byte 0 +.align 1 +.LC810: +.byte 55 +.byte 53 +.byte 52 +.byte 0 +.align 1 +.LC807: +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 112 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 73 +.byte 69 +.byte 69 +.byte 69 +.byte 32 +.byte 115 +.byte 116 +.byte 97 +.byte 110 +.byte 100 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 80 +.byte 0 +.align 1 +.LC806: +.byte 82 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 111 +.byte 114 +.byte 109 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 0 +.align 1 +.LC803: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 115 +.byte 101 +.byte 101 +.byte 109 +.byte 115 +.byte 32 +.byte 83 +.byte 97 +.byte 116 +.byte 105 +.byte 115 +.byte 102 +.byte 97 +.byte 99 +.byte 116 +.byte 111 +.byte 114 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC797: +.byte 78 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 117 +.byte 114 +.byte 101 +.byte 115 +.byte 44 +.byte 32 +.byte 100 +.byte 101 +.byte 102 +.byte 101 +.byte 99 +.byte 116 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 108 +.byte 97 +.byte 119 +.byte 115 +.byte 32 +.byte 104 +.byte 97 +.byte 118 +.byte 101 +.byte 32 +.byte 98 +.byte 101 +.byte 101 +.byte 110 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC796: +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 39 +.byte 115 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 115 +.byte 101 +.byte 113 +.byte 117 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC795: +.byte 80 +.byte 111 +.byte 116 +.byte 101 +.byte 110 +.byte 116 +.byte 105 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 32 +.byte 102 +.byte 97 +.byte 116 +.byte 97 +.byte 108 +.byte 32 +.byte 70 +.byte 65 +.byte 73 +.byte 76 +.byte 85 +.byte 82 +.byte 69 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 104 +.byte 97 +.byte 118 +.byte 101 +.byte 32 +.byte 115 +.byte 112 +.byte 111 +.byte 105 +.byte 108 +.byte 101 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 0 +.align 1 +.LC792: +.byte 117 +.byte 110 +.byte 97 +.byte 99 +.byte 99 +.byte 101 +.byte 112 +.byte 116 +.byte 97 +.byte 98 +.byte 108 +.byte 101 +.byte 32 +.byte 83 +.byte 101 +.byte 114 +.byte 105 +.byte 111 +.byte 117 +.byte 115 +.byte 32 +.byte 68 +.byte 101 +.byte 102 +.byte 101 +.byte 99 +.byte 116 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC791: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 104 +.byte 97 +.byte 115 +.byte 32 +.byte 0 +.align 1 +.LC787: +.byte 100 +.byte 101 +.byte 115 +.byte 112 +.byte 105 +.byte 116 +.byte 101 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 111 +.byte 110 +.byte 118 +.byte 101 +.byte 110 +.byte 105 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 68 +.byte 101 +.byte 102 +.byte 101 +.byte 99 +.byte 116 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC786: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 65 +.byte 99 +.byte 99 +.byte 101 +.byte 112 +.byte 116 +.byte 97 +.byte 98 +.byte 108 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC781: +.byte 83 +.byte 97 +.byte 116 +.byte 105 +.byte 115 +.byte 102 +.byte 97 +.byte 99 +.byte 116 +.byte 111 +.byte 114 +.byte 121 +.byte 32 +.byte 116 +.byte 104 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 32 +.byte 102 +.byte 108 +.byte 97 +.byte 119 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC780: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 100 +.byte 105 +.byte 97 +.byte 103 +.byte 110 +.byte 111 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 115 +.byte 101 +.byte 101 +.byte 109 +.byte 115 +.byte 32 +.byte 0 +.align 1 +.LC769: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 32 +.byte 37 +.byte 45 +.byte 50 +.byte 57 +.byte 115 +.byte 32 +.byte 37 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC762: +.byte 70 +.byte 76 +.byte 65 +.byte 87 +.byte 115 +.byte 32 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 61 +.byte 0 +.align 1 +.LC761: +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 115 +.byte 32 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 61 +.byte 0 +.align 1 +.LC760: +.byte 83 +.byte 69 +.byte 82 +.byte 73 +.byte 79 +.byte 85 +.byte 83 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 115 +.byte 32 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 61 +.byte 0 +.align 1 +.LC759: +.byte 70 +.byte 65 +.byte 73 +.byte 76 +.byte 85 +.byte 82 +.byte 69 +.byte 115 +.byte 32 +.byte 32 +.byte 101 +.byte 110 +.byte 99 +.byte 111 +.byte 117 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 100 +.byte 32 +.byte 61 +.byte 0 +.align 1 +.LC755: +.byte 10 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 84 +.byte 114 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 32 +.byte 48 +.byte 32 +.byte 47 +.byte 32 +.byte 48 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 101 +.byte 115 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 0 +.align 1 +.LC754: +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC751: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 84 +.byte 114 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 32 +.byte 49 +.byte 32 +.byte 47 +.byte 32 +.byte 48 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 101 +.byte 115 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 0 +.align 1 +.LC750: +.byte 87 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 109 +.byte 101 +.byte 115 +.byte 115 +.byte 97 +.byte 103 +.byte 101 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 47 +.byte 111 +.byte 114 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 115 +.byte 32 +.byte 100 +.byte 111 +.byte 101 +.byte 115 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 101 +.byte 63 +.byte 10 +.byte 0 +.align 1 +.LC749: +.byte 32 +.byte 32 +.byte 105 +.byte 110 +.byte 115 +.byte 116 +.byte 101 +.byte 97 +.byte 100 +.byte 44 +.byte 32 +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 45 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC748: +.byte 32 +.byte 32 +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 88 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 49 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 88 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC743: +.byte 32 +.byte 32 +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 88 +.byte 32 +.byte 32 +.byte 116 +.byte 114 +.byte 97 +.byte 112 +.byte 115 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 88 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 103 +.byte 10 +.byte 0 +.align 1 +.LC728: +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 114 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 49 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC727: +.byte 32 +.byte 117 +.byte 110 +.byte 98 +.byte 97 +.byte 108 +.byte 97 +.byte 110 +.byte 99 +.byte 101 +.byte 100 +.byte 32 +.byte 114 +.byte 97 +.byte 110 +.byte 103 +.byte 101 +.byte 59 +.byte 32 +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 42 +.byte 32 +.byte 86 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 9 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC726: +.byte 66 +.byte 97 +.byte 100 +.byte 108 +.byte 121 +.byte 0 +.align 1 +.LC719: +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 114 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 90 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 50 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC718: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC706: +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 114 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 90 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC705: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 119 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC688: +.byte 43 +.byte 45 +.byte 37 +.byte 103 +.byte 44 +.byte 32 +.byte 43 +.byte 45 +.byte 37 +.byte 103 +.byte 10 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 43 +.byte 45 +.byte 37 +.byte 103 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 46 +.byte 0 +.align 1 +.LC687: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 105 +.byte 110 +.byte 118 +.byte 111 +.byte 108 +.byte 118 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 0 +.align 1 +.LC681: +.byte 97 +.byte 98 +.byte 111 +.byte 118 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC680: +.byte 65 +.byte 110 +.byte 121 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 115 +.byte 101 +.byte 112 +.byte 97 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 42 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 111 +.byte 110 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC679: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 86 +.byte 32 +.byte 47 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC678: +.byte 78 +.byte 111 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 97 +.byte 108 +.byte 101 +.byte 100 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 86 +.byte 32 +.byte 42 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC677: +.byte 84 +.byte 104 +.byte 101 +.byte 114 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 32 +.byte 115 +.byte 97 +.byte 116 +.byte 117 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 98 +.byte 101 +.byte 99 +.byte 97 +.byte 117 +.byte 115 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 115 +.byte 121 +.byte 115 +.byte 116 +.byte 101 +.byte 109 +.byte 32 +.byte 116 +.byte 114 +.byte 97 +.byte 112 +.byte 115 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC676: +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 115 +.byte 97 +.byte 116 +.byte 117 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 115 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 86 +.byte 48 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC673: +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 86 +.byte 32 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC664: +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 112 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 9 +.byte 115 +.byte 104 +.byte 114 +.byte 105 +.byte 110 +.byte 107 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC661: +.byte 45 +.byte 40 +.byte 45 +.byte 89 +.byte 41 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 89 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC660: +.byte 102 +.byte 105 +.byte 110 +.byte 100 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 0 +.align 1 +.LC659: +.byte 83 +.byte 101 +.byte 101 +.byte 109 +.byte 115 +.byte 32 +.byte 79 +.byte 46 +.byte 75 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC656: +.byte 84 +.byte 114 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 89 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC655: +.byte 67 +.byte 97 +.byte 110 +.byte 32 +.byte 96 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 45 +.byte 89 +.byte 39 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 63 +.byte 10 +.byte 0 +.align 1 +.LC648: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 103 +.byte 101 +.byte 110 +.byte 101 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC647: +.byte 83 +.byte 101 +.byte 97 +.byte 114 +.byte 99 +.byte 104 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 79 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 58 +.byte 10 +.byte 0 +.align 1 +.LC646: +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 110 +.byte 111 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 114 +.byte 101 +.byte 112 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC638: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 112 +.byte 111 +.byte 119 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 90 +.byte 94 +.byte 81 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 114 +.byte 32 +.byte 110 +.byte 101 +.byte 97 +.byte 114 +.byte 108 +.byte 121 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 101 +.byte 109 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC637: +.byte 65 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 97 +.byte 99 +.byte 121 +.byte 32 +.byte 115 +.byte 101 +.byte 101 +.byte 109 +.byte 115 +.byte 32 +.byte 97 +.byte 100 +.byte 101 +.byte 113 +.byte 117 +.byte 97 +.byte 116 +.byte 101 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC630: +.byte 9 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 105 +.byte 110 +.byte 118 +.byte 111 +.byte 108 +.byte 118 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 105 +.byte 110 +.byte 121 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC629: +.byte 9 +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 109 +.byte 117 +.byte 99 +.byte 104 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 115 +.byte 112 +.byte 111 +.byte 105 +.byte 108 +.byte 32 +.byte 102 +.byte 105 +.byte 110 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 97 +.byte 108 +.byte 10 +.byte 0 +.align 1 +.LC628: +.byte 9 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC627: +.byte 9 +.byte 40 +.byte 49 +.byte 32 +.byte 43 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 59 +.byte 10 +.byte 0 +.align 1 +.LC626: +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 10 +.byte 0 +.align 1 +.LC625: +.byte 67 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 0 +.align 1 +.LC618: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 88 +.byte 94 +.byte 40 +.byte 40 +.byte 88 +.byte 32 +.byte 43 +.byte 32 +.byte 49 +.byte 41 +.byte 32 +.byte 47 +.byte 32 +.byte 40 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 49 +.byte 41 +.byte 41 +.byte 32 +.byte 118 +.byte 115 +.byte 46 +.byte 32 +.byte 101 +.byte 120 +.byte 112 +.byte 40 +.byte 50 +.byte 41 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 88 +.byte 32 +.byte 45 +.byte 62 +.byte 32 +.byte 49 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC614: +.byte 84 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 79 +.byte 46 +.byte 75 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC611: +.byte 32 +.byte 32 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC610: +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 98 +.byte 101 +.byte 116 +.byte 119 +.byte 101 +.byte 101 +.byte 110 +.byte 32 +.byte 48 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 10 +.byte 0 +.align 1 +.LC606: +.byte 97 +.byte 99 +.byte 116 +.byte 117 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 32 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 121 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 58 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC605: +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 97 +.byte 102 +.byte 102 +.byte 108 +.byte 105 +.byte 99 +.byte 116 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 10 +.byte 9 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 59 +.byte 10 +.byte 0 +.align 1 +.LC604: +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 61 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 32 +.byte 94 +.byte 32 +.byte 40 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 41 +.byte 10 +.byte 111 +.byte 110 +.byte 108 +.byte 121 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 0 +.align 1 +.LC603: +.byte 83 +.byte 105 +.byte 110 +.byte 99 +.byte 101 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 111 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 115 +.byte 32 +.byte 98 +.byte 101 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC602: +.byte 82 +.byte 97 +.byte 110 +.byte 103 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 110 +.byte 97 +.byte 114 +.byte 114 +.byte 111 +.byte 119 +.byte 59 +.byte 32 +.byte 85 +.byte 49 +.byte 94 +.byte 37 +.byte 100 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC597: +.byte 109 +.byte 101 +.byte 114 +.byte 101 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 111 +.byte 102 +.byte 102 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC596: +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 115 +.byte 117 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 32 +.byte 108 +.byte 97 +.byte 114 +.byte 103 +.byte 101 +.byte 114 +.byte 32 +.byte 82 +.byte 101 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 0 +.align 1 +.LC595: +.byte 32 +.byte 98 +.byte 101 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 0 +.align 1 +.LC594: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC593: +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 49 +.byte 32 +.byte 43 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC592: +.byte 88 +.byte 32 +.byte 47 +.byte 32 +.byte 90 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC589: +.byte 101 +.byte 110 +.byte 99 +.byte 111 +.byte 117 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 97 +.byte 108 +.byte 116 +.byte 104 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 32 +.byte 97 +.byte 99 +.byte 116 +.byte 117 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 10 +.byte 0 +.align 1 +.LC588: +.byte 32 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 40 +.byte 102 +.byte 40 +.byte 88 +.byte 41 +.byte 32 +.byte 45 +.byte 32 +.byte 102 +.byte 40 +.byte 90 +.byte 41 +.byte 41 +.byte 32 +.byte 47 +.byte 32 +.byte 40 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 90 +.byte 41 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC587: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 105 +.byte 102 +.byte 32 +.byte 40 +.byte 88 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 90 +.byte 41 +.byte 32 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 32 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 0 +.align 1 +.LC586: +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 117 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 110 +.byte 32 +.byte 105 +.byte 110 +.byte 110 +.byte 111 +.byte 99 +.byte 101 +.byte 110 +.byte 116 +.byte 32 +.byte 115 +.byte 116 +.byte 97 +.byte 116 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC585: +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 83 +.byte 69 +.byte 82 +.byte 73 +.byte 79 +.byte 85 +.byte 83 +.byte 32 +.byte 68 +.byte 69 +.byte 70 +.byte 69 +.byte 67 +.byte 84 +.byte 10 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 99 +.byte 97 +.byte 117 +.byte 115 +.byte 101 +.byte 115 +.byte 32 +.byte 0 +.align 1 +.LC584: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 83 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 78 +.byte 79 +.byte 84 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 44 +.byte 32 +.byte 0 +.align 1 +.LC583: +.byte 121 +.byte 101 +.byte 116 +.byte 32 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 90 +.byte 32 +.byte 121 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC582: +.byte 88 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 9 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 101 +.byte 113 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 90 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC577: +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 47 +.byte 32 +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 101 +.byte 100 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC567: +.byte 40 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 111 +.byte 102 +.byte 102 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 41 +.byte 32 +.byte 60 +.byte 32 +.byte 69 +.byte 48 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC566: +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 103 +.byte 114 +.byte 97 +.byte 100 +.byte 117 +.byte 97 +.byte 108 +.byte 59 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 117 +.byte 114 +.byte 115 +.byte 32 +.byte 65 +.byte 98 +.byte 115 +.byte 111 +.byte 108 +.byte 117 +.byte 116 +.byte 101 +.byte 32 +.byte 69 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 61 +.byte 10 +.byte 0 +.align 1 +.LC561: +.byte 124 +.byte 81 +.byte 32 +.byte 45 +.byte 32 +.byte 89 +.byte 124 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC560: +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 32 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 81 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 89 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC559: +.byte 81 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 89 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 108 +.byte 101 +.byte 32 +.byte 100 +.byte 101 +.byte 110 +.byte 121 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 124 +.byte 81 +.byte 32 +.byte 45 +.byte 32 +.byte 89 +.byte 124 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 48 +.byte 59 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 115 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC558: +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 117 +.byte 115 +.byte 101 +.byte 115 +.byte 32 +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 44 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 10 +.byte 0 +.align 1 +.LC556: +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 32 +.byte 109 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 108 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC555: +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 100 +.byte 111 +.byte 119 +.byte 110 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC554: +.byte 97 +.byte 112 +.byte 112 +.byte 114 +.byte 111 +.byte 97 +.byte 99 +.byte 104 +.byte 32 +.byte 97 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 49 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC553: +.byte 69 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 97 +.byte 99 +.byte 99 +.byte 117 +.byte 114 +.byte 97 +.byte 99 +.byte 121 +.byte 32 +.byte 100 +.byte 101 +.byte 116 +.byte 101 +.byte 114 +.byte 105 +.byte 111 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 115 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC541: +.byte 83 +.byte 109 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 115 +.byte 116 +.byte 114 +.byte 105 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 112 +.byte 111 +.byte 115 +.byte 105 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 69 +.byte 48 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC540: +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 116 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC539: +.byte 68 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 101 +.byte 110 +.byte 99 +.byte 101 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 115 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 97 +.byte 32 +.byte 104 +.byte 105 +.byte 103 +.byte 104 +.byte 101 +.byte 114 +.byte 0 +.align 1 +.LC536: +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 101 +.byte 110 +.byte 99 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC535: +.byte 80 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 116 +.byte 115 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 97 +.byte 32 +.byte 104 +.byte 105 +.byte 103 +.byte 104 +.byte 101 +.byte 114 +.byte 0 +.align 1 +.LC528: +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 80 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC527: +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 100 +.byte 108 +.byte 121 +.byte 32 +.byte 112 +.byte 111 +.byte 115 +.byte 105 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC526: +.byte 112 +.byte 111 +.byte 115 +.byte 105 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 44 +.byte 32 +.byte 105 +.byte 115 +.byte 110 +.byte 39 +.byte 116 +.byte 59 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC525: +.byte 66 +.byte 117 +.byte 116 +.byte 32 +.byte 45 +.byte 80 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 44 +.byte 32 +.byte 119 +.byte 104 +.byte 105 +.byte 99 +.byte 104 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 98 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC522: +.byte 80 +.byte 115 +.byte 101 +.byte 117 +.byte 100 +.byte 111 +.byte 90 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 112 +.byte 114 +.byte 105 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 58 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC521: +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 100 +.byte 108 +.byte 121 +.byte 32 +.byte 110 +.byte 101 +.byte 103 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC520: +.byte 80 +.byte 111 +.byte 115 +.byte 105 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 97 +.byte 110 +.byte 10 +.byte 0 +.align 1 +.LC507: +.byte 109 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 108 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC483: +.byte 83 +.byte 101 +.byte 101 +.byte 107 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 85 +.byte 110 +.byte 100 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 32 +.byte 116 +.byte 104 +.byte 114 +.byte 101 +.byte 115 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 115 +.byte 32 +.byte 85 +.byte 102 +.byte 84 +.byte 104 +.byte 111 +.byte 108 +.byte 100 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 69 +.byte 48 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC480: +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 110 +.byte 111 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 99 +.byte 114 +.byte 101 +.byte 112 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC477: +.byte 9 +.byte 105 +.byte 110 +.byte 118 +.byte 111 +.byte 108 +.byte 118 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 114 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 97 +.byte 116 +.byte 101 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC476: +.byte 69 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 115 +.byte 32 +.byte 108 +.byte 105 +.byte 107 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 105 +.byte 110 +.byte 118 +.byte 97 +.byte 108 +.byte 105 +.byte 100 +.byte 97 +.byte 116 +.byte 101 +.byte 32 +.byte 102 +.byte 105 +.byte 110 +.byte 97 +.byte 110 +.byte 99 +.byte 105 +.byte 97 +.byte 108 +.byte 32 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC455: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 112 +.byte 111 +.byte 119 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 90 +.byte 94 +.byte 105 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 115 +.byte 109 +.byte 97 +.byte 108 +.byte 108 +.byte 32 +.byte 73 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 90 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC452: +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 108 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 1 +.LC450: +.byte 116 +.byte 111 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 117 +.byte 108 +.byte 112 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC449: +.byte 79 +.byte 98 +.byte 115 +.byte 101 +.byte 114 +.byte 118 +.byte 101 +.byte 100 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 115 +.byte 32 +.byte 114 +.byte 117 +.byte 110 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 0 +.align 1 +.LC448: +.byte 83 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 101 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC445: +.byte 83 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC440: +.byte 83 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC435: +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 115 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC434: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 94 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC433: +.byte 65 +.byte 110 +.byte 111 +.byte 109 +.byte 97 +.byte 108 +.byte 111 +.byte 117 +.byte 115 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 73 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 32 +.byte 60 +.byte 32 +.byte 0 +.align 1 +.LC393: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 119 +.byte 104 +.byte 101 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC371: +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 88 +.byte 41 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 110 +.byte 45 +.byte 109 +.byte 111 +.byte 110 +.byte 111 +.byte 116 +.byte 111 +.byte 110 +.byte 105 +.byte 99 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 88 +.byte 32 +.byte 110 +.byte 101 +.byte 97 +.byte 114 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC370: +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 104 +.byte 97 +.byte 115 +.byte 32 +.byte 112 +.byte 97 +.byte 115 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 77 +.byte 111 +.byte 110 +.byte 111 +.byte 116 +.byte 111 +.byte 110 +.byte 105 +.byte 99 +.byte 105 +.byte 116 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC353: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 32 +.byte 109 +.byte 111 +.byte 110 +.byte 111 +.byte 116 +.byte 111 +.byte 110 +.byte 105 +.byte 99 +.byte 105 +.byte 116 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC342: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 105 +.byte 102 +.byte 32 +.byte 115 +.byte 113 +.byte 114 +.byte 116 +.byte 40 +.byte 88 +.byte 32 +.byte 42 +.byte 32 +.byte 88 +.byte 41 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 88 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 73 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 88 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC337: +.byte 83 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 48 +.byte 46 +.byte 48 +.byte 44 +.byte 32 +.byte 45 +.byte 48 +.byte 46 +.byte 48 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 49 +.byte 46 +.byte 48 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 1 +.LC335: +.byte 10 +.byte 82 +.byte 117 +.byte 110 +.byte 110 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 115 +.byte 113 +.byte 117 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 114 +.byte 111 +.byte 111 +.byte 116 +.byte 40 +.byte 120 +.byte 41 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC334: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 78 +.byte 111 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 117 +.byte 114 +.byte 101 +.byte 115 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 32 +.byte 112 +.byte 97 +.byte 105 +.byte 114 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC333: +.byte 88 +.byte 32 +.byte 42 +.byte 32 +.byte 89 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 89 +.byte 32 +.byte 42 +.byte 32 +.byte 88 +.byte 32 +.byte 116 +.byte 114 +.byte 105 +.byte 97 +.byte 108 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 4 +.LC324: +.long 0 +.long 1074266112 +.align 1 +.LC323: +.byte 84 +.byte 101 +.byte 115 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 114 +.byte 97 +.byte 110 +.byte 100 +.byte 111 +.byte 109 +.byte 32 +.byte 112 +.byte 97 +.byte 105 +.byte 114 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC322: +.byte 68 +.byte 111 +.byte 101 +.byte 115 +.byte 32 +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 99 +.byte 111 +.byte 109 +.byte 109 +.byte 117 +.byte 116 +.byte 101 +.byte 63 +.byte 32 +.byte 32 +.byte 0 +.align 1 +.LC319: +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 40 +.byte 115 +.byte 41 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 117 +.byte 114 +.byte 101 +.byte 40 +.byte 115 +.byte 41 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 10 +.byte 40 +.byte 110 +.byte 111 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 97 +.byte 98 +.byte 111 +.byte 118 +.byte 101 +.byte 41 +.byte 32 +.byte 99 +.byte 111 +.byte 117 +.byte 110 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 111 +.byte 110 +.byte 101 +.byte 32 +.byte 102 +.byte 108 +.byte 97 +.byte 119 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 102 +.byte 105 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 116 +.byte 97 +.byte 108 +.byte 108 +.byte 121 +.byte 32 +.byte 98 +.byte 101 +.byte 108 +.byte 111 +.byte 119 +.byte 0 +.align 1 +.LC317: +.byte 83 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 32 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 97 +.byte 116 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC316: +.byte 83 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 97 +.byte 114 +.byte 101 +.byte 110 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 117 +.byte 115 +.byte 101 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC299: +.byte 67 +.byte 104 +.byte 101 +.byte 99 +.byte 107 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 115 +.byte 116 +.byte 105 +.byte 99 +.byte 107 +.byte 121 +.byte 32 +.byte 98 +.byte 105 +.byte 116 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC296: +.byte 40 +.byte 88 +.byte 32 +.byte 45 +.byte 32 +.byte 89 +.byte 41 +.byte 32 +.byte 43 +.byte 32 +.byte 40 +.byte 89 +.byte 32 +.byte 45 +.byte 32 +.byte 88 +.byte 41 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 110 +.byte 32 +.byte 122 +.byte 101 +.byte 114 +.byte 111 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC293: +.byte 65 +.byte 100 +.byte 100 +.byte 105 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 110 +.byte 101 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC292: +.byte 65 +.byte 100 +.byte 100 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 0 +.align 1 +.LC289: +.byte 65 +.byte 100 +.byte 100 +.byte 105 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC282: +.byte 65 +.byte 100 +.byte 100 +.byte 47 +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC277: +.byte 73 +.byte 110 +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 108 +.byte 101 +.byte 116 +.byte 101 +.byte 32 +.byte 99 +.byte 97 +.byte 114 +.byte 114 +.byte 121 +.byte 45 +.byte 112 +.byte 114 +.byte 111 +.byte 112 +.byte 97 +.byte 103 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 65 +.byte 100 +.byte 100 +.byte 105 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 1 +.LC273: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 42 +.byte 32 +.byte 40 +.byte 32 +.byte 49 +.byte 32 +.byte 47 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 41 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 49 +.byte 0 +.align 1 +.LC271: +.byte 47 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 101 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC268: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC265: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 1 +.LC262: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC257: +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 1 +.LC254: +.byte 42 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 101 +.byte 105 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 112 +.byte 101 +.byte 100 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC253: +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 99 +.byte 104 +.byte 111 +.byte 112 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC250: +.byte 77 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 105 +.byte 99 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 99 +.byte 111 +.byte 114 +.byte 114 +.byte 101 +.byte 99 +.byte 116 +.byte 108 +.byte 121 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC240: +.byte 88 +.byte 32 +.byte 42 +.byte 32 +.byte 40 +.byte 49 +.byte 47 +.byte 88 +.byte 41 +.byte 32 +.byte 100 +.byte 105 +.byte 102 +.byte 102 +.byte 101 +.byte 114 +.byte 115 +.byte 32 +.byte 102 +.byte 114 +.byte 111 +.byte 109 +.byte 32 +.byte 49 +.byte 0 +.align 1 +.LC221: +.byte 67 +.byte 104 +.byte 101 +.byte 99 +.byte 107 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 109 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 121 +.byte 44 +.byte 32 +.byte 100 +.byte 105 +.byte 118 +.byte 105 +.byte 100 +.byte 101 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 97 +.byte 100 +.byte 100 +.byte 47 +.byte 115 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC220: +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 32 +.byte 42 +.byte 44 +.byte 32 +.byte 47 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 45 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 104 +.byte 97 +.byte 118 +.byte 101 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 44 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 121 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC217: +.byte 32 +.byte 32 +.byte 46 +.byte 46 +.byte 46 +.byte 32 +.byte 32 +.byte 105 +.byte 102 +.byte 32 +.byte 40 +.byte 88 +.byte 32 +.byte 61 +.byte 61 +.byte 32 +.byte 49 +.byte 46 +.byte 48 +.byte 41 +.byte 32 +.byte 123 +.byte 46 +.byte 46 +.byte 46 +.byte 46 +.byte 46 +.byte 125 +.byte 32 +.byte 101 +.byte 108 +.byte 115 +.byte 101 +.byte 32 +.byte 123 +.byte 46 +.byte 46 +.byte 46 +.byte 47 +.byte 40 +.byte 88 +.byte 45 +.byte 49 +.byte 46 +.byte 48 +.byte 41 +.byte 46 +.byte 46 +.byte 46 +.byte 125 +.byte 10 +.byte 0 +.align 1 +.LC216: +.byte 32 +.byte 32 +.byte 115 +.byte 117 +.byte 99 +.byte 104 +.byte 32 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 97 +.byte 117 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 103 +.byte 97 +.byte 105 +.byte 110 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 122 +.byte 101 +.byte 114 +.byte 111 +.byte 32 +.byte 97 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC215: +.byte 32 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 121 +.byte 105 +.byte 101 +.byte 108 +.byte 100 +.byte 115 +.byte 32 +.byte 32 +.byte 40 +.byte 49 +.byte 45 +.byte 85 +.byte 49 +.byte 41 +.byte 32 +.byte 45 +.byte 32 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 32 +.byte 44 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 101 +.byte 98 +.byte 121 +.byte 32 +.byte 118 +.byte 105 +.byte 116 +.byte 105 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 10 +.byte 0 +.align 1 +.LC214: +.byte 99 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 32 +.byte 40 +.byte 49 +.byte 45 +.byte 85 +.byte 49 +.byte 41 +.byte 32 +.byte 60 +.byte 32 +.byte 49 +.byte 32 +.byte 32 +.byte 97 +.byte 108 +.byte 116 +.byte 104 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 10 +.byte 0 +.align 1 +.LC211: +.byte 45 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 115 +.byte 32 +.byte 71 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 68 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 99 +.byte 101 +.byte 108 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 111 +.byte 98 +.byte 115 +.byte 99 +.byte 117 +.byte 114 +.byte 101 +.byte 100 +.byte 0 +.align 1 +.LC206: +.byte 42 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 47 +.byte 111 +.byte 114 +.byte 32 +.byte 47 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 108 +.byte 97 +.byte 115 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 0 +.align 1 +.LC202: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 117 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 49 +.byte 47 +.byte 49 +.byte 46 +.byte 48 +.byte 48 +.byte 48 +.byte 46 +.byte 46 +.byte 49 +.byte 32 +.byte 62 +.byte 61 +.byte 32 +.byte 49 +.byte 0 +.align 1 +.LC200: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 71 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 68 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 88 +.byte 47 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 88 +.byte 0 +.align 1 +.LC195: +.byte 68 +.byte 105 +.byte 118 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 71 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 68 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 32 +.byte 101 +.byte 120 +.byte 99 +.byte 101 +.byte 101 +.byte 100 +.byte 32 +.byte 49 +.byte 32 +.byte 117 +.byte 108 +.byte 112 +.byte 10 +.byte 111 +.byte 114 +.byte 32 +.byte 32 +.byte 49 +.byte 47 +.byte 51 +.byte 32 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 32 +.byte 51 +.byte 47 +.byte 57 +.byte 32 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 32 +.byte 57 +.byte 47 +.byte 50 +.byte 55 +.byte 32 +.byte 109 +.byte 97 +.byte 121 +.byte 32 +.byte 100 +.byte 105 +.byte 115 +.byte 97 +.byte 103 +.byte 114 +.byte 101 +.byte 101 +.byte 0 +.align 1 +.LC191: +.byte 42 +.byte 32 +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 109 +.byte 97 +.byte 110 +.byte 121 +.byte 32 +.byte 102 +.byte 105 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 119 +.byte 114 +.byte 111 +.byte 110 +.byte 103 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC189: +.byte 42 +.byte 32 +.byte 108 +.byte 97 +.byte 99 +.byte 107 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 71 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 68 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 44 +.byte 32 +.byte 115 +.byte 111 +.byte 32 +.byte 49 +.byte 42 +.byte 88 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 88 +.byte 0 +.align 1 +.LC186: +.byte 10 +.byte 67 +.byte 104 +.byte 101 +.byte 99 +.byte 107 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 103 +.byte 117 +.byte 97 +.byte 114 +.byte 100 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 32 +.byte 105 +.byte 110 +.byte 32 +.byte 42 +.byte 44 +.byte 32 +.byte 47 +.byte 44 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 45 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC185: +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 109 +.byte 97 +.byte 108 +.byte 105 +.byte 122 +.byte 101 +.byte 100 +.byte 44 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 105 +.byte 116 +.byte 32 +.byte 115 +.byte 104 +.byte 111 +.byte 117 +.byte 108 +.byte 100 +.byte 32 +.byte 98 +.byte 101 +.byte 46 +.byte 0 +.align 1 +.LC180: +.byte 83 +.byte 117 +.byte 98 +.byte 116 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 110 +.byte 111 +.byte 114 +.byte 109 +.byte 97 +.byte 108 +.byte 105 +.byte 122 +.byte 101 +.byte 100 +.byte 32 +.byte 88 +.byte 61 +.byte 89 +.byte 44 +.byte 88 +.byte 43 +.byte 90 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 89 +.byte 43 +.byte 90 +.byte 33 +.byte 0 +.align 1 +.LC176: +.byte 114 +.byte 111 +.byte 117 +.byte 103 +.byte 104 +.byte 108 +.byte 121 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 105 +.byte 102 +.byte 105 +.byte 99 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 101 +.byte 99 +.byte 105 +.byte 109 +.byte 97 +.byte 108 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC175: +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 101 +.byte 108 +.byte 121 +.byte 32 +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 32 +.byte 97 +.byte 98 +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 37 +.byte 103 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 32 +.byte 66 +.byte 45 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 44 +.byte 32 +.byte 105 +.byte 46 +.byte 101 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC174: +.byte 83 +.byte 111 +.byte 109 +.byte 101 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 32 +.byte 97 +.byte 112 +.byte 112 +.byte 101 +.byte 97 +.byte 114 +.byte 32 +.byte 116 +.byte 111 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 10 +.byte 0 +.align 1 +.LC168: +.byte 111 +.byte 102 +.byte 32 +.byte 97 +.byte 110 +.byte 10 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 45 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 1 +.LC167: +.byte 90 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 90 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 0 +.align 1 +.LC166: +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 101 +.byte 120 +.byte 97 +.byte 99 +.byte 116 +.byte 32 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 97 +.byte 108 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 97 +.byte 32 +.byte 114 +.byte 101 +.byte 115 +.byte 117 +.byte 108 +.byte 116 +.byte 10 +.byte 0 +.align 1 +.LC165: +.byte 66 +.byte 101 +.byte 99 +.byte 97 +.byte 117 +.byte 115 +.byte 101 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 117 +.byte 110 +.byte 117 +.byte 115 +.byte 117 +.byte 97 +.byte 108 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 102 +.byte 0 +.align 1 +.LC161: +.byte 9 +.byte 85 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 90 +.byte 50 +.byte 32 +.byte 45 +.byte 32 +.byte 85 +.byte 50 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC160: +.byte 9 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 90 +.byte 49 +.byte 32 +.byte 45 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC159: +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 0 +.align 1 +.LC158: +.byte 0 +.align 1 +.LC151: +.byte 84 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 102 +.byte 101 +.byte 97 +.byte 116 +.byte 117 +.byte 114 +.byte 101 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 102 +.byte 117 +.byte 114 +.byte 116 +.byte 104 +.byte 101 +.byte 114 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC146: +.byte 80 +.byte 111 +.byte 115 +.byte 115 +.byte 105 +.byte 98 +.byte 108 +.byte 121 +.byte 32 +.byte 115 +.byte 111 +.byte 109 +.byte 101 +.byte 32 +.byte 112 +.byte 97 +.byte 114 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 0 +.align 1 +.LC145: +.byte 98 +.byte 121 +.byte 32 +.byte 101 +.byte 120 +.byte 116 +.byte 114 +.byte 97 +.byte 45 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 101 +.byte 32 +.byte 101 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 101 +.byte 116 +.byte 105 +.byte 99 +.byte 32 +.byte 115 +.byte 117 +.byte 98 +.byte 101 +.byte 120 +.byte 112 +.byte 114 +.byte 101 +.byte 115 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 115 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC144: +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 115 +.byte 121 +.byte 109 +.byte 112 +.byte 116 +.byte 111 +.byte 109 +.byte 115 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 105 +.byte 110 +.byte 99 +.byte 111 +.byte 110 +.byte 115 +.byte 105 +.byte 115 +.byte 116 +.byte 101 +.byte 110 +.byte 99 +.byte 105 +.byte 101 +.byte 115 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 114 +.byte 111 +.byte 100 +.byte 117 +.byte 99 +.byte 101 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC143: +.byte 114 +.byte 101 +.byte 115 +.byte 112 +.byte 101 +.byte 99 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 108 +.byte 121 +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 32 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 44 +.byte 10 +.byte 0 +.align 1 +.LC142: +.byte 68 +.byte 105 +.byte 115 +.byte 97 +.byte 103 +.byte 114 +.byte 101 +.byte 101 +.byte 109 +.byte 101 +.byte 110 +.byte 116 +.byte 115 +.byte 32 +.byte 97 +.byte 109 +.byte 111 +.byte 110 +.byte 103 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 118 +.byte 97 +.byte 108 +.byte 117 +.byte 101 +.byte 115 +.byte 32 +.byte 88 +.byte 49 +.byte 44 +.byte 32 +.byte 89 +.byte 49 +.byte 44 +.byte 32 +.byte 90 +.byte 49 +.byte 44 +.byte 10 +.byte 0 +.align 1 +.LC120: +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 119 +.byte 111 +.byte 114 +.byte 115 +.byte 101 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 110 +.byte 32 +.byte 53 +.byte 32 +.byte 100 +.byte 101 +.byte 99 +.byte 105 +.byte 109 +.byte 97 +.byte 108 +.byte 32 +.byte 102 +.byte 105 +.byte 103 +.byte 117 +.byte 114 +.byte 101 +.byte 115 +.byte 32 +.byte 32 +.byte 0 +.align 1 +.LC118: +.byte 84 +.byte 104 +.byte 101 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 105 +.byte 102 +.byte 105 +.byte 99 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 116 +.byte 104 +.byte 101 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 37 +.byte 102 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC117: +.byte 108 +.byte 111 +.byte 103 +.byte 97 +.byte 114 +.byte 105 +.byte 116 +.byte 104 +.byte 109 +.byte 105 +.byte 99 +.byte 32 +.byte 101 +.byte 110 +.byte 99 +.byte 111 +.byte 100 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 104 +.byte 97 +.byte 115 +.byte 32 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 101 +.byte 114 +.byte 105 +.byte 122 +.byte 101 +.byte 100 +.byte 32 +.byte 115 +.byte 111 +.byte 108 +.byte 101 +.byte 108 +.byte 121 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 85 +.byte 49 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC114: +.byte 111 +.byte 102 +.byte 32 +.byte 115 +.byte 105 +.byte 103 +.byte 110 +.byte 105 +.byte 102 +.byte 105 +.byte 99 +.byte 97 +.byte 110 +.byte 116 +.byte 32 +.byte 100 +.byte 105 +.byte 103 +.byte 105 +.byte 116 +.byte 115 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 44 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 105 +.byte 116 +.byte 115 +.byte 101 +.byte 108 +.byte 102 +.byte 44 +.byte 32 +.byte 116 +.byte 104 +.byte 105 +.byte 115 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 97 +.byte 32 +.byte 109 +.byte 105 +.byte 110 +.byte 111 +.byte 114 +.byte 32 +.byte 102 +.byte 108 +.byte 97 +.byte 119 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC113: +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 99 +.byte 97 +.byte 110 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 98 +.byte 101 +.byte 32 +.byte 99 +.byte 104 +.byte 97 +.byte 114 +.byte 97 +.byte 99 +.byte 116 +.byte 101 +.byte 114 +.byte 105 +.byte 122 +.byte 101 +.byte 100 +.byte 32 +.byte 98 +.byte 121 +.byte 32 +.byte 97 +.byte 110 +.byte 32 +.byte 73 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 32 +.byte 110 +.byte 117 +.byte 109 +.byte 98 +.byte 101 +.byte 114 +.byte 10 +.byte 0 +.align 1 +.LC100: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 102 +.byte 117 +.byte 122 +.byte 122 +.byte 121 +.byte 44 +.byte 88 +.byte 61 +.byte 49 +.byte 32 +.byte 98 +.byte 117 +.byte 116 +.byte 32 +.byte 88 +.byte 45 +.byte 49 +.byte 47 +.byte 50 +.byte 45 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 1 +.LC96: +.byte 40 +.byte 49 +.byte 45 +.byte 85 +.byte 49 +.byte 41 +.byte 45 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 60 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 70 +.byte 65 +.byte 76 +.byte 83 +.byte 69 +.byte 44 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 103 +.byte 46 +.byte 32 +.byte 102 +.byte 97 +.byte 105 +.byte 108 +.byte 115 +.byte 63 +.byte 0 +.align 4 +.LC94: +.long 0 +.long 1076101120 +.align 1 +.LC89: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 103 +.byte 111 +.byte 111 +.byte 100 +.byte 32 +.byte 97 +.byte 115 +.byte 32 +.byte 50 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 49 +.byte 48 +.byte 0 +.align 1 +.LC85: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 116 +.byte 111 +.byte 111 +.byte 32 +.byte 98 +.byte 105 +.byte 103 +.byte 58 +.byte 32 +.byte 114 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 111 +.byte 102 +.byte 102 +.byte 32 +.byte 112 +.byte 114 +.byte 111 +.byte 98 +.byte 108 +.byte 101 +.byte 109 +.byte 115 +.byte 0 +.align 1 +.LC83: +.byte 77 +.byte 89 +.byte 83 +.byte 84 +.byte 69 +.byte 82 +.byte 89 +.byte 58 +.byte 32 +.byte 114 +.byte 101 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 101 +.byte 100 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC82: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 105 +.byte 114 +.byte 109 +.byte 101 +.byte 100 +.byte 46 +.byte 10 +.byte 0 +.align 4 +.LC79: +.long 1202590843 +.long 1065646817 +.align 1 +.LC78: +.byte 103 +.byte 101 +.byte 116 +.byte 115 +.byte 32 +.byte 98 +.byte 101 +.byte 116 +.byte 116 +.byte 101 +.byte 114 +.byte 32 +.byte 99 +.byte 108 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 101 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 115 +.byte 101 +.byte 112 +.byte 97 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC77: +.byte 99 +.byte 111 +.byte 110 +.byte 102 +.byte 105 +.byte 114 +.byte 109 +.byte 115 +.byte 32 +.byte 99 +.byte 108 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 101 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 115 +.byte 101 +.byte 112 +.byte 97 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC62: +.byte 82 +.byte 101 +.byte 99 +.byte 97 +.byte 108 +.byte 99 +.byte 117 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 114 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 112 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 10 +.byte 32 +.byte 0 +.align 1 +.LC61: +.byte 67 +.byte 108 +.byte 111 +.byte 115 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 114 +.byte 101 +.byte 108 +.byte 97 +.byte 116 +.byte 105 +.byte 118 +.byte 101 +.byte 32 +.byte 115 +.byte 101 +.byte 112 +.byte 97 +.byte 114 +.byte 97 +.byte 116 +.byte 105 +.byte 111 +.byte 110 +.byte 32 +.byte 102 +.byte 111 +.byte 117 +.byte 110 +.byte 100 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 85 +.byte 49 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 46 +.byte 55 +.byte 101 +.byte 32 +.byte 46 +.byte 10 +.byte 10 +.byte 0 +.align 1 +.LC55: +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 102 +.byte 32 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC46: +.byte 83 +.byte 101 +.byte 97 +.byte 114 +.byte 99 +.byte 104 +.byte 105 +.byte 110 +.byte 103 +.byte 32 +.byte 102 +.byte 111 +.byte 114 +.byte 32 +.byte 82 +.byte 97 +.byte 100 +.byte 105 +.byte 120 +.byte 32 +.byte 97 +.byte 110 +.byte 100 +.byte 32 +.byte 80 +.byte 114 +.byte 101 +.byte 99 +.byte 105 +.byte 115 +.byte 105 +.byte 111 +.byte 110 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC45: +.byte 10 +.byte 0 +.align 1 +.LC44: +.byte 45 +.byte 49 +.byte 44 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 44 +.byte 32 +.byte 49 +.byte 44 +.byte 32 +.byte 50 +.byte 44 +.byte 32 +.byte 51 +.byte 44 +.byte 32 +.byte 52 +.byte 44 +.byte 32 +.byte 53 +.byte 44 +.byte 32 +.byte 57 +.byte 44 +.byte 32 +.byte 50 +.byte 55 +.byte 44 +.byte 32 +.byte 51 +.byte 50 +.byte 32 +.byte 38 +.byte 32 +.byte 50 +.byte 52 +.byte 48 +.byte 32 +.byte 97 +.byte 114 +.byte 101 +.byte 32 +.byte 79 +.byte 46 +.byte 75 +.byte 46 +.byte 10 +.byte 0 +.align 1 +.LC39: +.byte 53 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 52 +.byte 43 +.byte 49 +.byte 44 +.byte 32 +.byte 50 +.byte 52 +.byte 48 +.byte 47 +.byte 51 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 56 +.byte 48 +.byte 44 +.byte 32 +.byte 50 +.byte 52 +.byte 48 +.byte 47 +.byte 52 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 54 +.byte 48 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 50 +.byte 52 +.byte 48 +.byte 47 +.byte 53 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 52 +.byte 56 +.byte 0 +.align 1 +.LC35: +.byte 57 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 51 +.byte 42 +.byte 51 +.byte 44 +.byte 32 +.byte 50 +.byte 55 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 57 +.byte 42 +.byte 51 +.byte 44 +.byte 32 +.byte 51 +.byte 50 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 56 +.byte 42 +.byte 52 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 51 +.byte 50 +.byte 45 +.byte 50 +.byte 55 +.byte 45 +.byte 52 +.byte 45 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 1 +.LC31: +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 43 +.byte 32 +.byte 40 +.byte 45 +.byte 49 +.byte 41 +.byte 32 +.byte 43 +.byte 32 +.byte 49 +.byte 47 +.byte 50 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 1 +.LC27: +.byte 45 +.byte 49 +.byte 43 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 40 +.byte 45 +.byte 49 +.byte 41 +.byte 43 +.byte 97 +.byte 98 +.byte 115 +.byte 40 +.byte 49 +.byte 41 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 45 +.byte 49 +.byte 43 +.byte 40 +.byte 45 +.byte 49 +.byte 41 +.byte 42 +.byte 40 +.byte 45 +.byte 49 +.byte 41 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 1 +.LC23: +.byte 51 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 50 +.byte 43 +.byte 49 +.byte 44 +.byte 32 +.byte 52 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 51 +.byte 43 +.byte 49 +.byte 44 +.byte 32 +.byte 52 +.byte 43 +.byte 50 +.byte 42 +.byte 40 +.byte 45 +.byte 50 +.byte 41 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 52 +.byte 45 +.byte 51 +.byte 45 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 0 +.align 4 +.LC21: +.long -755914244 +.long 1062232653 +.align 1 +.LC20: +.byte 67 +.byte 111 +.byte 109 +.byte 112 +.byte 97 +.byte 114 +.byte 105 +.byte 115 +.byte 111 +.byte 110 +.byte 32 +.byte 97 +.byte 108 +.byte 108 +.byte 101 +.byte 103 +.byte 101 +.byte 115 +.byte 32 +.byte 116 +.byte 104 +.byte 97 +.byte 116 +.byte 32 +.byte 45 +.byte 48 +.byte 46 +.byte 48 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 78 +.byte 111 +.byte 110 +.byte 45 +.byte 122 +.byte 101 +.byte 114 +.byte 111 +.byte 33 +.byte 10 +.byte 0 +.align 1 +.LC15: +.byte 48 +.byte 43 +.byte 48 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 49 +.byte 45 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 49 +.byte 32 +.byte 60 +.byte 61 +.byte 32 +.byte 48 +.byte 44 +.byte 32 +.byte 111 +.byte 114 +.byte 32 +.byte 49 +.byte 43 +.byte 49 +.byte 32 +.byte 33 +.byte 61 +.byte 32 +.byte 50 +.byte 0 +.align 1 +.LC13: +.byte 80 +.byte 114 +.byte 111 +.byte 103 +.byte 114 +.byte 97 +.byte 109 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 110 +.byte 111 +.byte 119 +.byte 32 +.byte 82 +.byte 85 +.byte 78 +.byte 78 +.byte 73 +.byte 78 +.byte 71 +.byte 32 +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 115 +.byte 32 +.byte 111 +.byte 110 +.byte 32 +.byte 115 +.byte 109 +.byte 97 +.byte 108 +.byte 108 +.byte 32 +.byte 105 +.byte 110 +.byte 116 +.byte 101 +.byte 103 +.byte 101 +.byte 114 +.byte 115 +.byte 58 +.byte 10 +.byte 0 +.align 4 +.LC9: +.long 0 +.long 1072693248 +.align 4 +.LC8: +.long 0 +.long 0 +.align 1 +.LC2: +.byte 10 +.byte 42 +.byte 32 +.byte 42 +.byte 32 +.byte 42 +.byte 32 +.byte 70 +.byte 76 +.byte 79 +.byte 65 +.byte 84 +.byte 73 +.byte 78 +.byte 71 +.byte 45 +.byte 80 +.byte 79 +.byte 73 +.byte 78 +.byte 84 +.byte 32 +.byte 69 +.byte 82 +.byte 82 +.byte 79 +.byte 82 +.byte 32 +.byte 42 +.byte 32 +.byte 42 +.byte 32 +.byte 42 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/sort.1bk b/src/cmd/lccom-1/tst/x86-linux/sort.1bk new file mode 100644 index 0000000..75e1f0d --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/sort.1bk @@ -0,0 +1,20 @@ +exchange(1,9) +exchange(3,7) +exchange(5,6) +exchange(0,5) +exchange(0,3) +exchange(0,0) +exchange(1,2) +exchange(6,6) +exchange(8,9) +exchange(7,8) +-51 +-1 +0 +1 +3 +10 +18 +32 +567 +789 diff --git a/src/cmd/lccom-1/tst/x86-linux/sort.2bk b/src/cmd/lccom-1/tst/x86-linux/sort.2bk new file mode 100644 index 0000000..81e6f38 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/sort.2bk @@ -0,0 +1,5 @@ +tst/sort.c:23: warning: missing return value +tst/sort.c:30: warning: missing return value +tst/sort.c:37: warning: missing return value +tst/sort.c:41: warning: missing return value +tst/sort.c:65: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/sort.sbk b/src/cmd/lccom-1/tst/x86-linux/sort.sbk new file mode 100644 index 0000000..b4cfbb6 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/sort.sbk @@ -0,0 +1,331 @@ +.data +.globl in +.align 4 +.type in,@object +in: +.long 10 +.long 32 +.long -1 +.long 567 +.long 3 +.long 18 +.long 1 +.long -51 +.long 789 +.long 0 +.size in,40 +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +pushl $10 +pushl $in +call sort +addl $8,%esp +movl $0,-4(%ebp) +jmp .LC5 +.LC2: +movl -4(%ebp),%edi +pushl in(,%edi,4) +call putd +addl $4,%esp +pushl $10 +call putchar +addl $4,%esp +.LC3: +incl -4(%ebp) +.LC5: +movl -4(%ebp),%edi +cmpl $10,%edi +jb .LC2 +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf6: +.size main,.Lf6-main +.globl putd +.align 16 +.type putd,@function +putd: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +cmpl $0,20(%ebp) +jge .LC8 +pushl $45 +call putchar +addl $4,%esp +negl 20(%ebp) +.LC8: +movl 20(%ebp),%eax +mov $10,%ecx +cdq +idivl %ecx +cmpl $0,%eax +je .LC10 +movl 20(%ebp),%eax +mov $10,%ecx +cdq +idivl %ecx +pushl %eax +call putd +addl $4,%esp +.LC10: +movl 20(%ebp),%eax +mov $10,%ecx +cdq +idivl %ecx +leal 48(%edx),%edi +pushl %edi +call putchar +addl $4,%esp +mov $0,%eax +.LC7: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf12: +.size putd,.Lf12-putd +.globl sort +.align 16 +.type sort,@function +sort: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 24(%ebp),%edi +subl $1,%edi +movl %edi,24(%ebp) +pushl %edi +pushl $0 +movl 20(%ebp),%edi +movl %edi,xx +pushl %edi +call quick +addl $12,%esp +mov $0,%eax +.LC13: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf14: +.size sort,.Lf14-sort +.globl quick +.align 16 +.type quick,@function +quick: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl 28(%ebp),%edi +cmpl %edi,24(%ebp) +jl .LC16 +mov $0,%eax +jmp .LC15 +.LC16: +pushl 28(%ebp) +pushl 24(%ebp) +pushl 20(%ebp) +call partition +addl $12,%esp +movl %eax,-4(%ebp) +movl -4(%ebp),%edi +subl $1,%edi +pushl %edi +pushl 24(%ebp) +pushl 20(%ebp) +call quick +addl $12,%esp +pushl 28(%ebp) +movl -4(%ebp),%edi +leal 1(%edi),%edi +pushl %edi +pushl 20(%ebp) +call quick +addl $12,%esp +mov $0,%eax +.LC15: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf18: +.size quick,.Lf18-quick +.globl partition +.align 16 +.type partition,@function +partition: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +incl 28(%ebp) +movl 24(%ebp),%edi +movl %edi,-8(%ebp) +movl -8(%ebp),%edi +movl 20(%ebp),%esi +movl (%esi,%edi,4),%edi +movl %edi,-4(%ebp) +jmp .LC21 +.LC20: +incl 24(%ebp) +jmp .LC24 +.LC23: +incl 24(%ebp) +.LC24: +movl 24(%ebp),%edi +movl 20(%ebp),%esi +movl -4(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +jl .LC23 +decl 28(%ebp) +jmp .LC27 +.LC26: +decl 28(%ebp) +.LC27: +movl 28(%ebp),%edi +movl 20(%ebp),%esi +movl -4(%ebp),%ebx +cmpl %ebx,(%esi,%edi,4) +jg .LC26 +movl 28(%ebp),%edi +cmpl %edi,24(%ebp) +jge .LC29 +movl 20(%ebp),%edi +movl 28(%ebp),%esi +leal (%edi,%esi,4),%esi +pushl %esi +movl 24(%ebp),%esi +leal (%edi,%esi,4),%edi +pushl %edi +call exchange +addl $8,%esp +.LC29: +.LC21: +movl 28(%ebp),%edi +cmpl %edi,24(%ebp) +jl .LC20 +movl 20(%ebp),%edi +movl 28(%ebp),%esi +leal (%edi,%esi,4),%esi +pushl %esi +movl -8(%ebp),%esi +leal (%edi,%esi,4),%edi +pushl %edi +call exchange +addl $8,%esp +movl 28(%ebp),%eax +.LC19: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf31: +.size partition,.Lf31-partition +.globl exchange +.align 16 +.type exchange,@function +exchange: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl xx,%edi +mov $4,%esi +movl 24(%ebp),%ebx +subl %edi,%ebx +movl %ebx,%eax +movl %esi,%ecx +cdq +idivl %ecx +pushl %eax +movl 20(%ebp),%ebx +subl %edi,%ebx +movl %ebx,%eax +movl %esi,%ecx +cdq +idivl %ecx +pushl %eax +pushl $.LC33 +call printf +addl $12,%esp +movl 20(%ebp),%edi +movl (,%edi),%esi +movl %esi,-4(%ebp) +movl 24(%ebp),%esi +movl (,%esi),%esi +movl %esi,(,%edi) +movl 24(%ebp),%edi +movl -4(%ebp),%esi +movl %esi,(,%edi) +mov $0,%eax +.LC32: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf34: +.size exchange,.Lf34-exchange +.bss +.globl xx +.align 4 +.type xx,@object +.size xx,4 +.comm xx,4 +.data +.align 1 +.LC33: +.byte 101 +.byte 120 +.byte 99 +.byte 104 +.byte 97 +.byte 110 +.byte 103 +.byte 101 +.byte 40 +.byte 37 +.byte 100 +.byte 44 +.byte 37 +.byte 100 +.byte 41 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/spill.1bk b/src/cmd/lccom-1/tst/x86-linux/spill.1bk new file mode 100644 index 0000000..e69de29 diff --git a/src/cmd/lccom-1/tst/x86-linux/spill.2bk b/src/cmd/lccom-1/tst/x86-linux/spill.2bk new file mode 100644 index 0000000..afd73e2 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/spill.2bk @@ -0,0 +1,6 @@ +tst/spill.c:1: warning: missing return value +tst/spill.c:3: warning: missing return value +tst/spill.c:5: warning: missing return value +tst/spill.c:7: warning: missing return value +tst/spill.c:9: warning: missing return value +tst/spill.c:17: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/spill.sbk b/src/cmd/lccom-1/tst/x86-linux/spill.sbk new file mode 100644 index 0000000..c66c3db --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/spill.sbk @@ -0,0 +1,286 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf2: +.size main,.Lf2-main +.globl f +.align 16 +.type f,@function +f: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +call f +movl %eax,%edi +call f +leal (%eax,%edi),%edi +movl %edi,20(%ebp) +mov $0,%eax +.LC3: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf4: +.size f,.Lf4-f +.globl f2 +.align 16 +.type f2,@function +f2: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +call f +movl %eax,%edi +cmpl $0,20(%ebp) +je .LC7 +call f +movl %eax,%esi +movl %esi,-4(%ebp) +jmp .LC8 +.LC7: +movl $1,-4(%ebp) +.LC8: +movl -4(%ebp),%esi +leal (%esi,%edi),%edi +movl %edi,20(%ebp) +mov $0,%eax +.LC5: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf9: +.size f2,.Lf9-f2 +.globl f3 +.align 16 +.type f3,@function +f3: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $44,%esp +movl $0,-4(%ebp) +movl $0,-8(%ebp) +movl $0,-12(%ebp) +movl $0,-16(%ebp) +movl $0,-20(%ebp) +movl $0,-24(%ebp) +movl $0,-28(%ebp) +movl $0,-32(%ebp) +movl $0,-36(%ebp) +movl $0,-40(%ebp) +movl 24(%ebp),%edi +leal 4(%edi),%esi +movl %esi,24(%ebp) +cmpl $0,20(%ebp) +je .LC12 +call f +movl %eax,%esi +movl %esi,-44(%ebp) +jmp .LC13 +.LC12: +movl $0,-44(%ebp) +.LC13: +movl -44(%ebp),%esi +movl %esi,(,%edi) +mov $0,%eax +.LC10: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf14: +.size f3,.Lf14-f3 +.globl f4 +.align 16 +.type f4,@function +f4: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $52,%esp +movl $0,-4(%ebp) +movl $0,-8(%ebp) +movl $0,-12(%ebp) +movl $0,-16(%ebp) +movl $0,-20(%ebp) +movl $0,-24(%ebp) +movl i,%edi +leal (,%edi,8),%esi +fldl a(%esi) +fstpl -36(%ebp) +fldl b(%esi) +fstpl -44(%ebp) +fldl -36(%ebp) +faddl -44(%ebp) +fldl .LC19 +fcompp +fstsw %ax +sahf +jp 1f +je .LC17 +1: +cmpl $0,%edi +je .LC17 +fldl -36(%ebp) +fsubl -44(%ebp) +fldl .LC19 +fcompp +fstsw %ax +sahf +jp 1f +je .LC17 +1: +movl $1,-28(%ebp) +jmp .LC18 +.LC17: +movl $0,-28(%ebp) +.LC18: +movl -28(%ebp),%edi +movl %edi,i +mov $0,%eax +.LC15: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf20: +.size f4,.Lf20-f4 +.globl f5 +.align 16 +.type f5,@function +f5: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl k,%edi +movl m,%esi +movl A,%ebx +movl %edi,%edx +imull %esi,%edx +leal (%ebx,%edx,8),%edx +movl j,%ecx +movl %ecx,%eax +imull %esi,%eax +leal (%ebx,%eax,8),%esi +movl n,%ebx +movl B,%eax +imull %ebx,%edi +leal (%eax,%edi,8),%edi +imull %ebx,%ecx +leal (%eax,%ecx,8),%ebx +fldl (,%edx) +fmull (,%esi) +fldl (,%edi) +fmull (,%ebx) +faddp %st,%st(1) +fstpl x +fldl (,%edx) +fmull (,%ebx) +fldl (,%edi) +fmull (,%esi) +fsubrp %st,%st(1) +fstpl x +mov $0,%eax +.LC21: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf22: +.size f5,.Lf22-f5 +.bss +.globl x +.align 4 +.type x,@object +.size x,8 +.comm x,8 +.globl B +.align 4 +.type B,@object +.size B,4 +.comm B,4 +.globl A +.align 4 +.type A,@object +.size A,4 +.comm A,4 +.globl n +.align 4 +.type n,@object +.size n,4 +.comm n,4 +.globl m +.align 4 +.type m,@object +.size m,4 +.comm m,4 +.globl k +.align 4 +.type k,@object +.size k,4 +.comm k,4 +.globl j +.align 4 +.type j,@object +.size j,4 +.comm j,4 +.globl i +.align 4 +.type i,@object +.size i,4 +.comm i,4 +.globl b +.align 4 +.type b,@object +.size b,80 +.comm b,80 +.globl a +.align 4 +.type a,@object +.size a,80 +.comm a,80 +.data +.align 4 +.LC19: +.long 0 +.long 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/stdarg.1bk b/src/cmd/lccom-1/tst/x86-linux/stdarg.1bk new file mode 100644 index 0000000..e973176 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/stdarg.1bk @@ -0,0 +1,6 @@ +test 1 +test 2 +test 3 +test 4 +test 5.000000 +{1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} diff --git a/src/cmd/lccom-1/tst/x86-linux/stdarg.2bk b/src/cmd/lccom-1/tst/x86-linux/stdarg.2bk new file mode 100644 index 0000000..2b3f417 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/stdarg.2bk @@ -0,0 +1 @@ +tst/stdarg.c:51: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/stdarg.h b/src/cmd/lccom-1/tst/x86-linux/stdarg.h new file mode 100644 index 0000000..5107bcd --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/stdarg.h @@ -0,0 +1,26 @@ +#ifndef __STDARG +#define __STDARG + +#if !defined(_VA_LIST) && !defined(__VA_LIST_DEFINED) +#define _VA_LIST +#define _VA_LIST_DEFINED +typedef char *__va_list; +#endif +static float __va_arg_tmp; +typedef __va_list va_list; + +#define va_start(list, start) ((void)((list) = (sizeof(start)<4 ? \ + (char *)((int *)&(start)+1) : (char *)(&(start)+1)))) +#define __va_arg(list, mode, n) (\ + __typecode(mode)==1 && sizeof(mode)==4 ? \ + (__va_arg_tmp = *(double *)(&(list += ((sizeof(double)+n)&~n))[-(int)((sizeof(double)+n)&~n)]), \ + *(mode *)&__va_arg_tmp) : \ + *(mode *)(&(list += ((sizeof(mode)+n)&~n))[-(int)((sizeof(mode)+n)&~n)])) +#define _bigendian_va_arg(list, mode, n) (\ + sizeof(mode)==1 ? *(mode *)(&(list += 4)[-1]) : \ + sizeof(mode)==2 ? *(mode *)(&(list += 4)[-2]) : __va_arg(list, mode, n)) +#define _littleendian_va_arg(list, mode, n) __va_arg(list, mode, n) +#define va_end(list) ((void)0) +#define va_arg(list, mode) _littleendian_va_arg(list, mode, 3U) +typedef void *__gnuc_va_list; +#endif diff --git a/src/cmd/lccom-1/tst/x86-linux/stdarg.sbk b/src/cmd/lccom-1/tst/x86-linux/stdarg.sbk new file mode 100644 index 0000000..8210428 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/stdarg.sbk @@ -0,0 +1,400 @@ +.data +.globl x +.align 4 +.type x,@object +.size x,16 +x: +.long 1 +.long 2 +.long 3 +.long 4 +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +pushl $.LC2 +call print +addl $4,%esp +pushl $.LC4 +pushl $.LC3 +call print +addl $8,%esp +pushl $10 +pushl $3 +pushl $.LC5 +call print +addl $12,%esp +pushl $10 +pushl $4 +pushl $.LC8 +pushl $.LC7 +pushl $.LC6 +call print +addl $20,%esp +pushl $10 +fldl .LC10 +subl $8,%esp +fstpl (%esp) +pushl $.LC8 +pushl $.LC7 +pushl $.LC9 +call print +addl $24,%esp +leal x,%edi +movl %edi,-8(%ebp) +movl %edi,%esi +movl %esi,-4(%ebp) +subl $16,%esp +movl %esp,%edi +movl $16,%ecx +rep +movsb +movl -8(%ebp),%edi +movl %edi,%esi +subl $16,%esp +movl %esp,%edi +movl $16,%ecx +rep +movsb +movl -8(%ebp),%edi +movl %edi,%esi +subl $16,%esp +movl %esp,%edi +movl $16,%ecx +rep +movsb +movl -8(%ebp),%edi +movl %edi,%esi +subl $16,%esp +movl %esp,%edi +movl $16,%ecx +rep +movsb +movl -8(%ebp),%edi +movl %edi,%esi +subl $16,%esp +movl %esp,%edi +movl $16,%ecx +rep +movsb +movl -8(%ebp),%edi +movl %edi,%esi +subl $16,%esp +movl %esp,%edi +movl $16,%ecx +rep +movsb +pushl $.LC11 +call print +addl $100,%esp +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf12: +.size main,.Lf12-main +.globl print +.align 16 +.type print,@function +print: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $28,%esp +leal 24(%ebp),%edi +movl %edi,-4(%ebp) +jmp .LC19 +.LC16: +movl 20(%ebp),%edi +movsbl (,%edi),%edi +cmpl $37,%edi +jne .LC20 +movl 20(%ebp),%edi +leal 1(%edi),%edi +movl %edi,20(%ebp) +movsbl (,%edi),%edi +movl %edi,-8(%ebp) +movl -8(%ebp),%edi +cmpl $115,%edi +je .LC36 +cmpl $115,%edi +jg .LC41 +.LC40: +movl -8(%ebp),%edi +cmpl $98,%edi +jl .LC22 +cmpl $102,%edi +jg .LC22 +jmp *.LC42-392(,%edi,4) +.data +.align 4 +.LC42: +.long .LC25 +.long .LC30 +.long .LC32 +.long .LC22 +.long .LC38 +.text +.LC41: +cmpl $119,-8(%ebp) +je .LC34 +jmp .LC22 +.LC25: +movl -4(%ebp),%edi +leal 16(%edi),%edi +movl %edi,-28(%ebp) +movl %edi,-4(%ebp) +leal -24(%ebp),%edi +movl -28(%ebp),%esi +leal -16(%esi),%esi +movl $16,%ecx +rep +movsb +pushl -12(%ebp) +pushl -16(%ebp) +pushl -20(%ebp) +pushl -24(%ebp) +pushl $.LC26 +call printf +addl $20,%esp +jmp .LC21 +.LC30: +movl -4(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-4(%ebp) +movsbl -4(%edi),%edi +pushl %edi +pushl $.LC31 +call printf +addl $8,%esp +jmp .LC21 +.LC32: +movl -4(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-4(%ebp) +pushl -4(%edi) +pushl $.LC33 +call printf +addl $8,%esp +jmp .LC21 +.LC34: +movl -4(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-4(%ebp) +movswl -4(%edi),%edi +pushl %edi +pushl $.LC35 +call printf +addl $8,%esp +jmp .LC21 +.LC36: +movl -4(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-4(%ebp) +pushl -4(%edi) +pushl $.LC37 +call printf +addl $8,%esp +jmp .LC21 +.LC38: +movl -4(%ebp),%edi +leal 8(%edi),%edi +movl %edi,-4(%ebp) +fldl -8(%edi) +subl $8,%esp +fstpl (%esp) +pushl $.LC39 +call printf +addl $12,%esp +jmp .LC21 +.LC22: +movl 20(%ebp),%edi +movsbl (,%edi),%edi +pushl %edi +pushl $.LC31 +call printf +addl $8,%esp +jmp .LC21 +.LC20: +movl 20(%ebp),%edi +movsbl (,%edi),%edi +pushl %edi +pushl $.LC31 +call printf +addl $8,%esp +.LC21: +.LC17: +incl 20(%ebp) +.LC19: +movl 20(%ebp),%edi +movsbl (,%edi),%edi +cmpl $0,%edi +jne .LC16 +mov $0,%eax +.LC13: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf44: +.size print,.Lf44-print +.bss +.align 4 +.type __va_arg_tmp,@object +.size __va_arg_tmp,4 +.lcomm __va_arg_tmp,4 +.data +.align 1 +.LC39: +.byte 37 +.byte 102 +.byte 0 +.align 1 +.LC37: +.byte 37 +.byte 115 +.byte 0 +.align 1 +.LC35: +.byte 37 +.byte 120 +.byte 0 +.align 1 +.LC33: +.byte 37 +.byte 100 +.byte 0 +.align 1 +.LC31: +.byte 37 +.byte 99 +.byte 0 +.align 1 +.LC26: +.byte 123 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 125 +.byte 0 +.align 1 +.LC11: +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 32 +.byte 37 +.byte 98 +.byte 10 +.byte 0 +.align 4 +.LC10: +.long 0 +.long 1075052544 +.align 1 +.LC9: +.byte 37 +.byte 115 +.byte 37 +.byte 115 +.byte 32 +.byte 37 +.byte 102 +.byte 37 +.byte 99 +.byte 0 +.align 1 +.LC8: +.byte 115 +.byte 116 +.byte 0 +.align 1 +.LC7: +.byte 116 +.byte 101 +.byte 0 +.align 1 +.LC6: +.byte 37 +.byte 115 +.byte 37 +.byte 115 +.byte 32 +.byte 37 +.byte 119 +.byte 37 +.byte 99 +.byte 0 +.align 1 +.LC5: +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 37 +.byte 100 +.byte 37 +.byte 99 +.byte 0 +.align 1 +.LC4: +.byte 50 +.byte 0 +.align 1 +.LC3: +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC2: +.byte 116 +.byte 101 +.byte 115 +.byte 116 +.byte 32 +.byte 49 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/struct.1bk b/src/cmd/lccom-1/tst/x86-linux/struct.1bk new file mode 100644 index 0000000..807f3da --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/struct.1bk @@ -0,0 +1,5 @@ +(-1,-1) is not within [10,10; 310,310] +(1,1) is not within [10,10; 310,310] +(20,300) is within [10,10; 310,310] +(500,400) is not within [10,10; 310,310] +ab diff --git a/src/cmd/lccom-1/tst/x86-linux/struct.2bk b/src/cmd/lccom-1/tst/x86-linux/struct.2bk new file mode 100644 index 0000000..cb0fbd0 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/struct.2bk @@ -0,0 +1,2 @@ +tst/struct.c:49: warning: missing return value +tst/struct.c:68: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/struct.sbk b/src/cmd/lccom-1/tst/x86-linux/struct.sbk new file mode 100644 index 0000000..ebfb5b4 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/struct.sbk @@ -0,0 +1,476 @@ +.globl addpoint +.text +.align 16 +.type addpoint,@function +addpoint: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 32(%ebp),%edi +addl %edi,24(%ebp) +movl 36(%ebp),%edi +addl %edi,28(%ebp) +movl 20(%ebp),%edi +leal 24(%ebp),%esi +movl $8,%ecx +rep +movsb +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf5: +.size addpoint,.Lf5-addpoint +.globl canonrect +.align 16 +.type canonrect,@function +canonrect: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $32,%esp +movl 32(%ebp),%edi +cmpl %edi,24(%ebp) +jge .LC11 +movl 24(%ebp),%edi +movl %edi,-20(%ebp) +jmp .LC12 +.LC11: +movl 32(%ebp),%edi +movl %edi,-20(%ebp) +.LC12: +movl -20(%ebp),%edi +movl %edi,-16(%ebp) +movl 36(%ebp),%edi +cmpl %edi,28(%ebp) +jge .LC21 +movl 28(%ebp),%edi +movl %edi,-24(%ebp) +jmp .LC22 +.LC21: +movl 36(%ebp),%edi +movl %edi,-24(%ebp) +.LC22: +movl -24(%ebp),%edi +movl %edi,-12(%ebp) +movl 32(%ebp),%edi +cmpl %edi,24(%ebp) +jle .LC27 +movl 24(%ebp),%edi +movl %edi,-28(%ebp) +jmp .LC28 +.LC27: +movl 32(%ebp),%edi +movl %edi,-28(%ebp) +.LC28: +movl -28(%ebp),%edi +movl %edi,-8(%ebp) +movl 36(%ebp),%edi +cmpl %edi,28(%ebp) +jle .LC38 +movl 28(%ebp),%edi +movl %edi,-32(%ebp) +jmp .LC39 +.LC38: +movl 36(%ebp),%edi +movl %edi,-32(%ebp) +.LC39: +movl -32(%ebp),%edi +movl %edi,-4(%ebp) +movl 20(%ebp),%edi +leal -16(%ebp),%esi +movl $16,%ecx +rep +movsb +.LC6: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf40: +.size canonrect,.Lf40-canonrect +.globl makepoint +.align 16 +.type makepoint,@function +makepoint: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl 24(%ebp),%edi +movl %edi,-8(%ebp) +movl 28(%ebp),%edi +movl %edi,-4(%ebp) +movl 20(%ebp),%edi +leal -8(%ebp),%esi +movl $8,%ecx +rep +movsb +.LC41: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf44: +.size makepoint,.Lf44-makepoint +.globl makerect +.align 16 +.type makerect,@function +makerect: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $16,%esp +leal -16(%ebp),%edi +leal 24(%ebp),%esi +movl $8,%ecx +rep +movsb +leal -8(%ebp),%edi +leal 32(%ebp),%esi +movl $8,%ecx +rep +movsb +leal -16(%ebp),%esi +subl $16,%esp +movl %esp,%edi +movl $16,%ecx +rep +movsb +pushl 20(%ebp) +call canonrect +addl $20,%esp +.LC45: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf48: +.size makerect,.Lf48-makerect +.globl ptinrect +.align 16 +.type ptinrect,@function +ptinrect: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl 20(%ebp),%edi +cmpl 28(%ebp),%edi +jl .LC57 +cmpl 36(%ebp),%edi +jge .LC57 +movl 32(%ebp),%edi +cmpl %edi,24(%ebp) +jl .LC57 +movl 40(%ebp),%edi +cmpl %edi,24(%ebp) +jge .LC57 +movl $1,-4(%ebp) +jmp .LC58 +.LC57: +movl $0,-4(%ebp) +.LC58: +movl -4(%ebp),%eax +.LC49: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf59: +.size ptinrect,.Lf59-ptinrect +.data +.globl y +.align 1 +.type y,@object +.size y,3 +y: +.byte 97 +.byte 98 +.byte 0 +.globl odd +.text +.align 16 +.type odd,@function +odd: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +leal -4(%ebp),%edi +leal 20(%ebp),%esi +movl $3,%ecx +rep +movsb +leal -4(%ebp),%edi +pushl %edi +pushl $.LC61 +call printf +addl $8,%esp +mov $0,%eax +.LC60: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf62: +.size odd,.Lf62-odd +.data +.align 4 +.LC64: +.long 0 +.long 0 +.align 4 +.LC65: +.long 320 +.long 320 +.align 4 +.LC66: +.long -1 +.long -1 +.long 1 +.long 1 +.long 20 +.long 300 +.long 500 +.long 400 +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $108,%esp +leal -68(%ebp),%edi +leal .LC64,%esi +movl $8,%ecx +rep +movsb +leal -76(%ebp),%edi +leal .LC65,%esi +movl $8,%ecx +rep +movsb +leal -36(%ebp),%edi +leal .LC66,%esi +movl $32,%ecx +rep +movsb +pushl $-10 +pushl $-10 +leal -84(%ebp),%edi +pushl %edi +call makepoint +addl $12,%esp +leal -84(%ebp),%esi +subl $8,%esp +movl %esp,%edi +movl $8,%ecx +rep +movsb +leal -76(%ebp),%esi +subl $8,%esp +movl %esp,%edi +movl $8,%ecx +rep +movsb +leal -92(%ebp),%edi +pushl %edi +call addpoint +addl $20,%esp +pushl $10 +pushl $10 +leal -100(%ebp),%edi +pushl %edi +call makepoint +addl $12,%esp +leal -100(%ebp),%esi +subl $8,%esp +movl %esp,%edi +movl $8,%ecx +rep +movsb +leal -68(%ebp),%esi +subl $8,%esp +movl %esp,%edi +movl $8,%ecx +rep +movsb +leal -108(%ebp),%edi +pushl %edi +call addpoint +addl $20,%esp +leal -108(%ebp),%esi +subl $8,%esp +movl %esp,%edi +movl $8,%ecx +rep +movsb +leal -92(%ebp),%esi +subl $8,%esp +movl %esp,%edi +movl $8,%ecx +rep +movsb +leal -52(%ebp),%edi +pushl %edi +call makerect +addl $20,%esp +movl $0,-4(%ebp) +jmp .LC70 +.LC67: +movl -4(%ebp),%edi +leal (,%edi,8),%edi +leal -32(%ebp),%esi +pushl (%esi,%edi) +leal -36(%ebp),%esi +pushl (%esi,%edi) +leal -60(%ebp),%edi +pushl %edi +call makepoint +addl $12,%esp +pushl -56(%ebp) +movl -4(%ebp),%edi +leal -36(%ebp),%esi +pushl (%esi,%edi,8) +pushl $.LC71 +call printf +addl $12,%esp +leal -52(%ebp),%esi +subl $16,%esp +movl %esp,%edi +movl $16,%ecx +rep +movsb +leal -60(%ebp),%esi +subl $8,%esp +movl %esp,%edi +movl $8,%ecx +rep +movsb +call ptinrect +addl $24,%esp +cmpl $0,%eax +jne .LC74 +pushl $.LC76 +call printf +addl $4,%esp +.LC74: +pushl -40(%ebp) +pushl -44(%ebp) +pushl -48(%ebp) +pushl -52(%ebp) +pushl $.LC77 +call printf +addl $20,%esp +.LC68: +incl -4(%ebp) +.LC70: +movl -4(%ebp),%edi +cmpl $4,%edi +jb .LC67 +leal y,%esi +subl $4,%esp +movl %esp,%edi +movl $3,%ecx +rep +movsb +call odd +addl $3,%esp +pushl $0 +call exit +addl $4,%esp +mov $0,%eax +.LC63: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf82: +.size main,.Lf82-main +.data +.align 1 +.LC77: +.byte 119 +.byte 105 +.byte 116 +.byte 104 +.byte 105 +.byte 110 +.byte 32 +.byte 91 +.byte 37 +.byte 100 +.byte 44 +.byte 37 +.byte 100 +.byte 59 +.byte 32 +.byte 37 +.byte 100 +.byte 44 +.byte 37 +.byte 100 +.byte 93 +.byte 10 +.byte 0 +.align 1 +.LC76: +.byte 110 +.byte 111 +.byte 116 +.byte 32 +.byte 0 +.align 1 +.LC71: +.byte 40 +.byte 37 +.byte 100 +.byte 44 +.byte 37 +.byte 100 +.byte 41 +.byte 32 +.byte 105 +.byte 115 +.byte 32 +.byte 0 +.align 1 +.LC61: +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/switch.1bk b/src/cmd/lccom-1/tst/x86-linux/switch.1bk new file mode 100644 index 0000000..de46a73 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/switch.1bk @@ -0,0 +1,76 @@ +b = 0x8 +f = 0xc +n = 0xa +r = 0xd +t = 0x9 +v = 0xb +x = 0x78 +f: +x = 0 +x = 1 +x = 2 +x = 2 +x = 2 +x = 2 +x = 2 +x = 7 +x = 8 +x = 9 +x = 9 +x = 9 +x = 9 +x = 9 +x = 9 +x = 9 +x = 16 +x = 17 +x = 18 +x = 19 +x = 20 +g: +1 1 +1 2 +2 3 +2 4 +2 5 +3 6 +d 6 +3 7 +d 7 +3 8 +d 8 +d 9 +d 10 +h: +i = 8 +i = 16 +i = 120 +i = 128 +i = 248 +i = 264 +i = 272 +i = 280 +i = 288 +i = 296 +i = 304 +i = 312 +488 defaults +x = 0x1000000 +x = 0x2000000 +x = 0x3000000 +x = 0x4000000 +x = 0x5000000 +x = 0x6000000 (default) +x = 0x7000000 (default) +0 +1 +2 +3 +4 +5 +0 +1 +2 +3 +4 +5 diff --git a/src/cmd/lccom-1/tst/x86-linux/switch.2bk b/src/cmd/lccom-1/tst/x86-linux/switch.2bk new file mode 100644 index 0000000..709b419 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/switch.2bk @@ -0,0 +1,5 @@ +tst/switch.c:55: warning: missing return value +tst/switch.c:73: warning: missing return value +tst/switch.c:97: warning: missing return value +tst/switch.c:112: warning: missing return value +tst/switch.c:137: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/switch.sbk b/src/cmd/lccom-1/tst/x86-linux/switch.sbk new file mode 100644 index 0000000..4ecdc6c --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/switch.sbk @@ -0,0 +1,899 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +leal .LC6,%edi +movl %edi,-4(%ebp) +jmp .LC5 +.LC2: +movl -4(%ebp),%edi +movsbl (,%edi),%edi +pushl %edi +call backslash +addl $4,%esp +pushl %eax +movl -4(%ebp),%edi +movsbl (,%edi),%edi +pushl %edi +pushl $.LC7 +call printf +addl $12,%esp +.LC3: +incl -4(%ebp) +.LC5: +movl -4(%ebp),%edi +movsbl (,%edi),%edi +cmpl $0,%edi +jne .LC2 +call f +call g +call h +movl $16777216,-8(%ebp) +jmp .LC11 +.LC8: +pushl -8(%ebp) +call big +addl $4,%esp +.LC9: +addl $16777216,-8(%ebp) +.LC11: +movl -8(%ebp),%edi +andl $117440512,%edi +cmpl $0,%edi +jne .LC8 +call limit +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf12: +.size main,.Lf12-main +.globl backslash +.align 16 +.type backslash,@function +backslash: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 20(%ebp),%edi +cmpl $102,%edi +je .LC17 +cmpl $102,%edi +jg .LC23 +.LC22: +cmpl $98,20(%ebp) +je .LC16 +jmp .LC14 +.LC23: +movl 20(%ebp),%edi +cmpl $110,%edi +je .LC18 +cmpl $110,%edi +jl .LC14 +.LC24: +movl 20(%ebp),%edi +cmpl $114,%edi +je .LC19 +cmpl $116,%edi +je .LC20 +cmpl $118,%edi +je .LC21 +jmp .LC14 +.LC16: +mov $8,%eax +jmp .LC13 +.LC17: +mov $12,%eax +jmp .LC13 +.LC18: +mov $10,%eax +jmp .LC13 +.LC19: +mov $13,%eax +jmp .LC13 +.LC20: +mov $9,%eax +jmp .LC13 +.LC21: +mov $11,%eax +jmp .LC13 +.LC14: +movl 20(%ebp),%eax +.LC13: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf25: +.size backslash,.Lf25-backslash +.globl f +.align 16 +.type f,@function +f: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $12,%esp +movl $0,-8(%ebp) +pushl $.LC27 +call printf +addl $4,%esp +movl $0,-4(%ebp) +.LC28: +movl -4(%ebp),%edi +movl %edi,-12(%ebp) +movl -4(%ebp),%edi +cmpl $1,%edi +jl .LC32 +cmpl $20,%edi +jg .LC32 +jmp *.LC44-4(,%edi,4) +.data +.align 4 +.LC44: +.long .LC34 +.long .LC35 +.long .LC32 +.long .LC32 +.long .LC32 +.long .LC32 +.long .LC36 +.long .LC37 +.long .LC38 +.long .LC32 +.long .LC32 +.long .LC32 +.long .LC32 +.long .LC32 +.long .LC32 +.long .LC39 +.long .LC40 +.long .LC41 +.long .LC42 +.long .LC43 +.text +.LC34: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC35: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC36: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC37: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC38: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC39: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC40: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC41: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC42: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC33 +.LC43: +movl -4(%ebp),%edi +movl %edi,-8(%ebp) +.LC32: +.LC33: +pushl -8(%ebp) +pushl $.LC46 +call printf +addl $8,%esp +.LC29: +incl -4(%ebp) +cmpl $20,-4(%ebp) +jle .LC28 +mov $0,%eax +.LC26: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf47: +.size f,.Lf47-f +.globl g +.align 16 +.type g,@function +g: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +pushl $.LC49 +call printf +addl $4,%esp +movl $1,-4(%ebp) +.LC50: +movl -4(%ebp),%edi +cmpl $1001,%edi +jl .LC67 +cmpl $1004,%edi +jg .LC68 +jmp *.LC69-4004(,%edi,4) +.data +.align 4 +.LC69: +.long .LC63 +.long .LC63 +.long .LC63 +.long .LC63 +.text +.LC67: +movl -4(%ebp),%edi +cmpl $1,%edi +jl .LC54 +cmpl $8,%edi +jg .LC54 +jmp *.LC71-4(,%edi,4) +.data +.align 4 +.LC71: +.long .LC56 +.long .LC56 +.long .LC58 +.long .LC58 +.long .LC58 +.long .LC60 +.long .LC60 +.long .LC60 +.text +.LC68: +movl -4(%ebp),%edi +cmpl $3001,%edi +jl .LC54 +cmpl $3004,%edi +jg .LC54 +jmp *.LC73-12004(,%edi,4) +.data +.align 4 +.LC73: +.long .LC65 +.long .LC65 +.long .LC65 +.long .LC65 +.text +.LC56: +pushl -4(%ebp) +pushl $.LC57 +call printf +addl $8,%esp +jmp .LC55 +.LC58: +pushl -4(%ebp) +pushl $.LC59 +call printf +addl $8,%esp +jmp .LC55 +.LC60: +pushl -4(%ebp) +pushl $.LC61 +call printf +addl $8,%esp +.LC54: +pushl -4(%ebp) +pushl $.LC62 +call printf +addl $8,%esp +jmp .LC55 +.LC63: +pushl -4(%ebp) +pushl $.LC64 +call printf +addl $8,%esp +jmp .LC55 +.LC65: +pushl -4(%ebp) +pushl $.LC66 +call printf +addl $8,%esp +.LC55: +.LC51: +incl -4(%ebp) +cmpl $10,-4(%ebp) +jle .LC50 +mov $0,%eax +.LC48: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf75: +.size g,.Lf75-g +.globl h +.align 16 +.type h,@function +h: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +movl $0,-8(%ebp) +pushl $.LC77 +call printf +addl $4,%esp +movl $1,-4(%ebp) +.LC78: +movl -4(%ebp),%edi +cmpl $264,%edi +je .LC90 +cmpl $264,%edi +jg .LC98 +.LC97: +movl -4(%ebp),%edi +cmpl $120,%edi +je .LC88 +cmpl $120,%edi +jg .LC100 +.LC99: +movl -4(%ebp),%edi +cmpl $8,%edi +je .LC87 +cmpl $8,%edi +jl .LC82 +.LC101: +cmpl $16,-4(%ebp) +je .LC86 +jmp .LC82 +.LC100: +movl -4(%ebp),%edi +cmpl $128,%edi +je .LC84 +cmpl $128,%edi +jl .LC82 +.LC102: +cmpl $248,-4(%ebp) +je .LC91 +jmp .LC82 +.LC98: +movl -4(%ebp),%edi +cmpl $288,%edi +je .LC95 +cmpl $288,%edi +jg .LC104 +.LC103: +movl -4(%ebp),%edi +cmpl $272,%edi +je .LC92 +cmpl $272,%edi +jl .LC82 +.LC105: +cmpl $280,-4(%ebp) +je .LC89 +jmp .LC82 +.LC104: +movl -4(%ebp),%edi +cmpl $304,%edi +je .LC93 +cmpl $304,%edi +jg .LC107 +.LC106: +cmpl $296,-4(%ebp) +je .LC94 +jmp .LC82 +.LC107: +cmpl $312,-4(%ebp) +je .LC96 +jmp .LC82 +.LC82: +incl -8(%ebp) +jmp .LC79 +.LC84: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC86: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC87: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC88: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC89: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC90: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC91: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC92: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC93: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC94: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC95: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +jmp .LC83 +.LC96: +pushl -4(%ebp) +pushl $.LC85 +call printf +addl $8,%esp +.LC83: +.LC79: +incl -4(%ebp) +cmpl $500,-4(%ebp) +jle .LC78 +pushl -8(%ebp) +pushl $.LC108 +call printf +addl $8,%esp +mov $0,%eax +.LC76: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf109: +.size h,.Lf109-h +.globl big +.align 16 +.type big,@function +big: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl 20(%ebp),%edi +andl $0x6000000,%edi +movl %edi,-4(%ebp) +movl -4(%ebp),%edi +cmpl $33554432,%edi +je .LC116 +cmpl $33554432,%edi +jg .LC120 +.LC119: +movl -4(%ebp),%edi +cmpl $-2,%edi +je .LC114 +cmpl $-1,%edi +je .LC114 +cmpl $0,%edi +je .LC114 +jmp .LC111 +.LC120: +movl -4(%ebp),%edi +cmpl $67108864,%edi +je .LC117 +jmp .LC111 +.LC114: +pushl 20(%ebp) +pushl $.LC115 +call printf +addl $8,%esp +jmp .LC112 +.LC116: +pushl 20(%ebp) +pushl $.LC115 +call printf +addl $8,%esp +jmp .LC112 +.LC117: +pushl 20(%ebp) +pushl $.LC115 +call printf +addl $8,%esp +jmp .LC112 +.LC111: +pushl 20(%ebp) +pushl $.LC118 +call printf +addl $8,%esp +.LC112: +mov $0,%eax +.LC110: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf121: +.size big,.Lf121-big +.globl limit +.align 16 +.type limit,@function +limit: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl $-2147483648,-4(%ebp) +.LC123: +movl -4(%ebp),%edi +mov $-2147483648,%esi +cmpl $-2147483648,%edi +jl .LC127 +cmpl $-2147483644,%edi +jg .LC127 +leal (,%edi,4),%edi +leal (,%esi,4),%esi +subl %esi,%edi +jmp *.LC140(%edi) +.data +.align 4 +.LC140: +.long .LC129 +.long .LC131 +.long .LC133 +.long .LC135 +.long .LC137 +.text +.LC129: +pushl $.LC130 +call printf +addl $4,%esp +jmp .LC128 +.LC131: +pushl $.LC132 +call printf +addl $4,%esp +jmp .LC128 +.LC133: +pushl $.LC134 +call printf +addl $4,%esp +jmp .LC128 +.LC135: +pushl $.LC136 +call printf +addl $4,%esp +jmp .LC128 +.LC137: +pushl $.LC138 +call printf +addl $4,%esp +jmp .LC128 +.LC127: +pushl $.LC139 +call printf +addl $4,%esp +.LC128: +.LC124: +incl -4(%ebp) +cmpl $-2147483643,-4(%ebp) +jle .LC123 +movl $2147483647,-4(%ebp) +.LC141: +movl -4(%ebp),%edi +mov $2147483643,%esi +cmpl $2147483643,%edi +jl .LC145 +cmpl $2147483647,%edi +jg .LC145 +leal (,%edi,4),%edi +leal (,%esi,4),%esi +subl %esi,%edi +jmp *.LC152(%edi) +.data +.align 4 +.LC152: +.long .LC151 +.long .LC150 +.long .LC149 +.long .LC148 +.long .LC147 +.text +.LC147: +pushl $.LC130 +call printf +addl $4,%esp +jmp .LC146 +.LC148: +pushl $.LC132 +call printf +addl $4,%esp +jmp .LC146 +.LC149: +pushl $.LC134 +call printf +addl $4,%esp +jmp .LC146 +.LC150: +pushl $.LC136 +call printf +addl $4,%esp +jmp .LC146 +.LC151: +pushl $.LC138 +call printf +addl $4,%esp +jmp .LC146 +.LC145: +pushl $.LC139 +call printf +addl $4,%esp +.LC146: +.LC142: +decl -4(%ebp) +cmpl $2147483642,-4(%ebp) +jge .LC141 +mov $0,%eax +.LC122: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf153: +.size limit,.Lf153-limit +.data +.align 1 +.LC139: +.byte 53 +.byte 10 +.byte 0 +.align 1 +.LC138: +.byte 52 +.byte 10 +.byte 0 +.align 1 +.LC136: +.byte 51 +.byte 10 +.byte 0 +.align 1 +.LC134: +.byte 50 +.byte 10 +.byte 0 +.align 1 +.LC132: +.byte 49 +.byte 10 +.byte 0 +.align 1 +.LC130: +.byte 48 +.byte 10 +.byte 0 +.align 1 +.LC118: +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 32 +.byte 40 +.byte 100 +.byte 101 +.byte 102 +.byte 97 +.byte 117 +.byte 108 +.byte 116 +.byte 41 +.byte 10 +.byte 0 +.align 1 +.LC115: +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 10 +.byte 0 +.align 1 +.LC108: +.byte 37 +.byte 100 +.byte 32 +.byte 100 +.byte 101 +.byte 102 +.byte 97 +.byte 117 +.byte 108 +.byte 116 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC85: +.byte 105 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC77: +.byte 104 +.byte 58 +.byte 10 +.byte 0 +.align 1 +.LC66: +.byte 54 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC64: +.byte 53 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC62: +.byte 100 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC61: +.byte 51 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC59: +.byte 50 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC57: +.byte 49 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC49: +.byte 103 +.byte 58 +.byte 10 +.byte 0 +.align 1 +.LC46: +.byte 120 +.byte 32 +.byte 61 +.byte 32 +.byte 37 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC27: +.byte 102 +.byte 58 +.byte 10 +.byte 0 +.align 1 +.LC7: +.byte 37 +.byte 99 +.byte 32 +.byte 61 +.byte 32 +.byte 48 +.byte 120 +.byte 37 +.byte 120 +.byte 10 +.byte 0 +.align 1 +.LC6: +.byte 98 +.byte 102 +.byte 110 +.byte 114 +.byte 116 +.byte 118 +.byte 120 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/wf1.1bk b/src/cmd/lccom-1/tst/x86-linux/wf1.1bk new file mode 100644 index 0000000..a846267 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/wf1.1bk @@ -0,0 +1,74 @@ +5 a +2 and +5 buf +16 c +8 char +1 compare +4 cond +5 count +1 d +1 die +3 else +1 entry +1 eof +4 err +1 error +1 exit +1 folded +1 for +1 free +1 frequencies +1 frequency +1 get +2 getchar +3 getword +14 if +2 in +1 index +1 input +1 install +8 int +1 into +1 is +4 isletter +1 it +1 itself +5 left +1 letter +7 lookup +1 main +2 malloc +1 message +2 n +1 necessary +12 next +9 node +4 of +1 on +1 or +1 otherwise +2 out +8 p +3 print +2 printf +16 return +5 right +4 root +25 s +2 storage +3 strcmp +1 strcpy +1 strlen +8 struct +1 structures +2 subtree +1 t +5 tprint +9 tree +1 uses +1 version +1 wf +3 while +21 word +9 words +2 z diff --git a/src/cmd/lccom-1/tst/x86-linux/wf1.2bk b/src/cmd/lccom-1/tst/x86-linux/wf1.2bk new file mode 100644 index 0000000..190e4a1 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/wf1.2bk @@ -0,0 +1,2 @@ +tst/wf1.c:29: warning: missing return value +tst/wf1.c:87: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/wf1.sbk b/src/cmd/lccom-1/tst/x86-linux/wf1.sbk new file mode 100644 index 0000000..f3ee849 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/wf1.sbk @@ -0,0 +1,437 @@ +.globl main +.text +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $24,%esp +movl $0,-24(%ebp) +movl $0,next +jmp .LC3 +.LC2: +leal -24(%ebp),%edi +pushl %edi +leal -20(%ebp),%edi +pushl %edi +call lookup +addl $8,%esp +incl (,%eax) +.LC3: +leal -20(%ebp),%edi +pushl %edi +call getword +addl $4,%esp +cmpl $0,%eax +jne .LC2 +pushl -24(%ebp) +call tprint +addl $4,%esp +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf5: +.size main,.Lf5-main +.globl err +.align 16 +.type err,@function +err: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl 20(%ebp) +pushl $.LC7 +call printf +addl $8,%esp +pushl $1 +call exit +addl $4,%esp +mov $0,%eax +.LC6: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf8: +.size err,.Lf8-err +.globl getword +.align 16 +.type getword,@function +getword: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $8,%esp +.LC10: +.LC11: +call getchar +movl %eax,%edi +movl %edi,-4(%ebp) +cmpl $-1,%edi +je .LC13 +pushl -4(%ebp) +call isletter +addl $4,%esp +cmpl $0,%eax +je .LC10 +.LC13: +movl 20(%ebp),%edi +movl %edi,-8(%ebp) +jmp .LC17 +.LC14: +movl -8(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-8(%ebp) +movl -4(%ebp),%esi +movl %esi,%ebx +movb %bl,(,%edi) +.LC15: +call getchar +movl %eax,-4(%ebp) +.LC17: +pushl -4(%ebp) +call isletter +addl $4,%esp +movl %eax,-4(%ebp) +cmpl $0,%eax +jne .LC14 +movl -8(%ebp),%edi +movb $0,(,%edi) +movl -8(%ebp),%edi +movl 20(%ebp),%esi +cmpl %esi,%edi +jbe .LC18 +mov $1,%eax +jmp .LC9 +.LC18: +mov $0,%eax +.LC9: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf20: +.size getword,.Lf20-getword +.globl isletter +.align 16 +.type isletter,@function +isletter: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 20(%ebp),%edi +cmpl $65,%edi +jl .LC22 +cmpl $90,%edi +jg .LC22 +addl $32,20(%ebp) +.LC22: +movl 20(%ebp),%edi +cmpl $97,%edi +jl .LC24 +cmpl $122,%edi +jg .LC24 +movl 20(%ebp),%eax +jmp .LC21 +.LC24: +mov $0,%eax +.LC21: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf26: +.size isletter,.Lf26-isletter +.globl lookup +.align 16 +.type lookup,@function +lookup: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +movl 24(%ebp),%edi +movl (,%edi),%edi +cmpl $0,%edi +je .LC28 +movl 24(%ebp),%edi +movl (,%edi),%edi +pushl 12(%edi) +pushl 20(%ebp) +call strcmp +addl $8,%esp +movl %eax,-4(%ebp) +cmpl $0,-4(%ebp) +jge .LC30 +movl 24(%ebp),%edi +movl (,%edi),%edi +leal 4(%edi),%edi +pushl %edi +pushl 20(%ebp) +call lookup +addl $8,%esp +movl %eax,%edi +jmp .LC27 +.LC30: +cmpl $0,-4(%ebp) +jle .LC32 +movl 24(%ebp),%edi +movl (,%edi),%edi +leal 8(%edi),%edi +pushl %edi +pushl 20(%ebp) +call lookup +addl $8,%esp +movl %eax,%edi +jmp .LC27 +.LC32: +movl 24(%ebp),%edi +movl (,%edi),%eax +jmp .LC27 +.LC28: +cmpl $2000,next +jl .LC34 +pushl $.LC36 +call err +addl $4,%esp +.LC34: +movl next,%edi +sall $4,%edi +movl $0,words(%edi) +movl next,%edi +sall $4,%edi +movl $0,words+8(%edi) +movl $0,words+4(%edi) +pushl 20(%ebp) +call strlen +addl $4,%esp +leal 1(%eax),%edi +pushl %edi +call malloc +addl $4,%esp +movl next,%esi +sall $4,%esi +movl %eax,words+12(%esi) +movl next,%edi +sall $4,%edi +movl words+12(%edi),%edi +cmpl $0,%edi +jne .LC40 +pushl $.LC43 +call err +addl $4,%esp +.LC40: +pushl 20(%ebp) +movl next,%edi +sall $4,%edi +pushl words+12(%edi) +call strcpy +addl $8,%esp +movl next,%edi +leal 1(%edi),%esi +movl %esi,next +sall $4,%edi +leal words(%edi),%edi +movl 24(%ebp),%esi +movl %edi,(,%esi) +movl %edi,%eax +.LC27: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf45: +.size lookup,.Lf45-lookup +.globl tprint +.align 16 +.type tprint,@function +tprint: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 20(%ebp),%edi +cmpl $0,%edi +je .LC47 +movl 20(%ebp),%edi +pushl 4(%edi) +call tprint +addl $4,%esp +movl 20(%ebp),%edi +pushl 12(%edi) +pushl (,%edi) +pushl $.LC49 +call printf +addl $12,%esp +movl 20(%ebp),%edi +pushl 8(%edi) +call tprint +addl $4,%esp +.LC47: +mov $0,%eax +.LC46: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf50: +.size tprint,.Lf50-tprint +.globl strcmp +.align 16 +.type strcmp,@function +strcmp: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +jmp .LC53 +.LC52: +movl 20(%ebp),%edi +leal 1(%edi),%esi +movl %esi,20(%ebp) +movsbl (,%edi),%edi +cmpl $0,%edi +jne .LC55 +mov $0,%eax +jmp .LC51 +.LC55: +incl 24(%ebp) +.LC53: +movl 20(%ebp),%edi +movsbl (,%edi),%edi +movl 24(%ebp),%esi +movsbl (,%esi),%esi +cmpl %esi,%edi +je .LC52 +movl 20(%ebp),%edi +movsbl (,%edi),%edi +cmpl $0,%edi +jne .LC57 +mov $-1,%eax +jmp .LC51 +.LC57: +movl 24(%ebp),%edi +movsbl (,%edi),%edi +cmpl $0,%edi +jne .LC59 +mov $1,%eax +jmp .LC51 +.LC59: +movl 20(%ebp),%edi +movsbl (,%edi),%edi +movl 24(%ebp),%esi +movsbl (,%esi),%esi +movl %edi,%eax +subl %esi,%eax +.LC51: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf61: +.size strcmp,.Lf61-strcmp +.bss +.globl next +.align 4 +.type next,@object +.size next,4 +.comm next,4 +.globl words +.align 4 +.type words,@object +.size words,32000 +.comm words,32000 +.data +.align 1 +.LC49: +.byte 37 +.byte 100 +.byte 9 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC43: +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 119 +.byte 111 +.byte 114 +.byte 100 +.byte 32 +.byte 115 +.byte 116 +.byte 111 +.byte 114 +.byte 97 +.byte 103 +.byte 101 +.byte 0 +.align 1 +.LC36: +.byte 111 +.byte 117 +.byte 116 +.byte 32 +.byte 111 +.byte 102 +.byte 32 +.byte 110 +.byte 111 +.byte 100 +.byte 101 +.byte 32 +.byte 115 +.byte 116 +.byte 111 +.byte 114 +.byte 97 +.byte 103 +.byte 101 +.byte 0 +.align 1 +.LC7: +.byte 63 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/x86-linux/yacc.1bk b/src/cmd/lccom-1/tst/x86-linux/yacc.1bk new file mode 100644 index 0000000..60de9b5 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/yacc.1bk @@ -0,0 +1,10 @@ +a +b +load +negate +push 5 +c +load +multiply +add +store diff --git a/src/cmd/lccom-1/tst/x86-linux/yacc.2bk b/src/cmd/lccom-1/tst/x86-linux/yacc.2bk new file mode 100644 index 0000000..4b6dc39 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/yacc.2bk @@ -0,0 +1,3 @@ +tst/yacc.c:345: warning: missing return value +tst/yacc.c:349: warning: missing return value +tst/yacc.c:360: warning: missing return value diff --git a/src/cmd/lccom-1/tst/x86-linux/yacc.sbk b/src/cmd/lccom-1/tst/x86-linux/yacc.sbk new file mode 100644 index 0000000..61f9858 --- /dev/null +++ b/src/cmd/lccom-1/tst/x86-linux/yacc.sbk @@ -0,0 +1,2384 @@ +.data +.globl yyin +.align 4 +.type yyin,@object +.size yyin,4 +yyin: +.long 0 +.globl yyout +.align 4 +.type yyout,@object +.size yyout,4 +yyout: +.long 0 +.globl yylex +.text +.align 16 +.type yylex,@function +yylex: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $4,%esp +jmp .LC3 +.LC2: +.LC5: +movl -4(%ebp),%edi +cmpl $-1,%edi +jl .LC6 +cmpl $4,%edi +jg .LC6 +jmp *.LC17+4(,%edi,4) +.data +.align 4 +.LC17: +.long .LC7 +.long .LC8 +.long .LC11 +.long .LC12 +.long .LC7 +.long .LC14 +.text +.LC8: +call yywrap +cmpl $0,%eax +je .LC7 +mov $0,%eax +jmp .LC1 +.LC11: +mov $257,%eax +jmp .LC1 +.LC12: +mov $258,%eax +jmp .LC1 +.LC14: +movsbl yytext,%eax +jmp .LC1 +.LC6: +pushl -4(%ebp) +pushl $.LC16 +pushl yyout +call fprintf +addl $12,%esp +.LC7: +.LC3: +call yylook +movl %eax,-4(%ebp) +cmpl $0,%eax +jge .LC2 +mov $0,%eax +.LC1: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf19: +.size yylex,.Lf19-yylex +.data +.globl yyvstop +.align 4 +.type yyvstop,@object +yyvstop: +.long 0 +.long 4 +.long 0 +.long 3 +.long 4 +.long 0 +.long 2 +.long 4 +.long 0 +.long 1 +.long 4 +.long 0 +.long 2 +.long 0 +.long 1 +.long 0 +.long 0 +.size yyvstop,68 +.globl yycrank +.align 1 +.type yycrank,@object +yycrank: +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 1 +.byte 3 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 1 +.byte 4 +.byte 1 +.byte 3 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 1 +.byte 5 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 5 +.byte 7 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 1 +.byte 6 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 6 +.byte 8 +.byte 0 +.byte 0 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 6 +.byte 8 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.size yycrank,290 +.globl yysvec +.align 4 +.type yysvec,@object +yysvec: +.long 0 +.long 0 +.long 0 +.long yycrank-2 +.long 0 +.long 0 +.long yycrank +.long yysvec+12 +.long 0 +.long yycrank +.long 0 +.long yyvstop+4 +.long yycrank +.long 0 +.long yyvstop+12 +.long yycrank+4 +.long 0 +.long yyvstop+24 +.long yycrank+38 +.long 0 +.long yyvstop+36 +.long yycrank +.long yysvec+60 +.long yyvstop+48 +.long yycrank +.long yysvec+72 +.long yyvstop+56 +.long 0 +.long 0 +.long 0 +.size yysvec,120 +.globl yytop +.align 4 +.type yytop,@object +.size yytop,4 +yytop: +.long yycrank+282 +.globl yybgin +.align 4 +.type yybgin,@object +.size yybgin,4 +yybgin: +.long yysvec+12 +.globl yymatch +.align 1 +.type yymatch,@object +yymatch: +.byte 0 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 9 +.byte 10 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 9 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 48 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 65 +.byte 1 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 65 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 1 +.byte 0 +.size yymatch,129 +.globl yyextra +.align 1 +.type yyextra,@object +yyextra: +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.byte 0 +.size yyextra,9 +.globl yylineno +.align 4 +.type yylineno,@object +.size yylineno,4 +yylineno: +.long 1 +.globl yysptr +.align 4 +.type yysptr,@object +.size yysptr,4 +yysptr: +.long yysbuf +.globl yyprevious +.align 4 +.type yyprevious,@object +.size yyprevious,4 +yyprevious: +.long 10 +.globl yylook +.text +.align 16 +.type yylook,@function +yylook: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $44,%esp +cmpl $0,yymorfg +jne .LC35 +leal yytext,%edi +movl %edi,-16(%ebp) +jmp .LC36 +.LC35: +movl $0,yymorfg +movl yyleng,%edi +leal yytext(%edi),%edi +movl %edi,-16(%ebp) +.LC36: +.LC37: +leal yylstate,%edi +movl %edi,-8(%ebp) +movl yybgin,%edi +movl %edi,-4(%ebp) +movl %edi,yyestate +cmpl $10,yyprevious +jne .LC41 +movl -4(%ebp),%edi +leal 12(%edi),%edi +movl %edi,-4(%ebp) +.LC41: +.LC43: +movl -4(%ebp),%edi +movl (,%edi),%edi +movl %edi,-12(%ebp) +movl -12(%ebp),%edi +leal yycrank,%esi +cmpl %esi,%edi +jne .LC47 +movl -4(%ebp),%edi +movl 4(%edi),%edi +movl %edi,-28(%ebp) +movl -28(%ebp),%edi +cmpl $0,%edi +jne .LC49 +jmp .LC94 +.LC49: +movl -28(%ebp),%edi +movl (,%edi),%edi +leal yycrank,%esi +cmpl %esi,%edi +jne .LC51 +jmp .LC94 +.LC51: +.LC47: +movl -16(%ebp),%edi +leal 1(%edi),%esi +movl %esi,-16(%ebp) +movl yysptr,%esi +leal yysbuf,%ebx +cmpl %ebx,%esi +jbe .LC61 +movl yysptr,%esi +leal -1(%esi),%esi +movl %esi,yysptr +movsbl (,%esi),%esi +movl %esi,-40(%ebp) +jmp .LC62 +.LC61: +movl yyin,%esi +leal 4(%esi),%esi +movl (,%esi),%ebx +subl $1,%ebx +movl %ebx,(,%esi) +cmpl $0,%ebx +jl .LC63 +movl yyin,%esi +movl (,%esi),%ebx +leal 1(%ebx),%edx +movl %edx,(,%esi) +movsbl (,%ebx),%esi +andl $255,%esi +movl %esi,-44(%ebp) +jmp .LC64 +.LC63: +pushl yyin +call _filbuf +addl $4,%esp +movl %eax,%esi +movl %esi,-44(%ebp) +.LC64: +movl -44(%ebp),%esi +movl %esi,-40(%ebp) +.LC62: +movl -40(%ebp),%esi +movl %esi,yytchar +cmpl $10,%esi +jne .LC59 +incl yylineno +movl yytchar,%esi +movl %esi,-36(%ebp) +jmp .LC60 +.LC59: +movl yytchar,%esi +movl %esi,-36(%ebp) +.LC60: +cmpl $-1,-36(%ebp) +jne .LC57 +movl $0,-32(%ebp) +jmp .LC58 +.LC57: +movl yytchar,%esi +movl %esi,-32(%ebp) +.LC58: +movl -32(%ebp),%esi +movl %esi,-20(%ebp) +movl %esi,%ebx +movb %bl,(,%edi) +.LC65: +movl -12(%ebp),%edi +movl %edi,-24(%ebp) +leal yycrank,%esi +cmpl %esi,%edi +jbe .LC66 +movl -20(%ebp),%edi +movl -24(%ebp),%esi +leal (%esi,%edi,2),%edi +movl %edi,-12(%ebp) +movl -12(%ebp),%edi +movl %edi,%esi +movl yytop,%ebx +cmpl %ebx,%esi +ja .LC67 +movsbl (,%edi),%edi +imul $12,%edi,%edi +leal yysvec(%edi),%edi +movl -4(%ebp),%esi +cmpl %esi,%edi +jne .LC67 +leal yysvec,%edi +movl -12(%ebp),%esi +movsbl 1(%esi),%esi +imul $12,%esi,%esi +leal yysvec(%esi),%esi +cmpl %edi,%esi +jne .LC70 +movl -16(%ebp),%edi +leal -1(%edi),%edi +movl %edi,-16(%ebp) +movsbl (,%edi),%edi +movl %edi,yytchar +cmpl $10,yytchar +jne .LC72 +decl yylineno +.LC72: +movl yysptr,%edi +leal 1(%edi),%esi +movl %esi,yysptr +movl yytchar,%esi +movl %esi,%ebx +movb %bl,(,%edi) +jmp .LC94 +.LC70: +movl -8(%ebp),%edi +leal 4(%edi),%esi +movl %esi,-8(%ebp) +movl -12(%ebp),%esi +movsbl 1(%esi),%esi +imul $12,%esi,%esi +leal yysvec(%esi),%esi +movl %esi,-4(%ebp) +movl %esi,(,%edi) +jmp .LC43 +.LC66: +movl -12(%ebp),%edi +leal yycrank,%esi +cmpl %esi,%edi +jae .LC75 +leal yycrank,%edi +movl -12(%ebp),%esi +subl %esi,%edi +movl %edi,%eax +mov $2,%ecx +cdq +idivl %ecx +leal yycrank(,%eax,2),%edi +movl %edi,-24(%ebp) +movl %edi,-12(%ebp) +movl -20(%ebp),%edi +movl -12(%ebp),%esi +leal (%esi,%edi,2),%edi +movl %edi,-12(%ebp) +movl -12(%ebp),%edi +movl %edi,%esi +movl yytop,%ebx +cmpl %ebx,%esi +ja .LC77 +movsbl (,%edi),%edi +imul $12,%edi,%edi +leal yysvec(%edi),%edi +movl -4(%ebp),%esi +cmpl %esi,%edi +jne .LC77 +leal yysvec,%edi +movl -12(%ebp),%esi +movsbl 1(%esi),%esi +imul $12,%esi,%esi +leal yysvec(%esi),%esi +cmpl %edi,%esi +jne .LC79 +movl -16(%ebp),%edi +leal -1(%edi),%edi +movl %edi,-16(%ebp) +movsbl (,%edi),%edi +movl %edi,yytchar +cmpl $10,yytchar +jne .LC81 +decl yylineno +.LC81: +movl yysptr,%edi +leal 1(%edi),%esi +movl %esi,yysptr +movl yytchar,%esi +movl %esi,%ebx +movb %bl,(,%edi) +jmp .LC94 +.LC79: +movl -8(%ebp),%edi +leal 4(%edi),%esi +movl %esi,-8(%ebp) +movl -12(%ebp),%esi +movsbl 1(%esi),%esi +imul $12,%esi,%esi +leal yysvec(%esi),%esi +movl %esi,-4(%ebp) +movl %esi,(,%edi) +jmp .LC43 +.LC77: +movl -20(%ebp),%edi +movsbl yymatch(%edi),%edi +movl -24(%ebp),%esi +leal (%esi,%edi,2),%edi +movl %edi,-12(%ebp) +movl -12(%ebp),%edi +movl %edi,%esi +movl yytop,%ebx +cmpl %ebx,%esi +ja .LC83 +movsbl (,%edi),%edi +imul $12,%edi,%edi +leal yysvec(%edi),%edi +movl -4(%ebp),%esi +cmpl %esi,%edi +jne .LC83 +leal yysvec,%edi +movl -12(%ebp),%esi +movsbl 1(%esi),%esi +imul $12,%esi,%esi +leal yysvec(%esi),%esi +cmpl %edi,%esi +jne .LC85 +movl -16(%ebp),%edi +leal -1(%edi),%edi +movl %edi,-16(%ebp) +movsbl (,%edi),%edi +movl %edi,yytchar +cmpl $10,yytchar +jne .LC87 +decl yylineno +.LC87: +movl yysptr,%edi +leal 1(%edi),%esi +movl %esi,yysptr +movl yytchar,%esi +movl %esi,%ebx +movb %bl,(,%edi) +jmp .LC94 +.LC85: +movl -8(%ebp),%edi +leal 4(%edi),%esi +movl %esi,-8(%ebp) +movl -12(%ebp),%esi +movsbl 1(%esi),%esi +imul $12,%esi,%esi +leal yysvec(%esi),%esi +movl %esi,-4(%ebp) +movl %esi,(,%edi) +jmp .LC43 +.LC83: +.LC75: +.LC67: +movl -4(%ebp),%edi +movl 4(%edi),%edi +movl %edi,-4(%ebp) +cmpl $0,%edi +je .LC89 +movl -4(%ebp),%edi +movl (,%edi),%edi +movl %edi,-12(%ebp) +leal yycrank,%esi +cmpl %esi,%edi +je .LC89 +jmp .LC65 +.LC89: +movl -16(%ebp),%edi +leal -1(%edi),%edi +movl %edi,-16(%ebp) +movsbl (,%edi),%edi +movl %edi,yytchar +cmpl $10,yytchar +jne .LC91 +decl yylineno +.LC91: +movl yysptr,%edi +leal 1(%edi),%esi +movl %esi,yysptr +movl yytchar,%esi +movl %esi,%ebx +movb %bl,(,%edi) +jmp .LC94 +.LC93: +movl -16(%ebp),%edi +leal -1(%edi),%esi +movl %esi,-16(%ebp) +movb $0,(,%edi) +movl -8(%ebp),%edi +movl (,%edi),%edi +movl %edi,%esi +cmpl $0,%esi +je .LC96 +movl 8(%edi),%edi +movl %edi,yyfnd +cmpl $0,%edi +je .LC96 +movl yyfnd,%edi +cmpl $0,(,%edi) +jle .LC96 +movl -8(%ebp),%edi +movl %edi,yyolsp +movl yyfnd,%edi +movl (,%edi),%edi +movsbl yyextra(%edi),%edi +cmpl $0,%edi +je .LC98 +jmp .LC101 +.LC100: +movl -8(%ebp),%edi +leal -4(%edi),%edi +movl %edi,-8(%ebp) +movl -16(%ebp),%edi +leal -1(%edi),%esi +movl %esi,-16(%ebp) +movsbl (,%edi),%edi +movl %edi,yytchar +cmpl $10,yytchar +jne .LC103 +decl yylineno +.LC103: +movl yysptr,%edi +leal 1(%edi),%esi +movl %esi,yysptr +movl yytchar,%esi +movl %esi,%ebx +movb %bl,(,%edi) +.LC101: +movl yyfnd,%edi +movl (,%edi),%edi +negl %edi +pushl %edi +movl -8(%ebp),%edi +movl (,%edi),%edi +pushl 8(%edi) +call yyback +addl $8,%esp +cmpl $1,%eax +je .LC105 +movl -8(%ebp),%edi +leal yylstate,%esi +cmpl %esi,%edi +ja .LC100 +.LC105: +.LC98: +movl -16(%ebp),%edi +movsbl (,%edi),%esi +movl %esi,yyprevious +movl -8(%ebp),%esi +movl %esi,yylsp +leal yytext,%esi +subl %esi,%edi +leal 1(%edi),%edi +movl %edi,yyleng +movl yyleng,%edi +movb $0,yytext(%edi) +movl yyfnd,%edi +leal 4(%edi),%esi +movl %esi,yyfnd +movl (,%edi),%eax +jmp .LC34 +.LC96: +movl -16(%ebp),%edi +movsbl (,%edi),%edi +movl %edi,yytchar +cmpl $10,yytchar +jne .LC106 +decl yylineno +.LC106: +movl yysptr,%edi +leal 1(%edi),%esi +movl %esi,yysptr +movl yytchar,%esi +movl %esi,%ebx +movb %bl,(,%edi) +.LC94: +movl -8(%ebp),%edi +leal -4(%edi),%esi +movl %esi,-8(%ebp) +leal yylstate,%esi +cmpl %esi,%edi +ja .LC93 +movsbl yytext,%edi +cmpl $0,%edi +jne .LC108 +leal yysbuf,%edi +movl %edi,yysptr +mov $0,%eax +jmp .LC34 +.LC108: +movl yysptr,%edi +leal yysbuf,%esi +cmpl %esi,%edi +jbe .LC118 +movl yysptr,%edi +leal -1(%edi),%edi +movl %edi,yysptr +movsbl (,%edi),%edi +movl %edi,-40(%ebp) +jmp .LC119 +.LC118: +movl yyin,%edi +leal 4(%edi),%edi +movl (,%edi),%esi +subl $1,%esi +movl %esi,(,%edi) +cmpl $0,%esi +jl .LC120 +movl yyin,%edi +movl (,%edi),%esi +leal 1(%esi),%ebx +movl %ebx,(,%edi) +movsbl (,%esi),%edi +andl $255,%edi +movl %edi,-44(%ebp) +jmp .LC121 +.LC120: +pushl yyin +call _filbuf +addl $4,%esp +movl %eax,%edi +movl %edi,-44(%ebp) +.LC121: +movl -44(%ebp),%edi +movl %edi,-40(%ebp) +.LC119: +movl -40(%ebp),%edi +movl %edi,yytchar +cmpl $10,%edi +jne .LC116 +incl yylineno +movl yytchar,%edi +movl %edi,-36(%ebp) +jmp .LC117 +.LC116: +movl yytchar,%edi +movl %edi,-36(%ebp) +.LC117: +cmpl $-1,-36(%ebp) +jne .LC114 +movl $0,-32(%ebp) +jmp .LC115 +.LC114: +movl yytchar,%edi +movl %edi,-32(%ebp) +.LC115: +movl -32(%ebp),%edi +movl %edi,%ebx +movb %bl,yytext +movsbl %bl,%edi +movl %edi,yyprevious +cmpl $0,yyprevious +jle .LC122 +movl yyout,%edi +leal 4(%edi),%edi +movl (,%edi),%esi +subl $1,%esi +movl %esi,(,%edi) +cmpl $0,%esi +jl .LC125 +movl yyout,%edi +movl (,%edi),%esi +leal 1(%esi),%ebx +movl %ebx,(,%edi) +movl yyprevious,%edi +movl %edi,%ebx +movb %bl,(,%esi) +jmp .LC126 +.LC125: +pushl yyout +pushl yyprevious +call _flsbuf +addl $8,%esp +.LC126: +.LC122: +leal yytext,%edi +movl %edi,-16(%ebp) +jmp .LC37 +.LC34: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf127: +.size yylook,.Lf127-yylook +.globl yyback +.align 16 +.type yyback,@function +yyback: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 20(%ebp),%edi +cmpl $0,%edi +jne .LC132 +mov $0,%eax +jmp .LC128 +.LC131: +movl 20(%ebp),%edi +leal 4(%edi),%esi +movl %esi,20(%ebp) +movl 24(%ebp),%esi +cmpl %esi,(,%edi) +jne .LC134 +mov $1,%eax +jmp .LC128 +.LC134: +.LC132: +movl 20(%ebp),%edi +cmpl $0,(,%edi) +jne .LC131 +mov $0,%eax +.LC128: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf136: +.size yyback,.Lf136-yyback +.globl yyinput +.align 16 +.type yyinput,@function +yyinput: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $16,%esp +movl yysptr,%edi +leal yysbuf,%esi +cmpl %esi,%edi +jbe .LC146 +movl yysptr,%edi +leal -1(%edi),%edi +movl %edi,yysptr +movsbl (,%edi),%edi +movl %edi,-12(%ebp) +jmp .LC147 +.LC146: +movl yyin,%edi +leal 4(%edi),%edi +movl (,%edi),%esi +subl $1,%esi +movl %esi,(,%edi) +cmpl $0,%esi +jl .LC148 +movl yyin,%edi +movl (,%edi),%esi +leal 1(%esi),%ebx +movl %ebx,(,%edi) +movsbl (,%esi),%edi +andl $255,%edi +movl %edi,-16(%ebp) +jmp .LC149 +.LC148: +pushl yyin +call _filbuf +addl $4,%esp +movl %eax,%edi +movl %edi,-16(%ebp) +.LC149: +movl -16(%ebp),%edi +movl %edi,-12(%ebp) +.LC147: +movl -12(%ebp),%edi +movl %edi,yytchar +cmpl $10,%edi +jne .LC144 +incl yylineno +movl yytchar,%edi +movl %edi,-8(%ebp) +jmp .LC145 +.LC144: +movl yytchar,%edi +movl %edi,-8(%ebp) +.LC145: +cmpl $-1,-8(%ebp) +jne .LC142 +movl $0,-4(%ebp) +jmp .LC143 +.LC142: +movl yytchar,%edi +movl %edi,-4(%ebp) +.LC143: +movl -4(%ebp),%eax +.LC137: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf150: +.size yyinput,.Lf150-yyinput +.globl yyoutput +.align 16 +.type yyoutput,@function +yyoutput: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl yyout,%edi +leal 4(%edi),%edi +movl (,%edi),%esi +subl $1,%esi +movl %esi,(,%edi) +cmpl $0,%esi +jl .LC153 +movl yyout,%edi +movl (,%edi),%esi +leal 1(%esi),%ebx +movl %ebx,(,%edi) +movl 20(%ebp),%edi +movl %edi,%ebx +movb %bl,(,%esi) +jmp .LC154 +.LC153: +pushl yyout +pushl 20(%ebp) +call _flsbuf +addl $8,%esp +.LC154: +mov $0,%eax +.LC151: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf155: +.size yyoutput,.Lf155-yyoutput +.globl yyunput +.align 16 +.type yyunput,@function +yyunput: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +movl 20(%ebp),%edi +movl %edi,yytchar +cmpl $10,yytchar +jne .LC157 +decl yylineno +.LC157: +movl yysptr,%edi +leal 1(%edi),%esi +movl %esi,yysptr +movl yytchar,%esi +movl %esi,%ebx +movb %bl,(,%edi) +mov $0,%eax +.LC156: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf159: +.size yyunput,.Lf159-yyunput +.globl main +.align 16 +.type main,@function +main: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +leal _iob,%edi +movl %edi,yyin +leal _iob+32,%edi +movl %edi,yyout +call yyparse +mov $0,%eax +.LC160: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf162: +.size main,.Lf162-main +.globl yyerror +.align 16 +.type yyerror,@function +yyerror: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +pushl 20(%ebp) +pushl $.LC164 +call printf +addl $8,%esp +mov $0,%eax +.LC163: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf165: +.size yyerror,.Lf165-yyerror +.data +.globl yyexca +.align 2 +.type yyexca,@object +yyexca: +.word -1 +.word 1 +.word 0 +.word -1 +.word -2 +.word 0 +.size yyexca,12 +.globl yyact +.align 2 +.type yyact,@object +yyact: +.word 12 +.word 2 +.word 9 +.word 8 +.word 17 +.word 11 +.word 25 +.word 17 +.word 15 +.word 18 +.word 16 +.word 10 +.word 18 +.word 17 +.word 15 +.word 7 +.word 16 +.word 13 +.word 18 +.word 5 +.word 3 +.word 1 +.word 0 +.word 19 +.word 20 +.word 0 +.word 0 +.word 21 +.word 22 +.word 23 +.word 24 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 6 +.word 14 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 0 +.word 4 +.word 6 +.size yyact,498 +.globl yypact +.align 2 +.type yypact,@object +yypact: +.word -1000 +.word -9 +.word -1000 +.word 5 +.word -7 +.word -59 +.word -1000 +.word -1000 +.word -1000 +.word -40 +.word -29 +.word -40 +.word -40 +.word -1000 +.word -1000 +.word -40 +.word -40 +.word -40 +.word -40 +.word -38 +.word -35 +.word -38 +.word -38 +.word -1000 +.word -1000 +.word -1000 +.size yypact,52 +.globl yypgo +.align 2 +.type yypgo,@object +yypgo: +.word 0 +.word 21 +.word 20 +.word 17 +.word 11 +.size yypgo,10 +.globl yyr1 +.align 2 +.type yyr1,@object +yyr1: +.word 0 +.word 1 +.word 1 +.word 1 +.word 1 +.word 2 +.word 4 +.word 4 +.word 4 +.word 4 +.word 4 +.word 4 +.word 4 +.word 4 +.word 3 +.size yyr1,30 +.globl yyr2 +.align 2 +.type yyr2,@object +yyr2: +.word 0 +.word 0 +.word 2 +.word 3 +.word 3 +.word 3 +.word 3 +.word 3 +.word 3 +.word 3 +.word 2 +.word 3 +.word 1 +.word 1 +.word 1 +.size yyr2,30 +.globl yychk +.align 2 +.type yychk,@object +yychk: +.word -1000 +.word -1 +.word 10 +.word -2 +.word 256 +.word -3 +.word 257 +.word 10 +.word 10 +.word 61 +.word -4 +.word 45 +.word 40 +.word -3 +.word 258 +.word 43 +.word 45 +.word 42 +.word 47 +.word -4 +.word -4 +.word -4 +.word -4 +.word -4 +.word -4 +.word 41 +.size yychk,52 +.globl yydef +.align 2 +.type yydef,@object +yydef: +.word 1 +.word -2 +.word 2 +.word 0 +.word 0 +.word 0 +.word 14 +.word 3 +.word 4 +.word 0 +.word 5 +.word 0 +.word 0 +.word 12 +.word 13 +.word 0 +.word 0 +.word 0 +.word 0 +.word 10 +.word 0 +.word 6 +.word 7 +.word 8 +.word 9 +.word 11 +.size yydef,52 +.globl yychar +.align 4 +.type yychar,@object +.size yychar,4 +yychar: +.long -1 +.globl yynerrs +.align 4 +.type yynerrs,@object +.size yynerrs,4 +yynerrs: +.long 0 +.globl yyerrflag +.align 2 +.type yyerrflag,@object +.size yyerrflag,2 +yyerrflag: +.word 0 +.globl yyparse +.text +.align 16 +.type yyparse,@function +yyparse: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +subl $336,%esp +movw $0,-8(%ebp) +movl $-1,yychar +movl $0,yynerrs +movw $0,yyerrflag +leal -330(%ebp),%edi +movl %edi,-12(%ebp) +leal yyv-4,%edi +movl %edi,-20(%ebp) +.LC169: +movl -12(%ebp),%edi +leal 2(%edi),%edi +movl %edi,-12(%ebp) +leal -30(%ebp),%esi +cmpl %esi,%edi +jbe .LC170 +pushl $.LC173 +call yyerror +addl $4,%esp +mov $1,%eax +jmp .LC166 +.LC170: +movl -12(%ebp),%edi +movw -8(%ebp),%si +movw %si,(,%edi) +movl -20(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-20(%ebp) +movl -20(%ebp),%edi +movl yyval,%esi +movl %esi,(,%edi) +.LC174: +movswl -8(%ebp),%edi +movw yypact(,%edi,2),%di +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $-1000,%edi +jg .LC175 +jmp .LC177 +.LC175: +cmpl $0,yychar +jge .LC178 +call yylex +movl %eax,yychar +cmpl $0,%eax +jge .LC180 +movl $0,yychar +.LC180: +.LC178: +movswl -16(%ebp),%edi +movl yychar,%esi +leal (%esi,%edi),%edi +movw %di,-16(%ebp) +movswl %di,%edi +cmpl $0,%edi +jl .LC184 +movswl -16(%ebp),%edi +cmpl $249,%edi +jl .LC182 +.LC184: +jmp .LC177 +.LC182: +movswl -16(%ebp),%edi +movw yyact(,%edi,2),%di +movw %di,-16(%ebp) +movswl %di,%edi +movswl yychk(,%edi,2),%edi +cmpl yychar,%edi +jne .LC185 +movl $-1,yychar +movl yylval,%edi +movl %edi,yyval +movw -16(%ebp),%di +movw %di,-8(%ebp) +movswl yyerrflag,%edi +cmpl $0,%edi +jle .LC169 +movswl yyerrflag,%edi +subl $1,%edi +movw %di,yyerrflag +jmp .LC169 +.LC185: +.LC177: +movswl -8(%ebp),%edi +movw yydef(,%edi,2),%di +movw %di,-16(%ebp) +movswl %di,%edi +cmpl $-2,%edi +jne .LC189 +cmpl $0,yychar +jge .LC191 +call yylex +movl %eax,yychar +cmpl $0,%eax +jge .LC193 +movl $0,yychar +.LC193: +.LC191: +leal yyexca,%edi +movl %edi,-24(%ebp) +jmp .LC198 +.LC195: +.LC196: +movl -24(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-24(%ebp) +.LC198: +movl -24(%ebp),%edi +movswl (,%edi),%esi +cmpl $-1,%esi +jne .LC195 +movswl 2(%edi),%edi +movswl -8(%ebp),%esi +cmpl %esi,%edi +jne .LC195 +jmp .LC200 +.LC199: +movl -24(%ebp),%edi +movswl (,%edi),%edi +cmpl yychar,%edi +jne .LC202 +jmp .LC201 +.LC202: +.LC200: +movl -24(%ebp),%edi +leal 4(%edi),%edi +movl %edi,-24(%ebp) +movswl (,%edi),%edi +cmpl $0,%edi +jge .LC199 +.LC201: +movl -24(%ebp),%edi +movw 2(%edi),%di +movw %di,-16(%ebp) +movswl %di,%edi +cmpl $0,%edi +jge .LC204 +mov $0,%eax +jmp .LC166 +.LC204: +.LC189: +movswl -16(%ebp),%edi +cmpl $0,%edi +jne .LC206 +movswl yyerrflag,%edi +movl %edi,-336(%ebp) +movl -336(%ebp),%edi +cmpl $0,%edi +jl .LC208 +cmpl $3,%edi +jg .LC208 +jmp *.LC224(,%edi,4) +.data +.align 4 +.LC224: +.long .LC211 +.long .LC214 +.long .LC214 +.long .LC221 +.text +.LC211: +pushl $.LC212 +call yyerror +addl $4,%esp +.LC213: +incl yynerrs +.LC214: +movw $3,yyerrflag +jmp .LC216 +.LC215: +movl -12(%ebp),%edi +movswl (,%edi),%edi +movswl yypact(,%edi,2),%edi +leal 256(%edi),%edi +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +cmpl $0,%edi +jl .LC218 +cmpl $249,%edi +jge .LC218 +movswl yyact(,%edi,2),%edi +movswl yychk(,%edi,2),%edi +cmpl $256,%edi +jne .LC218 +movswl -16(%ebp),%edi +movw yyact(,%edi,2),%di +movw %di,-8(%ebp) +jmp .LC169 +.LC218: +movl -12(%ebp),%edi +movswl (,%edi),%esi +movw yypact(,%esi,2),%si +movw %si,-16(%ebp) +leal -2(%edi),%edi +movl %edi,-12(%ebp) +movl -20(%ebp),%edi +leal -4(%edi),%edi +movl %edi,-20(%ebp) +.LC216: +movl -12(%ebp),%edi +leal -328(%ebp),%esi +cmpl %esi,%edi +jae .LC215 +.LC220: +mov $1,%eax +jmp .LC166 +.LC221: +cmpl $0,yychar +jne .LC222 +jmp .LC220 +.LC222: +movl $-1,yychar +jmp .LC174 +.LC208: +.LC206: +movw -16(%ebp),%di +movswl %di,%esi +leal (,%esi,2),%esi +leal yyr2(%esi),%ebx +movl -12(%ebp),%edx +movswl (,%ebx),%ecx +leal (,%ecx,2),%ecx +subl %ecx,%edx +movl %edx,-12(%ebp) +movl -20(%ebp),%edx +movl %edx,-4(%ebp) +movswl (,%ebx),%ebx +leal (,%ebx,4),%ebx +subl %ebx,%edx +movl %edx,-20(%ebp) +movl -20(%ebp),%ebx +movl 4(%ebx),%ebx +movl %ebx,yyval +movw %di,-332(%ebp) +movw yyr1(%esi),%di +movw %di,-16(%ebp) +movswl -16(%ebp),%edi +movswl yypgo(,%edi,2),%edi +movl -12(%ebp),%esi +movswl (,%esi),%esi +leal (%esi,%edi),%edi +leal 1(%edi),%edi +movw %di,-28(%ebp) +movswl -28(%ebp),%edi +cmpl $249,%edi +jge .LC227 +movw yyact(,%edi,2),%di +movw %di,-8(%ebp) +movswl %di,%edi +movswl yychk(,%edi,2),%edi +movswl -16(%ebp),%esi +negl %esi +cmpl %esi,%edi +je .LC225 +.LC227: +movswl -16(%ebp),%edi +movswl yypgo(,%edi,2),%edi +movw yyact(,%edi,2),%di +movw %di,-8(%ebp) +.LC225: +movswl -332(%ebp),%edi +movl %edi,-336(%ebp) +movl -336(%ebp),%edi +cmpl $4,%edi +jl .LC169 +cmpl $14,%edi +jg .LC169 +jmp *.LC249-16(,%edi,4) +.data +.align 4 +.LC249: +.long .LC231 +.long .LC232 +.long .LC234 +.long .LC236 +.long .LC238 +.long .LC240 +.long .LC242 +.long .LC169 +.long .LC244 +.long .LC246 +.long .LC248 +.text +.LC231: +movw $0,yyerrflag +jmp .LC169 +.LC232: +pushl $.LC233 +call printf +addl $4,%esp +jmp .LC169 +.LC234: +pushl $.LC235 +call printf +addl $4,%esp +jmp .LC169 +.LC236: +pushl $.LC237 +call printf +addl $4,%esp +jmp .LC169 +.LC238: +pushl $.LC239 +call printf +addl $4,%esp +jmp .LC169 +.LC240: +pushl $.LC241 +call printf +addl $4,%esp +jmp .LC169 +.LC242: +pushl $.LC243 +call printf +addl $4,%esp +jmp .LC169 +.LC244: +pushl $.LC245 +call printf +addl $4,%esp +jmp .LC169 +.LC246: +pushl $yytext +pushl $.LC247 +call printf +addl $8,%esp +jmp .LC169 +.LC248: +pushl $yytext +pushl $.LC164 +call printf +addl $8,%esp +jmp .LC169 +.LC166: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf251: +.size yyparse,.Lf251-yyparse +.globl yywrap +.align 16 +.type yywrap,@function +yywrap: +pushl %ebp +pushl %ebx +pushl %esi +pushl %edi +movl %esp,%ebp +mov $1,%eax +.LC252: +movl %ebp,%esp +popl %edi +popl %esi +popl %ebx +popl %ebp +ret +.Lf253: +.size yywrap,.Lf253-yywrap +.bss +.globl yyv +.align 4 +.type yyv,@object +.size yyv,600 +.comm yyv,600 +.globl yyfnd +.align 4 +.type yyfnd,@object +.size yyfnd,4 +.comm yyfnd,4 +.globl yyolsp +.align 4 +.type yyolsp,@object +.size yyolsp,4 +.comm yyolsp,4 +.globl yylsp +.align 4 +.type yylsp,@object +.size yylsp,4 +.comm yylsp,4 +.globl yylstate +.align 4 +.type yylstate,@object +.size yylstate,800 +.comm yylstate,800 +.globl yyestate +.align 4 +.type yyestate,@object +.size yyestate,4 +.comm yyestate,4 +.globl yytchar +.align 4 +.type yytchar,@object +.size yytchar,4 +.comm yytchar,4 +.globl yysbuf +.align 1 +.type yysbuf,@object +.size yysbuf,200 +.comm yysbuf,200 +.globl yymorfg +.align 4 +.type yymorfg,@object +.size yymorfg,4 +.comm yymorfg,4 +.globl yytext +.align 1 +.type yytext,@object +.size yytext,200 +.comm yytext,200 +.globl yyleng +.align 4 +.type yyleng,@object +.size yyleng,4 +.comm yyleng,4 +.globl yyval +.align 4 +.type yyval,@object +.size yyval,4 +.comm yyval,4 +.globl yylval +.align 4 +.type yylval,@object +.size yylval,4 +.comm yylval,4 +.data +.align 1 +.LC247: +.byte 112 +.byte 117 +.byte 115 +.byte 104 +.byte 32 +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC245: +.byte 108 +.byte 111 +.byte 97 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC243: +.byte 110 +.byte 101 +.byte 103 +.byte 97 +.byte 116 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC241: +.byte 100 +.byte 105 +.byte 118 +.byte 105 +.byte 100 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC239: +.byte 109 +.byte 117 +.byte 108 +.byte 116 +.byte 105 +.byte 112 +.byte 108 +.byte 121 +.byte 10 +.byte 0 +.align 1 +.LC237: +.byte 110 +.byte 101 +.byte 103 +.byte 97 +.byte 116 +.byte 101 +.byte 10 +.byte 97 +.byte 100 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC235: +.byte 97 +.byte 100 +.byte 100 +.byte 10 +.byte 0 +.align 1 +.LC233: +.byte 115 +.byte 116 +.byte 111 +.byte 114 +.byte 101 +.byte 10 +.byte 0 +.align 1 +.LC212: +.byte 115 +.byte 121 +.byte 110 +.byte 116 +.byte 97 +.byte 120 +.byte 32 +.byte 101 +.byte 114 +.byte 114 +.byte 111 +.byte 114 +.byte 0 +.align 1 +.LC173: +.byte 121 +.byte 97 +.byte 99 +.byte 99 +.byte 32 +.byte 115 +.byte 116 +.byte 97 +.byte 99 +.byte 107 +.byte 32 +.byte 111 +.byte 118 +.byte 101 +.byte 114 +.byte 102 +.byte 108 +.byte 111 +.byte 119 +.byte 0 +.align 1 +.LC164: +.byte 37 +.byte 115 +.byte 10 +.byte 0 +.align 1 +.LC16: +.byte 98 +.byte 97 +.byte 100 +.byte 32 +.byte 115 +.byte 119 +.byte 105 +.byte 116 +.byte 99 +.byte 104 +.byte 32 +.byte 121 +.byte 121 +.byte 108 +.byte 111 +.byte 111 +.byte 107 +.byte 32 +.byte 37 +.byte 100 +.byte 0 +.text +.ident "LCC: 4.1" diff --git a/src/cmd/lccom-1/tst/yacc.c b/src/cmd/lccom-1/tst/yacc.c new file mode 100644 index 0000000..caea406 --- /dev/null +++ b/src/cmd/lccom-1/tst/yacc.c @@ -0,0 +1,592 @@ +# define ID 257 +# define CON 258 +# define UNARYMINUS 259 +#define yyclearin yychar = -1 +#define yyerrok yyerrflag = 0 +extern int yychar; +extern short yyerrflag; +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 150 +#endif +#ifndef YYSTYPE +#define YYSTYPE int +#endif +YYSTYPE yylval, yyval; +# define YYERRCODE 256 + + + +#include + +# define U(x) x +# define NLSTATE yyprevious=YYNEWLINE +# define BEGIN yybgin = yysvec + 1 + +# define INITIAL 0 +# define YYLERR yysvec +# define YYSTATE (yyestate-yysvec-1) +# define YYOPTIM 1 +# define YYLMAX 200 +# define output(c) (void)putc(c,yyout) +# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) +# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} +# define yymore() (yymorfg=1) +# define ECHO fprintf(yyout, "%s",yytext) +# define REJECT { nstr = yyreject(); goto yyfussy;} +int yyleng; extern char yytext[]; +int yymorfg; +extern char *yysptr, yysbuf[]; +int yytchar; +FILE *yyin = NULL, *yyout = NULL; +extern int yylineno; +struct yysvf { + struct yywork *yystoff; + struct yysvf *yyother; + int *yystops;}; +struct yysvf *yyestate; +extern struct yysvf yysvec[], *yybgin; +# define YYNEWLINE 10 +yylex(){ +int nstr; extern int yyprevious; +while((nstr = yylook()) >= 0) +yyfussy: switch(nstr){ +case 0: +if(yywrap()) return(0); break; +case 1: + return ID; +break; +case 2: + return CON; +break; +case 3: + ; +break; +case 4: + return yytext[0]; +break; +case -1: +break; +default: +fprintf(yyout,"bad switch yylook %d",nstr); +} return(0); } +/* end of yylex */ +int yyvstop[] ={ +0, + +4, +0, + +3, +4, +0, + +2, +4, +0, + +1, +4, +0, + +2, +0, + +1, +0, +0}; +# define YYTYPE char +struct yywork { YYTYPE verify, advance; } yycrank[] ={ +0,0, 0,0, 1,3, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 1,4, 1,3, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +0,0, 1,5, 5,7, 5,7, +5,7, 5,7, 5,7, 5,7, +5,7, 5,7, 5,7, 5,7, +0,0, 0,0, 0,0, 0,0, +0,0, 0,0, 1,6, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 0,0, 0,0, 0,0, +0,0, 0,0, 0,0, 0,0, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 0,0, 0,0, +0,0, 0,0, 6,8, 0,0, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 6,8, 6,8, +6,8, 6,8, 0,0, 0,0, +0,0}; +struct yysvf yysvec[] ={ +0, 0, 0, +yycrank+-1, 0, 0, +yycrank+0, yysvec+1, 0, +yycrank+0, 0, yyvstop+1, +yycrank+0, 0, yyvstop+3, +yycrank+2, 0, yyvstop+6, +yycrank+19, 0, yyvstop+9, +yycrank+0, yysvec+5, yyvstop+12, +yycrank+0, yysvec+6, yyvstop+14, +0, 0, 0}; +struct yywork *yytop = yycrank+141; +struct yysvf *yybgin = yysvec+1; +char yymatch[] ={ +00 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , +01 ,011 ,012 ,01 ,01 ,01 ,01 ,01 , +01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , +01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , +011 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , +01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , +'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' , +'0' ,'0' ,01 ,01 ,01 ,01 ,01 ,01 , +01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , +'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , +'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , +'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,'A' , +01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , +'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , +'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' , +'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,01 , +0}; +char yyextra[] ={ +0,0,0,0,0,0,0,0, +0}; +/* ncform 4.1 83/08/11 */ + +int yylineno =1; +# define YYU(x) x +# define NLSTATE yyprevious=YYNEWLINE +char yytext[YYLMAX]; +struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; +char yysbuf[YYLMAX]; +char *yysptr = yysbuf; +int *yyfnd; +extern struct yysvf *yyestate; +int yyprevious = YYNEWLINE; +yylook(){ + register struct yysvf *yystate, **lsp; + register struct yywork *yyt; + struct yysvf *yyz; + int yych; + struct yywork *yyr; +# ifdef LEXDEBUG + int debug; +# endif + char *yylastch; + /* start off machines */ +# ifdef LEXDEBUG + debug = 0; +# endif + if (!yymorfg) + yylastch = yytext; + else { + yymorfg=0; + yylastch = yytext+yyleng; + } + for(;;){ + lsp = yylstate; + yyestate = yystate = yybgin; + if (yyprevious==YYNEWLINE) yystate++; + for (;;){ +# ifdef LEXDEBUG + if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); +# endif + yyt = yystate->yystoff; + if(yyt == yycrank){ /* may not be any transitions */ + yyz = yystate->yyother; + if(yyz == 0)break; + if(yyz->yystoff == yycrank)break; + } + *yylastch++ = yych = input(); + tryagain: +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"char "); + allprint(yych); + putchar('\n'); + } +# endif + yyr = yyt; + if ( yyt > yycrank){ + yyt = yyr + yych; + if (yyt <= yytop && yyt->verify+yysvec == yystate){ + if(yyt->advance+yysvec == YYLERR) /* error transitions */ + {unput(*--yylastch);break;} + *lsp++ = yystate = yyt->advance+yysvec; + goto contin; + } + } +# ifdef YYOPTIM + else if(yyt < yycrank) { /* r < yycrank */ + yyt = yyr = yycrank+(yycrank-yyt); +# ifdef LEXDEBUG + if(debug)fprintf(yyout,"compressed state\n"); +# endif + yyt = yyt + yych; + if(yyt <= yytop && yyt->verify+yysvec == yystate){ + if(yyt->advance+yysvec == YYLERR) /* error transitions */ + {unput(*--yylastch);break;} + *lsp++ = yystate = yyt->advance+yysvec; + goto contin; + } + yyt = yyr + YYU(yymatch[yych]); +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"try fall back character "); + allprint(YYU(yymatch[yych])); + putchar('\n'); + } +# endif + if(yyt <= yytop && yyt->verify+yysvec == yystate){ + if(yyt->advance+yysvec == YYLERR) /* error transition */ + {unput(*--yylastch);break;} + *lsp++ = yystate = yyt->advance+yysvec; + goto contin; + } + } + if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ +# ifdef LEXDEBUG + if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1); +# endif + goto tryagain; + } +# endif + else + {unput(*--yylastch);break;} + contin: +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"state %d char ",yystate-yysvec-1); + allprint(yych); + putchar('\n'); + } +# endif + ; + } +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); + allprint(yych); + putchar('\n'); + } +# endif + while (lsp-- > yylstate){ + *yylastch-- = 0; + if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){ + yyolsp = lsp; + if(yyextra[*yyfnd]){ /* must backup */ + while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){ + lsp--; + unput(*yylastch--); + } + } + yyprevious = YYU(*yylastch); + yylsp = lsp; + yyleng = yylastch-yytext+1; + yytext[yyleng] = 0; +# ifdef LEXDEBUG + if(debug){ + fprintf(yyout,"\nmatch "); + sprint(yytext); + fprintf(yyout," action %d\n",*yyfnd); + } +# endif + return(*yyfnd++); + } + unput(*yylastch); + } + if (yytext[0] == 0 /* && feof(yyin) */) + { + yysptr=yysbuf; + return(0); + } + yyprevious = yytext[0] = input(); + if (yyprevious>0) + output(yyprevious); + yylastch=yytext; +# ifdef LEXDEBUG + if(debug)putchar('\n'); +# endif + } + } +yyback(p, m) + int *p; +{ +if (p==0) return(0); +while (*p) + { + if (*p++ == m) + return(1); + } +return(0); +} + /* the following are only used in the lex library */ +yyinput(){ + return(input()); + } +yyoutput(c) + int c; { + output(c); + } +yyunput(c) + int c; { + unput(c); + } + +main() { + yyin = stdin; yyout = stdout; + yyparse(); + return 0; +} + +/* yyerror - issue error message */ +yyerror(s) char *s; { + printf("%s\n", s); +} +short yyexca[] ={ +-1, 1, + 0, -1, + -2, 0, + }; +# define YYNPROD 15 +# define YYLAST 249 +short yyact[]={ + + 12, 2, 9, 8, 17, 11, 25, 17, 15, 18, + 16, 10, 18, 17, 15, 7, 16, 13, 18, 5, + 3, 1, 0, 19, 20, 0, 0, 21, 22, 23, + 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 6, 14, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 4, 6 }; +short yypact[]={ + +-1000, -9,-1000, 5, -7, -59,-1000,-1000,-1000, -40, + -29, -40, -40,-1000,-1000, -40, -40, -40, -40, -38, + -35, -38, -38,-1000,-1000,-1000 }; +short yypgo[]={ + + 0, 21, 20, 17, 11 }; +short yyr1[]={ + + 0, 1, 1, 1, 1, 2, 4, 4, 4, 4, + 4, 4, 4, 4, 3 }; +short yyr2[]={ + + 0, 0, 2, 3, 3, 3, 3, 3, 3, 3, + 2, 3, 1, 1, 1 }; +short yychk[]={ + +-1000, -1, 10, -2, 256, -3, 257, 10, 10, 61, + -4, 45, 40, -3, 258, 43, 45, 42, 47, -4, + -4, -4, -4, -4, -4, 41 }; +short yydef[]={ + + 1, -2, 2, 0, 0, 0, 14, 3, 4, 0, + 5, 0, 0, 12, 13, 0, 0, 0, 0, 10, + 0, 6, 7, 8, 9, 11 }; +#ifndef lint +#endif + +# define YYFLAG -1000 +# define YYERROR goto yyerrlab +# define YYACCEPT return(0) +# define YYABORT return(1) + +/* parser for yacc output */ + +#ifdef YYDEBUG +int yydebug = 0; /* 1 for debugging */ +#endif +YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */ +int yychar = -1; /* current input token number */ +int yynerrs = 0; /* number of errors */ +short yyerrflag = 0; /* error recovery flag */ + +yyparse() { + + short yys[YYMAXDEPTH]; + short yyj, yym; + register YYSTYPE *yypvt; + register short yystate, *yyps, yyn; + register YYSTYPE *yypv; + register short *yyxi; + + yystate = 0; + yychar = -1; + yynerrs = 0; + yyerrflag = 0; + yyps= &yys[-1]; + yypv= &yyv[-1]; + + yystack: /* put a state and value onto the stack */ + +#ifdef YYDEBUG + if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar ); +#endif + if( ++yyps> &yys[YYMAXDEPTH-1] ) { yyerror( "yacc stack overflow" ); return(1); } + *yyps = yystate; + ++yypv; + *yypv = yyval; + + yynewstate: + + yyn = yypact[yystate]; + + if( yyn<= YYFLAG ) goto yydefault; /* simple state */ + + if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0; + if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault; + + if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */ + yychar = -1; + yyval = yylval; + yystate = yyn; + if( yyerrflag > 0 ) --yyerrflag; + goto yystack; + } + + yydefault: + /* default state action */ + + if( (yyn=yydef[yystate]) == -2 ) { + if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0; + /* look through exception table */ + + for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */ + + while( *(yyxi+=2) >= 0 ){ + if( *yyxi == yychar ) break; + } + if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */ + } + + if( yyn == 0 ){ /* error */ + /* error ... attempt to resume parsing */ + + switch( yyerrflag ){ + + case 0: /* brand new error */ + + yyerror( "syntax error" ); + yyerrlab: + ++yynerrs; + + case 1: + case 2: /* incompletely recovered error ... try again */ + + yyerrflag = 3; + + /* find a state where "error" is a legal shift action */ + + while ( yyps >= yys ) { + yyn = yypact[*yyps] + YYERRCODE; + if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){ + yystate = yyact[yyn]; /* simulate a shift of "error" */ + goto yystack; + } + yyn = yypact[*yyps]; + + /* the current yyps has no shift onn "error", pop stack */ + +#ifdef YYDEBUG + if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] ); +#endif + --yyps; + --yypv; + } + + /* there is no state on the stack with an error shift ... abort */ + + yyabort: + return(1); + + + case 3: /* no shift yet; clobber input char */ + +#ifdef YYDEBUG + if( yydebug ) printf( "error recovery discards char %d\n", yychar ); +#endif + + if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */ + yychar = -1; + goto yynewstate; /* try again in the same state */ + + } + + } + + /* reduction by production yyn */ + +#ifdef YYDEBUG + if( yydebug ) printf("reduce %d\n",yyn); +#endif + yyps -= yyr2[yyn]; + yypvt = yypv; + yypv -= yyr2[yyn]; + yyval = yypv[1]; + yym=yyn; + /* consult goto table to find next state */ + yyn = yyr1[yyn]; + yyj = yypgo[yyn] + *yyps + 1; + if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]]; + switch(yym){ + +case 4: +{ yyerrok; } break; +case 5: +{ printf("store\n"); } break; +case 6: +{ printf("add\n"); } break; +case 7: +{ printf("negate\nadd\n"); } break; +case 8: +{ printf("multiply\n"); } break; +case 9: +{ printf("divide\n"); } break; +case 10: +{ printf("negate\n"); } break; +case 12: +{ printf("load\n"); } break; +case 13: +{ printf("push %s\n", yytext); } break; +case 14: +{ printf("%s\n", yytext); } break; + } + goto yystack; /* stack new state and value */ + + } +int yywrap() { return 1; } diff --git a/src/cmd/lccom-1/types.c b/src/cmd/lccom-1/types.c new file mode 100644 index 0000000..115fa79 --- /dev/null +++ b/src/cmd/lccom-1/types.c @@ -0,0 +1,754 @@ +#include "c.h" +#include + +static Field isfield(const char *, Field); +static Type type(int, Type, int, int, void *); + +static struct entry { + struct type type; + struct entry *link; +} *typetable[128]; +static int maxlevel; + +static Symbol pointersym; + +Type chartype; /* char */ +Type doubletype; /* double */ +Type floattype; /* float */ +Type inttype; /* signed int */ +Type longdouble; /* long double */ +Type longtype; /* long */ +Type longlong; /* long long */ +Type shorttype; /* signed short int */ +Type signedchar; /* signed char */ +Type unsignedchar; /* unsigned char */ +Type unsignedlong; /* unsigned long int */ +Type unsignedlonglong; /* unsigned long long int */ +Type unsignedshort; /* unsigned short int */ +Type unsignedtype; /* unsigned int */ +Type funcptype; /* void (*)() */ +Type charptype; /* char* */ +Type voidptype; /* void* */ +Type voidtype; /* basic types: void */ +Type unsignedptr; /* unsigned type to hold void* */ +Type signedptr; /* signed type to hold void* */ +Type widechar; /* unsigned type that represents wchar_t */ + +static Type xxinit(int op, char *name, Metrics m) { + Symbol p = install(string(name), &types, GLOBAL, PERM); + Type ty = type(op, 0, m.size, m.align, p); + + assert(ty->align == 0 || ty->size%ty->align == 0); + p->type = ty; + p->addressed = m.outofline; + switch (ty->op) { + case INT: + p->u.limits.max.i = ones(8*ty->size)>>1; + p->u.limits.min.i = -p->u.limits.max.i - 1; + break; + case UNSIGNED: + p->u.limits.max.u = ones(8*ty->size); + p->u.limits.min.u = 0; + break; + case FLOAT: + if (ty->size == sizeof (float)) + p->u.limits.max.d = FLT_MAX; +#if 0 + else if (ty->size == sizeof (long double)) + p->u.limits.max.d = LDBL_MAX; +#endif + else + p->u.limits.max.d = DBL_MAX; + p->u.limits.min.d = -p->u.limits.max.d; + break; + default: assert(0); + } + return ty; +} +static Type type(int op, Type ty, int size, int align, void *sym) { + unsigned h = (op^((unsigned long)ty>>3)) +&(NELEMS(typetable)-1); + struct entry *tn; + + if (op != FUNCTION && (op != ARRAY || size > 0)) + for (tn = typetable[h]; tn; tn = tn->link) + if (tn->type.op == op && tn->type.type == ty + && tn->type.size == size && tn->type.align == align + && tn->type.u.sym == sym) + return &tn->type; + NEW0(tn, PERM); + tn->type.op = op; + tn->type.type = ty; + tn->type.size = size; + tn->type.align = align; + tn->type.u.sym = sym; + tn->link = typetable[h]; + typetable[h] = tn; + return &tn->type; +} +void type_init(int argc, char *argv[]) { + static int inited; + int i; + + if (inited) + return; + inited = 1; + if (!IR) + return; + for (i = 1; i < argc; i++) { + int size, align, outofline; + if (strncmp(argv[i], "-unsigned_char=", 15) == 0) + IR->unsigned_char = argv[i][15] - '0'; +#define xx(name) \ + else if (sscanf(argv[i], "-" #name "=%d,%d,%d", &size, &align, &outofline) == 3) { \ + IR->name.size = size; IR->name.align = align; \ + IR->name.outofline = outofline; } + xx(charmetric) + xx(shortmetric) + xx(intmetric) + xx(longmetric) + xx(longlongmetric) + xx(floatmetric) + xx(doublemetric) + xx(longdoublemetric) + xx(ptrmetric) + xx(structmetric) +#undef xx + } +#define xx(v,name,op,metrics) v=xxinit(op,name,IR->metrics) + xx(chartype, "char", IR->unsigned_char ? UNSIGNED : INT,charmetric); + xx(doubletype, "double", FLOAT, doublemetric); + xx(floattype, "float", FLOAT, floatmetric); + xx(inttype, "int", INT, intmetric); + xx(longdouble, "long double", FLOAT, longdoublemetric); + xx(longtype, "long int", INT, longmetric); + xx(longlong, "long long int", INT, longlongmetric); + xx(shorttype, "short", INT, shortmetric); + xx(signedchar, "signed char", INT, charmetric); + xx(unsignedchar, "unsigned char", UNSIGNED,charmetric); + xx(unsignedlong, "unsigned long", UNSIGNED,longmetric); + xx(unsignedshort, "unsigned short", UNSIGNED,shortmetric); + xx(unsignedtype, "unsigned int", UNSIGNED,intmetric); + xx(unsignedlonglong,"unsigned long long",UNSIGNED,longlongmetric); +#undef xx + { + Symbol p; + p = install(string("void"), &types, GLOBAL, PERM); + voidtype = type(VOID, NULL, 0, 0, p); + p->type = voidtype; + } + pointersym = install(string("T*"), &types, GLOBAL, PERM); + pointersym->addressed = IR->ptrmetric.outofline; + pointersym->u.limits.max.p = (void*)ones(8*IR->ptrmetric.size); + pointersym->u.limits.min.p = 0; + voidptype = ptr(voidtype); + funcptype = ptr(func(voidtype, NULL, 1)); + charptype = ptr(chartype); +#define xx(v,t) if (v==NULL && t->size==voidptype->size && t->align==voidptype->align) v=t + xx(unsignedptr,unsignedshort); + xx(unsignedptr,unsignedtype); + xx(unsignedptr,unsignedlong); + xx(unsignedptr,unsignedlonglong); + if (unsignedptr == NULL) + unsignedptr = type(UNSIGNED, NULL, voidptype->size, voidptype->align, voidptype->u.sym); + xx(signedptr,shorttype); + xx(signedptr,inttype); + xx(signedptr,longtype); + xx(signedptr,longlong); + if (signedptr == NULL) + signedptr = type(INT, NULL, voidptype->size, voidptype->align, voidptype->u.sym); +#undef xx + widechar = unsignedshort; + for (i = 0; i < argc; i++) { +#define xx(name,type) \ + if (strcmp(argv[i], "-wchar_t=" #name) == 0) \ + widechar = type; + xx(unsigned_char,unsignedchar) + xx(unsigned_int,unsignedtype) + xx(unsigned_short,unsignedshort) + } +#undef xx +} +void rmtypes(int lev) { + if (maxlevel >= lev) { + int i; + maxlevel = 0; + for (i = 0; i < NELEMS(typetable); i++) { + struct entry *tn, **tq = &typetable[i]; + while ((tn = *tq) != NULL) + if (tn->type.op == FUNCTION) + tq = &tn->link; + else if (tn->type.u.sym && tn->type.u.sym->scope >= lev) + *tq = tn->link; + else { + if (tn->type.u.sym && tn->type.u.sym->scope > maxlevel) + maxlevel = tn->type.u.sym->scope; + tq = &tn->link; + } + + } + } +} +Type ptr(Type ty) { + return type(POINTER, ty, IR->ptrmetric.size, + IR->ptrmetric.align, pointersym); +} +Type deref(Type ty) { + if (isptr(ty)) + ty = ty->type; + else + error("type error: %s\n", "pointer expected"); + return isenum(ty) ? unqual(ty)->type : ty; +} +Type array(Type ty, int n, int a) { + assert(ty); + if (isfunc(ty)) { + error("illegal type `array of %t'\n", ty); + return array(inttype, n, 0); + } + if (isarray(ty) && ty->size == 0) + error("missing array size\n"); + if (ty->size == 0) { + if (unqual(ty) == voidtype) + error("illegal type `array of %t'\n", ty); + else if (Aflag >= 2) + warning("declaring type array of %t' is undefined\n", ty); + + } else if (n > INT_MAX/ty->size) { + error("size of `array of %t' exceeds %d bytes\n", + ty, INT_MAX); + n = 1; + } + return type(ARRAY, ty, n*ty->size, + a ? a : ty->align, NULL); +} +Type atop(Type ty) { + if (isarray(ty)) + return ptr(ty->type); + error("type error: %s\n", "array expected"); + return ptr(ty); +} +Type qual(int op, Type ty) { + if (isarray(ty)) + ty = type(ARRAY, qual(op, ty->type), ty->size, + ty->align, NULL); + else if (isfunc(ty)) + warning("qualified function type ignored\n"); + else if ((isconst(ty) && op == CONST) + || (isvolatile(ty) && op == VOLATILE)) + error("illegal type `%k %t'\n", op, ty); + else { + if (isqual(ty)) { + op += ty->op; + ty = ty->type; + } + ty = type(op, ty, ty->size, ty->align, NULL); + } + return ty; +} +Type func(Type ty, Type *proto, int style) { + if (ty && (isarray(ty) || isfunc(ty))) + error("illegal return type `%t'\n", ty); + ty = type(FUNCTION, ty, 0, 0, NULL); + ty->u.f.proto = proto; + ty->u.f.oldstyle = style; + return ty; +} +Type freturn(Type ty) { + if (isfunc(ty)) + return ty->type; + error("type error: %s\n", "function expected"); + return inttype; +} +int variadic(Type ty) { + if (isfunc(ty) && ty->u.f.proto) { + int i; + for (i = 0; ty->u.f.proto[i]; i++) + ; + return i > 1 && ty->u.f.proto[i-1] == voidtype; + } + return 0; +} +Type newstruct(int op, char *tag) { + Symbol p; + + assert(tag); + if (*tag == 0) + tag = stringd(genlabel(1)); + else + if ((p = lookup(tag, types)) != NULL && (p->scope == level + || (p->scope == PARAM && level == PARAM+1))) { + if (p->type->op == op && !p->defined) + return p->type; + error("redefinition of `%s' previously defined at %w\n", + p->name, &p->src); + } + p = install(tag, &types, level, PERM); + p->type = type(op, NULL, 0, 0, p); + if (p->scope > maxlevel) + maxlevel = p->scope; + p->src = src; + return p->type; +} +Field newfield(char *name, Type ty, Type fty) { + Field p, *q = &ty->u.sym->u.s.flist; + + if (name == NULL) + name = stringd(genlabel(1)); + for (p = *q; p; q = &p->link, p = *q) + if (p->name == name) + error("duplicate field name `%s' in `%t'\n", + name, ty); + NEW0(p, PERM); + *q = p; + p->name = name; + p->type = fty; + if (xref) { /* omit */ + if (ty->u.sym->u.s.ftab == NULL) /* omit */ + ty->u.sym->u.s.ftab = table(NULL, level); /* omit */ + install(name, &ty->u.sym->u.s.ftab, 0, PERM)->src = src;/* omit */ + } /* omit */ + return p; +} +int eqtype(Type ty1, Type ty2, int ret) { + if (ty1 == ty2) + return 1; + if (ty1->op != ty2->op) + return 0; + switch (ty1->op) { + case ENUM: case UNION: case STRUCT: + case UNSIGNED: case INT: case FLOAT: + return 0; + case POINTER: return eqtype(ty1->type, ty2->type, 1); + case VOLATILE: case CONST+VOLATILE: + case CONST: return eqtype(ty1->type, ty2->type, 1); + case ARRAY: if (eqtype(ty1->type, ty2->type, 1)) { + if (ty1->size == ty2->size) + return 1; + if (ty1->size == 0 || ty2->size == 0) + return ret; + } + return 0; + case FUNCTION: if (eqtype(ty1->type, ty2->type, 1)) { + Type *p1 = ty1->u.f.proto, *p2 = ty2->u.f.proto; + if (p1 == p2) + return 1; + if (p1 && p2) { + for ( ; *p1 && *p2; p1++, p2++) + if (eqtype(unqual(*p1), unqual(*p2), 1) == 0) + return 0; + if (*p1 == NULL && *p2 == NULL) + return 1; + } else { + if (variadic(p1 ? ty1 : ty2)) + return 0; + if (p1 == NULL) + p1 = p2; + for ( ; *p1; p1++) { + Type ty = unqual(*p1); + if (promote(ty) != (isenum(ty) ? ty->type : ty)) + return 0; + } + return 1; + } + } + return 0; + } + assert(0); return 0; +} +Type promote(Type ty) { + ty = unqual(ty); + switch (ty->op) { + case ENUM: + return inttype; + case INT: + if (ty->size < inttype->size) + return inttype; + break; + case UNSIGNED: + if (ty->size < inttype->size) + return inttype; + if (ty->size < unsignedtype->size) + return unsignedtype; + break; + case FLOAT: + if (ty->size < doubletype->size) + return doubletype; + } + return ty; +} +Type signedint(Type ty) { + if (ty->op == INT) + return ty; + assert(ty->op == UNSIGNED); +#define xx(t) if (ty->size == t->size) return t + xx(inttype); + xx(longtype); + xx(longlong); +#undef xx + assert(0); return NULL; +} +Type compose(Type ty1, Type ty2) { + if (ty1 == ty2) + return ty1; + assert(ty1->op == ty2->op); + switch (ty1->op) { + case POINTER: + return ptr(compose(ty1->type, ty2->type)); + case CONST+VOLATILE: + return qual(CONST, qual(VOLATILE, + compose(ty1->type, ty2->type))); + case CONST: case VOLATILE: + return qual(ty1->op, compose(ty1->type, ty2->type)); + case ARRAY: { Type ty = compose(ty1->type, ty2->type); + if (ty1->size && ((ty1->type->size && ty2->size == 0) || ty1->size == ty2->size)) + return array(ty, ty1->size/ty1->type->size, ty1->align); + if (ty2->size && ty2->type->size && ty1->size == 0) + return array(ty, ty2->size/ty2->type->size, ty2->align); + return array(ty, 0, 0); } + case FUNCTION: { Type *p1 = ty1->u.f.proto, *p2 = ty2->u.f.proto; + Type ty = compose(ty1->type, ty2->type); + List tlist = NULL; + if (p1 == NULL && p2 == NULL) + return func(ty, NULL, 1); + if (p1 && p2 == NULL) + return func(ty, p1, ty1->u.f.oldstyle); + if (p2 && p1 == NULL) + return func(ty, p2, ty2->u.f.oldstyle); + for ( ; *p1 && *p2; p1++, p2++) { + Type ty = compose(unqual(*p1), unqual(*p2)); + if (isconst(*p1) || isconst(*p2)) + ty = qual(CONST, ty); + if (isvolatile(*p1) || isvolatile(*p2)) + ty = qual(VOLATILE, ty); + tlist = append(ty, tlist); + } + assert(*p1 == NULL && *p2 == NULL); + return func(ty, ltov(&tlist, PERM), 0); } + } + assert(0); return NULL; +} +int ttob(Type ty) { + switch (ty->op) { + case CONST: case VOLATILE: case CONST+VOLATILE: + return ttob(ty->type); + case VOID: case INT: case UNSIGNED: case FLOAT: + return ty->op + sizeop(ty->size); + case POINTER: + return POINTER + sizeop(voidptype->size); + case FUNCTION: + return POINTER + sizeop(funcptype->size); + case ARRAY: case STRUCT: case UNION: + return STRUCT; + case ENUM: + return INT + sizeop(inttype->size); + } + assert(0); return INT; +} +Type btot(int op, int size) { +#define xx(ty) if (size == (ty)->size) return ty; + switch (optype(op)) { + case F: + xx(floattype); + xx(doubletype); + xx(longdouble); + assert(0); return 0; + case I: + if (chartype->op == INT) + xx(chartype); + xx(signedchar); + xx(shorttype); + xx(inttype); + xx(longtype); + xx(longlong); + assert(0); return 0; + case U: + if (chartype->op == UNSIGNED) + xx(chartype); + xx(unsignedchar); + xx(unsignedshort); + xx(unsignedtype); + xx(unsignedlong); + xx(unsignedlonglong); + assert(0); return 0; + case P: + xx(voidptype); + xx(funcptype); + assert(0); return 0; + } +#undef xx + assert(0); return 0; +} +int hasproto(Type ty) { + if (ty == 0) + return 1; + switch (ty->op) { + case CONST: case VOLATILE: case CONST+VOLATILE: case POINTER: + case ARRAY: + return hasproto(ty->type); + case FUNCTION: + return hasproto(ty->type) && ty->u.f.proto; + case STRUCT: case UNION: + case VOID: case FLOAT: case ENUM: case INT: case UNSIGNED: + return 1; + } + assert(0); return 0; +} +/* fieldlist - construct a flat list of fields in type ty */ +Field fieldlist(Type ty) { + return ty->u.sym->u.s.flist; +} + +/* fieldref - find field name of type ty, return entry */ +Field fieldref(const char *name, Type ty) { + Field p = isfield(name, unqual(ty)->u.sym->u.s.flist); + + if (p && xref) { + Symbol q; + assert(unqual(ty)->u.sym->u.s.ftab); + q = lookup(name, unqual(ty)->u.sym->u.s.ftab); + assert(q); + use(q, src); + } + return p; +} + +/* ftype - return a function type for rty function (ty,...)' */ +Type ftype(Type rty, ...) { + va_list ap; + Type ty = NULL; + List list = NULL; + + va_start(ap, rty); + ty = va_arg(ap, Type); + for ( ; ty != NULL; ty = va_arg(ap, Type)) + list = append(ty, list); + va_end(ap); + return func(rty, ltov(&list, PERM), 0); +} + +/* isfield - if name is a field in flist, return pointer to the field structure */ +static Field isfield(const char *name, Field flist) { + for ( ; flist; flist = flist->link) + if (flist->name == name) + break; + return flist; +} + +/* outtype - output type ty */ +void outtype(Type ty, FILE *f) { + switch (ty->op) { + case CONST+VOLATILE: case CONST: case VOLATILE: + fprint(f, "%k %t", ty->op, ty->type); + break; + case STRUCT: case UNION: case ENUM: + assert(ty->u.sym); + if (ty->size == 0) + fprint(f, "incomplete "); + assert(ty->u.sym->name); + if (*ty->u.sym->name >= '1' && *ty->u.sym->name <= '9') { + Symbol p = findtype(ty); + if (p == 0) + fprint(f, "%k defined at %w", ty->op, &ty->u.sym->src); + else + fprint(f, p->name); + } else { + fprint(f, "%k %s", ty->op, ty->u.sym->name); + if (ty->size == 0) + fprint(f, " defined at %w", &ty->u.sym->src); + } + break; + case VOID: case FLOAT: case INT: case UNSIGNED: + fprint(f, ty->u.sym->name); + break; + case POINTER: + fprint(f, "pointer to %t", ty->type); + break; + case FUNCTION: + fprint(f, "%t function", ty->type); + if (ty->u.f.proto && ty->u.f.proto[0]) { + int i; + fprint(f, "(%t", ty->u.f.proto[0]); + for (i = 1; ty->u.f.proto[i]; i++) + if (ty->u.f.proto[i] == voidtype) + fprint(f, ",..."); + else + fprint(f, ",%t", ty->u.f.proto[i]); + fprint(f, ")"); + } else if (ty->u.f.proto && ty->u.f.proto[0] == 0) + fprint(f, "(void)"); + + break; + case ARRAY: + if (ty->size > 0 && ty->type && ty->type->size > 0) { + fprint(f, "array %d", ty->size/ty->type->size); + while (ty->type && isarray(ty->type) && ty->type->type->size > 0) { + ty = ty->type; + fprint(f, ",%d", ty->size/ty->type->size); + } + } else + fprint(f, "incomplete array"); + if (ty->type) + fprint(f, " of %t", ty->type); + break; + default: assert(0); + } +} + +/* printdecl - output a C declaration for symbol p of type ty */ +void printdecl(Symbol p, Type ty) { + switch (p->sclass) { + case AUTO: + fprint(stderr, "%s;\n", typestring(ty, p->name)); + break; + case STATIC: case EXTERN: + fprint(stderr, "%k %s;\n", p->sclass, typestring(ty, p->name)); + break; + case TYPEDEF: case ENUM: + break; + default: assert(0); + } +} + +/* printproto - output a prototype declaration for function p */ +void printproto(Symbol p, Symbol callee[]) { + if (p->type->u.f.proto) + printdecl(p, p->type); + else { + int i; + List list = 0; + if (callee[0] == 0) + list = append(voidtype, list); + else + for (i = 0; callee[i]; i++) + list = append(callee[i]->type, list); + printdecl(p, func(freturn(p->type), ltov(&list, PERM), 0)); + } +} + +/* prtype - print details of type ty on f with given indent */ +static void prtype(Type ty, FILE *f, int indent, unsigned mark) { + switch (ty->op) { + default: + fprint(f, "(%d %d %d [%p])", ty->op, ty->size, ty->align, ty->u.sym); + break; + case FLOAT: case INT: case UNSIGNED: case VOID: + fprint(f, "(%k %d %d [\"%s\"])", ty->op, ty->size, ty->align, ty->u.sym->name); + break; + case CONST+VOLATILE: case CONST: case VOLATILE: case POINTER: case ARRAY: + fprint(f, "(%k %d %d ", ty->op, ty->size, ty->align); + prtype(ty->type, f, indent+1, mark); + fprint(f, ")"); + break; + case STRUCT: case UNION: + fprint(f, "(%k %d %d [\"%s\"]", ty->op, ty->size, ty->align, ty->u.sym->name); + if (ty->x.marked != mark) { + Field p; + ty->x.marked = mark; + for (p = ty->u.sym->u.s.flist; p; p = p->link) { + fprint(f, "\n%I", indent+1); + prtype(p->type, f, indent+1, mark); + fprint(f, " %s@%d", p->name, p->offset); + if (p->lsb) + fprint(f, ":%d..%d", + fieldsize(p) + fieldright(p), fieldright(p)); + } + fprint(f, "\n%I", indent); + } + fprint(f, ")"); + break; + case ENUM: + fprint(f, "(%k %d %d [\"%s\"]", ty->op, ty->size, ty->align, ty->u.sym->name); + if (ty->x.marked != mark) { + int i; + Symbol *p = ty->u.sym->u.idlist; + ty->x.marked = mark; + for (i = 0; p[i] != NULL; i++) + fprint(f, "%I%s=%d\n", indent+1, p[i]->name, p[i]->u.value); + } + fprint(f, ")"); + break; + case FUNCTION: + fprint(f, "(%k %d %d ", ty->op, ty->size, ty->align); + prtype(ty->type, f, indent+1, mark); + if (ty->u.f.proto) { + int i; + fprint(f, "\n%I{", indent+1); + for (i = 0; ty->u.f.proto[i]; i++) { + if (i > 0) + fprint(f, "%I", indent+2); + prtype(ty->u.f.proto[i], f, indent+2, mark); + fprint(f, "\n"); + } + fprint(f, "%I}", indent+1); + } + fprint(f, ")"); + break; + } +} + +/* printtype - print details of type ty on fd */ +void printtype(Type ty, int fd) { + static unsigned mark; + prtype(ty, fd == 1 ? stdout : stderr, 0, ++mark); + fprint(fd == 1 ? stdout : stderr, "\n"); +} + +/* typestring - return ty as C declaration for str, which may be "" */ +char *typestring(Type ty, char *str) { + for ( ; ty; ty = ty->type) { + Symbol p; + switch (ty->op) { + case CONST+VOLATILE: case CONST: case VOLATILE: + if (isptr(ty->type)) + str = stringf("%k %s", ty->op, str); + else + return stringf("%k %s", ty->op, typestring(ty->type, str)); + break; + case STRUCT: case UNION: case ENUM: + assert(ty->u.sym); + if ((p = findtype(ty)) != NULL) + return *str ? stringf("%s %s", p->name, str) : p->name; + if (*ty->u.sym->name >= '1' && *ty->u.sym->name <= '9') + warning("unnamed %k in prototype\n", ty->op); + if (*str) + return stringf("%k %s %s", ty->op, ty->u.sym->name, str); + else + return stringf("%k %s", ty->op, ty->u.sym->name); + case VOID: case FLOAT: case INT: case UNSIGNED: + return *str ? stringf("%s %s", ty->u.sym->name, str) : ty->u.sym->name; + case POINTER: + if (!ischar(ty->type) && (p = findtype(ty)) != NULL) + return *str ? stringf("%s %s", p->name, str) : p->name; + str = stringf(isarray(ty->type) || isfunc(ty->type) ? "(*%s)" : "*%s", str); + break; + case FUNCTION: + if ((p = findtype(ty)) != NULL) + return *str ? stringf("%s %s", p->name, str) : p->name; + if (ty->u.f.proto == 0) + str = stringf("%s()", str); + else if (ty->u.f.proto[0]) { + int i; + str = stringf("%s(%s", str, typestring(ty->u.f.proto[0], "")); + for (i = 1; ty->u.f.proto[i]; i++) + if (ty->u.f.proto[i] == voidtype) + str = stringf("%s, ...", str); + else + str = stringf("%s, %s", str, typestring(ty->u.f.proto[i], "")); + str = stringf("%s)", str); + } else + str = stringf("%s(void)", str); + break; + case ARRAY: + if ((p = findtype(ty)) != NULL) + return *str ? stringf("%s %s", p->name, str) : p->name; + if (ty->type && ty->type->size > 0) + str = stringf("%s[%d]", str, ty->size/ty->type->size); + else + str = stringf("%s[]", str); + break; + default: assert(0); + } + } + assert(0); return 0; +} diff --git a/sys/pic32/ubw32-uart-sdramswap/using-bootloader.ld b/src/cmd/lccom-1/using-bootloader.ld similarity index 77% rename from sys/pic32/ubw32-uart-sdramswap/using-bootloader.ld rename to src/cmd/lccom-1/using-bootloader.ld index f14906b..f91cbd6 100644 --- a/sys/pic32/ubw32-uart-sdramswap/using-bootloader.ld +++ b/src/cmd/lccom-1/using-bootloader.ld @@ -7,11 +7,8 @@ OUTPUT_ARCH(mips) ENTRY(_reset_vector_) MEMORY { - flash (rx) : ORIGIN = 0x9d005000, LENGTH = 492K - ram (rw!x): ORIGIN = 0x80000000, LENGTH = 24K - u0area (rw!x): ORIGIN = 0x80006000, LENGTH = 3K - uarea (rw!x): ORIGIN = 0x80006C00, LENGTH = 3K - keram (rwx) : ORIGIN = 0x80007800, LENGTH = 2K + flash (rx) : ORIGIN = 0x7d030000, LENGTH = 320K + ram (rw!x): ORIGIN = 0x7F008000, LENGTH = 92K /* Required by Microchip C32 linker */ kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x80000 @@ -21,24 +18,16 @@ MEMORY kseg1_data_mem (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000 } -/* higher address of the user mode stack */ -u0 = ORIGIN(u0area); -u = ORIGIN(uarea); -u_end = ORIGIN(uarea) + LENGTH(uarea); - -_keram_start = ORIGIN(keram); -_keram_end = ORIGIN(keram) + LENGTH(keram); - SECTIONS { .text ORIGIN(flash) : { /* Exception handlers. */ - *(.exception) - . = 0x1000; + *(.uflash_head) + . = 0x30; /* Execution starts here. */ - *(.startup) - *(.text .stub .text.* .gnu.linkonce.t.*) + *(.startup) + *(.text .stub .text.* .gnu.linkonce.t.* ) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) *(.glue_7t) *(.glue_7) @@ -68,7 +57,7 @@ SECTIONS { __bss_start = .; *(.dynbss) - *(.sbss) + *(.sbss .sbss.* ) *(.scommon) *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) @@ -80,21 +69,6 @@ SECTIONS __bss_end = . ; _end = .; -/* - * RAM functions go at the end of our stack and heap allocation. - * Alignment of 2K required by the boundary register (BMXDKPBA). - */ - .ramfunc : AT (LOADADDR (.data) + SIZEOF (.data)) - { - _ramfunc_begin = . ; - *(.ramfunc .ramfunc.*) - . = ALIGN(4) ; - _ramfunc_end = . ; - } >keram - _ramfunc_image_begin = LOADADDR(.ramfunc) ; - _ramfunc_length = SIZEOF(.ramfunc) ; - - /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } diff --git a/src/cmd/lccom-1/x86.md b/src/cmd/lccom-1/x86.md new file mode 100644 index 0000000..1e134b2 --- /dev/null +++ b/src/cmd/lccom-1/x86.md @@ -0,0 +1,1011 @@ +%{ +enum { EAX=0, ECX=1, EDX=2, EBX=3, ESI=6, EDI=7 }; +#include "c.h" +#define NODEPTR_TYPE Node +#define OP_LABEL(p) ((p)->op) +#define LEFT_CHILD(p) ((p)->kids[0]) +#define RIGHT_CHILD(p) ((p)->kids[1]) +#define STATE_LABEL(p) ((p)->x.state) +static void address(Symbol, Symbol, long); +static void blkfetch(int, int, int, int); +static void blkloop(int, int, int, int, int, int[]); +static void blkstore(int, int, int, int); +static void defaddress(Symbol); +static void defconst(int, int, Value); +static void defstring(int, char *); +static void defsymbol(Symbol); +static void doarg(Node); +static void emit2(Node); +static void export(Symbol); +static void clobber(Node); +static void function(Symbol, Symbol [], Symbol [], int); +static void global(Symbol); +static void import(Symbol); +static void local(Symbol); +static void progbeg(int, char **); +static void progend(void); +static void segment(int); +static void space(int); +static void target(Node); +extern int ckstack(Node, int); +extern int memop(Node); +extern int sametree(Node, Node); +static Symbol charreg[32], shortreg[32], intreg[32]; +static Symbol fltreg[32]; + +static Symbol charregw, shortregw, intregw, fltregw; + +static int cseg; + +static Symbol quo, rem; + +%} +%start stmt +%term CNSTF4=4113 +%term CNSTF8=8209 +%term CNSTF16=16401 +%term CNSTI1=1045 +%term CNSTI2=2069 +%term CNSTI4=4117 +%term CNSTI8=8213 +%term CNSTP4=4119 +%term CNSTP8=8215 +%term CNSTU1=1046 +%term CNSTU2=2070 +%term CNSTU4=4118 +%term CNSTU8=8214 + +%term ARGB=41 +%term ARGF4=4129 +%term ARGF8=8225 +%term ARGF16=16417 +%term ARGI4=4133 +%term ARGI8=8229 +%term ARGP4=4135 +%term ARGP8=8231 +%term ARGU4=4134 +%term ARGU8=8230 + +%term ASGNB=57 +%term ASGNF4=4145 +%term ASGNF8=8241 +%term ASGNF16=16433 +%term ASGNI1=1077 +%term ASGNI2=2101 +%term ASGNI4=4149 +%term ASGNI8=8245 +%term ASGNP4=4151 +%term ASGNP8=8247 +%term ASGNU1=1078 +%term ASGNU2=2102 +%term ASGNU4=4150 +%term ASGNU8=8246 + +%term INDIRB=73 +%term INDIRF4=4161 +%term INDIRF8=8257 +%term INDIRF16=16449 +%term INDIRI1=1093 +%term INDIRI2=2117 +%term INDIRI4=4165 +%term INDIRI8=8261 +%term INDIRP4=4167 +%term INDIRP8=8263 +%term INDIRU1=1094 +%term INDIRU2=2118 +%term INDIRU4=4166 +%term INDIRU8=8262 + +%term CVFF4=4209 +%term CVFF8=8305 +%term CVFF16=16497 +%term CVFI4=4213 +%term CVFI8=8309 + +%term CVIF4=4225 +%term CVIF8=8321 +%term CVIF16=16513 +%term CVII1=1157 +%term CVII2=2181 +%term CVII4=4229 +%term CVII8=8325 +%term CVIU1=1158 +%term CVIU2=2182 +%term CVIU4=4230 +%term CVIU8=8326 + +%term CVPP4=4247 +%term CVPP8=8343 +%term CVPP16=16535 +%term CVPU4=4246 +%term CVPU8=8342 + +%term CVUI1=1205 +%term CVUI2=2229 +%term CVUI4=4277 +%term CVUI8=8373 +%term CVUP4=4279 +%term CVUP8=8375 +%term CVUP16=16567 +%term CVUU1=1206 +%term CVUU2=2230 +%term CVUU4=4278 +%term CVUU8=8374 + +%term NEGF4=4289 +%term NEGF8=8385 +%term NEGF16=16577 +%term NEGI4=4293 +%term NEGI8=8389 + +%term CALLB=217 +%term CALLF4=4305 +%term CALLF8=8401 +%term CALLF16=16593 +%term CALLI4=4309 +%term CALLI8=8405 +%term CALLP4=4311 +%term CALLP8=8407 +%term CALLU4=4310 +%term CALLU8=8406 +%term CALLV=216 + +%term RETF4=4337 +%term RETF8=8433 +%term RETF16=16625 +%term RETI4=4341 +%term RETI8=8437 +%term RETP4=4343 +%term RETP8=8439 +%term RETU4=4342 +%term RETU8=8438 +%term RETV=248 + +%term ADDRGP4=4359 +%term ADDRGP8=8455 + +%term ADDRFP4=4375 +%term ADDRFP8=8471 + +%term ADDRLP4=4391 +%term ADDRLP8=8487 + +%term ADDF4=4401 +%term ADDF8=8497 +%term ADDF16=16689 +%term ADDI4=4405 +%term ADDI8=8501 +%term ADDP4=4407 +%term ADDP8=8503 +%term ADDU4=4406 +%term ADDU8=8502 + +%term SUBF4=4417 +%term SUBF8=8513 +%term SUBF16=16705 +%term SUBI4=4421 +%term SUBI8=8517 +%term SUBP4=4423 +%term SUBP8=8519 +%term SUBU4=4422 +%term SUBU8=8518 + +%term LSHI4=4437 +%term LSHI8=8533 +%term LSHU4=4438 +%term LSHU8=8534 + +%term MODI4=4453 +%term MODI8=8549 +%term MODU4=4454 +%term MODU8=8550 + +%term RSHI4=4469 +%term RSHI8=8565 +%term RSHU4=4470 +%term RSHU8=8566 + +%term BANDI4=4485 +%term BANDI8=8581 +%term BANDU4=4486 +%term BANDU8=8582 + +%term BCOMI4=4501 +%term BCOMI8=8597 +%term BCOMU4=4502 +%term BCOMU8=8598 + +%term BORI4=4517 +%term BORI8=8613 +%term BORU4=4518 +%term BORU8=8614 + +%term BXORI4=4533 +%term BXORI8=8629 +%term BXORU4=4534 +%term BXORU8=8630 + +%term DIVF4=4545 +%term DIVF8=8641 +%term DIVF16=16833 +%term DIVI4=4549 +%term DIVI8=8645 +%term DIVU4=4550 +%term DIVU8=8646 + +%term MULF4=4561 +%term MULF8=8657 +%term MULF16=16849 +%term MULI4=4565 +%term MULI8=8661 +%term MULU4=4566 +%term MULU8=8662 + +%term EQF4=4577 +%term EQF8=8673 +%term EQF16=16865 +%term EQI4=4581 +%term EQI8=8677 +%term EQU4=4582 +%term EQU8=8678 + +%term GEF4=4593 +%term GEF8=8689 +%term GEI4=4597 +%term GEI8=8693 +%term GEI16=16885 +%term GEU4=4598 +%term GEU8=8694 + +%term GTF4=4609 +%term GTF8=8705 +%term GTF16=16897 +%term GTI4=4613 +%term GTI8=8709 +%term GTU4=4614 +%term GTU8=8710 + +%term LEF4=4625 +%term LEF8=8721 +%term LEF16=16913 +%term LEI4=4629 +%term LEI8=8725 +%term LEU4=4630 +%term LEU8=8726 + +%term LTF4=4641 +%term LTF8=8737 +%term LTF16=16929 +%term LTI4=4645 +%term LTI8=8741 +%term LTU4=4646 +%term LTU8=8742 + +%term NEF4=4657 +%term NEF8=8753 +%term NEF16=16945 +%term NEI4=4661 +%term NEI8=8757 +%term NEU4=4662 +%term NEU8=8758 + +%term JUMPV=584 + +%term LABELV=600 + +%term LOADB=233 +%term LOADF4=4321 +%term LOADF8=8417 +%term LOADF16=16609 +%term LOADI1=1253 +%term LOADI2=2277 +%term LOADI4=4325 +%term LOADI8=8421 +%term LOADP4=4327 +%term LOADP8=8423 +%term LOADU1=1254 +%term LOADU2=2278 +%term LOADU4=4326 +%term LOADU8=8422 + +%term VREGP=711 +%% +reg: INDIRI1(VREGP) "# read register\n" +reg: INDIRU1(VREGP) "# read register\n" + +reg: INDIRI2(VREGP) "# read register\n" +reg: INDIRU2(VREGP) "# read register\n" + +reg: INDIRF4(VREGP) "# read register\n" +reg: INDIRI4(VREGP) "# read register\n" +reg: INDIRP4(VREGP) "# read register\n" +reg: INDIRU4(VREGP) "# read register\n" + +reg: INDIRF8(VREGP) "# read register\n" +reg: INDIRI8(VREGP) "# read register\n" +reg: INDIRP8(VREGP) "# read register\n" +reg: INDIRU8(VREGP) "# read register\n" + +stmt: ASGNI1(VREGP,reg) "# write register\n" +stmt: ASGNU1(VREGP,reg) "# write register\n" + +stmt: ASGNI2(VREGP,reg) "# write register\n" +stmt: ASGNU2(VREGP,reg) "# write register\n" + +stmt: ASGNF4(VREGP,reg) "# write register\n" +stmt: ASGNI4(VREGP,reg) "# write register\n" +stmt: ASGNP4(VREGP,reg) "# write register\n" +stmt: ASGNU4(VREGP,reg) "# write register\n" + +stmt: ASGNF8(VREGP,reg) "# write register\n" +stmt: ASGNI8(VREGP,reg) "# write register\n" +stmt: ASGNP8(VREGP,reg) "# write register\n" +stmt: ASGNU8(VREGP,reg) "# write register\n" +con: CNSTI1 "%a" +con: CNSTU1 "%a" + +con: CNSTI2 "%a" +con: CNSTU2 "%a" + +con: CNSTI4 "%a" +con: CNSTU4 "%a" +con: CNSTP4 "%a" + +con: CNSTI8 "%a" +con: CNSTU8 "%a" +con: CNSTP8 "%a" +stmt: reg "" +acon: ADDRGP4 "(%a)" +acon: con "(%0)" +base: ADDRGP4 "(%a)" +base: reg "[%0]" +base: ADDI4(reg,acon) "%1[%0]" +base: ADDP4(reg,acon) "%1[%0]" +base: ADDU4(reg,acon) "%1[%0]" +base: ADDRFP4 "(%a)[ebp]" +base: ADDRLP4 "(%a)[ebp]" +index: reg "%0" +index: LSHI4(reg,con1) "%0*2" +index: LSHI4(reg,con2) "%0*4" +index: LSHI4(reg,con3) "%0*8" + +con1: CNSTI4 "1" range(a, 1, 1) +con1: CNSTU4 "1" range(a, 1, 1) +con2: CNSTI4 "2" range(a, 2, 2) +con2: CNSTU4 "2" range(a, 2, 2) +con3: CNSTI4 "3" range(a, 3, 3) +con3: CNSTU4 "3" range(a, 3, 3) +index: LSHU4(reg,con1) "%0*2" +index: LSHU4(reg,con2) "%0*4" +index: LSHU4(reg,con3) "%0*8" +addr: base "%0" +addr: ADDI4(index,base) "%1[%0]" +addr: ADDP4(index,base) "%1[%0]" +addr: ADDU4(index,base) "%1[%0]" +addr: index "[%0]" +mem: INDIRI1(addr) "byte ptr %0" +mem: INDIRI2(addr) "word ptr %0" +mem: INDIRI4(addr) "dword ptr %0" +mem: INDIRU1(addr) "byte ptr %0" +mem: INDIRU2(addr) "word ptr %0" +mem: INDIRU4(addr) "dword ptr %0" +mem: INDIRP4(addr) "dword ptr %0" +rc: reg "%0" +rc: con "%0" + +mr: reg "%0" +mr: mem "%0" + +mrc0: mem "%0" +mrc0: rc "%0" +mrc1: mem "%0" 1 +mrc1: rc "%0" + +mrc3: mem "%0" 3 +mrc3: rc "%0" +reg: addr "lea %c,%0\n" 1 +reg: mrc0 "mov %c,%0\n" 1 +reg: LOADI1(reg) "# move\n" 1 +reg: LOADI2(reg) "# move\n" 1 +reg: LOADI4(reg) "# move\n" move(a) +reg: LOADU1(reg) "# move\n" 1 +reg: LOADU2(reg) "# move\n" 1 +reg: LOADU4(reg) "# move\n" move(a) +reg: LOADP4(reg) "# move\n" move(a) +reg: ADDI4(reg,mrc1) "?mov %c,%0\nadd %c,%1\n" 1 +reg: ADDP4(reg,mrc1) "?mov %c,%0\nadd %c,%1\n" 1 +reg: ADDU4(reg,mrc1) "?mov %c,%0\nadd %c,%1\n" 1 +reg: SUBI4(reg,mrc1) "?mov %c,%0\nsub %c,%1\n" 1 +reg: SUBP4(reg,mrc1) "?mov %c,%0\nsub %c,%1\n" 1 +reg: SUBU4(reg,mrc1) "?mov %c,%0\nsub %c,%1\n" 1 +reg: BANDI4(reg,mrc1) "?mov %c,%0\nand %c,%1\n" 1 +reg: BORI4(reg,mrc1) "?mov %c,%0\nor %c,%1\n" 1 +reg: BXORI4(reg,mrc1) "?mov %c,%0\nxor %c,%1\n" 1 +reg: BANDU4(reg,mrc1) "?mov %c,%0\nand %c,%1\n" 1 +reg: BORU4(reg,mrc1) "?mov %c,%0\nor %c,%1\n" 1 +reg: BXORU4(reg,mrc1) "?mov %c,%0\nxor %c,%1\n" 1 +stmt: ASGNI4(addr,ADDI4(mem,con1)) "inc %1\n" memop(a) +stmt: ASGNI4(addr,ADDU4(mem,con1)) "inc %1\n" memop(a) +stmt: ASGNP4(addr,ADDP4(mem,con1)) "inc %1\n" memop(a) +stmt: ASGNI4(addr,SUBI4(mem,con1)) "dec %1\n" memop(a) +stmt: ASGNI4(addr,SUBU4(mem,con1)) "dec %1\n" memop(a) +stmt: ASGNP4(addr,SUBP4(mem,con1)) "dec %1\n" memop(a) +stmt: ASGNI4(addr,ADDI4(mem,rc)) "add %1,%2\n" memop(a) +stmt: ASGNI4(addr,SUBI4(mem,rc)) "sub %1,%2\n" memop(a) +stmt: ASGNU4(addr,ADDU4(mem,rc)) "add %1,%2\n" memop(a) +stmt: ASGNU4(addr,SUBU4(mem,rc)) "sub %1,%2\n" memop(a) + +stmt: ASGNI4(addr,BANDI4(mem,rc)) "and %1,%2\n" memop(a) +stmt: ASGNI4(addr,BORI4(mem,rc)) "or %1,%2\n" memop(a) +stmt: ASGNI4(addr,BXORI4(mem,rc)) "xor %1,%2\n" memop(a) +stmt: ASGNU4(addr,BANDU4(mem,rc)) "and %1,%2\n" memop(a) +stmt: ASGNU4(addr,BORU4(mem,rc)) "or %1,%2\n" memop(a) +stmt: ASGNU4(addr,BXORU4(mem,rc)) "xor %1,%2\n" memop(a) +reg: BCOMI4(reg) "?mov %c,%0\nnot %c\n" 2 +reg: BCOMU4(reg) "?mov %c,%0\nnot %c\n" 2 +reg: NEGI4(reg) "?mov %c,%0\nneg %c\n" 2 + +stmt: ASGNI4(addr,BCOMI4(mem)) "not %1\n" memop(a) +stmt: ASGNU4(addr,BCOMU4(mem)) "not %1\n" memop(a) +stmt: ASGNI4(addr,NEGI4(mem)) "neg %1\n" memop(a) +reg: LSHI4(reg,con5) "?mov %c,%0\nsal %c,%1\n" 2 +reg: LSHU4(reg,con5) "?mov %c,%0\nshl %c,%1\n" 2 +reg: RSHI4(reg,con5) "?mov %c,%0\nsar %c,%1\n" 2 +reg: RSHU4(reg,con5) "?mov %c,%0\nshr %c,%1\n" 2 + +stmt: ASGNI4(addr,LSHI4(mem,con5)) "sal %1,%2\n" memop(a) +stmt: ASGNI4(addr,LSHU4(mem,con5)) "shl %1,%2\n" memop(a) +stmt: ASGNI4(addr,RSHI4(mem,con5)) "sar %1,%2\n" memop(a) +stmt: ASGNI4(addr,RSHU4(mem,con5)) "shr %1,%2\n" memop(a) + +con5: CNSTI4 "%a" range(a, 0, 31) + +reg: LSHI4(reg,reg) "?mov %c,%0\nmov ecx,%1\nsal %c,cl\n" 3 +reg: LSHU4(reg,reg) "?mov %c,%0\nmov ecx,%1\nshl %c,cl\n" 2 +reg: RSHI4(reg,reg) "?mov %c,%0\nmov ecx,%1\nsar %c,cl\n" 2 +reg: RSHU4(reg,reg) "?mov %c,%0\nmov ecx,%1\nshr %c,cl\n" 2 +reg: MULI4(reg,mrc3) "?mov %c,%0\nimul %c,%1\n" 14 +reg: MULI4(con,mr) "imul %c,%1,%0\n" 13 +reg: MULU4(reg,mr) "mul %1\n" 13 +reg: DIVU4(reg,reg) "xor edx,edx\ndiv %1\n" +reg: MODU4(reg,reg) "xor edx,edx\ndiv %1\n" +reg: DIVI4(reg,reg) "cdq\nidiv %1\n" +reg: MODI4(reg,reg) "cdq\nidiv %1\n" +reg: CVPU4(reg) "mov %c,%0\n" move(a) +reg: CVUP4(reg) "mov %c,%0\n" move(a) +reg: CVII4(INDIRI1(addr)) "movsx %c,byte ptr %0\n" 3 +reg: CVII4(INDIRI2(addr)) "movsx %c,word ptr %0\n" 3 +reg: CVUU4(INDIRU1(addr)) "movzx %c,byte ptr %0\n" 3 +reg: CVUU4(INDIRU2(addr)) "movzx %c,word ptr %0\n" 3 +reg: CVII4(reg) "# extend\n" 3 +reg: CVIU4(reg) "# extend\n" 3 +reg: CVUI4(reg) "# extend\n" 3 +reg: CVUU4(reg) "# extend\n" 3 + +reg: CVII1(reg) "# truncate\n" 1 +reg: CVII2(reg) "# truncate\n" 1 +reg: CVUU1(reg) "# truncate\n" 1 +reg: CVUU2(reg) "# truncate\n" 1 +stmt: ASGNI1(addr,rc) "mov byte ptr %0,%1\n" 1 +stmt: ASGNI2(addr,rc) "mov word ptr %0,%1\n" 1 +stmt: ASGNI4(addr,rc) "mov dword ptr %0,%1\n" 1 +stmt: ASGNU1(addr,rc) "mov byte ptr %0,%1\n" 1 +stmt: ASGNU2(addr,rc) "mov word ptr %0,%1\n" 1 +stmt: ASGNU4(addr,rc) "mov dword ptr %0,%1\n" 1 +stmt: ASGNP4(addr,rc) "mov dword ptr %0,%1\n" 1 +stmt: ARGI4(mrc3) "push %0\n" 1 +stmt: ARGU4(mrc3) "push %0\n" 1 +stmt: ARGP4(mrc3) "push %0\n" 1 +stmt: ASGNB(reg,INDIRB(reg)) "mov ecx,%a\nrep movsb\n" +stmt: ARGB(INDIRB(reg)) "# ARGB\n" +memf: INDIRF8(addr) "qword ptr %0" +memf: INDIRF4(addr) "dword ptr %0" +memf: CVFF8(INDIRF4(addr)) "dword ptr %0" +reg: memf "fld %0\n" 3 +stmt: ASGNF8(addr,reg) "fstp qword ptr %0\n" 7 +stmt: ASGNF4(addr,reg) "fstp dword ptr %0\n" 7 +stmt: ASGNF4(addr,CVFF4(reg)) "fstp dword ptr %0\n" 7 +stmt: ARGF8(reg) "sub esp,8\nfstp qword ptr [esp]\n" +stmt: ARGF4(reg) "sub esp,4\nfstp dword ptr [esp]\n" +reg: NEGF8(reg) "fchs\n" +reg: NEGF4(reg) "fchs\n" +flt: memf " %0" +flt: reg "p st(1),st" +reg: ADDF8(reg,flt) "fadd%1\n" +reg: ADDF4(reg,flt) "fadd%1\n" +reg: DIVF8(reg,flt) "fdiv%1\n" +reg: DIVF4(reg,flt) "fdiv%1\n" +reg: MULF8(reg,flt) "fmul%1\n" +reg: MULF4(reg,flt) "fmul%1\n" +reg: SUBF8(reg,flt) "fsub%1\n" +reg: SUBF4(reg,flt) "fsub%1\n" +reg: CVFF8(reg) "# CVFF8\n" +reg: CVFF4(reg) "sub esp,4\nfstp dword ptr 0[esp]\nfld dword ptr 0[esp]\nadd esp,4\n" 12 + +reg: CVFI4(reg) "call __ftol\n" 31 +reg: CVIF8(INDIRI4(addr)) "fild dword ptr %0\n" 10 +reg: CVIF4(reg) "push %0\nfild dword ptr 0[esp]\nadd esp,4\n" 12 + +reg: CVIF8(reg) "push %0\nfild dword ptr 0[esp]\nadd esp,4\n" 12 + +addrj: ADDRGP4 "%a" +addrj: reg "%0" 2 +addrj: mem "%0" 2 + +stmt: JUMPV(addrj) "jmp %0\n" 3 +stmt: LABELV "%a:\n" +stmt: EQI4(mem,rc) "cmp %0,%1\nje %a\n" 5 +stmt: GEI4(mem,rc) "cmp %0,%1\njge %a\n" 5 +stmt: GTI4(mem,rc) "cmp %0,%1\njg %a\n" 5 +stmt: LEI4(mem,rc) "cmp %0,%1\njle %a\n" 5 +stmt: LTI4(mem,rc) "cmp %0,%1\njl %a\n" 5 +stmt: NEI4(mem,rc) "cmp %0,%1\njne %a\n" 5 +stmt: GEU4(mem,rc) "cmp %0,%1\njae %a\n" 5 +stmt: GTU4(mem,rc) "cmp %0,%1\nja %a\n" 5 +stmt: LEU4(mem,rc) "cmp %0,%1\njbe %a\n" 5 +stmt: LTU4(mem,rc) "cmp %0,%1\njb %a\n" 5 +stmt: EQI4(reg,mrc1) "cmp %0,%1\nje %a\n" 4 +stmt: GEI4(reg,mrc1) "cmp %0,%1\njge %a\n" 4 +stmt: GTI4(reg,mrc1) "cmp %0,%1\njg %a\n" 4 +stmt: LEI4(reg,mrc1) "cmp %0,%1\njle %a\n" 4 +stmt: LTI4(reg,mrc1) "cmp %0,%1\njl %a\n" 4 +stmt: NEI4(reg,mrc1) "cmp %0,%1\njne %a\n" 4 + +stmt: EQU4(reg,mrc1) "cmp %0,%1\nje %a\n" 4 +stmt: GEU4(reg,mrc1) "cmp %0,%1\njae %a\n" 4 +stmt: GTU4(reg,mrc1) "cmp %0,%1\nja %a\n" 4 +stmt: LEU4(reg,mrc1) "cmp %0,%1\njbe %a\n" 4 +stmt: LTU4(reg,mrc1) "cmp %0,%1\njb %a\n" 4 +stmt: NEU4(reg,mrc1) "cmp %0,%1\njne %a\n" 4 +cmpf: memf " %0" +cmpf: reg "p" +stmt: EQF8(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %b\nje %a\n%b:\n" +stmt: GEF8(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\njbe %a\n" +stmt: GTF8(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\njb %a\n" +stmt: LEF8(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\njae %a\n" +stmt: LTF8(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\nja %a\n" +stmt: NEF8(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\njne %a\n" + +stmt: EQF4(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %b\nje %a\n%b:\n" +stmt: GEF4(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\njbe %a\n\n" +stmt: GTF4(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\njb %a\n" +stmt: LEF4(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\njae %a\n\n" +stmt: LTF4(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\nja %a\n" +stmt: NEF4(cmpf,reg) "fcomp%0\nfstsw ax\nsahf\njp %a\njne %a\n" +reg: CALLI4(addrj) "call %0\nadd esp,%a\n" +reg: CALLU4(addrj) "call %0\nadd esp,%a\n" +reg: CALLP4(addrj) "call %0\nadd esp,%a\n" +stmt: CALLV(addrj) "call %0\nadd esp,%a\n" +reg: CALLF4(addrj) "call %0\nadd esp,%a\n" +reg: CALLF8(addrj) "call %0\nadd esp,%a\n" +stmt: CALLF4(addrj) "call %0\nadd esp,%a\nfstp\n" +stmt: CALLF8(addrj) "call %0\nadd esp,%a\nfstp\n" + +stmt: RETI4(reg) "# ret\n" +stmt: RETU4(reg) "# ret\n" +stmt: RETP4(reg) "# ret\n" +stmt: RETF4(reg) "# ret\n" +stmt: RETF8(reg) "# ret\n" +%% +static void progbeg(int argc, char *argv[]) { + int i; + + { + union { + char c; + int i; + } u; + u.i = 0; + u.c = 1; + swap = ((int)(u.i == 1)) != IR->little_endian; + } + parseflags(argc, argv); + intreg[EAX] = mkreg("eax", EAX, 1, IREG); + intreg[EDX] = mkreg("edx", EDX, 1, IREG); + intreg[ECX] = mkreg("ecx", ECX, 1, IREG); + intreg[EBX] = mkreg("ebx", EBX, 1, IREG); + intreg[ESI] = mkreg("esi", ESI, 1, IREG); + intreg[EDI] = mkreg("edi", EDI, 1, IREG); + + shortreg[EAX] = mkreg("ax", EAX, 1, IREG); + shortreg[ECX] = mkreg("cx", ECX, 1, IREG); + shortreg[EDX] = mkreg("dx", EDX, 1, IREG); + shortreg[EBX] = mkreg("bx", EBX, 1, IREG); + shortreg[ESI] = mkreg("si", ESI, 1, IREG); + shortreg[EDI] = mkreg("di", EDI, 1, IREG); + + charreg[EAX] = mkreg("al", EAX, 1, IREG); + charreg[ECX] = mkreg("cl", ECX, 1, IREG); + charreg[EDX] = mkreg("dl", EDX, 1, IREG); + charreg[EBX] = mkreg("bl", EBX, 1, IREG); + for (i = 0; i < 8; i++) + fltreg[i] = mkreg("%d", i, 0, FREG); + charregw = mkwildcard(charreg); + shortregw = mkwildcard(shortreg); + intregw = mkwildcard(intreg); + fltregw = mkwildcard(fltreg); + + tmask[IREG] = (1<x.regnode->mask |= 1<x.regnode->mask |= 1<op)) { + case MUL+U: + setreg(p, quo); + rtarget(p, 0, intreg[EAX]); + break; + case DIV+I: case DIV+U: + setreg(p, quo); + rtarget(p, 0, quo); + break; + case MOD+I: case MOD+U: + setreg(p, rem); + rtarget(p, 0, quo); + break; + case ASGN+B: + rtarget(p, 0, intreg[EDI]); + rtarget(p->kids[1], 0, intreg[ESI]); + break; + case ARG+B: + rtarget(p->kids[0], 0, intreg[ESI]); + break; + case CVF+I: + setreg(p, intreg[EAX]); + break; + case CALL+I: case CALL+U: case CALL+P: case CALL+V: + setreg(p, intreg[EAX]); + break; + case RET+I: case RET+U: case RET+P: + rtarget(p, 0, intreg[EAX]); + break; + } +} + +static void clobber(Node p) { + static int nstack = 0; + + assert(p); + nstack = ckstack(p, nstack); + switch (specific(p->op)) { + case RSH+I: case RSH+U: case LSH+I: case LSH+U: + if (generic(p->kids[1]->op) != CNST + && !( generic(p->kids[1]->op) == INDIR + && specific(p->kids[1]->kids[0]->op) == VREG+P + && p->kids[1]->syms[RX]->u.t.cse + && generic(p->kids[1]->syms[RX]->u.t.cse->op) == CNST +)) { + spill(1<op) == EQ+F) + p->syms[1] = findlabel(genlabel(1)); + break; + case CALL+F: + spill(1<op)==F) + +int ckstack(Node p, int n) { + int i; + + for (i = 0; i < NELEMS(p->x.kids) && p->x.kids[i]; i++) + if (isfp(p->x.kids[i])) + n--; + if (isfp(p) && p->count > 0) + n++; + if (n > 8) + error("expression too complicated\n"); + debug(fprint(stderr, "(ckstack(%x)=%d)\n", p, n)); + assert(n >= 0); + return n; +} +int memop(Node p) { + assert(p); + assert(generic(p->op) == ASGN); + assert(p->kids[0]); + assert(p->kids[1]); + if (generic(p->kids[1]->kids[0]->op) == INDIR + && sametree(p->kids[0], p->kids[1]->kids[0]->kids[0])) + return 3; + else + return LBURG_MAX; +} +int sametree(Node p, Node q) { + return p == NULL && q == NULL + || p && q && p->op == q->op && p->syms[0] == q->syms[0] + && sametree(p->kids[0], q->kids[0]) + && sametree(p->kids[1], q->kids[1]); +} +static void emit2(Node p) { + int op = specific(p->op); +#define preg(f) ((f)[getregnum(p->x.kids[0])]->x.name) + + if (op == CVI+I && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 1) + print("movsx %s,%s\n", p->syms[RX]->x.name +, preg(charreg)); + else if (op == CVI+U && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 1) + print("movsx %s,%s\n", p->syms[RX]->x.name +, preg(charreg)); + else if (op == CVI+I && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 2) + print("movsx %s,%s\n", p->syms[RX]->x.name +, preg(shortreg)); + else if (op == CVI+U && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 2) + print("movsx %s,%s\n", p->syms[RX]->x.name +, preg(shortreg)); + + else if (op == CVU+I && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 1) + print("movzx %s,%s\n", p->syms[RX]->x.name +, preg(charreg)); + else if (op == CVU+U && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 1) + print("movzx %s,%s\n", p->syms[RX]->x.name +, preg(charreg)); + else if (op == CVU+I && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 2) + print("movzx %s,%s\n", p->syms[RX]->x.name +, preg(shortreg)); + else if (op == CVU+U && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 2) + print("movzx %s,%s\n", p->syms[RX]->x.name +, preg(shortreg)); + else if (generic(op) == CVI || generic(op) == CVU || generic(op) == LOAD) { + char *dst = intreg[getregnum(p)]->x.name; + char *src = preg(intreg); + assert(opsize(p->op) <= opsize(p->x.kids[0]->op)); + if (dst != src) + print("mov %s,%s\n", dst, src); + } + else if (op == ARG+B) + print("sub esp,%d\nmov edi,esp\nmov ecx,%d\nrep movsb\n", + roundup(p->syms[0]->u.c.v.i, 4), p->syms[0]->u.c.v.i); +} + +static void doarg(Node p) { + assert(p && p->syms[0]); + mkactual(4, p->syms[0]->u.c.v.i); +} +static void blkfetch(int k, int off, int reg, int tmp) {} +static void blkstore(int k, int off, int reg, int tmp) {} +static void blkloop(int dreg, int doff, int sreg, int soff, + int size, int tmps[]) {} +static void local(Symbol p) { + if (isfloat(p->type)) + p->sclass = AUTO; + if (askregvar(p, (*IR->x.rmap)(ttob(p->type))) == 0) { + assert(p->sclass == AUTO); + offset = roundup(offset + p->type->size, + p->type->align < 4 ? 4 : p->type->align); + p->x.offset = -offset; + p->x.name = stringd(-offset); + } +} +static void function(Symbol f, Symbol caller[], Symbol callee[], int n) { + int i; + + print("%s:\n", f->x.name); + print("push ebx\n"); + print("push esi\n"); + print("push edi\n"); + print("push ebp\n"); + print("mov ebp,esp\n"); + usedmask[0] = usedmask[1] = 0; + freemask[0] = freemask[1] = ~(unsigned)0; + offset = 16 + 4; + for (i = 0; callee[i]; i++) { + Symbol p = callee[i]; + Symbol q = caller[i]; + assert(q); + p->x.offset = q->x.offset = offset; + p->x.name = q->x.name = stringf("%d", p->x.offset); + p->sclass = q->sclass = AUTO; + offset += roundup(q->type->size, 4); + } + assert(caller[i] == 0); + offset = maxoffset = 0; + gencode(caller, callee); + framesize = roundup(maxoffset, 4); + if (framesize >= 4096) + print("mov eax,%d\ncall __chkstk\n", framesize); + else if (framesize > 0) + print("sub esp,%d\n", framesize); + emitcode(); + print("mov esp,ebp\n"); + print("pop ebp\n"); + print("pop edi\n"); + print("pop esi\n"); + print("pop ebx\n"); + print("ret\n"); + if (framesize >= 4096) { + int oldseg = cseg; + segment(0); + print("extrn __chkstk:near\n"); + segment(oldseg); + } +} +static void defsymbol(Symbol p) { + if (p->scope >= LOCAL && p->sclass == STATIC) + p->x.name = stringf("L%d", genlabel(1)); + else if (p->generated) + p->x.name = stringf("L%s", p->name); + else if (p->scope == GLOBAL || p->sclass == EXTERN) + p->x.name = stringf("_%s", p->name); + else if (p->scope == CONSTANTS + && (isint(p->type) || isptr(p->type)) + && p->name[0] == '0' && p->name[1] == 'x') + p->x.name = stringf("0%sH", &p->name[2]); + else + p->x.name = p->name; +} +static void address(Symbol q, Symbol p, long n) { + if (p->scope == GLOBAL + || p->sclass == STATIC || p->sclass == EXTERN) + q->x.name = stringf("%s%s%D", + p->x.name, n >= 0 ? "+" : "", n); + else { + assert(n <= INT_MAX && n >= INT_MIN); + q->x.offset = p->x.offset + n; + q->x.name = stringd(q->x.offset); + } +} +static void defconst(int suffix, int size, Value v) { + if (suffix == I && size == 1) + print("db %d\n", v.u); + else if (suffix == I && size == 2) + print("dw %d\n", v.i); + else if (suffix == I && size == 4) + print("dd %d\n", v.i); + else if (suffix == U && size == 1) + print("db 0%xH\n", (unsigned)((unsigned char)v.u)); + else if (suffix == U && size == 2) + print("dw 0%xH\n", (unsigned)((unsigned short)v.u)); + else if (suffix == U && size == 4) + print("dd 0%xH\n", (unsigned)v.u); + else if (suffix == P && size == 4) + print("dd 0%xH\n", (unsigned)v.p); + else if (suffix == F && size == 4) { + float f = v.d; + print("dd 0%xH\n", *(unsigned *)&f); + } + else if (suffix == F && size == 8) { + double d = v.d; + unsigned *p = (unsigned *)&d; + print("dd 0%xH\ndd 0%xH\n", p[swap], p[!swap]); + } + else assert(0); +} +static void defaddress(Symbol p) { + print("dd %s\n", p->x.name); +} +static void defstring(int n, char *str) { + char *s; + + for (s = str; s < str + n; s++) + print("db %d\n", (*s)&0377); +} +static void export(Symbol p) { + print("public %s\n", p->x.name); +} +static void import(Symbol p) { + int oldseg = cseg; + + if (p->ref > 0) { + segment(0); + print("extrn %s:near\n", p->x.name); + segment(oldseg); + } +} +static void global(Symbol p) { + print("align %d\n", + p->type->align > 4 ? 4 : p->type->align); + print("%s label byte\n", p->x.name); +} +static void space(int n) { + print("db %d dup (0)\n", n); +} +Interface x86IR = { + 1, 1, 0, /* char */ + 2, 2, 0, /* short */ + 4, 4, 0, /* int */ + 4, 4, 0, /* long */ + 4, 4, 0, /* long long */ + 4, 4, 1, /* float */ + 8, 4, 1, /* double */ + 8, 4, 1, /* long double */ + 4, 4, 0, /* T * */ + 0, 1, 0, /* struct */ + 1, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 1, /* wants_argb */ + 0, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + address, + blockbeg, + blockend, + defaddress, + defconst, + defstring, + defsymbol, + emit, + export, + function, + gen, + global, + import, + local, + progbeg, + progend, + segment, + space, + 0, 0, 0, 0, 0, 0, 0, + {1, rmap, + blkfetch, blkstore, blkloop, + _label, + _rule, + _nts, + _kids, + _string, + _templates, + _isinstruction, + _ntname, + emit2, + doarg, + target, + clobber, +} +}; diff --git a/src/cmd/lccom-1/x86linux.md b/src/cmd/lccom-1/x86linux.md new file mode 100644 index 0000000..d291d4c --- /dev/null +++ b/src/cmd/lccom-1/x86linux.md @@ -0,0 +1,1078 @@ +%{ +/* x86/linux lburg spec. Derived from x86.md by +Marcos Ramirez +Horst von Brand +Jacob Navia +*/ +enum { EAX=0, ECX=1, EDX=2, EBX=3, ESI=6, EDI=7 }; +#include "c.h" +#define NODEPTR_TYPE Node +#define OP_LABEL(p) ((p)->op) +#define LEFT_CHILD(p) ((p)->kids[0]) +#define RIGHT_CHILD(p) ((p)->kids[1]) +#define STATE_LABEL(p) ((p)->x.state) +extern int ckstack(Node, int); +extern int memop(Node); +extern int sametree(Node, Node); +static Symbol charreg[32], shortreg[32], intreg[32]; +static Symbol fltreg[32]; + +static Symbol charregw, shortregw, intregw, fltregw; + +static int cseg; + +static Symbol quo, rem; + +extern char *stabprefix; +extern void stabblock(int, int, Symbol*); +extern void stabend(Coordinate *, Symbol, Coordinate **, Symbol *, Symbol *); +extern void stabfend(Symbol, int); +extern void stabinit(char *, int, char *[]); +extern void stabline(Coordinate *); +extern void stabsym(Symbol); +extern void stabtype(Symbol); + +static int pflag = 0; + +#define hasargs(p) (p->syms[0] && p->syms[0]->u.c.v.i > 0 ? 0 : LBURG_MAX) +%} +%start stmt +%term CNSTF4=4113 +%term CNSTF8=8209 +%term CNSTF16=16401 +%term CNSTI1=1045 +%term CNSTI2=2069 +%term CNSTI4=4117 +%term CNSTI8=8213 +%term CNSTP4=4119 +%term CNSTP8=8215 +%term CNSTU1=1046 +%term CNSTU2=2070 +%term CNSTU4=4118 +%term CNSTU8=8214 + +%term ARGB=41 +%term ARGF4=4129 +%term ARGF8=8225 +%term ARGF16=16417 +%term ARGI4=4133 +%term ARGI8=8229 +%term ARGP4=4135 +%term ARGP8=8231 +%term ARGU4=4134 +%term ARGU8=8230 + +%term ASGNB=57 +%term ASGNF4=4145 +%term ASGNF8=8241 +%term ASGNF16=16433 +%term ASGNI1=1077 +%term ASGNI2=2101 +%term ASGNI4=4149 +%term ASGNI8=8245 +%term ASGNP4=4151 +%term ASGNP8=8247 +%term ASGNU1=1078 +%term ASGNU2=2102 +%term ASGNU4=4150 +%term ASGNU8=8246 + +%term INDIRB=73 +%term INDIRF4=4161 +%term INDIRF8=8257 +%term INDIRF16=16449 +%term INDIRI1=1093 +%term INDIRI2=2117 +%term INDIRI4=4165 +%term INDIRI8=8261 +%term INDIRP4=4167 +%term INDIRP8=8263 +%term INDIRU1=1094 +%term INDIRU2=2118 +%term INDIRU4=4166 +%term INDIRU8=8262 + +%term CVFF4=4209 +%term CVFF8=8305 +%term CVFF16=16497 +%term CVFI4=4213 +%term CVFI8=8309 + +%term CVIF4=4225 +%term CVIF8=8321 +%term CVIF16=16513 +%term CVII1=1157 +%term CVII2=2181 +%term CVII4=4229 +%term CVII8=8325 +%term CVIU1=1158 +%term CVIU2=2182 +%term CVIU4=4230 +%term CVIU8=8326 + +%term CVPP4=4247 +%term CVPP8=8343 +%term CVPP16=16535 +%term CVPU4=4246 +%term CVPU8=8342 + +%term CVUI1=1205 +%term CVUI2=2229 +%term CVUI4=4277 +%term CVUI8=8373 +%term CVUP4=4279 +%term CVUP8=8375 +%term CVUP16=16567 +%term CVUU1=1206 +%term CVUU2=2230 +%term CVUU4=4278 +%term CVUU8=8374 + +%term NEGF4=4289 +%term NEGF8=8385 +%term NEGF16=16577 +%term NEGI4=4293 +%term NEGI8=8389 + +%term CALLB=217 +%term CALLF4=4305 +%term CALLF8=8401 +%term CALLF16=16593 +%term CALLI4=4309 +%term CALLI8=8405 +%term CALLP4=4311 +%term CALLP8=8407 +%term CALLU4=4310 +%term CALLU8=8406 +%term CALLV=216 + +%term RETF4=4337 +%term RETF8=8433 +%term RETF16=16625 +%term RETI4=4341 +%term RETI8=8437 +%term RETP4=4343 +%term RETP8=8439 +%term RETU4=4342 +%term RETU8=8438 +%term RETV=248 + +%term ADDRGP4=4359 +%term ADDRGP8=8455 + +%term ADDRFP4=4375 +%term ADDRFP8=8471 + +%term ADDRLP4=4391 +%term ADDRLP8=8487 + +%term ADDF4=4401 +%term ADDF8=8497 +%term ADDF16=16689 +%term ADDI4=4405 +%term ADDI8=8501 +%term ADDP4=4407 +%term ADDP8=8503 +%term ADDU4=4406 +%term ADDU8=8502 + +%term SUBF4=4417 +%term SUBF8=8513 +%term SUBF16=16705 +%term SUBI4=4421 +%term SUBI8=8517 +%term SUBP4=4423 +%term SUBP8=8519 +%term SUBU4=4422 +%term SUBU8=8518 + +%term LSHI4=4437 +%term LSHI8=8533 +%term LSHU4=4438 +%term LSHU8=8534 + +%term MODI4=4453 +%term MODI8=8549 +%term MODU4=4454 +%term MODU8=8550 + +%term RSHI4=4469 +%term RSHI8=8565 +%term RSHU4=4470 +%term RSHU8=8566 + +%term BANDI4=4485 +%term BANDI8=8581 +%term BANDU4=4486 +%term BANDU8=8582 + +%term BCOMI4=4501 +%term BCOMI8=8597 +%term BCOMU4=4502 +%term BCOMU8=8598 + +%term BORI4=4517 +%term BORI8=8613 +%term BORU4=4518 +%term BORU8=8614 + +%term BXORI4=4533 +%term BXORI8=8629 +%term BXORU4=4534 +%term BXORU8=8630 + +%term DIVF4=4545 +%term DIVF8=8641 +%term DIVF16=16833 +%term DIVI4=4549 +%term DIVI8=8645 +%term DIVU4=4550 +%term DIVU8=8646 + +%term MULF4=4561 +%term MULF8=8657 +%term MULF16=16849 +%term MULI4=4565 +%term MULI8=8661 +%term MULU4=4566 +%term MULU8=8662 + +%term EQF4=4577 +%term EQF8=8673 +%term EQF16=16865 +%term EQI4=4581 +%term EQI8=8677 +%term EQU4=4582 +%term EQU8=8678 + +%term GEF4=4593 +%term GEF8=8689 +%term GEI4=4597 +%term GEI8=8693 +%term GEI16=16885 +%term GEU4=4598 +%term GEU8=8694 + +%term GTF4=4609 +%term GTF8=8705 +%term GTF16=16897 +%term GTI4=4613 +%term GTI8=8709 +%term GTU4=4614 +%term GTU8=8710 + +%term LEF4=4625 +%term LEF8=8721 +%term LEF16=16913 +%term LEI4=4629 +%term LEI8=8725 +%term LEU4=4630 +%term LEU8=8726 + +%term LTF4=4641 +%term LTF8=8737 +%term LTF16=16929 +%term LTI4=4645 +%term LTI8=8741 +%term LTU4=4646 +%term LTU8=8742 + +%term NEF4=4657 +%term NEF8=8753 +%term NEF16=16945 +%term NEI4=4661 +%term NEI8=8757 +%term NEU4=4662 +%term NEU8=8758 + +%term JUMPV=584 + +%term LABELV=600 + +%term LOADB=233 +%term LOADF4=4321 +%term LOADF8=8417 +%term LOADF16=16609 +%term LOADI1=1253 +%term LOADI2=2277 +%term LOADI4=4325 +%term LOADI8=8421 +%term LOADP4=4327 +%term LOADP8=8423 +%term LOADU1=1254 +%term LOADU2=2278 +%term LOADU4=4326 +%term LOADU8=8422 + +%term VREGP=711 +%% +reg: INDIRI1(VREGP) "# read register\n" +reg: INDIRU1(VREGP) "# read register\n" + +reg: INDIRI2(VREGP) "# read register\n" +reg: INDIRU2(VREGP) "# read register\n" + +reg: INDIRI4(VREGP) "# read register\n" +reg: INDIRP4(VREGP) "# read register\n" +reg: INDIRU4(VREGP) "# read register\n" + +reg: INDIRI8(VREGP) "# read register\n" +reg: INDIRP8(VREGP) "# read register\n" +reg: INDIRU8(VREGP) "# read register\n" + +freg: INDIRF4(VREGP) "# read register\n" +freg: INDIRF8(VREGP) "# read register\n" + +stmt: ASGNI1(VREGP,reg) "# write register\n" +stmt: ASGNU1(VREGP,reg) "# write register\n" + +stmt: ASGNI2(VREGP,reg) "# write register\n" +stmt: ASGNU2(VREGP,reg) "# write register\n" + +stmt: ASGNF4(VREGP,reg) "# write register\n" +stmt: ASGNI4(VREGP,reg) "# write register\n" +stmt: ASGNP4(VREGP,reg) "# write register\n" +stmt: ASGNU4(VREGP,reg) "# write register\n" + +stmt: ASGNF8(VREGP,reg) "# write register\n" +stmt: ASGNI8(VREGP,reg) "# write register\n" +stmt: ASGNP8(VREGP,reg) "# write register\n" +stmt: ASGNU8(VREGP,reg) "# write register\n" + +cnst: CNSTI1 "%a" +cnst: CNSTU1 "%a" + +cnst: CNSTI2 "%a" +cnst: CNSTU2 "%a" + +cnst: CNSTI4 "%a" +cnst: CNSTU4 "%a" +cnst: CNSTP4 "%a" + +cnst: CNSTI8 "%a" +cnst: CNSTU8 "%a" +cnst: CNSTP8 "%a" + +con: cnst "$%0" + +stmt: reg "" +stmt: freg "" + +acon: ADDRGP4 "%a" +acon: ADDRGP8 "%a" +acon: cnst "%0" + +baseaddr: ADDRGP4 "%a" +base: reg "(%0)" +base: ADDI4(reg,acon) "%1(%0)" +base: ADDP4(reg,acon) "%1(%0)" +base: ADDU4(reg,acon) "%1(%0)" +base: ADDRFP4 "%a(%%ebp)" +base: ADDRLP4 "%a(%%ebp)" + +index: reg "%0" +index: LSHI4(reg,con1) "%0,2" +index: LSHI4(reg,con2) "%0,4" +index: LSHI4(reg,con3) "%0,8" +index: LSHU4(reg,con1) "%0,2" +index: LSHU4(reg,con2) "%0,4" +index: LSHU4(reg,con3) "%0,8" + +con0: CNSTI4 "1" range(a, 0, 0) +con0: CNSTU4 "1" range(a, 0, 0) +con1: CNSTI4 "1" range(a, 1, 1) +con1: CNSTU4 "1" range(a, 1, 1) +con2: CNSTI4 "2" range(a, 2, 2) +con2: CNSTU4 "2" range(a, 2, 2) +con3: CNSTI4 "3" range(a, 3, 3) +con3: CNSTU4 "3" range(a, 3, 3) + +addr: base "%0" +addr: baseaddr "%0" +addr: ADDI4(index,baseaddr) "%1(,%0)" +addr: ADDP4(index,baseaddr) "%1(,%0)" +addr: ADDU4(index,baseaddr) "%1(,%0)" + +addr: ADDI4(reg,baseaddr) "%1(%0)" +addr: ADDP4(reg,baseaddr) "%1(%0)" +addr: ADDU4(reg,baseaddr) "%1(%0)" + +addr: ADDI4(index,reg) "(%1,%0)" +addr: ADDP4(index,reg) "(%1,%0)" +addr: ADDU4(index,reg) "(%1,%0)" + +addr: index "(,%0)" + +mem1: INDIRI1(addr) "%0" +mem1: INDIRU1(addr) "%0" +mem2: INDIRI2(addr) "%0" +mem2: INDIRU2(addr) "%0" +mem4: INDIRI4(addr) "%0" +mem4: INDIRU4(addr) "%0" +mem4: INDIRP4(addr) "%0" + +rc: reg "%0" +rc: con "%0" + +mr: reg "%0" +mr: mem4 "%0" + +mr1: reg "%0" +mr1: mem1 "%0" + +mr2: reg "%0" +mr2: mem2 "%0" + +mrc: mem4 "%0" 1 +mrc: mem1 "%0" 1 +mrc: mem2 "%0" 1 +mrc: rc "%0" + +reg: addr "leal %0,%c\n" 1 +reg: mr "movl %0,%c\n" 1 +reg: mr1 "movb %0,%c\n" 1 +reg: mr2 "movw %0,%c\n" 1 +reg: con "mov %0,%c\n" 1 + +reg: LOADI1(reg) "# move\n" 1 +reg: LOADI2(reg) "# move\n" 1 +reg: LOADI4(reg) "# move\n" move(a) +reg: LOADU1(reg) "# move\n" 1 +reg: LOADU2(reg) "# move\n" 1 +reg: LOADU4(reg) "# move\n" move(a) +reg: LOADP4(reg) "# move\n" move(a) +reg: ADDI4(reg,mrc) "?movl %0,%c\naddl %1,%c\n" 1 +reg: ADDP4(reg,mrc) "?movl %0,%c\naddl %1,%c\n" 1 +reg: ADDU4(reg,mrc) "?movl %0,%c\naddl %1,%c\n" 1 +reg: SUBI4(reg,mrc) "?movl %0,%c\nsubl %1,%c\n" 1 +reg: SUBP4(reg,mrc) "?movl %0,%c\nsubl %1,%c\n" 1 +reg: SUBU4(reg,mrc) "?movl %0,%c\nsubl %1,%c\n" 1 +reg: BANDI4(reg,mrc) "?movl %0,%c\nandl %1,%c\n" 1 +reg: BORI4(reg,mrc) "?movl %0,%c\norl %1,%c\n" 1 +reg: BXORI4(reg,mrc) "?movl %0,%c\nxorl %1,%c\n" 1 +reg: BANDU4(reg,mrc) "?movl %0,%c\nandl %1,%c\n" 1 +reg: BORU4(reg,mrc) "?movl %0,%c\norl %1,%c\n" 1 +reg: BXORU4(reg,mrc) "?movl %0,%c\nxorl %1,%c\n" 1 + +stmt: ASGNI4(addr,ADDI4(mem4,con1)) "incl %1\n" memop(a) +stmt: ASGNI4(addr,ADDU4(mem4,con1)) "incl %1\n" memop(a) +stmt: ASGNP4(addr,ADDP4(mem4,con1)) "incl %1\n" memop(a) +stmt: ASGNI4(addr,SUBI4(mem4,con1)) "decl %1\n" memop(a) +stmt: ASGNI4(addr,SUBU4(mem4,con1)) "decl %1\n" memop(a) +stmt: ASGNP4(addr,SUBP4(mem4,con1)) "decl %1\n" memop(a) +stmt: ASGNI4(addr,ADDI4(mem4,rc)) "addl %2,%1\n" memop(a) +stmt: ASGNI4(addr,SUBI4(mem4,rc)) "subl %2,%1\n" memop(a) +stmt: ASGNU4(addr,ADDU4(mem4,rc)) "addl %2,%1\n" memop(a) +stmt: ASGNU4(addr,SUBU4(mem4,rc)) "subl %2,%1\n" memop(a) + +stmt: ASGNI4(addr,BANDI4(mem4,rc)) "andl %2,%1\n" memop(a) +stmt: ASGNI4(addr,BORI4(mem4,rc)) "orl %2,%1\n" memop(a) +stmt: ASGNI4(addr,BXORI4(mem4,rc)) "xorl %2,%1\n" memop(a) +stmt: ASGNU4(addr,BANDU4(mem4,rc)) "andl %2,%1\n" memop(a) +stmt: ASGNU4(addr,BORU4(mem4,rc)) "orl %2,%1\n" memop(a) +stmt: ASGNU4(addr,BXORU4(mem4,rc)) "xorl %2,%1\n" memop(a) +reg: BCOMI4(reg) "?movl %0,%c\nnotl %c\n" 2 +reg: BCOMU4(reg) "?movl %0,%c\nnotl %c\n" 2 +reg: NEGI4(reg) "?movl %0,%c\nnegl %c\n" 2 + +stmt: ASGNI4(addr,BCOMI4(mem4)) "notl %1\n" memop(a) +stmt: ASGNU4(addr,BCOMU4(mem4)) "notl %1\n" memop(a) +stmt: ASGNI4(addr,NEGI4(mem4)) "negl %1\n" memop(a) +reg: LSHI4(reg,rc5) "?movl %0,%c\nsall %1,%c\n" 2 +reg: LSHU4(reg,rc5) "?movl %0,%c\nshll %1,%c\n" 2 +reg: RSHI4(reg,rc5) "?movl %0,%c\nsarl %1,%c\n" 2 +reg: RSHU4(reg,rc5) "?movl %0,%c\nshrl %1,%c\n" 2 + +stmt: ASGNI4(addr,LSHI4(mem4,rc5)) "sall %2,%1\n" memop(a) +stmt: ASGNI4(addr,LSHU4(mem4,rc5)) "shll %2,%1\n" memop(a) +stmt: ASGNI4(addr,RSHI4(mem4,rc5)) "sarl %2,%1\n" memop(a) +stmt: ASGNI4(addr,RSHU4(mem4,rc5)) "shrl %2,%1\n" memop(a) + +rc5: CNSTI4 "$%a" range(a, 0, 31) +rc5: reg "%%cl" +reg: MULI4(reg,mrc) "?movl %0,%c\nimull %1,%c\n" 14 +reg: MULI4(con,mr) "imul %0,%1,%c\n" 13 +reg: MULU4(reg,mr) "mull %1\n" 13 +reg: DIVU4(reg,reg) "xorl %%edx,%%edx\ndivl %1\n" +reg: MODU4(reg,reg) "xorl %%edx,%%edx\ndivl %1\n" +reg: DIVI4(reg,reg) "cdq\nidivl %1\n" +reg: MODI4(reg,reg) "cdq\nidivl %1\n" +reg: CVPU4(reg) "movl %0,%c\n" move(a) +reg: CVUP4(reg) "movl %0,%c\n" move(a) +reg: CVII4(INDIRI1(addr)) "movsbl %0,%c\n" 3 +reg: CVII4(INDIRI2(addr)) "movswl %0,%c\n" 3 +reg: CVUU4(INDIRU1(addr)) "movzbl %0,%c\n" 3 +reg: CVUU4(INDIRU2(addr)) "movzwl %0,%c\n" 3 +reg: CVII4(reg) "# extend\n" 3 +reg: CVIU4(reg) "# extend\n" 3 +reg: CVUI4(reg) "# extend\n" 3 +reg: CVUU4(reg) "# extend\n" 3 + +reg: CVII1(reg) "# truncate\n" 1 +reg: CVII2(reg) "# truncate\n" 1 +reg: CVUU1(reg) "# truncate\n" 1 +reg: CVUU2(reg) "# truncate\n" 1 + +mrca: mem4 "%0" +mrca: rc "%0" +mrca: ADDRGP4 "$%a" +mrca: ADDRGP8 "$%a" + +stmt: ASGNI1(addr,rc) "movb %1,%0\n" 1 +stmt: ASGNI2(addr,rc) "movw %1,%0\n" 1 +stmt: ASGNI4(addr,rc) "movl %1,%0\n" 1 +stmt: ASGNU1(addr,rc) "movb %1,%0\n" 1 +stmt: ASGNU2(addr,rc) "movw %1,%0\n" 1 +stmt: ASGNU4(addr,rc) "movl %1,%0\n" 1 +stmt: ASGNP4(addr,rc) "movl %1,%0\n" 1 +stmt: ARGI4(mrca) "pushl %0\n" 1 +stmt: ARGU4(mrca) "pushl %0\n" 1 +stmt: ARGP4(mrca) "pushl %0\n" 1 +stmt: ASGNB(reg,INDIRB(reg)) "movl $%a,%%ecx\nrep\nmovsb\n" +stmt: ARGB(INDIRB(reg)) "# ARGB\n" + +memf: INDIRF8(addr) "l %0" +memf: INDIRF4(addr) "s %0" +memf: CVFF8(INDIRF4(addr)) "s %0" +memf: CVFF4(INDIRF8(addr)) "l %0" + +freg: memf "fld%0\n" 3 + +stmt: ASGNF8(addr,freg) "fstpl %0\n" 7 +stmt: ASGNF4(addr,freg) "fstps %0\n" 7 +stmt: ASGNF4(addr,CVFF4(freg)) "fstps %0\n" 7 + +stmt: ARGF8(freg) "subl $8,%%esp\nfstpl (%%esp)\n" +stmt: ARGF4(freg) "subl $4,%%esp\nfstps (%%esp)\n" +freg: NEGF8(freg) "fchs\n" +freg: NEGF4(freg) "fchs\n" + +flt: memf "%0" +flt: freg "p %%st,%%st(1)" +flt2: memf "%0" +flt2: freg "rp %%st,%%st(1)" + +freg: ADDF4(freg,flt) "fadd%1\n" +freg: ADDF8(freg,flt) "fadd%1\n" + +freg: DIVF4(freg,flt2) "fdiv%1\n" +freg: DIVF8(freg,flt2) "fdiv%1\n" + +freg: MULF4(freg,flt) "fmul%1\n" +freg: MULF8(freg,flt) "fmul%1\n" + +freg: SUBF4(freg,flt2) "fsub%1\n" +freg: SUBF8(freg,flt2) "fsub%1\n" + +freg: CVFF8(freg) "# CVFF8\n" +freg: CVFF4(freg) "sub $4,%%esp\nfstps (%%esp)\nflds (%%esp)\naddl $4,%%esp\n" 12 + +reg: CVFI4(freg) "subl $8,%%esp\nfnstcw 4(%%esp)\nmovl 4(%%esp),%%edx\nmovb $12,%%dh\nmovl %%edx,0(%%esp)\nfldcw 0(%%esp)\nfistpl 0(%%esp)\npopl %c\nfldcw 0(%%esp)\naddl $4,%%esp\n" 31 + +freg: CVIF8(INDIRI4(addr)) "fildl %0\n" 10 +freg: CVIF8(reg) "pushl %0\nfildl (%%esp)\naddl $4,%%esp\n" 12 + +freg: CVIF4(INDIRI4(addr)) "fildl %0\n" 10 +freg: CVIF4(reg) "pushl %0\nfildl (%%esp)\naddl $4,%%esp\n" 12 + +addrj: ADDRGP4 "%a" +addrj: reg "*%0" 2 +addrj: mem4 "*%0" 2 + +stmt: LABELV "%a:\n" +stmt: JUMPV(addrj) "jmp %0\n" 3 +stmt: EQI4(mem4,rc) "cmpl %1,%0\nje %a\n" 5 +stmt: GEI4(mem4,rc) "cmpl %1,%0\njge %a\n" 5 +stmt: GTI4(mem4,rc) "cmpl %1,%0\njg %a\n" 5 +stmt: LEI4(mem4,rc) "cmpl %1,%0\njle %a\n" 5 +stmt: LTI4(mem4,rc) "cmpl %1,%0\njl %a\n" 5 +stmt: NEI4(mem4,rc) "cmpl %1,%0\njne %a\n" 5 +stmt: GEU4(mem4,rc) "cmpl %1,%0\njae %a\n" 5 +stmt: GTU4(mem4,rc) "cmpl %1,%0\nja %a\n" 5 +stmt: LEU4(mem4,rc) "cmpl %1,%0\njbe %a\n" 5 +stmt: LTU4(mem4,rc) "cmpl %1,%0\njb %a\n" 5 +stmt: EQI4(reg,mrc) "cmpl %1,%0\nje %a\n" 4 +stmt: GEI4(reg,mrc) "cmpl %1,%0\njge %a\n" 4 +stmt: GTI4(reg,mrc) "cmpl %1,%0\njg %a\n" 4 +stmt: LEI4(reg,mrc) "cmpl %1,%0\njle %a\n" 4 +stmt: LTI4(reg,mrc) "cmpl %1,%0\njl %a\n" 4 +stmt: NEI4(reg,mrc) "cmpl %1,%0\njne %a\n" 4 + +stmt: EQU4(reg,mrc) "cmpl %1,%0\nje %a\n" 4 +stmt: GEU4(reg,mrc) "cmpl %1,%0\njae %a\n" 4 +stmt: GTU4(reg,mrc) "cmpl %1,%0\nja %a\n" 4 +stmt: LEU4(reg,mrc) "cmpl %1,%0\njbe %a\n" 4 +stmt: LTU4(reg,mrc) "cmpl %1,%0\njb %a\n" 4 +stmt: NEU4(reg,mrc) "cmpl %1,%0\njne %a\n" 4 + +stmt: EQI4(BANDU4(mr,con),con0) "testl %1,%0\nje %a\n" 3 +stmt: NEI4(BANDU4(mr,con),con0) "testl %1,%0\njne %a\n" + +stmt: EQI4(BANDU4(CVII2(INDIRI2(addr)),con),con0) "testw %1,%0\nje %a\n" +stmt: NEI4(BANDU4(CVII2(INDIRI2(addr)),con),con0) "testw %1,%0\njne %a\n" +stmt: EQI4(BANDU4(CVIU2(INDIRI2(addr)),con),con0) "testw %1,%0\nje %a\n" +stmt: NEI4(BANDU4(CVIU2(INDIRI2(addr)),con),con0) "testw %1,%0\njne %a\n" +stmt: EQI4(BANDU4(CVII1(INDIRI1(addr)),con),con0) "testb %1,%0\nje %a\n" + +cmpf: INDIRF8(addr) "l %0" +cmpf: INDIRF4(addr) "s %0" +cmpf: CVFF8(INDIRF4(addr)) "s %0" +cmpf: freg "p" + +stmt: EQF8(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp 1f\nje %a\n1:\n" +stmt: GEF8(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\njbe %a\n" +stmt: GTF8(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\njb %a\n" +stmt: LEF8(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\njae %a\n" +stmt: LTF8(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\nja %a\n" +stmt: NEF8(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\njne %a\n" + +stmt: EQF4(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp 1f\nje %a\n1:\n" +stmt: GEF4(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\njbe %a\n" +stmt: GTF4(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\njb %a\n" +stmt: LEF4(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\njae %a\n" +stmt: LTF4(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\nja %a\n" +stmt: NEF4(cmpf,freg) "fcomp%0\nfstsw %%ax\nsahf\njp %a\njne %a\n" + +freg: DIVF8(freg,CVIF8(INDIRI4(addr))) "fidivl %1\n" +freg: DIVF8(CVIF8(INDIRI4(addr)),freg) "fidivrl %0\n" +freg: DIVF8(freg,CVIF8(CVII2(INDIRI2(addr)))) "fidivs %1\n" +freg: DIVF8(CVIF8(CVII2(INDIRI2(addr))),freg) "fidivrs %0\n" +freg: MULF8(freg,CVIF8(INDIRI4(addr))) "fimull %1\n" +freg: MULF8(freg,CVIF8(CVII2(INDIRI2(addr)))) "fimuls %1\n" +freg: SUBF8(freg,CVIF8(INDIRI4(addr))) "fisubl %1\n" +freg: SUBF8(CVIF8(INDIRI4(addr)),freg) "fisubrl %0\n" +freg: SUBF8(freg,CVIF8(CVII2(INDIRI2(addr)))) "fisubs %1\n" +freg: SUBF8(CVIF8(CVII2(INDIRI2(addr))),freg) "fisubrs %0\n" +freg: ADDF8(freg,CVIF8(INDIRI4(addr))) "fiaddl %1\n" +freg: ADDF8(freg,CVIF8(CVII2(INDIRI2(addr)))) "fiadds %1\n" +freg: ADDF8(freg,CVFF8(INDIRF4(addr))) "fdivs %1\n" +freg: SUBF8(freg,CVFF8(INDIRF4(addr))) "fsubs %1\n" +freg: MULF8(freg,CVFF8(INDIRF4(addr))) "fmuls %1\n" +freg: DIVF8(freg,CVFF8(INDIRF4(addr))) "fdivs %1\n" +freg: LOADF8(memf) "fld%0\n" + +reg: CALLI4(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) +reg: CALLU4(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) +reg: CALLP4(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) + +reg: CALLI4(addrj) "call %0\n" 1 +reg: CALLU4(addrj) "call %0\n" 1 +reg: CALLP4(addrj) "call %0\n" 1 + +stmt: CALLV(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) +stmt: CALLV(addrj) "call %0\n" 1 + +freg: CALLF4(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) +freg: CALLF4(addrj) "call %0\n" 1 + +stmt: CALLF4(addrj) "call %0\naddl $%a,%%esp\nfstp %%st(0)\n" hasargs(a) +stmt: CALLF4(addrj) "call %0\nfstp %%st(0)\n" 1 + +freg: CALLF8(addrj) "call %0\naddl $%a,%%esp\n" hasargs(a) +freg: CALLF8(addrj) "call %0\n" 1 + +stmt: CALLF8(addrj) "call %0\naddl $%a,%%esp\nfstp %%st(0)\n" hasargs(a) +stmt: CALLF8(addrj) "call %0\nfstp %%st(0)\n" 1 + +stmt: RETI4(reg) "# ret\n" +stmt: RETU4(reg) "# ret\n" +stmt: RETP4(reg) "# ret\n" +stmt: RETF4(freg) "# ret\n" +stmt: RETF8(freg) "# ret\n" +%% +static void progbeg(int argc, char *argv[]) { + int i; + extern Interface x86IR, x86linuxIR; + +#define xx(f) assert(!x86linuxIR.f); x86linuxIR.f = x86IR.f + xx(address); + xx(local); + xx(x.blkfetch); + xx(x.blkstore); + xx(x.blkloop); + xx(x.doarg); +#undef xx + { + union { + char c; + int i; + } u; + u.i = 0; + u.c = 1; + swap = ((int)(u.i == 1)) != IR->little_endian; + } + parseflags(argc, argv); + for (i = 0; i < argc; i++) + if (strcmp(argv[i], "-p") == 0 || strcmp(argv[i], "-pg") == 0) + pflag = 1; + intreg[EAX] = mkreg("%%eax", EAX, 1, IREG); + intreg[EDX] = mkreg("%%edx", EDX, 1, IREG); + intreg[ECX] = mkreg("%%ecx", ECX, 1, IREG); + intreg[EBX] = mkreg("%%ebx", EBX, 1, IREG); + intreg[ESI] = mkreg("%%esi", ESI, 1, IREG); + intreg[EDI] = mkreg("%%edi", EDI, 1, IREG); + shortreg[EAX] = mkreg("%%ax", EAX, 1, IREG); + shortreg[ECX] = mkreg("%%cx", ECX, 1, IREG); + shortreg[EDX] = mkreg("%%dx", EDX, 1, IREG); + shortreg[EBX] = mkreg("%%bx", EBX, 1, IREG); + shortreg[ESI] = mkreg("%%si", ESI, 1, IREG); + shortreg[EDI] = mkreg("%%di", EDI, 1, IREG); + charreg[EAX] = mkreg("%%al", EAX, 1, IREG); + charreg[ECX] = mkreg("%%cl", ECX, 1, IREG); + charreg[EDX] = mkreg("%%dl", EDX, 1, IREG); + charreg[EBX] = mkreg("%%bl", EBX, 1, IREG); + for (i = 0; i < 8; i++) + fltreg[i] = mkreg("%d", i, 0, FREG); + charregw = mkwildcard(charreg); + shortregw = mkwildcard(shortreg); + intregw = mkwildcard(intreg); + fltregw = mkwildcard(fltreg); + + tmask[IREG] = (1<x.regnode->mask |= 1<x.regnode->mask |= 1<type->size > 0) + print(".size %s,%d\n", prevg->x.name, prevg->type->size); + prevg = NULL; +} + +static void progend(void) { + globalend(); + (*IR->segment)(CODE); + print(".ident \"LCC: 4.1\"\n"); +} + +static void target(Node p) { + assert(p); + switch (specific(p->op)) { + case RSH+I: case RSH+U: case LSH+I: case LSH+U: + if (generic(p->kids[1]->op) != CNST + && !( generic(p->kids[1]->op) == INDIR + && specific(p->kids[1]->kids[0]->op) == VREG+P + && p->kids[1]->syms[RX]->u.t.cse + && generic(p->kids[1]->syms[RX]->u.t.cse->op) == CNST)) { + rtarget(p, 1, intreg[ECX]); + setreg(p, intreg[EAX]); + } + break; + case MUL+U: + setreg(p, quo); + rtarget(p, 0, intreg[EAX]); + break; + case DIV+I: case DIV+U: + setreg(p, quo); + rtarget(p, 0, intreg[EAX]); + rtarget(p, 1, intreg[ECX]); + break; + case MOD+I: case MOD+U: + setreg(p, rem); + rtarget(p, 0, intreg[EAX]); + rtarget(p, 1, intreg[ECX]); + break; + case ASGN+B: + rtarget(p, 0, intreg[EDI]); + rtarget(p->kids[1], 0, intreg[ESI]); + break; + case ARG+B: + rtarget(p->kids[0], 0, intreg[ESI]); + break; + case CVF+I: + setreg(p, intreg[EAX]); + break; + case CALL+I: case CALL+U: case CALL+P: case CALL+V: + setreg(p, intreg[EAX]); + break; + case RET+I: case RET+U: case RET+P: + rtarget(p, 0, intreg[EAX]); + break; + } +} + +static void clobber(Node p) { + static int nstack = 0; + + assert(p); + nstack = ckstack(p, nstack); + switch (specific(p->op)) { + case ASGN+B: case ARG+B: + spill(1<op); +#define preg(f) ((f)[getregnum(p->x.kids[0])]->x.name) + + if (op == CVI+I && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 1) + print("movsbl %s,%s\n", preg(charreg), p->syms[RX]->x.name); + else if (op == CVI+U && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 1) + print("movsbl %s,%s\n", preg(charreg), p->syms[RX]->x.name); + else if (op == CVI+I && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 2) + print("movswl %s,%s\n", preg(shortreg), p->syms[RX]->x.name); + else if (op == CVI+U && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 2) + print("movswl %s,%s\n", preg(shortreg), p->syms[RX]->x.name); + else if (op == CVU+I && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 1) + print("movzbl %s,%s\n", preg(charreg), p->syms[RX]->x.name); + else if (op == CVU+U && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 1) + print("movzbl %s,%s\n", preg(charreg), p->syms[RX]->x.name); + else if (op == CVU+I && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 2) + print("movzwl %s,%s\n", preg(shortreg), p->syms[RX]->x.name); + else if (op == CVU+U && opsize(p->op) == 4 && opsize(p->x.kids[0]->op) == 2) + print("movzwl %s,%s\n", preg(shortreg), p->syms[RX]->x.name); + else if (generic(op) == CVI || generic(op) == CVU || generic(op) == LOAD) { + char *dst = intreg[getregnum(p)]->x.name; + char *src = preg(intreg); + assert(opsize(p->op) <= opsize(p->x.kids[0]->op)); + if (dst != src) + print("movl %s,%s\n", src, dst); + } else if (op == ARG+B) + print("subl $%d,%%esp\nmovl %%esp,%%edi\nmovl $%d,%%ecx\nrep\nmovsb\n", + roundup(p->syms[0]->u.c.v.i, 4), p->syms[0]->u.c.v.i); +} + +static void function(Symbol f, Symbol caller[], Symbol callee[], int n) { + int i; + + globalend(); + print(".align 16\n"); + print(".type %s,@function\n", f->x.name); + print("%s:\n", f->x.name); + print("pushl %%ebp\n"); + if (pflag) { + static int plab; + print("movl %%esp,%%ebp\n"); + (*IR->segment)(DATA); + print(".align 4\n.LP%d:\n.long 0\n", plab); + (*IR->segment)(CODE); + print("movl $.LP%d,%%edx\ncall mcount\n", plab); + plab++; + } + print("pushl %%ebx\n"); + print("pushl %%esi\n"); + print("pushl %%edi\n"); + print("movl %%esp,%%ebp\n"); + + usedmask[0] = usedmask[1] = 0; + freemask[0] = freemask[1] = ~0U; + offset = 16 + 4; + for (i = 0; callee[i]; i++) { + Symbol p = callee[i]; + Symbol q = caller[i]; + assert(q); + offset = roundup(offset, q->type->align); + p->x.offset = q->x.offset = offset; + p->x.name = q->x.name = stringf("%d", p->x.offset); + p->sclass = q->sclass = AUTO; + offset += roundup(q->type->size, 4); + } + assert(caller[i] == 0); + offset = maxoffset = 0; + gencode(caller, callee); + framesize = roundup(maxoffset, 4); + if (framesize > 0) + print("subl $%d,%%esp\n", framesize); + emitcode(); + print("movl %%ebp,%%esp\n"); + print("popl %%edi\n"); + print("popl %%esi\n"); + print("popl %%ebx\n"); + print("popl %%ebp\n"); + print("ret\n"); + { int l = genlabel(1); + print(".Lf%d:\n", l); + print(".size %s,.Lf%d-%s\n", f->x.name, l, f->x.name); + } +} + +static void defsymbol(Symbol p) { + if (p->scope >= LOCAL && p->sclass == STATIC) + p->x.name = stringf("%s.%d", p->name, genlabel(1)); + else if (p->generated) + p->x.name = stringf(".LC%s", p->name); + else if (p->scope == GLOBAL || p->sclass == EXTERN) + p->x.name = stringf("%s", p->name); + else + p->x.name = p->name; +} + +static void segment(int n) { + if (n == cseg) + return; + cseg = n; + if (cseg == CODE) + print(".text\n"); + else if (cseg == BSS) + print(".bss\n"); + else if (cseg == DATA || cseg == LIT) + print(".data\n"); +} + +static void defconst(int suffix, int size, Value v) { + if (suffix == I && size == 1) + print(".byte %d\n", (int)v.u); + else if (suffix == I && size == 2) + print(".word %d\n", (int)v.i); + else if (suffix == I && size == 4) + print(".long %d\n", (int)v.i); + else if (suffix == U && size == 1) + print(".byte %d\n", (int)((char)v.u)); + else if (suffix == U && size == 2) + print(".word %d\n", (int)v.u); + else if (suffix == U && size == 4) + print(".long %d\n", (int)v.u); + else if (suffix == P && size == 4) + print(".long %d\n", (int)v.p); + else if (suffix == F && size == 4) { + float f = v.d; + print(".long %d\n", (int)(*(unsigned *)&f)); + } else if (suffix == F && size == 8) { + double d = v.d; + unsigned *p = (unsigned *)&d; + print(".long %d\n.long %d\n", (int)p[swap], (int)p[!swap]); + } + else assert(0); +} + +static void defaddress(Symbol p) { + print(".long %s\n", p->x.name); +} + +static void defstring(int n, char *str) { + char *s; + + for (s = str; s < str + n; s++) + print(".byte %d\n", (*s)&0377); +} + +static void export(Symbol p) { + globalend(); + print(".globl %s\n", p->x.name); +} + +static void import(Symbol p) {} + +static void global(Symbol p) { + globalend(); + print(".align %d\n", p->type->align > 4 ? 4 : p->type->align); + if (!p->generated) { + print(".type %s,@%s\n", p->x.name, + isfunc(p->type) ? "function" : "object"); + if (p->type->size > 0) + print(".size %s,%d\n", p->x.name, p->type->size); + else + prevg = p; + } + if (p->u.seg == BSS) { + if (p->sclass == STATIC) + print(".lcomm %s,%d\n", p->x.name, p->type->size); + else + print(".comm %s,%d\n", p->x.name, p->type->size); + } else { + print("%s:\n", p->x.name); + } +} + +static void space(int n) { + if (cseg != BSS) + print(".space %d\n", n); +} + +Interface x86linuxIR = { + 1, 1, 0, /* char */ + 2, 2, 0, /* short */ + 4, 4, 0, /* int */ + 4, 4, 0, /* long */ + 4, 4, 0, /* long long */ + 4, 4, 1, /* float */ + 8, 4, 1, /* double */ + 8, 4, 1, /* long double */ + 4, 4, 0, /* T * */ + 0, 1, 0, /* struct */ + 1, /* little_endian */ + 0, /* mulops_calls */ + 0, /* wants_callb */ + 1, /* wants_argb */ + 0, /* left_to_right */ + 0, /* wants_dag */ + 0, /* unsigned_char */ + 0, /* address */ + blockbeg, + blockend, + defaddress, + defconst, + defstring, + defsymbol, + emit, + export, + function, + gen, + global, + import, + 0, /* local */ + progbeg, + progend, + segment, + space, + stabblock, stabend, 0, stabinit, stabline, stabsym, stabtype, + {1, rmap, + 0, 0, 0, /* blkfetch, blkstore, blkloop */ + _label, + _rule, + _nts, + _kids, + _string, + _templates, + _isinstruction, + _ntname, + emit2, + 0, /* doarg */ + target, + clobber, + } +}; diff --git a/src/cmd/picoc-1/Makefile b/src/cmd/picoc-1/Makefile new file mode 100644 index 0000000..c31e8ee --- /dev/null +++ b/src/cmd/picoc-1/Makefile @@ -0,0 +1,115 @@ +TOPSRC = $(shell cd ../../..; pwd) +#include $(TOPSRC)/target.mk +MACHINE = mips +DESTDIR ?= $(TOPSRC) + +# chipKIT PIC32 compiler on Linux +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Download from https://github.com/jasonkajita/chipKIT-cxx/downloads +# and unzip to /usr/local. +# Need to copy pic32-tools/pic32mx/include/stdarg.h +# to pic32-tools/lib/gcc/pic32mx/4.5.1/include. +# MPLABX C32 compiler doesn't support some functionality +# we need, so use chipKIT compiler by default. +ifndef GCCPREFIX + GCCPREFIX = /usr/local/pic32-tools/bin/pic32- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips + INCLUDES = -I/usr/local/pic32-tools/lib/gcc/pic32mx/4.5.1/include +endif + +CC = $(GCCPREFIX)gcc -mips32r2 -EL -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) +CXX = $(GCCPREFIX)g++ -mips32r2 -EL -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) +LD = $(GCCPREFIX)ld +AR = $(GCCPREFIX)ar +RANLIB = $(GCCPREFIX)ranlib +SIZE = $(GCCPREFIX)size +OBJDUMP = $(GCCPREFIX)objdump -mmips:isa32r2 +AS = $(CC) -x assembler-with-cpp -c +YACC = byacc +LEX = flex +INSTALL = install -m 644 +INSTALLDIR = install -m 755 -d +TAGSFILE = tags +MANROFF = nroff -man -h +ELF2AOUT = $(TOPSRC)/tools/elf2aout/elf2aout + +CFLAGS = -O -g + +#LDFLAGS += -N -nostartfiles -fno-dwarf2-cfi-asm -T$(TOPSRC)/src/elf32-mips.ld \ +# $(TOPSRC)/src/crt0.o -L$(TOPSRC)/src + +LIBS = -lc + +### END OF TARGET INCLUDE + +#CC=gcc +CFLAGS+= -g -DUNIX_HOST -DVER=\"`svnversion -n`\" -DFILENAME_MAX=64 -DL_tmpnam=30 -DCLOCKS_PER_SEC=80000000 -DPATH_MAX=200 -Os +LIBS=-lm -lc + +TARGET = picoc.bin +SRCS = picoc.c table.c lex.c parse.c expression.c heap.c type.c \ + variable.c clibrary.c platform.c include.c debug.c \ + platform/platform_unix.c platform/library_unix.c \ + cstdlib/stdio.c cstdlib/math.c cstdlib/string.c cstdlib/stdlib.c \ + cstdlib/time.c cstdlib/errno.c cstdlib/ctype.c cstdlib/stdbool.c \ + cstdlib/unistd.c retrobsd.c +OBJS := $(SRCS:%.c=%.o) + +LDFLAGS += -N -nostartfiles -fno-dwarf2-cfi-asm \ + -L$(TOPSRC)/src +LDFLAGS += -T using-bootloader.ld -Wl,-Map=picoc.map + +OBJCOPY = $(GCCPREFIX)objcopy + +all: $(TARGET) + +$(TARGET): $(OBJS) crt0.o + ${CC} ${LDFLAGS} -o ${TARGET}.elf crt0.o ${OBJS} ${LIBS} + ${OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis + ${SIZE} ${TARGET}.elf + $(OBJCOPY) -O binary ${TARGET}.elf ${TARGET} + $(OBJCOPY) -O ihex --change-addresses=0xa0000000 ${TARGET}.elf ${TARGET}.hex + #${ELF2AOUT} ${TARGET}.elf $@ + cp $(TARGET) $(TOPSRC)/uflash + +install: $(TARGET) + cp $(TARGET) $(TOPSRC)/uflash + +test: all + (cd tests; make test) + +clean: + rm -f $(TARGET) $(OBJS) *~ *.elf *.dis + +count: + @echo "Core:" + @cat picoc.h interpreter.h picoc.c table.c lex.c parse.c expression.c platform.c heap.c type.c variable.c include.c debug.c | grep -v '^[ ]*/\*' | grep -v '^[ ]*$$' | wc + @echo "" + @echo "Everything:" + @cat $(SRCS) *.h */*.h | wc + +.PHONY: clibrary.c + +picoc.o: picoc.c picoc.h +table.o: table.c interpreter.h platform.h +lex.o: lex.c interpreter.h platform.h +parse.o: parse.c picoc.h interpreter.h platform.h +expression.o: expression.c interpreter.h platform.h +heap.o: heap.c interpreter.h platform.h +type.o: type.c interpreter.h platform.h +variable.o: variable.c interpreter.h platform.h +clibrary.o: clibrary.c picoc.h interpreter.h platform.h +platform.o: platform.c picoc.h interpreter.h platform.h +include.o: include.c picoc.h interpreter.h platform.h +debug.o: debug.c interpreter.h platform.h +platform/platform_unix.o: platform/platform_unix.c picoc.h interpreter.h platform.h +platform/library_unix.o: platform/library_unix.c interpreter.h platform.h +cstdlib/stdio.o: cstdlib/stdio.c interpreter.h platform.h +cstdlib/math.o: cstdlib/math.c interpreter.h platform.h +cstdlib/string.o: cstdlib/string.c interpreter.h platform.h +cstdlib/stdlib.o: cstdlib/stdlib.c interpreter.h platform.h +cstdlib/time.o: cstdlib/time.c interpreter.h platform.h +cstdlib/errno.o: cstdlib/errno.c interpreter.h platform.h +cstdlib/ctype.o: cstdlib/ctype.c interpreter.h platform.h +cstdlib/stdbool.o: cstdlib/stdbool.c interpreter.h platform.h +cstdlib/unistd.o: cstdlib/unistd.c interpreter.h platform.h diff --git a/src/cmd/picoc-1/README b/src/cmd/picoc-1/README new file mode 100644 index 0000000..18779d3 --- /dev/null +++ b/src/cmd/picoc-1/README @@ -0,0 +1,91 @@ +picoc +----- + +PicoC is a very small C interpreter for scripting. It was originally written +as a script language for a UAV's on-board flight system. It's also very +suitable for other robotic, embedded and non-embedded applications. + +The core C source code is around 3500 lines of code. It's not intended to be +a complete implementation of ISO C but it has all the essentials. When +compiled it only takes a few k of code space and is also very sparing of +data space. This means it can work well in small embedded devices. It's also +a fun example of how to create a very small language implementation while +still keeping the code readable. + +picoc is now feature frozen. Since it's important that it remain small it's +intended that no more major features will be added from now on. It's been +tested on x86-32, x86-64, powerpc, arm, ultrasparc, HP-PA and blackfin +processors and is easy to port to new targets. + + +Compiling picoc +--------------- + +picoc can be compiled for a UNIX/Linux/POSIX host by typing "make". + +The test suite can be run by typing "make test". + + +Porting picoc +------------- + +platform.h is where you select your platform type and specify the includes +etc. for your platform. + +platform_XXX.c contains support functions so the compiler can work on +your platform, such as how to write characters to the console etc.. + +platform_library.c contains your library of functions you want to make +available to user programs. + +There's also a clibrary.c which contains user library functions like +printf() which are platform-independent. + +Porting the system will involve setting up suitable includes and defines +in platform.h, writing some I/O routines in platform_XXX.c, putting +whatever user functions you want in platform_library.c and then changing +the main program in picoc.c to whatever you need to do to get programs +into the system. + +platform.h is set to UNIX_HOST by default so tests can be easily run on +a UNIX system. You'll need to specify your own host setup dependent on +your target platform. + + +Copyright +--------- + +picoc is published under the "New BSD License". +http://www.opensource.org/licenses/bsd-license.php + + +Copyright (c) 2009-2011, Zik Saleeba +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 Zik Saleeba 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 +OWNER 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. diff --git a/src/cmd/picoc-1/clibrary.c b/src/cmd/picoc-1/clibrary.c new file mode 100644 index 0000000..a87ebfd --- /dev/null +++ b/src/cmd/picoc-1/clibrary.c @@ -0,0 +1,679 @@ +/* picoc mini standard C library - provides an optional tiny C standard library + * if BUILTIN_MINI_STDLIB is defined */ + +#include "picoc.h" +#include "interpreter.h" + +/* the picoc version string */ +static const char *VersionString = NULL; + +/* endian-ness checking */ +static const int __ENDIAN_CHECK__ = 1; + +static int BigEndian = 0; +static int LittleEndian = 0; + + +/* global initialisation for libraries */ +void LibraryInit() +{ + /* define the version number macro */ + VersionString = TableStrRegister(PICOC_VERSION); + VariableDefinePlatformVar(NULL, "PICOC_VERSION", CharPtrType, (union AnyValue *)&VersionString, FALSE); + + /* define endian-ness macros */ + BigEndian = ((*(char*)&__ENDIAN_CHECK__) == 0); + LittleEndian = ((*(char*)&__ENDIAN_CHECK__) == 1); + + VariableDefinePlatformVar(NULL, "BIG_ENDIAN", &IntType, (union AnyValue *)&BigEndian, FALSE); + VariableDefinePlatformVar(NULL, "LITTLE_ENDIAN", &IntType, (union AnyValue *)&LittleEndian, FALSE); +} + +/* add a library */ +void LibraryAdd(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList) +{ + struct ParseState Parser; + int Count; + char *Identifier; + struct ValueType *ReturnType; + struct Value *NewValue; + void *Tokens; + char *IntrinsicName = TableStrRegister("c library"); + + /* read all the library definitions */ + for (Count = 0; FuncList[Count].Prototype != NULL; Count++) + { + Tokens = LexAnalyse(IntrinsicName, FuncList[Count].Prototype, strlen((char *)FuncList[Count].Prototype), NULL); + LexInitParser(&Parser, FuncList[Count].Prototype, Tokens, IntrinsicName, TRUE, FALSE); + TypeParse(&Parser, &ReturnType, &Identifier, NULL); + NewValue = ParseFunctionDefinition(&Parser, ReturnType, Identifier); + NewValue->Val->FuncDef.Intrinsic = FuncList[Count].Func; + HeapFreeMem(Tokens); + } +} + +/* print a type to a stream without using printf/sprintf */ +void PrintType(struct ValueType *Typ, IOFILE *Stream) +{ + switch (Typ->Base) + { + case TypeVoid: PrintStr("void", Stream); break; + case TypeInt: PrintStr("int", Stream); break; + case TypeShort: PrintStr("short", Stream); break; + case TypeChar: PrintStr("char", Stream); break; + case TypeLong: PrintStr("long", Stream); break; + case TypeUnsignedInt: PrintStr("unsigned int", Stream); break; + case TypeUnsignedShort: PrintStr("unsigned short", Stream); break; + case TypeUnsignedLong: PrintStr("unsigned long", Stream); break; +#ifndef NO_FP + case TypeFP: PrintStr("double", Stream); break; +#endif + case TypeFunction: PrintStr("function", Stream); break; + case TypeMacro: PrintStr("macro", Stream); break; + case TypePointer: if (Typ->FromType) PrintType(Typ->FromType, Stream); PrintCh('*', Stream); break; + case TypeArray: PrintType(Typ->FromType, Stream); PrintCh('[', Stream); if (Typ->ArraySize != 0) PrintSimpleInt(Typ->ArraySize, Stream); PrintCh(']', Stream); break; + case TypeStruct: PrintStr("struct ", Stream); PrintStr(Typ->Identifier, Stream); break; + case TypeUnion: PrintStr("union ", Stream); PrintStr(Typ->Identifier, Stream); break; + case TypeEnum: PrintStr("enum ", Stream); PrintStr(Typ->Identifier, Stream); break; + case TypeGotoLabel: PrintStr("goto label ", Stream); break; + case Type_Type: PrintStr("type ", Stream); break; + } +} + + +#ifdef BUILTIN_MINI_STDLIB + +/* + * This is a simplified standard library for small embedded systems. It doesn't require + * a system stdio library to operate. + * + * A more complete standard library for larger computers is in the library_XXX.c files. + */ + +IOFILE *CStdOut; +IOFILE CStdOutBase; + +static int TRUEValue = 1; +static int ZeroValue = 0; + +void BasicIOInit() +{ + CStdOutBase.Putch = &PlatformPutc; + CStdOut = &CStdOutBase; +} + +/* initialise the C library */ +void CLibraryInit() +{ + /* define some constants */ + VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); + VariableDefinePlatformVar(NULL, "TRUE", &IntType, (union AnyValue *)&TRUEValue, FALSE); + VariableDefinePlatformVar(NULL, "FALSE", &IntType, (union AnyValue *)&ZeroValue, FALSE); +} + +/* stream for writing into strings */ +void SPutc(unsigned char Ch, union OutputStreamInfo *Stream) +{ + struct StringOutputStream *Out = &Stream->Str; + *Out->WritePos++ = Ch; +} + +/* print a character to a stream without using printf/sprintf */ +void PrintCh(char OutCh, struct OutputStream *Stream) +{ + (*Stream->Putch)(OutCh, &Stream->i); +} + +/* print a string to a stream without using printf/sprintf */ +void PrintStr(const char *Str, struct OutputStream *Stream) +{ + while (*Str != 0) + PrintCh(*Str++, Stream); +} + +/* print a single character a given number of times */ +void PrintRepeatedChar(char ShowChar, int Length, struct OutputStream *Stream) +{ + while (Length-- > 0) + PrintCh(ShowChar, Stream); +} + +/* print an unsigned integer to a stream without using printf/sprintf */ +void PrintUnsigned(unsigned long Num, unsigned int Base, int FieldWidth, int ZeroPad, int LeftJustify, struct OutputStream *Stream) +{ + char Result[33]; + int ResPos = sizeof(Result); + + Result[--ResPos] = '\0'; + if (Num == 0) + Result[--ResPos] = '0'; + + while (Num > 0) + { + unsigned long NextNum = Num / Base; + unsigned long Digit = Num - NextNum * Base; + if (Digit < 10) + Result[--ResPos] = '0' + Digit; + else + Result[--ResPos] = 'a' + Digit - 10; + + Num = NextNum; + } + + if (FieldWidth > 0 && !LeftJustify) + PrintRepeatedChar(ZeroPad ? '0' : ' ', FieldWidth - (sizeof(Result) - 1 - ResPos), Stream); + + PrintStr(&Result[ResPos], Stream); + + if (FieldWidth > 0 && LeftJustify) + PrintRepeatedChar(' ', FieldWidth - (sizeof(Result) - 1 - ResPos), Stream); +} + +/* print an integer to a stream without using printf/sprintf */ +void PrintSimpleInt(long Num, struct OutputStream *Stream) +{ + PrintInt(Num, -1, FALSE, FALSE, Stream); +} + +/* print an integer to a stream without using printf/sprintf */ +void PrintInt(long Num, int FieldWidth, int ZeroPad, int LeftJustify, struct OutputStream *Stream) +{ + if (Num < 0) + { + PrintCh('-', Stream); + Num = -Num; + if (FieldWidth != 0) + FieldWidth--; + } + + PrintUnsigned((unsigned long)Num, 10, FieldWidth, ZeroPad, LeftJustify, Stream); +} + +#ifndef NO_FP +/* print a double to a stream without using printf/sprintf */ +void PrintFP(double Num, struct OutputStream *Stream) +{ + int Exponent = 0; + int MaxDecimal; + + if (Num < 0) + { + PrintCh('-', Stream); + Num = -Num; + } + + if (Num >= 1e7) + Exponent = log10(Num); + else if (Num <= 1e-7 && Num != 0.0) + Exponent = log10(Num) - 0.999999999; + + Num /= pow(10.0, Exponent); + PrintInt((long)Num, 0, FALSE, FALSE, Stream); + PrintCh('.', Stream); + Num = (Num - (long)Num) * 10; + if (abs(Num) >= 1e-7) + { + for (MaxDecimal = 6; MaxDecimal > 0 && abs(Num) >= 1e-7; Num = (Num - (long)(Num + 1e-7)) * 10, MaxDecimal--) + PrintCh('0' + (long)(Num + 1e-7), Stream); + } + else + PrintCh('0', Stream); + + if (Exponent != 0) + { + PrintCh('e', Stream); + PrintInt(Exponent, 0, FALSE, FALSE, Stream); + } +} +#endif + +/* intrinsic functions made available to the language */ +void GenericPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs, struct OutputStream *Stream) +{ + char *FPos; + struct Value *NextArg = Param[0]; + struct ValueType *FormatType; + int ArgCount = 1; + int LeftJustify = FALSE; + int ZeroPad = FALSE; + int FieldWidth = 0; + char *Format = Param[0]->Val->Pointer; + + for (FPos = Format; *FPos != '\0'; FPos++) + { + if (*FPos == '%') + { + FPos++; + if (*FPos == '-') + { + /* a leading '-' means left justify */ + LeftJustify = TRUE; + FPos++; + } + + if (*FPos == '0') + { + /* a leading zero means zero pad a decimal number */ + ZeroPad = TRUE; + FPos++; + } + + /* get any field width in the format */ + while (isdigit((int)*FPos)) + FieldWidth = FieldWidth * 10 + (*FPos++ - '0'); + + /* now check the format type */ + switch (*FPos) + { + case 's': FormatType = CharPtrType; break; + case 'd': case 'u': case 'x': case 'b': case 'c': FormatType = &IntType; break; +#ifndef NO_FP + case 'f': FormatType = &FPType; break; +#endif + case '%': PrintCh('%', Stream); FormatType = NULL; break; + case '\0': FPos--; FormatType = NULL; break; + default: PrintCh(*FPos, Stream); FormatType = NULL; break; + } + + if (FormatType != NULL) + { + /* we have to format something */ + if (ArgCount >= NumArgs) + PrintStr("XXX", Stream); /* not enough parameters for format */ + else + { + NextArg = (struct Value *)((char *)NextArg + MEM_ALIGN(sizeof(struct Value) + TypeStackSizeValue(NextArg))); + if (NextArg->Typ != FormatType && + !((FormatType == &IntType || *FPos == 'f') && IS_NUMERIC_COERCIBLE(NextArg)) && + !(FormatType == CharPtrType && (NextArg->Typ->Base == TypePointer || + (NextArg->Typ->Base == TypeArray && NextArg->Typ->FromType->Base == TypeChar) ) ) ) + PrintStr("XXX", Stream); /* bad type for format */ + else + { + switch (*FPos) + { + case 's': + { + char *Str; + + if (NextArg->Typ->Base == TypePointer) + Str = NextArg->Val->Pointer; + else + Str = &NextArg->Val->ArrayMem[0]; + + if (Str == NULL) + PrintStr("NULL", Stream); + else + PrintStr(Str, Stream); + break; + } + case 'd': PrintInt(ExpressionCoerceInteger(NextArg), FieldWidth, ZeroPad, LeftJustify, Stream); break; + case 'u': PrintUnsigned(ExpressionCoerceUnsignedInteger(NextArg), 10, FieldWidth, ZeroPad, LeftJustify, Stream); break; + case 'x': PrintUnsigned(ExpressionCoerceUnsignedInteger(NextArg), 16, FieldWidth, ZeroPad, LeftJustify, Stream); break; + case 'b': PrintUnsigned(ExpressionCoerceUnsignedInteger(NextArg), 2, FieldWidth, ZeroPad, LeftJustify, Stream); break; + case 'c': PrintCh(ExpressionCoerceUnsignedInteger(NextArg), Stream); break; +#ifndef NO_FP + case 'f': PrintFP(ExpressionCoerceFP(NextArg), Stream); break; +#endif + } + } + } + + ArgCount++; + } + } + else + PrintCh(*FPos, Stream); + } +} + +/* printf(): print to console output */ +void LibPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct OutputStream ConsoleStream; + + ConsoleStream.Putch = &PlatformPutc; + GenericPrintf(Parser, ReturnValue, Param, NumArgs, &ConsoleStream); +} + +/* sprintf(): print to a string */ +void LibSPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct OutputStream StrStream; + + StrStream.Putch = &SPutc; + StrStream.i.Str.Parser = Parser; + StrStream.i.Str.WritePos = Param[0]->Val->Pointer; + + GenericPrintf(Parser, ReturnValue, Param+1, NumArgs-1, &StrStream); + PrintCh(0, &StrStream); + ReturnValue->Val->Pointer = *Param; +} + +/* get a line of input. protected from buffer overrun */ +void LibGets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = PlatformGetLine(Param[0]->Val->Pointer, GETS_BUF_MAX, NULL); + if (ReturnValue->Val->Pointer != NULL) + { + char *EOLPos = strchr(Param[0]->Val->Pointer, '\n'); + if (EOLPos != NULL) + *EOLPos = '\0'; + } +} + +void LibGetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = PlatformGetCharacter(); +} + +void LibExit(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + PlatformExit(Param[0]->Val->Integer); +} + +#ifdef PICOC_LIBRARY +void LibSin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = sin(Param[0]->Val->FP); +} + +void LibCos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = cos(Param[0]->Val->FP); +} + +void LibTan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = tan(Param[0]->Val->FP); +} + +void LibAsin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = asin(Param[0]->Val->FP); +} + +void LibAcos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = acos(Param[0]->Val->FP); +} + +void LibAtan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = atan(Param[0]->Val->FP); +} + +void LibSinh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = sinh(Param[0]->Val->FP); +} + +void LibCosh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = cosh(Param[0]->Val->FP); +} + +void LibTanh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = tanh(Param[0]->Val->FP); +} + +void LibExp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = exp(Param[0]->Val->FP); +} + +void LibFabs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = fabs(Param[0]->Val->FP); +} + +void LibLog(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = log(Param[0]->Val->FP); +} + +void LibLog10(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = log10(Param[0]->Val->FP); +} + +void LibPow(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = pow(Param[0]->Val->FP, Param[1]->Val->FP); +} + +void LibSqrt(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = sqrt(Param[0]->Val->FP); +} + +void LibRound(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = floor(Param[0]->Val->FP + 0.5); /* XXX - fix for soft float */ +} + +void LibCeil(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = ceil(Param[0]->Val->FP); +} + +void LibFloor(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = floor(Param[0]->Val->FP); +} +#endif + +#ifndef NO_STRING_FUNCTIONS +void LibMalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = malloc(Param[0]->Val->Integer); +} + +#ifndef NO_CALLOC +void LibCalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = calloc(Param[0]->Val->Integer, Param[1]->Val->Integer); +} +#endif + +#ifndef NO_REALLOC +void LibRealloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = realloc(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} +#endif + +void LibFree(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + free(Param[0]->Val->Pointer); +} + +void LibStrcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + char *To = (char *)Param[0]->Val->Pointer; + char *From = (char *)Param[1]->Val->Pointer; + + while (*From != '\0') + *To++ = *From++; + + *To = '\0'; +} + +void LibStrncpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + char *To = (char *)Param[0]->Val->Pointer; + char *From = (char *)Param[1]->Val->Pointer; + int Len = Param[2]->Val->Integer; + + for (; *From != '\0' && Len > 0; Len--) + *To++ = *From++; + + if (Len > 0) + *To = '\0'; +} + +void LibStrcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + char *Str1 = (char *)Param[0]->Val->Pointer; + char *Str2 = (char *)Param[1]->Val->Pointer; + int StrEnded; + + for (StrEnded = FALSE; !StrEnded; StrEnded = (*Str1 == '\0' || *Str2 == '\0'), Str1++, Str2++) + { + if (*Str1 < *Str2) { ReturnValue->Val->Integer = -1; return; } + else if (*Str1 > *Str2) { ReturnValue->Val->Integer = 1; return; } + } + + ReturnValue->Val->Integer = 0; +} + +void LibStrncmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + char *Str1 = (char *)Param[0]->Val->Pointer; + char *Str2 = (char *)Param[1]->Val->Pointer; + int Len = Param[2]->Val->Integer; + int StrEnded; + + for (StrEnded = FALSE; !StrEnded && Len > 0; StrEnded = (*Str1 == '\0' || *Str2 == '\0'), Str1++, Str2++, Len--) + { + if (*Str1 < *Str2) { ReturnValue->Val->Integer = -1; return; } + else if (*Str1 > *Str2) { ReturnValue->Val->Integer = 1; return; } + } + + ReturnValue->Val->Integer = 0; +} + +void LibStrcat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + char *To = (char *)Param[0]->Val->Pointer; + char *From = (char *)Param[1]->Val->Pointer; + + while (*To != '\0') + To++; + + while (*From != '\0') + *To++ = *From++; + + *To = '\0'; +} + +void LibIndex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + char *Pos = (char *)Param[0]->Val->Pointer; + int SearchChar = Param[1]->Val->Integer; + + while (*Pos != '\0' && *Pos != SearchChar) + Pos++; + + if (*Pos != SearchChar) + ReturnValue->Val->Pointer = NULL; + else + ReturnValue->Val->Pointer = Pos; +} + +void LibRindex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + char *Pos = (char *)Param[0]->Val->Pointer; + int SearchChar = Param[1]->Val->Integer; + + ReturnValue->Val->Pointer = NULL; + for (; *Pos != '\0'; Pos++) + { + if (*Pos == SearchChar) + ReturnValue->Val->Pointer = Pos; + } +} + +void LibStrlen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + char *Pos = (char *)Param[0]->Val->Pointer; + int Len; + + for (Len = 0; *Pos != '\0'; Pos++) + Len++; + + ReturnValue->Val->Integer = Len; +} + +void LibMemset(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + /* we can use the system memset() */ + memset(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} + +void LibMemcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + /* we can use the system memcpy() */ + memcpy(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void LibMemcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + unsigned char *Mem1 = (unsigned char *)Param[0]->Val->Pointer; + unsigned char *Mem2 = (unsigned char *)Param[1]->Val->Pointer; + int Len = Param[2]->Val->Integer; + + for (; Len > 0; Mem1++, Mem2++, Len--) + { + if (*Mem1 < *Mem2) { ReturnValue->Val->Integer = -1; return; } + else if (*Mem1 > *Mem2) { ReturnValue->Val->Integer = 1; return; } + } + + ReturnValue->Val->Integer = 0; +} +#endif + +/* list of all library functions and their prototypes */ +struct LibraryFunction CLibrary[] = +{ + { LibPrintf, "void printf(char *, ...);" }, + { LibSPrintf, "char *sprintf(char *, char *, ...);" }, + { LibGets, "char *gets(char *);" }, + { LibGetc, "int getchar();" }, + { LibExit, "void exit(int);" }, +#ifdef PICOC_LIBRARY + { LibSin, "float sin(float);" }, + { LibCos, "float cos(float);" }, + { LibTan, "float tan(float);" }, + { LibAsin, "float asin(float);" }, + { LibAcos, "float acos(float);" }, + { LibAtan, "float atan(float);" }, + { LibSinh, "float sinh(float);" }, + { LibCosh, "float cosh(float);" }, + { LibTanh, "float tanh(float);" }, + { LibExp, "float exp(float);" }, + { LibFabs, "float fabs(float);" }, + { LibLog, "float log(float);" }, + { LibLog10, "float log10(float);" }, + { LibPow, "float pow(float,float);" }, + { LibSqrt, "float sqrt(float);" }, + { LibRound, "float round(float);" }, + { LibCeil, "float ceil(float);" }, + { LibFloor, "float floor(float);" }, +#endif + { LibMalloc, "void *malloc(int);" }, +#ifndef NO_CALLOC + { LibCalloc, "void *calloc(int,int);" }, +#endif +#ifndef NO_REALLOC + { LibRealloc, "void *realloc(void *,int);" }, +#endif + { LibFree, "void free(void *);" }, +#ifndef NO_STRING_FUNCTIONS + { LibStrcpy, "void strcpy(char *,char *);" }, + { LibStrncpy, "void strncpy(char *,char *,int);" }, + { LibStrcmp, "int strcmp(char *,char *);" }, + { LibStrncmp, "int strncmp(char *,char *,int);" }, + { LibStrcat, "void strcat(char *,char *);" }, + { LibIndex, "char *index(char *,int);" }, + { LibRindex, "char *rindex(char *,int);" }, + { LibStrlen, "int strlen(char *);" }, + { LibMemset, "void memset(void *,int,int);" }, + { LibMemcpy, "void memcpy(void *,void *,int);" }, + { LibMemcmp, "int memcmp(void *,void *,int);" }, +#endif + { NULL, NULL } +}; + +#endif /* BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/crt0.c b/src/cmd/picoc-1/crt0.c new file mode 100644 index 0000000..00bf8fa --- /dev/null +++ b/src/cmd/picoc-1/crt0.c @@ -0,0 +1,117 @@ +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ +#include +#include +#include + +/* + * C runtime startoff. When an a.out is loaded by the kernel, the kernel + * sets up the stack as follows: + * + * _________________________________ + * | (NULL) | top of memory + * |-------------------------------| + * | | + * | environment strings | + * | | + * |-------------------------------| + * | | + * | argument strings | + * | | + * |-------------------------------| + * | envv[envc] (NULL) | end of environment vector tag, a 0 + * |-------------------------------| + * | envv[envc-1] | pointer to last environment string + * |-------------------------------| + * | ... | + * |-------------------------------| + * | envv[0] | pointer to first environment string + * |-------------------------------| + * | argv[argc] (NULL) | end of argument vector tag, a 0 + * |-------------------------------| + * | argv[argc-1] | pointer to last argument string + * |-------------------------------| + * | ... | + * |-------------------------------| + * | argv[0] | pointer to first argument string + * |-------------------------------| + * | | space for fourth argument + * |-------------------------------| + * | | space for third argument + * |-------------------------------| + * | | space for second argument + * |-------------------------------| + * sp-> | | space for first + * --------------------------------- + * + * Arguments are passed in registers $a0, $a1 and $a2. + * Register $gp is set to the start of data section. + * + * Crt0 simply moves the env to environ variable, calculates + * the __progname and then calls main. + */ +extern int main (int, char ** /*, char ** */ ); + +char **environ; +const char *__progname = ""; + +void _start (int, char **, char **); + +extern void __data_start(); +extern void _etext(); + + +/* The entry function. */ +void +_start (argc, argv, env) + int argc; + char **argv; + char **env; +{ + asm volatile ("la $gp, _gp"); + + /* Copy the .data image from flash to ram. + * Linker places it at the end of .text segment. */ + extern unsigned _edata; + unsigned *src = (unsigned*) &_etext; + unsigned *dest = (unsigned*)&__data_start; + unsigned *limit = (unsigned*)&_edata; //0x7d03b554 0x7f00b550; + + + + extern char _end[]; + //extern const char *_curbrk; + //_curbrk = _end; + + _brk (_end); + + //sbrk((char*) - (char*)dest); + //brk((char*)0x7f00f000); //0x7f00c000 + + while (dest < limit) { + /*printf ("copy %08x from (%08x) to (%08x)\n", *src, src, dest);*/ + *dest++ = *src++; + } + unsigned *bssend = (unsigned*)_end; + while( dest < _end ) + *dest++ = 0; + + //printf("%p %p %p\n",(char*)&_edata,(char*)&__data_start,(char*)&_edata-(char*)&__data_start); + + environ = env; + if (argc > 0 && argv[0] != 0) { + const char *s; + + __progname = argv[0]; + for (s = __progname; *s != '\0'; s++) + if (*s == '/') + __progname = s + 1; + } + + //printf("%p %p %p %p\n",(char*)&_edata,(char*)&__data_start,(char*)&_edata-(char*)&__data_start, _end); + + exit (main (argc, argv)); +} diff --git a/src/cmd/picoc-1/cstdlib/ctype.c b/src/cmd/picoc-1/cstdlib/ctype.c new file mode 100644 index 0000000..d1e8140 --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/ctype.c @@ -0,0 +1,110 @@ +/* string.h library for large systems - small embedded systems use clibrary.c instead */ +#include +#include "../interpreter.h" + +#ifndef BUILTIN_MINI_STDLIB + +void StdIsalnum(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isalnum(Param[0]->Val->Integer); +} + +void StdIsalpha(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isalpha(Param[0]->Val->Integer); +} + +void StdIsblank(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int ch = Param[0]->Val->Integer; + ReturnValue->Val->Integer = (ch == ' ') | (ch == '\t'); +} + +void StdIscntrl(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = iscntrl(Param[0]->Val->Integer); +} + +void StdIsdigit(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isdigit(Param[0]->Val->Integer); +} + +void StdIsgraph(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isgraph(Param[0]->Val->Integer); +} + +void StdIslower(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = islower(Param[0]->Val->Integer); +} + +void StdIsprint(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isprint(Param[0]->Val->Integer); +} + +void StdIspunct(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = ispunct(Param[0]->Val->Integer); +} + +void StdIsspace(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isspace(Param[0]->Val->Integer); +} + +void StdIsupper(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isupper(Param[0]->Val->Integer); +} + +void StdIsxdigit(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isxdigit(Param[0]->Val->Integer); +} + +void StdTolower(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = tolower(Param[0]->Val->Integer); +} + +void StdToupper(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = toupper(Param[0]->Val->Integer); +} + +void StdIsascii(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isascii(Param[0]->Val->Integer); +} + +void StdToascii(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = toascii(Param[0]->Val->Integer); +} + +/* all string.h functions */ +struct LibraryFunction StdCtypeFunctions[] = +{ + { StdIsalnum, "int isalnum(int);" }, + { StdIsalpha, "int isalpha(int);" }, + { StdIsblank, "int isblank(int);" }, + { StdIscntrl, "int iscntrl(int);" }, + { StdIsdigit, "int isdigit(int);" }, + { StdIsgraph, "int isgraph(int);" }, + { StdIslower, "int islower(int);" }, + { StdIsprint, "int isprint(int);" }, + { StdIspunct, "int ispunct(int);" }, + { StdIsspace, "int isspace(int);" }, + { StdIsupper, "int isupper(int);" }, + { StdIsxdigit, "int isxdigit(int);" }, + { StdTolower, "int tolower(int);" }, + { StdToupper, "int toupper(int);" }, + { StdIsascii, "int isascii(int);" }, + { StdToascii, "int toascii(int);" }, + { NULL, NULL } +}; + +#endif /* !BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/cstdlib/errno.c b/src/cmd/picoc-1/cstdlib/errno.c new file mode 100644 index 0000000..e5becbf --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/errno.c @@ -0,0 +1,655 @@ +/* string.h library for large systems - small embedded systems use clibrary.c instead */ +#include +#include "../interpreter.h" + +#ifndef BUILTIN_MINI_STDLIB + +#ifdef EACCES +static int EACCESValue = EACCES; +#endif + +#ifdef EADDRINUSE +static int EADDRINUSEValue = EADDRINUSE; +#endif + +#ifdef EADDRNOTAVAIL +static int EADDRNOTAVAILValue = EADDRNOTAVAIL; +#endif + +#ifdef EAFNOSUPPORT +static int EAFNOSUPPORTValue = EAFNOSUPPORT; +#endif + +#ifdef EAGAIN +static int EAGAINValue = EAGAIN; +#endif + +#ifdef EALREADY +static int EALREADYValue = EALREADY; +#endif + +#ifdef EBADF +static int EBADFValue = EBADF; +#endif + +#ifdef EBADMSG +static int EBADMSGValue = EBADMSG; +#endif + +#ifdef EBUSY +static int EBUSYValue = EBUSY; +#endif + +#ifdef ECANCELED +static int ECANCELEDValue = ECANCELED; +#endif + +#ifdef ECHILD +static int ECHILDValue = ECHILD; +#endif + +#ifdef ECONNABORTED +static int ECONNABORTEDValue = ECONNABORTED; +#endif + +#ifdef ECONNREFUSED +static int ECONNREFUSEDValue = ECONNREFUSED; +#endif + +#ifdef ECONNRESET +static int ECONNRESETValue = ECONNRESET; +#endif + +#ifdef EDEADLK +static int EDEADLKValue = EDEADLK; +#endif + +#ifdef EDESTADDRREQ +static int EDESTADDRREQValue = EDESTADDRREQ; +#endif + +#ifdef EDOM +static int EDOMValue = EDOM; +#endif + +#ifdef EDQUOT +static int EDQUOTValue = EDQUOT; +#endif + +#ifdef EEXIST +static int EEXISTValue = EEXIST; +#endif + +#ifdef EFAULT +static int EFAULTValue = EFAULT; +#endif + +#ifdef EFBIG +static int EFBIGValue = EFBIG; +#endif + +#ifdef EHOSTUNREACH +static int EHOSTUNREACHValue = EHOSTUNREACH; +#endif + +#ifdef EIDRM +static int EIDRMValue = EIDRM; +#endif + +#ifdef EILSEQ +static int EILSEQValue = EILSEQ; +#endif + +#ifdef EINPROGRESS +static int EINPROGRESSValue = EINPROGRESS; +#endif + +#ifdef EINTR +static int EINTRValue = EINTR; +#endif + +#ifdef EINVAL +static int EINVALValue = EINVAL; +#endif + +#ifdef EIO +static int EIOValue = EIO; +#endif + +#ifdef EISCONN +static int EISCONNValue = EISCONN; +#endif + +#ifdef EISDIR +static int EISDIRValue = EISDIR; +#endif + +#ifdef ELOOP +static int ELOOPValue = ELOOP; +#endif + +#ifdef EMFILE +static int EMFILEValue = EMFILE; +#endif + +#ifdef EMLINK +static int EMLINKValue = EMLINK; +#endif + +#ifdef EMSGSIZE +static int EMSGSIZEValue = EMSGSIZE; +#endif + +#ifdef EMULTIHOP +static int EMULTIHOPValue = EMULTIHOP; +#endif + +#ifdef ENAMETOOLONG +static int ENAMETOOLONGValue = ENAMETOOLONG; +#endif + +#ifdef ENETDOWN +static int ENETDOWNValue = ENETDOWN; +#endif + +#ifdef ENETRESET +static int ENETRESETValue = ENETRESET; +#endif + +#ifdef ENETUNREACH +static int ENETUNREACHValue = ENETUNREACH; +#endif + +#ifdef ENFILE +static int ENFILEValue = ENFILE; +#endif + +#ifdef ENOBUFS +static int ENOBUFSValue = ENOBUFS; +#endif + +#ifdef ENODATA +static int ENODATAValue = ENODATA; +#endif + +#ifdef ENODEV +static int ENODEVValue = ENODEV; +#endif + +#ifdef ENOENT +static int ENOENTValue = ENOENT; +#endif + +#ifdef ENOEXEC +static int ENOEXECValue = ENOEXEC; +#endif + +#ifdef ENOLCK +static int ENOLCKValue = ENOLCK; +#endif + +#ifdef ENOLINK +static int ENOLINKValue = ENOLINK; +#endif + +#ifdef ENOMEM +static int ENOMEMValue = ENOMEM; +#endif + +#ifdef ENOMSG +static int ENOMSGValue = ENOMSG; +#endif + +#ifdef ENOPROTOOPT +static int ENOPROTOOPTValue = ENOPROTOOPT; +#endif + +#ifdef ENOSPC +static int ENOSPCValue = ENOSPC; +#endif + +#ifdef ENOSR +static int ENOSRValue = ENOSR; +#endif + +#ifdef ENOSTR +static int ENOSTRValue = ENOSTR; +#endif + +#ifdef ENOSYS +static int ENOSYSValue = ENOSYS; +#endif + +#ifdef ENOTCONN +static int ENOTCONNValue = ENOTCONN; +#endif + +#ifdef ENOTDIR +static int ENOTDIRValue = ENOTDIR; +#endif + +#ifdef ENOTEMPTY +static int ENOTEMPTYValue = ENOTEMPTY; +#endif + +#ifdef ENOTRECOVERABLE +static int ENOTRECOVERABLEValue = ENOTRECOVERABLE; +#endif + +#ifdef ENOTSOCK +static int ENOTSOCKValue = ENOTSOCK; +#endif + +#ifdef ENOTSUP +static int ENOTSUPValue = ENOTSUP; +#endif + +#ifdef ENOTTY +static int ENOTTYValue = ENOTTY; +#endif + +#ifdef ENXIO +static int ENXIOValue = ENXIO; +#endif + +#ifdef EOPNOTSUPP +static int EOPNOTSUPPValue = EOPNOTSUPP; +#endif + +#ifdef EOVERFLOW +static int EOVERFLOWValue = EOVERFLOW; +#endif + +#ifdef EOWNERDEAD +static int EOWNERDEADValue = EOWNERDEAD; +#endif + +#ifdef EPERM +static int EPERMValue = EPERM; +#endif + +#ifdef EPIPE +static int EPIPEValue = EPIPE; +#endif + +#ifdef EPROTO +static int EPROTOValue = EPROTO; +#endif + +#ifdef EPROTONOSUPPORT +static int EPROTONOSUPPORTValue = EPROTONOSUPPORT; +#endif + +#ifdef EPROTOTYPE +static int EPROTOTYPEValue = EPROTOTYPE; +#endif + +#ifdef ERANGE +static int ERANGEValue = ERANGE; +#endif + +#ifdef EROFS +static int EROFSValue = EROFS; +#endif + +#ifdef ESPIPE +static int ESPIPEValue = ESPIPE; +#endif + +#ifdef ESRCH +static int ESRCHValue = ESRCH; +#endif + +#ifdef ESTALE +static int ESTALEValue = ESTALE; +#endif + +#ifdef ETIME +static int ETIMEValue = ETIME; +#endif + +#ifdef ETIMEDOUT +static int ETIMEDOUTValue = ETIMEDOUT; +#endif + +#ifdef ETXTBSY +static int ETXTBSYValue = ETXTBSY; +#endif + +#ifdef EWOULDBLOCK +static int EWOULDBLOCKValue = EWOULDBLOCK; +#endif + +#ifdef EXDEV +static int EXDEVValue = EXDEV; +#endif + + +/* creates various system-dependent definitions */ +void StdErrnoSetupFunc(void) +{ + /* defines */ +#ifdef EACCES + VariableDefinePlatformVar(NULL, "EACCES", &IntType, (union AnyValue *)&EACCESValue, FALSE); +#endif + +#ifdef EADDRINUSE + VariableDefinePlatformVar(NULL, "EADDRINUSE", &IntType, (union AnyValue *)&EADDRINUSEValue, FALSE); +#endif + +#ifdef EADDRNOTAVAIL + VariableDefinePlatformVar(NULL, "EADDRNOTAVAIL", &IntType, (union AnyValue *)&EADDRNOTAVAILValue, FALSE); +#endif + +#ifdef EAFNOSUPPORT + VariableDefinePlatformVar(NULL, "EAFNOSUPPORT", &IntType, (union AnyValue *)&EAFNOSUPPORTValue, FALSE); +#endif + +#ifdef EAGAIN + VariableDefinePlatformVar(NULL, "EAGAIN", &IntType, (union AnyValue *)&EAGAINValue, FALSE); +#endif + +#ifdef EALREADY + VariableDefinePlatformVar(NULL, "EALREADY", &IntType, (union AnyValue *)&EALREADYValue, FALSE); +#endif + +#ifdef EBADF + VariableDefinePlatformVar(NULL, "EBADF", &IntType, (union AnyValue *)&EBADFValue, FALSE); +#endif + +#ifdef EBADMSG + VariableDefinePlatformVar(NULL, "EBADMSG", &IntType, (union AnyValue *)&EBADMSGValue, FALSE); +#endif + +#ifdef EBUSY + VariableDefinePlatformVar(NULL, "EBUSY", &IntType, (union AnyValue *)&EBUSYValue, FALSE); +#endif + +#ifdef ECANCELED + VariableDefinePlatformVar(NULL, "ECANCELED", &IntType, (union AnyValue *)&ECANCELEDValue, FALSE); +#endif + +#ifdef ECHILD + VariableDefinePlatformVar(NULL, "ECHILD", &IntType, (union AnyValue *)&ECHILDValue, FALSE); +#endif + +#ifdef ECONNABORTED + VariableDefinePlatformVar(NULL, "ECONNABORTED", &IntType, (union AnyValue *)&ECONNABORTEDValue, FALSE); +#endif + +#ifdef ECONNREFUSED + VariableDefinePlatformVar(NULL, "ECONNREFUSED", &IntType, (union AnyValue *)&ECONNREFUSEDValue, FALSE); +#endif + +#ifdef ECONNRESET + VariableDefinePlatformVar(NULL, "ECONNRESET", &IntType, (union AnyValue *)&ECONNRESETValue, FALSE); +#endif + +#ifdef EDEADLK + VariableDefinePlatformVar(NULL, "EDEADLK", &IntType, (union AnyValue *)&EDEADLKValue, FALSE); +#endif + +#ifdef EDESTADDRREQ + VariableDefinePlatformVar(NULL, "EDESTADDRREQ", &IntType, (union AnyValue *)&EDESTADDRREQValue, FALSE); +#endif + +#ifdef EDOM + VariableDefinePlatformVar(NULL, "EDOM", &IntType, (union AnyValue *)&EDOMValue, FALSE); +#endif + +#ifdef EDQUOT + VariableDefinePlatformVar(NULL, "EDQUOT", &IntType, (union AnyValue *)&EDQUOTValue, FALSE); +#endif + +#ifdef EEXIST + VariableDefinePlatformVar(NULL, "EEXIST", &IntType, (union AnyValue *)&EEXISTValue, FALSE); +#endif + +#ifdef EFAULT + VariableDefinePlatformVar(NULL, "EFAULT", &IntType, (union AnyValue *)&EFAULTValue, FALSE); +#endif + +#ifdef EFBIG + VariableDefinePlatformVar(NULL, "EFBIG", &IntType, (union AnyValue *)&EFBIGValue, FALSE); +#endif + +#ifdef EHOSTUNREACH + VariableDefinePlatformVar(NULL, "EHOSTUNREACH", &IntType, (union AnyValue *)&EHOSTUNREACHValue, FALSE); +#endif + +#ifdef EIDRM + VariableDefinePlatformVar(NULL, "EIDRM", &IntType, (union AnyValue *)&EIDRMValue, FALSE); +#endif + +#ifdef EILSEQ + VariableDefinePlatformVar(NULL, "EILSEQ", &IntType, (union AnyValue *)&EILSEQValue, FALSE); +#endif + +#ifdef EINPROGRESS + VariableDefinePlatformVar(NULL, "EINPROGRESS", &IntType, (union AnyValue *)&EINPROGRESSValue, FALSE); +#endif + +#ifdef EINTR + VariableDefinePlatformVar(NULL, "EINTR", &IntType, (union AnyValue *)&EINTRValue, FALSE); +#endif + +#ifdef EINVAL + VariableDefinePlatformVar(NULL, "EINVAL", &IntType, (union AnyValue *)&EINVALValue, FALSE); +#endif + +#ifdef EIO + VariableDefinePlatformVar(NULL, "EIO", &IntType, (union AnyValue *)&EIOValue, FALSE); +#endif + +#ifdef EISCONN + VariableDefinePlatformVar(NULL, "EISCONN", &IntType, (union AnyValue *)&EISCONNValue, FALSE); +#endif + +#ifdef EISDIR + VariableDefinePlatformVar(NULL, "EISDIR", &IntType, (union AnyValue *)&EISDIRValue, FALSE); +#endif + +#ifdef ELOOP + VariableDefinePlatformVar(NULL, "ELOOP", &IntType, (union AnyValue *)&ELOOPValue, FALSE); +#endif + +#ifdef EMFILE + VariableDefinePlatformVar(NULL, "EMFILE", &IntType, (union AnyValue *)&EMFILEValue, FALSE); +#endif + +#ifdef EMLINK + VariableDefinePlatformVar(NULL, "EMLINK", &IntType, (union AnyValue *)&EMLINKValue, FALSE); +#endif + +#ifdef EMSGSIZE + VariableDefinePlatformVar(NULL, "EMSGSIZE", &IntType, (union AnyValue *)&EMSGSIZEValue, FALSE); +#endif + +#ifdef EMULTIHOP + VariableDefinePlatformVar(NULL, "EMULTIHOP", &IntType, (union AnyValue *)&EMULTIHOPValue, FALSE); +#endif + +#ifdef ENAMETOOLONG + VariableDefinePlatformVar(NULL, "ENAMETOOLONG", &IntType, (union AnyValue *)&ENAMETOOLONGValue, FALSE); +#endif + +#ifdef ENETDOWN + VariableDefinePlatformVar(NULL, "ENETDOWN", &IntType, (union AnyValue *)&ENETDOWNValue, FALSE); +#endif + +#ifdef ENETRESET + VariableDefinePlatformVar(NULL, "ENETRESET", &IntType, (union AnyValue *)&ENETRESETValue, FALSE); +#endif + +#ifdef ENETUNREACH + VariableDefinePlatformVar(NULL, "ENETUNREACH", &IntType, (union AnyValue *)&ENETUNREACHValue, FALSE); +#endif + +#ifdef ENFILE + VariableDefinePlatformVar(NULL, "ENFILE", &IntType, (union AnyValue *)&ENFILEValue, FALSE); +#endif + +#ifdef ENOBUFS + VariableDefinePlatformVar(NULL, "ENOBUFS", &IntType, (union AnyValue *)&ENOBUFSValue, FALSE); +#endif + +#ifdef ENODATA + VariableDefinePlatformVar(NULL, "ENODATA", &IntType, (union AnyValue *)&ENODATAValue, FALSE); +#endif + +#ifdef ENODEV + VariableDefinePlatformVar(NULL, "ENODEV", &IntType, (union AnyValue *)&ENODEVValue, FALSE); +#endif + +#ifdef ENOENT + VariableDefinePlatformVar(NULL, "ENOENT", &IntType, (union AnyValue *)&ENOENTValue, FALSE); +#endif + +#ifdef ENOEXEC + VariableDefinePlatformVar(NULL, "ENOEXEC", &IntType, (union AnyValue *)&ENOEXECValue, FALSE); +#endif + +#ifdef ENOLCK + VariableDefinePlatformVar(NULL, "ENOLCK", &IntType, (union AnyValue *)&ENOLCKValue, FALSE); +#endif + +#ifdef ENOLINK + VariableDefinePlatformVar(NULL, "ENOLINK", &IntType, (union AnyValue *)&ENOLINKValue, FALSE); +#endif + +#ifdef ENOMEM + VariableDefinePlatformVar(NULL, "ENOMEM", &IntType, (union AnyValue *)&ENOMEMValue, FALSE); +#endif + +#ifdef ENOMSG + VariableDefinePlatformVar(NULL, "ENOMSG", &IntType, (union AnyValue *)&ENOMSGValue, FALSE); +#endif + +#ifdef ENOPROTOOPT + VariableDefinePlatformVar(NULL, "ENOPROTOOPT", &IntType, (union AnyValue *)&ENOPROTOOPTValue, FALSE); +#endif + +#ifdef ENOSPC + VariableDefinePlatformVar(NULL, "ENOSPC", &IntType, (union AnyValue *)&ENOSPCValue, FALSE); +#endif + +#ifdef ENOSR + VariableDefinePlatformVar(NULL, "ENOSR", &IntType, (union AnyValue *)&ENOSRValue, FALSE); +#endif + +#ifdef ENOSTR + VariableDefinePlatformVar(NULL, "ENOSTR", &IntType, (union AnyValue *)&ENOSTRValue, FALSE); +#endif + +#ifdef ENOSYS + VariableDefinePlatformVar(NULL, "ENOSYS", &IntType, (union AnyValue *)&ENOSYSValue, FALSE); +#endif + +#ifdef ENOTCONN + VariableDefinePlatformVar(NULL, "ENOTCONN", &IntType, (union AnyValue *)&ENOTCONNValue, FALSE); +#endif + +#ifdef ENOTDIR + VariableDefinePlatformVar(NULL, "ENOTDIR", &IntType, (union AnyValue *)&ENOTDIRValue, FALSE); +#endif + +#ifdef ENOTEMPTY + VariableDefinePlatformVar(NULL, "ENOTEMPTY", &IntType, (union AnyValue *)&ENOTEMPTYValue, FALSE); +#endif + +#ifdef ENOTRECOVERABLE + VariableDefinePlatformVar(NULL, "ENOTRECOVERABLE", &IntType, (union AnyValue *)&ENOTRECOVERABLEValue, FALSE); +#endif + +#ifdef ENOTSOCK + VariableDefinePlatformVar(NULL, "ENOTSOCK", &IntType, (union AnyValue *)&ENOTSOCKValue, FALSE); +#endif + +#ifdef ENOTSUP + VariableDefinePlatformVar(NULL, "ENOTSUP", &IntType, (union AnyValue *)&ENOTSUPValue, FALSE); +#endif + +#ifdef ENOTTY + VariableDefinePlatformVar(NULL, "ENOTTY", &IntType, (union AnyValue *)&ENOTTYValue, FALSE); +#endif + +#ifdef ENXIO + VariableDefinePlatformVar(NULL, "ENXIO", &IntType, (union AnyValue *)&ENXIOValue, FALSE); +#endif + +#ifdef EOPNOTSUPP + VariableDefinePlatformVar(NULL, "EOPNOTSUPP", &IntType, (union AnyValue *)&EOPNOTSUPPValue, FALSE); +#endif + +#ifdef EOVERFLOW + VariableDefinePlatformVar(NULL, "EOVERFLOW", &IntType, (union AnyValue *)&EOVERFLOWValue, FALSE); +#endif + +#ifdef EOWNERDEAD + VariableDefinePlatformVar(NULL, "EOWNERDEAD", &IntType, (union AnyValue *)&EOWNERDEADValue, FALSE); +#endif + +#ifdef EPERM + VariableDefinePlatformVar(NULL, "EPERM", &IntType, (union AnyValue *)&EPERMValue, FALSE); +#endif + +#ifdef EPIPE + VariableDefinePlatformVar(NULL, "EPIPE", &IntType, (union AnyValue *)&EPIPEValue, FALSE); +#endif + +#ifdef EPROTO + VariableDefinePlatformVar(NULL, "EPROTO", &IntType, (union AnyValue *)&EPROTOValue, FALSE); +#endif + +#ifdef EPROTONOSUPPORT + VariableDefinePlatformVar(NULL, "EPROTONOSUPPORT", &IntType, (union AnyValue *)&EPROTONOSUPPORTValue, FALSE); +#endif + +#ifdef EPROTOTYPE + VariableDefinePlatformVar(NULL, "EPROTOTYPE", &IntType, (union AnyValue *)&EPROTOTYPEValue, FALSE); +#endif + +#ifdef ERANGE + VariableDefinePlatformVar(NULL, "ERANGE", &IntType, (union AnyValue *)&ERANGEValue, FALSE); +#endif + +#ifdef EROFS + VariableDefinePlatformVar(NULL, "EROFS", &IntType, (union AnyValue *)&EROFSValue, FALSE); +#endif + +#ifdef ESPIPE + VariableDefinePlatformVar(NULL, "ESPIPE", &IntType, (union AnyValue *)&ESPIPEValue, FALSE); +#endif + +#ifdef ESRCH + VariableDefinePlatformVar(NULL, "ESRCH", &IntType, (union AnyValue *)&ESRCHValue, FALSE); +#endif + +#ifdef ESTALE + VariableDefinePlatformVar(NULL, "ESTALE", &IntType, (union AnyValue *)&ESTALEValue, FALSE); +#endif + +#ifdef ETIME + VariableDefinePlatformVar(NULL, "ETIME", &IntType, (union AnyValue *)&ETIMEValue, FALSE); +#endif + +#ifdef ETIMEDOUT + VariableDefinePlatformVar(NULL, "ETIMEDOUT", &IntType, (union AnyValue *)&ETIMEDOUTValue, FALSE); +#endif + +#ifdef ETXTBSY + VariableDefinePlatformVar(NULL, "ETXTBSY", &IntType, (union AnyValue *)&ETXTBSYValue, FALSE); +#endif + +#ifdef EWOULDBLOCK + VariableDefinePlatformVar(NULL, "EWOULDBLOCK", &IntType, (union AnyValue *)&EWOULDBLOCKValue, FALSE); +#endif + +#ifdef EXDEV + VariableDefinePlatformVar(NULL, "EXDEV", &IntType, (union AnyValue *)&EXDEVValue, FALSE); +#endif + + VariableDefinePlatformVar(NULL, "errno", &IntType, (union AnyValue *)&errno, TRUE); +} + +#endif /* !BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/cstdlib/math.c b/src/cmd/picoc-1/cstdlib/math.c new file mode 100644 index 0000000..0ba29a4 --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/math.c @@ -0,0 +1,187 @@ +/* stdio.h library for large systems - small embedded systems use clibrary.c instead */ +#include "../interpreter.h" + +#ifndef BUILTIN_MINI_STDLIB +#ifndef NO_FP + +static double M_EValue = 2.7182818284590452354; /* e */ +static double M_LOG2EValue = 1.4426950408889634074; /* log_2 e */ +static double M_LOG10EValue = 0.43429448190325182765; /* log_10 e */ +static double M_LN2Value = 0.69314718055994530942; /* log_e 2 */ +static double M_LN10Value = 2.30258509299404568402; /* log_e 10 */ +static double M_PIValue = 3.14159265358979323846; /* pi */ +static double M_PI_2Value = 1.57079632679489661923; /* pi/2 */ +static double M_PI_4Value = 0.78539816339744830962; /* pi/4 */ +static double M_1_PIValue = 0.31830988618379067154; /* 1/pi */ +static double M_2_PIValue = 0.63661977236758134308; /* 2/pi */ +static double M_2_SQRTPIValue = 1.12837916709551257390; /* 2/sqrt(pi) */ +static double M_SQRT2Value = 1.41421356237309504880; /* sqrt(2) */ +static double M_SQRT1_2Value = 0.70710678118654752440; /* 1/sqrt(2) */ + + +void MathSin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = sin(Param[0]->Val->FP); +} + +void MathCos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = cos(Param[0]->Val->FP); +} + +void MathTan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = tan(Param[0]->Val->FP); +} + +void MathAsin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = asin(Param[0]->Val->FP); +} + +void MathAcos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = acos(Param[0]->Val->FP); +} + +void MathAtan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = atan(Param[0]->Val->FP); +} + +void MathAtan2(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = atan2(Param[0]->Val->FP, Param[1]->Val->FP); +} + +void MathSinh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = sinh(Param[0]->Val->FP); +} + +void MathCosh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = cosh(Param[0]->Val->FP); +} + +void MathTanh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = tanh(Param[0]->Val->FP); +} + +void MathExp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = exp(Param[0]->Val->FP); +} + +void MathFabs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = fabs(Param[0]->Val->FP); +} + +void MathFmod(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = fmod(Param[0]->Val->FP, Param[1]->Val->FP); +} + +void MathFrexp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = frexp(Param[0]->Val->FP, Param[1]->Val->Pointer); +} + +void MathLdexp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = ldexp(Param[0]->Val->FP, Param[1]->Val->Integer); +} + +void MathLog(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = log(Param[0]->Val->FP); +} + +void MathLog10(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = log10(Param[0]->Val->FP); +} + +void MathModf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = modf(Param[0]->Val->FP, Param[0]->Val->Pointer); +} + +void MathPow(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = pow(Param[0]->Val->FP, Param[1]->Val->FP); +} + +void MathSqrt(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = sqrt(Param[0]->Val->FP); +} + +void MathRound(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + /* this awkward definition of "round()" due to it being inconsistently + * declared in math.h */ + ReturnValue->Val->FP = ceil(Param[0]->Val->FP - 0.5); +} + +void MathCeil(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = ceil(Param[0]->Val->FP); +} + +void MathFloor(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = floor(Param[0]->Val->FP); +} + +/* all math.h functions */ +struct LibraryFunction MathFunctions[] = +{ + { MathAcos, "float acos(float);" }, + { MathAsin, "float asin(float);" }, + { MathAtan, "float atan(float);" }, + { MathAtan2, "float atan2(float, float);" }, + { MathCeil, "float ceil(float);" }, + { MathCos, "float cos(float);" }, + { MathCosh, "float cosh(float);" }, + { MathExp, "float exp(float);" }, + { MathFabs, "float fabs(float);" }, + { MathFloor, "float floor(float);" }, + { MathFmod, "float fmod(float, float);" }, + { MathFrexp, "float frexp(float, int *);" }, + { MathLdexp, "float ldexp(float, int);" }, + { MathLog, "float log(float);" }, + { MathLog10, "float log10(float);" }, + { MathModf, "float modf(float, float *);" }, + { MathPow, "float pow(float,float);" }, + { MathRound, "float round(float);" }, + { MathSin, "float sin(float);" }, + { MathSinh, "float sinh(float);" }, + { MathSqrt, "float sqrt(float);" }, + { MathTan, "float tan(float);" }, + { MathTanh, "float tanh(float);" }, + { NULL, NULL } +}; + +/* creates various system-dependent definitions */ +void MathSetupFunc(void) +{ + VariableDefinePlatformVar(NULL, "M_E", &FPType, (union AnyValue *)&M_EValue, FALSE); + VariableDefinePlatformVar(NULL, "M_LOG2E", &FPType, (union AnyValue *)&M_LOG2EValue, FALSE); + VariableDefinePlatformVar(NULL, "M_LOG10E", &FPType, (union AnyValue *)&M_LOG10EValue, FALSE); + VariableDefinePlatformVar(NULL, "M_LN2", &FPType, (union AnyValue *)&M_LN2Value, FALSE); + VariableDefinePlatformVar(NULL, "M_LN10", &FPType, (union AnyValue *)&M_LN10Value, FALSE); + VariableDefinePlatformVar(NULL, "M_PI", &FPType, (union AnyValue *)&M_PIValue, FALSE); + VariableDefinePlatformVar(NULL, "M_PI_2", &FPType, (union AnyValue *)&M_PI_2Value, FALSE); + VariableDefinePlatformVar(NULL, "M_PI_4", &FPType, (union AnyValue *)&M_PI_4Value, FALSE); + VariableDefinePlatformVar(NULL, "M_1_PI", &FPType, (union AnyValue *)&M_1_PIValue, FALSE); + VariableDefinePlatformVar(NULL, "M_2_PI", &FPType, (union AnyValue *)&M_2_PIValue, FALSE); + VariableDefinePlatformVar(NULL, "M_2_SQRTPI", &FPType, (union AnyValue *)&M_2_SQRTPIValue, FALSE); + VariableDefinePlatformVar(NULL, "M_SQRT2", &FPType, (union AnyValue *)&M_SQRT2Value, FALSE); + VariableDefinePlatformVar(NULL, "M_SQRT1_2", &FPType, (union AnyValue *)&M_SQRT1_2Value, FALSE); +} + +#endif /* !NO_FP */ +#endif /* !BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/cstdlib/stdbool.c b/src/cmd/picoc-1/cstdlib/stdbool.c new file mode 100644 index 0000000..30b2528 --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/stdbool.c @@ -0,0 +1,22 @@ +/* string.h library for large systems - small embedded systems use clibrary.c instead */ +#include "../interpreter.h" + +#ifndef BUILTIN_MINI_STDLIB + +static int trueValue = 1; +static int falseValue = 0; + + +/* structure definitions */ +const char StdboolDefs[] = "typedef int bool;"; + +/* creates various system-dependent definitions */ +void StdboolSetupFunc(void) +{ + /* defines */ + VariableDefinePlatformVar(NULL, "true", &IntType, (union AnyValue *)&trueValue, FALSE); + VariableDefinePlatformVar(NULL, "false", &IntType, (union AnyValue *)&falseValue, FALSE); + VariableDefinePlatformVar(NULL, "__bool_true_false_are_defined", &IntType, (union AnyValue *)&trueValue, FALSE); +} + +#endif /* !BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/cstdlib/stdio.c b/src/cmd/picoc-1/cstdlib/stdio.c new file mode 100644 index 0000000..85ad6f1 --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/stdio.c @@ -0,0 +1,742 @@ +/* stdio.h library for large systems - small embedded systems use clibrary.c instead */ +#ifndef BUILTIN_MINI_STDLIB + +#include +#include "../interpreter.h" + +#define MAX_FORMAT 80 +#define MAX_SCANF_ARGS 10 + +FILE *CStdOut; + +static int ZeroValue = 0; +static int EOFValue = EOF; +static int SEEK_SETValue = SEEK_SET; +static int SEEK_CURValue = SEEK_CUR; +static int SEEK_ENDValue = SEEK_END; +static int BUFSIZValue = BUFSIZ; +static int FILENAME_MAXValue = FILENAME_MAX; +static int _IOFBFValue = _IOFBF; +static int _IOLBFValue = _IOLBF; +static int _IONBFValue = _IONBF; +static int L_tmpnamValue = L_tmpnam; +static int GETS_MAXValue = 255; /* arbitrary maximum size of a gets() file */ + +static FILE *stdinValue; +static FILE *stdoutValue; +static FILE *stderrValue; + +struct ValueType *FilePtrType = NULL; + + +/* our own internal output stream which can output to FILE * or strings */ +typedef struct StdOutStreamStruct +{ + FILE *FilePtr; + char *StrOutPtr; + int StrOutLen; + int CharCount; + +} StdOutStream; + +/* our representation of varargs within picoc */ +struct StdVararg +{ + struct Value **Param; + int NumArgs; +}; + +/* initialises the I/O system so error reporting works */ +void BasicIOInit() +{ + CStdOut = stdout; + stdinValue = stdin; + stdoutValue = stdout; + stderrValue = stderr; +} + +/* output a single character to either a FILE * or a string */ +void StdioOutPutc(int OutCh, StdOutStream *Stream) +{ + if (Stream->FilePtr != NULL) + { + /* output to stdio stream */ + putc(OutCh, Stream->FilePtr); + Stream->CharCount++; + } + else if (Stream->StrOutLen < 0 || Stream->StrOutLen > 1) + { + /* output to a string */ + *Stream->StrOutPtr = OutCh; + Stream->StrOutPtr++; + + if (Stream->StrOutLen > 1) + Stream->StrOutLen--; + + Stream->CharCount++; + } +} + +/* output a string to either a FILE * or a string */ +void StdioOutPuts(const char *Str, StdOutStream *Stream) +{ + if (Stream->FilePtr != NULL) + { + /* output to stdio stream */ + fputs(Str, Stream->FilePtr); + } + else + { + /* output to a string */ + while (*Str != '\0') + { + if (Stream->StrOutLen < 0 || Stream->StrOutLen > 1) + { + /* output to a string */ + *Stream->StrOutPtr = *Str; + Str++; + Stream->StrOutPtr++; + + if (Stream->StrOutLen > 1) + Stream->StrOutLen--; + + Stream->CharCount++; + } + } + } +} + +/* printf-style format of an int or other word-sized object */ +void StdioFprintfWord(StdOutStream *Stream, const char *Format, unsigned int Value) +{ + if (Stream->FilePtr != NULL) + Stream->CharCount += fprintf(Stream->FilePtr, Format, Value); + + else if (Stream->StrOutLen >= 0) + { +#ifndef WIN32 + int CCount = snprintf(Stream->StrOutPtr, Stream->StrOutLen, Format, Value); +#else + int CCount = _snprintf(Stream->StrOutPtr, Stream->StrOutLen, Format, Value); +#endif + Stream->StrOutPtr += CCount; + Stream->StrOutLen -= CCount; + Stream->CharCount += CCount; + } + else + { + int CCount = sprintf(Stream->StrOutPtr, Format, Value); + Stream->CharCount += CCount; + Stream->StrOutPtr += CCount; + } +} + +/* printf-style format of a floating point number */ +void StdioFprintfFP(StdOutStream *Stream, const char *Format, double Value) +{ + if (Stream->FilePtr != NULL) + Stream->CharCount += fprintf(Stream->FilePtr, Format, Value); + + else if (Stream->StrOutLen >= 0) + { +#ifndef WIN32 + int CCount = snprintf(Stream->StrOutPtr, Stream->StrOutLen, Format, Value); +#else + int CCount = _snprintf(Stream->StrOutPtr, Stream->StrOutLen, Format, Value); +#endif + Stream->StrOutPtr += CCount; + Stream->StrOutLen -= CCount; + Stream->CharCount += CCount; + } + else + { + int CCount = sprintf(Stream->StrOutPtr, Format, Value); + Stream->CharCount += CCount; + Stream->StrOutPtr += CCount; + } +} + +/* printf-style format of a pointer */ +void StdioFprintfPointer(StdOutStream *Stream, const char *Format, void *Value) +{ + if (Stream->FilePtr != NULL) + Stream->CharCount += fprintf(Stream->FilePtr, Format, Value); + + else if (Stream->StrOutLen >= 0) + { +#ifndef WIN32 + int CCount = snprintf(Stream->StrOutPtr, Stream->StrOutLen, Format, Value); +#else + int CCount = _snprintf(Stream->StrOutPtr, Stream->StrOutLen, Format, Value); +#endif + Stream->StrOutPtr += CCount; + Stream->StrOutLen -= CCount; + Stream->CharCount += CCount; + } + else + { + int CCount = sprintf(Stream->StrOutPtr, Format, Value); + Stream->CharCount += CCount; + Stream->StrOutPtr += CCount; + } +} + +/* internal do-anything v[s][n]printf() formatting system with output to strings or FILE * */ +int StdioBasePrintf(struct ParseState *Parser, FILE *Stream, char *StrOut, int StrOutLen, char *Format, struct StdVararg *Args) +{ + struct Value *ThisArg = Args->Param[0]; + int ArgCount = 0; + char *FPos; + char OneFormatBuf[MAX_FORMAT+1]; + int OneFormatCount; + struct ValueType *ShowType; + StdOutStream SOStream; + + if (Format == NULL) + Format = "[null format]\n"; + + FPos = Format; + SOStream.FilePtr = Stream; + SOStream.StrOutPtr = StrOut; + SOStream.StrOutLen = StrOutLen; + SOStream.CharCount = 0; + + while (*FPos != '\0') + { + if (*FPos == '%') + { + /* work out what type we're printing */ + FPos++; + ShowType = NULL; + OneFormatBuf[0] = '%'; + OneFormatCount = 1; + + do + { + switch (*FPos) + { + case 'd': case 'i': ShowType = &IntType; break; /* integer decimal */ + case 'o': case 'u': case 'x': case 'X': ShowType = &IntType; break; /* integer base conversions */ +#ifndef NO_FP + case 'e': case 'E': ShowType = &FPType; break; /* double, exponent form */ + case 'f': case 'F': ShowType = &FPType; break; /* double, fixed-point */ + case 'g': case 'G': ShowType = &FPType; break; /* double, flexible format */ +#endif + case 'a': case 'A': ShowType = &IntType; break; /* hexadecimal, 0x- format */ + case 'c': ShowType = &IntType; break; /* character */ + case 's': ShowType = CharPtrType; break; /* string */ + case 'p': ShowType = VoidPtrType; break; /* pointer */ + case 'n': ShowType = &VoidType; break; /* number of characters written */ + case 'm': ShowType = &VoidType; break; /* strerror(errno) */ + case '%': ShowType = &VoidType; break; /* just a '%' character */ + case '\0': ShowType = &VoidType; break; /* end of format string */ + } + + /* copy one character of format across to the OneFormatBuf */ + OneFormatBuf[OneFormatCount] = *FPos; + OneFormatCount++; + + /* do special actions depending on the conversion type */ + if (ShowType == &VoidType) + { + switch (*FPos) + { + case 'm': StdioOutPuts(strerror(errno), &SOStream); break; + case '%': StdioOutPutc(*FPos, &SOStream); break; + case '\0': OneFormatBuf[OneFormatCount] = '\0'; StdioOutPutc(*FPos, &SOStream); break; + case 'n': + ThisArg = (struct Value *)((char *)ThisArg + MEM_ALIGN(sizeof(struct Value) + TypeStackSizeValue(ThisArg))); + if (ThisArg->Typ->Base == TypeArray && ThisArg->Typ->FromType->Base == TypeInt) + *(int *)ThisArg->Val->Pointer = SOStream.CharCount; + break; + } + } + + FPos++; + + } while (ShowType == NULL && OneFormatCount < MAX_FORMAT); + + if (ShowType != &VoidType) + { + if (ArgCount >= Args->NumArgs) + StdioOutPuts("XXX", &SOStream); + else + { + /* null-terminate the buffer */ + OneFormatBuf[OneFormatCount] = '\0'; + + /* print this argument */ + ThisArg = (struct Value *)((char *)ThisArg + MEM_ALIGN(sizeof(struct Value) + TypeStackSizeValue(ThisArg))); + if (ShowType == &IntType) + { + /* show a signed integer */ + if (IS_NUMERIC_COERCIBLE(ThisArg)) + StdioFprintfWord(&SOStream, OneFormatBuf, ExpressionCoerceUnsignedInteger(ThisArg)); + else + StdioOutPuts("XXX", &SOStream); + } +#ifndef NO_FP + else if (ShowType == &FPType) + { + /* show a floating point number */ + if (IS_NUMERIC_COERCIBLE(ThisArg)) + StdioFprintfFP(&SOStream, OneFormatBuf, ExpressionCoerceFP(ThisArg)); + else + StdioOutPuts("XXX", &SOStream); + } +#endif + else if (ShowType == CharPtrType) + { + if (ThisArg->Typ->Base == TypePointer) + StdioFprintfPointer(&SOStream, OneFormatBuf, ThisArg->Val->Pointer); + + else if (ThisArg->Typ->Base == TypeArray && ThisArg->Typ->FromType->Base == TypeChar) + StdioFprintfPointer(&SOStream, OneFormatBuf, &ThisArg->Val->ArrayMem[0]); + + else + StdioOutPuts("XXX", &SOStream); + } + else if (ShowType == VoidPtrType) + { + if (ThisArg->Typ->Base == TypePointer) + StdioFprintfPointer(&SOStream, OneFormatBuf, ThisArg->Val->Pointer); + + else if (ThisArg->Typ->Base == TypeArray) + StdioFprintfPointer(&SOStream, OneFormatBuf, &ThisArg->Val->ArrayMem[0]); + + else + StdioOutPuts("XXX", &SOStream); + } + + ArgCount++; + } + } + } + else + { + /* just output a normal character */ + StdioOutPutc(*FPos, &SOStream); + FPos++; + } + } + + /* null-terminate */ + if (SOStream.StrOutPtr != NULL && SOStream.StrOutLen > 0) + *SOStream.StrOutPtr = '\0'; + + return SOStream.CharCount; +} + +/* internal do-anything v[s][n]scanf() formatting system with input from strings or FILE * */ +int StdioBaseScanf(struct ParseState *Parser, FILE *Stream, char *StrIn, char *Format, struct StdVararg *Args) +{ + struct Value *ThisArg = Args->Param[0]; + int ArgCount = 0; + void *ScanfArg[MAX_SCANF_ARGS]; + + if (Args->NumArgs > MAX_SCANF_ARGS) + ProgramFail(Parser, "too many arguments to scanf() - %d max", MAX_SCANF_ARGS); + + for (ArgCount = 0; ArgCount < Args->NumArgs; ArgCount++) + { + ThisArg = (struct Value *)((char *)ThisArg + MEM_ALIGN(sizeof(struct Value) + TypeStackSizeValue(ThisArg))); + + if (ThisArg->Typ->Base == TypePointer) + ScanfArg[ArgCount] = ThisArg->Val->Pointer; + + else if (ThisArg->Typ->Base == TypeArray) + ScanfArg[ArgCount] = &ThisArg->Val->ArrayMem[0]; + + else + ProgramFail(Parser, "non-pointer argument to scanf() - argument %d after format", ArgCount+1); + } + + if (Stream != NULL) + return fscanf(Stream, Format, ScanfArg[0], ScanfArg[1], ScanfArg[2], ScanfArg[3], ScanfArg[4], ScanfArg[5], ScanfArg[6], ScanfArg[7], ScanfArg[8], ScanfArg[9]); + else + return sscanf(StrIn, Format, ScanfArg[0], ScanfArg[1], ScanfArg[2], ScanfArg[3], ScanfArg[4], ScanfArg[5], ScanfArg[6], ScanfArg[7], ScanfArg[8], ScanfArg[9]); +} + +/* stdio calls */ +void StdioFopen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = fopen(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StdioFreopen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = freopen(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Pointer); +} + +void StdioFclose(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fclose(Param[0]->Val->Pointer); +} + +void StdioFread(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fread(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer, Param[3]->Val->Pointer); +} + +void StdioFwrite(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fwrite(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer, Param[3]->Val->Pointer); +} + +void StdioFgetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fgetc(Param[0]->Val->Pointer); +} + +void StdioFgets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = fgets(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Pointer); +} + +void StdioRemove(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = remove(Param[0]->Val->Pointer); +} + +void StdioRename(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = rename(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StdioRewind(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + rewind(Param[0]->Val->Pointer); +} + +void StdioTmpfile(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = tmpfile(); +} + +void StdioClearerr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + clearerr((FILE *)Param[0]->Val->Pointer); +} + +void StdioFeof(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = feof((FILE *)Param[0]->Val->Pointer); +} + +void StdioFerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = ferror((FILE *)Param[0]->Val->Pointer); +} + +void StdioFileno(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ +#ifndef WIN32 + ReturnValue->Val->Integer = fileno((FILE *)Param[0]->Val->Pointer); +#else + ReturnValue->Val->Integer = _fileno(Param[0]->Val->Pointer); +#endif +} + +void StdioFflush(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fflush(Param[0]->Val->Pointer); +} + +void StdioFgetpos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fgetpos(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StdioFsetpos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fsetpos(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StdioFputc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fputc(Param[0]->Val->Integer, Param[1]->Val->Pointer); +} + +void StdioFputs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fputs(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StdioFtell(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = ftell(Param[0]->Val->Pointer); +} + +void StdioFseek(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fseek(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} + +void StdioPerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + perror(Param[0]->Val->Pointer); +} + +void StdioPutc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = putc(Param[0]->Val->Integer, (FILE *)Param[1]->Val->Pointer); +} + +void StdioPutchar(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = putchar(Param[0]->Val->Integer); +} + +void StdioSetbuf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + setbuf(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StdioSetvbuf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + setvbuf(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer, Param[3]->Val->Integer); +} + +void StdioUngetc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = ungetc(Param[0]->Val->Integer, Param[1]->Val->Pointer); +} + +void StdioPuts(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = puts(Param[0]->Val->Pointer); +} + +void StdioGets(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = fgets(Param[0]->Val->Pointer, GETS_MAXValue, stdin); + if (ReturnValue->Val->Pointer != NULL) + { + char *EOLPos = strchr(Param[0]->Val->Pointer, '\n'); + if (EOLPos != NULL) + *EOLPos = '\0'; + } +} + +void StdioGetchar(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getchar(); +} + +void StdioPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct StdVararg PrintfArgs; + + PrintfArgs.Param = Param; + PrintfArgs.NumArgs = NumArgs-1; + ReturnValue->Val->Integer = StdioBasePrintf(Parser, stdout, NULL, 0, Param[0]->Val->Pointer, &PrintfArgs); +} + +void StdioVprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = StdioBasePrintf(Parser, stdout, NULL, 0, Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StdioFprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct StdVararg PrintfArgs; + + PrintfArgs.Param = Param + 1; + PrintfArgs.NumArgs = NumArgs-2; + ReturnValue->Val->Integer = StdioBasePrintf(Parser, Param[0]->Val->Pointer, NULL, 0, Param[1]->Val->Pointer, &PrintfArgs); +} + +void StdioVfprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = StdioBasePrintf(Parser, Param[0]->Val->Pointer, NULL, 0, Param[1]->Val->Pointer, Param[2]->Val->Pointer); +} + +void StdioSprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct StdVararg PrintfArgs; + + PrintfArgs.Param = Param + 1; + PrintfArgs.NumArgs = NumArgs-2; + ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->Pointer, -1, Param[1]->Val->Pointer, &PrintfArgs); +} + +void StdioSnprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct StdVararg PrintfArgs; + + PrintfArgs.Param = Param+2; + PrintfArgs.NumArgs = NumArgs-3; + ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Pointer, &PrintfArgs); +} + +void StdioScanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct StdVararg ScanfArgs; + + ScanfArgs.Param = Param; + ScanfArgs.NumArgs = NumArgs-1; + ReturnValue->Val->Integer = StdioBaseScanf(Parser, stdin, NULL, Param[0]->Val->Pointer, &ScanfArgs); +} + +void StdioFscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct StdVararg ScanfArgs; + + ScanfArgs.Param = Param+1; + ScanfArgs.NumArgs = NumArgs-2; + ReturnValue->Val->Integer = StdioBaseScanf(Parser, Param[0]->Val->Pointer, NULL, Param[1]->Val->Pointer, &ScanfArgs); +} + +void StdioSscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + struct StdVararg ScanfArgs; + + ScanfArgs.Param = Param+1; + ScanfArgs.NumArgs = NumArgs-2; + ReturnValue->Val->Integer = StdioBaseScanf(Parser, NULL, Param[0]->Val->Pointer, Param[1]->Val->Pointer, &ScanfArgs); +} + +void StdioVsprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->Pointer, -1, Param[1]->Val->Pointer, Param[2]->Val->Pointer); +} + +void StdioVsnprintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = StdioBasePrintf(Parser, NULL, Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Pointer, Param[3]->Val->Pointer); +} + +void StdioVscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = StdioBaseScanf(Parser, stdin, NULL, Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StdioVfscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = StdioBaseScanf(Parser, Param[0]->Val->Pointer, NULL, Param[1]->Val->Pointer, Param[2]->Val->Pointer); +} + +void StdioVsscanf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = StdioBaseScanf(Parser, NULL, Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Pointer); +} + +/* handy structure definitions */ +const char StdioDefs[] = "\ +typedef struct __va_listStruct va_list; \ +typedef struct __FILEStruct FILE;\ +"; + +/* all stdio functions */ +struct LibraryFunction StdioFunctions[] = +{ + { StdioFopen, "FILE *fopen(char *, char *);" }, + { StdioFreopen, "FILE *freopen(char *, char *, FILE *);" }, + { StdioFclose, "int fclose(FILE *);" }, + { StdioFread, "int fread(void *, int, int, FILE *);" }, + { StdioFwrite, "int fwrite(void *, int, int, FILE *);" }, + { StdioFgetc, "int fgetc(FILE *);" }, + { StdioFgetc, "int getc(FILE *);" }, + { StdioFgets, "char *fgets(char *, int, FILE *);" }, + { StdioFputc, "int fputc(int, FILE *);" }, + { StdioFputs, "int fputs(char *, FILE *);" }, + { StdioRemove, "int remove(char *);" }, + { StdioRename, "int rename(char *, char *);" }, + { StdioRewind, "void rewind(FILE *);" }, + { StdioTmpfile, "FILE *tmpfile();" }, + { StdioClearerr,"void clearerr(FILE *);" }, + { StdioFeof, "int feof(FILE *);" }, + { StdioFerror, "int ferror(FILE *);" }, + { StdioFileno, "int fileno(FILE *);" }, + { StdioFflush, "int fflush(FILE *);" }, + { StdioFgetpos, "int fgetpos(FILE *, int *);" }, + { StdioFsetpos, "int fsetpos(FILE *, int *);" }, + { StdioFtell, "int ftell(FILE *);" }, + { StdioFseek, "int fseek(FILE *, int, int);" }, + { StdioPerror, "void perror(char *);" }, + { StdioPutc, "int putc(char *, FILE *);" }, + { StdioPutchar, "int putchar(int);" }, + { StdioPutchar, "int fputchar(int);" }, + { StdioSetbuf, "void setbuf(FILE *, char *);" }, + { StdioSetvbuf, "void setvbuf(FILE *, char *, int, int);" }, + { StdioUngetc, "int ungetc(int, FILE *);" }, + { StdioPuts, "int puts(char *);" }, + { StdioGets, "char *gets(char *);" }, + { StdioGetchar, "int getchar();" }, + { StdioPrintf, "int printf(char *, ...);" }, + { StdioFprintf, "int fprintf(FILE *, char *, ...);" }, + { StdioSprintf, "int sprintf(char *, char *, ...);" }, + { StdioSnprintf,"int snprintf(char *, int, char *, ...);" }, + { StdioScanf, "int scanf(char *, ...);" }, + { StdioFscanf, "int fscanf(FILE *, char *, ...);" }, + { StdioSscanf, "int sscanf(char *, char *, ...);" }, + { StdioVprintf, "int vprintf(char *, va_list);" }, + { StdioVfprintf,"int vfprintf(FILE *, char *, va_list);" }, + { StdioVsprintf,"int vsprintf(char *, char *, va_list);" }, + { StdioVsnprintf,"int vsnprintf(char *, int, char *, va_list);" }, + { StdioVscanf, "int vscanf(char *, va_list);" }, + { StdioVfscanf, "int vfscanf(FILE *, char *, va_list);" }, + { StdioVsscanf, "int vsscanf(char *, char *, va_list);" }, + { NULL, NULL } +}; + +/* creates various system-dependent definitions */ +void StdioSetupFunc(void) +{ + struct ValueType *StructFileType; + struct ValueType *FilePtrType; + + /* make a "struct __FILEStruct" which is the same size as a native FILE structure */ + StructFileType = TypeCreateOpaqueStruct(NULL, TableStrRegister("__FILEStruct"), sizeof(FILE)); + + /* get a FILE * type */ + FilePtrType = TypeGetMatching(NULL, StructFileType, TypePointer, 0, StrEmpty, TRUE); + + /* make a "struct __va_listStruct" which is the same size as our struct StdVararg */ + TypeCreateOpaqueStruct(NULL, TableStrRegister("__va_listStruct"), sizeof(FILE)); + + /* define EOF equal to the system EOF */ + VariableDefinePlatformVar(NULL, "EOF", &IntType, (union AnyValue *)&EOFValue, FALSE); + VariableDefinePlatformVar(NULL, "SEEK_SET", &IntType, (union AnyValue *)&SEEK_SETValue, FALSE); + VariableDefinePlatformVar(NULL, "SEEK_CUR", &IntType, (union AnyValue *)&SEEK_CURValue, FALSE); + VariableDefinePlatformVar(NULL, "SEEK_END", &IntType, (union AnyValue *)&SEEK_ENDValue, FALSE); + VariableDefinePlatformVar(NULL, "BUFSIZ", &IntType, (union AnyValue *)&BUFSIZValue, FALSE); + VariableDefinePlatformVar(NULL, "FILENAME_MAX", &IntType, (union AnyValue *)&FILENAME_MAXValue, FALSE); + VariableDefinePlatformVar(NULL, "_IOFBF", &IntType, (union AnyValue *)&_IOFBFValue, FALSE); + VariableDefinePlatformVar(NULL, "_IOLBF", &IntType, (union AnyValue *)&_IOLBFValue, FALSE); + VariableDefinePlatformVar(NULL, "_IONBF", &IntType, (union AnyValue *)&_IONBFValue, FALSE); + VariableDefinePlatformVar(NULL, "L_tmpnam", &IntType, (union AnyValue *)&L_tmpnamValue, FALSE); + VariableDefinePlatformVar(NULL, "GETS_MAX", &IntType, (union AnyValue *)&GETS_MAXValue, FALSE); + + /* define stdin, stdout and stderr */ + VariableDefinePlatformVar(NULL, "stdin", FilePtrType, (union AnyValue *)&stdinValue, FALSE); + VariableDefinePlatformVar(NULL, "stdout", FilePtrType, (union AnyValue *)&stdoutValue, FALSE); + VariableDefinePlatformVar(NULL, "stderr", FilePtrType, (union AnyValue *)&stderrValue, FALSE); + + /* define NULL, TRUE and FALSE */ + if (!VariableDefined(TableStrRegister("NULL"))) + VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); +} + +/* portability-related I/O calls */ +void PrintCh(char OutCh, FILE *Stream) +{ + putc(OutCh, Stream); +} + +void PrintSimpleInt(long Num, FILE *Stream) +{ + fprintf(Stream, "%ld", Num); +} + +void PrintStr(const char *Str, FILE *Stream) +{ + fputs(Str, Stream); +} + +void PrintFP(double Num, FILE *Stream) +{ + fprintf(Stream, "%f", Num); +} + +#endif /* !BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/cstdlib/stdlib.c b/src/cmd/picoc-1/cstdlib/stdlib.c new file mode 100644 index 0000000..8eebb1c --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/stdlib.c @@ -0,0 +1,174 @@ +/* stdlib.h library for large systems - small embedded systems use clibrary.c instead */ +#include "../interpreter.h" + +#ifndef BUILTIN_MINI_STDLIB + +static int ZeroValue = 0; + +#ifndef NO_FP +void StdlibAtof(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = atof(Param[0]->Val->Pointer); +} +#endif + +void StdlibAtoi(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = atoi(Param[0]->Val->Pointer); +} + +void StdlibAtol(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = atol(Param[0]->Val->Pointer); +} + +#ifndef NO_FP +void StdlibStrtod(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = strtod(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} +#endif + +void StdlibStrtol(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strtol(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void StdlibStrtoul(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strtoul(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void StdlibMalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = malloc(Param[0]->Val->Integer); +} + +void StdlibCalloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = calloc(Param[0]->Val->Integer, Param[1]->Val->Integer); +} + +void StdlibRealloc(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = realloc(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} + +void StdlibFree(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + free(Param[0]->Val->Pointer); +} + +void StdlibRand(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = rand(); +} + +void StdlibSrand(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + srand(Param[0]->Val->Integer); +} + +void StdlibAbort(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ProgramFail(Parser, "abort"); +} + +void StdlibExit(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + PlatformExit(Param[0]->Val->Integer); +} + +void StdlibGetenv(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = getenv(Param[0]->Val->Pointer); +} + +void StdlibSystem(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = system(Param[0]->Val->Pointer); +} + +#if 0 +void StdlibBsearch(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = bsearch(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer, Param[3]->Val->Integer, (int (*)())Param[4]->Val->Pointer); +} +#endif + +void StdlibAbs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = abs(Param[0]->Val->Integer); +} + +void StdlibLabs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = labs(Param[0]->Val->Integer); +} + +#if 0 +void StdlibDiv(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = div(Param[0]->Val->Integer, Param[1]->Val->Integer); +} + +void StdlibLdiv(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = ldiv(Param[0]->Val->Integer, Param[1]->Val->Integer); +} +#endif + +#if 0 +/* handy structure definitions */ +const char StdlibDefs[] = "\ +typedef struct { \ + int quot, rem; \ +} div_t; \ +\ +typedef struct { \ + int quot, rem; \ +} ldiv_t; \ +"; +#endif + +/* all stdlib.h functions */ +struct LibraryFunction StdlibFunctions[] = +{ +#ifndef NO_FP + { StdlibAtof, "float atof(char *);" }, + { StdlibStrtod, "float strtod(char *,char **);" }, +#endif + { StdlibAtoi, "int atoi(char *);" }, + { StdlibAtol, "int atol(char *);" }, + { StdlibStrtol, "int strtol(char *,char **,int);" }, + { StdlibStrtoul, "int strtoul(char *,char **,int);" }, + { StdlibMalloc, "void *malloc(int);" }, + { StdlibCalloc, "void *calloc(int,int);" }, + { StdlibRealloc, "void *realloc(void *,int);" }, + { StdlibFree, "void free(void *);" }, + { StdlibRand, "int rand();" }, + { StdlibSrand, "void srand(int);" }, + { StdlibAbort, "void abort();" }, + { StdlibExit, "void exit(int);" }, + { StdlibGetenv, "char *getenv(char *);" }, + { StdlibSystem, "int system(char *);" }, +/* { StdlibBsearch, "void *bsearch(void *,void *,int,int,int (*)());" }, */ +/* { StdlibQsort, "void *qsort(void *,int,int,int (*)());" }, */ + { StdlibAbs, "int abs(int);" }, + { StdlibLabs, "int labs(int);" }, +#if 0 + { StdlibDiv, "div_t div(int);" }, + { StdlibLdiv, "ldiv_t ldiv(int);" }, +#endif + { NULL, NULL } +}; + +/* creates various system-dependent definitions */ +void StdlibSetupFunc(void) +{ + /* define NULL, TRUE and FALSE */ + if (!VariableDefined(TableStrRegister("NULL"))) + VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); +} + +#endif /* !BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/cstdlib/string.c b/src/cmd/picoc-1/cstdlib/string.c new file mode 100644 index 0000000..655bbea --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/string.c @@ -0,0 +1,190 @@ +/* string.h library for large systems - small embedded systems use clibrary.c instead */ +#include "../interpreter.h" + +#ifndef BUILTIN_MINI_STDLIB + +static int ZeroValue = 0; + +void StringStrcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strcpy(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StringStrncpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strncpy(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void StringStrcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strcmp(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StringStrncmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strncmp(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void StringStrcat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strcat(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StringStrncat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strncat(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +#ifndef WIN32 +void StringIndex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = index(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} + +void StringRindex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = rindex(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} +#endif + +void StringStrlen(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strlen(Param[0]->Val->Pointer); +} + +void StringMemset(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = memset(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} + +void StringMemcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = memcpy(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void StringMemcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = memcmp(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void StringMemmove(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = memmove(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void StringMemchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = memchr(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} + +void StringStrchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strchr(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} + +void StringStrrchr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strrchr(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} + +/* We don't have locales - this is pointless +void StringStrcoll(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strcoll(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} +*/ + +void StringStrerror(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strerror(Param[0]->Val->Integer); +} + +void StringStrspn(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strspn(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StringStrcspn(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strcspn(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StringStrpbrk(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strpbrk(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StringStrstr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strstr(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void StringStrtok(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strtok(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +/* - We don't have locales, this is pointless. +void StringStrxfrm(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strxfrm(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} +*/ + +#ifndef WIN32 +void StringStrdup(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strdup(Param[0]->Val->Pointer); +} + +void StringStrtok_r(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = strtok_r(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Pointer); +} +#endif + +/* all string.h functions */ +struct LibraryFunction StringFunctions[] = +{ +#ifndef WIN32 + { StringIndex, "char *index(char *,int);" }, + { StringRindex, "char *rindex(char *,int);" }, +#endif + { StringMemcpy, "void *memcpy(void *,void *,int);" }, + { StringMemmove, "void *memmove(void *,void *,int);" }, + { StringMemchr, "void *memchr(char *,int,int);" }, + { StringMemcmp, "int memcmp(void *,void *,int);" }, + { StringMemset, "void *memset(void *,int,int);" }, + { StringStrcat, "char *strcat(char *,char *);" }, + { StringStrncat, "char *strncat(char *,char *,int);" }, + { StringStrchr, "char *strchr(char *,int);" }, + { StringStrrchr, "char *strrchr(char *,int);" }, + { StringStrcmp, "int strcmp(char *,char *);" }, + { StringStrncmp, "int strncmp(char *,char *,int);" }, +/* { StringStrcoll, "int strcoll(char *,char *);" }, */ + { StringStrcpy, "char *strcpy(char *,char *);" }, + { StringStrncpy, "char *strncpy(char *,char *,int);" }, + { StringStrerror, "char *strerror(int);" }, + { StringStrlen, "int strlen(char *);" }, + { StringStrspn, "int strspn(char *,char *);" }, + { StringStrcspn, "int strcspn(char *,char *);" }, + { StringStrpbrk, "char *strpbrk(char *,char *);" }, + { StringStrstr, "char *strstr(char *,char *);" }, + { StringStrtok, "char *strtok(char *,char *);" }, +/* { StringStrxfrm, "int strxfrm(char *,char *,int);" }, */ +#ifndef WIN32 + { StringStrdup, "char *strdup(char *);" }, + { StringStrtok_r, "char *strtok_r(char *,char *,char **);" }, +#endif + { NULL, NULL } +}; + +/* creates various system-dependent definitions */ +void StringSetupFunc(void) +{ + /* define NULL */ + if (!VariableDefined(TableStrRegister("NULL"))) + VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); +} + +#endif /* !BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/cstdlib/time.c b/src/cmd/picoc-1/cstdlib/time.c new file mode 100644 index 0000000..52dc98f --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/time.c @@ -0,0 +1,140 @@ +/* string.h library for large systems - small embedded systems use clibrary.c instead */ +#include +#include "../interpreter.h" + +#ifndef BUILTIN_MINI_STDLIB + +static int CLOCKS_PER_SECValue = CLOCKS_PER_SEC; + +#ifdef CLK_PER_SEC +static int CLK_PER_SECValue = CLK_PER_SEC; +#endif + +#ifdef CLK_TCK +static int CLK_TCKValue = CLK_TCK; +#endif + +void StdAsctime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = asctime(Param[0]->Val->Pointer); +} + +/* we don't have clock +void StdClock(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = clock(); +} +*/ + +void StdCtime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = ctime(Param[0]->Val->Pointer); +} + +#ifndef NO_FP +/* We don't have difftime +void StdDifftime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->FP = difftime((time_t)Param[0]->Val->Integer, Param[1]->Val->Integer); +} +*/ +#endif + +void StdGmtime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = gmtime(Param[0]->Val->Pointer); +} + +void StdLocaltime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = localtime(Param[0]->Val->Pointer); +} + +/* We don't have mktime +void StdMktime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = (int)mktime(Param[0]->Val->Pointer); +} +*/ + +void StdTime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = (int)time(Param[0]->Val->Pointer); +} + +void StdStrftime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = strftime(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Pointer, Param[3]->Val->Pointer); +} + +#ifndef WIN32 +/* We don't have strptime +void StdStrptime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + extern char *strptime(const char *s, const char *format, struct tm *tm); + + ReturnValue->Val->Pointer = strptime(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Pointer); +} +*/ + +/* We don't have gmtime_r +void StdGmtime_r(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = gmtime_r(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} +*/ + +/* We don't have timegm +void StdTimegm(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = timegm(Param[0]->Val->Pointer); +} +*/ +#endif + +/* handy structure definitions */ +const char StdTimeDefs[] = "\ +typedef int time_t; \ +typedef int clock_t;\ +"; + +/* all string.h functions */ +struct LibraryFunction StdTimeFunctions[] = +{ + { StdAsctime, "char *asctime(struct tm *);" }, +/* { StdClock, "time_t clock();" }, */ + { StdCtime, "char *ctime(int *);" }, +#ifndef NO_FP +/* { StdDifftime, "double difftime(int, int);" }, */ +#endif + { StdGmtime, "struct tm *gmtime(int *);" }, + { StdLocaltime, "struct tm *localtime(int *);" }, +/* { StdMktime, "int mktime(struct tm *ptm);" }, */ + { StdTime, "int time(int *);" }, + { StdStrftime, "int strftime(char *, int, char *, struct tm *);" }, +#ifndef WIN32 +/* { StdStrptime, "char *strptime(char *, char *, struct tm *);" },*/ +/* { StdGmtime_r, "struct tm *gmtime_r(int *, struct tm *);" },*/ +/* { StdTimegm, "int timegm(struct tm *);" }, */ +#endif + { NULL, NULL } +}; + + +/* creates various system-dependent definitions */ +void StdTimeSetupFunc(void) +{ + /* make a "struct tm" which is the same size as a native tm structure */ + TypeCreateOpaqueStruct(NULL, TableStrRegister("tm"), sizeof(struct tm)); + + /* define CLK_PER_SEC etc. */ + VariableDefinePlatformVar(NULL, "CLOCKS_PER_SEC", &IntType, (union AnyValue *)&CLOCKS_PER_SECValue, FALSE); +#ifdef CLK_PER_SEC + VariableDefinePlatformVar(NULL, "CLK_PER_SEC", &IntType, (union AnyValue *)&CLK_PER_SECValue, FALSE); +#endif +#ifdef CLK_TCK + VariableDefinePlatformVar(NULL, "CLK_TCK", &IntType, (union AnyValue *)&CLK_TCKValue, FALSE); +#endif +} + +#endif /* !BUILTIN_MINI_STDLIB */ diff --git a/src/cmd/picoc-1/cstdlib/unistd.c b/src/cmd/picoc-1/cstdlib/unistd.c new file mode 100644 index 0000000..30ca390 --- /dev/null +++ b/src/cmd/picoc-1/cstdlib/unistd.c @@ -0,0 +1,531 @@ +/* stdlib.h library for large systems - small embedded systems use clibrary.c instead */ +#include +#include +#include +#include "../interpreter.h" + +#ifndef BUILTIN_MINI_STDLIB + +static int ZeroValue = 0; + +void UnistdAccess(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = access(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} + +void UnistdAlarm(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = alarm(Param[0]->Val->Integer); +} + +void UnistdChdir(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = chdir(Param[0]->Val->Pointer); +} + +void UnistdChroot(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = chroot(Param[0]->Val->Pointer); +} + +void UnistdChown(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = chown(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} + +void UnistdClose(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = close(Param[0]->Val->Integer); +} + +/* +void UnistdConfstr(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = confstr(Param[0]->Val->Integer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} +*/ + +/* +void UnistdCtermid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = ctermid(Param[0]->Val->Pointer); +} +*/ +#if 0 +void UnistdCuserid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = cuserid(Param[0]->Val->Pointer); +} +#endif + +void UnistdDup(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = dup(Param[0]->Val->Integer); +} + +void UnistdDup2(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = dup2(Param[0]->Val->Integer, Param[1]->Val->Integer); +} + +void Unistd_Exit(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + _exit(Param[0]->Val->Integer); +} + +void UnistdFchown(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fchown(Param[0]->Val->Integer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} + +void UnistdFchdir(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fchdir(Param[0]->Val->Integer); +} + +/* +void UnistdFdatasync(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fdatasync(Param[0]->Val->Integer); +} +*/ + +void UnistdFork(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fork(); +} + +/* +void UnistdFpathconf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fpathconf(Param[0]->Val->Integer, Param[1]->Val->Integer); +} +*/ + +void UnistdFsync(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = fsync(Param[0]->Val->Integer); +} + +void UnistdFtruncate(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = ftruncate(Param[0]->Val->Integer, Param[1]->Val->Integer); +} + +/* +void UnistdGetcwd(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = getcwd(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} +*/ + +void UnistdGetdtablesize(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getdtablesize(); +} + +void UnistdGetegid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getegid(); +} + +void UnistdGeteuid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = geteuid(); +} + +void UnistdGetgid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getgid(); +} + +void UnistdGethostid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = gethostid(); +} + +void UnistdGetlogin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = getlogin(); +} + +/* +void UnistdGetlogin_r(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getlogin_r(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} +*/ + +void UnistdGetpagesize(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getpagesize(); +} + +void UnistdGetpass(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = getpass(Param[0]->Val->Pointer); +} + +#if 0 +void UnistdGetpgid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getpgid(Param[0]->Val->Integer); +} +#endif + +void UnistdGetpgrp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getpgrp(); +} + +void UnistdGetpid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getpid(); +} + +void UnistdGetppid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getppid(); +} + +#if 0 +void UnistdGetsid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getsid(Param[0]->Val->Integer); +} +#endif + +void UnistdGetuid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = getuid(); +} + +/* +void UnistdGetwd(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = getcwd(Param[0]->Val->Pointer, PATH_MAX); +} +*/ + +void UnistdIsatty(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = isatty(Param[0]->Val->Integer); +} + +/* +void UnistdLchown(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = lchown(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} +*/ + +void UnistdLink(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = link(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +/* +void UnistdLockf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = lockf(Param[0]->Val->Integer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} +*/ + +void UnistdLseek(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = lseek(Param[0]->Val->Integer, Param[1]->Val->Integer, Param[2]->Val->Integer); +} + +void UnistdNice(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = nice(Param[0]->Val->Integer); +} + +/* +void UnistdPathconf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = pathconf(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} +*/ + +void UnistdPause(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = pause(); +} + +#if 0 +void UnistdPread(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = pread(Param[0]->Val->Integer, Param[1]->Val->Pointer, Param[2]->Val->Integer, Param[3]->Val->Integer); +} + +void UnistdPwrite(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = pwrite(Param[0]->Val->Integer, Param[1]->Val->Pointer, Param[2]->Val->Integer, Param[3]->Val->Integer); +} +#endif + +void UnistdRead(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = read(Param[0]->Val->Integer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void UnistdReadlink(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = readlink(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + +void UnistdRmdir(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = rmdir(Param[0]->Val->Pointer); +} + +void UnistdSbrk(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = sbrk(Param[0]->Val->Integer); +} + +void UnistdSetgid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = setgid(Param[0]->Val->Integer); +} + +/* +void UnistdSetpgid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = setpgid(Param[0]->Val->Integer, Param[1]->Val->Integer); +} +*/ + +void UnistdSetpgrp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = setpgrp(); +} + +void UnistdSetregid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = setregid(Param[0]->Val->Integer, Param[1]->Val->Integer); +} + +void UnistdSetreuid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = setreuid(Param[0]->Val->Integer, Param[1]->Val->Integer); +} + +/* +void UnistdSetsid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = setsid(); +} +*/ + +void UnistdSetuid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = setuid(Param[0]->Val->Integer); +} + +void UnistdSleep(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = sleep(Param[0]->Val->Integer); +} + +#if 0 +void UnistdSwab(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = swab(Param[0]->Val->Pointer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} +#endif + +void UnistdSymlink(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = symlink(Param[0]->Val->Pointer, Param[1]->Val->Pointer); +} + +void UnistdSync(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + sync(); +} + +/* +void UnistdSysconf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = sysconf(Param[0]->Val->Integer); +} +*/ + +/* +void UnistdTcgetpgrp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = tcgetpgrp(Param[0]->Val->Integer); +} +*/ + +/* +void UnistdTcsetpgrp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = tcsetpgrp(Param[0]->Val->Integer, Param[1]->Val->Integer); +} +*/ + +void UnistdTruncate(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = truncate(Param[0]->Val->Pointer, Param[1]->Val->Integer); +} + +void UnistdTtyname(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Pointer = ttyname(Param[0]->Val->Integer); +} + +/* +void UnistdTtyname_r(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = ttyname_r(Param[0]->Val->Integer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} +*/ + +void UnistdUalarm(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = ualarm(Param[0]->Val->Integer, Param[1]->Val->Integer); +} + +void UnistdUnlink(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = unlink(Param[0]->Val->Pointer); +} + +void UnistdUsleep(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = 0; + usleep(Param[0]->Val->Integer); +} + +void UnistdVfork(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = vfork(); +} + +void UnistdWrite(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = write(Param[0]->Val->Integer, Param[1]->Val->Pointer, Param[2]->Val->Integer); +} + + +/* handy structure definitions */ +const char UnistdDefs[] = "\ +typedef int uid_t; \ +typedef int gid_t; \ +typedef int pid_t; \ +typedef int off_t; \ +typedef int size_t; \ +typedef int ssize_t; \ +typedef int useconds_t;\ +typedef int intptr_t;\ +"; + +/* all unistd.h functions */ +struct LibraryFunction UnistdFunctions[] = +{ + { UnistdAccess, "int access(char *, int);" }, + { UnistdAlarm, "unsigned int alarm(unsigned int);" }, +/* { UnistdBrk, "int brk(void *);" }, */ + { UnistdChdir, "int chdir(char *);" }, + { UnistdChroot, "int chroot(char *);" }, + { UnistdChown, "int chown(char *, uid_t, gid_t);" }, + { UnistdClose, "int close(int);" }, +/* { UnistdConfstr, "size_t confstr(int, char *, size_t);" }, */ +/* { UnistdCtermid, "char *ctermid(char *);" }, */ +/* { UnistdCuserid, "char *cuserid(char *);" }, */ + { UnistdDup, "int dup(int);" }, + { UnistdDup2, "int dup2(int, int);" }, +/* { UnistdEncrypt, "void encrypt(char[64], int);" }, */ +/* { UnistdExecl, "int execl(char *, char *, ...);" }, */ +/* { UnistdExecle, "int execle(char *, char *, ...);" }, */ +/* { UnistdExeclp, "int execlp(char *, char *, ...);" }, */ +/* { UnistdExecv, "int execv(char *, char *[]);" }, */ +/* { UnistdExecve, "int execve(char *, char *[], char *[]);" }, */ +/* { UnistdExecvp, "int execvp(char *, char *[]);" }, */ + { Unistd_Exit, "void _exit(int);" }, + { UnistdFchown, "int fchown(int, uid_t, gid_t);" }, + { UnistdFchdir, "int fchdir(int);" }, +/* { UnistdFdatasync, "int fdatasync(int);" }, */ + { UnistdFork, "pid_t fork(void);" }, +/* { UnistdFpathconf, "long fpathconf(int, int);" }, */ + { UnistdFsync, "int fsync(int);" }, + { UnistdFtruncate, "int ftruncate(int, off_t);" }, +/* { UnistdGetcwd, "char *getcwd(char *, size_t);" },*/ + { UnistdGetdtablesize, "int getdtablesize(void);" }, + { UnistdGetegid, "gid_t getegid(void);" }, + { UnistdGeteuid, "uid_t geteuid(void);" }, + { UnistdGetgid, "gid_t getgid(void);" }, +/* { UnistdGetgroups, "int getgroups(int, gid_t []);" }, */ + { UnistdGethostid, "long gethostid(void);" }, + { UnistdGetlogin, "char *getlogin(void);" }, +/* { UnistdGetlogin_r, "int getlogin_r(char *, size_t);" },*/ +/* { UnistdGetopt, "int getopt(int, char * [], char *);" }, */ + { UnistdGetpagesize, "int getpagesize(void);" }, + { UnistdGetpass, "char *getpass(char *);" }, +/* { UnistdGetpgid, "pid_t getpgid(pid_t);" }, */ + { UnistdGetpgrp, "pid_t getpgrp(void);" }, + { UnistdGetpid, "pid_t getpid(void);" }, + { UnistdGetppid, "pid_t getppid(void);" }, +/* { UnistdGetsid, "pid_t getsid(pid_t);" }, */ + { UnistdGetuid, "uid_t getuid(void);" }, +/* { UnistdGetwd, "char *getwd(char *);" }, */ + { UnistdIsatty, "int isatty(int);" }, +/* { UnistdLchown, "int lchown(char *, uid_t, gid_t);" },*/ + { UnistdLink, "int link(char *, char *);" }, +/* { UnistdLockf, "int lockf(int, int, off_t);" },*/ + { UnistdLseek, "off_t lseek(int, off_t, int);" }, + { UnistdNice, "int nice(int);" }, +/* { UnistdPathconf, "long pathconf(char *, int);" },*/ + { UnistdPause, "int pause(void);" }, +/* { UnistdPipe, "int pipe(int [2]);" }, */ +/* { UnistdPread, "ssize_t pread(int, void *, size_t, off_t);" }, */ +/* { UnistdPthread_atfork,"int pthread_atfork(void (*)(void), void (*)(void), void(*)(void));" }, */ +/* { UnistdPwrite, "ssize_t pwrite(int, void *, size_t, off_t);" }, */ + { UnistdRead, "ssize_t read(int, void *, size_t);" }, + { UnistdReadlink, "int readlink(char *, char *, size_t);" }, + { UnistdRmdir, "int rmdir(char *);" }, + { UnistdSbrk, "void *sbrk(intptr_t);" }, + { UnistdSetgid, "int setgid(gid_t);" }, +/* { UnistdSetpgid, "int setpgid(pid_t, pid_t);" }, */ + { UnistdSetpgrp, "pid_t setpgrp(void);" }, + { UnistdSetregid, "int setregid(gid_t, gid_t);" }, + { UnistdSetreuid, "int setreuid(uid_t, uid_t);" }, +/* { UnistdSetsid, "pid_t setsid(void);" }, */ + { UnistdSetuid, "int setuid(uid_t);" }, + { UnistdSleep, "unsigned int sleep(unsigned int);" }, +/* { UnistdSwab, "void swab(void *, void *, ssize_t);" }, */ + { UnistdSymlink, "int symlink(char *, char *);" }, + { UnistdSync, "void sync(void);" }, +/* { UnistdSysconf, "long sysconf(int);" }, */ +/* { UnistdTcgetpgrp, "pid_t tcgetpgrp(int);" }, */ +/* { UnistdTcsetpgrp, "int tcsetpgrp(int, pid_t);" },*/ + { UnistdTruncate, "int truncate(char *, off_t);" }, + { UnistdTtyname, "char *ttyname(int);" }, +/* { UnistdTtyname_r, "int ttyname_r(int, char *, size_t);" }, */ + { UnistdUalarm, "useconds_t ualarm(useconds_t, useconds_t);" }, + { UnistdUnlink, "int unlink(char *);" }, + { UnistdUsleep, "int usleep(useconds_t);" }, + { UnistdVfork, "pid_t vfork(void);" }, + { UnistdWrite, "ssize_t write(int, void *, size_t);" }, + { NULL, NULL } +}; + +/* creates various system-dependent definitions */ +void UnistdSetupFunc(void) +{ + /* define NULL */ + if (!VariableDefined(TableStrRegister("NULL"))) + VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE); + + /* define optarg and friends */ + VariableDefinePlatformVar(NULL, "optarg", CharPtrType, (union AnyValue *)&optarg, TRUE); + VariableDefinePlatformVar(NULL, "optind", &IntType, (union AnyValue *)&optind, TRUE); + VariableDefinePlatformVar(NULL, "opterr", &IntType, (union AnyValue *)&opterr, TRUE); + VariableDefinePlatformVar(NULL, "optopt", &IntType, (union AnyValue *)&optopt, TRUE); +} + +#endif /* !BUILTIN_MINI_STDLIB */ + diff --git a/src/cmd/picoc-1/debug.c b/src/cmd/picoc-1/debug.c new file mode 100644 index 0000000..ba09fe2 --- /dev/null +++ b/src/cmd/picoc-1/debug.c @@ -0,0 +1,127 @@ +/* picoc interactive debugger */ + +#ifndef NO_DEBUGGER + +#include "interpreter.h" + +#define BREAKPOINT_TABLE_SIZE 21 +#define BREAKPOINT_HASH(p) ( ((unsigned long)(p)->FileName) ^ (((p)->Line << 16) | ((p)->CharacterPos << 16)) ) + +struct Table BreakpointTable; +struct TableEntry *BreakpointHashTable[BREAKPOINT_TABLE_SIZE]; +int BreakpointCount = 0; +int DebugManualBreak = FALSE; + +/* initialise the debugger by clearing the breakpoint table */ +void DebugInit() +{ + TableInitTable(&BreakpointTable, &BreakpointHashTable[0], BREAKPOINT_TABLE_SIZE, TRUE); + BreakpointCount = 0; +} + +/* free the contents of the breakpoint table */ +void DebugCleanup() +{ + struct TableEntry *Entry; + struct TableEntry *NextEntry; + int Count; + + for (Count = 0; Count < BreakpointTable.Size; Count++) + { + for (Entry = BreakpointHashTable[Count]; Entry != NULL; Entry = NextEntry) + { + NextEntry = Entry->Next; + HeapFreeMem(Entry); + } + } +} + +/* search the table for a breakpoint */ +static struct TableEntry *DebugTableSearchBreakpoint(struct ParseState *Parser, int *AddAt) +{ + struct TableEntry *Entry; + int HashValue = BREAKPOINT_HASH(Parser) % BreakpointTable.Size; + + for (Entry = BreakpointHashTable[HashValue]; Entry != NULL; Entry = Entry->Next) + { + if (Entry->p.b.FileName == Parser->FileName && Entry->p.b.Line == Parser->Line && Entry->p.b.CharacterPos == Parser->CharacterPos) + return Entry; /* found */ + } + + *AddAt = HashValue; /* didn't find it in the chain */ + return NULL; +} + +/* set a breakpoint in the table */ +void DebugSetBreakpoint(struct ParseState *Parser) +{ + int AddAt; + struct TableEntry *FoundEntry = DebugTableSearchBreakpoint(Parser, &AddAt); + + if (FoundEntry == NULL) + { + /* add it to the table */ + struct TableEntry *NewEntry = HeapAllocMem(sizeof(struct TableEntry)); + if (NewEntry == NULL) + ProgramFail(NULL, "out of memory"); + + NewEntry->p.b.FileName = Parser->FileName; + NewEntry->p.b.Line = Parser->Line; + NewEntry->p.b.CharacterPos = Parser->CharacterPos; + NewEntry->Next = BreakpointHashTable[AddAt]; + BreakpointHashTable[AddAt] = NewEntry; + BreakpointCount++; + } +} + +/* delete a breakpoint from the hash table */ +int DebugClearBreakpoint(struct ParseState *Parser) +{ + struct TableEntry **EntryPtr; + int HashValue = BREAKPOINT_HASH(Parser) % BreakpointTable.Size; + + for (EntryPtr = &BreakpointHashTable[HashValue]; *EntryPtr != NULL; EntryPtr = &(*EntryPtr)->Next) + { + struct TableEntry *DeleteEntry = *EntryPtr; + if (DeleteEntry->p.b.FileName == Parser->FileName && DeleteEntry->p.b.Line == Parser->Line && DeleteEntry->p.b.CharacterPos == Parser->CharacterPos) + { + *EntryPtr = DeleteEntry->Next; + HeapFreeMem(DeleteEntry); + BreakpointCount--; + + return TRUE; + } + } + + return FALSE; +} + +/* before we run a statement, check if there's anything we have to do with the debugger here */ +void DebugCheckStatement(struct ParseState *Parser) +{ + int DoBreak = FALSE; + int AddAt; + + /* has the user manually pressed break? */ + if (DebugManualBreak) + { + DoBreak = TRUE; + DebugManualBreak = FALSE; + } + + /* is this a breakpoint location? */ + if (BreakpointCount != 0 && DebugTableSearchBreakpoint(Parser, &AddAt) != NULL) + DoBreak = TRUE; + + /* handle a break */ + if (DoBreak) + { + PlatformPrintf("Handling a break\n"); + PicocParseInteractiveNoStartPrompt(FALSE); + } +} + +void DebugStep() +{ +} +#endif /* !NO_DEBUGGER */ diff --git a/src/cmd/picoc-1/expression.c b/src/cmd/picoc-1/expression.c new file mode 100644 index 0000000..597016b --- /dev/null +++ b/src/cmd/picoc-1/expression.c @@ -0,0 +1,1492 @@ +/* picoc expression evaluator - a stack-based expression evaluation system + * which handles operator precedence */ + +#include "interpreter.h" + +/* whether evaluation is left to right for a given precedence level */ +#define IS_LEFT_TO_RIGHT(p) ((p) != 2 && (p) != 14) +#define BRACKET_PRECEDENCE 20 +#define IS_TYPE_TOKEN(t) ((t) >= TokenIntType && (t) <= TokenUnsignedType) + +#define DEEP_PRECEDENCE (BRACKET_PRECEDENCE*1000) + +#ifdef DEBUG_EXPRESSIONS +#define debugf printf +#else +void debugf(char *Format, ...) +{ +} +#endif + +/* local prototypes */ +enum OperatorOrder +{ + OrderNone, + OrderPrefix, + OrderInfix, + OrderPostfix +}; + +/* a stack of expressions we use in evaluation */ +struct ExpressionStack +{ + struct ExpressionStack *Next; /* the next lower item on the stack */ + struct Value *Val; /* the value for this stack node */ + enum LexToken Op; /* the operator */ + short unsigned int Precedence; /* the operator precedence of this node */ + unsigned char Order; /* the evaluation order of this operator */ +}; + +/* operator precedence definitions */ +struct OpPrecedence +{ + unsigned int PrefixPrecedence:4; + unsigned int PostfixPrecedence:4; + unsigned int InfixPrecedence:4; + char *Name; +}; + +/* NOTE: the order of this array must correspond exactly to the order of these tokens in enum LexToken */ +static struct OpPrecedence OperatorPrecedence[] = +{ + /* TokenNone, */ { 0, 0, 0, "none" }, + /* TokenComma, */ { 0, 0, 0, "," }, + /* TokenAssign, */ { 0, 0, 2, "=" }, /* TokenAddAssign, */ { 0, 0, 2, "+=" }, /* TokenSubtractAssign, */ { 0, 0, 2, "-=" }, + /* TokenMultiplyAssign, */ { 0, 0, 2, "*=" }, /* TokenDivideAssign, */ { 0, 0, 2, "/=" }, /* TokenModulusAssign, */ { 0, 0, 2, "%=" }, + /* TokenShiftLeftAssign, */ { 0, 0, 2, "<<=" }, /* TokenShiftRightAssign, */ { 0, 0, 2, ">>=" }, /* TokenArithmeticAndAssign, */ { 0, 0, 2, "&=" }, + /* TokenArithmeticOrAssign, */ { 0, 0, 2, "|=" }, /* TokenArithmeticExorAssign, */ { 0, 0, 2, "^=" }, + /* TokenQuestionMark, */ { 0, 0, 3, "?" }, /* TokenColon, */ { 0, 0, 3, ":" }, + /* TokenLogicalOr, */ { 0, 0, 4, "||" }, + /* TokenLogicalAnd, */ { 0, 0, 5, "&&" }, + /* TokenArithmeticOr, */ { 0, 0, 6, "|" }, + /* TokenArithmeticExor, */ { 0, 0, 7, "^" }, + /* TokenAmpersand, */ { 14, 0, 8, "&" }, + /* TokenEqual, */ { 0, 0, 9, "==" }, /* TokenNotEqual, */ { 0, 0, 9, "!=" }, + /* TokenLessThan, */ { 0, 0, 10, "<" }, /* TokenGreaterThan, */ { 0, 0, 10, ">" }, /* TokenLessEqual, */ { 0, 0, 10, "<=" }, /* TokenGreaterEqual, */ { 0, 0, 10, ">=" }, + /* TokenShiftLeft, */ { 0, 0, 11, "<<" }, /* TokenShiftRight, */ { 0, 0, 11, ">>" }, + /* TokenPlus, */ { 14, 0, 12, "+" }, /* TokenMinus, */ { 14, 0, 12, "-" }, + /* TokenAsterisk, */ { 14, 0, 13, "*" }, /* TokenSlash, */ { 0, 0, 13, "/" }, /* TokenModulus, */ { 0, 0, 13, "%" }, + /* TokenIncrement, */ { 14, 15, 0, "++" }, /* TokenDecrement, */ { 14, 15, 0, "--" }, /* TokenUnaryNot, */ { 14, 0, 0, "!" }, /* TokenUnaryExor, */ { 14, 0, 0, "~" }, /* TokenSizeof, */ { 14, 0, 0, "sizeof" }, /* TokenCast, */ { 14, 0, 0, "cast" }, + /* TokenLeftSquareBracket, */ { 0, 0, 15, "[" }, /* TokenRightSquareBracket, */ { 0, 15, 0, "]" }, /* TokenDot, */ { 0, 0, 15, "." }, /* TokenArrow, */ { 0, 0, 15, "->" }, + /* TokenOpenBracket, */ { 15, 0, 0, "(" }, /* TokenCloseBracket, */ { 0, 15, 0, ")" } +}; + +void ExpressionParseFunctionCall(struct ParseState *Parser, struct ExpressionStack **StackTop, const char *FuncName, int RunIt); + +#ifdef DEBUG_EXPRESSIONS +/* show the contents of the expression stack */ +void ExpressionStackShow(struct ExpressionStack *StackTop) +{ + printf("Expression stack [0x%lx,0x%lx]: ", (long)HeapStackTop, (long)StackTop); + + while (StackTop != NULL) + { + if (StackTop->Order == OrderNone) + { + /* it's a value */ + if (StackTop->Val->IsLValue) + printf("lvalue="); + else + printf("value="); + + switch (StackTop->Val->Typ->Base) + { + case TypeVoid: printf("void"); break; + case TypeInt: printf("%d:int", StackTop->Val->Val->Integer); break; + case TypeShort: printf("%d:short", StackTop->Val->Val->ShortInteger); break; + case TypeChar: printf("%d:char", StackTop->Val->Val->Character); break; + case TypeLong: printf("%d:long", StackTop->Val->Val->LongInteger); break; + case TypeUnsignedShort: printf("%d:unsigned short", StackTop->Val->Val->UnsignedShortInteger); break; + case TypeUnsignedInt: printf("%d:unsigned int", StackTop->Val->Val->UnsignedInteger); break; + case TypeUnsignedLong: printf("%d:unsigned long", StackTop->Val->Val->UnsignedLongInteger); break; + case TypeFP: printf("%f:fp", StackTop->Val->Val->FP); break; + case TypeFunction: printf("%s:function", StackTop->Val->Val->Identifier); break; + case TypeMacro: printf("%s:macro", StackTop->Val->Val->Identifier); break; + case TypePointer: + if (StackTop->Val->Val->Pointer == NULL) + printf("ptr(NULL)"); + else if (StackTop->Val->Typ->FromType->Base == TypeChar) + printf("\"%s\":string", (char *)StackTop->Val->Val->Pointer); + else + printf("ptr(0x%lx)", (long)StackTop->Val->Val->Pointer); + break; + case TypeArray: printf("array"); break; + case TypeStruct: printf("%s:struct", StackTop->Val->Val->Identifier); break; + case TypeUnion: printf("%s:union", StackTop->Val->Val->Identifier); break; + case TypeEnum: printf("%s:enum", StackTop->Val->Val->Identifier); break; + case Type_Type: PrintType(StackTop->Val->Val->Typ, CStdOut); printf(":type"); break; + default: printf("unknown"); break; + } + printf("[0x%lx,0x%lx]", (long)StackTop, (long)StackTop->Val); + } + else + { + /* it's an operator */ + printf("op='%s' %s %d", OperatorPrecedence[(int)StackTop->Op].Name, + (StackTop->Order == OrderPrefix) ? "prefix" : ((StackTop->Order == OrderPostfix) ? "postfix" : "infix"), + StackTop->Precedence); + printf("[0x%lx]", (long)StackTop); + } + + StackTop = StackTop->Next; + if (StackTop != NULL) + printf(", "); + } + + printf("\n"); +} +#endif + +long ExpressionCoerceInteger(struct Value *Val) +{ + switch (Val->Typ->Base) + { + case TypeInt: return (long)Val->Val->Integer; + case TypeChar: return (long)Val->Val->Character; + case TypeShort: return (long)Val->Val->ShortInteger; + case TypeLong: return (long)Val->Val->LongInteger; + case TypeUnsignedInt: return (long)Val->Val->UnsignedInteger; + case TypeUnsignedShort: return (long)Val->Val->UnsignedShortInteger; + case TypeUnsignedLong: return (long)Val->Val->UnsignedLongInteger; + case TypePointer: return (long)Val->Val->Pointer; +#ifndef NO_FP + case TypeFP: return (long)Val->Val->FP; +#endif + default: return 0; + } +} + +unsigned long ExpressionCoerceUnsignedInteger(struct Value *Val) +{ + switch (Val->Typ->Base) + { + case TypeInt: return (unsigned long)Val->Val->Integer; + case TypeChar: return (unsigned long)Val->Val->Character; + case TypeShort: return (unsigned long)Val->Val->ShortInteger; + case TypeLong: return (unsigned long)Val->Val->LongInteger; + case TypeUnsignedInt: return (unsigned long)Val->Val->UnsignedInteger; + case TypeUnsignedShort: return (unsigned long)Val->Val->UnsignedShortInteger; + case TypeUnsignedLong: return (unsigned long)Val->Val->UnsignedLongInteger; + case TypePointer: return (unsigned long)Val->Val->Pointer; +#ifndef NO_FP + case TypeFP: return (unsigned long)Val->Val->FP; +#endif + default: return 0; + } +} + +#ifndef NO_FP +double ExpressionCoerceFP(struct Value *Val) +{ +#ifndef BROKEN_FLOAT_CASTS + int IntVal; + unsigned UnsignedVal; + + switch (Val->Typ->Base) + { + case TypeInt: IntVal = Val->Val->Integer; return (double)IntVal; + case TypeChar: IntVal = Val->Val->Character; return (double)IntVal; + case TypeShort: IntVal = Val->Val->ShortInteger; return (double)IntVal; + case TypeLong: IntVal = Val->Val->LongInteger; return (double)IntVal; + case TypeUnsignedInt: UnsignedVal = Val->Val->UnsignedInteger; return (double)UnsignedVal; + case TypeUnsignedShort: UnsignedVal = Val->Val->UnsignedShortInteger; return (double)UnsignedVal; + case TypeUnsignedLong: UnsignedVal = Val->Val->UnsignedLongInteger; return (double)UnsignedVal; + case TypeFP: return Val->Val->FP; + default: return 0.0; + } +#else + switch (Val->Typ->Base) + { + case TypeInt: return (double)Val->Val->Integer; + case TypeChar: return (double)Val->Val->Character; + case TypeShort: return (double)Val->Val->ShortInteger; + case TypeLong: return (double)Val->Val->LongInteger; + case TypeUnsignedInt: return (double)Val->Val->UnsignedInteger; + case TypeUnsignedShort: return (double)Val->Val->UnsignedShortInteger; + case TypeUnsignedLong: return (double)Val->Val->UnsignedLongInteger; + case TypeFP: return (double)Val->Val->FP; + default: return 0.0; + } +#endif +} +#endif + +/* assign an integer value */ +long ExpressionAssignInt(struct ParseState *Parser, struct Value *DestValue, long FromInt, int After) +{ + long Result; + + if (!DestValue->IsLValue) + ProgramFail(Parser, "can't assign to this"); + + if (After) + Result = ExpressionCoerceInteger(DestValue); + else + Result = FromInt; + + switch (DestValue->Typ->Base) + { + case TypeInt: DestValue->Val->Integer = FromInt; break; + case TypeShort: DestValue->Val->ShortInteger = (short)FromInt; break; + case TypeChar: DestValue->Val->Character = (unsigned char)FromInt; break; + case TypeLong: DestValue->Val->LongInteger = (long)FromInt; break; + case TypeUnsignedInt: DestValue->Val->UnsignedInteger = (unsigned int)FromInt; break; + case TypeUnsignedShort: DestValue->Val->UnsignedShortInteger = (unsigned short)FromInt; break; + case TypeUnsignedLong: DestValue->Val->UnsignedLongInteger = (unsigned long)FromInt; break; + default: break; + } + return Result; +} + +#ifndef NO_FP +/* assign a floating point value */ +double ExpressionAssignFP(struct ParseState *Parser, struct Value *DestValue, double FromFP) +{ + if (!DestValue->IsLValue) + ProgramFail(Parser, "can't assign to this"); + + DestValue->Val->FP = FromFP; + return FromFP; +} +#endif + +/* push a node on to the expression stack */ +void ExpressionStackPushValueNode(struct ParseState *Parser, struct ExpressionStack **StackTop, struct Value *ValueLoc) +{ + struct ExpressionStack *StackNode = VariableAlloc(Parser, sizeof(struct ExpressionStack), FALSE); + StackNode->Next = *StackTop; + StackNode->Val = ValueLoc; + *StackTop = StackNode; +#ifdef FANCY_ERROR_MESSAGES + StackNode->Line = Parser->Line; + StackNode->CharacterPos = Parser->CharacterPos; +#endif +#ifdef DEBUG_EXPRESSIONS + ExpressionStackShow(*StackTop); +#endif +} + +/* push a blank value on to the expression stack by type */ +struct Value *ExpressionStackPushValueByType(struct ParseState *Parser, struct ExpressionStack **StackTop, struct ValueType *PushType) +{ + struct Value *ValueLoc = VariableAllocValueFromType(Parser, PushType, FALSE, NULL, FALSE); + ExpressionStackPushValueNode(Parser, StackTop, ValueLoc); + + return ValueLoc; +} + +/* push a value on to the expression stack */ +void ExpressionStackPushValue(struct ParseState *Parser, struct ExpressionStack **StackTop, struct Value *PushValue) +{ + struct Value *ValueLoc = VariableAllocValueAndCopy(Parser, PushValue, FALSE); + ExpressionStackPushValueNode(Parser, StackTop, ValueLoc); +} + +void ExpressionStackPushLValue(struct ParseState *Parser, struct ExpressionStack **StackTop, struct Value *PushValue, int Offset) +{ + struct Value *ValueLoc = VariableAllocValueShared(Parser, PushValue); + ValueLoc->Val = (void *)((char *)ValueLoc->Val + Offset); + ExpressionStackPushValueNode(Parser, StackTop, ValueLoc); +} + +void ExpressionStackPushDereference(struct ParseState *Parser, struct ExpressionStack **StackTop, struct Value *DereferenceValue) +{ + struct Value *DerefVal; + struct Value *ValueLoc; + int Offset; + struct ValueType *DerefType; + int DerefIsLValue; + void *DerefDataLoc = VariableDereferencePointer(Parser, DereferenceValue, &DerefVal, &Offset, &DerefType, &DerefIsLValue); + if (DerefDataLoc == NULL) + ProgramFail(Parser, "NULL pointer dereference"); + + ValueLoc = VariableAllocValueFromExistingData(Parser, DerefType, (union AnyValue *)DerefDataLoc, DerefIsLValue, DerefVal); + ExpressionStackPushValueNode(Parser, StackTop, ValueLoc); +} + +void ExpressionPushInt(struct ParseState *Parser, struct ExpressionStack **StackTop, long IntValue) +{ + struct Value *ValueLoc = VariableAllocValueFromType(Parser, &IntType, FALSE, NULL, FALSE); + ValueLoc->Val->Integer = IntValue; + ExpressionStackPushValueNode(Parser, StackTop, ValueLoc); +} + +#ifndef NO_FP +void ExpressionPushFP(struct ParseState *Parser, struct ExpressionStack **StackTop, double FPValue) +{ + struct Value *ValueLoc = VariableAllocValueFromType(Parser, &FPType, FALSE, NULL, FALSE); + ValueLoc->Val->FP = FPValue; + ExpressionStackPushValueNode(Parser, StackTop, ValueLoc); +} +#endif + +/* assign to a pointer */ +void ExpressionAssignToPointer(struct ParseState *Parser, struct Value *ToValue, struct Value *FromValue, const char *FuncName, int ParamNo, int AllowPointerCoercion) +{ + struct ValueType *PointedToType = ToValue->Typ->FromType; + + if (FromValue->Typ == ToValue->Typ || FromValue->Typ == VoidPtrType || (ToValue->Typ == VoidPtrType && FromValue->Typ->Base == TypePointer)) + ToValue->Val->Pointer = FromValue->Val->Pointer; /* plain old pointer assignment */ + + else if (FromValue->Typ->Base == TypeArray && (PointedToType == FromValue->Typ->FromType || ToValue->Typ == VoidPtrType)) + { + /* the form is: blah *x = array of blah */ + ToValue->Val->Pointer = (void *)&FromValue->Val->ArrayMem[0]; + } + else if (FromValue->Typ->Base == TypePointer && FromValue->Typ->FromType->Base == TypeArray && + (PointedToType == FromValue->Typ->FromType->FromType || ToValue->Typ == VoidPtrType) ) + { + /* the form is: blah *x = pointer to array of blah */ + ToValue->Val->Pointer = VariableDereferencePointer(Parser, FromValue, NULL, NULL, NULL, NULL); + } + else if (IS_NUMERIC_COERCIBLE(FromValue) && ExpressionCoerceInteger(FromValue) == 0) + { + /* null pointer assignment */ + ToValue->Val->Pointer = NULL; + } + else if (AllowPointerCoercion && IS_NUMERIC_COERCIBLE(FromValue)) + { + /* assign integer to native pointer */ + ToValue->Val->Pointer = (void *)(unsigned long)ExpressionCoerceUnsignedInteger(FromValue); + } + else if (AllowPointerCoercion && FromValue->Typ->Base == TypePointer) + { + /* assign a pointer to a pointer to a different type */ + ToValue->Val->Pointer = FromValue->Val->Pointer; + } + else + AssignFail(Parser, "%t from %t", ToValue->Typ, FromValue->Typ, 0, 0, FuncName, ParamNo); +} + +/* assign any kind of value */ +void ExpressionAssign(struct ParseState *Parser, struct Value *DestValue, struct Value *SourceValue, int Force, const char *FuncName, int ParamNo, int AllowPointerCoercion) +{ + if (!DestValue->IsLValue && !Force) + AssignFail(Parser, "not an lvalue", NULL, NULL, 0, 0, FuncName, ParamNo); + + if (IS_NUMERIC_COERCIBLE(DestValue) && !IS_NUMERIC_COERCIBLE_PLUS_POINTERS(SourceValue, AllowPointerCoercion)) + AssignFail(Parser, "%t from %t", DestValue->Typ, SourceValue->Typ, 0, 0, FuncName, ParamNo); + + switch (DestValue->Typ->Base) + { + case TypeInt: DestValue->Val->Integer = ExpressionCoerceInteger(SourceValue); break; + case TypeShort: DestValue->Val->ShortInteger = (short)ExpressionCoerceInteger(SourceValue); break; + case TypeChar: DestValue->Val->Character = (unsigned char)ExpressionCoerceUnsignedInteger(SourceValue); break; + case TypeLong: DestValue->Val->LongInteger = ExpressionCoerceInteger(SourceValue); break; + case TypeUnsignedInt: DestValue->Val->UnsignedInteger = ExpressionCoerceUnsignedInteger(SourceValue); break; + case TypeUnsignedShort: DestValue->Val->UnsignedShortInteger = (unsigned short)ExpressionCoerceUnsignedInteger(SourceValue); break; + case TypeUnsignedLong: DestValue->Val->UnsignedLongInteger = ExpressionCoerceUnsignedInteger(SourceValue); break; + +#ifndef NO_FP + case TypeFP: + if (!IS_NUMERIC_COERCIBLE_PLUS_POINTERS(SourceValue, AllowPointerCoercion)) + AssignFail(Parser, "%t from %t", DestValue->Typ, SourceValue->Typ, 0, 0, FuncName, ParamNo); + + DestValue->Val->FP = ExpressionCoerceFP(SourceValue); + break; +#endif + case TypePointer: + ExpressionAssignToPointer(Parser, DestValue, SourceValue, FuncName, ParamNo, AllowPointerCoercion); + break; + + case TypeArray: + if (SourceValue->Typ->Base == TypeArray && DestValue->Typ->FromType == DestValue->Typ->FromType && DestValue->Typ->ArraySize == 0) + { + /* destination array is unsized - need to resize the destination array to the same size as the source array */ + DestValue->Typ = SourceValue->Typ; + VariableRealloc(Parser, DestValue, TypeSizeValue(DestValue, FALSE)); + + if (DestValue->LValueFrom != NULL) + { + /* copy the resized value back to the LValue */ + DestValue->LValueFrom->Val = DestValue->Val; + DestValue->LValueFrom->AnyValOnHeap = DestValue->AnyValOnHeap; + } + } + + if (DestValue->Typ != SourceValue->Typ) + AssignFail(Parser, "%t from %t", DestValue->Typ, SourceValue->Typ, 0, 0, FuncName, ParamNo); + + if (DestValue->Typ->ArraySize != SourceValue->Typ->ArraySize) + AssignFail(Parser, "from an array of size %d to one of size %d", NULL, NULL, DestValue->Typ->ArraySize, SourceValue->Typ->ArraySize, FuncName, ParamNo); + + memcpy((void *)DestValue->Val, (void *)SourceValue->Val, TypeSizeValue(DestValue, FALSE)); + break; + + case TypeStruct: + case TypeUnion: + if (DestValue->Typ != SourceValue->Typ) + AssignFail(Parser, "%t from %t", DestValue->Typ, SourceValue->Typ, 0, 0, FuncName, ParamNo); + + memcpy((void *)DestValue->Val, (void *)SourceValue->Val, TypeSizeValue(SourceValue, FALSE)); + break; + + default: + AssignFail(Parser, "%t", DestValue->Typ, NULL, 0, 0, FuncName, ParamNo); + break; + } +} + +/* evaluate the first half of a ternary operator x ? y : z */ +void ExpressionQuestionMarkOperator(struct ParseState *Parser, struct ExpressionStack **StackTop, struct Value *BottomValue, struct Value *TopValue) +{ + if (!IS_NUMERIC_COERCIBLE(TopValue)) + ProgramFail(Parser, "first argument to '?' should be a number"); + + if (ExpressionCoerceInteger(TopValue)) + { + /* the condition's true, return the BottomValue */ + ExpressionStackPushValue(Parser, StackTop, BottomValue); + } + else + { + /* the condition's false, return void */ + ExpressionStackPushValueByType(Parser, StackTop, &VoidType); + } +} + +/* evaluate the second half of a ternary operator x ? y : z */ +void ExpressionColonOperator(struct ParseState *Parser, struct ExpressionStack **StackTop, struct Value *BottomValue, struct Value *TopValue) +{ + if (TopValue->Typ->Base == TypeVoid) + { + /* invoke the "else" part - return the BottomValue */ + ExpressionStackPushValue(Parser, StackTop, BottomValue); + } + else + { + /* it was a "then" - return the TopValue */ + ExpressionStackPushValue(Parser, StackTop, TopValue); + } +} + +/* evaluate a prefix operator */ +void ExpressionPrefixOperator(struct ParseState *Parser, struct ExpressionStack **StackTop, enum LexToken Op, struct Value *TopValue) +{ + struct Value *Result; + union AnyValue *ValPtr; + + debugf("ExpressionPrefixOperator()\n"); + switch (Op) + { + case TokenAmpersand: + if (!TopValue->IsLValue) + ProgramFail(Parser, "can't get the address of this"); + + ValPtr = TopValue->Val; + Result = VariableAllocValueFromType(Parser, TypeGetMatching(Parser, TopValue->Typ, TypePointer, 0, StrEmpty, TRUE), FALSE, NULL, FALSE); + Result->Val->Pointer = (void *)ValPtr; + ExpressionStackPushValueNode(Parser, StackTop, Result); + break; + + case TokenAsterisk: + ExpressionStackPushDereference(Parser, StackTop, TopValue); + break; + + case TokenSizeof: + /* return the size of the argument */ + if (TopValue->Typ == &TypeType) + ExpressionPushInt(Parser, StackTop, TypeSize(TopValue->Val->Typ, TopValue->Val->Typ->ArraySize, TRUE)); + else + ExpressionPushInt(Parser, StackTop, TypeSize(TopValue->Typ, TopValue->Typ->ArraySize, TRUE)); + break; + + default: + /* an arithmetic operator */ +#ifndef NO_FP + if (TopValue->Typ == &FPType) + { + /* floating point prefix arithmetic */ + double ResultFP = 0.0; + + switch (Op) + { + case TokenPlus: ResultFP = TopValue->Val->FP; break; + case TokenMinus: ResultFP = -TopValue->Val->FP; break; + default: ProgramFail(Parser, "invalid operation"); break; + } + + ExpressionPushFP(Parser, StackTop, ResultFP); + } + else +#endif + if (IS_NUMERIC_COERCIBLE(TopValue)) + { + /* integer prefix arithmetic */ + long ResultInt = 0; + long TopInt = ExpressionCoerceInteger(TopValue); + switch (Op) + { + case TokenPlus: ResultInt = TopInt; break; + case TokenMinus: ResultInt = -TopInt; break; + case TokenIncrement: ResultInt = ExpressionAssignInt(Parser, TopValue, TopInt+1, FALSE); break; + case TokenDecrement: ResultInt = ExpressionAssignInt(Parser, TopValue, TopInt-1, FALSE); break; + case TokenUnaryNot: ResultInt = !TopInt; break; + case TokenUnaryExor: ResultInt = ~TopInt; break; + default: ProgramFail(Parser, "invalid operation"); break; + } + + ExpressionPushInt(Parser, StackTop, ResultInt); + } + else if (TopValue->Typ->Base == TypePointer) + { + /* pointer prefix arithmetic */ + int Size = TypeSize(TopValue->Typ->FromType, 0, TRUE); + struct Value *StackValue; + void *ResultPtr; + + if (TopValue->Val->Pointer == NULL) + ProgramFail(Parser, "invalid use of a NULL pointer"); + + if (!TopValue->IsLValue) + ProgramFail(Parser, "can't assign to this"); + + switch (Op) + { + case TokenIncrement: TopValue->Val->Pointer = (void *)((char *)TopValue->Val->Pointer + Size); break; + case TokenDecrement: TopValue->Val->Pointer = (void *)((char *)TopValue->Val->Pointer - Size); break; + default: ProgramFail(Parser, "invalid operation"); break; + } + + ResultPtr = TopValue->Val->Pointer; + StackValue = ExpressionStackPushValueByType(Parser, StackTop, TopValue->Typ); + StackValue->Val->Pointer = ResultPtr; + } + else + ProgramFail(Parser, "invalid operation"); + break; + } +} + +/* evaluate a postfix operator */ +void ExpressionPostfixOperator(struct ParseState *Parser, struct ExpressionStack **StackTop, enum LexToken Op, struct Value *TopValue) +{ + debugf("ExpressionPostfixOperator()\n"); + if (IS_NUMERIC_COERCIBLE(TopValue)) + { + long ResultInt = 0; + long TopInt = ExpressionCoerceInteger(TopValue); + switch (Op) + { + case TokenIncrement: ResultInt = ExpressionAssignInt(Parser, TopValue, TopInt+1, TRUE); break; + case TokenDecrement: ResultInt = ExpressionAssignInt(Parser, TopValue, TopInt-1, TRUE); break; + case TokenRightSquareBracket: ProgramFail(Parser, "not supported"); break; /* XXX */ + case TokenCloseBracket: ProgramFail(Parser, "not supported"); break; /* XXX */ + default: ProgramFail(Parser, "invalid operation"); break; + } + + ExpressionPushInt(Parser, StackTop, ResultInt); + } + else if (TopValue->Typ->Base == TypePointer) + { + /* pointer postfix arithmetic */ + int Size = TypeSize(TopValue->Typ->FromType, 0, TRUE); + struct Value *StackValue; + void *OrigPointer = TopValue->Val->Pointer; + + if (TopValue->Val->Pointer == NULL) + ProgramFail(Parser, "invalid use of a NULL pointer"); + + if (!TopValue->IsLValue) + ProgramFail(Parser, "can't assign to this"); + + switch (Op) + { + case TokenIncrement: TopValue->Val->Pointer = (void *)((char *)TopValue->Val->Pointer + Size); break; + case TokenDecrement: TopValue->Val->Pointer = (void *)((char *)TopValue->Val->Pointer - Size); break; + default: ProgramFail(Parser, "invalid operation"); break; + } + + StackValue = ExpressionStackPushValueByType(Parser, StackTop, TopValue->Typ); + StackValue->Val->Pointer = OrigPointer; + } + else + ProgramFail(Parser, "invalid operation"); +} + +/* evaluate an infix operator */ +void ExpressionInfixOperator(struct ParseState *Parser, struct ExpressionStack **StackTop, enum LexToken Op, struct Value *BottomValue, struct Value *TopValue) +{ + long ResultInt = 0; + struct Value *StackValue; + void *Pointer; + + debugf("ExpressionInfixOperator()\n"); + if (BottomValue == NULL || TopValue == NULL) + ProgramFail(Parser, "invalid expression"); + + if (Op == TokenLeftSquareBracket) + { + /* array index */ + int ArrayIndex; + struct Value *Result = NULL; + + if (!IS_NUMERIC_COERCIBLE(TopValue)) + ProgramFail(Parser, "array index must be an integer"); + + ArrayIndex = ExpressionCoerceInteger(TopValue); + + /* make the array element result */ + switch (BottomValue->Typ->Base) + { + case TypeArray: Result = VariableAllocValueFromExistingData(Parser, BottomValue->Typ->FromType, (union AnyValue *)(&BottomValue->Val->ArrayMem[0] + TypeSize(BottomValue->Typ, ArrayIndex, TRUE)), BottomValue->IsLValue, BottomValue->LValueFrom); break; + case TypePointer: Result = VariableAllocValueFromExistingData(Parser, BottomValue->Typ->FromType, (union AnyValue *)((char *)BottomValue->Val->Pointer + TypeSize(BottomValue->Typ->FromType, 0, TRUE) * ArrayIndex), BottomValue->IsLValue, BottomValue->LValueFrom); break; + default: ProgramFail(Parser, "this %t is not an array", BottomValue->Typ); + } + + ExpressionStackPushValueNode(Parser, StackTop, Result); + } + else if (Op == TokenQuestionMark) + ExpressionQuestionMarkOperator(Parser, StackTop, TopValue, BottomValue); + + else if (Op == TokenColon) + ExpressionColonOperator(Parser, StackTop, TopValue, BottomValue); + +#ifndef NO_FP + else if ( (TopValue->Typ == &FPType && BottomValue->Typ == &FPType) || + (TopValue->Typ == &FPType && IS_NUMERIC_COERCIBLE(BottomValue)) || + (IS_NUMERIC_COERCIBLE(TopValue) && BottomValue->Typ == &FPType) ) + { + /* floating point infix arithmetic */ + int ResultIsInt = FALSE; + double ResultFP = 0.0; + double TopFP = (TopValue->Typ == &FPType) ? TopValue->Val->FP : (double)ExpressionCoerceInteger(TopValue); + double BottomFP = (BottomValue->Typ == &FPType) ? BottomValue->Val->FP : (double)ExpressionCoerceInteger(BottomValue); + + switch (Op) + { + case TokenAssign: ResultFP = ExpressionAssignFP(Parser, BottomValue, TopFP); break; + case TokenAddAssign: ResultFP = ExpressionAssignFP(Parser, BottomValue, BottomFP + TopFP); break; + case TokenSubtractAssign: ResultFP = ExpressionAssignFP(Parser, BottomValue, BottomFP - TopFP); break; + case TokenMultiplyAssign: ResultFP = ExpressionAssignFP(Parser, BottomValue, BottomFP * TopFP); break; + case TokenDivideAssign: ResultFP = ExpressionAssignFP(Parser, BottomValue, BottomFP / TopFP); break; + case TokenEqual: ResultInt = BottomFP == TopFP; ResultIsInt = TRUE; break; + case TokenNotEqual: ResultInt = BottomFP != TopFP; ResultIsInt = TRUE; break; + case TokenLessThan: ResultInt = BottomFP < TopFP; ResultIsInt = TRUE; break; + case TokenGreaterThan: ResultInt = BottomFP > TopFP; ResultIsInt = TRUE; break; + case TokenLessEqual: ResultInt = BottomFP <= TopFP; ResultIsInt = TRUE; break; + case TokenGreaterEqual: ResultInt = BottomFP >= TopFP; ResultIsInt = TRUE; break; + case TokenPlus: ResultFP = BottomFP + TopFP; break; + case TokenMinus: ResultFP = BottomFP - TopFP; break; + case TokenAsterisk: ResultFP = BottomFP * TopFP; break; + case TokenSlash: ResultFP = BottomFP / TopFP; break; + default: ProgramFail(Parser, "invalid operation"); break; + } + + if (ResultIsInt) + ExpressionPushInt(Parser, StackTop, ResultInt); + else + ExpressionPushFP(Parser, StackTop, ResultFP); + } +#endif + else if (IS_NUMERIC_COERCIBLE(TopValue) && IS_NUMERIC_COERCIBLE(BottomValue)) + { + /* integer operation */ + long TopInt = ExpressionCoerceInteger(TopValue); + long BottomInt = ExpressionCoerceInteger(BottomValue); + switch (Op) + { + case TokenAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, TopInt, FALSE); break; + case TokenAddAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt + TopInt, FALSE); break; + case TokenSubtractAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt - TopInt, FALSE); break; + case TokenMultiplyAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt * TopInt, FALSE); break; + case TokenDivideAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt / TopInt, FALSE); break; +#ifndef NO_MODULUS + case TokenModulusAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt % TopInt, FALSE); break; +#endif + case TokenShiftLeftAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt << TopInt, FALSE); break; + case TokenShiftRightAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt >> TopInt, FALSE); break; + case TokenArithmeticAndAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt & TopInt, FALSE); break; + case TokenArithmeticOrAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt | TopInt, FALSE); break; + case TokenArithmeticExorAssign: ResultInt = ExpressionAssignInt(Parser, BottomValue, BottomInt ^ TopInt, FALSE); break; + case TokenLogicalOr: ResultInt = BottomInt || TopInt; break; + case TokenLogicalAnd: ResultInt = BottomInt && TopInt; break; + case TokenArithmeticOr: ResultInt = BottomInt | TopInt; break; + case TokenArithmeticExor: ResultInt = BottomInt ^ TopInt; break; + case TokenAmpersand: ResultInt = BottomInt & TopInt; break; + case TokenEqual: ResultInt = BottomInt == TopInt; break; + case TokenNotEqual: ResultInt = BottomInt != TopInt; break; + case TokenLessThan: ResultInt = BottomInt < TopInt; break; + case TokenGreaterThan: ResultInt = BottomInt > TopInt; break; + case TokenLessEqual: ResultInt = BottomInt <= TopInt; break; + case TokenGreaterEqual: ResultInt = BottomInt >= TopInt; break; + case TokenShiftLeft: ResultInt = BottomInt << TopInt; break; + case TokenShiftRight: ResultInt = BottomInt >> TopInt; break; + case TokenPlus: ResultInt = BottomInt + TopInt; break; + case TokenMinus: ResultInt = BottomInt - TopInt; break; + case TokenAsterisk: ResultInt = BottomInt * TopInt; break; + case TokenSlash: ResultInt = BottomInt / TopInt; break; +#ifndef NO_MODULUS + case TokenModulus: ResultInt = BottomInt % TopInt; break; +#endif + default: ProgramFail(Parser, "invalid operation"); break; + } + + ExpressionPushInt(Parser, StackTop, ResultInt); + } + else if (BottomValue->Typ->Base == TypePointer && IS_NUMERIC_COERCIBLE(TopValue)) + { + /* pointer/integer infix arithmetic */ + long TopInt = ExpressionCoerceInteger(TopValue); + + if (Op == TokenEqual || Op == TokenNotEqual) + { + /* comparison to a NULL pointer */ + if (TopInt != 0) + ProgramFail(Parser, "invalid operation"); + + if (Op == TokenEqual) + ExpressionPushInt(Parser, StackTop, BottomValue->Val->Pointer == NULL); + else + ExpressionPushInt(Parser, StackTop, BottomValue->Val->Pointer != NULL); + } + else if (Op == TokenPlus || Op == TokenMinus) + { + /* pointer arithmetic */ + int Size = TypeSize(BottomValue->Typ->FromType, 0, TRUE); + + Pointer = BottomValue->Val->Pointer; + if (Pointer == NULL) + ProgramFail(Parser, "invalid use of a NULL pointer"); + + if (Op == TokenPlus) + Pointer = (void *)((char *)Pointer + TopInt * Size); + else + Pointer = (void *)((char *)Pointer - TopInt * Size); + + StackValue = ExpressionStackPushValueByType(Parser, StackTop, BottomValue->Typ); + StackValue->Val->Pointer = Pointer; + } + else if (Op == TokenAssign && TopInt == 0) + { + /* assign a NULL pointer */ + HeapUnpopStack(sizeof(struct Value)); + ExpressionAssign(Parser, BottomValue, TopValue, FALSE, NULL, 0, FALSE); + ExpressionStackPushValueNode(Parser, StackTop, BottomValue); + } + else if (Op == TokenAddAssign || Op == TokenSubtractAssign) + { + /* pointer arithmetic */ + int Size = TypeSize(BottomValue->Typ->FromType, 0, TRUE); + + Pointer = BottomValue->Val->Pointer; + if (Pointer == NULL) + ProgramFail(Parser, "invalid use of a NULL pointer"); + + if (Op == TokenAddAssign) + Pointer = (void *)((char *)Pointer + TopInt * Size); + else + Pointer = (void *)((char *)Pointer - TopInt * Size); + + HeapUnpopStack(sizeof(struct Value)); + BottomValue->Val->Pointer = Pointer; + ExpressionStackPushValueNode(Parser, StackTop, BottomValue); + } + else + ProgramFail(Parser, "invalid operation"); + } + else if (BottomValue->Typ->Base == TypePointer && TopValue->Typ->Base == TypePointer && Op != TokenAssign) + { + /* pointer/pointer operations */ + char *TopLoc = (char *)TopValue->Val->Pointer; + char *BottomLoc = (char *)BottomValue->Val->Pointer; + + switch (Op) + { + case TokenEqual: ExpressionPushInt(Parser, StackTop, BottomLoc == TopLoc); break; + case TokenNotEqual: ExpressionPushInt(Parser, StackTop, BottomLoc != TopLoc); break; + case TokenMinus: ExpressionPushInt(Parser, StackTop, BottomLoc - TopLoc); break; + default: ProgramFail(Parser, "invalid operation"); break; + } + } + else if (Op == TokenAssign) + { + /* assign a non-numeric type */ + HeapUnpopStack(sizeof(struct Value)); /* XXX - possible bug if lvalue is a temp value and takes more than sizeof(struct Value) */ + ExpressionAssign(Parser, BottomValue, TopValue, FALSE, NULL, 0, FALSE); + ExpressionStackPushValueNode(Parser, StackTop, BottomValue); + } + else if (Op == TokenCast) + { + /* cast a value to a different type */ /* XXX - possible bug if the destination type takes more than sizeof(struct Value) + sizeof(struct ValueType *) */ + struct Value *ValueLoc = ExpressionStackPushValueByType(Parser, StackTop, BottomValue->Val->Typ); + ExpressionAssign(Parser, ValueLoc, TopValue, TRUE, NULL, 0, TRUE); + } + else + ProgramFail(Parser, "invalid operation"); +} + +/* take the contents of the expression stack and compute the top until there's nothing greater than the given precedence */ +void ExpressionStackCollapse(struct ParseState *Parser, struct ExpressionStack **StackTop, int Precedence, int *IgnorePrecedence) +{ + int FoundPrecedence = Precedence; + struct Value *TopValue; + struct Value *BottomValue; + struct ExpressionStack *TopStackNode = *StackTop; + struct ExpressionStack *TopOperatorNode; + + debugf("ExpressionStackCollapse(%d):\n", Precedence); +#ifdef DEBUG_EXPRESSIONS + ExpressionStackShow(*StackTop); +#endif + while (TopStackNode != NULL && TopStackNode->Next != NULL && FoundPrecedence >= Precedence) + { + /* find the top operator on the stack */ + if (TopStackNode->Order == OrderNone) + TopOperatorNode = TopStackNode->Next; + else + TopOperatorNode = TopStackNode; + + FoundPrecedence = TopOperatorNode->Precedence; + + /* does it have a high enough precedence? */ + if (FoundPrecedence >= Precedence && TopOperatorNode != NULL) + { + /* execute this operator */ + switch (TopOperatorNode->Order) + { + case OrderPrefix: + /* prefix evaluation */ + debugf("prefix evaluation\n"); + TopValue = TopStackNode->Val; + + /* pop the value and then the prefix operator - assume they'll still be there until we're done */ + HeapPopStack(NULL, sizeof(struct ExpressionStack) + sizeof(struct Value) + TypeStackSizeValue(TopValue)); + HeapPopStack(TopOperatorNode, sizeof(struct ExpressionStack)); + *StackTop = TopOperatorNode->Next; + + /* do the prefix operation */ + if (Parser->Mode == RunModeRun && FoundPrecedence < *IgnorePrecedence) + { + /* run the operator */ + ExpressionPrefixOperator(Parser, StackTop, TopOperatorNode->Op, TopValue); + } + else + { + /* we're not running it so just return 0 */ + ExpressionPushInt(Parser, StackTop, 0); + } + break; + + case OrderPostfix: + /* postfix evaluation */ + debugf("postfix evaluation\n"); + TopValue = TopStackNode->Next->Val; + + /* pop the postfix operator and then the value - assume they'll still be there until we're done */ + HeapPopStack(NULL, sizeof(struct ExpressionStack)); + HeapPopStack(TopValue, sizeof(struct ExpressionStack) + sizeof(struct Value) + TypeStackSizeValue(TopValue)); + *StackTop = TopStackNode->Next->Next; + + /* do the postfix operation */ + if (Parser->Mode == RunModeRun && FoundPrecedence < *IgnorePrecedence) + { + /* run the operator */ + ExpressionPostfixOperator(Parser, StackTop, TopOperatorNode->Op, TopValue); + } + else + { + /* we're not running it so just return 0 */ + ExpressionPushInt(Parser, StackTop, 0); + } + break; + + case OrderInfix: + /* infix evaluation */ + debugf("infix evaluation\n"); + TopValue = TopStackNode->Val; + if (TopValue != NULL) + { + BottomValue = TopOperatorNode->Next->Val; + + /* pop a value, the operator and another value - assume they'll still be there until we're done */ + HeapPopStack(NULL, sizeof(struct ExpressionStack) + sizeof(struct Value) + TypeStackSizeValue(TopValue)); + HeapPopStack(NULL, sizeof(struct ExpressionStack)); + HeapPopStack(BottomValue, sizeof(struct ExpressionStack) + sizeof(struct Value) + TypeStackSizeValue(BottomValue)); + *StackTop = TopOperatorNode->Next->Next; + + /* do the infix operation */ + if (Parser->Mode == RunModeRun && FoundPrecedence <= *IgnorePrecedence) + { + /* run the operator */ + ExpressionInfixOperator(Parser, StackTop, TopOperatorNode->Op, BottomValue, TopValue); + } + else + { + /* we're not running it so just return 0 */ + ExpressionPushInt(Parser, StackTop, 0); + } + } + else + FoundPrecedence = -1; + break; + + case OrderNone: + /* this should never happen */ + assert(TopOperatorNode->Order != OrderNone); + break; + } + + /* if we've returned above the ignored precedence level turn ignoring off */ + if (FoundPrecedence <= *IgnorePrecedence) + *IgnorePrecedence = DEEP_PRECEDENCE; + } +#ifdef DEBUG_EXPRESSIONS + ExpressionStackShow(*StackTop); +#endif + TopStackNode = *StackTop; + } + debugf("ExpressionStackCollapse() finished\n"); +#ifdef DEBUG_EXPRESSIONS + ExpressionStackShow(*StackTop); +#endif +} + +/* push an operator on to the expression stack */ +void ExpressionStackPushOperator(struct ParseState *Parser, struct ExpressionStack **StackTop, enum OperatorOrder Order, enum LexToken Token, int Precedence) +{ + struct ExpressionStack *StackNode = VariableAlloc(Parser, sizeof(struct ExpressionStack), FALSE); + StackNode->Next = *StackTop; + StackNode->Order = Order; + StackNode->Op = Token; + StackNode->Precedence = Precedence; + *StackTop = StackNode; + debugf("ExpressionStackPushOperator()\n"); +#ifdef FANCY_ERROR_MESSAGES + StackNode->Line = Parser->Line; + StackNode->CharacterPos = Parser->CharacterPos; +#endif +#ifdef DEBUG_EXPRESSIONS + ExpressionStackShow(*StackTop); +#endif +} + +/* do the '.' and '->' operators */ +void ExpressionGetStructElement(struct ParseState *Parser, struct ExpressionStack **StackTop, enum LexToken Token) +{ + struct Value *Ident; + + /* get the identifier following the '.' or '->' */ + if (LexGetToken(Parser, &Ident, TRUE) != TokenIdentifier) + ProgramFail(Parser, "need an structure or union member after '%s'", (Token == TokenDot) ? "." : "->"); + + if (Parser->Mode == RunModeRun) + { + /* look up the struct element */ + struct Value *ParamVal = (*StackTop)->Val; + struct Value *StructVal = ParamVal; + struct ValueType *StructType = ParamVal->Typ; + char *DerefDataLoc = (char *)ParamVal->Val; + struct Value *MemberValue; + struct Value *Result; + + /* if we're doing '->' dereference the struct pointer first */ + if (Token == TokenArrow) + DerefDataLoc = VariableDereferencePointer(Parser, ParamVal, &StructVal, NULL, &StructType, NULL); + + if (StructType->Base != TypeStruct && StructType->Base != TypeUnion) + ProgramFail(Parser, "can't use '%s' on something that's not a struct or union %s : it's a %t", (Token == TokenDot) ? "." : "->", (Token == TokenArrow) ? "pointer" : "", ParamVal->Typ); + + if (!TableGet(StructType->Members, Ident->Val->Identifier, &MemberValue, NULL, NULL, NULL)) + ProgramFail(Parser, "doesn't have a member called '%s'", Ident->Val->Identifier); + + /* pop the value - assume it'll still be there until we're done */ + HeapPopStack(ParamVal, sizeof(struct ExpressionStack) + sizeof(struct Value) + TypeStackSizeValue(StructVal)); + *StackTop = (*StackTop)->Next; + + /* make the result value for this member only */ + Result = VariableAllocValueFromExistingData(Parser, MemberValue->Typ, (void *)(DerefDataLoc + MemberValue->Val->Integer), TRUE, (StructVal != NULL) ? StructVal->LValueFrom : NULL); + ExpressionStackPushValueNode(Parser, StackTop, Result); + } +} + +/* parse an expression with operator precedence */ +int ExpressionParse(struct ParseState *Parser, struct Value **Result) +{ + struct Value *LexValue; + int PrefixState = TRUE; + int Done = FALSE; + int BracketPrecedence = 0; + int LocalPrecedence; + int Precedence = 0; + int IgnorePrecedence = DEEP_PRECEDENCE; + struct ExpressionStack *StackTop = NULL; + int TernaryDepth = 0; + + debugf("ExpressionParse():\n"); + do + { + struct ParseState PreState; + enum LexToken Token; + + ParserCopy(&PreState, Parser); + Token = LexGetToken(Parser, &LexValue, TRUE); + if ( ( ( (int)Token > TokenComma && (int)Token <= (int)TokenOpenBracket) || + (Token == TokenCloseBracket && BracketPrecedence != 0)) && + (Token != TokenColon || TernaryDepth > 0) ) + { + /* it's an operator with precedence */ + if (PrefixState) + { + /* expect a prefix operator */ + if (OperatorPrecedence[(int)Token].PrefixPrecedence == 0) + ProgramFail(Parser, "operator not expected here"); + + LocalPrecedence = OperatorPrecedence[(int)Token].PrefixPrecedence; + Precedence = BracketPrecedence + LocalPrecedence; + + if (Token == TokenOpenBracket) + { + /* it's either a new bracket level or a cast */ + enum LexToken BracketToken = LexGetToken(Parser, &LexValue, FALSE); + if (IS_TYPE_TOKEN(BracketToken) && (StackTop == NULL || StackTop->Op != TokenSizeof) ) + { + /* it's a cast - get the new type */ + struct ValueType *CastType; + char *CastIdentifier; + struct Value *CastTypeValue; + + TypeParse(Parser, &CastType, &CastIdentifier, NULL); + if (LexGetToken(Parser, &LexValue, TRUE) != TokenCloseBracket) + ProgramFail(Parser, "brackets not closed"); + + /* scan and collapse the stack to the precedence of this infix cast operator, then push */ + Precedence = BracketPrecedence + OperatorPrecedence[(int)TokenCast].PrefixPrecedence; + + ExpressionStackCollapse(Parser, &StackTop, Precedence+1, &IgnorePrecedence); + CastTypeValue = VariableAllocValueFromType(Parser, &TypeType, FALSE, NULL, FALSE); + CastTypeValue->Val->Typ = CastType; + ExpressionStackPushValueNode(Parser, &StackTop, CastTypeValue); + ExpressionStackPushOperator(Parser, &StackTop, OrderInfix, TokenCast, Precedence); + } + else + { + /* boost the bracket operator precedence */ + BracketPrecedence += BRACKET_PRECEDENCE; + } + } + else + { + /* scan and collapse the stack to the precedence of this operator, then push */ + ExpressionStackCollapse(Parser, &StackTop, Precedence, &IgnorePrecedence); + ExpressionStackPushOperator(Parser, &StackTop, OrderPrefix, Token, Precedence); + } + } + else + { + /* expect an infix or postfix operator */ + if (OperatorPrecedence[(int)Token].PostfixPrecedence != 0) + { + switch (Token) + { + case TokenCloseBracket: + case TokenRightSquareBracket: + if (BracketPrecedence == 0) + { + /* assume this bracket is after the end of the expression */ + ParserCopy(Parser, &PreState); + Done = TRUE; + } + else + { + /* collapse to the bracket precedence */ + ExpressionStackCollapse(Parser, &StackTop, BracketPrecedence, &IgnorePrecedence); + BracketPrecedence -= BRACKET_PRECEDENCE; + } + break; + + default: + /* scan and collapse the stack to the precedence of this operator, then push */ + Precedence = BracketPrecedence + OperatorPrecedence[(int)Token].PostfixPrecedence; + ExpressionStackCollapse(Parser, &StackTop, Precedence, &IgnorePrecedence); + ExpressionStackPushOperator(Parser, &StackTop, OrderPostfix, Token, Precedence); + break; + } + } + else if (OperatorPrecedence[(int)Token].InfixPrecedence != 0) + { + /* scan and collapse the stack, then push */ + Precedence = BracketPrecedence + OperatorPrecedence[(int)Token].InfixPrecedence; + + /* for right to left order, only go down to the next higher precedence so we evaluate it in reverse order */ + /* for left to right order, collapse down to this precedence so we evaluate it in forward order */ + if (IS_LEFT_TO_RIGHT(OperatorPrecedence[(int)Token].InfixPrecedence)) + ExpressionStackCollapse(Parser, &StackTop, Precedence, &IgnorePrecedence); + else + ExpressionStackCollapse(Parser, &StackTop, Precedence+1, &IgnorePrecedence); + + if (Token == TokenDot || Token == TokenArrow) + { + ExpressionGetStructElement(Parser, &StackTop, Token); /* this operator is followed by a struct element so handle it as a special case */ + } + else + { + /* if it's a && or || operator we may not need to evaluate the right hand side of the expression */ + if ( (Token == TokenLogicalOr || Token == TokenLogicalAnd) && IS_NUMERIC_COERCIBLE(StackTop->Val)) + { + long LHSInt = ExpressionCoerceInteger(StackTop->Val); + if ( ( (Token == TokenLogicalOr && LHSInt) || (Token == TokenLogicalAnd && !LHSInt) ) && + (IgnorePrecedence > Precedence) ) + IgnorePrecedence = Precedence; + } + + /* push the operator on the stack */ + ExpressionStackPushOperator(Parser, &StackTop, OrderInfix, Token, Precedence); + PrefixState = TRUE; + + switch (Token) + { + case TokenQuestionMark: TernaryDepth++; break; + case TokenColon: TernaryDepth--; break; + default: break; + } + } + + /* treat an open square bracket as an infix array index operator followed by an open bracket */ + if (Token == TokenLeftSquareBracket) + { + /* boost the bracket operator precedence, then push */ + BracketPrecedence += BRACKET_PRECEDENCE; + } + } + else + ProgramFail(Parser, "operator not expected here"); + } + } + else if (Token == TokenIdentifier) + { + /* it's a variable, function or a macro */ + if (!PrefixState) + ProgramFail(Parser, "identifier not expected here"); + + if (LexGetToken(Parser, NULL, FALSE) == TokenOpenBracket) + { + ExpressionParseFunctionCall(Parser, &StackTop, LexValue->Val->Identifier, Parser->Mode == RunModeRun && Precedence < IgnorePrecedence); + } + else + { + if (Parser->Mode == RunModeRun && Precedence < IgnorePrecedence) + { + struct Value *VariableValue = NULL; + + VariableGet(Parser, LexValue->Val->Identifier, &VariableValue); + if (VariableValue->Typ->Base == TypeMacro) + { + /* evaluate a macro as a kind of simple subroutine */ + struct ParseState MacroParser; + struct Value *MacroResult; + + ParserCopy(&MacroParser, &VariableValue->Val->MacroDef.Body); + if (VariableValue->Val->MacroDef.NumParams != 0) + ProgramFail(&MacroParser, "macro arguments missing"); + + if (!ExpressionParse(&MacroParser, &MacroResult) || LexGetToken(&MacroParser, NULL, FALSE) != TokenEndOfFunction) + ProgramFail(&MacroParser, "expression expected"); + + ExpressionStackPushValueNode(Parser, &StackTop, MacroResult); + } + else if (VariableValue->Typ == &VoidType) + ProgramFail(Parser, "a void value isn't much use here"); + else + ExpressionStackPushLValue(Parser, &StackTop, VariableValue, 0); /* it's a value variable */ + } + else /* push a dummy value */ + ExpressionPushInt(Parser, &StackTop, 0); + + } + + /* if we've successfully ignored the RHS turn ignoring off */ + if (Precedence <= IgnorePrecedence) + IgnorePrecedence = DEEP_PRECEDENCE; + + PrefixState = FALSE; + } + else if ((int)Token > TokenCloseBracket && (int)Token <= TokenCharacterConstant) + { + /* it's a value of some sort, push it */ + if (!PrefixState) + ProgramFail(Parser, "value not expected here"); + + PrefixState = FALSE; + ExpressionStackPushValue(Parser, &StackTop, LexValue); + } + else if (IS_TYPE_TOKEN(Token)) + { + /* it's a type. push it on the stack like a value. this is used in sizeof() */ + struct ValueType *Typ; + char *Identifier; + struct Value *TypeValue; + + if (!PrefixState) + ProgramFail(Parser, "type not expected here"); + + PrefixState = FALSE; + ParserCopy(Parser, &PreState); + TypeParse(Parser, &Typ, &Identifier, NULL); + TypeValue = VariableAllocValueFromType(Parser, &TypeType, FALSE, NULL, FALSE); + TypeValue->Val->Typ = Typ; + ExpressionStackPushValueNode(Parser, &StackTop, TypeValue); + } + else + { + /* it isn't a token from an expression */ + ParserCopy(Parser, &PreState); + Done = TRUE; + } + + } while (!Done); + + /* check that brackets have been closed */ + if (BracketPrecedence > 0) + ProgramFail(Parser, "brackets not closed"); + + /* scan and collapse the stack to precedence 0 */ + ExpressionStackCollapse(Parser, &StackTop, 0, &IgnorePrecedence); + + /* fix up the stack and return the result if we're in run mode */ + if (StackTop != NULL) + { + /* all that should be left is a single value on the stack */ + if (Parser->Mode == RunModeRun) + { + if (StackTop->Order != OrderNone || StackTop->Next != NULL) + ProgramFail(Parser, "invalid expression"); + + *Result = StackTop->Val; + HeapPopStack(StackTop, sizeof(struct ExpressionStack)); + } + else + HeapPopStack(StackTop->Val, sizeof(struct ExpressionStack) + sizeof(struct Value) + TypeStackSizeValue(StackTop->Val)); + } + + debugf("ExpressionParse() done\n\n"); +#ifdef DEBUG_EXPRESSIONS + ExpressionStackShow(StackTop); +#endif + return StackTop != NULL; +} + + +/* do a parameterised macro call */ +void ExpressionParseMacroCall(struct ParseState *Parser, struct ExpressionStack **StackTop, const char *MacroName, struct MacroDef *MDef) +{ + struct Value *ReturnValue = NULL; + struct Value *Param; + struct Value **ParamArray = NULL; + int ArgCount; + enum LexToken Token; + + if (Parser->Mode == RunModeRun) + { + /* create a stack frame for this macro */ +#ifndef NO_FP + ExpressionStackPushValueByType(Parser, StackTop, &FPType); /* largest return type there is */ +#else + ExpressionStackPushValueByType(Parser, StackTop, &IntType); /* largest return type there is */ +#endif + ReturnValue = (*StackTop)->Val; + HeapPushStackFrame(); + ParamArray = HeapAllocStack(sizeof(struct Value *) * MDef->NumParams); + if (ParamArray == NULL) + ProgramFail(Parser, "out of memory"); + } + else + ExpressionPushInt(Parser, StackTop, 0); + + /* parse arguments */ + ArgCount = 0; + do { + if (ExpressionParse(Parser, &Param)) + { + if (Parser->Mode == RunModeRun) + { + if (ArgCount < MDef->NumParams) + ParamArray[ArgCount] = Param; + else + ProgramFail(Parser, "too many arguments to %s()", MacroName); + } + + ArgCount++; + Token = LexGetToken(Parser, NULL, TRUE); + if (Token != TokenComma && Token != TokenCloseBracket) + ProgramFail(Parser, "comma expected"); + } + else + { + /* end of argument list? */ + Token = LexGetToken(Parser, NULL, TRUE); + if (!TokenCloseBracket) + ProgramFail(Parser, "bad argument"); + } + + } while (Token != TokenCloseBracket); + + if (Parser->Mode == RunModeRun) + { + /* evaluate the macro */ + struct ParseState MacroParser; + int Count; + struct Value *EvalValue; + + if (ArgCount < MDef->NumParams) + ProgramFail(Parser, "not enough arguments to '%s'", MacroName); + + if (MDef->Body.Pos == NULL) + ProgramFail(Parser, "'%s' is undefined", MacroName); + + ParserCopy(&MacroParser, &MDef->Body); + VariableStackFrameAdd(Parser, MacroName, 0); + TopStackFrame->NumParams = ArgCount; + TopStackFrame->ReturnValue = ReturnValue; + for (Count = 0; Count < MDef->NumParams; Count++) + VariableDefine(Parser, MDef->ParamName[Count], ParamArray[Count], NULL, TRUE); + + ExpressionParse(&MacroParser, &EvalValue); + ExpressionAssign(Parser, ReturnValue, EvalValue, TRUE, MacroName, 0, FALSE); + VariableStackFramePop(Parser); + HeapPopStackFrame(); + } +} + +/* do a function call */ +void ExpressionParseFunctionCall(struct ParseState *Parser, struct ExpressionStack **StackTop, const char *FuncName, int RunIt) +{ + struct Value *ReturnValue = NULL; + struct Value *FuncValue; + struct Value *Param; + struct Value **ParamArray = NULL; + int ArgCount; + enum LexToken Token = LexGetToken(Parser, NULL, TRUE); /* open bracket */ + enum RunMode OldMode = Parser->Mode; + + if (RunIt) + { + /* get the function definition */ + VariableGet(Parser, FuncName, &FuncValue); + + if (FuncValue->Typ->Base == TypeMacro) + { + /* this is actually a macro, not a function */ + ExpressionParseMacroCall(Parser, StackTop, FuncName, &FuncValue->Val->MacroDef); + return; + } + + if (FuncValue->Typ->Base != TypeFunction) + ProgramFail(Parser, "%t is not a function - can't call", FuncValue->Typ); + + ExpressionStackPushValueByType(Parser, StackTop, FuncValue->Val->FuncDef.ReturnType); + ReturnValue = (*StackTop)->Val; + HeapPushStackFrame(); + ParamArray = HeapAllocStack(sizeof(struct Value *) * FuncValue->Val->FuncDef.NumParams); + if (ParamArray == NULL) + ProgramFail(Parser, "out of memory"); + } + else + { + ExpressionPushInt(Parser, StackTop, 0); + Parser->Mode = RunModeSkip; + } + + /* parse arguments */ + ArgCount = 0; + do { + if (RunIt && ArgCount < FuncValue->Val->FuncDef.NumParams) + ParamArray[ArgCount] = VariableAllocValueFromType(Parser, FuncValue->Val->FuncDef.ParamType[ArgCount], FALSE, NULL, FALSE); + + if (ExpressionParse(Parser, &Param)) + { + if (RunIt) + { + if (ArgCount < FuncValue->Val->FuncDef.NumParams) + { + ExpressionAssign(Parser, ParamArray[ArgCount], Param, TRUE, FuncName, ArgCount+1, FALSE); + VariableStackPop(Parser, Param); + } + else + { + if (!FuncValue->Val->FuncDef.VarArgs) + ProgramFail(Parser, "too many arguments to %s()", FuncName); + } + } + + ArgCount++; + Token = LexGetToken(Parser, NULL, TRUE); + if (Token != TokenComma && Token != TokenCloseBracket) + ProgramFail(Parser, "comma expected"); + } + else + { + /* end of argument list? */ + Token = LexGetToken(Parser, NULL, TRUE); + if (!TokenCloseBracket) + ProgramFail(Parser, "bad argument"); + } + + } while (Token != TokenCloseBracket); + + if (RunIt) + { + /* run the function */ + if (ArgCount < FuncValue->Val->FuncDef.NumParams) + ProgramFail(Parser, "not enough arguments to '%s'", FuncName); + + if (FuncValue->Val->FuncDef.Intrinsic == NULL) + { + /* run a user-defined function */ + struct ParseState FuncParser; + int Count; + + if (FuncValue->Val->FuncDef.Body.Pos == NULL) + ProgramFail(Parser, "'%s' is undefined", FuncName); + + ParserCopy(&FuncParser, &FuncValue->Val->FuncDef.Body); + VariableStackFrameAdd(Parser, FuncName, FuncValue->Val->FuncDef.Intrinsic ? FuncValue->Val->FuncDef.NumParams : 0); + TopStackFrame->NumParams = ArgCount; + TopStackFrame->ReturnValue = ReturnValue; + for (Count = 0; Count < FuncValue->Val->FuncDef.NumParams; Count++) + VariableDefine(Parser, FuncValue->Val->FuncDef.ParamName[Count], ParamArray[Count], NULL, TRUE); + + if (ParseStatement(&FuncParser, TRUE) != ParseResultOk) + ProgramFail(&FuncParser, "function body expected"); + + if (RunIt) + { + if (FuncParser.Mode == RunModeRun && FuncValue->Val->FuncDef.ReturnType != &VoidType) + ProgramFail(&FuncParser, "no value returned from a function returning %t", FuncValue->Val->FuncDef.ReturnType); + + else if (FuncParser.Mode == RunModeGoto) + ProgramFail(&FuncParser, "couldn't find goto label '%s'", FuncParser.SearchGotoLabel); + } + + VariableStackFramePop(Parser); + } + else + FuncValue->Val->FuncDef.Intrinsic(Parser, ReturnValue, ParamArray, ArgCount); + + HeapPopStackFrame(); + } + + Parser->Mode = OldMode; +} + +/* parse an expression */ +long ExpressionParseInt(struct ParseState *Parser) +{ + struct Value *Val; + long Result = 0; + + if (!ExpressionParse(Parser, &Val)) + ProgramFail(Parser, "expression expected"); + + if (Parser->Mode == RunModeRun) + { + if (!IS_NUMERIC_COERCIBLE(Val)) + ProgramFail(Parser, "integer value expected instead of %t", Val->Typ); + + Result = ExpressionCoerceInteger(Val); + VariableStackPop(Parser, Val); + } + + return Result; +} + diff --git a/src/cmd/picoc-1/heap.c b/src/cmd/picoc-1/heap.c new file mode 100644 index 0000000..ab44f84 --- /dev/null +++ b/src/cmd/picoc-1/heap.c @@ -0,0 +1,289 @@ +/* picoc heap memory allocation. This is a complete (but small) memory + * allocator for embedded systems which have no memory allocator. Alternatively + * you can define USE_MALLOC_HEAP to use your system's own malloc() allocator */ + +/* stack grows up from the bottom and heap grows down from the top of heap space */ +#include "interpreter.h" + +#define FREELIST_BUCKETS 8 /* freelists for 4, 8, 12 ... 32 byte allocs */ +#define SPLIT_MEM_THRESHOLD 16 /* don't split memory which is close in size */ + +#ifdef USE_MALLOC_STACK +static unsigned char *HeapMemory = NULL; /* stack memory since our heap is malloc()ed */ +static void *HeapBottom = NULL; /* the bottom of the (downward-growing) heap */ +static void *StackFrame = NULL; /* the current stack frame */ +void *HeapStackTop = NULL; /* the top of the stack */ +#else +# ifdef SURVEYOR_HOST +static unsigned char *HeapMemory = (unsigned char *)C_HEAPSTART; /* all memory - stack and heap */ +static void *HeapBottom = (void *)C_HEAPSTART + HEAP_SIZE; /* the bottom of the (downward-growing) heap */ +static void *StackFrame = (void *)C_HEAPSTART; /* the current stack frame */ +void *HeapStackTop = (void *)C_HEAPSTART; /* the top of the stack */ +void *HeapMemStart = (void *)C_HEAPSTART; +# else +static unsigned char HeapMemory[HEAP_SIZE]; /* all memory - stack and heap */ +static void *HeapBottom = &HeapMemory[HEAP_SIZE]; /* the bottom of the (downward-growing) heap */ +static void *StackFrame = &HeapMemory[0]; /* the current stack frame */ +void *HeapStackTop = &HeapMemory[0]; /* the top of the stack */ +# endif +#endif + +static struct AllocNode *FreeListBucket[FREELIST_BUCKETS]; /* we keep a pool of freelist buckets to reduce fragmentation */ +static struct AllocNode *FreeListBig; /* free memory which doesn't fit in a bucket */ + +#ifdef DEBUG_HEAP +void ShowBigList() +{ + struct AllocNode *LPos; + + printf("Heap: bottom=0x%lx 0x%lx-0x%lx, big freelist=", (long)HeapBottom, (long)&HeapMemory[0], (long)&HeapMemory[HEAP_SIZE]); + for (LPos = FreeListBig; LPos != NULL; LPos = LPos->NextFree) + printf("0x%lx:%d ", (long)LPos, LPos->Size); + + printf("\n"); +} +#endif + +/* initialise the stack and heap storage */ +void HeapInit(int StackOrHeapSize) +{ + int Count; + int AlignOffset = 0; + +#ifdef USE_MALLOC_STACK + HeapMemory = malloc(StackOrHeapSize); +#endif + + while (((unsigned long)&HeapMemory[AlignOffset] & (sizeof(ALIGN_TYPE)-1)) != 0) + AlignOffset++; + + StackFrame = &HeapMemory[AlignOffset]; + HeapStackTop = &HeapMemory[AlignOffset]; + *(void **)StackFrame = NULL; + HeapBottom = &HeapMemory[StackOrHeapSize-sizeof(ALIGN_TYPE)+AlignOffset]; + FreeListBig = NULL; + for (Count = 0; Count < FREELIST_BUCKETS; Count++) + FreeListBucket[Count] = NULL; +} + +void HeapCleanup() +{ +#ifdef USE_MALLOC_STACK + free(HeapMemory); +#endif +} + +/* allocate some space on the stack, in the current stack frame + * clears memory. can return NULL if out of stack space */ +void *HeapAllocStack(int Size) +{ + char *NewMem = HeapStackTop; + char *NewTop = (char *)HeapStackTop + MEM_ALIGN(Size); +#ifdef DEBUG_HEAP + printf("HeapAllocStack(%ld) at 0x%lx\n", (unsigned long)MEM_ALIGN(Size), (unsigned long)HeapStackTop); +#endif + if (NewTop > (char *)HeapBottom) + return NULL; + + HeapStackTop = (void *)NewTop; + memset((void *)NewMem, '\0', Size); + return NewMem; +} + +/* allocate some space on the stack, in the current stack frame */ +void HeapUnpopStack(int Size) +{ +#ifdef DEBUG_HEAP + printf("HeapUnpopStack(%ld) at 0x%lx\n", (unsigned long)MEM_ALIGN(Size), (unsigned long)HeapStackTop); +#endif + HeapStackTop = (void *)((char *)HeapStackTop + MEM_ALIGN(Size)); +} + +/* free some space at the top of the stack */ +int HeapPopStack(void *Addr, int Size) +{ + int ToLose = MEM_ALIGN(Size); + if (ToLose > ((char *)HeapStackTop - (char *)&HeapMemory[0])) + return FALSE; + +#ifdef DEBUG_HEAP + printf("HeapPopStack(0x%lx, %ld) back to 0x%lx\n", (unsigned long)Addr, (unsigned long)MEM_ALIGN(Size), (unsigned long)HeapStackTop - ToLose); +#endif + HeapStackTop = (void *)((char *)HeapStackTop - ToLose); + assert(Addr == NULL || HeapStackTop == Addr); + + return TRUE; +} + +/* push a new stack frame on to the stack */ +void HeapPushStackFrame() +{ +#ifdef DEBUG_HEAP + printf("Adding stack frame at 0x%lx\n", (unsigned long)HeapStackTop); +#endif + *(void **)HeapStackTop = StackFrame; + StackFrame = HeapStackTop; + HeapStackTop = (void *)((char *)HeapStackTop + MEM_ALIGN(sizeof(ALIGN_TYPE))); +} + +/* pop the current stack frame, freeing all memory in the frame. can return NULL */ +int HeapPopStackFrame() +{ + if (*(void **)StackFrame != NULL) + { + HeapStackTop = StackFrame; + StackFrame = *(void **)StackFrame; +#ifdef DEBUG_HEAP + printf("Popping stack frame back to 0x%lx\n", (unsigned long)HeapStackTop); +#endif + return TRUE; + } + else + return FALSE; +} + +/* allocate some dynamically allocated memory. memory is cleared. can return NULL if out of memory */ +void *HeapAllocMem(int Size) +{ +#ifdef USE_MALLOC_HEAP + return calloc(Size, 1); +#else + struct AllocNode *NewMem = NULL; + struct AllocNode **FreeNode; + int AllocSize = MEM_ALIGN(Size) + MEM_ALIGN(sizeof(NewMem->Size)); + int Bucket; + void *ReturnMem; + + if (Size == 0) + return NULL; + + assert(Size > 0); + + /* make sure we have enough space for an AllocNode */ + if (AllocSize < sizeof(struct AllocNode)) + AllocSize = sizeof(struct AllocNode); + + Bucket = AllocSize >> 2; + if (Bucket < FREELIST_BUCKETS && FreeListBucket[Bucket] != NULL) + { + /* try to allocate from a freelist bucket first */ +#ifdef DEBUG_HEAP + printf("allocating %d(%d) from bucket", Size, AllocSize); +#endif + NewMem = FreeListBucket[Bucket]; + assert((unsigned long)NewMem >= (unsigned long)&HeapMemory[0] && (unsigned char *)NewMem - &HeapMemory[0] < HEAP_SIZE); + FreeListBucket[Bucket] = *(struct AllocNode **)NewMem; + assert(FreeListBucket[Bucket] == NULL || ((unsigned long)FreeListBucket[Bucket] >= (unsigned long)&HeapMemory[0] && (unsigned char *)FreeListBucket[Bucket] - &HeapMemory[0] < HEAP_SIZE)); + NewMem->Size = AllocSize; + } + else if (FreeListBig != NULL) + { + /* grab the first item from the "big" freelist we can fit in */ + for (FreeNode = &FreeListBig; *FreeNode != NULL && (*FreeNode)->Size < AllocSize; FreeNode = &(*FreeNode)->NextFree) + {} + + if (*FreeNode != NULL) + { + assert((unsigned long)*FreeNode >= (unsigned long)&HeapMemory[0] && (unsigned char *)*FreeNode - &HeapMemory[0] < HEAP_SIZE); + assert((*FreeNode)->Size < HEAP_SIZE && (*FreeNode)->Size > 0); + if ((*FreeNode)->Size < AllocSize + SPLIT_MEM_THRESHOLD) + { + /* close in size - reduce fragmentation by not splitting */ +#ifdef DEBUG_HEAP + printf("allocating %d(%d) from freelist, no split (%d)", Size, AllocSize, (*FreeNode)->Size); +#endif + NewMem = *FreeNode; + assert((unsigned long)NewMem >= (unsigned long)&HeapMemory[0] && (unsigned char *)NewMem - &HeapMemory[0] < HEAP_SIZE); + *FreeNode = NewMem->NextFree; + } + else + { + /* split this big memory chunk */ +#ifdef DEBUG_HEAP + printf("allocating %d(%d) from freelist, split chunk (%d)", Size, AllocSize, (*FreeNode)->Size); +#endif + NewMem = (void *)((char *)*FreeNode + (*FreeNode)->Size - AllocSize); + assert((unsigned long)NewMem >= (unsigned long)&HeapMemory[0] && (unsigned char *)NewMem - &HeapMemory[0] < HEAP_SIZE); + (*FreeNode)->Size -= AllocSize; + NewMem->Size = AllocSize; + } + } + } + + if (NewMem == NULL) + { + /* couldn't allocate from a freelist - try to increase the size of the heap area */ +#ifdef DEBUG_HEAP + printf("allocating %d(%d) at bottom of heap (0x%lx-0x%lx)", Size, AllocSize, (long)((char *)HeapBottom - AllocSize), (long)HeapBottom); +#endif + if ((char *)HeapBottom - AllocSize < (char *)HeapStackTop) + return NULL; + + HeapBottom = (void *)((char *)HeapBottom - AllocSize); + NewMem = HeapBottom; + NewMem->Size = AllocSize; + } + + ReturnMem = (void *)((char *)NewMem + MEM_ALIGN(sizeof(NewMem->Size))); + memset(ReturnMem, '\0', AllocSize - MEM_ALIGN(sizeof(NewMem->Size))); +#ifdef DEBUG_HEAP + printf(" = %lx\n", (unsigned long)ReturnMem); +#endif + return ReturnMem; +#endif +} + +/* free some dynamically allocated memory */ +void HeapFreeMem(void *Mem) +{ +#ifdef USE_MALLOC_HEAP + free(Mem); +#else + struct AllocNode *MemNode = (struct AllocNode *)((char *)Mem - MEM_ALIGN(sizeof(MemNode->Size))); + int Bucket = MemNode->Size >> 2; + +#ifdef DEBUG_HEAP + printf("HeapFreeMem(0x%lx)\n", (unsigned long)Mem); +#endif + assert((unsigned long)Mem >= (unsigned long)&HeapMemory[0] && (unsigned char *)Mem - &HeapMemory[0] < HEAP_SIZE); + assert(MemNode->Size < HEAP_SIZE && MemNode->Size > 0); + if (Mem == NULL) + return; + + if ((void *)MemNode == HeapBottom) + { + /* pop it off the bottom of the heap, reducing the heap size */ +#ifdef DEBUG_HEAP + printf("freeing %d from bottom of heap\n", MemNode->Size); +#endif + HeapBottom = (void *)((char *)HeapBottom + MemNode->Size); +#ifdef DEBUG_HEAP + ShowBigList(); +#endif + } + else if (Bucket < FREELIST_BUCKETS) + { + /* we can fit it in a bucket */ +#ifdef DEBUG_HEAP + printf("freeing %d to bucket\n", MemNode->Size); +#endif + assert(FreeListBucket[Bucket] == NULL || ((unsigned long)FreeListBucket[Bucket] >= (unsigned long)&HeapMemory[0] && (unsigned char *)FreeListBucket[Bucket] - &HeapMemory[0] < HEAP_SIZE)); + *(struct AllocNode **)MemNode = FreeListBucket[Bucket]; + FreeListBucket[Bucket] = (struct AllocNode *)MemNode; + } + else + { + /* put it in the big memory freelist */ +#ifdef DEBUG_HEAP + printf("freeing %lx:%d to freelist\n", (unsigned long)Mem, MemNode->Size); +#endif + assert(FreeListBig == NULL || ((unsigned long)FreeListBig >= (unsigned long)&HeapMemory[0] && (unsigned char *)FreeListBig - &HeapMemory[0] < HEAP_SIZE)); + MemNode->NextFree = FreeListBig; + FreeListBig = MemNode; +#ifdef DEBUG_HEAP + ShowBigList(); +#endif + } +#endif +} + diff --git a/src/cmd/picoc-1/include.c b/src/cmd/picoc-1/include.c new file mode 100644 index 0000000..a0f9be3 --- /dev/null +++ b/src/cmd/picoc-1/include.c @@ -0,0 +1,115 @@ +/* picoc include system - can emulate system includes from built-in libraries + * or it can include and parse files if the system has files */ + +#include "picoc.h" +#include "interpreter.h" + +#ifndef NO_HASH_INCLUDE + +/* a list of libraries we can include */ +struct IncludeLibrary +{ + char *IncludeName; + void (*SetupFunction)(void); + struct LibraryFunction *FuncList; + const char *SetupCSource; + struct IncludeLibrary *NextLib; +}; + +struct IncludeLibrary *IncludeLibList = NULL; + + +/* initialise the built-in include libraries */ +void IncludeInit() +{ +#ifndef BUILTIN_MINI_STDLIB + IncludeRegister("ctype.h", NULL, &StdCtypeFunctions[0], NULL); + IncludeRegister("errno.h", &StdErrnoSetupFunc, NULL, NULL); +# ifndef NO_FP + IncludeRegister("math.h", &MathSetupFunc, &MathFunctions[0], NULL); +# endif + IncludeRegister("stdbool.h", &StdboolSetupFunc, NULL, StdboolDefs); + IncludeRegister("stdio.h", &StdioSetupFunc, &StdioFunctions[0], StdioDefs); + IncludeRegister("stdlib.h", &StdlibSetupFunc, &StdlibFunctions[0], NULL); + IncludeRegister("string.h", &StringSetupFunc, &StringFunctions[0], NULL); + IncludeRegister("time.h", &StdTimeSetupFunc, &StdTimeFunctions[0], StdTimeDefs); +# ifndef WIN32 + IncludeRegister("unistd.h", &UnistdSetupFunc, &UnistdFunctions[0], UnistdDefs); +# endif +#endif +} + +/* clean up space used by the include system */ +void IncludeCleanup() +{ + struct IncludeLibrary *ThisInclude = IncludeLibList; + struct IncludeLibrary *NextInclude; + + while (ThisInclude != NULL) + { + NextInclude = ThisInclude->NextLib; + HeapFreeMem(ThisInclude); + ThisInclude = NextInclude; + } + + IncludeLibList = NULL; +} + +/* register a new build-in include file */ +void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struct LibraryFunction *FuncList, const char *SetupCSource) +{ + struct IncludeLibrary *NewLib = HeapAllocMem(sizeof(struct IncludeLibrary)); + NewLib->IncludeName = TableStrRegister(IncludeName); + NewLib->SetupFunction = SetupFunction; + NewLib->FuncList = FuncList; + NewLib->SetupCSource = SetupCSource; + NewLib->NextLib = IncludeLibList; + IncludeLibList = NewLib; +} + +/* include all of the system headers */ +void PicocIncludeAllSystemHeaders() +{ + struct IncludeLibrary *ThisInclude = IncludeLibList; + + for (; ThisInclude != NULL; ThisInclude = ThisInclude->NextLib) + IncludeFile(ThisInclude->IncludeName); +} + +/* include one of a number of predefined libraries, or perhaps an actual file */ +void IncludeFile(char *FileName) +{ + struct IncludeLibrary *LInclude; + + /* scan for the include file name to see if it's in our list of predefined includes */ + for (LInclude = IncludeLibList; LInclude != NULL; LInclude = LInclude->NextLib) + { + if (strcmp(LInclude->IncludeName, FileName) == 0) + { + /* found it - protect against multiple inclusion */ + if (!VariableDefined(FileName)) + { + VariableDefine(NULL, FileName, NULL, &VoidType, FALSE); + + /* run an extra startup function if there is one */ + if (LInclude->SetupFunction != NULL) + (*LInclude->SetupFunction)(); + + /* parse the setup C source code - may define types etc. */ + if (LInclude->SetupCSource != NULL) + PicocParse(FileName, LInclude->SetupCSource, strlen(LInclude->SetupCSource), TRUE, TRUE, FALSE, FALSE); + + /* set up the library functions */ + if (LInclude->FuncList != NULL) + LibraryAdd(&GlobalTable, FileName, LInclude->FuncList); + } + + return; + } + } + + /* not a predefined file, read a real file */ + PicocPlatformScanFile(FileName); +} + +#endif /* NO_HASH_INCLUDE */ diff --git a/src/cmd/picoc-1/interpreter.h b/src/cmd/picoc-1/interpreter.h new file mode 100644 index 0000000..8643340 --- /dev/null +++ b/src/cmd/picoc-1/interpreter.h @@ -0,0 +1,523 @@ +/* picoc main header file - this has all the main data structures and + * function prototypes. If you're just calling picoc you should look at the + * external interface instead, in picoc.h */ + +#ifndef INTERPRETER_H +#define INTERPRETER_H + +#include "platform.h" + + +/* handy definitions */ +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef min +#define min(x,y) (((x)<(y))?(x):(y)) +#endif + +#define MEM_ALIGN(x) (((x) + sizeof(ALIGN_TYPE) - 1) & ~(sizeof(ALIGN_TYPE)-1)) + +#define GETS_BUF_MAX 256 + +/* small processors use a simplified FILE * for stdio, otherwise use the system FILE * */ +#ifdef BUILTIN_MINI_STDLIB +typedef struct OutputStream IOFILE; +#else +typedef FILE IOFILE; +#endif + +/* coercion of numeric types to other numeric types */ +#ifndef NO_FP +#define IS_FP(v) ((v)->Typ->Base == TypeFP) +#define FP_VAL(v) ((v)->Val->FP) +#else +#define IS_FP(v) 0 +#define FP_VAL(v) 0 +#endif + +#define IS_POINTER_COERCIBLE(v, ap) ((ap) ? ((v)->Typ->Base == TypePointer) : 0) +#define POINTER_COERCE(v) ((int)(v)->Val->Pointer) + +#define IS_INTEGER_NUMERIC_TYPE(t) ((t)->Base >= TypeInt && (t)->Base <= TypeUnsignedLong) +#define IS_INTEGER_NUMERIC(v) IS_INTEGER_NUMERIC_TYPE((v)->Typ) +#define IS_NUMERIC_COERCIBLE(v) (IS_INTEGER_NUMERIC(v) || IS_FP(v)) +#define IS_NUMERIC_COERCIBLE_PLUS_POINTERS(v,ap) (IS_NUMERIC_COERCIBLE(v) || IS_POINTER_COERCIBLE(v,ap)) + + +struct Table; + +/* lexical tokens */ +enum LexToken +{ + /* 0x00 */ TokenNone, + /* 0x01 */ TokenComma, + /* 0x02 */ TokenAssign, TokenAddAssign, TokenSubtractAssign, TokenMultiplyAssign, TokenDivideAssign, TokenModulusAssign, + /* 0x08 */ TokenShiftLeftAssign, TokenShiftRightAssign, TokenArithmeticAndAssign, TokenArithmeticOrAssign, TokenArithmeticExorAssign, + /* 0x0d */ TokenQuestionMark, TokenColon, + /* 0x0f */ TokenLogicalOr, + /* 0x10 */ TokenLogicalAnd, + /* 0x11 */ TokenArithmeticOr, + /* 0x12 */ TokenArithmeticExor, + /* 0x13 */ TokenAmpersand, + /* 0x14 */ TokenEqual, TokenNotEqual, + /* 0x16 */ TokenLessThan, TokenGreaterThan, TokenLessEqual, TokenGreaterEqual, + /* 0x1a */ TokenShiftLeft, TokenShiftRight, + /* 0x1c */ TokenPlus, TokenMinus, + /* 0x1e */ TokenAsterisk, TokenSlash, TokenModulus, + /* 0x21 */ TokenIncrement, TokenDecrement, TokenUnaryNot, TokenUnaryExor, TokenSizeof, TokenCast, + /* 0x27 */ TokenLeftSquareBracket, TokenRightSquareBracket, TokenDot, TokenArrow, + /* 0x2b */ TokenOpenBracket, TokenCloseBracket, + /* 0x2d */ TokenIdentifier, TokenIntegerConstant, TokenFPConstant, TokenStringConstant, TokenCharacterConstant, + /* 0x32 */ TokenSemicolon, TokenEllipsis, + /* 0x34 */ TokenLeftBrace, TokenRightBrace, + /* 0x36 */ TokenIntType, TokenCharType, TokenFloatType, TokenDoubleType, TokenVoidType, TokenEnumType, + /* 0x3c */ TokenLongType, TokenSignedType, TokenShortType, TokenStaticType, TokenAutoType, TokenRegisterType, TokenExternType, TokenStructType, TokenUnionType, TokenUnsignedType, TokenTypedef, + /* 0x46 */ TokenContinue, TokenDo, TokenElse, TokenFor, TokenGoto, TokenIf, TokenWhile, TokenBreak, TokenSwitch, TokenCase, TokenDefault, TokenReturn, + /* 0x52 */ TokenHashDefine, TokenHashInclude, TokenHashIf, TokenHashIfdef, TokenHashIfndef, TokenHashElse, TokenHashEndif, + /* 0x59 */ TokenNew, TokenDelete, + /* 0x5b */ TokenOpenMacroBracket, + /* 0x5c */ TokenEOF, TokenEndOfLine, TokenEndOfFunction +}; + +/* used in dynamic memory allocation */ +struct AllocNode +{ + unsigned int Size; + struct AllocNode *NextFree; +}; + +/* whether we're running or skipping code */ +enum RunMode +{ + RunModeRun, /* we're running code as we parse it */ + RunModeSkip, /* skipping code, not running */ + RunModeReturn, /* returning from a function */ + RunModeCaseSearch, /* searching for a case label */ + RunModeBreak, /* breaking out of a switch/while/do */ + RunModeContinue, /* as above but repeat the loop */ + RunModeGoto /* searching for a goto label */ +}; + +/* parser state - has all this detail so we can parse nested files */ +struct ParseState +{ + const unsigned char *Pos; /* the character position in the source text */ + char *FileName; /* what file we're executing (registered string) */ + short int Line; /* line number we're executing */ + short int CharacterPos; /* character/column in the line we're executing */ + enum RunMode Mode; /* whether to skip or run code */ + int SearchLabel; /* what case label we're searching for */ + const char *SearchGotoLabel;/* what goto label we're searching for */ + const char *SourceText; /* the entire source text */ + short int HashIfLevel; /* how many "if"s we're nested down */ + short int HashIfEvaluateToLevel; /* if we're not evaluating an if branch, what the last evaluated level was */ + char DebugMode; /* debugging mode */ +}; + +/* values */ +enum BaseType +{ + TypeVoid, /* no type */ + TypeInt, /* integer */ + TypeShort, /* short integer */ + TypeChar, /* a single character (unsigned) */ + TypeLong, /* long integer */ + TypeUnsignedInt, /* unsigned integer */ + TypeUnsignedShort, /* unsigned short integer */ + TypeUnsignedLong, /* unsigned long integer */ +#ifndef NO_FP + TypeFP, /* floating point */ +#endif + TypeFunction, /* a function */ + TypeMacro, /* a macro */ + TypePointer, /* a pointer */ + TypeArray, /* an array of a sub-type */ + TypeStruct, /* aggregate type */ + TypeUnion, /* merged type */ + TypeEnum, /* enumerated integer type */ + TypeGotoLabel, /* a label we can "goto" */ + Type_Type /* a type for storing types */ +}; + +/* data type */ +struct ValueType +{ + enum BaseType Base; /* what kind of type this is */ + int ArraySize; /* the size of an array type */ + int Sizeof; /* the storage required */ + int AlignBytes; /* the alignment boundary of this type */ + const char *Identifier; /* the name of a struct or union */ + struct ValueType *FromType; /* the type we're derived from (or NULL) */ + struct ValueType *DerivedTypeList; /* first in a list of types derived from this one */ + struct ValueType *Next; /* next item in the derived type list */ + struct Table *Members; /* members of a struct or union */ + int OnHeap; /* true if allocated on the heap */ + int StaticQualifier; /* true if it's a static */ +}; + +/* function definition */ +struct FuncDef +{ + struct ValueType *ReturnType; /* the return value type */ + int NumParams; /* the number of parameters */ + int VarArgs; /* has a variable number of arguments after the explicitly specified ones */ + struct ValueType **ParamType; /* array of parameter types */ + char **ParamName; /* array of parameter names */ + void (*Intrinsic)(); /* intrinsic call address or NULL */ + struct ParseState Body; /* lexical tokens of the function body if not intrinsic */ +}; + +/* macro definition */ +struct MacroDef +{ + int NumParams; /* the number of parameters */ + char **ParamName; /* array of parameter names */ + struct ParseState Body; /* lexical tokens of the function body if not intrinsic */ +}; + +/* values */ +union AnyValue +{ + unsigned char Character; + short ShortInteger; + int Integer; + long LongInteger; + unsigned short UnsignedShortInteger; + unsigned int UnsignedInteger; + unsigned long UnsignedLongInteger; + char *Identifier; + char ArrayMem[2]; /* placeholder for where the data starts, doesn't point to it */ + struct ValueType *Typ; + struct FuncDef FuncDef; + struct MacroDef MacroDef; +#ifndef NO_FP + double FP; +#endif + void *Pointer; /* unsafe native pointers */ +}; + +struct Value +{ + struct ValueType *Typ; /* the type of this value */ + union AnyValue *Val; /* pointer to the AnyValue which holds the actual content */ + struct Value *LValueFrom; /* if an LValue, this is a Value our LValue is contained within (or NULL) */ + char ValOnHeap; /* this Value is on the heap */ + char ValOnStack; /* the AnyValue is on the stack along with this Value */ + char AnyValOnHeap; /* the AnyValue is separately allocated from the Value on the heap */ + char IsLValue; /* is modifiable and is allocated somewhere we can usefully modify it */ +}; + +/* hash table data structure */ +struct TableEntry +{ + struct TableEntry *Next; /* next item in this hash chain */ + const char *DeclFileName; /* where the variable was declared */ + unsigned short DeclLine; + unsigned short DeclColumn; + + union TableEntryPayload + { + struct ValueEntry + { + char *Key; /* points to the shared string table */ + struct Value *Val; /* the value we're storing */ + } v; /* used for tables of values */ + + char Key[1]; /* dummy size - used for the shared string table */ + + struct BreakpointEntry /* defines a breakpoint */ + { + const char *FileName; + short int Line; + short int CharacterPos; + } b; + + } p; +}; + +struct Table +{ + short Size; + short OnHeap; + struct TableEntry **HashTable; +}; + +/* stack frame for function calls */ +struct StackFrame +{ + struct ParseState ReturnParser; /* how we got here */ + const char *FuncName; /* the name of the function we're in */ + struct Value *ReturnValue; /* copy the return value here */ + struct Value **Parameter; /* array of parameter values */ + int NumParams; /* the number of parameters */ + struct Table LocalTable; /* the local variables and parameters */ + struct TableEntry *LocalHashTable[LOCAL_TABLE_SIZE]; + struct StackFrame *PreviousStackFrame; /* the next lower stack frame */ +}; + +/* lexer state */ +enum LexMode +{ + LexModeNormal, + LexModeHashInclude, + LexModeHashDefine, + LexModeHashDefineSpace, + LexModeHashDefineSpaceIdent +}; + +struct LexState +{ + const char *Pos; + const char *End; + const char *FileName; + int Line; + int CharacterPos; + const char *SourceText; + enum LexMode Mode; + int EmitExtraNewlines; +}; + +/* library function definition */ +struct LibraryFunction +{ + void (*Func)(struct ParseState *Parser, struct Value *, struct Value **, int); + const char *Prototype; +}; + +/* output stream-type specific state information */ +union OutputStreamInfo +{ + struct StringOutputStream + { + struct ParseState *Parser; + char *WritePos; + } Str; +}; + +/* stream-specific method for writing characters to the console */ +typedef void CharWriter(unsigned char, union OutputStreamInfo *); + +/* used when writing output to a string - eg. sprintf() */ +struct OutputStream +{ + CharWriter *Putch; + union OutputStreamInfo i; +}; + +/* possible results of parsing a statement */ +enum ParseResult { ParseResultEOF, ParseResultError, ParseResultOk }; + +/* globals */ +extern void *HeapStackTop; +extern struct Table GlobalTable; +extern struct StackFrame *TopStackFrame; +extern struct ValueType UberType; +extern struct ValueType IntType; +extern struct ValueType CharType; +#ifndef NO_FP +extern struct ValueType FPType; +#endif +extern struct ValueType VoidType; +extern struct ValueType TypeType; +extern struct ValueType FunctionType; +extern struct ValueType MacroType; +extern struct ValueType GotoLabelType; +extern struct ValueType *CharPtrType; +extern struct ValueType *CharPtrPtrType; +extern struct ValueType *CharArrayType; +extern struct ValueType *VoidPtrType; +extern char *StrEmpty; +extern struct PointerValue NULLPointer; +extern struct LibraryFunction CLibrary[]; +extern struct LibraryFunction PlatformLibrary[]; +extern IOFILE *CStdOut; + +/* table.c */ +void TableInit(); +char *TableStrRegister(const char *Str); +char *TableStrRegister2(const char *Str, int Len); +void TableInitTable(struct Table *Tbl, struct TableEntry **HashTable, int Size, int OnHeap); +int TableSet(struct Table *Tbl, char *Key, struct Value *Val, const char *DeclFileName, int DeclLine, int DeclColumn); +int TableGet(struct Table *Tbl, const char *Key, struct Value **Val, const char **DeclFileName, int *DeclLine, int *DeclColumn); +struct Value *TableDelete(struct Table *Tbl, const char *Key); +char *TableSetIdentifier(struct Table *Tbl, const char *Ident, int IdentLen); +void TableStrFree(); + +/* lex.c */ +void LexInit(); +void LexCleanup(); +void *LexAnalyse(const char *FileName, const char *Source, int SourceLen, int *TokenLen); +void LexInitParser(struct ParseState *Parser, const char *SourceText, void *TokenSource, char *FileName, int RunIt, int SetDebugMode); +enum LexToken LexGetToken(struct ParseState *Parser, struct Value **Value, int IncPos); +enum LexToken LexRawPeekToken(struct ParseState *Parser); +void LexToEndOfLine(struct ParseState *Parser); +void *LexCopyTokens(struct ParseState *StartParser, struct ParseState *EndParser); +void LexInteractiveClear(struct ParseState *Parser); +void LexInteractiveCompleted(struct ParseState *Parser); +void LexInteractiveStatementPrompt(); + +/* parse.c */ +/* the following are defined in picoc.h: + * void PicocParse(const char *FileName, const char *Source, int SourceLen, int RunIt, int CleanupNow, int CleanupSource); + * void PicocParseInteractive(); */ +void PicocParseInteractiveNoStartPrompt(int EnableDebugger); +enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemicolon); +struct Value *ParseFunctionDefinition(struct ParseState *Parser, struct ValueType *ReturnType, char *Identifier); +void ParseCleanup(); +void ParserCopyPos(struct ParseState *To, struct ParseState *From); +void ParserCopy(struct ParseState *To, struct ParseState *From); + +/* expression.c */ +int ExpressionParse(struct ParseState *Parser, struct Value **Result); +long ExpressionParseInt(struct ParseState *Parser); +void ExpressionAssign(struct ParseState *Parser, struct Value *DestValue, struct Value *SourceValue, int Force, const char *FuncName, int ParamNo, int AllowPointerCoercion); +long ExpressionCoerceInteger(struct Value *Val); +unsigned long ExpressionCoerceUnsignedInteger(struct Value *Val); +#ifndef NO_FP +double ExpressionCoerceFP(struct Value *Val); +#endif + +/* type.c */ +void TypeInit(); +void TypeCleanup(); +int TypeSize(struct ValueType *Typ, int ArraySize, int Compact); +int TypeSizeValue(struct Value *Val, int Compact); +int TypeStackSizeValue(struct Value *Val); +int TypeLastAccessibleOffset(struct Value *Val); +int TypeParseFront(struct ParseState *Parser, struct ValueType **Typ, int *IsStatic); +void TypeParseIdentPart(struct ParseState *Parser, struct ValueType *BasicTyp, struct ValueType **Typ, char **Identifier); +void TypeParse(struct ParseState *Parser, struct ValueType **Typ, char **Identifier, int *IsStatic); +struct ValueType *TypeGetMatching(struct ParseState *Parser, struct ValueType *ParentType, enum BaseType Base, int ArraySize, const char *Identifier, int AllowDuplicates); +struct ValueType *TypeCreateOpaqueStruct(struct ParseState *Parser, const char *StructName, int Size); + +/* heap.c */ +void HeapInit(int StackSize); +void HeapCleanup(); +void *HeapAllocStack(int Size); +int HeapPopStack(void *Addr, int Size); +void HeapUnpopStack(int Size); +void HeapPushStackFrame(); +int HeapPopStackFrame(); +void *HeapAllocMem(int Size); +void HeapFreeMem(void *Mem); + +/* variable.c */ +void VariableInit(); +void VariableCleanup(); +void VariableFree(struct Value *Val); +void VariableTableCleanup(struct Table *HashTable); +void *VariableAlloc(struct ParseState *Parser, int Size, int OnHeap); +void VariableStackPop(struct ParseState *Parser, struct Value *Var); +struct Value *VariableAllocValueAndData(struct ParseState *Parser, int DataSize, int IsLValue, struct Value *LValueFrom, int OnHeap); +struct Value *VariableAllocValueAndCopy(struct ParseState *Parser, struct Value *FromValue, int OnHeap); +struct Value *VariableAllocValueFromType(struct ParseState *Parser, struct ValueType *Typ, int IsLValue, struct Value *LValueFrom, int OnHeap); +struct Value *VariableAllocValueFromExistingData(struct ParseState *Parser, struct ValueType *Typ, union AnyValue *FromValue, int IsLValue, struct Value *LValueFrom); +struct Value *VariableAllocValueShared(struct ParseState *Parser, struct Value *FromValue); +struct Value *VariableDefine(struct ParseState *Parser, char *Ident, struct Value *InitValue, struct ValueType *Typ, int MakeWritable); +struct Value *VariableDefineButIgnoreIdentical(struct ParseState *Parser, char *Ident, struct ValueType *Typ, int IsStatic, int *FirstVisit); +int VariableDefined(const char *Ident); +void VariableRealloc(struct ParseState *Parser, struct Value *FromValue, int NewSize); +void VariableGet(struct ParseState *Parser, const char *Ident, struct Value **LVal); +void VariableDefinePlatformVar(struct ParseState *Parser, char *Ident, struct ValueType *Typ, union AnyValue *FromValue, int IsWritable); +void VariableStackFrameAdd(struct ParseState *Parser, const char *FuncName, int NumParams); +void VariableStackFramePop(struct ParseState *Parser); +struct Value *VariableStringLiteralGet(char *Ident); +void VariableStringLiteralDefine(char *Ident, struct Value *Val); +void *VariableDereferencePointer(struct ParseState *Parser, struct Value *PointerValue, struct Value **DerefVal, int *DerefOffset, struct ValueType **DerefType, int *DerefIsLValue); + +/* clibrary.c */ +void BasicIOInit(); +void LibraryInit(); +void LibraryAdd(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList); +void CLibraryInit(); +void PrintCh(char OutCh, IOFILE *Stream); +void PrintSimpleInt(long Num, IOFILE *Stream); +void PrintInt(long Num, int FieldWidth, int ZeroPad, int LeftJustify, IOFILE *Stream); +void PrintStr(const char *Str, IOFILE *Stream); +void PrintFP(double Num, IOFILE *Stream); +void PrintType(struct ValueType *Typ, IOFILE *Stream); +void LibPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs); + +/* platform.c */ +/* the following are defined in picoc.h: + * void PicocCallMain(int argc, char **argv); + * int PicocPlatformSetExitPoint(); + * void PicocInitialise(int StackSize); + * void PicocCleanup(); + * void PicocPlatformScanFile(const char *FileName); + * extern int PicocExitValue; */ +void ProgramFail(struct ParseState *Parser, const char *Message, ...); +void AssignFail(struct ParseState *Parser, const char *Format, struct ValueType *Type1, struct ValueType *Type2, int Num1, int Num2, const char *FuncName, int ParamNo); +void LexFail(struct LexState *Lexer, const char *Message, ...); +void PlatformInit(); +void PlatformCleanup(); +char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt); +int PlatformGetCharacter(); +void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *); +void PlatformErrorPrefix(struct ParseState *Parser); +void PlatformPrintf(const char *Format, ...); +void PlatformVPrintf(const char *Format, va_list Args); +void PlatformExit(int ExitVal); +char *PlatformMakeTempName(char *TempNameBuffer); +void PlatformLibraryInit(); + +/* include.c */ +void IncludeInit(); +void IncludeCleanup(); +void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struct LibraryFunction *FuncList, const char *SetupCSource); +void IncludeFile(char *Filename); +/* the following is defined in picoc.h: + * void PicocIncludeAllSystemHeaders(); */ + +/* debug.c */ +extern int DebugManualBreak; +void DebugInit(); +void DebugCleanup(); +void DebugCheckStatement(struct ParseState *Parser); + + +/* stdio.c */ +extern const char StdioDefs[]; +extern struct LibraryFunction StdioFunctions[]; +void StdioSetupFunc(void); + +/* math.c */ +extern struct LibraryFunction MathFunctions[]; +void MathSetupFunc(void); + +/* string.c */ +extern struct LibraryFunction StringFunctions[]; +void StringSetupFunc(void); + +/* stdlib.c */ +extern struct LibraryFunction StdlibFunctions[]; +void StdlibSetupFunc(void); + +/* time.c */ +extern const char StdTimeDefs[]; +extern struct LibraryFunction StdTimeFunctions[]; +void StdTimeSetupFunc(void); + +/* errno.c */ +void StdErrnoSetupFunc(void); + +/* ctype.c */ +extern struct LibraryFunction StdCtypeFunctions[]; + +/* stdbool.c */ +extern const char StdboolDefs[]; +void StdboolSetupFunc(void); + +/* unistd.c */ +extern const char UnistdDefs[]; +extern struct LibraryFunction UnistdFunctions[]; +void UnistdSetupFunc(void); + +#endif /* INTERPRETER_H */ diff --git a/src/cmd/picoc-1/lex.c b/src/cmd/picoc-1/lex.c new file mode 100644 index 0000000..93683ba --- /dev/null +++ b/src/cmd/picoc-1/lex.c @@ -0,0 +1,978 @@ +/* picoc lexer - converts source text into a tokenised form */ + +#include "interpreter.h" + +#ifdef NO_CTYPE +#define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) +#define isdigit(c) ((c) >= '0' && (c) <= '9') +#define isalnum(c) (isalpha(c) || isdigit(c)) +#define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n') +#endif +#define isCidstart(c) (isalpha(c) || (c)=='_' || (c)=='#') +#define isCident(c) (isalnum(c) || (c)=='_') + +#define IS_HEX_ALPHA_DIGIT(c) (((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) +#define IS_BASE_DIGIT(c,b) (((c) >= '0' && (c) < '0' + (((b)<10)?(b):10)) || (((b) > 10) ? IS_HEX_ALPHA_DIGIT(c) : FALSE)) +#define GET_BASE_DIGIT(c) (((c) <= '9') ? ((c) - '0') : (((c) <= 'F') ? ((c) - 'A' + 10) : ((c) - 'a' + 10))) + +#define NEXTIS(c,x,y) { if (NextChar == (c)) { LEXER_INC(Lexer); GotToken = (x); } else GotToken = (y); } +#define NEXTIS3(c,x,d,y,z) { if (NextChar == (c)) { LEXER_INC(Lexer); GotToken = (x); } else NEXTIS(d,y,z) } +#define NEXTIS4(c,x,d,y,e,z,a) { if (NextChar == (c)) { LEXER_INC(Lexer); GotToken = (x); } else NEXTIS3(d,y,e,z,a) } +#define NEXTIS3PLUS(c,x,d,y,e,z,a) { if (NextChar == (c)) { LEXER_INC(Lexer); GotToken = (x); } else if (NextChar == (d)) { if (Lexer->Pos[1] == (e)) { LEXER_INCN(Lexer, 2); GotToken = (z); } else { LEXER_INC(Lexer); GotToken = (y); } } else GotToken = (a); } +#define NEXTISEXACTLY3(c,d,y,z) { if (NextChar == (c) && Lexer->Pos[1] == (d)) { LEXER_INCN(Lexer, 2); GotToken = (y); } else GotToken = (z); } + +#define LEXER_INC(l) ( (l)->Pos++, (l)->CharacterPos++ ) +#define LEXER_INCN(l, n) ( (l)->Pos+=(n), (l)->CharacterPos+=(n) ) +#define TOKEN_DATA_OFFSET 2 + +#define MAX_CHAR_VALUE 255 /* maximum value which can be represented by a "char" data type */ + +static union AnyValue LexAnyValue; +static struct Value LexValue = { &VoidType, &LexAnyValue, NULL, FALSE, FALSE, FALSE }; + +struct ReservedWord +{ + const char *Word; + enum LexToken Token; + const char *SharedWord; /* word stored in shared string space */ +}; + +static struct ReservedWord ReservedWords[] = +{ + { "#define", TokenHashDefine, NULL }, + { "#else", TokenHashElse, NULL }, + { "#endif", TokenHashEndif, NULL }, + { "#if", TokenHashIf, NULL }, + { "#ifdef", TokenHashIfdef, NULL }, + { "#ifndef", TokenHashIfndef, NULL }, + { "#include", TokenHashInclude, NULL }, + { "auto", TokenAutoType, NULL }, + { "break", TokenBreak, NULL }, + { "case", TokenCase, NULL }, + { "char", TokenCharType, NULL }, + { "continue", TokenContinue, NULL }, + { "default", TokenDefault, NULL }, + { "delete", TokenDelete, NULL }, + { "do", TokenDo, NULL }, +#ifndef NO_FP + { "double", TokenDoubleType, NULL }, +#endif + { "else", TokenElse, NULL }, + { "enum", TokenEnumType, NULL }, + { "extern", TokenExternType, NULL }, +#ifndef NO_FP + { "float", TokenFloatType, NULL }, +#endif + { "for", TokenFor, NULL }, + { "goto", TokenGoto, NULL }, + { "if", TokenIf, NULL }, + { "int", TokenIntType, NULL }, + { "long", TokenLongType, NULL }, + { "new", TokenNew, NULL }, + { "register", TokenRegisterType, NULL }, + { "return", TokenReturn, NULL }, + { "short", TokenShortType, NULL }, + { "signed", TokenSignedType, NULL }, + { "sizeof", TokenSizeof, NULL }, + { "static", TokenStaticType, NULL }, + { "struct", TokenStructType, NULL }, + { "switch", TokenSwitch, NULL }, + { "typedef", TokenTypedef, NULL }, + { "union", TokenUnionType, NULL }, + { "unsigned", TokenUnsignedType, NULL }, + { "void", TokenVoidType, NULL }, + { "while", TokenWhile, NULL } +}; + +/* linked list of tokens used in interactive mode */ +struct TokenLine +{ + struct TokenLine *Next; + unsigned char *Tokens; + int NumBytes; +}; + +static struct TokenLine *InteractiveHead = NULL; +static struct TokenLine *InteractiveTail = NULL; +static struct TokenLine *InteractiveCurrentLine = NULL; +static int LexUseStatementPrompt = FALSE; + + +/* initialise the lexer */ +void LexInit() +{ + int Count; + + for (Count = 0; Count < sizeof(ReservedWords) / sizeof(struct ReservedWord); Count++) + ReservedWords[Count].SharedWord = TableStrRegister(ReservedWords[Count].Word); +} + +/* deallocate */ +void LexCleanup() +{ + LexInteractiveClear(NULL); +} + +/* check if a word is a reserved word - used while scanning */ +enum LexToken LexCheckReservedWord(const char *Word) +{ + int Count; + + for (Count = 0; Count < sizeof(ReservedWords) / sizeof(struct ReservedWord); Count++) + { + if (Word == ReservedWords[Count].SharedWord) + return ReservedWords[Count].Token; + } + + return TokenNone; +} + +/* get a numeric literal - used while scanning */ +enum LexToken LexGetNumber(struct LexState *Lexer, struct Value *Value) +{ + int Result = 0; + int Base = 10; + enum LexToken ResultToken; +#ifndef NO_FP + double FPResult; + double FPDiv; +#endif + + if (*Lexer->Pos == '0') + { + /* a binary, octal or hex literal */ + LEXER_INC(Lexer); + if (Lexer->Pos != Lexer->End) + { + if (*Lexer->Pos == 'x' || *Lexer->Pos == 'X') + { Base = 16; LEXER_INC(Lexer); } + else if (*Lexer->Pos == 'b' || *Lexer->Pos == 'B') + { Base = 2; LEXER_INC(Lexer); } + else if (*Lexer->Pos != '.') + Base = 8; + } + } + + /* get the value */ + for (; Lexer->Pos != Lexer->End && IS_BASE_DIGIT(*Lexer->Pos, Base); LEXER_INC(Lexer)) + Result = Result * Base + GET_BASE_DIGIT(*Lexer->Pos); + + if (Result >= 0 && Result <= MAX_CHAR_VALUE) + { + Value->Typ = &CharType; + Value->Val->Character = Result; + ResultToken = TokenCharacterConstant; + } + else + { + Value->Typ = &IntType; + Value->Val->Integer = Result; + ResultToken = TokenIntegerConstant; + } + + if (Lexer->Pos == Lexer->End) + return ResultToken; + + if (*Lexer->Pos == 'l' || *Lexer->Pos == 'L') + { + LEXER_INC(Lexer); + return ResultToken; + } + +#ifndef NO_FP + if (Lexer->Pos == Lexer->End || *Lexer->Pos != '.') + return ResultToken; + + Value->Typ = &FPType; + LEXER_INC(Lexer); + for (FPDiv = 1.0/Base, FPResult = (double)Result; Lexer->Pos != Lexer->End && IS_BASE_DIGIT(*Lexer->Pos, Base); LEXER_INC(Lexer), FPDiv /= (double)Base) + FPResult += GET_BASE_DIGIT(*Lexer->Pos) * FPDiv; + + if (Lexer->Pos != Lexer->End && (*Lexer->Pos == 'e' || *Lexer->Pos == 'E')) + { + double ExponentMultiplier = 1.0; + + LEXER_INC(Lexer); + if (Lexer->Pos != Lexer->End && *Lexer->Pos == '-') + { + ExponentMultiplier = -1.0; + LEXER_INC(Lexer); + } + + Result = 0; + while (Lexer->Pos != Lexer->End && IS_BASE_DIGIT(*Lexer->Pos, Base)) + { + Result = Result * Base + GET_BASE_DIGIT(*Lexer->Pos); + LEXER_INC(Lexer); + } + + FPResult *= pow((double)Base, (double)Result * ExponentMultiplier); + } + + Value->Val->FP = FPResult; + + return TokenFPConstant; +#else + return ResultToken; +#endif +} + +/* get a reserved word or identifier - used while scanning */ +enum LexToken LexGetWord(struct LexState *Lexer, struct Value *Value) +{ + const char *StartPos = Lexer->Pos; + enum LexToken Token; + + do { + LEXER_INC(Lexer); + } while (Lexer->Pos != Lexer->End && isCident((int)*Lexer->Pos)); + + Value->Typ = NULL; + Value->Val->Identifier = TableStrRegister2(StartPos, Lexer->Pos - StartPos); + + Token = LexCheckReservedWord(Value->Val->Identifier); + switch (Token) + { + case TokenHashInclude: Lexer->Mode = LexModeHashInclude; break; + case TokenHashDefine: Lexer->Mode = LexModeHashDefine; break; + default: break; + } + + if (Token != TokenNone) + return Token; + + if (Lexer->Mode == LexModeHashDefineSpace) + Lexer->Mode = LexModeHashDefineSpaceIdent; + + return TokenIdentifier; +} + +/* unescape a character from an octal character constant */ +unsigned char LexUnEscapeCharacterConstant(const char **From, const char *End, unsigned char FirstChar, int Base) +{ + unsigned char Total = GET_BASE_DIGIT(FirstChar); + int CCount; + for (CCount = 0; IS_BASE_DIGIT(**From, Base) && CCount < 2; CCount++, (*From)++) + Total = Total * Base + GET_BASE_DIGIT(**From); + + return Total; +} + +/* unescape a character from a string or character constant */ +unsigned char LexUnEscapeCharacter(const char **From, const char *End) +{ + unsigned char ThisChar; + + while ( *From != End && **From == '\\' && + &(*From)[1] != End && (*From)[1] == '\n' ) + (*From) += 2; /* skip escaped end of lines with LF line termination */ + + while ( *From != End && **From == '\\' && + &(*From)[1] != End && &(*From)[2] != End && (*From)[1] == '\r' && (*From)[2] == '\n') + (*From) += 3; /* skip escaped end of lines with CR/LF line termination */ + + if (*From == End) + return '\\'; + + if (**From == '\\') + { + /* it's escaped */ + (*From)++; + if (*From == End) + return '\\'; + + ThisChar = *(*From)++; + switch (ThisChar) + { + case '\\': return '\\'; + case '\'': return '\''; + case '"': return '"'; + case 'a': return '\a'; + case 'b': return '\b'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + case '0': case '1': case '2': case '3': return LexUnEscapeCharacterConstant(From, End, ThisChar, 8); + case 'x': return LexUnEscapeCharacterConstant(From, End, '0', 16); + default: return ThisChar; + } + } + else + return *(*From)++; +} + +/* get a string constant - used while scanning */ +enum LexToken LexGetStringConstant(struct LexState *Lexer, struct Value *Value, char EndChar) +{ + int Escape = FALSE; + const char *StartPos = Lexer->Pos; + const char *EndPos; + char *EscBuf; + char *EscBufPos; + char *RegString; + struct Value *ArrayValue; + + while (Lexer->Pos != Lexer->End && (*Lexer->Pos != EndChar || Escape)) + { + /* find the end */ + if (Escape) + { + if (*Lexer->Pos == '\r' && Lexer->Pos+1 != Lexer->End) + Lexer->Pos++; + + if (*Lexer->Pos == '\n' && Lexer->Pos+1 != Lexer->End) + { + Lexer->Line++; + Lexer->Pos++; + Lexer->CharacterPos = 0; + Lexer->EmitExtraNewlines++; + } + + Escape = FALSE; + } + else if (*Lexer->Pos == '\\') + Escape = TRUE; + + LEXER_INC(Lexer); + } + EndPos = Lexer->Pos; + + EscBuf = HeapAllocStack(EndPos - StartPos); + if (EscBuf == NULL) + LexFail(Lexer, "out of memory"); + + for (EscBufPos = EscBuf, Lexer->Pos = StartPos; Lexer->Pos != EndPos;) + *EscBufPos++ = LexUnEscapeCharacter(&Lexer->Pos, EndPos); + + /* try to find an existing copy of this string literal */ + RegString = TableStrRegister2(EscBuf, EscBufPos - EscBuf); + HeapPopStack(EscBuf, EndPos - StartPos); + ArrayValue = VariableStringLiteralGet(RegString); + if (ArrayValue == NULL) + { + /* create and store this string literal */ + ArrayValue = VariableAllocValueAndData(NULL, 0, FALSE, NULL, TRUE); + ArrayValue->Typ = CharArrayType; + ArrayValue->Val = (union AnyValue *)RegString; + VariableStringLiteralDefine(RegString, ArrayValue); + } + + /* create the the pointer for this char* */ + Value->Typ = CharPtrType; + Value->Val->Pointer = RegString; + if (*Lexer->Pos == EndChar) + LEXER_INC(Lexer); + + return TokenStringConstant; +} + +/* get a character constant - used while scanning */ +enum LexToken LexGetCharacterConstant(struct LexState *Lexer, struct Value *Value) +{ + Value->Typ = &CharType; + Value->Val->Character = LexUnEscapeCharacter(&Lexer->Pos, Lexer->End); + if (Lexer->Pos != Lexer->End && *Lexer->Pos != '\'') + LexFail(Lexer, "expected \"'\""); + + LEXER_INC(Lexer); + return TokenCharacterConstant; +} + +/* skip a comment - used while scanning */ +void LexSkipComment(struct LexState *Lexer, char NextChar, enum LexToken *ReturnToken) +{ + if (NextChar == '*') + { + /* conventional C comment */ + while (Lexer->Pos != Lexer->End && (*(Lexer->Pos-1) != '*' || *Lexer->Pos != '/')) + { + if (*Lexer->Pos == '\n') + Lexer->EmitExtraNewlines++; + + LEXER_INC(Lexer); + } + + if (Lexer->Pos != Lexer->End) + LEXER_INC(Lexer); + + Lexer->Mode = LexModeNormal; + } + else + { + /* C++ style comment */ + while (Lexer->Pos != Lexer->End && *Lexer->Pos != '\n') + LEXER_INC(Lexer); + } +} + +/* get a single token from the source - used while scanning */ +enum LexToken LexScanGetToken(struct LexState *Lexer, struct Value **Value) +{ + char ThisChar; + char NextChar; + enum LexToken GotToken = TokenNone; + + /* handle cases line multi-line comments or string constants which mess up the line count */ + if (Lexer->EmitExtraNewlines > 0) + { + Lexer->EmitExtraNewlines--; + return TokenEndOfLine; + } + + /* scan for a token */ + do + { + *Value = &LexValue; + while (Lexer->Pos != Lexer->End && isspace((int)*Lexer->Pos)) + { + if (*Lexer->Pos == '\n') + { + Lexer->Line++; + Lexer->Pos++; + Lexer->Mode = LexModeNormal; + Lexer->CharacterPos = 0; + return TokenEndOfLine; + } + else if (Lexer->Mode == LexModeHashDefine || Lexer->Mode == LexModeHashDefineSpace) + Lexer->Mode = LexModeHashDefineSpace; + + else if (Lexer->Mode == LexModeHashDefineSpaceIdent) + Lexer->Mode = LexModeNormal; + + LEXER_INC(Lexer); + } + + if (Lexer->Pos == Lexer->End || *Lexer->Pos == '\0') + return TokenEOF; + + ThisChar = *Lexer->Pos; + if (isCidstart((int)ThisChar)) + return LexGetWord(Lexer, *Value); + + if (isdigit((int)ThisChar)) + return LexGetNumber(Lexer, *Value); + + NextChar = (Lexer->Pos+1 != Lexer->End) ? *(Lexer->Pos+1) : 0; + LEXER_INC(Lexer); + switch (ThisChar) + { + case '"': GotToken = LexGetStringConstant(Lexer, *Value, '"'); break; + case '\'': GotToken = LexGetCharacterConstant(Lexer, *Value); break; + case '(': if (Lexer->Mode == LexModeHashDefineSpaceIdent) GotToken = TokenOpenMacroBracket; else GotToken = TokenOpenBracket; Lexer->Mode = LexModeNormal; break; + case ')': GotToken = TokenCloseBracket; break; + case '=': NEXTIS('=', TokenEqual, TokenAssign); break; + case '+': NEXTIS3('=', TokenAddAssign, '+', TokenIncrement, TokenPlus); break; + case '-': NEXTIS4('=', TokenSubtractAssign, '>', TokenArrow, '-', TokenDecrement, TokenMinus); break; + case '*': NEXTIS('=', TokenMultiplyAssign, TokenAsterisk); break; + case '/': if (NextChar == '/' || NextChar == '*') { LEXER_INC(Lexer); LexSkipComment(Lexer, NextChar, &GotToken); } else NEXTIS('=', TokenDivideAssign, TokenSlash); break; + case '%': NEXTIS('=', TokenModulusAssign, TokenModulus); break; + case '<': if (Lexer->Mode == LexModeHashInclude) GotToken = LexGetStringConstant(Lexer, *Value, '>'); else { NEXTIS3PLUS('=', TokenLessEqual, '<', TokenShiftLeft, '=', TokenShiftLeftAssign, TokenLessThan); } break; + case '>': NEXTIS3PLUS('=', TokenGreaterEqual, '>', TokenShiftRight, '=', TokenShiftRightAssign, TokenGreaterThan); break; + case ';': GotToken = TokenSemicolon; break; + case '&': NEXTIS3('=', TokenArithmeticAndAssign, '&', TokenLogicalAnd, TokenAmpersand); break; + case '|': NEXTIS3('=', TokenArithmeticOrAssign, '|', TokenLogicalOr, TokenArithmeticOr); break; + case '{': GotToken = TokenLeftBrace; break; + case '}': GotToken = TokenRightBrace; break; + case '[': GotToken = TokenLeftSquareBracket; break; + case ']': GotToken = TokenRightSquareBracket; break; + case '!': NEXTIS('=', TokenNotEqual, TokenUnaryNot); break; + case '^': NEXTIS('=', TokenArithmeticExorAssign, TokenArithmeticExor); break; + case '~': GotToken = TokenUnaryExor; break; + case ',': GotToken = TokenComma; break; + case '.': NEXTISEXACTLY3('.', '.', TokenEllipsis, TokenDot); break; + case '?': GotToken = TokenQuestionMark; break; + case ':': GotToken = TokenColon; break; + default: LexFail(Lexer, "illegal character '%c'", ThisChar); break; + } + } while (GotToken == TokenNone); + + return GotToken; +} + +/* what size value goes with each token */ +int LexTokenSize(enum LexToken Token) +{ + switch (Token) + { + case TokenIdentifier: case TokenStringConstant: return sizeof(char *); + case TokenIntegerConstant: return sizeof(int); + case TokenCharacterConstant: return sizeof(unsigned char); + case TokenFPConstant: return sizeof(double); + default: return 0; + } +} + +/* produce tokens from the lexer and return a heap buffer with the result - used for scanning */ +void *LexTokenise(struct LexState *Lexer, int *TokenLen) +{ + enum LexToken Token; + void *HeapMem; + struct Value *GotValue; + int MemUsed = 0; + int ValueSize; + int ReserveSpace = (Lexer->End - Lexer->Pos) * 4 + 16; + void *TokenSpace = HeapAllocStack(ReserveSpace); + char *TokenPos = (char *)TokenSpace; + int LastCharacterPos = 0; + + if (TokenSpace == NULL) + LexFail(Lexer, "out of memory"); + + do + { + /* store the token at the end of the stack area */ + Token = LexScanGetToken(Lexer, &GotValue); + +#ifdef DEBUG_LEXER + printf("Token: %02x\n", Token); +#endif + *(unsigned char *)TokenPos = Token; + TokenPos++; + MemUsed++; + + *(unsigned char *)TokenPos = (unsigned char)LastCharacterPos; + TokenPos++; + MemUsed++; + + ValueSize = LexTokenSize(Token); + if (ValueSize > 0) + { + /* store a value as well */ + memcpy((void *)TokenPos, (void *)GotValue->Val, ValueSize); + TokenPos += ValueSize; + MemUsed += ValueSize; + } + + LastCharacterPos = Lexer->CharacterPos; + + } while (Token != TokenEOF); + + HeapMem = HeapAllocMem(MemUsed); + if (HeapMem == NULL) + LexFail(Lexer, "out of memory"); + + assert(ReserveSpace >= MemUsed); + memcpy(HeapMem, TokenSpace, MemUsed); + HeapPopStack(TokenSpace, ReserveSpace); +#ifdef DEBUG_LEXER + { + int Count; + printf("Tokens: "); + for (Count = 0; Count < MemUsed; Count++) + printf("%02x ", *((unsigned char *)HeapMem+Count)); + printf("\n"); + } +#endif + if (TokenLen) + *TokenLen = MemUsed; + + return HeapMem; +} + +/* lexically analyse some source text */ +void *LexAnalyse(const char *FileName, const char *Source, int SourceLen, int *TokenLen) +{ + struct LexState Lexer; + + Lexer.Pos = Source; + Lexer.End = Source + SourceLen; + Lexer.Line = 1; + Lexer.FileName = FileName; + Lexer.Mode = LexModeNormal; + Lexer.EmitExtraNewlines = 0; + Lexer.CharacterPos = 1; + Lexer.SourceText = Source; + + return LexTokenise(&Lexer, TokenLen); +} + +/* prepare to parse a pre-tokenised buffer */ +void LexInitParser(struct ParseState *Parser, const char *SourceText, void *TokenSource, char *FileName, int RunIt, int EnableDebugger) +{ + Parser->Pos = TokenSource; + Parser->Line = 1; + Parser->FileName = FileName; + Parser->Mode = RunIt ? RunModeRun : RunModeSkip; + Parser->SearchLabel = 0; + Parser->HashIfLevel = 0; + Parser->HashIfEvaluateToLevel = 0; + Parser->CharacterPos = 0; + Parser->SourceText = SourceText; + Parser->DebugMode = EnableDebugger; +} + +/* get the next token, without pre-processing */ +enum LexToken LexGetRawToken(struct ParseState *Parser, struct Value **Value, int IncPos) +{ + enum LexToken Token = TokenNone; + int ValueSize; + char *Prompt = NULL; + + do + { + /* get the next token */ + if (Parser->Pos == NULL && InteractiveHead != NULL) + Parser->Pos = InteractiveHead->Tokens; + + if (Parser->FileName != StrEmpty || InteractiveHead != NULL) + { + /* skip leading newlines */ + while ((Token = (enum LexToken)*(unsigned char *)Parser->Pos) == TokenEndOfLine) + { + Parser->Line++; + Parser->Pos += TOKEN_DATA_OFFSET; + } + } + + if (Parser->FileName == StrEmpty && (InteractiveHead == NULL || Token == TokenEOF)) + { + /* we're at the end of an interactive input token list */ + char LineBuffer[LINEBUFFER_MAX]; + void *LineTokens; + int LineBytes; + struct TokenLine *LineNode; + + if (InteractiveHead == NULL || (unsigned char *)Parser->Pos == &InteractiveTail->Tokens[InteractiveTail->NumBytes-TOKEN_DATA_OFFSET]) + { + /* get interactive input */ + if (LexUseStatementPrompt) + { + Prompt = INTERACTIVE_PROMPT_STATEMENT; + LexUseStatementPrompt = FALSE; + } + else + Prompt = INTERACTIVE_PROMPT_LINE; + + if (PlatformGetLine(&LineBuffer[0], LINEBUFFER_MAX, Prompt) == NULL) + return TokenEOF; + + /* put the new line at the end of the linked list of interactive lines */ + LineTokens = LexAnalyse(StrEmpty, &LineBuffer[0], strlen(LineBuffer), &LineBytes); + LineNode = VariableAlloc(Parser, sizeof(struct TokenLine), TRUE); + LineNode->Tokens = LineTokens; + LineNode->NumBytes = LineBytes; + if (InteractiveHead == NULL) + { + /* start a new list */ + InteractiveHead = LineNode; + Parser->Line = 1; + Parser->CharacterPos = 0; + } + else + InteractiveTail->Next = LineNode; + + InteractiveTail = LineNode; + InteractiveCurrentLine = LineNode; + Parser->Pos = LineTokens; + } + else + { + /* go to the next token line */ + if (Parser->Pos != &InteractiveCurrentLine->Tokens[InteractiveCurrentLine->NumBytes-TOKEN_DATA_OFFSET]) + { + /* scan for the line */ + for (InteractiveCurrentLine = InteractiveHead; Parser->Pos != &InteractiveCurrentLine->Tokens[InteractiveCurrentLine->NumBytes-TOKEN_DATA_OFFSET]; InteractiveCurrentLine = InteractiveCurrentLine->Next) + { assert(InteractiveCurrentLine->Next != NULL); } + } + + assert(InteractiveCurrentLine != NULL); + InteractiveCurrentLine = InteractiveCurrentLine->Next; + assert(InteractiveCurrentLine != NULL); + Parser->Pos = InteractiveCurrentLine->Tokens; + } + + Token = (enum LexToken)*(unsigned char *)Parser->Pos; + } + } while ((Parser->FileName == StrEmpty && Token == TokenEOF) || Token == TokenEndOfLine); + + Parser->CharacterPos = *((unsigned char *)Parser->Pos + 1); + ValueSize = LexTokenSize(Token); + if (ValueSize > 0) + { + /* this token requires a value - unpack it */ + if (Value != NULL) + { + switch (Token) + { + case TokenStringConstant: LexValue.Typ = CharPtrType; break; + case TokenIdentifier: LexValue.Typ = NULL; break; + case TokenIntegerConstant: LexValue.Typ = &IntType; break; + case TokenCharacterConstant: LexValue.Typ = &CharType; break; +#ifndef NO_FP + case TokenFPConstant: LexValue.Typ = &FPType; break; +#endif + default: break; + } + + memcpy((void *)LexValue.Val, (void *)((char *)Parser->Pos + TOKEN_DATA_OFFSET), ValueSize); + LexValue.ValOnHeap = FALSE; + LexValue.ValOnStack = FALSE; + LexValue.IsLValue = FALSE; + LexValue.LValueFrom = NULL; + *Value = &LexValue; + } + + if (IncPos) + Parser->Pos += ValueSize + TOKEN_DATA_OFFSET; + } + else + { + if (IncPos && Token != TokenEOF) + Parser->Pos += TOKEN_DATA_OFFSET; + } + +#ifdef DEBUG_LEXER + printf("Got token=%02x inc=%d pos=%d\n", Token, IncPos, Parser->CharacterPos); +#endif + assert(Token >= TokenNone && Token <= TokenEndOfFunction); + return Token; +} + +/* correct the token position depending if we already incremented the position */ +void LexHashIncPos(struct ParseState *Parser, int IncPos) +{ + if (!IncPos) + LexGetRawToken(Parser, NULL, TRUE); +} + +/* handle a #ifdef directive */ +void LexHashIfdef(struct ParseState *Parser, int IfNot) +{ + /* get symbol to check */ + struct Value *IdentValue; + struct Value *SavedValue; + int IsDefined; + enum LexToken Token = LexGetRawToken(Parser, &IdentValue, TRUE); + + if (Token != TokenIdentifier) + ProgramFail(Parser, "identifier expected"); + + /* is the identifier defined? */ + IsDefined = TableGet(&GlobalTable, IdentValue->Val->Identifier, &SavedValue, NULL, NULL, NULL); + if (Parser->HashIfEvaluateToLevel == Parser->HashIfLevel && ( (IsDefined && !IfNot) || (!IsDefined && IfNot)) ) + { + /* #if is active, evaluate to this new level */ + Parser->HashIfEvaluateToLevel++; + } + + Parser->HashIfLevel++; +} + +/* handle a #if directive */ +void LexHashIf(struct ParseState *Parser) +{ + /* get symbol to check */ + struct Value *IdentValue; + struct Value *SavedValue; + struct ParseState MacroParser; + enum LexToken Token = LexGetRawToken(Parser, &IdentValue, TRUE); + + if (Token == TokenIdentifier) + { + /* look up a value from a macro definition */ + if (!TableGet(&GlobalTable, IdentValue->Val->Identifier, &SavedValue, NULL, NULL, NULL)) + ProgramFail(Parser, "'%s' is undefined", IdentValue->Val->Identifier); + + if (SavedValue->Typ->Base != TypeMacro) + ProgramFail(Parser, "value expected"); + + ParserCopy(&MacroParser, &SavedValue->Val->MacroDef.Body); + Token = LexGetRawToken(&MacroParser, &IdentValue, TRUE); + } + + if (Token != TokenCharacterConstant) + ProgramFail(Parser, "value expected"); + + /* is the identifier defined? */ + if (Parser->HashIfEvaluateToLevel == Parser->HashIfLevel && IdentValue->Val->Character) + { + /* #if is active, evaluate to this new level */ + Parser->HashIfEvaluateToLevel++; + } + + Parser->HashIfLevel++; +} + +/* handle a #else directive */ +void LexHashElse(struct ParseState *Parser) +{ + if (Parser->HashIfEvaluateToLevel == Parser->HashIfLevel - 1) + Parser->HashIfEvaluateToLevel++; /* #if was not active, make this next section active */ + + else if (Parser->HashIfEvaluateToLevel == Parser->HashIfLevel) + { + /* #if was active, now go inactive */ + if (Parser->HashIfLevel == 0) + ProgramFail(Parser, "#else without #if"); + + Parser->HashIfEvaluateToLevel--; + } +} + +/* handle a #endif directive */ +void LexHashEndif(struct ParseState *Parser) +{ + if (Parser->HashIfLevel == 0) + ProgramFail(Parser, "#endif without #if"); + + Parser->HashIfLevel--; + if (Parser->HashIfEvaluateToLevel > Parser->HashIfLevel) + Parser->HashIfEvaluateToLevel = Parser->HashIfLevel; +} + +/* get the next token given a parser state, pre-processing as we go */ +enum LexToken LexGetToken(struct ParseState *Parser, struct Value **Value, int IncPos) +{ + enum LexToken Token; + int TryNextToken; + + /* implements the pre-processor #if commands */ + do + { + int WasPreProcToken = TRUE; + + Token = LexGetRawToken(Parser, Value, IncPos); + switch (Token) + { + case TokenHashIfdef: LexHashIncPos(Parser, IncPos); LexHashIfdef(Parser, FALSE); break; + case TokenHashIfndef: LexHashIncPos(Parser, IncPos); LexHashIfdef(Parser, TRUE); break; + case TokenHashIf: LexHashIncPos(Parser, IncPos); LexHashIf(Parser); break; + case TokenHashElse: LexHashIncPos(Parser, IncPos); LexHashElse(Parser); break; + case TokenHashEndif: LexHashIncPos(Parser, IncPos); LexHashEndif(Parser); break; + default: WasPreProcToken = FALSE; break; + } + + /* if we're going to reject this token, increment the token pointer to the next one */ + TryNextToken = (Parser->HashIfEvaluateToLevel < Parser->HashIfLevel && Token != TokenEOF) || WasPreProcToken; + if (!IncPos && TryNextToken) + LexGetRawToken(Parser, NULL, TRUE); + + } while (TryNextToken); + + return Token; +} + +/* take a quick peek at the next token, skipping any pre-processing */ +enum LexToken LexRawPeekToken(struct ParseState *Parser) +{ + return (enum LexToken)*(unsigned char *)Parser->Pos; +} + +/* find the end of the line */ +void LexToEndOfLine(struct ParseState *Parser) +{ + while (TRUE) + { + enum LexToken Token = (enum LexToken)*(unsigned char *)Parser->Pos; + if (Token == TokenEndOfLine || Token == TokenEOF) + return; + else + LexGetRawToken(Parser, NULL, TRUE); + } +} + +/* copy the tokens from StartParser to EndParser into new memory, removing TokenEOFs and terminate with a TokenEndOfFunction */ +void *LexCopyTokens(struct ParseState *StartParser, struct ParseState *EndParser) +{ + int MemSize = 0; + int CopySize; + unsigned char *Pos = (unsigned char *)StartParser->Pos; + unsigned char *NewTokens; + unsigned char *NewTokenPos; + struct TokenLine *ILine; + + if (InteractiveHead == NULL) + { + /* non-interactive mode - copy the tokens */ + MemSize = EndParser->Pos - StartParser->Pos; + NewTokens = VariableAlloc(StartParser, MemSize + TOKEN_DATA_OFFSET, TRUE); + memcpy(NewTokens, (void *)StartParser->Pos, MemSize); + } + else + { + /* we're in interactive mode - add up line by line */ + for (InteractiveCurrentLine = InteractiveHead; InteractiveCurrentLine != NULL && (Pos < &InteractiveCurrentLine->Tokens[0] || Pos >= &InteractiveCurrentLine->Tokens[InteractiveCurrentLine->NumBytes]); InteractiveCurrentLine = InteractiveCurrentLine->Next) + {} /* find the line we just counted */ + + if (EndParser->Pos >= StartParser->Pos && EndParser->Pos < &InteractiveCurrentLine->Tokens[InteractiveCurrentLine->NumBytes]) + { + /* all on a single line */ + MemSize = EndParser->Pos - StartParser->Pos; + NewTokens = VariableAlloc(StartParser, MemSize + TOKEN_DATA_OFFSET, TRUE); + memcpy(NewTokens, (void *)StartParser->Pos, MemSize); + } + else + { + /* it's spread across multiple lines */ + MemSize = &InteractiveCurrentLine->Tokens[InteractiveCurrentLine->NumBytes-TOKEN_DATA_OFFSET] - Pos; + + for (ILine = InteractiveCurrentLine->Next; ILine != NULL && (EndParser->Pos < &ILine->Tokens[0] || EndParser->Pos >= &ILine->Tokens[ILine->NumBytes]); ILine = ILine->Next) + MemSize += ILine->NumBytes - TOKEN_DATA_OFFSET; + + assert(ILine != NULL); + MemSize += EndParser->Pos - &ILine->Tokens[0]; + NewTokens = VariableAlloc(StartParser, MemSize + TOKEN_DATA_OFFSET, TRUE); + + CopySize = &InteractiveCurrentLine->Tokens[InteractiveCurrentLine->NumBytes-TOKEN_DATA_OFFSET] - Pos; + memcpy(NewTokens, Pos, CopySize); + NewTokenPos = NewTokens + CopySize; + for (ILine = InteractiveCurrentLine->Next; ILine != NULL && (EndParser->Pos < &ILine->Tokens[0] || EndParser->Pos >= &ILine->Tokens[ILine->NumBytes]); ILine = ILine->Next) + { + memcpy(NewTokenPos, &ILine->Tokens[0], ILine->NumBytes - TOKEN_DATA_OFFSET); + NewTokenPos += ILine->NumBytes-TOKEN_DATA_OFFSET; + } + assert(ILine != NULL); + memcpy(NewTokenPos, &ILine->Tokens[0], EndParser->Pos - &ILine->Tokens[0]); + } + } + + NewTokens[MemSize] = (unsigned char)TokenEndOfFunction; + + return NewTokens; +} + +/* indicate that we've completed up to this point in the interactive input and free expired tokens */ +void LexInteractiveClear(struct ParseState *Parser) +{ + while (InteractiveHead != NULL) + { + struct TokenLine *NextLine = InteractiveHead->Next; + + HeapFreeMem(InteractiveHead->Tokens); + HeapFreeMem(InteractiveHead); + InteractiveHead = NextLine; + } + + if (Parser != NULL) + Parser->Pos = NULL; + InteractiveTail = NULL; +} + +/* indicate that we've completed up to this point in the interactive input and free expired tokens */ +void LexInteractiveCompleted(struct ParseState *Parser) +{ + while (InteractiveHead != NULL && !(Parser->Pos >= &InteractiveHead->Tokens[0] && Parser->Pos < &InteractiveHead->Tokens[InteractiveHead->NumBytes])) + { + /* this token line is no longer needed - free it */ + struct TokenLine *NextLine = InteractiveHead->Next; + + HeapFreeMem(InteractiveHead->Tokens); + HeapFreeMem(InteractiveHead); + InteractiveHead = NextLine; + + if (InteractiveHead == NULL) + { + /* we've emptied the list */ + Parser->Pos = NULL; + InteractiveTail = NULL; + } + } +} + +/* the next time we prompt, make it the full statement prompt */ +void LexInteractiveStatementPrompt() +{ + LexUseStatementPrompt = TRUE; +} diff --git a/src/cmd/picoc-1/msvc/picoc/picoc.sln b/src/cmd/picoc-1/msvc/picoc/picoc.sln new file mode 100644 index 0000000..e2be657 --- /dev/null +++ b/src/cmd/picoc-1/msvc/picoc/picoc.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 11 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "picoc", "picoc.vcxproj", "{C0156FB3-55AB-4F82-8A97-A776DFC57951}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C0156FB3-55AB-4F82-8A97-A776DFC57951}.Debug|Win32.ActiveCfg = Debug|Win32 + {C0156FB3-55AB-4F82-8A97-A776DFC57951}.Debug|Win32.Build.0 = Debug|Win32 + {C0156FB3-55AB-4F82-8A97-A776DFC57951}.Release|Win32.ActiveCfg = Release|Win32 + {C0156FB3-55AB-4F82-8A97-A776DFC57951}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/cmd/picoc-1/msvc/picoc/picoc.vcxproj b/src/cmd/picoc-1/msvc/picoc/picoc.vcxproj new file mode 100644 index 0000000..63f24a0 --- /dev/null +++ b/src/cmd/picoc-1/msvc/picoc/picoc.vcxproj @@ -0,0 +1,111 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + $(VCTargetsPath11) + + + {C0156FB3-55AB-4F82-8A97-A776DFC57951} + Win32Proj + picoc + + + + Application + true + v110 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/cmd/picoc-1/msvc/picoc/picoc.vcxproj.filters b/src/cmd/picoc-1/msvc/picoc/picoc.vcxproj.filters new file mode 100644 index 0000000..77be70a --- /dev/null +++ b/src/cmd/picoc-1/msvc/picoc/picoc.vcxproj.filters @@ -0,0 +1,99 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {9cc822ce-c7ed-4deb-93d2-ab0077cfe681} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\cstdlib + + + Source Files\cstdlib + + + Source Files\cstdlib + + + Source Files\cstdlib + + + Source Files\cstdlib + + + Source Files\cstdlib + + + Source Files\cstdlib + + + Source Files\cstdlib + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/cmd/picoc-1/parse.c b/src/cmd/picoc-1/parse.c new file mode 100644 index 0000000..6eefb0b --- /dev/null +++ b/src/cmd/picoc-1/parse.c @@ -0,0 +1,917 @@ +/* picoc parser - parses source and executes statements */ + +#include "picoc.h" +#include "interpreter.h" + +/* a chunk of heap-allocated tokens we'll cleanup when we're done */ +struct CleanupTokenNode +{ + void *Tokens; + const char *SourceText; + struct CleanupTokenNode *Next; +}; + +static struct CleanupTokenNode *CleanupTokenList = NULL; + + +/* deallocate any memory */ +void ParseCleanup() +{ + while (CleanupTokenList != NULL) + { + struct CleanupTokenNode *Next = CleanupTokenList->Next; + + HeapFreeMem(CleanupTokenList->Tokens); + if (CleanupTokenList->SourceText != NULL) + HeapFreeMem((void *)CleanupTokenList->SourceText); + + HeapFreeMem(CleanupTokenList); + CleanupTokenList = Next; + } +} + +/* parse a statement, but only run it if Condition is TRUE */ +enum ParseResult ParseStatementMaybeRun(struct ParseState *Parser, int Condition, int CheckTrailingSemicolon) +{ + if (Parser->Mode != RunModeSkip && !Condition) + { + enum RunMode OldMode = Parser->Mode; + int Result; + Parser->Mode = RunModeSkip; + Result = ParseStatement(Parser, CheckTrailingSemicolon); + Parser->Mode = OldMode; + return Result; + } + else + return ParseStatement(Parser, CheckTrailingSemicolon); +} + +/* count the number of parameters to a function or macro */ +int ParseCountParams(struct ParseState *Parser) +{ + int ParamCount = 0; + + enum LexToken Token = LexGetToken(Parser, NULL, TRUE); + if (Token != TokenCloseBracket && Token != TokenEOF) + { + /* count the number of parameters */ + ParamCount++; + while ((Token = LexGetToken(Parser, NULL, TRUE)) != TokenCloseBracket && Token != TokenEOF) + { + if (Token == TokenComma) + ParamCount++; + } + } + + return ParamCount; +} + +/* parse a function definition and store it for later */ +struct Value *ParseFunctionDefinition(struct ParseState *Parser, struct ValueType *ReturnType, char *Identifier) +{ + struct ValueType *ParamType; + char *ParamIdentifier; + enum LexToken Token = TokenNone; + struct ParseState ParamParser; + struct Value *FuncValue; + struct Value *OldFuncValue; + struct ParseState FuncBody; + int ParamCount = 0; + + if (TopStackFrame != NULL) + ProgramFail(Parser, "nested function definitions are not allowed"); + + LexGetToken(Parser, NULL, TRUE); /* open bracket */ + ParserCopy(&ParamParser, Parser); + ParamCount = ParseCountParams(Parser); + if (ParamCount > PARAMETER_MAX) + ProgramFail(Parser, "too many parameters"); + + FuncValue = VariableAllocValueAndData(Parser, sizeof(struct FuncDef) + sizeof(struct ValueType *) * ParamCount + sizeof(const char *) * ParamCount, FALSE, NULL, TRUE); + FuncValue->Typ = &FunctionType; + FuncValue->Val->FuncDef.ReturnType = ReturnType; + FuncValue->Val->FuncDef.NumParams = ParamCount; + FuncValue->Val->FuncDef.VarArgs = FALSE; + FuncValue->Val->FuncDef.ParamType = (struct ValueType **)((char *)FuncValue->Val + sizeof(struct FuncDef)); + FuncValue->Val->FuncDef.ParamName = (char **)((char *)FuncValue->Val->FuncDef.ParamType + sizeof(struct ValueType *) * ParamCount); + + for (ParamCount = 0; ParamCount < FuncValue->Val->FuncDef.NumParams; ParamCount++) + { + /* harvest the parameters into the function definition */ + if (ParamCount == FuncValue->Val->FuncDef.NumParams-1 && LexGetToken(&ParamParser, NULL, FALSE) == TokenEllipsis) + { + /* ellipsis at end */ + FuncValue->Val->FuncDef.NumParams--; + FuncValue->Val->FuncDef.VarArgs = TRUE; + break; + } + else + { + /* add a parameter */ + TypeParse(&ParamParser, &ParamType, &ParamIdentifier, NULL); + if (ParamType->Base == TypeVoid) + { + /* this isn't a real parameter at all - delete it */ + ParamCount--; + FuncValue->Val->FuncDef.NumParams--; + } + else + { + FuncValue->Val->FuncDef.ParamType[ParamCount] = ParamType; + FuncValue->Val->FuncDef.ParamName[ParamCount] = ParamIdentifier; + } + } + + Token = LexGetToken(&ParamParser, NULL, TRUE); + if (Token != TokenComma && ParamCount < FuncValue->Val->FuncDef.NumParams-1) + ProgramFail(&ParamParser, "comma expected"); + } + + if (FuncValue->Val->FuncDef.NumParams != 0 && Token != TokenCloseBracket && Token != TokenComma && Token != TokenEllipsis) + ProgramFail(&ParamParser, "bad parameter"); + + if (strcmp(Identifier, "main") == 0) + { + /* make sure it's int main() */ + if ( FuncValue->Val->FuncDef.ReturnType != &IntType && + FuncValue->Val->FuncDef.ReturnType != &VoidType ) + ProgramFail(Parser, "main() should return an int or void"); + + if (FuncValue->Val->FuncDef.NumParams != 0 && + (FuncValue->Val->FuncDef.NumParams != 2 || FuncValue->Val->FuncDef.ParamType[0] != &IntType) ) + ProgramFail(Parser, "bad parameters to main()"); + } + + /* look for a function body */ + Token = LexGetToken(Parser, NULL, FALSE); + if (Token == TokenSemicolon) + LexGetToken(Parser, NULL, TRUE); /* it's a prototype, absorb the trailing semicolon */ + else + { + /* it's a full function definition with a body */ + if (Token != TokenLeftBrace) + ProgramFail(Parser, "bad function definition"); + + ParserCopy(&FuncBody, Parser); + if (ParseStatementMaybeRun(Parser, FALSE, TRUE) != ParseResultOk) + ProgramFail(Parser, "function definition expected"); + + FuncValue->Val->FuncDef.Body = FuncBody; + FuncValue->Val->FuncDef.Body.Pos = LexCopyTokens(&FuncBody, Parser); + + /* is this function already in the global table? */ + if (TableGet(&GlobalTable, Identifier, &OldFuncValue, NULL, NULL, NULL)) + { + if (OldFuncValue->Val->FuncDef.Body.Pos == NULL) + { + /* override an old function prototype */ + VariableFree(TableDelete(&GlobalTable, Identifier)); + } + else + ProgramFail(Parser, "'%s' is already defined", Identifier); + } + } + + if (!TableSet(&GlobalTable, Identifier, FuncValue, (char *)Parser->FileName, Parser->Line, Parser->CharacterPos)) + ProgramFail(Parser, "'%s' is already defined", Identifier); + + return FuncValue; +} + +/* parse an array initialiser and assign to a variable */ +int ParseArrayInitialiser(struct ParseState *Parser, struct Value *NewVariable, int DoAssignment) +{ + int ArrayIndex = 0; + enum LexToken Token; + struct Value *CValue; + + /* count the number of elements in the array */ + if (DoAssignment && Parser->Mode == RunModeRun) + { + struct ParseState CountParser; + int NumElements; + + ParserCopy(&CountParser, Parser); + NumElements = ParseArrayInitialiser(&CountParser, NewVariable, FALSE); + if (NewVariable->Typ->ArraySize == 0) + VariableRealloc(Parser, NewVariable, NumElements); + + else if (NewVariable->Typ->ArraySize != NumElements) + AssignFail(Parser, "from an array of size %d to one of size %d", NULL, NULL, NumElements, NewVariable->Typ->ArraySize, NULL, 0); + } + + /* parse the array initialiser */ + Token = LexGetToken(Parser, NULL, FALSE); + while (Token != TokenRightBrace) + { + struct Value *ArrayElement = NULL; + + if (Parser->Mode == RunModeRun && DoAssignment) + ArrayElement = VariableAllocValueFromExistingData(Parser, NewVariable->Typ->FromType, (union AnyValue *)(&NewVariable->Val->ArrayMem[0] + TypeSize(NewVariable->Typ->FromType, 0, TRUE) * ArrayIndex), TRUE, NewVariable); + + if (!ExpressionParse(Parser, &CValue)) + ProgramFail(Parser, "expression expected"); + + if (Parser->Mode == RunModeRun && DoAssignment) + { + ExpressionAssign(Parser, ArrayElement, CValue, FALSE, NULL, 0, FALSE); + VariableStackPop(Parser, CValue); + VariableStackPop(Parser, ArrayElement); + } + + ArrayIndex++; + + Token = LexGetToken(Parser, NULL, FALSE); + if (Token == TokenComma) + { + LexGetToken(Parser, NULL, TRUE); + Token = LexGetToken(Parser, NULL, FALSE); + } + else if (Token != TokenRightBrace) + ProgramFail(Parser, "comma expected"); + } + + if (Token == TokenRightBrace) + LexGetToken(Parser, NULL, TRUE); + else + ProgramFail(Parser, "'}' expected"); + + return ArrayIndex; +} + +/* assign an initial value to a variable */ +void ParseDeclarationAssignment(struct ParseState *Parser, struct Value *NewVariable, int DoAssignment) +{ + struct Value *CValue; + + if (LexGetToken(Parser, NULL, FALSE) == TokenLeftBrace) + { + /* this is an array initialiser */ + LexGetToken(Parser, NULL, TRUE); + ParseArrayInitialiser(Parser, NewVariable, DoAssignment); + } + else + { + /* this is a normal expression initialiser */ + if (!ExpressionParse(Parser, &CValue)) + ProgramFail(Parser, "expression expected"); + + if (Parser->Mode == RunModeRun && DoAssignment) + { + ExpressionAssign(Parser, NewVariable, CValue, FALSE, NULL, 0, FALSE); + VariableStackPop(Parser, CValue); + } + } +} + +/* declare a variable or function */ +int ParseDeclaration(struct ParseState *Parser, enum LexToken Token) +{ + char *Identifier; + struct ValueType *BasicType; + struct ValueType *Typ; + struct Value *NewVariable = NULL; + int IsStatic = FALSE; + int FirstVisit = FALSE; + + TypeParseFront(Parser, &BasicType, &IsStatic); + do + { + TypeParseIdentPart(Parser, BasicType, &Typ, &Identifier); + if ((Token != TokenVoidType && Token != TokenStructType && Token != TokenUnionType && Token != TokenEnumType) && Identifier == StrEmpty) + ProgramFail(Parser, "identifier expected"); + + if (Identifier != StrEmpty) + { + /* handle function definitions */ + if (LexGetToken(Parser, NULL, FALSE) == TokenOpenBracket) + { + ParseFunctionDefinition(Parser, Typ, Identifier); + return FALSE; + } + else + { + if (Typ == &VoidType && Identifier != StrEmpty) + ProgramFail(Parser, "can't define a void variable"); + + if (Parser->Mode == RunModeRun || Parser->Mode == RunModeGoto) + NewVariable = VariableDefineButIgnoreIdentical(Parser, Identifier, Typ, IsStatic, &FirstVisit); + + if (LexGetToken(Parser, NULL, FALSE) == TokenAssign) + { + /* we're assigning an initial value */ + LexGetToken(Parser, NULL, TRUE); + ParseDeclarationAssignment(Parser, NewVariable, !IsStatic || FirstVisit); + } + } + } + + Token = LexGetToken(Parser, NULL, FALSE); + if (Token == TokenComma) + LexGetToken(Parser, NULL, TRUE); + + } while (Token == TokenComma); + + return TRUE; +} + +/* parse a #define macro definition and store it for later */ +void ParseMacroDefinition(struct ParseState *Parser) +{ + struct Value *MacroName; + char *MacroNameStr; + struct Value *ParamName; + struct Value *MacroValue; + + if (LexGetToken(Parser, &MacroName, TRUE) != TokenIdentifier) + ProgramFail(Parser, "identifier expected"); + + MacroNameStr = MacroName->Val->Identifier; + + if (LexRawPeekToken(Parser) == TokenOpenMacroBracket) + { + /* it's a parameterised macro, read the parameters */ + enum LexToken Token = LexGetToken(Parser, NULL, TRUE); + struct ParseState ParamParser; + int NumParams; + int ParamCount = 0; + + ParserCopy(&ParamParser, Parser); + NumParams = ParseCountParams(&ParamParser); + MacroValue = VariableAllocValueAndData(Parser, sizeof(struct MacroDef) + sizeof(const char *) * NumParams, FALSE, NULL, TRUE); + MacroValue->Val->MacroDef.NumParams = NumParams; + MacroValue->Val->MacroDef.ParamName = (char **)((char *)MacroValue->Val + sizeof(struct MacroDef)); + + Token = LexGetToken(Parser, &ParamName, TRUE); + + while (Token == TokenIdentifier) + { + /* store a parameter name */ + MacroValue->Val->MacroDef.ParamName[ParamCount++] = ParamName->Val->Identifier; + + /* get the trailing comma */ + Token = LexGetToken(Parser, NULL, TRUE); + if (Token == TokenComma) + Token = LexGetToken(Parser, &ParamName, TRUE); + + else if (Token != TokenCloseBracket) + ProgramFail(Parser, "comma expected"); + } + + if (Token != TokenCloseBracket) + ProgramFail(Parser, "close bracket expected"); + } + else + { + /* allocate a simple unparameterised macro */ + MacroValue = VariableAllocValueAndData(Parser, sizeof(struct MacroDef), FALSE, NULL, TRUE); + MacroValue->Val->MacroDef.NumParams = 0; + } + + /* copy the body of the macro to execute later */ + ParserCopy(&MacroValue->Val->MacroDef.Body, Parser); + MacroValue->Typ = &MacroType; + LexToEndOfLine(Parser); + MacroValue->Val->MacroDef.Body.Pos = LexCopyTokens(&MacroValue->Val->MacroDef.Body, Parser); + + if (!TableSet(&GlobalTable, MacroNameStr, MacroValue, (char *)Parser->FileName, Parser->Line, Parser->CharacterPos)) + ProgramFail(Parser, "'%s' is already defined", MacroNameStr); +} + +/* copy the entire parser state */ +void ParserCopy(struct ParseState *To, struct ParseState *From) +{ + memcpy((void *)To, (void *)From, sizeof(*To)); +} + +/* copy where we're at in the parsing */ +void ParserCopyPos(struct ParseState *To, struct ParseState *From) +{ + To->Pos = From->Pos; + To->Line = From->Line; + To->HashIfLevel = From->HashIfLevel; + To->HashIfEvaluateToLevel = From->HashIfEvaluateToLevel; + To->CharacterPos = From->CharacterPos; +} + +/* parse a "for" statement */ +void ParseFor(struct ParseState *Parser) +{ + int Condition; + struct ParseState PreConditional; + struct ParseState PreIncrement; + struct ParseState PreStatement; + struct ParseState After; + + if (LexGetToken(Parser, NULL, TRUE) != TokenOpenBracket) + ProgramFail(Parser, "'(' expected"); + + if (ParseStatement(Parser, TRUE) != ParseResultOk) + ProgramFail(Parser, "statement expected"); + + ParserCopyPos(&PreConditional, Parser); + if (LexGetToken(Parser, NULL, FALSE) == TokenSemicolon) + Condition = TRUE; + else + Condition = ExpressionParseInt(Parser); + + if (LexGetToken(Parser, NULL, TRUE) != TokenSemicolon) + ProgramFail(Parser, "';' expected"); + + ParserCopyPos(&PreIncrement, Parser); + ParseStatementMaybeRun(Parser, FALSE, FALSE); + + if (LexGetToken(Parser, NULL, TRUE) != TokenCloseBracket) + ProgramFail(Parser, "')' expected"); + + ParserCopyPos(&PreStatement, Parser); + if (ParseStatementMaybeRun(Parser, Condition, TRUE) != ParseResultOk) + ProgramFail(Parser, "statement expected"); + + if (Parser->Mode == RunModeContinue) + Parser->Mode = RunModeRun; + + ParserCopyPos(&After, Parser); + + while (Condition && Parser->Mode == RunModeRun) + { + ParserCopyPos(Parser, &PreIncrement); + ParseStatement(Parser, FALSE); + + ParserCopyPos(Parser, &PreConditional); + if (LexGetToken(Parser, NULL, FALSE) == TokenSemicolon) + Condition = TRUE; + else + Condition = ExpressionParseInt(Parser); + + if (Condition) + { + ParserCopyPos(Parser, &PreStatement); + ParseStatement(Parser, TRUE); + + if (Parser->Mode == RunModeContinue) + Parser->Mode = RunModeRun; + } + } + + if (Parser->Mode == RunModeBreak) + Parser->Mode = RunModeRun; + + ParserCopyPos(Parser, &After); +} + +/* parse a block of code and return what mode it returned in */ +enum RunMode ParseBlock(struct ParseState *Parser, int AbsorbOpenBrace, int Condition) +{ + if (AbsorbOpenBrace && LexGetToken(Parser, NULL, TRUE) != TokenLeftBrace) + ProgramFail(Parser, "'{' expected"); + + if (Parser->Mode == RunModeSkip || !Condition) + { + /* condition failed - skip this block instead */ + enum RunMode OldMode = Parser->Mode; + Parser->Mode = RunModeSkip; + while (ParseStatement(Parser, TRUE) == ParseResultOk) + {} + Parser->Mode = OldMode; + } + else + { + /* just run it in its current mode */ + while (ParseStatement(Parser, TRUE) == ParseResultOk) + {} + } + + if (LexGetToken(Parser, NULL, TRUE) != TokenRightBrace) + ProgramFail(Parser, "'}' expected"); + + return Parser->Mode; +} + +/* parse a typedef declaration */ +void ParseTypedef(struct ParseState *Parser) +{ + struct ValueType *Typ; + struct ValueType **TypPtr; + char *TypeName; + struct Value InitValue; + + TypeParse(Parser, &Typ, &TypeName, NULL); + + if (Parser->Mode == RunModeRun) + { + TypPtr = &Typ; + InitValue.Typ = &TypeType; + InitValue.Val = (union AnyValue *)TypPtr; + VariableDefine(Parser, TypeName, &InitValue, NULL, FALSE); + } +} + +/* parse a statement */ +enum ParseResult ParseStatement(struct ParseState *Parser, int CheckTrailingSemicolon) +{ + struct Value *CValue; + struct Value *LexerValue; + struct Value *VarValue; + int Condition; + struct ParseState PreState; + enum LexToken Token; + + /* if we're debugging, check for a breakpoint */ + if (Parser->DebugMode && Parser->Mode == RunModeRun) + DebugCheckStatement(Parser); + + /* take note of where we are and then grab a token to see what statement we have */ + ParserCopy(&PreState, Parser); + Token = LexGetToken(Parser, &LexerValue, TRUE); + + switch (Token) + { + case TokenEOF: + return ParseResultEOF; + + case TokenIdentifier: + /* might be a typedef-typed variable declaration or it might be an expression */ + if (VariableDefined(LexerValue->Val->Identifier)) + { + VariableGet(Parser, LexerValue->Val->Identifier, &VarValue); + if (VarValue->Typ->Base == Type_Type) + { + *Parser = PreState; + ParseDeclaration(Parser, Token); + break; + } + } + else + { + /* it might be a goto label */ + enum LexToken NextToken = LexGetToken(Parser, NULL, FALSE); + if (NextToken == TokenColon) + { + /* declare the identifier as a goto label */ + LexGetToken(Parser, NULL, TRUE); + if (Parser->Mode == RunModeGoto && LexerValue->Val->Identifier == Parser->SearchGotoLabel) + Parser->Mode = RunModeRun; + + CheckTrailingSemicolon = FALSE; + break; + } + } + /* else fallthrough to expression */ + + case TokenAsterisk: + case TokenAmpersand: + case TokenIncrement: + case TokenDecrement: + case TokenOpenBracket: + *Parser = PreState; + ExpressionParse(Parser, &CValue); + if (Parser->Mode == RunModeRun) + VariableStackPop(Parser, CValue); + break; + + case TokenLeftBrace: + ParseBlock(Parser, FALSE, TRUE); + CheckTrailingSemicolon = FALSE; + break; + + case TokenIf: + if (LexGetToken(Parser, NULL, TRUE) != TokenOpenBracket) + ProgramFail(Parser, "'(' expected"); + + Condition = ExpressionParseInt(Parser); + + if (LexGetToken(Parser, NULL, TRUE) != TokenCloseBracket) + ProgramFail(Parser, "')' expected"); + + if (ParseStatementMaybeRun(Parser, Condition, TRUE) != ParseResultOk) + ProgramFail(Parser, "statement expected"); + + if (LexGetToken(Parser, NULL, FALSE) == TokenElse) + { + LexGetToken(Parser, NULL, TRUE); + if (ParseStatementMaybeRun(Parser, !Condition, TRUE) != ParseResultOk) + ProgramFail(Parser, "statement expected"); + } + CheckTrailingSemicolon = FALSE; + break; + + case TokenWhile: + { + struct ParseState PreConditional; + enum RunMode PreMode = Parser->Mode; + + if (LexGetToken(Parser, NULL, TRUE) != TokenOpenBracket) + ProgramFail(Parser, "'(' expected"); + + ParserCopyPos(&PreConditional, Parser); + do + { + ParserCopyPos(Parser, &PreConditional); + Condition = ExpressionParseInt(Parser); + if (LexGetToken(Parser, NULL, TRUE) != TokenCloseBracket) + ProgramFail(Parser, "')' expected"); + + if (ParseStatementMaybeRun(Parser, Condition, TRUE) != ParseResultOk) + ProgramFail(Parser, "statement expected"); + + if (Parser->Mode == RunModeContinue) + Parser->Mode = PreMode; + + } while (Parser->Mode == RunModeRun && Condition); + + if (Parser->Mode == RunModeBreak) + Parser->Mode = PreMode; + + CheckTrailingSemicolon = FALSE; + } + break; + + case TokenDo: + { + struct ParseState PreStatement; + enum RunMode PreMode = Parser->Mode; + ParserCopyPos(&PreStatement, Parser); + do + { + ParserCopyPos(Parser, &PreStatement); + if (ParseStatement(Parser, TRUE) != ParseResultOk) + ProgramFail(Parser, "statement expected"); + + if (Parser->Mode == RunModeContinue) + Parser->Mode = PreMode; + + if (LexGetToken(Parser, NULL, TRUE) != TokenWhile) + ProgramFail(Parser, "'while' expected"); + + if (LexGetToken(Parser, NULL, TRUE) != TokenOpenBracket) + ProgramFail(Parser, "'(' expected"); + + Condition = ExpressionParseInt(Parser); + if (LexGetToken(Parser, NULL, TRUE) != TokenCloseBracket) + ProgramFail(Parser, "')' expected"); + + } while (Condition && Parser->Mode == RunModeRun); + + if (Parser->Mode == RunModeBreak) + Parser->Mode = PreMode; + } + break; + + case TokenFor: + ParseFor(Parser); + CheckTrailingSemicolon = FALSE; + break; + + case TokenSemicolon: + CheckTrailingSemicolon = FALSE; + break; + + case TokenIntType: + case TokenShortType: + case TokenCharType: + case TokenLongType: + case TokenFloatType: + case TokenDoubleType: + case TokenVoidType: + case TokenStructType: + case TokenUnionType: + case TokenEnumType: + case TokenSignedType: + case TokenUnsignedType: + case TokenStaticType: + case TokenAutoType: + case TokenRegisterType: + case TokenExternType: + *Parser = PreState; + CheckTrailingSemicolon = ParseDeclaration(Parser, Token); + break; + + case TokenHashDefine: + ParseMacroDefinition(Parser); + CheckTrailingSemicolon = FALSE; + break; + +#ifndef NO_HASH_INCLUDE + case TokenHashInclude: + if (LexGetToken(Parser, &LexerValue, TRUE) != TokenStringConstant) + ProgramFail(Parser, "\"filename.h\" expected"); + + IncludeFile((char *)LexerValue->Val->Pointer); + CheckTrailingSemicolon = FALSE; + break; +#endif + + case TokenSwitch: + if (LexGetToken(Parser, NULL, TRUE) != TokenOpenBracket) + ProgramFail(Parser, "'(' expected"); + + Condition = ExpressionParseInt(Parser); + + if (LexGetToken(Parser, NULL, TRUE) != TokenCloseBracket) + ProgramFail(Parser, "')' expected"); + + if (LexGetToken(Parser, NULL, FALSE) != TokenLeftBrace) + ProgramFail(Parser, "'{' expected"); + + { + /* new block so we can store parser state */ + enum RunMode OldMode = Parser->Mode; + int OldSearchLabel = Parser->SearchLabel; + Parser->Mode = RunModeCaseSearch; + Parser->SearchLabel = Condition; + + ParseBlock(Parser, TRUE, OldMode != RunModeSkip); + + if (Parser->Mode != RunModeReturn) + Parser->Mode = OldMode; + + Parser->SearchLabel = OldSearchLabel; + } + + CheckTrailingSemicolon = FALSE; + break; + + case TokenCase: + if (Parser->Mode == RunModeCaseSearch) + { + Parser->Mode = RunModeRun; + Condition = ExpressionParseInt(Parser); + Parser->Mode = RunModeCaseSearch; + } + else + Condition = ExpressionParseInt(Parser); + + if (LexGetToken(Parser, NULL, TRUE) != TokenColon) + ProgramFail(Parser, "':' expected"); + + if (Parser->Mode == RunModeCaseSearch && Condition == Parser->SearchLabel) + Parser->Mode = RunModeRun; + + CheckTrailingSemicolon = FALSE; + break; + + case TokenDefault: + if (LexGetToken(Parser, NULL, TRUE) != TokenColon) + ProgramFail(Parser, "':' expected"); + + if (Parser->Mode == RunModeCaseSearch) + Parser->Mode = RunModeRun; + + CheckTrailingSemicolon = FALSE; + break; + + case TokenBreak: + if (Parser->Mode == RunModeRun) + Parser->Mode = RunModeBreak; + break; + + case TokenContinue: + if (Parser->Mode == RunModeRun) + Parser->Mode = RunModeContinue; + break; + + case TokenReturn: + if (Parser->Mode == RunModeRun) + { + if (TopStackFrame->ReturnValue->Typ->Base != TypeVoid) + { + if (!ExpressionParse(Parser, &CValue)) + ProgramFail(Parser, "value required in return"); + + ExpressionAssign(Parser, TopStackFrame->ReturnValue, CValue, TRUE, NULL, 0, FALSE); + VariableStackPop(Parser, CValue); + } + else + { + if (ExpressionParse(Parser, &CValue)) + ProgramFail(Parser, "value in return from a void function"); + } + + Parser->Mode = RunModeReturn; + } + else + ExpressionParse(Parser, &CValue); + break; + + case TokenTypedef: + ParseTypedef(Parser); + break; + + case TokenGoto: + if (LexGetToken(Parser, &LexerValue, TRUE) != TokenIdentifier) + ProgramFail(Parser, "identifier expected"); + + if (Parser->Mode == RunModeRun) + { + /* start scanning for the goto label */ + Parser->SearchGotoLabel = LexerValue->Val->Identifier; + Parser->Mode = RunModeGoto; + } + break; + + case TokenDelete: + { + /* try it as a function or variable name to delete */ + if (LexGetToken(Parser, &LexerValue, TRUE) != TokenIdentifier) + ProgramFail(Parser, "identifier expected"); + + if (Parser->Mode == RunModeRun) + { + /* delete this variable or function */ + CValue = TableDelete(&GlobalTable, LexerValue->Val->Identifier); + + if (CValue == NULL) + ProgramFail(Parser, "'%s' is not defined", LexerValue->Val->Identifier); + + VariableFree(CValue); + } + break; + } + + default: + *Parser = PreState; + return ParseResultError; + } + + if (CheckTrailingSemicolon) + { + if (LexGetToken(Parser, NULL, TRUE) != TokenSemicolon) + ProgramFail(Parser, "';' expected"); + } + + return ParseResultOk; +} + +/* quick scan a source file for definitions */ +void PicocParse(const char *FileName, const char *Source, int SourceLen, int RunIt, int CleanupNow, int CleanupSource, int EnableDebugger) +{ + struct ParseState Parser; + enum ParseResult Ok; + struct CleanupTokenNode *NewCleanupNode; + char *RegFileName = TableStrRegister(FileName); + + void *Tokens = LexAnalyse(RegFileName, Source, SourceLen, NULL); + + /* allocate a cleanup node so we can clean up the tokens later */ + if (!CleanupNow) + { + NewCleanupNode = HeapAllocMem(sizeof(struct CleanupTokenNode)); + if (NewCleanupNode == NULL) + ProgramFail(NULL, "out of memory"); + + NewCleanupNode->Tokens = Tokens; + if (CleanupSource) + NewCleanupNode->SourceText = Source; + else + NewCleanupNode->SourceText = NULL; + + NewCleanupNode->Next = CleanupTokenList; + CleanupTokenList = NewCleanupNode; + } + + /* do the parsing */ + LexInitParser(&Parser, Source, Tokens, RegFileName, RunIt, EnableDebugger); + + do { + Ok = ParseStatement(&Parser, TRUE); + } while (Ok == ParseResultOk); + + if (Ok == ParseResultError) + ProgramFail(&Parser, "parse error"); + + /* clean up */ + if (CleanupNow) + HeapFreeMem(Tokens); +} + +/* parse interactively */ +void PicocParseInteractiveNoStartPrompt(int EnableDebugger) +{ + struct ParseState Parser; + enum ParseResult Ok; + + LexInitParser(&Parser, NULL, NULL, StrEmpty, TRUE, EnableDebugger); + PicocPlatformSetExitPoint(); + LexInteractiveClear(&Parser); + + do + { + LexInteractiveStatementPrompt(); + Ok = ParseStatement(&Parser, TRUE); + LexInteractiveCompleted(&Parser); + + } while (Ok == ParseResultOk); + + if (Ok == ParseResultError) + ProgramFail(&Parser, "parse error"); + + PlatformPrintf("\n"); +} + +/* parse interactively, showing a startup message */ +void PicocParseInteractive() +{ + PlatformPrintf(INTERACTIVE_PROMPT_START); + PicocParseInteractiveNoStartPrompt(TRUE); +} diff --git a/src/cmd/picoc-1/picoc.c b/src/cmd/picoc-1/picoc.c new file mode 100644 index 0000000..4854d34 --- /dev/null +++ b/src/cmd/picoc-1/picoc.c @@ -0,0 +1,111 @@ +/* picoc main program - this varies depending on your operating system and + * how you're using picoc */ + +/* include only picoc.h here - should be able to use it with only the external interfaces, no internals from interpreter.h */ +#include "picoc.h" + +/* platform-dependent code for running programs is in this file */ + +#if defined(UNIX_HOST) || defined(WIN32) +#include +#include +#include +#include + +struct uflash_head ufh __attribute__ ((section (".uflash_head"))) = +{ + UFLASH_MAGIC, "picoc" +}; + + +#define PICOC_STACK_SIZE (32*1024) /* space for the the stack */ + +int main(int argc, char **argv) +{ + int ParamCount = 1; + int DontRunMain = FALSE; + int StackSize = getenv("STACKSIZE") ? atoi(getenv("STACKSIZE")) : PICOC_STACK_SIZE; + + if (argc < 2) + { + printf("Format: picoc ... [- ...] : run a program (calls main() to start it)\n" + " picoc -s ... [- ...] : script mode - runs the program without calling main()\n" + " picoc -i : interactive mode\n"); + exit(1); + } + + PicocInitialise(StackSize); + + if (strcmp(argv[ParamCount], "-s") == 0 || strcmp(argv[ParamCount], "-m") == 0) + { + DontRunMain = TRUE; + PicocIncludeAllSystemHeaders(); + ParamCount++; + } + + if (argc > ParamCount && strcmp(argv[ParamCount], "-i") == 0) + { + PicocIncludeAllSystemHeaders(); + PicocParseInteractive(TRUE); + } + else + { + if (PicocPlatformSetExitPoint()) + { + PicocCleanup(); + return PicocExitValue; + } + + for (; ParamCount < argc && strcmp(argv[ParamCount], "-") != 0; ParamCount++) + PicocPlatformScanFile(argv[ParamCount]); + + if (!DontRunMain) + PicocCallMain(argc - ParamCount, &argv[ParamCount]); + } + + PicocCleanup(); + return PicocExitValue; +} +#else +# ifdef SURVEYOR_HOST +# define HEAP_SIZE C_HEAPSIZE +# include +# include "../srv.h" +# include "../print.h" +# include "../string.h" + +int picoc(char *SourceStr) +{ + char *pos; + + PicocInitialise(HEAP_SIZE); + + if (SourceStr) + { + for (pos = SourceStr; *pos != 0; pos++) + { + if (*pos == 0x1a) + { + *pos = 0x20; + } + } + } + + PicocExitBuf[40] = 0; + PicocPlatformSetExitPoint(); + if (PicocExitBuf[40]) { + printf("Leaving PicoC\n\r"); + PicocCleanup(); + return PicocExitValue; + } + + if (SourceStr) + PicocParse("nofile", SourceStr, strlen(SourceStr), TRUE, TRUE, FALSE); + + PicocParseInteractive(); + PicocCleanup(); + + return PicocExitValue; +} +# endif +#endif diff --git a/src/cmd/picoc-1/picoc.h b/src/cmd/picoc-1/picoc.h new file mode 100644 index 0000000..ab95985 --- /dev/null +++ b/src/cmd/picoc-1/picoc.h @@ -0,0 +1,52 @@ +/* picoc external interface. This should be the only header you need to use if + * you're using picoc as a library. Internal details are in interpreter.h */ +#ifndef PICOC_H +#define PICOC_H + +/* picoc version number */ +#ifdef VER +#define PICOC_VERSION "v2.2 beta r" VER /* VER is the subversion version number, obtained via the Makefile */ +#else +#define PICOC_VERSION "v2.2" +#endif + +/* handy definitions */ +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + + +#if defined(UNIX_HOST) || defined(WIN32) +#include + +/* mark where to end the program for platforms which require this */ +extern jmp_buf PicocExitBuf; + +/* this has to be a macro, otherwise errors will occur due to the stack being corrupt */ +#define PicocPlatformSetExitPoint() setjmp(PicocExitBuf) +#endif + +#ifdef SURVEYOR_HOST +/* mark where to end the program for platforms which require this */ +extern int PicocExitBuf[]; + +#define PicocPlatformSetExitPoint() setjmp(PicocExitBuf) +#endif + +/* parse.c */ +void PicocParse(const char *FileName, const char *Source, int SourceLen, int RunIt, int CleanupNow, int CleanupSource, int EnableDebugger); +void PicocParseInteractive(); + +/* platform.c */ +void PicocCallMain(int argc, char **argv); +void PicocInitialise(int StackSize); +void PicocCleanup(); +void PicocPlatformScanFile(const char *FileName); + +extern int PicocExitValue; + +/* include.c */ +void PicocIncludeAllSystemHeaders(); + +#endif /* PICOC_H */ diff --git a/src/cmd/picoc-1/platform.c b/src/cmd/picoc-1/platform.c new file mode 100644 index 0000000..1a83168 --- /dev/null +++ b/src/cmd/picoc-1/platform.c @@ -0,0 +1,242 @@ +/* picoc's interface to the underlying platform. most platform-specific code + * is in platform/platform_XX.c and platform/library_XX.c */ + +#include "picoc.h" +#include "interpreter.h" + +/* the value passed to exit() */ +int PicocExitValue = 0; + +/* initialise everything */ +void PicocInitialise(int StackSize) +{ + PlatformInit(); + BasicIOInit(); + HeapInit(StackSize); + TableInit(); + VariableInit(); + LexInit(); + TypeInit(); +#ifndef NO_HASH_INCLUDE + IncludeInit(); +#endif + LibraryInit(); +#ifdef BUILTIN_MINI_STDLIB + LibraryAdd(&GlobalTable, "c library", &CLibrary[0]); + CLibraryInit(); +#endif + PlatformLibraryInit(); + DebugInit(); +} + +/* free memory */ +void PicocCleanup() +{ + DebugCleanup(); +#ifndef NO_HASH_INCLUDE + IncludeCleanup(); +#endif + ParseCleanup(); + LexCleanup(); + VariableCleanup(); + TypeCleanup(); + TableStrFree(); + HeapCleanup(); + PlatformCleanup(); +} + +/* platform-dependent code for running programs */ +#if defined(UNIX_HOST) || defined(WIN32) + +#define CALL_MAIN_NO_ARGS_RETURN_VOID "main();" +#define CALL_MAIN_WITH_ARGS_RETURN_VOID "main(__argc,__argv);" +#define CALL_MAIN_NO_ARGS_RETURN_INT "__exit_value = main();" +#define CALL_MAIN_WITH_ARGS_RETURN_INT "__exit_value = main(__argc,__argv);" + +void PicocCallMain(int argc, char **argv) +{ + /* check if the program wants arguments */ + struct Value *FuncValue = NULL; + + if (!VariableDefined(TableStrRegister("main"))) + ProgramFail(NULL, "main() is not defined"); + + VariableGet(NULL, TableStrRegister("main"), &FuncValue); + if (FuncValue->Typ->Base != TypeFunction) + ProgramFail(NULL, "main is not a function - can't call it"); + + if (FuncValue->Val->FuncDef.NumParams != 0) + { + /* define the arguments */ + VariableDefinePlatformVar(NULL, "__argc", &IntType, (union AnyValue *)&argc, FALSE); + VariableDefinePlatformVar(NULL, "__argv", CharPtrPtrType, (union AnyValue *)&argv, FALSE); + } + + if (FuncValue->Val->FuncDef.ReturnType == &VoidType) + { + if (FuncValue->Val->FuncDef.NumParams == 0) + PicocParse("startup", CALL_MAIN_NO_ARGS_RETURN_VOID, strlen(CALL_MAIN_NO_ARGS_RETURN_VOID), TRUE, TRUE, FALSE, TRUE); + else + PicocParse("startup", CALL_MAIN_WITH_ARGS_RETURN_VOID, strlen(CALL_MAIN_WITH_ARGS_RETURN_VOID), TRUE, TRUE, FALSE, TRUE); + } + else + { + VariableDefinePlatformVar(NULL, "__exit_value", &IntType, (union AnyValue *)&PicocExitValue, TRUE); + + if (FuncValue->Val->FuncDef.NumParams == 0) + PicocParse("startup", CALL_MAIN_NO_ARGS_RETURN_INT, strlen(CALL_MAIN_NO_ARGS_RETURN_INT), TRUE, TRUE, FALSE, TRUE); + else + PicocParse("startup", CALL_MAIN_WITH_ARGS_RETURN_INT, strlen(CALL_MAIN_WITH_ARGS_RETURN_INT), TRUE, TRUE, FALSE, TRUE); + } +} +#endif + +void PrintSourceTextErrorLine(const char *FileName, const char *SourceText, int Line, int CharacterPos) +{ + int LineCount; + const char *LinePos; + const char *CPos; + int CCount; + + if (SourceText != NULL) + { + /* find the source line */ + for (LinePos = SourceText, LineCount = 1; *LinePos != '\0' && LineCount < Line; LinePos++) + { + if (*LinePos == '\n') + LineCount++; + } + + /* display the line */ + for (CPos = LinePos; *CPos != '\n' && *CPos != '\0'; CPos++) + PrintCh(*CPos, CStdOut); + PrintCh('\n', CStdOut); + + /* display the error position */ + for (CPos = LinePos, CCount = 0; *CPos != '\n' && *CPos != '\0' && (CCount < CharacterPos || *CPos == ' '); CPos++, CCount++) + { + if (*CPos == '\t') + PrintCh('\t', CStdOut); + else + PrintCh(' ', CStdOut); + } + } + else + { + /* assume we're in interactive mode - try to make the arrow match up with the input text */ + for (CCount = 0; CCount < CharacterPos + (int)strlen(INTERACTIVE_PROMPT_STATEMENT); CCount++) + PrintCh(' ', CStdOut); + } + PlatformPrintf("^\n%s:%d: ", FileName, Line, CharacterPos); + +} + +/* display the source line and line number to identify an error */ +void PlatformErrorPrefix(struct ParseState *Parser) +{ + if (Parser != NULL) + PrintSourceTextErrorLine(Parser->FileName, Parser->SourceText, Parser->Line, Parser->CharacterPos); +} + +/* exit with a message */ +void ProgramFail(struct ParseState *Parser, const char *Message, ...) +{ + va_list Args; + + PlatformErrorPrefix(Parser); + va_start(Args, Message); + PlatformVPrintf(Message, Args); + va_end(Args); + PlatformPrintf("\n"); + PlatformExit(1); +} + +/* like ProgramFail() but gives descriptive error messages for assignment */ +void AssignFail(struct ParseState *Parser, const char *Format, struct ValueType *Type1, struct ValueType *Type2, int Num1, int Num2, const char *FuncName, int ParamNo) +{ + PlatformErrorPrefix(Parser); + PlatformPrintf("can't %s ", (FuncName == NULL) ? "assign" : "set"); + + if (Type1 != NULL) + PlatformPrintf(Format, Type1, Type2); + else + PlatformPrintf(Format, Num1, Num2); + + if (FuncName != NULL) + PlatformPrintf(" in argument %d of call to %s()", ParamNo, FuncName); + + ProgramFail(NULL, ""); +} + +/* exit lexing with a message */ +void LexFail(struct LexState *Lexer, const char *Message, ...) +{ + va_list Args; + + PrintSourceTextErrorLine(Lexer->FileName, Lexer->SourceText, Lexer->Line, Lexer->CharacterPos); + va_start(Args, Message); + PlatformVPrintf(Message, Args); + va_end(Args); + PlatformPrintf("\n"); + PlatformExit(1); +} + +/* printf for compiler error reporting */ +void PlatformPrintf(const char *Format, ...) +{ + va_list Args; + + va_start(Args, Format); + PlatformVPrintf(Format, Args); + va_end(Args); +} + +void PlatformVPrintf(const char *Format, va_list Args) +{ + const char *FPos; + + for (FPos = Format; *FPos != '\0'; FPos++) + { + if (*FPos == '%') + { + FPos++; + switch (*FPos) + { + case 's': PrintStr(va_arg(Args, char *), CStdOut); break; + case 'd': PrintSimpleInt(va_arg(Args, int), CStdOut); break; + case 'c': PrintCh(va_arg(Args, int), CStdOut); break; + case 't': PrintType(va_arg(Args, struct ValueType *), CStdOut); break; +#ifndef NO_FP + case 'f': PrintFP(va_arg(Args, double), CStdOut); break; +#endif + case '%': PrintCh('%', CStdOut); break; + case '\0': FPos--; break; + } + } + else + PrintCh(*FPos, CStdOut); + } +} + +/* make a new temporary name. takes a static buffer of char [7] as a parameter. should be initialised to "XX0000" + * where XX can be any characters */ +char *PlatformMakeTempName(char *TempNameBuffer) +{ + int CPos = 5; + + while (CPos > 1) + { + if (TempNameBuffer[CPos] < '9') + { + TempNameBuffer[CPos]++; + return TableStrRegister(TempNameBuffer); + } + else + { + TempNameBuffer[CPos] = '0'; + CPos--; + } + } + + return TableStrRegister(TempNameBuffer); +} diff --git a/src/cmd/picoc-1/platform.h b/src/cmd/picoc-1/platform.h new file mode 100644 index 0000000..ce4da02 --- /dev/null +++ b/src/cmd/picoc-1/platform.h @@ -0,0 +1,147 @@ +/* all platform-specific includes and defines go in this file */ +#ifndef PLATFORM_H +#define PLATFORM_H + + +/* configurable options */ +/* select your host type (or do it in the Makefile): + * #define UNIX_HOST + * #define FLYINGFOX_HOST + * #define SURVEYOR_HOST + * #define SRV1_UNIX_HOST + * #define UMON_HOST + * #define WIN32 (predefined on MSVC) + */ + +#define LARGE_INT_POWER_OF_TEN 1000000000 /* the largest power of ten which fits in an int on this architecture */ +#if defined(__hppa__) || defined(__sparc__) +#define ALIGN_TYPE double /* the default data type to use for alignment */ +#else +#define ALIGN_TYPE void * /* the default data type to use for alignment */ +#endif + +#define GLOBAL_TABLE_SIZE 97 /* global variable table */ +#define STRING_TABLE_SIZE 97 /* shared string table size */ +#define STRING_LITERAL_TABLE_SIZE 97 /* string literal table size */ +#define PARAMETER_MAX 16 /* maximum number of parameters to a function */ +#define LINEBUFFER_MAX 256 /* maximum number of characters on a line */ +#define LOCAL_TABLE_SIZE 11 /* size of local variable table (can expand) */ +#define STRUCT_TABLE_SIZE 11 /* size of struct/union member table (can expand) */ + +#define INTERACTIVE_PROMPT_START "starting picoc " PICOC_VERSION "\n" +#define INTERACTIVE_PROMPT_STATEMENT "picoc> " +#define INTERACTIVE_PROMPT_LINE " > " + +/* host platform includes */ +#ifdef UNIX_HOST +# define USE_MALLOC_STACK /* stack is allocated using malloc() */ +# define USE_MALLOC_HEAP /* heap is allocated using malloc() */ +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# ifndef NO_FP +# include +# define PICOC_MATH_LIBRARY +//# define USE_READLINE +# undef BIG_ENDIAN +# if defined(__powerpc__) || defined(__hppa__) || defined(__sparc__) +# define BIG_ENDIAN +# endif +# endif + +extern jmp_buf ExitBuf; + +#else +# ifdef WIN32 +# define USE_MALLOC_STACK /* stack is allocated using malloc() */ +# define USE_MALLOC_HEAP /* heap is allocated using malloc() */ +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# define PICOC_MATH_LIBRARY +# undef BIG_ENDIAN + +extern jmp_buf ExitBuf; + +# else +# ifdef FLYINGFOX_HOST +# define HEAP_SIZE (16*1024) /* space for the heap and the stack */ +# define NO_HASH_INCLUDE +# include +# include +# include +# include +# include +# include +# include +# define assert(x) +# define BUILTIN_MINI_STDLIB +# undef BIG_ENDIAN + +# else +# ifdef SURVEYOR_HOST +# define HEAP_SIZE C_HEAPSIZE +# define NO_FP +# define NO_CTYPE +# define NO_HASH_INCLUDE +# define NO_MODULUS +# include +# include "../string.h" +# include "../print.h" +# include "../srv.h" +# include "../setjmp.h" +# include "../stdarg.h" +# include "../colors.h" +# include "../neural.h" +# include "../gps.h" +# include "../i2c.h" +# include "../jpeg.h" +# include "../malloc.h" +# include "../xmodem.h" +# define assert(x) +# undef BIG_ENDIAN +# define NO_CALLOC +# define NO_REALLOC +# define BROKEN_FLOAT_CASTS +# define BUILTIN_MINI_STDLIB +# else +# ifdef UMON_HOST +# define HEAP_SIZE (128*1024) /* space for the heap and the stack */ +# define NO_FP +# define BUILTIN_MINI_STDLIB +# include +# include +# include +# include +# include +# include +# include "monlib.h" +# define assert(x) +# define malloc mon_malloc +# define calloc(a,b) mon_malloc(a*b) +# define realloc mon_realloc +# define free mon_free +# endif +# endif +# endif + +extern int ExitBuf[]; + +# endif +#endif + +#endif /* PLATFORM_H */ diff --git a/src/cmd/picoc-1/platform/library_ffox.c b/src/cmd/picoc-1/platform/library_ffox.c new file mode 100644 index 0000000..9e68e62 --- /dev/null +++ b/src/cmd/picoc-1/platform/library_ffox.c @@ -0,0 +1,13 @@ +#include "../interpreter.h" + +/* list of all library functions and their prototypes */ +struct LibraryFunction PlatformLibrary[] = +{ + { NULL, NULL } +}; + +void PlatformLibraryInit() +{ + LibraryAdd(&GlobalTable, "platform library", &PlatformLibrary); +} + diff --git a/src/cmd/picoc-1/platform/library_msvc.c b/src/cmd/picoc-1/platform/library_msvc.c new file mode 100644 index 0000000..c2c54b4 --- /dev/null +++ b/src/cmd/picoc-1/platform/library_msvc.c @@ -0,0 +1,5 @@ +#include "../interpreter.h" + +void PlatformLibraryInit() +{ +} diff --git a/src/cmd/picoc-1/platform/library_srv1.c b/src/cmd/picoc-1/platform/library_srv1.c new file mode 100644 index 0000000..a8cd443 --- /dev/null +++ b/src/cmd/picoc-1/platform/library_srv1.c @@ -0,0 +1,809 @@ +#include "../interpreter.h" + +static int Blobcnt, Blobx1, Blobx2, Bloby1, Bloby2, Iy1, Iy2, Iu1, Iu2, Iv1, Iv2; +static int GPSlat, GPSlon, GPSalt, GPSfix, GPSsat, GPSutc, Elcount, Ercount; +static int ScanVect[16], NNVect[NUM_OUTPUT]; + +struct ValueType *IntArrayType; + + +void SRV1SetupFunc() +{ + IntArrayType = TypeGetMatching(NULL, &IntType, TypeArray, 16, StrEmpty, TRUE); + VariableDefinePlatformVar(NULL, "scanvect", IntArrayType, (union AnyValue *)&ScanVect, FALSE); + VariableDefinePlatformVar(NULL, "neuron", IntArrayType, (union AnyValue *)&NNVect, FALSE); + VariableDefinePlatformVar(NULL, "blobcnt", &IntType, (union AnyValue *)&Blobcnt, FALSE); + VariableDefinePlatformVar(NULL, "blobx1", &IntType, (union AnyValue *)&Blobx1, FALSE); + VariableDefinePlatformVar(NULL, "blobx2", &IntType, (union AnyValue *)&Blobx2, FALSE); + VariableDefinePlatformVar(NULL, "bloby1", &IntType, (union AnyValue *)&Bloby1, FALSE); + VariableDefinePlatformVar(NULL, "bloby2", &IntType, (union AnyValue *)&Bloby2, FALSE); + VariableDefinePlatformVar(NULL, "lcount", &IntType, (union AnyValue *)&Elcount, FALSE); + VariableDefinePlatformVar(NULL, "rcount", &IntType, (union AnyValue *)&Ercount, FALSE); + VariableDefinePlatformVar(NULL, "y1", &IntType, (union AnyValue *)&Iy1, FALSE); + VariableDefinePlatformVar(NULL, "y2", &IntType, (union AnyValue *)&Iy2, FALSE); + VariableDefinePlatformVar(NULL, "u1", &IntType, (union AnyValue *)&Iu1, FALSE); + VariableDefinePlatformVar(NULL, "u2", &IntType, (union AnyValue *)&Iu2, FALSE); + VariableDefinePlatformVar(NULL, "v1", &IntType, (union AnyValue *)&Iv1, FALSE); + VariableDefinePlatformVar(NULL, "v2", &IntType, (union AnyValue *)&Iv2, FALSE); + VariableDefinePlatformVar(NULL, "gpslat", &IntType, (union AnyValue *)&GPSlat, FALSE); + VariableDefinePlatformVar(NULL, "gpslon", &IntType, (union AnyValue *)&GPSlon, FALSE); + VariableDefinePlatformVar(NULL, "gpsalt", &IntType, (union AnyValue *)&GPSalt, FALSE); + VariableDefinePlatformVar(NULL, "gpsfix", &IntType, (union AnyValue *)&GPSfix, FALSE); + VariableDefinePlatformVar(NULL, "gpssat", &IntType, (union AnyValue *)&GPSsat, FALSE); + VariableDefinePlatformVar(NULL, "gpsutc", &IntType, (union AnyValue *)&GPSutc, FALSE); +} + +void Csignal(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // check for kbhit, return t or nil +{ + if (getsignal()) + ReturnValue->Val->Integer = 1; + else + ReturnValue->Val->Integer = 0; +} + +void Cinput(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return 0-9 from console input +{ + ReturnValue->Val->Integer = getch(); +} + +void Cdelay(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int del; + + del = Param[0]->Val->Integer; + if ((del < 0) || (del > 1000000)) + return; + delayMS(del); +} + +void Crand(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = (int)rand() % (unsigned int)(Param[0]->Val->Integer + 1); +} + +void Ctime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = (int)readRTC(); +} + +void Ciodir(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int dir; + + dir = Param[0]->Val->Integer; + *pPORTHIO_DIR = ((dir << 10) & 0xFC00) + (*pPORTHIO_DIR & 0x03FF); // H15/14/13/12/11/10 - 1=output, 0=input + *pPORTHIO_INEN = (((~dir) << 10) & 0xFC00) + (*pPORTHIO_INEN & 0x03FF); // invert dir bits to enable inputs +} + +void Cioread(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = (*pPORTHIO >> 10) & 0x003F; +} + +void Ciowrite(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + *pPORTHIO = ((Param[0]->Val->Integer << 10) & 0xFC00) + (*pPORTHIO & 0x03FF); +} + +void Cpeek(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int size, ptr; + unsigned char *cp; + unsigned short *sp; + unsigned int *ip; + + /* x = peek(addr, size); + mask ptr to align with word size */ + ptr = Param[0]->Val->Integer; + size = Param[1]->Val->Integer; + switch (size) { + case 1: // char * + cp = (unsigned char *)ptr; + ReturnValue->Val->Integer = (int)((unsigned int)*cp); + break; + case 2: // short * + sp = (unsigned short *)(ptr & 0xFFFFFFFE); // align with even boundary + ReturnValue->Val->Integer = (int)((unsigned short)*sp); + break; + case 4: // int * + ip = (unsigned int *)(ptr & 0xFFFFFFFC); // aling with quad boundary + ReturnValue->Val->Integer = (int)*ip; + break; + default: + ReturnValue->Val->Integer = 0; + break; + } +} + +void Cpoke(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int size, ptr, val; + unsigned char *cp; + unsigned short *sp; + unsigned int *ip; + + /* x = poke(addr, size, val); + mask ptr to align with word size */ + ptr = Param[0]->Val->Integer; + size = Param[1]->Val->Integer; + val = Param[2]->Val->Integer; + switch (size) { + case 1: // char * + cp = (unsigned char *)ptr; + *cp = (unsigned char)(val & 0x000000FF); + break; + case 2: // short * + sp = (unsigned short *)(ptr & 0xFFFFFFFE); + *sp = (unsigned short)(val & 0x0000FFFF); + break; + case 4: // int * + ip = (unsigned int *)(ptr & 0xFFFFFFFC); + *ip = val; + break; + default: // don't bother with bad value + break; + } +} + +void Cencoders(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + unsigned int ix; + + ix = encoders(); // read left and right encoders; save data to C globals lcount, rcount + Elcount = (ix >> 16) & 0x0000FFFF; + Ercount = ix & 0x0000FFFF; +} + +void Cmotors(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + lspeed = Param[0]->Val->Integer; + if ((lspeed < -100) || (lspeed > 100)) + ProgramFail(NULL, "motors(): left motor value out of range"); + rspeed = Param[1]->Val->Integer; + if ((rspeed < -100) || (rspeed > 100)) + ProgramFail(NULL, "motors(): right motor value out of range"); + if (!pwm1_init) { + initPWM(); + pwm1_init = 1; + pwm1_mode = PWM_PWM; + base_speed = 50; + } + setPWM(lspeed, rspeed); +} + +void Cmotors2(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + lspeed2 = Param[0]->Val->Integer; + if ((lspeed2 < -100) || (lspeed2 > 100)) + ProgramFail(NULL, "motors2(): left motor value out of range"); + rspeed2 = Param[1]->Val->Integer; + if ((rspeed2 < -100) || (rspeed2 > 100)) + ProgramFail(NULL, "motors2(): right motor value out of range"); + if (!pwm2_init) { + initPWM2(); + pwm2_init = 1; + pwm2_mode = PWM_PWM; + base_speed2 = 50; + } + setPWM2(lspeed2, rspeed2); +} + +void Cservos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int lspeed, rspeed; + + lspeed = Param[0]->Val->Integer; + if ((lspeed < 0) || (lspeed > 100)) + ProgramFail(NULL, "servos(): TMR2 value out of range"); + rspeed = Param[1]->Val->Integer; + if ((rspeed < 0) || (rspeed > 100)) + ProgramFail(NULL, "servos()(): TMR3 value out of range"); + if (!pwm1_init) { + initPPM1(); + pwm1_init = 1; + pwm1_mode = PWM_PPM; + } + setPPM1(lspeed, rspeed); +} + +void Cservos2(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int lspeed, rspeed; + + lspeed = Param[0]->Val->Integer; + if ((lspeed < 0) || (lspeed > 100)) + ProgramFail(NULL, "servos2(): TMR6 value out of range"); + rspeed = Param[1]->Val->Integer; + if ((rspeed < 0) || (rspeed > 100)) + ProgramFail(NULL, "servos2(): TMR7 value out of range"); + if (!pwm2_init) { + initPPM2(); + pwm2_init = 1; + pwm2_mode = PWM_PPM; + } + setPPM2(lspeed, rspeed); +} + +void Claser(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // laser(1) turns them on, laser(0) turns them off +{ + *pPORTHIO &= 0xFD7F; // turn off both lasers + switch (Param[0]->Val->Integer) { + case 1: + *pPORTHIO |= 0x0080; // turn on left laser + break; + case 2: + *pPORTHIO |= 0x0200; // turn on right laser + break; + case 3: + *pPORTHIO |= 0x0280; // turn on both lasers + break; + } +} + +void Csonar(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // read sonar module +{ + unsigned int i; + i = Param[0]->Val->Integer; + if ((i<1) || (i>4)) { + ProgramFail(NULL, "sonar(): 1, 2, 3, 4 are only valid selections"); + } + sonar(); + ReturnValue->Val->Integer = sonar_data[i] / 100; +} + +void Crange(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = laser_range(0); +} + +void Cbattery(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + if (*pPORTHIO & 0x0004) + ReturnValue->Val->Integer = 0; // low battery voltage detected + else + ReturnValue->Val->Integer = 1; // battery voltage okay +} + +void Cvcolor(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // set color bin - + // vcolor (color, ymin, ymax, umin, umax, vmin, vmax); +{ + int ix; + + ix = Param[0]->Val->Integer; + ymin[ix] = Param[1]->Val->Integer; + ymax[ix] = Param[2]->Val->Integer; + umin[ix] = Param[3]->Val->Integer; + umax[ix] = Param[4]->Val->Integer; + vmin[ix] = Param[5]->Val->Integer; + vmax[ix] = Param[6]->Val->Integer; +} + +void Cvcam(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // set camera functions - + // enable/disable AGC(4) / AWB(2) / AEC(1) camera controls + // vcam(7) = AGC+AWB+AEC on vcam(0) = AGC+AWB+AEC off +{ + unsigned char cx, i2c_data[2]; + + cx = (unsigned char)Param[0]->Val->Integer & 0x07; + i2c_data[0] = 0x13; + i2c_data[1] = 0xC0 + cx; + i2cwrite(0x30, (unsigned char *)i2c_data, 1, SCCB_ON); // OV9655 + i2cwrite(0x21, (unsigned char *)i2c_data, 1, SCCB_ON); // OV7725 +} + +void Cvfind(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // set color bin - + // vfind (color, x1, x2, y1, y2); +{ + int ix, x1, x2, y1, y2; + + ix = Param[0]->Val->Integer; + x1 = Param[1]->Val->Integer; + x2 = Param[2]->Val->Integer; + y1 = Param[3]->Val->Integer; + y2 = Param[4]->Val->Integer; + ReturnValue->Val->Integer = vfind((unsigned char *)FRAME_BUF, ix, x1, x2, y1, y2); +} + +void Cvcap(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + grab_frame(); // capture frame for processing +} + +void Cvrcap(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + grab_reference_frame(); // capture reference frame for differencing +} + +void Cvdiff(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + frame_diff_flag = Param[0]->Val->Integer; // set/clear frame_diff_flag +} + +void Cvpix(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int x, y, ix; + x = Param[0]->Val->Integer; + y = Param[1]->Val->Integer; + ix = vpix((unsigned char *)FRAME_BUF, x, y); + Iy1 = ((ix>>16) & 0x000000FF); // Y1 + Iu1 = ((ix>>24) & 0x000000FF); // U + Iv1 = ((ix>>8) & 0x000000FF); // V +} + +void Cvscan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int col, thresh, ix; + col = Param[0]->Val->Integer; + if ((col < 1) || (col > 9)) + ProgramFail(NULL, "vscan(): number of columns must be between 1 and 9"); + thresh = Param[1]->Val->Integer; + if ((thresh < 0) || (thresh > 9999)) + ProgramFail(NULL, "vscan(): threshold must be between 0 and 9999"); + ix = vscan((unsigned char *)SPI_BUFFER1, (unsigned char *)FRAME_BUF, thresh, (unsigned int)col, (unsigned int *)&ScanVect[0]); + ReturnValue->Val->Integer = ix; +} + +void Cvmean(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + vmean((unsigned char *)FRAME_BUF); + Iy1 = mean[0]; + Iu1 = mean[1]; + Iv1 = mean[2]; +} + +// search for blob by color, index; return center point X,Y and width Z +void Cvblob(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, iblob, numblob; + + ix = Param[0]->Val->Integer; + if (ix > MAX_COLORS) + ProgramFail(NULL, "blob(): invalid color index"); + iblob = Param[1]->Val->Integer; + if (iblob > MAX_BLOBS) + ProgramFail(NULL, "blob(): invalid blob index"); + + numblob = vblob((unsigned char *)FRAME_BUF, (unsigned char *)FRAME_BUF3, ix); + + if ((blobcnt[iblob] == 0) || (numblob == -1)) { + Blobcnt = 0; + } else { + Blobcnt = blobcnt[iblob]; + Blobx1 = blobx1[iblob]; + Blobx2 = blobx2[iblob]; + Bloby1 = bloby1[iblob]; + Bloby2 = bloby2[iblob]; + } + ReturnValue->Val->Integer = numblob; +} + +void Cvjpeg (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + unsigned int image_size, qual; + unsigned char *output_start, *output_end; + + qual = Param[0]->Val->Integer; + if ((qual < 1) || (qual > 8)) + ProgramFail(NULL, "vjpeg(): quality parameter out of range"); + + output_start = (unsigned char *)JPEG_BUF; + output_end = encode_image((unsigned char *)FRAME_BUF, output_start, qual, + FOUR_TWO_TWO, imgWidth, imgHeight); + image_size = (unsigned int)(output_end - output_start); + + ReturnValue->Val->Integer = image_size; +} + +void Cvsend (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + unsigned int ix, image_size; + unsigned char *cp; + + image_size = Param[0]->Val->Integer; + if ((image_size < 0) || (image_size > 200000)) + ProgramFail(NULL, "vsend(): image size out of range"); + + led1_on(); + + cp = (unsigned char *)JPEG_BUF; + for (ix=0; ixVal->Integer = ix; +} + +void Ctilt(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return reading from HMC6352 I2C compass +{ + unsigned int ix; + + ix = (unsigned int)Param[0]->Val->Integer; + if ((ix<1) || (ix>3)) + ProgramFail(NULL, "tilt(): invalid channel"); + ReturnValue->Val->Integer = tilt(ix); +} + +void Canalog(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return reading from HMC6352 I2C compass +{ + unsigned char i2c_data[3], device_id; + unsigned int ix, channel; + unsigned char mask1[] = { 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x08 }; + unsigned char mask2[] = { 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00 }; + + // decide which i2c device based on channel range + ix = (unsigned char)Param[0]->Val->Integer; + if ((ix<1) || (ix>28)) + ProgramFail(NULL, "analog(): invalid channel"); + device_id = 0; + switch (ix / 10) { + case 0: + device_id = 0x20; // channels 1-8 + break; + case 1: + device_id = 0x23; // channels 11-18 + break; + case 2: + device_id = 0x24; // channels 21-28 + break; + } + channel = ix % 10; + if ((channel<1) || (channel>8)) + ProgramFail(NULL, "analog(): invalid channel"); + + // set timer register 3 + i2c_data[0] = 0x03; + i2c_data[1] = 0x01; + i2cwrite(device_id, (unsigned char *)i2c_data, 1, SCCB_ON); + + // set analog channel + i2c_data[0] = 0x02; + i2c_data[1] = mask1[channel-1]; + i2c_data[2] = mask2[channel-1]; + i2cwritex(device_id, (unsigned char *)i2c_data, 3, SCCB_ON); + + // small delay + delayUS(1000); + + // read data + i2c_data[0] = 0x00; + i2cread(device_id, (unsigned char *)i2c_data, 2, SCCB_ON); + ix = (((i2c_data[0] & 0x0F) << 8) + i2c_data[1]); + ReturnValue->Val->Integer = ix; +} + +void Cgps(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + gps_parse(); + GPSlat = gps_gga.lat; + GPSlon = gps_gga.lon; + GPSalt = gps_gga.alt; + GPSfix = gps_gga.fix; + GPSsat = gps_gga.sat; + GPSutc = gps_gga.utc; +} + +void Creadi2c(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // syntax val = readi2c(device, register); +{ + unsigned char i2c_device, i2c_data[2]; + + i2c_device = (unsigned char)Param[0]->Val->Integer; + i2c_data[0] = (unsigned char)Param[1]->Val->Integer; + + i2cread(i2c_device, (unsigned char *)i2c_data, 1, SCCB_OFF); + ReturnValue->Val->Integer = ((int)i2c_data[0] & 0x000000FF); +} + +void Creadi2c2(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // syntax two_byte_val = readi2c(device, register); +{ + unsigned char i2c_device, i2c_data[2]; + + i2c_device = (unsigned char)Param[0]->Val->Integer; + i2c_data[0] = (unsigned char)Param[1]->Val->Integer; + + i2cread(i2c_device, (unsigned char *)i2c_data, 2, SCCB_OFF); + ReturnValue->Val->Integer = (((unsigned int)i2c_data[0] << 8) + i2c_data[1]); +} + +void Cwritei2c(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // syntax writei2c(device, register, value); +{ + unsigned char i2c_device, i2c_data[2]; + + i2c_device = (unsigned char)Param[0]->Val->Integer; + i2c_data[0] = (unsigned char)Param[1]->Val->Integer; + i2c_data[1] = (unsigned char)Param[2]->Val->Integer; + + i2cwrite(i2c_device, (unsigned char *)i2c_data, 1, SCCB_OFF); +} + +void Csin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // sin(angle) +{ + int ix; + + ix = Param[0]->Val->Integer; // input to function is angle in degrees + ReturnValue->Val->Integer = sin(ix); +} + +void Ccos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // cos(angle) +{ + int ix; + + ix = Param[0]->Val->Integer; // input to function is angle in degrees + ReturnValue->Val->Integer = cos(ix); +} + +void Ctan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // tan(angle) +{ + int ix; + + ix = Param[0]->Val->Integer; // input to function is angle in degrees + ReturnValue->Val->Integer = tan(ix); +} + +void Casin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // asin(y,hyp) +{ + int y, hyp; + y = Param[0]->Val->Integer; + hyp = Param[1]->Val->Integer; + if (y > hyp) + ProgramFail(NULL, "asin(): opposite greater than hypotenuse"); + ReturnValue->Val->Integer = asin(y, hyp); +} + +void Cacos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // acos(x,hyp) +{ + int x, hyp; + x = Param[0]->Val->Integer; + hyp = Param[1]->Val->Integer; + if (x > hyp) + ProgramFail(NULL, "acos(): adjacent greater than hypotenuse"); + ReturnValue->Val->Integer = acos(x, hyp); +} + +void Catan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // atan(y,x) +{ + int x ,y; + y = Param[0]->Val->Integer; + x = Param[1]->Val->Integer; + ReturnValue->Val->Integer = atan(y, x); +} + +void Cgps_head(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // gps_head(lat1, lon1, lat2, lon2) +{ + int lat1, lon1, lat2, lon2; + lat1 = Param[0]->Val->Integer; + lon1 = Param[1]->Val->Integer; + lat2 = Param[2]->Val->Integer; + lon2 = Param[3]->Val->Integer; + ReturnValue->Val->Integer = gps_head(lat1, lon1, lat2, lon2); +} + +void Cgps_dist(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // gps_dist(lat1, lon1, lat2, lon2) +{ + int lat1, lon1, lat2, lon2; + lat1 = Param[0]->Val->Integer; + lon1 = Param[1]->Val->Integer; + lat2 = Param[2]->Val->Integer; + lon2 = Param[3]->Val->Integer; + ReturnValue->Val->Integer = gps_dist(lat1, lon1, lat2, lon2); +} + +void Csqrt(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // sqrt(x) +{ + int x; + x = Param[0]->Val->Integer; + ReturnValue->Val->Integer = isqrt(x); +} + +void Cnnset(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, i1; + + ix = Param[0]->Val->Integer; + if (ix > NUM_NPATTERNS) + ProgramFail(NULL, "nnset(): invalid index"); + for (i1=0; i1<8; i1++) + npattern[ix*8 + i1] = (unsigned char)Param[i1+1]->Val->Integer; +} + +void Cnnshow(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix; + + ix = Param[0]->Val->Integer; + if (ix > NUM_NPATTERNS) + ProgramFail(NULL, "nnshow(): invalid index"); + nndisplay(ix); +} + +void Cnninit(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + nninit_network(); +} + +void Cnntrain(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, i1; + + nntrain_network(10000); + for (ix=0; ixVal->Integer; + for (i2=0; i2<8; i2++) { + if (ch & nmask[i2]) + N_IN(ix++) = 1024; + else + N_IN(ix++) = 0; + } + } + nncalculate_network(); + ix = 0; + max = 0; + for (i1=0; i1Val->Integer = ix; +} + +void Cnnmatchblob(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, i1, max; + + ix = Param[0]->Val->Integer; + if (ix > MAX_BLOBS) + ProgramFail(NULL, "nnmatchblob(): invalid blob index"); + if (!blobcnt[ix]) + ProgramFail(NULL, "nnmatchblob(): not a valid blob"); + /* use data still in blob_buf[] (FRAME_BUF3) + square the aspect ratio of x1, x2, y1, y2 + then subsample blob pixels to populate N_IN(0:63) with 0:1024 values + then nncalculate_network() and display the N_OUT() results */ + nnscale8x8((unsigned char *)FRAME_BUF3, blobix[ix], blobx1[ix], blobx2[ix], + bloby1[ix], bloby2[ix], imgWidth, imgHeight); + nncalculate_network(); + ix = 0; + max = 0; + for (i1=0; i1Val->Integer = ix; +} + +void Cnnlearnblob (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix; + + ix = Param[0]->Val->Integer; + if (ix > NUM_NPATTERNS) + ProgramFail(NULL, "nnlearnblob(): invalid index"); + if (!blobcnt[0]) + ProgramFail(NULL, "nnlearnblob(): no blob to grab"); + nnscale8x8((unsigned char *)FRAME_BUF3, blobix[0], blobx1[0], blobx2[0], + bloby1[0], bloby2[0], imgWidth, imgHeight); + nnpack8x8(ix); + nndisplay(ix); +} + +void Cautorun (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, t0; + unsigned char ch; + + ix = Param[0]->Val->Integer; + t0 = readRTC(); + while (readRTC() < (t0 + ix*1000)) { // watch for ESC in 'ix' seconds + if (getchar(&ch)) { + if (ch == 0x1B) { // if ESC found, exit picoC + printf("found ESC\r\n"); + ExitBuf[40] = 1; + longjmp(ExitBuf, 1); + } + } + } +} + +void Clineno (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + ReturnValue->Val->Integer = Parser->Line; +} + +void Cerrormsg (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + PlatformErrorPrefix(Parser); + LibPrintf(Parser, ReturnValue, Param, NumArgs); +} + +/* nothing here because we don't add any functions until srv1.h is #included */ +struct LibraryFunction PlatformLibrary[] = +{ + { NULL, NULL } +}; + +/* list of all library functions included with srv1.h */ +struct LibraryFunction SRV1Functions[] = +{ + { Csignal, "int signal();" }, + { Cinput, "int input();" }, + { Cdelay, "void delay(int);" }, + { Crand, "int rand(int);" }, + { Ctime, "int time();" }, + { Ciodir, "void iodir(int);" }, + { Cioread, "int ioread();" }, + { Ciowrite, "void iowrite(int);" }, + { Cpeek, "int peek(int, int);" }, + { Cpoke, "void poke(int, int, int);" }, + { Cmotors, "void motors(int, int);" }, + { Cmotors2, "void motors2(int, int);" }, + { Cservos, "void servos(int, int);" }, + { Cservos2, "void servos2(int, int);" }, + { Cencoders, "void encoders();" }, + { Claser, "void laser(int);" }, + { Csonar, "int sonar(int);" }, + { Crange, "int range();" }, + { Cbattery, "int battery();" }, + { Cvcolor, "void vcolor(int, int, int, int, int, int, int);" }, + { Cvfind, "int vfind(int, int, int, int, int);" }, + { Cvcam, "void vcam(int);" }, + { Cvcap, "void vcap();" }, + { Cvrcap, "void vrcap();" }, + { Cvdiff, "void vdiff(int);" }, + { Cvpix, "void vpix(int, int);" }, + { Cvscan, "int vscan(int, int);" }, + { Cvmean, "void vmean();" }, + { Cvblob, "int vblob(int, int);" }, + { Cvjpeg, "int vjpeg(int);" }, + { Cvsend, "void vsend(int);" }, + { Ccompass, "int compass();" }, + { Canalog, "int analog(int);" }, + { Ctilt, "int tilt(int);" }, + { Cgps, "void gps();" }, + { Creadi2c, "int readi2c(int, int);" }, + { Creadi2c2, "int readi2c2(int, int);" }, + { Cwritei2c, "void writei2c(int, int, int);" }, + { Csin, "int sin(int);" }, + { Ccos, "int cos(int);" }, + { Ctan, "int tan(int);" }, + { Casin, "int asin(int, int);" }, + { Cacos, "int acos(int, int);" }, + { Catan, "int atan(int, int);" }, + { Cgps_head, "int gps_head(int, int, int, int);" }, + { Cgps_dist, "int gps_dist(int, int, int, int);" }, + { Csqrt, "int sqrt(int);" }, + { Cnnshow, "void nnshow(int);" }, + { Cnnset, "void nnset(int, int, int, int, int, int, int, int, int);" }, + { Cnninit, "void nninit();" }, + { Cnntrain, "void nntrain();" }, + { Cnntest, "int nntest(int, int, int, int, int, int, int, int);" }, + { Cnnmatchblob, "int nnmatchblob(int);" }, + { Cnnlearnblob, "void nnlearnblob(int);" }, + { Cautorun, "void autorun(int);" }, + { Clineno, "int lineno();" }, + { Cerrormsg, "void errormsg(char *);" }, + { NULL, NULL } +}; + +void PlatformLibraryInit() +{ + IncludeRegister("srv1.h", &SRV1SetupFunc, &SRV1Functions[0], NULL); +} diff --git a/src/cmd/picoc-1/platform/library_surveyor.c b/src/cmd/picoc-1/platform/library_surveyor.c new file mode 100644 index 0000000..283aff2 --- /dev/null +++ b/src/cmd/picoc-1/platform/library_surveyor.c @@ -0,0 +1,944 @@ +#include "../interpreter.h" +#include "../picoc.h" + +static int Blobcnt, Blobx1, Blobx2, Bloby1, Bloby2, Iy1, Iy2, Iu1, Iu2, Iv1, Iv2; +static int Cxmin, Cxmax, Cymin, Cymax; +static int GPSlat, GPSlon, GPSalt, GPSfix, GPSsat, GPSutc, Elcount, Ercount; +static int ScanVect[16], NNVect[NUM_OUTPUT]; + +void PlatformLibraryInit() +{ + struct ValueType *IntArrayType; + + IntArrayType = TypeGetMatching(NULL, &IntType, TypeArray, 16, StrEmpty, TRUE); + VariableDefinePlatformVar(NULL, "scanvect", IntArrayType, (union AnyValue *)&ScanVect, FALSE); + VariableDefinePlatformVar(NULL, "neuron", IntArrayType, (union AnyValue *)&NNVect, FALSE); + VariableDefinePlatformVar(NULL, "xbuf", CharArrayType, (union AnyValue *)&xbuff, FALSE); + VariableDefinePlatformVar(NULL, "blobcnt", &IntType, (union AnyValue *)&Blobcnt, FALSE); + VariableDefinePlatformVar(NULL, "blobx1", &IntType, (union AnyValue *)&Blobx1, FALSE); + VariableDefinePlatformVar(NULL, "blobx2", &IntType, (union AnyValue *)&Blobx2, FALSE); + VariableDefinePlatformVar(NULL, "bloby1", &IntType, (union AnyValue *)&Bloby1, FALSE); + VariableDefinePlatformVar(NULL, "bloby2", &IntType, (union AnyValue *)&Bloby2, FALSE); + VariableDefinePlatformVar(NULL, "lcount", &IntType, (union AnyValue *)&Elcount, FALSE); + VariableDefinePlatformVar(NULL, "rcount", &IntType, (union AnyValue *)&Ercount, FALSE); + VariableDefinePlatformVar(NULL, "y1", &IntType, (union AnyValue *)&Iy1, FALSE); + VariableDefinePlatformVar(NULL, "y2", &IntType, (union AnyValue *)&Iy2, FALSE); + VariableDefinePlatformVar(NULL, "u1", &IntType, (union AnyValue *)&Iu1, FALSE); + VariableDefinePlatformVar(NULL, "u2", &IntType, (union AnyValue *)&Iu2, FALSE); + VariableDefinePlatformVar(NULL, "v1", &IntType, (union AnyValue *)&Iv1, FALSE); + VariableDefinePlatformVar(NULL, "v2", &IntType, (union AnyValue *)&Iv2, FALSE); + VariableDefinePlatformVar(NULL, "gpslat", &IntType, (union AnyValue *)&GPSlat, FALSE); + VariableDefinePlatformVar(NULL, "gpslon", &IntType, (union AnyValue *)&GPSlon, FALSE); + VariableDefinePlatformVar(NULL, "gpsalt", &IntType, (union AnyValue *)&GPSalt, FALSE); + VariableDefinePlatformVar(NULL, "gpsfix", &IntType, (union AnyValue *)&GPSfix, FALSE); + VariableDefinePlatformVar(NULL, "gpssat", &IntType, (union AnyValue *)&GPSsat, FALSE); + VariableDefinePlatformVar(NULL, "gpsutc", &IntType, (union AnyValue *)&GPSutc, FALSE); + VariableDefinePlatformVar(NULL, "cxmin", &IntType, (union AnyValue *)&Cxmin, FALSE); + VariableDefinePlatformVar(NULL, "cxmax", &IntType, (union AnyValue *)&Cxmax, FALSE); + VariableDefinePlatformVar(NULL, "cymin", &IntType, (union AnyValue *)&Cymin, FALSE); + VariableDefinePlatformVar(NULL, "cymax", &IntType, (union AnyValue *)&Cymax, FALSE); + LibraryAdd(&GlobalTable, "platform library", &PlatformLibrary[0]); +} + +void Csignal(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // check for kbhit, return t or nil +{ + ReturnValue->Val->Integer = getsignal(); +} + +void Csignal1(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // check for kbhit, return t or nil +{ + ReturnValue->Val->Integer = uart1Signal(); +} + +void Cinput(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return 0-9 from console input +{ + ReturnValue->Val->Integer = getch(); +} + +void Cinput1(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return 0-9 from console input +{ + ReturnValue->Val->Integer = uart1GetCh(); +} + +void Cread_int(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return 0-9 from console input +{ + int ix, sign; + unsigned char ch; + + ix = 0; + sign = 1; + while (1) { + ch = getch(); + if (ch == '-') { + sign = -1; + continue; + } + if ((ch < '0') || (ch > '9')) { // if not '-' or 0-9, we're done + ReturnValue->Val->Integer = ix * sign; + return; + } + ix = (ix * 10) + (ch & 0x0F); + } +} + +void Cread_str(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // read string from console +{ + int ix; + unsigned char ch; + + ix = 0; + char *cp = (char *)Param[0]->Val->Pointer; + while (1) { + ch = getch(); + cp[ix++] = ch; + if ((ch == 0) || (ch == 0x01)) { // null or ctrl-A + ix--; + cp[ix] = 0; + break; + } + if (ix > 1023) { + cp[ix] = 0; + ix--; + break; + } + } + ReturnValue->Val->Integer = ix; +} + +void Cinit_uart1(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return 0-9 from console input +{ + int ii; + ii = Param[0]->Val->Integer; // ii = baudrate for uart1 + init_uart1(ii); +} + +void Coutput(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return 0-9 from console input +{ + int ch; + ch = Param[0]->Val->Integer; + putchar((unsigned char)ch); +} + +void Coutput1(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return 0-9 from console input +{ + int ch; + ch = Param[0]->Val->Integer; + uart1SendChar((unsigned char)ch); +} + +void Cdelay(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int del; + + del = Param[0]->Val->Integer; + if ((del < 0) || (del > 1000000)) + return; + delayMS(del); +} + +void Crand(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = (int)rand() % (unsigned int)(Param[0]->Val->Integer + 1); +} + +void Ctime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = (int)readRTC(); +} + +void Ciodir(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int dir; + + dir = Param[0]->Val->Integer; + *pPORTHIO_DIR = ((dir << 10) & 0xFC00) + (*pPORTHIO_DIR & 0x03FF); // H15/14/13/12/11/10 - 1=output, 0=input + *pPORTHIO_INEN = (((~dir) << 10) & 0xFC00) + (*pPORTHIO_INEN & 0x03FF); // invert dir bits to enable inputs +} + +void Cioread(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = (*pPORTHIO >> 10) & 0x003F; +} + +void Ciowrite(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + *pPORTHIO = ((Param[0]->Val->Integer << 10) & 0xFC00) + (*pPORTHIO & 0x03FF); +} + +void Cpeek(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int size, ptr; + unsigned char *cp; + unsigned short *sp; + unsigned int *ip; + + /* x = peek(addr, size); + mask ptr to align with word size */ + ptr = Param[0]->Val->Integer; + size = Param[1]->Val->Integer; + switch (size) { + case 1: // char * + cp = (unsigned char *)ptr; + ReturnValue->Val->Integer = (int)((unsigned int)*cp); + break; + case 2: // short * + sp = (unsigned short *)(ptr & 0xFFFFFFFE); // align with even boundary + ReturnValue->Val->Integer = (int)((unsigned short)*sp); + break; + case 4: // int * + ip = (unsigned int *)(ptr & 0xFFFFFFFC); // aling with quad boundary + ReturnValue->Val->Integer = (int)*ip; + break; + default: + ReturnValue->Val->Integer = 0; + break; + } +} + +void Cpoke(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int size, ptr, val; + unsigned char *cp; + unsigned short *sp; + unsigned int *ip; + + /* x = poke(addr, size, val); + mask ptr to align with word size */ + ptr = Param[0]->Val->Integer; + size = Param[1]->Val->Integer; + val = Param[2]->Val->Integer; + switch (size) { + case 1: // char * + cp = (unsigned char *)ptr; + *cp = (unsigned char)(val & 0x000000FF); + break; + case 2: // short * + sp = (unsigned short *)(ptr & 0xFFFFFFFE); + *sp = (unsigned short)(val & 0x0000FFFF); + break; + case 4: // int * + ip = (unsigned int *)(ptr & 0xFFFFFFFC); + *ip = val; + break; + default: // don't bother with bad value + break; + } +} + +void Cencoders(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + unsigned int ix; + + ix = encoders(); // read left and right encoders; save data to C globals lcount, rcount + Elcount = (ix >> 16) & 0x0000FFFF; + Ercount = ix & 0x0000FFFF; +} + +void Cencoderx(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return reading from HMC6352 I2C compass +{ + int ix; + + ix = (unsigned char)Param[0]->Val->Integer; + if ((ix<0) || (ix>7)) + ProgramFail(NULL, "encoderx(): invalid channel"); + ReturnValue->Val->Integer = encoder_4wd(ix); +} + +void Cmotors(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + lspeed = Param[0]->Val->Integer; + if ((lspeed < -100) || (lspeed > 100)) + ProgramFail(NULL, "motors(): left motor value out of range"); + rspeed = Param[1]->Val->Integer; + if ((rspeed < -100) || (rspeed > 100)) + ProgramFail(NULL, "motors(): right motor value out of range"); + if (!pwm1_init) { + initPWM(); + pwm1_init = 1; + pwm1_mode = PWM_PWM; + base_speed = 50; + } + setPWM(lspeed, rspeed); +} + +void Cmotors2(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + lspeed2 = Param[0]->Val->Integer; + if ((lspeed2 < -100) || (lspeed2 > 100)) + ProgramFail(NULL, "motors2(): left motor value out of range"); + rspeed2 = Param[1]->Val->Integer; + if ((rspeed2 < -100) || (rspeed2 > 100)) + ProgramFail(NULL, "motors2(): right motor value out of range"); + if (!pwm2_init) { + initPWM2(); + pwm2_init = 1; + pwm2_mode = PWM_PWM; + base_speed2 = 50; + } + setPWM2(lspeed2, rspeed2); +} + +/* motor control for SRV-4WD controller */ +void Cmotorx(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + unsigned char ch; + int ls, rs; + + ls = Param[0]->Val->Integer; + if ((ls < -100) || (ls > 100)) + ProgramFail(NULL, "motors(): left motor value out of range"); + ls = (ls * 127) / 100; // scale to full +/-127 range + rs = Param[1]->Val->Integer; + if ((rs < -100) || (rs > 100)) + ProgramFail(NULL, "motors(): right motor value out of range"); + rs = (rs * 127) / 100; // scale to full +/-127 range + if (xwd_init == 0) { + xwd_init = 1; + init_uart1(115200); + delayMS(10); + } + uart1SendChar('x'); + uart1SendChar((char)ls); + uart1SendChar((char)rs); + while (uart1GetChar(&ch)) // flush the receive buffer + continue; +} + +void Cservos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int lspeed, rspeed; + + lspeed = Param[0]->Val->Integer; + if ((lspeed < 0) || (lspeed > 100)) + ProgramFail(NULL, "servos(): TMR2 value out of range"); + rspeed = Param[1]->Val->Integer; + if ((rspeed < 0) || (rspeed > 100)) + ProgramFail(NULL, "servos()(): TMR3 value out of range"); + if (!pwm1_init) { + initPPM1(); + pwm1_init = 1; + pwm1_mode = PWM_PPM; + } + setPPM1(lspeed, rspeed); +} + +void Cservos2(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int lspeed, rspeed; + + lspeed = Param[0]->Val->Integer; + if ((lspeed < 0) || (lspeed > 100)) + ProgramFail(NULL, "servos2(): TMR6 value out of range"); + rspeed = Param[1]->Val->Integer; + if ((rspeed < 0) || (rspeed > 100)) + ProgramFail(NULL, "servos2(): TMR7 value out of range"); + if (!pwm2_init) { + initPPM2(); + pwm2_init = 1; + pwm2_mode = PWM_PPM; + } + setPPM2(lspeed, rspeed); +} + +void Claser(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // laser(1) turns them on, laser(0) turns them off +{ + *pPORTHIO &= 0xFD7F; // turn off both lasers + switch (Param[0]->Val->Integer) { + case 1: + *pPORTHIO |= 0x0080; // turn on left laser + break; + case 2: + *pPORTHIO |= 0x0200; // turn on right laser + break; + case 3: + *pPORTHIO |= 0x0280; // turn on both lasers + break; + } +} + +void Csonar(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // read sonar module +{ + unsigned int i; + i = Param[0]->Val->Integer; + if ((i<1) || (i>4)) { + ProgramFail(NULL, "sonar(): 1, 2, 3, 4 are only valid selections"); + } + sonar(); + ReturnValue->Val->Integer = sonar_data[i] / 100; +} + +void Crange(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = laser_range(0); +} + +void Cbattery(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + if (*pPORTHIO & 0x0004) + ReturnValue->Val->Integer = 0; // low battery voltage detected + else + ReturnValue->Val->Integer = 1; // battery voltage okay +} + +void Cvcolor(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // set color bin - + // vcolor (color, ymin, ymax, umin, umax, vmin, vmax); +{ + int ix; + + ix = Param[0]->Val->Integer; + ymin[ix] = Param[1]->Val->Integer; + ymax[ix] = Param[2]->Val->Integer; + umin[ix] = Param[3]->Val->Integer; + umax[ix] = Param[4]->Val->Integer; + vmin[ix] = Param[5]->Val->Integer; + vmax[ix] = Param[6]->Val->Integer; +} + +void Cvcam(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // set camera functions - + // enable/disable AGC(4) / AWB(2) / AEC(1) camera controls + // vcam(7) = AGC+AWB+AEC on vcam(0) = AGC+AWB+AEC off +{ + unsigned char cx, i2c_data[2]; + + cx = (unsigned char)Param[0]->Val->Integer & 0x07; + i2c_data[0] = 0x13; + i2c_data[1] = 0xC0 + cx; + i2cwrite(0x30, (unsigned char *)i2c_data, 1, SCCB_ON); // OV9655 + i2cwrite(0x21, (unsigned char *)i2c_data, 1, SCCB_ON); // OV7725 +} + +void Cvfind(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // set color bin - + // vfind (color, x1, x2, y1, y2); +{ + int ix, x1, x2, y1, y2; + + ix = Param[0]->Val->Integer; + x1 = Param[1]->Val->Integer; + x2 = Param[2]->Val->Integer; + y1 = Param[3]->Val->Integer; + y2 = Param[4]->Val->Integer; + ReturnValue->Val->Integer = vfind((unsigned char *)FRAME_BUF, ix, x1, x2, y1, y2); +} + +void Cvcap(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + grab_frame(); // capture frame for processing +} + +void Cvrcap(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + grab_reference_frame(); // capture reference frame for differencing +} + +void Cvdiff(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + frame_diff_flag = Param[0]->Val->Integer; // set/clear frame_diff_flag +} + +void Cvpix(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int x, y, ix; + x = Param[0]->Val->Integer; + y = Param[1]->Val->Integer; + ix = vpix((unsigned char *)FRAME_BUF, x, y); + Iy1 = ((ix>>16) & 0x000000FF); // Y1 + Iu1 = ((ix>>24) & 0x000000FF); // U + Iv1 = ((ix>>8) & 0x000000FF); // V +} + +void Cvscan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + int col, thresh, ix; + col = Param[0]->Val->Integer; + if ((col < 1) || (col > 9)) + ProgramFail(NULL, "vscan(): number of columns must be between 1 and 9"); + thresh = Param[1]->Val->Integer; + if ((thresh < 0) || (thresh > 9999)) + ProgramFail(NULL, "vscan(): threshold must be between 0 and 9999"); + ix = vscan((unsigned char *)SPI_BUFFER1, (unsigned char *)FRAME_BUF, thresh, (unsigned int)col, (unsigned int *)&ScanVect[0]); + ReturnValue->Val->Integer = ix; +} + +void Cvmean(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + vmean((unsigned char *)FRAME_BUF); + Iy1 = mean[0]; + Iu1 = mean[1]; + Iv1 = mean[2]; +} + +// search for blob by color, index; return center point X,Y and width Z +void Cvblob(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, iblob, numblob; + + ix = Param[0]->Val->Integer; + if (ix > MAX_COLORS) + ProgramFail(NULL, "blob(): invalid color index"); + iblob = Param[1]->Val->Integer; + if (iblob > MAX_BLOBS) + ProgramFail(NULL, "blob(): invalid blob index"); + + numblob = vblob((unsigned char *)FRAME_BUF, (unsigned char *)FRAME_BUF3, ix); + + if ((blobcnt[iblob] == 0) || (numblob == -1)) { + Blobcnt = 0; + } else { + Blobcnt = blobcnt[iblob]; + Blobx1 = blobx1[iblob]; + Blobx2 = blobx2[iblob]; + Bloby1 = bloby1[iblob]; + Bloby2 = bloby2[iblob]; + } + ReturnValue->Val->Integer = numblob; +} + +void Cvjpeg (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + unsigned int image_size, qual; + unsigned char *output_start, *output_end; + + qual = Param[0]->Val->Integer; + if ((qual < 1) || (qual > 8)) + ProgramFail(NULL, "vjpeg(): quality parameter out of range"); + + output_start = (unsigned char *)JPEG_BUF; + output_end = encode_image((unsigned char *)FRAME_BUF, output_start, qual, + FOUR_TWO_TWO, imgWidth, imgHeight); + image_size = (unsigned int)(output_end - output_start); + + ReturnValue->Val->Integer = image_size; +} + +void Cvsend (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + unsigned int ix, image_size; + unsigned char *cp; + + image_size = Param[0]->Val->Integer; + if ((image_size < 0) || (image_size > 200000)) + ProgramFail(NULL, "vsend(): image size out of range"); + + led1_on(); + + cp = (unsigned char *)JPEG_BUF; + for (ix=0; ixVal->Integer = ix; +} + +void Ccompassx(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return reading from HMC5843 I2C compass +{ + short x, y, z; + int ix; + + ix = (int)read_compass3x(&x, &y, &z); + Cxmin = cxmin; + Cxmax = cxmax; + Cymin = cymin; + Cymax = cymax; + ReturnValue->Val->Integer = ix; +} + +void Ccompassxcal(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return reading from HMC5843 I2C compass +{ + /* cxmin, cxmax, cymin, cymax */ + cxmin = Param[0]->Val->Integer; + cxmax = Param[1]->Val->Integer; + cymin = Param[2]->Val->Integer; + cymax = Param[3]->Val->Integer; + compass_continuous_calibration = Param[4]->Val->Integer; // continuous calibration: off = 0, on = 1 +} + +void Ctilt(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return reading from HMC6352 I2C compass +{ + unsigned int ix; + + ix = (unsigned int)Param[0]->Val->Integer; + if ((ix<1) || (ix>3)) + ProgramFail(NULL, "tilt(): invalid channel"); + ReturnValue->Val->Integer = tilt(ix); +} + +void Canalog(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return reading from HMC6352 I2C compass +{ + unsigned int ix, channel; + + ix = (unsigned char)Param[0]->Val->Integer; + if ((ix<1) || (ix>28)) + ProgramFail(NULL, "analog(): invalid channel"); + channel = ix % 10; + if ((channel<1) || (channel>8)) + ProgramFail(NULL, "analog(): invalid channel"); + ReturnValue->Val->Integer = analog(ix); +} + + +/* read analog channel 0-7 from SRV-4WD ( + channel 0 = battery level + channel 1 = 5V gyro + channel 2 = 3.3V gyro + channel 3 = IR1 + channel 4 = IR2 + channel 6 = IR3 + channel 7 = IR4 + */ +void Canalogx(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // return reading from HMC6352 I2C compass +{ + int ix; + + ix = (unsigned char)Param[0]->Val->Integer; + if ((ix<0) || (ix>7)) + ProgramFail(NULL, "analogx(): invalid channel"); + ReturnValue->Val->Integer = analog_4wd(ix); +} + +void Cgps(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + gps_parse(); + GPSlat = gps_gga.lat; + GPSlon = gps_gga.lon; + GPSalt = gps_gga.alt; + GPSfix = gps_gga.fix; + GPSsat = gps_gga.sat; + GPSutc = gps_gga.utc; +} + +void Creadi2c(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // syntax val = readi2c(device, register); +{ + unsigned char i2c_device, i2c_data[2]; + + i2c_device = (unsigned char)Param[0]->Val->Integer; + i2c_data[0] = (unsigned char)Param[1]->Val->Integer; + + i2cread(i2c_device, (unsigned char *)i2c_data, 1, SCCB_OFF); + ReturnValue->Val->Integer = ((int)i2c_data[0] & 0x000000FF); +} + +void Creadi2c2(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // syntax two_byte_val = readi2c(device, register); +{ + unsigned char i2c_device, i2c_data[2]; + + i2c_device = (unsigned char)Param[0]->Val->Integer; + i2c_data[0] = (unsigned char)Param[1]->Val->Integer; + + i2cread(i2c_device, (unsigned char *)i2c_data, 2, SCCB_OFF); + ReturnValue->Val->Integer = (((unsigned int)i2c_data[0] << 8) + i2c_data[1]); +} + +void Cwritei2c(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // syntax writei2c(device, register, value); +{ + unsigned char i2c_device, i2c_data[2]; + + i2c_device = (unsigned char)Param[0]->Val->Integer; + i2c_data[0] = (unsigned char)Param[1]->Val->Integer; + i2c_data[1] = (unsigned char)Param[2]->Val->Integer; + + i2cwrite(i2c_device, (unsigned char *)i2c_data, 1, SCCB_OFF); +} + +void Cabs(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // abs(int) +{ + int ix; + + ix = Param[0]->Val->Integer; // return absolute value of int + if (ix < 0) + ix = -ix; + ReturnValue->Val->Integer = ix; +} +void Csin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // sin(angle) +{ + int ix; + + ix = Param[0]->Val->Integer; // input to function is angle in degrees + ReturnValue->Val->Integer = sin(ix); +} + +void Ccos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // cos(angle) +{ + int ix; + + ix = Param[0]->Val->Integer; // input to function is angle in degrees + ReturnValue->Val->Integer = cos(ix); +} + +void Ctan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // tan(angle) +{ + int ix; + + ix = Param[0]->Val->Integer; // input to function is angle in degrees + ReturnValue->Val->Integer = tan(ix); +} + +void Casin(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // asin(y,hyp) +{ + int y, hyp; + y = Param[0]->Val->Integer; + hyp = Param[1]->Val->Integer; + if (y > hyp) + ProgramFail(NULL, "asin(): opposite greater than hypotenuse"); + ReturnValue->Val->Integer = asin(y, hyp); +} + +void Cacos(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // acos(x,hyp) +{ + int x, hyp; + x = Param[0]->Val->Integer; + hyp = Param[1]->Val->Integer; + if (x > hyp) + ProgramFail(NULL, "acos(): adjacent greater than hypotenuse"); + ReturnValue->Val->Integer = acos(x, hyp); +} + +void Catan(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // atan(y,x) +{ + int x ,y; + y = Param[0]->Val->Integer; + x = Param[1]->Val->Integer; + ReturnValue->Val->Integer = atan(y, x); +} + +void Cgps_head(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // gps_head(lat1, lon1, lat2, lon2) +{ + int lat1, lon1, lat2, lon2; + lat1 = Param[0]->Val->Integer; + lon1 = Param[1]->Val->Integer; + lat2 = Param[2]->Val->Integer; + lon2 = Param[3]->Val->Integer; + ReturnValue->Val->Integer = gps_head(lat1, lon1, lat2, lon2); +} + +void Cgps_dist(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // gps_dist(lat1, lon1, lat2, lon2) +{ + int lat1, lon1, lat2, lon2; + lat1 = Param[0]->Val->Integer; + lon1 = Param[1]->Val->Integer; + lat2 = Param[2]->Val->Integer; + lon2 = Param[3]->Val->Integer; + ReturnValue->Val->Integer = gps_dist(lat1, lon1, lat2, lon2); +} + +void Csqrt(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) // sqrt(x) +{ + int x; + x = Param[0]->Val->Integer; + ReturnValue->Val->Integer = isqrt(x); +} + +void Cnnset(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, i1; + + ix = Param[0]->Val->Integer; + if (ix > NUM_NPATTERNS) + ProgramFail(NULL, "nnset(): invalid index"); + for (i1=0; i1<8; i1++) + npattern[ix*8 + i1] = (unsigned char)Param[i1+1]->Val->Integer; +} + +void Cnnshow(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix; + + ix = Param[0]->Val->Integer; + if (ix > NUM_NPATTERNS) + ProgramFail(NULL, "nnshow(): invalid index"); + nndisplay(ix); +} + +void Cnninit(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + nninit_network(); +} + +void Cnntrain(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, i1; + + nntrain_network(10000); + for (ix=0; ixVal->Integer; + for (i2=0; i2<8; i2++) { + if (ch & nmask[i2]) + N_IN(ix++) = 1024; + else + N_IN(ix++) = 0; + } + } + nncalculate_network(); + ix = 0; + max = 0; + for (i1=0; i1Val->Integer = ix; +} + +void Cnnmatchblob(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, i1, max; + + ix = Param[0]->Val->Integer; + if (ix > MAX_BLOBS) + ProgramFail(NULL, "nnmatchblob(): invalid blob index"); + if (!blobcnt[ix]) + ProgramFail(NULL, "nnmatchblob(): not a valid blob"); + /* use data still in blob_buf[] (FRAME_BUF3) + square the aspect ratio of x1, x2, y1, y2 + then subsample blob pixels to populate N_IN(0:63) with 0:1024 values + then nncalculate_network() and display the N_OUT() results */ + nnscale8x8((unsigned char *)FRAME_BUF3, blobix[ix], blobx1[ix], blobx2[ix], + bloby1[ix], bloby2[ix], imgWidth, imgHeight); + nncalculate_network(); + ix = 0; + max = 0; + for (i1=0; i1Val->Integer = ix; +} + +void Cnnlearnblob (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix; + + ix = Param[0]->Val->Integer; + if (ix > NUM_NPATTERNS) + ProgramFail(NULL, "nnlearnblob(): invalid index"); + if (!blobcnt[0]) + ProgramFail(NULL, "nnlearnblob(): no blob to grab"); + nnscale8x8((unsigned char *)FRAME_BUF3, blobix[0], blobx1[0], blobx2[0], + bloby1[0], bloby2[0], imgWidth, imgHeight); + nnpack8x8(ix); + nndisplay(ix); +} + +void Cautorun (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + int ix, t0; + unsigned char ch; + + ix = Param[0]->Val->Integer; + t0 = readRTC(); + while (readRTC() < (t0 + ix*1000)) { // watch for ESC in 'ix' seconds + if (getchar(&ch)) { + if (ch == 0x1B) { // if ESC found, exit picoC + printf("found ESC\r\n"); + PlatformExit(0); + } + } + } +} + +void Clineno (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + ReturnValue->Val->Integer = Parser->Line; +} + +void Cerrormsg (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { + PlatformErrorPrefix(Parser); + LibPrintf(Parser, ReturnValue, Param, NumArgs); +} + +/* list of all library functions and their prototypes */ +struct LibraryFunction PlatformLibrary[] = +{ + { Csignal, "int signal();" }, + { Csignal1, "int signal1();" }, + { Cinput, "int input();" }, + { Cinput1, "int input1();" }, + { Cinit_uart1, "void init_uart1(int);" }, + { Cread_int, "int read_int();" }, + { Cread_str, "int read_str(char *);" }, + { Coutput, "void output(int);" }, + { Coutput1, "void output1(int);" }, + { Cdelay, "void delay(int);" }, + { Crand, "int rand(int);" }, + { Ctime, "int time();" }, + { Ciodir, "void iodir(int);" }, + { Cioread, "int ioread();" }, + { Ciowrite, "void iowrite(int);" }, + { Cpeek, "int peek(int, int);" }, + { Cpoke, "void poke(int, int, int);" }, + { Cmotors, "void motors(int, int);" }, + { Cmotors2, "void motors2(int, int);" }, + { Cmotorx, "void motorx(int, int);" }, + { Cservos, "void servos(int, int);" }, + { Cservos2, "void servos2(int, int);" }, + { Cencoders, "void encoders();" }, + { Cencoderx, "int encoderx(int);" }, + { Claser, "void laser(int);" }, + { Csonar, "int sonar(int);" }, + { Crange, "int range();" }, + { Cbattery, "int battery();" }, + { Cvcolor, "void vcolor(int, int, int, int, int, int, int);" }, + { Cvfind, "int vfind(int, int, int, int, int);" }, + { Cvcam, "void vcam(int);" }, + { Cvcap, "void vcap();" }, + { Cvrcap, "void vrcap();" }, + { Cvdiff, "void vdiff(int);" }, + { Cvpix, "void vpix(int, int);" }, + { Cvscan, "int vscan(int, int);" }, + { Cvmean, "void vmean();" }, + { Cvblob, "int vblob(int, int);" }, + { Cvjpeg, "int vjpeg(int);" }, + { Cvsend, "void vsend(int);" }, + { Ccompass, "int compass();" }, + { Ccompassx, "int compassx();" }, + { Ccompassxcal, "void compassxcal(int, int, int, int, int);" }, + { Canalog, "int analog(int);" }, + { Canalogx, "int analogx(int);" }, + { Ctilt, "int tilt(int);" }, + { Cgps, "void gps();" }, + { Creadi2c, "int readi2c(int, int);" }, + { Creadi2c2, "int readi2c2(int, int);" }, + { Cwritei2c, "void writei2c(int, int, int);" }, + { Cabs, "int abs(int);" }, + { Csin, "int sin(int);" }, + { Ccos, "int cos(int);" }, + { Ctan, "int tan(int);" }, + { Casin, "int asin(int, int);" }, + { Cacos, "int acos(int, int);" }, + { Catan, "int atan(int, int);" }, + { Cgps_head, "int gps_head(int, int, int, int);" }, + { Cgps_dist, "int gps_dist(int, int, int, int);" }, + { Csqrt, "int sqrt(int);" }, + { Cnnshow, "void nnshow(int);" }, + { Cnnset, "void nnset(int, int, int, int, int, int, int, int, int);" }, + { Cnninit, "void nninit();" }, + { Cnntrain, "void nntrain();" }, + { Cnntest, "int nntest(int, int, int, int, int, int, int, int);" }, + { Cnnmatchblob, "int nnmatchblob(int);" }, + { Cnnlearnblob, "void nnlearnblob(int);" }, + { Cautorun, "void autorun(int);" }, + { Clineno, "int lineno();" }, + { Cerrormsg, "void errormsg(char *);" }, + { NULL, NULL } +}; + diff --git a/src/cmd/picoc-1/platform/library_unix.c b/src/cmd/picoc-1/platform/library_unix.c new file mode 100644 index 0000000..0308702 --- /dev/null +++ b/src/cmd/picoc-1/platform/library_unix.c @@ -0,0 +1,29 @@ +#include "../interpreter.h" + +void UnixSetupFunc() +{ +} + +void Ctest (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + printf("test(%d)\n", Param[0]->Val->Integer); + Param[0]->Val->Integer = 1234; +} + +void Clineno (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) +{ + ReturnValue->Val->Integer = Parser->Line; +} + +/* list of all library functions and their prototypes */ +struct LibraryFunction UnixFunctions[] = +{ + { Ctest, "void test(int);" }, + { Clineno, "int lineno();" }, + { NULL, NULL } +}; + +void PlatformLibraryInit() +{ + IncludeRegister("picoc_unix.h", &UnixSetupFunc, &UnixFunctions[0], NULL); +} diff --git a/src/cmd/picoc-1/platform/platform_ffox.c b/src/cmd/picoc-1/platform/platform_ffox.c new file mode 100644 index 0000000..ea7bd7e --- /dev/null +++ b/src/cmd/picoc-1/platform/platform_ffox.c @@ -0,0 +1,51 @@ +#include "../interpreter.h" + +/* deallocate any storage */ +void PlatformCleanup() +{ +} + +/* get a line of interactive input */ +char *PlatformGetLine(char *Buf, int MaxLen) +{ + // XXX - unimplemented so far + return NULL; +} + +/* get a character of interactive input */ +int PlatformGetCharacter() +{ + // XXX - unimplemented so far + return 0; +} + +/* write a character to the console */ +void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream) +{ + // XXX - unimplemented so far +} + +/* read a file into memory */ +char *PlatformReadFile(const char *FileName) +{ + // XXX - unimplemented so far + return NULL; +} + +/* read and scan a file for definitions */ +void PlatformScanFile(const char *FileName) +{ + char *SourceStr = PlatformReadFile(FileName); + Parse(FileName, SourceStr, strlen(SourceStr), TRUE); + //free(SourceStr); +} + +/* mark where to end the program for platforms which require this */ +jmp_buf ExitBuf; + +/* exit the program */ +void PlatformExit() +{ + longjmp(ExitBuf, 1); +} + diff --git a/src/cmd/picoc-1/platform/platform_msvc.c b/src/cmd/picoc-1/platform/platform_msvc.c new file mode 100644 index 0000000..14718aa --- /dev/null +++ b/src/cmd/picoc-1/platform/platform_msvc.c @@ -0,0 +1,80 @@ +#include "../picoc.h" +#include "../interpreter.h" + +/* mark where to end the program for platforms which require this */ +jmp_buf PicocExitBuf; + +void PlatformInit() +{ +} + +void PlatformCleanup() +{ +} + +/* get a line of interactive input */ +char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt) +{ + if (Prompt != NULL) + printf("%s", Prompt); + + fflush(stdout); + return fgets(Buf, MaxLen, stdin); +} + +/* get a character of interactive input */ +int PlatformGetCharacter() +{ + fflush(stdout); + return getchar(); +} + +/* write a character to the console */ +void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream) +{ + putchar(OutCh); +} + +/* read a file into memory */ +char *PlatformReadFile(const char *FileName) +{ + struct stat FileInfo; + char *ReadText; + FILE *InFile; + int BytesRead; + + if (stat(FileName, &FileInfo)) + ProgramFail(NULL, "can't read file %s\n", FileName); + + ReadText = malloc(FileInfo.st_size + 1); + if (ReadText == NULL) + ProgramFail(NULL, "out of memory\n"); + + InFile = fopen(FileName, "r"); + if (InFile == NULL) + ProgramFail(NULL, "can't read file %s\n", FileName); + + BytesRead = fread(ReadText, 1, FileInfo.st_size, InFile); + if (BytesRead == 0) + ProgramFail(NULL, "can't read file %s\n", FileName); + + ReadText[BytesRead] = '\0'; + fclose(InFile); + + return ReadText; +} + +/* read and scan a file for definitions */ +void PicocPlatformScanFile(const char *FileName) +{ + char *SourceStr = PlatformReadFile(FileName); + + PicocParse(FileName, SourceStr, strlen(SourceStr), TRUE, FALSE, TRUE, TRUE); +} + +/* exit the program */ +void PlatformExit(int RetVal) +{ + PicocExitValue = RetVal; + longjmp(PicocExitBuf, 1); +} diff --git a/src/cmd/picoc-1/platform/platform_surveyor.c b/src/cmd/picoc-1/platform/platform_surveyor.c new file mode 100644 index 0000000..1557747 --- /dev/null +++ b/src/cmd/picoc-1/platform/platform_surveyor.c @@ -0,0 +1,71 @@ +#include "../interpreter.h" +#include "../picoc.h" + +/* mark where to end the program for platforms which require this */ +int PicocExitBuf[41]; + +/* deallocate any storage */ +void PlatformCleanup() +{ +} + +/* get a line of interactive input */ +char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt) +{ + int ix; + char ch, *cp; + + printf(Prompt); + + ix = 0; + cp = 0; + + // If the first character is \n or \r, eat it + ch = getch(); + if (ch == '\n' || ch == '\r') + { + // And get the next character + ch = getch(); + } + + while (ix++ < MaxLen) { + + if (ch == 0x1B || ch == 0x03) { // ESC character or ctrl-c (to avoid problem with TeraTerm) - exit + printf("Leaving PicoC\n"); + return NULL; + } + if (ch == '\n') { + *cp++ = '\n'; // if newline, send newline character followed by null + *cp = 0; + return Buf; + } + *cp++ = ch; + ix++; + ch = getch(); + } + return NULL; +} + +/* write a character to the console */ +void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream) +{ + if (OutCh == '\n') + putchar('\r'); + + putchar(OutCh); +} + +/* read a character */ +int PlatformGetCharacter() +{ + return getch(); +} + +/* exit the program */ +void PlatformExit(int RetVal) +{ + PicocExitValue = RetVal; + PicocExitBuf[40] = 1; + longjmp(PicocExitBuf, 1); +} + diff --git a/src/cmd/picoc-1/platform/platform_unix.c b/src/cmd/picoc-1/platform/platform_unix.c new file mode 100644 index 0000000..e40477d --- /dev/null +++ b/src/cmd/picoc-1/platform/platform_unix.c @@ -0,0 +1,138 @@ +#include "../picoc.h" +#include "../interpreter.h" + +#ifdef USE_READLINE +#include +#include +#endif + +/* mark where to end the program for platforms which require this */ +jmp_buf PicocExitBuf; + +#ifndef NO_DEBUGGER +#include + +static void BreakHandler(int Signal) +{ + PlatformPrintf("break\n"); + DebugManualBreak = TRUE; +} + +void PlatformInit() +{ + /* capture the break signal and pass it to the debugger */ + signal(SIGINT, BreakHandler); +} +#else +void PlatformInit() +{ +} +#endif + +void PlatformCleanup() +{ +} + +/* get a line of interactive input */ +char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt) +{ +#ifdef USE_READLINE + if (Prompt != NULL) + { + /* use GNU readline to read the line */ + char *InLine = readline(Prompt); + if (InLine == NULL) + return NULL; + + Buf[MaxLen] = '\0'; + strncpy(Buf, InLine, MaxLen-1); + strncat(Buf, "\n", MaxLen-1); + + if (InLine[0] != '\0') + add_history(InLine); + + free(InLine); + return Buf; + } +#endif + + if (Prompt != NULL) + printf("%s", Prompt); + + fflush(stdout); + return fgets(Buf, MaxLen, stdin); +} + +/* get a character of interactive input */ +int PlatformGetCharacter() +{ + fflush(stdout); + return getchar(); +} + +/* write a character to the console */ +void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream) +{ + putchar(OutCh); +} + +/* read a file into memory */ +char *PlatformReadFile(const char *FileName) +{ + struct stat FileInfo; + char *ReadText; + FILE *InFile; + int BytesRead; + char *p; + + if (stat(FileName, &FileInfo)) + ProgramFail(NULL, "can't read file %s\n", FileName); + + ReadText = malloc(FileInfo.st_size + 1); + if (ReadText == NULL) + ProgramFail(NULL, "out of memory\n"); + + InFile = fopen(FileName, "r"); + if (InFile == NULL) + ProgramFail(NULL, "can't read file %s\n", FileName); + + BytesRead = fread(ReadText, 1, FileInfo.st_size, InFile); + if (BytesRead == 0) + ProgramFail(NULL, "can't read file %s\n", FileName); + + ReadText[BytesRead] = '\0'; + fclose(InFile); + + if ((ReadText[0] == '#') && (ReadText[1] == '!')) + { + for (*p = ReadText; (*p != '\r') && (*p != '\n'); ++p) + { + *p = ' '; + } + } + + return ReadText; +} + +/* read and scan a file for definitions */ +void PicocPlatformScanFile(const char *FileName) +{ + char *SourceStr = PlatformReadFile(FileName); + + /* ignore "#!/path/to/picoc" .. by replacing the "#!" with "//" */ + if (SourceStr != NULL && SourceStr[0] == '#' && SourceStr[1] == '!') + { + SourceStr[0] = '/'; + SourceStr[1] = '/'; + } + + PicocParse(FileName, SourceStr, strlen(SourceStr), TRUE, FALSE, TRUE, TRUE); +} + +/* exit the program */ +void PlatformExit(int RetVal) +{ + PicocExitValue = RetVal; + longjmp(PicocExitBuf, 1); +} + diff --git a/src/cmd/picoc-1/retrobsd.c b/src/cmd/picoc-1/retrobsd.c new file mode 100644 index 0000000..ff5459c --- /dev/null +++ b/src/cmd/picoc-1/retrobsd.c @@ -0,0 +1,20 @@ +#include +#include + +/* Fixes for RetroBSD missing functions */ + +static const double one = 1.0, Zero[] = {0.0, -0.0,}; + + +int fgetpos(FILE *stream, int *pos) +{ + *pos = ftell(stream); + return *pos; +} + +int fsetpos(FILE *stream, int *pos) +{ + fseek(stream,SEEK_SET,*pos); + return *pos; +} + diff --git a/src/cmd/picoc-1/table.c b/src/cmd/picoc-1/table.c new file mode 100644 index 0000000..c051925 --- /dev/null +++ b/src/cmd/picoc-1/table.c @@ -0,0 +1,190 @@ +/* picoc hash table module. This hash table code is used for both symbol tables + * and the shared string table. */ + +#include "interpreter.h" + +struct Table StringTable; +struct TableEntry *StringHashTable[STRING_TABLE_SIZE]; +char *StrEmpty = NULL; + +/* initialise the shared string system */ +void TableInit() +{ + TableInitTable(&StringTable, &StringHashTable[0], STRING_TABLE_SIZE, TRUE); + StrEmpty = TableStrRegister(""); +} + +/* hash function for strings */ +static unsigned int TableHash(const char *Key, int Len) +{ + unsigned int Hash = Len; + int Offset; + int Count; + + for (Count = 0, Offset = 8; Count < Len; Count++, Offset+=7) + { + if (Offset > sizeof(unsigned int) * 8 - 7) + Offset -= sizeof(unsigned int) * 8 - 6; + + Hash ^= *Key++ << Offset; + } + + return Hash; +} + +/* initialise a table */ +void TableInitTable(struct Table *Tbl, struct TableEntry **HashTable, int Size, int OnHeap) +{ + Tbl->Size = Size; + Tbl->OnHeap = OnHeap; + Tbl->HashTable = HashTable; + memset((void *)HashTable, '\0', sizeof(struct TableEntry *) * Size); +} + +/* check a hash table entry for a key */ +static struct TableEntry *TableSearch(struct Table *Tbl, const char *Key, int *AddAt) +{ + struct TableEntry *Entry; + int HashValue = ((unsigned long)Key) % Tbl->Size; /* shared strings have unique addresses so we don't need to hash them */ + + for (Entry = Tbl->HashTable[HashValue]; Entry != NULL; Entry = Entry->Next) + { + if (Entry->p.v.Key == Key) + return Entry; /* found */ + } + + *AddAt = HashValue; /* didn't find it in the chain */ + return NULL; +} + +/* set an identifier to a value. returns FALSE if it already exists. + * Key must be a shared string from TableStrRegister() */ +int TableSet(struct Table *Tbl, char *Key, struct Value *Val, const char *DeclFileName, int DeclLine, int DeclColumn) +{ + int AddAt; + struct TableEntry *FoundEntry = TableSearch(Tbl, Key, &AddAt); + + if (FoundEntry == NULL) + { /* add it to the table */ + struct TableEntry *NewEntry = VariableAlloc(NULL, sizeof(struct TableEntry), Tbl->OnHeap); + NewEntry->DeclFileName = DeclFileName; + NewEntry->DeclLine = DeclLine; + NewEntry->DeclColumn = DeclColumn; + NewEntry->p.v.Key = Key; + NewEntry->p.v.Val = Val; + NewEntry->Next = Tbl->HashTable[AddAt]; + Tbl->HashTable[AddAt] = NewEntry; + return TRUE; + } + + return FALSE; +} + +/* find a value in a table. returns FALSE if not found. + * Key must be a shared string from TableStrRegister() */ +int TableGet(struct Table *Tbl, const char *Key, struct Value **Val, const char **DeclFileName, int *DeclLine, int *DeclColumn) +{ + int AddAt; + struct TableEntry *FoundEntry = TableSearch(Tbl, Key, &AddAt); + if (FoundEntry == NULL) + return FALSE; + + *Val = FoundEntry->p.v.Val; + + if (DeclFileName != NULL) + { + *DeclFileName = FoundEntry->DeclFileName; + *DeclLine = FoundEntry->DeclLine; + *DeclColumn = FoundEntry->DeclColumn; + } + + return TRUE; +} + +/* remove an entry from the table */ +struct Value *TableDelete(struct Table *Tbl, const char *Key) +{ + struct TableEntry **EntryPtr; + int HashValue = ((unsigned long)Key) % Tbl->Size; /* shared strings have unique addresses so we don't need to hash them */ + + for (EntryPtr = &Tbl->HashTable[HashValue]; *EntryPtr != NULL; EntryPtr = &(*EntryPtr)->Next) + { + if ((*EntryPtr)->p.v.Key == Key) + { + struct TableEntry *DeleteEntry = *EntryPtr; + struct Value *Val = DeleteEntry->p.v.Val; + *EntryPtr = DeleteEntry->Next; + HeapFreeMem(DeleteEntry); + + return Val; + } + } + + return NULL; +} + +/* check a hash table entry for an identifier */ +static struct TableEntry *TableSearchIdentifier(struct Table *Tbl, const char *Key, int Len, int *AddAt) +{ + struct TableEntry *Entry; + int HashValue = TableHash(Key, Len) % Tbl->Size; + + for (Entry = Tbl->HashTable[HashValue]; Entry != NULL; Entry = Entry->Next) + { + if (strncmp(&Entry->p.Key[0], (char *)Key, Len) == 0 && Entry->p.Key[Len] == '\0') + return Entry; /* found */ + } + + *AddAt = HashValue; /* didn't find it in the chain */ + return NULL; +} + +/* set an identifier and return the identifier. share if possible */ +char *TableSetIdentifier(struct Table *Tbl, const char *Ident, int IdentLen) +{ + int AddAt; + struct TableEntry *FoundEntry = TableSearchIdentifier(Tbl, Ident, IdentLen, &AddAt); + + if (FoundEntry != NULL) + return &FoundEntry->p.Key[0]; + else + { /* add it to the table - we economise by not allocating the whole structure here */ + struct TableEntry *NewEntry = HeapAllocMem(sizeof(struct TableEntry) - sizeof(union TableEntryPayload) + IdentLen + 1); + if (NewEntry == NULL) + ProgramFail(NULL, "out of memory"); + + strncpy((char *)&NewEntry->p.Key[0], (char *)Ident, IdentLen); + NewEntry->p.Key[IdentLen] = '\0'; + NewEntry->Next = Tbl->HashTable[AddAt]; + Tbl->HashTable[AddAt] = NewEntry; + return &NewEntry->p.Key[0]; + } +} + +/* register a string in the shared string store */ +char *TableStrRegister2(const char *Str, int Len) +{ + return TableSetIdentifier(&StringTable, Str, Len); +} + +char *TableStrRegister(const char *Str) +{ + return TableStrRegister2(Str, strlen((char *)Str)); +} + +/* free all the strings */ +void TableStrFree() +{ + struct TableEntry *Entry; + struct TableEntry *NextEntry; + int Count; + + for (Count = 0; Count < StringTable.Size; Count++) + { + for (Entry = StringTable.HashTable[Count]; Entry != NULL; Entry = NextEntry) + { + NextEntry = Entry->Next; + HeapFreeMem(Entry); + } + } +} diff --git a/src/cmd/picoc-1/tests/00_assignment.c b/src/cmd/picoc-1/tests/00_assignment.c new file mode 100644 index 0000000..56738ba --- /dev/null +++ b/src/cmd/picoc-1/tests/00_assignment.c @@ -0,0 +1,13 @@ +#include + +int a; +a = 42; +printf("%d\n", a); + +int b = 64; +printf("%d\n", b); + +int c = 12, d = 34; +printf("%d, %d\n", c, d); + +void main() {} diff --git a/src/cmd/picoc-1/tests/00_assignment.expect b/src/cmd/picoc-1/tests/00_assignment.expect new file mode 100644 index 0000000..d4407f3 --- /dev/null +++ b/src/cmd/picoc-1/tests/00_assignment.expect @@ -0,0 +1,3 @@ +42 +64 +12, 34 diff --git a/src/cmd/picoc-1/tests/01_comment.c b/src/cmd/picoc-1/tests/01_comment.c new file mode 100644 index 0000000..ce8d687 --- /dev/null +++ b/src/cmd/picoc-1/tests/01_comment.c @@ -0,0 +1,10 @@ +#include + +printf("Hello\n"); +printf("Hello\n"); /* this is a comment */ printf("Hello\n"); +printf("Hello\n"); +// this is also a comment sayhello(); +printf("Hello\n"); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/01_comment.expect b/src/cmd/picoc-1/tests/01_comment.expect new file mode 100644 index 0000000..b1387ad --- /dev/null +++ b/src/cmd/picoc-1/tests/01_comment.expect @@ -0,0 +1,5 @@ +Hello +Hello +Hello +Hello +Hello diff --git a/src/cmd/picoc-1/tests/02_printf.c b/src/cmd/picoc-1/tests/02_printf.c new file mode 100644 index 0000000..f779c1e --- /dev/null +++ b/src/cmd/picoc-1/tests/02_printf.c @@ -0,0 +1,13 @@ +#include + +printf("Hello world\n"); + +int Count; +for (Count = -5; Count <= 5; Count++) + printf("Count = %d\n", Count); + +printf("String 'hello', 'there' is '%s', '%s'\n", "hello", "there"); +printf("Character 'A' is '%c'\n", 65); +printf("Character 'a' is '%c'\n", 'a'); + +void main() {} diff --git a/src/cmd/picoc-1/tests/02_printf.expect b/src/cmd/picoc-1/tests/02_printf.expect new file mode 100644 index 0000000..f67a0f6 --- /dev/null +++ b/src/cmd/picoc-1/tests/02_printf.expect @@ -0,0 +1,15 @@ +Hello world +Count = -5 +Count = -4 +Count = -3 +Count = -2 +Count = -1 +Count = 0 +Count = 1 +Count = 2 +Count = 3 +Count = 4 +Count = 5 +String 'hello', 'there' is 'hello', 'there' +Character 'A' is 'A' +Character 'a' is 'a' diff --git a/src/cmd/picoc-1/tests/03_struct.c b/src/cmd/picoc-1/tests/03_struct.c new file mode 100644 index 0000000..079622d --- /dev/null +++ b/src/cmd/picoc-1/tests/03_struct.c @@ -0,0 +1,21 @@ +#include + +struct fred +{ + int boris; + int natasha; +}; + +struct fred bloggs; + +bloggs.boris = 12; +bloggs.natasha = 34; + +printf("%d\n", bloggs.boris); +printf("%d\n", bloggs.natasha); + +//struct fred jones[2]; +//jones[0].boris = 12; +//jones[0].natasha = 34; + +void main() {} diff --git a/src/cmd/picoc-1/tests/03_struct.expect b/src/cmd/picoc-1/tests/03_struct.expect new file mode 100644 index 0000000..8e994dd --- /dev/null +++ b/src/cmd/picoc-1/tests/03_struct.expect @@ -0,0 +1,2 @@ +12 +34 diff --git a/src/cmd/picoc-1/tests/04_for.c b/src/cmd/picoc-1/tests/04_for.c new file mode 100644 index 0000000..de563b5 --- /dev/null +++ b/src/cmd/picoc-1/tests/04_for.c @@ -0,0 +1,10 @@ +#include + +int Count; + +for (Count = 1; Count <= 10; Count++) +{ + printf("%d\n", Count); +} + +void main() {} diff --git a/src/cmd/picoc-1/tests/04_for.expect b/src/cmd/picoc-1/tests/04_for.expect new file mode 100644 index 0000000..f00c965 --- /dev/null +++ b/src/cmd/picoc-1/tests/04_for.expect @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/src/cmd/picoc-1/tests/05_array.c b/src/cmd/picoc-1/tests/05_array.c new file mode 100644 index 0000000..03dac05 --- /dev/null +++ b/src/cmd/picoc-1/tests/05_array.c @@ -0,0 +1,16 @@ +#include + +int Count; +int Array[10]; + +for (Count = 1; Count <= 10; Count++) +{ + Array[Count-1] = Count * Count; +} + +for (Count = 0; Count < 10; Count++) +{ + printf("%d\n", Array[Count]); +} + +void main() {} diff --git a/src/cmd/picoc-1/tests/05_array.expect b/src/cmd/picoc-1/tests/05_array.expect new file mode 100644 index 0000000..bc7257c --- /dev/null +++ b/src/cmd/picoc-1/tests/05_array.expect @@ -0,0 +1,10 @@ +1 +4 +9 +16 +25 +36 +49 +64 +81 +100 diff --git a/src/cmd/picoc-1/tests/06_case.c b/src/cmd/picoc-1/tests/06_case.c new file mode 100644 index 0000000..1858205 --- /dev/null +++ b/src/cmd/picoc-1/tests/06_case.c @@ -0,0 +1,24 @@ +#include + +int Count; + +for (Count = 0; Count < 4; Count++) +{ + printf("%d\n", Count); + switch (Count) + { + case 1: + printf("%d\n", 1); + break; + + case 2: + printf("%d\n", 2); + break; + + default: + printf("%d\n", 0); + break; + } +} + +void main() {} diff --git a/src/cmd/picoc-1/tests/06_case.expect b/src/cmd/picoc-1/tests/06_case.expect new file mode 100644 index 0000000..fab2c20 --- /dev/null +++ b/src/cmd/picoc-1/tests/06_case.expect @@ -0,0 +1,8 @@ +0 +0 +1 +1 +2 +2 +3 +0 diff --git a/src/cmd/picoc-1/tests/07_function.c b/src/cmd/picoc-1/tests/07_function.c new file mode 100644 index 0000000..0501380 --- /dev/null +++ b/src/cmd/picoc-1/tests/07_function.c @@ -0,0 +1,25 @@ +#include + +int myfunc(int x) +{ + return x * x; +} + +printf("%d\n", myfunc(3)); +printf("%d\n", myfunc(4)); + +void vfunc(int a) +{ + printf("a=%d\n", a); +} + +vfunc(1234); + +void qfunc() +{ + printf("qfunc()\n"); +} + +qfunc(); + +void main() {} diff --git a/src/cmd/picoc-1/tests/07_function.expect b/src/cmd/picoc-1/tests/07_function.expect new file mode 100644 index 0000000..8ffb0a7 --- /dev/null +++ b/src/cmd/picoc-1/tests/07_function.expect @@ -0,0 +1,4 @@ +9 +16 +a=1234 +qfunc() diff --git a/src/cmd/picoc-1/tests/08_while.c b/src/cmd/picoc-1/tests/08_while.c new file mode 100644 index 0000000..aee79ba --- /dev/null +++ b/src/cmd/picoc-1/tests/08_while.c @@ -0,0 +1,19 @@ +#include + +int a; +int p; +int t; + +a = 1; +p = 0; +t = 0; + +while (a < 100) +{ + printf("%d\n", a); + t = a; + a = t + p; + p = t; +} + +void main() {} diff --git a/src/cmd/picoc-1/tests/08_while.expect b/src/cmd/picoc-1/tests/08_while.expect new file mode 100644 index 0000000..702d4c0 --- /dev/null +++ b/src/cmd/picoc-1/tests/08_while.expect @@ -0,0 +1,11 @@ +1 +1 +2 +3 +5 +8 +13 +21 +34 +55 +89 diff --git a/src/cmd/picoc-1/tests/09_do_while.c b/src/cmd/picoc-1/tests/09_do_while.c new file mode 100644 index 0000000..e55b83a --- /dev/null +++ b/src/cmd/picoc-1/tests/09_do_while.c @@ -0,0 +1,20 @@ +#include + +int a; +int p; +int t; + +a = 1; +p = 0; +t = 0; + +do +{ + printf("%d\n", a); + t = a; + a = t + p; + p = t; +} while (a < 100); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/09_do_while.expect b/src/cmd/picoc-1/tests/09_do_while.expect new file mode 100644 index 0000000..702d4c0 --- /dev/null +++ b/src/cmd/picoc-1/tests/09_do_while.expect @@ -0,0 +1,11 @@ +1 +1 +2 +3 +5 +8 +13 +21 +34 +55 +89 diff --git a/src/cmd/picoc-1/tests/10_pointer.c b/src/cmd/picoc-1/tests/10_pointer.c new file mode 100644 index 0000000..1bd40e3 --- /dev/null +++ b/src/cmd/picoc-1/tests/10_pointer.c @@ -0,0 +1,37 @@ +#include + +int a; +int *b; +int c; + +a = 42; +b = &a; +printf("a = %d\n", *b); + +struct ziggy +{ + int a; + int b; + int c; +} bolshevic; + +bolshevic.a = 12; +bolshevic.b = 34; +bolshevic.c = 56; + +printf("bolshevic.a = %d\n", bolshevic.a); +printf("bolshevic.b = %d\n", bolshevic.b); +printf("bolshevic.c = %d\n", bolshevic.c); + +struct ziggy *tsar = &bolshevic; + +printf("tsar->a = %d\n", tsar->a); +printf("tsar->b = %d\n", tsar->b); +printf("tsar->c = %d\n", tsar->c); + +/* +b = &(bolshevic.b); +printf("bolshevic.b = %d\n", *b); +*/ + +void main() {} diff --git a/src/cmd/picoc-1/tests/10_pointer.expect b/src/cmd/picoc-1/tests/10_pointer.expect new file mode 100644 index 0000000..97116c0 --- /dev/null +++ b/src/cmd/picoc-1/tests/10_pointer.expect @@ -0,0 +1,7 @@ +a = 42 +bolshevic.a = 12 +bolshevic.b = 34 +bolshevic.c = 56 +tsar->a = 12 +tsar->b = 34 +tsar->c = 56 diff --git a/src/cmd/picoc-1/tests/11_precedence.c b/src/cmd/picoc-1/tests/11_precedence.c new file mode 100644 index 0000000..f7a4bda --- /dev/null +++ b/src/cmd/picoc-1/tests/11_precedence.c @@ -0,0 +1,38 @@ +#include + +int a; +int b; +int c; +int d; +int e; +int f; +int x; +int y; + +a = 12; +b = 34; +c = 56; +d = 78; +e = 0; +f = 1; + +printf("%d\n", c + d); +printf("%d\n", (y = c + d)); +/* printf("%d\n", a ? b+c : c+d); +printf("%d\n", a ? b+c : c+d); +printf("%d\n", a || b ? b+c : c+d); */ +printf("%d\n", e || e && f); +printf("%d\n", e || f && f); +printf("%d\n", e && e || f); +printf("%d\n", e && f || f); +printf("%d\n", a && f | f); +printf("%d\n", a | b ^ c & d); +printf("%d, %d\n", a == a, a == b); +printf("%d, %d\n", a != a, a != b); +printf("%d\n", a != b && c != d); +printf("%d\n", a + b * c / f); +printf("%d\n", a + b * c / f); +printf("%d\n", (4 << 4)); +printf("%d\n", (64 >> 4)); + +void main() {} diff --git a/src/cmd/picoc-1/tests/11_precedence.expect b/src/cmd/picoc-1/tests/11_precedence.expect new file mode 100644 index 0000000..b692396 --- /dev/null +++ b/src/cmd/picoc-1/tests/11_precedence.expect @@ -0,0 +1,15 @@ +134 +134 +0 +1 +1 +1 +1 +46 +1, 0 +0, 1 +1 +1916 +1916 +64 +4 diff --git a/src/cmd/picoc-1/tests/12_hashdefine.c b/src/cmd/picoc-1/tests/12_hashdefine.c new file mode 100644 index 0000000..6ffaf3f --- /dev/null +++ b/src/cmd/picoc-1/tests/12_hashdefine.c @@ -0,0 +1,10 @@ +#include + +#define FRED 12 +#define BLOGGS(x) (12*(x)) + +printf("%d\n", FRED); +printf("%d, %d, %d\n", BLOGGS(1), BLOGGS(2), BLOGGS(3)); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/12_hashdefine.expect b/src/cmd/picoc-1/tests/12_hashdefine.expect new file mode 100644 index 0000000..99f2ed5 --- /dev/null +++ b/src/cmd/picoc-1/tests/12_hashdefine.expect @@ -0,0 +1,2 @@ +12 +12, 24, 36 diff --git a/src/cmd/picoc-1/tests/13_integer_literals.c b/src/cmd/picoc-1/tests/13_integer_literals.c new file mode 100644 index 0000000..f021de2 --- /dev/null +++ b/src/cmd/picoc-1/tests/13_integer_literals.c @@ -0,0 +1,16 @@ +#include + +int a = 24680; +int b = 01234567; +int c = 0x2468ac; +int d = 0x2468AC; +int e = 0b010101010101; + +printf("%d\n", a); +printf("%d\n", b); +printf("%d\n", c); +printf("%d\n", d); +printf("%d\n", e); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/13_integer_literals.expect b/src/cmd/picoc-1/tests/13_integer_literals.expect new file mode 100644 index 0000000..f5aca06 --- /dev/null +++ b/src/cmd/picoc-1/tests/13_integer_literals.expect @@ -0,0 +1,5 @@ +24680 +342391 +2386092 +2386092 +1365 diff --git a/src/cmd/picoc-1/tests/14_if.c b/src/cmd/picoc-1/tests/14_if.c new file mode 100644 index 0000000..bb56ef4 --- /dev/null +++ b/src/cmd/picoc-1/tests/14_if.c @@ -0,0 +1,17 @@ +#include + +int a = 1; + +if (a) + printf("a is true\n"); +else + printf("a is false\n"); + +int b = 0; +if (b) + printf("b is true\n"); +else + printf("b is false\n"); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/14_if.expect b/src/cmd/picoc-1/tests/14_if.expect new file mode 100644 index 0000000..c32c415 --- /dev/null +++ b/src/cmd/picoc-1/tests/14_if.expect @@ -0,0 +1,2 @@ +a is true +b is false diff --git a/src/cmd/picoc-1/tests/15_recursion.c b/src/cmd/picoc-1/tests/15_recursion.c new file mode 100644 index 0000000..4733c8f --- /dev/null +++ b/src/cmd/picoc-1/tests/15_recursion.c @@ -0,0 +1,16 @@ +#include + +int factorial(int i) +{ + if (i < 2) + return i; + else + return i * factorial(i - 1); +} + +int Count; + +for (Count = 1; Count <= 10; Count++) + printf("%d\n", factorial(Count)); + +void main() {} diff --git a/src/cmd/picoc-1/tests/15_recursion.expect b/src/cmd/picoc-1/tests/15_recursion.expect new file mode 100644 index 0000000..db47b28 --- /dev/null +++ b/src/cmd/picoc-1/tests/15_recursion.expect @@ -0,0 +1,10 @@ +1 +2 +6 +24 +120 +720 +5040 +40320 +362880 +3628800 diff --git a/src/cmd/picoc-1/tests/16_nesting.c b/src/cmd/picoc-1/tests/16_nesting.c new file mode 100644 index 0000000..90a62bf --- /dev/null +++ b/src/cmd/picoc-1/tests/16_nesting.c @@ -0,0 +1,16 @@ +#include + +int x, y, z; + +for (x = 0; x < 2; x++) +{ + for (y = 0; y < 3; y++) + { + for (z = 0; z < 3; z++) + { + printf("%d %d %d\n", x, y, z); + } + } +} + +void main() {} diff --git a/src/cmd/picoc-1/tests/16_nesting.expect b/src/cmd/picoc-1/tests/16_nesting.expect new file mode 100644 index 0000000..625ee13 --- /dev/null +++ b/src/cmd/picoc-1/tests/16_nesting.expect @@ -0,0 +1,18 @@ +0 0 0 +0 0 1 +0 0 2 +0 1 0 +0 1 1 +0 1 2 +0 2 0 +0 2 1 +0 2 2 +1 0 0 +1 0 1 +1 0 2 +1 1 0 +1 1 1 +1 1 2 +1 2 0 +1 2 1 +1 2 2 diff --git a/src/cmd/picoc-1/tests/17_enum.c b/src/cmd/picoc-1/tests/17_enum.c new file mode 100644 index 0000000..f53c88c --- /dev/null +++ b/src/cmd/picoc-1/tests/17_enum.c @@ -0,0 +1,24 @@ +#include + +enum fred +{ + a, + b, + c, + d, + e = 54, + f = 73, + g, + h +}; + +enum fred frod; + +printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h); +printf("%d\n", frod); +frod = 12; +printf("%d\n", frod); +frod = e; +printf("%d\n", frod); + +void main() {} diff --git a/src/cmd/picoc-1/tests/17_enum.expect b/src/cmd/picoc-1/tests/17_enum.expect new file mode 100644 index 0000000..0c17a2d --- /dev/null +++ b/src/cmd/picoc-1/tests/17_enum.expect @@ -0,0 +1,4 @@ +0 1 2 3 54 73 74 75 +0 +12 +54 diff --git a/src/cmd/picoc-1/tests/18_include.c b/src/cmd/picoc-1/tests/18_include.c new file mode 100644 index 0000000..f2bfcc6 --- /dev/null +++ b/src/cmd/picoc-1/tests/18_include.c @@ -0,0 +1,7 @@ +#include + +printf("including\n"); +#include "18_include.h" +printf("done\n"); + +void main() {} diff --git a/src/cmd/picoc-1/tests/18_include.expect b/src/cmd/picoc-1/tests/18_include.expect new file mode 100644 index 0000000..87729df --- /dev/null +++ b/src/cmd/picoc-1/tests/18_include.expect @@ -0,0 +1,3 @@ +including +included +done diff --git a/src/cmd/picoc-1/tests/18_include.h b/src/cmd/picoc-1/tests/18_include.h new file mode 100644 index 0000000..01f894d --- /dev/null +++ b/src/cmd/picoc-1/tests/18_include.h @@ -0,0 +1 @@ +printf("included\n"); diff --git a/src/cmd/picoc-1/tests/19_pointer_arithmetic.c b/src/cmd/picoc-1/tests/19_pointer_arithmetic.c new file mode 100644 index 0000000..96c7e6a --- /dev/null +++ b/src/cmd/picoc-1/tests/19_pointer_arithmetic.c @@ -0,0 +1,24 @@ +#include + +int a; +int *b; +int *c; + +a = 42; +b = &a; +c = NULL; + +printf("%d\n", *b); + +if (b == NULL) + printf("b is NULL\n"); +else + printf("b is not NULL\n"); + +if (c == NULL) + printf("c is NULL\n"); +else + printf("c is not NULL\n"); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/19_pointer_arithmetic.expect b/src/cmd/picoc-1/tests/19_pointer_arithmetic.expect new file mode 100644 index 0000000..0cf781b --- /dev/null +++ b/src/cmd/picoc-1/tests/19_pointer_arithmetic.expect @@ -0,0 +1,3 @@ +42 +b is not NULL +c is NULL diff --git a/src/cmd/picoc-1/tests/20_pointer_comparison.c b/src/cmd/picoc-1/tests/20_pointer_comparison.c new file mode 100644 index 0000000..bab1d5e --- /dev/null +++ b/src/cmd/picoc-1/tests/20_pointer_comparison.c @@ -0,0 +1,20 @@ +#include + +int a; +int b; +int *d; +int *e; +d = &a; +e = &b; +a = 12; +b = 34; +printf("%d\n", *d); +printf("%d\n", *e); +printf("%d\n", d == e); +printf("%d\n", d != e); +d = e; +printf("%d\n", d == e); +printf("%d\n", d != e); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/20_pointer_comparison.expect b/src/cmd/picoc-1/tests/20_pointer_comparison.expect new file mode 100644 index 0000000..5d1e5f5 --- /dev/null +++ b/src/cmd/picoc-1/tests/20_pointer_comparison.expect @@ -0,0 +1,6 @@ +12 +34 +0 +1 +1 +0 diff --git a/src/cmd/picoc-1/tests/21_char_array.c b/src/cmd/picoc-1/tests/21_char_array.c new file mode 100644 index 0000000..0f158cd --- /dev/null +++ b/src/cmd/picoc-1/tests/21_char_array.c @@ -0,0 +1,29 @@ +#include + +int x = 'a'; +char y = x; + +char *a = "hello"; + +printf("%s\n", a); + +int c; +c = *a; + +char *b; +for (b = a; *b != 0; b++) + printf("%c: %d\n", *b, *b); + +char destarray[10]; +char *dest = &destarray[0]; +char *src = a; + +while (*src != 0) + *dest++ = *src++; + +*dest = 0; + +printf("copied string is %s\n", destarray); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/21_char_array.expect b/src/cmd/picoc-1/tests/21_char_array.expect new file mode 100644 index 0000000..dbc6068 --- /dev/null +++ b/src/cmd/picoc-1/tests/21_char_array.expect @@ -0,0 +1,7 @@ +hello +h: 104 +e: 101 +l: 108 +l: 108 +o: 111 +copied string is hello diff --git a/src/cmd/picoc-1/tests/22_floating_point.c b/src/cmd/picoc-1/tests/22_floating_point.c new file mode 100644 index 0000000..37754a4 --- /dev/null +++ b/src/cmd/picoc-1/tests/22_floating_point.c @@ -0,0 +1,45 @@ +#include +#include + +// variables +float a = 12.34 + 56.78; +printf("%f\n", a); + +// infix operators +printf("%f\n", 12.34 + 56.78); +printf("%f\n", 12.34 - 56.78); +printf("%f\n", 12.34 * 56.78); +printf("%f\n", 12.34 / 56.78); + +// comparison operators +printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78); +printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34); +printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34); + +// assignment operators +a = 12.34; +a += 56.78; +printf("%f\n", a); + +a = 12.34; +a -= 56.78; +printf("%f\n", a); + +a = 12.34; +a *= 56.78; +printf("%f\n", a); + +a = 12.34; +a /= 56.78; +printf("%f\n", a); + +// prefix operators +printf("%f\n", +12.34); +printf("%f\n", -12.34); + +// type coercion +a = 2; +printf("%f\n", a); +printf("%f\n", sin(2)); + +void main() {} diff --git a/src/cmd/picoc-1/tests/22_floating_point.expect b/src/cmd/picoc-1/tests/22_floating_point.expect new file mode 100644 index 0000000..282d089 --- /dev/null +++ b/src/cmd/picoc-1/tests/22_floating_point.expect @@ -0,0 +1,16 @@ +69.120000 +69.120000 +-44.440000 +700.665200 +0.217330 +1 1 0 0 0 1 +0 1 1 1 0 0 +0 0 0 1 1 1 +69.120000 +-44.440000 +700.665200 +0.217330 +12.340000 +-12.340000 +2.000000 +0.909297 diff --git a/src/cmd/picoc-1/tests/23_type_coercion.c b/src/cmd/picoc-1/tests/23_type_coercion.c new file mode 100644 index 0000000..9076952 --- /dev/null +++ b/src/cmd/picoc-1/tests/23_type_coercion.c @@ -0,0 +1,49 @@ +#include + +void charfunc(char a) +{ + printf("char: %c\n", a); +} + +void intfunc(int a) +{ + printf("int: %d\n", a); +} + +void floatfunc(float a) +{ + printf("float: %f\n", a); +} + +charfunc('a'); +charfunc(98); +charfunc(99.0); + +intfunc('a'); +intfunc(98); +intfunc(99.0); + +floatfunc('a'); +floatfunc(98); +floatfunc(99.0); + +printf("%c %d %f\n", 'a', 'b', 'c'); +printf("%c %d %f\n", 97, 98, 99); +printf("%c %d %f\n", 97.0, 98.0, 99.0); + +char b = 97; +char c = 97.0; + +printf("%d %d\n", b, c); + +int d = 'a'; +int e = 97.0; + +printf("%d %d\n", d, e); + +float f = 'a'; +float g = 97; + +printf("%f %f\n", f, g); + +void main() {} diff --git a/src/cmd/picoc-1/tests/23_type_coercion.expect b/src/cmd/picoc-1/tests/23_type_coercion.expect new file mode 100644 index 0000000..a4c5b68 --- /dev/null +++ b/src/cmd/picoc-1/tests/23_type_coercion.expect @@ -0,0 +1,15 @@ +char: a +char: b +char: c +int: 97 +int: 98 +int: 99 +float: 97.000000 +float: 98.000000 +float: 99.000000 +a 98 99.000000 +a 98 99.000000 +a 98 99.000000 +97 97 +97 97 +97.000000 97.000000 diff --git a/src/cmd/picoc-1/tests/24_math_library.c b/src/cmd/picoc-1/tests/24_math_library.c new file mode 100644 index 0000000..892c4b8 --- /dev/null +++ b/src/cmd/picoc-1/tests/24_math_library.c @@ -0,0 +1,23 @@ +#include +#include + +printf("%f\n", sin(0.12)); +printf("%f\n", cos(0.12)); +printf("%f\n", tan(0.12)); +printf("%f\n", asin(0.12)); +printf("%f\n", acos(0.12)); +printf("%f\n", atan(0.12)); +printf("%f\n", sinh(0.12)); +printf("%f\n", cosh(0.12)); +printf("%f\n", tanh(0.12)); +printf("%f\n", exp(0.12)); +printf("%f\n", fabs(-0.12)); +printf("%f\n", log(0.12)); +printf("%f\n", log10(0.12)); +printf("%f\n", pow(0.12, 0.12)); +printf("%f\n", sqrt(0.12)); +printf("%f\n", round(12.34)); +printf("%f\n", ceil(12.34)); +printf("%f\n", floor(12.34)); + +void main() {} diff --git a/src/cmd/picoc-1/tests/24_math_library.expect b/src/cmd/picoc-1/tests/24_math_library.expect new file mode 100644 index 0000000..99f7299 --- /dev/null +++ b/src/cmd/picoc-1/tests/24_math_library.expect @@ -0,0 +1,18 @@ +0.119712 +0.992809 +0.120579 +0.120290 +1.450506 +0.119429 +0.120288 +1.007209 +0.119427 +1.127497 +0.120000 +-2.120264 +-0.920819 +0.775357 +0.346410 +12.000000 +13.000000 +12.000000 diff --git a/src/cmd/picoc-1/tests/25_quicksort.c b/src/cmd/picoc-1/tests/25_quicksort.c new file mode 100644 index 0000000..724d9c5 --- /dev/null +++ b/src/cmd/picoc-1/tests/25_quicksort.c @@ -0,0 +1,80 @@ +#include + +int array[16]; + +//Swap integer values by array indexes +void swap(int a, int b) +{ + int tmp = array[a]; + array[a] = array[b]; + array[b] = tmp; +} + +//Partition the array into two halves and return the +//index about which the array is partitioned +int partition(int left, int right) +{ + int pivotIndex = left; + int pivotValue = array[pivotIndex]; + int index = left; + int i; + + swap(pivotIndex, right); + for(i = left; i < right; i++) + { + if(array[i] < pivotValue) + { + swap(i, index); + index += 1; + } + } + swap(right, index); + + return index; +} + +//Quicksort the array +void quicksort(int left, int right) +{ + if(left >= right) + return; + + int index = partition(left, right); + quicksort(left, index - 1); + quicksort(index + 1, right); +} + +void main() +{ + int i; + + array[0] = 62; + array[1] = 83; + array[2] = 4; + array[3] = 89; + array[4] = 36; + array[5] = 21; + array[6] = 74; + array[7] = 37; + array[8] = 65; + array[9] = 33; + array[10] = 96; + array[11] = 38; + array[12] = 53; + array[13] = 16; + array[14] = 74; + array[15] = 55; + + for (i = 0; i < 16; i++) + printf("%d ", array[i]); + + printf("\n"); + + quicksort(0, 15); + + for (i = 0; i < 16; i++) + printf("%d ", array[i]); + + printf("\n"); +} + diff --git a/src/cmd/picoc-1/tests/25_quicksort.expect b/src/cmd/picoc-1/tests/25_quicksort.expect new file mode 100644 index 0000000..2d39cd3 --- /dev/null +++ b/src/cmd/picoc-1/tests/25_quicksort.expect @@ -0,0 +1,2 @@ +62 83 4 89 36 21 74 37 65 33 96 38 53 16 74 55 +4 16 21 33 36 37 38 53 55 62 65 74 74 83 89 96 diff --git a/src/cmd/picoc-1/tests/26_character_constants.c b/src/cmd/picoc-1/tests/26_character_constants.c new file mode 100644 index 0000000..6553f76 --- /dev/null +++ b/src/cmd/picoc-1/tests/26_character_constants.c @@ -0,0 +1,13 @@ +#include + +printf("%d\n", '\1'); +printf("%d\n", '\10'); +printf("%d\n", '\100'); +printf("%d\n", '\x01'); +printf("%d\n", '\x0e'); +printf("%d\n", '\x10'); +printf("%d\n", '\x40'); +printf("test \x407\n"); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/26_character_constants.expect b/src/cmd/picoc-1/tests/26_character_constants.expect new file mode 100644 index 0000000..53e27d0 --- /dev/null +++ b/src/cmd/picoc-1/tests/26_character_constants.expect @@ -0,0 +1,8 @@ +1 +8 +64 +1 +14 +16 +64 +test @7 diff --git a/src/cmd/picoc-1/tests/27_sizeof.c b/src/cmd/picoc-1/tests/27_sizeof.c new file mode 100644 index 0000000..52703aa --- /dev/null +++ b/src/cmd/picoc-1/tests/27_sizeof.c @@ -0,0 +1,12 @@ +#include + +char a; +int b; +double c; + +printf("%d\n", sizeof(a)); +printf("%d\n", sizeof(b)); +printf("%d\n", sizeof(c)); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/27_sizeof.expect b/src/cmd/picoc-1/tests/27_sizeof.expect new file mode 100644 index 0000000..7329e00 --- /dev/null +++ b/src/cmd/picoc-1/tests/27_sizeof.expect @@ -0,0 +1,3 @@ +1 +4 +8 diff --git a/src/cmd/picoc-1/tests/28_strings.c b/src/cmd/picoc-1/tests/28_strings.c new file mode 100644 index 0000000..d173060 --- /dev/null +++ b/src/cmd/picoc-1/tests/28_strings.c @@ -0,0 +1,41 @@ +#include +#include + +char a[10]; + +strcpy(a, "hello"); +printf("%s\n", a); + +strncpy(a, "gosh", 2); +printf("%s\n", a); + +printf("%d\n", strcmp(a, "apple") > 0); +printf("%d\n", strcmp(a, "goere") > 0); +printf("%d\n", strcmp(a, "zebra") < 0); + +printf("%d\n", strlen(a)); + +strcat(a, "!"); +printf("%s\n", a); + +printf("%d\n", strncmp(a, "apple", 2) > 0); +printf("%d\n", strncmp(a, "goere", 2) == 0); +printf("%d\n", strncmp(a, "goerg", 2) == 0); +printf("%d\n", strncmp(a, "zebra", 2) < 0); + +printf("%s\n", index(a, 'o')); +printf("%s\n", rindex(a, 'l')); +printf("%d\n", rindex(a, 'x') == NULL); + +memset(&a[1], 'r', 4); +printf("%s\n", a); + +memcpy(&a[2], a, 2); +printf("%s\n", a); + +printf("%d\n", memcmp(a, "apple", 4) > 0); +printf("%d\n", memcmp(a, "grgr", 4) == 0); +printf("%d\n", memcmp(a, "zebra", 4) < 0); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/28_strings.expect b/src/cmd/picoc-1/tests/28_strings.expect new file mode 100644 index 0000000..fd9217a --- /dev/null +++ b/src/cmd/picoc-1/tests/28_strings.expect @@ -0,0 +1,19 @@ +hello +gollo +1 +1 +1 +5 +gollo! +1 +1 +1 +1 +ollo! +lo! +1 +grrrr! +grgrr! +1 +1 +1 diff --git a/src/cmd/picoc-1/tests/29_array_address.c b/src/cmd/picoc-1/tests/29_array_address.c new file mode 100644 index 0000000..a8562af --- /dev/null +++ b/src/cmd/picoc-1/tests/29_array_address.c @@ -0,0 +1,8 @@ +#include +#include + +char a[10]; +strcpy(a, "abcdef"); +printf("%s\n", &a[1]); + +void main() {} diff --git a/src/cmd/picoc-1/tests/29_array_address.expect b/src/cmd/picoc-1/tests/29_array_address.expect new file mode 100644 index 0000000..9bc8683 --- /dev/null +++ b/src/cmd/picoc-1/tests/29_array_address.expect @@ -0,0 +1 @@ +bcdef diff --git a/src/cmd/picoc-1/tests/30_hanoi.c b/src/cmd/picoc-1/tests/30_hanoi.c new file mode 100644 index 0000000..5ca6667 --- /dev/null +++ b/src/cmd/picoc-1/tests/30_hanoi.c @@ -0,0 +1,125 @@ +/* example from http://barnyard.syr.edu/quickies/hanoi.c */ + +/* hanoi.c: solves the tower of hanoi problem. (Programming exercise.) */ +/* By Terry R. McConnell (12/2/97) */ +/* Compile: cc -o hanoi hanoi.c */ + +/* This program does no error checking. But then, if it's right, +it's right ... right ? */ + + +/* The original towers of hanoi problem seems to have been originally posed +by one M. Claus in 1883. There is a popular legend that goes along with +it that has been often repeated and paraphrased. It goes something like this: +In the great temple at Benares there are 3 golden spikes. On one of them, +God placed 64 disks increasing in size from bottom to top, at the beginning +of time. Since then, and to this day, the priest on duty constantly transfers +disks, one at a time, in such a way that no larger disk is ever put on top +of a smaller one. When the disks have been transferred entirely to another +spike the Universe will come to an end in a large thunderclap. + +This paraphrases the original legend due to DeParville, La Nature, Paris 1884, +Part I, 285-286. For this and further information see: Mathematical +Recreations & Essays, W.W. Rouse Ball, MacMillan, NewYork, 11th Ed. 1967, +303-305. +* +* +*/ + +#include +#include + +#define TRUE 1 +#define FALSE 0 + +#define N 4 /* This is the number of "disks" on tower A initially. */ + /* Taken to be 64 in the legend. The number of moves + required, in general, is 2^N - 1. For N = 64, this is + 18,446,744,073,709,551,615 */ + +int A[N], B[N], C[N]; /* These are the three towers. For example if the +state of A is 0,1,3,4, that means that there are three discs on A of sizes +1, 3, and 4. (Think of right as being the "down" direction.) */ + +void Hanoi(int,int*,int*,int*); + +/* Print the current configuration of A, B, and C to the screen */ + +void +PrintAll() +{ + int i; + + printf("A: "); + for(i=0;i + +int main(int argc, char **argv) +{ + int Count; + + printf("hello world %d\n", argc); + for (Count = 0; Count < argc; Count++) + printf("arg %d: %s\n", Count, argv[Count]); + + return 0; +} diff --git a/src/cmd/picoc-1/tests/31_args.expect b/src/cmd/picoc-1/tests/31_args.expect new file mode 100644 index 0000000..bf25112 --- /dev/null +++ b/src/cmd/picoc-1/tests/31_args.expect @@ -0,0 +1,6 @@ +hello world 5 +arg 0: - +arg 1: arg1 +arg 2: arg2 +arg 3: arg3 +arg 4: arg4 diff --git a/src/cmd/picoc-1/tests/32_led.c b/src/cmd/picoc-1/tests/32_led.c new file mode 100644 index 0000000..d1a28b6 --- /dev/null +++ b/src/cmd/picoc-1/tests/32_led.c @@ -0,0 +1,264 @@ +/* example from http://barnyard.syr.edu/quickies/led.c */ + +/* led.c: print out number as if on 7 line led display. I.e., write integer + given on command line like this: + _ _ _ + | _| _| |_| |_ + | |_ _| | _| etc. + + We assume the terminal behaves like a classical teletype. So the top + lines of all digits have to be printed first, then the middle lines of + all digits, etc. + + By Terry R. McConnell + + compile: cc -o led led.c + + If you just want to link in the subroutine print_led that does all the + work, compile with -DNO_MAIN, and declare the following in any source file + that uses the call: + + extern void print_led(unsigned long x, char *buf); + + Bug: you cannot call repeatedly to print more than one number to a line. + That would require curses or some other terminal API that allows moving the + cursor to a previous line. + + */ + + + +#include +#include + +#define MAX_DIGITS 32 +#define NO_MAIN + + +/* Print the top line of the digit d into buffer. + Does not null terminate buffer. */ + +void topline(int d, char *p){ + + *p++ = ' '; + switch(d){ + + /* all these have _ on top line */ + + case 0: + case 2: + case 3: + case 5: + case 7: + case 8: + case 9: + *p++ = '_'; + break; + default: + *p++=' '; + + } + *p++=' '; +} + +/* Print the middle line of the digit d into the buffer. + Does not null terminate. */ + +void midline(int d, char *p){ + + switch(d){ + + /* those that have leading | on middle line */ + + case 0: + case 4: + case 5: + case 6: + case 8: + case 9: + *p++='|'; + break; + default: + *p++=' '; + } + switch(d){ + + /* those that have _ on middle line */ + + case 2: + case 3: + case 4: + case 5: + case 6: + case 8: + case 9: + *p++='_'; + break; + default: + *p++=' '; + + } + switch(d){ + + /* those that have closing | on middle line */ + + case 0: + case 1: + case 2: + case 3: + case 4: + case 7: + case 8: + case 9: + *p++='|'; + break; + default: + *p++=' '; + + } +} + +/* Print the bottom line of the digit d. Does not null terminate. */ + +void botline(int d, char *p){ + + + switch(d){ + + /* those that have leading | on bottom line */ + + case 0: + case 2: + case 6: + case 8: + *p++='|'; + break; + default: + *p++=' '; + } + switch(d){ + + /* those that have _ on bottom line */ + + case 0: + case 2: + case 3: + case 5: + case 6: + case 8: + *p++='_'; + break; + default: + *p++=' '; + + } + switch(d){ + + /* those that have closing | on bottom line */ + + case 0: + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + *p++='|'; + break; + default: + *p++=' '; + + } +} + +/* Write the led representation of integer to string buffer. */ + +void print_led(unsigned long x, char *buf) +{ + + int i=0,n; + static int d[MAX_DIGITS]; + + + /* extract digits from x */ + + n = ( x == 0L ? 1 : 0 ); /* 0 is a digit, hence a special case */ + + while(x){ + d[n++] = (int)(x%10L); + if(n >= MAX_DIGITS)break; + x = x/10L; + } + + /* print top lines of all digits */ + + for(i=n-1;i>=0;i--){ + topline(d[i],buf); + buf += 3; + *buf++=' '; + } + *buf++='\n'; /* move teletype to next line */ + + /* print middle lines of all digits */ + + for(i=n-1;i>=0;i--){ + midline(d[i],buf); + buf += 3; + *buf++=' '; + } + *buf++='\n'; + + /* print bottom lines of all digits */ + + for(i=n-1;i>=0;i--){ + botline(d[i],buf); + buf += 3; + *buf++=' '; + } + *buf++='\n'; + *buf='\0'; +} + +int main() +{ + char buf[5*MAX_DIGITS]; + print_led(1234567, buf); + printf("%s\n",buf); + + return 0; +} + +#ifndef NO_MAIN +int main(int argc, char **argv) +{ + + int i=0,n; + long x; + static int d[MAX_DIGITS]; + char buf[5*MAX_DIGITS]; + + if(argc != 2){ + fprintf(stderr,"led: usage: led integer\n"); + return 1; + } + + /* fetch argument from command line */ + + x = atol(argv[1]); + + /* sanity check */ + + if(x<0){ + fprintf(stderr,"led: %d must be non-negative\n",x); + return 1; + } + + print_led(x,buf); + printf("%s\n",buf); + + return 0; + +} +#endif diff --git a/src/cmd/picoc-1/tests/32_led.expect b/src/cmd/picoc-1/tests/32_led.expect new file mode 100644 index 0000000..c53b58a --- /dev/null +++ b/src/cmd/picoc-1/tests/32_led.expect @@ -0,0 +1,4 @@ + _ _ _ _ + | _| _| |_| |_ |_ | + | |_ _| | _| |_| | + diff --git a/src/cmd/picoc-1/tests/33_ternary_op.c b/src/cmd/picoc-1/tests/33_ternary_op.c new file mode 100644 index 0000000..5c1cead --- /dev/null +++ b/src/cmd/picoc-1/tests/33_ternary_op.c @@ -0,0 +1,10 @@ +#include + +int Count; + +for (Count = 0; Count < 10; Count++) +{ + printf("%d\n", (Count < 5) ? (Count*Count) : (Count * 3)); +} + +void main() {} diff --git a/src/cmd/picoc-1/tests/33_ternary_op.expect b/src/cmd/picoc-1/tests/33_ternary_op.expect new file mode 100644 index 0000000..45ea507 --- /dev/null +++ b/src/cmd/picoc-1/tests/33_ternary_op.expect @@ -0,0 +1,10 @@ +0 +1 +4 +9 +16 +15 +18 +21 +24 +27 diff --git a/src/cmd/picoc-1/tests/34_array_assignment.c b/src/cmd/picoc-1/tests/34_array_assignment.c new file mode 100644 index 0000000..afe544e --- /dev/null +++ b/src/cmd/picoc-1/tests/34_array_assignment.c @@ -0,0 +1,18 @@ +#include + +int a[4]; + +a[0] = 12; +a[1] = 23; +a[2] = 34; +a[3] = 45; + +printf("%d %d %d %d\n", a[0], a[1], a[2], a[3]); + +int b[4]; + +b = a; + +printf("%d %d %d %d\n", b[0], b[1], b[2], b[3]); + +void main() {} diff --git a/src/cmd/picoc-1/tests/34_array_assignment.expect b/src/cmd/picoc-1/tests/34_array_assignment.expect new file mode 100644 index 0000000..9736bf5 --- /dev/null +++ b/src/cmd/picoc-1/tests/34_array_assignment.expect @@ -0,0 +1,2 @@ +12 23 34 45 +12 23 34 45 diff --git a/src/cmd/picoc-1/tests/35_sizeof.c b/src/cmd/picoc-1/tests/35_sizeof.c new file mode 100644 index 0000000..87c783a --- /dev/null +++ b/src/cmd/picoc-1/tests/35_sizeof.c @@ -0,0 +1,9 @@ +#include + +char a; +short b; + +printf("%d %d\n", sizeof(char), sizeof(a)); +printf("%d %d\n", sizeof(short), sizeof(b)); + +void main() {} diff --git a/src/cmd/picoc-1/tests/35_sizeof.expect b/src/cmd/picoc-1/tests/35_sizeof.expect new file mode 100644 index 0000000..534fb83 --- /dev/null +++ b/src/cmd/picoc-1/tests/35_sizeof.expect @@ -0,0 +1,2 @@ +1 1 +2 2 diff --git a/src/cmd/picoc-1/tests/36_array_initialisers.c b/src/cmd/picoc-1/tests/36_array_initialisers.c new file mode 100644 index 0000000..ce8695b --- /dev/null +++ b/src/cmd/picoc-1/tests/36_array_initialisers.c @@ -0,0 +1,16 @@ +#include + +int Count; + +int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 }; + +for (Count = 0; Count < 10; Count++) + printf("%d: %d\n", Count, Array[Count]); + +int Array2[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753, }; + +for (Count = 0; Count < 10; Count++) + printf("%d: %d\n", Count, Array2[Count]); + + +void main() {} diff --git a/src/cmd/picoc-1/tests/36_array_initialisers.expect b/src/cmd/picoc-1/tests/36_array_initialisers.expect new file mode 100644 index 0000000..3ac6c77 --- /dev/null +++ b/src/cmd/picoc-1/tests/36_array_initialisers.expect @@ -0,0 +1,20 @@ +0: 12 +1: 34 +2: 56 +3: 78 +4: 90 +5: 123 +6: 456 +7: 789 +8: 8642 +9: 9753 +0: 12 +1: 34 +2: 56 +3: 78 +4: 90 +5: 123 +6: 456 +7: 789 +8: 8642 +9: 9753 diff --git a/src/cmd/picoc-1/tests/37_sprintf.c b/src/cmd/picoc-1/tests/37_sprintf.c new file mode 100644 index 0000000..839a4d8 --- /dev/null +++ b/src/cmd/picoc-1/tests/37_sprintf.c @@ -0,0 +1,12 @@ +#include + +char Buf[100]; +int Count; + +for (Count = 1; Count <= 20; Count++) +{ + sprintf(Buf, "->%02d<-\n", Count); + printf("%s", Buf); +} + +void main() {} diff --git a/src/cmd/picoc-1/tests/37_sprintf.expect b/src/cmd/picoc-1/tests/37_sprintf.expect new file mode 100644 index 0000000..a643da8 --- /dev/null +++ b/src/cmd/picoc-1/tests/37_sprintf.expect @@ -0,0 +1,20 @@ +->01<- +->02<- +->03<- +->04<- +->05<- +->06<- +->07<- +->08<- +->09<- +->10<- +->11<- +->12<- +->13<- +->14<- +->15<- +->16<- +->17<- +->18<- +->19<- +->20<- diff --git a/src/cmd/picoc-1/tests/38_multiple_array_index.c b/src/cmd/picoc-1/tests/38_multiple_array_index.c new file mode 100644 index 0000000..383d3ee --- /dev/null +++ b/src/cmd/picoc-1/tests/38_multiple_array_index.c @@ -0,0 +1,29 @@ +#include + +int a[4][4]; +int b = 0; +int x; +int y; + +for (x = 0; x < 4; x++) +{ + for (y = 0; y < 4; y++) + { + b++; + a[x][y] = b; + } +} + + + +for (x = 0; x < 4; x++) +{ + printf("x=%d: ", x); + for (y = 0; y < 4; y++) + { + printf("%d ", a[x][y]); + } + printf("\n"); +} + +void main() {} diff --git a/src/cmd/picoc-1/tests/38_multiple_array_index.expect b/src/cmd/picoc-1/tests/38_multiple_array_index.expect new file mode 100644 index 0000000..747ad75 --- /dev/null +++ b/src/cmd/picoc-1/tests/38_multiple_array_index.expect @@ -0,0 +1,4 @@ +x=0: 1 2 3 4 +x=1: 5 6 7 8 +x=2: 9 10 11 12 +x=3: 13 14 15 16 diff --git a/src/cmd/picoc-1/tests/39_typedef.c b/src/cmd/picoc-1/tests/39_typedef.c new file mode 100644 index 0000000..e36791c --- /dev/null +++ b/src/cmd/picoc-1/tests/39_typedef.c @@ -0,0 +1,26 @@ +#include + +typedef int MyInt; + +MyInt a = 1; +printf("%d\n", a); + +struct FunStruct +{ + int i; + int j; +}; + +typedef struct FunStruct MyFunStruct; + +MyFunStruct b; +b.i = 12; +b.j = 34; +printf("%d,%d\n", b.i, b.j); + +typedef MyFunStruct *MoreFunThanEver; + +MoreFunThanEver c = &b; +printf("%d,%d\n", c->i, c->j); + +void main() {} diff --git a/src/cmd/picoc-1/tests/39_typedef.expect b/src/cmd/picoc-1/tests/39_typedef.expect new file mode 100644 index 0000000..b9050a9 --- /dev/null +++ b/src/cmd/picoc-1/tests/39_typedef.expect @@ -0,0 +1,3 @@ +1 +12,34 +12,34 diff --git a/src/cmd/picoc-1/tests/40_stdio.c b/src/cmd/picoc-1/tests/40_stdio.c new file mode 100644 index 0000000..546ca52 --- /dev/null +++ b/src/cmd/picoc-1/tests/40_stdio.c @@ -0,0 +1,47 @@ +#include + +FILE *f = fopen("fred.txt", "w"); +fwrite("hello\nhello\n", 1, 12, f); +fclose(f); + +char freddy[7]; +f = fopen("fred.txt", "r"); +if (fread(freddy, 1, 6, f) != 6) + printf("couldn't read fred.txt\n"); + +freddy[6] = '\0'; +fclose(f); + +printf("%s", freddy); + +char InChar; +char ShowChar; +f = fopen("fred.txt", "r"); +while ( (InChar = fgetc(f)) != EOF) +{ + ShowChar = InChar; + if (ShowChar < ' ') + ShowChar = '.'; + + printf("ch: %d '%c'\n", InChar, ShowChar); +} +fclose(f); + +f = fopen("fred.txt", "r"); +while ( (InChar = getc(f)) != EOF) +{ + ShowChar = InChar; + if (ShowChar < ' ') + ShowChar = '.'; + + printf("ch: %d '%c'\n", InChar, ShowChar); +} +fclose(f); + +f = fopen("fred.txt", "r"); +while (fgets(freddy, sizeof(freddy), f) != NULL) + printf("x: %s", freddy); + +fclose(f); + +void main() {} diff --git a/src/cmd/picoc-1/tests/40_stdio.expect b/src/cmd/picoc-1/tests/40_stdio.expect new file mode 100644 index 0000000..e08167a --- /dev/null +++ b/src/cmd/picoc-1/tests/40_stdio.expect @@ -0,0 +1,27 @@ +hello +ch: 104 'h' +ch: 101 'e' +ch: 108 'l' +ch: 108 'l' +ch: 111 'o' +ch: 10 '.' +ch: 104 'h' +ch: 101 'e' +ch: 108 'l' +ch: 108 'l' +ch: 111 'o' +ch: 10 '.' +ch: 104 'h' +ch: 101 'e' +ch: 108 'l' +ch: 108 'l' +ch: 111 'o' +ch: 10 '.' +ch: 104 'h' +ch: 101 'e' +ch: 108 'l' +ch: 108 'l' +ch: 111 'o' +ch: 10 '.' +x: hello +x: hello diff --git a/src/cmd/picoc-1/tests/41_hashif.c b/src/cmd/picoc-1/tests/41_hashif.c new file mode 100644 index 0000000..b1883c0 --- /dev/null +++ b/src/cmd/picoc-1/tests/41_hashif.c @@ -0,0 +1,80 @@ +#include + +printf("#include test\n"); + +#if 1 + #if 0 + printf("a\n"); + #else + printf("b\n"); + #endif +#else + #if 0 + printf("c\n"); + #else + printf("d\n"); + #endif +#endif + +#if 0 + #if 1 + printf("e\n"); + #else + printf("f\n"); + #endif +#else + #if 1 + printf("g\n"); + #else + printf("h\n"); + #endif +#endif + +#define DEF + +#ifdef DEF + #ifdef DEF + printf("i\n"); + #else + printf("j\n"); + #endif +#else + #ifdef DEF + printf("k\n"); + #else + printf("l\n"); + #endif +#endif + +#ifndef DEF + #ifndef DEF + printf("m\n"); + #else + printf("n\n"); + #endif +#else + #ifndef DEF + printf("o\n"); + #else + printf("p\n"); + #endif +#endif + +#define ONE 1 +#define ZERO 0 + +#if ONE + #if ZERO + printf("q\n"); + #else + printf("r\n"); + #endif +#else + #if ZERO + printf("s\n"); + #else + printf("t\n"); + #endif +#endif + +void main() {} diff --git a/src/cmd/picoc-1/tests/41_hashif.expect b/src/cmd/picoc-1/tests/41_hashif.expect new file mode 100644 index 0000000..5fd414b --- /dev/null +++ b/src/cmd/picoc-1/tests/41_hashif.expect @@ -0,0 +1,6 @@ +#include test +b +g +i +p +r diff --git a/src/cmd/picoc-1/tests/42_function_pointer.c b/src/cmd/picoc-1/tests/42_function_pointer.c new file mode 100644 index 0000000..ce39708 --- /dev/null +++ b/src/cmd/picoc-1/tests/42_function_pointer.c @@ -0,0 +1,15 @@ +#include + +int fred(int p) +{ + printf("yo %d\n", p); + return 42; +} + +int (*f)(int) = &fred; + +int main() +{ + printf("%d\n", (*f)(24)); + return 0; +} diff --git a/src/cmd/picoc-1/tests/43_void_param.c b/src/cmd/picoc-1/tests/43_void_param.c new file mode 100644 index 0000000..4803d94 --- /dev/null +++ b/src/cmd/picoc-1/tests/43_void_param.c @@ -0,0 +1,10 @@ +#include + +void fred(void) +{ + printf("yo\n"); +} + +fred(); + +void main() {} diff --git a/src/cmd/picoc-1/tests/43_void_param.expect b/src/cmd/picoc-1/tests/43_void_param.expect new file mode 100644 index 0000000..092bfb9 --- /dev/null +++ b/src/cmd/picoc-1/tests/43_void_param.expect @@ -0,0 +1 @@ +yo diff --git a/src/cmd/picoc-1/tests/44_scoped_declarations.c b/src/cmd/picoc-1/tests/44_scoped_declarations.c new file mode 100644 index 0000000..50337ef --- /dev/null +++ b/src/cmd/picoc-1/tests/44_scoped_declarations.c @@ -0,0 +1,12 @@ +#include + +int a; + +for (a = 0; a < 2; a++) +{ + int b = a; +} + +printf("it's all good\n"); + +void main() {} diff --git a/src/cmd/picoc-1/tests/44_scoped_declarations.expect b/src/cmd/picoc-1/tests/44_scoped_declarations.expect new file mode 100644 index 0000000..231ccc0 --- /dev/null +++ b/src/cmd/picoc-1/tests/44_scoped_declarations.expect @@ -0,0 +1 @@ +it's all good diff --git a/src/cmd/picoc-1/tests/45_empty_for.c b/src/cmd/picoc-1/tests/45_empty_for.c new file mode 100644 index 0000000..28d0b6c --- /dev/null +++ b/src/cmd/picoc-1/tests/45_empty_for.c @@ -0,0 +1,16 @@ +#include + +int main() +{ + int Count = 0; + + for (;;) + { + Count++; + printf("%d\n", Count); + if (Count >= 10) + break; + } + + return 0; +} diff --git a/src/cmd/picoc-1/tests/45_empty_for.expect b/src/cmd/picoc-1/tests/45_empty_for.expect new file mode 100644 index 0000000..f00c965 --- /dev/null +++ b/src/cmd/picoc-1/tests/45_empty_for.expect @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/src/cmd/picoc-1/tests/46_grep.c b/src/cmd/picoc-1/tests/46_grep.c new file mode 100644 index 0000000..b142f98 --- /dev/null +++ b/src/cmd/picoc-1/tests/46_grep.c @@ -0,0 +1,562 @@ +/* + * The information in this document is subject to change + * without notice and should not be construed as a commitment + * by Digital Equipment Corporation or by DECUS. + * + * Neither Digital Equipment Corporation, DECUS, nor the authors + * assume any responsibility for the use or reliability of this + * document or the described software. + * + * Copyright (C) 1980, DECUS + * + * General permission to copy or modify, but not for profit, is + * hereby granted, provided that the above copyright notice is + * included and reference made to the fact that reproduction + * privileges were granted by DECUS. + */ +#include + +/* + * grep + * + * Runs on the Decus compiler or on vms, On vms, define as: + * grep :== "$disk:[account]grep" (native) + * grep :== "$disk:[account]grep grep" (Decus) + * See below for more information. + */ + +#if 0 +char *documentation[] = { +"grep searches a file for a given pattern. Execute by", +" grep [flags] regular_expression file_list\n", +"Flags are single characters preceeded by '-':", +" -c Only a count of matching lines is printed", +" -f Print file name for matching lines switch, see below", +" -n Each line is preceeded by its line number", +" -v Only print non-matching lines\n", +"The file_list is a list of files (wildcards are acceptable on RSX modes).", +"\nThe file name is normally printed if there is a file given.", +"The -f flag reverses this action (print name no file, not if more).\n", +0 }; + +char *patdoc[] = { +"The regular_expression defines the pattern to search for. Upper- and", +"lower-case are always ignored. Blank lines never match. The expression", +"should be quoted to prevent file-name translation.", +"x An ordinary character (not mentioned below) matches that character.", +"'\\' The backslash quotes any character. \"\\$\" matches a dollar-sign.", +"'^' A circumflex at the beginning of an expression matches the", +" beginning of a line.", +"'$' A dollar-sign at the end of an expression matches the end of a line.", +"'.' A period matches any character except \"new-line\".", +"':a' A colon matches a class of characters described by the following", +"':d' character. \":a\" matches any alphabetic, \":d\" matches digits,", +"':n' \":n\" matches alphanumerics, \": \" matches spaces, tabs, and", +"': ' other control characters, such as new-line.", +"'*' An expression followed by an asterisk matches zero or more", +" occurrances of that expression: \"fo*\" matches \"f\", \"fo\"", +" \"foo\", etc.", +"'+' An expression followed by a plus sign matches one or more", +" occurrances of that expression: \"fo+\" matches \"fo\", etc.", +"'-' An expression followed by a minus sign optionally matches", +" the expression.", +"'[]' A string enclosed in square brackets matches any character in", +" that string, but no others. If the first character in the", +" string is a circumflex, the expression matches any character", +" except \"new-line\" and the characters in the string. For", +" example, \"[xyz]\" matches \"xx\" and \"zyx\", while \"[^xyz]\"", +" matches \"abc\" but not \"axb\". A range of characters may be", +" specified by two characters separated by \"-\". Note that,", +" [a-z] matches alphabetics, while [z-a] never matches.", +"The concatenation of regular expressions is a regular expression.", +0}; +#endif + +#define LMAX 512 +#define PMAX 256 + +#define CHAR 1 +#define BOL 2 +#define EOL 3 +#define ANY 4 +#define CLASS 5 +#define NCLASS 6 +#define STAR 7 +#define PLUS 8 +#define MINUS 9 +#define ALPHA 10 +#define DIGIT 11 +#define NALPHA 12 +#define PUNCT 13 +#define RANGE 14 +#define ENDPAT 15 + +int cflag=0, fflag=0, nflag=0, vflag=0, nfile=0, debug=0; + +char *pp, lbuf[LMAX], pbuf[PMAX]; + +char *cclass(); +char *pmatch(); + + +/*** Display a file name *******************************/ +void file(char *s) +{ + printf("File %s:\n", s); +} + +/*** Report unopenable file ****************************/ +void cant(char *s) +{ + fprintf(stderr, "%s: cannot open\n", s); +} + +/*** Give good help ************************************/ +void help(char **hp) +{ + char **dp; + + for (dp = hp; *dp; ++dp) + printf("%s\n", *dp); +} + +/*** Display usage summary *****************************/ +void usage(char *s) +{ + fprintf(stderr, "?GREP-E-%s\n", s); + fprintf(stderr, + "Usage: grep [-cfnv] pattern [file ...]. grep ? for help\n"); + exit(1); +} + +/*** Compile the pattern into global pbuf[] ************/ +void compile(char *source) +{ + char *s; /* Source string pointer */ + char *lp; /* Last pattern pointer */ + int c; /* Current character */ + int o; /* Temp */ + char *spp; /* Save beginning of pattern */ + + s = source; + if (debug) + printf("Pattern = \"%s\"\n", s); + pp = pbuf; + while (c = *s++) { + /* + * STAR, PLUS and MINUS are special. + */ + if (c == '*' || c == '+' || c == '-') { + if (pp == pbuf || + (o=pp[-1]) == BOL || + o == EOL || + o == STAR || + o == PLUS || + o == MINUS) + badpat("Illegal occurrance op.", source, s); + store(ENDPAT); + store(ENDPAT); + spp = pp; /* Save pattern end */ + while (--pp > lp) /* Move pattern down */ + *pp = pp[-1]; /* one byte */ + *pp = (c == '*') ? STAR : + (c == '-') ? MINUS : PLUS; + pp = spp; /* Restore pattern end */ + continue; + } + /* + * All the rest. + */ + lp = pp; /* Remember start */ + switch(c) { + + case '^': + store(BOL); + break; + + case '$': + store(EOL); + break; + + case '.': + store(ANY); + break; + + case '[': + s = cclass(source, s); + break; + + case ':': + if (*s) { + switch(tolower(c = *s++)) { + + case 'a': + case 'A': + store(ALPHA); + break; + + case 'd': + case 'D': + store(DIGIT); + break; + + case 'n': + case 'N': + store(NALPHA); + break; + + case ' ': + store(PUNCT); + break; + + default: + badpat("Unknown : type", source, s); + + } + break; + } + else badpat("No : type", source, s); + + case '\\': + if (*s) + c = *s++; + + default: + store(CHAR); + store(tolower(c)); + } + } + store(ENDPAT); + store(0); /* Terminate string */ + if (debug) { + for (lp = pbuf; lp < pp;) { + if ((c = (*lp++ & 0377)) < ' ') + printf("\\%o ", c); + else printf("%c ", c); + } + printf("\n"); + } +} + +/*** Compile a class (within []) ***********************/ +char *cclass(char *source, char *src) +/* char *source; // Pattern start -- for error msg. */ +/* char *src; // Class start */ +{ + char *s; /* Source pointer */ + char *cp; /* Pattern start */ + int c; /* Current character */ + int o; /* Temp */ + + s = src; + o = CLASS; + if (*s == '^') { + ++s; + o = NCLASS; + } + store(o); + cp = pp; + store(0); /* Byte count */ + while ((c = *s++) && c!=']') { + if (c == '\\') { /* Store quoted char */ + if ((c = *s++) == '\0') /* Gotta get something */ + badpat("Class terminates badly", source, s); + else store(tolower(c)); + } + else if (c == '-' && + (pp - cp) > 1 && *s != ']' && *s != '\0') { + c = pp[-1]; /* Range start */ + pp[-1] = RANGE; /* Range signal */ + store(c); /* Re-store start */ + c = *s++; /* Get end char and*/ + store(tolower(c)); /* Store it */ + } + else { + store(tolower(c)); /* Store normal char */ + } + } + if (c != ']') + badpat("Unterminated class", source, s); + if ((c = (pp - cp)) >= 256) + badpat("Class too large", source, s); + if (c == 0) + badpat("Empty class", source, s); + *cp = c; + return(s); +} + +/*** Store an entry in the pattern buffer **************/ +void store(int op) +{ + if (pp >= &pbuf[PMAX]) + error("Pattern too complex\n"); + *pp++ = op; +} + +/*** Report a bad pattern specification ****************/ +void badpat(char *message, char *source, char *stop) +/* char *message; // Error message */ +/* char *source; // Pattern start */ +/* char *stop; // Pattern end */ +{ + fprintf(stderr, "-GREP-E-%s, pattern is\"%s\"\n", message, source); + fprintf(stderr, "-GREP-E-Stopped at byte %d, '%c'\n", + stop-source, stop[-1]); + error("?GREP-E-Bad pattern\n"); +} + +/*** Scan the file for the pattern in pbuf[] ***********/ +void grep(FILE *fp, char *fn) +/* FILE *fp; // File to process */ +/* char *fn; // File name (for -f option) */ +{ + int lno, count, m; + + lno = 0; + count = 0; + while (fgets(lbuf, LMAX, fp)) { + ++lno; + m = match(); + if ((m && !vflag) || (!m && vflag)) { + ++count; + if (!cflag) { + if (fflag && fn) { + file(fn); + fn = 0; + } + if (nflag) + printf("%d\t", lno); + printf("%s\n", lbuf); + } + } + } + if (cflag) { + if (fflag && fn) + file(fn); + printf("%d\n", count); + } +} + +/*** Match line (lbuf) with pattern (pbuf) return 1 if match ***/ +void match() +{ + char *l; /* Line pointer */ + + for (l = lbuf; *l; ++l) { + if (pmatch(l, pbuf)) + return(1); + } + return(0); +} + +/*** Match partial line with pattern *******************/ +char *pmatch(char *line, char *pattern) +/* char *line; // (partial) line to match */ +/* char *pattern; // (partial) pattern to match */ +{ + char *l; /* Current line pointer */ + char *p; /* Current pattern pointer */ + char c; /* Current character */ + char *e; /* End for STAR and PLUS match */ + int op; /* Pattern operation */ + int n; /* Class counter */ + char *are; /* Start of STAR match */ + + l = line; + if (debug > 1) + printf("pmatch(\"%s\")\n", line); + p = pattern; + while ((op = *p++) != ENDPAT) { + if (debug > 1) + printf("byte[%d] = 0%o, '%c', op = 0%o\n", + l-line, *l, *l, op); + switch(op) { + + case CHAR: + if (tolower(*l++) != *p++) + return(0); + break; + + case BOL: + if (l != lbuf) + return(0); + break; + + case EOL: + if (*l != '\0') + return(0); + break; + + case ANY: + if (*l++ == '\0') + return(0); + break; + + case DIGIT: + if ((c = *l++) < '0' || (c > '9')) + return(0); + break; + + case ALPHA: + c = tolower(*l++); + if (c < 'a' || c > 'z') + return(0); + break; + + case NALPHA: + c = tolower(*l++); + if (c >= 'a' && c <= 'z') + break; + else if (c < '0' || c > '9') + return(0); + break; + + case PUNCT: + c = *l++; + if (c == 0 || c > ' ') + return(0); + break; + + case CLASS: + case NCLASS: + c = tolower(*l++); + n = *p++ & 0377; + do { + if (*p == RANGE) { + p += 3; + n -= 2; + if (c >= p[-2] && c <= p[-1]) + break; + } + else if (c == *p++) + break; + } while (--n > 1); + if ((op == CLASS) == (n <= 1)) + return(0); + if (op == CLASS) + p += n - 2; + break; + + case MINUS: + e = pmatch(l, p); /* Look for a match */ + while (*p++ != ENDPAT); /* Skip over pattern */ + if (e) /* Got a match? */ + l = e; /* Yes, update string */ + break; /* Always succeeds */ + + case PLUS: /* One or more ... */ + if ((l = pmatch(l, p)) == 0) + return(0); /* Gotta have a match */ + case STAR: /* Zero or more ... */ + are = l; /* Remember line start */ + while (*l && (e = pmatch(l, p))) + l = e; /* Get longest match */ + while (*p++ != ENDPAT); /* Skip over pattern */ + while (l >= are) { /* Try to match rest */ + if (e = pmatch(l, p)) + return(e); + --l; /* Nope, try earlier */ + } + return(0); /* Nothing else worked */ + + default: + printf("Bad op code %d\n", op); + error("Cannot happen -- match\n"); + } + } + return(l); +} + +/*** Report an error ***********************************/ +void error(char *s) +{ + fprintf(stderr, "%s", s); + exit(1); +} + +/*** Main program - parse arguments & grep *************/ +int main(int argc, char **argv) +{ + char *p; + int c, i; + int gotpattern; + + FILE *f; + + if (argc <= 1) + usage("No arguments"); + if (argc == 2 && argv[1][0] == '?' && argv[1][1] == 0) { + help(documentation); + help(patdoc); + return; + } + nfile = argc-1; + gotpattern = 0; + for (i=1; i < argc; ++i) { + p = argv[i]; + if (*p == '-') { + ++p; + while (c = *p++) { + switch(tolower(c)) { + + case '?': + help(documentation); + break; + + case 'C': + case 'c': + ++cflag; + break; + + case 'D': + case 'd': + ++debug; + break; + + case 'F': + case 'f': + ++fflag; + break; + + case 'n': + case 'N': + ++nflag; + break; + + case 'v': + case 'V': + ++vflag; + break; + + default: + usage("Unknown flag"); + } + } + argv[i] = 0; + --nfile; + } else if (!gotpattern) { + compile(p); + argv[i] = 0; + ++gotpattern; + --nfile; + } + } + if (!gotpattern) + usage("No pattern"); + if (nfile == 0) + grep(stdin, 0); + else { + fflag = fflag ^ (nfile > 0); + for (i=1; i < argc; ++i) { + if (p = argv[i]) { + if ((f=fopen(p, "r")) == NULL) + cant(p); + else { + grep(f, p); + fclose(f); + } + } + } + } +} + diff --git a/src/cmd/picoc-1/tests/47_switch_return.c b/src/cmd/picoc-1/tests/47_switch_return.c new file mode 100644 index 0000000..2fdb8bd --- /dev/null +++ b/src/cmd/picoc-1/tests/47_switch_return.c @@ -0,0 +1,23 @@ +#include + +void fred(int x) +{ + switch (x) + { + case 1: printf("1\n"); return; + case 2: printf("2\n"); break; + case 3: printf("3\n"); return; + } + + printf("out\n"); +} + +int main() +{ + fred(1); + fred(2); + fred(3); + + return 0; +} + diff --git a/src/cmd/picoc-1/tests/47_switch_return.expect b/src/cmd/picoc-1/tests/47_switch_return.expect new file mode 100644 index 0000000..b6deb7e --- /dev/null +++ b/src/cmd/picoc-1/tests/47_switch_return.expect @@ -0,0 +1,4 @@ +1 +2 +out +3 diff --git a/src/cmd/picoc-1/tests/48_nested_break.c b/src/cmd/picoc-1/tests/48_nested_break.c new file mode 100644 index 0000000..4b01a99 --- /dev/null +++ b/src/cmd/picoc-1/tests/48_nested_break.c @@ -0,0 +1,24 @@ +#include + +int a; +char b; + +a = 0; +while (a < 2) +{ + printf("%d", a++); + break; + + b = 'A'; + while (b < 'C') + { + printf("%c", b++); + } + printf("e"); +} +printf("\n"); + +int main() +{ + return 0; +} diff --git a/src/cmd/picoc-1/tests/48_nested_break.expect b/src/cmd/picoc-1/tests/48_nested_break.expect new file mode 100644 index 0000000..573541a --- /dev/null +++ b/src/cmd/picoc-1/tests/48_nested_break.expect @@ -0,0 +1 @@ +0 diff --git a/src/cmd/picoc-1/tests/49_bracket_evaluation.c b/src/cmd/picoc-1/tests/49_bracket_evaluation.c new file mode 100644 index 0000000..b4303c6 --- /dev/null +++ b/src/cmd/picoc-1/tests/49_bracket_evaluation.c @@ -0,0 +1,21 @@ +#include + +struct point +{ + double x; + double y; +}; + +struct point point_array[100]; + +int main() +{ + int my_point = 10; + + point_array[my_point].x = 12.34; + point_array[my_point].y = 56.78; + + printf("%f, %f\n", point_array[my_point].x, point_array[my_point].y); + + return 0; +} diff --git a/src/cmd/picoc-1/tests/49_bracket_evaluation.expect b/src/cmd/picoc-1/tests/49_bracket_evaluation.expect new file mode 100644 index 0000000..1da66db --- /dev/null +++ b/src/cmd/picoc-1/tests/49_bracket_evaluation.expect @@ -0,0 +1 @@ +12.340000, 56.780000 diff --git a/src/cmd/picoc-1/tests/50_logical_second_arg.c b/src/cmd/picoc-1/tests/50_logical_second_arg.c new file mode 100644 index 0000000..f4be825 --- /dev/null +++ b/src/cmd/picoc-1/tests/50_logical_second_arg.c @@ -0,0 +1,27 @@ +#include + +int fred() +{ + printf("fred\n"); + return 0; +} + +int joe() +{ + printf("joe\n"); + return 1; +} + +int main() +{ + printf("%d\n", fred() && joe()); + printf("%d\n", fred() || joe()); + printf("%d\n", joe() && fred()); + printf("%d\n", joe() || fred()); + printf("%d\n", fred() && (1 + joe())); + printf("%d\n", fred() || (0 + joe())); + printf("%d\n", joe() && (0 + fred())); + printf("%d\n", joe() || (1 + fred())); + + return 0; +} diff --git a/src/cmd/picoc-1/tests/50_logical_second_arg.expect b/src/cmd/picoc-1/tests/50_logical_second_arg.expect new file mode 100644 index 0000000..d6174ae --- /dev/null +++ b/src/cmd/picoc-1/tests/50_logical_second_arg.expect @@ -0,0 +1,20 @@ +fred +0 +fred +joe +1 +joe +fred +0 +joe +1 +fred +0 +fred +joe +1 +joe +fred +0 +joe +1 diff --git a/src/cmd/picoc-1/tests/51_static.c b/src/cmd/picoc-1/tests/51_static.c new file mode 100644 index 0000000..3e93ba9 --- /dev/null +++ b/src/cmd/picoc-1/tests/51_static.c @@ -0,0 +1,26 @@ +#include + +static int fred = 1234; +static int joe; + +void henry() +{ + static int fred = 4567; + + printf("%d\n", fred); + fred++; +} + +void main() +{ + printf("%d\n", fred); + henry(); + henry(); + henry(); + henry(); + printf("%d\n", fred); + fred = 8901; + joe = 2345; + printf("%d\n", fred); + printf("%d\n", joe); +} diff --git a/src/cmd/picoc-1/tests/51_static.expect b/src/cmd/picoc-1/tests/51_static.expect new file mode 100644 index 0000000..18224fa --- /dev/null +++ b/src/cmd/picoc-1/tests/51_static.expect @@ -0,0 +1,8 @@ +1234 +4567 +4568 +4569 +4570 +1234 +8901 +2345 diff --git a/src/cmd/picoc-1/tests/52_unnamed_enum.c b/src/cmd/picoc-1/tests/52_unnamed_enum.c new file mode 100644 index 0000000..7e99bfd --- /dev/null +++ b/src/cmd/picoc-1/tests/52_unnamed_enum.c @@ -0,0 +1,24 @@ +#include + +enum fred { a, b, c }; + +printf("a=%d\n", a); +printf("b=%d\n", b); +printf("c=%d\n", c); + +enum fred d; + +typedef enum { e, f, g } h; +typedef enum { i, j, k } m; + +printf("e=%d\n", e); +printf("f=%d\n", f); +printf("g=%d\n", g); + +printf("i=%d\n", i); +printf("j=%d\n", j); +printf("k=%d\n", k); + +void main() +{ +} diff --git a/src/cmd/picoc-1/tests/52_unnamed_enum.expect b/src/cmd/picoc-1/tests/52_unnamed_enum.expect new file mode 100644 index 0000000..84f2ac8 --- /dev/null +++ b/src/cmd/picoc-1/tests/52_unnamed_enum.expect @@ -0,0 +1,9 @@ +a=0 +b=1 +c=2 +e=0 +f=1 +g=2 +i=0 +j=1 +k=2 diff --git a/src/cmd/picoc-1/tests/54_goto.c b/src/cmd/picoc-1/tests/54_goto.c new file mode 100644 index 0000000..65ee7e2 --- /dev/null +++ b/src/cmd/picoc-1/tests/54_goto.c @@ -0,0 +1,52 @@ +#include + +void fred() +{ + printf("In fred()\n"); + goto done; + printf("In middle\n"); +done: + printf("At end\n"); +} + +void joe() +{ + int b = 5678; + + printf("In joe()\n"); + + { + int c = 1234; + printf("c = %d\n", c); + goto outer; + printf("uh-oh\n"); + } + +outer: + + printf("done\n"); +} + +void henry() +{ + int a; + + printf("In henry()\n"); + goto inner; + + { + int b; +inner: + b = 1234; + printf("b = %d\n", b); + } + + printf("done\n"); +} + +void main() +{ + fred(); + joe(); + henry(); +} diff --git a/src/cmd/picoc-1/tests/54_goto.expect b/src/cmd/picoc-1/tests/54_goto.expect new file mode 100644 index 0000000..8e553fa --- /dev/null +++ b/src/cmd/picoc-1/tests/54_goto.expect @@ -0,0 +1,8 @@ +In fred() +At end +In joe() +c = 1234 +done +In henry() +b = 1234 +done diff --git a/src/cmd/picoc-1/tests/55_array_initialiser.c b/src/cmd/picoc-1/tests/55_array_initialiser.c new file mode 100644 index 0000000..6d3d028 --- /dev/null +++ b/src/cmd/picoc-1/tests/55_array_initialiser.c @@ -0,0 +1,12 @@ +#include + +int main() +{ + int fred[3] = { 12, 34, 56 }; + double joe[] = { 23.4, 56.7, 89.0 }; + + printf("%d %d %d\n", fred[0], fred[1], fred[2]); + printf("%f %f %f\n", joe[0], joe[1], joe[2]); + + return 0; +} diff --git a/src/cmd/picoc-1/tests/55_array_initialiser.expect b/src/cmd/picoc-1/tests/55_array_initialiser.expect new file mode 100644 index 0000000..c486310 --- /dev/null +++ b/src/cmd/picoc-1/tests/55_array_initialiser.expect @@ -0,0 +1,2 @@ +12 34 56 +23.400000 56.700000 89.000000 diff --git a/src/cmd/picoc-1/tests/Makefile b/src/cmd/picoc-1/tests/Makefile new file mode 100644 index 0000000..a73199a --- /dev/null +++ b/src/cmd/picoc-1/tests/Makefile @@ -0,0 +1,74 @@ +TESTS= 00_assignment.test \ + 01_comment.test \ + 02_printf.test \ + 03_struct.test \ + 04_for.test \ + 05_array.test \ + 06_case.test \ + 07_function.test \ + 08_while.test \ + 09_do_while.test \ + 10_pointer.test \ + 11_precedence.test \ + 12_hashdefine.test \ + 13_integer_literals.test \ + 14_if.test \ + 15_recursion.test \ + 16_nesting.test \ + 17_enum.test \ + 18_include.test \ + 19_pointer_arithmetic.test \ + 20_pointer_comparison.test \ + 21_char_array.test \ + 22_floating_point.test \ + 23_type_coercion.test \ + 24_math_library.test \ + 25_quicksort.test \ + 26_character_constants.test \ + 28_strings.test \ + 29_array_address.test \ + 30_hanoi.test \ + 31_args.test \ + 32_led.test \ + 33_ternary_op.test \ + 34_array_assignment.test \ + 35_sizeof.test \ + 36_array_initialisers.test \ + 37_sprintf.test \ + 38_multiple_array_index.test \ + 39_typedef.test \ + 40_stdio.test \ + 41_hashif.test \ + 43_void_param.test \ + 44_scoped_declarations.test \ + 45_empty_for.test \ + 47_switch_return.test \ + 48_nested_break.test \ + 49_bracket_evaluation.test \ + 50_logical_second_arg.test \ + 51_static.test \ + 52_unnamed_enum.test \ + 54_goto.test \ + 55_array_initialiser.test + +%.test: %.expect %.c + @echo Test: $*... + @if [ "x`echo $* | grep args`" != "x" ]; \ + then \ + ../picoc $*.c - arg1 arg2 arg3 arg4 2>&1 >$*.output; \ + else \ + ../picoc $*.c 2>&1 >$*.output; \ + fi + @if [ "x`diff -qbu $*.expect $*.output`" != "x" ]; \ + then \ + echo "error in test $*"; \ + diff -u $*.expect $*.output; \ + rm -f $*.output; \ + exit 1; \ + fi; \ + rm -f $*.output + +all: test + +test: $(TESTS) + @echo "test passed" diff --git a/src/cmd/picoc-1/type.c b/src/cmd/picoc-1/type.c new file mode 100644 index 0000000..2f91df9 --- /dev/null +++ b/src/cmd/picoc-1/type.c @@ -0,0 +1,549 @@ +/* picoc data type module. This manages a tree of data types and has facilities + * for parsing data types. */ + +#include "interpreter.h" + +/* some basic types */ +struct ValueType UberType; +struct ValueType IntType; +struct ValueType ShortType; +struct ValueType CharType; +struct ValueType LongType; +struct ValueType UnsignedIntType; +struct ValueType UnsignedShortType; +struct ValueType UnsignedLongType; +#ifndef NO_FP +struct ValueType FPType; +#endif +struct ValueType VoidType; +struct ValueType TypeType; +struct ValueType FunctionType; +struct ValueType MacroType; +struct ValueType EnumType; +struct ValueType GotoLabelType; +struct ValueType *CharPtrType; +struct ValueType *CharPtrPtrType; +struct ValueType *CharArrayType; +struct ValueType *VoidPtrType; + +static int PointerAlignBytes; +static int IntAlignBytes; + + +/* add a new type to the set of types we know about */ +struct ValueType *TypeAdd(struct ParseState *Parser, struct ValueType *ParentType, enum BaseType Base, int ArraySize, const char *Identifier, int Sizeof, int AlignBytes) +{ + struct ValueType *NewType = VariableAlloc(Parser, sizeof(struct ValueType), TRUE); + NewType->Base = Base; + NewType->ArraySize = ArraySize; + NewType->Sizeof = Sizeof; + NewType->AlignBytes = AlignBytes; + NewType->Identifier = Identifier; + NewType->Members = NULL; + NewType->FromType = ParentType; + NewType->DerivedTypeList = NULL; + NewType->OnHeap = TRUE; + NewType->Next = ParentType->DerivedTypeList; + ParentType->DerivedTypeList = NewType; + + return NewType; +} + +/* given a parent type, get a matching derived type and make one if necessary. + * Identifier should be registered with the shared string table. */ +struct ValueType *TypeGetMatching(struct ParseState *Parser, struct ValueType *ParentType, enum BaseType Base, int ArraySize, const char *Identifier, int AllowDuplicates) +{ + int Sizeof; + int AlignBytes; + struct ValueType *ThisType = ParentType->DerivedTypeList; + while (ThisType != NULL && (ThisType->Base != Base || ThisType->ArraySize != ArraySize || ThisType->Identifier != Identifier)) + ThisType = ThisType->Next; + + if (ThisType != NULL) + { + if (AllowDuplicates) + return ThisType; + else + ProgramFail(Parser, "data type '%s' is already defined", Identifier); + } + + switch (Base) + { + case TypePointer: Sizeof = sizeof(void *); AlignBytes = PointerAlignBytes; break; + case TypeArray: Sizeof = ArraySize * ParentType->Sizeof; AlignBytes = ParentType->AlignBytes; break; + case TypeEnum: Sizeof = sizeof(int); AlignBytes = IntAlignBytes; break; + default: Sizeof = 0; AlignBytes = 0; break; /* structs and unions will get bigger when we add members to them */ + } + + return TypeAdd(Parser, ParentType, Base, ArraySize, Identifier, Sizeof, AlignBytes); +} + +/* stack space used by a value */ +int TypeStackSizeValue(struct Value *Val) +{ + if (Val != NULL && Val->ValOnStack) + return TypeSizeValue(Val, FALSE); + else + return 0; +} + +/* memory used by a value */ +int TypeSizeValue(struct Value *Val, int Compact) +{ + if (IS_INTEGER_NUMERIC(Val) && !Compact) + return sizeof(ALIGN_TYPE); /* allow some extra room for type extension */ + else if (Val->Typ->Base != TypeArray) + return Val->Typ->Sizeof; + else + return Val->Typ->FromType->Sizeof * Val->Typ->ArraySize; +} + +/* memory used by a variable given its type and array size */ +int TypeSize(struct ValueType *Typ, int ArraySize, int Compact) +{ + if (IS_INTEGER_NUMERIC_TYPE(Typ) && !Compact) + return sizeof(ALIGN_TYPE); /* allow some extra room for type extension */ + else if (Typ->Base != TypeArray) + return Typ->Sizeof; + else + return Typ->FromType->Sizeof * ArraySize; +} + +/* add a base type */ +void TypeAddBaseType(struct ValueType *TypeNode, enum BaseType Base, int Sizeof, int AlignBytes) +{ + TypeNode->Base = Base; + TypeNode->ArraySize = 0; + TypeNode->Sizeof = Sizeof; + TypeNode->AlignBytes = AlignBytes; + TypeNode->Identifier = StrEmpty; + TypeNode->Members = NULL; + TypeNode->FromType = NULL; + TypeNode->DerivedTypeList = NULL; + TypeNode->OnHeap = FALSE; + TypeNode->Next = UberType.DerivedTypeList; + UberType.DerivedTypeList = TypeNode; +} + +/* initialise the type system */ +void TypeInit() +{ + struct IntAlign { char x; int y; } ia; + struct ShortAlign { char x; short y; } sa; + struct CharAlign { char x; char y; } ca; + struct LongAlign { char x; long y; } la; +#ifndef NO_FP + struct DoubleAlign { char x; double y; } da; +#endif + struct PointerAlign { char x; void *y; } pa; + + IntAlignBytes = (char *)&ia.y - &ia.x; + PointerAlignBytes = (char *)&pa.y - &pa.x; + + UberType.DerivedTypeList = NULL; + TypeAddBaseType(&IntType, TypeInt, sizeof(int), IntAlignBytes); + TypeAddBaseType(&ShortType, TypeShort, sizeof(short), (char *)&sa.y - &sa.x); + TypeAddBaseType(&CharType, TypeChar, sizeof(unsigned char), (char *)&ca.y - &ca.x); + TypeAddBaseType(&LongType, TypeLong, sizeof(long), (char *)&la.y - &la.x); + TypeAddBaseType(&UnsignedIntType, TypeUnsignedInt, sizeof(unsigned int), IntAlignBytes); + TypeAddBaseType(&UnsignedShortType, TypeUnsignedShort, sizeof(unsigned short), (char *)&sa.y - &sa.x); + TypeAddBaseType(&UnsignedLongType, TypeUnsignedLong, sizeof(unsigned long), (char *)&la.y - &la.x); + TypeAddBaseType(&VoidType, TypeVoid, 0, 1); + TypeAddBaseType(&FunctionType, TypeFunction, sizeof(int), IntAlignBytes); + TypeAddBaseType(&MacroType, TypeMacro, sizeof(int), IntAlignBytes); + TypeAddBaseType(&GotoLabelType, TypeGotoLabel, 0, 1); +#ifndef NO_FP + TypeAddBaseType(&FPType, TypeFP, sizeof(double), (char *)&da.y - &da.x); + TypeAddBaseType(&TypeType, Type_Type, sizeof(double), (char *)&da.y - &da.x); /* must be large enough to cast to a double */ +#else + TypeAddBaseType(&TypeType, Type_Type, sizeof(struct ValueType *), PointerAlignBytes); +#endif + CharArrayType = TypeAdd(NULL, &CharType, TypeArray, 0, StrEmpty, sizeof(char), (char *)&ca.y - &ca.x); + CharPtrType = TypeAdd(NULL, &CharType, TypePointer, 0, StrEmpty, sizeof(void *), PointerAlignBytes); + CharPtrPtrType = TypeAdd(NULL, CharPtrType, TypePointer, 0, StrEmpty, sizeof(void *), PointerAlignBytes); + VoidPtrType = TypeAdd(NULL, &VoidType, TypePointer, 0, StrEmpty, sizeof(void *), PointerAlignBytes); +} + +/* deallocate heap-allocated types */ +void TypeCleanupNode(struct ValueType *Typ) +{ + struct ValueType *SubType; + struct ValueType *NextSubType; + + /* clean up and free all the sub-nodes */ + for (SubType = Typ->DerivedTypeList; SubType != NULL; SubType = NextSubType) + { + NextSubType = SubType->Next; + TypeCleanupNode(SubType); + if (SubType->OnHeap) + { + /* if it's a struct or union deallocate all the member values */ + if (SubType->Members != NULL) + { + VariableTableCleanup(SubType->Members); + HeapFreeMem(SubType->Members); + } + + /* free this node */ + HeapFreeMem(SubType); + } + } +} + +void TypeCleanup() +{ + TypeCleanupNode(&UberType); +} + +/* parse a struct or union declaration */ +void TypeParseStruct(struct ParseState *Parser, struct ValueType **Typ, int IsStruct) +{ + struct Value *LexValue; + struct ValueType *MemberType; + char *MemberIdentifier; + char *StructIdentifier; + struct Value *MemberValue; + enum LexToken Token; + int AlignBoundary; + + Token = LexGetToken(Parser, &LexValue, FALSE); + if (Token == TokenIdentifier) + { + LexGetToken(Parser, &LexValue, TRUE); + StructIdentifier = LexValue->Val->Identifier; + Token = LexGetToken(Parser, NULL, FALSE); + } + else + { + static char TempNameBuf[7] = "^s0000"; + StructIdentifier = PlatformMakeTempName(TempNameBuf); + } + + *Typ = TypeGetMatching(Parser, &UberType, IsStruct ? TypeStruct : TypeUnion, 0, StructIdentifier, Token != TokenLeftBrace); + + Token = LexGetToken(Parser, NULL, FALSE); + if (Token != TokenLeftBrace) + { + /* use the already defined structure */ + if ((*Typ)->Members == NULL) + ProgramFail(Parser, "structure '%s' isn't defined", LexValue->Val->Identifier); + + return; + } + + if (TopStackFrame != NULL) + ProgramFail(Parser, "struct/union definitions can only be globals"); + + LexGetToken(Parser, NULL, TRUE); + (*Typ)->Members = VariableAlloc(Parser, sizeof(struct Table) + STRUCT_TABLE_SIZE * sizeof(struct TableEntry), TRUE); + (*Typ)->Members->HashTable = (struct TableEntry **)((char *)(*Typ)->Members + sizeof(struct Table)); + TableInitTable((*Typ)->Members, (struct TableEntry **)((char *)(*Typ)->Members + sizeof(struct Table)), STRUCT_TABLE_SIZE, TRUE); + + do { + TypeParse(Parser, &MemberType, &MemberIdentifier, NULL); + if (MemberType == NULL || MemberIdentifier == NULL) + ProgramFail(Parser, "invalid type in struct"); + + MemberValue = VariableAllocValueAndData(Parser, sizeof(int), FALSE, NULL, TRUE); + MemberValue->Typ = MemberType; + if (IsStruct) + { + /* allocate this member's location in the struct */ + AlignBoundary = MemberValue->Typ->AlignBytes; + if (((*Typ)->Sizeof & (AlignBoundary-1)) != 0) + (*Typ)->Sizeof += AlignBoundary - ((*Typ)->Sizeof & (AlignBoundary-1)); + + MemberValue->Val->Integer = (*Typ)->Sizeof; + (*Typ)->Sizeof += TypeSizeValue(MemberValue, TRUE); + } + else + { + /* union members always start at 0, make sure it's big enough to hold the largest member */ + MemberValue->Val->Integer = 0; + if (MemberValue->Typ->Sizeof > (*Typ)->Sizeof) + (*Typ)->Sizeof = TypeSizeValue(MemberValue, TRUE); + } + + /* make sure to align to the size of the largest member's alignment */ + if ((*Typ)->AlignBytes < MemberValue->Typ->AlignBytes) + (*Typ)->AlignBytes = MemberValue->Typ->AlignBytes; + + /* define it */ + if (!TableSet((*Typ)->Members, MemberIdentifier, MemberValue, Parser->FileName, Parser->Line, Parser->CharacterPos)) + ProgramFail(Parser, "member '%s' already defined", &MemberIdentifier); + + if (LexGetToken(Parser, NULL, TRUE) != TokenSemicolon) + ProgramFail(Parser, "semicolon expected"); + + } while (LexGetToken(Parser, NULL, FALSE) != TokenRightBrace); + + /* now align the structure to the size of its largest member's alignment */ + AlignBoundary = (*Typ)->AlignBytes; + if (((*Typ)->Sizeof & (AlignBoundary-1)) != 0) + (*Typ)->Sizeof += AlignBoundary - ((*Typ)->Sizeof & (AlignBoundary-1)); + + LexGetToken(Parser, NULL, TRUE); +} + +/* create a system struct which has no user-visible members */ +struct ValueType *TypeCreateOpaqueStruct(struct ParseState *Parser, const char *StructName, int Size) +{ + struct ValueType *Typ = TypeGetMatching(Parser, &UberType, TypeStruct, 0, StructName, FALSE); + + /* create the (empty) table */ + Typ->Members = VariableAlloc(Parser, sizeof(struct Table) + STRUCT_TABLE_SIZE * sizeof(struct TableEntry), TRUE); + Typ->Members->HashTable = (struct TableEntry **)((char *)Typ->Members + sizeof(struct Table)); + TableInitTable(Typ->Members, (struct TableEntry **)((char *)Typ->Members + sizeof(struct Table)), STRUCT_TABLE_SIZE, TRUE); + Typ->Sizeof = Size; + + return Typ; +} + +/* parse an enum declaration */ +void TypeParseEnum(struct ParseState *Parser, struct ValueType **Typ) +{ + struct Value *LexValue; + struct Value InitValue; + enum LexToken Token; + struct ValueType *EnumType; + int EnumValue = 0; + char *EnumIdentifier; + + Token = LexGetToken(Parser, &LexValue, FALSE); + if (Token == TokenIdentifier) + { + LexGetToken(Parser, &LexValue, TRUE); + EnumIdentifier = LexValue->Val->Identifier; + Token = LexGetToken(Parser, NULL, FALSE); + } + else + { + static char TempNameBuf[7] = "^e0000"; + EnumIdentifier = PlatformMakeTempName(TempNameBuf); + } + + EnumType = TypeGetMatching(Parser, &UberType, TypeEnum, 0, EnumIdentifier, Token != TokenLeftBrace); + *Typ = &IntType; + if (Token != TokenLeftBrace) + { + /* use the already defined enum */ + if ((*Typ)->Members == NULL) + ProgramFail(Parser, "enum '%s' isn't defined", EnumIdentifier); + + return; + } + + if (TopStackFrame != NULL) + ProgramFail(Parser, "enum definitions can only be globals"); + + LexGetToken(Parser, NULL, TRUE); + (*Typ)->Members = &GlobalTable; + memset((void *)&InitValue, '\0', sizeof(struct Value)); + InitValue.Typ = &IntType; + InitValue.Val = (union AnyValue *)&EnumValue; + do { + if (LexGetToken(Parser, &LexValue, TRUE) != TokenIdentifier) + ProgramFail(Parser, "identifier expected"); + + EnumIdentifier = LexValue->Val->Identifier; + if (LexGetToken(Parser, NULL, FALSE) == TokenAssign) + { + LexGetToken(Parser, NULL, TRUE); + EnumValue = ExpressionParseInt(Parser); + } + + VariableDefine(Parser, EnumIdentifier, &InitValue, NULL, FALSE); + + Token = LexGetToken(Parser, NULL, TRUE); + if (Token != TokenComma && Token != TokenRightBrace) + ProgramFail(Parser, "comma expected"); + + EnumValue++; + + } while (Token == TokenComma); +} + +/* parse a type - just the basic type */ +int TypeParseFront(struct ParseState *Parser, struct ValueType **Typ, int *IsStatic) +{ + struct ParseState Before; + struct Value *LexerValue; + enum LexToken Token; + int Unsigned = FALSE; + struct Value *VarValue; + int StaticQualifier = FALSE; + *Typ = NULL; + + /* ignore leading type qualifiers */ + ParserCopy(&Before, Parser); + Token = LexGetToken(Parser, &LexerValue, TRUE); + while (Token == TokenStaticType || Token == TokenAutoType || Token == TokenRegisterType || Token == TokenExternType) + { + if (Token == TokenStaticType) + StaticQualifier = TRUE; + + Token = LexGetToken(Parser, &LexerValue, TRUE); + } + + if (IsStatic != NULL) + *IsStatic = StaticQualifier; + + /* handle signed/unsigned with no trailing type */ + if (Token == TokenSignedType || Token == TokenUnsignedType) + { + enum LexToken FollowToken = LexGetToken(Parser, &LexerValue, FALSE); + Unsigned = (Token == TokenUnsignedType); + + if (FollowToken != TokenIntType && FollowToken != TokenLongType && FollowToken != TokenShortType && FollowToken != TokenCharType) + { + if (Token == TokenUnsignedType) + *Typ = &UnsignedIntType; + else + *Typ = &IntType; + + return TRUE; + } + + Token = LexGetToken(Parser, &LexerValue, TRUE); + } + + switch (Token) + { + case TokenIntType: *Typ = Unsigned ? &UnsignedIntType : &IntType; break; + case TokenShortType: *Typ = Unsigned ? &UnsignedShortType : &ShortType; break; + case TokenCharType: *Typ = &CharType; break; + case TokenLongType: *Typ = Unsigned ? &UnsignedLongType : &LongType; break; +#ifndef NO_FP + case TokenFloatType: case TokenDoubleType: *Typ = &FPType; break; +#endif + case TokenVoidType: *Typ = &VoidType; break; + + case TokenStructType: case TokenUnionType: + if (*Typ != NULL) + ProgramFail(Parser, "bad type declaration"); + + TypeParseStruct(Parser, Typ, Token == TokenStructType); + break; + + case TokenEnumType: + if (*Typ != NULL) + ProgramFail(Parser, "bad type declaration"); + + TypeParseEnum(Parser, Typ); + break; + + case TokenIdentifier: + /* we already know it's a typedef-defined type because we got here */ + VariableGet(Parser, LexerValue->Val->Identifier, &VarValue); + *Typ = VarValue->Val->Typ; + break; + + default: ParserCopy(Parser, &Before); return FALSE; + } + + return TRUE; +} + +/* parse a type - the part at the end after the identifier. eg. array specifications etc. */ +struct ValueType *TypeParseBack(struct ParseState *Parser, struct ValueType *FromType) +{ + enum LexToken Token; + struct ParseState Before; + + ParserCopy(&Before, Parser); + Token = LexGetToken(Parser, NULL, TRUE); + if (Token == TokenLeftSquareBracket) + { + /* add another array bound */ + if (LexGetToken(Parser, NULL, FALSE) == TokenRightSquareBracket) + { + /* an unsized array */ + LexGetToken(Parser, NULL, TRUE); + return TypeGetMatching(Parser, TypeParseBack(Parser, FromType), TypeArray, 0, StrEmpty, TRUE); + } + else + { + /* get a numeric array size */ + enum RunMode OldMode = Parser->Mode; + int ArraySize; + Parser->Mode = RunModeRun; + ArraySize = ExpressionParseInt(Parser); + Parser->Mode = OldMode; + + if (LexGetToken(Parser, NULL, TRUE) != TokenRightSquareBracket) + ProgramFail(Parser, "']' expected"); + + return TypeGetMatching(Parser, TypeParseBack(Parser, FromType), TypeArray, ArraySize, StrEmpty, TRUE); + } + } + else + { + /* the type specification has finished */ + ParserCopy(Parser, &Before); + return FromType; + } +} + +/* parse a type - the part which is repeated with each identifier in a declaration list */ +void TypeParseIdentPart(struct ParseState *Parser, struct ValueType *BasicTyp, struct ValueType **Typ, char **Identifier) +{ + struct ParseState Before; + enum LexToken Token; + struct Value *LexValue; + int Done = FALSE; + *Typ = BasicTyp; + *Identifier = StrEmpty; + + while (!Done) + { + ParserCopy(&Before, Parser); + Token = LexGetToken(Parser, &LexValue, TRUE); + switch (Token) + { + case TokenOpenBracket: + if (*Typ != NULL) + ProgramFail(Parser, "bad type declaration"); + + TypeParse(Parser, Typ, Identifier, NULL); + if (LexGetToken(Parser, NULL, TRUE) != TokenCloseBracket) + ProgramFail(Parser, "')' expected"); + break; + + case TokenAsterisk: + if (*Typ == NULL) + ProgramFail(Parser, "bad type declaration"); + + *Typ = TypeGetMatching(Parser, *Typ, TypePointer, 0, StrEmpty, TRUE); + break; + + case TokenIdentifier: + if (*Typ == NULL || *Identifier != StrEmpty) + ProgramFail(Parser, "bad type declaration"); + + *Identifier = LexValue->Val->Identifier; + Done = TRUE; + break; + + default: ParserCopy(Parser, &Before); Done = TRUE; break; + } + } + + if (*Typ == NULL) + ProgramFail(Parser, "bad type declaration"); + + if (*Identifier != StrEmpty) + { + /* parse stuff after the identifier */ + *Typ = TypeParseBack(Parser, *Typ); + } +} + +/* parse a type - a complete declaration including identifier */ +void TypeParse(struct ParseState *Parser, struct ValueType **Typ, char **Identifier, int *IsStatic) +{ + struct ValueType *BasicType; + + TypeParseFront(Parser, &BasicType, IsStatic); + TypeParseIdentPart(Parser, BasicType, Typ, Identifier); +} + diff --git a/src/cmd/picoc-1/using-bootloader.ld b/src/cmd/picoc-1/using-bootloader.ld new file mode 100644 index 0000000..f91cbd6 --- /dev/null +++ b/src/cmd/picoc-1/using-bootloader.ld @@ -0,0 +1,108 @@ +/* + * Linker script for PIC32 firmware using HID bootloader. + */ +OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", + "elf32-littlemips") +OUTPUT_ARCH(mips) +ENTRY(_reset_vector_) +MEMORY +{ + flash (rx) : ORIGIN = 0x7d030000, LENGTH = 320K + ram (rw!x): ORIGIN = 0x7F008000, LENGTH = 92K + + /* Required by Microchip C32 linker */ + kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x80000 + kseg0_boot_mem : ORIGIN = 0x9FC00490, LENGTH = 0x970 + exception_mem : ORIGIN = 0x9FC01000, LENGTH = 0x1000 + kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0x490 + kseg1_data_mem (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000 +} + +SECTIONS +{ + .text ORIGIN(flash) : + { + /* Exception handlers. */ + *(.uflash_head) + . = 0x30; + /* Execution starts here. */ + *(.startup) + *(.text .stub .text.* .gnu.linkonce.t.* ) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.glue_7t) *(.glue_7) + __rodata_start = . ; + *(.rodata .rodata.* .gnu.linkonce.r.* .rel.dyn) + *(.dinit) + /* Align here to ensure that the .text section ends on word boundary. */ + . = ALIGN (32 / 8); + _etext = .; + } > flash + + /* Start data (internal SRAM). */ + .data : AT (ADDR (.text) + SIZEOF (.text)) + { + __data_start = . ; + _gp = .; /* We use only 32k RAM for kernel, so no need for 0x8000 offset. */ + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + *(.sdata .sdata.* .gnu.linkonce.s.*) + *(.data .data.* .gnu.linkonce.d.*) + *(.eh_frame) + _edata = .; + } > ram + + .bss ADDR (.data) + SIZEOF (.data) (NOLOAD) : + { + __bss_start = .; + *(.dynbss) + *(.sbss .sbss.* ) + *(.scommon) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN (32 / 8); + } > ram + __bss_end = . ; + _end = .; + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } +} diff --git a/src/cmd/picoc-1/variable.c b/src/cmd/picoc-1/variable.c new file mode 100644 index 0000000..06b813e --- /dev/null +++ b/src/cmd/picoc-1/variable.c @@ -0,0 +1,370 @@ +/* picoc variable storage. This provides ways of defining and accessing + * variables */ + +#include "interpreter.h" + +/* maximum size of a value to temporarily copy while we create a variable */ +#define MAX_TMP_COPY_BUF 256 + +/* the table of global definitions */ +struct Table GlobalTable; +struct TableEntry *GlobalHashTable[GLOBAL_TABLE_SIZE]; + +/* the table of string literal values */ +struct Table StringLiteralTable; +struct TableEntry *StringLiteralHashTable[STRING_LITERAL_TABLE_SIZE]; + +/* the stack */ +struct StackFrame *TopStackFrame = NULL; + + +/* initialise the variable system */ +void VariableInit() +{ + TableInitTable(&GlobalTable, &GlobalHashTable[0], GLOBAL_TABLE_SIZE, TRUE); + TableInitTable(&StringLiteralTable, &StringLiteralHashTable[0], STRING_LITERAL_TABLE_SIZE, TRUE); + TopStackFrame = NULL; +} + +/* deallocate the contents of a variable */ +void VariableFree(struct Value *Val) +{ + if (Val->ValOnHeap || Val->AnyValOnHeap) + { + /* free function bodies */ + if (Val->Typ == &FunctionType && Val->Val->FuncDef.Intrinsic == NULL && Val->Val->FuncDef.Body.Pos != NULL) + HeapFreeMem((void *)Val->Val->FuncDef.Body.Pos); + + /* free macro bodies */ + if (Val->Typ == &MacroType) + HeapFreeMem((void *)Val->Val->MacroDef.Body.Pos); + + /* free the AnyValue */ + if (Val->AnyValOnHeap) + HeapFreeMem(Val->Val); + } + + /* free the value */ + if (Val->ValOnHeap) + HeapFreeMem(Val); +} + +/* deallocate the global table and the string literal table */ +void VariableTableCleanup(struct Table *HashTable) +{ + struct TableEntry *Entry; + struct TableEntry *NextEntry; + int Count; + + for (Count = 0; Count < HashTable->Size; Count++) + { + for (Entry = HashTable->HashTable[Count]; Entry != NULL; Entry = NextEntry) + { + NextEntry = Entry->Next; + VariableFree(Entry->p.v.Val); + + /* free the hash table entry */ + HeapFreeMem(Entry); + } + } +} + +void VariableCleanup() +{ + VariableTableCleanup(&GlobalTable); + VariableTableCleanup(&StringLiteralTable); +} + +/* allocate some memory, either on the heap or the stack and check if we've run out */ +void *VariableAlloc(struct ParseState *Parser, int Size, int OnHeap) +{ + void *NewValue; + + if (OnHeap) + NewValue = HeapAllocMem(Size); + else + NewValue = HeapAllocStack(Size); + + if (NewValue == NULL) + ProgramFail(Parser, "out of memory"); + +#ifdef DEBUG_HEAP + if (!OnHeap) + printf("pushing %d at 0x%lx\n", Size, (unsigned long)NewValue); +#endif + + return NewValue; +} + +/* allocate a value either on the heap or the stack using space dependent on what type we want */ +struct Value *VariableAllocValueAndData(struct ParseState *Parser, int DataSize, int IsLValue, struct Value *LValueFrom, int OnHeap) +{ + struct Value *NewValue = VariableAlloc(Parser, MEM_ALIGN(sizeof(struct Value)) + DataSize, OnHeap); + NewValue->Val = (union AnyValue *)((char *)NewValue + MEM_ALIGN(sizeof(struct Value))); + NewValue->ValOnHeap = OnHeap; + NewValue->AnyValOnHeap = FALSE; + NewValue->ValOnStack = !OnHeap; + NewValue->IsLValue = IsLValue; + NewValue->LValueFrom = LValueFrom; + + return NewValue; +} + +/* allocate a value given its type */ +struct Value *VariableAllocValueFromType(struct ParseState *Parser, struct ValueType *Typ, int IsLValue, struct Value *LValueFrom, int OnHeap) +{ + int Size = TypeSize(Typ, Typ->ArraySize, FALSE); + struct Value *NewValue = VariableAllocValueAndData(Parser, Size, IsLValue, LValueFrom, OnHeap); + assert(Size >= 0 || Typ == &VoidType); + NewValue->Typ = Typ; + + return NewValue; +} + +/* allocate a value either on the heap or the stack and copy its value. handles overlapping data */ +struct Value *VariableAllocValueAndCopy(struct ParseState *Parser, struct Value *FromValue, int OnHeap) +{ + struct ValueType *DType = FromValue->Typ; + struct Value *NewValue; + char TmpBuf[MAX_TMP_COPY_BUF]; + int CopySize = TypeSizeValue(FromValue, TRUE); + + assert(CopySize <= MAX_TMP_COPY_BUF); + memcpy((void *)&TmpBuf[0], (void *)FromValue->Val, CopySize); + NewValue = VariableAllocValueAndData(Parser, CopySize, FromValue->IsLValue, FromValue->LValueFrom, OnHeap); + NewValue->Typ = DType; + memcpy((void *)NewValue->Val, (void *)&TmpBuf[0], CopySize); + + return NewValue; +} + +/* allocate a value either on the heap or the stack from an existing AnyValue and type */ +struct Value *VariableAllocValueFromExistingData(struct ParseState *Parser, struct ValueType *Typ, union AnyValue *FromValue, int IsLValue, struct Value *LValueFrom) +{ + struct Value *NewValue = VariableAlloc(Parser, sizeof(struct Value), FALSE); + NewValue->Typ = Typ; + NewValue->Val = FromValue; + NewValue->ValOnHeap = FALSE; + NewValue->AnyValOnHeap = FALSE; + NewValue->ValOnStack = FALSE; + NewValue->IsLValue = IsLValue; + NewValue->LValueFrom = LValueFrom; + + return NewValue; +} + +/* allocate a value either on the heap or the stack from an existing Value, sharing the value */ +struct Value *VariableAllocValueShared(struct ParseState *Parser, struct Value *FromValue) +{ + return VariableAllocValueFromExistingData(Parser, FromValue->Typ, FromValue->Val, FromValue->IsLValue, FromValue->IsLValue ? FromValue : NULL); +} + +/* reallocate a variable so its data has a new size */ +void VariableRealloc(struct ParseState *Parser, struct Value *FromValue, int NewSize) +{ + if (FromValue->AnyValOnHeap) + VariableFree(FromValue->Val); + + FromValue->Val = VariableAlloc(Parser, NewSize, TRUE); + FromValue->AnyValOnHeap = TRUE; +} + +/* define a variable. Ident must be registered */ +struct Value *VariableDefine(struct ParseState *Parser, char *Ident, struct Value *InitValue, struct ValueType *Typ, int MakeWritable) +{ + struct Value *AssignValue; + + if (InitValue != NULL) + AssignValue = VariableAllocValueAndCopy(Parser, InitValue, TopStackFrame == NULL); + else + AssignValue = VariableAllocValueFromType(Parser, Typ, MakeWritable, NULL, TopStackFrame == NULL); + + AssignValue->IsLValue = MakeWritable; + + if (!TableSet((TopStackFrame == NULL) ? &GlobalTable : &TopStackFrame->LocalTable, Ident, AssignValue, Parser ? ((char *)Parser->FileName) : NULL, Parser ? Parser->Line : 0, Parser ? Parser->CharacterPos : 0)) + ProgramFail(Parser, "'%s' is already defined", Ident); + + return AssignValue; +} + +/* define a variable. Ident must be registered. If it's a redefinition from the same declaration don't throw an error */ +struct Value *VariableDefineButIgnoreIdentical(struct ParseState *Parser, char *Ident, struct ValueType *Typ, int IsStatic, int *FirstVisit) +{ + struct Value *ExistingValue; + const char *DeclFileName; + int DeclLine; + int DeclColumn; + + if (IsStatic) + { + char MangledName[LINEBUFFER_MAX]; + char *MNPos = &MangledName[0]; + char *MNEnd = &MangledName[LINEBUFFER_MAX-1]; + const char *RegisteredMangledName; + + /* make the mangled static name (avoiding using sprintf() to minimise library impact) */ + memset((void *)&MangledName, '\0', sizeof(MangledName)); + *MNPos++ = '/'; + strncpy(MNPos, (char *)Parser->FileName, MNEnd - MNPos); + MNPos += strlen(MNPos); + + if (TopStackFrame != NULL) + { + /* we're inside a function */ + if (MNEnd - MNPos > 0) *MNPos++ = '/'; + strncpy(MNPos, (char *)TopStackFrame->FuncName, MNEnd - MNPos); + MNPos += strlen(MNPos); + } + + if (MNEnd - MNPos > 0) *MNPos++ = '/'; + strncpy(MNPos, Ident, MNEnd - MNPos); + RegisteredMangledName = TableStrRegister(MangledName); + + /* is this static already defined? */ + if (!TableGet(&GlobalTable, RegisteredMangledName, &ExistingValue, &DeclFileName, &DeclLine, &DeclColumn)) + { + /* define the mangled-named static variable store in the global scope */ + ExistingValue = VariableAllocValueFromType(Parser, Typ, TRUE, NULL, TRUE); + TableSet(&GlobalTable, (char *)RegisteredMangledName, ExistingValue, (char *)Parser->FileName, Parser->Line, Parser->CharacterPos); + *FirstVisit = TRUE; + } + + /* static variable exists in the global scope - now make a mirroring variable in our own scope with the short name */ + VariableDefinePlatformVar(Parser, Ident, ExistingValue->Typ, ExistingValue->Val, TRUE); + return ExistingValue; + } + else + { + if (Parser->Line != 0 && TableGet((TopStackFrame == NULL) ? &GlobalTable : &TopStackFrame->LocalTable, Ident, &ExistingValue, &DeclFileName, &DeclLine, &DeclColumn) + && DeclFileName == Parser->FileName && DeclLine == Parser->Line && DeclColumn == Parser->CharacterPos) + return ExistingValue; + else + return VariableDefine(Parser, Ident, NULL, Typ, TRUE); + } +} + +/* check if a variable with a given name is defined. Ident must be registered */ +int VariableDefined(const char *Ident) +{ + struct Value *FoundValue; + + if (TopStackFrame == NULL || !TableGet(&TopStackFrame->LocalTable, Ident, &FoundValue, NULL, NULL, NULL)) + { + if (!TableGet(&GlobalTable, Ident, &FoundValue, NULL, NULL, NULL)) + return FALSE; + } + + return TRUE; +} + +/* get the value of a variable. must be defined. Ident must be registered */ +void VariableGet(struct ParseState *Parser, const char *Ident, struct Value **LVal) +{ + if (TopStackFrame == NULL || !TableGet(&TopStackFrame->LocalTable, Ident, LVal, NULL, NULL, NULL)) + { + if (!TableGet(&GlobalTable, Ident, LVal, NULL, NULL, NULL)) + ProgramFail(Parser, "'%s' is undefined", Ident); + } +} + +/* define a global variable shared with a platform global. Ident will be registered */ +void VariableDefinePlatformVar(struct ParseState *Parser, char *Ident, struct ValueType *Typ, union AnyValue *FromValue, int IsWritable) +{ + struct Value *SomeValue = VariableAllocValueAndData(NULL, 0, IsWritable, NULL, TRUE); + SomeValue->Typ = Typ; + SomeValue->Val = FromValue; + + if (!TableSet((TopStackFrame == NULL) ? &GlobalTable : &TopStackFrame->LocalTable, TableStrRegister(Ident), SomeValue, Parser ? Parser->FileName : NULL, Parser ? Parser->Line : 0, Parser ? Parser->CharacterPos : 0)) + ProgramFail(Parser, "'%s' is already defined", Ident); +} + +/* free and/or pop the top value off the stack. Var must be the top value on the stack! */ +void VariableStackPop(struct ParseState *Parser, struct Value *Var) +{ + int Success; + +#ifdef DEBUG_HEAP + if (Var->ValOnStack) + printf("popping %ld at 0x%lx\n", (unsigned long)(sizeof(struct Value) + TypeSizeValue(Var, FALSE)), (unsigned long)Var); +#endif + + if (Var->ValOnHeap) + { + if (Var->Val != NULL) + HeapFreeMem(Var->Val); + + Success = HeapPopStack(Var, sizeof(struct Value)); /* free from heap */ + } + else if (Var->ValOnStack) + Success = HeapPopStack(Var, sizeof(struct Value) + TypeSizeValue(Var, FALSE)); /* free from stack */ + else + Success = HeapPopStack(Var, sizeof(struct Value)); /* value isn't our problem */ + + if (!Success) + ProgramFail(Parser, "stack underrun"); +} + +/* add a stack frame when doing a function call */ +void VariableStackFrameAdd(struct ParseState *Parser, const char *FuncName, int NumParams) +{ + struct StackFrame *NewFrame; + + HeapPushStackFrame(); + NewFrame = HeapAllocStack(sizeof(struct StackFrame) + sizeof(struct Value *) * NumParams); + if (NewFrame == NULL) + ProgramFail(Parser, "out of memory"); + + ParserCopy(&NewFrame->ReturnParser, Parser); + NewFrame->FuncName = FuncName; + NewFrame->Parameter = (NumParams > 0) ? ((void *)((char *)NewFrame + sizeof(struct StackFrame))) : NULL; + TableInitTable(&NewFrame->LocalTable, &NewFrame->LocalHashTable[0], LOCAL_TABLE_SIZE, FALSE); + NewFrame->PreviousStackFrame = TopStackFrame; + TopStackFrame = NewFrame; +} + +/* remove a stack frame */ +void VariableStackFramePop(struct ParseState *Parser) +{ + if (TopStackFrame == NULL) + ProgramFail(Parser, "stack is empty - can't go back"); + + ParserCopy(Parser, &TopStackFrame->ReturnParser); + TopStackFrame = TopStackFrame->PreviousStackFrame; + HeapPopStackFrame(); +} + +/* get a string literal. assumes that Ident is already registered. NULL if not found */ +struct Value *VariableStringLiteralGet(char *Ident) +{ + struct Value *LVal = NULL; + + if (TableGet(&StringLiteralTable, Ident, &LVal, NULL, NULL, NULL)) + return LVal; + else + return NULL; +} + +/* define a string literal. assumes that Ident is already registered */ +void VariableStringLiteralDefine(char *Ident, struct Value *Val) +{ + TableSet(&StringLiteralTable, Ident, Val, NULL, 0, 0); +} + +/* check a pointer for validity and dereference it for use */ +void *VariableDereferencePointer(struct ParseState *Parser, struct Value *PointerValue, struct Value **DerefVal, int *DerefOffset, struct ValueType **DerefType, int *DerefIsLValue) +{ + if (DerefVal != NULL) + *DerefVal = NULL; + + if (DerefType != NULL) + *DerefType = PointerValue->Typ->FromType; + + if (DerefOffset != NULL) + *DerefOffset = 0; + + if (DerefIsLValue != NULL) + *DerefIsLValue = TRUE; + + return PointerValue->Val->Pointer; +} + diff --git a/src/cmd/smallc/Makefile b/src/cmd/smallc/Makefile index 83abcb7..821df59 100644 --- a/src/cmd/smallc/Makefile +++ b/src/cmd/smallc/Makefile @@ -7,8 +7,8 @@ LIBS = -lc ARCH = mips -OBJS = data.o error.o expr.o function.o gen.o io.o lex.o main.o \ - primary.o stmt.o sym.o while.o code$(ARCH).o +OBJS = data.o error.o expr.o function.o gen.o initialise.o io.o lex.o main.o \ + preproc.o primary.o stmt.o sym.o while.o code$(ARCH).o all: smallc @@ -35,10 +35,13 @@ error.o: error.c defs.h data.h expr.o: expr.c defs.h data.h function.o: function.c defs.h data.h gen.o: gen.c defs.h data.h +initialise.o: initialise.c defs.h data.h io.o: io.c defs.h data.h lex.o: lex.c defs.h data.h main.o: main.c defs.h data.h +preproc.o: preproc.c defs.h data.h primary.o: primary.c defs.h data.h stmt.o: stmt.c defs.h data.h sym.o: sym.c defs.h data.h while.o: while.c defs.h data.h + diff --git a/src/cmd/smallc/README b/src/cmd/smallc/README index 13faa95..2b3ee6e 100644 --- a/src/cmd/smallc/README +++ b/src/cmd/smallc/README @@ -1,4 +1,39 @@ - Small C version C3.0R1.1 +This version is derived from https://github.com/begoon/smallc-85 and adds +a mips code generator that works with the retrobsd as command. Some bug +fixes have also been applied. + +--------------------- previous readme ---------------------------------- +This fork from https://github.com/ncb85/SmallC-85 has no functional +changes, only a few build scripts. + +To build on Windows: + + cd windows + nmake + +- - - + +Revived version of SmallC based on Chris Lewis' port to UNIX V. I have +mainly rewritten code to use structures and to make it compile using GCC +silently without warnigns. + +Support for one line comments from C99 specification was added as well +as capability to handle Windows EOLs. + +Initialisation of global variables is also possible. When not initialised +global var is assigned zero at compile time. + +Furthermore support for ANSI style method declaration has been added. + +Generated code is suitable for ASXXXX assembler/linker. + +***** update ***** +Support for unsigned types +Support for undocumented 8085 istructions LHLX, SHLX, LDSI, ARHL + +-------------------------- original posting ------------------------------ + +Small C version C3.0R1.1 (SCC3) Chris Lewis @@ -16,14 +51,17 @@ use lots of more work (eg: a real scanner), but what the heck... Retargetting the compiler requires only relinking the frontend with a new code generator. -Code generators for 6809 (MIT UNIX-like assembler), M68K (Motorola V/68 UNIX -assembler), VAX (BSD 4.1 assembler), and 8080 (RMAC assembler) are provided. +Code generators for 6809 (MIT UNIX-like assembler), M68K (Motorola V/68 +UNIX +assembler), VAX (BSD 4.1 assembler), and 8080 (RMAC assembler) are +provided. Users having access to System V make should be able to use the Makefile without any modification except for INCDIR and LIBDIR (where you'd like to put the compiler itself). -Users not having access to System V will probably have to rewrite the Makefile. +Users not having access to System V will probably have to rewrite the +Makefile. [ I have provided a Makefile that seems to work with bsd systems - mod] WARNING: you will probably see a great deal of compilation warnings when @@ -57,4 +95,4 @@ me if you run into trouble. I would be greatly interested in any new coders or bug reports in the compilers. As far as I am aware, the major restriction on porting this thing for different targets is that pointers and integers *must* be the same length, alignment, and be -interchangeable. +interchangeable. \ No newline at end of file diff --git a/src/cmd/smallc/code8080.c b/src/cmd/smallc/code8080.c index a6a177b..c7365e2 100644 --- a/src/cmd/smallc/code8080.c +++ b/src/cmd/smallc/code8080.c @@ -1,7 +1,15 @@ +/* File code8080.c: 2.2 (84/08/31,10:05:09) */ +/*% cc -O -c % + * + */ + #include #include "defs.h" #include "data.h" +/* Define ASNM and LDNM to the names of the assembler and linker + respectively */ + /* * Some predefinitions: * @@ -12,219 +20,205 @@ * This compiler assumes that an integer is the SAME length as * a pointer - in fact, the compiler uses INTSIZE for both. */ -#define INTSIZE 2 -#define BYTEOFF 0 -/* - * print all assembler info before any code is generated +/** + * print all assembler info before any code is generated */ -header () -{ - outstr ("; Small C 8080;\n;\tCoder (2.4,84/11/27)\n;"); - FEvers(); - nl (); - ol ("extrn ?gchar,?gint,?pchar,?pint,?bool"); - ol ("extrn ?sxt"); - ol ("extrn ?or,?and,?xor"); - ol ("extrn ?eq,?ne,?gt,?le,?ge,?lt,?uge,?ult,?ugt,?ule"); - ol ("extrn ?asr,?asl"); - ol ("extrn ?sub,?neg,?com,?lneg,?mul,?div"); - ol ("extrn ?case"); -} - -nl () -{ - outbyte (EOL); -} - -galign (t) - int t; -{ - return(t); -} - -/* - * return size of an integer - */ -intsize() -{ - return(INTSIZE); -} - -/* - * return offset of ls byte within word - * (ie: 8080 & pdp11 is 0, 6809 is 1, 360 is 3) - */ -byteoff() -{ - return(BYTEOFF); -} - -/* - * Output internal generated label prefix - */ -olprfix() -{ - outbyte('?'); -} - -/* - * Output a label definition terminator - */ -col () -{ - outbyte (58); -} - -/* - * begin a comment line for the assembler - */ -comment () -{ - outbyte (';'); -} - -/* - * Emit user label prefix - */ -prefix () -{ -} - -/* - * print any assembler stuff needed after all code - */ -trailer () -{ - ol ("end"); -} - -/* - * function prologue - */ -prologue () -{ -} - -/* - * text (code) segment - */ -gtext () -{ - ol ("cseg"); -} - -/* - * data segment - */ -gdata () -{ - ol ("dseg"); -} - -/* - * Output the variable symbol at scptr as an extrn or a public - */ -ppubext(scptr) - char *scptr; -{ - if (cptr[STORAGE] == STATIC) - return; - ot (scptr[STORAGE] == EXTERN ? "extrn\t" : "public\t"); - prefix (); - outstr (scptr); - nl(); - -} - -/* - * Output the function symbol at scptr as an extrn or a public - */ -fpubext(scptr) - char *scptr; -{ - if (scptr[STORAGE] == STATIC) - return; - ot (scptr[OFFSET] == FUNCTION ? "public\t" : "extrn\t"); - prefix (); - outstr (scptr); - nl (); -} - -/* - * Output a decimal number to the assembler file - */ -onum(num) - int num; -{ - outdec(num); /* pdp11 needs a "." here */ -} - -/* - * fetch a static memory cell into the primary register - */ -getmem (sym) - char *sym; -{ - if ((sym[IDENT] != POINTER) & (sym[TYPE] == CCHAR)) { - ot ("lda\t"); - outstr (sym + NAME); - nl (); - gcall ("?sxt"); - } else { - ot ("lhld\t"); - outstr (sym + NAME); - nl (); - } - -} - -/* - * fetch the address of the specified symbol into the primary register - */ -getloc (sym) - char *sym; -{ - immed (); - if (sym[STORAGE] == LSTATIC) { - printlabel(glint(sym)); - nl(); - } else { - outdec (glint(sym) - stkp); - nl (); - ol ("dad\tsp"); - } +void header () { + output_string ("; Small C 8080;\n;\tCoder (2.4,84/11/27)\n;"); + frontend_version(); + newline (); + output_line ("\t;program area SMALLC_GENERATED is RELOCATABLE"); + output_line ("\t.area\tSMALLC_GENERATED\t(REL,CON)"); + output_line ("\t.module SMALLC_GENERATED"); + output_line ("\t.list (err, loc, bin, eqt, cyc, lin, src, lst, md)"); + output_line ("\t.nlist (pag)"); } /** - * store the primary register into the specified static memory cell + * prints new line + * @return + */ +newline () { +#if __CYGWIN__ == 1 + output_byte (CR); +#endif + output_byte (LF); +} + +void initmac() { + //defmac("cpm\t1"); + defmac("I8080\t1"); + defmac("RMAC\t1"); + defmac("smallc\t1"); +} + +/** + * Output internal generated label prefix + */ +void output_label_prefix() { + output_byte('$'); +} + +/** + * Output a label definition terminator + */ +void output_label_terminator () { + output_byte (':'); +} + +/** + * begin a comment line for the assembler + */ +void gen_comment() { + output_byte (';'); +} + +/** + * print any assembler stuff needed after all code + */ +void trailer() { + output_line (";\t.end"); +} + +/** + * text (code) segment + */ +void code_segment_gtext() { + output_line ("\t.area SMALLC_GENERATED (REL,CON,CSEG)"); +} + +/** + * data segment + */ +void data_segment_gdata() { + output_line ("\t.area SMALLC_GENERATED_DATA (REL,CON,DSEG)"); +} + +/** + * Output the variable symbol at scptr as an extrn or a public + * @param scptr + */ +void ppubext(SYMBOL *scptr) { + if (symbol_table[current_symbol_table_idx].storage == STATIC) return; + output_with_tab (scptr->storage == EXTERN ? ";extrn\t" : ".globl\t"); + output_string (scptr->name); + newline(); +} + +/** + * Output the function symbol at scptr as an extrn or a public + * @param scptr + */ +void fpubext(SYMBOL *scptr) { + if (scptr->storage == STATIC) return; + output_with_tab (scptr->offset == FUNCTION ? ".globl\t" : ";extrn\t"); + output_string (scptr->name); + newline (); +} + +/** + * Output a decimal number to the assembler file, with # prefix + * @param num + */ +void output_number(num) int num; { + output_byte('#'); + output_decimal(num); +} + +/** + * fetch a static memory cell into the primary register * @param sym */ -putmem (sym) - char *sym; -{ - if ((sym[IDENT] != POINTER) & (sym[TYPE] == CCHAR)) { - ol ("mov\ta,l"); - ot ("sta\t"); - } else - ot ("shld\t"); - outstr (sym + NAME); - nl (); +void gen_get_memory(SYMBOL *sym) { + if ((sym->identity != POINTER) && (sym->type == CCHAR)) { + output_with_tab ("lda\t"); + output_string (sym->name); + newline (); + gen_call ("ccsxt"); + } else if ((sym->identity != POINTER) && (sym->type == UCHAR)) { + output_with_tab("lda\t"); + output_string(sym->name); + newline(); + output_line("mov \tl,a"); + output_line("mvi \th,0"); + } else { + output_with_tab ("lhld\t"); + output_string (sym->name); + newline (); + } +} + +/** + * asm - fetch the address of the specified symbol into the primary register + * @param sym the symbol name + * @return which register pair contains result + */ +int gen_get_location(SYMBOL *sym) { + /*gen_immediate (); + if (sym->storage == LSTATIC) { + print_label(sym->offset); + newline(); + } else { + output_number (sym->offset - stkp); + newline (); + output_line ("dad\tsp"); + }*/ + if (sym->storage == LSTATIC) { + gen_immediate(); + print_label(sym->offset); + newline(); + return HL_REG; + } else { + if (uflag) { + output_with_tab("ldsi\t"); + output_number(sym->offset - stkp); + newline (); + //gen_swap(); + return DE_REG; + } else { + gen_immediate(); + output_number(sym->offset - stkp); + newline (); + output_line ("dad \tsp"); + return HL_REG; + } + } +} + +/** + * asm - store the primary register into the specified static memory cell + * @param sym + */ +void gen_put_memory(SYMBOL *sym) { + if ((sym->identity != POINTER) && (sym->type & CCHAR)) { + output_line ("mov \ta,l"); + output_with_tab ("sta \t"); + } else { + output_with_tab ("shld\t"); + } + output_string (sym->name); + newline (); } /** * store the specified object type in the primary register - * at the address on the top of the stack + * at the address in secondary register (on the top of the stack) * @param typeobj */ -putstk (typeobj) - char typeobj; -{ - gpop (); - if (typeobj == CCHAR) - gcall ("?pchar"); - else - gcall ("?pint"); +void gen_put_indirect(char typeobj) { + gen_pop (); + if (typeobj & CCHAR) { + //gen_call("ccpchar"); + output_line("mov \ta,l"); + output_line("stax\td"); + } else { + if (uflag) { + output_line("shlx"); + } else { + gen_call("ccpint"); + } + } } /** @@ -232,88 +226,112 @@ putstk (typeobj) * register into the primary register * @param typeobj object type */ -indirect (typeobj) - char typeobj; -{ - if (typeobj == CCHAR) - gcall ("?gchar"); - else - gcall ("?gint"); +void gen_get_indirect(char typeobj, int reg) { + if (typeobj == CCHAR) { + if (reg == DE_REG) { + gen_swap(); + } + gen_call("ccgchar"); + } else if (typeobj == UCHAR) { + if (reg == DE_REG) { + gen_swap(); + } + //gen_call("cguchar"); + output_line("mov \tl,m"); + output_line("mvi \th,0"); + } else { + if (uflag) { + if (reg == HL_REG) { + gen_swap(); + } + output_line("lhlx"); + } else { + if (reg == DE_REG) { + gen_swap(); + } + gen_call("ccgint"); + } + } } /** * swap the primary and secondary registers */ -swap () -{ - ol ("xchg"); +gen_swap() { + output_line("xchg"); } /** * print partial instruction to get an immediate value into * the primary register */ -immed () -{ - ot ("lxi\th,"); +gen_immediate() { + output_with_tab ("lxi \th,"); } /** * push the primary register onto the stack */ -gpush () -{ - ol ("push\th"); +gen_push(int reg) { + if (reg == DE_REG) { + output_line ("push\td"); stkp = stkp - INTSIZE; + } else { + output_line ("push\th"); + stkp = stkp - INTSIZE; + } } /** * pop the top of the stack into the secondary register */ -gpop () -{ - ol ("pop\td"); +gen_pop() { + output_line ("pop \td"); stkp = stkp + INTSIZE; } /** * swap the primary register and the top of the stack */ -swapstk () -{ - ol ("xthl"); +gen_swap_stack() { + output_line ("xthl"); } /** * call the specified subroutine name * @param sname subroutine name */ -gcall (sname) - char *sname; -{ - ot ("call\t"); - outstr (sname); - nl (); +gen_call(char *sname) { + output_with_tab ("call\t"); + output_string (sname); + newline (); +} + +/** + * declare entry point + */ +declare_entry_point(char *symbol_name) { + output_string(symbol_name); + output_label_terminator(); + //newline(); } /** * return from subroutine */ -gret () -{ - ol ("ret"); +gen_ret() { + output_line ("ret"); } /** * perform subroutine call to value on top of stack */ -callstk () -{ - immed (); - outstr ("$+5 "); - nl (); - swapstk (); - ol ("pchl"); +callstk() { + gen_immediate (); + output_string ("#.+5"); + newline (); + gen_swap_stack (); + output_line ("pchl"); stkp = stkp + INTSIZE; } @@ -321,12 +339,12 @@ callstk () * jump to specified internal label number * @param label the label */ -jump (label) - int label; +gen_jump(label) +int label; { - ot ("jmp\t"); - printlabel (label); - nl (); + output_with_tab ("jmp \t"); + print_label (label); + newline (); } /** @@ -334,64 +352,59 @@ jump (label) * @param label the label * @param ft if true jnz is generated, jz otherwise */ -testjump (label, ft) - int label; - int ft; +gen_test_jump(label, ft) +int label, + ft; { - ol ("mov\ta,h"); - ol ("ora\tl"); - if (ft) - ot ("jnz\t"); - else - ot ("jz\t"); - printlabel (label); - nl (); + output_line ("mov \ta,h"); + output_line ("ora \tl"); + if (ft) + output_with_tab ("jnz \t"); + else + output_with_tab ("jz \t"); + print_label (label); + newline (); } /** * print pseudo-op to define a byte */ -defbyte () -{ - ot ("db\t"); +gen_def_byte() { + output_with_tab (".db\t"); } /** * print pseudo-op to define storage */ -defstorage () -{ - ot ("ds\t"); +gen_def_storage() { + output_with_tab (".ds\t"); } /** * print pseudo-op to define a word */ -defword () -{ - ot ("dw\t"); +gen_def_word() { + output_with_tab (".dw\t"); } /** * modify the stack pointer to the new value indicated * @param newstkp new value */ -modstk (newstkp) - int newstkp; -{ +gen_modify_stack(int newstkp) { int k; - k = galign(newstkp - stkp); + k = newstkp - stkp; if (k == 0) return (newstkp); if (k > 0) { if (k < 7) { if (k & 1) { - ol ("inx\tsp"); + output_line ("inx \tsp"); k--; } while (k) { - ol ("pop\tb"); + output_line ("pop \tb"); k = k - INTSIZE; } return (newstkp); @@ -399,53 +412,50 @@ modstk (newstkp) } else { if (k > -7) { if (k & 1) { - ol ("dcx\tsp"); + output_line ("dcx \tsp"); k++; } while (k) { - ol ("push\tb"); + output_line ("push\tb"); k = k + INTSIZE; } return (newstkp); } } - swap (); - immed (); - outdec (k); - nl (); - ol ("dad\tsp"); - ol ("sphl"); - swap (); + gen_swap (); + gen_immediate (); + output_number (k); + newline (); + output_line ("dad \tsp"); + output_line ("sphl"); + gen_swap (); return (newstkp); } /** * multiply the primary register by INTSIZE */ -gaslint () -{ - ol ("dad\th"); +gen_multiply_by_two() { + output_line ("dad \th"); } /** - * divide the primary register by INTSIZE + * divide the primary register by INTSIZE, never used */ -gasrint() -{ - gpush(); /* push primary in prep for gasr */ - immed (); - onum (1); - nl (); - gasr (); /* divide by two */ +gen_divide_by_two() { + gen_push(HL_REG); /* push primary in prep for gasr */ + gen_immediate (); + output_number (1); + newline (); + gen_arithm_shift_right (); /* divide by two */ } /** * Case jump instruction */ -gjcase() -{ - ot ("jmp\t?case"); - nl (); +gen_jump_case() { + output_with_tab ("jmp \tcccase"); + newline (); } /** @@ -454,162 +464,156 @@ gjcase() * @param lval * @param lval2 */ -gadd (lval, lval2) - int *lval; - int *lval2; -{ - gpop (); - if (dbltest (lval2, lval)) { - swap (); - gaslint (); - swap (); - } - ol ("dad\td"); +gen_add(lval,lval2) int *lval,*lval2; { + gen_pop (); + if (dbltest (lval2, lval)) { + gen_swap (); + gen_multiply_by_two (); + gen_swap (); + } + output_line ("dad \td"); } -/* - * subtract the primary register from the secondary +/** + * subtract the primary register from the secondary */ -gsub () -{ - gpop (); - gcall ("?sub"); +gen_sub() { + gen_pop (); + gen_call ("ccsub"); } -/* - * multiply the primary and secondary registers - * (result in primary) +/** + * multiply the primary and secondary registers (result in primary) */ -gmult () -{ - gpop(); - gcall ("?mul"); +gen_mult() { + gen_pop(); + gen_call ("ccmul"); } -/* - * divide the secondary register by the primary - * (quotient in primary, remainder in secondary) +/** + * divide the secondary register by the primary + * (quotient in primary, remainder in secondary) */ -gdiv () -{ - gpop(); - gcall ("?div"); +gen_div() { + gen_pop(); + gen_call ("ccdiv"); } -/* - * compute the remainder (mod) of the secondary register - * divided by the primary register - * (remainder in primary, quotient in secondary) +/** + * unsigned divide the secondary register by the primary + * (quotient in primary, remainder in secondary) */ -gmod () -{ - gdiv (); - swap (); +gen_udiv() { + gen_pop(); + gen_call ("ccudiv"); } -/* - * inclusive 'or' the primary and secondary registers +/** + * compute the remainder (mod) of the secondary register + * divided by the primary register + * (remainder in primary, quotient in secondary) */ -gor () -{ - gpop(); - gcall ("?or"); +gen_mod() { + gen_div (); + gen_swap (); } -/* - * exclusive 'or' the primary and secondary registers +/** + * compute the remainder (mod) of the secondary register + * divided by the primary register + * (remainder in primary, quotient in secondary) */ -gxor () -{ - gpop(); - gcall ("?xor"); +gen_umod() { + gen_udiv (); + gen_swap (); } -/* - * 'and' the primary and secondary registers +/** + * inclusive 'or' the primary and secondary registers */ -gand () -{ - gpop(); - gcall ("?and"); +gen_or() { + gen_pop(); + gen_call ("ccor"); } -/* - * arithmetic shift right the secondary register the number of - * times in the primary register - * (results in primary register) +/** + * exclusive 'or' the primary and secondary registers */ -gasr () -{ - gpop(); - gcall ("?asr"); +gen_xor() { + gen_pop(); + gen_call ("ccxor"); } -/* - * arithmetic shift left the secondary register the number of - * times in the primary register - * (results in primary register) +/** + * 'and' the primary and secondary registers */ -gasl () -{ - gpop (); - gcall ("?asl"); +gen_and() { + gen_pop(); + gen_call ("ccand"); } -/* - * two's complement of primary register +/** + * arithmetic shift right the secondary register the number of + * times in the primary register (results in primary register) */ -gneg () -{ - gcall ("?neg"); +gen_arithm_shift_right() { + gen_pop(); + gen_call ("ccasr"); } -/* - * logical complement of primary register +/** + * arithmetic shift left the secondary register the number of + * times in the primary register (results in primary register) */ -glneg () -{ - gcall ("?lneg"); +gen_arithm_shift_left() { + gen_pop (); + gen_call ("ccasl"); } -/* - * one's complement of primary register +/** + * two's complement of primary register */ -gcom () -{ - gcall ("?com"); +gen_twos_complement() { + gen_call ("ccneg"); } -/* - * Convert primary value into logical value (0 if 0, 1 otherwise) +/** + * logical complement of primary register */ -gbool () -{ - gcall ("?bool"); +gen_logical_negation() { + gen_call ("cclneg"); } -/* - * increment the primary register by 1 if char, INTSIZE if - * int +/** + * one's complement of primary register */ -ginc (lval) - int lval[]; -{ - ol ("inx\th"); - if (lval[2] == CINT) - ol ("inx\th"); +gen_complement() { + gen_call ("cccom"); } -/* - * decrement the primary register by one if char, INTSIZE if - * int +/** + * Convert primary value into logical value (0 if 0, 1 otherwise) */ -gdec (lval) - int lval[]; -{ - ol ("dcx\th"); - if (lval[2] == CINT) - ol("dcx\th"); +gen_convert_primary_reg_value_to_bool() { + gen_call ("ccbool"); +} + +/** + * increment the primary register by 1 if char, INTSIZE if int + */ +gen_increment_primary_reg(lvalue_t *lval) { + output_line ("inx \th"); + if (lval->ptr_type & CINT) + output_line ("inx \th"); +} + +/** + * decrement the primary register by one if char, INTSIZE if int + */ +gen_decrement_primary_reg(lvalue_t *lval) { + output_line ("dcx \th"); + if (lval->ptr_type & CINT) + output_line("dcx \th"); } /* @@ -617,106 +621,133 @@ gdec (lval) * they compare the secondary register against the primary register * and put a literl 1 in the primary if the condition is true, * otherwise they clear the primary register - */ - -/* - * equal - */ -geq () -{ - gpop(); - gcall ("?eq"); -} - -/* - * not equal * */ -gne () -{ - gpop(); - gcall ("?ne"); + +/** + * equal + */ +gen_equal() { + gen_pop(); + gen_call ("cceq"); } -/* - * less than (signed) +/** + * not equal */ -glt () -{ - gpop(); - gcall ("?lt"); +gen_not_equal() { + gen_pop(); + gen_call ("ccne"); } -/* - * less than or equal (signed) +/** + * less than (signed) */ -gle () -{ - gpop(); - gcall ("?le"); +gen_less_than() { + gen_pop(); + gen_call ("cclt"); } -/* - * greater than (signed) +/** + * less than or equal (signed) */ -ggt () -{ - gpop(); - gcall ("?gt"); +gen_less_or_equal() { + gen_pop(); + gen_call ("ccle"); } -/* - * greater than or equal (signed) +/** + * greater than (signed) */ -gge () -{ - gpop(); - gcall ("?ge"); +gen_greater_than() { + gen_pop(); + gen_call ("ccgt"); +} + +/** + * greater than or equal (signed) + */ +gen_greater_or_equal() { + gen_pop(); + gen_call ("ccge"); } /** * less than (unsigned) */ -gult () -{ - gpop(); - gcall ("?ult"); +gen_unsigned_less_than() { + gen_pop(); + gen_call ("ccult"); } /** * less than or equal (unsigned) */ -gule () -{ - gpop(); - gcall ("?ule"); +gen_unsigned_less_or_equal() { + gen_pop(); + gen_call ("ccule"); } /** * greater than (unsigned) */ -gugt () -{ - gpop(); - gcall ("?ugt"); +gen_usigned_greater_than() { + gen_pop(); + gen_call ("ccugt"); } /** * greater than or equal (unsigned) */ -guge () -{ - gpop(); - gcall ("?uge"); +gen_unsigned_greater_or_equal() { + gen_pop(); + gen_call ("ccuge"); +} + +char *inclib() { +#ifdef cpm + return("B:"); +#endif +#ifdef unix +#ifdef INCDIR + return(INCDIR); +#else + return ""; +#endif +#endif } /** * Squirrel away argument count in a register that modstk doesn't touch. + * @param d */ gnargs(d) - int d; -{ - ot ("mvi\ta,"); - onum(d); - nl (); +int d; { + output_with_tab ("mvi \ta,"); + output_number(d); + newline (); } + +int assemble(s) +char *s; { +#ifdef ASNM + char buf[100]; + strcpy(buf, ASNM); + strcat(buf, " "); + strcat(buf, s); + buf[strlen(buf)-1] = 's'; + return(system(buf)); +#else + return(0); +#endif + +} + +int link() { +#ifdef LDNM + fputs("I don't know how to link files yet\n", stderr); +#else + return(0); +#endif +} + diff --git a/src/cmd/smallc/codemips.c b/src/cmd/smallc/codemips.c index ee67249..69dcd88 100644 --- a/src/cmd/smallc/codemips.c +++ b/src/cmd/smallc/codemips.c @@ -12,7 +12,7 @@ * This compiler assumes that an integer is the SAME length as * a pointer - in fact, the compiler uses INTSIZE for both. */ -#define INTSIZE 4 +//#define INTSIZE 4 #define BYTEOFF 0 /* @@ -20,30 +20,31 @@ */ header() { - outstr ("#\tSmall C MIPS32\n#\tCoder 1.0, 2012/06/18\n#"); - FEvers(); - nl(); - //ol ("global\tTlneg"); - //ol ("global\tTcase"); - //ol ("global\tTeq"); - //ol ("global\tTne"); - //ol ("global\tTlt"); - //ol ("global\tTle"); - //ol ("global\tTgt"); - //ol ("global\tTge"); - //ol ("global\tTult"); - //ol ("global\tTule"); - //ol ("global\tTugt"); - //ol ("global\tTuge"); - //ol ("global\tTbool"); - //ol ("global\tTmult"); - //ol ("global\tTdiv"); - //ol ("global\tTmod"); + output_string ("#\tSmall C MIPS32\n#\tCoder 1.0, 2012/06/18\n#"); + //FEvers(); + newline(); + //output_line ("global\tTlneg"); + //output_line ("global\tTcase"); + //output_line ("global\tTeq"); + //output_line ("global\tTne"); + //output_line ("global\tTlt"); + //output_line ("global\tTle"); + //output_line ("global\tTgt"); + //output_line ("global\tTge"); + //output_line ("global\tTult"); + //output_line ("global\tTule"); + //output_line ("global\tTugt"); + //output_line ("global\tTuge"); + //output_line ("global\tTbool"); + //output_line ("global\tTmult"); + //output_line ("global\tTdiv"); + //output_line ("global\tTmod"); } -nl() + +newline() { - outbyte (EOL); + output_byte ('\n'); } galign(t) @@ -80,33 +81,31 @@ byteoff() /* * Output internal generated label prefix. */ -olprfix() +void output_label_prefix() { - outstr ("$_"); + output_string ("._"); } /* * Output a label definition terminator. */ -col() +void output_label_terminator() { - outstr (":"); + output_string (":"); } /* * Begin a comment line for the assembler. */ -comment() -{ - outbyte ('#'); +void gen_comment() { + output_byte ('#'); } - /* * Output a prefix in front of user labels. */ prefix() { - //outbyte ('_'); + output_byte ('_'); } /* @@ -124,41 +123,57 @@ prologue() /* todo */ } +fentry() +{ + output_line("addiu\t$sp, $sp, -4"); + output_line("sw\t$ra, 0($sp)"); +} + /* * Text (code) segment. */ -gtext() +code_segment_gtext() { - ol (".text"); + output_line (".text"); } /* * Data segment. */ -gdata() +data_segment_gdata() { - ol (".data"); + output_line (".data"); } +char *inclib() { +#ifdef cpm + return("B:"); +#endif +#ifdef unix +#ifdef INCDIR + return(INCDIR); +#else + return ""; +#endif +#endif +} /* * Output the variable symbol at scptr as an extrn or a public. */ -ppubext (scptr) - char *scptr; +void ppubext (SYMBOL *scptr) { - if (scptr[STORAGE] == STATIC) + if( scptr->storage == STATIC ) return; - ot (".globl\t"); - //prefix(); - outstr (scptr); - nl(); + output_string (".globl\t"); + prefix(); + output_string (scptr); + newline(); } /* * Output the function symbol at scptr as an extrn or a public */ -fpubext (scptr) - char *scptr; +void fpubext (SYMBOL *scptr) { ppubext (scptr); } @@ -166,75 +181,76 @@ fpubext (scptr) /* * Output a decimal number to the assembler file. */ -onum (num) - int num; +void output_number(int num) { - outdec (num); + output_decimal (num); } /* * Fetch a static memory cell into the primary register. */ -getmem (sym) - char *sym; +void gen_get_memory(SYMBOL *sym) { - if ((sym[IDENT] != POINTER) & (sym[TYPE] == CCHAR)) { - ot ("lb\t$v0, "); - //prefix(); - outstr (sym + NAME); + output_string ("\tla\t$t0, "); + prefix(); + output_string (sym->name); + newline(); + if ((sym->identity != POINTER) & (sym->type & CCHAR)) { + if(sym->type & UNSIGNED ) { + output_line ("lbu\t$v0, 0($t0)"); + } else { + output_line ("lb\t$v0, 0($t0)"); + } } else { - ot ("lw\t$v0, "); - //prefix(); - outstr (sym + NAME); + output_line ("lw\t$v0, 0($t0)"); } } + /* * Fetch the address of the specified symbol into the primary register. */ -getloc (sym) - char *sym; +int gen_get_location(SYMBOL *sym) { - if (sym[STORAGE] == LSTATIC) { - ot ("la $v0, "); - printlabel(glint(sym)); - nl(); + if( sym->storage == LSTATIC) { + output_string ("\tla $v0, "); + print_label(sym->offset); + newline(); } else { - ot ("la $v0, "); - onum (glint(sym) - stkp); - outstr ("($sp)\n"); + output_string("\taddiu\t$v0, $sp, "); + output_number (sym->offset - stkp); + newline(); } } /* * Store the primary register into the specified static memory cell. */ -putmem (sym) - char *sym; +void gen_put_memory(SYMBOL *sym) { - if ((sym[IDENT] != POINTER) & (sym[TYPE] == CCHAR)) { - ot ("sb\t$v0, "); - } else - ot ("sw\t$v0, "); - - //prefix(); - outstr (sym + NAME); - nl(); + output_string ("\tla\t$t0, "); + prefix(); + output_string (sym->name); + newline(); + if ((sym->identity != POINTER) & (sym->type & CCHAR)) { + output_line ("sb\t$v0, 0($t0)"); + } else { + output_line ("sw\t$v0, 0($t0)"); + } } /* * Store the specified object type in the primary register * at the address on the top of the stack. */ -putstk (typeobj) - char typeobj; +void gen_put_indirect(char typeobj) { - ol ("lw\t$at, ($sp)"); - ol ("addiu\t$sp, 4"); - if (typeobj == CCHAR) - ol ("sb\t$v0, ($at)"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + if (typeobj & CCHAR) + output_line ("sb\t$v0, 0($t1)"); else - ol ("sw\t$v0, ($at)"); + output_line ("sw\t$v0, 0($t1)"); stkp = stkp + INTSIZE; } @@ -242,88 +258,99 @@ putstk (typeobj) * Fetch the specified object type indirect through the primary * register into the primary register. */ -indirect (typeobj) - char typeobj; +void gen_get_indirect(char typeobj, int reg) { - if (typeobj == CCHAR) - ol ("lb\t$v0, ($v0)"); - else - ol ("lw\t$v0, ($v0)"); + if (typeobj & CCHAR) { + if( typeobj & UNSIGNED ) { + output_line ("lbu\t$v0, 0($v0)"); + } else { + output_line ("lb\t$v0, 0($v0)"); + } + } else { + output_line ("lw\t$v0, 0($v0)"); + } } /* * Swap the primary and secondary registers. */ -swap() +gen_swap() { - ol ("move\t$at, %v0\n\tmove\t$v0, $v1\n\tmove\t$v1, $at"); + output_line ("move\t$at, $v0\n\tmove\t$v0, $v1\n\tmove\t$v1, $at"); } /* * Print partial instruction to get an immediate value into * the primary register. */ -immed() +gen_immediate_a() { - ot ("la\t$v0, "); + output_string ("\tla\t$v0, "); } -immedi() +gen_immediate_c() { - ot ("li\t$v0, "); + output_string ("\tli\t$v0, "); } /* * Push the primary register onto the stack. */ -gpush() +gen_push() { - ol ("addiu\t$sp, -4"); - ol ("sw\t$v0, ($sp)"); + output_line ("addiu\t$sp, $sp, -4"); + output_line ("sw\t$v0, 0($sp)"); stkp = stkp - INTSIZE; } /* * Pop the top of the stack into the secondary register. */ -gpop() +gen_pop() { - ol ("lw\t$v1, ($sp)"); - ol ("addiu\t$sp, 4"); + output_line ("lw\t$v1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); stkp = stkp + INTSIZE; } /* * Swap the primary register and the top of the stack. */ -swapstk() +gen_swap_stack() { - ol ("mov.l\t(%sp)+,%d2\nmov.l\t%d0,-(%sp)\nmov.l\t%d2,%d0"); + output_line ("move\t$t1, $v0"); + output_line ("lw\t$v0, 0($sp)"); + output_line ("sw\t$t1, 0($sp)"); } /* * Call the specified subroutine name. */ -gcall (sname) - char *sname; +gen_call (char * sname) { if (*sname == '^') { - ot ("jsr\tT"); - outstr (++sname); + output_string ("\tjal\tT"); + output_string (++sname); + newline(); + output_line ("nop" ); /* fill delay slot */ } else { - ot ("jsr\t"); - //prefix(); - outstr (sname); + output_string ("\tjal\t"); + prefix(); + output_string (sname); + newline(); + output_line ("nop"); /* fill delay slot */ } - nl(); } /* * Return from subroutine. */ -gret() +gen_ret() { - ol ("jr\t$ra\nnop"); + output_line("lw\t$ra, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("jr\t$ra"); + output_line ("nop"); } /* @@ -331,66 +358,65 @@ gret() */ callstk() { - ol ("jsr\t(%sp)+"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + gen_call ("^callstk"); stkp = stkp + INTSIZE; } /* * Jump to specified internal label number. */ -jump (label) - int label; +gen_jump (int label) { - ot ("j\t"); - printlabel (label); - ol ("\nnop"); + output_string ("\tj\t"); + print_label (label); + newline(); + output_line ("nop"); } /* * Test the primary register and jump if false to label. */ -testjump (label, ft) - int label; - int ft; +gen_test_jump (int label, int ft) { - ol ("cmp.l\t%d0,&0"); if (ft) - ot ("beq\t"); + output_string("\tbne\t$v0, $zero, "); else - ot ("bne\t"); - printlabel (label); - nl(); + output_string("\tbeq\t$v0, $zero, "); + print_label (label); + newline(); + output_line("nop"); // fill delay slot } /* * Print pseudo-op to define a byte. */ -defbyte() +gen_def_byte() { - ot (".byte\t"); + output_string (".byte\t"); } /* * Print pseudo-op to define storage. */ -defstorage() +gen_def_storage() { - ot (".space\t"); + output_string (".space\t"); } /* * Print pseudo-op to define a word. */ -defword() +gen_def_word() { - ot (".word\t"); + output_string (".word\t"); } /* * Modify the stack pointer to the new value indicated. */ -modstk (newstkp) - int newstkp; +gen_modify_stack (int newstkp) { int k; @@ -399,59 +425,59 @@ modstk (newstkp) error("Bad stack alignment (compiler error)"); if (k == 0) return (newstkp); - ot ("add.l\t&"); - onum (k); - outstr (",sp"); - nl(); + output_string ("\taddiu\t$sp, $sp, "); + output_number (k); + newline(); return (newstkp); } /* * Multiply the primary register by INTSIZE. */ -gaslint() +gen_multiply_by_two() { - ol ("asl.l\t&2,%d0"); + output_line ("sll\t$v0, $v0, 2"); } /* * Divide the primary register by INTSIZE. */ -gasrint() +gen_divide_by_two() { - ol ("asr.l\t&2,%d0"); + output_line ("sra\t$v0, $v0, 2"); } /* * Case jump instruction. */ -gjcase() +gen_jump_case() { - gcall ("^case"); + gen_call("^case"); } /* * Add the primary and secondary registers. * If lval2 is int pointer and lval is int, scale lval. */ -gadd (lval, lval2) - int *lval, *lval2; +gen_add (int *lval, int *lval2) { + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); if (dbltest (lval2, lval)) { - ol ("asl.l\t&2,(%sp)"); + output_line("sll\t$t1, $t1, 2"); } - ol ("add.l\t(%sp)+,%d0"); + output_line ("add\t$v0, $v0, $t1"); stkp = stkp + INTSIZE; } /* - * Subtract the primary register from the secondary. + * Subtract the primary register from the secondary. // *** from TOS */ -gsub() +gen_sub() { - ol ("mov.l\t(%sp)+,%d2"); - ol ("sub.l\t%d0,%d2"); - ol ("mov.l\t%d2,%d0"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("sub\t$v0, $t1, $v0"); stkp = stkp + INTSIZE; } @@ -459,9 +485,13 @@ gsub() * Multiply the primary and secondary registers. * (result in primary) */ -gmult() +gen_mult() { - gcall ("^mult"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("mult\t$v0, $t1"); + output_line ("mflo\t$v0"); + //gcall ("^mult"); stkp = stkp + INTSIZE; } @@ -469,9 +499,26 @@ gmult() * Divide the secondary register by the primary. * (quotient in primary, remainder in secondary) */ -gdiv() +gen_div() { - gcall ("^div"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("div\t$t1, $v0"); + output_line ("mflo\t$v0"); + output_line ("mfhi\t$t1"); + //gcall ("^div"); + stkp = stkp + INTSIZE; +} + +gen_udiv() +{ + output_line ("#FIXME genudiv"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("divu\t$t1, $v0"); + output_line ("mflo\t$v0"); + output_line ("mfhi\t$t1"); + //gcall ("^div"); stkp = stkp + INTSIZE; } @@ -480,37 +527,63 @@ gdiv() * divided by the primary register. * (remainder in primary, quotient in secondary) */ -gmod() +gen_mod() { - gcall ("^mod"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("div\t$t1, $v0"); + output_line ("mflo\t$t1"); + output_line ("mfhi\t$v0"); + //gcall ("^mod"); + stkp = stkp + INTSIZE; +} + +gen_umod() +{ + output_line ("#FIXME genumod"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("divu\t$t1, $v0"); + output_line ("mflo\t$t1"); + output_line ("mfhi\t$v0"); + //gcall ("^mod"); stkp = stkp + INTSIZE; } /* * Inclusive 'or' the primary and secondary registers. */ -gor() +gen_or() { - ol ("or.l\t(%sp)+,%d0"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("or\t$v0, $v0, $t1"); + //output_line ("or.l\t(%sp)+,%d0"); stkp = stkp + INTSIZE; } /* * Exclusive 'or' the primary and secondary registers. */ -gxor() +gen_xor() { - ol ("mov.l\t(%sp)+,%d1"); - ol ("eor.l\t%d1,%d0"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("xor\t$v0, $v0, $t1"); + //output_line ("mov.l\t(%sp)+,%d1"); + //output_line ("eor.l\t%d1,%d0"); stkp = stkp + INTSIZE; } /* * 'And' the primary and secondary registers. */ -gand() +gen_and() { - ol ("and.l\t(%sp)+,%d0"); + //output_line ("and.l\t(%sp)+,%d0"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("and\t$v0, $v0, $t1"); stkp = stkp + INTSIZE; } @@ -519,11 +592,11 @@ gand() * times in the primary register. * (results in primary register) */ -gasr() +gen_arithm_shift_right() { - ol ("mov.l\t(%sp)+,%d1"); - ol ("asr.l\t%d0,%d1"); - ol ("mov.l\t%d1,%d0"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("srav\t$v0, $t1, $v0"); stkp = stkp + INTSIZE; } @@ -532,68 +605,74 @@ gasr() * times in the primary register. * (results in primary register) */ -gasl() +gen_arithm_shift_left() { - ol ("mov.l\t(%sp)+,%d1"); - ol ("asl.l\t%d0,%d1"); - ol ("mov.l\t%d1,%d0"); + output_line ("lw\t$t1, 0($sp)"); + output_line ("addiu\t$sp, $sp, 4"); + output_line ("sllv\t$v0, $t1, $v0"); stkp = stkp + INTSIZE; } /* * Two's complement of primary register. */ -gneg() +gen_twos_complement() { - ol ("neg.l\t%d0"); + output_line ("sub\t$v0, $zero, $v0"); } /* * Logical complement of primary register. */ -glneg() +gen_logical_negation() { - gcall ("^lneg"); + //gcall ("^lneg"); + output_line ("sltu\t$t1, $v0, $zero"); + output_line ("sltu\t$t2, $zero, $v0"); + output_line ("or\t$v0, $t1, $t2"); + output_line ("xori\t$v0, $v0, 1"); } /* * One's complement of primary register. */ -gcom() +gen_complement() { - ol ("not\t%d0"); + output_line ("addiu\t$t1, $zero, -1"); + output_line ("xor\t$v0, $v0, $t1"); } /* * Convert primary register into logical value. */ -gbool() +gen_convert_primary_reg_value_to_bool() { - gcall ("^bool"); + output_line ("sltu\t$t1, $v0, $zero"); + output_line ("sltu\t$t2, $zero, $v0"); + output_line ("or\t$v0, $t1, $t2"); + //gcall ("^bool"); } /* * Increment the primary register by 1 if char, INTSIZE if int. */ -ginc (lval) - int lval[]; +gen_increment_primary_reg (lvalue_t *lval) { - if (lval[2] == CINT) - ol ("addq.l\t&4,%d0"); + if (lval->ptr_type & CINT) + output_line("addiu\t$v0, $v0, 4"); else - ol ("addq.l\t&1,%d0"); + output_line("addiu\t$v0, $v0, 1"); } /* * Decrement the primary register by one if char, INTSIZE if int. */ -gdec (lval) - int lval[]; +gen_decrement_primary_reg (lvalue_t *lval) { - if (lval[2] == CINT) - ol ("subq.l\t&4,%d0"); + if (lval->ptr_type & CINT) + output_line("addiu\t$v0, $v0, -4"); else - ol ("subq.l\t&1,%d0"); + output_line("addiu\t$v0, $v0, -1"); } /* @@ -602,94 +681,134 @@ gdec (lval) * and put a literl 1 in the primary if the condition is true, * otherwise they clear the primary register. */ - +///// BEEP BEEP actually, compare tos /* * equal */ -geq() +gen_equal() { - gcall ("^eq"); + output_line("lw\t$t1, 0($sp)"); + output_line("sltu\t$t2, $v0, $t1"); + output_line("sltu\t$v0, $t1, $v0"); + output_line("or\t$v0, $v0, $t2"); + output_line("xori\t$v0, $v0, 1"); + output_line("addiu\t$sp, $sp, 4"); + //gcall ("^eq"); stkp = stkp + INTSIZE; } /* * not equal */ -gne() +gen_not_equal() { - gcall ("^ne"); + output_line("lw\t$t1, 0($sp)"); + output_line("sltu\t$t2, $v0, $t1"); + output_line("sltu\t$v0, $t1, $v0"); + output_line("or\t$v0, $v0, $t2"); + output_line("addiu\t$sp, $sp, 4"); + //gcall ("^ne"); stkp = stkp + INTSIZE; } /* - * less than (signed) + * less than (signed) - TOS < primary */ -glt() +gen_less_than() { - gcall ("^lt"); + output_line("lw\t$t1, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("slt\t$v0, $t1, $v0"); + //gcall ("^lt"); stkp = stkp + INTSIZE; } /* - * less than or equal (signed) + * less than or equal (signed) TOS <= primary */ -gle() +gen_less_or_equal() { - gcall ("^le"); + output_line("lw\t$t1, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("slt\t$v0, $v0, $t1"); // primary < tos + output_line("xori\t$v0, $v0, 1"); // primary >= tos + //gcall ("^le"); stkp = stkp + INTSIZE; } /* - * greater than (signed) + * greater than (signed) TOS > primary */ -ggt() +gen_greater_than() { - gcall ("^gt"); + output_line("lw\t$t1, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("slt\t$v0, $v0, $t1"); //pimary < TOS + //output_line("xori\t$v0, $v0, 1"); + //gcall ("^gt"); stkp = stkp + INTSIZE; } /* - * greater than or equal (signed) + * greater than or equal (signed) TOS >= primary */ -gge() +gen_greater_or_equal() { - gcall ("^ge"); + output_line("lw\t$t1, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("slt\t$v0, $t1, $v0"); //tos < primary + output_line("xori\t$v0, $v0, 1"); //tos >= primary + //gcall ("^ge"); stkp = stkp + INTSIZE; } /* * less than (unsigned) */ -gult() +gen_unsigned_less_than() { - gcall ("^ult"); + output_line("lw\t$t1, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("sltu\t$v0, $t1, $v0"); + //gcall ("^ult"); stkp = stkp + INTSIZE; } /* * less than or equal (unsigned) */ -gule() +gen_unsigned_less_or_equal() { - gcall ("^ule"); + output_line("lw\t$t1, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("sltu\t$v0, $v0, $t1"); // primary < tos + output_line("xori\t$v0, $v0, 1"); // primary >= tos + //gcall ("^ule"); stkp = stkp + INTSIZE; } /* * greater than (unsigned) */ -gugt() +gen_usigned_greater_than() { - gcall ("^ugt"); + output_line("lw\t$t1, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("sltu\t$v0, $v0, $t1"); //pimary < TOS + //gcall ("^ugt"); stkp = stkp + INTSIZE; } /* * greater than or equal (unsigned) */ -guge() +gen_unsigned_greater_or_equal() { - gcall ("^uge"); + output_line("lw\t$t1, 0($sp)"); + output_line("addiu\t$sp, $sp, 4"); + output_line("sltu\t$v0, $t1, $v0"); //tos < primary + output_line("xori\t$v0, $v0, 1"); //tos >= primary + //gcall ("^uge"); stkp = stkp + INTSIZE; } @@ -702,3 +821,26 @@ gnargs (d) { /* Empty for now. */ } + +int assemble(s) +char *s; { +#ifdef ASNM + char buf[100]; + strcpy(buf, ASNM); + strcat(buf, " "); + strcat(buf, s); + buf[strlen(buf)-1] = 's'; + return(system(buf)); +#else + return(0); +#endif +} + + +int link() { +#ifdef LDNM + fputs("I don't know how to link files yet\n", stderr); +#else + return(0); +#endif +} diff --git a/src/cmd/smallc/data.c b/src/cmd/smallc/data.c index 39925c5..ec7feb7 100644 --- a/src/cmd/smallc/data.c +++ b/src/cmd/smallc/data.c @@ -1,19 +1,32 @@ +/* File data.c: 2.2 (84/11/27,16:26:13) */ +/*% cc -O -c % + * + */ + #include #include "defs.h" /* storage words */ +SYMBOL symbol_table[NUMBER_OF_GLOBALS + NUMBER_OF_LOCALS]; +int global_table_index, rglobal_table_index; +int local_table_index; +//char symtab[SYMTBSZ]; +//char *glbptr, *rglbptr, *locptr; + +WHILE ws[WSTABSZ]; //int ws[WSTABSZ]; +//while_table_t *wsptr; //int *wsptr; +int while_table_index; -char symtab[SYMTBSZ]; -char *glbptr, *rglbptr, *locptr; -int ws[WSTABSZ]; -int *wsptr; int swstcase[SWSTSZ]; int swstlab[SWSTSZ]; int swstp; char litq[LITABSZ]; int litptr; +char macq[MACQSIZE]; +int macptr; char line[LINESIZE]; -int lptr; +char mline[LINESIZE]; +int lptr, mptr; /* miscellaneous storage */ @@ -33,11 +46,17 @@ FILE *inclstk[INCLSIZ]; int inclsp; char fname[20]; -char quote[2]; -char *cptr; +//char quote[2]; +int current_symbol_table_idx; //char *cptr; int *iptr; int fexitlab; +int iflevel, skiplevel; int errfile; int sflag; +int cflag; int errs; int aflag; +int uflag; + +char initials_table[INITIALS_SIZE]; // 5kB space for initialisation data +char *initials_table_ptr = 0; diff --git a/src/cmd/smallc/data.h b/src/cmd/smallc/data.h index ac12404..ab8893d 100644 --- a/src/cmd/smallc/data.h +++ b/src/cmd/smallc/data.h @@ -1,16 +1,22 @@ +/* File data.h: 2.2 (84/11/27,16:26:11) */ + /* storage words */ -extern char symtab[]; -extern char *glbptr, *rglbptr, *locptr; -extern int ws[]; -extern int *wsptr; +extern SYMBOL symbol_table[NUMBER_OF_GLOBALS + NUMBER_OF_LOCALS]; //extern char symtab[]; +extern int global_table_index, rglobal_table_index; //extern char *glbptr, *rglbptr, *locptr; +extern int local_table_index; +extern WHILE ws[]; //int ws[]; +extern int while_table_index; //*wsptr; extern int swstcase[]; extern int swstlab[]; extern int swstp; extern char litq[]; extern int litptr; +extern char macq[]; +extern int macptr; extern char line[]; -extern int lptr; +extern char mline[]; +extern int lptr, mptr; /* miscellaneous storage */ @@ -31,9 +37,16 @@ extern int inclsp; extern char fname[]; extern char quote[]; -extern char *cptr; +extern int current_symbol_table_idx; //extern char *cptr; extern int *iptr; extern int fexitlab; +extern int iflevel, skiplevel; extern int errfile; +extern int sflag; +extern int cflag; extern int errs; extern int aflag; +extern int uflag; + +extern char initials_table[INITIALS_SIZE]; // 5kB space for initialisation data +extern char *initials_table_ptr; diff --git a/src/cmd/smallc/defs.h b/src/cmd/smallc/defs.h index 8a193ae..2418987 100644 --- a/src/cmd/smallc/defs.h +++ b/src/cmd/smallc/defs.h @@ -1,128 +1,292 @@ -#define FALSE 0 -#define TRUE 1 -#define NO 0 -#define YES 1 +/* + * File defs.h: 2.1 (83/03/21,02:07:20) + */ + +/* Intel 8080 architecture defs */ +#define INTSIZE 4 /* miscellaneous */ +#define FOREVER for(;;) +#define FALSE 0 +#define TRUE 1 +#define NO 0 +#define YES 1 -#define EOS 0 -#define EOL 10 -#define BKSP 8 -#define CR 13 -#define FFEED 12 -#define TAB 9 +#define EOS 0 +#define LF 10 +#define BKSP 8 +#define CR 13 +#define FFEED 12 +#define TAB 9 /* symbol table parameters */ - -#define SYMSIZ 14 -#define SYMTBSZ 2800 -#define NUMGLBS 150 +/*#define SYMSIZ 38 +#define SYMTBSZ 20000 +#define NUMGLBS 450 #define STARTGLB symtab -#define ENDGLB (STARTGLB + NUMGLBS*SYMSIZ) -#define STARTLOC (ENDGLB + SYMSIZ) -#define ENDLOC (symtab + SYMTBSZ - SYMSIZ) +#define ENDGLB (STARTGLB+NUMGLBS*SYMSIZ) +#define STARTLOC (ENDGLB+SYMSIZ) +#define ENDLOC (symtab+SYMTBSZ-SYMSIZ)*/ /* symbol table entry format */ - -#define NAME 0 -#define IDENT 9 -#define TYPE 10 -#define STORAGE 11 -#define OFFSET 12 +/*#define NAME 0 +#define IDENT 33 +#define TYPE 34 +#define STORAGE 35 +#define OFFSET 36*/ /* system-wide name size (for symbols) */ -#define NAMESIZE 9 -#define NAMEMAX 8 +#define NAMESIZE 33 +#define NAMEMAX 32 + +struct symbol { + char name[NAMESIZE]; // symbol name + int identity; // variable, array, pointer, function + int type; // char, int + int storage; // public, auto, extern, static, lstatic, defauto + int offset; // offset + int count; // count of elements (for arrays) +}; +#define SYMBOL struct symbol + +#define NUMBER_OF_GLOBALS 150 +#define NUMBER_OF_LOCALS 50 /* possible entries for "ident" */ - #define VARIABLE 1 #define ARRAY 2 #define POINTER 3 #define FUNCTION 4 -/* possible entries for "type" */ - -#define CCHAR 1 -#define CINT 2 +/** + * possible entries for "type" + * high order 14 bits give length of object + * low order 2 bits make type unique within length + */ +#define UNSIGNED 1 +#define CCHAR (1 << 2) +#define UCHAR ((1 << 2) + 1) +#define CINT (2 << 2) +#define UINT ((2 << 2) + 1) /* possible entries for storage */ +#define PUBLIC 1 +#define AUTO 2 +#define EXTERN 3 -#define PUBLIC 1 -#define AUTO 2 -#define EXTERN 3 +#define STATIC 4 +#define LSTATIC 5 +#define DEFAUTO 6 -#define STATIC 4 -#define LSTATIC 5 -#define DEFAUTO 6 /* "do"/"for"/"while"/"switch" statement stack */ - -#define WSTABSZ 100 -#define WSSIZ 7 -#define WSMAX ws + WSTABSZ - WSSIZ +#define WSTABSZ 100 +//#define WSSIZ 7 +//#define WSMAX ws+WSTABSZ-WSSIZ /* entry offsets in "do"/"for"/"while"/"switch" stack */ +#define WSSYM 0 +#define WSSP 1 +#define WSTYP 2 +#define WSCASEP 3 +#define WSTEST 3 +#define WSINCR 4 +#define WSDEF 4 +#define WSBODY 5 +#define WSTAB 5 +#define WSEXIT 6 -#define WSSYM 0 -#define WSSP 1 -#define WSTYP 2 -#define WSCASEP 3 -#define WSTEST 3 -#define WSINCR 4 -#define WSDEF 4 -#define WSBODY 5 -#define WSTAB 5 -#define WSEXIT 6 +struct while_rec { + int symbol_idx; // symbol table address + int stack_pointer; // stack pointer + int type; // type + int case_test; // case or test + int incr_def; // continue label ? + int body_tab; // body of loop, switch ? + int while_exit; // exit label +}; +#define WHILE struct while_rec /* possible entries for "wstyp" */ - -#define WSWHILE 0 -#define WSFOR 1 -#define WSDO 2 +#define WSWHILE 0 +#define WSFOR 1 +#define WSDO 2 #define WSSWITCH 3 /* "switch" label stack */ - -#define SWSTSZ 100 +#define SWSTSZ 100 /* literal pool */ - -#define LITABSZ 2000 -#define LITMAX LITABSZ-1 +#define LITABSZ 5000 +#define LITMAX LITABSZ-1 /* input line */ - #define LINESIZE 150 -#define LINEMAX (LINESIZE-1) -#define MPMAX LINEMAX +#define LINEMAX (LINESIZE-1) +#define MPMAX LINEMAX /* macro (define) pool */ - -#define MACQSIZE 1000 -#define MACMAX (MACQSIZE-1) +#define MACQSIZE 5000 +#define MACMAX (MACQSIZE-1) /* "include" stack */ - -#define INCLSIZ 3 +#define INCLSIZ 3 /* statement types (tokens) */ - -#define STIF 1 -#define STWHILE 2 +#define STIF 1 +#define STWHILE 2 #define STRETURN 3 -#define STBREAK 4 -#define STCONT 5 -#define STASM 6 -#define STEXP 7 -#define STDO 8 -#define STFOR 9 +#define STBREAK 4 +#define STCONT 5 +#define STASM 6 +#define STEXP 7 +#define STDO 8 +#define STFOR 9 #define STSWITCH 10 -/* casts, to make gcc happy */ +#define DEFLIB inclib() -#ifdef __GNUC__ -#define CAST_INT (int) -#define CAST_INT_PTR (int*) -#define CAST_CHAR_PTR (char*) -#endif +#define HL_REG 1 +#define DE_REG 2 + +typedef struct lvalue { + SYMBOL *symbol; // symbol table address, or 0 for constant + int indirect; // type of indirect object, 0 for static object + int ptr_type; // type of pointer or array, 0 for other idents +} lvalue_t; + + + +/** + * path to include directories. set at compile time on host machine + * @return + */ +char *inclib(); + +/** + * try to find symbol in local symbol table + * @param sname symbol name + * @return + */ +int findloc (char sname[]); + +/** + * try to find symbol in global symbol table + * @param sname + * @return + */ +int findglb (char sname[]); + +/** + * adds global symbol to the symbol table + * @param sname + * @param id + * @param typ + * @param value + * @param stor + * @return + */ +int add_global (char sname[], int id, int typ, int value, int stor, int count); + +/** + * adds local symbol to the symbol table + * @param sname symbol name + * @param id identity - possible entries, VARIABLE, ARRAY, POINTER, FUNCTION + * @param typ type - possible entries, CCHAR, CINT + * @param value offset field, it is stack frame offset for local objects + * @param stclass storage - possible entries, PUBLIC, AUTO, EXTERN, STATIC, LSTATIC, DEFAUTO + * @return + */ +int add_local (char sname[], int id, int typ, int value, int stclass, int count); + +WHILE *readwhile(); +WHILE *findwhile(); +WHILE *readswitch(); + +/** + * Output the variable symbol at scptr as an extrn or a public + * @param scptr + */ +void ppubext(SYMBOL *scptr); + +/** + * Output the function symbol at scptr as an extrn or a public + * @param scptr + */ +void fpubext(SYMBOL *scptr); + +/** + * fetch a static memory cell into the primary register + * @param sym + */ +void gen_get_memory (SYMBOL *sym); + +/** + * fetch the specified object type indirect through the primary + * register into the primary register + * @param typeobj object type + */ +void gen_get_indirect(char typeobj, int reg); + +/** + * asm - fetch the address of the specified symbol into the primary register + * @param sym the symbol name + */ +int gen_get_location (SYMBOL *sym); + +/** + * asm - store the primary register into the specified static memory cell + * @param sym + */ +void gen_put_memory (SYMBOL *sym); + +// intialisation of global variables +#define INIT_TYPE NAMESIZE +#define INIT_LENGTH NAMESIZE+1 +#define INITIALS_SIZE 5*1024 + +/** + * a constructor :-) + */ +void create_initials(); + +/** + * add new symbol to table + * @param symbol_name + */ +void add_symbol(char *symbol_name, char type); + +/** + * find symbol in table + * @param symbol_name + * @return + */ +int find_symbol(char *symbol_name); + +/** + * add data to table for given symbol + * @param symbol_name + * @param type + * @param value + */ +void add_data(char *symbol_name, int type, int value); + +/** + * get number of data items for given symbol + * @param symbol_name + * @return + */ +int get_size(char *symbol_name); + +/** + * get item at position + * @param symbol_name + * @param position + * @return + */ +int get_item_at(char *symbol_name, int position); + +/** + * push the primary register onto the stack + */ +//void gen_push(); diff --git a/src/cmd/smallc/error.c b/src/cmd/smallc/error.c index 9f09a4f..9420bee 100644 --- a/src/cmd/smallc/error.c +++ b/src/cmd/smallc/error.c @@ -1,41 +1,45 @@ +/* File error.c: 2.1 (83/03/20,16:02:00) */ +/*% cc -O -c % + * + */ + #include #include "defs.h" #include "data.h" error (ptr) - char *ptr; +char ptr[]; { FILE *tempfile; tempfile = output; output = stdout; - doerror (ptr); + doerror(ptr); output = tempfile; - doerror (ptr); + doerror(ptr); errcnt++; } -doerror(ptr) - char *ptr; -{ +doerror(ptr) char *ptr; { int k; - comment (); - outstr (line); - nl (); - comment (); + gen_comment (); + output_string (line); + newline (); + gen_comment (); k = 0; while (k < lptr) { if (line[k] == 9) - tab (); + print_tab (); else - outbyte (' '); + output_byte (' '); k++; } - outbyte ('^'); - nl (); - comment (); - outstr ("****** "); - outstr (ptr); - outstr (" ******"); - nl (); + output_byte ('^'); + newline (); + gen_comment (); + output_string ("****** "); + output_string (ptr); + output_string (" ******"); + newline (); } + diff --git a/src/cmd/smallc/expr.c b/src/cmd/smallc/expr.c index 0ff0dea..11e04bc 100644 --- a/src/cmd/smallc/expr.c +++ b/src/cmd/smallc/expr.c @@ -1,44 +1,80 @@ +/* + * File expr.c: 2.2 (83/06/21,11:24:26) + */ + #include #include "defs.h" #include "data.h" -/* - * lval[0] - symbol table address, else 0 for constant - * lval[1] - type indirect object to fetch, else 0 for static object - * lval[2] - type pointer or array, else 0 +//struct lvalue { +// SYMBOL *symbol ; // symbol table address, or 0 for constant +// int indirect ; // type of indirect object, 0 for static object +// int ptr_type ; // type of pointer or array, 0 for other idents +// int is_const ; // true if constant expression +// int const_val ; // value of constant expression (& other uses) +// TAG_SYMBOL *tagsym ; // tag symbol address, 0 if not struct +// int (*binop)() ; // function address of highest/last binary operator +// char *stage_add ; // stage addess of "oper 0" code, else 0 +// int val_type ; // type of value calculated +//} ; + +//#define LVALUE struct lvalue + +/** + * unsigned operand ? */ -expression (comma) - int comma; -{ - int lval[3]; +nosign(lvalue_t *is) { + SYMBOL *ptr; + + if((is->ptr_type) || + ((ptr = is->symbol) && (ptr->type & UNSIGNED))) { + return 1; + } + return 0; +} + +/** + * lval[0] - symbol table address, else 0 for constant + * lval[1] - type indirect object to fetch, else 0 for static object + * lval[2] - type pointer or array, else 0 + * @param comma + * @return + */ +expression(int comma) { + lvalue_t lval; + int k; do { - if (heir1 (lval)) - rvalue (lval); + if (k = hier1 (&lval)) + rvalue(&lval, k); if (!comma) return; } while (match (",")); } -heir1 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * assignment operators + * @param lval + * @return + */ +hier1 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; char fc; - k = heir1a (lval); + k = hier1a (lval); if (match ("=")) { if (k == 0) { needlval (); return (0); } - if (lval[1]) - gpush (); - if (heir1 (lval2)) - rvalue (lval2); + if (lval->indirect) + gen_push(k); + if (k = hier1 (lval2)) + k = rvalue(lval2, k); store (lval); return (0); - } else { + } else { fc = ch(); if (match ("-=") || match ("+=") || @@ -54,35 +90,47 @@ heir1 (lval) needlval (); return (0); } - if (lval[1]) - gpush (); - rvalue (lval); - gpush (); - if (heir1 (lval2)) - rvalue (lval2); + if (lval->indirect) + gen_push(k); + k = rvalue(lval, k); + gen_push(k); + if (k = hier1 (lval2)) + k = rvalue(lval2, k); switch (fc) { case '-': { if (dbltest(lval,lval2)) - gaslint(); - gsub(); + gen_multiply_by_two(); + gen_sub(); result (lval, lval2); break; } case '+': { if (dbltest(lval,lval2)) - gaslint(); - gadd (lval,lval2); + gen_multiply_by_two(); + gen_add (lval,lval2); result(lval,lval2); break; } - case '*': gmult (); break; - case '/': gdiv (); break; - case '%': gmod (); break; - case '>': gasr (); break; - case '<': gasl (); break; - case '&': gand (); break; - case '^': gxor (); break; - case '|': gor (); break; + case '*': gen_mult (); break; + case '/': + if(nosign(lval) || nosign(lval2)) { + gen_udiv(); + } else { + gen_div(); + } + break; + case '%': + if(nosign(lval) || nosign(lval2)) { + gen_umod(); + } else { + gen_mod(); + } + break; + case '>': gen_arithm_shift_right (); break; + case '<': gen_arithm_shift_left(); break; + case '&': gen_and (); break; + case '^': gen_xor (); break; + case '|': gen_or (); break; } store (lval); return (0); @@ -91,197 +139,228 @@ heir1 (lval) } } -heir1a (lval) - int lval[]; -{ - int k, lval2[3], lab1, lab2; +/** + * processes ? : expression + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier1a (lvalue_t *lval) { + int k, lab1, lab2; + lvalue_t lval2[1]; - k = heir1b (lval); + k = hier1b (lval); blanks (); if (ch () != '?') return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER if (match ("?")) { - testjump (lab1 = getlabel (), FALSE); - if (heir1b (lval2)) - rvalue (lval2); - jump (lab2 = getlabel ()); - printlabel (lab1); - col (); - nl (); + gen_test_jump (lab1 = getlabel (), FALSE); + if (k = hier1b (lval2)) + k = rvalue(lval2, k); + gen_jump (lab2 = getlabel ()); + print_label (lab1); + output_label_terminator (); + newline (); blanks (); if (!match (":")) { error ("missing colon"); return (0); } - if (heir1b (lval2)) - rvalue (lval2); - printlabel (lab2); - col (); - nl (); + if (k = hier1b (lval2)) + k = rvalue(lval2, k); + print_label (lab2); + output_label_terminator (); + newline (); } else return (0); - } } -heir1b (lval) - int lval[]; -{ - int k, lval2[3], lab; +/** + * processes logical or || + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier1b (lvalue_t *lval) { + int k, lab; + lvalue_t lval2[1]; - k = heir1c (lval); + k = hier1c (lval); blanks (); if (!sstreq ("||")) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER if (match ("||")) { - testjump (lab = getlabel (), TRUE); - if (heir1c (lval2)) - rvalue (lval2); - printlabel (lab); - col (); - nl (); - gbool(); + gen_test_jump (lab = getlabel (), TRUE); + if (k = hier1c (lval2)) + k = rvalue(lval2, k); + print_label (lab); + output_label_terminator (); + newline (); + gen_convert_primary_reg_value_to_bool(); } else return (0); - } } -heir1c (lval) - int lval[]; -{ - int k, lval2[3], lab; +/** + * processes logical and && + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier1c (lvalue_t *lval) { + int k, lab; + lvalue_t lval2[1]; - k = heir2 (lval); + k = hier2 (lval); blanks (); if (!sstreq ("&&")) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER if (match ("&&")) { - testjump (lab = getlabel (), FALSE); - if (heir2 (lval2)) - rvalue (lval2); - printlabel (lab); - col (); - nl (); - gbool(); + gen_test_jump (lab = getlabel (), FALSE); + if (k = hier2 (lval2)) + k = rvalue(lval2, k); + print_label (lab); + output_label_terminator (); + newline (); + gen_convert_primary_reg_value_to_bool(); } else return (0); - } } -heir2 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * processes bitwise or | + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier2 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; - k = heir3 (lval); + k = hier3 (lval); blanks (); if ((ch() != '|') | (nch() == '|') | (nch() == '=')) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER { if ((ch() == '|') & (nch() != '|') & (nch() != '=')) { inbyte (); - gpush (); - if (heir3 (lval2)) - rvalue (lval2); - gor (); + gen_push(k); + if (k = hier3 (lval2)) + k = rvalue(lval2, k); + gen_or (); blanks(); } else return (0); } } -heir3 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * processes bitwise exclusive or + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier3 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; - k = heir4 (lval); + k = hier4 (lval); blanks (); if ((ch () != '^') | (nch() == '=')) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER { if ((ch() == '^') & (nch() != '=')){ inbyte (); - gpush (); - if (heir4 (lval2)) - rvalue (lval2); - gxor (); + gen_push(k); + if (k = hier4 (lval2)) + k = rvalue(lval2, k); + gen_xor (); blanks(); } else return (0); } } -heir4 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * processes bitwise and & + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier4 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; - k = heir5 (lval); + k = hier5 (lval); blanks (); if ((ch() != '&') | (nch() == '|') | (nch() == '=')) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER { if ((ch() == '&') & (nch() != '&') & (nch() != '=')) { inbyte (); - gpush (); - if (heir5 (lval2)) - rvalue (lval2); - gand (); + gen_push(k); + if (k = hier5 (lval2)) + k = rvalue(lval2, k); + gen_and (); blanks(); } else return (0); } + } -heir5 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * processes equal and not equal operators + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier5 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; - k = heir6 (lval); + k = hier6 (lval); blanks (); if (!sstreq ("==") & !sstreq ("!=")) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER { if (match ("==")) { - gpush (); - if (heir6 (lval2)) - rvalue (lval2); - geq (); + gen_push(k); + if (k = hier6 (lval2)) + k = rvalue(lval2, k); + gen_equal (); } else if (match ("!=")) { - gpush (); - if (heir6 (lval2)) - rvalue (lval2); - gne (); + gen_push(k); + if (k = hier6 (lval2)) + k = rvalue(lval2, k); + gen_not_equal (); } else return (0); } + } -heir6 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * comparison operators + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier6 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; - k = heir7 (lval); + k = hier7 (lval); blanks (); if (!sstreq ("<") && !sstreq ("<=") && @@ -291,121 +370,139 @@ heir6 (lval) if (sstreq ("<<") || sstreq (">>")) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER { if (match ("<=")) { - gpush (); - if (heir7 (lval2)) - rvalue (lval2); - if (lval[2] || lval2[2]) { - gule (); + gen_push(k); + if (k = hier7 (lval2)) + k = rvalue(lval2, k); + if (nosign(lval) || nosign(lval2)) { + gen_unsigned_less_or_equal (); continue; } - gle (); + gen_less_or_equal (); } else if (match (">=")) { - gpush (); - if (heir7 (lval2)) - rvalue (lval2); - if (lval[2] || lval2[2]) { - guge (); + gen_push(k); + if (k = hier7 (lval2)) + k = rvalue(lval2, k); + if (nosign(lval) || nosign(lval2)) { + gen_unsigned_greater_or_equal (); continue; } - gge (); + gen_greater_or_equal(); } else if ((sstreq ("<")) && !sstreq ("<<")) { inbyte (); - gpush (); - if (heir7 (lval2)) - rvalue (lval2); - if (lval[2] || lval2[2]) { - gult (); + gen_push(k); + if (k = hier7 (lval2)) + k = rvalue(lval2, k); + if (nosign(lval) || nosign(lval2)) { + gen_unsigned_less_than (); continue; } - glt (); + gen_less_than (); } else if ((sstreq (">")) && !sstreq (">>")) { inbyte (); - gpush (); - if (heir7 (lval2)) - rvalue (lval2); - if (lval[2] || lval2[2]) { - gugt (); + gen_push(k); + if (k = hier7 (lval2)) + k = rvalue(lval2, k); + if (nosign(lval) || nosign(lval2)) { + gen_usigned_greater_than (); continue; } - ggt (); + gen_greater_than(); } else return (0); blanks (); } + } -heir7 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * bitwise left, right shift + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier7 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; - k = heir8 (lval); + k = hier8 (lval); blanks (); if (!sstreq (">>") && !sstreq ("<<") || sstreq(">>=") || sstreq("<<=")) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER { if (sstreq(">>") && ! sstreq(">>=")) { inbyte(); inbyte(); - gpush (); - if (heir8 (lval2)) - rvalue (lval2); - gasr (); + gen_push(k); + if (k = hier8 (lval2)) + k = rvalue(lval2, k); + gen_arithm_shift_right (); } else if (sstreq("<<") && ! sstreq("<<=")) { inbyte(); inbyte(); - gpush (); - if (heir8 (lval2)) - rvalue (lval2); - gasl (); + gen_push(k); + if (k = hier8 (lval2)) + k = rvalue(lval2, k); + gen_arithm_shift_left(); } else return (0); blanks(); } + } -heir8 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * addition, subtraction + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier8 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; - k = heir9 (lval); + k = hier9 (lval); blanks (); if ((ch () != '+') & (ch () != '-') | nch() == '=') return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER { if (match ("+")) { - gpush (); - if (heir9 (lval2)) - rvalue (lval2); + gen_push(k); + if (k = hier9 (lval2)) + k = rvalue(lval2, k); /* if left is pointer and right is int, scale right */ if (dbltest (lval, lval2)) - gaslint (); + gen_multiply_by_two (); /* will scale left if right int pointer and left int */ - gadd (lval,lval2); + gen_add (lval,lval2); result (lval, lval2); } else if (match ("-")) { - gpush (); - if (heir9 (lval2)) - rvalue (lval2); + gen_push(k); + if (k = hier9 (lval2)) + k = rvalue(lval2, k); /* if dbl, can only be: pointer - int, or pointer - pointer, thus, in first case, int is scaled up, in second, result is scaled down. */ if (dbltest (lval, lval2)) - gaslint (); - gsub (); + gen_multiply_by_two (); + gen_sub (); /* if both pointers, scale result */ - if ((lval[2] == CINT) && (lval2[2] == CINT)) { - gasrint(); /* divide by intsize */ + + /* the second major condition was added to fix &a[n]-&a[n] where a is an int array + * this was done be inspection and may cause other conditions to fail + * more testing is needed. + * Really, there are multiple problems when taking addresses of arrays + * This needs a lot more work, but it seems to fix the specific problem + * and does not introduce any bugs that I can assign to it */ + if (((lval->ptr_type & CINT) && (lval2->ptr_type & CINT)) + ||((!lval->symbol)&&(!lval2->symbol)&&(lval->ptr_type&CCHAR)&&(lval2->ptr_type&CCHAR)&&(lval->indirect & CINT) && (lval2->indirect & CINT))) { + gen_divide_by_two(); /* divide by intsize */ } result (lval, lval2); } else @@ -413,199 +510,219 @@ heir8 (lval) } } -heir9 (lval) - int lval[]; -{ - int k, lval2[3]; +/** + * multiplication, division, modulus + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier9 (lvalue_t *lval) { + int k; + lvalue_t lval2[1]; - k = heir10 (lval); + k = hier10 (lval); blanks (); if (((ch () != '*') && (ch () != '/') && (ch () != '%')) || (nch() == '=')) return (k); if (k) - rvalue (lval); - for (;;) { + k = rvalue(lval, k); + FOREVER { if (match ("*")) { - gpush (); - if (heir10 (lval2)) - rvalue (lval2); - gmult (); + gen_push(k); + if (k = hier10 (lval2)) + k = rvalue(lval2, k); + gen_mult (); } else if (match ("/")) { - gpush (); - if (heir10 (lval2)) - rvalue (lval2); - gdiv (); + gen_push(k); + if (k = hier10 (lval2)) + k = rvalue(lval2, k); + if(nosign(lval) || nosign(lval2)) { + gen_udiv(); + } else { + gen_div (); + } } else if (match ("%")) { - gpush (); - if (heir10 (lval2)) - rvalue (lval2); - gmod (); + gen_push(k); + if (k = hier10 (lval2)) + k = rvalue(lval2, k); + if(nosign(lval) || nosign(lval2)) { + gen_umod(); + } else { + gen_mod (); + } } else return (0); } + } -heir10 (lval) - int lval[]; -{ +/** + * increment, decrement, negation operators + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier10 (lvalue_t *lval) { int k; - char *ptr; + SYMBOL *ptr; if (match ("++")) { - if ((k = heir10 (lval)) == 0) { + if ((k = hier10 (lval)) == 0) { needlval (); return (0); } - if (lval[1]) - gpush (); - rvalue (lval); - ginc (lval); + if (lval->indirect) + gen_push(k); + k = rvalue(lval, k); + gen_increment_primary_reg (lval); store (lval); return (0); } else if (match ("--")) { - if ((k = heir10 (lval)) == 0) { + if ((k = hier10 (lval)) == 0) { needlval (); return (0); } - if (lval[1]) - gpush (); - rvalue (lval); - gdec (lval); + if (lval->indirect) + gen_push(k); + k = rvalue(lval, k); + gen_decrement_primary_reg (lval); store (lval); return (0); } else if (match ("-")) { - k = heir10 (lval); + k = hier10 (lval); if (k) - rvalue (lval); - gneg (); + k = rvalue(lval, k); + gen_twos_complement(); return (0); } else if (match ("~")) { - k = heir10 (lval); + k = hier10 (lval); if (k) - rvalue (lval); - gcom (); + k = rvalue(lval, k); + gen_complement (); return (0); } else if (match ("!")) { - k = heir10 (lval); + k = hier10 (lval); if (k) - rvalue (lval); - glneg (); + k = rvalue(lval, k); + gen_logical_negation(); return (0); } else if (ch()=='*' && nch() != '=') { inbyte(); - k = heir10 (lval); + k = hier10 (lval); if (k) - rvalue (lval); - ptr = CAST_CHAR_PTR lval[0]; - if (ptr) - lval[1] = ptr[TYPE]; + k = rvalue(lval, k); + if (ptr = lval->symbol) + lval->indirect = ptr->type; else - lval[1] = CINT; - lval[2] = 0; /* flag as not pointer or array */ + lval->indirect = CINT; + lval->ptr_type = 0; // flag as not pointer or array return (1); } else if (ch()=='&' && nch()!='&' && nch()!='=') { inbyte(); - k = heir10 (lval); + k = hier10 (lval); if (k == 0) { error ("illegal address"); return (0); } - ptr = CAST_CHAR_PTR lval[0]; - lval[2] = ptr[TYPE]; - if (lval[1]) + ptr = lval->symbol; + if( ptr ) lval->ptr_type = ptr->type; + if (lval->indirect) return (0); /* global and non-array */ - immed (); - prefix (); - ptr = CAST_CHAR_PTR lval[0]; - outstr (ptr); - nl (); - lval[1] = ptr[TYPE]; + gen_immediate_a (); + prefix(); + output_string ((ptr = lval->symbol)->name); + newline (); + lval->indirect = ptr->type; return (0); } else { - k = heir11 (lval); + k = hier11 (lval); if (match ("++")) { if (k == 0) { needlval (); return (0); } - if (lval[1]) - gpush (); - rvalue (lval); - ginc (lval); + if (lval->indirect) + gen_push(k); + k = rvalue(lval, k); + gen_increment_primary_reg (lval); store (lval); - gdec (lval); + gen_decrement_primary_reg (lval); return (0); } else if (match ("--")) { if (k == 0) { needlval (); return (0); } - if (lval[1]) - gpush (); - rvalue (lval); - gdec (lval); + if (lval->indirect) + gen_push(k); + k = rvalue(lval, k); + gen_decrement_primary_reg (lval); store (lval); - ginc (lval); + gen_increment_primary_reg (lval); return (0); } else return (k); } + } -heir11 (lval) - int *lval; -{ +/** + * array subscripting + * @param lval + * @return 0 or 1, fetch or no fetch + */ +hier11 (lvalue_t *lval) { int k; - char *ptr; + SYMBOL *ptr; k = primary (lval); - ptr = CAST_CHAR_PTR lval[0]; + ptr = lval->symbol; blanks (); if ((ch () == '[') | (ch () == '(')) - for (;;) { + FOREVER { if (match ("[")) { if (ptr == 0) { error ("can't subscript"); junk (); needbrack ("]"); return (0); - } else if (ptr[IDENT] == POINTER) - rvalue (lval); - else if (ptr[IDENT] != ARRAY) { + } else if (ptr->identity == POINTER) + k = rvalue(lval, k); + else if (ptr->identity != ARRAY) { error ("can't subscript"); k = 0; } - gpush (); + gen_push(k); expression (YES); needbrack ("]"); - if (ptr[TYPE] == CINT) - gaslint (); - gadd (NULL,NULL); - lval[0] = 0; - lval[1] = ptr[TYPE]; - k = 1; + if (ptr->type & CINT) + gen_multiply_by_two (); + gen_add (NULL,NULL); + lval->symbol = 0; + lval->indirect = ptr->type; + k = HL_REG; } else if (match ("(")) { if (ptr == 0) callfunction (0); - else if (ptr[IDENT] != FUNCTION) { - rvalue (lval); + else if (ptr->identity != FUNCTION) { + k = rvalue(lval, k); callfunction (0); } else callfunction (ptr); - k = lval[0] = 0; + lval->symbol = 0; + k = 0; } else return (k); } if (ptr == 0) return (k); - if (ptr[IDENT] == FUNCTION) { - immed (); - prefix (); - outstr (ptr); - nl (); + if (ptr->identity == FUNCTION) { + gen_immediate_a (); + prefix(); + output_string (ptr); + newline (); return (0); } return (k); } + diff --git a/src/cmd/smallc/function.c b/src/cmd/smallc/function.c index c5ef57a..3d43264 100644 --- a/src/cmd/smallc/function.c +++ b/src/cmd/smallc/function.c @@ -1,142 +1,174 @@ +/* + * File function.c: 2.1 (83/03/20,16:02:04) + */ + #include #include "defs.h" #include "data.h" -/* - * begin a function - * - * called from "parse", this routine tries to make a function out - * of what follows - * modified version. p.l. woods - */ int argtop; -newfunc () -{ - char n[NAMESIZE], *ptr; - fexitlab = getlabel(); +/** + * begin a function + * called from "parse", this routine tries to make a function out + * of what follows + * modified version. p.l. woods + */ +newfunc() { + char n[NAMESIZE]; + int idx, type; + fexitlab = getlabel(); - if (!symname (n) ) { - error ("illegal function or declaration"); - kill (); - return; - } - ptr = CAST_CHAR_PTR findglb (n); - if (ptr) { - if (ptr[IDENT] != FUNCTION) - multidef (n); - else if (ptr[OFFSET] == FUNCTION) - multidef (n); - else - ptr[OFFSET] = FUNCTION; - } else - addglb (n, FUNCTION, CINT, FUNCTION, PUBLIC); - prologue (); - if (!match ("(")) - error ("missing open paren"); - prefix (); - outstr (n); - col (); - nl (); - locptr = STARTLOC; - argstk = 0; - while (!match (")")) { - if (symname (n)) { - if (findloc (n)) - multidef (n); - else { - addloc (n, 0, 0, argstk, AUTO); - argstk = argstk + intsize(); - } - } else { - error ("illegal argument name"); - junk (); + if (!symname(n)) { + error("illegal function or declaration"); + kill(); + return; + } + if (idx = findglb(n)) { + if (symbol_table[idx].identity != FUNCTION) + multidef(n); + else if (symbol_table[idx].offset == FUNCTION) + multidef(n); + else + symbol_table[idx].offset = FUNCTION; + } else + add_global(n, FUNCTION, CINT, FUNCTION, PUBLIC, 1); + if (!match("(")) + error("missing open paren"); +prefix(); + output_string(n); + output_label_terminator(); + newline(); +fentry(); + local_table_index = NUMBER_OF_GLOBALS; //locptr = STARTLOC; + argstk = 0; + // ANSI style argument declaration + if (doAnsiArguments() == 0) { + // K&R style argument declaration + while (!match(")")) { + if (symname(n)) { + if (findloc(n)) + multidef(n); + else { + add_local(n, 0, 0, argstk, AUTO, 1); + argstk = argstk + INTSIZE; } - blanks (); - if (!streq (line + lptr, ")")) { - if (!match (",")) - error ("expected comma"); - } - if (endst ()) - break; + } else { + error("illegal argument name"); + junk(); + } + blanks(); + if (!streq(line + lptr, ")")) { + if (!match(",")) + error("expected comma"); + } + if (endst()) + break; } stkp = 0; argtop = argstk; while (argstk) { - if (amatch ("register", 8)) { - if (amatch("char", 4)) - getarg(CCHAR); - else if (amatch ("int", 3)) - getarg(CINT); - else - getarg(CINT); - ns(); - } else if (amatch ("char", 4)) { - getarg (CCHAR); - ns (); - } else if (amatch ("int", 3)) { - getarg (CINT); - ns (); - } else { - error ("wrong number args"); - break; - } + if (type = get_type()) { + getarg(type); + need_semicolon(); + } else { + error("wrong number args"); + break; + } } - statement(YES); - printlabel(fexitlab); - col(); - nl(); - modstk (0); - gret (); - stkp = 0; - locptr = STARTLOC; + } + statement(YES); + print_label(fexitlab); + output_label_terminator(); + newline(); + gen_modify_stack(0); + gen_ret(); + stkp = 0; + local_table_index = NUMBER_OF_GLOBALS; //locptr = STARTLOC; } -/* - * declare argument types - * - * called from "newfunc", this routine add an entry in the local - * symbol table for each named argument - * completely rewritten version. p.l. woods +/** + * declare argument types + * called from "newfunc", this routine adds an entry in the local + * symbol table for each named argument + * completely rewritten version. p.l. woods + * @param t argument type (char, int) + * @return */ -getarg (t) - int t; -{ - int j, legalname, address; - char n[NAMESIZE], c, *argptr; +getarg(int t) { + int j, legalname, address, argptr; + char n[NAMESIZE]; - for (;;) { - if (argstk == 0) - return; - if (match ("*")) - j = POINTER; - else - j = VARIABLE; - if (!(legalname = symname (n))) - illname (); - if (match ("[")) { - while (inbyte () != ']') - if (endst ()) - break; - j = POINTER; - } - if (legalname) { - argptr = CAST_CHAR_PTR findloc (n); - if (argptr) { - argptr[IDENT] = j; - argptr[TYPE] = t; - address = argtop - glint(argptr); - if (t == CCHAR && j == VARIABLE) - address = address + byteoff(); - argptr[OFFSET] = (address) & 0xff; - argptr[OFFSET + 1] = (address >> 8) & 0xff; - } else - error ("expecting argument name"); - } - argstk = argstk - intsize(); - if (endst ()) - return; - if (!match (",")) - error ("expected comma"); + FOREVER { if (argstk == 0) return; if (match("*")) j = POINTER; + else j = VARIABLE; if (!(legalname = symname(n))) illname(); if + (match("[")) { while (inbyte() != ']') if (endst()) break; j = + POINTER; } if (legalname) { if (argptr = findloc(n)) { + symbol_table[argptr].identity = j; symbol_table[argptr].type = t + ; address = argtop - symbol_table[argptr].offset; symbol_table[ + argptr].offset = address; } else error("expecting argument name" + ); } argstk = argstk - INTSIZE; if (endst()) return; if (!match( + ",")) error("expected comma"); } } + +doAnsiArguments() { + int type; + type = get_type(); + if (type == 0) { + return 0; // no type detected, revert back to K&R style + } + argtop = argstk; + argstk = 0; + FOREVER + { + if (type) { + doLocalAnsiArgument(type); + } else { + error("wrong number args"); + break; } + if (match(",")) { + type = get_type(); + continue; + } + if (match(")")) { + break; + } + } } + +doLocalAnsiArgument(int type) { + char symbol_name[NAMESIZE]; + int identity, address, argptr, ptr; + + if (match("*")) { + identity = POINTER; + } else { + identity = VARIABLE; + } + if (symname(symbol_name)) { + if (findloc(symbol_name)) { + multidef(symbol_name); + } else { + argptr = add_local (symbol_name, identity, type, 0, AUTO, 1); + argstk = argstk + INTSIZE; + ptr = local_table_index; + while (ptr != NUMBER_OF_GLOBALS) { // modify stack offset as we push more params + ptr = ptr - 1; + address = symbol_table[ptr].offset; + symbol_table[ptr].offset = address + INTSIZE; + } + } + } else { + error("illegal argument name"); + junk(); + } + if (match("[")) { + while (inbyte() != ']') { + if (endst()) { + break; + } + } + identity = POINTER; + symbol_table[argptr].identity = identity; + } +} + diff --git a/src/cmd/smallc/gen.c b/src/cmd/smallc/gen.c index ac174ea..68df459 100644 --- a/src/cmd/smallc/gen.c +++ b/src/cmd/smallc/gen.c @@ -1,50 +1,66 @@ +/* File gen.c: 2.1 (83/03/20,16:02:06) */ +/*% cc -O -c % + * + */ + #include #include "defs.h" #include "data.h" /* * return next available internal label number + * */ getlabel () { return (nxtlab++); + } -/* - * print specified number as label +/** + * print specified number as label + * @param label */ -printlabel (label) - int label; +print_label (label) +int label; { - olprfix (); - outdec (label); + output_label_prefix (); + output_decimal (label); } -/* - * glabel - generate label +/** + * glabel - generate label + * not used ? + * @param lab label number */ glabel (lab) - char *lab; +char *lab; { - prefix (); - outstr (lab); - col (); - nl (); + output_string (lab); + output_label_terminator (); + newline (); } -/* - * gnlabel - generate numeric label +/** + * gnlabel - generate numeric label + * @param nlab label number + * @return */ -gnlabel (nlab) - int nlab; +generate_label (nlab) +int nlab; { - printlabel (nlab); - col (); - nl (); + print_label (nlab); + output_label_terminator (); + newline (); } -outbyte (c) - char c; +/** + * outputs one byte + * @param c + * @return + */ +output_byte (c) +char c; { if (c == 0) return (0); @@ -52,85 +68,94 @@ outbyte (c) return (c); } -outstr (ptr) - char ptr[]; +/** + * outputs a string + * @param ptr the string + * @return + */ +output_string (ptr) +char ptr[]; { int k; - k = 0; - while (outbyte (ptr[k++])); + while (output_byte (ptr[k++])); } -tab () +/** + * outputs a tab + * @return + */ +print_tab () { - outbyte (9); + output_byte ('\t'); } -ol (ptr) - char ptr[]; +/** + * output line + * @param ptr + * @return + */ +output_line (ptr) +char ptr[]; { - ot (ptr); - nl (); + output_with_tab (ptr); + newline (); } -ot (ptr) - char ptr[]; +/** + * tabbed output + * @param ptr + * @return + */ +output_with_tab (ptr) +char ptr[]; { - tab (); - outstr (ptr); + print_tab (); + output_string (ptr); } -outdec (number) - int number; -{ - int k, zs; - char c; - - if (number == -32768) { - outstr ("-32768"); - return; - } - zs = 0; - k = 10000; - if (number < 0) { - number = (-number); - outbyte ('-'); - } - while (k >= 1) { - c = number / k + '0'; - if ((c != '0' | (k == 1) | zs)) { - zs = 1; - outbyte (c); - } - number = number % k; - k = k / 10; - } +/** + * output decimal number + * @param number + * @return + */ +output_decimal (int number) { + fprintf(output, "%d", number); } -store (lval) - int *lval; -{ - if (lval[1] == 0) - putmem (lval[0]); - else - putstk (lval[1]); +/** + * stores values into memory + * @param lval TODO + * @return + */ +store (lvalue_t *lval) { + if (lval->indirect == 0) + gen_put_memory (lval->symbol); + else + gen_put_indirect (lval->indirect); } -rvalue (lval) - int *lval; -{ - if ((lval[0] != 0) & (lval[1] == 0)) - getmem (lval[0]); - else - indirect (lval[1]); +rvalue (lvalue_t *lval, int reg) { + if ((lval->symbol != 0) & (lval->indirect == 0)) + gen_get_memory (lval->symbol); + else + gen_get_indirect (lval->indirect, reg); + return HL_REG; } +/** + * parses test part "(expression)" input and generates assembly for jump + * @param label + * @param ft + * @return + */ test (label, ft) - int label; - int ft; +int label, + ft; { needbrack ("("); expression (YES); needbrack (")"); - testjump (label, ft); + gen_test_jump (label, ft); } + diff --git a/src/cmd/smallc/initialise.c b/src/cmd/smallc/initialise.c new file mode 100644 index 0000000..fae24c8 --- /dev/null +++ b/src/cmd/smallc/initialise.c @@ -0,0 +1,103 @@ +#include +#include +#include "defs.h" +#include "data.h" + +/* + * SYMBOL_NAME 32 + * TYPE 1 + * LENGTH 2 + * initialisation + */ + +/** + * a constructor :-) + */ +void create_initials() { + int i; + for (i=0; i> 8; + initials_table_ptr[index + 1] = 0xff & value; + length++; + initials_table_ptr[INIT_LENGTH] = (0xff00 & length) >> 8; + initials_table_ptr[INIT_LENGTH+1] = 0xff & length; +} + +/** + * get number of data items for given symbol + * @param symbol_name + * @return + */ +int get_size(char *symbol_name) { + int result = 0; + if (find_symbol(symbol_name) != 0) { + result = ((unsigned char)initials_table_ptr[INIT_LENGTH] << 8) + (unsigned char)initials_table_ptr[INIT_LENGTH+1]; + } + return result; +} + +/** + * get item at position + * @param symbol_name + * @param position + * @return + */ +int get_item_at(char *symbol_name, int position) { + int result = 0; + if (find_symbol(symbol_name) != 0) { + int index = NAMESIZE + 1 + 2 + (2 * position); + result = (initials_table_ptr[index] << 8) + (unsigned char)initials_table_ptr[index+1]; + } + return result; +} diff --git a/src/cmd/smallc/io.c b/src/cmd/smallc/io.c index e4869f2..5c0aaaa 100644 --- a/src/cmd/smallc/io.c +++ b/src/cmd/smallc/io.c @@ -1,3 +1,8 @@ +/* File io.c: 2.1 (83/03/20,16:02:07) */ +/*% cc -O -c % + * + */ + #include #include #include "defs.h" @@ -6,8 +11,7 @@ /* * open input file */ -openin (p) - char *p; +openin (p) char *p; { strcpy(fname, p); fixname (fname); @@ -19,6 +23,7 @@ openin (p) } kill (); return (YES); + } /* @@ -33,35 +38,38 @@ openout () } kill (); return (YES); + } /* * change input filename to output filename */ outfname (s) - char *s; +char *s; { while (*s) s++; *--s = 's'; + } -/* - * remove NL from filenames +/** + * remove NL from filenames */ fixname (s) - char *s; +char *s; { - while (*s && *s++ != EOL); + while (*s && *s++ != LF); if (!*s) return; *(--s) = 0; + } -/* - * check that filename is "*.c" +/** + * check that filename is "*.c" */ checkname (s) - char *s; +char *s; { while (*s) s++; @@ -70,27 +78,26 @@ checkname (s) if (*--s != '.') return (NO); return (YES); + } -kill () -{ +kill () { lptr = 0; line[lptr] = 0; } -readline () -{ +readline () { int k; FILE *unit; - for (;;) { + FOREVER { if (feof (input)) return; if ((unit = input2) == NULL) unit = input; kill (); while ((k = fgetc (unit)) != EOF) { - if ((k == EOL) | (lptr >= LINEMAX)) + if ((k == CR) || (k == LF) | (lptr >= LINEMAX)) break; line[lptr++] = k; } @@ -102,9 +109,9 @@ readline () } if (lptr) { if ((ctext) & (cmode)) { - comment (); - outstr (line); - nl (); + gen_comment (); + output_string (line); + newline (); } lptr = 0; return; @@ -112,18 +119,16 @@ readline () } } -inbyte () -{ +inbyte () { while (ch () == 0) { if (feof (input)) return (0); - readline (); + preprocess (); } return (gch ()); } -inchar () -{ +inchar () { if (ch () == 0) readline (); if (feof (input)) @@ -131,37 +136,51 @@ inchar () return (gch ()); } -gch () -{ +/** + * gets current char from input line and moves to the next one + * @return current char + */ +gch () { if (ch () == 0) return (0); else return (line[lptr++] & 127); } -nch () -{ +/** + * returns next char + * @return next char + */ +nch () { if (ch () == 0) return (0); else return (line[lptr + 1] & 127); } -ch () -{ +/** + * returns current char + * @return current char + */ +ch () { return (line[lptr] & 127); } /* * print a carriage return and a string only to console + * */ pl (str) - char *str; +char *str; { int k; k = 0; - putchar (EOL); +#if __CYGWIN__ == 1 + putchar (CR); +#endif + putchar (LF); while (str[k]) putchar (str[k++]); } + diff --git a/src/cmd/smallc/lex.c b/src/cmd/smallc/lex.c index 32db0bd..aabf2d0 100644 --- a/src/cmd/smallc/lex.c +++ b/src/cmd/smallc/lex.c @@ -1,166 +1,227 @@ +/* File lex.c: 2.1 (83/03/20,16:02:09) */ +/*% cc -O -c % + * + */ + #include #include "defs.h" #include "data.h" -/* - * semicolon enforcer - * - * called whenever syntax requires a semicolon - * +/** + * test if given character is alpha + * @param c + * @return */ -ns () -{ - if (!match (";")) - error ("missing semicolon"); +alpha(char c) { + c = c & 127; + return (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + (c == '_')); } -junk () -{ - if (an (inbyte ())) - while (an (ch ())) - gch (); +/** + * test if given character is numeric + * @param c + * @return + */ +numeric(char c) { + c = c & 127; + return ((c >= '0') && (c <= '9')); +} + +/** + * test if given character is alphanumeric + * @param c + * @return + */ +alphanumeric(char c) { + return ((alpha (c)) || (numeric (c))); +} + +/** + * semicolon enforcer + * called whenever syntax requires a semicolon + */ +need_semicolon() { + if (!match (";")) + error ("missing semicolon"); +} + +junk() { + if (alphanumeric (inbyte ())) + while (alphanumeric (ch ())) + gch (); + else + while (alphanumeric (ch ())) { + if (ch () == 0) + break; + gch (); + } + blanks (); +} + +endst() { + blanks (); + return ((streq (line + lptr, ";") | (ch () == 0))); +} + +/** + * enforces bracket + * @param str + * @return + */ +needbrack(char *str) { + if (!match (str)) { + error ("missing bracket"); + gen_comment (); + output_string (str); + newline (); + } +} + +/** + * + * @param str1 + * @return + */ +sstreq(str1) char *str1; { + return (streq(line + lptr, str1)); +} + +/** + * indicates whether or not the current substring in the source line matches a + * literal string + * accepts the address of the current character in the source + * line and the address of the a literal string, and returns the substring length + * if a match occurs and zero otherwise + * @param str1 address1 + * @param str2 address2 + * @return + */ +streq(char str1[], char str2[]) { + int k; + k = 0; + while (str2[k]) { + if ((str1[k] != str2[k])) + return (0); + k++; + } + return (k); +} + +/** + * compares two string both must be zero ended, otherwise no match found + * ensures that the entire token is examined + * @param str1 + * @param str2 + * @param len + * @return + */ +astreq (char str1[], char str2[], int len) { + int k; + k = 0; + while (k < len) { + if ((str1[k] != str2[k])) + break; + if (str1[k] == 0) + break; + if (str2[k] == 0) + break; + k++; + } + if (alphanumeric (str1[k])) + return (0); + if (alphanumeric (str2[k])) + return (0); + return (k); +} + +/** + * looks for a match between a literal string and the current token in + * the input line. It skips over the token and returns true if a match occurs + * otherwise it retains the current position in the input line and returns false + * there is no verification that all of the token was matched + * @param lit + * @return + */ +match (char *lit) { + int k; + blanks(); + if (k = streq (line + lptr, lit)) { + lptr = lptr + k; + return (1); + } + return (0); +} + +/** + * compares two string both must be zero ended, otherwise no match found + * advances line pointer only if match found + * it assumes that an alphanumeric (including underscore) comparison + * is being made and guarantees that all of the token in the source line is + * scanned in the process + * @param lit + * @param len + * @return + */ +amatch(char *lit, int len) { + int k; + + blanks(); + if (k = astreq (line + lptr, lit, len)) { + lptr = lptr + k; + while (alphanumeric (ch ())) + inbyte (); + return (1); + } + return (0); +} + +blanks() { + FOREVER { + while (ch () == 0) { + preprocess (); + if (feof (input)) + break; + } + if (ch () == ' ') + gch (); + else if (ch () == 9) + gch (); else - while (an (ch ())) { - if (ch () == 0) - break; - gch (); - } - blanks (); + return; + } } -endst () -{ - blanks (); - return ((streq (line + lptr, ";") | (ch () == 0))); -} - -needbrack (str) - char *str; -{ - if (!match (str)) { - error ("missing bracket"); - comment (); - outstr (str); - nl (); - } -} - -/* - * test if given character is alpha +/** + * returns declaration type + * @return CCHAR, CINT, UCHAR, UINT */ -alpha (c) - char c; -{ - c = c & 127; - return (((c >= 'a') & (c <= 'z')) | - ((c >= 'A') & (c <= 'Z')) | - (c == '_')); -} - -/* - * test if given character is numeric - */ -numeric (c) - char c; -{ - c = c & 127; - return ((c >= '0') & (c <= '9')); -} - -/* - * test if given character is alphanumeric - */ -an (c) - char c; -{ - return ((alpha (c)) | (numeric (c))); -} - -sstreq (str1) - char *str1; -{ - return (streq(line + lptr, str1)); -} - -streq (str1, str2) - char str1[], str2[]; -{ - int k; - - k = 0; - while (str2[k]) { - if ((str1[k] != str2[k])) - return (0); - k++; +int get_type() { + if (amatch ("register", 8)) { + if (amatch("char", 4)) + return CCHAR; + else if (amatch ("int", 3)) + return CINT; + else + return CINT; + } else if(amatch("unsigned", 8)) { + if (amatch("char", 4)) { + return UCHAR; + } else if (amatch("int", 3)) { + return UINT; } - return (k); -} - -astreq (str1, str2, len) - char str1[], str2[]; - int len; -{ - int k; - - k = 0; - while (k < len) { - if ((str1[k] != str2[k])) - break; - if (str1[k] == 0) - break; - if (str2[k] == 0) - break; - k++; + } else if(amatch("signed", 8)) { + if (amatch("char", 4)) { + return CCHAR; + } else if (amatch("int", 3)) { + return CINT; } - if (an (str1[k])) - return (0); - if (an (str2[k])) - return (0); - return (k); + } else if (amatch ("char", 4)) { + return CCHAR; + } else if (amatch ("int", 3)) { + return CINT; + } + return 0; } -match (lit) - char *lit; -{ - int k; - - blanks (); - if (k = streq (line + lptr, lit)) { - lptr = lptr + k; - return (1); - } - return (0); -} - -amatch (lit, len) - char *lit; - int len; -{ - int k; - - blanks (); - if (k = astreq (line + lptr, lit, len)) { - lptr = lptr + k; - while (an (ch ())) - inbyte (); - return (1); - } - return (0); -} - -blanks () -{ - for (;;) { - while (ch () == 0) { - readline (); - if (feof (input)) - break; - } - if (ch () == ' ') - gch (); - else if (ch () == 9) - gch (); - else - return; - } -} diff --git a/src/cmd/smallc/main.c b/src/cmd/smallc/main.c index 2035037..f4cee8b 100644 --- a/src/cmd/smallc/main.c +++ b/src/cmd/smallc/main.c @@ -1,29 +1,50 @@ +/* + * File main.c: 2.7 (84/11/28,10:14:56) + */ + #include #include #include #include "defs.h" #include "data.h" -main (argc, argv) - int argc; - char *argv[]; -{ - char *p = NULL, *bp; +main(int argc, char *argv[]) { + char *param = NULL, *bp; + int smacptr, i; + macptr = 0; ctext = 0; errs = 0; aflag = 1; - int i=1; - for (; i= litptr)) { - nl(); + newline(); break; } - outbyte(','); + output_byte(','); } } } @@ -184,58 +243,90 @@ dumplits() /** * dump all static variables */ -dumpglbs() -{ - int j; +dumpglbs() { + int dim, i, list_size, line_count, value; if (!glbflag) return; - cptr = rglbptr; - while (cptr < glbptr) { - if (cptr[IDENT] != FUNCTION) { - ppubext(cptr); - if (cptr[STORAGE] != EXTERN) { - prefix(); - outstr(cptr); - col(); - defstorage(); - j = glint(cptr); - if ((cptr[TYPE] == CINT) || - (cptr[IDENT] == POINTER)) - j = j * intsize(); - onum(j); - nl(); + current_symbol_table_idx = rglobal_table_index; + while (current_symbol_table_idx < global_table_index) { + SYMBOL *symbol = &symbol_table[current_symbol_table_idx]; + if (symbol->identity != FUNCTION) { + ppubext(symbol); + if (symbol->storage != EXTERN) { + prefix(); + output_string(symbol->name); + output_label_terminator(); + dim = symbol->offset; + list_size = 0; + line_count = 0; + if (find_symbol(symbol->name)) { // has initials + list_size = get_size(symbol->name); + if (dim == -1) { + dim = list_size; + } + } + for (i=0; itype & CINT) || (symbol->identity == POINTER)) { + gen_def_word(); + } else { + gen_def_byte(); + } + } + if (i < list_size) { + // dump data + value = get_item_at(symbol->name, i); + output_number(value); + } else { + // dump zero, no more data available + output_number(0); + } + line_count++; + if (line_count % 10 == 0) { + line_count = 0; + } else { + if (i < dim-1) { + output_byte( ',' ); + } + } + } + newline(); } } else { - fpubext(cptr); + fpubext(symbol); } - cptr = cptr + SYMSIZ; + current_symbol_table_idx++; } } /* * report errors */ -errorsummary() -{ +errorsummary() { if (ncmp) error("missing closing bracket"); - nl(); - comment(); - outdec(errcnt); + newline(); + gen_comment(); + output_decimal(errcnt); if (errcnt) errfile = YES; - outstr(" error(s) in compilation"); - nl(); - comment(); - ot("literal pool:"); - outdec(litptr); - nl(); - comment(); - ot("global pool:"); - outdec(glbptr - rglbptr); - nl(); - comment(); - pl(errcnt ? "Error(s)" : "No errors"); + output_string(" error(s) in compilation"); + newline(); + gen_comment(); + output_with_tab("literal pool:"); + output_decimal(litptr); + newline(); + gen_comment(); + output_with_tab("global pool:"); + output_decimal(global_table_index - rglobal_table_index); + newline(); + gen_comment(); + output_with_tab("Macro pool:"); + output_decimal(macptr); + newline(); + if (errcnt > 0) + pl("Error(s)"); } /** @@ -243,32 +334,10 @@ errorsummary() * @param s the filename * @return the last char if it contains dot, space otherwise */ -filename_typeof (s) - char *s; -{ +filename_typeof(char *s) { s += strlen(s) - 2; if (*s == '.') return (*(s + 1)); return (' '); } -/** - * "asm" pseudo-statement - * enters mode where assembly language statements are passed - * intact through parser - */ -doasm () -{ - cmode = 0; - for (;;) { - readline (); - if (match ("__endasm__")) - break; - if (feof (input)) - break; - outstr (line); - nl (); - } - kill (); - cmode = 1; -} diff --git a/src/cmd/smallc/preproc.c b/src/cmd/smallc/preproc.c new file mode 100644 index 0000000..f6f5b28 --- /dev/null +++ b/src/cmd/smallc/preproc.c @@ -0,0 +1,371 @@ +/* File preproc.c: 2.3 (84/11/27,11:47:40) */ +/*% cc -O -c % + * + */ + +#include +#include +#include "defs.h" +#include "data.h" + +/** + * remove "brackets" surrounding include file name + * @see DEFLIB + */ +FILE* fix_include_name () { + char c1, c2, *p, *ibp; + char buf[20]; + FILE *fp; + char buf2[100]; + + ibp = &buf[0]; + + if ((c1 = gch ()) != '"' && c1 != '<') + return (NULL); + for (p = line + lptr; *p ;) + *ibp++ = *p++; + c2 = *(--p); + if (c1 == '"' ? (c2 != '"') : (c2 != '>')) { + error ("incorrect delimiter"); + return (NULL); + } + *(--ibp) = 0; + fp = NULL; + if (c1 == '<' || !(fp = fopen(buf, "r"))) { + strcpy(buf2, DEFLIB); + strcat(buf2, buf); + fp = fopen(buf2, "r"); + } + return (fp); +} + +/** + * open an include file + */ +doinclude () +{ + char *p; + FILE *inp2; + + blanks (); + if (inp2 = fix_include_name ()) + if (inclsp < INCLSIZ) { + inclstk[inclsp++] = input2; + input2 = inp2; + } else { + fclose (inp2); + error ("too many nested includes"); + } + else { + error ("Could not open include file"); + } + kill (); + +} + +/** + * "asm" pseudo-statement + * enters mode where assembly language statements are passed + * intact through parser + */ +doasm () +{ + cmode = 0; + FOREVER { + readline (); + if (match ("#endasm")) + break; + if (feof (input)) + break; + output_string (line); + newline (); + } + kill (); + cmode = 1; + +} + +dodefine () +{ + addmac(); +} + +doundef () +{ + int mp; + char sname[NAMESIZE]; + + if (!symname(sname)) { + illname(); + kill(); + return; + } + + if (mp = findmac(sname)) + delmac(mp); + kill(); + +} + +preprocess () +{ + if (ifline()) return; + while (cpp()); +} + +doifdef (ifdef) +int ifdef; +{ + char sname[NAMESIZE]; + int k; + + blanks(); + ++iflevel; + if (skiplevel) return; + k = symname(sname) && findmac(sname); + if (k != ifdef) skiplevel = iflevel; + +} + +ifline() +{ + FOREVER { + readline(); + if (feof(input)) return(1); + if (match("#ifdef")) { + doifdef(YES); + continue; + } else if (match("#ifndef")) { + doifdef(NO); + continue; + } else if (match("#else")) { + if (iflevel) { + if (skiplevel == iflevel) skiplevel = 0; + else if (skiplevel == 0) skiplevel = iflevel; + } else noiferr(); + continue; + } else if (match("#endif")) { + if (iflevel) { + if (skiplevel == iflevel) skiplevel = 0; + --iflevel; + } else noiferr(); + continue; + } + if (!skiplevel) return(0); + } + +} + +noiferr() +{ + error("no matching #if..."); + +} + +/** + * preprocess - copies mline to line with special treatment of preprocess cmds + * @return + */ +cpp () +{ + int k; + char c, sname[NAMESIZE]; + int tog; + int cpped; /* non-zero if something expanded */ + + cpped = 0; + /* don't expand lines with preprocessor commands in them */ + if (!cmode || line[0] == '#') return(0); + + mptr = lptr = 0; + while (ch ()) { + if ((ch () == ' ') | (ch () == 9)) { + keepch (' '); + while ((ch () == ' ') | (ch () == 9)) + gch (); + } else if (ch () == '"') { + keepch (ch ()); + gch (); + while (ch () != '"') { + if (ch () == 0) { + error ("missing quote"); + break; + } + if (ch() == '\\') keepch(gch()); + keepch (gch ()); + } + gch (); + keepch ('"'); + } else if (ch () == '\'') { + keepch ('\''); + gch (); + while (ch () != '\'') { + if (ch () == 0) { + error ("missing apostrophe"); + break; + } + if (ch() == '\\') keepch(gch()); + keepch (gch ()); + } + gch (); + keepch ('\''); + } else if ((ch () == '/') & (nch () == '*')) { + inchar (); + inchar (); + while ((((c = ch ()) == '*') & (nch () == '/')) == 0) + if (c == '$') { + inchar (); + tog = TRUE; + if (ch () == '-') { + tog = FALSE; + inchar (); + } + if (alpha (c = ch ())) { + inchar (); + toggle (c, tog); + } + } else { + if (ch () == 0) + readline (); + else + inchar (); + if (feof (input)) + break; + } + inchar (); + inchar (); + } else if ((ch () == '/') & (nch () == '/')) { // one line comment + while(gch()); + } else if (alphanumeric(ch ())) { + k = 0; + while (alphanumeric(ch ())) { + if (k < NAMEMAX) + sname[k++] = ch (); + gch (); + } + sname[k] = 0; + if (k = findmac (sname)) { + cpped = 1; + while (c = macq[k++]) + keepch (c); + } else { + k = 0; + while (c = sname[k++]) + keepch (c); + } + } else + keepch (gch ()); + } + keepch (0); + if (mptr >= MPMAX) + error ("line too long"); + lptr = mptr = 0; + while (line[lptr++] = mline[mptr++]); + lptr = 0; + return(cpped); + +} + +keepch (c) +char c; +{ + mline[mptr] = c; + if (mptr < MPMAX) + mptr++; + return (c); + +} + +defmac(s) +char *s; +{ + kill(); + strcpy(line, s); + addmac(); +} + +addmac () +{ + char sname[NAMESIZE]; + int k; + int mp; + + if (!symname (sname)) { + illname (); + kill (); + return; + } + if (mp = findmac(sname)) { + error("Duplicate define"); + delmac(mp); + } + k = 0; + while (putmac (sname[k++])); + while (ch () == ' ' | ch () == 9) + gch (); + //while (putmac (gch ())); + while (putmac(remove_one_line_comment(gch ()))); + if (macptr >= MACMAX) + error ("macro table full"); + +} + +/** + * removes one line comments from defines + * @param c + * @return + */ +remove_one_line_comment(c) char c; { + if ((c == '/') && (ch() == '/')) { + while(gch()); + return 0; + } else { + return c; + } +} + +delmac(mp) int mp; { + --mp; --mp; /* step over previous null */ + while (mp >= 0 && macq[mp]) macq[mp--] = '%'; + +} + +putmac (c) +char c; +{ + macq[macptr] = c; + if (macptr < MACMAX) + macptr++; + return (c); + +} + +findmac (sname) +char *sname; +{ + int k; + + k = 0; + while (k < macptr) { + if (astreq (sname, macq + k, NAMEMAX)) { + while (macq[k++]); + return (k); + } + while (macq[k++]); + while (macq[k++]); + } + return (0); + +} + +toggle (name, onoff) +char name; +int onoff; +{ + switch (name) { + case 'C': + ctext = onoff; + break; + } +} + diff --git a/src/cmd/smallc/primary.c b/src/cmd/smallc/primary.c index c817557..a431b42 100644 --- a/src/cmd/smallc/primary.c +++ b/src/cmd/smallc/primary.c @@ -1,155 +1,166 @@ +/* + * File primary.c: 2.4 (84/11/27,16:26:07) + */ + #include #include "defs.h" #include "data.h" -primary (lval) - int *lval; -{ - char *ptr, sname[NAMESIZE]; - int num[1]; - int k; +primary (lvalue_t *lval) { + char sname[NAMESIZE]; + int num[1], k, symbol_table_idx, offset, reg; + SYMBOL *symbol; - lval[2] = 0; /* clear pointer/array type */ + lval->ptr_type = 0; /* clear pointer/array type */ if (match ("(")) { - k = heir1 (lval); + k = hier1 (lval); needbrack (")"); return (k); } if (amatch("sizeof", 6)) { needbrack("("); - immedi(); - if (amatch("int", 3)) - onum(intsize()); - else if (amatch("char", 4)) - onum(1); + gen_immediate_c(); + if (amatch("int", 3)) output_number(INTSIZE); + else if (amatch("char", 4)) output_number(1); else if (symname(sname)) { - if ((ptr = CAST_CHAR_PTR findloc(sname)) || - (ptr = CAST_CHAR_PTR findglb(sname))) - { - if (ptr[STORAGE] == LSTATIC) + if ((symbol_table_idx = findloc(sname)) || + (symbol_table_idx = findglb(sname))) { + symbol = &symbol_table[symbol_table_idx]; + if (symbol->storage == LSTATIC) error("sizeof local static"); - k = glint(ptr); - if ((ptr[TYPE] == CINT) || - (ptr[IDENT] == POINTER)) - k *= intsize(); - onum(k); + offset = symbol->count; + if ((symbol->type & CINT) || + (symbol->identity == POINTER)) + offset *= INTSIZE; + output_number(offset); } else { error("sizeof undeclared variable"); - onum(0); + output_number(0); } } else { - error("sizeof only on type or variable"); + error("sizeof only on simple type or variable"); } needbrack(")"); - nl(); - return(lval[0] = lval[1] = 0); + newline(); + lval->symbol = 0; + lval->indirect = 0; + return(0); } if (symname (sname)) { - ptr = CAST_CHAR_PTR findloc (sname); - if (ptr) { - getloc (ptr); - lval[0] = CAST_INT ptr; - lval[1] = ptr[TYPE]; - if (ptr[IDENT] == POINTER) { - lval[1] = CINT; - lval[2] = ptr[TYPE]; + if (symbol_table_idx = findloc (sname)) { + symbol = &symbol_table[symbol_table_idx]; + reg = gen_get_location (symbol); + lval->symbol = symbol; + lval->indirect = symbol->type; + if (symbol->identity == ARRAY) { + lval->ptr_type = symbol->type; + //lval->ptr_type = 0; + return 0; } - if (ptr[IDENT] == ARRAY) { - lval[1] = ptr[TYPE]; - lval[2] = 0; - return (0); - } else - return (1); + if (symbol->identity == POINTER) { + lval->indirect = UINT; + lval->ptr_type = symbol->type; + } + return reg; } - ptr = CAST_CHAR_PTR findglb (sname); - if (ptr) - if (ptr[IDENT] != FUNCTION) { - lval[0] = CAST_INT ptr; - lval[1] = 0; - if (ptr[IDENT] != ARRAY) { - if (ptr[IDENT] == POINTER) - lval[2] = ptr[TYPE]; - return (1); + if (symbol_table_idx = findglb (sname)) { + symbol = &symbol_table[symbol_table_idx]; + if (symbol->identity != FUNCTION) { + lval->symbol = symbol; + lval->indirect = 0; + if (symbol->identity != ARRAY) { + if (symbol->identity == POINTER) { + lval->ptr_type = symbol->type; + } + return 1; } - immed (); - prefix (); - outstr (ptr); - nl (); - lval[1] = lval[2] = ptr[TYPE]; - lval[2] = 0; - return (0); + gen_immediate_a (); + prefix(); + output_string (symbol->name); + newline (); + lval->indirect = lval->ptr_type = symbol_table[symbol_table_idx].type; + lval->ptr_type = 0; + return 0; } + } blanks (); if (ch() != '(') error("undeclared variable"); - ptr = CAST_CHAR_PTR addglb (sname, FUNCTION, CINT, 0, PUBLIC); - lval[0] = CAST_INT ptr; - lval[1] = 0; - return (0); + symbol_table_idx = add_global (sname, FUNCTION, CINT, 0, PUBLIC, 1); + symbol = &symbol_table[symbol_table_idx]; + lval->symbol = symbol; + lval->indirect = 0; + return 0; + } + if (constant (num)) { + lval->symbol = 0; + lval->indirect = 0; + return 0; } - if (constant (num)) - return (lval[0] = lval[1] = 0); else { error ("invalid expression"); - immedi (); - onum (0); - nl (); + gen_immediate_c (); + output_number(0); + newline (); junk (); - return (0); + return 0; } + } -/* - * true if val1 -> int pointer or int array and val2 not pointer or array +/** + * true if val1 -> int pointer or int array and val2 not pointer or array + * @param val1 + * @param val2 + * @return */ -dbltest (val1, val2) - int val1[], val2[]; -{ +dbltest (lvalue_t *val1, lvalue_t *val2) { if (val1 == NULL) return (FALSE); - if (val1[2] != CINT) + if (!(val1->ptr_type & CINT)) return (FALSE); - if (val2[2]) + if (val2->ptr_type) return (FALSE); return (TRUE); } -/* - * determine type of binary operation +/** + * determine type of binary operation + * @param lval + * @param lval2 + * @return */ -result (lval, lval2) - int lval[]; - int lval2[]; -{ - if (lval[2] && lval2[2]) - lval[2] = 0; - else if (lval2[2]) { - lval[0] = lval2[0]; - lval[1] = lval2[1]; - lval[2] = lval2[2]; +result (lvalue_t *lval, lvalue_t *lval2) { + if (lval->ptr_type && lval2->ptr_type) + lval->ptr_type = 0; + else if (lval2->ptr_type) { + lval->symbol = lval2->symbol; + lval->indirect = lval2->indirect; + lval->ptr_type = lval2->ptr_type; } } constant (val) - int val[]; +int val[]; { if (number (val)) - immedi (); - else if (pstr (val)) - immed (); - else if (qstr (val)) { - immed (); - printlabel (litlab); - outbyte ('+'); + gen_immediate_c (); + else if (quoted_char (val)) + gen_immediate_c (); + else if (quoted_string (val)) { + gen_immediate_a (); + print_label (litlab); + output_byte ('+'); } else return (0); - onum (val[0]); - nl (); + output_number (val[0]); + newline (); return (1); + } number (val) - int val[]; +int val[]; { int k, minus, base; char c; @@ -184,40 +195,51 @@ number (val) if (minus < 0) k = (-k); val[0] = k; - return (1); + if(k < 0) { + return (UINT); + } else { + return (CINT); + } } -pstr (val) - int val[]; -{ +/** + * Test if we have one char enclosed in single quotes + * @param value returns the char found + * @return 1 if we have, 0 otherwise + */ +quoted_char (int *value) { int k; char c; k = 0; if (!match ("'")) return (0); - while ((c = gch ()) != 39) { + while ((c = gch ()) != '\'') { c = (c == '\\') ? spechar(): c; k = (k & 255) * 256 + (c & 255); } - val[0] = k; + *value = k; return (1); } -qstr (val) - int val[]; -{ +/** + * Test if we have string enclosed in double quotes. e.g. "abc". + * Load the string into literal pool. + * @param position returns beginning of the string + * @return 1 if such string found, 0 otherwise + */ +quoted_string (int *position) { char c; - if (!match (quote)) + if (!match ("\"")) return (0); - val[0] = litptr; + *position = litptr; while (ch () != '"') { if (ch () == 0) break; if (litptr >= LITMAX) { error ("string space exhausted"); - while (!match (quote)) + while (!match ("\"")) if (gch () == 0) break; return (1); @@ -230,68 +252,64 @@ qstr (val) return (1); } -/* - * decode special characters (preceeded by back slashes) +/** + * decode special characters (preceeded by back slashes) */ -spechar() -{ +spechar() { char c; c = ch(); - if (c == 'n') c = EOL; + if (c == 'n') c = LF; else if (c == 't') c = TAB; else if (c == 'r') c = CR; else if (c == 'f') c = FFEED; else if (c == 'b') c = BKSP; else if (c == '0') c = EOS; - else if (c == EOS) return; + else if (c == EOS) return 0; gch(); return (c); } -/* - * perform a function call - * - * called from "heir11", this routine will either call the named - * function, or if the supplied ptr is zero, will call the contents - * of HL - * +/** + * perform a function call + * called from "hier11", this routine will either call the named + * function, or if the supplied ptr is zero, will call the contents + * of HL + * @param ptr name of the function */ -callfunction (ptr) - char *ptr; +void callfunction (ptr) +char *ptr; { int nargs; nargs = 0; blanks (); if (ptr == 0) - gpush (); - + gen_push (HL_REG); while (!streq (line + lptr, ")")) { if (endst ()) break; expression (NO); if (ptr == 0) - swapstk (); - gpush (); - nargs = nargs + intsize(); + gen_swap_stack (); + gen_push (HL_REG); + nargs = nargs + INTSIZE; if (!match (",")) break; } needbrack (")"); if (aflag) - gnargs(nargs / intsize()); - + gnargs(nargs / INTSIZE); if (ptr) - gcall (ptr); + gen_call (ptr); else callstk (); - - stkp = modstk (stkp + nargs); + stkp = gen_modify_stack (stkp + nargs); } needlval () { error ("must be lvalue"); } + diff --git a/src/cmd/smallc/stmt.c b/src/cmd/smallc/stmt.c index aa5535d..7b6ead3 100644 --- a/src/cmd/smallc/stmt.c +++ b/src/cmd/smallc/stmt.c @@ -1,74 +1,76 @@ +/* + * File stmt.c: 2.1 (83/03/20,16:02:17) + */ + #include #include "defs.h" #include "data.h" -/* - * statement parser - * - * called whenever syntax requires a statement. this routine - * performs that statement and returns a number telling which one - * - * 'func' is true if we require a "function_statement", which - * must be compound, and must contain "statement_list" (even if - * "declaration_list" is omitted) +/** + * statement parser + * called whenever syntax requires a statement. this routine + * performs that statement and returns a number telling which one + * @param func func is true if we require a "function_statement", which + * must be compound, and must contain "statement_list" (even if + * "declaration_list" is omitted) + * @return statement type */ -statement (func) - int func; -{ +statement (int func) { if ((ch () == 0) & feof (input)) return (0); lastst = 0; if (func) if (match ("{")) { - compound (YES); + do_compound (YES); return (lastst); } else error ("function requires compound statement"); if (match ("{")) - compound (NO); + do_compound (NO); else - stst (); + do_statement (); return (lastst); } -/* - * declaration +/** + * declaration */ -stdecl () -{ +statement_declare() { if (amatch("register", 8)) - doldcls(DEFAUTO); + do_local_declares(DEFAUTO); else if (amatch("auto", 4)) - doldcls(DEFAUTO); + do_local_declares(DEFAUTO); else if (amatch("static", 6)) - doldcls(LSTATIC); - else if (doldcls(AUTO)) ; + do_local_declares(LSTATIC); + else if (do_local_declares(AUTO)) ; else return (NO); return (YES); } -doldcls(stclass) - int stclass; -{ +/** + * local declarations + * @param stclass + * @return + */ +do_local_declares(int stclass) { + int type = 0; blanks(); - if (amatch("char", 4)) - declloc(CCHAR, stclass); - else if (amatch("int", 3)) - declloc(CINT, stclass); - else if (stclass == LSTATIC || stclass == DEFAUTO) - declloc(CINT, stclass); - else - return(0); - ns(); + if (type = get_type()) { + declare_local(type, stclass); + } else if (stclass == LSTATIC || stclass == DEFAUTO) { + declare_local(CINT, stclass); + } else { + return(0); + } + need_semicolon(); return(1); } -/* - * non-declaration statement +/** + * non-declaration statement */ -stst () -{ +do_statement () { if (amatch ("if", 2)) { doif (); lastst = STIF; @@ -80,22 +82,22 @@ stst () lastst = STSWITCH; } else if (amatch ("do", 2)) { dodo (); - ns (); + need_semicolon (); lastst = STDO; } else if (amatch ("for", 3)) { dofor (); lastst = STFOR; } else if (amatch ("return", 6)) { doreturn (); - ns (); + need_semicolon (); lastst = STRETURN; } else if (amatch ("break", 5)) { dobreak (); - ns (); + need_semicolon (); lastst = STBREAK; } else if (amatch ("continue", 8)) { docont (); - ns (); + need_semicolon (); lastst = STCONT; } else if (match (";")) ; @@ -105,34 +107,30 @@ stst () } else if (amatch ("default", 7)) { dodefault (); lastst = statement (NO); - } else if (match ("__asm__")) { + } else if (match ("#asm")) { doasm (); lastst = STASM; } else if (match ("{")) - compound (NO); + do_compound (NO); else { expression (YES); /* if (match (":")) { dolabel (); lastst = statement (NO); } else { -*/ ns (); +*/ need_semicolon (); lastst = STEXP; /* } */ } } -/* - * compound statement - * - * allow any number of statements to fall between "{" and "}" - * - * 'func' is true if we are in a "function_statement", which - * must contain "statement_list" +/** + * compound statement + * allow any number of statements to fall between "{" and "}" + * 'func' is true if we are in a "function_statement", which + * must contain "statement_list" */ -compound (func) - int func; -{ +do_compound(int func) { int decls; decls = YES; @@ -141,184 +139,178 @@ compound (func) if (feof (input)) return; if (decls) { - if (!stdecl ()) + if (!statement_declare ()) decls = NO; } else - stst (); + do_statement (); } ncmp--; } -/* - * "if" statement +/** + * "if" statement */ -doif () -{ +doif() { int fstkp, flab1, flab2; - char *flev; + int flev; - flev = locptr; + flev = local_table_index; fstkp = stkp; flab1 = getlabel (); test (flab1, FALSE); statement (NO); - stkp = modstk (fstkp); - locptr = flev; + stkp = gen_modify_stack (fstkp); + local_table_index = flev; if (!amatch ("else", 4)) { - gnlabel (flab1); + generate_label (flab1); return; } - jump (flab2 = getlabel ()); - gnlabel (flab1); + gen_jump (flab2 = getlabel ()); + generate_label (flab1); statement (NO); - stkp = modstk (fstkp); - locptr = flev; - gnlabel (flab2); + stkp = gen_modify_stack (fstkp); + local_table_index = flev; + generate_label (flab2); } -/* - * "while" statement +/** + * "while" statement */ -dowhile () -{ - int ws[7]; +dowhile() { + WHILE ws; //int ws[7]; - ws[WSSYM] = CAST_INT locptr; - ws[WSSP] = stkp; - ws[WSTYP] = WSWHILE; - ws[WSTEST] = getlabel (); - ws[WSEXIT] = getlabel (); - addwhile (ws); - gnlabel (ws[WSTEST]); - test (ws[WSEXIT], FALSE); + ws.symbol_idx = local_table_index; + ws.stack_pointer = stkp; + ws.type = WSWHILE; + ws.case_test = getlabel (); + ws.while_exit = getlabel (); + addwhile (&ws); + generate_label (ws.case_test); + test (ws.while_exit, FALSE); statement (NO); - jump (ws[WSTEST]); - gnlabel (ws[WSEXIT]); - locptr = CAST_CHAR_PTR ws[WSSYM]; - stkp = modstk (ws[WSSP]); + gen_jump (ws.case_test); + generate_label (ws.while_exit); + local_table_index = ws.symbol_idx; + stkp = gen_modify_stack (ws.stack_pointer); delwhile (); } -/* - * "do" statement +/** + * "do" statement */ -dodo () -{ - int ws[7]; +dodo() { + WHILE ws; //int ws[7]; - ws[WSSYM] = CAST_INT locptr; - ws[WSSP] = stkp; - ws[WSTYP] = WSDO; - ws[WSBODY] = getlabel (); - ws[WSTEST] = getlabel (); - ws[WSEXIT] = getlabel (); - addwhile (ws); - gnlabel (ws[WSBODY]); + ws.symbol_idx = local_table_index; + ws.stack_pointer = stkp; + ws.type = WSDO; + ws.body_tab = getlabel (); + ws.case_test = getlabel (); + ws.while_exit = getlabel (); + addwhile (&ws); + generate_label (ws.body_tab); statement (NO); if (!match ("while")) { error ("missing while"); return; } - gnlabel (ws[WSTEST]); - test (ws[WSBODY], TRUE); - gnlabel (ws[WSEXIT]); - locptr = CAST_CHAR_PTR ws[WSSYM]; - stkp = modstk (ws[WSSP]); + generate_label (ws.case_test); + test (ws.body_tab, TRUE); + generate_label (ws.while_exit); + local_table_index = ws.symbol_idx; + stkp = gen_modify_stack (ws.stack_pointer); delwhile (); } -/* - * "for" statement +/** + * "for" statement */ -dofor () -{ - int ws[7], - *pws; +dofor() { + WHILE ws; //int ws[7], + WHILE *pws; - ws[WSSYM] = CAST_INT locptr; - ws[WSSP] = stkp; - ws[WSTYP] = WSFOR; - ws[WSTEST] = getlabel (); - ws[WSINCR] = getlabel (); - ws[WSBODY] = getlabel (); - ws[WSEXIT] = getlabel (); - addwhile (ws); - pws = CAST_INT_PTR readwhile (); + ws.symbol_idx = local_table_index; + ws.stack_pointer = stkp; + ws.type = WSFOR; + ws.case_test = getlabel (); + ws.incr_def = getlabel (); + ws.body_tab = getlabel (); + ws.while_exit = getlabel (); + addwhile (&ws); + pws = readwhile (); needbrack ("("); if (!match (";")) { expression (YES); - ns (); + need_semicolon (); } - gnlabel (pws[WSTEST]); + generate_label (pws->case_test); if (!match (";")) { expression (YES); - testjump (pws[WSBODY], TRUE); - jump (pws[WSEXIT]); - ns (); + gen_test_jump (pws->body_tab, TRUE); + gen_jump (pws->while_exit); + need_semicolon (); } else - pws[WSTEST] = pws[WSBODY]; - gnlabel (pws[WSINCR]); + pws->case_test = pws->body_tab; + generate_label (pws->incr_def); if (!match (")")) { expression (YES); needbrack (")"); - jump (pws[WSTEST]); + gen_jump (pws->case_test); } else - pws[WSINCR] = pws[WSTEST]; - gnlabel (pws[WSBODY]); + pws->incr_def = pws->case_test; + generate_label (pws->body_tab); statement (NO); - jump (pws[WSINCR]); - gnlabel (pws[WSEXIT]); - locptr = CAST_CHAR_PTR pws[WSSYM]; - stkp = modstk (pws[WSSP]); + gen_jump (pws->incr_def); + generate_label (pws->while_exit); + local_table_index = pws->symbol_idx; + stkp = gen_modify_stack (pws->stack_pointer); delwhile (); } -/* - * "switch" statement +/** + * "switch" statement */ -doswitch () -{ - int ws[7]; - int *ptr; +doswitch() { + WHILE ws; //int ws[7]; + WHILE *ptr; //int *ptr; - ws[WSSYM] = CAST_INT locptr; - ws[WSSP] = stkp; - ws[WSTYP] = WSSWITCH; - ws[WSCASEP] = swstp; - ws[WSTAB] = getlabel (); - ws[WSDEF] = ws[WSEXIT] = getlabel (); - addwhile (ws); - immed (); - printlabel (ws[WSTAB]); - nl (); - gpush (); + ws.symbol_idx = local_table_index; + ws.stack_pointer = stkp; + ws.type = WSSWITCH; + ws.case_test = swstp; + ws.body_tab = getlabel (); + ws.incr_def = ws.while_exit = getlabel (); + addwhile (&ws); + gen_immediate_a (); + print_label (ws.body_tab); + newline (); + gen_push (); needbrack ("("); expression (YES); needbrack (")"); - stkp = stkp + intsize(); /* '?case' will adjust the stack */ - gjcase (); + stkp = stkp + INTSIZE; // '?case' will adjust the stack + gen_jump_case (); statement (NO); - ptr = CAST_INT_PTR readswitch (); - jump (ptr[WSEXIT]); + ptr = readswitch (); + gen_jump (ptr->while_exit); dumpsw (ptr); - gnlabel (ptr[WSEXIT]); - locptr = CAST_CHAR_PTR ptr[WSSYM]; - stkp = modstk (ptr[WSSP]); - swstp = ptr[WSCASEP]; + generate_label (ptr->while_exit); + local_table_index = ptr->symbol_idx; + stkp = gen_modify_stack (ptr->stack_pointer); + swstp = ptr->case_test; delwhile (); } -/* - * "case" label +/** + * "case" label */ -docase () -{ +docase() { int val; val = 0; if (readswitch ()) { if (!number (&val)) - if (!pstr (&val)) + if (!quoted_char (&val)) error ("bad case label"); addcase (val); if (!match (":")) @@ -327,95 +319,88 @@ docase () error ("no active switch"); } -/* - * "default" label +/** + * "default" label */ -dodefault () -{ - int *ptr, - lab; +dodefault() { + WHILE *ptr; //int *ptr, + int lab; - ptr = CAST_INT_PTR readswitch (); - if (ptr) { - ptr[WSDEF] = lab = getlabel (); - gnlabel (lab); + if (ptr = readswitch ()) { + ptr->incr_def = lab = getlabel (); + generate_label (lab); if (!match (":")) error ("missing colon"); } else error ("no active switch"); } -/* - * "return" statement +/** + * "return" statement */ -doreturn () -{ +doreturn() { if (endst () == 0) expression (YES); - jump(fexitlab); + gen_jump(fexitlab); } -/* - * "break" statement +/** + * "break" statement */ -dobreak () -{ - int *ptr; +dobreak() { + WHILE *ptr; //int *ptr; - ptr = CAST_INT_PTR readwhile (); - if (ptr == 0) + if ((ptr = readwhile ()) == 0) return; - modstk (ptr[WSSP]); - jump (ptr[WSEXIT]); + gen_modify_stack (ptr->stack_pointer); + gen_jump (ptr->while_exit); } -/* - * "continue" statement +/** + * "continue" statement */ -docont () -{ - int *ptr; +docont() { + WHILE *ptr; //int *ptr; - ptr = CAST_INT_PTR findwhile (); - if (ptr == 0) + if ((ptr = findwhile ()) == 0) return; - modstk (ptr[WSSP]); - if (ptr[WSTYP] == WSFOR) - jump (ptr[WSINCR]); + gen_modify_stack (ptr->stack_pointer); + if (ptr->type == WSFOR) + gen_jump (ptr->incr_def); else - jump (ptr[WSTEST]); + gen_jump (ptr->case_test); } -/* - * dump switch table +/** + * dump switch table */ -dumpsw (ws) - int ws[]; -{ +dumpsw(WHILE *ws) { +//int ws[]; int i,j; - gdata (); - gnlabel (ws[WSTAB]); - if (ws[WSCASEP] != swstp) { - j = ws[WSCASEP]; + data_segment_gdata (); + generate_label (ws->body_tab); + if (ws->case_test != swstp) { + j = ws->case_test; while (j < swstp) { - defword (); + gen_def_word (); i = 4; while (i--) { - onum (swstcase[j]); - outbyte (','); - printlabel (swstlab[j++]); + output_number (swstcase[j]); + output_byte (','); + print_label (swstlab[j++]); if ((i == 0) | (j >= swstp)) { - nl (); + newline (); break; } - outbyte (','); + output_byte (','); } } } - defword (); - printlabel (ws[WSDEF]); - outstr (",0"); - nl (); - gtext (); + gen_def_word (); + print_label (ws->incr_def); + output_string (",0"); + newline (); + code_segment_gtext (); } + diff --git a/src/cmd/smallc/sym.c b/src/cmd/smallc/sym.c index 04639bb..b84c395 100644 --- a/src/cmd/smallc/sym.c +++ b/src/cmd/smallc/sym.c @@ -1,19 +1,23 @@ +/* + * File sym.c: 2.1 (83/03/20,16:02:19) + */ + #include #include "defs.h" #include "data.h" -/* - * declare a static variable +/** + * declare a static variable + * @param type + * @param storage + * @return */ -declglb (typ, stor) - int typ; - int stor; -{ - int k, j; +declare_global(int type, int storage) { + int k, j, count; char sname[NAMESIZE]; - for (;;) { - for (;;) { + FOREVER { + FOREVER { if (endst ()) return; k = 1; @@ -25,14 +29,17 @@ declglb (typ, stor) illname (); if (findglb (sname)) multidef (sname); + count = 1; if (match ("[")) { k = needsub (); - if (k || stor == EXTERN) + count = k; + //if (k || storage == EXTERN) j = ARRAY; - else - j = POINTER; + //else + // j = POINTER; } - addglb (sname, j, typ, k, stor); + j = initials(sname, type, j, k); + add_global (sname, j, type, (k == 0 ? -1 : k), storage, count); break; } if (!match (",")) @@ -40,20 +47,21 @@ declglb (typ, stor) } } -/* - * declare local variables - * - * works just like "declglb", but modifies machine stack and adds - * symbol table entry with appropriate stack offset to find it again +/** + * declare local variables + * works just like "declglb", but modifies machine stack and adds + * symbol table entry with appropriate stack offset to find it again + * @param typ + * @param stclass */ -declloc (typ, stclass) - int typ, stclass; +declare_local (typ, stclass) +int typ, stclass; { - int k, j; + int k, j, count; char sname[NAMESIZE]; - for (;;) { - for (;;) { + FOREVER { + FOREVER { if (endst ()) return; if (match ("*")) @@ -64,27 +72,29 @@ declloc (typ, stclass) illname (); if (findloc (sname)) multidef (sname); + count = 1; if (match ("[")) { k = needsub (); + count = k; if (k) { j = ARRAY; - if (typ == CINT) - k = k * intsize(); + if (typ & CINT) + k = k * INTSIZE; } else { j = POINTER; - k = intsize(); + k = INTSIZE; } } else - if ((typ == CCHAR) & (j != POINTER)) + if ((typ & CCHAR) && (j != POINTER)) k = 1; else - k = intsize(); + k = INTSIZE; if (stclass != LSTATIC) { k = galign(k); - stkp = modstk (stkp - k); - addloc (sname, j, typ, stkp, AUTO); + stkp = gen_modify_stack (stkp - k); + add_local (sname, j, typ, stkp, AUTO, count); } else - addloc( sname, j, typ, k, LSTATIC); + add_local( sname, j, typ, k, LSTATIC, count); break; } if (!match (",")) @@ -92,11 +102,83 @@ declloc (typ, stclass) } } -/* - * get required array size +/** + * initialize global objects + * @param symbol_name + * @param size char 1 or integer 2 + * @param identity + * @param dim + * @return 1 if variable is initialized */ -needsub () -{ +int initials(char *symbol_name, int size, int identity, int dim) { + int dim_unknown = 0; + litptr = 0; + if(dim == 0) { // allow for xx[] = {..}; declaration + dim_unknown = 1; + } + if (!(size & CCHAR) && !(size & CINT)) { + error("unsupported storage size"); + } + if(match("=")) { + // an array + if(match("{")) { + while((dim > 0) || (dim_unknown)) { + if (init(symbol_name, size, identity, &dim) && dim_unknown) { + dim_unknown++; + } + if(match(",") == 0) { + break; + } + } + needbrack("}"); + if(--dim_unknown == 0) + identity = POINTER; + // single constant + } else { + init(symbol_name, size, identity, &dim); + } + } + return identity; +} + +/** + * evaluate one initializer, add data to table + * @param size + * @param ident + * @param dim + * @return + */ +init(char *symbol_name, int size, int ident, int *dim) { + int value, number_of_chars; + if(ident == POINTER) { + error("cannot assign to pointer"); + } + if(quoted_string(&value)) { + if((ident == VARIABLE) || (size != 1)) + error("found string: must assign to char pointer or array"); + number_of_chars = litptr - value; + *dim = *dim - number_of_chars; + while (number_of_chars > 0) { + add_data(symbol_name, CCHAR, litq[value++]); + number_of_chars = number_of_chars - 1; + } + } else if (number(&value)) { + add_data(symbol_name, CINT, value); + *dim = *dim - 1; + } else if(quoted_char(&value)) { + add_data(symbol_name, CCHAR, value); + *dim = *dim - 1; + } else { + return 0; + } + return 1; +} + +/** + * get required array size. [xx] + * @return array size + */ +needsub () { int num[1]; if (match ("]")) @@ -113,134 +195,149 @@ needsub () return (num[0]); } -findglb (sname) - char *sname; -{ - char *ptr; +/** + * search global table for given symbol name + * @param sname + * @return table index + */ +int findglb (char *sname) { + int idx; - ptr = STARTGLB; - while (ptr != glbptr) { - if (astreq (sname, ptr, NAMEMAX)) - return (CAST_INT ptr); - ptr = ptr + SYMSIZ; + idx = 1; + while (idx < global_table_index) { + if (astreq (sname, symbol_table[idx].name, NAMEMAX)) + return (idx); + idx++; } return (0); } -findloc (sname) - char *sname; -{ - char *ptr; +/** + * search local table for given symbol name + * @param sname + * @return table index + */ +int findloc (char *sname) { + int idx; - ptr = locptr; - while (ptr != STARTLOC) { - ptr = ptr - SYMSIZ; - if (astreq (sname, ptr, NAMEMAX)) - return (CAST_INT ptr); + idx = local_table_index; + while (idx >= NUMBER_OF_GLOBALS) { + idx--; + if (astreq (sname, symbol_table[idx].name, NAMEMAX)) + return (idx); } return (0); } -addglb (sname, id, typ, value, stor) - char *sname, id, typ; - int value, stor; -{ - char *ptr; - - cptr = CAST_CHAR_PTR findglb (sname); - if (cptr) - return (CAST_INT cptr); - if (glbptr >= ENDGLB) { +/** + * add new symbol to global table + * @param sname + * @param identity + * @param type + * @param value + * @param storage + * @return new index + */ +int add_global (char *sname, int identity, int type, int offset, int storage, int count) { + SYMBOL *symbol; + char *buffer_ptr; +//printf("global - symbol: %s offset: %d count: %d\n", sname, offset, count); + if (current_symbol_table_idx = findglb (sname)) { + return (current_symbol_table_idx); + } + if (global_table_index >= NUMBER_OF_GLOBALS) { error ("global symbol table overflow"); return (0); } - cptr = ptr = glbptr; - while (an (*ptr++ = *sname++)); - cptr[IDENT] = id; - cptr[TYPE] = typ; - cptr[STORAGE] = stor; - cptr[OFFSET] = value & 0xff; - cptr[OFFSET+1] = (value >> 8) & 0xff; - glbptr = glbptr + SYMSIZ; - return (CAST_INT cptr); + current_symbol_table_idx = global_table_index; + symbol = &symbol_table[current_symbol_table_idx]; + buffer_ptr = symbol->name; + while (alphanumeric(*buffer_ptr++ = *sname++)); + symbol->identity = identity; + symbol->type = type; + symbol->storage = storage; + symbol->count = count; + symbol->offset = offset; + global_table_index++; + return (current_symbol_table_idx); } -addloc (sname, id, typ, value, stclass) - char *sname, id, typ; - int value, stclass; -{ - char *ptr; - int k; - - cptr = CAST_CHAR_PTR findloc (sname); - if (cptr) - return (CAST_INT cptr); - if (locptr >= ENDLOC) { +/** + * add new symbol to local table + * @param sname + * @param identity + * @param type + * @param value + * @param storage_class + * @return + */ +int add_local (char *sname, int identity, int type, int offset, int storage_class, int count) { + int k; + SYMBOL *symbol; + char *buffer_ptr; +//printf("local - symbol: %s offset: %d count: %d\n", sname, offset, count); + + if (current_symbol_table_idx = findloc (sname)) { + return (current_symbol_table_idx); + } + if (local_table_index >= NUMBER_OF_GLOBALS + NUMBER_OF_LOCALS) { error ("local symbol table overflow"); return (0); } - cptr = ptr = locptr; - while (an (*ptr++ = *sname++)); - cptr[IDENT] = id; - cptr[TYPE] = typ; - cptr[STORAGE] = stclass; - if (stclass == LSTATIC) { - gdata(); - printlabel(k = getlabel()); - col(); - defstorage(); - onum(value); - nl(); - gtext(); - value = k; - } else - value = galign(value); - cptr[OFFSET] = value & 0xff; - cptr[OFFSET+1] = (value >> 8) & 0xff; - locptr = locptr + SYMSIZ; - return (CAST_INT cptr); + current_symbol_table_idx = local_table_index; + symbol = &symbol_table[current_symbol_table_idx]; + buffer_ptr = symbol->name; + while (alphanumeric(*buffer_ptr++ = *sname++)); + symbol->identity = identity; + symbol->type = type; + symbol->storage = storage_class; + symbol->count = count; + if (storage_class == LSTATIC) { + data_segment_gdata(); + print_label(k = getlabel()); + output_label_terminator(); + gen_def_storage(); + output_number(offset); + newline(); + code_segment_gtext(); + offset = k; + } + symbol->offset = offset; + local_table_index++; + return (current_symbol_table_idx); } /* * test if next input string is legal symbol name * */ -symname (sname) - char *sname; -{ - int k; - char c; +symname(char *sname) { + int k; - blanks (); - if (!alpha (ch ())) - return (0); - k = 0; - while (an (ch ())) - sname[k++] = gch (); - sname[k] = 0; - return (1); + blanks(); + if (!alpha (ch ())) + return (0); + k = 0; + while (alphanumeric(ch ())) + sname[k++] = gch (); + sname[k] = 0; + return (1); } -illname () -{ - error ("illegal symbol name"); +illname() { + error ("illegal symbol name"); } -multidef (sname) - char *sname; -{ - error ("already defined"); - comment (); - outstr (sname); - nl (); +/** + * print error message + * @param symbol_name + * @return + */ +multidef (char *symbol_name) { + error ("already defined"); + gen_comment (); + output_string (symbol_name); + newline (); } -glint(syment) - char *syment; -{ - int l, u, r; - l = syment[OFFSET]; - u = syment[OFFSET+1]; - r = (l & 0xff) + ((u << 8) & ~0x00ff); - return (r); -} + diff --git a/src/cmd/smallc/while.c b/src/cmd/smallc/while.c index 9ccc510..2355983 100644 --- a/src/cmd/smallc/while.c +++ b/src/cmd/smallc/while.c @@ -1,72 +1,84 @@ +/* File while.c: 2.1 (83/03/20,16:02:22) */ +/*% cc -O -c % + * + */ + #include #include "defs.h" #include "data.h" -addwhile (ptr) - int ptr[]; -{ - int k; +addwhile (WHILE *ptr) { +//int ptr[]; + //int k; - if (wsptr == WSMAX) { - error ("too many active whiles"); - return; - } - k = 0; - while (k < WSSIZ) - *wsptr++ = ptr[k++]; + //if (wsptr == WSMAX) { + if (while_table_index == WSTABSZ) { + error ("too many active whiles"); + return; + } + //k = 0; + //while (k < WSSIZ) + // *wsptr++ = ptr[k++]; + ws[while_table_index++] = *ptr; } -delwhile () -{ - if (readwhile ()) - wsptr = wsptr - WSSIZ; +delwhile () { + if (readwhile ()) { + //wsptr = wsptr - WSSIZ; + while_table_index--; + } } -readwhile () -{ - if (wsptr == ws) { - error ("no active do/for/while/switch"); - return (0); - } - return CAST_INT (wsptr - WSSIZ); -} - -findwhile () -{ - int *ptr; - - for (ptr = wsptr; ptr != ws;) { - ptr = ptr - WSSIZ; - if (ptr[WSTYP] != WSSWITCH) - return (CAST_INT ptr); - } - error ("no active do/for/while"); +WHILE *readwhile () { + if (while_table_index == 0) { + //if (wsptr == ws) { + error ("no active do/for/while/switch"); return (0); + } else { + //return (wsptr-WSSIZ); + return &ws[while_table_index - 1]; + } } -readswitch () -{ - int *ptr; +WHILE *findwhile () { + //int *ptr; - ptr = CAST_INT_PTR readwhile (); - if (ptr) - if (ptr[WSTYP] == WSSWITCH) - return (CAST_INT ptr); - return (0); + //for (ptr = wsptr; ptr != ws;) { + for (; while_table_index != 0;) { + //ptr = ptr - WSSIZ; + while_table_index--; + //if (ptr[WSTYP] != WSSWITCH) + // return (ptr); + if (ws[while_table_index].type != WSSWITCH) + return &ws[while_table_index]; + } + error ("no active do/for/while"); + return (0); } -addcase (val) - int val; -{ - int lab; +WHILE *readswitch () { + WHILE *ptr; //int *ptr; - if (swstp == SWSTSZ) - error ("too many case labels"); - else { - swstcase[swstp] = val; - swstlab[swstp++] = lab = getlabel (); - printlabel (lab); - col (); - nl (); + if (ptr = readwhile ()) { + //if (ptr[WSTYP] == WSSWITCH) + if (ptr->type == WSSWITCH) { + return (ptr); } + } + return (0); } + +addcase (int val) { + int lab; + + if (swstp == SWSTSZ) + error ("too many case labels"); + else { + swstcase[swstp] = val; + swstlab[swstp++] = lab = getlabel (); + print_label (lab); + output_label_terminator (); + newline (); + } +} + diff --git a/src/cmd/uflash.c b/src/cmd/uflash.c new file mode 100644 index 0000000..1750831 --- /dev/null +++ b/src/cmd/uflash.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include + +void report_loaded() +{ + if( UFLASH_HEADPTR->magic != UFLASH_MAGIC ) + { + printf("It appears that no userland program is loaded into flash\n" ); + exit(2); + } + + printf( "%s is loaded into flash\n", &UFLASH_HEADPTR->name[0] ); +} + +#define UFLASH_DEV_PATH "/dev/uflash" + +int main(int argc, char*argv[]) +{ + if( argc < 2 ) + { + report_loaded(); + exit(0); + } + + if( argc > 2 ) + { + printf( "useage: uflash loadable_executable_name" ); + exit(1); + } + + int fd = open(UFLASH_DEV_PATH, O_RDWR); + if( fd == -1 ) + { + printf("Failed to open %s\n", UFLASH_DEV_PATH ); + exit(1); + } + + char temp[1024]; + strcpy( temp, "/uflash/" ); + strcat( temp, argv[1] ); + strcat( temp, ".bin" ); + + write(fd,temp,strlen(temp)); + + int load_result = ioctl(fd,UFLASH_LOAD,0); + + + if( load_result == -1 ) + { + printf("Failed to load %s into flash\n", argv[1] ); + close(fd); + exit(1); + } + + close(fd); + printf( "Loaded %s into flash\n", argv[1] ); + return 0; +} + diff --git a/src/cmd/uflash_r/Makefile b/src/cmd/uflash_r/Makefile new file mode 100644 index 0000000..10076be --- /dev/null +++ b/src/cmd/uflash_r/Makefile @@ -0,0 +1,72 @@ +TOPSRC = $(shell cd ../../..; pwd) +#include $(TOPSRC)/target.mk + +MACHINE = mips +DESTDIR ?= $(TOPSRC) + +# chipKIT PIC32 compiler on Linux +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Download from https://github.com/jasonkajita/chipKIT-cxx/downloads +# and unzip to /usr/local. +# Need to copy pic32-tools/pic32mx/include/stdarg.h +# to pic32-tools/lib/gcc/pic32mx/4.5.1/include. +# MPLABX C32 compiler doesn't support some functionality +# we need, so use chipKIT compiler by default. +ifndef GCCPREFIX + GCCPREFIX = /usr/local/pic32-tools/bin/pic32- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips + INCLUDES = -I/usr/local/pic32-tools/lib/gcc/pic32mx/4.5.1/include +endif + +CC = $(GCCPREFIX)gcc -mips32r2 -EL -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) +CXX = $(GCCPREFIX)g++ -mips32r2 -EL -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) +LD = $(GCCPREFIX)ld +AR = $(GCCPREFIX)ar +RANLIB = $(GCCPREFIX)ranlib +SIZE = $(GCCPREFIX)size +OBJDUMP = $(GCCPREFIX)objdump -mmips:isa32r2 +AS = $(CC) -x assembler-with-cpp -c +YACC = byacc +LEX = flex +INSTALL = install -m 644 +INSTALLDIR = install -m 755 -d +TAGSFILE = tags +MANROFF = nroff -man -h +ELF2AOUT = $(TOPSRC)/tools/elf2aout/elf2aout + +CFLAGS = -O -g + +#LDFLAGS += -N -nostartfiles -fno-dwarf2-cfi-asm -T$(TOPSRC)/src/elf32-mips.ld \ +# $(TOPSRC)/src/crt0.o -L$(TOPSRC)/src +LDFLAGS += -N -nostartfiles -fno-dwarf2-cfi-asm -T$(TOPSRC)/src/elf32-mips.ld \ + -L$(TOPSRC)/src +LIBS = -lc + +# END OF INCLUDED TARGET.MK +CFLAGS += -Werror -Os + +YACC = bison -y +YFLAGS = -d +LIBS = -lm +FILES = uflash_r.o +SOURCE = uflash_r.c + +uflash_r: $(FILES) + ${CC} ${LDFLAGS} -o uflash_r.elf $(FILES) ${LIBS} + ${OBJDUMP} -S uflash_r.elf > uflash_r.dis + ${SIZE} uflash_r.elf + ${ELF2AOUT} uflash_r.elf $@ && rm uflash_r.elf + +install: uflash_r + install uflash_r ${DESTDIR}/bin/ + rm -f ${DESTDIR}/bin/picoc + rm -f ${DESTDIR}/bin/lccom + ln -s ${DESTDIR}/bin/uflash_r ${DESTDIR}/bin/picoc + ln -s ${DESTDIR}/bin/uflash_r ${DESTDIR}/bin/lccom + +lint: + lint -spu uflash_r.c -lm |\ + egrep -v '^(error|free|malloc)' + +clean: + -rm -f *.o *.tmp *.out *.elf *.dis uflash_r diff --git a/src/cmd/uflash_r/uflash_r.c b/src/cmd/uflash_r/uflash_r.c new file mode 100644 index 0000000..2a27bb5 --- /dev/null +++ b/src/cmd/uflash_r/uflash_r.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ +#include +#include +#include +#include + +/* + * C runtime startoff. When an a.out is loaded by the kernel, the kernel + * sets up the stack as follows: + * + * _________________________________ + * | (NULL) | top of memory + * |-------------------------------| + * | | + * | environment strings | + * | | + * |-------------------------------| + * | | + * | argument strings | + * | | + * |-------------------------------| + * | envv[envc] (NULL) | end of environment vector tag, a 0 + * |-------------------------------| + * | envv[envc-1] | pointer to last environment string + * |-------------------------------| + * | ... | + * |-------------------------------| + * | envv[0] | pointer to first environment string + * |-------------------------------| + * | argv[argc] (NULL) | end of argument vector tag, a 0 + * |-------------------------------| + * | argv[argc-1] | pointer to last argument string + * |-------------------------------| + * | ... | + * |-------------------------------| + * | argv[0] | pointer to first argument string + * |-------------------------------| + * | | space for fourth argument + * |-------------------------------| + * | | space for third argument + * |-------------------------------| + * | | space for second argument + * |-------------------------------| + * sp-> | | space for first + * --------------------------------- + * + * Arguments are passed in registers $a0, $a1 and $a2. + * Register $gp is set to the start of data section. + * + * Crt0 simply moves the env to environ variable, calculates + * the __progname and then calls main. + */ +extern int main (int, char **, char **); + +char **environ; +const char *__progname = ""; + +void _start (int, char **, char **); + +/* The entry function. */ +void +_start (argc, argv, env) + int argc; + char **argv; + char **env; +{ + asm volatile ("la $gp, _gp"); + + if( UFLASH_HEADPTR->magic != UFLASH_MAGIC ) + { + printf("It appears that no userland program is loaded into flash\n" ); + exit(2); + } + + char * p1 = argv[0]; + char * p2 = &UFLASH_HEADPTR->name[0]; + while( *p1 == *p2 && *p1 != 0 ) { ++p1; ++p2; } + if( *p1 != *p2 ) + { + printf("Unable to run %s as %s is loaded into flash\n", argv[0], UFLASH_HEADPTR->name ); + exit(2); + } + + UFLASH_STARTPTR(argc,argv,env); +} diff --git a/sys/include/uflash.h b/sys/include/uflash.h new file mode 100644 index 0000000..ee117bc --- /dev/null +++ b/sys/include/uflash.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)gpio.h 1.4 (2.11BSD GTE) 1997/3/28 + */ + +/* + * Ioctl definitions + */ +#ifndef _UFLASH_H +#define _UFLASH_H + +#include +#include + +#define UFLASH_LOAD (IOC_VOID | 1 << 16 | 'u'<<8) /* configure as input */ + +#define UFLASH_MAGIC 0x24 + +struct uflash_head +{ + unsigned magic; + char name[31]; +}; + +#define UFLASH_HEADPTR ((struct uflash_head*)0x7d030000) + +typedef void (*_startp)(int, char **, char **); +#define UFLASH_STARTPTR ((_startp)0x7d030030) + +#ifdef KERNEL +int uflash_open (dev_t dev, int flag, int mode); +int uflash_close (dev_t dev, int flag, int mode); +int uflash_read (dev_t dev, struct uio *uio, int flag); +int uflash_write (dev_t dev, struct uio *uio, int flag); +int uflash_ioctl (dev_t dev, u_int cmd, caddr_t addr, int flag); +#endif + +#endif diff --git a/sys/pic32/Makefile b/sys/pic32/Makefile index 354a4ac..ea5cfc6 100644 --- a/sys/pic32/Makefile +++ b/sys/pic32/Makefile @@ -2,7 +2,7 @@ # Programs that live in subdirectories, and have makefiles of their own. # SUBDIR = baremetal dip duinomite explorer16 max32 max32-eth maximite meb \ - pinguino-micro starter-kit ubw32 ubw32-uart ubw32-uart-sdramswap usbboot + pinguino-micro starter-kit ubw32 ubw32-uart usbboot default: diff --git a/sys/pic32/adc.c b/sys/pic32/adc.c index 95ce922..a857cd4 100644 --- a/sys/pic32/adc.c +++ b/sys/pic32/adc.c @@ -62,8 +62,8 @@ int adc_open(dev_t dev, int flag, int mode) AD1CON2 = 0b0000010000111100; AD1CON3 = 0b0000011100000111; AD1CON1 = 0b1000000011100110; - IPC(6) = 0b00000100000000000000000000000000; IECSET(1) = 1<<(PIC32_IRQ_AD1-32); + IPC(6) = 0x04040404; } nactive++; return 0; diff --git a/sys/pic32/baremetal/Makefile b/sys/pic32/baremetal/Makefile index 15e874a..de0328e 100644 --- a/sys/pic32/baremetal/Makefile +++ b/sys/pic32/baremetal/Makefile @@ -37,7 +37,13 @@ DEFS += -DLED_AUX_PORT=TRISG -DLED_AUX_PIN=13 DRIVER_GPIO = yes # Basic ADC interface -DRIVER_ADC = no +DRIVER_ADC = yes + +DRIVER_OC = yes +DRIVER_GLCD = yes + +# Support userland program in flash +DRIVER_UFLASH = no # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) diff --git a/sys/pic32/devsw.c b/sys/pic32/devsw.c index b655c8a..4483e6d 100644 --- a/sys/pic32/devsw.c +++ b/sys/pic32/devsw.c @@ -14,6 +14,7 @@ #include "clist.h" #include "tty.h" #include "systm.h" +#include "errno.h" #ifdef GPIO_ENABLED #include "gpio.h" @@ -35,6 +36,10 @@ #include "oc.h" #endif +#ifdef UFLASH_ENABLED +#include "uflash.h" +#endif + #ifndef SWAPDEV #define swopen nulldev #define swstrategy nostrategy @@ -50,6 +55,14 @@ nulldev () return (0); } +#ifndef UFLASH_ENABLED +static int +faildev () +{ + return (EPERM); +} +#endif + static int norw (dev, uio, flag) dev_t dev; @@ -179,6 +192,19 @@ const struct cdevsw cdevsw[] = { nostrategy, }, #endif +// UFLASH = 12 +#ifdef UFLASH_ENABLED +{ + uflash_open, uflash_close, uflash_read, uflash_write, + uflash_ioctl, nulldev, 0, seltrue, + nostrategy, }, +#else +{ + faildev, nulldev, norw, norw, + noioctl, nulldev, 0, seltrue, + nostrategy, }, +#endif + }; const int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); diff --git a/sys/pic32/dip/Makefile b/sys/pic32/dip/Makefile index ff6b8bc..795d91d 100644 --- a/sys/pic32/dip/Makefile +++ b/sys/pic32/dip/Makefile @@ -41,6 +41,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = no +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/drivers.mk b/sys/pic32/drivers.mk index 2b7b27d..2aae91c 100644 --- a/sys/pic32/drivers.mk +++ b/sys/pic32/drivers.mk @@ -3,6 +3,11 @@ ifeq ($(DRIVER_GPIO),yes) DEFS += -DGPIO_ENABLED endif +ifeq ($(DRIVER_UFLASH),yes) + KERNOBJ += uflash.o + DEFS += -DUFLASH_ENABLED +endif + ifeq ($(DRIVER_POWER),yes) KERNOBJ += power_control.o POWER_LED_PORT ?= TRISG diff --git a/sys/pic32/duinomite-uart/Makefile b/sys/pic32/duinomite-uart/Makefile index bca9316..034a6a7 100644 --- a/sys/pic32/duinomite-uart/Makefile +++ b/sys/pic32/duinomite-uart/Makefile @@ -51,6 +51,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = no +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/duinomite/Makefile b/sys/pic32/duinomite/Makefile index 105ebaa..1dbb9b5 100644 --- a/sys/pic32/duinomite/Makefile +++ b/sys/pic32/duinomite/Makefile @@ -53,6 +53,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = no +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/explorer16/Makefile b/sys/pic32/explorer16/Makefile index 3dc1cd6..2c825f6 100644 --- a/sys/pic32/explorer16/Makefile +++ b/sys/pic32/explorer16/Makefile @@ -39,6 +39,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = no +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/fubarino/Makefile b/sys/pic32/fubarino/Makefile index 1d2580a..24c58ce 100644 --- a/sys/pic32/fubarino/Makefile +++ b/sys/pic32/fubarino/Makefile @@ -30,10 +30,13 @@ DEFS += -DSD_CS0_PORT=TRISG -DSD_CS0_PIN=9 DEFS += -DLED_KERNEL_PORT=TRISE -DLED_KERNEL_PIN=5 # Include or exclude drivers -DRIVER_GPIO = yes # General Purpose I/O -DRIVER_ADC = yes # Basic ADC interface -DRIVER_SPI = yes # Generic SPI interface -DRIVER_OC = yes # Output Compare driver +DRIVER_GPIO = yes +DRIVER_ADC = yes +DRIVER_SPI = yes +DRIVER_OC = yes +# Support userland program in flash +DRIVER_UFLASH = no + DEPFLAGS = -MT $@ -MD -MP -MF .deps/$*.dep CFLAGS = -O $(DEFS) $(DEPFLAGS) diff --git a/sys/pic32/machdep.c b/sys/pic32/machdep.c index 9c04f03..9c70201 100644 --- a/sys/pic32/machdep.c +++ b/sys/pic32/machdep.c @@ -134,17 +134,9 @@ startup() mips_write_c0_register (C0_CAUSE, 0, CA_IV); /* Setup memory. */ - BMXPUPBA = 512 << 10; /* Kernel Flash memory size */ - -#ifdef KERNEL_EXECUTABLE_RAM - extern void _keram_start(), _keram_end(); - unsigned keram_size_k = ((char*)&_keram_end-(char*)&_keram_start)/1024; - BMXDKPBA = (32-keram_size_k) << 10; /* Kernel RAM size */ - BMXDUDBA = BMXDKPBA+(keram_size_k<<10); /* 2k executable RAM in kernel */ -#else + BMXPUPBA = 192 << 10; /* Kernel Flash memory size */ BMXDKPBA = 32 << 10; /* Kernel RAM size */ - BMXDUDBA = BMXDKPBA; /* Zero executable RAM in kernel */ -#endif + BMXDUDBA = BMXDKPBA; /* No executable RAM in kernel */ BMXDUPBA = BMXDUDBA; /* All user RAM is executable */ /* @@ -159,7 +151,9 @@ startup() IPC(8) = IPC(9) = IPC(10) = IPC(11) = IPC(12) = PIC32_IPC_IP0(1) | PIC32_IPC_IP1(1) | - PIC32_IPC_IP2(1) | PIC32_IPC_IP3(1); + PIC32_IPC_IP2(1) | PIC32_IPC_IP3(1) | + PIC32_IPC_IS0(0) | PIC32_IPC_IS1(0) | + PIC32_IPC_IS2(0) | PIC32_IPC_IS3(0) ; /* * Setup wait states. @@ -243,25 +237,6 @@ startup() /*printf ("copy %08x from (%08x) to (%08x)\n", *src, src, dest);*/ *dest++ = *src++; } - -#ifdef KERNEL_EXECUTABLE_RAM - /* Copy code that must run out of ram (due to timing restrictions) - * from flash to the executable section of kernel ram. - * This was added to support swap on sdram */ - - extern void _ramfunc_image_begin(); - extern void _ramfunc_begin(); - extern void _ramfunc_end(); - - unsigned *src1 = (unsigned*) &_ramfunc_image_begin; - unsigned *dest1 = (unsigned*)&_ramfunc_begin; - unsigned *limit1 = (unsigned*)&_ramfunc_end; - /*printf ("copy from (%08x) to (%08x)\n", src1, dest1);*/ - while (dest1 < limit1) { - *dest1++ = *src1++; - } -#endif - #endif /* * Setup UART registers. diff --git a/sys/pic32/machparam.h b/sys/pic32/machparam.h index 4c927c9..14e4ac7 100644 --- a/sys/pic32/machparam.h +++ b/sys/pic32/machparam.h @@ -63,12 +63,7 @@ #define DATA_SIZE (128*1024) #define KERNEL_FLASH_SIZE (192*1024) - -#ifdef KERNEL_EXECUTABLE_RAM -#define KERNEL_DATA_SIZE (30*1024) -#else #define KERNEL_DATA_SIZE (32*1024) -#endif #define KERNEL_FLASH_START 0x9d000000 #define USER_FLASH_START (KERNEL_FLASH_START + KERNEL_FLASH_SIZE) @@ -76,13 +71,7 @@ #define KERNEL_DATA_START 0x80000000 #define KERNEL_DATA_END (KERNEL_DATA_START + KERNEL_DATA_SIZE) - -#ifdef KERNEL_EXECUTABLE_RAM -#define USER_DATA_START (0x7f000000 + KERNEL_DATA_SIZE+2048) -#else #define USER_DATA_START (0x7f000000 + KERNEL_DATA_SIZE) -#endif - #define USER_DATA_END (0x7f000000 + DATA_SIZE) #define stacktop(siz) (USER_DATA_END) diff --git a/sys/pic32/max32-eth/Makefile b/sys/pic32/max32-eth/Makefile index d606b5c..4f7975b 100644 --- a/sys/pic32/max32-eth/Makefile +++ b/sys/pic32/max32-eth/Makefile @@ -47,6 +47,9 @@ DRIVER_SPI = yes # Basic ADC interface DRIVER_ADC = yes +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 180978f..7e17e31 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -42,10 +42,13 @@ DEFS += -DLED_TTY_PORT=TRISA -DLED_TTY_PIN=3 # Include or exclude drivers # General Purpose I/O -DRIVER_GPIO = yes +DRIVER_GPIO = no # Basic ADC interface -DRIVER_ADC = yes +DRIVER_ADC = no + +# Support userland program in flash +DRIVER_UFLASH = yes # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) diff --git a/sys/pic32/maximite/Makefile b/sys/pic32/maximite/Makefile index b410aec..c7467fc 100644 --- a/sys/pic32/maximite/Makefile +++ b/sys/pic32/maximite/Makefile @@ -50,6 +50,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = no +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/meb/Makefile b/sys/pic32/meb/Makefile index 913be75..dcb985d 100644 --- a/sys/pic32/meb/Makefile +++ b/sys/pic32/meb/Makefile @@ -55,6 +55,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = no +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/pinguino-micro/Makefile b/sys/pic32/pinguino-micro/Makefile index 8c06b46..ea62cc1 100644 --- a/sys/pic32/pinguino-micro/Makefile +++ b/sys/pic32/pinguino-micro/Makefile @@ -48,6 +48,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = yes +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/retroone/Makefile b/sys/pic32/retroone/Makefile index b731c48..a214b0b 100644 --- a/sys/pic32/retroone/Makefile +++ b/sys/pic32/retroone/Makefile @@ -40,6 +40,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = yes +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/sdram.S b/sys/pic32/sdram.S deleted file mode 100644 index df86ec5..0000000 --- a/sys/pic32/sdram.S +++ /dev/null @@ -1,735 +0,0 @@ -/* - * SDRAM Access Routines for PIC32. - * - * Retromaster - 10.05.2010 - * - * This file is in the public domain. You can use, modify, and distribute the source code - * and executable programs based on the source code. This file is provided "as is" and - * without any express or implied warranties whatsoever. Use at your own risk! - * - * Changes by madscifi for inclusion in the retrobsd project. - */ - -/* SDRAM Pin to PIC32 Pin Mapping: - * SDRAM PIC32 - * ------ ------ - * notes, the order of An to RBn DOES matter - * At the moment it is a bit of a mess and - * needs to be cleaned up. - * A0 23 RB11 - * A1 24 RB12 - * A2 25 RB13 - * A3 26 RB14 - * A4 29 RB5 - * A5 30 RB4 - * A6 31 RB3 - * A7 32 RB2 - * A8 33 RB6 - * A9 34 RB7 - * A10 22? RB15 - * A11 35 RB9 - * BA0 20 RD15 - * BA1 21 RD14 - * - * note, the order of DQn to RAn does not matter - * DQ0 2 RA6 - * DQ1 4 RA1 - * DQ2 5 RA7 - * DQ3 7 RA2 - * DQ4 8 RA3 - * DQ5 10 RA4 - * DQ6 11 RA5 - * DQ7 13 RA0 - - * CLK 38 OC4-RD3 - * CKE 37 A10 - * CS 19 RF4 - * WE 16 RF0 - * CAS 17 RF1 - * RAS 18 RF5 - * - * SDRam 42, 44, 45, 47, 48, 50, 51, 53 - pullup (d8-d15) - */ - - -/* - * Retrobsd does not currently contain a good header - * for pulling the pic32 port addresses into an assembly - * file, so define some needed registers here for the moment. - */ - -#define TRISA 0xBF886000 -#define T2CON 0xBF800800 -#define TMR2 0xBF800810 -#define PR2 0xBF800820 -#define T2CONSET 0xBF800808 -#define OC4CON 0xBF803600 -#define OC4RS 0xBF803620 -#define OC4R 0xBF803610 -#define AD1PCFGSET 0xBF809068 - -/* Offsets (from TRISA) for the io ports */ -#define SDR_OFFSET_A 0 -#define SDR_OFFSET_B 0x40 -#define SDR_OFFSET_C 0x80 -#define SDR_OFFSET_D 0xc0 -#define SDR_OFFSET_E 0x100 -#define SDR_OFFSET_F 0x140 -#define SDR_OFFSET_G 0x180 - -/* Offsets (from TRISA) for the various port control registers */ -#define TRIS_OFFSET 0x0 -#define PORT_OFFSET 0x10 -#define LAT_OFFSET 0x20 -#define ODCF_OFFSET 0x30 - -/* Offsets (from TRISA) for the various io port bit manipulator registers */ -#define NOP_OP_OFFSET 0x0 -#define CLR_OP_OFFSET 0x4 -#define SET_OP_OFFSET 0x8 -#define INV_OP_OFFSET 0xc - - -/* - * Specific assignments of ports ports used - * Note: In general, it is not sufficient to - * change the constants below - corresponding - * changes to the code below will likely be - * required if any of the following values - * are changed. - */ - -/* DATA_PORT_TRIS must be assigned to a TRIS of the port - * that has the low 8 bits tied the 8 data bits on the ram. - */ -#define SDR_DATA_IO SDR_OFFSET_A -#define SDR_DATA_TRIS SDR_OFFSET_A - -#define SDR_ADDRESS_IO SDR_OFFSET_B -#define SDR_ADDRESS_TRIS SDR_OFFSET_B -#define ADDRESS_MASK 0xfafc - -#define SDR_BANK_IO SDR_OFFSET_D -#define SDR_BANK_TRIS SDR_OFFSET_D -#define BANK_0_BIT 14 -#define BANK_1_BIT 15 - -#define SDR_CONTROL_IO SDR_OFFSET_F -#define SDR_CONTROL_TRIS SDR_OFFSET_F -#define CONTROL_WE_BIT 0 -#define CONTROL_CAS_BIT 1 -#define CONTROL_CS_BIT 4 -#define CONTROL_RAS_BIT 5 - -#define SDR_CKE_IO SDR_OFFSET_A -#define SDR_CKE_TRIS SDR_OFFSET_A -#define CKE_BIT 10 - -#define CONTROL_ALL_MASK ( (1< -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; -typedef unsigned long long uint64_t; - -extern __attribute__((far)) void sdram_init(); -extern __attribute__((far)) void sdram_active(uint16_t rowaddr); -extern __attribute__((far)) void sdram_write(uint16_t pseudocoladdr, uint64_t val); -extern __attribute__((far)) uint64_t sdram_read(uint16_t pseudocoladdr); -extern __attribute__((far)) void sdram_auto_refresh(void); -extern __attribute__((far)) void sdram_precharge(void); -extern __attribute__((far)) void sdram_precharge_all(void); -extern __attribute__((far)) void sdram_sleep(void); -extern __attribute__((far)) void sdram_wake(void); -extern __attribute__((far)) void sdram_bank(uint8_t bank); - -#endif diff --git a/sys/pic32/sdramp.c b/sys/pic32/sdramp.c deleted file mode 100644 index 38da910..0000000 --- a/sys/pic32/sdramp.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Driver for external SDRAM-based swap device. - * - * See sdram.S for information on interface to sdram - * - * This code could use a bit of optimization. - */ - -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "errno.h" -#include "dk.h" -#include "sdram.h" - -int sw_dkn = -1; /* Statistics slot number */ - -/* - * physical specs of SDRAM chip - */ -#define RAM_COLS 512 -#define RAM_ROWS 4096 -#define RAM_BANKS 4 - - -/* - * RAM_BURST_COUNT MUST be match the number of bytes - * read/written by each call to sdram_read/sdram_write - */ -#define RAM_BURST_COUNT 8 - -/* - * CHUNK_SIZE number of bytes in each "chunk" - */ -#define CHUNK_SIZE 128 - -#define RAM_BURST_GROUP_COUNT 8 - -#define BLOCKS_PER_ROW ( RAM_COLS / CHUNK_SIZE ) - -static char swaptemp[CHUNK_SIZE]; - -static void -read_chunk_from_sdram( uint64_t* dest, unsigned int blockNumber ) -{ - int startColumn = ( ( blockNumber & ( BLOCKS_PER_ROW - 1 ) ) * CHUNK_SIZE ) / RAM_BURST_COUNT; - int rowAndBank = blockNumber / BLOCKS_PER_ROW; - int row = rowAndBank & ( RAM_ROWS - 1 ); - int bank = rowAndBank / RAM_ROWS; - int col = startColumn; - - while( col < startColumn + CHUNK_SIZE/RAM_BURST_COUNT ) { - int x = mips_intr_disable(); - sdram_wake(); - sdram_bank(bank); - sdram_active(row); - int i; - for( i = 0; i < RAM_BURST_GROUP_COUNT; i++ ) { - *dest++ = sdram_read( col ); - col += 1; //RAM_BURST_COUNT; - } - sdram_precharge(); - sdram_precharge_all(); - sdram_sleep(); - - mips_intr_restore (x); - - asm volatile ("nop"); - asm volatile ("nop"); - asm volatile ("nop"); - asm volatile ("nop"); - asm volatile ("nop"); - asm volatile ("nop"); - } -} - -static void -write_chunk_to_sdram( uint64_t* src, unsigned int blockNumber ) -{ - int startColumn = ( ( blockNumber & ( BLOCKS_PER_ROW - 1 ) ) * CHUNK_SIZE ) / RAM_BURST_COUNT; - int rowAndBank = blockNumber / BLOCKS_PER_ROW; - int row = rowAndBank & ( RAM_ROWS - 1 ); - int bank = rowAndBank / RAM_ROWS; - - int col = startColumn; - while( col < startColumn + CHUNK_SIZE/RAM_BURST_COUNT ) { - int x = mips_intr_disable(); - - sdram_wake(); - sdram_bank(bank); - sdram_active(row); - int i; - for( i = 0; i < RAM_BURST_GROUP_COUNT; i++ ) { - sdram_write( col, *src++ ); - col += 1; //RAM_BURST_COUNT; - } - sdram_precharge(); - sdram_precharge_all(); - sdram_sleep(); - - mips_intr_restore (x); - - asm volatile ("nop"); - asm volatile ("nop"); - asm volatile ("nop"); - asm volatile ("nop"); - asm volatile ("nop"); - asm volatile ("nop"); - } -} - - -/* - * Read a block of data. - */ -static void -dev_read(unsigned blockno, char* data, unsigned nbytes) -{ - blockno = blockno * (DEV_BSIZE/CHUNK_SIZE); - - while( nbytes >= CHUNK_SIZE ) { - read_chunk_from_sdram( (uint64_t*) swaptemp, blockno ); - bcopy( swaptemp, data, CHUNK_SIZE ); - data += CHUNK_SIZE; - blockno += 1; - nbytes -= CHUNK_SIZE; - } - - if( nbytes ) { - read_chunk_from_sdram( (uint64_t*) swaptemp, blockno ); - bcopy( swaptemp, data, nbytes ); - } - - return; -} - -/* - * Write a block of data. - */ -static void -dev_write (unsigned blockno, char *data, unsigned nbytes) -{ - blockno = blockno * (DEV_BSIZE/CHUNK_SIZE); - - while( nbytes >= CHUNK_SIZE ) { - bcopy( data, swaptemp, CHUNK_SIZE ); - write_chunk_to_sdram( (uint64_t*) swaptemp, blockno ); - data += CHUNK_SIZE; - blockno += 1; - nbytes -= CHUNK_SIZE; - } - if( nbytes ) { - read_chunk_from_sdram( (uint64_t*) swaptemp, blockno ); - bcopy( data, swaptemp, nbytes ); - write_chunk_to_sdram( (uint64_t*) swaptemp, blockno ); - } - return; -} - -int -swopen(dev_t dev, int flag, int mode) -{ - static int has_been_opened = 0; - - if (!has_been_opened) { - int x = mips_intr_disable(); - sdram_init(); - mips_intr_restore(x); - has_been_opened = 1; - -#ifdef UCB_METER - /* Allocate statistics slot */ - dk_alloc (&sw_dkn, 1, "sw"); -#endif - } - return 0; -} - -void -swstrategy(register struct buf *bp) -{ - int s; - -#if 0 - printf ("sw0: %s block %u, length %u bytes, addr %p\n", - (bp->b_flags & B_READ) ? "read" : "write", - bp->b_blkno, bp->b_bcount, bp->b_addr); -#endif - led_control (LED_AUX, 1); - s = splbio(); -#ifdef UCB_METER - if (sw_dkn >= 0) { - dk_busy |= 1 << sw_dkn; - dk_xfer[sw_dkn]++; - dk_bytes[sw_dkn] += bp->b_bcount; - } -#endif - unsigned adj = 0; - if (minor(bp->b_dev)==1) { - adj = SWAPSZ; - } - if (bp->b_flags & B_READ) { - dev_read (bp->b_blkno+adj, bp->b_addr, bp->b_bcount); - } else { - dev_write (bp->b_blkno+adj, bp->b_addr, bp->b_bcount); - } -#if 0 - printf (" %02x", (unsigned char) bp->b_addr[0]); - int i; - for (i=1; ib_bcount; i++) - printf ("-%02x", (unsigned char) bp->b_addr[i]); - printf ("\n"); -#endif - biodone (bp); - led_control (LED_AUX, 0); - splx (s); -#ifdef UCB_METER - if (sw_dkn >= 0) - dk_busy &= ~(1 << sw_dkn); -#endif -} diff --git a/sys/pic32/starter-kit/Makefile b/sys/pic32/starter-kit/Makefile index 59a966e..896e056 100644 --- a/sys/pic32/starter-kit/Makefile +++ b/sys/pic32/starter-kit/Makefile @@ -48,7 +48,7 @@ DEFS += -DSD_PORT=SPI1CON -DSD_MHZ=10 DEFS += -DSD_CS0_PORT=TRISB -DSD_CS0_PIN=1 # LEDs at pins D0 (red), D1 (yellow), D2 (green) -DEFS += -DLED_TTY_PORT=TRISD -DLED_TTY_PIN=0 +# Pin D0 is used for SD/MMC as signal SDO1 DEFS += -DLED_DISK_PORT=TRISD -DLED_DISK_PIN=1 DEFS += -DLED_KERNEL_PORT=TRISD -DLED_KERNEL_PIN=2 @@ -60,6 +60,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = yes +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/ubw32-uart-sdramswap/Makefile b/sys/pic32/ubw32-uart-sdramswap/Makefile deleted file mode 100644 index 1422349..0000000 --- a/sys/pic32/ubw32-uart-sdramswap/Makefile +++ /dev/null @@ -1,158 +0,0 @@ -# -# Copyright (c) 1988 Regents of the University of California. -# All rights reserved. -# -# Redistribution and use in source and binary forms are permitted -# provided that this notice is preserved and that due credit is given -# to the University of California at Berkeley. The name of the University -# may not be used to endorse or promote products derived from this -# software without specific prior written permission. This software -# is provided ``as is'' without express or implied warranty. -# -H = ../../include -M = .. -S = ../../kernel - -vpath %.c $(M):$(S) -vpath %.S $(M):$(S) - -# Kernel options. -DEFS += -I. -I$(H) -DKERNEL -DUCB_METER -DPIC32MX7 - -# CPU frequency 80 MHz. -DEFS += -DCPU_KHZ=80000 -DEFS += -DBUS_KHZ=80000 - -# -# UBW32 board -# =========== -# -# Console on UART1 -DEFS += -DCONSOLE_UART1 - -# SD/MMC card driver on SPI1 -# /CS0 at pin A9 (and optional /CS1 at pin A10) -DEFS += -DSD_PORT=SPI1CON -DSD_MHZ=8 -DEFS += -DSD_CS0_PORT=TRISA -DSD_CS0_PIN=9 -DEFS += -DSD_CS1_PORT=TRISA -DSD_CS1_PIN=10 - -# LEDs at pins E0, E1, E2, E3 -DEFS += -DLED_AUX_PORT=TRISE -DLED_AUX_PIN=0 -DLED_AUX_INVERT -DEFS += -DLED_DISK_PORT=TRISE -DLED_DISK_PIN=1 -DLED_DISK_INVERT -DEFS += -DLED_KERNEL_PORT=TRISE -DLED_KERNEL_PIN=2 -DLED_KERNEL_INVERT -DEFS += -DLED_TTY_PORT=TRISE -DLED_TTY_PIN=3 -DLED_TTY_INVERT - -# Swap on sdram -DEFS += -DSWAPDEV=0x0100 -DSWAPSZ=2048 -DEFS += -DKERNEL_EXECUTABLE_RAM - -#DEFS += -DSW_DATA_PORT=TRISE -DSW_DATA_PIN=0 -#DEFS += -DSW_RD_PORT=TRISE -DSW_RD_PIN=8 -#DEFS += -DSW_WR_PORT=TRISE -DSW_WR_PIN=9 -#DEFS += -DSW_LDA_PORT=TRISC -DSW_LDA_PIN=1 - -# Include or exclude drivers - -# General Purpose I/O -DRIVER_GPIO = no - -# Basic ADC interface -DRIVER_ADC = no - -# Power control (power LED, and soft power-off by button) -# requires supported PSU (ATX) -DRIVER_POWER = no - -POWER_LED_PORT = TRISG -POWER_LED_PIN = 12 -POWER_SWITCH_PORT = TRISG -POWER_SWITCH_PIN = 0 -POWER_CONTROL_PORT = TRISE -POWER_CONTROL_PIN = 9 - -DEPFLAGS = -MT $@ -MD -MP -MF .deps/$*.dep -CFLAGS = -O $(DEFS) $(DEPFLAGS) -ASFLAGS = $(DEFS) $(DEPFLAGS) - -include ../gcc-config.mk - -CC = $(GCCPREFIX)gcc -EL -g -mips32r2 -CC += -nostdinc -fno-builtin -Werror -Wall -fno-dwarf2-cfi-asm -LDFLAGS += -nostdlib -T using-bootloader.ld -Wl,-Map=unix.map -SIZE = $(GCCPREFIX)size -OBJDUMP = $(GCCPREFIX)objdump -OBJCOPY = $(GCCPREFIX)objcopy - -# Machine-dependent files: -# startup.o MUST be loaded first. -KERNOBJ = startup.o clock.o devsw.o sysctl.o \ - signal.o machdep.o mem.o exception.o - -KERNOBJ += cons.o - -# swap on sdram - this is incompatible with swap.o -KERNOBJ += sdram.o sdramp.o - -# Kernel. -KERNOBJ += init_main.o init_sysent.o kern_clock.o \ - kern_descrip.o kern_exec.o kern_exit.o kern_fork.o \ - kern_mman.o kern_proc.o kern_prot.o \ - kern_prot2.o kern_resource.o kern_sig.o kern_sig2.o \ - kern_subr.o kern_synch.o kern_sysctl.o kern_time.o \ - subr_log.o subr_prf.o subr_rmap.o \ - sys_generic.o sys_inode.o syscalls.o \ - sys_pipe.o sys_process.o tty.o tty_conf.o \ - tty_subr.o tty_tty.o ufs_alloc.o ufs_bio.o \ - ufs_bmap.o ufs_dsort.o ufs_fio.o \ - ufs_inode.o ufs_mount.o ufs_namei.o ufs_subr.o \ - ufs_syscalls.o ufs_syscalls2.o vfs_vnops.o \ - vm_sched.o vm_swap.o vm_swp.o kern_glob.o - -# Drivers. -KERNOBJ += sd.o - -# Configuration-dependent files. -KERNOBJ += vers.o - -# This makefile does the work including the right files and options for the drivers -include ../drivers.mk - -all: .deps sys machine unix.elf - $(SIZE) unix.elf - -clean: - rm -rf .deps *.o *.elf *.bin *.dis *.map *.srec core \ - mklog assym.h vers.c genassym sys machine - -.deps: - mkdir .deps - -sys: - ln -s ../../include $@ - -machine: - ln -s .. $@ - -unix.elf: $(KERNOBJ) using-bootloader.ld - $(CC) $(LDFLAGS) $(KERNOBJ) -o $@ - chmod -x $@ - $(OBJDUMP) -d -S -z $@ > unix.dis - $(OBJCOPY) -O binary $@ unix.bin - $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ unix.hex - chmod -x $@ unix.bin - -load: unix.elf - pic32prog -p unix.hex - -vers.o: ../newvers.sh $(H)/*.h $(M)/*.[ch] $(S)/*.c - sh ../newvers.sh > vers.c - $(CC) -c vers.c - -.SUFFIXES: .i .srec .hex .dis .cpp .cxx .bin .elf - -.o.dis: - $(OBJDUMP) -d -z -S $< > $@ - -ifeq (.deps, $(wildcard .deps)) --include .deps/*.dep -endif diff --git a/sys/pic32/ubw32-uart/Makefile b/sys/pic32/ubw32-uart/Makefile index 7ca3d3d..9e0427f 100644 --- a/sys/pic32/ubw32-uart/Makefile +++ b/sys/pic32/ubw32-uart/Makefile @@ -61,6 +61,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = no +# Support userland program in flash +DRIVER_UFLASH = yes + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/ubw32/Makefile b/sys/pic32/ubw32/Makefile index 1bf039f..88f0cca 100644 --- a/sys/pic32/ubw32/Makefile +++ b/sys/pic32/ubw32/Makefile @@ -52,6 +52,9 @@ DRIVER_GPIO = yes # Basic ADC interface DRIVER_ADC = no +# Support userland program in flash +DRIVER_UFLASH = no + # Power control (power LED, and soft power-off by button) # requires supported PSU (ATX) DRIVER_POWER = no diff --git a/sys/pic32/uflash.c b/sys/pic32/uflash.c new file mode 100644 index 0000000..fa5e52d --- /dev/null +++ b/sys/pic32/uflash.c @@ -0,0 +1,458 @@ +/* + * uflash driver for PIC32. + * + * Based on GPIO driver: + * Copyright (C) 2012 Serge Vakulenko, + * + * Permission to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that the copyright notice and this + * permission notice and warranty disclaimer appear in supporting + * documentation, and that the name of the author not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * The author disclaim all warranties with regard to this + * software, including all implied warranties of merchantability + * and fitness. In no event shall the author be liable for any + * special, indirect or consequential damages or any damages + * whatsoever resulting from loss of use, data or profits, whether + * in an action of contract, negligence or other tortious action, + * arising out of or in connection with the use or performance of + * this software. + */ +#include "param.h" +#include "conf.h" +#include "user.h" +#include "ioctl.h" +#include "uflash.h" +#include "systm.h" +#include "uio.h" +#include "stat.h" + +#include "map.h" +#include "proc.h" +#include "buf.h" +#include "inode.h" +#include "namei.h" +#include "fs.h" +#include "mount.h" +#include "file.h" +#include "signalvar.h" + +/* TODO: some sort of interlock is needed so that the contents + * of flash are not replaced while a processing that depends + * on the contents is executing. + */ + +#define MINOR_UNIT 0x07 /* Minor mask: unit number */ + +#define FLASH_PAGE_SIZE 4096 +#define FLASH_BUFFER_INT_COUNT 4 + +static void flashErasePage(unsigned addrPage); +static void flashWriteUint32(unsigned addrUint32, unsigned *rgu32Data, unsigned cu32Data); + +// Flash operations +#define NVMOP_WORD_PGM 0x4001 // Word program operation +#define NVMOP_ROW_PGM 0x4003 // Row write +#define NVMOP_PAGE_ERASE 0x4004 // Page erase operation + +#define USE_USER_FLASH_START (USER_FLASH_START-0x20000000UL) + +/* + * To enable debug output, comment out the first line, + * and uncomment the second line. + */ +#define PRINTDBG(...) /*empty*/ +//#define PRINTDBG printf + +char targetToFlash[31] = ""; + +int +uflash_open (dev, flag, mode) + dev_t dev; +{ + if (u.u_uid != 0) + return EPERM; + return 0; +} + +int +uflash_close (dev, flag, mode) + dev_t dev; +{ + return 0; +} + +int +uflash_read (dev, uio, flag) + dev_t dev; + struct uio *uio; + int flag; +{ + register struct iovec *iov; + register u_int cnt; + char *buf = targetToFlash; + + cnt = strlen(targetToFlash); + + /* I/o size should be large enough. */ + iov = uio->uio_iov; + if (iov->iov_len < cnt) + return EIO; + + /* Read only cnt bytes. */ + if (uio->uio_offset >= cnt) + return 0; + + cnt -= uio->uio_offset; + + + /* Print port status to buffer. */ + //PRINTDBG ("uflash_read -> %s", buf); + + bcopy (buf + uio->uio_offset, iov->iov_base, cnt); + iov->iov_base += cnt; + iov->iov_len -= cnt; + uio->uio_resid -= cnt; + uio->uio_offset += cnt; + return 0; +} + +int +uflash_write (dev, uio, flag) + dev_t dev; + struct uio *uio; + int flag; +{ + register struct iovec *iov = uio->uio_iov; + register u_int cnt = 30; + char * buf = targetToFlash; + + /* I/o size should be large enough. */ + if (iov->iov_len > cnt) + return EIO; + + if( iov->iov_len < cnt ) cnt = iov->iov_len; + + cnt -= uio->uio_offset; + bcopy (iov->iov_base, buf+uio->uio_offset, cnt); + buf[uio->uio_offset+cnt]=0; + + iov->iov_base += cnt; + iov->iov_len -= cnt; + uio->uio_resid -= cnt; + uio->uio_offset += cnt; + + //PRINTDBG ("uflash_read ('%s')\n", buf); + return 0; +} + +/* + * Commands: + * UFLASH_LOAD - load the program specified into user flash + */ + +int +uflash_ioctl (dev, cmd, addr, flag) + dev_t dev; + register u_int cmd; + caddr_t addr; +{ + int result = 0; + struct inode *ip; + + //unsigned unit = cmd & 0xff; + cmd &= ~0xff; + + if( cmd != UFLASH_LOAD ) + return EINVAL; + + struct nameidata nd; + register struct nameidata *ndp = &nd; + + //printf ("uflash_ioctl ('%s', ['%s', '%s', ...])\n", uap->fname, uap->argp[0], uap->argp[1]); + + NDINIT (ndp, LOOKUP, FOLLOW, targetToFlash); + ip = namei (ndp); + if (ip == NULL) { + result = EACCES; + goto done; + } + + struct stat sb; + int err = ino_stat (ip, &sb); + if( err ) { + result = err; + goto done; + } + + /* Erase Pages */ + + unsigned address = USE_USER_FLASH_START; + int remaining = (int)sb.st_size; + + while( remaining > 0 ) { + flashErasePage( address ); + address += 4096; + remaining -= 4096; + } + + /* TODO: reorgainize writing so that everything except the first + * couple of bytes is written to flash and verified before + * writing and verifying the first couple of bytes. The purpose + * would be to leave the uflash area in an invalid state so that + * the stub code would not attempt to execute it. + */ + + /* Write bin */ + + address = USE_USER_FLASH_START; + remaining = (int)sb.st_size; + + unsigned buffer[FLASH_BUFFER_INT_COUNT]; + + while( remaining ) { + unsigned readsize = FLASH_BUFFER_INT_COUNT * sizeof(unsigned); + if( readsize > remaining ) readsize = remaining; + + int resid; + err = rdwri (UIO_READ, ip, (caddr_t)buffer, readsize, (off_t) address - USE_USER_FLASH_START, IO_UNIT, &resid); + + if( err ) { + result = err; + goto done; + } + + if( resid ) { + result = EIO; + goto done; + } + + flashWriteUint32(address, buffer, FLASH_BUFFER_INT_COUNT); + + address += readsize; + remaining -= readsize; + } + + /* Verify bin */ + + address = USE_USER_FLASH_START; + remaining = (int)sb.st_size; + + while( remaining ) { + unsigned readsize = FLASH_BUFFER_INT_COUNT * sizeof(unsigned); + if( readsize > remaining ) readsize = remaining; + + int resid; + err = rdwri (UIO_READ, ip, (caddr_t)buffer, readsize, (off_t) address - (unsigned)USE_USER_FLASH_START, IO_UNIT, &resid); + + if( err ) { + result = err; + goto done; + } + + if( resid ) { + result = EIO; + goto done; + } + + int i; + for( i = 0; i < readsize; ++i ) { + if( ((char*)address)[i] != ((char*)buffer)[i] ) { + result = EIO; + goto done; + } + } + + address += readsize; + remaining -= readsize; + } + +done: + if (ip) + iput(ip); + + return result; +} + + + +/*** void flashOperation(unsigned nvmop, unsigned addr, unsigned data) +** +** Synopsis: +** Performs either a page erase, word write, or row write +** +** Parameters: +** nvmop either NVMOP_PAGE_ERASE, NVMOP_WORD_PGM, or NVMOP_ROW_PGM +** addr the unsigned_t flash address of: the page to erase, word location to write, or row location to write +** data a unsigned_t of data to write, or the unsigned_t of the SRAM address containing the array of data to write to the row +** +** Return Values: +** True if successful, false if failed +** +** Errors: +** None +** +** Notes: +** data has no meaning when page erase is specified and should be set to 0ul +** +*/ + +/* + * nvm_operation is borrowed from usb_boot.c and is controlled + * by the following copyright: + * + * USB HID bootloader for PIC32 microcontroller. + * + * Based on Microchip sources. + * Heavily rewritten by Serge Vakulenko, . + * + * The software supplied herewith by Microchip Technology Incorporated + * (the 'Company') for its PIC(R) Microcontroller is intended and + * supplied to you, the Company's customer, for use solely and + * exclusively on Microchip PIC Microcontroller products. The + * software is owned by the Company and/or its supplier, and is + * protected under applicable copyright laws. All rights are reserved. + * Any use in violation of the foregoing restrictions may subject the + * user to criminal sanctions under applicable laws, as well as to + * civil liability for the breach of the terms and conditions of this license. + * + * THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, + * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED + * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, + * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR + * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. + */ +static void nvm_operation (unsigned op, unsigned address, unsigned data) +{ + int x; + + // Convert virtual address to physical + NVMADDR = address & 0x1fffffff; + NVMDATA = data; + + // Disable interrupts + x = mips_intr_disable(); + + // Enable Flash Write/Erase Operations + NVMCON = PIC32_NVMCON_WREN | op; + + // Data sheet prescribes 6us delay for LVD to become stable. + // To be on the safer side, we shall set 7us delay. + udelay (7); + + NVMKEY = 0xAA996655; + NVMKEY = 0x556699AA; + NVMCONSET = PIC32_NVMCON_WR; + + // Wait for WR bit to clear + while (NVMCON & PIC32_NVMCON_WR) + continue; + + // Disable Flash Write/Erase operations + NVMCONCLR = PIC32_NVMCON_WREN; + + // Enable interrupts + mips_intr_restore (x); +#if 0 + // Check error status + if (NVMCON & (PIC32_NVMCON_WRERR | PIC32_NVMCON_LVDERR)) { + TODO; + } +#endif +} + +// flashErasePage and flashWriteUint32 where originally from the file flash.c +// implements the low level flash control and access. +// +// flash.c originated from the cpustick.com skeleton project from +// http://www.cpustick.com/downloads.htm and was originally written +// by Rich Testardi; please preserve this reference and share bug +// fixes with rich@testardi.com. +/*** void flashErasePage(unsigned addrPage) +** +** Synopsis: +** Erases the page starting at the page address. +* +** Parameters: +** addrPage The virtual address of the page to erase +** +** Return Values: +** None +** +** Errors: +** None +** +** Notes: +** +** addrPage must be page aligned. +** +*/ +static void flashErasePage(unsigned addrPage) +{ + int i; + int j; + unsigned x = ~0; + unsigned *rgUint32 = (unsigned *) addrPage; + + // we learned that just because the flash does not successfully + // erase on the first attempt, it might on another. We found that + // we can double the life of flash by attempting to + // erase the flash up to 5 times before quitting. + for(j=0; j<5; j++) { + // first check to see if the page needs to be erased + for (i = 0; i < FLASH_PAGE_SIZE/sizeof(unsigned); i++) { + x &= rgUint32[i]; + } + + // flash erased, we are done. + if(x == ~0) { + break; + } + + // Unlock and Erase Page + nvm_operation(NVMOP_PAGE_ERASE, addrPage, 0); + } + + // at this point, we don't care if the flash ever actually erased as + // as we will catch the failure when we verify the programming. + } + + +/*** void flashWriteUint32(unsigned addrUint32, unsigned *rgu32Data, unsigned cu32Data) +** +** Synopsis: +** Writes an array to unsigned to flash +* +** Parameters: +** rgu32Data Pointer to an array of unsigned +** cu32Data The number of unsigned to write +** +** Return Values: +** None +** +** Errors: +** None +** +** Notes: +** +** Assumes the pages have already been erased. +** +*/ +static void flashWriteUint32(unsigned addrUint32, unsigned *rgu32Data, unsigned cu32Data) +{ + int i = 0; + + for(i=0; i < cu32Data; i++) { + // only do this if the data is not what is already in flash + if(rgu32Data[i] != ~0) { + // Write the data + nvm_operation(NVMOP_WORD_PGM, addrUint32, rgu32Data[i]); + } + addrUint32 += sizeof(unsigned); + } +} diff --git a/sys/pic32/usb_boot.c b/sys/pic32/usb_boot.c index aa3daf4..3872ee8 100644 --- a/sys/pic32/usb_boot.c +++ b/sys/pic32/usb_boot.c @@ -563,7 +563,7 @@ int main() CHECONSET = 0x30; /* Disable JTAG port, to use it for i/o. */ - DDPCON = 0; + /*DDPCON = 0;*/ /* Config register: enable kseg0 caching. */ mips_write_c0_register (C0_CONFIG, 0, diff --git a/sys/pic32/usb_console.c b/sys/pic32/usb_console.c index 0660ed8..91d8e08 100644 --- a/sys/pic32/usb_console.c +++ b/sys/pic32/usb_console.c @@ -45,8 +45,10 @@ void cninit() IECSET(1) = 1 << (PIC32_IRQ_USB - 32); /* Wait for any user input. */ + led_control (LED_KERNEL, 1); while (! cdc_consume(0)) usb_device_tasks(); + led_control (LED_KERNEL, 0); } void cnidentify() diff --git a/sys/pic32/usbboot/Makefile b/sys/pic32/usbboot/Makefile index 85a9374..b061005 100644 --- a/sys/pic32/usbboot/Makefile +++ b/sys/pic32/usbboot/Makefile @@ -42,10 +42,10 @@ I = .. #CFLAGS += -DDIP -DFLASH_JUMP=0x9d000000 # Microchip USB/Ethernet Starter Kit -#CFLAGS += -DSTARTERKIT -DFLASH_JUMP=0x9d000000 +CFLAGS += -DSTARTERKIT -DFLASH_JUMP=0x9d000000 # Fubarino -CFLAGS += -DFUBARINO -DFLASH_JUMP=0x9d000000 +#CFLAGS += -DFUBARINO -DFLASH_JUMP=0x9d000000 all: usbboot.hex usbboot.elf $(SIZE) usbboot.elf diff --git a/test.txt b/test.txt deleted file mode 100644 index 038d718..0000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -testing diff --git a/tools/virtualmips/mips_memory.c b/tools/virtualmips/mips_memory.c index f00a6de..66a7c83 100644 --- a/tools/virtualmips/mips_memory.c +++ b/tools/virtualmips/mips_memory.c @@ -1207,9 +1207,22 @@ static mts32_entry_t *mips_mts32_slow_lookup (cpu_mips_t * cpu, #ifdef SIM_PIC32 if (vaddr == 0) goto err_undef; - map.vaddr = vaddr & MIPS_MIN_PAGE_MASK; - map.paddr = map.vaddr & 0x1ffff; - map.mapped = FALSE; + if( vaddr >= 0x7f000000 ) + { + map.vaddr = vaddr & MIPS_MIN_PAGE_MASK; + map.paddr = map.vaddr & 0x1ffff; + map.mapped = FALSE; + } + else if( vaddr >= 0x7d000000 ) + { + map.vaddr = vaddr & MIPS_MIN_PAGE_MASK; + map.paddr = map.vaddr & 0x1fffffff; + map.mapped = FALSE; + } + else + { + goto err_undef; + } #else /* trigger TLB exception if no matching entry found */ if (! mips_cp0_tlb_lookup (cpu, vaddr, &map)) diff --git a/tools/virtualmips/pic32.h b/tools/virtualmips/pic32.h index 3e3a5fe..48ad598 100644 --- a/tools/virtualmips/pic32.h +++ b/tools/virtualmips/pic32.h @@ -119,6 +119,16 @@ struct pic32_system { struct vdevice *prefetch; /* Prefetch cache controller */ unsigned checon; + + struct vdevice* flash_device; /* not owner of vdevice, just a reference that is filled by syscon code */ + unsigned nvmcon; + unsigned nvmkey; + unsigned nvmaddr; + unsigned nvmdata; + unsigned nvmsrcaddr; + + unsigned nvmstate; + }; typedef struct pic32_system pic32_t; diff --git a/tools/virtualmips/pic32_dev_flash.c b/tools/virtualmips/pic32_dev_flash.c index f0c2142..edec1a2 100644 --- a/tools/virtualmips/pic32_dev_flash.c +++ b/tools/virtualmips/pic32_dev_flash.c @@ -22,6 +22,8 @@ #include "mips_memory.h" #include "pic32.h" +#define FLASH_PAGE_SIZE 4096 + /* flash private data */ typedef struct flash_data { struct vdevice *dev; @@ -30,6 +32,52 @@ typedef struct flash_data { m_uint8_t *flash_file_name; } flash_data_t; +int dev_flash_flash_op( struct vdevice *dev, m_uint32_t addr, u_int op, m_uint32_t extra ) +{ + flash_data_t *d = dev->priv_data; + m_uint32_t offset = addr - dev->phys_addr; + + if( offset >= d->flash_size ) { + fprintf(stderr, "Flash operation out-of-bounds addr=%d offset=%d\n", addr, offset ); + return -1; + } + switch( op ) + { + case PIC32_NVMCON_PAGE_ERASE: + { + if( offset != (offset & ~(FLASH_PAGE_SIZE - 1)) ) + { + fprintf(stderr, "Flash operation misaligned\n" ); + return -1; + } + + int i; + for( i = 0; i < FLASH_PAGE_SIZE; ++i ) + { + *(unsigned *) (d->flash_ptr + offset + i) = ~0U; + } + return 0; + } + case PIC32_NVMCON_WORD_PGM: + { + if( offset != (offset & ~3) ) + { + fprintf(stderr, "Flash operation misaligned\n" ); + return -1; + } + * (unsigned *) (d->flash_ptr + offset) = *(unsigned *)(d->flash_ptr + offset) & extra; + return 0; + } + case PIC32_NVMCON_ROW_PGM: + { + fprintf(stderr, "Flash operation unsupported\n" ); + return -1; + } + } + fprintf(stderr, "Unknown Flash Operation\n" ); + return -1; +} + void *dev_flash_access (cpu_mips_t * cpu, struct vdevice *dev, m_uint32_t offset, u_int op_size, u_int op_type, m_uint32_t * data, m_uint8_t * has_set_value) @@ -79,12 +127,16 @@ static int dev_flash_load (char *flash_file_name, unsigned flash_len, fprintf (stderr, "%s: empty flash file.\n", flash_file_name); return (-1); } - *flash_data_hp = mmap (NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (*flash_data_hp == MAP_FAILED) { + char* tm = mmap (NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (tm == MAP_FAILED) { fprintf (stderr, "%s: ", flash_file_name); perror ("mmap"); return (-1); } + *flash_data_hp = malloc( flash_len ); + memcpy( *flash_data_hp, tm, sb.st_size ); + munmap( tm, sb.st_size ); + close( fd ); return 0; } diff --git a/tools/virtualmips/pic32_dev_syscon.c b/tools/virtualmips/pic32_dev_syscon.c index 63038fb..61f4587 100644 --- a/tools/virtualmips/pic32_dev_syscon.c +++ b/tools/virtualmips/pic32_dev_syscon.c @@ -22,9 +22,29 @@ #define SYSCON_REG_SIZE 0x1000 extern cpu_mips_t *current_cpu; +extern int dev_flash_flash_op( struct vdevice *dev, m_uint32_t addr, u_int op, m_uint32_t extra ); static int syskey_unlock; +static inline unsigned write_op (a, b, op) +{ + switch (op & 0xc) { + case 0x0: /* Assign */ + a = b; + break; + case 0x4: /* Clear */ + a &= ~b; + break; + case 0x8: /* Set */ + a |= b; + break; + case 0xc: /* Invert */ + a ^= b; + break; + } + return a; +} + static void soft_reset (cpu_mips_t *cpu) { pic32_t *pic32 = (pic32_t*) cpu->vm->hw_data; @@ -43,10 +63,14 @@ void *dev_pic32_syscon_access (cpu_mips_t *cpu, struct vdevice *dev, { pic32_t *pic32 = dev->priv_data; + if (offset >= SYSCON_REG_SIZE) { *data = 0; return NULL; } + + int keep_nvmstate = 0; + if (op_type == MTS_READ) *data = 0; switch (offset & 0xff0) { @@ -150,11 +174,75 @@ void *dev_pic32_syscon_access (cpu_mips_t *cpu, struct vdevice *dev, soft_reset (cpu); } break; - + case PIC32_NVMCON & 0xff0: + if (op_type == MTS_READ) { + *data = pic32->nvmcon; + if( *data & PIC32_NVMCON_WR ) { + pic32->nvmcon &= ~PIC32_NVMCON_WR; + } + } else { + pic32->nvmcon = write_op (pic32->nvmcon, *data, offset); + if( pic32->nvmstate == 2 && pic32->nvmcon & PIC32_NVMCON_WR ) { + switch( pic32->nvmcon & PIC32_NVMCON_NVMOP ) + { + case PIC32_NVMCON_PAGE_ERASE: + case PIC32_NVMCON_WORD_PGM: + dev_flash_flash_op( pic32->flash_device, + pic32->nvmaddr, + pic32->nvmcon & PIC32_NVMCON_NVMOP, + pic32->nvmdata ); + break; + default: + fprintf(stderr, "Unsupported/unknown flash operation\n" ); + break; + } + } + } + break; + case PIC32_NVMKEY & 0xff0: + if (op_type == MTS_READ) { + *data = pic32->nvmkey; + } else { + pic32->nvmkey = write_op (pic32->nvmkey, *data, offset); + if( pic32->nvmcon & PIC32_NVMCON_WREN + && pic32->nvmkey == 0xAA996655 ) { + pic32->nvmstate = 1; + keep_nvmstate = 1; + pic32->nvmcon &= ~PIC32_NVMCON_WR; + } else if( pic32->nvmstate == 1 + && pic32->nvmcon & PIC32_NVMCON_WREN + && pic32->nvmkey == 0x556699AA ) { + pic32->nvmstate = 2; + keep_nvmstate = 1; + } + } + break; + case PIC32_NVMADDR & 0xff0: + if (op_type == MTS_READ) { + *data = pic32->nvmaddr; + } else { + pic32->nvmaddr = write_op (pic32->nvmaddr, *data, offset); + } + break; + case PIC32_NVMDATA & 0xff0: + if (op_type == MTS_READ) { + *data = pic32->nvmdata; + } else { + pic32->nvmdata = write_op (pic32->nvmdata, *data, offset); + } + break; + case PIC32_NVMSRCADDR & 0xff0: + if (op_type == MTS_READ) { + *data = pic32->nvmsrcaddr; + } else { + pic32->nvmsrcaddr = write_op (pic32->nvmsrcaddr, *data, offset); + } + break; default: ASSERT (0, "unknown syscon offset %x\n", offset); } *has_set_value = TRUE; + if( !keep_nvmstate ) pic32->nvmstate = 0; return NULL; } @@ -170,6 +258,13 @@ void dev_pic32_syscon_reset (cpu_mips_t *cpu, struct vdevice *dev) pic32->rcon = 0; pic32->rswrst = 0; syskey_unlock = 0; + pic32->nvmcon = 0; + pic32->nvmkey = 0; + pic32->nvmaddr = 0; + pic32->nvmdata = 0; + pic32->nvmsrcaddr = 0; + pic32->nvmstate = 0; + } int dev_pic32_syscon_init (vm_instance_t *vm, char *name, unsigned paddr) @@ -186,6 +281,12 @@ int dev_pic32_syscon_init (vm_instance_t *vm, char *name, unsigned paddr) pic32->sysdev->reset_handler = dev_pic32_syscon_reset; pic32->sysdev->flags = VDEVICE_FLAG_NO_MTS_MMAP; + pic32->flash_device = vm_find_device( vm, "Program flash" ); + if( !pic32->flash_device ) + { + fprintf( stderr, "Unable to find Program Flash device\n"); + return (-1); + } vm_bind_device (vm, pic32->sysdev); return (0); } diff --git a/tools/virtualmips/pic32mx.h b/tools/virtualmips/pic32mx.h index be1e23b..d5796ec 100644 --- a/tools/virtualmips/pic32mx.h +++ b/tools/virtualmips/pic32mx.h @@ -894,4 +894,29 @@ #define PIC32_PMSTAT_IBOV 0x4000 /* Input buffer overflow */ #define PIC32_PMSTAT_IBF 0x8000 /* Input buffer full */ + +#define PIC32_NVMCON PIC32_R (0x0F400) +#define PIC32_NVMCONCLR PIC32_R (0x0F404) +#define PIC32_NVMCONSET PIC32_R (0x0F408) +#define PIC32_NVMCONINV PIC32_R (0x0F40C) +#define PIC32_NVMKEY PIC32_R (0x0F410) +#define PIC32_NVMADDR PIC32_R (0x0F420) +#define PIC32_NVMADDRCLR PIC32_R (0x0F424) +#define PIC32_NVMADDRSET PIC32_R (0x0F428) +#define PIC32_NVMADDRINV PIC32_R (0x0F42C) +#define PIC32_NVMDATA PIC32_R (0x0F430) +#define PIC32_NVMSRCADDR PIC32_R (0x0F440) + +#define PIC32_NVMCON_NVMOP 0x0000000F +#define PIC32_NVMCON_NOP 0 /* No operation */ +#define PIC32_NVMCON_WORD_PGM 1 /* Word program */ +#define PIC32_NVMCON_ROW_PGM 3 /* Row program */ +#define PIC32_NVMCON_PAGE_ERASE 4 /* Page erase */ + +#define PIC32_NVMCON_LVDSTAT 0x00000800 +#define PIC32_NVMCON_LVDERR 0x00001000 +#define PIC32_NVMCON_WRERR 0x00002000 +#define PIC32_NVMCON_WREN 0x00004000 +#define PIC32_NVMCON_WR 0x00008000 + #endif /* _IO_PIC32MX_H */ diff --git a/tools/virtualmips/vm.c b/tools/virtualmips/vm.c index aa96f35..b65332f 100644 --- a/tools/virtualmips/vm.c +++ b/tools/virtualmips/vm.c @@ -329,6 +329,7 @@ void vm_delete_vtty (vm_instance_t * vm) } } + /* Bind a device to a virtual machine */ int vm_bind_device (vm_instance_t * vm, struct vdevice *dev) { @@ -456,3 +457,12 @@ void vm_monitor (vm_instance_t * vm) while (vm->status != VM_STATUS_SHUTDOWN) usleep (1000); } + +struct vdevice *vm_find_device( vm_instance_t * vm, char * name ) +{ + u_int i; + for (i=0; i < VM_DEVICE_MAX; i++) + if( vm->dev_array[i] && strcmp( vm->dev_array[i]->name, name ) == 0 ) + return vm->dev_array[i]; + return 0; +} diff --git a/tools/virtualmips/vm.h b/tools/virtualmips/vm.h index 1428e12..b61170f 100644 --- a/tools/virtualmips/vm.h +++ b/tools/virtualmips/vm.h @@ -126,4 +126,5 @@ int vm_suspend (vm_instance_t * vm); int vm_resume (vm_instance_t * vm); int vm_stop (vm_instance_t * vm); void vm_monitor (vm_instance_t * vm); +struct vdevice *vm_find_device( vm_instance_t * vm, char * name ); #endif