Guest User

Untitled

a guest
Jun 18th, 2020
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 330.01 KB | None | 0 0
  1. $ futhark dev --gpu --verbose futracerlib.fut
  2. [ +0.000109] Reading and type-checking source program
  3. [ +0.249060] Internalising program
  4. [ +0.425029] Type-checking internalised program
  5. [ +0.120780] Running pass simplify
  6. [ +0.085439] Running pass Inline functions
  7. [ +0.469623] Running pass simplify
  8. [ +0.084080] Running pass CSE
  9. [ +0.041714] Running pass simplify
  10. [ +0.073842] Running pass Fuse SOACs
  11. [ +0.121451] Running pass CSE
  12. [ +0.027033] Running pass simplify
  13. [ +0.041800] Running pass Fuse SOACs
  14. [ +0.098423] Running pass CSE
  15. [ +0.026688] Running pass simplify
  16. [ +0.040797] Running pass Remove dead functions
  17. [ +0.021023] Running pass extract kernels
  18. Internal compiler error.
  19. Please report this at https://github.com/diku-dk/futhark/issues.
  20. Type error after pass 'extract kernels':
  21. In function render_triangles_raw
  22. When checking function body
  23. In expression of statement {[w_7133][h_7134]i32 res_7619}
  24. In expression of statement {[w_7133][h_7134]i32 res_8634}
  25. In expression of statement {[w_7133][h_7134]i32 res_8639}
  26. In expression of statement {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_8971,
  27. [n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_8972}
  28. In expression of statement {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_14331}
  29. In expression of statement {[lifted_0_rect_pixel_indices_arg_8964]i32 res_14357}
  30. In subexp res_9384
  31. Use of unknown variable res_9384.
  32.  
  33.  
  34. entry {f32, f32, f32} translate_point_raw (f32 x_move_7065, f32 y_move_7066,
  35. f32 z_move_7067, f32 x_7068,
  36. f32 y_7069, f32 z_7070) = {
  37. let {f32 res_7071} = fadd32(x_move_7065, x_7068)
  38. let {f32 res_7072} = fadd32(y_move_7066, y_7069)
  39. let {f32 res_7073} = fadd32(z_move_7067, z_7070)
  40. in {res_7071, res_7072, res_7073}
  41. }
  42.  
  43. entry {f32, f32, f32} rotate_point_raw (f32 angle_x_7074, f32 angle_y_7075,
  44. f32 angle_z_7076, f32 x_origo_7077,
  45. f32 y_origo_7078, f32 z_origo_7079,
  46. f32 x_7080, f32 y_7081, f32 z_7082) = {
  47. let {f32 res_7083} = fsub32(x_7080, x_origo_7077)
  48. let {f32 res_7084} = fsub32(y_7081, y_origo_7078)
  49. let {f32 res_7085} = fsub32(z_7082, z_origo_7079)
  50. let {f32 res_7086} =
  51. sin32(angle_x_7074)
  52. let {f32 res_7087} =
  53. cos32(angle_x_7074)
  54. let {f32 res_7088} =
  55. sin32(angle_y_7075)
  56. let {f32 res_7089} =
  57. cos32(angle_y_7075)
  58. let {f32 res_7090} =
  59. sin32(angle_z_7076)
  60. let {f32 res_7091} =
  61. cos32(angle_z_7076)
  62. let {f32 x_7092} = fmul32(res_7084, res_7087)
  63. let {f32 y_7093} = fmul32(res_7085, res_7086)
  64. let {f32 res_7094} = fsub32(x_7092, y_7093)
  65. let {f32 x_7095} = fmul32(res_7084, res_7086)
  66. let {f32 y_7096} = fmul32(res_7085, res_7087)
  67. let {f32 res_7097} = fadd32(x_7095, y_7096)
  68. let {f32 x_7098} = fmul32(res_7088, res_7097)
  69. let {f32 y_7099} = fmul32(res_7083, res_7089)
  70. let {f32 res_7100} = fadd32(x_7098, y_7099)
  71. let {f32 x_7101} = fmul32(res_7089, res_7097)
  72. let {f32 y_7102} = fmul32(res_7083, res_7088)
  73. let {f32 res_7103} = fsub32(x_7101, y_7102)
  74. let {f32 x_7104} = fmul32(res_7091, res_7100)
  75. let {f32 y_7105} = fmul32(res_7090, res_7094)
  76. let {f32 res_7106} = fsub32(x_7104, y_7105)
  77. let {f32 x_7107} = fmul32(res_7090, res_7100)
  78. let {f32 y_7108} = fmul32(res_7091, res_7094)
  79. let {f32 res_7109} = fadd32(x_7107, y_7108)
  80. let {f32 res_7110} = fadd32(x_origo_7077, res_7106)
  81. let {f32 res_7111} = fadd32(y_origo_7078, res_7109)
  82. let {f32 res_7112} = fadd32(z_origo_7079, res_7103)
  83. in {res_7110, res_7111, res_7112}
  84. }
  85.  
  86. entry {[?0][?1]i32} render_triangles_raw (i32 n_7113, i32 n_7114, i32 n_7115,
  87. i32 n_7116, i32 n_7117, i32 n_7118,
  88. i32 n_7119, i32 n_7120, i32 n_7121,
  89. i32 n_7122, i32 n_7123, i32 n_7124,
  90. i32 n_7125, i32 n_7126,
  91. i32 impl₂_7127, i32 impl₂_7128,
  92. i32 impl₂_7129,
  93. i32 render_approach_7130,
  94. i32 n_draw_rects_x_7131,
  95. i32 n_draw_rects_y_7132, i32 w_7133,
  96. i32 h_7134, f32 view_dist_7135,
  97. f32 draw_dist_7136,
  98. [n_7113]f32 x0s_7137,
  99. [n_7114]f32 y0s_7138,
  100. [n_7115]f32 z0s_7139,
  101. [n_7116]f32 x1s_7140,
  102. [n_7117]f32 y1s_7141,
  103. [n_7118]f32 z1s_7142,
  104. [n_7119]f32 x2s_7143,
  105. [n_7120]f32 y2s_7144,
  106. [n_7121]f32 z2s_7145,
  107. [n_7122]i32 surface_types_7146,
  108. [n_7123]f32 surface_hsv_hs_7147,
  109. [n_7124]f32 surface_hsv_ss_7148,
  110. [n_7125]f32 surface_hsv_vs_7149,
  111. [n_7126]i32 surface_indices_7150,
  112. i32 surface_n_7151,
  113. i32 surface_w_7152,
  114. i32 surface_h_7153,
  115. [impl₂_7127]f32 surface_textures_flat_hsv_hs_7154,
  116. [impl₂_7128]f32 surface_textures_flat_hsv_ss_7155,
  117. [impl₂_7129]f32 surface_textures_flat_hsv_vs_7156,
  118. f32 c_x_7157, f32 c_y_7158,
  119. f32 c_z_7159, f32 c_ax_7160,
  120. f32 c_ay_7161, f32 c_az_7162) = {
  121. let {bool dim_match_7163} = eq_i32(n_7113, n_7114)
  122. let {cert empty_or_match_cert_7164} =
  123. assert(dim_match_7163, "function arguments of wrong shape",
  124. "futracerlib.fut:21:1-71:70")
  125. let {bool dim_match_7165} = eq_i32(n_7113, n_7115)
  126. let {cert empty_or_match_cert_7166} =
  127. assert(dim_match_7165, "function arguments of wrong shape",
  128. "futracerlib.fut:21:1-71:70")
  129. let {bool dim_match_7167} = eq_i32(n_7113, n_7116)
  130. let {cert empty_or_match_cert_7168} =
  131. assert(dim_match_7167, "function arguments of wrong shape",
  132. "futracerlib.fut:21:1-71:70")
  133. let {bool dim_match_7169} = eq_i32(n_7113, n_7117)
  134. let {cert empty_or_match_cert_7170} =
  135. assert(dim_match_7169, "function arguments of wrong shape",
  136. "futracerlib.fut:21:1-71:70")
  137. let {bool dim_match_7171} = eq_i32(n_7113, n_7118)
  138. let {cert empty_or_match_cert_7172} =
  139. assert(dim_match_7171, "function arguments of wrong shape",
  140. "futracerlib.fut:21:1-71:70")
  141. let {bool dim_match_7173} = eq_i32(n_7113, n_7119)
  142. let {cert empty_or_match_cert_7174} =
  143. assert(dim_match_7173, "function arguments of wrong shape",
  144. "futracerlib.fut:21:1-71:70")
  145. let {bool dim_match_7175} = eq_i32(n_7113, n_7120)
  146. let {cert empty_or_match_cert_7176} =
  147. assert(dim_match_7175, "function arguments of wrong shape",
  148. "futracerlib.fut:21:1-71:70")
  149. let {bool dim_match_7177} = eq_i32(n_7113, n_7121)
  150. let {cert empty_or_match_cert_7178} =
  151. assert(dim_match_7177, "function arguments of wrong shape",
  152. "futracerlib.fut:21:1-71:70")
  153. let {bool dim_match_7179} = eq_i32(n_7113, n_7122)
  154. let {cert empty_or_match_cert_7180} =
  155. assert(dim_match_7179, "function arguments of wrong shape",
  156. "futracerlib.fut:21:1-71:70")
  157. -- surface_types_7181 aliases surface_types_7146
  158. let {[n_7113]i32 surface_types_7181} =
  159. <empty_or_match_cert_7180>
  160. reshape((~n_7113), surface_types_7146)
  161. let {bool dim_match_7182} = eq_i32(n_7113, n_7123)
  162. let {cert empty_or_match_cert_7183} =
  163. assert(dim_match_7182, "function arguments of wrong shape",
  164. "futracerlib.fut:21:1-71:70")
  165. -- surface_hsv_hs_7184 aliases surface_hsv_hs_7147
  166. let {[n_7113]f32 surface_hsv_hs_7184} =
  167. <empty_or_match_cert_7183>
  168. reshape((~n_7113), surface_hsv_hs_7147)
  169. let {bool dim_match_7185} = eq_i32(n_7113, n_7124)
  170. let {cert empty_or_match_cert_7186} =
  171. assert(dim_match_7185, "function arguments of wrong shape",
  172. "futracerlib.fut:21:1-71:70")
  173. -- surface_hsv_ss_7187 aliases surface_hsv_ss_7148
  174. let {[n_7113]f32 surface_hsv_ss_7187} =
  175. <empty_or_match_cert_7186>
  176. reshape((~n_7113), surface_hsv_ss_7148)
  177. let {bool dim_match_7188} = eq_i32(n_7113, n_7125)
  178. let {cert empty_or_match_cert_7189} =
  179. assert(dim_match_7188, "function arguments of wrong shape",
  180. "futracerlib.fut:21:1-71:70")
  181. -- surface_hsv_vs_7190 aliases surface_hsv_vs_7149
  182. let {[n_7113]f32 surface_hsv_vs_7190} =
  183. <empty_or_match_cert_7189>
  184. reshape((~n_7113), surface_hsv_vs_7149)
  185. let {bool dim_match_7191} = eq_i32(n_7113, n_7126)
  186. let {cert empty_or_match_cert_7192} =
  187. assert(dim_match_7191, "function arguments of wrong shape",
  188. "futracerlib.fut:21:1-71:70")
  189. -- surface_indices_7193 aliases surface_indices_7150
  190. let {[n_7113]i32 surface_indices_7193} =
  191. <empty_or_match_cert_7192>
  192. reshape((~n_7113), surface_indices_7150)
  193. let {bool dim_match_7194} = eq_i32(impl₂_7127, impl₂_7128)
  194. let {cert empty_or_match_cert_7195} =
  195. assert(dim_match_7194, "function arguments of wrong shape",
  196. "futracerlib.fut:21:1-71:70")
  197. let {bool dim_match_7196} = eq_i32(impl₂_7127, impl₂_7129)
  198. let {cert empty_or_match_cert_7197} =
  199. assert(dim_match_7196, "function arguments of wrong shape",
  200. "futracerlib.fut:21:1-71:70")
  201. let {i32 unflatten_arg_7198} = mul32(surface_n_7151, surface_h_7153)
  202. let {i32 x_7199} = mul_nw32(surface_w_7152, unflatten_arg_7198)
  203. let {bool assert_arg_7200} = eq_i32(x_7199, impl₂_7127)
  204. let {cert dim_ok_7201} =
  205. assert(assert_arg_7200,
  206. "new shape has different number of elements than old shape",
  207. "/prelude/array.fut:95:3-33")
  208. let {f32 translate_point_arg_7202} = fsub32(0.0f32, c_x_7157)
  209. let {f32 translate_point_arg_7203} = fsub32(0.0f32, c_y_7158)
  210. let {f32 translate_point_arg_7204} = fsub32(0.0f32, c_z_7159)
  211. let {f32 rotate_point_arg_7205} = fsub32(0.0f32, c_ax_7160)
  212. let {f32 rotate_point_arg_7206} = fsub32(0.0f32, c_ay_7161)
  213. let {f32 rotate_point_arg_7207} = fsub32(0.0f32, c_az_7162)
  214. let {f32 res_7208} =
  215. sin32(rotate_point_arg_7205)
  216. let {f32 res_7209} =
  217. cos32(rotate_point_arg_7205)
  218. let {f32 res_7210} =
  219. sin32(rotate_point_arg_7206)
  220. let {f32 res_7211} =
  221. cos32(rotate_point_arg_7206)
  222. let {f32 res_7212} =
  223. sin32(rotate_point_arg_7207)
  224. let {f32 res_7213} =
  225. cos32(rotate_point_arg_7207)
  226. let {f32 res_7214} = sitofp i32 w_7133 to f32
  227. let {f32 y_7215} = fdiv32(res_7214, 2.0f32)
  228. let {f32 res_7216} = sitofp i32 h_7134 to f32
  229. let {f32 y_7217} = fdiv32(res_7216, 2.0f32)
  230. -- reshape_7346 aliases y0s_7138
  231. let {[n_7113]f32 reshape_7346} =
  232. <empty_or_match_cert_7164>
  233. reshape((~n_7113), y0s_7138)
  234. -- reshape_7347 aliases z0s_7139
  235. let {[n_7113]f32 reshape_7347} =
  236. <empty_or_match_cert_7166>
  237. reshape((~n_7113), z0s_7139)
  238. -- reshape_7348 aliases x1s_7140
  239. let {[n_7113]f32 reshape_7348} =
  240. <empty_or_match_cert_7168>
  241. reshape((~n_7113), x1s_7140)
  242. -- reshape_7349 aliases y1s_7141
  243. let {[n_7113]f32 reshape_7349} =
  244. <empty_or_match_cert_7170>
  245. reshape((~n_7113), y1s_7141)
  246. -- reshape_7350 aliases z1s_7142
  247. let {[n_7113]f32 reshape_7350} =
  248. <empty_or_match_cert_7172>
  249. reshape((~n_7113), z1s_7142)
  250. -- reshape_7351 aliases x2s_7143
  251. let {[n_7113]f32 reshape_7351} =
  252. <empty_or_match_cert_7174>
  253. reshape((~n_7113), x2s_7143)
  254. -- reshape_7352 aliases y2s_7144
  255. let {[n_7113]f32 reshape_7352} =
  256. <empty_or_match_cert_7176>
  257. reshape((~n_7113), y2s_7144)
  258. -- reshape_7353 aliases z2s_7145
  259. let {[n_7113]f32 reshape_7353} =
  260. <empty_or_match_cert_7178>
  261. reshape((~n_7113), z2s_7145)
  262. let {i64 n_9676} = sext i32 n_7113 to i64
  263. let {i64 nest_size_9677} = mul_nw64(n_9676, 1i64)
  264. let {i32 segscan_group_size_9679} =
  265. get_size(segscan_group_size_9678, group_size)
  266. let {i32 num_groups_9681} =
  267. calc_num_groups(nest_size_9677, segscan_num_groups_9680,
  268. segscan_group_size_9679)
  269. let {i32 num_threads_9682} =
  270. mul_nw32(num_groups_9681, segscan_group_size_9679)
  271. let {[n_7113]i32 offsets_7354, [n_7113]i32 increments_7355,
  272. [n_7113]i32 res_7356, [n_7113]i32 res_7357, [n_7113]i32 res_7358,
  273. [n_7113]i32 res_7359, [n_7113]i32 res_7360, [n_7113]i32 res_7361,
  274. [n_7113]f32 res_7362, [n_7113]f32 res_7363, [n_7113]f32 res_7364} =
  275. segscan_thread
  276. (#groups=num_groups_9681; groupsize=segscan_group_size_9679)
  277. ({{0i32},
  278. [],
  279. fn {i32} (i32 x_7365, i32 y_7366) =>
  280. let {i32 z_7367} = add_nw32(x_7365, y_7366)
  281. in {z_7367}})
  282. (gtid_9683 < n_7113) (~phys_tid_9684) : {i32, i32, i32, i32, i32, i32, i32,
  283. i32, f32, f32, f32} {
  284. let {f32 x_7368} = x0s_7137[gtid_9683]
  285. let {f32 x_7369} = reshape_7346[gtid_9683]
  286. let {f32 x_7370} = reshape_7347[gtid_9683]
  287. let {f32 x_7371} = reshape_7348[gtid_9683]
  288. let {f32 x_7372} = reshape_7349[gtid_9683]
  289. let {f32 x_7373} = reshape_7350[gtid_9683]
  290. let {f32 x_7374} = reshape_7351[gtid_9683]
  291. let {f32 x_7375} = reshape_7352[gtid_9683]
  292. let {f32 x_7376} = reshape_7353[gtid_9683]
  293. let {f32 res_7377} = fadd32(translate_point_arg_7202, x_7368)
  294. let {f32 res_7378} = fadd32(translate_point_arg_7203, x_7369)
  295. let {f32 res_7379} = fadd32(translate_point_arg_7204, x_7370)
  296. let {f32 x_7380} = fmul32(res_7209, res_7378)
  297. let {f32 y_7381} = fmul32(res_7208, res_7379)
  298. let {f32 res_7382} = fsub32(x_7380, y_7381)
  299. let {f32 x_7383} = fmul32(res_7208, res_7378)
  300. let {f32 y_7384} = fmul32(res_7209, res_7379)
  301. let {f32 res_7385} = fadd32(x_7383, y_7384)
  302. let {f32 x_7386} = fmul32(res_7210, res_7385)
  303. let {f32 y_7387} = fmul32(res_7211, res_7377)
  304. let {f32 res_7388} = fadd32(x_7386, y_7387)
  305. let {f32 x_7389} = fmul32(res_7211, res_7385)
  306. let {f32 y_7390} = fmul32(res_7210, res_7377)
  307. let {f32 res_7391} = fsub32(x_7389, y_7390)
  308. let {f32 x_7392} = fmul32(res_7213, res_7388)
  309. let {f32 y_7393} = fmul32(res_7212, res_7382)
  310. let {f32 res_7394} = fsub32(x_7392, y_7393)
  311. let {f32 x_7395} = fmul32(res_7212, res_7388)
  312. let {f32 y_7396} = fmul32(res_7213, res_7382)
  313. let {f32 res_7397} = fadd32(x_7395, y_7396)
  314. let {f32 res_7398} = fadd32(translate_point_arg_7202, x_7371)
  315. let {f32 res_7399} = fadd32(translate_point_arg_7203, x_7372)
  316. let {f32 res_7400} = fadd32(translate_point_arg_7204, x_7373)
  317. let {f32 x_7401} = fmul32(res_7209, res_7399)
  318. let {f32 y_7402} = fmul32(res_7208, res_7400)
  319. let {f32 res_7403} = fsub32(x_7401, y_7402)
  320. let {f32 x_7404} = fmul32(res_7208, res_7399)
  321. let {f32 y_7405} = fmul32(res_7209, res_7400)
  322. let {f32 res_7406} = fadd32(x_7404, y_7405)
  323. let {f32 x_7407} = fmul32(res_7210, res_7406)
  324. let {f32 y_7408} = fmul32(res_7211, res_7398)
  325. let {f32 res_7409} = fadd32(x_7407, y_7408)
  326. let {f32 x_7410} = fmul32(res_7211, res_7406)
  327. let {f32 y_7411} = fmul32(res_7210, res_7398)
  328. let {f32 res_7412} = fsub32(x_7410, y_7411)
  329. let {f32 x_7413} = fmul32(res_7213, res_7409)
  330. let {f32 y_7414} = fmul32(res_7212, res_7403)
  331. let {f32 res_7415} = fsub32(x_7413, y_7414)
  332. let {f32 x_7416} = fmul32(res_7212, res_7409)
  333. let {f32 y_7417} = fmul32(res_7213, res_7403)
  334. let {f32 res_7418} = fadd32(x_7416, y_7417)
  335. let {f32 res_7419} = fadd32(translate_point_arg_7202, x_7374)
  336. let {f32 res_7420} = fadd32(translate_point_arg_7203, x_7375)
  337. let {f32 res_7421} = fadd32(translate_point_arg_7204, x_7376)
  338. let {f32 x_7422} = fmul32(res_7209, res_7420)
  339. let {f32 y_7423} = fmul32(res_7208, res_7421)
  340. let {f32 res_7424} = fsub32(x_7422, y_7423)
  341. let {f32 x_7425} = fmul32(res_7208, res_7420)
  342. let {f32 y_7426} = fmul32(res_7209, res_7421)
  343. let {f32 res_7427} = fadd32(x_7425, y_7426)
  344. let {f32 x_7428} = fmul32(res_7210, res_7427)
  345. let {f32 y_7429} = fmul32(res_7211, res_7419)
  346. let {f32 res_7430} = fadd32(x_7428, y_7429)
  347. let {f32 x_7431} = fmul32(res_7211, res_7427)
  348. let {f32 y_7432} = fmul32(res_7210, res_7419)
  349. let {f32 res_7433} = fsub32(x_7431, y_7432)
  350. let {f32 x_7434} = fmul32(res_7213, res_7430)
  351. let {f32 y_7435} = fmul32(res_7212, res_7424)
  352. let {f32 res_7436} = fsub32(x_7434, y_7435)
  353. let {f32 x_7437} = fmul32(res_7212, res_7430)
  354. let {f32 y_7438} = fmul32(res_7213, res_7424)
  355. let {f32 res_7439} = fadd32(x_7437, y_7438)
  356. let {bool cond_7440} = le32(0.0f32, res_7391)
  357. let {f32 z_ratio_7441} =
  358. -- Branch returns: {f32}
  359. if cond_7440
  360. then {
  361. let {f32 x_7442} = fadd32(view_dist_7135, res_7391)
  362. let {f32 res_7443} = fdiv32(x_7442, view_dist_7135)
  363. in {res_7443}
  364. } else {
  365. let {f32 x_7444} = fsub32(view_dist_7135, res_7391)
  366. let {f32 y_7445} = fdiv32(x_7444, view_dist_7135)
  367. let {f32 res_7446} = fdiv32(1.0f32, y_7445)
  368. in {res_7446}
  369. }
  370. let {f32 x_7447} = fdiv32(res_7394, z_ratio_7441)
  371. let {f32 x_projected_7448} = fadd32(y_7215, x_7447)
  372. let {f32 x_7449} = fdiv32(res_7397, z_ratio_7441)
  373. let {f32 y_projected_7450} = fadd32(y_7217, x_7449)
  374. let {i32 res_7451} = fptosi f32 x_projected_7448 to i32
  375. let {i32 res_7452} = fptosi f32 y_projected_7450 to i32
  376. let {bool cond_7453} = le32(0.0f32, res_7412)
  377. let {f32 z_ratio_7454} =
  378. -- Branch returns: {f32}
  379. if cond_7453
  380. then {
  381. let {f32 x_7455} = fadd32(view_dist_7135, res_7412)
  382. let {f32 res_7456} = fdiv32(x_7455, view_dist_7135)
  383. in {res_7456}
  384. } else {
  385. let {f32 x_7457} = fsub32(view_dist_7135, res_7412)
  386. let {f32 y_7458} = fdiv32(x_7457, view_dist_7135)
  387. let {f32 res_7459} = fdiv32(1.0f32, y_7458)
  388. in {res_7459}
  389. }
  390. let {f32 x_7460} = fdiv32(res_7415, z_ratio_7454)
  391. let {f32 x_projected_7461} = fadd32(y_7215, x_7460)
  392. let {f32 x_7462} = fdiv32(res_7418, z_ratio_7454)
  393. let {f32 y_projected_7463} = fadd32(y_7217, x_7462)
  394. let {i32 res_7464} = fptosi f32 x_projected_7461 to i32
  395. let {i32 res_7465} = fptosi f32 y_projected_7463 to i32
  396. let {bool cond_7466} = le32(0.0f32, res_7433)
  397. let {f32 z_ratio_7467} =
  398. -- Branch returns: {f32}
  399. if cond_7466
  400. then {
  401. let {f32 x_7468} = fadd32(view_dist_7135, res_7433)
  402. let {f32 res_7469} = fdiv32(x_7468, view_dist_7135)
  403. in {res_7469}
  404. } else {
  405. let {f32 x_7470} = fsub32(view_dist_7135, res_7433)
  406. let {f32 y_7471} = fdiv32(x_7470, view_dist_7135)
  407. let {f32 res_7472} = fdiv32(1.0f32, y_7471)
  408. in {res_7472}
  409. }
  410. let {f32 x_7473} = fdiv32(res_7436, z_ratio_7467)
  411. let {f32 x_projected_7474} = fadd32(y_7215, x_7473)
  412. let {f32 x_7475} = fdiv32(res_7439, z_ratio_7467)
  413. let {f32 y_projected_7476} = fadd32(y_7217, x_7475)
  414. let {i32 res_7477} = fptosi f32 x_projected_7474 to i32
  415. let {i32 res_7478} = fptosi f32 y_projected_7476 to i32
  416. let {bool res_7480} = lt32(res_7391, draw_dist_7136)
  417. let {bool x_7481} = logand(cond_7440, res_7480)
  418. let {bool res_7483} = lt32(res_7412, draw_dist_7136)
  419. let {bool x_7484} = logand(cond_7453, res_7483)
  420. let {bool x_7485} = not x_7481
  421. let {bool y_7486} = logand(x_7484, x_7485)
  422. let {bool cond_7487} = logor(x_7481, y_7486)
  423. let {bool res_7489} = lt32(res_7433, draw_dist_7136)
  424. let {bool x_7490} = logand(cond_7466, res_7489)
  425. let {bool x_7491} = not cond_7487
  426. let {bool y_7492} = logand(x_7490, x_7491)
  427. let {bool cond_7493} = logor(cond_7487, y_7492)
  428. let {bool cond_7494} = slt32(res_7451, 0i32)
  429. let {bool res_7495} = slt32(res_7464, 0i32)
  430. let {bool x_7496} = logand(cond_7494, res_7495)
  431. let {bool res_7497} = slt32(res_7477, 0i32)
  432. let {bool x_7498} = logand(x_7496, res_7497)
  433. let {bool cond_7499} = sle32(w_7133, res_7451)
  434. let {bool res_7500} = sle32(w_7133, res_7464)
  435. let {bool x_7501} = logand(cond_7499, res_7500)
  436. let {bool res_7502} = sle32(w_7133, res_7477)
  437. let {bool x_7503} = logand(x_7501, res_7502)
  438. let {bool x_7504} = not x_7498
  439. let {bool y_7505} = logand(x_7503, x_7504)
  440. let {bool cond_7506} = logor(x_7498, y_7505)
  441. let {bool cond_7507} = slt32(res_7452, 0i32)
  442. let {bool res_7508} = slt32(res_7465, 0i32)
  443. let {bool x_7509} = logand(cond_7507, res_7508)
  444. let {bool res_7510} = slt32(res_7478, 0i32)
  445. let {bool x_7511} = logand(x_7509, res_7510)
  446. let {bool x_7512} = not cond_7506
  447. let {bool y_7513} = logand(x_7511, x_7512)
  448. let {bool cond_7514} = logor(cond_7506, y_7513)
  449. let {bool cond_7515} = sle32(h_7134, res_7452)
  450. let {bool res_7516} = sle32(h_7134, res_7465)
  451. let {bool x_7517} = logand(cond_7515, res_7516)
  452. let {bool res_7518} = sle32(h_7134, res_7478)
  453. let {bool x_7519} = logand(x_7517, res_7518)
  454. let {bool x_7520} = not cond_7514
  455. let {bool y_7521} = logand(x_7519, x_7520)
  456. let {bool res_7522} = logor(cond_7514, y_7521)
  457. let {bool res_7523} = not res_7522
  458. let {bool x_7524} = logand(cond_7493, res_7523)
  459. let {bool cond_neg_7525} = not x_7524
  460. let {i32 res_7526} = btoi bool cond_neg_7525 to i32
  461. let {bool is_i_7527} = eq_i32(res_7526, 0i32)
  462. let {bool cond_neg_7528} = not is_i_7527
  463. let {i32 part_res_7529} = btoi bool cond_neg_7528 to i32
  464. let {i32 part_res_7530} = btoi bool is_i_7527 to i32
  465. return {returns part_res_7530, returns part_res_7529, returns res_7451,
  466. returns res_7452, returns res_7464, returns res_7465,
  467. returns res_7477, returns res_7478, returns res_7391,
  468. returns res_7412, returns res_7433}
  469. }
  470. let {i32 last_index_7542} = sub_nw32(n_7113, 1i32)
  471. let {bool is_empty_7543} = eq_i32(n_7113, 0i32)
  472. let {i32 partition_size_7544} =
  473. -- Branch returns: {i32}
  474. if is_empty_7543
  475. then {0i32} else {
  476. let {i32 last_offset_7545} = offsets_7354[last_index_7542]
  477. in {last_offset_7545}
  478. }
  479. let {[n_7113]i32 partition_dest_7546} = scratch(i32, n_7113)
  480. let {[n_7113]i32 partition_dest_7547} = scratch(i32, n_7113)
  481. let {[n_7113]f32 partition_dest_7548} = scratch(f32, n_7113)
  482. let {[n_7113]i32 partition_dest_7549} = scratch(i32, n_7113)
  483. let {[n_7113]i32 partition_dest_7550} = scratch(i32, n_7113)
  484. let {[n_7113]f32 partition_dest_7551} = scratch(f32, n_7113)
  485. let {[n_7113]i32 partition_dest_7552} = scratch(i32, n_7113)
  486. let {[n_7113]i32 partition_dest_7553} = scratch(i32, n_7113)
  487. let {[n_7113]f32 partition_dest_7554} = scratch(f32, n_7113)
  488. let {[n_7113]i32 partition_dest_7555} = scratch(i32, n_7113)
  489. let {[n_7113]f32 partition_dest_7556} = scratch(f32, n_7113)
  490. let {[n_7113]f32 partition_dest_7557} = scratch(f32, n_7113)
  491. let {[n_7113]f32 partition_dest_7558} = scratch(f32, n_7113)
  492. let {[n_7113]i32 partition_dest_7559} = scratch(i32, n_7113)
  493. let {i64 n_9687} = sext i32 n_7113 to i64
  494. let {i64 nest_size_9688} = mul_nw64(n_9687, 1i64)
  495. let {i32 segmap_group_size_9690} =
  496. get_size(segmap_group_size_9689, group_size)
  497. let {i64 segmap_group_size_9691} = sext i32 segmap_group_size_9690 to i64
  498. let {i64 segmap_usable_groups_64_9692} =
  499. sdiv_up64(nest_size_9688, segmap_group_size_9691)
  500. let {i32 segmap_usable_groups_9693} =
  501. sext i64 segmap_usable_groups_64_9692 to i32
  502. let {[n_7113]i32 partition_res_7560, [n_7113]i32 partition_res_7561,
  503. [n_7113]f32 partition_res_7562, [n_7113]i32 partition_res_7563,
  504. [n_7113]i32 partition_res_7564, [n_7113]f32 partition_res_7565,
  505. [n_7113]i32 partition_res_7566, [n_7113]i32 partition_res_7567,
  506. [n_7113]f32 partition_res_7568, [n_7113]i32 partition_res_7569,
  507. [n_7113]f32 partition_res_7570, [n_7113]f32 partition_res_7571,
  508. [n_7113]f32 partition_res_7572, [n_7113]i32 partition_res_7573} =
  509. -- Consumes partition_dest_7546, partition_dest_7547, partition_dest_7548, partition_dest_7549, partition_dest_7550, partition_dest_7551, partition_dest_7552, partition_dest_7553, partition_dest_7554, partition_dest_7555, partition_dest_7556, partition_dest_7557, partition_dest_7558, partition_dest_7559
  510. segmap_thread
  511. (#groups=segmap_usable_groups_9693; groupsize=segmap_group_size_9690)
  512. (write_i_9685 < n_7113) (~phys_tid_9686) : {i32, i32, f32, i32, i32, f32,
  513. i32, i32, f32, i32, f32, f32,
  514. f32, i32} {
  515. let {i32 c_7574} = increments_7355[write_i_9685]
  516. let {i32 offset_7575} = offsets_7354[write_i_9685]
  517. let {i32 v_7576} = res_7356[write_i_9685]
  518. let {i32 v_7577} = res_7357[write_i_9685]
  519. let {f32 v_7578} = res_7362[write_i_9685]
  520. let {i32 v_7579} = res_7358[write_i_9685]
  521. let {i32 v_7580} = res_7359[write_i_9685]
  522. let {f32 v_7581} = res_7363[write_i_9685]
  523. let {i32 v_7582} = res_7360[write_i_9685]
  524. let {i32 v_7583} = res_7361[write_i_9685]
  525. let {f32 v_7584} = res_7364[write_i_9685]
  526. let {i32 v_7585} = surface_types_7181[write_i_9685]
  527. let {f32 v_7586} = surface_hsv_hs_7184[write_i_9685]
  528. let {f32 v_7587} = surface_hsv_ss_7187[write_i_9685]
  529. let {f32 v_7588} = surface_hsv_vs_7190[write_i_9685]
  530. let {i32 v_7589} = surface_indices_7193[write_i_9685]
  531. let {bool is_this_one_7590} = eq_i32(c_7574, 0i32)
  532. let {i32 this_offset_7591} = add_nw32(-1i32, offset_7575)
  533. let {i32 total_res_7592} =
  534. -- Branch returns: {i32}
  535. if is_this_one_7590
  536. then {this_offset_7591} else {-1i32}
  537. return {partition_dest_7546 with ([total_res_7592 < n_7113] <- v_7576),
  538. partition_dest_7547 with ([total_res_7592 < n_7113] <- v_7577),
  539. partition_dest_7548 with ([total_res_7592 < n_7113] <- v_7578),
  540. partition_dest_7549 with ([total_res_7592 < n_7113] <- v_7579),
  541. partition_dest_7550 with ([total_res_7592 < n_7113] <- v_7580),
  542. partition_dest_7551 with ([total_res_7592 < n_7113] <- v_7581),
  543. partition_dest_7552 with ([total_res_7592 < n_7113] <- v_7582),
  544. partition_dest_7553 with ([total_res_7592 < n_7113] <- v_7583),
  545. partition_dest_7554 with ([total_res_7592 < n_7113] <- v_7584),
  546. partition_dest_7555 with ([total_res_7592 < n_7113] <- v_7585),
  547. partition_dest_7556 with ([total_res_7592 < n_7113] <- v_7586),
  548. partition_dest_7557 with ([total_res_7592 < n_7113] <- v_7587),
  549. partition_dest_7558 with ([total_res_7592 < n_7113] <- v_7588),
  550. partition_dest_7559 with ([total_res_7592 < n_7113] <- v_7589)}
  551. }
  552. let {bool empty_slice_7593} = eq_i32(partition_size_7544, 0i32)
  553. let {i32 m_7594} = sub32(partition_size_7544, 1i32)
  554. let {bool zero_leq_i_p_m_t_s_7595} = sle32(0i32, m_7594)
  555. let {bool i_p_m_t_s_leq_w_7596} = slt32(m_7594, n_7113)
  556. let {bool i_lte_j_7597} = sle32(0i32, partition_size_7544)
  557. let {bool y_7598} = logand(zero_leq_i_p_m_t_s_7595, i_p_m_t_s_leq_w_7596)
  558. let {bool y_7599} = logand(i_lte_j_7597, y_7598)
  559. let {bool ok_or_empty_7600} = logor(empty_slice_7593, y_7599)
  560. let {cert index_certs_7601} =
  561. assert(ok_or_empty_7600, "Index [:", partition_size_7544,
  562. "] out of bounds for array of shape [", n_7113,
  563. "].", "/prelude/soacs.fut:141:6-16")
  564. -- res_7602 aliases partition_res_7560
  565. let {[partition_size_7544]i32 res_7602} =
  566. <index_certs_7601>
  567. partition_res_7560[0i32:+partition_size_7544*1i32]
  568. -- res_7603 aliases partition_res_7561
  569. let {[partition_size_7544]i32 res_7603} =
  570. <index_certs_7601>
  571. partition_res_7561[0i32:+partition_size_7544*1i32]
  572. -- res_7604 aliases partition_res_7562
  573. let {[partition_size_7544]f32 res_7604} =
  574. <index_certs_7601>
  575. partition_res_7562[0i32:+partition_size_7544*1i32]
  576. -- res_7605 aliases partition_res_7563
  577. let {[partition_size_7544]i32 res_7605} =
  578. <index_certs_7601>
  579. partition_res_7563[0i32:+partition_size_7544*1i32]
  580. -- res_7606 aliases partition_res_7564
  581. let {[partition_size_7544]i32 res_7606} =
  582. <index_certs_7601>
  583. partition_res_7564[0i32:+partition_size_7544*1i32]
  584. -- res_7607 aliases partition_res_7565
  585. let {[partition_size_7544]f32 res_7607} =
  586. <index_certs_7601>
  587. partition_res_7565[0i32:+partition_size_7544*1i32]
  588. -- res_7608 aliases partition_res_7566
  589. let {[partition_size_7544]i32 res_7608} =
  590. <index_certs_7601>
  591. partition_res_7566[0i32:+partition_size_7544*1i32]
  592. -- res_7609 aliases partition_res_7567
  593. let {[partition_size_7544]i32 res_7609} =
  594. <index_certs_7601>
  595. partition_res_7567[0i32:+partition_size_7544*1i32]
  596. -- res_7610 aliases partition_res_7568
  597. let {[partition_size_7544]f32 res_7610} =
  598. <index_certs_7601>
  599. partition_res_7568[0i32:+partition_size_7544*1i32]
  600. -- res_7611 aliases partition_res_7569
  601. let {[partition_size_7544]i32 res_7611} =
  602. <index_certs_7601>
  603. partition_res_7569[0i32:+partition_size_7544*1i32]
  604. -- res_7612 aliases partition_res_7570
  605. let {[partition_size_7544]f32 res_7612} =
  606. <index_certs_7601>
  607. partition_res_7570[0i32:+partition_size_7544*1i32]
  608. -- res_7613 aliases partition_res_7571
  609. let {[partition_size_7544]f32 res_7613} =
  610. <index_certs_7601>
  611. partition_res_7571[0i32:+partition_size_7544*1i32]
  612. -- res_7614 aliases partition_res_7572
  613. let {[partition_size_7544]f32 res_7614} =
  614. <index_certs_7601>
  615. partition_res_7572[0i32:+partition_size_7544*1i32]
  616. -- res_7615 aliases partition_res_7573
  617. let {[partition_size_7544]i32 res_7615} =
  618. <index_certs_7601>
  619. partition_res_7573[0i32:+partition_size_7544*1i32]
  620. let {bool cond_7616} = eq_i32(render_approach_7130, 1i32)
  621. let {[partition_size_7544]i32 res_7617} = iota32(partition_size_7544, 0i32,
  622. 1i32)
  623. let {i32 replicate_arg_7618} = mul32(w_7133, h_7134)
  624. let {[w_7133][h_7134]i32 res_7619} =
  625. -- Branch returns: {[w_7133][h_7134]i32}
  626. if cond_7616
  627. then {
  628. let {i64 partition_size_9694} = sext i32 partition_size_7544 to i64
  629. let {i64 nest_size_9695} = mul_nw64(partition_size_9694, 1i64)
  630. let {i32 segscan_group_size_9697} =
  631. get_size(segscan_group_size_9696, group_size)
  632. let {i32 num_groups_9699} =
  633. calc_num_groups(nest_size_9695, segscan_num_groups_9698,
  634. segscan_group_size_9697)
  635. let {i32 num_threads_9700} =
  636. mul_nw32(num_groups_9699, segscan_group_size_9697)
  637. let {[partition_size_7544]i32 res_7647, [partition_size_7544]i32 res_7648,
  638. [partition_size_7544]i32 res_7649, [partition_size_7544]i32 res_7650,
  639. [partition_size_7544]i32 res_7651, [partition_size_7544]i32 res_7652,
  640. [partition_size_7544]i32 res_7653,
  641. [partition_size_7544]i32 res_7654} =
  642. segscan_thread
  643. (#groups=num_groups_9699; groupsize=segscan_group_size_9697)
  644. ({{0i32},
  645. [],
  646. fn {i32} (i32 x_7655, i32 x_7656) =>
  647. let {i32 res_7657} = add32(x_7655, x_7656)
  648. in {res_7657}})
  649. (gtid_9701 < partition_size_7544) (~phys_tid_9702) : {i32, i32, i32,
  650. i32, i32, i32,
  651. i32, i32} {
  652. let {i32 x_7658} = res_7602[gtid_9701]
  653. let {i32 x_7659} = res_7603[gtid_9701]
  654. let {i32 x_7660} = res_7605[gtid_9701]
  655. let {i32 x_7661} = res_7606[gtid_9701]
  656. let {i32 x_7662} = res_7608[gtid_9701]
  657. let {i32 x_7663} = res_7609[gtid_9701]
  658. let {bool cond_7664} = slt32(x_7661, x_7659)
  659. let {i32 res_7665} =
  660. -- Branch returns: {i32}
  661. if cond_7664
  662. then {x_7660} else {x_7658}
  663. let {i32 res_7666} =
  664. -- Branch returns: {i32}
  665. if cond_7664
  666. then {x_7661} else {x_7659}
  667. let {i32 res_7667} =
  668. -- Branch returns: {i32}
  669. if cond_7664
  670. then {x_7658} else {x_7660}
  671. let {i32 res_7668} =
  672. -- Branch returns: {i32}
  673. if cond_7664
  674. then {x_7659} else {x_7661}
  675. let {bool cond_7669} = slt32(x_7663, res_7668)
  676. let {i32 res_7670} =
  677. -- Branch returns: {i32}
  678. if cond_7669
  679. then {x_7662} else {res_7667}
  680. let {i32 res_7671} =
  681. -- Branch returns: {i32}
  682. if cond_7669
  683. then {x_7663} else {res_7668}
  684. let {i32 res_7672} =
  685. -- Branch returns: {i32}
  686. if cond_7669
  687. then {res_7667} else {x_7662}
  688. let {i32 res_7673} =
  689. -- Branch returns: {i32}
  690. if cond_7669
  691. then {res_7668} else {x_7663}
  692. let {bool cond_7674} = slt32(res_7671, res_7666)
  693. let {i32 res_7675} =
  694. -- Branch returns: {i32}
  695. if cond_7674
  696. then {res_7670} else {res_7665}
  697. let {i32 res_7676} =
  698. -- Branch returns: {i32}
  699. if cond_7674
  700. then {res_7671} else {res_7666}
  701. let {i32 res_7677} =
  702. -- Branch returns: {i32}
  703. if cond_7674
  704. then {res_7665} else {res_7670}
  705. let {i32 res_7678} =
  706. -- Branch returns: {i32}
  707. if cond_7674
  708. then {res_7666} else {res_7671}
  709. let {i32 x_7679} = sub32(res_7673, res_7676)
  710. let {i32 res_7680} = add32(1i32, x_7679)
  711. return {returns res_7680, returns res_7680, returns res_7675,
  712. returns res_7676, returns res_7677, returns res_7678,
  713. returns res_7672, returns res_7673}
  714. }
  715. -- res_7689 aliases res_7647
  716. let {[partition_size_7544]i32 res_7689} = rotate((-1i32), res_7647)
  717. let {i64 partition_size_9703} = sext i32 partition_size_7544 to i64
  718. let {i64 nest_size_9704} = mul_nw64(partition_size_9703, 1i64)
  719. let {i32 segred_group_size_9706} =
  720. get_size(segred_group_size_9705, group_size)
  721. let {i32 num_groups_9708} =
  722. calc_num_groups(nest_size_9704, segred_num_groups_9707,
  723. segred_group_size_9706)
  724. let {i32 num_threads_9709} =
  725. mul_nw32(num_groups_9708, segred_group_size_9706)
  726. let {[1i32]i32 res_9710} =
  727. segred_thread
  728. (#groups=num_groups_9708; groupsize=segred_group_size_9706)
  729. ({{0i32},
  730. [],
  731. commutative fn {i32} (i32 x_7691, i32 x_7692) =>
  732. let {i32 res_7693} = add32(x_7691, x_7692)
  733. in {res_7693}})
  734. (dummy_9711 < 1i32,
  735. gtid_9712 < partition_size_7544) (~phys_tid_9713) : {i32} {
  736. let {i32 x_7694} = res_7648[gtid_9712]
  737. return {returns x_7694}
  738. }
  739. let {i32 res_7690} = res_9710[0i32]
  740. let {bool bounds_invalid_upwards_7695} = slt32(res_7690, 0i32)
  741. let {bool valid_7696} = not bounds_invalid_upwards_7695
  742. let {cert range_valid_c_7697} =
  743. assert(valid_7696, "Range ", 0i32, "..", 1i32, "..<", res_7690,
  744. " is invalid.", "/prelude/math.fut:453:23-30")
  745. let {[res_7690]i32 res_7698} = replicate([res_7690], 0i32)
  746. let {i64 partition_size_9714} = sext i32 partition_size_7544 to i64
  747. let {i64 nest_size_9715} = mul_nw64(partition_size_9714, 1i64)
  748. let {i32 seghist_group_size_9717} =
  749. get_size(seghist_group_size_9716, group_size)
  750. let {i32 num_groups_9719} =
  751. calc_num_groups(nest_size_9715, seghist_num_groups_9718,
  752. seghist_group_size_9717)
  753. let {i32 num_threads_9720} =
  754. mul_nw32(num_groups_9719, seghist_group_size_9717)
  755. let {[res_7690]i32 res_7699} =
  756. -- Consumes res_7698
  757. seghist_thread
  758. (#groups=num_groups_9719; groupsize=seghist_group_size_9717)
  759. _thread
  760. (#groups=num_groups_9719; groupsize=seghist_group_size_9717)
  761. ({res_7690, 1i32,
  762. {res_7698},
  763. {0i32},
  764. [],
  765. fn {i32} (i32 x_9723, i32 x_9724) =>
  766. let {i32 res_9725} =
  767. <range_valid_c_7697>
  768. smax32(x_9723, x_9724)
  769. in {res_9725}})
  770. (gtid_9721 < partition_size_7544) (~phys_tid_9722) : {i32, i32} {
  771. let {i32 x_9726} = res_7617[gtid_9721]
  772. let {i32 x_9727} = res_7689[gtid_9721]
  773. let {bool cond_9728} = eq_i32(x_9726, 0i32)
  774. let {i32 res_9729} =
  775. -- Branch returns: {i32}
  776. if cond_9728
  777. then {0i32} else {x_9727}
  778. return {returns res_9729, returns x_9726}
  779. }
  780. let {i64 res_9730} = sext i32 res_7690 to i64
  781. let {i64 nest_size_9731} = mul_nw64(res_9730, 1i64)
  782. let {i32 segscan_group_size_9733} =
  783. get_size(segscan_group_size_9732, group_size)
  784. let {i32 num_groups_9735} =
  785. calc_num_groups(nest_size_9731, segscan_num_groups_9734,
  786. segscan_group_size_9733)
  787. let {i32 num_threads_9736} =
  788. mul_nw32(num_groups_9735, segscan_group_size_9733)
  789. let {[res_7690]bool res_7707, [res_7690]i32 res_7708} =
  790. segscan_thread
  791. (#groups=num_groups_9735; groupsize=segscan_group_size_9733)
  792. ({{false, 0i32},
  793. [],
  794. fn {bool, i32} (bool x_7709, i32 x_7710, bool x_7711, i32 x_7712) =>
  795. let {bool res_7713} = logor(x_7709, x_7711)
  796. let {i32 res_7714} =
  797. -- Branch returns: {i32}
  798. if x_7711
  799. then {x_7712} else {
  800. let {i32 res_7715} = add32(x_7710, x_7712)
  801. in {res_7715}
  802. }
  803. in {res_7713, res_7714}})
  804. (gtid_9737 < res_7690) (~phys_tid_9738) : {bool, i32} {
  805. let {i32 x_7716} = res_7699[gtid_9737]
  806. let {bool res_7717} = slt32(0i32, x_7716)
  807. return {returns res_7717, returns x_7716}
  808. }
  809. -- res_7718 aliases res_7708
  810. let {[res_7690]i32 res_7718} = rotate((-1i32), res_7708)
  811. let {[res_7690]i32 res_7719} = replicate([res_7690], 1i32)
  812. let {i32 chunk_7833} = res_7690
  813. let {bool inpacc_7834} = false
  814. let {i32 inpacc_7835} = 0i32
  815. let {i32 inpacc_7836} = 0i32
  816. -- inp_7837 aliases res_7719
  817. let {[chunk_7833]i32 inp_7837} = reshape((~chunk_7833), res_7719)
  818. -- inp_7838 aliases res_7708
  819. let {[chunk_7833]i32 inp_7838} = reshape((~chunk_7833), res_7708)
  820. -- inp_7839 aliases res_7718
  821. let {[chunk_7833]i32 inp_7839} = reshape((~chunk_7833), res_7718)
  822. let {i64 chunk_9739} = sext i32 chunk_7833 to i64
  823. let {i64 nest_size_9740} = mul_nw64(chunk_9739, 1i64)
  824. let {i32 segscan_group_size_9742} =
  825. get_size(segscan_group_size_9741, group_size)
  826. let {i32 num_groups_9744} =
  827. calc_num_groups(nest_size_9740, segscan_num_groups_9743,
  828. segscan_group_size_9742)
  829. let {i32 num_threads_9745} =
  830. mul_nw32(num_groups_9744, segscan_group_size_9742)
  831. let {[chunk_7833]bool resarr0_7840, [chunk_7833]i32 resarr0_7841} =
  832. segscan_thread
  833. (#groups=num_groups_9744; groupsize=segscan_group_size_9742)
  834. ({{false, 0i32},
  835. [],
  836. fn {bool, i32} (bool x_7842, i32 x_7843, bool x_7844, i32 x_7845) =>
  837. let {bool res_7846} = logor(x_7842, x_7844)
  838. let {i32 res_7847} =
  839. -- Branch returns: {i32}
  840. if x_7844
  841. then {x_7845} else {
  842. let {i32 res_7848} = add32(x_7843, x_7845)
  843. in {res_7848}
  844. }
  845. in {res_7846, res_7847}})
  846. (gtid_9746 < chunk_7833) (~phys_tid_9747) : {bool, i32} {
  847. let {i32 x_7849} = inp_7838[gtid_9746]
  848. let {i32 x_7850} = inp_7839[gtid_9746]
  849. let {i32 x_7851} = inp_7837[gtid_9746]
  850. let {bool res_7852} = eq_i32(x_7849, x_7850)
  851. let {bool res_7853} = not res_7852
  852. return {returns res_7853, returns x_7851}
  853. }
  854. let {i32 szm1_7854} = sub_nw32(chunk_7833, 1i32)
  855. let {bool empty_arr_7855} = slt32(szm1_7854, 0i32)
  856. let {bool lstel_7856, i32 lstel_7857} =
  857. -- Branch returns: {bool, i32}
  858. if empty_arr_7855
  859. then {false, 0i32} else {
  860. let {bool lstel_tmp_7858} = resarr0_7840[szm1_7854]
  861. let {i32 lstel_tmp_7859} = resarr0_7841[szm1_7854]
  862. in {lstel_tmp_7858, lstel_tmp_7859}
  863. }
  864. let {bool res_7860} = logor(inpacc_7834, lstel_7856)
  865. let {i32 res_7861} =
  866. -- Branch returns: {i32}
  867. if lstel_7856
  868. then {lstel_7857} else {
  869. let {i32 res_7862} = add32(inpacc_7835, lstel_7857)
  870. in {res_7862}
  871. }
  872. let {i64 chunk_9748} = sext i32 chunk_7833 to i64
  873. let {i64 nest_size_9749} = mul_nw64(chunk_9748, 1i64)
  874. let {i32 segscan_group_size_9751} =
  875. get_size(segscan_group_size_9750, group_size)
  876. let {i32 num_groups_9753} =
  877. calc_num_groups(nest_size_9749, segscan_num_groups_9752,
  878. segscan_group_size_9751)
  879. let {i32 num_threads_9754} =
  880. mul_nw32(num_groups_9753, segscan_group_size_9751)
  881. let {[chunk_7833]i32 resarr0_7932, [chunk_7833]i32 map_res_7933,
  882. [chunk_7833]i32 res_7934, [chunk_7833]i32 res_7935,
  883. [chunk_7833]i32 res_7936, [chunk_7833]i32 res_7937} =
  884. segscan_thread
  885. (#groups=num_groups_9753; groupsize=segscan_group_size_9751)
  886. ({{0i32},
  887. [],
  888. fn {i32} (i32 x_7938, i32 x_7939) =>
  889. let {i32 res_7940} = add32(x_7938, x_7939)
  890. in {res_7940}})
  891. (gtid_9755 < chunk_7833) (~phys_tid_9756) : {i32, i32, i32, i32, i32,
  892. i32} {
  893. let {bool x_7941} = resarr0_7840[gtid_9755]
  894. let {i32 x_7942} = resarr0_7841[gtid_9755]
  895. let {i32 x_7943} = inp_7838[gtid_9755]
  896. let {i32 res_7944} =
  897. -- Branch returns: {i32}
  898. if x_7941
  899. then {x_7942} else {
  900. let {i32 res_7945} = add32(inpacc_7835, x_7942)
  901. in {res_7945}
  902. }
  903. let {i32 res_7946} = sub32(res_7944, 1i32)
  904. let {bool x_7947} = sle32(0i32, x_7943)
  905. let {bool y_7948} = slt32(x_7943, partition_size_7544)
  906. let {bool bounds_check_7949} = logand(x_7947, y_7948)
  907. let {cert index_certs_7950} =
  908. assert(bounds_check_7949, "Index [", x_7943,
  909. "] out of bounds for array of shape [",
  910. partition_size_7544, "].",
  911. "futracerlib/lib/github.com/diku-dk/segmented/segmented.fut:74:24-29")
  912. let {i32 lifted_0_get_arg_7951} =
  913. <index_certs_7950>
  914. res_7649[x_7943]
  915. let {i32 lifted_0_get_arg_7952} =
  916. <index_certs_7950>
  917. res_7650[x_7943]
  918. let {i32 lifted_0_get_arg_7953} =
  919. <index_certs_7950>
  920. res_7651[x_7943]
  921. let {i32 lifted_0_get_arg_7954} =
  922. <index_certs_7950>
  923. res_7652[x_7943]
  924. let {i32 lifted_0_get_arg_7955} =
  925. <index_certs_7950>
  926. res_7653[x_7943]
  927. let {i32 lifted_0_get_arg_7956} =
  928. <index_certs_7950>
  929. res_7654[x_7943]
  930. let {i32 y_7957} = add32(res_7946, lifted_0_get_arg_7952)
  931. let {i32 y_7958} = sub32(lifted_0_get_arg_7954, lifted_0_get_arg_7952)
  932. let {bool cond_7959} = sle32(res_7946, y_7958)
  933. let {i32 res_7960, i32 res_7961} =
  934. -- Branch returns: {i32, i32}
  935. if cond_7959
  936. then {
  937. let {i32 dx_7962} =
  938. sub32(lifted_0_get_arg_7953, lifted_0_get_arg_7951)
  939. let {bool cond_7963} = eq_i32(y_7958, 0i32)
  940. let {f32 res_7964} =
  941. -- Branch returns: {f32}
  942. if cond_7963
  943. then {0.0f32} else {
  944. let {f32 res_7965} = sitofp i32 y_7958 to f32
  945. let {f32 res_7966} = sitofp i32 dx_7962 to f32
  946. let {f32 res_7967} = fdiv32(res_7966, res_7965)
  947. in {res_7967}
  948. }
  949. let {i32 dx_7968} =
  950. sub32(lifted_0_get_arg_7955, lifted_0_get_arg_7951)
  951. let {i32 dy_7969} =
  952. sub32(lifted_0_get_arg_7956, lifted_0_get_arg_7952)
  953. let {bool cond_7970} = eq_i32(dy_7969, 0i32)
  954. let {f32 res_7971} =
  955. -- Branch returns: {f32}
  956. if cond_7970
  957. then {0.0f32} else {
  958. let {f32 res_7972} = sitofp i32 dy_7969 to f32
  959. let {f32 res_7973} = sitofp i32 dx_7968 to f32
  960. let {f32 res_7974} = fdiv32(res_7973, res_7972)
  961. in {res_7974}
  962. }
  963. let {f32 res_7975} = sitofp i32 res_7946 to f32
  964. let {f32 f32_arg_7976} = fmul32(res_7964, res_7975)
  965. let {i32 res_7977} = fptosi f32 f32_arg_7976 to i32
  966. let {i32 x1_7978} = add32(lifted_0_get_arg_7951, res_7977)
  967. let {f32 f32_arg_7979} = fmul32(res_7971, res_7975)
  968. let {i32 res_7980} = fptosi f32 f32_arg_7979 to i32
  969. let {i32 x2_7981} = add32(lifted_0_get_arg_7951, res_7980)
  970. in {x1_7978, x2_7981}
  971. } else {
  972. let {i32 dx_7982} =
  973. sub32(lifted_0_get_arg_7951, lifted_0_get_arg_7955)
  974. let {i32 dy_7983} =
  975. sub32(lifted_0_get_arg_7952, lifted_0_get_arg_7956)
  976. let {bool cond_7984} = eq_i32(dy_7983, 0i32)
  977. let {f32 res_7985} =
  978. -- Branch returns: {f32}
  979. if cond_7984
  980. then {0.0f32} else {
  981. let {f32 res_7986} = sitofp i32 dy_7983 to f32
  982. let {f32 res_7987} = sitofp i32 dx_7982 to f32
  983. let {f32 res_7988} = fdiv32(res_7987, res_7986)
  984. in {res_7988}
  985. }
  986. let {i32 dx_7989} =
  987. sub32(lifted_0_get_arg_7953, lifted_0_get_arg_7955)
  988. let {i32 dy_7990} =
  989. sub32(lifted_0_get_arg_7954, lifted_0_get_arg_7956)
  990. let {bool cond_7991} = eq_i32(dy_7990, 0i32)
  991. let {f32 res_7992} =
  992. -- Branch returns: {f32}
  993. if cond_7991
  994. then {0.0f32} else {
  995. let {f32 res_7993} = sitofp i32 dy_7990 to f32
  996. let {f32 res_7994} = sitofp i32 dx_7989 to f32
  997. let {f32 res_7995} = fdiv32(res_7994, res_7993)
  998. in {res_7995}
  999. }
  1000. let {i32 x_7996} =
  1001. sub32(lifted_0_get_arg_7956, lifted_0_get_arg_7952)
  1002. let {i32 dy_7997} = sub32(x_7996, res_7946)
  1003. let {f32 res_7998} = sitofp i32 dy_7997 to f32
  1004. let {f32 f32_arg_7999} = fmul32(res_7985, res_7998)
  1005. let {i32 res_8000} = fptosi f32 f32_arg_7999 to i32
  1006. let {i32 x1_8001} = sub32(lifted_0_get_arg_7955, res_8000)
  1007. let {f32 f32_arg_8002} = fmul32(res_7992, res_7998)
  1008. let {i32 res_8003} = fptosi f32 f32_arg_8002 to i32
  1009. let {i32 x2_8004} = sub32(lifted_0_get_arg_7955, res_8003)
  1010. in {x1_8001, x2_8004}
  1011. }
  1012. let {i32 res_elem_8005} =
  1013. <index_certs_7950>
  1014. x_7943
  1015. let {i32 res_8006} = sub32(y_7957, y_7957)
  1016. let {i32 res_8007} = abs32 res_8006
  1017. let {i32 res_8008} = sub32(res_7961, res_7960)
  1018. let {i32 res_8009} = abs32 res_8008
  1019. let {i32 res_8010} = smax32(res_8007, res_8009)
  1020. let {i32 res_8011} = add32(1i32, res_8010)
  1021. return {returns res_8011, returns res_8011, returns res_7960,
  1022. returns y_7957, returns res_7961, returns res_elem_8005}
  1023. }
  1024. let {i32 lstel_8020} =
  1025. -- Branch returns: {i32}
  1026. if empty_arr_7855
  1027. then {0i32} else {
  1028. let {i32 lstel_tmp_8021} = resarr0_7932[szm1_7854]
  1029. in {lstel_tmp_8021}
  1030. }
  1031. let {i32 comparatee_9757} = mul_nw32(chunk_7833, 1i32)
  1032. let {bool suff_outer_par_9758} =
  1033. get_size(suff_outer_par_0, threshold ()) <= comparatee_9757
  1034. let {i64 chunk_9790} = sext i32 chunk_7833 to i64
  1035. let {i64 nest_size_9791} = mul_nw64(chunk_9790, 1i64)
  1036. let {i32 segmap_group_size_9792} =
  1037. get_size(segmap_group_size_9783, group_size)
  1038. let {i64 segmap_group_size_9793} = sext i32 segmap_group_size_9792 to i64
  1039. let {i64 segmap_usable_groups_64_9794} =
  1040. sdiv_up64(nest_size_9791, segmap_group_size_9793)
  1041. let {i32 segmap_usable_groups_9795} =
  1042. sext i64 segmap_usable_groups_64_9794 to i32
  1043. let {[chunk_7833]i32 res_9796} =
  1044. segmap_thread
  1045. (#groups=segmap_usable_groups_9795; groupsize=segmap_group_size_9792)
  1046. (gtid_9779 < chunk_7833) (~phys_tid_9780) : {i32} {
  1047. let {i32 x_9797} = resarr0_7932[gtid_9779]
  1048. let {i32 res_9798} = add32(inpacc_7836, x_9797)
  1049. return {returns res_9798}
  1050. }
  1051. -- res_8022 aliases res_9796
  1052. let {[chunk_7833]i32 res_8022} = res_9796
  1053. let {i32 res_8025} = add32(inpacc_7836, lstel_8020)
  1054. let {bool inpacc_7824} = res_7860
  1055. let {i32 inpacc_7825} = res_7861
  1056. let {i32 inpacc_7826} = res_8025
  1057. -- res_7827 aliases res_8022
  1058. let {[res_7690]i32 res_7827} = reshape((~res_7690), res_8022)
  1059. -- res_7828 aliases map_res_7933
  1060. let {[res_7690]i32 res_7828} = reshape((~res_7690), map_res_7933)
  1061. -- res_7829 aliases res_7934
  1062. let {[res_7690]i32 res_7829} = reshape((~res_7690), res_7934)
  1063. -- res_7830 aliases res_7935
  1064. let {[res_7690]i32 res_7830} = reshape((~res_7690), res_7935)
  1065. -- res_7831 aliases res_7936
  1066. let {[res_7690]i32 res_7831} = reshape((~res_7690), res_7936)
  1067. -- res_7832 aliases res_7937
  1068. let {[res_7690]i32 res_7832} = reshape((~res_7690), res_7937)
  1069. -- res_8035 aliases res_7827
  1070. let {[res_7690]i32 res_8035} = rotate((-1i32), res_7827)
  1071. let {[res_7690]i32 res_8036} = iota32(res_7690, 0i32, 1i32)
  1072. let {i64 res_9799} = sext i32 res_7690 to i64
  1073. let {i64 nest_size_9800} = mul_nw64(res_9799, 1i64)
  1074. let {i32 segred_group_size_9802} =
  1075. get_size(segred_group_size_9801, group_size)
  1076. let {i32 num_groups_9804} =
  1077. calc_num_groups(nest_size_9800, segred_num_groups_9803,
  1078. segred_group_size_9802)
  1079. let {i32 num_threads_9805} =
  1080. mul_nw32(num_groups_9804, segred_group_size_9802)
  1081. let {[1i32]i32 res_9806} =
  1082. segred_thread
  1083. (#groups=num_groups_9804; groupsize=segred_group_size_9802)
  1084. ({{0i32},
  1085. [],
  1086. commutative fn {i32} (i32 x_8038, i32 x_8039) =>
  1087. let {i32 res_8040} = add32(x_8038, x_8039)
  1088. in {res_8040}})
  1089. (dummy_9807 < 1i32, gtid_9808 < res_7690) (~phys_tid_9809) : {i32} {
  1090. let {i32 x_8041} = res_7828[gtid_9808]
  1091. return {returns x_8041}
  1092. }
  1093. let {i32 res_8037} = res_9806[0i32]
  1094. let {bool bounds_invalid_upwards_8042} = slt32(res_8037, 0i32)
  1095. let {bool valid_8043} = not bounds_invalid_upwards_8042
  1096. let {cert range_valid_c_8044} =
  1097. assert(valid_8043, "Range ", 0i32, "..", 1i32, "..<", res_8037,
  1098. " is invalid.", "/prelude/math.fut:453:23-30")
  1099. let {[res_8037]i32 res_8045} = replicate([res_8037], 0i32)
  1100. let {i64 res_9810} = sext i32 res_7690 to i64
  1101. let {i64 nest_size_9811} = mul_nw64(res_9810, 1i64)
  1102. let {i32 seghist_group_size_9813} =
  1103. get_size(seghist_group_size_9812, group_size)
  1104. let {i32 num_groups_9815} =
  1105. calc_num_groups(nest_size_9811, seghist_num_groups_9814,
  1106. seghist_group_size_9813)
  1107. let {i32 num_threads_9816} =
  1108. mul_nw32(num_groups_9815, seghist_group_size_9813)
  1109. let {[res_8037]i32 res_8046} =
  1110. -- Consumes res_8045
  1111. seghist_thread
  1112. (#groups=num_groups_9815; groupsize=seghist_group_size_9813)
  1113. _thread
  1114. (#groups=num_groups_9815; groupsize=seghist_group_size_9813)
  1115. ({res_8037, 1i32,
  1116. {res_8045},
  1117. {0i32},
  1118. [],
  1119. fn {i32} (i32 x_9819, i32 x_9820) =>
  1120. let {i32 res_9821} =
  1121. <range_valid_c_8044>
  1122. smax32(x_9819, x_9820)
  1123. in {res_9821}})
  1124. (gtid_9817 < res_7690) (~phys_tid_9818) : {i32, i32} {
  1125. let {i32 x_9822} = res_8036[gtid_9817]
  1126. let {i32 x_9823} = res_8035[gtid_9817]
  1127. let {bool cond_9824} = eq_i32(x_9822, 0i32)
  1128. let {i32 res_9825} =
  1129. -- Branch returns: {i32}
  1130. if cond_9824
  1131. then {0i32} else {x_9823}
  1132. return {returns res_9825, returns x_9822}
  1133. }
  1134. let {i64 res_9826} = sext i32 res_8037 to i64
  1135. let {i64 nest_size_9827} = mul_nw64(res_9826, 1i64)
  1136. let {i32 segscan_group_size_9829} =
  1137. get_size(segscan_group_size_9828, group_size)
  1138. let {i32 num_groups_9831} =
  1139. calc_num_groups(nest_size_9827, segscan_num_groups_9830,
  1140. segscan_group_size_9829)
  1141. let {i32 num_threads_9832} =
  1142. mul_nw32(num_groups_9831, segscan_group_size_9829)
  1143. let {[res_8037]bool res_8054, [res_8037]i32 res_8055} =
  1144. segscan_thread
  1145. (#groups=num_groups_9831; groupsize=segscan_group_size_9829)
  1146. ({{false, 0i32},
  1147. [],
  1148. fn {bool, i32} (bool x_8056, i32 x_8057, bool x_8058, i32 x_8059) =>
  1149. let {bool res_8060} = logor(x_8056, x_8058)
  1150. let {i32 res_8061} =
  1151. -- Branch returns: {i32}
  1152. if x_8058
  1153. then {x_8059} else {
  1154. let {i32 res_8062} = add32(x_8057, x_8059)
  1155. in {res_8062}
  1156. }
  1157. in {res_8060, res_8061}})
  1158. (gtid_9833 < res_8037) (~phys_tid_9834) : {bool, i32} {
  1159. let {i32 x_8063} = res_8046[gtid_9833]
  1160. let {bool res_8064} = slt32(0i32, x_8063)
  1161. return {returns res_8064, returns x_8063}
  1162. }
  1163. -- res_8065 aliases res_8055
  1164. let {[res_8037]i32 res_8065} = rotate((-1i32), res_8055)
  1165. let {[res_8037]i32 res_8066} = replicate([res_8037], 1i32)
  1166. let {i32 chunk_8156} = res_8037
  1167. let {bool inpacc_8157} = false
  1168. let {i32 inpacc_8158} = 0i32
  1169. let {i32 inpacc_8159} = 0i32
  1170. -- inp_8160 aliases res_8066
  1171. let {[chunk_8156]i32 inp_8160} = reshape((~chunk_8156), res_8066)
  1172. -- inp_8161 aliases res_8055
  1173. let {[chunk_8156]i32 inp_8161} = reshape((~chunk_8156), res_8055)
  1174. -- inp_8162 aliases res_8065
  1175. let {[chunk_8156]i32 inp_8162} = reshape((~chunk_8156), res_8065)
  1176. let {i64 chunk_9835} = sext i32 chunk_8156 to i64
  1177. let {i64 nest_size_9836} = mul_nw64(chunk_9835, 1i64)
  1178. let {i32 segscan_group_size_9838} =
  1179. get_size(segscan_group_size_9837, group_size)
  1180. let {i32 num_groups_9840} =
  1181. calc_num_groups(nest_size_9836, segscan_num_groups_9839,
  1182. segscan_group_size_9838)
  1183. let {i32 num_threads_9841} =
  1184. mul_nw32(num_groups_9840, segscan_group_size_9838)
  1185. let {[chunk_8156]bool resarr0_8163, [chunk_8156]i32 resarr0_8164} =
  1186. segscan_thread
  1187. (#groups=num_groups_9840; groupsize=segscan_group_size_9838)
  1188. ({{false, 0i32},
  1189. [],
  1190. fn {bool, i32} (bool x_8165, i32 x_8166, bool x_8167, i32 x_8168) =>
  1191. let {bool res_8169} = logor(x_8165, x_8167)
  1192. let {i32 res_8170} =
  1193. -- Branch returns: {i32}
  1194. if x_8167
  1195. then {x_8168} else {
  1196. let {i32 res_8171} = add32(x_8166, x_8168)
  1197. in {res_8171}
  1198. }
  1199. in {res_8169, res_8170}})
  1200. (gtid_9842 < chunk_8156) (~phys_tid_9843) : {bool, i32} {
  1201. let {i32 x_8172} = inp_8161[gtid_9842]
  1202. let {i32 x_8173} = inp_8162[gtid_9842]
  1203. let {i32 x_8174} = inp_8160[gtid_9842]
  1204. let {bool res_8175} = eq_i32(x_8172, x_8173)
  1205. let {bool res_8176} = not res_8175
  1206. return {returns res_8176, returns x_8174}
  1207. }
  1208. let {i32 szm1_8177} = sub_nw32(chunk_8156, 1i32)
  1209. let {bool empty_arr_8178} = slt32(szm1_8177, 0i32)
  1210. let {bool lstel_8179, i32 lstel_8180} =
  1211. -- Branch returns: {bool, i32}
  1212. if empty_arr_8178
  1213. then {false, 0i32} else {
  1214. let {bool lstel_tmp_8181} = resarr0_8163[szm1_8177]
  1215. let {i32 lstel_tmp_8182} = resarr0_8164[szm1_8177]
  1216. in {lstel_tmp_8181, lstel_tmp_8182}
  1217. }
  1218. let {bool res_8183} = logor(inpacc_8157, lstel_8179)
  1219. let {i32 res_8184} =
  1220. -- Branch returns: {i32}
  1221. if lstel_8179
  1222. then {lstel_8180} else {
  1223. let {i32 res_8185} = add32(inpacc_8158, lstel_8180)
  1224. in {res_8185}
  1225. }
  1226. let {i64 chunk_9844} = sext i32 chunk_8156 to i64
  1227. let {i64 nest_size_9845} = mul_nw64(chunk_9844, 1i64)
  1228. let {i32 segscan_group_size_9847} =
  1229. get_size(segscan_group_size_9846, group_size)
  1230. let {i32 num_groups_9849} =
  1231. calc_num_groups(nest_size_9845, segscan_num_groups_9848,
  1232. segscan_group_size_9847)
  1233. let {i32 num_threads_9850} =
  1234. mul_nw32(num_groups_9849, segscan_group_size_9847)
  1235. let {[chunk_8156]i32 resarr0_8233, [chunk_8156]i32 map_res_8234,
  1236. [chunk_8156]i32 res_8235, [chunk_8156]i32 res_8236,
  1237. [chunk_8156]i32 res_8237} =
  1238. segscan_thread
  1239. (#groups=num_groups_9849; groupsize=segscan_group_size_9847)
  1240. ({{0i32},
  1241. [],
  1242. fn {i32} (i32 x_8238, i32 y_8239) =>
  1243. let {i32 z_8240} = add_nw32(x_8238, y_8239)
  1244. in {z_8240}})
  1245. (gtid_9851 < chunk_8156) (~phys_tid_9852) : {i32, i32, i32, i32, i32} {
  1246. let {bool x_8241} = resarr0_8163[gtid_9851]
  1247. let {i32 x_8242} = resarr0_8164[gtid_9851]
  1248. let {i32 x_8243} = inp_8161[gtid_9851]
  1249. let {i32 res_8244} =
  1250. -- Branch returns: {i32}
  1251. if x_8241
  1252. then {x_8242} else {
  1253. let {i32 res_8245} = add32(inpacc_8158, x_8242)
  1254. in {res_8245}
  1255. }
  1256. let {i32 res_8246} = sub32(res_8244, 1i32)
  1257. let {bool x_8247} = sle32(0i32, x_8243)
  1258. let {bool y_8248} = slt32(x_8243, res_7690)
  1259. let {bool bounds_check_8249} = logand(x_8247, y_8248)
  1260. let {cert index_certs_8250} =
  1261. assert(bounds_check_8249, "Index [", x_8243,
  1262. "] out of bounds for array of shape [",
  1263. res_7690, "].",
  1264. "futracerlib/lib/github.com/diku-dk/segmented/segmented.fut:74:24-29")
  1265. let {i32 lifted_0_get_arg_8251} =
  1266. <index_certs_8250>
  1267. res_7829[x_8243]
  1268. let {i32 lifted_0_get_arg_8252} =
  1269. <index_certs_8250>
  1270. res_7830[x_8243]
  1271. let {i32 lifted_0_get_arg_8253} =
  1272. <index_certs_8250>
  1273. res_7831[x_8243]
  1274. let {i32 lifted_0_get_arg_8254} =
  1275. <index_certs_8250>
  1276. res_7832[x_8243]
  1277. let {i32 abs_arg_8255} =
  1278. sub32(lifted_0_get_arg_8251, lifted_0_get_arg_8253)
  1279. let {i32 res_8256} = abs32 abs_arg_8255
  1280. let {i32 abs_arg_8257} =
  1281. sub32(lifted_0_get_arg_8252, lifted_0_get_arg_8252)
  1282. let {i32 res_8258} = abs32 abs_arg_8257
  1283. let {bool cond_8259} = slt32(res_8258, res_8256)
  1284. let {i32 res_8260, i32 res_8261} =
  1285. -- Branch returns: {i32, i32}
  1286. if cond_8259
  1287. then {
  1288. let {bool cond_8262} =
  1289. slt32(lifted_0_get_arg_8251, lifted_0_get_arg_8253)
  1290. let {i32 res_8263} =
  1291. -- Branch returns: {i32}
  1292. if cond_8262
  1293. then {1i32} else {
  1294. let {bool cond_8264} =
  1295. slt32(lifted_0_get_arg_8253, lifted_0_get_arg_8251)
  1296. let {i32 res_8265} =
  1297. -- Branch returns: {i32}
  1298. if cond_8264
  1299. then {-1i32} else {0i32}
  1300. in {res_8265}
  1301. }
  1302. let {bool cond_8266} =
  1303. eq_i32(lifted_0_get_arg_8253, lifted_0_get_arg_8251)
  1304. let {f32 res_8267} =
  1305. -- Branch returns: {f32}
  1306. if cond_8266
  1307. then {-1.0f32} else {
  1308. let {f32 res_8268} = sitofp i32 abs_arg_8257 to f32
  1309. let {i32 abs_arg_8269} =
  1310. sub32(lifted_0_get_arg_8253, lifted_0_get_arg_8251)
  1311. let {i32 res_8270} = abs32 abs_arg_8269
  1312. let {f32 res_8271} = sitofp i32 res_8270 to f32
  1313. let {f32 res_8272} = fdiv32(res_8268, res_8271)
  1314. in {res_8272}
  1315. }
  1316. let {i32 y_8273} = mul32(res_8246, res_8263)
  1317. let {i32 res_8274} = add32(lifted_0_get_arg_8251, y_8273)
  1318. let {f32 res_8275} = sitofp i32 res_8246 to f32
  1319. let {f32 t32_arg_8276} = fmul32(res_8267, res_8275)
  1320. let {i32 res_8277} = fptosi f32 t32_arg_8276 to i32
  1321. let {i32 res_8278} = add32(lifted_0_get_arg_8252, res_8277)
  1322. in {res_8274, res_8278}
  1323. } else {
  1324. let {bool cond_8279} =
  1325. slt32(lifted_0_get_arg_8251, lifted_0_get_arg_8253)
  1326. let {f32 res_8280} =
  1327. -- Branch returns: {f32}
  1328. if cond_8279
  1329. then {1.0f32} else {-1.0f32}
  1330. let {f32 res_8281} = sitofp i32 res_8246 to f32
  1331. let {f32 t32_arg_8282} = fmul32(res_8280, res_8281)
  1332. let {i32 res_8283} = fptosi f32 t32_arg_8282 to i32
  1333. let {i32 res_8284} = add32(lifted_0_get_arg_8251, res_8283)
  1334. in {res_8284, lifted_0_get_arg_8252}
  1335. }
  1336. let {bool cond_8285} = sle32(0i32, res_8260)
  1337. let {bool res_8286} = slt32(res_8260, w_7133)
  1338. let {bool x_8287} = logand(cond_8285, res_8286)
  1339. let {bool res_8288} = sle32(0i32, res_8261)
  1340. let {bool x_8289} = logand(x_8287, res_8288)
  1341. let {bool res_8290} = slt32(res_8261, h_7134)
  1342. let {bool x_8291} = logand(x_8289, res_8290)
  1343. let {bool cond_neg_8292} = not x_8291
  1344. let {i32 res_8293} = btoi bool cond_neg_8292 to i32
  1345. let {bool is_i_8294} = eq_i32(res_8293, 0i32)
  1346. let {bool cond_neg_8295} = not is_i_8294
  1347. let {i32 part_res_8296} = btoi bool cond_neg_8295 to i32
  1348. let {i32 part_res_8297} = btoi bool is_i_8294 to i32
  1349. return {returns part_res_8297, returns part_res_8296,
  1350. returns res_8260, returns res_8261,
  1351. returns lifted_0_get_arg_8254}
  1352. }
  1353. let {i32 lstel_8305} =
  1354. -- Branch returns: {i32}
  1355. if empty_arr_8178
  1356. then {0i32} else {
  1357. let {i32 lstel_tmp_8306} = resarr0_8233[szm1_8177]
  1358. in {lstel_tmp_8306}
  1359. }
  1360. let {i32 comparatee_9853} = mul_nw32(chunk_8156, 1i32)
  1361. let {bool suff_outer_par_9854} =
  1362. get_size(suff_outer_par_1, threshold ()) <= comparatee_9853
  1363. let {i64 chunk_9886} = sext i32 chunk_8156 to i64
  1364. let {i64 nest_size_9887} = mul_nw64(chunk_9886, 1i64)
  1365. let {i32 segmap_group_size_9888} =
  1366. get_size(segmap_group_size_9879, group_size)
  1367. let {i64 segmap_group_size_9889} = sext i32 segmap_group_size_9888 to i64
  1368. let {i64 segmap_usable_groups_64_9890} =
  1369. sdiv_up64(nest_size_9887, segmap_group_size_9889)
  1370. let {i32 segmap_usable_groups_9891} =
  1371. sext i64 segmap_usable_groups_64_9890 to i32
  1372. let {[chunk_8156]i32 res_9892} =
  1373. segmap_thread
  1374. (#groups=segmap_usable_groups_9891; groupsize=segmap_group_size_9888)
  1375. (gtid_9875 < chunk_8156) (~phys_tid_9876) : {i32} {
  1376. let {i32 y_9893} = resarr0_8233[gtid_9875]
  1377. let {i32 z_9894} = add_nw32(inpacc_8159, y_9893)
  1378. return {returns z_9894}
  1379. }
  1380. -- res_8307 aliases res_9892
  1381. let {[chunk_8156]i32 res_8307} = res_9892
  1382. let {i32 z_8310} = add_nw32(inpacc_8159, lstel_8305)
  1383. let {bool inpacc_8148} = res_8183
  1384. let {i32 inpacc_8149} = res_8184
  1385. let {i32 inpacc_8150} = z_8310
  1386. -- offsets_8151 aliases res_8307
  1387. let {[res_8037]i32 offsets_8151} = reshape((~res_8037), res_8307)
  1388. -- increments_8152 aliases map_res_8234
  1389. let {[res_8037]i32 increments_8152} = reshape((~res_8037), map_res_8234)
  1390. -- res_8153 aliases res_8235
  1391. let {[res_8037]i32 res_8153} = reshape((~res_8037), res_8235)
  1392. -- res_8154 aliases res_8236
  1393. let {[res_8037]i32 res_8154} = reshape((~res_8037), res_8236)
  1394. -- res_8155 aliases res_8237
  1395. let {[res_8037]i32 res_8155} = reshape((~res_8037), res_8237)
  1396. let {i32 last_index_8319} = sub_nw32(res_8037, 1i32)
  1397. let {bool is_empty_8320} = eq_i32(res_8037, 0i32)
  1398. let {i32 partition_size_8321} =
  1399. -- Branch returns: {i32}
  1400. if is_empty_8320
  1401. then {0i32} else {
  1402. let {i32 last_offset_8322} = offsets_8151[last_index_8319]
  1403. in {last_offset_8322}
  1404. }
  1405. let {[res_8037]i32 partition_dest_8323} = scratch(i32, res_8037)
  1406. let {[res_8037]i32 partition_dest_8324} = scratch(i32, res_8037)
  1407. let {[res_8037]i32 partition_dest_8325} = scratch(i32, res_8037)
  1408. let {i64 res_9897} = sext i32 res_8037 to i64
  1409. let {i64 nest_size_9898} = mul_nw64(res_9897, 1i64)
  1410. let {i32 segmap_group_size_9900} =
  1411. get_size(segmap_group_size_9899, group_size)
  1412. let {i64 segmap_group_size_9901} = sext i32 segmap_group_size_9900 to i64
  1413. let {i64 segmap_usable_groups_64_9902} =
  1414. sdiv_up64(nest_size_9898, segmap_group_size_9901)
  1415. let {i32 segmap_usable_groups_9903} =
  1416. sext i64 segmap_usable_groups_64_9902 to i32
  1417. let {[res_8037]i32 partition_res_8326, [res_8037]i32 partition_res_8327,
  1418. [res_8037]i32 partition_res_8328} =
  1419. -- Consumes partition_dest_8323, partition_dest_8324, partition_dest_8325
  1420. segmap_thread
  1421. (#groups=segmap_usable_groups_9903; groupsize=segmap_group_size_9900)
  1422. (write_i_9895 < res_8037) (~phys_tid_9896) : {i32, i32, i32} {
  1423. let {i32 c_8329} = increments_8152[write_i_9895]
  1424. let {i32 offset_8330} = offsets_8151[write_i_9895]
  1425. let {i32 v_8331} = res_8153[write_i_9895]
  1426. let {i32 v_8332} = res_8154[write_i_9895]
  1427. let {i32 v_8333} = res_8155[write_i_9895]
  1428. let {bool is_this_one_8334} = eq_i32(c_8329, 0i32)
  1429. let {i32 this_offset_8335} = add_nw32(-1i32, offset_8330)
  1430. let {i32 total_res_8336} =
  1431. -- Branch returns: {i32}
  1432. if is_this_one_8334
  1433. then {this_offset_8335} else {-1i32}
  1434. return {partition_dest_8323 with ([total_res_8336 < res_8037] <- v_8331),
  1435. partition_dest_8324 with ([total_res_8336 < res_8037] <- v_8332),
  1436. partition_dest_8325 with ([total_res_8336 < res_8037] <- v_8333)}
  1437. }
  1438. let {bool empty_slice_8337} = eq_i32(partition_size_8321, 0i32)
  1439. let {i32 m_8338} = sub32(partition_size_8321, 1i32)
  1440. let {bool zero_leq_i_p_m_t_s_8339} = sle32(0i32, m_8338)
  1441. let {bool i_p_m_t_s_leq_w_8340} = slt32(m_8338, res_8037)
  1442. let {bool i_lte_j_8341} = sle32(0i32, partition_size_8321)
  1443. let {bool y_8342} = logand(zero_leq_i_p_m_t_s_8339, i_p_m_t_s_leq_w_8340)
  1444. let {bool y_8343} = logand(i_lte_j_8341, y_8342)
  1445. let {bool ok_or_empty_8344} = logor(empty_slice_8337, y_8343)
  1446. let {cert index_certs_8345} =
  1447. assert(ok_or_empty_8344, "Index [:", partition_size_8321,
  1448. "] out of bounds for array of shape [",
  1449. res_8037, "].", "/prelude/soacs.fut:141:6-16")
  1450. -- res_8346 aliases partition_res_8326
  1451. let {[partition_size_8321]i32 res_8346} =
  1452. <index_certs_8345>
  1453. partition_res_8326[0i32:+partition_size_8321*1i32]
  1454. -- res_8347 aliases partition_res_8327
  1455. let {[partition_size_8321]i32 res_8347} =
  1456. <index_certs_8345>
  1457. partition_res_8327[0i32:+partition_size_8321*1i32]
  1458. -- res_8348 aliases partition_res_8328
  1459. let {[partition_size_8321]i32 res_8348} =
  1460. <index_certs_8345>
  1461. partition_res_8328[0i32:+partition_size_8321*1i32]
  1462. let {bool bounds_invalid_upwards_8349} = slt32(replicate_arg_7618, 0i32)
  1463. let {bool valid_8350} = not bounds_invalid_upwards_8349
  1464. let {cert range_valid_c_8351} =
  1465. assert(valid_8350, "Range ", 0i32, "..", 1i32, "..<",
  1466. replicate_arg_7618, " is invalid.",
  1467. "/prelude/math.fut:453:23-30")
  1468. let {[replicate_arg_7618]i64 res_8352} = replicate([replicate_arg_7618],
  1469. -1i64)
  1470. let {i64 partition_size_9904} = sext i32 partition_size_8321 to i64
  1471. let {i64 nest_size_9905} = mul_nw64(partition_size_9904, 1i64)
  1472. let {i32 seghist_group_size_9907} =
  1473. get_size(seghist_group_size_9906, group_size)
  1474. let {i32 num_groups_9909} =
  1475. calc_num_groups(nest_size_9905, seghist_num_groups_9908,
  1476. seghist_group_size_9907)
  1477. let {i32 num_threads_9910} =
  1478. mul_nw32(num_groups_9909, seghist_group_size_9907)
  1479. let {[replicate_arg_7618]i64 res_8353} =
  1480. -- Consumes res_8352
  1481. seghist_thread
  1482. (#groups=num_groups_9909; groupsize=seghist_group_size_9907)
  1483. _thread
  1484. (#groups=num_groups_9909; groupsize=seghist_group_size_9907)
  1485. ({replicate_arg_7618, 1i32,
  1486. {res_8352},
  1487. {-1i64},
  1488. [],
  1489. fn {i64} (i64 x_9913, i64 x_9914) =>
  1490. let {i64 i64_arg_9915} = ashr64(x_9913, 32i64)
  1491. let {i32 res_9916} = sext i64 i64_arg_9915 to i32
  1492. let {i32 res_9917} = sext i64 x_9913 to i32
  1493. let {i64 i64_arg_9918} = ashr64(x_9914, 32i64)
  1494. let {i32 res_9919} = sext i64 i64_arg_9918 to i32
  1495. let {i32 res_9920} = sext i64 x_9914 to i32
  1496. let {bool cond_9921} = eq_i32(res_9917, -1i32)
  1497. let {i64 res_9922} =
  1498. -- Branch returns: {i64}
  1499. if cond_9921
  1500. then {x_9914} else {
  1501. let {bool cond_9923} = eq_i32(res_9920, -1i32)
  1502. let {i64 res_9924} =
  1503. -- Branch returns: {i64}
  1504. if cond_9923
  1505. then {x_9913} else {
  1506. let {bool zero_9925} = eq_i32(h_7134, 0i32)
  1507. let {bool nonzero_9926} = not zero_9925
  1508. let {cert nonzero_cert_9927} =
  1509. assert(nonzero_9926, "division by zero",
  1510. "futracerlib/render.fut:321:32-39")
  1511. let {i32 res_9928} =
  1512. <nonzero_cert_9927>
  1513. sdiv32(res_9916, h_7134)
  1514. let {i32 res_9929} =
  1515. <nonzero_cert_9927>
  1516. smod32(res_9916, h_7134)
  1517. let {i32 res_9930} =
  1518. <nonzero_cert_9927>
  1519. sdiv32(res_9919, h_7134)
  1520. let {i32 res_9931} =
  1521. <nonzero_cert_9927>
  1522. smod32(res_9919, h_7134)
  1523. let {i32 res_9932} =
  1524. <index_certs_7601>
  1525. partition_res_7560[res_9917]
  1526. let {i32 res_9933} =
  1527. <index_certs_7601>
  1528. partition_res_7561[res_9917]
  1529. let {f32 res_9934} =
  1530. <index_certs_7601>
  1531. partition_res_7562[res_9917]
  1532. let {i32 res_9935} =
  1533. <index_certs_7601>
  1534. partition_res_7563[res_9917]
  1535. let {i32 res_9936} =
  1536. <index_certs_7601>
  1537. partition_res_7564[res_9917]
  1538. let {f32 res_9937} =
  1539. <index_certs_7601>
  1540. partition_res_7565[res_9917]
  1541. let {i32 res_9938} =
  1542. <index_certs_7601>
  1543. partition_res_7566[res_9917]
  1544. let {i32 res_9939} =
  1545. <index_certs_7601>
  1546. partition_res_7567[res_9917]
  1547. let {f32 res_9940} =
  1548. <index_certs_7601>
  1549. partition_res_7568[res_9917]
  1550. let {i32 res_9941} =
  1551. <index_certs_7601>
  1552. partition_res_7560[res_9920]
  1553. let {i32 res_9942} =
  1554. <index_certs_7601>
  1555. partition_res_7561[res_9920]
  1556. let {f32 res_9943} =
  1557. <index_certs_7601>
  1558. partition_res_7562[res_9920]
  1559. let {i32 res_9944} =
  1560. <index_certs_7601>
  1561. partition_res_7563[res_9920]
  1562. let {i32 res_9945} =
  1563. <index_certs_7601>
  1564. partition_res_7564[res_9920]
  1565. let {f32 res_9946} =
  1566. <index_certs_7601>
  1567. partition_res_7565[res_9920]
  1568. let {i32 res_9947} =
  1569. <index_certs_7601>
  1570. partition_res_7566[res_9920]
  1571. let {i32 res_9948} =
  1572. <index_certs_7601>
  1573. partition_res_7567[res_9920]
  1574. let {f32 res_9949} =
  1575. <index_certs_7601>
  1576. partition_res_7568[res_9920]
  1577. let {i32 x_9950} = sub32(res_9936, res_9939)
  1578. let {i32 y_9951} = sub32(res_9932, res_9938)
  1579. let {i32 x_9952} = mul32(x_9950, y_9951)
  1580. let {i32 x_9953} = sub32(res_9938, res_9935)
  1581. let {i32 y_9954} = sub32(res_9933, res_9939)
  1582. let {i32 y_9955} = mul32(x_9953, y_9954)
  1583. let {i32 factor_9956} = add32(x_9952, y_9955)
  1584. let {bool cond_9957} = eq_i32(factor_9956, 0i32)
  1585. let {bool cond_9958} = not cond_9957
  1586. let {f32 res_9959, f32 res_9960, f32 res_9961} =
  1587. -- Branch returns: {f32, f32, f32}
  1588. if cond_9958
  1589. then {
  1590. let {i32 y_9962} = sub32(res_9928, res_9938)
  1591. let {i32 x_9963} = mul32(x_9950, y_9962)
  1592. let {i32 y_9964} = sub32(res_9929, res_9939)
  1593. let {i32 y_9965} = mul32(x_9953, y_9964)
  1594. let {i32 a_9966} = add32(x_9963, y_9965)
  1595. let {i32 x_9967} = sub32(res_9939, res_9933)
  1596. let {i32 x_9968} = mul32(y_9962, x_9967)
  1597. let {i32 y_9969} = mul32(y_9951, y_9964)
  1598. let {i32 b_9970} = add32(x_9968, y_9969)
  1599. let {f32 res_9971} = sitofp i32 factor_9956 to f32
  1600. let {f32 res_9972} = sitofp i32 a_9966 to f32
  1601. let {f32 an_9973} = fdiv32(res_9972, res_9971)
  1602. let {f32 res_9974} = sitofp i32 b_9970 to f32
  1603. let {f32 bn_9975} = fdiv32(res_9974, res_9971)
  1604. let {f32 x_9976} = fsub32(1.0f32, an_9973)
  1605. let {f32 cn_9977} = fsub32(x_9976, bn_9975)
  1606. in {an_9973, bn_9975, cn_9977}
  1607. } else {-1.0f32, -1.0f32, -1.0f32}
  1608. let {i32 x_9978} = sub32(res_9945, res_9948)
  1609. let {i32 y_9979} = sub32(res_9941, res_9947)
  1610. let {i32 x_9980} = mul32(x_9978, y_9979)
  1611. let {i32 x_9981} = sub32(res_9947, res_9944)
  1612. let {i32 y_9982} = sub32(res_9942, res_9948)
  1613. let {i32 y_9983} = mul32(x_9981, y_9982)
  1614. let {i32 factor_9984} = add32(x_9980, y_9983)
  1615. let {bool cond_9985} = eq_i32(factor_9984, 0i32)
  1616. let {bool cond_9986} = not cond_9985
  1617. let {f32 res_9987, f32 res_9988, f32 res_9989} =
  1618. -- Branch returns: {f32, f32, f32}
  1619. if cond_9986
  1620. then {
  1621. let {i32 y_9990} = sub32(res_9930, res_9947)
  1622. let {i32 x_9991} = mul32(x_9978, y_9990)
  1623. let {i32 y_9992} = sub32(res_9931, res_9948)
  1624. let {i32 y_9993} = mul32(x_9981, y_9992)
  1625. let {i32 a_9994} = add32(x_9991, y_9993)
  1626. let {i32 x_9995} = sub32(res_9948, res_9942)
  1627. let {i32 x_9996} = mul32(y_9990, x_9995)
  1628. let {i32 y_9997} = mul32(y_9979, y_9992)
  1629. let {i32 b_9998} = add32(x_9996, y_9997)
  1630. let {f32 res_9999} = sitofp i32 factor_9984 to f32
  1631. let {f32 res_10000} = sitofp i32 a_9994 to f32
  1632. let {f32 an_10001} = fdiv32(res_10000, res_9999)
  1633. let {f32 res_10002} = sitofp i32 b_9998 to f32
  1634. let {f32 bn_10003} = fdiv32(res_10002, res_9999)
  1635. let {f32 x_10004} = fsub32(1.0f32, an_10001)
  1636. let {f32 cn_10005} = fsub32(x_10004, bn_10003)
  1637. in {an_10001, bn_10003, cn_10005}
  1638. } else {-1.0f32, -1.0f32, -1.0f32}
  1639. let {f32 x_10006} = fmul32(res_9934, res_9959)
  1640. let {f32 y_10007} = fmul32(res_9937, res_9960)
  1641. let {f32 x_10008} = fadd32(x_10006, y_10007)
  1642. let {f32 y_10009} = fmul32(res_9940, res_9961)
  1643. let {f32 res_10010} = fadd32(x_10008, y_10009)
  1644. let {f32 x_10011} = fmul32(res_9943, res_9987)
  1645. let {f32 y_10012} = fmul32(res_9946, res_9988)
  1646. let {f32 x_10013} = fadd32(x_10011, y_10012)
  1647. let {f32 y_10014} = fmul32(res_9949, res_9989)
  1648. let {f32 res_10015} = fadd32(x_10013, y_10014)
  1649. let {bool cond_10016} = lt32(res_10010, res_10015)
  1650. let {i64 res_10017} =
  1651. -- Branch returns: {i64}
  1652. if cond_10016
  1653. then {x_9913} else {x_9914}
  1654. in {res_10017}
  1655. }
  1656. in {res_9924}
  1657. }
  1658. in {res_9922}})
  1659. (gtid_9911 < partition_size_8321) (~phys_tid_9912) : {i32, i64} {
  1660. let {i32 x_10018} = res_8346[gtid_9911]
  1661. let {i32 x_10019} = res_8347[gtid_9911]
  1662. let {i32 x_10020} = res_8348[gtid_9911]
  1663. let {i32 x_10021} = mul32(h_7134, x_10018)
  1664. let {i32 res_10022} = add32(x_10019, x_10021)
  1665. let {i64 res_10023} = sext i32 res_10022 to i64
  1666. let {i64 x_10024} = shl64(res_10023, 32i64)
  1667. let {i64 res_10025} = sext i32 x_10020 to i64
  1668. let {i64 res_10026} = or64(x_10024, res_10025)
  1669. return {returns res_10022, returns res_10026}
  1670. }
  1671. let {bool zero_8468} = eq_i32(h_7134, 0i32)
  1672. let {bool nonzero_8469} = not zero_8468
  1673. let {cert nonzero_cert_8470} =
  1674. assert(nonzero_8469, "division by zero",
  1675. "futracerlib/render.fut:332:16-22")
  1676. let {i32 comparatee_10027} = mul_nw32(replicate_arg_7618, 1i32)
  1677. let {bool suff_outer_par_10028} =
  1678. get_size(suff_outer_par_2, threshold ()) <= comparatee_10027
  1679. let {i64 replicate_arg_10534} = sext i32 replicate_arg_7618 to i64
  1680. let {i64 nest_size_10535} = mul_nw64(replicate_arg_10534, 1i64)
  1681. let {i32 segmap_group_size_10536} =
  1682. get_size(segmap_group_size_10369, group_size)
  1683. let {i64 segmap_group_size_10537} =
  1684. sext i32 segmap_group_size_10536 to i64
  1685. let {i64 segmap_usable_groups_64_10538} =
  1686. sdiv_up64(nest_size_10535, segmap_group_size_10537)
  1687. let {i32 segmap_usable_groups_10539} =
  1688. sext i64 segmap_usable_groups_64_10538 to i32
  1689. let {[replicate_arg_7618]i32 res_10540} =
  1690. segmap_thread
  1691. (#groups=segmap_usable_groups_10539; groupsize=segmap_group_size_10536)
  1692. (gtid_10365 < replicate_arg_7618) (~phys_tid_10366) : {i32} {
  1693. let {i64 x_10541} = res_8353[gtid_10365]
  1694. let {i64 i64_arg_10542} = ashr64(x_10541, 32i64)
  1695. let {i32 res_10543} = sext i64 i64_arg_10542 to i32
  1696. let {i32 res_10544} = sext i64 x_10541 to i32
  1697. let {i32 res_10545} =
  1698. <nonzero_cert_8470>
  1699. sdiv32(res_10543, h_7134)
  1700. let {i32 res_10546} =
  1701. <nonzero_cert_8470>
  1702. smod32(res_10543, h_7134)
  1703. let {bool cond_10547} = eq_i32(res_10544, -1i32)
  1704. let {i32 res_10548} =
  1705. -- Branch returns: {i32}
  1706. if cond_10547
  1707. then {0i32} else {
  1708. let {i32 res_10549} =
  1709. <index_certs_7601>
  1710. partition_res_7560[res_10544]
  1711. let {i32 res_10550} =
  1712. <index_certs_7601>
  1713. partition_res_7561[res_10544]
  1714. let {f32 res_10551} =
  1715. <index_certs_7601>
  1716. partition_res_7562[res_10544]
  1717. let {i32 res_10552} =
  1718. <index_certs_7601>
  1719. partition_res_7563[res_10544]
  1720. let {i32 res_10553} =
  1721. <index_certs_7601>
  1722. partition_res_7564[res_10544]
  1723. let {f32 res_10554} =
  1724. <index_certs_7601>
  1725. partition_res_7565[res_10544]
  1726. let {i32 res_10555} =
  1727. <index_certs_7601>
  1728. partition_res_7566[res_10544]
  1729. let {i32 res_10556} =
  1730. <index_certs_7601>
  1731. partition_res_7567[res_10544]
  1732. let {f32 res_10557} =
  1733. <index_certs_7601>
  1734. partition_res_7568[res_10544]
  1735. let {i32 res_10558} =
  1736. <index_certs_7601>
  1737. partition_res_7569[res_10544]
  1738. let {f32 res_10559} =
  1739. <index_certs_7601>
  1740. partition_res_7570[res_10544]
  1741. let {f32 res_10560} =
  1742. <index_certs_7601>
  1743. partition_res_7571[res_10544]
  1744. let {f32 res_10561} =
  1745. <index_certs_7601>
  1746. partition_res_7572[res_10544]
  1747. let {i32 res_10562} =
  1748. <index_certs_7601>
  1749. partition_res_7573[res_10544]
  1750. let {i32 x_10563} = sub32(res_10553, res_10556)
  1751. let {i32 y_10564} = sub32(res_10549, res_10555)
  1752. let {i32 x_10565} = mul32(x_10563, y_10564)
  1753. let {i32 x_10566} = sub32(res_10555, res_10552)
  1754. let {i32 y_10567} = sub32(res_10550, res_10556)
  1755. let {i32 y_10568} = mul32(x_10566, y_10567)
  1756. let {i32 factor_10569} = add32(x_10565, y_10568)
  1757. let {bool cond_10570} = eq_i32(factor_10569, 0i32)
  1758. let {bool cond_10571} = not cond_10570
  1759. let {f32 res_10572, f32 res_10573, f32 res_10574} =
  1760. -- Branch returns: {f32, f32, f32}
  1761. if cond_10571
  1762. then {
  1763. let {i32 y_10575} = sub32(res_10545, res_10555)
  1764. let {i32 x_10576} = mul32(x_10563, y_10575)
  1765. let {i32 y_10577} = sub32(res_10546, res_10556)
  1766. let {i32 y_10578} = mul32(x_10566, y_10577)
  1767. let {i32 a_10579} = add32(x_10576, y_10578)
  1768. let {i32 x_10580} = sub32(res_10556, res_10550)
  1769. let {i32 x_10581} = mul32(y_10575, x_10580)
  1770. let {i32 y_10582} = mul32(y_10564, y_10577)
  1771. let {i32 b_10583} = add32(x_10581, y_10582)
  1772. let {f32 res_10584} = sitofp i32 factor_10569 to f32
  1773. let {f32 res_10585} = sitofp i32 a_10579 to f32
  1774. let {f32 an_10586} = fdiv32(res_10585, res_10584)
  1775. let {f32 res_10587} = sitofp i32 b_10583 to f32
  1776. let {f32 bn_10588} = fdiv32(res_10587, res_10584)
  1777. let {f32 x_10589} = fsub32(1.0f32, an_10586)
  1778. let {f32 cn_10590} = fsub32(x_10589, bn_10588)
  1779. in {an_10586, bn_10588, cn_10590}
  1780. } else {-1.0f32, -1.0f32, -1.0f32}
  1781. let {f32 x_10591} = fmul32(res_10551, res_10572)
  1782. let {f32 y_10592} = fmul32(res_10554, res_10573)
  1783. let {f32 x_10593} = fadd32(x_10591, y_10592)
  1784. let {f32 y_10594} = fmul32(res_10557, res_10574)
  1785. let {f32 res_10595} = fadd32(x_10593, y_10594)
  1786. let {bool cond_10596} = eq_i32(res_10558, 1i32)
  1787. let {f32 res_10597, f32 res_10598, f32 res_10599} =
  1788. -- Branch returns: {f32, f32, f32}
  1789. if cond_10596
  1790. then {res_10559, res_10560, res_10561} else {
  1791. let {bool cond_10600} = eq_i32(res_10558, 2i32)
  1792. let {f32 res_10601, f32 res_10602, f32 res_10603} =
  1793. -- Branch returns: {f32, f32, f32}
  1794. if cond_10600
  1795. then {
  1796. let {i32 i_10604} = sdiv32(res_10562, 2i32)
  1797. let {i32 x_10605} = and32(1i32, res_10562)
  1798. let {bool cond_10606} = eq_i32(x_10605, 0i32)
  1799. let {f32 res_10607} =
  1800. -- Branch returns: {f32}
  1801. if cond_10606
  1802. then {0.0f32} else {1.0f32}
  1803. let {f32 res_10608} =
  1804. -- Branch returns: {f32}
  1805. if cond_10606
  1806. then {1.0f32} else {0.0f32}
  1807. let {f32 x_10609} = fmul32(res_10572, res_10607)
  1808. let {f32 y_10610} = fmul32(res_10573, res_10608)
  1809. let {f32 x_10611} = fadd32(x_10609, y_10610)
  1810. let {f32 y_10612} = fmul32(res_10574, res_10607)
  1811. let {f32 yn_10613} = fadd32(x_10611, y_10612)
  1812. let {f32 y_10614} = fmul32(res_10573, res_10607)
  1813. let {f32 x_10615} = fadd32(x_10609, y_10614)
  1814. let {f32 y_10616} = fmul32(res_10574, res_10608)
  1815. let {f32 xn_10617} = fadd32(x_10615, y_10616)
  1816. let {f32 res_10618} = sitofp i32 surface_h_7153 to f32
  1817. let {f32 t32_arg_10619} = fmul32(yn_10613, res_10618)
  1818. let {i32 res_10620} = fptosi f32 t32_arg_10619 to i32
  1819. let {f32 res_10621} = sitofp i32 surface_w_7152 to f32
  1820. let {f32 t32_arg_10622} = fmul32(xn_10617, res_10621)
  1821. let {i32 res_10623} = fptosi f32 t32_arg_10622 to i32
  1822. let {i32 clamp_arg_10624} = sub32(surface_h_7153, 1i32)
  1823. let {i32 res_10625} = smax32(0i32, res_10620)
  1824. let {i32 res_10626} = smin32(clamp_arg_10624, res_10625)
  1825. let {i32 clamp_arg_10627} = sub32(surface_w_7152, 1i32)
  1826. let {i32 res_10628} = smax32(0i32, res_10623)
  1827. let {i32 res_10629} = smin32(clamp_arg_10627, res_10628)
  1828. let {i32 binop_y_10630} =
  1829. mul_nw32(surface_w_7152, surface_h_7153)
  1830. let {i32 binop_x_10631} = mul_nw32(i_10604, binop_y_10630)
  1831. let {i32 binop_y_10632} =
  1832. mul_nw32(surface_w_7152, res_10626)
  1833. let {i32 binop_x_10633} =
  1834. add_nw32(binop_x_10631, binop_y_10632)
  1835. let {i32 new_index_10634} =
  1836. add_nw32(res_10629, binop_x_10633)
  1837. let {f32 res_10635} =
  1838. <dim_ok_7201>
  1839. surface_textures_flat_hsv_hs_7154[new_index_10634]
  1840. let {f32 res_10636} =
  1841. <empty_or_match_cert_7195, dim_ok_7201>
  1842. surface_textures_flat_hsv_ss_7155[new_index_10634]
  1843. let {f32 res_10637} =
  1844. <empty_or_match_cert_7197, dim_ok_7201>
  1845. surface_textures_flat_hsv_vs_7156[new_index_10634]
  1846. in {res_10635, res_10636, res_10637}
  1847. } else {0.0f32, 0.0f32, 0.0f32}
  1848. in {res_10601, res_10602, res_10603}
  1849. }
  1850. let {f32 y_10638} = fpow32(res_10595, 2.0f32)
  1851. let {f32 min_arg_10639} = fdiv32(2000000.0f32, y_10638)
  1852. let {f32 res_10640} = fmin32(1.0f32, min_arg_10639)
  1853. let {f32 res_10641} = fmul32(res_10599, res_10640)
  1854. let {f32 c_10642} = fmul32(res_10598, res_10641)
  1855. let {f32 h'_10643} = fdiv32(res_10597, 60.0f32)
  1856. let {f32 t32_arg_10644} = fdiv32(h'_10643, 2.0f32)
  1857. let {i32 res_10645} = fptosi f32 t32_arg_10644 to i32
  1858. let {f32 res_10646} = sitofp i32 res_10645 to f32
  1859. let {f32 y_10647} = fmul32(2.0f32, res_10646)
  1860. let {f32 res_10648} = fsub32(h'_10643, y_10647)
  1861. let {f32 abs_arg_10649} = fsub32(res_10648, 1.0f32)
  1862. let {f32 res_10650} = fabs32 abs_arg_10649
  1863. let {f32 y_10651} = fsub32(1.0f32, res_10650)
  1864. let {f32 x_10652} = fmul32(c_10642, y_10651)
  1865. let {bool cond_10653} = le32(0.0f32, h'_10643)
  1866. let {bool res_10654} = lt32(h'_10643, 1.0f32)
  1867. let {bool x_10655} = logand(cond_10653, res_10654)
  1868. let {f32 res_10656, f32 res_10657, f32 res_10658} =
  1869. -- Branch returns: {f32, f32, f32}
  1870. if x_10655
  1871. then {c_10642, x_10652, 0.0f32} else {
  1872. let {bool cond_10659} = le32(1.0f32, h'_10643)
  1873. let {bool res_10660} = lt32(h'_10643, 2.0f32)
  1874. let {bool x_10661} = logand(cond_10659, res_10660)
  1875. let {f32 res_10662, f32 res_10663, f32 res_10664} =
  1876. -- Branch returns: {f32, f32, f32}
  1877. if x_10661
  1878. then {x_10652, c_10642, 0.0f32} else {
  1879. let {bool cond_10665} = le32(2.0f32, h'_10643)
  1880. let {bool res_10666} = lt32(h'_10643, 3.0f32)
  1881. let {bool x_10667} = logand(cond_10665, res_10666)
  1882. let {f32 res_10668, f32 res_10669, f32 res_10670} =
  1883. -- Branch returns: {f32, f32, f32}
  1884. if x_10667
  1885. then {0.0f32, c_10642, x_10652} else {
  1886. let {bool cond_10671} = le32(3.0f32, h'_10643)
  1887. let {bool res_10672} = lt32(h'_10643, 4.0f32)
  1888. let {bool x_10673} = logand(cond_10671, res_10672)
  1889. let {f32 res_10674} =
  1890. -- Branch returns: {f32}
  1891. if x_10673
  1892. then {x_10652} else {0.0f32}
  1893. let {f32 res_10675, f32 res_10676} =
  1894. -- Branch returns: {f32, f32}
  1895. if x_10673
  1896. then {0.0f32, c_10642} else {
  1897. let {bool cond_10677} = le32(4.0f32, h'_10643)
  1898. let {bool res_10678} = lt32(h'_10643, 5.0f32)
  1899. let {bool x_10679} = logand(cond_10677, res_10678)
  1900. let {f32 res_10680, f32 res_10681} =
  1901. -- Branch returns: {f32, f32}
  1902. if x_10679
  1903. then {x_10652, c_10642} else {
  1904. let {bool cond_10682} = le32(5.0f32, h'_10643)
  1905. let {bool res_10683} = lt32(h'_10643, 6.0f32)
  1906. let {bool x_10684} =
  1907. logand(cond_10682, res_10683)
  1908. let {f32 res_10685} =
  1909. -- Branch returns: {f32}
  1910. if x_10684
  1911. then {c_10642} else {0.0f32}
  1912. let {f32 res_10686} =
  1913. -- Branch returns: {f32}
  1914. if x_10684
  1915. then {x_10652} else {0.0f32}
  1916. in {res_10685, res_10686}
  1917. }
  1918. in {res_10680, res_10681}
  1919. }
  1920. in {res_10675, res_10674, res_10676}
  1921. }
  1922. in {res_10668, res_10669, res_10670}
  1923. }
  1924. in {res_10662, res_10663, res_10664}
  1925. }
  1926. let {f32 m_10687} = fsub32(res_10641, c_10642)
  1927. let {f32 res_10688} = fadd32(res_10656, m_10687)
  1928. let {f32 res_10689} = fadd32(res_10657, m_10687)
  1929. let {f32 res_10690} = fadd32(res_10658, m_10687)
  1930. let {f32 f32_arg_10691} = fmul32(255.0f32, res_10688)
  1931. let {i32 unsign_arg_10692} = fptoui f32 f32_arg_10691 to i32
  1932. let {f32 f32_arg_10693} = fmul32(255.0f32, res_10689)
  1933. let {i32 unsign_arg_10694} = fptoui f32 f32_arg_10693 to i32
  1934. let {f32 f32_arg_10695} = fmul32(255.0f32, res_10690)
  1935. let {i32 unsign_arg_10696} = fptoui f32 f32_arg_10695 to i32
  1936. let {i32 x_10697} = shl32(unsign_arg_10692, 16i32)
  1937. let {i32 y_10698} = shl32(unsign_arg_10694, 8i32)
  1938. let {i32 x_10699} = or32(x_10697, y_10698)
  1939. let {i32 res_10700} = or32(unsign_arg_10696, x_10699)
  1940. in {res_10700}
  1941. }
  1942. return {returns res_10548}
  1943. }
  1944. -- res_8471 aliases res_10540
  1945. let {[replicate_arg_7618]i32 res_8471} = res_10540
  1946. -- res_8632 aliases res_8471
  1947. let {[w_7133][h_7134]i32 res_8632} =
  1948. <range_valid_c_8351>
  1949. reshape((w_7133, h_7134), res_8471)
  1950. in {res_8632}
  1951. } else {
  1952. let {bool cond_8633} = eq_i32(render_approach_7130, 2i32)
  1953. let {[w_7133][h_7134]i32 res_8634} =
  1954. -- Branch returns: {[w_7133][h_7134]i32}
  1955. if cond_8633
  1956. then {
  1957. let {bool cond_8635} = eq_i32(n_draw_rects_x_7131, 1i32)
  1958. let {bool res_8636} = eq_i32(n_draw_rects_y_7132, 1i32)
  1959. let {bool x_8637} = logand(cond_8635, res_8636)
  1960. let {i32 n_total_8638} =
  1961. mul32(n_draw_rects_x_7131, n_draw_rects_y_7132)
  1962. let {[w_7133][h_7134]i32 res_8639} =
  1963. -- Branch returns: {[w_7133][h_7134]i32}
  1964. if x_8637
  1965. then {
  1966. let {bool bounds_invalid_upwards_8640} =
  1967. slt32(replicate_arg_7618, 0i32)
  1968. let {bool valid_8641} = not bounds_invalid_upwards_8640
  1969. let {cert range_valid_c_8642} =
  1970. assert(valid_8641, "Range ", 0i32, "..", 1i32, "..<",
  1971. replicate_arg_7618, " is invalid.",
  1972. "/prelude/math.fut:453:23-30")
  1973. let {[replicate_arg_7618]i32 res_8643} =
  1974. <range_valid_c_8642>
  1975. iota32(replicate_arg_7618, 0i32, 1i32)
  1976. let {i32 comparatee_10701} = mul_nw32(replicate_arg_7618, 1i32)
  1977. let {bool suff_outer_par_10702} =
  1978. get_size(suff_outer_par_3, threshold ()) <= comparatee_10701
  1979. let {[replicate_arg_7618]i32 res_8644} =
  1980. -- Branch returns: {[replicate_arg_7618]i32}
  1981. if <equiv> suff_outer_par_10702
  1982. then {
  1983. let {i64 replicate_arg_10994} =
  1984. sext i32 replicate_arg_7618 to i64
  1985. let {i64 nest_size_10995} =
  1986. mul_nw64(replicate_arg_10994, 1i64)
  1987. let {i32 segmap_group_size_10996} =
  1988. get_size(segmap_group_size_10707, group_size)
  1989. let {i64 segmap_group_size_10997} =
  1990. sext i32 segmap_group_size_10996 to i64
  1991. let {i64 segmap_usable_groups_64_10998} =
  1992. sdiv_up64(nest_size_10995, segmap_group_size_10997)
  1993. let {i32 segmap_usable_groups_10999} =
  1994. sext i64 segmap_usable_groups_64_10998 to i32
  1995. let {[replicate_arg_7618]i32 res_11000} =
  1996. segmap_thread
  1997. (#groups=segmap_usable_groups_10999; groupsize=segmap_group_size_10996)
  1998. (gtid_10703 < replicate_arg_7618) (~phys_tid_10704) : {i32} {
  1999. let {i32 x_11001} = res_8643[gtid_10703]
  2000. let {i32 res_11002} = sdiv32(x_11001, h_7134)
  2001. let {i32 res_11003} = smod32(x_11001, h_7134)
  2002. let {bool res_11004, f32 res_11005, i32 res_11006} =
  2003. redomap(partition_size_7544,
  2004. {commutative fn {bool, f32, i32} (bool x_11007,
  2005. f32 x_11008,
  2006. i32 x_11009,
  2007. bool x_11010,
  2008. f32 x_11011,
  2009. i32 x_11012) =>
  2010. let {bool res_11013} = le32(0.0f32, x_11008)
  2011. let {bool x_11014} =
  2012. logand(x_11007, res_11013)
  2013. let {bool cond_11015} = lt32(x_11011, 0.0f32)
  2014. let {bool res_11016} = not x_11010
  2015. let {bool x_11017} = not cond_11015
  2016. let {bool y_11018} =
  2017. logand(res_11016, x_11017)
  2018. let {bool cond_11019} =
  2019. logor(cond_11015, y_11018)
  2020. let {bool res_11020} = lt32(x_11008, x_11011)
  2021. let {bool x_11021} = not cond_11019
  2022. let {bool y_11022} =
  2023. logand(res_11020, x_11021)
  2024. let {bool res_11023} =
  2025. logor(cond_11019, y_11022)
  2026. let {bool x_11024} =
  2027. logand(x_11014, res_11023)
  2028. let {bool res_11025, f32 res_11026,
  2029. i32 res_11027} =
  2030. -- Branch returns: {bool, f32, i32}
  2031. if x_11024
  2032. then {true, x_11008, x_11009} else {
  2033. let {bool res_11028} =
  2034. le32(0.0f32, x_11011)
  2035. let {bool x_11029} =
  2036. logand(x_11010, res_11028)
  2037. let {bool cond_11030} =
  2038. lt32(x_11008, 0.0f32)
  2039. let {bool res_11031} = not x_11007
  2040. let {bool x_11032} = not cond_11030
  2041. let {bool y_11033} =
  2042. logand(res_11031, x_11032)
  2043. let {bool cond_11034} =
  2044. logor(cond_11030, y_11033)
  2045. let {bool res_11035} =
  2046. lt32(x_11011, x_11008)
  2047. let {bool x_11036} = not cond_11034
  2048. let {bool y_11037} =
  2049. logand(res_11035, x_11036)
  2050. let {bool res_11038} =
  2051. logor(cond_11034, y_11037)
  2052. let {bool x_11039} =
  2053. logand(x_11029, res_11038)
  2054. let {bool res_11040, f32 res_11041,
  2055. i32 res_11042} =
  2056. -- Branch returns: {bool, f32, i32}
  2057. if x_11039
  2058. then {true, x_11011, x_11012} else {
  2059. let {bool x_11043} =
  2060. logand(x_11010, x_11014)
  2061. let {bool x_11044} =
  2062. logand(res_11028, x_11043)
  2063. let {bool res_11045} =
  2064. eq_f32(x_11008, x_11011)
  2065. let {bool x_11046} =
  2066. logand(x_11044, res_11045)
  2067. let {f32 res_11047} =
  2068. -- Branch returns: {f32}
  2069. if x_11046
  2070. then {x_11008} else {-1.0f32}
  2071. let {i32 res_11048} =
  2072. -- Branch returns: {i32}
  2073. if x_11046
  2074. then {x_11009} else {-1i32}
  2075. in {x_11046, res_11047, res_11048}
  2076. }
  2077. in {res_11040, res_11041, res_11042}
  2078. }
  2079. in {res_11025, res_11026, res_11027},
  2080. {false, -1.0f32, -1i32}},
  2081. fn {bool, f32, i32} (i32 x_11049, i32 x_11050,
  2082. f32 x_11051, i32 x_11052,
  2083. i32 x_11053, f32 x_11054,
  2084. i32 x_11055, i32 x_11056,
  2085. f32 x_11057,
  2086. i32 x_11058) =>
  2087. let {i32 x_11059} = sub32(x_11053, x_11056)
  2088. let {i32 y_11060} = sub32(x_11049, x_11055)
  2089. let {i32 x_11061} = mul32(x_11059, y_11060)
  2090. let {i32 x_11062} = sub32(x_11055, x_11052)
  2091. let {i32 y_11063} = sub32(x_11050, x_11056)
  2092. let {i32 y_11064} = mul32(x_11062, y_11063)
  2093. let {i32 factor_11065} =
  2094. add32(x_11061, y_11064)
  2095. let {bool cond_11066} =
  2096. eq_i32(factor_11065, 0i32)
  2097. let {bool cond_11067} = not cond_11066
  2098. let {i32 res_11068} =
  2099. -- Branch returns: {i32}
  2100. if cond_11067
  2101. then {factor_11065} else {1i32}
  2102. let {i32 res_11069, i32 res_11070,
  2103. i32 res_11071, f32 res_11072,
  2104. f32 res_11073, f32 res_11074} =
  2105. -- Branch returns: {i32, i32, i32, f32, f32, f32}
  2106. if cond_11067
  2107. then {
  2108. let {i32 y_11075} =
  2109. sub32(res_11002, x_11055)
  2110. let {i32 x_11076} =
  2111. mul32(x_11059, y_11075)
  2112. let {i32 y_11077} =
  2113. sub32(res_11003, x_11056)
  2114. let {i32 y_11078} =
  2115. mul32(x_11062, y_11077)
  2116. let {i32 a_11079} =
  2117. add32(x_11076, y_11078)
  2118. let {i32 x_11080} =
  2119. sub32(x_11056, x_11050)
  2120. let {i32 x_11081} =
  2121. mul32(y_11075, x_11080)
  2122. let {i32 y_11082} =
  2123. mul32(y_11060, y_11077)
  2124. let {i32 b_11083} =
  2125. add32(x_11081, y_11082)
  2126. let {i32 x_11084} =
  2127. sub32(factor_11065, a_11079)
  2128. let {i32 c_11085} =
  2129. sub32(x_11084, b_11083)
  2130. let {f32 res_11086} =
  2131. sitofp i32 factor_11065 to f32
  2132. let {f32 res_11087} =
  2133. sitofp i32 a_11079 to f32
  2134. let {f32 an_11088} =
  2135. fdiv32(res_11087, res_11086)
  2136. let {f32 res_11089} =
  2137. sitofp i32 b_11083 to f32
  2138. let {f32 bn_11090} =
  2139. fdiv32(res_11089, res_11086)
  2140. let {f32 x_11091} =
  2141. fsub32(1.0f32, an_11088)
  2142. let {f32 cn_11092} =
  2143. fsub32(x_11091, bn_11090)
  2144. in {a_11079, b_11083, c_11085, an_11088,
  2145. bn_11090, cn_11092}
  2146. } else {-1i32, -1i32, -1i32, -1.0f32,
  2147. -1.0f32, -1.0f32}
  2148. let {bool cond_11093} = slt32(0i32, res_11068)
  2149. let {bool res_11094} = sle32(0i32, res_11069)
  2150. let {bool x_11095} =
  2151. logand(cond_11093, res_11094)
  2152. let {bool res_11096} =
  2153. sle32(res_11069, res_11068)
  2154. let {bool x_11097} =
  2155. logand(x_11095, res_11096)
  2156. let {bool cond_11098} = sle32(res_11068, 0i32)
  2157. let {bool res_11099} =
  2158. sle32(res_11068, res_11069)
  2159. let {bool x_11100} =
  2160. logand(cond_11098, res_11099)
  2161. let {bool res_11101} = sle32(res_11069, 0i32)
  2162. let {bool x_11102} =
  2163. logand(x_11100, res_11101)
  2164. let {bool x_11103} = not x_11097
  2165. let {bool y_11104} = logand(x_11102, x_11103)
  2166. let {bool res_11105} = logor(x_11097, y_11104)
  2167. let {bool res_11106} = sle32(0i32, res_11070)
  2168. let {bool x_11107} =
  2169. logand(cond_11093, res_11106)
  2170. let {bool res_11108} =
  2171. sle32(res_11070, res_11068)
  2172. let {bool x_11109} =
  2173. logand(x_11107, res_11108)
  2174. let {bool res_11110} =
  2175. sle32(res_11068, res_11070)
  2176. let {bool x_11111} =
  2177. logand(cond_11098, res_11110)
  2178. let {bool res_11112} = sle32(res_11070, 0i32)
  2179. let {bool x_11113} =
  2180. logand(x_11111, res_11112)
  2181. let {bool x_11114} = not x_11109
  2182. let {bool y_11115} = logand(x_11113, x_11114)
  2183. let {bool res_11116} = logor(x_11109, y_11115)
  2184. let {bool x_11117} =
  2185. logand(res_11105, res_11116)
  2186. let {bool res_11118} = sle32(0i32, res_11071)
  2187. let {bool x_11119} =
  2188. logand(cond_11093, res_11118)
  2189. let {bool res_11120} =
  2190. sle32(res_11071, res_11068)
  2191. let {bool x_11121} =
  2192. logand(x_11119, res_11120)
  2193. let {bool res_11122} =
  2194. sle32(res_11068, res_11071)
  2195. let {bool x_11123} =
  2196. logand(cond_11098, res_11122)
  2197. let {bool res_11124} = sle32(res_11071, 0i32)
  2198. let {bool x_11125} =
  2199. logand(x_11123, res_11124)
  2200. let {bool x_11126} = not x_11121
  2201. let {bool y_11127} = logand(x_11125, x_11126)
  2202. let {bool res_11128} = logor(x_11121, y_11127)
  2203. let {bool x_11129} =
  2204. logand(x_11117, res_11128)
  2205. let {f32 x_11130} = fmul32(x_11051, res_11072)
  2206. let {f32 y_11131} = fmul32(x_11054, res_11073)
  2207. let {f32 x_11132} = fadd32(x_11130, y_11131)
  2208. let {f32 y_11133} = fmul32(x_11057, res_11074)
  2209. let {f32 res_11134} = fadd32(x_11132, y_11133)
  2210. in {x_11129, res_11134, x_11058},
  2211. res_7602, res_7603, res_7604, res_7605,
  2212. res_7606, res_7607, res_7608, res_7609,
  2213. res_7610, res_7617)
  2214. let {bool cond_11135} = eq_i32(res_11006, -1i32)
  2215. let {f32 res_11136, f32 res_11137, f32 res_11138} =
  2216. -- Branch returns: {f32, f32, f32}
  2217. if cond_11135
  2218. then {0.0f32, 0.0f32, 0.0f32} else {
  2219. let {i32 barycentric_coordinates_arg_11139} =
  2220. <index_certs_7601>
  2221. partition_res_7560[res_11006]
  2222. let {i32 barycentric_coordinates_arg_11140} =
  2223. <index_certs_7601>
  2224. partition_res_7561[res_11006]
  2225. let {i32 barycentric_coordinates_arg_11141} =
  2226. <index_certs_7601>
  2227. partition_res_7563[res_11006]
  2228. let {i32 barycentric_coordinates_arg_11142} =
  2229. <index_certs_7601>
  2230. partition_res_7564[res_11006]
  2231. let {i32 barycentric_coordinates_arg_11143} =
  2232. <index_certs_7601>
  2233. partition_res_7566[res_11006]
  2234. let {i32 barycentric_coordinates_arg_11144} =
  2235. <index_certs_7601>
  2236. partition_res_7567[res_11006]
  2237. let {i32 x_11145} =
  2238. sub32(barycentric_coordinates_arg_11142, barycentric_coordinates_arg_11144)
  2239. let {i32 y_11146} =
  2240. sub32(barycentric_coordinates_arg_11139, barycentric_coordinates_arg_11143)
  2241. let {i32 x_11147} = mul32(x_11145, y_11146)
  2242. let {i32 x_11148} =
  2243. sub32(barycentric_coordinates_arg_11143, barycentric_coordinates_arg_11141)
  2244. let {i32 y_11149} =
  2245. sub32(barycentric_coordinates_arg_11140, barycentric_coordinates_arg_11144)
  2246. let {i32 y_11150} = mul32(x_11148, y_11149)
  2247. let {i32 factor_11151} = add32(x_11147, y_11150)
  2248. let {bool cond_11152} = eq_i32(factor_11151, 0i32)
  2249. let {bool cond_11153} = not cond_11152
  2250. let {f32 res_11154, f32 res_11155, f32 res_11156} =
  2251. -- Branch returns: {f32, f32, f32}
  2252. if cond_11153
  2253. then {
  2254. let {i32 y_11157} =
  2255. sub32(res_11002, barycentric_coordinates_arg_11143)
  2256. let {i32 x_11158} = mul32(x_11145, y_11157)
  2257. let {i32 y_11159} =
  2258. sub32(res_11003, barycentric_coordinates_arg_11144)
  2259. let {i32 y_11160} = mul32(x_11148, y_11159)
  2260. let {i32 a_11161} = add32(x_11158, y_11160)
  2261. let {i32 x_11162} =
  2262. sub32(barycentric_coordinates_arg_11144, barycentric_coordinates_arg_11140)
  2263. let {i32 x_11163} = mul32(y_11157, x_11162)
  2264. let {i32 y_11164} = mul32(y_11146, y_11159)
  2265. let {i32 b_11165} = add32(x_11163, y_11164)
  2266. let {f32 res_11166} =
  2267. sitofp i32 factor_11151 to f32
  2268. let {f32 res_11167} = sitofp i32 a_11161 to f32
  2269. let {f32 an_11168} = fdiv32(res_11167, res_11166)
  2270. let {f32 res_11169} = sitofp i32 b_11165 to f32
  2271. let {f32 bn_11170} = fdiv32(res_11169, res_11166)
  2272. let {f32 x_11171} = fsub32(1.0f32, an_11168)
  2273. let {f32 cn_11172} = fsub32(x_11171, bn_11170)
  2274. in {an_11168, bn_11170, cn_11172}
  2275. } else {-1.0f32, -1.0f32, -1.0f32}
  2276. let {i32 color_point_arg_11173} =
  2277. <index_certs_7601>
  2278. partition_res_7569[res_11006]
  2279. let {f32 color_point_arg_11174} =
  2280. <index_certs_7601>
  2281. partition_res_7570[res_11006]
  2282. let {f32 color_point_arg_11175} =
  2283. <index_certs_7601>
  2284. partition_res_7571[res_11006]
  2285. let {f32 color_point_arg_11176} =
  2286. <index_certs_7601>
  2287. partition_res_7572[res_11006]
  2288. let {i32 color_point_arg_11177} =
  2289. <index_certs_7601>
  2290. partition_res_7573[res_11006]
  2291. let {bool cond_11178} =
  2292. eq_i32(color_point_arg_11173, 1i32)
  2293. let {f32 res_11179, f32 res_11180, f32 res_11181} =
  2294. -- Branch returns: {f32, f32, f32}
  2295. if cond_11178
  2296. then {color_point_arg_11174, color_point_arg_11175,
  2297. color_point_arg_11176} else {
  2298. let {bool cond_11182} =
  2299. eq_i32(color_point_arg_11173, 2i32)
  2300. let {f32 res_11183, f32 res_11184,
  2301. f32 res_11185} =
  2302. -- Branch returns: {f32, f32, f32}
  2303. if cond_11182
  2304. then {
  2305. let {i32 i_11186} =
  2306. sdiv32(color_point_arg_11177, 2i32)
  2307. let {i32 x_11187} =
  2308. and32(1i32, color_point_arg_11177)
  2309. let {bool cond_11188} = eq_i32(x_11187, 0i32)
  2310. let {f32 res_11189} =
  2311. -- Branch returns: {f32}
  2312. if cond_11188
  2313. then {0.0f32} else {1.0f32}
  2314. let {f32 res_11190} =
  2315. -- Branch returns: {f32}
  2316. if cond_11188
  2317. then {1.0f32} else {0.0f32}
  2318. let {f32 x_11191} =
  2319. fmul32(res_11154, res_11189)
  2320. let {f32 y_11192} =
  2321. fmul32(res_11155, res_11190)
  2322. let {f32 x_11193} = fadd32(x_11191, y_11192)
  2323. let {f32 y_11194} =
  2324. fmul32(res_11156, res_11189)
  2325. let {f32 yn_11195} = fadd32(x_11193, y_11194)
  2326. let {f32 y_11196} =
  2327. fmul32(res_11155, res_11189)
  2328. let {f32 x_11197} = fadd32(x_11191, y_11196)
  2329. let {f32 y_11198} =
  2330. fmul32(res_11156, res_11190)
  2331. let {f32 xn_11199} = fadd32(x_11197, y_11198)
  2332. let {f32 res_11200} =
  2333. sitofp i32 surface_h_7153 to f32
  2334. let {f32 t32_arg_11201} =
  2335. fmul32(yn_11195, res_11200)
  2336. let {i32 res_11202} =
  2337. fptosi f32 t32_arg_11201 to i32
  2338. let {f32 res_11203} =
  2339. sitofp i32 surface_w_7152 to f32
  2340. let {f32 t32_arg_11204} =
  2341. fmul32(xn_11199, res_11203)
  2342. let {i32 res_11205} =
  2343. fptosi f32 t32_arg_11204 to i32
  2344. let {i32 clamp_arg_11206} =
  2345. sub32(surface_h_7153, 1i32)
  2346. let {i32 res_11207} = smax32(0i32, res_11202)
  2347. let {i32 res_11208} =
  2348. smin32(clamp_arg_11206, res_11207)
  2349. let {i32 clamp_arg_11209} =
  2350. sub32(surface_w_7152, 1i32)
  2351. let {i32 res_11210} = smax32(0i32, res_11205)
  2352. let {i32 res_11211} =
  2353. smin32(clamp_arg_11209, res_11210)
  2354. let {i32 binop_y_11212} =
  2355. mul_nw32(surface_w_7152, surface_h_7153)
  2356. let {i32 binop_x_11213} =
  2357. mul_nw32(i_11186, binop_y_11212)
  2358. let {i32 binop_y_11214} =
  2359. mul_nw32(surface_w_7152, res_11208)
  2360. let {i32 binop_x_11215} =
  2361. add_nw32(binop_x_11213, binop_y_11214)
  2362. let {i32 new_index_11216} =
  2363. add_nw32(res_11211, binop_x_11215)
  2364. let {f32 res_11217} =
  2365. <dim_ok_7201>
  2366. surface_textures_flat_hsv_hs_7154[new_index_11216]
  2367. let {f32 res_11218} =
  2368. <empty_or_match_cert_7195, dim_ok_7201>
  2369. surface_textures_flat_hsv_ss_7155[new_index_11216]
  2370. let {f32 res_11219} =
  2371. <empty_or_match_cert_7197, dim_ok_7201>
  2372. surface_textures_flat_hsv_vs_7156[new_index_11216]
  2373. in {res_11217, res_11218, res_11219}
  2374. } else {0.0f32, 0.0f32, 0.0f32}
  2375. in {res_11183, res_11184, res_11185}
  2376. }
  2377. let {f32 y_11220} = fpow32(res_11005, 2.0f32)
  2378. let {f32 min_arg_11221} =
  2379. fdiv32(2000000.0f32, y_11220)
  2380. let {f32 res_11222} = fmin32(1.0f32, min_arg_11221)
  2381. let {f32 res_11223} = fmul32(res_11181, res_11222)
  2382. in {res_11179, res_11180, res_11223}
  2383. }
  2384. let {f32 c_11224} = fmul32(res_11137, res_11138)
  2385. let {f32 h'_11225} = fdiv32(res_11136, 60.0f32)
  2386. let {f32 t32_arg_11226} = fdiv32(h'_11225, 2.0f32)
  2387. let {i32 res_11227} = fptosi f32 t32_arg_11226 to i32
  2388. let {f32 res_11228} = sitofp i32 res_11227 to f32
  2389. let {f32 y_11229} = fmul32(2.0f32, res_11228)
  2390. let {f32 res_11230} = fsub32(h'_11225, y_11229)
  2391. let {f32 abs_arg_11231} = fsub32(res_11230, 1.0f32)
  2392. let {f32 res_11232} = fabs32 abs_arg_11231
  2393. let {f32 y_11233} = fsub32(1.0f32, res_11232)
  2394. let {f32 x_11234} = fmul32(c_11224, y_11233)
  2395. let {bool cond_11235} = le32(0.0f32, h'_11225)
  2396. let {bool res_11236} = lt32(h'_11225, 1.0f32)
  2397. let {bool x_11237} = logand(cond_11235, res_11236)
  2398. let {f32 res_11238, f32 res_11239, f32 res_11240} =
  2399. -- Branch returns: {f32, f32, f32}
  2400. if x_11237
  2401. then {c_11224, x_11234, 0.0f32} else {
  2402. let {bool cond_11241} = le32(1.0f32, h'_11225)
  2403. let {bool res_11242} = lt32(h'_11225, 2.0f32)
  2404. let {bool x_11243} = logand(cond_11241, res_11242)
  2405. let {f32 res_11244, f32 res_11245, f32 res_11246} =
  2406. -- Branch returns: {f32, f32, f32}
  2407. if x_11243
  2408. then {x_11234, c_11224, 0.0f32} else {
  2409. let {bool cond_11247} = le32(2.0f32, h'_11225)
  2410. let {bool res_11248} = lt32(h'_11225, 3.0f32)
  2411. let {bool x_11249} = logand(cond_11247, res_11248)
  2412. let {f32 res_11250, f32 res_11251,
  2413. f32 res_11252} =
  2414. -- Branch returns: {f32, f32, f32}
  2415. if x_11249
  2416. then {0.0f32, c_11224, x_11234} else {
  2417. let {bool cond_11253} = le32(3.0f32, h'_11225)
  2418. let {bool res_11254} = lt32(h'_11225, 4.0f32)
  2419. let {bool x_11255} =
  2420. logand(cond_11253, res_11254)
  2421. let {f32 res_11256} =
  2422. -- Branch returns: {f32}
  2423. if x_11255
  2424. then {x_11234} else {0.0f32}
  2425. let {f32 res_11257, f32 res_11258} =
  2426. -- Branch returns: {f32, f32}
  2427. if x_11255
  2428. then {0.0f32, c_11224} else {
  2429. let {bool cond_11259} =
  2430. le32(4.0f32, h'_11225)
  2431. let {bool res_11260} =
  2432. lt32(h'_11225, 5.0f32)
  2433. let {bool x_11261} =
  2434. logand(cond_11259, res_11260)
  2435. let {f32 res_11262, f32 res_11263} =
  2436. -- Branch returns: {f32, f32}
  2437. if x_11261
  2438. then {x_11234, c_11224} else {
  2439. let {bool cond_11264} =
  2440. le32(5.0f32, h'_11225)
  2441. let {bool res_11265} =
  2442. lt32(h'_11225, 6.0f32)
  2443. let {bool x_11266} =
  2444. logand(cond_11264, res_11265)
  2445. let {f32 res_11267} =
  2446. -- Branch returns: {f32}
  2447. if x_11266
  2448. then {c_11224} else {0.0f32}
  2449. let {f32 res_11268} =
  2450. -- Branch returns: {f32}
  2451. if x_11266
  2452. then {x_11234} else {0.0f32}
  2453. in {res_11267, res_11268}
  2454. }
  2455. in {res_11262, res_11263}
  2456. }
  2457. in {res_11257, res_11256, res_11258}
  2458. }
  2459. in {res_11250, res_11251, res_11252}
  2460. }
  2461. in {res_11244, res_11245, res_11246}
  2462. }
  2463. let {f32 m_11269} = fsub32(res_11138, c_11224)
  2464. let {f32 res_11270} = fadd32(res_11238, m_11269)
  2465. let {f32 res_11271} = fadd32(res_11239, m_11269)
  2466. let {f32 res_11272} = fadd32(res_11240, m_11269)
  2467. let {f32 f32_arg_11273} = fmul32(255.0f32, res_11270)
  2468. let {i32 unsign_arg_11274} =
  2469. fptoui f32 f32_arg_11273 to i32
  2470. let {f32 f32_arg_11275} = fmul32(255.0f32, res_11271)
  2471. let {i32 unsign_arg_11276} =
  2472. fptoui f32 f32_arg_11275 to i32
  2473. let {f32 f32_arg_11277} = fmul32(255.0f32, res_11272)
  2474. let {i32 unsign_arg_11278} =
  2475. fptoui f32 f32_arg_11277 to i32
  2476. let {i32 x_11279} = shl32(unsign_arg_11274, 16i32)
  2477. let {i32 y_11280} = shl32(unsign_arg_11276, 8i32)
  2478. let {i32 x_11281} = or32(x_11279, y_11280)
  2479. let {i32 res_11282} = or32(unsign_arg_11278, x_11281)
  2480. return {returns res_11282}
  2481. }
  2482. in {res_11000}
  2483. } else {
  2484. let {i64 replicate_arg_11603} =
  2485. sext i32 replicate_arg_7618 to i64
  2486. let {i64 nest_size_11604} =
  2487. mul_nw64(replicate_arg_11603, 1i64)
  2488. let {i32 segmap_group_size_11605} =
  2489. get_size(segmap_group_size_11595, group_size)
  2490. let {i64 segmap_group_size_11606} =
  2491. sext i32 segmap_group_size_11605 to i64
  2492. let {i64 segmap_usable_groups_64_11607} =
  2493. sdiv_up64(nest_size_11604, segmap_group_size_11606)
  2494. let {i32 segmap_usable_groups_11608} =
  2495. sext i64 segmap_usable_groups_64_11607 to i32
  2496. let {[replicate_arg_7618]i32 res_r_11609,
  2497. [replicate_arg_7618]i32 res_r_11610} =
  2498. segmap_thread
  2499. (#groups=segmap_usable_groups_11608; groupsize=segmap_group_size_11605)
  2500. (gtid_11591 < replicate_arg_7618) (~phys_tid_11592) : {i32,
  2501. i32} {
  2502. let {i32 x_11611} = res_8643[gtid_11591]
  2503. let {i32 res_11612} = sdiv32(x_11611, h_7134)
  2504. let {i32 res_11613} = smod32(x_11611, h_7134)
  2505. return {returns res_11612, returns res_11613}
  2506. }
  2507. let {i64 partition_size_11614} =
  2508. sext i32 partition_size_7544 to i64
  2509. let {i64 replicate_arg_11615} =
  2510. sext i32 replicate_arg_7618 to i64
  2511. let {i64 y_11616} = mul_nw64(replicate_arg_11615, 1i64)
  2512. let {i64 nest_size_11617} =
  2513. mul_nw64(partition_size_11614, y_11616)
  2514. let {i32 segred_group_size_11618} =
  2515. get_size(segred_group_size_11454, group_size)
  2516. let {i32 num_groups_11619} =
  2517. calc_num_groups(nest_size_11617, segred_num_groups_11456,
  2518. segred_group_size_11618)
  2519. let {i32 num_threads_11620} =
  2520. mul_nw32(num_groups_11619, segred_group_size_11618)
  2521. let {[replicate_arg_7618]bool res_11621,
  2522. [replicate_arg_7618]f32 res_r_11622,
  2523. [replicate_arg_7618]i32 res_r_11623} =
  2524. segred_thread
  2525. (#groups=num_groups_11619; groupsize=segred_group_size_11618)
  2526. ({{false, -1.0f32, -1i32},
  2527. [],
  2528. commutative fn {bool, f32, i32} (bool x_11624,
  2529. f32 x_11625, i32 x_11626,
  2530. bool x_11627,
  2531. f32 x_11628,
  2532. i32 x_11629) =>
  2533. let {bool res_11630} = le32(0.0f32, x_11625)
  2534. let {bool x_11631} = logand(x_11624, res_11630)
  2535. let {bool cond_11632} = lt32(x_11628, 0.0f32)
  2536. let {bool res_11633} = not x_11627
  2537. let {bool x_11634} = not cond_11632
  2538. let {bool y_11635} = logand(res_11633, x_11634)
  2539. let {bool cond_11636} = logor(cond_11632, y_11635)
  2540. let {bool res_11637} = lt32(x_11625, x_11628)
  2541. let {bool x_11638} = not cond_11636
  2542. let {bool y_11639} = logand(res_11637, x_11638)
  2543. let {bool res_11640} = logor(cond_11636, y_11639)
  2544. let {bool x_11641} = logand(x_11631, res_11640)
  2545. let {bool res_11642, f32 res_11643, i32 res_11644} =
  2546. -- Branch returns: {bool, f32, i32}
  2547. if x_11641
  2548. then {true, x_11625, x_11626} else {
  2549. let {bool res_11645} = le32(0.0f32, x_11628)
  2550. let {bool x_11646} = logand(x_11627, res_11645)
  2551. let {bool cond_11647} = lt32(x_11625, 0.0f32)
  2552. let {bool res_11648} = not x_11624
  2553. let {bool x_11649} = not cond_11647
  2554. let {bool y_11650} = logand(res_11648, x_11649)
  2555. let {bool cond_11651} = logor(cond_11647, y_11650)
  2556. let {bool res_11652} = lt32(x_11628, x_11625)
  2557. let {bool x_11653} = not cond_11651
  2558. let {bool y_11654} = logand(res_11652, x_11653)
  2559. let {bool res_11655} = logor(cond_11651, y_11654)
  2560. let {bool x_11656} = logand(x_11646, res_11655)
  2561. let {bool res_11657, f32 res_11658, i32 res_11659} =
  2562. -- Branch returns: {bool, f32, i32}
  2563. if x_11656
  2564. then {true, x_11628, x_11629} else {
  2565. let {bool x_11660} = logand(x_11627, x_11631)
  2566. let {bool x_11661} = logand(res_11645, x_11660)
  2567. let {bool res_11662} = eq_f32(x_11625, x_11628)
  2568. let {bool x_11663} = logand(x_11661, res_11662)
  2569. let {f32 res_11664} =
  2570. -- Branch returns: {f32}
  2571. if x_11663
  2572. then {x_11625} else {-1.0f32}
  2573. let {i32 res_11665} =
  2574. -- Branch returns: {i32}
  2575. if x_11663
  2576. then {x_11626} else {-1i32}
  2577. in {x_11663, res_11664, res_11665}
  2578. }
  2579. in {res_11657, res_11658, res_11659}
  2580. }
  2581. in {res_11642, res_11643, res_11644}})
  2582. (gtid_11449 < replicate_arg_7618,
  2583. gtid_11459 < partition_size_7544) (~phys_tid_11460) : {bool,
  2584. f32,
  2585. i32} {
  2586. let {i32 res_11666} = res_r_11609[gtid_11449]
  2587. let {i32 res_11667} = res_r_11610[gtid_11449]
  2588. let {i32 x_11668} = res_7602[gtid_11459]
  2589. let {i32 x_11669} = res_7603[gtid_11459]
  2590. let {f32 x_11670} = res_7604[gtid_11459]
  2591. let {i32 x_11671} = res_7605[gtid_11459]
  2592. let {i32 x_11672} = res_7606[gtid_11459]
  2593. let {f32 x_11673} = res_7607[gtid_11459]
  2594. let {i32 x_11674} = res_7608[gtid_11459]
  2595. let {i32 x_11675} = res_7609[gtid_11459]
  2596. let {f32 x_11676} = res_7610[gtid_11459]
  2597. let {i32 x_11677} = res_7617[gtid_11459]
  2598. let {i32 x_11678} = sub32(x_11672, x_11675)
  2599. let {i32 y_11679} = sub32(x_11668, x_11674)
  2600. let {i32 x_11680} = mul32(x_11678, y_11679)
  2601. let {i32 x_11681} = sub32(x_11674, x_11671)
  2602. let {i32 y_11682} = sub32(x_11669, x_11675)
  2603. let {i32 y_11683} = mul32(x_11681, y_11682)
  2604. let {i32 factor_11684} = add32(x_11680, y_11683)
  2605. let {bool cond_11685} = eq_i32(factor_11684, 0i32)
  2606. let {bool cond_11686} = not cond_11685
  2607. let {i32 res_11687} =
  2608. -- Branch returns: {i32}
  2609. if cond_11686
  2610. then {factor_11684} else {1i32}
  2611. let {i32 res_11688, i32 res_11689, i32 res_11690,
  2612. f32 res_11691, f32 res_11692, f32 res_11693} =
  2613. -- Branch returns: {i32, i32, i32, f32, f32, f32}
  2614. if cond_11686
  2615. then {
  2616. let {i32 y_11694} = sub32(res_11666, x_11674)
  2617. let {i32 x_11695} = mul32(x_11678, y_11694)
  2618. let {i32 y_11696} = sub32(res_11667, x_11675)
  2619. let {i32 y_11697} = mul32(x_11681, y_11696)
  2620. let {i32 a_11698} = add32(x_11695, y_11697)
  2621. let {i32 x_11699} = sub32(x_11675, x_11669)
  2622. let {i32 x_11700} = mul32(y_11694, x_11699)
  2623. let {i32 y_11701} = mul32(y_11679, y_11696)
  2624. let {i32 b_11702} = add32(x_11700, y_11701)
  2625. let {i32 x_11703} = sub32(factor_11684, a_11698)
  2626. let {i32 c_11704} = sub32(x_11703, b_11702)
  2627. let {f32 res_11705} = sitofp i32 factor_11684 to f32
  2628. let {f32 res_11706} = sitofp i32 a_11698 to f32
  2629. let {f32 an_11707} = fdiv32(res_11706, res_11705)
  2630. let {f32 res_11708} = sitofp i32 b_11702 to f32
  2631. let {f32 bn_11709} = fdiv32(res_11708, res_11705)
  2632. let {f32 x_11710} = fsub32(1.0f32, an_11707)
  2633. let {f32 cn_11711} = fsub32(x_11710, bn_11709)
  2634. in {a_11698, b_11702, c_11704, an_11707, bn_11709,
  2635. cn_11711}
  2636. } else {-1i32, -1i32, -1i32, -1.0f32, -1.0f32, -1.0f32}
  2637. let {bool cond_11712} = slt32(0i32, res_11687)
  2638. let {bool res_11713} = sle32(0i32, res_11688)
  2639. let {bool x_11714} = logand(cond_11712, res_11713)
  2640. let {bool res_11715} = sle32(res_11688, res_11687)
  2641. let {bool x_11716} = logand(x_11714, res_11715)
  2642. let {bool cond_11717} = sle32(res_11687, 0i32)
  2643. let {bool res_11718} = sle32(res_11687, res_11688)
  2644. let {bool x_11719} = logand(cond_11717, res_11718)
  2645. let {bool res_11720} = sle32(res_11688, 0i32)
  2646. let {bool x_11721} = logand(x_11719, res_11720)
  2647. let {bool x_11722} = not x_11716
  2648. let {bool y_11723} = logand(x_11721, x_11722)
  2649. let {bool res_11724} = logor(x_11716, y_11723)
  2650. let {bool res_11725} = sle32(0i32, res_11689)
  2651. let {bool x_11726} = logand(cond_11712, res_11725)
  2652. let {bool res_11727} = sle32(res_11689, res_11687)
  2653. let {bool x_11728} = logand(x_11726, res_11727)
  2654. let {bool res_11729} = sle32(res_11687, res_11689)
  2655. let {bool x_11730} = logand(cond_11717, res_11729)
  2656. let {bool res_11731} = sle32(res_11689, 0i32)
  2657. let {bool x_11732} = logand(x_11730, res_11731)
  2658. let {bool x_11733} = not x_11728
  2659. let {bool y_11734} = logand(x_11732, x_11733)
  2660. let {bool res_11735} = logor(x_11728, y_11734)
  2661. let {bool x_11736} = logand(res_11724, res_11735)
  2662. let {bool res_11737} = sle32(0i32, res_11690)
  2663. let {bool x_11738} = logand(cond_11712, res_11737)
  2664. let {bool res_11739} = sle32(res_11690, res_11687)
  2665. let {bool x_11740} = logand(x_11738, res_11739)
  2666. let {bool res_11741} = sle32(res_11687, res_11690)
  2667. let {bool x_11742} = logand(cond_11717, res_11741)
  2668. let {bool res_11743} = sle32(res_11690, 0i32)
  2669. let {bool x_11744} = logand(x_11742, res_11743)
  2670. let {bool x_11745} = not x_11740
  2671. let {bool y_11746} = logand(x_11744, x_11745)
  2672. let {bool res_11747} = logor(x_11740, y_11746)
  2673. let {bool x_11748} = logand(x_11736, res_11747)
  2674. let {f32 x_11749} = fmul32(x_11670, res_11691)
  2675. let {f32 y_11750} = fmul32(x_11673, res_11692)
  2676. let {f32 x_11751} = fadd32(x_11749, y_11750)
  2677. let {f32 y_11752} = fmul32(x_11676, res_11693)
  2678. let {f32 res_11753} = fadd32(x_11751, y_11752)
  2679. return {returns x_11748, returns res_11753,
  2680. returns x_11677}
  2681. }
  2682. let {i64 replicate_arg_11754} =
  2683. sext i32 replicate_arg_7618 to i64
  2684. let {i64 nest_size_11755} =
  2685. mul_nw64(replicate_arg_11754, 1i64)
  2686. let {i32 segmap_group_size_11756} =
  2687. get_size(segmap_group_size_11291, group_size)
  2688. let {i64 segmap_group_size_11757} =
  2689. sext i32 segmap_group_size_11756 to i64
  2690. let {i64 segmap_usable_groups_64_11758} =
  2691. sdiv_up64(nest_size_11755, segmap_group_size_11757)
  2692. let {i32 segmap_usable_groups_11759} =
  2693. sext i64 segmap_usable_groups_64_11758 to i32
  2694. let {[replicate_arg_7618]i32 res_11760} =
  2695. segmap_thread
  2696. (#groups=segmap_usable_groups_11759; groupsize=segmap_group_size_11756)
  2697. (gtid_11287 < replicate_arg_7618) (~phys_tid_11288) : {i32} {
  2698. let {i32 res_11761} = res_r_11609[gtid_11287]
  2699. let {i32 res_11762} = res_r_11610[gtid_11287]
  2700. let {f32 res_11763} = res_r_11622[gtid_11287]
  2701. let {i32 res_11764} = res_r_11623[gtid_11287]
  2702. let {bool cond_11765} = eq_i32(res_11764, -1i32)
  2703. let {f32 res_11766, f32 res_11767, f32 res_11768} =
  2704. -- Branch returns: {f32, f32, f32}
  2705. if cond_11765
  2706. then {0.0f32, 0.0f32, 0.0f32} else {
  2707. let {i32 barycentric_coordinates_arg_11769} =
  2708. <index_certs_7601>
  2709. partition_res_7560[res_11764]
  2710. let {i32 barycentric_coordinates_arg_11770} =
  2711. <index_certs_7601>
  2712. partition_res_7561[res_11764]
  2713. let {i32 barycentric_coordinates_arg_11771} =
  2714. <index_certs_7601>
  2715. partition_res_7563[res_11764]
  2716. let {i32 barycentric_coordinates_arg_11772} =
  2717. <index_certs_7601>
  2718. partition_res_7564[res_11764]
  2719. let {i32 barycentric_coordinates_arg_11773} =
  2720. <index_certs_7601>
  2721. partition_res_7566[res_11764]
  2722. let {i32 barycentric_coordinates_arg_11774} =
  2723. <index_certs_7601>
  2724. partition_res_7567[res_11764]
  2725. let {i32 x_11775} =
  2726. sub32(barycentric_coordinates_arg_11772, barycentric_coordinates_arg_11774)
  2727. let {i32 y_11776} =
  2728. sub32(barycentric_coordinates_arg_11769, barycentric_coordinates_arg_11773)
  2729. let {i32 x_11777} = mul32(x_11775, y_11776)
  2730. let {i32 x_11778} =
  2731. sub32(barycentric_coordinates_arg_11773, barycentric_coordinates_arg_11771)
  2732. let {i32 y_11779} =
  2733. sub32(barycentric_coordinates_arg_11770, barycentric_coordinates_arg_11774)
  2734. let {i32 y_11780} = mul32(x_11778, y_11779)
  2735. let {i32 factor_11781} = add32(x_11777, y_11780)
  2736. let {bool cond_11782} = eq_i32(factor_11781, 0i32)
  2737. let {bool cond_11783} = not cond_11782
  2738. let {f32 res_11784, f32 res_11785, f32 res_11786} =
  2739. -- Branch returns: {f32, f32, f32}
  2740. if cond_11783
  2741. then {
  2742. let {i32 y_11787} =
  2743. sub32(res_11761, barycentric_coordinates_arg_11773)
  2744. let {i32 x_11788} = mul32(x_11775, y_11787)
  2745. let {i32 y_11789} =
  2746. sub32(res_11762, barycentric_coordinates_arg_11774)
  2747. let {i32 y_11790} = mul32(x_11778, y_11789)
  2748. let {i32 a_11791} = add32(x_11788, y_11790)
  2749. let {i32 x_11792} =
  2750. sub32(barycentric_coordinates_arg_11774, barycentric_coordinates_arg_11770)
  2751. let {i32 x_11793} = mul32(y_11787, x_11792)
  2752. let {i32 y_11794} = mul32(y_11776, y_11789)
  2753. let {i32 b_11795} = add32(x_11793, y_11794)
  2754. let {f32 res_11796} =
  2755. sitofp i32 factor_11781 to f32
  2756. let {f32 res_11797} = sitofp i32 a_11791 to f32
  2757. let {f32 an_11798} = fdiv32(res_11797, res_11796)
  2758. let {f32 res_11799} = sitofp i32 b_11795 to f32
  2759. let {f32 bn_11800} = fdiv32(res_11799, res_11796)
  2760. let {f32 x_11801} = fsub32(1.0f32, an_11798)
  2761. let {f32 cn_11802} = fsub32(x_11801, bn_11800)
  2762. in {an_11798, bn_11800, cn_11802}
  2763. } else {-1.0f32, -1.0f32, -1.0f32}
  2764. let {i32 color_point_arg_11803} =
  2765. <index_certs_7601>
  2766. partition_res_7569[res_11764]
  2767. let {f32 color_point_arg_11804} =
  2768. <index_certs_7601>
  2769. partition_res_7570[res_11764]
  2770. let {f32 color_point_arg_11805} =
  2771. <index_certs_7601>
  2772. partition_res_7571[res_11764]
  2773. let {f32 color_point_arg_11806} =
  2774. <index_certs_7601>
  2775. partition_res_7572[res_11764]
  2776. let {i32 color_point_arg_11807} =
  2777. <index_certs_7601>
  2778. partition_res_7573[res_11764]
  2779. let {bool cond_11808} =
  2780. eq_i32(color_point_arg_11803, 1i32)
  2781. let {f32 res_11809, f32 res_11810, f32 res_11811} =
  2782. -- Branch returns: {f32, f32, f32}
  2783. if cond_11808
  2784. then {color_point_arg_11804, color_point_arg_11805,
  2785. color_point_arg_11806} else {
  2786. let {bool cond_11812} =
  2787. eq_i32(color_point_arg_11803, 2i32)
  2788. let {f32 res_11813, f32 res_11814,
  2789. f32 res_11815} =
  2790. -- Branch returns: {f32, f32, f32}
  2791. if cond_11812
  2792. then {
  2793. let {i32 i_11816} =
  2794. sdiv32(color_point_arg_11807, 2i32)
  2795. let {i32 x_11817} =
  2796. and32(1i32, color_point_arg_11807)
  2797. let {bool cond_11818} = eq_i32(x_11817, 0i32)
  2798. let {f32 res_11819} =
  2799. -- Branch returns: {f32}
  2800. if cond_11818
  2801. then {0.0f32} else {1.0f32}
  2802. let {f32 res_11820} =
  2803. -- Branch returns: {f32}
  2804. if cond_11818
  2805. then {1.0f32} else {0.0f32}
  2806. let {f32 x_11821} =
  2807. fmul32(res_11784, res_11819)
  2808. let {f32 y_11822} =
  2809. fmul32(res_11785, res_11820)
  2810. let {f32 x_11823} = fadd32(x_11821, y_11822)
  2811. let {f32 y_11824} =
  2812. fmul32(res_11786, res_11819)
  2813. let {f32 yn_11825} = fadd32(x_11823, y_11824)
  2814. let {f32 y_11826} =
  2815. fmul32(res_11785, res_11819)
  2816. let {f32 x_11827} = fadd32(x_11821, y_11826)
  2817. let {f32 y_11828} =
  2818. fmul32(res_11786, res_11820)
  2819. let {f32 xn_11829} = fadd32(x_11827, y_11828)
  2820. let {f32 res_11830} =
  2821. sitofp i32 surface_h_7153 to f32
  2822. let {f32 t32_arg_11831} =
  2823. fmul32(yn_11825, res_11830)
  2824. let {i32 res_11832} =
  2825. fptosi f32 t32_arg_11831 to i32
  2826. let {f32 res_11833} =
  2827. sitofp i32 surface_w_7152 to f32
  2828. let {f32 t32_arg_11834} =
  2829. fmul32(xn_11829, res_11833)
  2830. let {i32 res_11835} =
  2831. fptosi f32 t32_arg_11834 to i32
  2832. let {i32 clamp_arg_11836} =
  2833. sub32(surface_h_7153, 1i32)
  2834. let {i32 res_11837} = smax32(0i32, res_11832)
  2835. let {i32 res_11838} =
  2836. smin32(clamp_arg_11836, res_11837)
  2837. let {i32 clamp_arg_11839} =
  2838. sub32(surface_w_7152, 1i32)
  2839. let {i32 res_11840} = smax32(0i32, res_11835)
  2840. let {i32 res_11841} =
  2841. smin32(clamp_arg_11839, res_11840)
  2842. let {i32 binop_y_11842} =
  2843. mul_nw32(surface_w_7152, surface_h_7153)
  2844. let {i32 binop_x_11843} =
  2845. mul_nw32(i_11816, binop_y_11842)
  2846. let {i32 binop_y_11844} =
  2847. mul_nw32(surface_w_7152, res_11838)
  2848. let {i32 binop_x_11845} =
  2849. add_nw32(binop_x_11843, binop_y_11844)
  2850. let {i32 new_index_11846} =
  2851. add_nw32(res_11841, binop_x_11845)
  2852. let {f32 res_11847} =
  2853. <dim_ok_7201>
  2854. surface_textures_flat_hsv_hs_7154[new_index_11846]
  2855. let {f32 res_11848} =
  2856. <empty_or_match_cert_7195, dim_ok_7201>
  2857. surface_textures_flat_hsv_ss_7155[new_index_11846]
  2858. let {f32 res_11849} =
  2859. <empty_or_match_cert_7197, dim_ok_7201>
  2860. surface_textures_flat_hsv_vs_7156[new_index_11846]
  2861. in {res_11847, res_11848, res_11849}
  2862. } else {0.0f32, 0.0f32, 0.0f32}
  2863. in {res_11813, res_11814, res_11815}
  2864. }
  2865. let {f32 y_11850} = fpow32(res_11763, 2.0f32)
  2866. let {f32 min_arg_11851} =
  2867. fdiv32(2000000.0f32, y_11850)
  2868. let {f32 res_11852} = fmin32(1.0f32, min_arg_11851)
  2869. let {f32 res_11853} = fmul32(res_11811, res_11852)
  2870. in {res_11809, res_11810, res_11853}
  2871. }
  2872. let {f32 c_11854} = fmul32(res_11767, res_11768)
  2873. let {f32 h'_11855} = fdiv32(res_11766, 60.0f32)
  2874. let {f32 t32_arg_11856} = fdiv32(h'_11855, 2.0f32)
  2875. let {i32 res_11857} = fptosi f32 t32_arg_11856 to i32
  2876. let {f32 res_11858} = sitofp i32 res_11857 to f32
  2877. let {f32 y_11859} = fmul32(2.0f32, res_11858)
  2878. let {f32 res_11860} = fsub32(h'_11855, y_11859)
  2879. let {f32 abs_arg_11861} = fsub32(res_11860, 1.0f32)
  2880. let {f32 res_11862} = fabs32 abs_arg_11861
  2881. let {f32 y_11863} = fsub32(1.0f32, res_11862)
  2882. let {f32 x_11864} = fmul32(c_11854, y_11863)
  2883. let {bool cond_11865} = le32(0.0f32, h'_11855)
  2884. let {bool res_11866} = lt32(h'_11855, 1.0f32)
  2885. let {bool x_11867} = logand(cond_11865, res_11866)
  2886. let {f32 res_11868, f32 res_11869, f32 res_11870} =
  2887. -- Branch returns: {f32, f32, f32}
  2888. if x_11867
  2889. then {c_11854, x_11864, 0.0f32} else {
  2890. let {bool cond_11871} = le32(1.0f32, h'_11855)
  2891. let {bool res_11872} = lt32(h'_11855, 2.0f32)
  2892. let {bool x_11873} = logand(cond_11871, res_11872)
  2893. let {f32 res_11874, f32 res_11875, f32 res_11876} =
  2894. -- Branch returns: {f32, f32, f32}
  2895. if x_11873
  2896. then {x_11864, c_11854, 0.0f32} else {
  2897. let {bool cond_11877} = le32(2.0f32, h'_11855)
  2898. let {bool res_11878} = lt32(h'_11855, 3.0f32)
  2899. let {bool x_11879} = logand(cond_11877, res_11878)
  2900. let {f32 res_11880, f32 res_11881,
  2901. f32 res_11882} =
  2902. -- Branch returns: {f32, f32, f32}
  2903. if x_11879
  2904. then {0.0f32, c_11854, x_11864} else {
  2905. let {bool cond_11883} = le32(3.0f32, h'_11855)
  2906. let {bool res_11884} = lt32(h'_11855, 4.0f32)
  2907. let {bool x_11885} =
  2908. logand(cond_11883, res_11884)
  2909. let {f32 res_11886} =
  2910. -- Branch returns: {f32}
  2911. if x_11885
  2912. then {x_11864} else {0.0f32}
  2913. let {f32 res_11887, f32 res_11888} =
  2914. -- Branch returns: {f32, f32}
  2915. if x_11885
  2916. then {0.0f32, c_11854} else {
  2917. let {bool cond_11889} =
  2918. le32(4.0f32, h'_11855)
  2919. let {bool res_11890} =
  2920. lt32(h'_11855, 5.0f32)
  2921. let {bool x_11891} =
  2922. logand(cond_11889, res_11890)
  2923. let {f32 res_11892, f32 res_11893} =
  2924. -- Branch returns: {f32, f32}
  2925. if x_11891
  2926. then {x_11864, c_11854} else {
  2927. let {bool cond_11894} =
  2928. le32(5.0f32, h'_11855)
  2929. let {bool res_11895} =
  2930. lt32(h'_11855, 6.0f32)
  2931. let {bool x_11896} =
  2932. logand(cond_11894, res_11895)
  2933. let {f32 res_11897} =
  2934. -- Branch returns: {f32}
  2935. if x_11896
  2936. then {c_11854} else {0.0f32}
  2937. let {f32 res_11898} =
  2938. -- Branch returns: {f32}
  2939. if x_11896
  2940. then {x_11864} else {0.0f32}
  2941. in {res_11897, res_11898}
  2942. }
  2943. in {res_11892, res_11893}
  2944. }
  2945. in {res_11887, res_11886, res_11888}
  2946. }
  2947. in {res_11880, res_11881, res_11882}
  2948. }
  2949. in {res_11874, res_11875, res_11876}
  2950. }
  2951. let {f32 m_11899} = fsub32(res_11768, c_11854)
  2952. let {f32 res_11900} = fadd32(res_11868, m_11899)
  2953. let {f32 res_11901} = fadd32(res_11869, m_11899)
  2954. let {f32 res_11902} = fadd32(res_11870, m_11899)
  2955. let {f32 f32_arg_11903} = fmul32(255.0f32, res_11900)
  2956. let {i32 unsign_arg_11904} =
  2957. fptoui f32 f32_arg_11903 to i32
  2958. let {f32 f32_arg_11905} = fmul32(255.0f32, res_11901)
  2959. let {i32 unsign_arg_11906} =
  2960. fptoui f32 f32_arg_11905 to i32
  2961. let {f32 f32_arg_11907} = fmul32(255.0f32, res_11902)
  2962. let {i32 unsign_arg_11908} =
  2963. fptoui f32 f32_arg_11907 to i32
  2964. let {i32 x_11909} = shl32(unsign_arg_11904, 16i32)
  2965. let {i32 y_11910} = shl32(unsign_arg_11906, 8i32)
  2966. let {i32 x_11911} = or32(x_11909, y_11910)
  2967. let {i32 res_11912} = or32(unsign_arg_11908, x_11911)
  2968. return {returns res_11912}
  2969. }
  2970. -- res_11913 aliases res_11760
  2971. let {[replicate_arg_7618]i32 res_11913} = res_11760
  2972. in {res_11913}
  2973. }
  2974. -- res_8927 aliases res_8644
  2975. let {[w_7133][h_7134]i32 res_8927} =
  2976. <range_valid_c_8642>
  2977. reshape((w_7133, h_7134), res_8644)
  2978. in {res_8927}
  2979. } else {
  2980. let {bool zero_8928} = eq_i32(n_draw_rects_x_7131, 0i32)
  2981. let {bool nonzero_8929} = not zero_8928
  2982. let {cert nonzero_cert_8930} =
  2983. assert(nonzero_8929, "division by zero",
  2984. "futracerlib/render.fut:206:19-31")
  2985. let {i32 x_8931} =
  2986. <nonzero_cert_8930>
  2987. sdiv32(w_7133, n_draw_rects_x_7131)
  2988. let {i32 x_8932} =
  2989. <nonzero_cert_8930>
  2990. smod32(w_7133, n_draw_rects_x_7131)
  2991. let {bool bool_arg_8933} = slt32(0i32, x_8932)
  2992. let {i32 res_8934} = btoi bool bool_arg_8933 to i32
  2993. let {i32 x_size_8935} = add32(x_8931, res_8934)
  2994. let {bool zero_8936} = eq_i32(n_draw_rects_y_7132, 0i32)
  2995. let {bool nonzero_8937} = not zero_8936
  2996. let {cert nonzero_cert_8938} =
  2997. assert(nonzero_8937, "division by zero",
  2998. "futracerlib/render.fut:207:19-31")
  2999. let {i32 x_8939} =
  3000. <nonzero_cert_8938>
  3001. sdiv32(h_7134, n_draw_rects_y_7132)
  3002. let {i32 x_8940} =
  3003. <nonzero_cert_8938>
  3004. smod32(h_7134, n_draw_rects_y_7132)
  3005. let {bool bool_arg_8941} = slt32(0i32, x_8940)
  3006. let {i32 res_8942} = btoi bool bool_arg_8941 to i32
  3007. let {i32 y_size_8943} = add32(x_8939, res_8942)
  3008. let {bool bounds_invalid_upwards_8944} =
  3009. slt32(n_draw_rects_x_7131, 0i32)
  3010. let {bool valid_8945} = not bounds_invalid_upwards_8944
  3011. let {cert range_valid_c_8946} =
  3012. assert(valid_8945, "Range ", 0i32, "..", 1i32, "..<",
  3013. n_draw_rects_x_7131, " is invalid.",
  3014. "/prelude/math.fut:453:23-30")
  3015. let {[n_draw_rects_x_7131]i32 res_8947} =
  3016. <range_valid_c_8946>
  3017. iota32(n_draw_rects_x_7131, 0i32, 1i32)
  3018. let {bool bounds_invalid_upwards_8948} =
  3019. slt32(n_draw_rects_y_7132, 0i32)
  3020. let {bool valid_8949} = not bounds_invalid_upwards_8948
  3021. let {cert range_valid_c_8950} =
  3022. assert(valid_8949, "Range ", 0i32, "..", 1i32, "..<",
  3023. n_draw_rects_y_7132, " is invalid.",
  3024. "/prelude/math.fut:453:23-30")
  3025. let {[n_draw_rects_y_7132]i32 res_8951} =
  3026. <range_valid_c_8950>
  3027. iota32(n_draw_rects_y_7132, 0i32, 1i32)
  3028. let {i32 comparatee_11914} = mul_nw32(n_draw_rects_y_7132, 1i32)
  3029. let {bool suff_outer_par_11915} =
  3030. get_size(suff_outer_par_4, threshold ()) <= comparatee_11914
  3031. let {i64 n_draw_rects_y_11951} =
  3032. sext i32 n_draw_rects_y_7132 to i64
  3033. let {i64 nest_size_11952} = mul_nw64(n_draw_rects_y_11951, 1i64)
  3034. let {i32 segmap_group_size_11953} =
  3035. get_size(segmap_group_size_11943, group_size)
  3036. let {i64 segmap_group_size_11954} =
  3037. sext i32 segmap_group_size_11953 to i64
  3038. let {i64 segmap_usable_groups_64_11955} =
  3039. sdiv_up64(nest_size_11952, segmap_group_size_11954)
  3040. let {i32 segmap_usable_groups_11956} =
  3041. sext i64 segmap_usable_groups_64_11955 to i32
  3042. let {[n_draw_rects_y_7132]i32 res_11957,
  3043. [n_draw_rects_y_7132]i32 res_11958} =
  3044. <range_valid_c_8950>
  3045. segmap_thread
  3046. (#groups=segmap_usable_groups_11956; groupsize=segmap_group_size_11953)
  3047. (gtid_11939 < n_draw_rects_y_7132) (~phys_tid_11940) : {i32,
  3048. i32} {
  3049. let {i32 x_11959} = res_8951[gtid_11939]
  3050. let {i32 y0_11960} = mul32(y_size_8943, x_11959)
  3051. let {i32 y1_11961} = add32(y_size_8943, y0_11960)
  3052. return {returns y0_11960, returns y1_11961}
  3053. }
  3054. -- res_8952 aliases res_11957
  3055. let {[n_draw_rects_y_7132]i32 res_8952} = res_11957
  3056. -- res_8953 aliases res_11958
  3057. let {[n_draw_rects_y_7132]i32 res_8953} = res_11958
  3058. let {i32 comparatee_11962} = mul_nw32(n_draw_rects_x_7131, 1i32)
  3059. let {bool suff_outer_par_11963} =
  3060. get_size(suff_outer_par_5, threshold ()) <= comparatee_11962
  3061. let {i64 n_draw_rects_x_12092} =
  3062. sext i32 n_draw_rects_x_7131 to i64
  3063. let {i64 nest_size_12093} = mul_nw64(n_draw_rects_x_12092, 1i64)
  3064. let {i32 segmap_group_size_12094} =
  3065. get_size(segmap_group_size_12084, group_size)
  3066. let {i64 segmap_group_size_12095} =
  3067. sext i32 segmap_group_size_12094 to i64
  3068. let {i64 segmap_usable_groups_64_12096} =
  3069. sdiv_up64(nest_size_12093, segmap_group_size_12095)
  3070. let {i32 segmap_usable_groups_12097} =
  3071. sext i64 segmap_usable_groups_64_12096 to i32
  3072. let {[n_draw_rects_x_7131]i32 x0_r_12098,
  3073. [n_draw_rects_x_7131]i32 x1_r_12099} =
  3074. segmap_thread
  3075. (#groups=segmap_usable_groups_12097; groupsize=segmap_group_size_12094)
  3076. (gtid_12080 < n_draw_rects_x_7131) (~phys_tid_12081) : {i32,
  3077. i32} {
  3078. let {i32 x_12100} = res_8947[gtid_12080]
  3079. let {i32 x0_12101} = mul32(x_size_8935, x_12100)
  3080. let {i32 x1_12102} = add32(x_size_8935, x0_12101)
  3081. return {returns x0_12101, returns x1_12102}
  3082. }
  3083. let {i64 n_draw_rects_x_12103} =
  3084. sext i32 n_draw_rects_x_7131 to i64
  3085. let {i64 n_draw_rects_y_12104} =
  3086. sext i32 n_draw_rects_y_7132 to i64
  3087. let {i64 y_12105} = mul_nw64(n_draw_rects_y_12104, 1i64)
  3088. let {i64 nest_size_12106} =
  3089. mul_nw64(n_draw_rects_x_12103, y_12105)
  3090. let {i32 segmap_group_size_12107} =
  3091. get_size(segmap_group_size_12044, group_size)
  3092. let {i64 segmap_group_size_12108} =
  3093. sext i32 segmap_group_size_12107 to i64
  3094. let {i64 segmap_usable_groups_64_12109} =
  3095. sdiv_up64(nest_size_12106, segmap_group_size_12108)
  3096. let {i32 segmap_usable_groups_12110} =
  3097. sext i64 segmap_usable_groups_64_12109 to i32
  3098. let {i32 y_12111} = mul_nw32(n_draw_rects_y_7132, 1i32)
  3099. let {i32 comparatee_12112} =
  3100. mul_nw32(n_draw_rects_x_7131, y_12111)
  3101. let {bool suff_outer_par_12113} =
  3102. get_size(suff_outer_par_7,
  3103. threshold (!suff_outer_par_5)) <= comparatee_12112
  3104. let {i64 n_draw_rects_x_12114} =
  3105. sext i32 n_draw_rects_x_7131 to i64
  3106. let {i64 n_draw_rects_y_12115} =
  3107. sext i32 n_draw_rects_y_7132 to i64
  3108. let {i64 y_12116} = mul_nw64(n_draw_rects_y_12115, 1i64)
  3109. let {i64 nest_size_12117} =
  3110. mul_nw64(n_draw_rects_x_12114, y_12116)
  3111. let {i32 segmap_group_size_12118} =
  3112. get_size(segmap_group_size_12062, group_size)
  3113. let {i64 segmap_group_size_12119} =
  3114. sext i32 segmap_group_size_12118 to i64
  3115. let {i64 segmap_usable_groups_64_12120} =
  3116. sdiv_up64(nest_size_12117, segmap_group_size_12119)
  3117. let {i32 segmap_usable_groups_12121} =
  3118. sext i64 segmap_usable_groups_64_12120 to i32
  3119. let {[n_draw_rects_x_7131][n_draw_rects_y_7132]i32 res_12122} =
  3120. segmap_thread
  3121. (#groups=segmap_usable_groups_12121; groupsize=segmap_group_size_12118)
  3122. (gtid_12055 < n_draw_rects_x_7131,
  3123. gtid_12056 < n_draw_rects_y_7132) (~phys_tid_12057) : {i32} {
  3124. let {i32 x0_12123} = x0_r_12098[gtid_12055]
  3125. let {i32 tmp_12124} = replicate([], x0_12123)
  3126. return {returns tmp_12124}
  3127. }
  3128. -- res_12125 aliases res_12122
  3129. let {[n_draw_rects_x_7131][n_draw_rects_y_7132]i32 res_12125} =
  3130. res_12122
  3131. let {i64 n_draw_rects_x_12126} =
  3132. sext i32 n_draw_rects_x_7131 to i64
  3133. let {i64 n_draw_rects_y_12127} =
  3134. sext i32 n_draw_rects_y_7132 to i64
  3135. let {i64 y_12128} = mul_nw64(n_draw_rects_y_12127, 1i64)
  3136. let {i64 nest_size_12129} =
  3137. mul_nw64(n_draw_rects_x_12126, y_12128)
  3138. let {i32 segmap_group_size_12130} =
  3139. get_size(segmap_group_size_11999, group_size)
  3140. let {i64 segmap_group_size_12131} =
  3141. sext i32 segmap_group_size_12130 to i64
  3142. let {i64 segmap_usable_groups_64_12132} =
  3143. sdiv_up64(nest_size_12129, segmap_group_size_12131)
  3144. let {i32 segmap_usable_groups_12133} =
  3145. sext i64 segmap_usable_groups_64_12132 to i32
  3146. let {i32 y_12134} = mul_nw32(n_draw_rects_y_7132, 1i32)
  3147. let {i32 comparatee_12135} =
  3148. mul_nw32(n_draw_rects_x_7131, y_12134)
  3149. let {bool suff_outer_par_12136} =
  3150. get_size(suff_outer_par_6,
  3151. threshold (!suff_outer_par_5)) <= comparatee_12135
  3152. let {i64 n_draw_rects_x_12137} =
  3153. sext i32 n_draw_rects_x_7131 to i64
  3154. let {i64 n_draw_rects_y_12138} =
  3155. sext i32 n_draw_rects_y_7132 to i64
  3156. let {i64 y_12139} = mul_nw64(n_draw_rects_y_12138, 1i64)
  3157. let {i64 nest_size_12140} =
  3158. mul_nw64(n_draw_rects_x_12137, y_12139)
  3159. let {i32 segmap_group_size_12141} =
  3160. get_size(segmap_group_size_12017, group_size)
  3161. let {i64 segmap_group_size_12142} =
  3162. sext i32 segmap_group_size_12141 to i64
  3163. let {i64 segmap_usable_groups_64_12143} =
  3164. sdiv_up64(nest_size_12140, segmap_group_size_12142)
  3165. let {i32 segmap_usable_groups_12144} =
  3166. sext i64 segmap_usable_groups_64_12143 to i32
  3167. let {[n_draw_rects_x_7131][n_draw_rects_y_7132]i32 res_12145} =
  3168. segmap_thread
  3169. (#groups=segmap_usable_groups_12144; groupsize=segmap_group_size_12141)
  3170. (gtid_12010 < n_draw_rects_x_7131,
  3171. gtid_12011 < n_draw_rects_y_7132) (~phys_tid_12012) : {i32} {
  3172. let {i32 x1_12146} = x1_r_12099[gtid_12010]
  3173. let {i32 tmp_12147} = replicate([], x1_12146)
  3174. return {returns tmp_12147}
  3175. }
  3176. -- res_12148 aliases res_12145
  3177. let {[n_draw_rects_x_7131][n_draw_rects_y_7132]i32 res_12148} =
  3178. res_12145
  3179. -- res_8957 aliases res_12125
  3180. let {[n_draw_rects_x_7131][n_draw_rects_y_7132]i32 res_8957} =
  3181. res_12125
  3182. -- res_8958 aliases res_12148
  3183. let {[n_draw_rects_x_7131][n_draw_rects_y_7132]i32 res_8958} =
  3184. res_12148
  3185. let {i32 lifted_0_rect_pixel_indices_arg_8964} =
  3186. mul32(x_size_8935, y_size_8943)
  3187. -- reshape_8965 aliases res_8957
  3188. let {[n_total_8638]i32 reshape_8965} =
  3189. <range_valid_c_8946>
  3190. reshape((n_total_8638), res_8957)
  3191. let {[n_draw_rects_x_7131][n_draw_rects_y_7132]i32 repeat_8966} =
  3192. replicate([n_draw_rects_x_7131], res_8952)
  3193. -- reshape_8967 aliases repeat_8966
  3194. let {[n_total_8638]i32 reshape_8967} =
  3195. <range_valid_c_8946>
  3196. reshape((n_total_8638), repeat_8966)
  3197. -- reshape_8968 aliases res_8958
  3198. let {[n_total_8638]i32 reshape_8968} =
  3199. <range_valid_c_8946>
  3200. reshape((n_total_8638), res_8958)
  3201. let {[n_draw_rects_x_7131][n_draw_rects_y_7132]i32 repeat_8969} =
  3202. replicate([n_draw_rects_x_7131], res_8953)
  3203. -- reshape_8970 aliases repeat_8969
  3204. let {[n_total_8638]i32 reshape_8970} =
  3205. <range_valid_c_8946>
  3206. reshape((n_total_8638), repeat_8969)
  3207. let {i32 comparatee_12149} = mul_nw32(n_total_8638, 1i32)
  3208. let {bool suff_outer_par_12150} =
  3209. get_size(suff_outer_par_8, threshold ()) <= comparatee_12149
  3210. let {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_8971,
  3211. [n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_8972} =
  3212. -- Branch returns: {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32,
  3213. -- [n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32}
  3214. if <equiv> suff_outer_par_12150
  3215. then {
  3216. let {i64 n_total_12892} = sext i32 n_total_8638 to i64
  3217. let {i64 nest_size_12893} = mul_nw64(n_total_12892, 1i64)
  3218. let {i32 segmap_group_size_12894} =
  3219. get_size(segmap_group_size_12475, group_size)
  3220. let {i32 num_groups_12895} =
  3221. calc_num_groups(nest_size_12893, segmap_num_groups_12477,
  3222. segmap_group_size_12894)
  3223. let {i32 num_threads_12896} =
  3224. mul_nw32(num_groups_12895, segmap_group_size_12894)
  3225. let {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_12897,
  3226. [n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_12898} =
  3227. segmap_thread
  3228. (#groups=num_groups_12895; groupsize=segmap_group_size_12894; virtualise)
  3229. (gtid_12471 < n_total_8638) (~phys_tid_12472) : {[lifted_0_rect_pixel_indices_arg_8964]i32,
  3230. [lifted_0_rect_pixel_indices_arg_8964]i32} {
  3231. let {i32 x_12899} = reshape_8965[gtid_12471]
  3232. let {i32 x_12900} = reshape_8967[gtid_12471]
  3233. let {i32 x_12901} = reshape_8968[gtid_12471]
  3234. let {i32 x_12902} = reshape_8970[gtid_12471]
  3235. let {i32 res_12903} = sub32(x_12901, x_12899)
  3236. let {i32 res_12904} = sub32(x_12902, x_12900)
  3237. let {[res_12903]i32 res_12905} = iota32(res_12903, 0i32,
  3238. 1i32)
  3239. let {[res_12904]i32 res_12906} = iota32(res_12904, 0i32,
  3240. 1i32)
  3241. let {[res_12904]i32 res_12907} =
  3242. map(res_12904,
  3243. fn {i32} (i32 x_12908) =>
  3244. let {i32 res_12909} = add32(x_12900, x_12908)
  3245. in {res_12909},
  3246. res_12906)
  3247. let {[res_12903][res_12904]i32 res_12910} =
  3248. map(res_12903,
  3249. fn {[res_12904]i32} (i32 x_12911) =>
  3250. let {i32 res_12912} = add32(x_12899, x_12911)
  3251. let {i32 x_12913} = mul32(h_7134, res_12912)
  3252. let {[res_12904]i32 res_12914} =
  3253. map(res_12904,
  3254. fn {i32} (i32 x_12915) =>
  3255. let {i32 res_12916} =
  3256. add32(x_12913, x_12915)
  3257. in {res_12916},
  3258. res_12907)
  3259. in {res_12914},
  3260. res_12905)
  3261. -- result_proper_shape_12917 aliases res_12910
  3262. let {[lifted_0_rect_pixel_indices_arg_8964]i32 result_proper_shape_12917} =
  3263. reshape((lifted_0_rect_pixel_indices_arg_8964),
  3264. res_12910)
  3265. let {[partition_size_7544]i32 offsets_12918,
  3266. [partition_size_7544]i32 increments_12919} =
  3267. scanomap(partition_size_7544,
  3268. {fn {i32} (i32 x_12920, i32 y_12921) =>
  3269. let {i32 z_12922} =
  3270. add_nw32(x_12920, y_12921)
  3271. in {z_12922},
  3272. {0i32}},
  3273. fn {i32, i32} (i32 x_12923, i32 x_12924,
  3274. i32 x_12925, i32 x_12926,
  3275. i32 x_12927, i32 x_12928) =>
  3276. let {i32 res_12929} =
  3277. smin32(x_12923, x_12925)
  3278. let {i32 res_12930} =
  3279. smin32(x_12927, res_12929)
  3280. let {i32 res_12931} =
  3281. smin32(x_12924, x_12926)
  3282. let {i32 res_12932} =
  3283. smin32(x_12928, res_12931)
  3284. let {i32 res_12933} =
  3285. smax32(x_12923, x_12925)
  3286. let {i32 res_12934} =
  3287. smax32(x_12927, res_12933)
  3288. let {i32 res_12935} =
  3289. smax32(x_12924, x_12926)
  3290. let {i32 res_12936} =
  3291. smax32(x_12928, res_12935)
  3292. let {bool cond_12937} =
  3293. sle32(res_12934, x_12899)
  3294. let {bool res_12938} =
  3295. sle32(x_12901, res_12930)
  3296. let {bool x_12939} = not cond_12937
  3297. let {bool y_12940} =
  3298. logand(res_12938, x_12939)
  3299. let {bool cond_12941} =
  3300. logor(cond_12937, y_12940)
  3301. let {bool res_12942} =
  3302. sle32(res_12936, x_12900)
  3303. let {bool x_12943} = not cond_12941
  3304. let {bool y_12944} =
  3305. logand(res_12942, x_12943)
  3306. let {bool cond_12945} =
  3307. logor(cond_12941, y_12944)
  3308. let {bool res_12946} =
  3309. sle32(x_12902, res_12932)
  3310. let {bool x_12947} = not cond_12945
  3311. let {bool y_12948} =
  3312. logand(res_12946, x_12947)
  3313. let {bool complement_arg_12949} =
  3314. logor(cond_12945, y_12948)
  3315. let {bool res_12950} =
  3316. not complement_arg_12949
  3317. let {bool x_12951} = not res_12938
  3318. let {bool y_12952} =
  3319. logand(cond_12937, x_12951)
  3320. let {bool cond_12953} =
  3321. logor(res_12938, y_12952)
  3322. let {bool x_12954} = not cond_12953
  3323. let {bool y_12955} =
  3324. logand(res_12946, x_12954)
  3325. let {bool cond_12956} =
  3326. logor(cond_12953, y_12955)
  3327. let {bool x_12957} = not cond_12956
  3328. let {bool y_12958} =
  3329. logand(res_12942, x_12957)
  3330. let {bool complement_arg_12959} =
  3331. logor(cond_12956, y_12958)
  3332. let {bool res_12960} =
  3333. not complement_arg_12959
  3334. let {bool y_12961} =
  3335. logand(complement_arg_12949, res_12960)
  3336. let {bool res_12962} =
  3337. logor(res_12950, y_12961)
  3338. let {bool cond_neg_12963} = not res_12962
  3339. let {i32 res_12964} =
  3340. btoi bool cond_neg_12963 to i32
  3341. let {bool is_i_12965} =
  3342. eq_i32(res_12964, 0i32)
  3343. let {bool cond_neg_12966} = not is_i_12965
  3344. let {i32 part_res_12967} =
  3345. btoi bool cond_neg_12966 to i32
  3346. let {i32 part_res_12968} =
  3347. btoi bool is_i_12965 to i32
  3348. in {part_res_12968, part_res_12967},
  3349. res_7602, res_7603, res_7605, res_7606,
  3350. res_7608, res_7609)
  3351. let {i32 partition_size_12969} =
  3352. -- Branch returns: {i32}
  3353. if empty_slice_7593
  3354. then {0i32} else {
  3355. let {i32 last_offset_12970} = offsets_12918[m_7594]
  3356. in {last_offset_12970}
  3357. }
  3358. let {[partition_size_7544]i32 partition_dest_12971} =
  3359. scratch(i32, partition_size_7544)
  3360. let {[partition_size_7544]i32 partition_dest_12972} =
  3361. scratch(i32, partition_size_7544)
  3362. let {[partition_size_7544]f32 partition_dest_12973} =
  3363. scratch(f32, partition_size_7544)
  3364. let {[partition_size_7544]i32 partition_dest_12974} =
  3365. scratch(i32, partition_size_7544)
  3366. let {[partition_size_7544]i32 partition_dest_12975} =
  3367. scratch(i32, partition_size_7544)
  3368. let {[partition_size_7544]f32 partition_dest_12976} =
  3369. scratch(f32, partition_size_7544)
  3370. let {[partition_size_7544]i32 partition_dest_12977} =
  3371. scratch(i32, partition_size_7544)
  3372. let {[partition_size_7544]i32 partition_dest_12978} =
  3373. scratch(i32, partition_size_7544)
  3374. let {[partition_size_7544]f32 partition_dest_12979} =
  3375. scratch(f32, partition_size_7544)
  3376. let {[partition_size_7544]i32 partition_dest_12980} =
  3377. scratch(i32, partition_size_7544)
  3378. let {[partition_size_7544]f32 partition_dest_12981} =
  3379. scratch(f32, partition_size_7544)
  3380. let {[partition_size_7544]f32 partition_dest_12982} =
  3381. scratch(f32, partition_size_7544)
  3382. let {[partition_size_7544]f32 partition_dest_12983} =
  3383. scratch(f32, partition_size_7544)
  3384. let {[partition_size_7544]i32 partition_dest_12984} =
  3385. scratch(i32, partition_size_7544)
  3386. let {[partition_size_7544]i32 partition_res_12985,
  3387. [partition_size_7544]i32 partition_res_12986,
  3388. [partition_size_7544]f32 partition_res_12987,
  3389. [partition_size_7544]i32 partition_res_12988,
  3390. [partition_size_7544]i32 partition_res_12989,
  3391. [partition_size_7544]f32 partition_res_12990,
  3392. [partition_size_7544]i32 partition_res_12991,
  3393. [partition_size_7544]i32 partition_res_12992,
  3394. [partition_size_7544]f32 partition_res_12993,
  3395. [partition_size_7544]i32 partition_res_12994,
  3396. [partition_size_7544]f32 partition_res_12995,
  3397. [partition_size_7544]f32 partition_res_12996,
  3398. [partition_size_7544]f32 partition_res_12997,
  3399. [partition_size_7544]i32 partition_res_12998} =
  3400. -- Consumes partition_dest_12971, partition_dest_12972, partition_dest_12973, partition_dest_12974, partition_dest_12975, partition_dest_12976, partition_dest_12977, partition_dest_12978, partition_dest_12979, partition_dest_12980, partition_dest_12981, partition_dest_12982, partition_dest_12983, partition_dest_12984
  3401. scatter(partition_size_7544,
  3402. fn {i32, i32, i32, i32, i32, i32, i32, i32, i32,
  3403. i32, i32, i32, i32, i32, i32, i32, f32, i32,
  3404. i32, f32, i32, i32, f32, i32, f32, f32, f32,
  3405. i32} (i32 c_12999, i32 offset_13000,
  3406. i32 v_13001, i32 v_13002, f32 v_13003,
  3407. i32 v_13004, i32 v_13005, f32 v_13006,
  3408. i32 v_13007, i32 v_13008, f32 v_13009,
  3409. i32 v_13010, f32 v_13011, f32 v_13012,
  3410. f32 v_13013, i32 v_13014) =>
  3411. let {bool is_this_one_13015} =
  3412. eq_i32(c_12999, 0i32)
  3413. let {i32 this_offset_13016} =
  3414. add_nw32(-1i32, offset_13000)
  3415. let {i32 total_res_13017} =
  3416. -- Branch returns: {i32}
  3417. if is_this_one_13015
  3418. then {this_offset_13016} else {-1i32}
  3419. in {total_res_13017, total_res_13017,
  3420. total_res_13017, total_res_13017,
  3421. total_res_13017, total_res_13017,
  3422. total_res_13017, total_res_13017,
  3423. total_res_13017, total_res_13017,
  3424. total_res_13017, total_res_13017,
  3425. total_res_13017, total_res_13017, v_13001,
  3426. v_13002, v_13003, v_13004, v_13005,
  3427. v_13006, v_13007, v_13008, v_13009,
  3428. v_13010, v_13011, v_13012, v_13013,
  3429. v_13014},
  3430. {increments_12919, offsets_12918, res_7602,
  3431. res_7603, res_7604, res_7605, res_7606,
  3432. res_7607, res_7608, res_7609, res_7610,
  3433. res_7611, res_7612, res_7613, res_7614,
  3434. res_7615}, (1, partition_dest_12971), (1,
  3435. partition_dest_12972),
  3436. (1, partition_dest_12973), (1,
  3437. partition_dest_12974),
  3438. (1, partition_dest_12975), (1,
  3439. partition_dest_12976),
  3440. (1, partition_dest_12977), (1,
  3441. partition_dest_12978),
  3442. (1, partition_dest_12979), (1,
  3443. partition_dest_12980),
  3444. (1, partition_dest_12981), (1,
  3445. partition_dest_12982),
  3446. (1, partition_dest_12983), (1,
  3447. partition_dest_12984))
  3448. -- res_13018 aliases partition_res_12985
  3449. let {[partition_size_12969]i32 res_13018} =
  3450. partition_res_12985[0i32:+partition_size_12969*1i32]
  3451. -- res_13019 aliases partition_res_12986
  3452. let {[partition_size_12969]i32 res_13019} =
  3453. partition_res_12986[0i32:+partition_size_12969*1i32]
  3454. -- res_13020 aliases partition_res_12987
  3455. let {[partition_size_12969]f32 res_13020} =
  3456. partition_res_12987[0i32:+partition_size_12969*1i32]
  3457. -- res_13021 aliases partition_res_12988
  3458. let {[partition_size_12969]i32 res_13021} =
  3459. partition_res_12988[0i32:+partition_size_12969*1i32]
  3460. -- res_13022 aliases partition_res_12989
  3461. let {[partition_size_12969]i32 res_13022} =
  3462. partition_res_12989[0i32:+partition_size_12969*1i32]
  3463. -- res_13023 aliases partition_res_12990
  3464. let {[partition_size_12969]f32 res_13023} =
  3465. partition_res_12990[0i32:+partition_size_12969*1i32]
  3466. -- res_13024 aliases partition_res_12991
  3467. let {[partition_size_12969]i32 res_13024} =
  3468. partition_res_12991[0i32:+partition_size_12969*1i32]
  3469. -- res_13025 aliases partition_res_12992
  3470. let {[partition_size_12969]i32 res_13025} =
  3471. partition_res_12992[0i32:+partition_size_12969*1i32]
  3472. -- res_13026 aliases partition_res_12993
  3473. let {[partition_size_12969]f32 res_13026} =
  3474. partition_res_12993[0i32:+partition_size_12969*1i32]
  3475. let {[partition_size_12969]i32 lifted_2_map2_arg_13027} =
  3476. iota32(partition_size_12969, 0i32, 1i32)
  3477. let {[lifted_0_rect_pixel_indices_arg_8964]i32 res_13028} =
  3478. map(lifted_0_rect_pixel_indices_arg_8964,
  3479. fn {i32} (i32 x_13029) =>
  3480. let {i32 res_13030} = sdiv32(x_13029, h_7134)
  3481. let {i32 res_13031} = smod32(x_13029, h_7134)
  3482. let {bool res_13032, f32 res_13033,
  3483. i32 res_13034} =
  3484. redomap(partition_size_12969,
  3485. {commutative fn {bool, f32, i32}
  3486. (bool x_13035, f32 x_13036,
  3487. i32 x_13037, bool x_13038,
  3488. f32 x_13039, i32 x_13040) =>
  3489. let {bool res_13041} =
  3490. le32(0.0f32, x_13036)
  3491. let {bool x_13042} =
  3492. logand(x_13035, res_13041)
  3493. let {bool cond_13043} =
  3494. lt32(x_13039, 0.0f32)
  3495. let {bool res_13044} = not x_13038
  3496. let {bool x_13045} = not cond_13043
  3497. let {bool y_13046} =
  3498. logand(res_13044, x_13045)
  3499. let {bool cond_13047} =
  3500. logor(cond_13043, y_13046)
  3501. let {bool res_13048} =
  3502. lt32(x_13036, x_13039)
  3503. let {bool x_13049} = not cond_13047
  3504. let {bool y_13050} =
  3505. logand(res_13048, x_13049)
  3506. let {bool res_13051} =
  3507. logor(cond_13047, y_13050)
  3508. let {bool x_13052} =
  3509. logand(x_13042, res_13051)
  3510. let {bool res_13053, f32 res_13054,
  3511. i32 res_13055} =
  3512. -- Branch returns: {bool, f32, i32}
  3513. if x_13052
  3514. then {true, x_13036,
  3515. x_13037} else {
  3516. let {bool res_13056} =
  3517. le32(0.0f32, x_13039)
  3518. let {bool x_13057} =
  3519. logand(x_13038, res_13056)
  3520. let {bool cond_13058} =
  3521. lt32(x_13036, 0.0f32)
  3522. let {bool res_13059} =
  3523. not x_13035
  3524. let {bool x_13060} =
  3525. not cond_13058
  3526. let {bool y_13061} =
  3527. logand(res_13059, x_13060)
  3528. let {bool cond_13062} =
  3529. logor(cond_13058, y_13061)
  3530. let {bool res_13063} =
  3531. lt32(x_13039, x_13036)
  3532. let {bool x_13064} =
  3533. not cond_13062
  3534. let {bool y_13065} =
  3535. logand(res_13063, x_13064)
  3536. let {bool res_13066} =
  3537. logor(cond_13062, y_13065)
  3538. let {bool x_13067} =
  3539. logand(x_13057, res_13066)
  3540. let {bool res_13068,
  3541. f32 res_13069,
  3542. i32 res_13070} =
  3543. -- Branch returns: {bool, f32, i32}
  3544. if x_13067
  3545. then {true, x_13039,
  3546. x_13040} else {
  3547. let {bool x_13071} =
  3548. logand(x_13038, x_13042)
  3549. let {bool x_13072} =
  3550. logand(res_13056, x_13071)
  3551. let {bool res_13073} =
  3552. eq_f32(x_13036, x_13039)
  3553. let {bool x_13074} =
  3554. logand(x_13072, res_13073)
  3555. let {f32 res_13075} =
  3556. -- Branch returns: {f32}
  3557. if x_13074
  3558. then {x_13036} else {-1.0f32}
  3559. let {i32 res_13076} =
  3560. -- Branch returns: {i32}
  3561. if x_13074
  3562. then {x_13037} else {-1i32}
  3563. in {x_13074, res_13075,
  3564. res_13076}
  3565. }
  3566. in {res_13068, res_13069,
  3567. res_13070}
  3568. }
  3569. in {res_13053, res_13054, res_13055},
  3570. {false, -1.0f32, -1i32}},
  3571. fn {bool, f32, i32} (i32 x_13077,
  3572. i32 x_13078,
  3573. f32 x_13079,
  3574. i32 x_13080,
  3575. i32 x_13081,
  3576. f32 x_13082,
  3577. i32 x_13083,
  3578. i32 x_13084,
  3579. f32 x_13085,
  3580. i32 x_13086) =>
  3581. let {i32 x_13087} =
  3582. sub32(x_13081, x_13084)
  3583. let {i32 y_13088} =
  3584. sub32(x_13077, x_13083)
  3585. let {i32 x_13089} =
  3586. mul32(x_13087, y_13088)
  3587. let {i32 x_13090} =
  3588. sub32(x_13083, x_13080)
  3589. let {i32 y_13091} =
  3590. sub32(x_13078, x_13084)
  3591. let {i32 y_13092} =
  3592. mul32(x_13090, y_13091)
  3593. let {i32 factor_13093} =
  3594. add32(x_13089, y_13092)
  3595. let {bool cond_13094} =
  3596. eq_i32(factor_13093, 0i32)
  3597. let {bool cond_13095} = not cond_13094
  3598. let {i32 res_13096} =
  3599. -- Branch returns: {i32}
  3600. if cond_13095
  3601. then {factor_13093} else {1i32}
  3602. let {i32 res_13097, i32 res_13098,
  3603. i32 res_13099, f32 res_13100,
  3604. f32 res_13101, f32 res_13102} =
  3605. -- Branch returns: {i32, i32, i32, f32, f32, f32}
  3606. if cond_13095
  3607. then {
  3608. let {i32 y_13103} =
  3609. sub32(res_13030, x_13083)
  3610. let {i32 x_13104} =
  3611. mul32(x_13087, y_13103)
  3612. let {i32 y_13105} =
  3613. sub32(res_13031, x_13084)
  3614. let {i32 y_13106} =
  3615. mul32(x_13090, y_13105)
  3616. let {i32 a_13107} =
  3617. add32(x_13104, y_13106)
  3618. let {i32 x_13108} =
  3619. sub32(x_13084, x_13078)
  3620. let {i32 x_13109} =
  3621. mul32(y_13103, x_13108)
  3622. let {i32 y_13110} =
  3623. mul32(y_13088, y_13105)
  3624. let {i32 b_13111} =
  3625. add32(x_13109, y_13110)
  3626. let {i32 x_13112} =
  3627. sub32(factor_13093, a_13107)
  3628. let {i32 c_13113} =
  3629. sub32(x_13112, b_13111)
  3630. let {f32 res_13114} =
  3631. sitofp i32 factor_13093 to f32
  3632. let {f32 res_13115} =
  3633. sitofp i32 a_13107 to f32
  3634. let {f32 an_13116} =
  3635. fdiv32(res_13115, res_13114)
  3636. let {f32 res_13117} =
  3637. sitofp i32 b_13111 to f32
  3638. let {f32 bn_13118} =
  3639. fdiv32(res_13117, res_13114)
  3640. let {f32 x_13119} =
  3641. fsub32(1.0f32, an_13116)
  3642. let {f32 cn_13120} =
  3643. fsub32(x_13119, bn_13118)
  3644. in {a_13107, b_13111, c_13113,
  3645. an_13116, bn_13118, cn_13120}
  3646. } else {-1i32, -1i32, -1i32,
  3647. -1.0f32, -1.0f32, -1.0f32}
  3648. let {bool cond_13121} =
  3649. slt32(0i32, res_13096)
  3650. let {bool res_13122} =
  3651. sle32(0i32, res_13097)
  3652. let {bool x_13123} =
  3653. logand(cond_13121, res_13122)
  3654. let {bool res_13124} =
  3655. sle32(res_13097, res_13096)
  3656. let {bool x_13125} =
  3657. logand(x_13123, res_13124)
  3658. let {bool cond_13126} =
  3659. sle32(res_13096, 0i32)
  3660. let {bool res_13127} =
  3661. sle32(res_13096, res_13097)
  3662. let {bool x_13128} =
  3663. logand(cond_13126, res_13127)
  3664. let {bool res_13129} =
  3665. sle32(res_13097, 0i32)
  3666. let {bool x_13130} =
  3667. logand(x_13128, res_13129)
  3668. let {bool x_13131} = not x_13125
  3669. let {bool y_13132} =
  3670. logand(x_13130, x_13131)
  3671. let {bool res_13133} =
  3672. logor(x_13125, y_13132)
  3673. let {bool res_13134} =
  3674. sle32(0i32, res_13098)
  3675. let {bool x_13135} =
  3676. logand(cond_13121, res_13134)
  3677. let {bool res_13136} =
  3678. sle32(res_13098, res_13096)
  3679. let {bool x_13137} =
  3680. logand(x_13135, res_13136)
  3681. let {bool res_13138} =
  3682. sle32(res_13096, res_13098)
  3683. let {bool x_13139} =
  3684. logand(cond_13126, res_13138)
  3685. let {bool res_13140} =
  3686. sle32(res_13098, 0i32)
  3687. let {bool x_13141} =
  3688. logand(x_13139, res_13140)
  3689. let {bool x_13142} = not x_13137
  3690. let {bool y_13143} =
  3691. logand(x_13141, x_13142)
  3692. let {bool res_13144} =
  3693. logor(x_13137, y_13143)
  3694. let {bool x_13145} =
  3695. logand(res_13133, res_13144)
  3696. let {bool res_13146} =
  3697. sle32(0i32, res_13099)
  3698. let {bool x_13147} =
  3699. logand(cond_13121, res_13146)
  3700. let {bool res_13148} =
  3701. sle32(res_13099, res_13096)
  3702. let {bool x_13149} =
  3703. logand(x_13147, res_13148)
  3704. let {bool res_13150} =
  3705. sle32(res_13096, res_13099)
  3706. let {bool x_13151} =
  3707. logand(cond_13126, res_13150)
  3708. let {bool res_13152} =
  3709. sle32(res_13099, 0i32)
  3710. let {bool x_13153} =
  3711. logand(x_13151, res_13152)
  3712. let {bool x_13154} = not x_13149
  3713. let {bool y_13155} =
  3714. logand(x_13153, x_13154)
  3715. let {bool res_13156} =
  3716. logor(x_13149, y_13155)
  3717. let {bool x_13157} =
  3718. logand(x_13145, res_13156)
  3719. let {f32 x_13158} =
  3720. fmul32(x_13079, res_13100)
  3721. let {f32 y_13159} =
  3722. fmul32(x_13082, res_13101)
  3723. let {f32 x_13160} =
  3724. fadd32(x_13158, y_13159)
  3725. let {f32 y_13161} =
  3726. fmul32(x_13085, res_13102)
  3727. let {f32 res_13162} =
  3728. fadd32(x_13160, y_13161)
  3729. in {x_13157, res_13162, x_13086},
  3730. res_13018, res_13019, res_13020,
  3731. res_13021, res_13022, res_13023,
  3732. res_13024, res_13025, res_13026,
  3733. lifted_2_map2_arg_13027)
  3734. let {bool cond_13163} = eq_i32(res_13034, -1i32)
  3735. let {f32 res_13164, f32 res_13165,
  3736. f32 res_13166} =
  3737. -- Branch returns: {f32, f32, f32}
  3738. if cond_13163
  3739. then {0.0f32, 0.0f32, 0.0f32} else {
  3740. let {i32 barycentric_coordinates_arg_13167} =
  3741. partition_res_12985[res_13034]
  3742. let {i32 barycentric_coordinates_arg_13168} =
  3743. partition_res_12986[res_13034]
  3744. let {i32 barycentric_coordinates_arg_13169} =
  3745. partition_res_12988[res_13034]
  3746. let {i32 barycentric_coordinates_arg_13170} =
  3747. partition_res_12989[res_13034]
  3748. let {i32 barycentric_coordinates_arg_13171} =
  3749. partition_res_12991[res_13034]
  3750. let {i32 barycentric_coordinates_arg_13172} =
  3751. partition_res_12992[res_13034]
  3752. let {i32 x_13173} =
  3753. sub32(barycentric_coordinates_arg_13170, barycentric_coordinates_arg_13172)
  3754. let {i32 y_13174} =
  3755. sub32(barycentric_coordinates_arg_13167, barycentric_coordinates_arg_13171)
  3756. let {i32 x_13175} = mul32(x_13173, y_13174)
  3757. let {i32 x_13176} =
  3758. sub32(barycentric_coordinates_arg_13171, barycentric_coordinates_arg_13169)
  3759. let {i32 y_13177} =
  3760. sub32(barycentric_coordinates_arg_13168, barycentric_coordinates_arg_13172)
  3761. let {i32 y_13178} = mul32(x_13176, y_13177)
  3762. let {i32 factor_13179} =
  3763. add32(x_13175, y_13178)
  3764. let {bool cond_13180} =
  3765. eq_i32(factor_13179, 0i32)
  3766. let {bool cond_13181} = not cond_13180
  3767. let {f32 res_13182, f32 res_13183,
  3768. f32 res_13184} =
  3769. -- Branch returns: {f32, f32, f32}
  3770. if cond_13181
  3771. then {
  3772. let {i32 y_13185} =
  3773. sub32(res_13030, barycentric_coordinates_arg_13171)
  3774. let {i32 x_13186} =
  3775. mul32(x_13173, y_13185)
  3776. let {i32 y_13187} =
  3777. sub32(res_13031, barycentric_coordinates_arg_13172)
  3778. let {i32 y_13188} =
  3779. mul32(x_13176, y_13187)
  3780. let {i32 a_13189} =
  3781. add32(x_13186, y_13188)
  3782. let {i32 x_13190} =
  3783. sub32(barycentric_coordinates_arg_13172, barycentric_coordinates_arg_13168)
  3784. let {i32 x_13191} =
  3785. mul32(y_13185, x_13190)
  3786. let {i32 y_13192} =
  3787. mul32(y_13174, y_13187)
  3788. let {i32 b_13193} =
  3789. add32(x_13191, y_13192)
  3790. let {f32 res_13194} =
  3791. sitofp i32 factor_13179 to f32
  3792. let {f32 res_13195} =
  3793. sitofp i32 a_13189 to f32
  3794. let {f32 an_13196} =
  3795. fdiv32(res_13195, res_13194)
  3796. let {f32 res_13197} =
  3797. sitofp i32 b_13193 to f32
  3798. let {f32 bn_13198} =
  3799. fdiv32(res_13197, res_13194)
  3800. let {f32 x_13199} =
  3801. fsub32(1.0f32, an_13196)
  3802. let {f32 cn_13200} =
  3803. fsub32(x_13199, bn_13198)
  3804. in {an_13196, bn_13198, cn_13200}
  3805. } else {-1.0f32, -1.0f32, -1.0f32}
  3806. let {i32 color_point_arg_13201} =
  3807. partition_res_12994[res_13034]
  3808. let {f32 color_point_arg_13202} =
  3809. partition_res_12995[res_13034]
  3810. let {f32 color_point_arg_13203} =
  3811. partition_res_12996[res_13034]
  3812. let {f32 color_point_arg_13204} =
  3813. partition_res_12997[res_13034]
  3814. let {i32 color_point_arg_13205} =
  3815. partition_res_12998[res_13034]
  3816. let {bool cond_13206} =
  3817. eq_i32(color_point_arg_13201, 1i32)
  3818. let {f32 res_13207, f32 res_13208,
  3819. f32 res_13209} =
  3820. -- Branch returns: {f32, f32, f32}
  3821. if cond_13206
  3822. then {color_point_arg_13202,
  3823. color_point_arg_13203,
  3824. color_point_arg_13204} else {
  3825. let {bool cond_13210} =
  3826. eq_i32(color_point_arg_13201, 2i32)
  3827. let {f32 res_13211, f32 res_13212,
  3828. f32 res_13213} =
  3829. -- Branch returns: {f32, f32, f32}
  3830. if cond_13210
  3831. then {
  3832. let {i32 i_13214} =
  3833. sdiv32(color_point_arg_13205, 2i32)
  3834. let {i32 x_13215} =
  3835. and32(1i32, color_point_arg_13205)
  3836. let {bool cond_13216} =
  3837. eq_i32(x_13215, 0i32)
  3838. let {f32 res_13217} =
  3839. -- Branch returns: {f32}
  3840. if cond_13216
  3841. then {0.0f32} else {1.0f32}
  3842. let {f32 res_13218} =
  3843. -- Branch returns: {f32}
  3844. if cond_13216
  3845. then {1.0f32} else {0.0f32}
  3846. let {f32 x_13219} =
  3847. fmul32(res_13182, res_13217)
  3848. let {f32 y_13220} =
  3849. fmul32(res_13183, res_13218)
  3850. let {f32 x_13221} =
  3851. fadd32(x_13219, y_13220)
  3852. let {f32 y_13222} =
  3853. fmul32(res_13184, res_13217)
  3854. let {f32 yn_13223} =
  3855. fadd32(x_13221, y_13222)
  3856. let {f32 y_13224} =
  3857. fmul32(res_13183, res_13217)
  3858. let {f32 x_13225} =
  3859. fadd32(x_13219, y_13224)
  3860. let {f32 y_13226} =
  3861. fmul32(res_13184, res_13218)
  3862. let {f32 xn_13227} =
  3863. fadd32(x_13225, y_13226)
  3864. let {f32 res_13228} =
  3865. sitofp i32 surface_h_7153 to f32
  3866. let {f32 t32_arg_13229} =
  3867. fmul32(yn_13223, res_13228)
  3868. let {i32 res_13230} =
  3869. fptosi f32 t32_arg_13229 to i32
  3870. let {f32 res_13231} =
  3871. sitofp i32 surface_w_7152 to f32
  3872. let {f32 t32_arg_13232} =
  3873. fmul32(xn_13227, res_13231)
  3874. let {i32 res_13233} =
  3875. fptosi f32 t32_arg_13232 to i32
  3876. let {i32 clamp_arg_13234} =
  3877. sub32(surface_h_7153, 1i32)
  3878. let {i32 res_13235} =
  3879. smax32(0i32, res_13230)
  3880. let {i32 res_13236} =
  3881. smin32(clamp_arg_13234, res_13235)
  3882. let {i32 clamp_arg_13237} =
  3883. sub32(surface_w_7152, 1i32)
  3884. let {i32 res_13238} =
  3885. smax32(0i32, res_13233)
  3886. let {i32 res_13239} =
  3887. smin32(clamp_arg_13237, res_13238)
  3888. let {i32 binop_y_13240} =
  3889. mul_nw32(surface_w_7152, surface_h_7153)
  3890. let {i32 binop_x_13241} =
  3891. mul_nw32(i_13214, binop_y_13240)
  3892. let {i32 binop_y_13242} =
  3893. mul_nw32(surface_w_7152, res_13236)
  3894. let {i32 binop_x_13243} =
  3895. add_nw32(binop_x_13241, binop_y_13242)
  3896. let {i32 new_index_13244} =
  3897. add_nw32(res_13239, binop_x_13243)
  3898. let {f32 res_13245} =
  3899. <dim_ok_7201>
  3900. surface_textures_flat_hsv_hs_7154[new_index_13244]
  3901. let {f32 res_13246} =
  3902. <empty_or_match_cert_7195,
  3903. dim_ok_7201>
  3904. surface_textures_flat_hsv_ss_7155[new_index_13244]
  3905. let {f32 res_13247} =
  3906. <empty_or_match_cert_7197,
  3907. dim_ok_7201>
  3908. surface_textures_flat_hsv_vs_7156[new_index_13244]
  3909. in {res_13245, res_13246, res_13247}
  3910. } else {0.0f32, 0.0f32, 0.0f32}
  3911. in {res_13211, res_13212, res_13213}
  3912. }
  3913. let {f32 y_13248} = fpow32(res_13033, 2.0f32)
  3914. let {f32 min_arg_13249} =
  3915. fdiv32(2000000.0f32, y_13248)
  3916. let {f32 res_13250} =
  3917. fmin32(1.0f32, min_arg_13249)
  3918. let {f32 res_13251} =
  3919. fmul32(res_13209, res_13250)
  3920. in {res_13207, res_13208, res_13251}
  3921. }
  3922. let {f32 c_13252} = fmul32(res_13165, res_13166)
  3923. let {f32 h'_13253} = fdiv32(res_13164, 60.0f32)
  3924. let {f32 t32_arg_13254} = fdiv32(h'_13253, 2.0f32)
  3925. let {i32 res_13255} =
  3926. fptosi f32 t32_arg_13254 to i32
  3927. let {f32 res_13256} = sitofp i32 res_13255 to f32
  3928. let {f32 y_13257} = fmul32(2.0f32, res_13256)
  3929. let {f32 res_13258} = fsub32(h'_13253, y_13257)
  3930. let {f32 abs_arg_13259} =
  3931. fsub32(res_13258, 1.0f32)
  3932. let {f32 res_13260} = fabs32 abs_arg_13259
  3933. let {f32 y_13261} = fsub32(1.0f32, res_13260)
  3934. let {f32 x_13262} = fmul32(c_13252, y_13261)
  3935. let {bool cond_13263} = le32(0.0f32, h'_13253)
  3936. let {bool res_13264} = lt32(h'_13253, 1.0f32)
  3937. let {bool x_13265} = logand(cond_13263, res_13264)
  3938. let {f32 res_13266, f32 res_13267,
  3939. f32 res_13268} =
  3940. -- Branch returns: {f32, f32, f32}
  3941. if x_13265
  3942. then {c_13252, x_13262, 0.0f32} else {
  3943. let {bool cond_13269} = le32(1.0f32, h'_13253)
  3944. let {bool res_13270} = lt32(h'_13253, 2.0f32)
  3945. let {bool x_13271} =
  3946. logand(cond_13269, res_13270)
  3947. let {f32 res_13272, f32 res_13273,
  3948. f32 res_13274} =
  3949. -- Branch returns: {f32, f32, f32}
  3950. if x_13271
  3951. then {x_13262, c_13252, 0.0f32} else {
  3952. let {bool cond_13275} =
  3953. le32(2.0f32, h'_13253)
  3954. let {bool res_13276} =
  3955. lt32(h'_13253, 3.0f32)
  3956. let {bool x_13277} =
  3957. logand(cond_13275, res_13276)
  3958. let {f32 res_13278, f32 res_13279,
  3959. f32 res_13280} =
  3960. -- Branch returns: {f32, f32, f32}
  3961. if x_13277
  3962. then {0.0f32, c_13252, x_13262} else {
  3963. let {bool cond_13281} =
  3964. le32(3.0f32, h'_13253)
  3965. let {bool res_13282} =
  3966. lt32(h'_13253, 4.0f32)
  3967. let {bool x_13283} =
  3968. logand(cond_13281, res_13282)
  3969. let {f32 res_13284} =
  3970. -- Branch returns: {f32}
  3971. if x_13283
  3972. then {x_13262} else {0.0f32}
  3973. let {f32 res_13285, f32 res_13286} =
  3974. -- Branch returns: {f32, f32}
  3975. if x_13283
  3976. then {0.0f32, c_13252} else {
  3977. let {bool cond_13287} =
  3978. le32(4.0f32, h'_13253)
  3979. let {bool res_13288} =
  3980. lt32(h'_13253, 5.0f32)
  3981. let {bool x_13289} =
  3982. logand(cond_13287, res_13288)
  3983. let {f32 res_13290,
  3984. f32 res_13291} =
  3985. -- Branch returns: {f32, f32}
  3986. if x_13289
  3987. then {x_13262, c_13252} else {
  3988. let {bool cond_13292} =
  3989. le32(5.0f32, h'_13253)
  3990. let {bool res_13293} =
  3991. lt32(h'_13253, 6.0f32)
  3992. let {bool x_13294} =
  3993. logand(cond_13292, res_13293)
  3994. let {f32 res_13295} =
  3995. -- Branch returns: {f32}
  3996. if x_13294
  3997. then {c_13252} else {0.0f32}
  3998. let {f32 res_13296} =
  3999. -- Branch returns: {f32}
  4000. if x_13294
  4001. then {x_13262} else {0.0f32}
  4002. in {res_13295, res_13296}
  4003. }
  4004. in {res_13290, res_13291}
  4005. }
  4006. in {res_13285, res_13284, res_13286}
  4007. }
  4008. in {res_13278, res_13279, res_13280}
  4009. }
  4010. in {res_13272, res_13273, res_13274}
  4011. }
  4012. let {f32 m_13297} = fsub32(res_13166, c_13252)
  4013. let {f32 res_13298} = fadd32(res_13266, m_13297)
  4014. let {f32 res_13299} = fadd32(res_13267, m_13297)
  4015. let {f32 res_13300} = fadd32(res_13268, m_13297)
  4016. let {f32 f32_arg_13301} =
  4017. fmul32(255.0f32, res_13298)
  4018. let {i32 unsign_arg_13302} =
  4019. fptoui f32 f32_arg_13301 to i32
  4020. let {f32 f32_arg_13303} =
  4021. fmul32(255.0f32, res_13299)
  4022. let {i32 unsign_arg_13304} =
  4023. fptoui f32 f32_arg_13303 to i32
  4024. let {f32 f32_arg_13305} =
  4025. fmul32(255.0f32, res_13300)
  4026. let {i32 unsign_arg_13306} =
  4027. fptoui f32 f32_arg_13305 to i32
  4028. let {i32 x_13307} = shl32(unsign_arg_13302, 16i32)
  4029. let {i32 y_13308} = shl32(unsign_arg_13304, 8i32)
  4030. let {i32 x_13309} = or32(x_13307, y_13308)
  4031. let {i32 res_13310} =
  4032. or32(unsign_arg_13306, x_13309)
  4033. in {res_13310},
  4034. result_proper_shape_12917)
  4035. return {returns res_13028,
  4036. returns result_proper_shape_12917}
  4037. }
  4038. in {res_12897, res_12898}
  4039. } else {
  4040. let {i64 n_total_14145} = sext i32 n_total_8638 to i64
  4041. let {i64 nest_size_14146} = mul_nw64(n_total_14145, 1i64)
  4042. let {i32 segmap_group_size_14147} =
  4043. get_size(segmap_group_size_14121, group_size)
  4044. let {i32 num_groups_14148} =
  4045. calc_num_groups(nest_size_14146, segmap_num_groups_14123,
  4046. segmap_group_size_14147)
  4047. let {i32 num_threads_14149} =
  4048. mul_nw32(num_groups_14148, segmap_group_size_14147)
  4049. let {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_14150} =
  4050. segmap_thread
  4051. (#groups=num_groups_14148; groupsize=segmap_group_size_14147; virtualise)
  4052. (gtid_14117 < n_total_8638) (~phys_tid_14118) : {[lifted_0_rect_pixel_indices_arg_8964]i32} {
  4053. let {i32 x_14151} = reshape_8965[gtid_14117]
  4054. let {i32 x_14152} = reshape_8967[gtid_14117]
  4055. let {i32 x_14153} = reshape_8968[gtid_14117]
  4056. let {i32 x_14154} = reshape_8970[gtid_14117]
  4057. let {i32 res_14155} = sub32(x_14153, x_14151)
  4058. let {i32 res_14156} = sub32(x_14154, x_14152)
  4059. let {[res_14155]i32 res_14157} = iota32(res_14155, 0i32,
  4060. 1i32)
  4061. let {[res_14156]i32 res_14158} = iota32(res_14156, 0i32,
  4062. 1i32)
  4063. let {[res_14156]i32 res_14159} =
  4064. map(res_14156,
  4065. fn {i32} (i32 x_14160) =>
  4066. let {i32 res_14161} = add32(x_14152, x_14160)
  4067. in {res_14161},
  4068. res_14158)
  4069. let {[res_14155][res_14156]i32 res_14162} =
  4070. map(res_14155,
  4071. fn {[res_14156]i32} (i32 x_14163) =>
  4072. let {i32 res_14164} = add32(x_14151, x_14163)
  4073. let {i32 x_14165} = mul32(h_7134, res_14164)
  4074. let {[res_14156]i32 res_14166} =
  4075. map(res_14156,
  4076. fn {i32} (i32 x_14167) =>
  4077. let {i32 res_14168} =
  4078. add32(x_14165, x_14167)
  4079. in {res_14168},
  4080. res_14159)
  4081. in {res_14166},
  4082. res_14157)
  4083. -- result_proper_shape_14169 aliases res_14162
  4084. let {[lifted_0_rect_pixel_indices_arg_8964]i32 result_proper_shape_14169} =
  4085. reshape((lifted_0_rect_pixel_indices_arg_8964),
  4086. res_14162)
  4087. return {returns result_proper_shape_14169}
  4088. }
  4089. let {i64 partition_size_14170} =
  4090. sext i32 partition_size_7544 to i64
  4091. let {i64 n_total_14171} = sext i32 n_total_8638 to i64
  4092. let {i64 y_14172} = mul_nw64(n_total_14171, 1i64)
  4093. let {i64 nest_size_14173} =
  4094. mul_nw64(partition_size_14170, y_14172)
  4095. let {i32 segscan_group_size_14174} =
  4096. get_size(segscan_group_size_14051, group_size)
  4097. let {i32 num_groups_14175} =
  4098. calc_num_groups(nest_size_14173, segscan_num_groups_14053,
  4099. segscan_group_size_14174)
  4100. let {i32 num_threads_14176} =
  4101. mul_nw32(num_groups_14175, segscan_group_size_14174)
  4102. let {[n_total_8638][partition_size_7544]i32 offsets_r_14177,
  4103. [n_total_8638][partition_size_7544]i32 increments_r_14178} =
  4104. segscan_thread
  4105. (#groups=num_groups_14175; groupsize=segscan_group_size_14174)
  4106. ({{0i32},
  4107. [],
  4108. fn {i32} (i32 x_14179, i32 y_14180) =>
  4109. let {i32 z_14181} = add_nw32(x_14179, y_14180)
  4110. in {z_14181}})
  4111. (gtid_14046 < n_total_8638,
  4112. gtid_14056 < partition_size_7544) (~phys_tid_14057) : {i32,
  4113. i32} {
  4114. let {i32 x_14182} = reshape_8965[gtid_14046]
  4115. let {i32 x_14183} = reshape_8967[gtid_14046]
  4116. let {i32 x_14184} = reshape_8968[gtid_14046]
  4117. let {i32 x_14185} = reshape_8970[gtid_14046]
  4118. let {i32 x_14186} = res_7602[gtid_14056]
  4119. let {i32 x_14187} = res_7603[gtid_14056]
  4120. let {i32 x_14188} = res_7605[gtid_14056]
  4121. let {i32 x_14189} = res_7606[gtid_14056]
  4122. let {i32 x_14190} = res_7608[gtid_14056]
  4123. let {i32 x_14191} = res_7609[gtid_14056]
  4124. let {i32 res_14192} = smin32(x_14186, x_14188)
  4125. let {i32 res_14193} = smin32(x_14190, res_14192)
  4126. let {i32 res_14194} = smin32(x_14187, x_14189)
  4127. let {i32 res_14195} = smin32(x_14191, res_14194)
  4128. let {i32 res_14196} = smax32(x_14186, x_14188)
  4129. let {i32 res_14197} = smax32(x_14190, res_14196)
  4130. let {i32 res_14198} = smax32(x_14187, x_14189)
  4131. let {i32 res_14199} = smax32(x_14191, res_14198)
  4132. let {bool cond_14200} = sle32(res_14197, x_14182)
  4133. let {bool res_14201} = sle32(x_14184, res_14193)
  4134. let {bool x_14202} = not cond_14200
  4135. let {bool y_14203} = logand(res_14201, x_14202)
  4136. let {bool cond_14204} = logor(cond_14200, y_14203)
  4137. let {bool res_14205} = sle32(res_14199, x_14183)
  4138. let {bool x_14206} = not cond_14204
  4139. let {bool y_14207} = logand(res_14205, x_14206)
  4140. let {bool cond_14208} = logor(cond_14204, y_14207)
  4141. let {bool res_14209} = sle32(x_14185, res_14195)
  4142. let {bool x_14210} = not cond_14208
  4143. let {bool y_14211} = logand(res_14209, x_14210)
  4144. let {bool complement_arg_14212} =
  4145. logor(cond_14208, y_14211)
  4146. let {bool res_14213} = not complement_arg_14212
  4147. let {bool x_14214} = not res_14201
  4148. let {bool y_14215} = logand(cond_14200, x_14214)
  4149. let {bool cond_14216} = logor(res_14201, y_14215)
  4150. let {bool x_14217} = not cond_14216
  4151. let {bool y_14218} = logand(res_14209, x_14217)
  4152. let {bool cond_14219} = logor(cond_14216, y_14218)
  4153. let {bool x_14220} = not cond_14219
  4154. let {bool y_14221} = logand(res_14205, x_14220)
  4155. let {bool complement_arg_14222} =
  4156. logor(cond_14219, y_14221)
  4157. let {bool res_14223} = not complement_arg_14222
  4158. let {bool y_14224} =
  4159. logand(complement_arg_14212, res_14223)
  4160. let {bool res_14225} = logor(res_14213, y_14224)
  4161. let {bool cond_neg_14226} = not res_14225
  4162. let {i32 res_14227} = btoi bool cond_neg_14226 to i32
  4163. let {bool is_i_14228} = eq_i32(res_14227, 0i32)
  4164. let {bool cond_neg_14229} = not is_i_14228
  4165. let {i32 part_res_14230} = btoi bool cond_neg_14229 to i32
  4166. let {i32 part_res_14231} = btoi bool is_i_14228 to i32
  4167. return {returns part_res_14231, returns part_res_14230}
  4168. }
  4169. let {i64 n_total_14232} = sext i32 n_total_8638 to i64
  4170. let {i64 nest_size_14233} = mul_nw64(n_total_14232, 1i64)
  4171. let {i32 segmap_group_size_14234} =
  4172. get_size(segmap_group_size_14024, group_size)
  4173. let {i32 num_groups_14235} =
  4174. calc_num_groups(nest_size_14233, segmap_num_groups_14026,
  4175. segmap_group_size_14234)
  4176. let {i32 num_threads_14236} =
  4177. mul_nw32(num_groups_14235, segmap_group_size_14234)
  4178. let {[n_total_8638][partition_size_7544]i32 partition_dest_r_14237,
  4179. [n_total_8638][partition_size_7544]i32 partition_dest_r_14238,
  4180. [n_total_8638][partition_size_7544]f32 partition_dest_r_14239,
  4181. [n_total_8638][partition_size_7544]i32 partition_dest_r_14240,
  4182. [n_total_8638][partition_size_7544]i32 partition_dest_r_14241,
  4183. [n_total_8638][partition_size_7544]f32 partition_dest_r_14242,
  4184. [n_total_8638][partition_size_7544]i32 partition_dest_r_14243,
  4185. [n_total_8638][partition_size_7544]i32 partition_dest_r_14244,
  4186. [n_total_8638][partition_size_7544]f32 partition_dest_r_14245,
  4187. [n_total_8638][partition_size_7544]i32 partition_dest_r_14246,
  4188. [n_total_8638][partition_size_7544]f32 partition_dest_r_14247,
  4189. [n_total_8638][partition_size_7544]f32 partition_dest_r_14248,
  4190. [n_total_8638][partition_size_7544]f32 partition_dest_r_14249,
  4191. [n_total_8638][partition_size_7544]i32 partition_dest_r_14250,
  4192. [n_total_8638]i32 partition_size_r_14251} =
  4193. segmap_thread
  4194. (#groups=num_groups_14235; groupsize=segmap_group_size_14234; virtualise)
  4195. (gtid_14020 < n_total_8638) (~phys_tid_14021) : {[partition_size_7544]i32,
  4196. [partition_size_7544]i32,
  4197. [partition_size_7544]f32,
  4198. [partition_size_7544]i32,
  4199. [partition_size_7544]i32,
  4200. [partition_size_7544]f32,
  4201. [partition_size_7544]i32,
  4202. [partition_size_7544]i32,
  4203. [partition_size_7544]f32,
  4204. [partition_size_7544]i32,
  4205. [partition_size_7544]f32,
  4206. [partition_size_7544]f32,
  4207. [partition_size_7544]f32,
  4208. [partition_size_7544]i32,
  4209. i32} {
  4210. -- offsets_14252 aliases offsets_r_14177
  4211. let {[partition_size_7544]i32 offsets_14252} =
  4212. offsets_r_14177[gtid_14020,
  4213. 0i32:+partition_size_7544*1i32]
  4214. let {i32 partition_size_14253} =
  4215. -- Branch returns: {i32}
  4216. if empty_slice_7593
  4217. then {0i32} else {
  4218. let {i32 last_offset_14254} = offsets_14252[m_7594]
  4219. in {last_offset_14254}
  4220. }
  4221. let {[partition_size_7544]i32 partition_dest_14255} =
  4222. scratch(i32, partition_size_7544)
  4223. let {[partition_size_7544]i32 partition_dest_14256} =
  4224. scratch(i32, partition_size_7544)
  4225. let {[partition_size_7544]f32 partition_dest_14257} =
  4226. scratch(f32, partition_size_7544)
  4227. let {[partition_size_7544]i32 partition_dest_14258} =
  4228. scratch(i32, partition_size_7544)
  4229. let {[partition_size_7544]i32 partition_dest_14259} =
  4230. scratch(i32, partition_size_7544)
  4231. let {[partition_size_7544]f32 partition_dest_14260} =
  4232. scratch(f32, partition_size_7544)
  4233. let {[partition_size_7544]i32 partition_dest_14261} =
  4234. scratch(i32, partition_size_7544)
  4235. let {[partition_size_7544]i32 partition_dest_14262} =
  4236. scratch(i32, partition_size_7544)
  4237. let {[partition_size_7544]f32 partition_dest_14263} =
  4238. scratch(f32, partition_size_7544)
  4239. let {[partition_size_7544]i32 partition_dest_14264} =
  4240. scratch(i32, partition_size_7544)
  4241. let {[partition_size_7544]f32 partition_dest_14265} =
  4242. scratch(f32, partition_size_7544)
  4243. let {[partition_size_7544]f32 partition_dest_14266} =
  4244. scratch(f32, partition_size_7544)
  4245. let {[partition_size_7544]f32 partition_dest_14267} =
  4246. scratch(f32, partition_size_7544)
  4247. let {[partition_size_7544]i32 partition_dest_14268} =
  4248. scratch(i32, partition_size_7544)
  4249. return {returns partition_dest_14255,
  4250. returns partition_dest_14256,
  4251. returns partition_dest_14257,
  4252. returns partition_dest_14258,
  4253. returns partition_dest_14259,
  4254. returns partition_dest_14260,
  4255. returns partition_dest_14261,
  4256. returns partition_dest_14262,
  4257. returns partition_dest_14263,
  4258. returns partition_dest_14264,
  4259. returns partition_dest_14265,
  4260. returns partition_dest_14266,
  4261. returns partition_dest_14267,
  4262. returns partition_dest_14268,
  4263. returns partition_size_14253}
  4264. }
  4265. let {i64 n_total_14269} = sext i32 n_total_8638 to i64
  4266. let {i64 partition_size_14270} =
  4267. sext i32 partition_size_7544 to i64
  4268. let {i64 y_14271} = mul_nw64(partition_size_14270, 1i64)
  4269. let {i64 nest_size_14272} = mul_nw64(n_total_14269, y_14271)
  4270. let {i32 segmap_group_size_14273} =
  4271. get_size(segmap_group_size_13980, group_size)
  4272. let {i64 segmap_group_size_14274} =
  4273. sext i32 segmap_group_size_14273 to i64
  4274. let {i64 segmap_usable_groups_64_14275} =
  4275. sdiv_up64(nest_size_14272, segmap_group_size_14274)
  4276. let {i32 segmap_usable_groups_14276} =
  4277. sext i64 segmap_usable_groups_64_14275 to i32
  4278. let {[n_total_8638][partition_size_7544]i32 partition_res_r_14277,
  4279. [n_total_8638][partition_size_7544]i32 partition_res_r_14278,
  4280. [n_total_8638][partition_size_7544]f32 partition_res_r_14279,
  4281. [n_total_8638][partition_size_7544]i32 partition_res_r_14280,
  4282. [n_total_8638][partition_size_7544]i32 partition_res_r_14281,
  4283. [n_total_8638][partition_size_7544]f32 partition_res_r_14282,
  4284. [n_total_8638][partition_size_7544]i32 partition_res_r_14283,
  4285. [n_total_8638][partition_size_7544]i32 partition_res_r_14284,
  4286. [n_total_8638][partition_size_7544]f32 partition_res_r_14285,
  4287. [n_total_8638][partition_size_7544]i32 partition_res_r_14286,
  4288. [n_total_8638][partition_size_7544]f32 partition_res_r_14287,
  4289. [n_total_8638][partition_size_7544]f32 partition_res_r_14288,
  4290. [n_total_8638][partition_size_7544]f32 partition_res_r_14289,
  4291. [n_total_8638][partition_size_7544]i32 partition_res_r_14290} =
  4292. -- Consumes partition_dest_r_14237, partition_dest_r_14238, partition_dest_r_14239, partition_dest_r_14240, partition_dest_r_14241, partition_dest_r_14242, partition_dest_r_14243, partition_dest_r_14244, partition_dest_r_14245, partition_dest_r_14246, partition_dest_r_14247, partition_dest_r_14248, partition_dest_r_14249, partition_dest_r_14250
  4293. segmap_thread
  4294. (#groups=segmap_usable_groups_14276; groupsize=segmap_group_size_14273)
  4295. (gtid_13973 < n_total_8638,
  4296. gtid_13974 < partition_size_7544) (~phys_tid_13975) : {i32,
  4297. i32,
  4298. f32,
  4299. i32,
  4300. i32,
  4301. f32,
  4302. i32,
  4303. i32,
  4304. f32,
  4305. i32,
  4306. f32,
  4307. f32,
  4308. f32,
  4309. i32} {
  4310. -- offsets_14291 aliases offsets_r_14177
  4311. let {[partition_size_7544]i32 offsets_14291} =
  4312. offsets_r_14177[gtid_13973,
  4313. 0i32:+partition_size_7544*1i32]
  4314. -- increments_14292 aliases increments_r_14178
  4315. let {[partition_size_7544]i32 increments_14292} =
  4316. increments_r_14178[gtid_13973,
  4317. 0i32:+partition_size_7544*1i32]
  4318. -- partition_dest_14293 aliases partition_dest_r_14237
  4319. let {[partition_size_7544]i32 partition_dest_14293} =
  4320. partition_dest_r_14237[gtid_13973,
  4321. 0i32:+partition_size_7544*1i32]
  4322. -- partition_dest_14294 aliases partition_dest_r_14238
  4323. let {[partition_size_7544]i32 partition_dest_14294} =
  4324. partition_dest_r_14238[gtid_13973,
  4325. 0i32:+partition_size_7544*1i32]
  4326. -- partition_dest_14295 aliases partition_dest_r_14239
  4327. let {[partition_size_7544]f32 partition_dest_14295} =
  4328. partition_dest_r_14239[gtid_13973,
  4329. 0i32:+partition_size_7544*1i32]
  4330. -- partition_dest_14296 aliases partition_dest_r_14240
  4331. let {[partition_size_7544]i32 partition_dest_14296} =
  4332. partition_dest_r_14240[gtid_13973,
  4333. 0i32:+partition_size_7544*1i32]
  4334. -- partition_dest_14297 aliases partition_dest_r_14241
  4335. let {[partition_size_7544]i32 partition_dest_14297} =
  4336. partition_dest_r_14241[gtid_13973,
  4337. 0i32:+partition_size_7544*1i32]
  4338. -- partition_dest_14298 aliases partition_dest_r_14242
  4339. let {[partition_size_7544]f32 partition_dest_14298} =
  4340. partition_dest_r_14242[gtid_13973,
  4341. 0i32:+partition_size_7544*1i32]
  4342. -- partition_dest_14299 aliases partition_dest_r_14243
  4343. let {[partition_size_7544]i32 partition_dest_14299} =
  4344. partition_dest_r_14243[gtid_13973,
  4345. 0i32:+partition_size_7544*1i32]
  4346. -- partition_dest_14300 aliases partition_dest_r_14244
  4347. let {[partition_size_7544]i32 partition_dest_14300} =
  4348. partition_dest_r_14244[gtid_13973,
  4349. 0i32:+partition_size_7544*1i32]
  4350. -- partition_dest_14301 aliases partition_dest_r_14245
  4351. let {[partition_size_7544]f32 partition_dest_14301} =
  4352. partition_dest_r_14245[gtid_13973,
  4353. 0i32:+partition_size_7544*1i32]
  4354. -- partition_dest_14302 aliases partition_dest_r_14246
  4355. let {[partition_size_7544]i32 partition_dest_14302} =
  4356. partition_dest_r_14246[gtid_13973,
  4357. 0i32:+partition_size_7544*1i32]
  4358. -- partition_dest_14303 aliases partition_dest_r_14247
  4359. let {[partition_size_7544]f32 partition_dest_14303} =
  4360. partition_dest_r_14247[gtid_13973,
  4361. 0i32:+partition_size_7544*1i32]
  4362. -- partition_dest_14304 aliases partition_dest_r_14248
  4363. let {[partition_size_7544]f32 partition_dest_14304} =
  4364. partition_dest_r_14248[gtid_13973,
  4365. 0i32:+partition_size_7544*1i32]
  4366. -- partition_dest_14305 aliases partition_dest_r_14249
  4367. let {[partition_size_7544]f32 partition_dest_14305} =
  4368. partition_dest_r_14249[gtid_13973,
  4369. 0i32:+partition_size_7544*1i32]
  4370. -- partition_dest_14306 aliases partition_dest_r_14250
  4371. let {[partition_size_7544]i32 partition_dest_14306} =
  4372. partition_dest_r_14250[gtid_13973,
  4373. 0i32:+partition_size_7544*1i32]
  4374. let {i32 c_14307} = increments_r_14178[gtid_13973,
  4375. gtid_13974]
  4376. let {i32 offset_14308} = offsets_r_14177[gtid_13973,
  4377. gtid_13974]
  4378. let {i32 v_14309} = res_7602[gtid_13974]
  4379. let {i32 v_14310} = res_7603[gtid_13974]
  4380. let {f32 v_14311} = res_7604[gtid_13974]
  4381. let {i32 v_14312} = res_7605[gtid_13974]
  4382. let {i32 v_14313} = res_7606[gtid_13974]
  4383. let {f32 v_14314} = res_7607[gtid_13974]
  4384. let {i32 v_14315} = res_7608[gtid_13974]
  4385. let {i32 v_14316} = res_7609[gtid_13974]
  4386. let {f32 v_14317} = res_7610[gtid_13974]
  4387. let {i32 v_14318} = res_7611[gtid_13974]
  4388. let {f32 v_14319} = res_7612[gtid_13974]
  4389. let {f32 v_14320} = res_7613[gtid_13974]
  4390. let {f32 v_14321} = res_7614[gtid_13974]
  4391. let {i32 v_14322} = res_7615[gtid_13974]
  4392. let {bool is_this_one_14323} = eq_i32(c_14307, 0i32)
  4393. let {i32 this_offset_14324} =
  4394. add_nw32(-1i32, offset_14308)
  4395. let {i32 total_res_14325} =
  4396. -- Branch returns: {i32}
  4397. if is_this_one_14323
  4398. then {this_offset_14324} else {-1i32}
  4399. return {partition_dest_r_14237 with ([gtid_13973 < n_total_8638,
  4400. total_res_14325 < partition_size_7544] <- v_14309),
  4401. partition_dest_r_14238 with ([gtid_13973 < n_total_8638,
  4402. total_res_14325 < partition_size_7544] <- v_14310),
  4403. partition_dest_r_14239 with ([gtid_13973 < n_total_8638,
  4404. total_res_14325 < partition_size_7544] <- v_14311),
  4405. partition_dest_r_14240 with ([gtid_13973 < n_total_8638,
  4406. total_res_14325 < partition_size_7544] <- v_14312),
  4407. partition_dest_r_14241 with ([gtid_13973 < n_total_8638,
  4408. total_res_14325 < partition_size_7544] <- v_14313),
  4409. partition_dest_r_14242 with ([gtid_13973 < n_total_8638,
  4410. total_res_14325 < partition_size_7544] <- v_14314),
  4411. partition_dest_r_14243 with ([gtid_13973 < n_total_8638,
  4412. total_res_14325 < partition_size_7544] <- v_14315),
  4413. partition_dest_r_14244 with ([gtid_13973 < n_total_8638,
  4414. total_res_14325 < partition_size_7544] <- v_14316),
  4415. partition_dest_r_14245 with ([gtid_13973 < n_total_8638,
  4416. total_res_14325 < partition_size_7544] <- v_14317),
  4417. partition_dest_r_14246 with ([gtid_13973 < n_total_8638,
  4418. total_res_14325 < partition_size_7544] <- v_14318),
  4419. partition_dest_r_14247 with ([gtid_13973 < n_total_8638,
  4420. total_res_14325 < partition_size_7544] <- v_14319),
  4421. partition_dest_r_14248 with ([gtid_13973 < n_total_8638,
  4422. total_res_14325 < partition_size_7544] <- v_14320),
  4423. partition_dest_r_14249 with ([gtid_13973 < n_total_8638,
  4424. total_res_14325 < partition_size_7544] <- v_14321),
  4425. partition_dest_r_14250 with ([gtid_13973 < n_total_8638,
  4426. total_res_14325 < partition_size_7544] <- v_14322)}
  4427. }
  4428. let {i64 n_total_14326} = sext i32 n_total_8638 to i64
  4429. let {i64 nest_size_14327} = mul_nw64(n_total_14326, 1i64)
  4430. let {i32 segmap_group_size_14328} =
  4431. get_size(segmap_group_size_13645, group_size)
  4432. let {i32 num_groups_14329} =
  4433. calc_num_groups(nest_size_14327, segmap_num_groups_13647,
  4434. segmap_group_size_14328)
  4435. let {i32 num_threads_14330} =
  4436. mul_nw32(num_groups_14329, segmap_group_size_14328)
  4437. let {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_14331} =
  4438. segmap_thread
  4439. (#groups=num_groups_14329; groupsize=segmap_group_size_14328; virtualise)
  4440. (gtid_13641 < n_total_8638) (~phys_tid_13642) : {[lifted_0_rect_pixel_indices_arg_8964]i32} {
  4441. let {i32 partition_size_14332} =
  4442. partition_size_r_14251[gtid_13641]
  4443. -- partition_res_14333 aliases partition_res_r_14277
  4444. let {[partition_size_7544]i32 partition_res_14333} =
  4445. partition_res_r_14277[gtid_13641,
  4446. 0i32:+partition_size_7544*1i32]
  4447. -- partition_res_14334 aliases partition_res_r_14278
  4448. let {[partition_size_7544]i32 partition_res_14334} =
  4449. partition_res_r_14278[gtid_13641,
  4450. 0i32:+partition_size_7544*1i32]
  4451. -- partition_res_14335 aliases partition_res_r_14279
  4452. let {[partition_size_7544]f32 partition_res_14335} =
  4453. partition_res_r_14279[gtid_13641,
  4454. 0i32:+partition_size_7544*1i32]
  4455. -- partition_res_14336 aliases partition_res_r_14280
  4456. let {[partition_size_7544]i32 partition_res_14336} =
  4457. partition_res_r_14280[gtid_13641,
  4458. 0i32:+partition_size_7544*1i32]
  4459. -- partition_res_14337 aliases partition_res_r_14281
  4460. let {[partition_size_7544]i32 partition_res_14337} =
  4461. partition_res_r_14281[gtid_13641,
  4462. 0i32:+partition_size_7544*1i32]
  4463. -- partition_res_14338 aliases partition_res_r_14282
  4464. let {[partition_size_7544]f32 partition_res_14338} =
  4465. partition_res_r_14282[gtid_13641,
  4466. 0i32:+partition_size_7544*1i32]
  4467. -- partition_res_14339 aliases partition_res_r_14283
  4468. let {[partition_size_7544]i32 partition_res_14339} =
  4469. partition_res_r_14283[gtid_13641,
  4470. 0i32:+partition_size_7544*1i32]
  4471. -- partition_res_14340 aliases partition_res_r_14284
  4472. let {[partition_size_7544]i32 partition_res_14340} =
  4473. partition_res_r_14284[gtid_13641,
  4474. 0i32:+partition_size_7544*1i32]
  4475. -- partition_res_14341 aliases partition_res_r_14285
  4476. let {[partition_size_7544]f32 partition_res_14341} =
  4477. partition_res_r_14285[gtid_13641,
  4478. 0i32:+partition_size_7544*1i32]
  4479. -- partition_res_14342 aliases partition_res_r_14286
  4480. let {[partition_size_7544]i32 partition_res_14342} =
  4481. partition_res_r_14286[gtid_13641,
  4482. 0i32:+partition_size_7544*1i32]
  4483. -- partition_res_14343 aliases partition_res_r_14287
  4484. let {[partition_size_7544]f32 partition_res_14343} =
  4485. partition_res_r_14287[gtid_13641,
  4486. 0i32:+partition_size_7544*1i32]
  4487. -- partition_res_14344 aliases partition_res_r_14288
  4488. let {[partition_size_7544]f32 partition_res_14344} =
  4489. partition_res_r_14288[gtid_13641,
  4490. 0i32:+partition_size_7544*1i32]
  4491. -- partition_res_14345 aliases partition_res_r_14289
  4492. let {[partition_size_7544]f32 partition_res_14345} =
  4493. partition_res_r_14289[gtid_13641,
  4494. 0i32:+partition_size_7544*1i32]
  4495. -- partition_res_14346 aliases partition_res_r_14290
  4496. let {[partition_size_7544]i32 partition_res_14346} =
  4497. partition_res_r_14290[gtid_13641,
  4498. 0i32:+partition_size_7544*1i32]
  4499. -- res_14347 aliases partition_res_14333
  4500. let {[partition_size_14332]i32 res_14347} =
  4501. partition_res_14333[0i32:+partition_size_14332*1i32]
  4502. -- res_14348 aliases partition_res_14334
  4503. let {[partition_size_14332]i32 res_14348} =
  4504. partition_res_14334[0i32:+partition_size_14332*1i32]
  4505. -- res_14349 aliases partition_res_14335
  4506. let {[partition_size_14332]f32 res_14349} =
  4507. partition_res_14335[0i32:+partition_size_14332*1i32]
  4508. -- res_14350 aliases partition_res_14336
  4509. let {[partition_size_14332]i32 res_14350} =
  4510. partition_res_14336[0i32:+partition_size_14332*1i32]
  4511. -- res_14351 aliases partition_res_14337
  4512. let {[partition_size_14332]i32 res_14351} =
  4513. partition_res_14337[0i32:+partition_size_14332*1i32]
  4514. -- res_14352 aliases partition_res_14338
  4515. let {[partition_size_14332]f32 res_14352} =
  4516. partition_res_14338[0i32:+partition_size_14332*1i32]
  4517. -- res_14353 aliases partition_res_14339
  4518. let {[partition_size_14332]i32 res_14353} =
  4519. partition_res_14339[0i32:+partition_size_14332*1i32]
  4520. -- res_14354 aliases partition_res_14340
  4521. let {[partition_size_14332]i32 res_14354} =
  4522. partition_res_14340[0i32:+partition_size_14332*1i32]
  4523. -- res_14355 aliases partition_res_14341
  4524. let {[partition_size_14332]f32 res_14355} =
  4525. partition_res_14341[0i32:+partition_size_14332*1i32]
  4526. let {[partition_size_14332]i32 lifted_2_map2_arg_14356} =
  4527. iota32(partition_size_14332, 0i32, 1i32)
  4528. let {[lifted_0_rect_pixel_indices_arg_8964]i32 res_14357} =
  4529. replicate([lifted_0_rect_pixel_indices_arg_8964],
  4530. res_9384)
  4531. let {i32 res_14358} = sdiv32(x_9103, h_7134)
  4532. let {i32 res_14359} = smod32(x_9103, h_7134)
  4533. let {bool res_14360, f32 res_14361, i32 res_14362} =
  4534. redomap(partition_size_14332,
  4535. {commutative fn {bool, f32, i32} (bool x_14363,
  4536. f32 x_14364,
  4537. i32 x_14365,
  4538. bool x_14366,
  4539. f32 x_14367,
  4540. i32 x_14368) =>
  4541. let {bool res_14369} = le32(0.0f32, x_14364)
  4542. let {bool x_14370} =
  4543. logand(x_14363, res_14369)
  4544. let {bool cond_14371} = lt32(x_14367, 0.0f32)
  4545. let {bool res_14372} = not x_14366
  4546. let {bool x_14373} = not cond_14371
  4547. let {bool y_14374} =
  4548. logand(res_14372, x_14373)
  4549. let {bool cond_14375} =
  4550. logor(cond_14371, y_14374)
  4551. let {bool res_14376} = lt32(x_14364, x_14367)
  4552. let {bool x_14377} = not cond_14375
  4553. let {bool y_14378} =
  4554. logand(res_14376, x_14377)
  4555. let {bool res_14379} =
  4556. logor(cond_14375, y_14378)
  4557. let {bool x_14380} =
  4558. logand(x_14370, res_14379)
  4559. let {bool res_14381, f32 res_14382,
  4560. i32 res_14383} =
  4561. -- Branch returns: {bool, f32, i32}
  4562. if x_14380
  4563. then {true, x_14364, x_14365} else {
  4564. let {bool res_14384} =
  4565. le32(0.0f32, x_14367)
  4566. let {bool x_14385} =
  4567. logand(x_14366, res_14384)
  4568. let {bool cond_14386} =
  4569. lt32(x_14364, 0.0f32)
  4570. let {bool res_14387} = not x_14363
  4571. let {bool x_14388} = not cond_14386
  4572. let {bool y_14389} =
  4573. logand(res_14387, x_14388)
  4574. let {bool cond_14390} =
  4575. logor(cond_14386, y_14389)
  4576. let {bool res_14391} =
  4577. lt32(x_14367, x_14364)
  4578. let {bool x_14392} = not cond_14390
  4579. let {bool y_14393} =
  4580. logand(res_14391, x_14392)
  4581. let {bool res_14394} =
  4582. logor(cond_14390, y_14393)
  4583. let {bool x_14395} =
  4584. logand(x_14385, res_14394)
  4585. let {bool res_14396, f32 res_14397,
  4586. i32 res_14398} =
  4587. -- Branch returns: {bool, f32, i32}
  4588. if x_14395
  4589. then {true, x_14367, x_14368} else {
  4590. let {bool x_14399} =
  4591. logand(x_14366, x_14370)
  4592. let {bool x_14400} =
  4593. logand(res_14384, x_14399)
  4594. let {bool res_14401} =
  4595. eq_f32(x_14364, x_14367)
  4596. let {bool x_14402} =
  4597. logand(x_14400, res_14401)
  4598. let {f32 res_14403} =
  4599. -- Branch returns: {f32}
  4600. if x_14402
  4601. then {x_14364} else {-1.0f32}
  4602. let {i32 res_14404} =
  4603. -- Branch returns: {i32}
  4604. if x_14402
  4605. then {x_14365} else {-1i32}
  4606. in {x_14402, res_14403, res_14404}
  4607. }
  4608. in {res_14396, res_14397, res_14398}
  4609. }
  4610. in {res_14381, res_14382, res_14383},
  4611. {false, -1.0f32, -1i32}},
  4612. fn {bool, f32, i32} (i32 x_14405, i32 x_14406,
  4613. f32 x_14407, i32 x_14408,
  4614. i32 x_14409, f32 x_14410,
  4615. i32 x_14411, i32 x_14412,
  4616. f32 x_14413,
  4617. i32 x_14414) =>
  4618. let {i32 x_14415} = sub32(x_14409, x_14412)
  4619. let {i32 y_14416} = sub32(x_14405, x_14411)
  4620. let {i32 x_14417} = mul32(x_14415, y_14416)
  4621. let {i32 x_14418} = sub32(x_14411, x_14408)
  4622. let {i32 y_14419} = sub32(x_14406, x_14412)
  4623. let {i32 y_14420} = mul32(x_14418, y_14419)
  4624. let {i32 factor_14421} =
  4625. add32(x_14417, y_14420)
  4626. let {bool cond_14422} =
  4627. eq_i32(factor_14421, 0i32)
  4628. let {bool cond_14423} = not cond_14422
  4629. let {i32 res_14424} =
  4630. -- Branch returns: {i32}
  4631. if cond_14423
  4632. then {factor_14421} else {1i32}
  4633. let {i32 res_14425, i32 res_14426,
  4634. i32 res_14427, f32 res_14428,
  4635. f32 res_14429, f32 res_14430} =
  4636. -- Branch returns: {i32, i32, i32, f32, f32, f32}
  4637. if cond_14423
  4638. then {
  4639. let {i32 y_14431} =
  4640. sub32(res_14358, x_14411)
  4641. let {i32 x_14432} =
  4642. mul32(x_14415, y_14431)
  4643. let {i32 y_14433} =
  4644. sub32(res_14359, x_14412)
  4645. let {i32 y_14434} =
  4646. mul32(x_14418, y_14433)
  4647. let {i32 a_14435} =
  4648. add32(x_14432, y_14434)
  4649. let {i32 x_14436} =
  4650. sub32(x_14412, x_14406)
  4651. let {i32 x_14437} =
  4652. mul32(y_14431, x_14436)
  4653. let {i32 y_14438} =
  4654. mul32(y_14416, y_14433)
  4655. let {i32 b_14439} =
  4656. add32(x_14437, y_14438)
  4657. let {i32 x_14440} =
  4658. sub32(factor_14421, a_14435)
  4659. let {i32 c_14441} =
  4660. sub32(x_14440, b_14439)
  4661. let {f32 res_14442} =
  4662. sitofp i32 factor_14421 to f32
  4663. let {f32 res_14443} =
  4664. sitofp i32 a_14435 to f32
  4665. let {f32 an_14444} =
  4666. fdiv32(res_14443, res_14442)
  4667. let {f32 res_14445} =
  4668. sitofp i32 b_14439 to f32
  4669. let {f32 bn_14446} =
  4670. fdiv32(res_14445, res_14442)
  4671. let {f32 x_14447} =
  4672. fsub32(1.0f32, an_14444)
  4673. let {f32 cn_14448} =
  4674. fsub32(x_14447, bn_14446)
  4675. in {a_14435, b_14439, c_14441, an_14444,
  4676. bn_14446, cn_14448}
  4677. } else {-1i32, -1i32, -1i32, -1.0f32,
  4678. -1.0f32, -1.0f32}
  4679. let {bool cond_14449} = slt32(0i32, res_14424)
  4680. let {bool res_14450} = sle32(0i32, res_14425)
  4681. let {bool x_14451} =
  4682. logand(cond_14449, res_14450)
  4683. let {bool res_14452} =
  4684. sle32(res_14425, res_14424)
  4685. let {bool x_14453} =
  4686. logand(x_14451, res_14452)
  4687. let {bool cond_14454} = sle32(res_14424, 0i32)
  4688. let {bool res_14455} =
  4689. sle32(res_14424, res_14425)
  4690. let {bool x_14456} =
  4691. logand(cond_14454, res_14455)
  4692. let {bool res_14457} = sle32(res_14425, 0i32)
  4693. let {bool x_14458} =
  4694. logand(x_14456, res_14457)
  4695. let {bool x_14459} = not x_14453
  4696. let {bool y_14460} = logand(x_14458, x_14459)
  4697. let {bool res_14461} = logor(x_14453, y_14460)
  4698. let {bool res_14462} = sle32(0i32, res_14426)
  4699. let {bool x_14463} =
  4700. logand(cond_14449, res_14462)
  4701. let {bool res_14464} =
  4702. sle32(res_14426, res_14424)
  4703. let {bool x_14465} =
  4704. logand(x_14463, res_14464)
  4705. let {bool res_14466} =
  4706. sle32(res_14424, res_14426)
  4707. let {bool x_14467} =
  4708. logand(cond_14454, res_14466)
  4709. let {bool res_14468} = sle32(res_14426, 0i32)
  4710. let {bool x_14469} =
  4711. logand(x_14467, res_14468)
  4712. let {bool x_14470} = not x_14465
  4713. let {bool y_14471} = logand(x_14469, x_14470)
  4714. let {bool res_14472} = logor(x_14465, y_14471)
  4715. let {bool x_14473} =
  4716. logand(res_14461, res_14472)
  4717. let {bool res_14474} = sle32(0i32, res_14427)
  4718. let {bool x_14475} =
  4719. logand(cond_14449, res_14474)
  4720. let {bool res_14476} =
  4721. sle32(res_14427, res_14424)
  4722. let {bool x_14477} =
  4723. logand(x_14475, res_14476)
  4724. let {bool res_14478} =
  4725. sle32(res_14424, res_14427)
  4726. let {bool x_14479} =
  4727. logand(cond_14454, res_14478)
  4728. let {bool res_14480} = sle32(res_14427, 0i32)
  4729. let {bool x_14481} =
  4730. logand(x_14479, res_14480)
  4731. let {bool x_14482} = not x_14477
  4732. let {bool y_14483} = logand(x_14481, x_14482)
  4733. let {bool res_14484} = logor(x_14477, y_14483)
  4734. let {bool x_14485} =
  4735. logand(x_14473, res_14484)
  4736. let {f32 x_14486} = fmul32(x_14407, res_14428)
  4737. let {f32 y_14487} = fmul32(x_14410, res_14429)
  4738. let {f32 x_14488} = fadd32(x_14486, y_14487)
  4739. let {f32 y_14489} = fmul32(x_14413, res_14430)
  4740. let {f32 res_14490} = fadd32(x_14488, y_14489)
  4741. in {x_14485, res_14490, x_14414},
  4742. res_14347, res_14348, res_14349, res_14350,
  4743. res_14351, res_14352, res_14353, res_14354,
  4744. res_14355, lifted_2_map2_arg_14356)
  4745. let {bool cond_14491} = eq_i32(res_14362, -1i32)
  4746. let {f32 res_14492, f32 res_14493, f32 res_14494} =
  4747. -- Branch returns: {f32, f32, f32}
  4748. if cond_14491
  4749. then {0.0f32, 0.0f32, 0.0f32} else {
  4750. let {i32 barycentric_coordinates_arg_14495} =
  4751. partition_res_14333[res_14362]
  4752. let {i32 barycentric_coordinates_arg_14496} =
  4753. partition_res_14334[res_14362]
  4754. let {i32 barycentric_coordinates_arg_14497} =
  4755. partition_res_14336[res_14362]
  4756. let {i32 barycentric_coordinates_arg_14498} =
  4757. partition_res_14337[res_14362]
  4758. let {i32 barycentric_coordinates_arg_14499} =
  4759. partition_res_14339[res_14362]
  4760. let {i32 barycentric_coordinates_arg_14500} =
  4761. partition_res_14340[res_14362]
  4762. let {i32 x_14501} =
  4763. sub32(barycentric_coordinates_arg_14498, barycentric_coordinates_arg_14500)
  4764. let {i32 y_14502} =
  4765. sub32(barycentric_coordinates_arg_14495, barycentric_coordinates_arg_14499)
  4766. let {i32 x_14503} = mul32(x_14501, y_14502)
  4767. let {i32 x_14504} =
  4768. sub32(barycentric_coordinates_arg_14499, barycentric_coordinates_arg_14497)
  4769. let {i32 y_14505} =
  4770. sub32(barycentric_coordinates_arg_14496, barycentric_coordinates_arg_14500)
  4771. let {i32 y_14506} = mul32(x_14504, y_14505)
  4772. let {i32 factor_14507} = add32(x_14503, y_14506)
  4773. let {bool cond_14508} = eq_i32(factor_14507, 0i32)
  4774. let {bool cond_14509} = not cond_14508
  4775. let {f32 res_14510, f32 res_14511, f32 res_14512} =
  4776. -- Branch returns: {f32, f32, f32}
  4777. if cond_14509
  4778. then {
  4779. let {i32 y_14513} =
  4780. sub32(res_14358, barycentric_coordinates_arg_14499)
  4781. let {i32 x_14514} = mul32(x_14501, y_14513)
  4782. let {i32 y_14515} =
  4783. sub32(res_14359, barycentric_coordinates_arg_14500)
  4784. let {i32 y_14516} = mul32(x_14504, y_14515)
  4785. let {i32 a_14517} = add32(x_14514, y_14516)
  4786. let {i32 x_14518} =
  4787. sub32(barycentric_coordinates_arg_14500, barycentric_coordinates_arg_14496)
  4788. let {i32 x_14519} = mul32(y_14513, x_14518)
  4789. let {i32 y_14520} = mul32(y_14502, y_14515)
  4790. let {i32 b_14521} = add32(x_14519, y_14520)
  4791. let {f32 res_14522} =
  4792. sitofp i32 factor_14507 to f32
  4793. let {f32 res_14523} = sitofp i32 a_14517 to f32
  4794. let {f32 an_14524} = fdiv32(res_14523, res_14522)
  4795. let {f32 res_14525} = sitofp i32 b_14521 to f32
  4796. let {f32 bn_14526} = fdiv32(res_14525, res_14522)
  4797. let {f32 x_14527} = fsub32(1.0f32, an_14524)
  4798. let {f32 cn_14528} = fsub32(x_14527, bn_14526)
  4799. in {an_14524, bn_14526, cn_14528}
  4800. } else {-1.0f32, -1.0f32, -1.0f32}
  4801. let {i32 color_point_arg_14529} =
  4802. partition_res_14342[res_14362]
  4803. let {f32 color_point_arg_14530} =
  4804. partition_res_14343[res_14362]
  4805. let {f32 color_point_arg_14531} =
  4806. partition_res_14344[res_14362]
  4807. let {f32 color_point_arg_14532} =
  4808. partition_res_14345[res_14362]
  4809. let {i32 color_point_arg_14533} =
  4810. partition_res_14346[res_14362]
  4811. let {bool cond_14534} =
  4812. eq_i32(color_point_arg_14529, 1i32)
  4813. let {f32 res_14535, f32 res_14536, f32 res_14537} =
  4814. -- Branch returns: {f32, f32, f32}
  4815. if cond_14534
  4816. then {color_point_arg_14530, color_point_arg_14531,
  4817. color_point_arg_14532} else {
  4818. let {bool cond_14538} =
  4819. eq_i32(color_point_arg_14529, 2i32)
  4820. let {f32 res_14539, f32 res_14540,
  4821. f32 res_14541} =
  4822. -- Branch returns: {f32, f32, f32}
  4823. if cond_14538
  4824. then {
  4825. let {i32 i_14542} =
  4826. sdiv32(color_point_arg_14533, 2i32)
  4827. let {i32 x_14543} =
  4828. and32(1i32, color_point_arg_14533)
  4829. let {bool cond_14544} = eq_i32(x_14543, 0i32)
  4830. let {f32 res_14545} =
  4831. -- Branch returns: {f32}
  4832. if cond_14544
  4833. then {0.0f32} else {1.0f32}
  4834. let {f32 res_14546} =
  4835. -- Branch returns: {f32}
  4836. if cond_14544
  4837. then {1.0f32} else {0.0f32}
  4838. let {f32 x_14547} =
  4839. fmul32(res_14510, res_14545)
  4840. let {f32 y_14548} =
  4841. fmul32(res_14511, res_14546)
  4842. let {f32 x_14549} = fadd32(x_14547, y_14548)
  4843. let {f32 y_14550} =
  4844. fmul32(res_14512, res_14545)
  4845. let {f32 yn_14551} = fadd32(x_14549, y_14550)
  4846. let {f32 y_14552} =
  4847. fmul32(res_14511, res_14545)
  4848. let {f32 x_14553} = fadd32(x_14547, y_14552)
  4849. let {f32 y_14554} =
  4850. fmul32(res_14512, res_14546)
  4851. let {f32 xn_14555} = fadd32(x_14553, y_14554)
  4852. let {f32 res_14556} =
  4853. sitofp i32 surface_h_7153 to f32
  4854. let {f32 t32_arg_14557} =
  4855. fmul32(yn_14551, res_14556)
  4856. let {i32 res_14558} =
  4857. fptosi f32 t32_arg_14557 to i32
  4858. let {f32 res_14559} =
  4859. sitofp i32 surface_w_7152 to f32
  4860. let {f32 t32_arg_14560} =
  4861. fmul32(xn_14555, res_14559)
  4862. let {i32 res_14561} =
  4863. fptosi f32 t32_arg_14560 to i32
  4864. let {i32 clamp_arg_14562} =
  4865. sub32(surface_h_7153, 1i32)
  4866. let {i32 res_14563} = smax32(0i32, res_14558)
  4867. let {i32 res_14564} =
  4868. smin32(clamp_arg_14562, res_14563)
  4869. let {i32 clamp_arg_14565} =
  4870. sub32(surface_w_7152, 1i32)
  4871. let {i32 res_14566} = smax32(0i32, res_14561)
  4872. let {i32 res_14567} =
  4873. smin32(clamp_arg_14565, res_14566)
  4874. let {i32 binop_y_14568} =
  4875. mul_nw32(surface_w_7152, surface_h_7153)
  4876. let {i32 binop_x_14569} =
  4877. mul_nw32(i_14542, binop_y_14568)
  4878. let {i32 binop_y_14570} =
  4879. mul_nw32(surface_w_7152, res_14564)
  4880. let {i32 binop_x_14571} =
  4881. add_nw32(binop_x_14569, binop_y_14570)
  4882. let {i32 new_index_14572} =
  4883. add_nw32(res_14567, binop_x_14571)
  4884. let {f32 res_14573} =
  4885. <dim_ok_7201>
  4886. surface_textures_flat_hsv_hs_7154[new_index_14572]
  4887. let {f32 res_14574} =
  4888. <empty_or_match_cert_7195, dim_ok_7201>
  4889. surface_textures_flat_hsv_ss_7155[new_index_14572]
  4890. let {f32 res_14575} =
  4891. <empty_or_match_cert_7197, dim_ok_7201>
  4892. surface_textures_flat_hsv_vs_7156[new_index_14572]
  4893. in {res_14573, res_14574, res_14575}
  4894. } else {0.0f32, 0.0f32, 0.0f32}
  4895. in {res_14539, res_14540, res_14541}
  4896. }
  4897. let {f32 y_14576} = fpow32(res_14361, 2.0f32)
  4898. let {f32 min_arg_14577} =
  4899. fdiv32(2000000.0f32, y_14576)
  4900. let {f32 res_14578} = fmin32(1.0f32, min_arg_14577)
  4901. let {f32 res_14579} = fmul32(res_14537, res_14578)
  4902. in {res_14535, res_14536, res_14579}
  4903. }
  4904. let {f32 c_14580} = fmul32(res_14493, res_14494)
  4905. let {f32 h'_14581} = fdiv32(res_14492, 60.0f32)
  4906. let {f32 t32_arg_14582} = fdiv32(h'_14581, 2.0f32)
  4907. let {i32 res_14583} = fptosi f32 t32_arg_14582 to i32
  4908. let {f32 res_14584} = sitofp i32 res_14583 to f32
  4909. let {f32 y_14585} = fmul32(2.0f32, res_14584)
  4910. let {f32 res_14586} = fsub32(h'_14581, y_14585)
  4911. let {f32 abs_arg_14587} = fsub32(res_14586, 1.0f32)
  4912. let {f32 res_14588} = fabs32 abs_arg_14587
  4913. let {f32 y_14589} = fsub32(1.0f32, res_14588)
  4914. let {f32 x_14590} = fmul32(c_14580, y_14589)
  4915. let {bool cond_14591} = le32(0.0f32, h'_14581)
  4916. let {bool res_14592} = lt32(h'_14581, 1.0f32)
  4917. let {bool x_14593} = logand(cond_14591, res_14592)
  4918. let {f32 res_14594, f32 res_14595, f32 res_14596} =
  4919. -- Branch returns: {f32, f32, f32}
  4920. if x_14593
  4921. then {c_14580, x_14590, 0.0f32} else {
  4922. let {bool cond_14597} = le32(1.0f32, h'_14581)
  4923. let {bool res_14598} = lt32(h'_14581, 2.0f32)
  4924. let {bool x_14599} = logand(cond_14597, res_14598)
  4925. let {f32 res_14600, f32 res_14601, f32 res_14602} =
  4926. -- Branch returns: {f32, f32, f32}
  4927. if x_14599
  4928. then {x_14590, c_14580, 0.0f32} else {
  4929. let {bool cond_14603} = le32(2.0f32, h'_14581)
  4930. let {bool res_14604} = lt32(h'_14581, 3.0f32)
  4931. let {bool x_14605} = logand(cond_14603, res_14604)
  4932. let {f32 res_14606, f32 res_14607,
  4933. f32 res_14608} =
  4934. -- Branch returns: {f32, f32, f32}
  4935. if x_14605
  4936. then {0.0f32, c_14580, x_14590} else {
  4937. let {bool cond_14609} = le32(3.0f32, h'_14581)
  4938. let {bool res_14610} = lt32(h'_14581, 4.0f32)
  4939. let {bool x_14611} =
  4940. logand(cond_14609, res_14610)
  4941. let {f32 res_14612} =
  4942. -- Branch returns: {f32}
  4943. if x_14611
  4944. then {x_14590} else {0.0f32}
  4945. let {f32 res_14613, f32 res_14614} =
  4946. -- Branch returns: {f32, f32}
  4947. if x_14611
  4948. then {0.0f32, c_14580} else {
  4949. let {bool cond_14615} =
  4950. le32(4.0f32, h'_14581)
  4951. let {bool res_14616} =
  4952. lt32(h'_14581, 5.0f32)
  4953. let {bool x_14617} =
  4954. logand(cond_14615, res_14616)
  4955. let {f32 res_14618, f32 res_14619} =
  4956. -- Branch returns: {f32, f32}
  4957. if x_14617
  4958. then {x_14590, c_14580} else {
  4959. let {bool cond_14620} =
  4960. le32(5.0f32, h'_14581)
  4961. let {bool res_14621} =
  4962. lt32(h'_14581, 6.0f32)
  4963. let {bool x_14622} =
  4964. logand(cond_14620, res_14621)
  4965. let {f32 res_14623} =
  4966. -- Branch returns: {f32}
  4967. if x_14622
  4968. then {c_14580} else {0.0f32}
  4969. let {f32 res_14624} =
  4970. -- Branch returns: {f32}
  4971. if x_14622
  4972. then {x_14590} else {0.0f32}
  4973. in {res_14623, res_14624}
  4974. }
  4975. in {res_14618, res_14619}
  4976. }
  4977. in {res_14613, res_14612, res_14614}
  4978. }
  4979. in {res_14606, res_14607, res_14608}
  4980. }
  4981. in {res_14600, res_14601, res_14602}
  4982. }
  4983. let {f32 m_14625} = fsub32(res_14494, c_14580)
  4984. let {f32 res_14626} = fadd32(res_14594, m_14625)
  4985. let {f32 res_14627} = fadd32(res_14595, m_14625)
  4986. let {f32 res_14628} = fadd32(res_14596, m_14625)
  4987. let {f32 f32_arg_14629} = fmul32(255.0f32, res_14626)
  4988. let {i32 unsign_arg_14630} =
  4989. fptoui f32 f32_arg_14629 to i32
  4990. let {f32 f32_arg_14631} = fmul32(255.0f32, res_14627)
  4991. let {i32 unsign_arg_14632} =
  4992. fptoui f32 f32_arg_14631 to i32
  4993. let {f32 f32_arg_14633} = fmul32(255.0f32, res_14628)
  4994. let {i32 unsign_arg_14634} =
  4995. fptoui f32 f32_arg_14633 to i32
  4996. let {i32 x_14635} = shl32(unsign_arg_14630, 16i32)
  4997. let {i32 y_14636} = shl32(unsign_arg_14632, 8i32)
  4998. let {i32 x_14637} = or32(x_14635, y_14636)
  4999. let {i32 res_14638} = or32(unsign_arg_14634, x_14637)
  5000. return {returns res_14357}
  5001. }
  5002. -- res_14639 aliases res_14331
  5003. let {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_14639} =
  5004. res_14331
  5005. -- res_14640 aliases res_14150
  5006. let {[n_total_8638][lifted_0_rect_pixel_indices_arg_8964]i32 res_14640} =
  5007. res_14150
  5008. in {res_14639, res_14640}
  5009. }
  5010. let {i32 flat_dim_9385} =
  5011. mul_nw32(n_total_8638, lifted_0_rect_pixel_indices_arg_8964)
  5012. let {bool bounds_invalid_upwards_9386} =
  5013. slt32(replicate_arg_7618, 0i32)
  5014. let {bool valid_9387} = not bounds_invalid_upwards_9386
  5015. let {cert range_valid_c_9388} =
  5016. assert(valid_9387, "Range ", 0i32, "..", 1i32, "..<",
  5017. replicate_arg_7618, " is invalid.",
  5018. "/prelude/math.fut:453:23-30")
  5019. let {[replicate_arg_7618]i32 res_9389} =
  5020. replicate([replicate_arg_7618], 0i32)
  5021. -- reshape_9390 aliases res_8972
  5022. let {[flat_dim_9385]i32 reshape_9390} = reshape((flat_dim_9385),
  5023. res_8972)
  5024. -- reshape_9391 aliases res_8971
  5025. let {[flat_dim_9385]i32 reshape_9391} = reshape((flat_dim_9385),
  5026. res_8971)
  5027. let {i64 flat_dim_14643} =
  5028. <range_valid_c_9388>
  5029. sext i32 flat_dim_9385 to i64
  5030. let {i64 nest_size_14644} =
  5031. <range_valid_c_9388>
  5032. mul_nw64(flat_dim_14643, 1i64)
  5033. let {i32 segmap_group_size_14646} =
  5034. <range_valid_c_9388>
  5035. get_size(segmap_group_size_14645, group_size)
  5036. let {i64 segmap_group_size_14647} =
  5037. <range_valid_c_9388>
  5038. sext i32 segmap_group_size_14646 to i64
  5039. let {i64 segmap_usable_groups_64_14648} =
  5040. <range_valid_c_9388>
  5041. sdiv_up64(nest_size_14644, segmap_group_size_14647)
  5042. let {i32 segmap_usable_groups_14649} =
  5043. <range_valid_c_9388>
  5044. sext i64 segmap_usable_groups_64_14648 to i32
  5045. let {[replicate_arg_7618]i32 res_9392} =
  5046. -- Consumes res_9389
  5047. <range_valid_c_9388>
  5048. segmap_thread
  5049. (#groups=segmap_usable_groups_14649; groupsize=segmap_group_size_14646)
  5050. (write_i_14641 < flat_dim_9385) (~phys_tid_14642) : {i32} {
  5051. let {i32 x_9393} = reshape_9390[write_i_14641]
  5052. let {i32 write_value_9394} = reshape_9391[write_i_14641]
  5053. let {bool cond_9395} = slt32(x_9393, replicate_arg_7618)
  5054. let {i32 res_9396} =
  5055. -- Branch returns: {i32}
  5056. if cond_9395
  5057. then {x_9393} else {-1i32}
  5058. return {res_9389 with ([res_9396 < replicate_arg_7618] <- write_value_9394)}
  5059. }
  5060. -- res_9397 aliases res_9392
  5061. let {[w_7133][h_7134]i32 res_9397} = reshape((w_7133, h_7134),
  5062. res_9392)
  5063. in {res_9397}
  5064. }
  5065. in {res_8639}
  5066. } else {
  5067. let {bool cond_9398} = eq_i32(render_approach_7130, 3i32)
  5068. let {[w_7133][h_7134]i32 res_9399} =
  5069. -- Branch returns: {[w_7133][h_7134]i32}
  5070. if cond_9398
  5071. then {
  5072. let {bool bounds_invalid_upwards_9400} =
  5073. slt32(replicate_arg_7618, 0i32)
  5074. let {bool valid_9401} = not bounds_invalid_upwards_9400
  5075. let {cert range_valid_c_9402} =
  5076. assert(valid_9401, "Range ", 0i32, "..", 1i32, "..<",
  5077. replicate_arg_7618, " is invalid.",
  5078. "/prelude/math.fut:453:23-30")
  5079. let {[replicate_arg_7618]i32 res_9403} =
  5080. replicate([replicate_arg_7618], 0i32)
  5081. let {[replicate_arg_7618]f32 res_9404} =
  5082. replicate([replicate_arg_7618], f32.inf)
  5083. let {i32 within_bounds_arg_9405} = sub32(w_7133, 1i32)
  5084. let {i32 within_bounds_arg_9406} = sub32(h_7134, 1i32)
  5085. let {f32 res_9407} = sitofp i32 surface_h_7153 to f32
  5086. let {f32 res_9408} = sitofp i32 surface_w_7152 to f32
  5087. let {i32 clamp_arg_9409} = sub32(surface_h_7153, 1i32)
  5088. let {i32 clamp_arg_9410} = sub32(surface_w_7152, 1i32)
  5089. let {i32 binop_y_9411} = mul_nw32(surface_w_7152, surface_h_7153)
  5090. let {[replicate_arg_7618]i32 res_9412,
  5091. [replicate_arg_7618]f32 res_9413} =
  5092. -- Consumes res_9403, res_9404
  5093. loop {*[replicate_arg_7618]i32 pixels_9414,
  5094. *[replicate_arg_7618]f32 z_values_9415} = {res_9403,
  5095. res_9404}
  5096. for i_9416:i32 < partition_size_7544 do {
  5097. let {i32 loopres_9417} =
  5098. <range_valid_c_9402, index_certs_7601>
  5099. partition_res_7560[i_9416]
  5100. let {i32 loopres_9418} =
  5101. <index_certs_7601>
  5102. partition_res_7561[i_9416]
  5103. let {f32 loopres_9419} =
  5104. <index_certs_7601>
  5105. partition_res_7562[i_9416]
  5106. let {i32 loopres_9420} =
  5107. <index_certs_7601>
  5108. partition_res_7563[i_9416]
  5109. let {i32 loopres_9421} =
  5110. <index_certs_7601>
  5111. partition_res_7564[i_9416]
  5112. let {f32 loopres_9422} =
  5113. <index_certs_7601>
  5114. partition_res_7565[i_9416]
  5115. let {i32 loopres_9423} =
  5116. <index_certs_7601>
  5117. partition_res_7566[i_9416]
  5118. let {i32 loopres_9424} =
  5119. <index_certs_7601>
  5120. partition_res_7567[i_9416]
  5121. let {f32 loopres_9425} =
  5122. <index_certs_7601>
  5123. partition_res_7568[i_9416]
  5124. let {i32 loopres_9426} =
  5125. <index_certs_7601>
  5126. partition_res_7569[i_9416]
  5127. let {f32 loopres_9427} =
  5128. <index_certs_7601>
  5129. partition_res_7570[i_9416]
  5130. let {f32 loopres_9428} =
  5131. <index_certs_7601>
  5132. partition_res_7571[i_9416]
  5133. let {f32 loopres_9429} =
  5134. <index_certs_7601>
  5135. partition_res_7572[i_9416]
  5136. let {i32 loopres_9430} =
  5137. <index_certs_7601>
  5138. partition_res_7573[i_9416]
  5139. let {i32 res_9431} = smin32(loopres_9417, loopres_9420)
  5140. let {i32 res_9432} = smin32(loopres_9423, res_9431)
  5141. let {i32 res_9433} = smin32(within_bounds_arg_9405, res_9432)
  5142. let {i32 res_9434} = smax32(0i32, res_9433)
  5143. let {i32 res_9435} = smin32(loopres_9418, loopres_9421)
  5144. let {i32 res_9436} = smin32(loopres_9424, res_9435)
  5145. let {i32 res_9437} = smin32(within_bounds_arg_9406, res_9436)
  5146. let {i32 res_9438} = smax32(0i32, res_9437)
  5147. let {i32 res_9439} = smax32(loopres_9417, loopres_9420)
  5148. let {i32 res_9440} = smax32(loopres_9423, res_9439)
  5149. let {i32 res_9441} = smin32(within_bounds_arg_9405, res_9440)
  5150. let {i32 res_9442} = smax32(0i32, res_9441)
  5151. let {i32 res_9443} = smax32(loopres_9418, loopres_9421)
  5152. let {i32 res_9444} = smax32(loopres_9424, res_9443)
  5153. let {i32 res_9445} = smin32(within_bounds_arg_9406, res_9444)
  5154. let {i32 res_9446} = smax32(0i32, res_9445)
  5155. let {i32 x_9447} = sub32(res_9442, res_9434)
  5156. let {i32 x_span_9448} = add32(1i32, x_9447)
  5157. let {i32 x_9449} = sub32(res_9446, res_9438)
  5158. let {i32 y_span_9450} = add32(1i32, x_9449)
  5159. let {bool bounds_invalid_upwards_9451} =
  5160. slt32(x_span_9448, 0i32)
  5161. let {bool valid_9452} = not bounds_invalid_upwards_9451
  5162. let {cert range_valid_c_9453} =
  5163. assert(valid_9452, "Range ", 0i32, "..", 1i32, "..<",
  5164. x_span_9448, " is invalid.",
  5165. "/prelude/math.fut:453:23-30")
  5166. let {[x_span_9448]i32 res_9454} =
  5167. <range_valid_c_9453>
  5168. iota32(x_span_9448, 0i32, 1i32)
  5169. let {bool bounds_invalid_upwards_9455} =
  5170. slt32(y_span_9450, 0i32)
  5171. let {bool valid_9456} = not bounds_invalid_upwards_9455
  5172. let {cert range_valid_c_9457} =
  5173. assert(valid_9456, "Range ", 0i32, "..", 1i32, "..<",
  5174. y_span_9450, " is invalid.",
  5175. "/prelude/math.fut:453:23-30")
  5176. let {[y_span_9450]i32 res_9458} =
  5177. <range_valid_c_9457>
  5178. iota32(y_span_9450, 0i32, 1i32)
  5179. let {i32 comparatee_14650} = mul_nw32(y_span_9450, 1i32)
  5180. let {bool suff_outer_par_14651} =
  5181. get_size(suff_outer_par_9, threshold ()) <= comparatee_14650
  5182. let {i64 y_span_14683} = sext i32 y_span_9450 to i64
  5183. let {i64 nest_size_14684} = mul_nw64(y_span_14683, 1i64)
  5184. let {i32 segmap_group_size_14685} =
  5185. get_size(segmap_group_size_14676, group_size)
  5186. let {i64 segmap_group_size_14686} =
  5187. sext i32 segmap_group_size_14685 to i64
  5188. let {i64 segmap_usable_groups_64_14687} =
  5189. sdiv_up64(nest_size_14684, segmap_group_size_14686)
  5190. let {i32 segmap_usable_groups_14688} =
  5191. sext i64 segmap_usable_groups_64_14687 to i32
  5192. let {[y_span_9450]i32 res_14689} =
  5193. <range_valid_c_9457>
  5194. segmap_thread
  5195. (#groups=segmap_usable_groups_14688; groupsize=segmap_group_size_14685)
  5196. (gtid_14672 < y_span_9450) (~phys_tid_14673) : {i32} {
  5197. let {i32 x_14690} = res_9458[gtid_14672]
  5198. let {i32 res_14691} = add32(res_9438, x_14690)
  5199. return {returns res_14691}
  5200. }
  5201. -- res_9459 aliases res_14689
  5202. let {[y_span_9450]i32 res_9459} = res_14689
  5203. let {i32 comparatee_14692} = mul_nw32(x_span_9448, 1i32)
  5204. let {bool suff_outer_par_14693} =
  5205. get_size(suff_outer_par_10,
  5206. threshold ()) <= comparatee_14692
  5207. let {i64 x_span_14771} = sext i32 x_span_9448 to i64
  5208. let {i64 nest_size_14772} = mul_nw64(x_span_14771, 1i64)
  5209. let {i32 segmap_group_size_14773} =
  5210. get_size(segmap_group_size_14764, group_size)
  5211. let {i64 segmap_group_size_14774} =
  5212. sext i32 segmap_group_size_14773 to i64
  5213. let {i64 segmap_usable_groups_64_14775} =
  5214. sdiv_up64(nest_size_14772, segmap_group_size_14774)
  5215. let {i32 segmap_usable_groups_14776} =
  5216. sext i64 segmap_usable_groups_64_14775 to i32
  5217. let {[x_span_9448]i32 res_r_14777} =
  5218. <range_valid_c_9453>
  5219. segmap_thread
  5220. (#groups=segmap_usable_groups_14776; groupsize=segmap_group_size_14773)
  5221. (gtid_14760 < x_span_9448) (~phys_tid_14761) : {i32} {
  5222. let {i32 x_14778} = res_9454[gtid_14760]
  5223. let {i32 res_14779} = add32(res_9434, x_14778)
  5224. return {returns res_14779}
  5225. }
  5226. let {i64 x_span_14780} = sext i32 x_span_9448 to i64
  5227. let {i64 y_span_14781} = sext i32 y_span_9450 to i64
  5228. let {i64 y_14782} = mul_nw64(y_span_14781, 1i64)
  5229. let {i64 nest_size_14783} = mul_nw64(x_span_14780, y_14782)
  5230. let {i32 segmap_group_size_14784} =
  5231. get_size(segmap_group_size_14724, group_size)
  5232. let {i64 segmap_group_size_14785} =
  5233. sext i32 segmap_group_size_14784 to i64
  5234. let {i64 segmap_usable_groups_64_14786} =
  5235. sdiv_up64(nest_size_14783, segmap_group_size_14785)
  5236. let {i32 segmap_usable_groups_14787} =
  5237. sext i64 segmap_usable_groups_64_14786 to i32
  5238. let {i32 y_14788} = mul_nw32(y_span_9450, 1i32)
  5239. let {i32 comparatee_14789} = mul_nw32(x_span_9448, y_14788)
  5240. let {bool suff_outer_par_14790} =
  5241. get_size(suff_outer_par_11,
  5242. threshold (!suff_outer_par_10)) <= comparatee_14789
  5243. let {i64 x_span_14791} = sext i32 x_span_9448 to i64
  5244. let {i64 y_span_14792} = sext i32 y_span_9450 to i64
  5245. let {i64 y_14793} = mul_nw64(y_span_14792, 1i64)
  5246. let {i64 nest_size_14794} = mul_nw64(x_span_14791, y_14793)
  5247. let {i32 segmap_group_size_14795} =
  5248. get_size(segmap_group_size_14742, group_size)
  5249. let {i64 segmap_group_size_14796} =
  5250. sext i32 segmap_group_size_14795 to i64
  5251. let {i64 segmap_usable_groups_64_14797} =
  5252. sdiv_up64(nest_size_14794, segmap_group_size_14796)
  5253. let {i32 segmap_usable_groups_14798} =
  5254. sext i64 segmap_usable_groups_64_14797 to i32
  5255. let {[x_span_9448][y_span_9450]i32 res_14799} =
  5256. <range_valid_c_9453>
  5257. segmap_thread
  5258. (#groups=segmap_usable_groups_14798; groupsize=segmap_group_size_14795)
  5259. (gtid_14735 < x_span_9448,
  5260. gtid_14736 < y_span_9450) (~phys_tid_14737) : {i32} {
  5261. let {i32 res_14800} = res_r_14777[gtid_14735]
  5262. let {i32 tmp_14801} = replicate([], res_14800)
  5263. return {returns tmp_14801}
  5264. }
  5265. -- res_14802 aliases res_14799
  5266. let {[x_span_9448][y_span_9450]i32 res_14802} = res_14799
  5267. -- res_9462 aliases res_14802
  5268. let {[x_span_9448][y_span_9450]i32 res_9462} = res_14802
  5269. let {i32 flat_dim_9466} = mul_nw32(x_span_9448, y_span_9450)
  5270. -- reshape_9467 aliases res_9462
  5271. let {[flat_dim_9466]i32 reshape_9467} =
  5272. reshape((flat_dim_9466), res_9462)
  5273. let {[x_span_9448][y_span_9450]i32 repeat_9468} =
  5274. replicate([x_span_9448], res_9459)
  5275. -- reshape_9469 aliases repeat_9468
  5276. let {[flat_dim_9466]i32 reshape_9469} =
  5277. reshape((flat_dim_9466), repeat_9468)
  5278. let {i32 comparatee_14803} = mul_nw32(flat_dim_9466, 1i32)
  5279. let {bool suff_outer_par_14804} =
  5280. get_size(suff_outer_par_12,
  5281. threshold ()) <= comparatee_14803
  5282. let {i64 flat_dim_14846} = sext i32 flat_dim_9466 to i64
  5283. let {i64 nest_size_14847} = mul_nw64(flat_dim_14846, 1i64)
  5284. let {i32 segmap_group_size_14848} =
  5285. get_size(segmap_group_size_14836, group_size)
  5286. let {i64 segmap_group_size_14849} =
  5287. sext i32 segmap_group_size_14848 to i64
  5288. let {i64 segmap_usable_groups_64_14850} =
  5289. sdiv_up64(nest_size_14847, segmap_group_size_14849)
  5290. let {i32 segmap_usable_groups_14851} =
  5291. sext i64 segmap_usable_groups_64_14850 to i32
  5292. let {[flat_dim_9466]f32 res_14852,
  5293. [flat_dim_9466]i32 res_14853} =
  5294. segmap_thread
  5295. (#groups=segmap_usable_groups_14851; groupsize=segmap_group_size_14848)
  5296. (gtid_14832 < flat_dim_9466) (~phys_tid_14833) : {f32,
  5297. i32} {
  5298. let {i32 x_14854} = reshape_9467[gtid_14832]
  5299. let {i32 x_14855} = reshape_9469[gtid_14832]
  5300. let {i32 x_14856} = mul32(h_7134, x_14854)
  5301. let {i32 res_14857} = add32(x_14855, x_14856)
  5302. let {f32 res_14858} = z_values_9415[res_14857]
  5303. return {returns res_14858, returns res_14857}
  5304. }
  5305. -- res_9470 aliases res_14852
  5306. let {[flat_dim_9466]f32 res_9470} = res_14852
  5307. -- res_9471 aliases res_14853
  5308. let {[flat_dim_9466]i32 res_9471} = res_14853
  5309. let {i32 x_9477} = sub32(loopres_9421, loopres_9424)
  5310. let {i32 y_9478} = sub32(loopres_9417, loopres_9423)
  5311. let {i32 x_9479} = mul32(x_9477, y_9478)
  5312. let {i32 x_9480} = sub32(loopres_9423, loopres_9420)
  5313. let {i32 y_9481} = sub32(loopres_9418, loopres_9424)
  5314. let {i32 y_9482} = mul32(x_9480, y_9481)
  5315. let {i32 factor_9483} = add32(x_9479, y_9482)
  5316. let {bool cond_9484} = eq_i32(factor_9483, 0i32)
  5317. let {bool cond_9485} = not cond_9484
  5318. let {i32 res_9486} =
  5319. -- Branch returns: {i32}
  5320. if cond_9485
  5321. then {factor_9483} else {1i32}
  5322. let {i32 x_9487} = sub32(loopres_9424, loopres_9418)
  5323. let {f32 res_9488} = sitofp i32 factor_9483 to f32
  5324. let {bool cond_9489} = eq_i32(loopres_9426, 1i32)
  5325. let {bool cond_9490} = eq_i32(loopres_9426, 2i32)
  5326. let {i32 i_9491} = sdiv32(loopres_9430, 2i32)
  5327. let {i32 x_9492} = and32(1i32, loopres_9430)
  5328. let {bool cond_9493} = eq_i32(x_9492, 0i32)
  5329. let {f32 res_9494} =
  5330. -- Branch returns: {f32}
  5331. if cond_9493
  5332. then {0.0f32} else {1.0f32}
  5333. let {f32 res_9495} =
  5334. -- Branch returns: {f32}
  5335. if cond_9493
  5336. then {1.0f32} else {0.0f32}
  5337. let {i32 binop_x_9496} = mul_nw32(binop_y_9411, i_9491)
  5338. let {bool cond_9497} = slt32(0i32, res_9486)
  5339. let {bool cond_9498} = sle32(res_9486, 0i32)
  5340. let {i64 flat_dim_14861} = sext i32 flat_dim_9466 to i64
  5341. let {i64 nest_size_14862} = mul_nw64(flat_dim_14861, 1i64)
  5342. let {i32 segmap_group_size_14864} =
  5343. get_size(segmap_group_size_14863, group_size)
  5344. let {i64 segmap_group_size_14865} =
  5345. sext i32 segmap_group_size_14864 to i64
  5346. let {i64 segmap_usable_groups_64_14866} =
  5347. sdiv_up64(nest_size_14862, segmap_group_size_14865)
  5348. let {i32 segmap_usable_groups_14867} =
  5349. sext i64 segmap_usable_groups_64_14866 to i32
  5350. let {[replicate_arg_7618]f32 res_9499,
  5351. [replicate_arg_7618]i32 res_9500} =
  5352. -- Consumes pixels_9414, z_values_9415
  5353. segmap_thread
  5354. (#groups=segmap_usable_groups_14867; groupsize=segmap_group_size_14864)
  5355. (write_i_14859 < flat_dim_9466) (~phys_tid_14860) : {f32,
  5356. i32} {
  5357. let {i32 x_9501} = res_9471[write_i_14859]
  5358. let {f32 x_9502} = res_9470[write_i_14859]
  5359. let {i32 x_9503} = reshape_9467[write_i_14859]
  5360. let {i32 x_9504} = reshape_9469[write_i_14859]
  5361. let {i32 res_9505, i32 res_9506, i32 res_9507,
  5362. f32 res_9508, f32 res_9509, f32 res_9510} =
  5363. -- Branch returns: {i32, i32, i32, f32, f32, f32}
  5364. if cond_9485
  5365. then {
  5366. let {i32 y_9511} = sub32(x_9503, loopres_9423)
  5367. let {i32 x_9512} = mul32(x_9477, y_9511)
  5368. let {i32 y_9513} = sub32(x_9504, loopres_9424)
  5369. let {i32 y_9514} = mul32(x_9480, y_9513)
  5370. let {i32 a_9515} = add32(x_9512, y_9514)
  5371. let {i32 x_9516} = mul32(x_9487, y_9511)
  5372. let {i32 y_9517} = mul32(y_9478, y_9513)
  5373. let {i32 b_9518} = add32(x_9516, y_9517)
  5374. let {i32 x_9519} = sub32(factor_9483, a_9515)
  5375. let {i32 c_9520} = sub32(x_9519, b_9518)
  5376. let {f32 res_9521} = sitofp i32 a_9515 to f32
  5377. let {f32 an_9522} = fdiv32(res_9521, res_9488)
  5378. let {f32 res_9523} = sitofp i32 b_9518 to f32
  5379. let {f32 bn_9524} = fdiv32(res_9523, res_9488)
  5380. let {f32 x_9525} = fsub32(1.0f32, an_9522)
  5381. let {f32 cn_9526} = fsub32(x_9525, bn_9524)
  5382. in {a_9515, b_9518, c_9520, an_9522, bn_9524, cn_9526}
  5383. } else {-1i32, -1i32, -1i32, -1.0f32, -1.0f32, -1.0f32}
  5384. let {f32 x_9527} = fmul32(loopres_9419, res_9508)
  5385. let {f32 y_9528} = fmul32(loopres_9422, res_9509)
  5386. let {f32 x_9529} = fadd32(x_9527, y_9528)
  5387. let {f32 y_9530} = fmul32(loopres_9425, res_9510)
  5388. let {f32 res_9531} = fadd32(x_9529, y_9530)
  5389. let {f32 res_9532, f32 res_9533, f32 res_9534} =
  5390. -- Branch returns: {f32, f32, f32}
  5391. if cond_9489
  5392. then {loopres_9427, loopres_9428, loopres_9429} else {
  5393. let {f32 res_9535, f32 res_9536, f32 res_9537} =
  5394. -- Branch returns: {f32, f32, f32}
  5395. if cond_9490
  5396. then {
  5397. let {f32 x_9538} = fmul32(res_9494, res_9508)
  5398. let {f32 y_9539} = fmul32(res_9495, res_9509)
  5399. let {f32 x_9540} = fadd32(x_9538, y_9539)
  5400. let {f32 y_9541} = fmul32(res_9494, res_9510)
  5401. let {f32 yn_9542} = fadd32(x_9540, y_9541)
  5402. let {f32 y_9543} = fmul32(res_9494, res_9509)
  5403. let {f32 x_9544} = fadd32(x_9538, y_9543)
  5404. let {f32 y_9545} = fmul32(res_9495, res_9510)
  5405. let {f32 xn_9546} = fadd32(x_9544, y_9545)
  5406. let {f32 t32_arg_9547} = fmul32(res_9407, yn_9542)
  5407. let {i32 res_9548} =
  5408. fptosi f32 t32_arg_9547 to i32
  5409. let {f32 t32_arg_9549} = fmul32(res_9408, xn_9546)
  5410. let {i32 res_9550} =
  5411. fptosi f32 t32_arg_9549 to i32
  5412. let {i32 res_9551} = smax32(0i32, res_9548)
  5413. let {i32 res_9552} =
  5414. smin32(clamp_arg_9409, res_9551)
  5415. let {i32 res_9553} = smax32(0i32, res_9550)
  5416. let {i32 res_9554} =
  5417. smin32(clamp_arg_9410, res_9553)
  5418. let {i32 binop_y_9555} =
  5419. mul_nw32(surface_w_7152, res_9552)
  5420. let {i32 binop_x_9556} =
  5421. add_nw32(binop_x_9496, binop_y_9555)
  5422. let {i32 new_index_9557} =
  5423. add_nw32(res_9554, binop_x_9556)
  5424. let {f32 res_9558} =
  5425. <dim_ok_7201>
  5426. surface_textures_flat_hsv_hs_7154[new_index_9557]
  5427. let {f32 res_9559} =
  5428. <empty_or_match_cert_7195, dim_ok_7201>
  5429. surface_textures_flat_hsv_ss_7155[new_index_9557]
  5430. let {f32 res_9560} =
  5431. <empty_or_match_cert_7197, dim_ok_7201>
  5432. surface_textures_flat_hsv_vs_7156[new_index_9557]
  5433. in {res_9558, res_9559, res_9560}
  5434. } else {0.0f32, 0.0f32, 0.0f32}
  5435. in {res_9535, res_9536, res_9537}
  5436. }
  5437. let {f32 y_9561} = fpow32(res_9531, 2.0f32)
  5438. let {f32 min_arg_9562} = fdiv32(2000000.0f32, y_9561)
  5439. let {f32 res_9563} = fmin32(1.0f32, min_arg_9562)
  5440. let {f32 res_9564} = fmul32(res_9534, res_9563)
  5441. let {f32 c_9565} = fmul32(res_9533, res_9564)
  5442. let {f32 h'_9566} = fdiv32(res_9532, 60.0f32)
  5443. let {f32 t32_arg_9567} = fdiv32(h'_9566, 2.0f32)
  5444. let {i32 res_9568} = fptosi f32 t32_arg_9567 to i32
  5445. let {f32 res_9569} = sitofp i32 res_9568 to f32
  5446. let {f32 y_9570} = fmul32(2.0f32, res_9569)
  5447. let {f32 res_9571} = fsub32(h'_9566, y_9570)
  5448. let {f32 abs_arg_9572} = fsub32(res_9571, 1.0f32)
  5449. let {f32 res_9573} = fabs32 abs_arg_9572
  5450. let {f32 y_9574} = fsub32(1.0f32, res_9573)
  5451. let {f32 x_9575} = fmul32(c_9565, y_9574)
  5452. let {bool cond_9576} = le32(0.0f32, h'_9566)
  5453. let {bool res_9577} = lt32(h'_9566, 1.0f32)
  5454. let {bool x_9578} = logand(cond_9576, res_9577)
  5455. let {f32 res_9579, f32 res_9580, f32 res_9581} =
  5456. -- Branch returns: {f32, f32, f32}
  5457. if x_9578
  5458. then {c_9565, x_9575, 0.0f32} else {
  5459. let {bool cond_9582} = le32(1.0f32, h'_9566)
  5460. let {bool res_9583} = lt32(h'_9566, 2.0f32)
  5461. let {bool x_9584} = logand(cond_9582, res_9583)
  5462. let {f32 res_9585, f32 res_9586, f32 res_9587} =
  5463. -- Branch returns: {f32, f32, f32}
  5464. if x_9584
  5465. then {x_9575, c_9565, 0.0f32} else {
  5466. let {bool cond_9588} = le32(2.0f32, h'_9566)
  5467. let {bool res_9589} = lt32(h'_9566, 3.0f32)
  5468. let {bool x_9590} = logand(cond_9588, res_9589)
  5469. let {f32 res_9591, f32 res_9592, f32 res_9593} =
  5470. -- Branch returns: {f32, f32, f32}
  5471. if x_9590
  5472. then {0.0f32, c_9565, x_9575} else {
  5473. let {bool cond_9594} = le32(3.0f32, h'_9566)
  5474. let {bool res_9595} = lt32(h'_9566, 4.0f32)
  5475. let {bool x_9596} =
  5476. logand(cond_9594, res_9595)
  5477. let {f32 res_9597} =
  5478. -- Branch returns: {f32}
  5479. if x_9596
  5480. then {x_9575} else {0.0f32}
  5481. let {f32 res_9598, f32 res_9599} =
  5482. -- Branch returns: {f32, f32}
  5483. if x_9596
  5484. then {0.0f32, c_9565} else {
  5485. let {bool cond_9600} =
  5486. le32(4.0f32, h'_9566)
  5487. let {bool res_9601} =
  5488. lt32(h'_9566, 5.0f32)
  5489. let {bool x_9602} =
  5490. logand(cond_9600, res_9601)
  5491. let {f32 res_9603, f32 res_9604} =
  5492. -- Branch returns: {f32, f32}
  5493. if x_9602
  5494. then {x_9575, c_9565} else {
  5495. let {bool cond_9605} =
  5496. le32(5.0f32, h'_9566)
  5497. let {bool res_9606} =
  5498. lt32(h'_9566, 6.0f32)
  5499. let {bool x_9607} =
  5500. logand(cond_9605, res_9606)
  5501. let {f32 res_9608} =
  5502. -- Branch returns: {f32}
  5503. if x_9607
  5504. then {c_9565} else {0.0f32}
  5505. let {f32 res_9609} =
  5506. -- Branch returns: {f32}
  5507. if x_9607
  5508. then {x_9575} else {0.0f32}
  5509. in {res_9608, res_9609}
  5510. }
  5511. in {res_9603, res_9604}
  5512. }
  5513. in {res_9598, res_9597, res_9599}
  5514. }
  5515. in {res_9591, res_9592, res_9593}
  5516. }
  5517. in {res_9585, res_9586, res_9587}
  5518. }
  5519. let {f32 m_9610} = fsub32(res_9564, c_9565)
  5520. let {f32 res_9611} = fadd32(res_9579, m_9610)
  5521. let {f32 res_9612} = fadd32(res_9580, m_9610)
  5522. let {f32 res_9613} = fadd32(res_9581, m_9610)
  5523. let {f32 f32_arg_9614} = fmul32(255.0f32, res_9611)
  5524. let {i32 unsign_arg_9615} = fptoui f32 f32_arg_9614 to i32
  5525. let {f32 f32_arg_9616} = fmul32(255.0f32, res_9612)
  5526. let {i32 unsign_arg_9617} = fptoui f32 f32_arg_9616 to i32
  5527. let {f32 f32_arg_9618} = fmul32(255.0f32, res_9613)
  5528. let {i32 unsign_arg_9619} = fptoui f32 f32_arg_9618 to i32
  5529. let {i32 x_9620} = shl32(unsign_arg_9615, 16i32)
  5530. let {i32 y_9621} = shl32(unsign_arg_9617, 8i32)
  5531. let {i32 x_9622} = or32(x_9620, y_9621)
  5532. let {i32 res_9623} = or32(unsign_arg_9619, x_9622)
  5533. let {bool res_9624} = sle32(0i32, res_9505)
  5534. let {bool x_9625} = logand(cond_9497, res_9624)
  5535. let {bool res_9626} = sle32(res_9505, res_9486)
  5536. let {bool x_9627} = logand(x_9625, res_9626)
  5537. let {bool res_9628} = sle32(res_9486, res_9505)
  5538. let {bool x_9629} = logand(cond_9498, res_9628)
  5539. let {bool res_9630} = sle32(res_9505, 0i32)
  5540. let {bool x_9631} = logand(x_9629, res_9630)
  5541. let {bool x_9632} = not x_9627
  5542. let {bool y_9633} = logand(x_9631, x_9632)
  5543. let {bool res_9634} = logor(x_9627, y_9633)
  5544. let {bool res_9635} = sle32(0i32, res_9506)
  5545. let {bool x_9636} = logand(cond_9497, res_9635)
  5546. let {bool res_9637} = sle32(res_9506, res_9486)
  5547. let {bool x_9638} = logand(x_9636, res_9637)
  5548. let {bool res_9639} = sle32(res_9486, res_9506)
  5549. let {bool x_9640} = logand(cond_9498, res_9639)
  5550. let {bool res_9641} = sle32(res_9506, 0i32)
  5551. let {bool x_9642} = logand(x_9640, res_9641)
  5552. let {bool x_9643} = not x_9638
  5553. let {bool y_9644} = logand(x_9642, x_9643)
  5554. let {bool res_9645} = logor(x_9638, y_9644)
  5555. let {bool x_9646} = logand(res_9634, res_9645)
  5556. let {bool res_9647} = sle32(0i32, res_9507)
  5557. let {bool x_9648} = logand(cond_9497, res_9647)
  5558. let {bool res_9649} = sle32(res_9507, res_9486)
  5559. let {bool x_9650} = logand(x_9648, res_9649)
  5560. let {bool res_9651} = sle32(res_9486, res_9507)
  5561. let {bool x_9652} = logand(cond_9498, res_9651)
  5562. let {bool res_9653} = sle32(res_9507, 0i32)
  5563. let {bool x_9654} = logand(x_9652, res_9653)
  5564. let {bool x_9655} = not x_9650
  5565. let {bool y_9656} = logand(x_9654, x_9655)
  5566. let {bool res_9657} = logor(x_9650, y_9656)
  5567. let {bool x_9658} = logand(x_9646, res_9657)
  5568. let {bool res_9659} = le32(0.0f32, res_9531)
  5569. let {bool x_9660} = logand(x_9658, res_9659)
  5570. let {bool cond_9661} = lt32(x_9502, 0.0f32)
  5571. let {bool res_9662} = lt32(res_9531, x_9502)
  5572. let {bool x_9663} = not cond_9661
  5573. let {bool y_9664} = logand(res_9662, x_9663)
  5574. let {bool res_9665} = logor(cond_9661, y_9664)
  5575. let {bool x_9666} = logand(x_9660, res_9665)
  5576. let {i32 res_9667} =
  5577. -- Branch returns: {i32}
  5578. if x_9666
  5579. then {x_9501} else {-1i32}
  5580. let {i32 res_9668} =
  5581. -- Branch returns: {i32}
  5582. if x_9666
  5583. then {res_9623} else {0i32}
  5584. let {f32 res_9669} =
  5585. -- Branch returns: {f32}
  5586. if x_9666
  5587. then {res_9531} else {0.0f32}
  5588. return {z_values_9415 with ([res_9667 < replicate_arg_7618] <- res_9669),
  5589. pixels_9414 with ([res_9667 < replicate_arg_7618] <- res_9668)}
  5590. }
  5591. in {res_9500, res_9499}
  5592. }
  5593. -- res_9670 aliases res_9412
  5594. let {[w_7133][h_7134]i32 res_9670} = reshape((w_7133, h_7134),
  5595. res_9412)
  5596. in {res_9670}
  5597. } else {
  5598. let {bool bounds_invalid_upwards_9671} = slt32(w_7133, 0i32)
  5599. let {bool valid_9672} = not bounds_invalid_upwards_9671
  5600. let {cert range_valid_c_9673} =
  5601. assert(valid_9672, "Range ", 0i32, "..", 1i32, "..<", w_7133,
  5602. " is invalid.",
  5603. "/prelude/math.fut:453:23-30")
  5604. let {[w_7133][h_7134]i32 res_9674} = replicate([w_7133, h_7134],
  5605. 0i32)
  5606. -- res_9675 aliases res_9674
  5607. let {[w_7133][h_7134]i32 res_9675} =
  5608. <range_valid_c_9673>
  5609. res_9674
  5610. in {res_9675}
  5611. }
  5612. in {res_9399}
  5613. }
  5614. in {res_8634}
  5615. }
  5616. in {w_7133, h_7134, res_7619}
  5617. }
Add Comment
Please, Sign In to add comment