Skip to content

Instantly share code, notes, and snippets.

@akawashiro
Created October 31, 2018 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akawashiro/62fbc0c465aa120928fb9eb8c20b0de1 to your computer and use it in GitHub Desktop.
Save akawashiro/62fbc0c465aa120928fb9eb8c20b0de1 to your computer and use it in GitHub Desktop.
(module
(import "host" "print" (func $print_f32 (param f32)))
(import "host" "print" (func $print_i32 (param i32)))
(memory 65536)
(table 6 anyfunc)
(func $def_fun_andb_0 (param $val_b1_20 i32) (param $val_b2_21 i32) (param $cls_fun_andb_0 i32) (result i32)
(local $stack_top_var i32)
(get_local $val_b1_20)
(if (result i32)
(i32.eqz)
(then
(i32.const 0))
(else
(get_local $val_b2_21)
(if (result i32)
(i32.eqz)
(then
(i32.const 0))
(else
(i32.const 1))))))
(func $def_fun_abs_1 (param $val_f_19 f32) (param $cls_fun_abs_1 i32) (result f32)
(local $stack_top_var i32)
(f32.const 0.0)
(get_local $val_f_19)
(f32.lt)
(if (result f32)
(i32.eqz)
(then
(f32.const -1.0)
(get_local $val_f_19)
(f32.mul))
(else
(get_local $val_f_19))))
(func $def_fun_isConv_2 (param $val_x_17 f32) (param $val_y_18 f32) (param $cls_fun_isConv_2 i32) (result i32)
(local $fun_abs_1 i32)
(local $fun_andb_0 i32)
(local $tmp_fun_isConv_2 i32)
(local $stack_top_var i32)
(get_local $cls_fun_isConv_2)
(set_local $stack_top_var)
(get_local $stack_top_var)
(i32.const 0)
(i32.add)
(i32.load)
(set_local $tmp_fun_isConv_2)
(get_local $stack_top_var)
(i32.const 4)
(i32.add)
(i32.load)
(set_local $fun_andb_0)
(get_local $stack_top_var)
(i32.const 8)
(i32.add)
(i32.load)
(set_local $fun_abs_1)
(get_local $stack_top_var)
(i32.const 12)
(i32.add)
(i32.load)
(set_local $fun_abs_1)
(get_local $val_x_17)
(get_local $fun_abs_1)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param i32) (result f32))
(f32.const 1.0)
(f32.lt)
(get_local $val_y_18)
(get_local $fun_abs_1)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param i32) (result f32))
(f32.const 1.0)
(f32.lt)
(get_local $fun_andb_0)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param i32) (param i32) (param i32) (result i32))
(if (result i32)
(i32.eqz)
(then
(i32.const 0))
(else
(i32.const 1))))
(func $def_fun_m_4 (param $val_a_11 f32) (param $val_b_12 f32) (param $cls_fun_m_4 i32) (result i32)
(local $fun_f_13 i32)
(local $fun_isConv_2 i32)
(local $val_times_3 i32)
(local $tmp_fun_m_4 i32)
(local $stack_top_var i32)
(get_local $cls_fun_m_4)
(set_local $stack_top_var)
(get_local $stack_top_var)
(i32.const 0)
(i32.add)
(i32.load)
(set_local $tmp_fun_m_4)
(get_local $stack_top_var)
(i32.const 4)
(i32.add)
(i32.load)
(set_local $val_times_3)
(get_local $stack_top_var)
(i32.const 8)
(i32.add)
(i32.load)
(set_local $fun_isConv_2)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(i32.const 5)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_times_3)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_isConv_2)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_a_11)
(f32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_b_12)
(f32.store)
(set_local $fun_f_13)
(get_local $val_a_11)
(get_local $val_b_12)
(i32.const 0)
(get_local $fun_f_13)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param f32) (param i32) (param i32) (result i32)))
(func $def_fun_plot_6 (param $val_x_7 f32) (param $val_y_8 f32) (param $cls_fun_plot_6 i32) (result i32)
(local $val_yy_10 f32)
(local $val_xx_9 f32)
(local $fun_plot_6 i32)
(local $fun_m_4 i32)
(local $val_dt_5 f32)
(local $fun_andb_0 i32)
(local $tmp_fun_plot_6 i32)
(local $stack_top_var i32)
(get_local $cls_fun_plot_6)
(set_local $stack_top_var)
(get_local $stack_top_var)
(i32.const 0)
(i32.add)
(i32.load)
(set_local $tmp_fun_plot_6)
(get_local $stack_top_var)
(i32.const 4)
(i32.add)
(i32.load)
(set_local $fun_andb_0)
(get_local $stack_top_var)
(i32.const 8)
(i32.add)
(f32.load)
(set_local $val_dt_5)
(get_local $stack_top_var)
(i32.const 12)
(i32.add)
(f32.load)
(set_local $val_dt_5)
(get_local $stack_top_var)
(i32.const 16)
(i32.add)
(i32.load)
(set_local $fun_m_4)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_andb_0)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_dt_5)
(f32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_dt_5)
(f32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_m_4)
(i32.store)
(set_local $fun_plot_6)
(f32.const 1.0)
(get_local $val_x_7)
(f32.lt)
(f32.const 1.0)
(get_local $val_y_8)
(f32.lt)
(get_local $fun_andb_0)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param i32) (param i32) (param i32) (result i32))
(if (result i32)
(i32.eqz)
(then
(f32.const 1.0)
(get_local $val_x_7)
(f32.lt)
(if (result f32)
(i32.eqz)
(then
(get_local $val_x_7)
(get_local $val_dt_5)
(f32.add))
(else
(f32.const -1.0)))
(set_local $val_xx_9)
(f32.const 1.0)
(get_local $val_x_7)
(f32.lt)
(if (result f32)
(i32.eqz)
(then
(get_local $val_y_8))
(else
(get_local $val_y_8)
(get_local $val_dt_5)
(f32.add)))
(set_local $val_yy_10)
(get_local $val_x_7)
(get_local $val_y_8)
(get_local $fun_m_4)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param f32) (param i32) (result i32))
(if (result i32)
(i32.eqz)
(then
(get_local $val_xx_9)
(get_local $val_yy_10)
(get_local $fun_plot_6)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param f32) (param i32) (result i32)))
(else
(get_local $val_x_7)
(call $print_f32)
(get_local $val_y_8)
(call $print_f32)
(get_local $val_xx_9)
(get_local $val_yy_10)
(get_local $fun_plot_6)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param f32) (param i32) (result i32)))))
(else
(i32.const 1))))
(func $def_fun_f_13 (param $val_x_14 f32) (param $val_y_15 f32) (param $val_n_16 i32) (param $cls_fun_f_13 i32) (result i32)
(local $fun_f_13 i32)
(local $val_b_12 f32)
(local $val_a_11 f32)
(local $fun_isConv_2 i32)
(local $val_times_3 i32)
(local $tmp_fun_f_13 i32)
(local $stack_top_var i32)
(get_local $cls_fun_f_13)
(set_local $stack_top_var)
(get_local $stack_top_var)
(i32.const 0)
(i32.add)
(i32.load)
(set_local $tmp_fun_f_13)
(get_local $stack_top_var)
(i32.const 4)
(i32.add)
(i32.load)
(set_local $val_times_3)
(get_local $stack_top_var)
(i32.const 8)
(i32.add)
(i32.load)
(set_local $fun_isConv_2)
(get_local $stack_top_var)
(i32.const 12)
(i32.add)
(f32.load)
(set_local $val_a_11)
(get_local $stack_top_var)
(i32.const 16)
(i32.add)
(f32.load)
(set_local $val_b_12)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(i32.const 5)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_times_3)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_isConv_2)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_a_11)
(f32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_b_12)
(f32.store)
(set_local $fun_f_13)
(get_local $val_times_3)
(get_local $val_n_16)
(i32.lt_s)
(if (result i32)
(i32.eqz)
(then
(get_local $val_x_14)
(get_local $val_x_14)
(f32.mul)
(get_local $val_y_15)
(get_local $val_y_15)
(f32.mul)
(f32.sub)
(get_local $val_a_11)
(f32.add)
(f32.const 2.0)
(get_local $val_x_14)
(f32.mul)
(get_local $val_y_15)
(f32.mul)
(get_local $val_b_12)
(f32.add)
(get_local $val_n_16)
(i32.const 1)
(i32.add)
(get_local $fun_f_13)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param f32) (param i32) (param i32) (result i32)))
(else
(get_local $val_x_14)
(get_local $val_y_15)
(get_local $fun_isConv_2)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param f32) (param i32) (result i32)))))
(elem (i32.const 0) $def_fun_andb_0 $def_fun_abs_1 $def_fun_isConv_2 $def_fun_m_4 $def_fun_plot_6 $def_fun_f_13)
(func (export "main") (result i32)
(local $fun_plot_6 i32)
(local $val_dt_5 f32)
(local $fun_m_4 i32)
(local $val_times_3 i32)
(local $fun_isConv_2 i32)
(local $fun_abs_1 i32)
(local $fun_andb_0 i32)
(local $stack_top_var i32)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(i32.const 0)
(i32.store)
(set_local $fun_andb_0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(i32.const 1)
(i32.store)
(set_local $fun_abs_1)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(i32.const 2)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_andb_0)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_abs_1)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_abs_1)
(i32.store)
(set_local $fun_isConv_2)
(i32.const 10)
(set_local $val_times_3)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(i32.const 3)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_times_3)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_isConv_2)
(i32.store)
(set_local $fun_m_4)
(f32.const 5.0e-2)
(set_local $val_dt_5)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_andb_0)
(i32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_dt_5)
(f32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $val_dt_5)
(f32.store)
(i32.const 0)
(i32.const 0)
(i32.load)
(i32.const 4)
(i32.add)
(i32.store)
(i32.const 0)
(i32.load)
(get_local $fun_m_4)
(i32.store)
(set_local $fun_plot_6)
(f32.const -1.0)
(f32.const -1.0)
(get_local $fun_plot_6)
(set_local $stack_top_var)
(get_local $stack_top_var)
(get_local $stack_top_var)
(i32.load)
(call_indirect (param f32) (param f32) (param i32) (result i32))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment