Created
July 27, 2020 16:41
-
-
Save moyix/e75d21ddea480d3e2ac72baf3dc1facf to your computer and use it in GitHub Desktop.
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
// gcc z3ex.c -o z3ex -l z3 | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
#include "z3.h" | |
int main(void) { | |
Z3_config cfg; | |
Z3_context ctx; | |
cfg = Z3_mk_config(); | |
ctx = Z3_mk_context(cfg); | |
Z3_sort I = Z3_mk_bv_sort(ctx, 64); | |
Z3_ast x = Z3_mk_int64(ctx, -5, I); // works if you change this to 5 | |
Z3_string s = Z3_ast_to_string(ctx, x); | |
printf("%s\n", s); | |
int64_t x_val = 0; | |
if (Z3_get_numeral_int64(ctx, x, &x_val)) { | |
printf("Success: x = %" PRId64 "\n", x_val); | |
} | |
else { | |
printf("Failed.\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment