Last active
May 4, 2017 14:36
-
-
Save axic/ca1cb385e193d7cacfe38e86766d4dea to your computer and use it in GitHub Desktop.
Sample clang compiled webassembly
This file contains 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
main() { | |
char buf[4096] = { 0 }; | |
unsigned long long x = 1; | |
printf("hello %lld", x); | |
} |
This file contains 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
(module | |
(type $FUNCSIG$ii (func (param i32) (result i32))) | |
(type $FUNCSIG$iii (func (param i32 i32) (result i32))) | |
(import "env" "printf" (func $printf (param i32 i32) (result i32))) | |
(table 0 anyfunc) | |
(memory $0 1) | |
(data (i32.const 4) " \00\00") | |
(data (i32.const 16) "hello %lld\00") | |
(export "memory" (memory $0)) | |
(export "main" (func $main)) | |
(func $main (result i32) | |
(local $0 i32) | |
(i32.store offset=4 | |
(i32.const 0) | |
(tee_local $0 | |
(i32.sub | |
(i32.load offset=4 | |
(i32.const 0) | |
) | |
(i32.const 16) | |
) | |
) | |
) | |
(i64.store | |
(get_local $0) | |
(i64.const 1) | |
) | |
(drop | |
(call $printf | |
(i32.const 16) | |
(get_local $0) | |
) | |
) | |
(i32.store offset=4 | |
(i32.const 0) | |
(i32.add | |
(get_local $0) | |
(i32.const 16) | |
) | |
) | |
(i32.const 0) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment