Created
May 30, 2015 12:40
-
-
Save tyage/a50328992427dab7223a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int plus_one(int i) { | |
return i + 1; | |
} | |
int main(void) { | |
for (int i = 0; i < 10; ++i) { | |
printf("%d\n", plus_one(i)); | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _plus_one($i) { | |
$i = $i|0; | |
var $0 = 0, $1 = 0, $2 = 0, label = 0, sp = 0; | |
sp = STACKTOP; | |
STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abort(); | |
$0 = $i; | |
$1 = $0; | |
$2 = (($1) + 1)|0; | |
STACKTOP = sp;return ($2|0); | |
} | |
function _main() { | |
var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $i = 0, $vararg_buffer = 0, label = 0, sp = 0; | |
sp = STACKTOP; | |
STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abort(); | |
$vararg_buffer = sp; | |
$0 = 0; | |
$i = 0; | |
while(1) { | |
$1 = $i; | |
$2 = ($1|0)<(10); | |
if (!($2)) { | |
break; | |
} | |
$3 = $i; | |
$4 = (_plus_one($3)|0); | |
HEAP32[$vararg_buffer>>2] = $4; | |
(_printf((8|0),($vararg_buffer|0))|0); | |
$5 = $i; | |
$6 = (($5) + 1)|0; | |
$i = $6; | |
} | |
STACKTOP = sp;return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment