program_if.go 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. @target mips, mipt2
  2. package main;
  3. const (
  4. LIN = 2
  5. COL = 2
  6. )
  7. var (
  8. matrizA [LIN][COL]int
  9. )
  10. func main() {
  11. var (
  12. aux = 0
  13. i = 1
  14. )
  15. /**
  16. FOR_OR_AND_AND_1:
  17. for i := 0; (((i < LIN || 1 == 1) && (i < LIN && 1 == 1)) && 1 == 1 ); i++ {
  18. //continue
  19. aux = aux + 10
  20. //break
  21. }
  22. FOR_OR_AND_AND_OR:
  23. for i := 0; (((i < LIN || 1 == 1) && (i < LIN && 1 == 1)) || 1 == 1 ); i++ {
  24. //continue
  25. aux = aux + 10
  26. //break
  27. }
  28. */
  29. SWITCH_1:
  30. switch aux {
  31. case 1,3,5:
  32. aux = 10
  33. case 2:
  34. aux = 20
  35. default:
  36. aux = 30
  37. }
  38. SWITCH_2:
  39. switch {
  40. case 1 == 3, 2 < 4:
  41. aux = 10
  42. case 2 == 2:
  43. aux = 20
  44. default:
  45. aux = 30
  46. }
  47. // if - if - else
  48. if i == 1 && 1 == 1 {
  49. aux = 10
  50. } else if i == 2 {
  51. aux = 20
  52. }else {
  53. aux = 30
  54. }
  55. IF_01:
  56. if (i < LIN) {
  57. aux = 10
  58. }else {
  59. aux = 20
  60. }
  61. IF_02:
  62. if (i < LIN || 1 == 1) {
  63. aux = 10
  64. }else {
  65. aux = 20
  66. }
  67. IF_03:
  68. if (i < LIN && 1 == 1) {
  69. aux = 10
  70. }else {
  71. aux = 20
  72. }
  73. IF_04:
  74. if ((i < LIN || 1 == 1) || (i < LIN || 1 == 1)) {
  75. aux = 10
  76. }else {
  77. aux = 20
  78. }
  79. IF_05:
  80. if ((i < LIN && 1 == 1) && (i < LIN && 1 == 1)) {
  81. aux = 10
  82. }else {
  83. aux = 20
  84. }
  85. IF_06:
  86. if ((i < LIN && 1 == 1) || (i < LIN && 1 == 1)) {
  87. aux = 10
  88. }else {
  89. aux = 20
  90. }
  91. IF_07:
  92. if ((i < LIN || 1 == 1) && (i < LIN || 1 == 1)) {
  93. aux = 10
  94. }else {
  95. aux = 20
  96. }
  97. IF_08:
  98. if ((i < LIN && 1 == 1) && (i < LIN || 1 == 1)) {
  99. aux = 10
  100. }else {
  101. aux = 20
  102. }
  103. IF_09:
  104. if ((i < LIN || 1 == 1) && (i < LIN && 1 == 1)) {
  105. aux = 10
  106. }else {
  107. aux = 20
  108. }
  109. IF_10:
  110. if ((i < LIN && 1 == 1) || (i < LIN || 1 == 1)) {
  111. aux = 10
  112. }else {
  113. aux = 20
  114. }
  115. IF_11:
  116. if ((i < LIN || 1 == 1) || (i < LIN && 1 == 1)) {
  117. aux = 10
  118. }else {
  119. aux = 20
  120. }
  121. /**
  122. */
  123. /**
  124. FOR_OR_AND_AND_1:
  125. for i := 0; ((i < LIN || 1 == 1) && (i < LIN && 1 == 1)); i++ {
  126. //continue
  127. aux = aux + 10
  128. //break
  129. }
  130. FOR_AND_AND_OR_1:
  131. for i := 0; ((i < LIN && 1 == 1) && (i < LIN || 1 == 1)); i++ {
  132. //continue
  133. aux = aux + 10
  134. //break
  135. }
  136. FOR_AND_OR_OR_1:
  137. for i := 0; ((i < LIN && 1 == 1) || (i < LIN || 1 == 1)); i++ {
  138. //continue
  139. aux = aux + 10
  140. //break
  141. }
  142. FOR_OR_OR_AND_1:
  143. for i := 0; ((i < LIN || 1 == 1) || (i < LIN && 1 == 1)); i++ {
  144. //continue
  145. aux = aux + 10
  146. //break
  147. }
  148. FOR_AND_OR_1:
  149. for i := 0; ((i < LIN || 1 == 1) && (i < LIN || 1 == 1)); i++ {
  150. //continue
  151. aux = aux + 10
  152. //break
  153. }
  154. FOR_OR_AND_1:
  155. for i := 0; ((i < LIN && 1 == 1) || (i < LIN && 1 == 1)); i++ {
  156. //continue
  157. aux = aux + 10
  158. //break
  159. }
  160. FOR_OR_1:
  161. for i := 0; ((i < LIN || 1 == 1) || (i < LIN || 1 == 1)); i++ {
  162. //continue
  163. aux = aux + 10
  164. //break
  165. }
  166. FOR_OR_2:
  167. for i := 0; i < LIN || 1 == 1; i++ {
  168. //continue
  169. aux = aux + 10
  170. //break
  171. }
  172. FOR_0:
  173. for i := 0; ((i < LIN && 1 == 1) && (i < LIN && 1 == 1)); i++ {
  174. //continue
  175. aux = aux + 10
  176. //break
  177. }
  178. FOR_1:
  179. for i := 0; (i < LIN && 1 == 1); i++ {
  180. //continue
  181. aux = aux + 10
  182. //break
  183. }
  184. FOR_2:
  185. for i := 0; (i < LIN || 1 == 1); i++ {
  186. //continue
  187. aux = aux + 10
  188. //break
  189. }
  190. FOR_3:
  191. for i := 0; (i < LIN); i++ {
  192. //continue
  193. aux = aux + 10
  194. //break
  195. }
  196. */
  197. }
  198. /**
  199. package main;
  200. const (
  201. LIN = 2
  202. COL = 2
  203. )
  204. var (
  205. matrizA [LIN][COL]int
  206. matrizB [LIN][COL]int
  207. matrizR [LIN][COL]int
  208. )
  209. func preenche(){
  210. var k = 1
  211. for i := 0; i < LIN ; i++ {
  212. for j := 0; j < COL ; j++ {
  213. matrizA[i][j] = k
  214. matrizB[i][j] = k
  215. k++
  216. }
  217. }
  218. }
  219. func multiplica() {
  220. var aux = 0
  221. for i := 0; i < LIN; i++ {
  222. for j := 0; j < COL; j++ {
  223. for k := 0; k < LIN; k++ {
  224. aux += matrizA[i][k] * matrizB[k][j]
  225. }
  226. matrizR[i][j] = aux
  227. aux = 0
  228. }
  229. }
  230. }
  231. func main() {
  232. preenche()
  233. multiplica()
  234. }
  235. */
  236. /**
  237. package main;
  238. const (
  239. LIN = 2
  240. COL = 2
  241. )
  242. type X struct {
  243. a int
  244. b int
  245. c int
  246. }
  247. var (
  248. a [5][6]int
  249. matrixX [3]X
  250. )
  251. func atualiza(x,i int) {
  252. if (x == 1){
  253. //a[x][i].c = 1
  254. // a[x][i] = 1
  255. a[x][i] = 10
  256. } else {
  257. i = 1
  258. }
  259. }
  260. func atualiza2(x *int) int {
  261. *x = 10
  262. return 2
  263. }
  264. func main() int {
  265. x := 1
  266. i := 1
  267. var (
  268. varx X
  269. )
  270. i = atualiza2(y)
  271. //atualiza(x,i)
  272. //varx.c = 50
  273. //matrixX[i].c = 50
  274. /*
  275. Testados
  276. IF_BASIC:
  277. if i < LIN {
  278. x = 10
  279. }
  280. IF_ANDOR:
  281. if (i < LIN && true) || 1 == 1 {
  282. x = 10
  283. } else {
  284. x = 20
  285. }
  286. */
  287. /*
  288. IF_ORAND:
  289. if (i < LIN || true) && 1 == 1 {
  290. x = 10
  291. } else {
  292. x = 20
  293. }
  294. IF_ANDOR_R:
  295. if 1 == 1 || (i < LIN && true){
  296. x = 10
  297. } else {
  298. x = 20
  299. }
  300. IF_ORAND_R:
  301. if 1 == 1 && (i < LIN || true) {
  302. x = 10
  303. } else {
  304. x = 20
  305. }
  306. IF_OROR:
  307. if (i < LIN || true) || 1 == 1 {
  308. x = 10
  309. } else {
  310. x = 20
  311. }
  312. IF_ANDAND:
  313. if (i < LIN && true) && 1 == 1 {
  314. x = 10
  315. } else {
  316. x = 20
  317. }
  318. IF_OROR_R:
  319. if 1 == 1 || (i < LIN || true){
  320. x = 10
  321. } else {
  322. x = 20
  323. }
  324. IF_ANDAND_R:
  325. if 1 == 1||(i < LIN && true) {
  326. x = 10
  327. } else {
  328. x = 20
  329. }
  330. IF_ORANDOR:
  331. if (i < LIN || true) && (1 == 1 || 2==2) {
  332. x = 10
  333. } else {
  334. x = 20
  335. }
  336. IF_ANDORAND_0:
  337. if (i < LIN || true) || (1 == 1 || 2 == 2 ) {
  338. x = 10
  339. } else {
  340. x = 20
  341. }
  342. IF_ANDORAND_1:
  343. if (i < LIN && true) || (1 == 1 || 2==2) {
  344. x = 10
  345. } else {
  346. x = 20
  347. }
  348. IF_ANDORAND_2:
  349. if (i < LIN || true) || (1 == 1 && 2 == 2 ) {
  350. x = 10
  351. } else {
  352. x = 20
  353. }
  354. IF_ANDORAND_10:
  355. if (i < LIN && true) || 2==2 {
  356. x = 10
  357. } else {
  358. x = 20
  359. }
  360. IF_ANDORAND_11:
  361. if 2==2 || (i < LIN && true) {
  362. x = 10
  363. } else {
  364. x = 20
  365. }
  366. return x
  367. */