Advertisement
tinyevil

Untitled

Jun 29th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. function max(x y:i32):i32{
  2.     if ( x > y ){
  3.         return x;
  4.     }else{
  5.         return y;
  6.     }
  7. }
  8.  
  9. function max(x y:i32):i32 = (compiler, body) => {
  10.     let if_block = compiler.insert_if_stmt(body);
  11.     let block1 = if_block.add_branch(
  12.         compiler.create_int_cmp_i32(
  13.             compiler.find_param("x"),
  14.             compiler.find_param("y")
  15.         )
  16.     );
  17.     compiler.insert_return(block1, compiler.find_param("x"));
  18.    
  19.     let block2 = if_block.add_else_branch();
  20.     compiler.insert_return(block2, compiler.find_param("y"));  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement